= F extends (...args: infer A) => any ? A : never;
+
+export { baseWatch }
+
+/**
+ * 定义一个veact组件
+ * @param v 类似vue的定义对象
+ * @returns
+ */
+export declare function defineSetupComponent(v: ISetupComponent
): (props: P) => default_2.JSX.Element;
+
+declare type IfAny = 0 extends 1 & T ? Y : N;
+
+export declare interface ISetupComponent {
+ setup(p: P): T;
+ render(ctx: T): ReactElement;
+}
+
+declare type MapSources = {
+ [K in keyof T]: T[K] extends WatchSource ? MaybeUndefined : T[K] extends object ? MaybeUndefined : never;
+};
+
+declare type MaybeUndefined = I extends true ? T | undefined : T;
+
+export declare type MultiWatchSources = (WatchSource | object)[];
+
+/**
+ * 对应mobx的组件
+ * 函数中不能调用hook
+ */
+export declare function Observer({ children }: {
+ children: () => ReactElement;
+}): ReactElement>;
+
+/**
+ * The function is called right before the component is unmounted.
+ *
+ * @param fn
+ * @see {@link https://react.dev/reference/react/Component#componentwillunmount React `componentWillUnmount()`}
+ */
+export declare function onBeforeUnmount(fn: () => void): void;
+
+/**
+ * @module veact.lifecycle
+ * @author Surmon
+ */
+/**
+ * The function is called right after the component is mounted.
+ *
+ * @param fn
+ * @see {@link https://react.dev/reference/react/Component#componentdidmount React `componentDidMount()`}
+ */
+export declare function onMounted(fn: () => any): void;
+
+/**
+ * The function is called immediately after the component is re-rendered with updated props or state.
+ * This method is not invoked during the initial render.
+ *
+ * @param fn
+ * @see {@link https://react.dev/reference/react/Component#componentdidupdate React `componentDidUpdate()`}
+ */
+export declare function onUpdated(fn: () => void): void;
+
+export declare function SetupComponentRenderer(p: {
+ target: ISetupComponent;
+ props: any;
+}): default_2.JSX.Element;
+
+/**
+ * Takes a getter function and returns a readonly reactive ref object for the
+ * returned value from the getter. It can also take an object with get and set
+ * functions to create a writable ref object.
+ *
+ * @param getter - Function that produces the next value.
+ * @param debugOptions - For debugging. See {@link https://vuejs.org/guide/extras/reactivity-in-depth.html#computed-debugging Vue Computed Debugging}.
+ * @see {@link https://vuejs.org/api/reactivity-core.html#computed Vue `computed()`}
+ *
+ * @example
+ * ```js
+ * // Creating a readonly computed ref:
+ * const count = useRef(1)
+ * const plusOne = useComputed(() => count.value + 1)
+ *
+ * console.log(plusOne.value) // 2
+ * plusOne.value++ // error
+ * ```
+ *
+ * @example
+ * ```js
+ * // Creating a writable computed ref:
+ * const count = useRef(1)
+ * const plusOne = useComputed({
+ * get: () => count.value + 1,
+ * set: (val) => {
+ * count.value = val - 1
+ * }
+ * })
+ *
+ * plusOne.value = 1
+ * console.log(count.value) // 0
+ * ```
+ */
+export declare function useComputed(getter: ComputedGetter, debugOptions?: DebuggerOptions): ComputedRef;
+
+export declare function useComputed(options: WritableComputedOptions, debugOptions?: DebuggerOptions): WritableComputedRef;
+
+/**
+ * Creates a customized ref with explicit control over its dependency tracking
+ * and updates triggering.
+ *
+ * @param factory - The function that receives the `track` and `trigger` callbacks.
+ * @see {@link https://vuejs.org/api/reactivity-advanced.html#customref Vue `customRef()`}
+ */
+export declare function useCustomRef(factory: CustomRefFactory): Ref;
+
+/**
+ * Creates an effect scope object which can capture the reactive effects (i.e.
+ * computed and watchers) created within it so that these effects can be
+ * disposed together. For detailed use cases of this API, please consult its
+ * corresponding {@link https://github.com/vuejs/rfcs/blob/master/active-rfcs/0041-reactivity-effect-scope.md | RFC}.
+ *
+ * @param detached - Can be used to create a "detached" effect scope.
+ * @see {@link https://vuejs.org/api/reactivity-advanced.html#effectscope Vue `effectScope()`}
+ */
+export declare function useEffectScope(...args: ArgumentTypes): EffectScope;
+
+/**
+ * Returns a reactive proxy of the object.
+ *
+ * The reactive conversion is "deep": it affects all nested properties. A
+ * reactive object also deeply unwraps any properties that are refs while
+ * maintaining reactivity.
+ *
+ * @param target - The source object.
+ * @see {@link https://vuejs.org/api/reactivity-core.html#reactive Vue `reactive()`}
+ *
+ * @example
+ * ```js
+ * const obj = useReactive({ count: 0 })
+ * ```
+ */
+export declare function useReactive(target: T): Reactive;
+
+/**
+ * @module veact.reactivity
+ * @author Surmon
+ */
+/**
+ * Converts some of the 'raw Vue' data, which is not already wrapped in a hook,
+ * into reactive hook data to ensure proper reactivity within the component.
+ *
+ * @param getter - A function that returns the data to be deeply watched.
+ * @example
+ * ```tsx
+ * import React from 'react'
+ * import { ref, useReactivity } from 'veact'
+ *
+ * const countRef = ref(0)
+ *
+ * export const Component: React.FC = () => {
+ * // Convert to a reactivity hook
+ * const count = useReactivity(() => countRef)
+ * const increment = () => {
+ * count.value++
+ * }
+ *
+ * return (
+ *
+ * {count.value}
+ *
+ *
+ * )
+ * }
+ * ```
+ */
+export declare function useReactivity(getter: () => T): T;
+
+/**
+ * Takes an object (reactive or plain) or a ref and returns a readonly proxy to
+ * the original.
+ *
+ * A readonly proxy is deep: any nested property accessed will be readonly as
+ * well. It also has the same ref-unwrapping behavior as {@link useReactive()},
+ * except the unwrapped values will also be made readonly.
+ *
+ * @param target - The source object.
+ * @see {@link https://vuejs.org/api/reactivity-core.html#readonly Vue `readonly()`}
+ *
+ * @example
+ * ```js
+ * const original = useReactive({ count: 0 })
+ * const copy = useReadonly(original)
+ *
+ * useWatchEffect(() => {
+ * // works for reactivity tracking
+ * console.log(copy.count)
+ * })
+ *
+ * // mutating original will trigger watchers relying on the copy
+ * original.count++
+ *
+ * // mutating the copy will fail and result in a warning
+ * copy.count++ // warning!
+ * ```
+ */
+export declare function useReadonly(target: T): DeepReadonly>;
+
+/**
+ * Takes an inner value and returns a reactive and mutable ref object, which
+ * has a single property `.value` that points to the inner value.
+ *
+ * @param value - The object to wrap in the ref.
+ * @see {@link https://vuejs.org/api/reactivity-core.html#ref Vue `ref()`}
+ *
+ * @example
+ * ```js
+ * const count = useRef(0)
+ * console.log(count.value) // 0
+ *
+ * count.value = 1
+ * console.log(count.value) // 1
+ * ```
+ */
+export declare function useRef(value: T): [T] extends [Ref] ? IfAny, T> : Ref, UnwrapRef | T>;
+
+export declare function useRef(): Ref;
+
+/**
+ * Shallow version of {@link useReactive()}.
+ *
+ * Unlike {@link useReactive()}, there is no deep conversion: only root-level
+ * properties are reactive for a shallow reactive object. Property values are
+ * stored and exposed as-is - this also means properties with ref values will
+ * not be automatically unwrapped.
+ *
+ * @param target - The source object.
+ * @see {@link https://vuejs.org/api/reactivity-advanced.html#shallowreactive Vue `shallowReactive()`}
+ *
+ * @example
+ * ```js
+ * const state = useShallowReactive({
+ * foo: 1,
+ * nested: {
+ * bar: 2
+ * }
+ * })
+ *
+ * // mutating state's own properties is reactive
+ * state.foo++
+ *
+ * // ...but does not convert nested objects
+ * isReactive(state.nested) // false
+ *
+ * // NOT reactive
+ * state.nested.bar++
+ * ```
+ */
+export declare function useShallowReactive(target: T): ShallowReactive;
+
+/**
+ * Shallow version of {@link useReadonly()}.
+ *
+ * Unlike {@link useReadonly()}, there is no deep conversion: only root-level
+ * properties are made readonly. Property values are stored and exposed as-is -
+ * this also means properties with ref values will not be automatically
+ * unwrapped.
+ *
+ * @param target - The source object.
+ * @see {@link https://vuejs.org/api/reactivity-advanced.html#shallowreadonly Vue `shallowReadonly()`}
+ *
+ * @example
+ * ```js
+ * const state = useShallowReadonly({
+ * foo: 1,
+ * nested: {
+ * bar: 2
+ * }
+ * })
+ *
+ * // mutating state's own properties will fail
+ * state.foo++
+ *
+ * // ...but works on nested objects
+ * isReadonly(state.nested) // false
+ *
+ * // works
+ * state.nested.bar++
+ * ```
+ */
+export declare function useShallowReadonly(target: T): Readonly;
+
+/**
+ * Shallow version of {@link useRef()}.
+ *
+ * @param value - The "inner value" for the shallow ref.
+ * @see {@link https://vuejs.org/api/reactivity-advanced.html#shallowref Vue `shallowRef()`}
+ *
+ * @example
+ * ```js
+ * const state = useShallowRef({ count: 1 })
+ * // does NOT trigger change
+ * state.value.count = 2
+ * // does trigger change
+ * state.value = { count: 2 }
+ * ```
+ */
+export declare function useShallowRef(value: T): Ref extends T ? (T extends Ref ? IfAny, T> : ShallowRef) : ShallowRef;
+
+export declare function useShallowRef(): ShallowRef;
+
+export declare const useWatch: (InstanceType>>)["watch"];
+
+/**
+ * Runs a function immediately while reactively tracking its dependencies and re-runs it whenever the dependencies are changed.
+ *
+ * @param effect - The effect function to run.
+ * @param options - An optional options object that can be used to adjust the effect's flush timing or to debug the effect's dependencies; the `flush` option is not supported compared to Vue (3.5.0).
+ * @see {@link https://vuejs.org/api/reactivity-core.html#watcheffect Vue `watchEffect()`}
+ *
+ * @example
+ * ```js
+ * const count = useRef(0)
+ * useWatchEffect(() => console.log(count.value))
+ * // -> logs 0
+ *
+ * count.value++
+ * // -> logs 1
+ * ```
+ */
+export declare const useWatchEffect: typeof watchEffect;
+
+export declare const watch: {
+ = false>(source: WatchSource, callback: WatchCallback, options?: WatchOptions | undefined): WatchHandle;
+ , Immediate extends Readonly = false>(sources: T | readonly [...T], callback: [T] extends [ReactiveMarker] ? WatchCallback : WatchCallback< { [K in keyof T]: T[K] extends WatchSource ? V : T[K] extends object ? T[K] : never; }, { [K_1 in keyof T]: T[K_1] extends WatchSource ? Immediate extends true ? V | undefined : V : T[K_1] extends object ? Immediate extends true ? T[K_1] | undefined : T[K_1] : never; }>, options?: WatchOptions | undefined): WatchHandle;
+ = false>(sources: [...T], callback: WatchCallback< { [K in keyof T]: T[K] extends WatchSource ? V : T[K] extends object ? T[K] : never; }, { [K_1 in keyof T]: T[K_1] extends WatchSource ? Immediate extends true ? V | undefined : V : T[K_1] extends object ? Immediate extends true ? T[K_1] | undefined : T[K_1] : never; }>, options?: WatchOptions | undefined): WatchHandle;
+ = false>(source: T, callback: WatchCallback, options?: WatchOptions | undefined): WatchHandle;
+};
+
+/**
+ * Runs a function immediately while reactively tracking its dependencies and re-runs it whenever the dependencies are changed.
+ *
+ * @param effectFn - The effect function to run.
+ * @param options - An optional options object that can be used to adjust the effect's flush timing or to debug the effect's dependencies; the `flush` option is not supported compared to Vue (3.5.0).
+ * @see {@link https://vuejs.org/api/reactivity-core.html#watcheffect Vue `watchEffect()`}
+ *
+ * @example
+ * ```js
+ * const count = ref(0)
+ * watchEffect(() => console.log(count.value))
+ * // -> logs 0
+ *
+ * count.value++
+ * // -> logs 1
+ * ```
+ */
+export declare function watchEffect(effectFn: WatchEffect, options?: WatchEffectOptions): WatchHandle;
+
+export declare type WatchEffectOptions = DebuggerOptions;
+
+/**
+ * Watches one or more reactive data sources and invokes a callback function when the sources change.
+ *
+ * @param source - The watcher's source.
+ * @param callback - This function will be called when the source is changed.
+ * @param options - An optional options object that does not support the `flush` option compared to Vue (3.5.0).
+ * @see {@link https://vuejs.org/api/reactivity-core.html#watch Vue `watch()`}
+ *
+ * @example
+ * ```js
+ * const count = useRef(0)
+ * useWatch(count, (count, prevCount) => {
+ * // ...
+ * })
+ * ```
+ */
+export declare const watcherInstance: WatchHelper;
+
+/**
+ * Watches one or more reactive data sources and invokes a callback function when the sources change.
+ *
+ * @param source - The watcher's source.
+ * @param callback - This function will be called when the source is changed.
+ * @param options - An optional options object that does not support the `flush` option compared to Vue (3.5.0).
+ * @see {@link https://vuejs.org/api/reactivity-core.html#watch Vue `watch()`}
+ *
+ * @example
+ * ```js
+ * const count = ref(0)
+ * watch(count, (count, prevCount) => {
+ * // ...
+ * })
+ * ```
+ */
+declare class WatchHelper {
+ watch = false>(source: WatchSource, callback: WatchCallback>, options?: WatchOptions): R;
+ watch, Immediate extends Readonly = false>(sources: readonly [...T] | T, callback: [T] extends [ReactiveMarker] ? WatchCallback> : WatchCallback, MapSources>, options?: WatchOptions): R;
+ watch = false>(sources: [...T], callback: WatchCallback, MapSources>, options?: WatchOptions): R;
+ watch = false>(source: T, callback: WatchCallback>, options?: WatchOptions): R;
+}
+
+export declare interface WatchOptions extends DebuggerOptions {
+ immediate?: Immediate;
+ deep?: boolean | number;
+ once?: boolean;
+}
+
+
+export * from "@vue/reactivity";
+
+export { }
diff --git a/dist/veact.js b/dist/veact.js
new file mode 100644
index 0000000..b3f9d33
--- /dev/null
+++ b/dist/veact.js
@@ -0,0 +1,1829 @@
+import or, { useEffect as Fe, useRef as ie, useCallback as be, useReducer as Gr, useMemo as Hr, useState as L } from "react";
+import { watch as ur, isRef as Xr, isReactive as Zr, ref as Qr, shallowRef as et, customRef as rt, reactive as tt, shallowReactive as nt, readonly as it, shallowReadonly as at, computed as st, effectScope as ot } from "@vue/reactivity";
+export * from "@vue/reactivity";
+import { watch as pn } from "@vue/reactivity";
+/*!
+ * veact v1.1.0
+ * https://github.com/veactjs/veact
+ *
+ * Includes @vue/reactivity
+ * https://github.com/vuejs/core/tree/main/packages/reactivity
+ *
+ * (c) 2021-present Surmon and Veact contributors.
+ * Released under the MIT License.
+ *
+ * Date: 2024-09-19T04:33:55.899Z
+ */
+function ut(r) {
+ Fe(() => {
+ r();
+ }, []);
+}
+function fr(r) {
+ Fe(() => () => {
+ r();
+ }, []);
+}
+function Zt(r) {
+ const t = ie(!1);
+ Fe(() => {
+ t.current ? r() : t.current = !0;
+ });
+}
+const Pe = "veact", lr = {
+ ...console,
+ log(...r) {
+ console.log(`[${Pe}]`, ...r);
+ },
+ warn(...r) {
+ console.warn(`[${Pe}]`, ...r);
+ },
+ error(...r) {
+ console.error(`[${Pe}]`, ...r);
+ }
+};
+function cr(r) {
+ const t = ie(!0), e = ie(void 0);
+ return t.current && (t.current = !1, e.current = r()), e.current;
+}
+class ft {
+ // implementation
+ watch(t, e, i = {}) {
+ return ur(t, e, {
+ ...i,
+ onWarn: lr.warn,
+ scheduler: (s) => s()
+ });
+ }
+}
+const Ce = new ft(), V = (r, t, e = {}) => {
+ const i = ie(), s = be(() => {
+ i.current && (i.current(), i.current = void 0);
+ }, []), a = be(() => {
+ i.current && s(), i.current = Ce.watch(r, (...o) => {
+ console.log("触发更新"), t(...o);
+ }, e);
+ }, []);
+ return ut(() => {
+ console.log("执行监听"), a();
+ }), fr(() => {
+ console.log("取消监听"), s();
+ }), cr(() => {
+ console.log("初始监听"), a();
+ }), i;
+};
+var $ = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Me = { exports: {} }, he = {};
+/**
+ * @license React
+ * react-jsx-runtime.production.min.js
+ *
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+var ir;
+function lt() {
+ if (ir) return he;
+ ir = 1;
+ var r = or, t = Symbol.for("react.element"), e = Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty, s = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, a = { key: !0, ref: !0, __self: !0, __source: !0 };
+ function o(l, f, h) {
+ var d, g = {}, p = null, m = null;
+ h !== void 0 && (p = "" + h), f.key !== void 0 && (p = "" + f.key), f.ref !== void 0 && (m = f.ref);
+ for (d in f) i.call(f, d) && !a.hasOwnProperty(d) && (g[d] = f[d]);
+ if (l && l.defaultProps) for (d in f = l.defaultProps, f) g[d] === void 0 && (g[d] = f[d]);
+ return { $$typeof: t, type: l, key: p, ref: m, props: g, _owner: s.current };
+ }
+ return he.Fragment = e, he.jsx = o, he.jsxs = o, he;
+}
+var ve = {};
+/**
+ * @license React
+ * react-jsx-runtime.development.js
+ *
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+var ar;
+function ct() {
+ return ar || (ar = 1, process.env.NODE_ENV !== "production" && function() {
+ var r = or, t = Symbol.for("react.element"), e = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), a = Symbol.for("react.profiler"), o = Symbol.for("react.provider"), l = Symbol.for("react.context"), f = Symbol.for("react.forward_ref"), h = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), g = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), m = Symbol.for("react.offscreen"), A = Symbol.iterator, Y = "@@iterator";
+ function J(n) {
+ if (n === null || typeof n != "object")
+ return null;
+ var u = A && n[A] || n[Y];
+ return typeof u == "function" ? u : null;
+ }
+ var x = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
+ function k(n) {
+ {
+ for (var u = arguments.length, v = new Array(u > 1 ? u - 1 : 0), y = 1; y < u; y++)
+ v[y - 1] = arguments[y];
+ we("error", n, v);
+ }
+ }
+ function we(n, u, v) {
+ {
+ var y = x.ReactDebugCurrentFrame, R = y.getStackAddendum();
+ R !== "" && (u += "%s", v = v.concat([R]));
+ var E = v.map(function(w) {
+ return String(w);
+ });
+ E.unshift("Warning: " + u), Function.prototype.apply.call(console[n], console, E);
+ }
+ }
+ var q = !1, _ = !1, B = !1, O = !1, Z = !1, oe;
+ oe = Symbol.for("react.module.reference");
+ function W(n) {
+ return !!(typeof n == "string" || typeof n == "function" || n === i || n === a || Z || n === s || n === h || n === d || O || n === m || q || _ || B || typeof n == "object" && n !== null && (n.$$typeof === p || n.$$typeof === g || n.$$typeof === o || n.$$typeof === l || n.$$typeof === f || // This needs to include all possible module reference object
+ // types supported by any Flight configuration anywhere since
+ // we don't know which Flight build this will end up being used
+ // with.
+ n.$$typeof === oe || n.getModuleId !== void 0));
+ }
+ function ue(n, u, v) {
+ var y = n.displayName;
+ if (y)
+ return y;
+ var R = u.displayName || u.name || "";
+ return R !== "" ? v + "(" + R + ")" : v;
+ }
+ function fe(n) {
+ return n.displayName || "Context";
+ }
+ function M(n) {
+ if (n == null)
+ return null;
+ if (typeof n.tag == "number" && k("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof n == "function")
+ return n.displayName || n.name || null;
+ if (typeof n == "string")
+ return n;
+ switch (n) {
+ case i:
+ return "Fragment";
+ case e:
+ return "Portal";
+ case a:
+ return "Profiler";
+ case s:
+ return "StrictMode";
+ case h:
+ return "Suspense";
+ case d:
+ return "SuspenseList";
+ }
+ if (typeof n == "object")
+ switch (n.$$typeof) {
+ case l:
+ var u = n;
+ return fe(u) + ".Consumer";
+ case o:
+ var v = n;
+ return fe(v._context) + ".Provider";
+ case f:
+ return ue(n, n.render, "ForwardRef");
+ case g:
+ var y = n.displayName || null;
+ return y !== null ? y : M(n.type) || "Memo";
+ case p: {
+ var R = n, E = R._payload, w = R._init;
+ try {
+ return M(w(E));
+ } catch {
+ return null;
+ }
+ }
+ }
+ return null;
+ }
+ var F = Object.assign, K = 0, Q, G, H, X, de, Ye, qe;
+ function Be() {
+ }
+ Be.__reactDisabledLog = !0;
+ function Rr() {
+ {
+ if (K === 0) {
+ Q = console.log, G = console.info, H = console.warn, X = console.error, de = console.group, Ye = console.groupCollapsed, qe = console.groupEnd;
+ var n = {
+ configurable: !0,
+ enumerable: !0,
+ value: Be,
+ writable: !0
+ };
+ Object.defineProperties(console, {
+ info: n,
+ log: n,
+ warn: n,
+ error: n,
+ group: n,
+ groupCollapsed: n,
+ groupEnd: n
+ });
+ }
+ K++;
+ }
+ }
+ function Er() {
+ {
+ if (K--, K === 0) {
+ var n = {
+ configurable: !0,
+ enumerable: !0,
+ writable: !0
+ };
+ Object.defineProperties(console, {
+ log: F({}, n, {
+ value: Q
+ }),
+ info: F({}, n, {
+ value: G
+ }),
+ warn: F({}, n, {
+ value: H
+ }),
+ error: F({}, n, {
+ value: X
+ }),
+ group: F({}, n, {
+ value: de
+ }),
+ groupCollapsed: F({}, n, {
+ value: Ye
+ }),
+ groupEnd: F({}, n, {
+ value: qe
+ })
+ });
+ }
+ K < 0 && k("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
+ }
+ }
+ var Re = x.ReactCurrentDispatcher, Ee;
+ function ye(n, u, v) {
+ {
+ if (Ee === void 0)
+ try {
+ throw Error();
+ } catch (R) {
+ var y = R.stack.trim().match(/\n( *(at )?)/);
+ Ee = y && y[1] || "";
+ }
+ return `
+` + Ee + n;
+ }
+ }
+ var Oe = !1, pe;
+ {
+ var Or = typeof WeakMap == "function" ? WeakMap : Map;
+ pe = new Or();
+ }
+ function Le(n, u) {
+ if (!n || Oe)
+ return "";
+ {
+ var v = pe.get(n);
+ if (v !== void 0)
+ return v;
+ }
+ var y;
+ Oe = !0;
+ var R = Error.prepareStackTrace;
+ Error.prepareStackTrace = void 0;
+ var E;
+ E = Re.current, Re.current = null, Rr();
+ try {
+ if (u) {
+ var w = function() {
+ throw Error();
+ };
+ if (Object.defineProperty(w.prototype, "props", {
+ set: function() {
+ throw Error();
+ }
+ }), typeof Reflect == "object" && Reflect.construct) {
+ try {
+ Reflect.construct(w, []);
+ } catch (I) {
+ y = I;
+ }
+ Reflect.construct(n, [], w);
+ } else {
+ try {
+ w.call();
+ } catch (I) {
+ y = I;
+ }
+ n.call(w.prototype);
+ }
+ } else {
+ try {
+ throw Error();
+ } catch (I) {
+ y = I;
+ }
+ n();
+ }
+ } catch (I) {
+ if (I && y && typeof I.stack == "string") {
+ for (var b = I.stack.split(`
+`), D = y.stack.split(`
+`), T = b.length - 1, j = D.length - 1; T >= 1 && j >= 0 && b[T] !== D[j]; )
+ j--;
+ for (; T >= 1 && j >= 0; T--, j--)
+ if (b[T] !== D[j]) {
+ if (T !== 1 || j !== 1)
+ do
+ if (T--, j--, j < 0 || b[T] !== D[j]) {
+ var U = `
+` + b[T].replace(" at new ", " at ");
+ return n.displayName && U.includes("") && (U = U.replace("", n.displayName)), typeof n == "function" && pe.set(n, U), U;
+ }
+ while (T >= 1 && j >= 0);
+ break;
+ }
+ }
+ } finally {
+ Oe = !1, Re.current = E, Er(), Error.prepareStackTrace = R;
+ }
+ var ne = n ? n.displayName || n.name : "", ee = ne ? ye(ne) : "";
+ return typeof n == "function" && pe.set(n, ee), ee;
+ }
+ function xr(n, u, v) {
+ return Le(n, !1);
+ }
+ function Sr(n) {
+ var u = n.prototype;
+ return !!(u && u.isReactComponent);
+ }
+ function _e(n, u, v) {
+ if (n == null)
+ return "";
+ if (typeof n == "function")
+ return Le(n, Sr(n));
+ if (typeof n == "string")
+ return ye(n);
+ switch (n) {
+ case h:
+ return ye("Suspense");
+ case d:
+ return ye("SuspenseList");
+ }
+ if (typeof n == "object")
+ switch (n.$$typeof) {
+ case f:
+ return xr(n.render);
+ case g:
+ return _e(n.type, u, v);
+ case p: {
+ var y = n, R = y._payload, E = y._init;
+ try {
+ return _e(E(R), u, v);
+ } catch {
+ }
+ }
+ }
+ return "";
+ }
+ var le = Object.prototype.hasOwnProperty, Ve = {}, Ne = x.ReactDebugCurrentFrame;
+ function ge(n) {
+ if (n) {
+ var u = n._owner, v = _e(n.type, n._source, u ? u.type : null);
+ Ne.setExtraStackFrame(v);
+ } else
+ Ne.setExtraStackFrame(null);
+ }
+ function Tr(n, u, v, y, R) {
+ {
+ var E = Function.call.bind(le);
+ for (var w in n)
+ if (E(n, w)) {
+ var b = void 0;
+ try {
+ if (typeof n[w] != "function") {
+ var D = Error((y || "React class") + ": " + v + " type `" + w + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof n[w] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
+ throw D.name = "Invariant Violation", D;
+ }
+ b = n[w](u, w, y, v, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
+ } catch (T) {
+ b = T;
+ }
+ b && !(b instanceof Error) && (ge(R), k("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", y || "React class", v, w, typeof b), ge(null)), b instanceof Error && !(b.message in Ve) && (Ve[b.message] = !0, ge(R), k("Failed %s type: %s", v, b.message), ge(null));
+ }
+ }
+ }
+ var jr = Array.isArray;
+ function xe(n) {
+ return jr(n);
+ }
+ function kr(n) {
+ {
+ var u = typeof Symbol == "function" && Symbol.toStringTag, v = u && n[Symbol.toStringTag] || n.constructor.name || "Object";
+ return v;
+ }
+ }
+ function Ar(n) {
+ try {
+ return Je(n), !1;
+ } catch {
+ return !0;
+ }
+ }
+ function Je(n) {
+ return "" + n;
+ }
+ function Ke(n) {
+ if (Ar(n))
+ return k("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", kr(n)), Je(n);
+ }
+ var ce = x.ReactCurrentOwner, Pr = {
+ key: !0,
+ ref: !0,
+ __self: !0,
+ __source: !0
+ }, Ge, He, Se;
+ Se = {};
+ function Cr(n) {
+ if (le.call(n, "ref")) {
+ var u = Object.getOwnPropertyDescriptor(n, "ref").get;
+ if (u && u.isReactWarning)
+ return !1;
+ }
+ return n.ref !== void 0;
+ }
+ function Mr(n) {
+ if (le.call(n, "key")) {
+ var u = Object.getOwnPropertyDescriptor(n, "key").get;
+ if (u && u.isReactWarning)
+ return !1;
+ }
+ return n.key !== void 0;
+ }
+ function Dr(n, u) {
+ if (typeof n.ref == "string" && ce.current && u && ce.current.stateNode !== u) {
+ var v = M(ce.current.type);
+ Se[v] || (k('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', M(ce.current.type), n.ref), Se[v] = !0);
+ }
+ }
+ function Fr(n, u) {
+ {
+ var v = function() {
+ Ge || (Ge = !0, k("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", u));
+ };
+ v.isReactWarning = !0, Object.defineProperty(n, "key", {
+ get: v,
+ configurable: !0
+ });
+ }
+ }
+ function Ir(n, u) {
+ {
+ var v = function() {
+ He || (He = !0, k("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", u));
+ };
+ v.isReactWarning = !0, Object.defineProperty(n, "ref", {
+ get: v,
+ configurable: !0
+ });
+ }
+ }
+ var Wr = function(n, u, v, y, R, E, w) {
+ var b = {
+ // This tag allows us to uniquely identify this as a React Element
+ $$typeof: t,
+ // Built-in properties that belong on the element
+ type: n,
+ key: u,
+ ref: v,
+ props: w,
+ // Record the component responsible for creating this element.
+ _owner: E
+ };
+ return b._store = {}, Object.defineProperty(b._store, "validated", {
+ configurable: !1,
+ enumerable: !1,
+ writable: !0,
+ value: !1
+ }), Object.defineProperty(b, "_self", {
+ configurable: !1,
+ enumerable: !1,
+ writable: !1,
+ value: y
+ }), Object.defineProperty(b, "_source", {
+ configurable: !1,
+ enumerable: !1,
+ writable: !1,
+ value: R
+ }), Object.freeze && (Object.freeze(b.props), Object.freeze(b)), b;
+ };
+ function Ur(n, u, v, y, R) {
+ {
+ var E, w = {}, b = null, D = null;
+ v !== void 0 && (Ke(v), b = "" + v), Mr(u) && (Ke(u.key), b = "" + u.key), Cr(u) && (D = u.ref, Dr(u, R));
+ for (E in u)
+ le.call(u, E) && !Pr.hasOwnProperty(E) && (w[E] = u[E]);
+ if (n && n.defaultProps) {
+ var T = n.defaultProps;
+ for (E in T)
+ w[E] === void 0 && (w[E] = T[E]);
+ }
+ if (b || D) {
+ var j = typeof n == "function" ? n.displayName || n.name || "Unknown" : n;
+ b && Fr(w, j), D && Ir(w, j);
+ }
+ return Wr(n, b, D, R, y, ce.current, w);
+ }
+ }
+ var Te = x.ReactCurrentOwner, Xe = x.ReactDebugCurrentFrame;
+ function te(n) {
+ if (n) {
+ var u = n._owner, v = _e(n.type, n._source, u ? u.type : null);
+ Xe.setExtraStackFrame(v);
+ } else
+ Xe.setExtraStackFrame(null);
+ }
+ var je;
+ je = !1;
+ function ke(n) {
+ return typeof n == "object" && n !== null && n.$$typeof === t;
+ }
+ function Ze() {
+ {
+ if (Te.current) {
+ var n = M(Te.current.type);
+ if (n)
+ return `
+
+Check the render method of \`` + n + "`.";
+ }
+ return "";
+ }
+ }
+ function $r(n) {
+ return "";
+ }
+ var Qe = {};
+ function zr(n) {
+ {
+ var u = Ze();
+ if (!u) {
+ var v = typeof n == "string" ? n : n.displayName || n.name;
+ v && (u = `
+
+Check the top-level render call using <` + v + ">.");
+ }
+ return u;
+ }
+ }
+ function er(n, u) {
+ {
+ if (!n._store || n._store.validated || n.key != null)
+ return;
+ n._store.validated = !0;
+ var v = zr(u);
+ if (Qe[v])
+ return;
+ Qe[v] = !0;
+ var y = "";
+ n && n._owner && n._owner !== Te.current && (y = " It was passed a child from " + M(n._owner.type) + "."), te(n), k('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', v, y), te(null);
+ }
+ }
+ function rr(n, u) {
+ {
+ if (typeof n != "object")
+ return;
+ if (xe(n))
+ for (var v = 0; v < n.length; v++) {
+ var y = n[v];
+ ke(y) && er(y, u);
+ }
+ else if (ke(n))
+ n._store && (n._store.validated = !0);
+ else if (n) {
+ var R = J(n);
+ if (typeof R == "function" && R !== n.entries)
+ for (var E = R.call(n), w; !(w = E.next()).done; )
+ ke(w.value) && er(w.value, u);
+ }
+ }
+ }
+ function Yr(n) {
+ {
+ var u = n.type;
+ if (u == null || typeof u == "string")
+ return;
+ var v;
+ if (typeof u == "function")
+ v = u.propTypes;
+ else if (typeof u == "object" && (u.$$typeof === f || // Note: Memo only checks outer props here.
+ // Inner props are checked in the reconciler.
+ u.$$typeof === g))
+ v = u.propTypes;
+ else
+ return;
+ if (v) {
+ var y = M(u);
+ Tr(v, n.props, "prop", y, n);
+ } else if (u.PropTypes !== void 0 && !je) {
+ je = !0;
+ var R = M(u);
+ k("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", R || "Unknown");
+ }
+ typeof u.getDefaultProps == "function" && !u.getDefaultProps.isReactClassApproved && k("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
+ }
+ }
+ function qr(n) {
+ {
+ for (var u = Object.keys(n.props), v = 0; v < u.length; v++) {
+ var y = u[v];
+ if (y !== "children" && y !== "key") {
+ te(n), k("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", y), te(null);
+ break;
+ }
+ }
+ n.ref !== null && (te(n), k("Invalid attribute `ref` supplied to `React.Fragment`."), te(null));
+ }
+ }
+ var tr = {};
+ function nr(n, u, v, y, R, E) {
+ {
+ var w = W(n);
+ if (!w) {
+ var b = "";
+ (n === void 0 || typeof n == "object" && n !== null && Object.keys(n).length === 0) && (b += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
+ var D = $r();
+ D ? b += D : b += Ze();
+ var T;
+ n === null ? T = "null" : xe(n) ? T = "array" : n !== void 0 && n.$$typeof === t ? (T = "<" + (M(n.type) || "Unknown") + " />", b = " Did you accidentally export a JSX literal instead of a component?") : T = typeof n, k("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", T, b);
+ }
+ var j = Ur(n, u, v, R, E);
+ if (j == null)
+ return j;
+ if (w) {
+ var U = u.children;
+ if (U !== void 0)
+ if (y)
+ if (xe(U)) {
+ for (var ne = 0; ne < U.length; ne++)
+ rr(U[ne], n);
+ Object.freeze && Object.freeze(U);
+ } else
+ k("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
+ else
+ rr(U, n);
+ }
+ if (le.call(u, "key")) {
+ var ee = M(n), I = Object.keys(u).filter(function(Kr) {
+ return Kr !== "key";
+ }), Ae = I.length > 0 ? "{key: someKey, " + I.join(": ..., ") + ": ...}" : "{key: someKey}";
+ if (!tr[ee + Ae]) {
+ var Jr = I.length > 0 ? "{" + I.join(": ..., ") + ": ...}" : "{}";
+ k(`A props object containing a "key" prop is being spread into JSX:
+ let props = %s;
+ <%s {...props} />
+React keys must be passed directly to JSX without using spread:
+ let props = %s;
+ <%s key={someKey} {...props} />`, Ae, ee, Jr, ee), tr[ee + Ae] = !0;
+ }
+ }
+ return n === i ? qr(j) : Yr(j), j;
+ }
+ }
+ function Br(n, u, v) {
+ return nr(n, u, v, !0);
+ }
+ function Lr(n, u, v) {
+ return nr(n, u, v, !1);
+ }
+ var Vr = Lr, Nr = Br;
+ ve.Fragment = i, ve.jsx = Vr, ve.jsxs = Nr;
+ }()), ve;
+}
+process.env.NODE_ENV === "production" ? Me.exports = lt() : Me.exports = ct();
+var hr = Me.exports;
+const ht = (r) => r + 1, N = () => Gr(ht, 0)[1];
+var c = {};
+function S(r, e) {
+ var e = e || {};
+ this._head = 0, this._tail = 0, this._capacity = e.capacity, this._capacityMask = 3, this._list = new Array(4), Array.isArray(r) && this._fromArray(r);
+}
+S.prototype.peekAt = function(t) {
+ var e = t;
+ if (e === (e | 0)) {
+ var i = this.size();
+ if (!(e >= i || e < -i))
+ return e < 0 && (e += i), e = this._head + e & this._capacityMask, this._list[e];
+ }
+};
+S.prototype.get = function(t) {
+ return this.peekAt(t);
+};
+S.prototype.peek = function() {
+ if (this._head !== this._tail)
+ return this._list[this._head];
+};
+S.prototype.peekFront = function() {
+ return this.peek();
+};
+S.prototype.peekBack = function() {
+ return this.peekAt(-1);
+};
+Object.defineProperty(S.prototype, "length", {
+ get: function() {
+ return this.size();
+ }
+});
+S.prototype.size = function() {
+ return this._head === this._tail ? 0 : this._head < this._tail ? this._tail - this._head : this._capacityMask + 1 - (this._head - this._tail);
+};
+S.prototype.unshift = function(t) {
+ if (t === void 0) return this.size();
+ var e = this._list.length;
+ return this._head = this._head - 1 + e & this._capacityMask, this._list[this._head] = t, this._tail === this._head && this._growArray(), this._capacity && this.size() > this._capacity && this.pop(), this._head < this._tail ? this._tail - this._head : this._capacityMask + 1 - (this._head - this._tail);
+};
+S.prototype.shift = function() {
+ var t = this._head;
+ if (t !== this._tail) {
+ var e = this._list[t];
+ return this._list[t] = void 0, this._head = t + 1 & this._capacityMask, t < 2 && this._tail > 1e4 && this._tail <= this._list.length >>> 2 && this._shrinkArray(), e;
+ }
+};
+S.prototype.push = function(t) {
+ if (t === void 0) return this.size();
+ var e = this._tail;
+ return this._list[e] = t, this._tail = e + 1 & this._capacityMask, this._tail === this._head && this._growArray(), this._capacity && this.size() > this._capacity && this.shift(), this._head < this._tail ? this._tail - this._head : this._capacityMask + 1 - (this._head - this._tail);
+};
+S.prototype.pop = function() {
+ var t = this._tail;
+ if (t !== this._head) {
+ var e = this._list.length;
+ this._tail = t - 1 + e & this._capacityMask;
+ var i = this._list[this._tail];
+ return this._list[this._tail] = void 0, this._head < 2 && t > 1e4 && t <= e >>> 2 && this._shrinkArray(), i;
+ }
+};
+S.prototype.removeOne = function(t) {
+ var e = t;
+ if (e === (e | 0) && this._head !== this._tail) {
+ var i = this.size(), s = this._list.length;
+ if (!(e >= i || e < -i)) {
+ e < 0 && (e += i), e = this._head + e & this._capacityMask;
+ var a = this._list[e], o;
+ if (t < i / 2) {
+ for (o = t; o > 0; o--)
+ this._list[e] = this._list[e = e - 1 + s & this._capacityMask];
+ this._list[e] = void 0, this._head = this._head + 1 + s & this._capacityMask;
+ } else {
+ for (o = i - 1 - t; o > 0; o--)
+ this._list[e] = this._list[e = e + 1 + s & this._capacityMask];
+ this._list[e] = void 0, this._tail = this._tail - 1 + s & this._capacityMask;
+ }
+ return a;
+ }
+ }
+};
+S.prototype.remove = function(t, e) {
+ var i = t, s, a = e;
+ if (i === (i | 0) && this._head !== this._tail) {
+ var o = this.size(), l = this._list.length;
+ if (!(i >= o || i < -o || e < 1)) {
+ if (i < 0 && (i += o), e === 1 || !e)
+ return s = new Array(1), s[0] = this.removeOne(i), s;
+ if (i === 0 && i + e >= o)
+ return s = this.toArray(), this.clear(), s;
+ i + e > o && (e = o - i);
+ var f;
+ for (s = new Array(e), f = 0; f < e; f++)
+ s[f] = this._list[this._head + i + f & this._capacityMask];
+ if (i = this._head + i & this._capacityMask, t + e === o) {
+ for (this._tail = this._tail - e + l & this._capacityMask, f = e; f > 0; f--)
+ this._list[i = i + 1 + l & this._capacityMask] = void 0;
+ return s;
+ }
+ if (t === 0) {
+ for (this._head = this._head + e + l & this._capacityMask, f = e - 1; f > 0; f--)
+ this._list[i = i + 1 + l & this._capacityMask] = void 0;
+ return s;
+ }
+ if (i < o / 2) {
+ for (this._head = this._head + t + e + l & this._capacityMask, f = t; f > 0; f--)
+ this.unshift(this._list[i = i - 1 + l & this._capacityMask]);
+ for (i = this._head - 1 + l & this._capacityMask; a > 0; )
+ this._list[i = i - 1 + l & this._capacityMask] = void 0, a--;
+ t < 0 && (this._tail = i);
+ } else {
+ for (this._tail = i, i = i + e + l & this._capacityMask, f = o - (e + t); f > 0; f--)
+ this.push(this._list[i++]);
+ for (i = this._tail; a > 0; )
+ this._list[i = i + 1 + l & this._capacityMask] = void 0, a--;
+ }
+ return this._head < 2 && this._tail > 1e4 && this._tail <= l >>> 2 && this._shrinkArray(), s;
+ }
+ }
+};
+S.prototype.splice = function(t, e) {
+ var i = t;
+ if (i === (i | 0)) {
+ var s = this.size();
+ if (i < 0 && (i += s), !(i > s))
+ if (arguments.length > 2) {
+ var a, o, l, f = arguments.length, h = this._list.length, d = 2;
+ if (!s || i < s / 2) {
+ for (o = new Array(i), a = 0; a < i; a++)
+ o[a] = this._list[this._head + a & this._capacityMask];
+ for (e === 0 ? (l = [], i > 0 && (this._head = this._head + i + h & this._capacityMask)) : (l = this.remove(i, e), this._head = this._head + i + h & this._capacityMask); f > d; )
+ this.unshift(arguments[--f]);
+ for (a = i; a > 0; a--)
+ this.unshift(o[a - 1]);
+ } else {
+ o = new Array(s - (i + e));
+ var g = o.length;
+ for (a = 0; a < g; a++)
+ o[a] = this._list[this._head + i + e + a & this._capacityMask];
+ for (e === 0 ? (l = [], i != s && (this._tail = this._head + i + h & this._capacityMask)) : (l = this.remove(i, e), this._tail = this._tail - g + h & this._capacityMask); d < f; )
+ this.push(arguments[d++]);
+ for (a = 0; a < g; a++)
+ this.push(o[a]);
+ }
+ return l;
+ } else
+ return this.remove(i, e);
+ }
+};
+S.prototype.clear = function() {
+ this._head = 0, this._tail = 0;
+};
+S.prototype.isEmpty = function() {
+ return this._head === this._tail;
+};
+S.prototype.toArray = function() {
+ return this._copyArray(!1);
+};
+S.prototype._fromArray = function(t) {
+ for (var e = 0; e < t.length; e++) this.push(t[e]);
+};
+S.prototype._copyArray = function(t) {
+ var e = [], i = this._list, s = i.length, a;
+ if (t || this._head > this._tail) {
+ for (a = this._head; a < s; a++) e.push(i[a]);
+ for (a = 0; a < this._tail; a++) e.push(i[a]);
+ } else
+ for (a = this._head; a < this._tail; a++) e.push(i[a]);
+ return e;
+};
+S.prototype._growArray = function() {
+ this._head && (this._list = this._copyArray(!0), this._head = 0), this._tail = this._list.length, this._list.length <<= 1, this._capacityMask = this._capacityMask << 1 | 1;
+};
+S.prototype._shrinkArray = function() {
+ this._list.length >>>= 1, this._capacityMask >>>= 1;
+};
+var vt = S, vr = { exports: {} };
+(function(r) {
+ var t = function() {
+ function e(p, m) {
+ return m != null && p instanceof m;
+ }
+ var i;
+ try {
+ i = Map;
+ } catch {
+ i = function() {
+ };
+ }
+ var s;
+ try {
+ s = Set;
+ } catch {
+ s = function() {
+ };
+ }
+ var a;
+ try {
+ a = Promise;
+ } catch {
+ a = function() {
+ };
+ }
+ function o(p, m, A, Y, J) {
+ typeof m == "object" && (A = m.depth, Y = m.prototype, J = m.includeNonEnumerable, m = m.circular);
+ var x = [], k = [], we = typeof Buffer < "u";
+ typeof m > "u" && (m = !0), typeof A > "u" && (A = 1 / 0);
+ function q(_, B) {
+ if (_ === null)
+ return null;
+ if (B === 0)
+ return _;
+ var O, Z;
+ if (typeof _ != "object")
+ return _;
+ if (e(_, i))
+ O = new i();
+ else if (e(_, s))
+ O = new s();
+ else if (e(_, a))
+ O = new a(function(G, H) {
+ _.then(function(X) {
+ G(q(X, B - 1));
+ }, function(X) {
+ H(q(X, B - 1));
+ });
+ });
+ else if (o.__isArray(_))
+ O = [];
+ else if (o.__isRegExp(_))
+ O = new RegExp(_.source, g(_)), _.lastIndex && (O.lastIndex = _.lastIndex);
+ else if (o.__isDate(_))
+ O = new Date(_.getTime());
+ else {
+ if (we && Buffer.isBuffer(_))
+ return Buffer.allocUnsafe ? O = Buffer.allocUnsafe(_.length) : O = new Buffer(_.length), _.copy(O), O;
+ e(_, Error) ? O = Object.create(_) : typeof Y > "u" ? (Z = Object.getPrototypeOf(_), O = Object.create(Z)) : (O = Object.create(Y), Z = Y);
+ }
+ if (m) {
+ var oe = x.indexOf(_);
+ if (oe != -1)
+ return k[oe];
+ x.push(_), k.push(O);
+ }
+ e(_, i) && _.forEach(function(G, H) {
+ var X = q(H, B - 1), de = q(G, B - 1);
+ O.set(X, de);
+ }), e(_, s) && _.forEach(function(G) {
+ var H = q(G, B - 1);
+ O.add(H);
+ });
+ for (var W in _) {
+ var ue;
+ Z && (ue = Object.getOwnPropertyDescriptor(Z, W)), !(ue && ue.set == null) && (O[W] = q(_[W], B - 1));
+ }
+ if (Object.getOwnPropertySymbols)
+ for (var fe = Object.getOwnPropertySymbols(_), W = 0; W < fe.length; W++) {
+ var M = fe[W], F = Object.getOwnPropertyDescriptor(_, M);
+ F && !F.enumerable && !J || (O[M] = q(_[M], B - 1), F.enumerable || Object.defineProperty(O, M, {
+ enumerable: !1
+ }));
+ }
+ if (J)
+ for (var K = Object.getOwnPropertyNames(_), W = 0; W < K.length; W++) {
+ var Q = K[W], F = Object.getOwnPropertyDescriptor(_, Q);
+ F && F.enumerable || (O[Q] = q(_[Q], B - 1), Object.defineProperty(O, Q, {
+ enumerable: !1
+ }));
+ }
+ return O;
+ }
+ return q(p, A);
+ }
+ o.clonePrototype = function(m) {
+ if (m === null)
+ return null;
+ var A = function() {
+ };
+ return A.prototype = m, new A();
+ };
+ function l(p) {
+ return Object.prototype.toString.call(p);
+ }
+ o.__objToStr = l;
+ function f(p) {
+ return typeof p == "object" && l(p) === "[object Date]";
+ }
+ o.__isDate = f;
+ function h(p) {
+ return typeof p == "object" && l(p) === "[object Array]";
+ }
+ o.__isArray = h;
+ function d(p) {
+ return typeof p == "object" && l(p) === "[object RegExp]";
+ }
+ o.__isRegExp = d;
+ function g(p) {
+ var m = "";
+ return p.global && (m += "g"), p.ignoreCase && (m += "i"), p.multiline && (m += "m"), m;
+ }
+ return o.__getRegExpFlags = g, o;
+ }();
+ r.exports && (r.exports = t);
+})(vr);
+var dt = vr.exports, yt = function r(t, e) {
+ if (t === e) return !0;
+ if (t && e && typeof t == "object" && typeof e == "object") {
+ if (t.constructor !== e.constructor) return !1;
+ var i, s, a;
+ if (Array.isArray(t)) {
+ if (i = t.length, i != e.length) return !1;
+ for (s = i; s-- !== 0; )
+ if (!r(t[s], e[s])) return !1;
+ return !0;
+ }
+ if (t.constructor === RegExp) return t.source === e.source && t.flags === e.flags;
+ if (t.valueOf !== Object.prototype.valueOf) return t.valueOf() === e.valueOf();
+ if (t.toString !== Object.prototype.toString) return t.toString() === e.toString();
+ if (a = Object.keys(t), i = a.length, i !== Object.keys(e).length) return !1;
+ for (s = i; s-- !== 0; )
+ if (!Object.prototype.hasOwnProperty.call(e, a[s])) return !1;
+ for (s = i; s-- !== 0; ) {
+ var o = a[s];
+ if (!r(t[o], e[o])) return !1;
+ }
+ return !0;
+ }
+ return t !== t && e !== e;
+}, pt = $ && $.__awaiter || function(r, t, e, i) {
+ function s(a) {
+ return a instanceof e ? a : new e(function(o) {
+ o(a);
+ });
+ }
+ return new (e || (e = Promise))(function(a, o) {
+ function l(d) {
+ try {
+ h(i.next(d));
+ } catch (g) {
+ o(g);
+ }
+ }
+ function f(d) {
+ try {
+ h(i.throw(d));
+ } catch (g) {
+ o(g);
+ }
+ }
+ function h(d) {
+ d.done ? a(d.value) : s(d.value).then(l, f);
+ }
+ h((i = i.apply(r, t || [])).next());
+ });
+}, re = $ && $.__generator || function(r, t) {
+ var e = { label: 0, sent: function() {
+ if (a[0] & 1) throw a[1];
+ return a[1];
+ }, trys: [], ops: [] }, i, s, a, o;
+ return o = { next: l(0), throw: l(1), return: l(2) }, typeof Symbol == "function" && (o[Symbol.iterator] = function() {
+ return this;
+ }), o;
+ function l(h) {
+ return function(d) {
+ return f([h, d]);
+ };
+ }
+ function f(h) {
+ if (i) throw new TypeError("Generator is already executing.");
+ for (; e; ) try {
+ if (i = 1, s && (a = h[0] & 2 ? s.return : h[0] ? s.throw || ((a = s.return) && a.call(s), 0) : s.next) && !(a = a.call(s, h[1])).done) return a;
+ switch (s = 0, a && (h = [h[0] & 2, a.value]), h[0]) {
+ case 0:
+ case 1:
+ a = h;
+ break;
+ case 4:
+ return e.label++, { value: h[1], done: !1 };
+ case 5:
+ e.label++, s = h[1], h = [0];
+ continue;
+ case 7:
+ h = e.ops.pop(), e.trys.pop();
+ continue;
+ default:
+ if (a = e.trys, !(a = a.length > 0 && a[a.length - 1]) && (h[0] === 6 || h[0] === 2)) {
+ e = 0;
+ continue;
+ }
+ if (h[0] === 3 && (!a || h[1] > a[0] && h[1] < a[3])) {
+ e.label = h[1];
+ break;
+ }
+ if (h[0] === 6 && e.label < a[1]) {
+ e.label = a[1], a = h;
+ break;
+ }
+ if (a && e.label < a[2]) {
+ e.label = a[2], e.ops.push(h);
+ break;
+ }
+ a[2] && e.ops.pop(), e.trys.pop();
+ continue;
+ }
+ h = t.call(r, e);
+ } catch (d) {
+ h = [6, d], s = 0;
+ } finally {
+ i = a = 0;
+ }
+ if (h[0] & 5) throw h[1];
+ return { value: h[0] ? h[1] : void 0, done: !0 };
+ }
+}, C = $ && $.__values || function(r) {
+ var t = typeof Symbol == "function" && Symbol.iterator, e = t && r[t], i = 0;
+ if (e) return e.call(r);
+ if (r && typeof r.length == "number") return {
+ next: function() {
+ return r && i >= r.length && (r = void 0), { value: r && r[i++], done: !r };
+ }
+ };
+ throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
+}, me = $ && $.__read || function(r, t) {
+ var e = typeof Symbol == "function" && r[Symbol.iterator];
+ if (!e) return r;
+ var i = e.call(r), s, a = [], o;
+ try {
+ for (; (t === void 0 || t-- > 0) && !(s = i.next()).done; ) a.push(s.value);
+ } catch (l) {
+ o = { error: l };
+ } finally {
+ try {
+ s && !s.done && (e = i.return) && e.call(i);
+ } finally {
+ if (o) throw o.error;
+ }
+ }
+ return a;
+}, ae = $ && $.__spread || function() {
+ for (var r = [], t = 0; t < arguments.length; t++) r = r.concat(me(arguments[t]));
+ return r;
+}, Ie = $ && $.__importDefault || function(r) {
+ return r && r.__esModule ? r : { default: r };
+};
+Object.defineProperty(c, "__esModule", { value: !0 });
+c.cached = c.curry = c.call = c.mapToObj = c.len = c.keys = c.set = c.zipToDict = c.dict = gr = c.list = c.isAsyncIter = c.isIter = c.trustType = c.assertType = c.assert = c.parse = c.json = c.float = c.str = c.int = c.insert = c.max = c.min = c.sample = c.extract = c.byIdx = c.sorted = c.shuffle = c.cartesian = c.zip = c.error = c.print = c.equal = c.not = c.all = c.any = c.enumerate = c.range = c.randint = c.delay = void 0;
+function _t(r) {
+ return pt(this, void 0, void 0, function() {
+ return re(this, function(t) {
+ return [2, new Promise(function(e) {
+ setTimeout(function() {
+ e();
+ }, r);
+ })];
+ });
+ });
+}
+c.delay = _t;
+function We(r) {
+ return Math.floor(Math.random() * r) % r;
+}
+c.randint = We;
+function se(r, t, e) {
+ var i;
+ return re(this, function(s) {
+ switch (s.label) {
+ case 0:
+ return t == null && e == null ? [5, C(se(0, 1, r))] : [3, 2];
+ case 1:
+ return s.sent(), [3, 8];
+ case 2:
+ return e != null ? [3, 4] : [5, C(se(r, 1, t))];
+ case 3:
+ return s.sent(), [3, 8];
+ case 4:
+ i = r, s.label = 5;
+ case 5:
+ return i < e ? [4, i] : [3, 8];
+ case 6:
+ s.sent(), s.label = 7;
+ case 7:
+ return i += t, [3, 5];
+ case 8:
+ return [2];
+ }
+ });
+}
+c.range = se;
+function gt(r) {
+ var t, e, i, s, a, o, l;
+ return re(this, function(f) {
+ switch (f.label) {
+ case 0:
+ t = 0, f.label = 1;
+ case 1:
+ f.trys.push([1, 6, 7, 8]), e = C(r), i = e.next(), f.label = 2;
+ case 2:
+ return i.done ? [3, 5] : (s = i.value, [4, [t++, s]]);
+ case 3:
+ f.sent(), f.label = 4;
+ case 4:
+ return i = e.next(), [3, 2];
+ case 5:
+ return [3, 8];
+ case 6:
+ return a = f.sent(), o = { error: a }, [3, 8];
+ case 7:
+ try {
+ i && !i.done && (l = e.return) && l.call(e);
+ } finally {
+ if (o) throw o.error;
+ }
+ return [7];
+ case 8:
+ return [2];
+ }
+ });
+}
+c.enumerate = gt;
+function Ue(r) {
+ var t, e;
+ try {
+ for (var i = C(r), s = i.next(); !s.done; s = i.next()) {
+ var a = s.value;
+ if (a)
+ return !0;
+ }
+ } catch (o) {
+ t = { error: o };
+ } finally {
+ try {
+ s && !s.done && (e = i.return) && e.call(i);
+ } finally {
+ if (t) throw t.error;
+ }
+ }
+ return !1;
+}
+c.any = Ue;
+function bt(r) {
+ return !Ue(dr(r));
+}
+c.all = bt;
+function dr(r) {
+ var t, e, i = [];
+ try {
+ for (var s = C(r), a = s.next(); !a.done; a = s.next()) {
+ var o = a.value;
+ i.push(!o);
+ }
+ } catch (l) {
+ t = { error: l };
+ } finally {
+ try {
+ a && !a.done && (e = s.return) && e.call(s);
+ } finally {
+ if (t) throw t.error;
+ }
+ }
+ return i;
+}
+c.not = dr;
+function mt(r, t) {
+ var e, i, s, a, o = [];
+ if (Symbol.iterator in t)
+ try {
+ for (var l = C($e(r, t)), f = l.next(); !f.done; f = l.next()) {
+ var h = me(f.value, 2), d = h[0], g = h[1];
+ o.push(d.__equal__(g));
+ }
+ } catch (A) {
+ e = { error: A };
+ } finally {
+ try {
+ f && !f.done && (i = l.return) && i.call(l);
+ } finally {
+ if (e) throw e.error;
+ }
+ }
+ else
+ try {
+ for (var p = C(r), m = p.next(); !m.done; m = p.next()) {
+ var d = m.value;
+ _r(t) && o.push(d.__equal__(t));
+ }
+ } catch (A) {
+ s = { error: A };
+ } finally {
+ try {
+ m && !m.done && (a = p.return) && a.call(p);
+ } finally {
+ if (s) throw s.error;
+ }
+ }
+ return o;
+}
+c.equal = mt;
+function wt() {
+ for (var r = [], t = 0; t < arguments.length; t++)
+ r[t] = arguments[t];
+ console.log.apply(console, ae(r));
+}
+c.print = wt;
+function Rt(r) {
+ throw r === void 0 && (r = ""), new Error(r);
+}
+c.error = Rt;
+function $e() {
+ var r, t, e, i, s, a, o, l, f = [];
+ for (r = 0; r < arguments.length; r++)
+ f[r] = arguments[r];
+ return re(this, function(h) {
+ switch (h.label) {
+ case 0:
+ if (P(f) == 0)
+ return [2];
+ P(f) == 1 && (f = f[0]), t = [];
+ try {
+ for (e = C(f), i = e.next(); !i.done; i = e.next())
+ s = i.value, t.push(s[Symbol.iterator]());
+ } catch (d) {
+ o = { error: d };
+ } finally {
+ try {
+ i && !i.done && (l = e.return) && l.call(e);
+ } finally {
+ if (o) throw o.error;
+ }
+ }
+ h.label = 1;
+ case 1:
+ return a = t.map(function(d) {
+ return d.next();
+ }), Ue(a.map(function(d) {
+ return d.done;
+ })) ? [2, void 0] : [3, 2];
+ case 2:
+ return [4, a.map(function(d) {
+ return d.value;
+ })];
+ case 3:
+ h.sent(), h.label = 4;
+ case 4:
+ return [3, 1];
+ case 5:
+ return [2];
+ }
+ });
+}
+c.zip = $e;
+function sr(r, t) {
+ var e, i, s, a, o, l, f, h, d, g, p, m, A, Y, J;
+ return re(this, function(x) {
+ switch (x.label) {
+ case 0:
+ e = [], i = !0, x.label = 1;
+ case 1:
+ x.trys.push([1, 13, 14, 15]), s = C(r), a = s.next(), x.label = 2;
+ case 2:
+ if (a.done) return [3, 12];
+ o = a.value, l = i ? t : e, x.label = 3;
+ case 3:
+ x.trys.push([3, 8, 9, 10]), f = (Y = void 0, C(l)), h = f.next(), x.label = 4;
+ case 4:
+ return h.done ? [3, 7] : (d = h.value, [4, [o, d]]);
+ case 5:
+ x.sent(), i && e.push(d), x.label = 6;
+ case 6:
+ return h = f.next(), [3, 4];
+ case 7:
+ return [3, 10];
+ case 8:
+ return g = x.sent(), Y = { error: g }, [3, 10];
+ case 9:
+ try {
+ h && !h.done && (J = f.return) && J.call(f);
+ } finally {
+ if (Y) throw Y.error;
+ }
+ return [7];
+ case 10:
+ i = !1, x.label = 11;
+ case 11:
+ return a = s.next(), [3, 2];
+ case 12:
+ return [3, 15];
+ case 13:
+ return p = x.sent(), m = { error: p }, [3, 15];
+ case 14:
+ try {
+ a && !a.done && (A = s.return) && A.call(s);
+ } finally {
+ if (m) throw m.error;
+ }
+ return [7];
+ case 15:
+ return [2];
+ }
+ });
+}
+function yr() {
+ var r, t, e, i, s, a, o, l, f, h = [];
+ for (r = 0; r < arguments.length; r++)
+ h[r] = arguments[r];
+ return re(this, function(d) {
+ switch (d.label) {
+ case 0:
+ return P(h) != 2 ? [3, 2] : [5, C(sr(h[0], h[1]))];
+ case 1:
+ return d.sent(), [3, 9];
+ case 2:
+ d.trys.push([2, 7, 8, 9]), t = C(sr(h[0], yr.apply(void 0, ae(h.slice(1))))), e = t.next(), d.label = 3;
+ case 3:
+ return e.done ? [3, 6] : (i = me(e.value, 2), s = i[0], a = i[1], [4, ae([s], a)]);
+ case 4:
+ d.sent(), d.label = 5;
+ case 5:
+ return e = t.next(), [3, 3];
+ case 6:
+ return [3, 9];
+ case 7:
+ return o = d.sent(), l = { error: o }, [3, 9];
+ case 8:
+ try {
+ e && !e.done && (f = t.return) && f.call(t);
+ } finally {
+ if (l) throw l.error;
+ }
+ return [7];
+ case 9:
+ return [2];
+ }
+ });
+}
+c.cartesian = yr;
+var Et = Ie(vt);
+function pr(r) {
+ var t, e, i = new Et.default(), s = z(r), a = z(se(P(s)));
+ a.forEach(function(p) {
+ return i.push(p);
+ });
+ var o = new Array(P(s));
+ try {
+ for (var l = C(s), f = l.next(); !f.done; f = l.next()) {
+ var h = f.value, d = We(P(i)), g = i.get(d);
+ i.removeOne(d), o[g] = h;
+ }
+ } catch (p) {
+ t = { error: p };
+ } finally {
+ try {
+ f && !f.done && (e = l.return) && e.call(l);
+ } finally {
+ if (t) throw t.error;
+ }
+ }
+ return o;
+}
+c.shuffle = pr;
+function Ot(r, t, e) {
+ t === void 0 && (t = null);
+ var i = z(r).sort(function(s, a) {
+ var o = me([-t(s), -t(a)], 2), l = o[0], f = o[1];
+ return l - f;
+ });
+ return i;
+}
+c.sorted = Ot;
+function ze(r, t) {
+ var e = z(r), i = t.map(function(s) {
+ return e[s];
+ });
+ return i;
+}
+c.byIdx = ze;
+function xt(r, t) {
+ var e = z(r), i = pr(se(P(e))).slice(0, t);
+ return ze(e, i);
+}
+c.extract = xt;
+function St(r, t) {
+ var e = z(r), i = z(se(P(e))).map(function(s) {
+ return We(P(e));
+ });
+ return ze(e, i);
+}
+c.sample = St;
+c.min = Math.min;
+c.max = Math.max;
+function Tt(r, t, e) {
+ var i = [], s = z(r);
+ return s.forEach(function(a, o) {
+ t == o && i.push(e), i.push(a);
+ }), P(s) == t && i.push(e), i;
+}
+c.insert = Tt;
+function jt(r) {
+ return typeof r == "string" ? parseInt(r) : typeof r == "number" ? r | 0 : "toInt" in r ? r.toInt() : 0;
+}
+c.int = jt;
+function kt(r) {
+ return De(r, "object") ? r.toString() : De(r, "string") ? r : new Number(r).toString();
+}
+c.str = kt;
+function At(r) {
+ return typeof r == "string" ? parseFloat(r) : typeof r == "number" ? r : "toFloat" in r ? r.toFloat() : 0;
+}
+c.float = At;
+function Pt(r) {
+ return JSON.stringify(r);
+}
+c.json = Pt;
+function Ct(r) {
+ return JSON.parse(r);
+}
+c.parse = Ct;
+function Mt(r, t) {
+ if (!r)
+ throw new Error(t ?? "错误");
+}
+c.assert = Mt;
+function De(r, t) {
+ if (typeof t == "string")
+ return typeof r == t;
+ if (typeof t == "function")
+ return r instanceof t;
+}
+c.assertType = De;
+function _r(r) {
+ return !0;
+}
+c.trustType = _r;
+function Dt(r) {
+ return Symbol.iterator in r;
+}
+c.isIter = Dt;
+function Ft(r) {
+ return Symbol.asyncIterator in r && !(Symbol.iterator in r);
+}
+c.isAsyncIter = Ft;
+function z(r) {
+ var t, e;
+ if (r == null)
+ return z([]);
+ var i = [];
+ try {
+ for (var s = C(r), a = s.next(); !a.done; a = s.next()) {
+ var o = a.value;
+ i.push(o);
+ }
+ } catch (l) {
+ t = { error: l };
+ } finally {
+ try {
+ a && !a.done && (e = s.return) && e.call(s);
+ } finally {
+ if (t) throw t.error;
+ }
+ }
+ return i;
+}
+var gr = c.list = z;
+function br(r) {
+ return new Map(r);
+}
+c.dict = br;
+function It(r, t) {
+ return br($e(r, t));
+}
+c.zipToDict = It;
+function Wt(r) {
+ return new Set(r);
+}
+c.set = Wt;
+function Ut(r) {
+ var t, e, i, s, a, o, l, f, h, d;
+ return re(this, function(g) {
+ switch (g.label) {
+ case 0:
+ if (!(r instanceof Map)) return [3, 9];
+ g.label = 1;
+ case 1:
+ g.trys.push([1, 6, 7, 8]), t = C(r.keys()), e = t.next(), g.label = 2;
+ case 2:
+ return e.done ? [3, 5] : (i = e.value, [4, i]);
+ case 3:
+ g.sent(), g.label = 4;
+ case 4:
+ return e = t.next(), [3, 2];
+ case 5:
+ return [3, 8];
+ case 6:
+ return s = g.sent(), h = { error: s }, [3, 8];
+ case 7:
+ try {
+ e && !e.done && (d = t.return) && d.call(t);
+ } finally {
+ if (h) throw h.error;
+ }
+ return [7];
+ case 8:
+ return [3, 13];
+ case 9:
+ if (typeof r != "object") return [3, 13];
+ a = [];
+ for (o in r)
+ a.push(o);
+ l = 0, g.label = 10;
+ case 10:
+ return l < a.length ? (f = a[l], [4, f]) : [3, 13];
+ case 11:
+ g.sent(), g.label = 12;
+ case 12:
+ return l++, [3, 10];
+ case 13:
+ return [2];
+ }
+ });
+}
+c.keys = Ut;
+function P(r) {
+ if ("length" in r)
+ return r.length;
+ if ("size" in r)
+ return r.size;
+ if ("count" in r)
+ return r.count;
+ if ("__len__" in r)
+ return r.__len__();
+ if (Symbol.iterator in r)
+ return P(z(r));
+ if (typeof r == "object") {
+ var t = 0;
+ for (var e in r)
+ t++;
+ return t;
+ }
+}
+c.len = P;
+function $t(r) {
+ r === void 0 && (r = /* @__PURE__ */ new Map());
+ var t = new Proxy({}, {
+ get: function(e, i, s) {
+ return r.get(i);
+ },
+ set: function(e, i, s, a) {
+ return r.set(i, s), !0;
+ },
+ has: function(e, i) {
+ return r.has(i);
+ },
+ deleteProperty: function(e, i) {
+ return r.delete(i);
+ },
+ defineProperty: function(e, i, s) {
+ return r.set(i, s.value), !0;
+ },
+ ownKeys: function(e) {
+ return z(r.keys());
+ }
+ });
+ return t;
+}
+c.mapToObj = $t;
+function zt(r) {
+ r();
+}
+c.call = zt;
+function mr(r, t) {
+ return t === void 0 && (t = []), function(e) {
+ var i = P(t) + 1, s = t.concat([e]);
+ return i == P(r) ? r.apply(void 0, ae(s)) : mr(r, s);
+ };
+}
+function Yt(r) {
+ function t() {
+ for (var e, i, s = [], a = 0; a < arguments.length; a++)
+ s[a] = arguments[a];
+ var o = r;
+ try {
+ for (var l = C(s), f = l.next(); !f.done; f = l.next()) {
+ var h = f.value;
+ o = o(h);
+ }
+ } catch (d) {
+ e = { error: d };
+ } finally {
+ try {
+ f && !f.done && (i = l.return) && i.call(l);
+ } finally {
+ if (e) throw e.error;
+ }
+ }
+ return o;
+ }
+ return t;
+}
+function wr(r, t, e) {
+ t === void 0 && (t = 0), e === void 0 && (e = null), e == null && (e = r);
+ var i = mr(r), s = Yt(i), a = function() {
+ for (var o = [], l = 0; l < arguments.length; l++)
+ o[l] = arguments[l];
+ var f = s.apply(void 0, ae(o));
+ if (t + P(o) == P(e))
+ return f;
+ var h = wr(f, t + P(o), e);
+ return h;
+ };
+ return a;
+}
+c.curry = wr;
+var qt = Ie(dt), Bt = Ie(yt);
+function Lt(r) {
+ var t = !1, e = null, i = null;
+ return function() {
+ for (var s = [], a = 0; a < arguments.length; a++)
+ s[a] = arguments[a];
+ if (!t || i !== s || !Bt.default(s, i))
+ return t = !0, e = r.apply(void 0, ae(s)), i = qt.default(s), e;
+ };
+}
+c.cached = Lt;
+function Qt(r) {
+ const t = N();
+ return V(() => r(), t, { deep: !0 }), r();
+}
+function Vt(r) {
+ function* t() {
+ for (let e in r)
+ yield r[e];
+ }
+ return gr(t());
+}
+function Nt(r) {
+ const t = N(), e = be(() => {
+ const s = r();
+ return Vt(s).filter((o) => Xr(o) || Zr(o));
+ }, [r]), i = Hr(() => e(), [e]);
+ return V(() => i, t, { deep: !0 }), r();
+}
+function Jt(r) {
+ const t = cr(() => r.target.setup(r.props)), e = Nt(() => t), i = r.target.render;
+ return /* @__PURE__ */ hr.jsx(i, { ...e });
+}
+function en(r) {
+ return (t) => /* @__PURE__ */ hr.jsx(Jt, { target: r, props: t });
+}
+function rn(r) {
+ const [t] = L(() => Qr(r)), e = N();
+ return V(t, e, { deep: !0 }), t;
+}
+function tn(r) {
+ const [t] = L(() => et(r)), e = N();
+ return V(t, e), t;
+}
+function nn(r) {
+ const [t] = L(() => rt(r)), e = N();
+ return V(t, e), t;
+}
+function an(r) {
+ const [t] = L(() => tt(r)), e = N();
+ return V(t, e), t;
+}
+function sn(r) {
+ const [t] = L(() => nt(r)), e = N();
+ return V(t, e), t;
+}
+function on(r) {
+ const [t] = L(() => it(r)), e = N();
+ return V(t, e), t;
+}
+function un(r) {
+ const [t] = L(() => at(r)), e = N();
+ return V(t, e), t;
+}
+function Kt(r, t) {
+ const [e] = L(() => st(r, t)), i = N();
+ return V(e, i), e;
+}
+function fn({ children: r }) {
+ return Kt(() => r()).value;
+}
+function Gt(r, t = {}) {
+ return ur(r, null, {
+ ...t,
+ onWarn: lr.warn,
+ scheduler: (e) => e()
+ });
+}
+const ln = (r, t) => {
+ const [e] = L(() => Gt(r, t));
+ return fr(() => e.stop()), e;
+};
+function cn(...r) {
+ const t = ie(!1), [e] = L(() => ot(...r)), i = ie(e.run), s = be((a) => {
+ if (!t.current)
+ return t.current = !0, i.current.bind(e)(a);
+ }, []);
+ return e.run = s, e;
+}
+const hn = Ce.watch.bind(Ce);
+export {
+ fn as Observer,
+ Jt as SetupComponentRenderer,
+ pn as baseWatch,
+ en as defineSetupComponent,
+ fr as onBeforeUnmount,
+ ut as onMounted,
+ Zt as onUpdated,
+ Kt as useComputed,
+ nn as useCustomRef,
+ cn as useEffectScope,
+ an as useReactive,
+ Qt as useReactivity,
+ on as useReadonly,
+ rn as useRef,
+ sn as useShallowReactive,
+ un as useShallowReadonly,
+ tn as useShallowRef,
+ V as useWatch,
+ ln as useWatchEffect,
+ hn as watch,
+ Gt as watchEffect,
+ Ce as watcherInstance
+};
diff --git a/dist/veact.umd.cjs b/dist/veact.umd.cjs
new file mode 100644
index 0000000..735f3bd
--- /dev/null
+++ b/dist/veact.umd.cjs
@@ -0,0 +1,41 @@
+(function(R,E){typeof exports=="object"&&typeof module<"u"?E(exports,require("react"),require("@vue/reactivity")):typeof define=="function"&&define.amd?define(["exports","react","@vue/reactivity"],E):(R=typeof globalThis<"u"?globalThis:R||self,E(R.veact={},R.React,R.VueReactivity))})(this,function(R,E,D){"use strict";/*!
+ * veact v1.1.0
+ * https://github.com/veactjs/veact
+ *
+ * Includes @vue/reactivity
+ * https://github.com/vuejs/core/tree/main/packages/reactivity
+ *
+ * (c) 2021-present Surmon and Veact contributors.
+ * Released under the MIT License.
+ *
+ * Date: 2024-09-19T04:33:55.899Z
+ */function Be(e){E.useEffect(()=>{e()},[])}function Re(e){E.useEffect(()=>()=>{e()},[])}function Et(e){const r=E.useRef(!1);E.useEffect(()=>{r.current?e():r.current=!0})}const Ee="veact",Ve={...console,log(...e){console.log(`[${Ee}]`,...e)},warn(...e){console.warn(`[${Ee}]`,...e)},error(...e){console.error(`[${Ee}]`,...e)}};function Le(e){const r=E.useRef(!0),t=E.useRef(void 0);return r.current&&(r.current=!1,t.current=e()),t.current}class Ot{watch(r,t,a={}){return D.watch(r,t,{...a,onWarn:Ve.warn,scheduler:s=>s()})}}const ye=new Ot,N=(e,r,t={})=>{const a=E.useRef(),s=E.useCallback(()=>{a.current&&(a.current(),a.current=void 0)},[]),i=E.useCallback(()=>{a.current&&s(),a.current=ye.watch(e,(...o)=>{console.log("触发更新"),r(...o)},t)},[]);return Be(()=>{console.log("执行监听"),i()}),Re(()=>{console.log("取消监听"),s()}),Le(()=>{console.log("初始监听"),i()}),a};var B=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Oe={exports:{}},ue={};/**
+ * @license React
+ * react-jsx-runtime.production.min.js
+ *
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */var Ne;function St(){if(Ne)return ue;Ne=1;var e=E,r=Symbol.for("react.element"),t=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,s=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function o(l,f,h){var d,g={},p=null,m=null;h!==void 0&&(p=""+h),f.key!==void 0&&(p=""+f.key),f.ref!==void 0&&(m=f.ref);for(d in f)a.call(f,d)&&!i.hasOwnProperty(d)&&(g[d]=f[d]);if(l&&l.defaultProps)for(d in f=l.defaultProps,f)g[d]===void 0&&(g[d]=f[d]);return{$$typeof:r,type:l,key:p,ref:m,props:g,_owner:s.current}}return ue.Fragment=t,ue.jsx=o,ue.jsxs=o,ue}var fe={};/**
+ * @license React
+ * react-jsx-runtime.development.js
+ *
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */var Je;function Tt(){return Je||(Je=1,process.env.NODE_ENV!=="production"&&function(){var e=E,r=Symbol.for("react.element"),t=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),l=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),M=Symbol.iterator,J="@@iterator";function X(n){if(n===null||typeof n!="object")return null;var u=M&&n[M]||n[J];return typeof u=="function"?u:null}var k=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function C(n){{for(var u=arguments.length,v=new Array(u>1?u-1:0),y=1;y=1&&P>=0&&b[x]!==W[P];)P--;for(;x>=1&&P>=0;x--,P--)if(b[x]!==W[P]){if(x!==1||P!==1)do if(x--,P--,P<0||b[x]!==W[P]){var L=`
+`+b[x].replace(" at new "," at ");return n.displayName&&L.includes("")&&(L=L.replace("",n.displayName)),typeof n=="function"&&be.set(n,L),L}while(x>=1&&P>=0);break}}}finally{De=!1,Ae.current=S,Rr(),Error.prepareStackTrace=O}var oe=n?n.displayName||n.name:"",ne=oe?ge(oe):"";return typeof n=="function"&&be.set(n,ne),ne}function Or(n,u,v){return ft(n,!1)}function Sr(n){var u=n.prototype;return!!(u&&u.isReactComponent)}function me(n,u,v){if(n==null)return"";if(typeof n=="function")return ft(n,Sr(n));if(typeof n=="string")return ge(n);switch(n){case h:return ge("Suspense");case d:return ge("SuspenseList")}if(typeof n=="object")switch(n.$$typeof){case f:return Or(n.render);case g:return me(n.type,u,v);case p:{var y=n,O=y._payload,S=y._init;try{return me(S(O),u,v)}catch{}}}return""}var ve=Object.prototype.hasOwnProperty,lt={},ct=k.ReactDebugCurrentFrame;function we(n){if(n){var u=n._owner,v=me(n.type,n._source,u?u.type:null);ct.setExtraStackFrame(v)}else ct.setExtraStackFrame(null)}function Tr(n,u,v,y,O){{var S=Function.call.bind(ve);for(var w in n)if(S(n,w)){var b=void 0;try{if(typeof n[w]!="function"){var W=Error((y||"React class")+": "+v+" type `"+w+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof n[w]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw W.name="Invariant Violation",W}b=n[w](u,w,y,v,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(x){b=x}b&&!(b instanceof Error)&&(we(O),C("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",y||"React class",v,w,typeof b),we(null)),b instanceof Error&&!(b.message in lt)&&(lt[b.message]=!0,we(O),C("Failed %s type: %s",v,b.message),we(null))}}}var jr=Array.isArray;function Ie(n){return jr(n)}function kr(n){{var u=typeof Symbol=="function"&&Symbol.toStringTag,v=u&&n[Symbol.toStringTag]||n.constructor.name||"Object";return v}}function xr(n){try{return ht(n),!1}catch{return!0}}function ht(n){return""+n}function vt(n){if(xr(n))return C("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",kr(n)),ht(n)}var de=k.ReactCurrentOwner,Pr={key:!0,ref:!0,__self:!0,__source:!0},dt,yt,Fe;Fe={};function Cr(n){if(ve.call(n,"ref")){var u=Object.getOwnPropertyDescriptor(n,"ref").get;if(u&&u.isReactWarning)return!1}return n.ref!==void 0}function Ar(n){if(ve.call(n,"key")){var u=Object.getOwnPropertyDescriptor(n,"key").get;if(u&&u.isReactWarning)return!1}return n.key!==void 0}function Mr(n,u){if(typeof n.ref=="string"&&de.current&&u&&de.current.stateNode!==u){var v=F(de.current.type);Fe[v]||(C('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',F(de.current.type),n.ref),Fe[v]=!0)}}function Dr(n,u){{var v=function(){dt||(dt=!0,C("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",u))};v.isReactWarning=!0,Object.defineProperty(n,"key",{get:v,configurable:!0})}}function Ir(n,u){{var v=function(){yt||(yt=!0,C("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",u))};v.isReactWarning=!0,Object.defineProperty(n,"ref",{get:v,configurable:!0})}}var Fr=function(n,u,v,y,O,S,w){var b={$$typeof:r,type:n,key:u,ref:v,props:w,_owner:S};return b._store={},Object.defineProperty(b._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(b,"_self",{configurable:!1,enumerable:!1,writable:!1,value:y}),Object.defineProperty(b,"_source",{configurable:!1,enumerable:!1,writable:!1,value:O}),Object.freeze&&(Object.freeze(b.props),Object.freeze(b)),b};function Wr(n,u,v,y,O){{var S,w={},b=null,W=null;v!==void 0&&(vt(v),b=""+v),Ar(u)&&(vt(u.key),b=""+u.key),Cr(u)&&(W=u.ref,Mr(u,O));for(S in u)ve.call(u,S)&&!Pr.hasOwnProperty(S)&&(w[S]=u[S]);if(n&&n.defaultProps){var x=n.defaultProps;for(S in x)w[S]===void 0&&(w[S]=x[S])}if(b||W){var P=typeof n=="function"?n.displayName||n.name||"Unknown":n;b&&Dr(w,P),W&&Ir(w,P)}return Fr(n,b,W,O,y,de.current,w)}}var We=k.ReactCurrentOwner,pt=k.ReactDebugCurrentFrame;function se(n){if(n){var u=n._owner,v=me(n.type,n._source,u?u.type:null);pt.setExtraStackFrame(v)}else pt.setExtraStackFrame(null)}var Ue;Ue=!1;function ze(n){return typeof n=="object"&&n!==null&&n.$$typeof===r}function _t(){{if(We.current){var n=F(We.current.type);if(n)return`
+
+Check the render method of \``+n+"`."}return""}}function Ur(n){return""}var gt={};function zr(n){{var u=_t();if(!u){var v=typeof n=="string"?n:n.displayName||n.name;v&&(u=`
+
+Check the top-level render call using <`+v+">.")}return u}}function bt(n,u){{if(!n._store||n._store.validated||n.key!=null)return;n._store.validated=!0;var v=zr(u);if(gt[v])return;gt[v]=!0;var y="";n&&n._owner&&n._owner!==We.current&&(y=" It was passed a child from "+F(n._owner.type)+"."),se(n),C('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',v,y),se(null)}}function mt(n,u){{if(typeof n!="object")return;if(Ie(n))for(var v=0;v",b=" Did you accidentally export a JSX literal instead of a component?"):x=typeof n,C("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",x,b)}var P=Wr(n,u,v,O,S);if(P==null)return P;if(w){var L=u.children;if(L!==void 0)if(y)if(Ie(L)){for(var oe=0;oe0?"{key: someKey, "+z.join(": ..., ")+": ...}":"{key: someKey}";if(!wt[ne+Ye]){var Kr=z.length>0?"{"+z.join(": ..., ")+": ...}":"{}";C(`A props object containing a "key" prop is being spread into JSX:
+ let props = %s;
+ <%s {...props} />
+React keys must be passed directly to JSX without using spread:
+ let props = %s;
+ <%s key={someKey} {...props} />`,Ye,ne,Kr,ne),wt[ne+Ye]=!0}}return n===a?Br(P):Yr(P),P}}function Vr(n,u,v){return Rt(n,u,v,!0)}function Lr(n,u,v){return Rt(n,u,v,!1)}var Nr=Lr,Jr=Vr;fe.Fragment=a,fe.jsx=Nr,fe.jsxs=Jr}()),fe}process.env.NODE_ENV==="production"?Oe.exports=St():Oe.exports=Tt();var Ke=Oe.exports;const jt=e=>e+1,H=()=>E.useReducer(jt,0)[1];var c={};function j(e,t){var t=t||{};this._head=0,this._tail=0,this._capacity=t.capacity,this._capacityMask=3,this._list=new Array(4),Array.isArray(e)&&this._fromArray(e)}j.prototype.peekAt=function(r){var t=r;if(t===(t|0)){var a=this.size();if(!(t>=a||t<-a))return t<0&&(t+=a),t=this._head+t&this._capacityMask,this._list[t]}},j.prototype.get=function(r){return this.peekAt(r)},j.prototype.peek=function(){if(this._head!==this._tail)return this._list[this._head]},j.prototype.peekFront=function(){return this.peek()},j.prototype.peekBack=function(){return this.peekAt(-1)},Object.defineProperty(j.prototype,"length",{get:function(){return this.size()}}),j.prototype.size=function(){return this._head===this._tail?0:this._headthis._capacity&&this.pop(),this._head1e4&&this._tail<=this._list.length>>>2&&this._shrinkArray(),t}},j.prototype.push=function(r){if(r===void 0)return this.size();var t=this._tail;return this._list[t]=r,this._tail=t+1&this._capacityMask,this._tail===this._head&&this._growArray(),this._capacity&&this.size()>this._capacity&&this.shift(),this._head1e4&&r<=t>>>2&&this._shrinkArray(),a}},j.prototype.removeOne=function(r){var t=r;if(t===(t|0)&&this._head!==this._tail){var a=this.size(),s=this._list.length;if(!(t>=a||t<-a)){t<0&&(t+=a),t=this._head+t&this._capacityMask;var i=this._list[t],o;if(r0;o--)this._list[t]=this._list[t=t-1+s&this._capacityMask];this._list[t]=void 0,this._head=this._head+1+s&this._capacityMask}else{for(o=a-1-r;o>0;o--)this._list[t]=this._list[t=t+1+s&this._capacityMask];this._list[t]=void 0,this._tail=this._tail-1+s&this._capacityMask}return i}}},j.prototype.remove=function(r,t){var a=r,s,i=t;if(a===(a|0)&&this._head!==this._tail){var o=this.size(),l=this._list.length;if(!(a>=o||a<-o||t<1)){if(a<0&&(a+=o),t===1||!t)return s=new Array(1),s[0]=this.removeOne(a),s;if(a===0&&a+t>=o)return s=this.toArray(),this.clear(),s;a+t>o&&(t=o-a);var f;for(s=new Array(t),f=0;f0;f--)this._list[a=a+1+l&this._capacityMask]=void 0;return s}if(r===0){for(this._head=this._head+t+l&this._capacityMask,f=t-1;f>0;f--)this._list[a=a+1+l&this._capacityMask]=void 0;return s}if(a0;f--)this.unshift(this._list[a=a-1+l&this._capacityMask]);for(a=this._head-1+l&this._capacityMask;i>0;)this._list[a=a-1+l&this._capacityMask]=void 0,i--;r<0&&(this._tail=a)}else{for(this._tail=a,a=a+t+l&this._capacityMask,f=o-(t+r);f>0;f--)this.push(this._list[a++]);for(a=this._tail;i>0;)this._list[a=a+1+l&this._capacityMask]=void 0,i--}return this._head<2&&this._tail>1e4&&this._tail<=l>>>2&&this._shrinkArray(),s}}},j.prototype.splice=function(r,t){var a=r;if(a===(a|0)){var s=this.size();if(a<0&&(a+=s),!(a>s))if(arguments.length>2){var i,o,l,f=arguments.length,h=this._list.length,d=2;if(!s||a0&&(this._head=this._head+a+h&this._capacityMask)):(l=this.remove(a,t),this._head=this._head+a+h&this._capacityMask);f>d;)this.unshift(arguments[--f]);for(i=a;i>0;i--)this.unshift(o[i-1])}else{o=new Array(s-(a+t));var g=o.length;for(i=0;ithis._tail){for(i=this._head;i>>=1,this._capacityMask>>>=1};var kt=j,Ge={exports:{}};(function(e){var r=function(){function t(p,m){return m!=null&&p instanceof m}var a;try{a=Map}catch{a=function(){}}var s;try{s=Set}catch{s=function(){}}var i;try{i=Promise}catch{i=function(){}}function o(p,m,M,J,X){typeof m=="object"&&(M=m.depth,J=m.prototype,X=m.includeNonEnumerable,m=m.circular);var k=[],C=[],Ce=typeof Buffer<"u";typeof m>"u"&&(m=!0),typeof M>"u"&&(M=1/0);function K(_,G){if(_===null)return null;if(G===0)return _;var T,te;if(typeof _!="object")return _;if(t(_,a))T=new a;else if(t(_,s))T=new s;else if(t(_,i))T=new i(function(Q,q){_.then(function($){Q(K($,G-1))},function($){q(K($,G-1))})});else if(o.__isArray(_))T=[];else if(o.__isRegExp(_))T=new RegExp(_.source,g(_)),_.lastIndex&&(T.lastIndex=_.lastIndex);else if(o.__isDate(_))T=new Date(_.getTime());else{if(Ce&&Buffer.isBuffer(_))return Buffer.allocUnsafe?T=Buffer.allocUnsafe(_.length):T=new Buffer(_.length),_.copy(T),T;t(_,Error)?T=Object.create(_):typeof J>"u"?(te=Object.getPrototypeOf(_),T=Object.create(te)):(T=Object.create(J),te=J)}if(m){var le=k.indexOf(_);if(le!=-1)return C[le];k.push(_),C.push(T)}t(_,a)&&_.forEach(function(Q,q){var $=K(q,G-1),_e=K(Q,G-1);T.set($,_e)}),t(_,s)&&_.forEach(function(Q){var q=K(Q,G-1);T.add(q)});for(var Y in _){var ce;te&&(ce=Object.getOwnPropertyDescriptor(te,Y)),!(ce&&ce.set==null)&&(T[Y]=K(_[Y],G-1))}if(Object.getOwnPropertySymbols)for(var he=Object.getOwnPropertySymbols(_),Y=0;Y0&&i[i.length-1])&&(h[0]===6||h[0]===2)){t=0;continue}if(h[0]===3&&(!i||h[1]>i[0]&&h[1]=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")},pe=B&&B.__read||function(e,r){var t=typeof Symbol=="function"&&e[Symbol.iterator];if(!t)return e;var a=t.call(e),s,i=[],o;try{for(;(r===void 0||r-- >0)&&!(s=a.next()).done;)i.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(t=a.return)&&t.call(a)}finally{if(o)throw o.error}}return i},ae=B&&B.__spread||function(){for(var e=[],r=0;re(),r,{deep:!0}),e()}function or(e){function*r(){for(let t in e)yield e[t]}return $e(r())}function ur(e){const r=H(),t=E.useCallback(()=>{const s=e();return or(s).filter(o=>D.isRef(o)||D.isReactive(o))},[e]),a=E.useMemo(()=>t(),[t]);return N(()=>a,r,{deep:!0}),e()}function nt(e){const r=Le(()=>e.target.setup(e.props)),t=ur(()=>r),a=e.target.render;return Ke.jsx(a,{...t})}function fr(e){return r=>Ke.jsx(nt,{target:e,props:r})}function lr(e){const[r]=E.useState(()=>D.ref(e)),t=H();return N(r,t,{deep:!0}),r}function cr(e){const[r]=E.useState(()=>D.shallowRef(e)),t=H();return N(r,t),r}function hr(e){const[r]=E.useState(()=>D.customRef(e)),t=H();return N(r,t),r}function vr(e){const[r]=E.useState(()=>D.reactive(e)),t=H();return N(r,t),r}function dr(e){const[r]=E.useState(()=>D.shallowReactive(e)),t=H();return N(r,t),r}function yr(e){const[r]=E.useState(()=>D.readonly(e)),t=H();return N(r,t),r}function pr(e){const[r]=E.useState(()=>D.shallowReadonly(e)),t=H();return N(r,t),r}function at(e,r){const[t]=E.useState(()=>D.computed(e,r)),a=H();return N(t,a),t}function _r({children:e}){return at(()=>e()).value}function it(e,r={}){return D.watch(e,null,{...r,onWarn:Ve.warn,scheduler:t=>t()})}const gr=(e,r)=>{const[t]=E.useState(()=>it(e,r));return Re(()=>t.stop()),t};function br(...e){const r=E.useRef(!1),[t]=E.useState(()=>D.effectScope(...e)),a=E.useRef(t.run),s=E.useCallback(i=>{if(!r.current)return r.current=!0,a.current.bind(t)(i)},[]);return t.run=s,t}const mr=ye.watch.bind(ye);Object.defineProperty(R,"baseWatch",{enumerable:!0,get:()=>D.watch}),R.Observer=_r,R.SetupComponentRenderer=nt,R.defineSetupComponent=fr,R.onBeforeUnmount=Re,R.onMounted=Be,R.onUpdated=Et,R.useComputed=at,R.useCustomRef=hr,R.useEffectScope=br,R.useReactive=vr,R.useReactivity=sr,R.useReadonly=yr,R.useRef=lr,R.useShallowReactive=dr,R.useShallowReadonly=pr,R.useShallowRef=cr,R.useWatch=N,R.useWatchEffect=gr,R.watch=mr,R.watchEffect=it,R.watcherInstance=ye,Object.keys(D).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(R,e)&&Object.defineProperty(R,e,{enumerable:!0,get:()=>D[e]})}),Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})});
diff --git a/package.json b/package.json
index f42ee04..07134fc 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "veact",
- "version": "1.0.0",
+ "version": "1.1.0",
"description": "Mutable state enhancer library for React by @vue/reactivity",
"keywords": [
"React",
@@ -50,12 +50,15 @@
"react-dom": "^16.8.0 || ^17 || ^18 || ^19"
},
"dependencies": {
- "@vue/reactivity": ">=3.5"
+ "@vue/reactivity": ">=3.5",
+ "lodash": "^4.17.21",
+ "ts-pystyle": "^1.4.4"
},
"devDependencies": {
"@eslint/js": "^9.x",
"@testing-library/react": "^16.x",
"@types/eslint": "^9.x",
+ "@types/lodash": "^4",
"@types/react": "^18.x",
"@types/react-dom": "^18.x",
"@vitejs/plugin-react": "^4.x",
diff --git a/src/index.ts b/src/index.ts
index c0322ce..da2215b 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -3,8 +3,11 @@
* @author Surmon
*/
+import { watcherInstance } from './watch'
+
// redirect all APIs from @vue/reactivity
export * from '@vue/reactivity'
+export * from "./setup/setupComponents"
export { watch as baseWatch } from '@vue/reactivity'
// lifecycle hooks
@@ -23,7 +26,11 @@ export { useReadonly, useShallowReadonly } from './readonly'
export { useComputed } from './computed'
// watch and hooks
-export { watch, useWatch } from './watch'
+export { watcherInstance, useWatch } from './watch'
+//兼容处理
+const watch=watcherInstance.watch.bind(watcherInstance);
+export {watch};
+export * from "./observer"
export type { WatchOptions, MultiWatchSources } from './watch'
// watchEffect and hooks
diff --git a/src/observer/index.tsx b/src/observer/index.tsx
new file mode 100644
index 0000000..6c6ffc0
--- /dev/null
+++ b/src/observer/index.tsx
@@ -0,0 +1,40 @@
+import { FunctionComponent, ReactElement, useMemo } from "react";
+import { useComputed } from "../computed";
+import React from "react";
+import { useOnce } from "../useOnce";
+
+//允许组件直接对外部响应式容器进行反应
+//自动缓存dom
+/**
+ * 对应mobx的observe
+ * 全函数监听
+ * 让func在另一个组件的上下文中执行
+ */
+function observe(Func:(p:P)=>ReactElement){
+ const t:FunctionComponent
=(p)=>{
+
+ //todo:设法让执行过程在computed上下文中 同时保持函数上下文不变
+ return Func(p);
+ }
+ return t;
+}
+
+// let Comp=observe((p:{
+// aaa:number
+// })=>{
+// return
+// })
+// let a=
+
+
+
+/**
+ * 对应mobx的组件
+ * 函数中不能调用hook
+ */
+export function Observer({children}:{
+ children:()=>ReactElement
+}){
+ const v=useComputed(()=>children())
+ return v.value;
+}
diff --git a/src/reactivity.ts b/src/reactivity.ts
index 4fc2bd5..cb9ccd8 100644
--- a/src/reactivity.ts
+++ b/src/reactivity.ts
@@ -5,6 +5,10 @@
import { useWatch } from './watch'
import { useForceUpdate } from './_utils'
+import { useCallback, useMemo } from 'react'
+import { mapValues } from 'lodash'
+import { list } from 'ts-pystyle'
+import { isReactive, isRef } from '@vue/reactivity'
/**
* Converts some of the 'raw Vue' data, which is not already wrapped in a hook,
@@ -40,3 +44,30 @@ export function useReactivity(getter: () => T): T {
useWatch(() => getter(), forceUpdate, { deep: true })
return getter()
}
+
+function objToArr(obj:any){
+ function *inner(){
+ for(let k in obj){
+ yield obj[k]
+ }
+ }
+ return list(inner());
+}
+/**
+ * 执行对象内监听 过滤非ref reactive
+ * 针对构造setupComponent支持
+ * @param getter
+ * @returns
+ */
+export function useReactivityObject(getter: () => T): T {
+ const forceUpdate = useForceUpdate()
+ // deep > watch > traverse(getter()) > ref | array | set | map | plain object(reactive) > force update
+ const f=useCallback(()=>{
+ const t=getter();
+ const ar=objToArr(t).filter(v=>isRef(v)||isReactive(v))
+ return ar;
+ },[getter])
+ const v=useMemo(()=>f(),[f])
+ useWatch(() => v, forceUpdate, { deep: true })
+ return getter()
+}
diff --git a/src/setup/setupComponents.tsx b/src/setup/setupComponents.tsx
new file mode 100644
index 0000000..443f63b
--- /dev/null
+++ b/src/setup/setupComponents.tsx
@@ -0,0 +1,40 @@
+import { ReactElement } from "react";
+import { useOnce } from "../useOnce";
+import { isReactive, isRef, reactive } from "@vue/reactivity";
+import React from "react";
+import { useReactivity, useReactivityObject } from "../reactivity";
+import { mapValues } from "lodash";
+
+export interface ISetupComponent {
+ setup(p: P): T;
+ render(ctx: T): ReactElement;
+}
+
+export function SetupComponentRenderer(p: {
+ target: ISetupComponent;
+ props: any;
+}) {
+ const store = useOnce(() => {
+ let t = p.target.setup(p.props);
+ return t;
+ });
+ const t=useReactivityObject(()=>store)
+ // let t = mapValues(store, (v, k) => {
+ // if (isRef(v) || isReactive(v)) {
+ // return useReactivity(() => v);
+ // } else return v;
+ // });
+ const RenderComp = p.target.render;
+ return ;
+}
+
+/**
+ * 定义一个veact组件
+ * @param v 类似vue的定义对象
+ * @returns
+ */
+export function defineSetupComponent(v: ISetupComponent
) {
+ return (props: P) => {
+ return ;
+ };
+}
diff --git a/src/useImState.ts b/src/useImState.ts
new file mode 100644
index 0000000..c7fed6b
--- /dev/null
+++ b/src/useImState.ts
@@ -0,0 +1,7 @@
+/**
+ * 立即执行state
+ */
+
+export default function useImState(init:()=>T){
+
+}
diff --git a/src/useOnce.ts b/src/useOnce.ts
new file mode 100644
index 0000000..9b67421
--- /dev/null
+++ b/src/useOnce.ts
@@ -0,0 +1,16 @@
+import { useRef } from "react";
+
+/**
+ * 保证函数只执行一次 后每次返回同样的结果
+ * @param func 执行一次并返回结果的函数
+ * @returns
+ */
+export function useOnce(func: () => T) {
+ const first = useRef(true);
+ const data = useRef(undefined);
+ if (first.current) {
+ first.current = false;
+ data.current = func();
+ }
+ return data.current as T;
+}
diff --git a/src/watch.ts b/src/watch.ts
index f7dd1ef..b9d5eec 100644
--- a/src/watch.ts
+++ b/src/watch.ts
@@ -1,9 +1,10 @@
+
/**
* @module veact.watch
* @author Surmon
*/
-import { useState as useReactState } from 'react'
+import { MutableRefObject, useCallback, useEffect, useState as useReactState, useRef } from 'react'
import { watch as vueWatch } from '@vue/reactivity'
import type {
ReactiveMarker,
@@ -12,8 +13,9 @@ import type {
WatchSource,
WatchHandle,
} from '@vue/reactivity'
-import { onBeforeUnmount } from './lifecycle'
+import { onBeforeUnmount, onMounted } from './lifecycle'
import { logger } from './_logger'
+import { useOnce } from './useOnce'
// changelog: https://github.com/vuejs/core/blob/main/CHANGELOG.md
// https://github.com/vuejs/core/blob/main/packages/runtime-core/src/apiWatch.ts
@@ -32,10 +34,10 @@ export type MultiWatchSources = (WatchSource | object)[]
type MaybeUndefined = I extends true ? T | undefined : T
type MapSources = {
[K in keyof T]: T[K] extends WatchSource
- ? MaybeUndefined
- : T[K] extends object
- ? MaybeUndefined
- : never
+ ? MaybeUndefined
+ : T[K] extends object
+ ? MaybeUndefined
+ : never
}
/**
@@ -54,48 +56,51 @@ type MapSources = {
* })
* ```
*/
+export class WatchHelper {
-// overload: single source + cb
-export function watch = false>(
- source: WatchSource,
- callback: WatchCallback>,
- options?: WatchOptions,
-): WatchHandle
-
-// overload: reactive array or tuple of multiple sources + cb
-export function watch, Immediate extends Readonly = false>(
- sources: readonly [...T] | T,
- callback: [T] extends [ReactiveMarker]
- ? WatchCallback>
- : WatchCallback, MapSources>,
- options?: WatchOptions,
-): WatchHandle
-
-// overload: array of multiple sources + cb
-export function watch = false>(
- sources: [...T],
- callback: WatchCallback, MapSources>,
- options?: WatchOptions,
-): WatchHandle
-
-// overload: watching reactive object w/ cb
-export function watch = false>(
- source: T,
- callback: WatchCallback>,
- options?: WatchOptions,
-): WatchHandle
-
-// implementation
-export function watch = false>(
- source: T | WatchSource,
- callback: WatchCallback,
- options: WatchOptions = {},
-): WatchHandle {
- return vueWatch(source as any, callback, {
- ...options,
- onWarn: logger.warn,
- scheduler: (job) => job(),
- })
+ //type tricky
+ // overload: single source + cb
+ watch = false, >(
+ source: WatchSource,
+ callback: WatchCallback>,
+ options?: WatchOptions,
+ ): R
+
+ // overload: reactive array or tuple of multiple sources + cb
+ watch, Immediate extends Readonly = false>(
+ sources: readonly [...T] | T,
+ callback: [T] extends [ReactiveMarker]
+ ? WatchCallback>
+ : WatchCallback, MapSources>,
+ options?: WatchOptions,
+ ): R
+
+ // overload: array of multiple sources + cb
+ watch = false>(
+ sources: [...T],
+ callback: WatchCallback, MapSources>,
+ options?: WatchOptions,
+ ): R
+
+ // overload: watching reactive object w/ cb
+ watch = false>(
+ source: T,
+ callback: WatchCallback>,
+ options?: WatchOptions,
+ ): R
+
+ // implementation
+ watch = false>(
+ source: T | WatchSource,
+ callback: WatchCallback,
+ options: WatchOptions = {},
+ ): R {
+ return vueWatch(source as any, callback, {
+ ...options,
+ onWarn: logger.warn,
+ scheduler: (job) => job(),
+ }) as any
+ }
}
/**
@@ -114,8 +119,40 @@ export function watch = false>(
* })
* ```
*/
-export const useWatch: typeof watch = (source: any, callback: any, options = {}) => {
- const [watchHandle] = useReactState(() => watch(source as any, callback, options))
- onBeforeUnmount(() => watchHandle.stop())
- return watchHandle
+
+export const watcherInstance=new WatchHelper();
+
+export const useWatch: (InstanceType>>)["watch"] = (source: any, callback: any, options = {}) => {
+ const watcher = useRef()
+ //执行watch
+ const cancelWatch = useCallback(() => {
+ if (watcher.current) {
+ watcher.current();
+ watcher.current = undefined;
+ }
+ }, [])
+ const doWatch = useCallback(() => {
+ if (watcher.current) cancelWatch();
+
+ watcher.current = watcherInstance.watch(source as any, (...args) => {
+ console.log("触发更新")
+ callback(...args)
+ }, options)
+
+ }, [])
+ onMounted(() => {
+ console.log("执行监听")
+ doWatch();
+ })
+ onBeforeUnmount(() => {
+ console.log("取消监听")
+ cancelWatch();
+ })
+ useOnce(() => {
+ console.log("初始监听")
+ doWatch();
+ })
+
+ return watcher;
}
+
diff --git "a/\350\256\241\345\210\222.md" "b/\350\256\241\345\210\222.md"
new file mode 100644
index 0000000..3f7b54d
--- /dev/null
+++ "b/\350\256\241\345\210\222.md"
@@ -0,0 +1,7 @@
+# 计划
+- [ ] 添加局部监听器支持,添加observe函数与Observer组件,实现可选全组件刷新与可选局部刷新
+- [ ] 添加vite插件支持自动处理template标签并处理其中的style
+ - [ ] 可选支持属性区分
+ - [ ] 可选支持类prefix支持(纯class支持)
+- [ ] 获取react的Internal dispatcher中的唯一id进行组件标记
+- [ ] 改为直接链接到memoriedState,避免直接使用hook(待定)