frosty 0.0.106 → 0.0.108

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/_native.d.ts +3 -3
  2. package/dist/_native.js +2 -2
  3. package/dist/_native.mjs +2 -2
  4. package/dist/dom.d.ts +3 -3
  5. package/dist/dom.js +3 -3
  6. package/dist/dom.mjs +3 -3
  7. package/dist/index.d.ts +5 -5
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +2 -2
  10. package/dist/index.mjs +3 -3
  11. package/dist/internals/{common-BcsIDGYU.d.ts → common-CpEB3ieX.d.ts} +2 -2
  12. package/dist/internals/{common-BcsIDGYU.d.ts.map → common-CpEB3ieX.d.ts.map} +1 -1
  13. package/dist/internals/{fragment-DKCD1vbK.d.ts → fragment-CaAgTjMI.d.ts} +2 -2
  14. package/dist/internals/{fragment-DKCD1vbK.d.ts.map → fragment-CaAgTjMI.d.ts.map} +1 -1
  15. package/dist/internals/{renderer-UC6atzRe.mjs → renderer--0PsU-Q7.mjs} +3 -3
  16. package/dist/internals/{renderer-UC6atzRe.mjs.map → renderer--0PsU-Q7.mjs.map} +1 -1
  17. package/dist/internals/{renderer-ClfQWto_.d.ts → renderer--F4YB5QP.d.ts} +3 -3
  18. package/dist/internals/{renderer-ClfQWto_.d.ts.map → renderer--F4YB5QP.d.ts.map} +1 -1
  19. package/dist/internals/{renderer-CrkHpyGl.js → renderer-B7W4MPhB.js} +22 -11
  20. package/dist/internals/renderer-B7W4MPhB.js.map +1 -0
  21. package/dist/internals/{renderer-BbAH2tVg.mjs → renderer-BnAgo9Lq.mjs} +22 -11
  22. package/dist/internals/renderer-BnAgo9Lq.mjs.map +1 -0
  23. package/dist/internals/{renderer-7nrHSjnF.d.ts → renderer-Bv5pi6kG.d.ts} +3 -3
  24. package/dist/internals/{renderer-7nrHSjnF.d.ts.map → renderer-Bv5pi6kG.d.ts.map} +1 -1
  25. package/dist/internals/{renderer-Dh6XARYX.js → renderer-XtpnTAvD.js} +3 -3
  26. package/dist/internals/{renderer-Dh6XARYX.js.map → renderer-XtpnTAvD.js.map} +1 -1
  27. package/dist/internals/{state-BUsKrPS6.js → state-4DjTr6NP.js} +2 -2
  28. package/dist/internals/state-4DjTr6NP.js.map +1 -0
  29. package/dist/internals/{state-ChcSdPG6.mjs → state-DHNx5rLZ.mjs} +2 -2
  30. package/dist/internals/state-DHNx5rLZ.mjs.map +1 -0
  31. package/dist/internals/{sync-BTwu3J9M.mjs → sync-0lfEEQfP.mjs} +2 -2
  32. package/dist/internals/{sync-BTwu3J9M.mjs.map → sync-0lfEEQfP.mjs.map} +1 -1
  33. package/dist/internals/{sync-DddZEmk8.js → sync-h5hbWjqx.js} +2 -2
  34. package/dist/internals/{sync-DddZEmk8.js.map → sync-h5hbWjqx.js.map} +1 -1
  35. package/dist/internals/{utils-CrbA4_Jr.d.ts → utils-B79j-cNE.d.ts} +2 -2
  36. package/dist/internals/{utils-CrbA4_Jr.d.ts.map → utils-B79j-cNE.d.ts.map} +1 -1
  37. package/dist/jsx-dev-runtime.d.ts +2 -2
  38. package/dist/jsx-runtime.d.ts +2 -2
  39. package/dist/server-dom.d.ts +3 -3
  40. package/dist/server-dom.js +3 -3
  41. package/dist/server-dom.mjs +3 -3
  42. package/dist/web.d.ts +3 -3
  43. package/dist/web.js +4 -4
  44. package/dist/web.mjs +5 -5
  45. package/package.json +1 -1
  46. package/dist/internals/renderer-BbAH2tVg.mjs.map +0 -1
  47. package/dist/internals/renderer-CrkHpyGl.js.map +0 -1
  48. package/dist/internals/state-BUsKrPS6.js.map +0 -1
  49. package/dist/internals/state-ChcSdPG6.mjs.map +0 -1
package/dist/_native.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { N as NativeElementType, c as PropsType, C as ComponentNode } from './internals/common-BcsIDGYU.js';
2
- export { V as VNode, _ as _Renderer } from './internals/renderer-ClfQWto_.js';
3
- export { u as uniqueId } from './internals/utils-CrbA4_Jr.js';
1
+ import { N as NativeElementType, c as PropsType, C as ComponentNode } from './internals/common-CpEB3ieX.js';
2
+ export { V as VNode, _ as _Renderer } from './internals/renderer--F4YB5QP.js';
3
+ export { u as uniqueId } from './internals/utils-B79j-cNE.js';
4
4
  import '@o2ter/utils-js';
5
5
  import 'lodash';
6
6
  import 'csstype';
package/dist/_native.js CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var runtime = require('./internals/runtime-PKOt40BM.js');
4
- var renderer = require('./internals/renderer-CrkHpyGl.js');
5
- var state = require('./internals/state-BUsKrPS6.js');
4
+ var renderer = require('./internals/renderer-B7W4MPhB.js');
5
+ var state = require('./internals/state-4DjTr6NP.js');
6
6
  require('lodash');
7
7
  require('nextick');
8
8
  require('myers.js');
package/dist/_native.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { _ as _createElement } from './internals/runtime-DrGYUphO.mjs';
2
2
  export { N as NativeElementType } from './internals/runtime-DrGYUphO.mjs';
3
- export { _ as _Renderer } from './internals/renderer-BbAH2tVg.mjs';
4
- export { d as EventEmitter, V as VNode, a as uniqueId } from './internals/state-ChcSdPG6.mjs';
3
+ export { _ as _Renderer } from './internals/renderer-BnAgo9Lq.mjs';
4
+ export { d as EventEmitter, V as VNode, a as uniqueId } from './internals/state-DHNx5rLZ.mjs';
5
5
  import 'lodash';
6
6
  import 'nextick';
7
7
  import 'myers.js';
package/dist/dom.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { _ as _DOMRenderer } from './internals/renderer-7nrHSjnF.js';
2
- import './internals/common-BcsIDGYU.js';
1
+ import { _ as _DOMRenderer } from './internals/renderer-Bv5pi6kG.js';
2
+ import './internals/common-CpEB3ieX.js';
3
3
  import '@o2ter/utils-js';
4
4
  import 'lodash';
5
5
  import 'csstype';
6
- import './internals/renderer-ClfQWto_.js';
6
+ import './internals/renderer--F4YB5QP.js';
7
7
  import 'jsdom';
8
8
 
9
9
  declare class DOMRenderer extends _DOMRenderer {
package/dist/dom.js CHANGED
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var renderer = require('./internals/renderer-Dh6XARYX.js');
3
+ var renderer = require('./internals/renderer-XtpnTAvD.js');
4
4
  require('lodash');
5
5
  require('myers.js');
6
- require('./internals/renderer-CrkHpyGl.js');
7
- require('./internals/state-BUsKrPS6.js');
6
+ require('./internals/renderer-B7W4MPhB.js');
7
+ require('./internals/state-4DjTr6NP.js');
8
8
  require('./internals/runtime-PKOt40BM.js');
9
9
  require('nextick');
10
10
  require('postcss');
package/dist/dom.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { _ as _DOMRenderer } from './internals/renderer-UC6atzRe.mjs';
1
+ import { _ as _DOMRenderer } from './internals/renderer--0PsU-Q7.mjs';
2
2
  import 'lodash';
3
3
  import 'myers.js';
4
- import './internals/renderer-BbAH2tVg.mjs';
5
- import './internals/state-ChcSdPG6.mjs';
4
+ import './internals/renderer-BnAgo9Lq.mjs';
5
+ import './internals/state-DHNx5rLZ.mjs';
6
6
  import './internals/runtime-DrGYUphO.mjs';
7
7
  import 'nextick';
8
8
  import 'postcss';
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { P as PropsWithChildren, C as ComponentNode, S as SetStateAction, a as ComponentType, E as ElementNode, R as RefObject, b as Ref, _ as _ElementType, N as NativeElementType, c as PropsType } from './internals/common-BcsIDGYU.js';
2
- export { h as CSSProperties, e as ClassName, j as ComponentProps, k as ComponentPropsWithoutRef, m as ComponentRef, g as ExtendedCSSProperties, i as RefAttribute, l as RefCallback, f as StyleProp, d as createElement } from './internals/common-BcsIDGYU.js';
3
- export { F as Fragment } from './internals/fragment-DKCD1vbK.js';
1
+ import { P as PropsWithChildren, C as ComponentNode, S as SetStateAction, a as ComponentType, E as ElementNode, R as RefObject, b as Ref, _ as _ElementType, N as NativeElementType, c as PropsType } from './internals/common-CpEB3ieX.js';
2
+ export { h as CSSProperties, e as ClassName, j as ComponentProps, k as ComponentPropsWithoutRef, m as ComponentRef, g as ExtendedCSSProperties, i as RefAttribute, l as RefCallback, f as StyleProp, d as createElement } from './internals/common-CpEB3ieX.js';
3
+ export { F as Fragment } from './internals/fragment-CaAgTjMI.js';
4
4
  import _ from 'lodash';
5
5
  import { Awaitable } from '@o2ter/utils-js';
6
- export { m as mergeRefs } from './internals/utils-CrbA4_Jr.js';
6
+ export { m as mergeRefs } from './internals/utils-B79j-cNE.js';
7
7
  import 'csstype';
8
8
 
9
- declare const createPairs: ({ allowTextChildren }: {
9
+ declare const createPairs: ({ allowTextChildren }?: {
10
10
  allowTextChildren?: boolean;
11
11
  }) => {
12
12
  Parent: ({ children }: PropsWithChildren<{}>) => ComponentNode;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sources":["../src/core/components/pairs.ts","../src/core/hooks/misc/resource/types.ts","../src/core/hooks/misc/resource/error.tsx","../src/core/hooks/misc/resource/index.ts","../src/core/hooks/misc/interval.ts","../src/core/hooks/misc/store.ts","../src/core/hooks/awaited.ts","../src/core/hooks/debounce.ts","../src/core/hooks/effect.ts","../src/core/hooks/context.ts","../src/core/hooks/memo.ts","../src/core/hooks/ref.ts","../src/core/hooks/callback.ts","../src/core/hooks/state.ts","../src/core/hooks/stack.ts","../src/core/hooks/reducer.ts","../src/core/hooks/sync.ts","../src/core/hooks/storage.ts","../src/core/types/error.ts","../src/core/types/props.ts"],"sourcesContent":["//\n// pairs.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from \"lodash\";\nimport { PropsWithChildren } from \"../types/common\";\nimport { NativeElementType } from \"../types/component\";\nimport { _createElement } from \"../types/runtime\";\n\nexport abstract class _ParentComponent extends NativeElementType {\n abstract isChildNode(child: any): boolean;\n}\n\nexport abstract class _ChildComponent extends NativeElementType {\n}\n\nexport const createPairs = ({ allowTextChildren }: {\n allowTextChildren?: boolean;\n}) => {\n class ChildComponent extends _ChildComponent {\n }\n class ParentComponent extends _ParentComponent {\n isChildNode(child: any) {\n if (allowTextChildren && _.isString(child)) return true;\n return child instanceof ChildComponent;\n }\n }\n return {\n Parent: ({ children }: PropsWithChildren<{}>) => _createElement(ParentComponent, { children }),\n Child: ({ children }: PropsWithChildren<{}>) => _createElement(ChildComponent, { children }),\n }\n}\n","//\n// types.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { Awaitable } from '@o2ter/utils-js';\nimport { SetStateAction } from '../../../types/common';\n\n/**\n * Represents a function to fetch asynchronous resources.\n * \n * @template T - The type of the resource being fetched.\n * @template P - The type of the parameters passed to the fetch function.\n * \n * @param x - An object containing:\n * - `abortSignal`: An `AbortSignal` to handle cancellation of the fetch operation.\n * - `param`: Optional parameters for the fetch operation, passed by the `refresh` or `next` function.\n * - `prevState`: The previous state of the resource, if applicable. This is only populated when the `next` function is called.\n * - `dispatch`: A function to update the resource state during the fetch process.\n * \n * @returns A promise that resolves to the fetched resource or `void`.\n */\nexport type Fetch<T, P> = (x: {\n abortSignal: AbortSignal;\n param?: P;\n prevState?: T;\n dispatch: (value: SetStateAction<T, T | undefined>) => void;\n}) => PromiseLike<void | T>;\n\n/**\n * Represents a function to fetch asynchronous iterable resources, such as streams or paginated data.\n * \n * @template T - The type of the resource items being fetched.\n * @template P - The type of the parameters passed to the fetch function.\n * \n * @param x - An object containing:\n * - `abortSignal`: An `AbortSignal` to handle cancellation of the fetch operation.\n * - `param`: Optional parameters for the fetch operation, passed by the `refresh` or `next` function.\n * \n * @returns An `AsyncIterable` that yields the fetched resource items.\n */\nexport type FetchWithIterable<T, P> = (x: {\n abortSignal: AbortSignal;\n param?: P;\n}) => Awaitable<AsyncIterable<T>>;\n\n/**\n * Configuration object for asynchronous resource fetching.\n * \n * @template F - The type of the fetch function.\n * \n * @property fetch - The fetch function to retrieve the resource.\n * @property debounce - Optional debounce settings to control the frequency of fetch calls.\n * - `wait`: The number of milliseconds to delay.\n * - Other settings as defined in `_.DebounceSettings`.\n */\nexport type Config<F> = {\n fetch: F,\n debounce?: _.DebounceSettings & { wait?: number; },\n};\n","//\n// error.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { Awaitable } from '@o2ter/utils-js';\nimport { ComponentType, PropsWithChildren, SetStateAction } from '../../../types/common';\nimport { createContext } from '../../context';\nimport { useContext } from '../../context';\nimport { useState } from '../../state';\nimport { useMemo } from '../../memo';\nimport { useRendererStorage } from '../../storage';\n\ntype Errors = {\n token: string;\n error: any;\n refresh: () => Awaitable<void>;\n refreshing: boolean;\n loading: boolean;\n}[];\n\ntype ContextValue = {\n errors: Errors;\n setErrors: (values: SetStateAction<Errors>) => void;\n};\n\nconst defaultStorageKey = Symbol();\nconst Context = createContext<ContextValue>();\n\n/**\n * A context provider component for managing asynchronous resource errors.\n * \n * This component provides a shared context for tracking errors encountered during\n * asynchronous operations. It allows child components to access and manage these errors\n * using the `useResourceErrors` hook.\n * \n * ### Usage:\n * Wrap your application or specific parts of it with this component to enable error tracking:\n * \n * ```tsx\n * <ResourceErrors>\n * <YourComponent />\n * </ResourceErrors>\n * ```\n * \n * @param children - The child components that will have access to the error context.\n * \n * @returns A context provider that wraps the provided children.\n */\nexport const ResourceErrors: ComponentType<PropsWithChildren<{}>> = ({\n children\n}) => {\n const [errors, setErrors] = useState<Errors>([]);\n const value = useMemo(() => ({ errors, setErrors }), [errors, setErrors]);\n return (\n <Context value={value}>{children}</Context>\n );\n}\n\nexport const useErrorContext = () => {\n const value = useContext(Context);\n if (value) return value;\n const storage = useRendererStorage();\n const found = storage.get(defaultStorageKey);\n if (found) return found as ContextValue;\n const store: ContextValue = {\n errors: [],\n setErrors: (values: SetStateAction<Errors>) => {\n store.errors = _.isFunction(values) ? values(store.errors) : values;\n },\n };\n storage.set(defaultStorageKey, store);\n return store;\n};\n\n/**\n * A hook to access the list of asynchronous resource errors.\n * \n * This hook allows components to retrieve the current list of errors being tracked\n * in the `ResourceErrors` context. It must be used within a component that is\n * a descendant of the `ResourceErrors` provider.\n * \n * ### Usage:\n * ```tsx\n * import { useEffect, useResourceErrors } from 'frosty';\n * \n * const errors = useResourceErrors();\n * \n * useEffect(() => {\n * errors.forEach(({ token, error, refresh }) => {\n * console.error(`Error [${token}]:`, error);\n * // Optionally call refresh() to retry the operation\n * });\n * }, [errors]);\n * ```\n * \n * @returns The list of errors currently being tracked in the context. Each error includes:\n * - `token`: A unique identifier for the error.\n * - `error`: The error object or message.\n * - `refresh`: A function to retry the operation that caused the error.\n */\nexport const useResourceErrors = () => useErrorContext().errors;\n","//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { SetStateAction } from '../../../types/common';\nimport { Config, Fetch, FetchWithIterable } from './types';\nimport { useState } from '../../state';\nimport { useEffect } from '../../effect';\nimport { useCallback } from '../../callback';\nimport { useAsyncDebounce } from '../../debounce';\nimport { useErrorContext } from './error';\nimport { uniqueId } from '../../../../core/utils';\nexport { ResourceErrors, useResourceErrors } from './error';\n\n/**\n * A hook to manage asynchronous resources with support for debouncing, error handling, and state management.\n * \n * @template T - The type of the resource being fetched.\n * @template P - The type of the parameters passed to the fetch function.\n * \n * @param config - The fetch function or a configuration object containing the fetch function and optional debounce settings.\n * @param deps - An optional dependency array to control when the resource is refreshed.\n * \n * @returns An object containing:\n * - `count`: The number of times the resource has been fetched.\n * - `refreshing`: A boolean indicating if the resource is currently being refreshed.\n * - `loading`: A boolean indicating if the resource is currently being loaded.\n * - `resource`: The fetched resource.\n * - `error`: Any error encountered during the fetch.\n * - `cancel`: A function to cancel the current fetch operation.\n * - `refresh`: A function to refresh the resource.\n * - `next`: A function to fetch the next set of data (for paginated resources).\n * - `setResource`: A function to manually update the resource state.\n */\nexport const useResource = <T, P = any>(\n config: Fetch<T, P> | Config<Fetch<T, P>>,\n deps?: any,\n) => {\n\n const fetch = _.isFunction(config) ? config : config.fetch;\n const debounce = _.isFunction(config) ? {} : config.debounce;\n\n const [state, setState] = useState<{\n type?: 'refresh' | 'next';\n count?: number;\n flag?: boolean;\n resource?: T;\n error?: any;\n token?: string;\n abort?: AbortController;\n }>({});\n\n const _dispatch = (\n token: string,\n next: SetStateAction<typeof state>,\n ) => setState(state => state.token === token ? ({\n ...(_.isFunction(next) ? next(state.flag ? state : _.omit(state, 'resource', 'error')) : next),\n count: state.flag ? state.count : (state.count ?? 0) + 1,\n flag: true,\n }) : state);\n\n const _fetch = useAsyncDebounce(async (\n type: 'refresh' | 'next',\n abort: AbortController,\n reset: boolean,\n param?: P,\n prevState?: T,\n ) => {\n\n const token = uniqueId();\n setState(state => ({ ...state, type, token, abort, flag: !reset }));\n\n try {\n\n const resource = await fetch({\n param,\n prevState,\n abortSignal: abort.signal,\n dispatch: (next) => {\n _dispatch(token, state => ({\n ...state,\n resource: _.isFunction(next) ? next(state.resource) : next,\n }));\n },\n });\n\n _dispatch(token, state => ({ resource: resource ?? state.resource }));\n\n } catch (error) {\n\n _dispatch(token, state => ({\n resource: state.resource,\n error,\n }));\n }\n\n }, debounce ?? {});\n\n useEffect(() => {\n const controller = new AbortController();\n void _fetch('refresh', controller, true);\n return () => controller.abort();\n }, deps ?? []);\n\n const _cancelRef = useCallback((reason?: any) => { state.abort?.abort(reason) });\n const _refreshRef = useCallback((param?: P) => _fetch('refresh', new AbortController(), true, param));\n const _nextRef = useCallback((param?: P) => _fetch('next', new AbortController(), false, param, state.resource));\n const _setResRef = useCallback((resource: T | ((prevState?: T) => T)) => setState(state => ({\n ..._.omit(state, 'resource', 'error'),\n resource: _.isFunction(resource) ? resource(state.resource) : resource,\n })));\n\n const { setErrors } = useErrorContext();\n useEffect(() => {\n const { type, abort, token = uniqueId(), error } = state;\n if (!error) return;\n setErrors(v => [...v, {\n token,\n error,\n refresh: _refreshRef,\n refreshing: !_.isNil(abort) && type === 'refresh',\n loading: !_.isNil(abort),\n }]);\n return () => setErrors(v => _.filter(v, x => x.token !== token));\n }, [state]);\n\n return {\n count: state.count ?? 0,\n refreshing: !_.isNil(state.abort) && state.type === 'refresh',\n loading: !_.isNil(state.abort),\n resource: state.resource,\n error: state.error,\n cancel: _cancelRef,\n refresh: _refreshRef,\n next: _nextRef,\n setResource: _setResRef,\n };\n}\n\n/**\n * A hook to manage asynchronous iterable resources, such as streams or paginated data.\n * \n * @template T - The type of the resource items being fetched.\n * @template P - The type of the parameters passed to the fetch function.\n * \n * @param config - The fetch function or a configuration object containing the fetch function and optional debounce settings.\n * @param deps - An optional dependency array to control when the resource is refreshed.\n * \n * @returns An object containing the same properties as `useResource`, but optimized for iterable resources.\n */\nexport const useIterableResource = <T, P = any>(\n config: FetchWithIterable<T, P> | Config<FetchWithIterable<T, P>>,\n deps?: any,\n) => {\n const fetch = _.isFunction(config) ? config : config.fetch;\n const debounce = _.isFunction(config) ? {} : config.debounce;\n const { next, ...result } = useResource<T[]>({\n fetch: async ({ dispatch, abortSignal, param }) => {\n const resource = await fetch({ abortSignal, param });\n for await (const item of resource) {\n dispatch(items => items ? [...items, item] : [item]);\n }\n },\n debounce,\n }, deps);\n return result;\n}\n","//\n// interval.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { useEffect } from '../effect';\n\n/**\n * A hook that repeatedly calls the provided callback function at the specified interval.\n * \n * @param callback - The function to be executed at each interval.\n * @param ms - The delay in milliseconds between each call to the callback. If not provided, the interval will not be set.\n * @returns void\n * \n * @example\n * useInterval(() => {\n * // Code to run every 1000ms\n * }, 1000);\n */\nexport const useInterval = (\n callback: () => void,\n ms?: number,\n) => useEffect(() => {\n if (_.isNil(ms)) return;\n const interval = setInterval(() => {\n callback();\n }, ms);\n return () => clearInterval(interval);\n}, [ms]);\n","//\n// store.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { SetStateAction } from '../../types/common';\nimport { useSyncExternalStore } from '../sync';\n\n/**\n * A class representing a store that holds a value and allows for subscription\n * to changes in that value.\n *\n * @template T - The type of the value stored in the store.\n *\n * @example\n * const store = createStore(0);\n * store.setValue(1);\n * store.subscribe((oldVal, newVal) => {\n * console.log(`Value changed from ${oldVal} to ${newVal}`);\n * });\n */\nclass Store<T> {\n\n #listeners = new Set<(oldVal: T, newVal: T) => void>();\n #value: T;\n\n /** @internal */\n constructor(initialValue: T) {\n this.#value = initialValue;\n }\n\n /**\n * Gets the current value of the store.\n * \n * @returns The current value of the store.\n */\n get value() {\n return this.#value;\n }\n\n /**\n * Sets the value of the store and notifies all subscribers.\n * \n * @param dispatch - The new value or a function that returns the new value.\n */\n setValue(dispatch: SetStateAction<T>) {\n const oldVal = this.#value;\n this.#value = _.isFunction(dispatch) ? dispatch(this.#value) : dispatch;\n this.#listeners.forEach(listener => void listener(oldVal, this.#value));\n }\n\n /**\n * Subscribes to changes in the store's value.\n * \n * @param callback - The function to call when the value changes.\n * @returns A function to unsubscribe from the store.\n */\n subscribe(callback: (oldVal: T, newVal: T) => void) {\n this.#listeners.add(callback);\n return () => { this.#listeners.delete(callback); };\n }\n}\n\n/**\n * Creates a new store with the given initial value.\n * \n * @param initialValue - The initial value to be stored.\n * @returns {Store<T>} A new store instance.\n *\n * @example\n * const counterStore = createStore(0);\n */\nexport const createStore = <T extends unknown = any>(initialValue: T) => new Store(initialValue);\n\n/**\n * A hook to subscribe to a store and select a slice of its state.\n * The component will re-render when the selected state changes.\n * \n * @param store - The store instance to subscribe to.\n * @param selector - A function to select a part of the store's state. Defaults to the entire state.\n * @param equal - A function to compare selected values for equality. Defaults to deep equality.\n * @returns The selected slice of the store's state.\n *\n * @example\n * const count = useStore(counterStore);\n *\n * @example\n * // Using a selector\n * const userName = useStore(userStore, user => user.name);\n */\nexport const useStore = <T extends unknown = any, S = T>(\n store: Store<T>,\n selector: (state: T) => S = v => v as any,\n equal: (value: S, other: S) => boolean = _.isEqual,\n): S => useSyncExternalStore(\n (onStoreChange) => store.subscribe((oldVal, newVal) => {\n if (!equal(selector(oldVal), selector(newVal))) onStoreChange();\n }),\n () => selector(store.value)\n);\n","//\n// awaited.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { reconciler } from '../reconciler/state';\nimport { _useMemo } from '../reconciler/hooks';\n\nconst resolved = new WeakMap<PromiseLike<any>, { result?: any; error?: any; }>();\n\n/**\n * Eagerly resolves a promise returned by the factory function and caches its result or error.\n *\n * This hook ensures the promise settles before rendering completes. If the promise is still pending,\n * it returns `undefined` and schedules an immediate rerender of the current component. Once resolved, it returns the value.\n * If rejected, it throws the error.\n *\n * #### Usage\n * ```typescript\n * const data = useAwaited(() => fetchData(id), [id]);\n * ```\n *\n * #### Parameters\n * - `factory`: `() => PromiseLike<T>` \n * A function that returns a promise to resolve.\n * - `deps` (optional): `any` \n * Dependency array for memoization. The promise is recreated when dependencies change.\n *\n * #### Returns\n * - `T | undefined` \n * The resolved value, once available. Returns `undefined` while the promise is pending.\n * - Throws the rejection error if the promise fails.\n *\n * #### Throws\n * - Error if used outside a render function.\n * - The rejection error if the promise fails.\n *\n * @template T Type of the resolved value.\n */\nexport const useAwaited = <T>(\n factory: () => PromiseLike<T>,\n deps?: any,\n): T | undefined => {\n const state = reconciler.currentHookState;\n if (!state) throw Error('useAwaited must be used within a render function.');\n const promise = _useMemo('useAwaited', () => factory(), deps ?? null);\n if (resolved.has(promise)) {\n const { result, error } = resolved.get(promise) ?? {};\n if (error) throw error;\n return result;\n }\n state.tasks.push((async () => {\n try {\n const result = await promise;\n resolved.set(promise, { result });\n } catch (error) {\n resolved.set(promise, { error });\n }\n })());\n}","//\n// debounce.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\n\nconst debounce = <T extends (...args: any) => any>(\n callback: T,\n settings: _.DebounceSettings & { wait?: number; },\n) => {\n const { wait, ...options } = settings;\n return _.debounce(callback, wait, {\n ...options,\n leading: 'leading' in options ? !!options.leading : true,\n trailing: 'trailing' in options ? !!options.trailing : true,\n });\n}\n\nconst asyncDebounce = <T extends (...args: any) => PromiseLike<any>>(\n func: T,\n settings: _.DebounceSettings & { wait?: number; },\n) => {\n\n type R = T extends (...args: any) => PromiseLike<infer R> ? R : never;\n let preflight: Promise<R>;\n\n const debounced = debounce(async function (\n this: any,\n resolve?: (value: PromiseLike<R>) => void,\n ...args: Parameters<T>\n ) {\n const result = func.call(this, ...args as any) as PromiseLike<R>;\n if (_.isFunction(resolve)) resolve(result);\n return result;\n }, settings);\n\n return function (this: any, ...args: Parameters<T>) {\n if (_.isNil(preflight)) {\n preflight = new Promise<R>(r => debounced.call(this, r, ...args));\n return preflight;\n }\n return debounced.call(this, undefined, ...args) ?? preflight;\n };\n};\n\n/**\n * A hook that creates a debounced version of a function.\n * The debounced function delays invoking the callback until after\n * the specified wait time has elapsed since the last time it was called.\n * \n * This is useful for optimizing performance in scenarios where frequent\n * function calls (e.g., during user input or window resizing) can be expensive.\n * \n * @template T The type of the callback function.\n * @param callback The function to debounce.\n * @param settings Configuration options for debouncing, including:\n * - `wait` (number): The number of milliseconds to delay.\n * - Other lodash debounce options such as `leading` and `trailing`.\n * @returns A debounced version of the callback function.\n */\nexport const useDebounce = <T extends (...args: any) => any>(\n callback: T,\n settings: _.DebounceSettings & { wait?: number; },\n) => {\n const store = _useMemo('useDebounce', () => {\n const store = {\n current: callback,\n stable: debounce((function (this: any, ...args) {\n return store.current.call(this, ...args);\n }) as T, settings),\n };\n return store;\n }, null);\n store.current = callback;\n return store.stable;\n}\n\n/**\n * A hook that creates a debounced version of an asynchronous function.\n * The debounced function delays invoking the callback until after\n * the specified wait time has elapsed since the last time it was called.\n * \n * This is particularly useful for scenarios where frequent API calls\n * or other asynchronous operations need to be throttled to improve performance.\n * \n * @template T The type of the asynchronous callback function.\n * @param callback The asynchronous function to debounce.\n * @param settings Configuration options for debouncing, including:\n * - `wait` (number): The number of milliseconds to delay.\n * - Other lodash debounce options such as `leading` and `trailing`.\n * @returns A debounced version of the asynchronous callback function.\n */\nexport const useAsyncDebounce = <T extends (...args: any) => PromiseLike<any>>(\n callback: T,\n settings: _.DebounceSettings & { wait?: number; },\n) => {\n const store = _useMemo('useAsyncDebounce', () => {\n const store = {\n current: callback,\n stable: asyncDebounce((function (this: any, ...args) {\n return store.current.call(this, ...args);\n }) as T, settings),\n };\n return store;\n }, null);\n store.current = callback;\n return store.stable;\n}\n","//\n// effect.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { Awaitable } from '@o2ter/utils-js';\nimport { _useEffect } from '../reconciler/hooks';\n\n/**\n * A hook that manages side effects with support for an `AbortSignal`.\n * It ensures proper cleanup logic and handles asynchronous operations effectively.\n *\n * @param effect - \n * A function that receives an `AbortSignal` and performs side effects. \n * It can optionally return a cleanup function or a promise that resolves to a cleanup function.\n *\n * @param deps - \n * An optional dependencies that determines when the effect should be re-executed.\n *\n * @example\n * useEffect((signal) => {\n * fetch('/api/data', { signal })\n * .then(response => response.json())\n * .then(data => console.log(data))\n * .catch(err => {\n * if (err.name === 'AbortError') {\n * console.log('Fetch aborted');\n * } else {\n * console.error(err);\n * }\n * });\n * \n * return () => {\n * console.log('Cleanup logic here');\n * };\n * }, []);\n */\nexport const useEffect = (\n effect: (\n signal: AbortSignal,\n ) => Awaitable<void | (() => Awaitable<void>)>,\n deps?: any,\n) => _useEffect('useEffect', () => {\n const abort = new AbortController();\n try {\n const destructor = effect(abort.signal);\n return () => {\n abort.abort();\n (async () => {\n try {\n const _destructor = await destructor;\n if (_.isFunction(_destructor)) _destructor();\n } catch (e) {\n console.error(e);\n }\n })();\n };\n } catch (e) {\n console.error(e);\n return () => abort.abort();\n }\n}, deps);","//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { reconciler } from '../reconciler/state';\nimport { ComponentType, ElementNode } from '../types/common';\n\nconst _contextDefaultValue = new WeakMap<Context<any>, any>();\n\nexport const isContext = (type: any): type is Context<any> => {\n return _contextDefaultValue.has(type as any);\n};\n\nexport type Context<Value> = ReturnType<typeof _createContext<Value>>;\nexport type ContextType<C extends Context<any>> = C extends Context<infer T> ? T : never;\n\nconst _createContext = <Value extends unknown>(defaultValue: Value) => {\n const _context: ComponentType<{\n value: Value;\n children?: ElementNode | ((value: Value) => ElementNode);\n }> = ({ value, children }) => {\n return _.isFunction(children) ? children(value) : children;\n };\n const Consumer: ComponentType<{\n children: (value: Value) => ElementNode;\n }> = ({ children }) => {\n const value = useContext(_context as Context<Value>);\n return children(value);\n };\n _contextDefaultValue.set(_context as Context<Value>, defaultValue);\n return _.assign(_context, { Consumer });\n};\n\n/**\n * Creates a new context object with an optional default value.\n *\n * A context object allows you to share a value across a component tree\n * without explicitly passing it as a prop to every level.\n *\n * @template Value - The type of the value to be stored in the context.\n * @param - The default value for the context.\n * @returns A context object that can be used to provide and consume the value.\n */\n\nexport function createContext<Value>(defaultValue: Value): Context<Value>;\nexport function createContext<Value = undefined>(): Context<Value | undefined>;\n\nexport function createContext(defaultValue?: any) {\n return _createContext(defaultValue);\n}\n\n/**\n * A hook that retrieves the current value of a context and optionally applies\n * a selector function to transform the context value. This hook ensures that the component\n * subscribes to the context and re-renders when the context value changes.\n *\n * @template T - The type of the context value.\n * @template R - The type of the transformed value returned by the selector.\n * @param context - The context object to retrieve the value from.\n * @param selector - An optional selector function to transform the context value.\n * Defaults to an identity function.\n * @returns - The current value of the context, optionally transformed by the selector.\n *\n * @throws - Throws an error if the provided context is invalid or if the hook\n * is used outside of a render function.\n *\n * @example\n * const MyContext = createContext({ user: null });\n * \n * function MyComponent() {\n * const user = useContext(MyContext, context => context.user);\n * return <div>{user ? `Hello, ${user.name}` : 'Hello, Guest'}</div>;\n * }\n */\nexport const useContext = <T, R = T>(\n context: Context<T>,\n selector: (state: T) => R = v => v as any\n) => {\n if (!isContext(context)) throw Error(`Invalid type of ${context}`);\n const state = reconciler.currentHookState;\n if (!state) throw Error('useContext must be used within a render function.');\n const { contextValue, listens } = state;\n listens.add(context);\n const { value = _contextDefaultValue.get(context) } = contextValue.get(context) ?? {};\n return selector(value);\n};\n","//\n// memo.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\n\n/**\n * A utility function that memoizes the result of a factory function.\n * \n * @template T The type of the value returned by the factory function.\n * @param factory A function that produces a value to be memoized.\n * @param deps An optional dependency array. The memoized value is recalculated \n * only when the dependencies change.\n * @returns The memoized value produced by the factory function.\n */\nexport const useMemo = <T>(\n factory: () => T,\n deps?: any,\n) => _useMemo('useMemo', () => factory(), deps);\n","//\n// memo.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useEffect, _useMemo } from '../reconciler/hooks';\nimport { Ref, RefObject } from '../types/common';\n\n/**\n * Creates a mutable reference object that persists across function calls.\n * \n * @template T The type of the value stored in the reference.\n * @param initialValue The initial value to store in the reference.\n * @returns An object with a `current` property that holds the value.\n */\nexport function useRef<T>(initialValue: T): RefObject<T>;\nexport function useRef<T = undefined>(): RefObject<T | undefined>;\n\nexport function useRef(initialValue?: any) {\n return _useMemo('useRef', () => ({ current: initialValue }), null);\n}\n\n/**\n * Associates a reference with a value created by an initializer function.\n * \n * @template T The type of the reference.\n * @template R The type of the value created by the initializer function.\n * @param ref A reference object or a callback function to receive the value.\n * @param init A function that initializes and returns the value to associate with the reference.\n * @param deps An optional dependency array. The initializer function is re-executed when the dependencies change.\n */\nexport const useRefHandle = <T, R extends T>(\n ref: Ref<T> | undefined,\n init: () => R,\n deps?: any\n) => _useEffect('useRefHandle', () => {\n try {\n if (ref) {\n const _ref = init();\n if (typeof ref === 'function') ref(_ref);\n else if (typeof ref === 'object') ref.current = _ref;\n }\n return () => void 0;\n } catch (e) {\n console.error(e);\n return () => void 0;\n }\n}, deps);","//\n// memo.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\n\n/**\n * A hook that memoizes a callback function, ensuring that it only changes\n * if its dependencies change. This is useful for optimizing performance by preventing\n * unnecessary re-creations of functions.\n *\n * @template T - The type of the callback function.\n * @param callback - The callback function to be memoized.\n * @param deps - An optional dependencies. If provided, the callback\n * will only be updated when one of these dependencies changes.\n * If not provided, the callback will remain stable.\n * @returns - A stable version of the callback function that will not change unless\n * its dependencies change.\n *\n * @example\n * const memoizedCallback = useCallback(() => {\n * console.log('This function is memoized!');\n * }, [dependency]);\n */\n\nexport function useCallback<T extends (...args: any) => any>(\n callback: T,\n deps?: any\n): T;\n\nexport function useCallback<T extends ((...args: any) => any) | _.Falsey>(\n callback: T,\n deps?: any\n): T;\n\nexport function useCallback<T extends ((...args: any) => any) | _.Falsey>(\n callback: T,\n deps?: any\n): T {\n if (!_.isUndefined(deps)) return _useMemo('useCallback', () => callback, deps);\n const store = _useMemo('useCallback', () => {\n const store = {\n current: callback,\n stable: function (this: any, ...args: any) {\n if (_.isFunction(store.current))\n return store.current.call(this, ...args);\n },\n };\n return store;\n }, null);\n if (_.isFunction(callback)) store.current = callback;\n return callback && (store.stable as T);\n}\n","//\n// memo.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\nimport { SetStateAction } from '../types/common';\n\n/**\n * A hook function for managing state within a custom framework or library.\n *\n * @template T - The type of the state value.\n * @param - The initial state value or a function that returns the initial state.\n * @returns - A tuple containing the current state value and a function to update the state.\n *\n * The `useState` function provides a way to manage stateful values. It returns the current state\n * and a setter function that can update the state. The setter function accepts either a new value\n * or a function that receives the current state and returns the updated state.\n *\n * Example:\n * ```typescript\n * const [count, setCount] = useState(0);\n * setCount(5); // Updates the state to 5\n * setCount(prev => prev + 1); // Updates the state to the previous value + 1\n * ```\n */\nexport function useState<T>(initialState: T | (() => T)): [T, (dispatch: SetStateAction<T>) => void];\nexport function useState<T = undefined>(): [T | undefined, (dispatch: SetStateAction<T | undefined>) => void];\n\nexport function useState(initialState?: any) {\n const { value, setValue } = _useMemo('useState', ({ node }) => {\n const state = {\n value: _.isFunction(initialState) ? initialState() : initialState,\n setValue: (dispatch: SetStateAction<any>) => {\n const oldValue = state.value;\n const newValue = _.isFunction(dispatch) ? dispatch(oldValue) : dispatch;\n if (oldValue === newValue) return;\n state.value = newValue;\n node?._setDirty();\n },\n };\n return state;\n }, null);\n return [value, setValue];\n}\n","//\n// stack.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { reconciler } from '../reconciler/state';\n\n/**\n * Retrieves the stack of parent components from the current hook state.\n *\n * This function accesses the current hook state and extracts the stack of \n * parent components. It throws an error if called outside of a valid render \n * context.\n *\n * @returns An array of parent components from the current hook state.\n * @throws Will throw an error if the function is called outside of a valid render context.\n */\nexport const useStack = () => {\n const state = reconciler.currentHookState;\n if (!state) throw Error('useStack must be used within a render function.');\n return _.map(state.stack, x => x._component);\n}\n","//\n// reducer.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\n\n/**\n * A utility function that manages state using a reducer pattern.\n * \n * @template T The type of the state.\n * @template A The type of the action object (optional).\n * @param reducer A function that takes the current state and an action, and returns the new state.\n * @param initialState The initial state value or a function that returns the initial state.\n * @returns A tuple containing the current state and a dispatch function to update the state.\n */\nexport function useReducer<T>(\n reducer: (prevState: T) => T,\n initialState: T | (() => T),\n): [T, (dispatch: () => void) => void];\n\nexport function useReducer<T, A = any>(\n reducer: (prevState: T, action: A) => T,\n initialState: T | (() => T),\n): [T, (dispatch: (action: A) => void) => void];\n\nexport function useReducer<T = undefined>(\n reducer: (prevState: T | undefined) => T | undefined\n): [T | undefined, (dispatch: () => void) => void];\n\nexport function useReducer<T = undefined, A = any>(\n reducer: (prevState: T | undefined, action: A) => T | undefined\n): [T | undefined, (dispatch: (action: A) => void) => void];\n\nexport function useReducer(\n reducer: (prevState: any, action?: any) => any,\n initialState?: any,\n) {\n const { value, dispatch } = _useMemo('useReducer', ({ node }) => {\n const state = {\n value: _.isFunction(initialState) ? initialState() : initialState,\n dispatch: (action?: any) => {\n const oldValue = state.value;\n const newValue = reducer(state.value, action);\n if (oldValue === newValue) return;\n state.value = newValue;\n node?._setDirty();\n },\n };\n return state;\n }, null);\n return [value, dispatch];\n}\n","//\n// sync.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { Awaitable } from '@o2ter/utils-js';\nimport { _useEffect } from '../reconciler/hooks';\nimport { reconciler } from '../reconciler/state';\n\n/**\n * A hook utility for synchronizing with an external store.\n *\n * @template Snapshot - The type of the snapshot returned by the store.\n * @param subscribe - A function that sets up a subscription to the external store.\n * - `onStoreChange`: A callback to invoke when the store changes.\n * - `signal`: An `AbortSignal` to handle cleanup when the subscription is no longer needed.\n * - Returns an optional cleanup function or a promise resolving to one.\n * @param getSnapshot - A function that retrieves the current snapshot of the store.\n * @param getServerSnapshot - (Optional) A function that retrieves the snapshot of the store\n * in a server environment.\n * @returns The current snapshot of the store.\n *\n * @throws Will throw an error if used outside of a valid render context.\n */\nexport const useSyncExternalStore = <Snapshot>(\n subscribe: (\n onStoreChange: () => void,\n signal: AbortSignal,\n ) => Awaitable<void | (() => Awaitable<void>)>,\n getSnapshot: () => Snapshot,\n getServerSnapshot?: () => Snapshot,\n) => {\n const state = reconciler.currentHookState;\n if (!state) throw Error('useSyncExternalStore must be used within a render function.');\n _useEffect('useSyncExternalStore', ({ node }) => {\n const abort = new AbortController();\n try {\n const destructor = subscribe(() => { node?._setDirty(); }, abort.signal);\n return () => {\n abort.abort();\n (async () => {\n try {\n const _destructor = await destructor;\n if (_.isFunction(_destructor)) _destructor();\n } catch (e) {\n console.error(e);\n }\n })();\n };\n } catch (e) {\n console.error(e);\n return () => abort.abort();\n }\n }, null);\n if (getServerSnapshot && state.renderer._server) {\n return getServerSnapshot();\n }\n return getSnapshot();\n};","//\n// storage.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { reconciler } from '../reconciler/state';\n\nconst storage = new WeakMap<any, Map<any, any>>();\n\n/**\n * Returns a persistent storage Map associated with the current renderer instance.\n * This hook allows components to store and retrieve values that persist across renders,\n * scoped to the renderer. Must be called within a render function.\n *\n * @throws Error if called outside of a render function.\n * @returns {Map<any, any>} The storage map for the current renderer.\n */\nexport const useRendererStorage = () => {\n const state = reconciler.currentHookState;\n if (!state) throw Error('useRendererStorage must be used within a render function.');\n const found = storage.get(state.renderer);\n const store = found ?? new Map<any, any>();\n if (!found) storage.set(state.renderer, store);\n return store;\n};\n","//\n// error.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { ComponentType, PropsWithChildren } from './common';\nimport { ComponentNode } from './component';\n\ntype ErrorBoundaryProps = PropsWithChildren<{\n silent?: boolean;\n onError?: (\n error: any,\n component: ComponentNode,\n stack: ComponentNode[],\n ) => void;\n}>;\n\nexport const ErrorBoundary: ComponentType<ErrorBoundaryProps> = ({ children }) => {\n return children;\n}\n","//\n// props.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { ComponentType, PropsWithChildren } from './common';\nimport { NativeElementType } from './component';\nimport { _ElementType, PropsType } from './runtime';\n\ntype PropsProviderProps = PropsWithChildren<{\n callback: (v: {\n type: _ElementType | typeof NativeElementType,\n props: PropsType\n }) => PropsType | undefined | null;\n}>;\n\nexport const PropsProvider: ComponentType<PropsProviderProps> = ({ children }) => {\n return children;\n}\n"],"names":[],"mappings":";;;;;;;;AAOO;AACP;AACA;AACA;AACA;AACA;;ACTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;;ACpDA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;;AC3DP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;;ACXP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;;AC9DP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;;AC5BP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;;AC5BA;AACA;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACA;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;;AC/CP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;;ACRP;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACA;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;;AClBP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACA;;ACnBP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACA;;ACpBP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;;ACVP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACA;AACA;AACA;;ACXP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;;AChBP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;;ACNP;AACA;AACA;AACA;AACO;;ACHP;AACA;AACA;AACA;AACA;AACA;AACO;;;"}
1
+ {"version":3,"file":"index.d.ts","sources":["../src/core/components/pairs.ts","../src/core/hooks/misc/resource/types.ts","../src/core/hooks/misc/resource/error.tsx","../src/core/hooks/misc/resource/index.ts","../src/core/hooks/misc/interval.ts","../src/core/hooks/misc/store.ts","../src/core/hooks/awaited.ts","../src/core/hooks/debounce.ts","../src/core/hooks/effect.ts","../src/core/hooks/context.ts","../src/core/hooks/memo.ts","../src/core/hooks/ref.ts","../src/core/hooks/callback.ts","../src/core/hooks/state.ts","../src/core/hooks/stack.ts","../src/core/hooks/reducer.ts","../src/core/hooks/sync.ts","../src/core/hooks/storage.ts","../src/core/types/error.ts","../src/core/types/props.ts"],"sourcesContent":["//\n// pairs.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from \"lodash\";\nimport { PropsWithChildren } from \"../types/common\";\nimport { NativeElementType } from \"../types/component\";\nimport { _createElement } from \"../types/runtime\";\n\nexport abstract class _ParentComponent extends NativeElementType {\n abstract isChildNode(child: any): boolean;\n}\n\nexport abstract class _ChildComponent extends NativeElementType {\n}\n\nexport const createPairs = ({ allowTextChildren }: {\n allowTextChildren?: boolean;\n} = {}) => {\n class ChildComponent extends _ChildComponent {\n }\n class ParentComponent extends _ParentComponent {\n isChildNode(child: any) {\n if (allowTextChildren && _.isString(child)) return true;\n return child instanceof ChildComponent;\n }\n }\n return {\n Parent: ({ children }: PropsWithChildren<{}>) => _createElement(ParentComponent, { children }),\n Child: ({ children }: PropsWithChildren<{}>) => _createElement(ChildComponent, { children }),\n }\n}\n","//\n// types.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { Awaitable } from '@o2ter/utils-js';\nimport { SetStateAction } from '../../../types/common';\n\n/**\n * Represents a function to fetch asynchronous resources.\n * \n * @template T - The type of the resource being fetched.\n * @template P - The type of the parameters passed to the fetch function.\n * \n * @param x - An object containing:\n * - `abortSignal`: An `AbortSignal` to handle cancellation of the fetch operation.\n * - `param`: Optional parameters for the fetch operation, passed by the `refresh` or `next` function.\n * - `prevState`: The previous state of the resource, if applicable. This is only populated when the `next` function is called.\n * - `dispatch`: A function to update the resource state during the fetch process.\n * \n * @returns A promise that resolves to the fetched resource or `void`.\n */\nexport type Fetch<T, P> = (x: {\n abortSignal: AbortSignal;\n param?: P;\n prevState?: T;\n dispatch: (value: SetStateAction<T, T | undefined>) => void;\n}) => PromiseLike<void | T>;\n\n/**\n * Represents a function to fetch asynchronous iterable resources, such as streams or paginated data.\n * \n * @template T - The type of the resource items being fetched.\n * @template P - The type of the parameters passed to the fetch function.\n * \n * @param x - An object containing:\n * - `abortSignal`: An `AbortSignal` to handle cancellation of the fetch operation.\n * - `param`: Optional parameters for the fetch operation, passed by the `refresh` or `next` function.\n * \n * @returns An `AsyncIterable` that yields the fetched resource items.\n */\nexport type FetchWithIterable<T, P> = (x: {\n abortSignal: AbortSignal;\n param?: P;\n}) => Awaitable<AsyncIterable<T>>;\n\n/**\n * Configuration object for asynchronous resource fetching.\n * \n * @template F - The type of the fetch function.\n * \n * @property fetch - The fetch function to retrieve the resource.\n * @property debounce - Optional debounce settings to control the frequency of fetch calls.\n * - `wait`: The number of milliseconds to delay.\n * - Other settings as defined in `_.DebounceSettings`.\n */\nexport type Config<F> = {\n fetch: F,\n debounce?: _.DebounceSettings & { wait?: number; },\n};\n","//\n// error.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { Awaitable } from '@o2ter/utils-js';\nimport { ComponentType, PropsWithChildren, SetStateAction } from '../../../types/common';\nimport { createContext } from '../../context';\nimport { useContext } from '../../context';\nimport { useState } from '../../state';\nimport { useMemo } from '../../memo';\nimport { useRendererStorage } from '../../storage';\n\ntype Errors = {\n token: string;\n error: any;\n refresh: () => Awaitable<void>;\n refreshing: boolean;\n loading: boolean;\n}[];\n\ntype ContextValue = {\n errors: Errors;\n setErrors: (values: SetStateAction<Errors>) => void;\n};\n\nconst defaultStorageKey = Symbol();\nconst Context = createContext<ContextValue>();\n\n/**\n * A context provider component for managing asynchronous resource errors.\n * \n * This component provides a shared context for tracking errors encountered during\n * asynchronous operations. It allows child components to access and manage these errors\n * using the `useResourceErrors` hook.\n * \n * ### Usage:\n * Wrap your application or specific parts of it with this component to enable error tracking:\n * \n * ```tsx\n * <ResourceErrors>\n * <YourComponent />\n * </ResourceErrors>\n * ```\n * \n * @param children - The child components that will have access to the error context.\n * \n * @returns A context provider that wraps the provided children.\n */\nexport const ResourceErrors: ComponentType<PropsWithChildren<{}>> = ({\n children\n}) => {\n const [errors, setErrors] = useState<Errors>([]);\n const value = useMemo(() => ({ errors, setErrors }), [errors, setErrors]);\n return (\n <Context value={value}>{children}</Context>\n );\n}\n\nexport const useErrorContext = () => {\n const value = useContext(Context);\n if (value) return value;\n const storage = useRendererStorage();\n const found = storage.get(defaultStorageKey);\n if (found) return found as ContextValue;\n const store: ContextValue = {\n errors: [],\n setErrors: (values: SetStateAction<Errors>) => {\n store.errors = _.isFunction(values) ? values(store.errors) : values;\n },\n };\n storage.set(defaultStorageKey, store);\n return store;\n};\n\n/**\n * A hook to access the list of asynchronous resource errors.\n * \n * This hook allows components to retrieve the current list of errors being tracked\n * in the `ResourceErrors` context. It must be used within a component that is\n * a descendant of the `ResourceErrors` provider.\n * \n * ### Usage:\n * ```tsx\n * import { useEffect, useResourceErrors } from 'frosty';\n * \n * const errors = useResourceErrors();\n * \n * useEffect(() => {\n * errors.forEach(({ token, error, refresh }) => {\n * console.error(`Error [${token}]:`, error);\n * // Optionally call refresh() to retry the operation\n * });\n * }, [errors]);\n * ```\n * \n * @returns The list of errors currently being tracked in the context. Each error includes:\n * - `token`: A unique identifier for the error.\n * - `error`: The error object or message.\n * - `refresh`: A function to retry the operation that caused the error.\n */\nexport const useResourceErrors = () => useErrorContext().errors;\n","//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { SetStateAction } from '../../../types/common';\nimport { Config, Fetch, FetchWithIterable } from './types';\nimport { useState } from '../../state';\nimport { useEffect } from '../../effect';\nimport { useCallback } from '../../callback';\nimport { useAsyncDebounce } from '../../debounce';\nimport { useErrorContext } from './error';\nimport { uniqueId } from '../../../../core/utils';\nexport { ResourceErrors, useResourceErrors } from './error';\n\n/**\n * A hook to manage asynchronous resources with support for debouncing, error handling, and state management.\n * \n * @template T - The type of the resource being fetched.\n * @template P - The type of the parameters passed to the fetch function.\n * \n * @param config - The fetch function or a configuration object containing the fetch function and optional debounce settings.\n * @param deps - An optional dependency array to control when the resource is refreshed.\n * \n * @returns An object containing:\n * - `count`: The number of times the resource has been fetched.\n * - `refreshing`: A boolean indicating if the resource is currently being refreshed.\n * - `loading`: A boolean indicating if the resource is currently being loaded.\n * - `resource`: The fetched resource.\n * - `error`: Any error encountered during the fetch.\n * - `cancel`: A function to cancel the current fetch operation.\n * - `refresh`: A function to refresh the resource.\n * - `next`: A function to fetch the next set of data (for paginated resources).\n * - `setResource`: A function to manually update the resource state.\n */\nexport const useResource = <T, P = any>(\n config: Fetch<T, P> | Config<Fetch<T, P>>,\n deps?: any,\n) => {\n\n const fetch = _.isFunction(config) ? config : config.fetch;\n const debounce = _.isFunction(config) ? {} : config.debounce;\n\n const [state, setState] = useState<{\n type?: 'refresh' | 'next';\n count?: number;\n flag?: boolean;\n resource?: T;\n error?: any;\n token?: string;\n abort?: AbortController;\n }>({});\n\n const _dispatch = (\n token: string,\n next: SetStateAction<typeof state>,\n ) => setState(state => state.token === token ? ({\n ...(_.isFunction(next) ? next(state.flag ? state : _.omit(state, 'resource', 'error')) : next),\n count: state.flag ? state.count : (state.count ?? 0) + 1,\n flag: true,\n }) : state);\n\n const _fetch = useAsyncDebounce(async (\n type: 'refresh' | 'next',\n abort: AbortController,\n reset: boolean,\n param?: P,\n prevState?: T,\n ) => {\n\n const token = uniqueId();\n setState(state => ({ ...state, type, token, abort, flag: !reset }));\n\n try {\n\n const resource = await fetch({\n param,\n prevState,\n abortSignal: abort.signal,\n dispatch: (next) => {\n _dispatch(token, state => ({\n ...state,\n resource: _.isFunction(next) ? next(state.resource) : next,\n }));\n },\n });\n\n _dispatch(token, state => ({ resource: resource ?? state.resource }));\n\n } catch (error) {\n\n _dispatch(token, state => ({\n resource: state.resource,\n error,\n }));\n }\n\n }, debounce ?? {});\n\n useEffect(() => {\n const controller = new AbortController();\n void _fetch('refresh', controller, true);\n return () => controller.abort();\n }, deps ?? []);\n\n const _cancelRef = useCallback((reason?: any) => { state.abort?.abort(reason) });\n const _refreshRef = useCallback((param?: P) => _fetch('refresh', new AbortController(), true, param));\n const _nextRef = useCallback((param?: P) => _fetch('next', new AbortController(), false, param, state.resource));\n const _setResRef = useCallback((resource: T | ((prevState?: T) => T)) => setState(state => ({\n ..._.omit(state, 'resource', 'error'),\n resource: _.isFunction(resource) ? resource(state.resource) : resource,\n })));\n\n const { setErrors } = useErrorContext();\n useEffect(() => {\n const { type, abort, token = uniqueId(), error } = state;\n if (!error) return;\n setErrors(v => [...v, {\n token,\n error,\n refresh: _refreshRef,\n refreshing: !_.isNil(abort) && type === 'refresh',\n loading: !_.isNil(abort),\n }]);\n return () => setErrors(v => _.filter(v, x => x.token !== token));\n }, [state]);\n\n return {\n count: state.count ?? 0,\n refreshing: !_.isNil(state.abort) && state.type === 'refresh',\n loading: !_.isNil(state.abort),\n resource: state.resource,\n error: state.error,\n cancel: _cancelRef,\n refresh: _refreshRef,\n next: _nextRef,\n setResource: _setResRef,\n };\n}\n\n/**\n * A hook to manage asynchronous iterable resources, such as streams or paginated data.\n * \n * @template T - The type of the resource items being fetched.\n * @template P - The type of the parameters passed to the fetch function.\n * \n * @param config - The fetch function or a configuration object containing the fetch function and optional debounce settings.\n * @param deps - An optional dependency array to control when the resource is refreshed.\n * \n * @returns An object containing the same properties as `useResource`, but optimized for iterable resources.\n */\nexport const useIterableResource = <T, P = any>(\n config: FetchWithIterable<T, P> | Config<FetchWithIterable<T, P>>,\n deps?: any,\n) => {\n const fetch = _.isFunction(config) ? config : config.fetch;\n const debounce = _.isFunction(config) ? {} : config.debounce;\n const { next, ...result } = useResource<T[]>({\n fetch: async ({ dispatch, abortSignal, param }) => {\n const resource = await fetch({ abortSignal, param });\n for await (const item of resource) {\n dispatch(items => items ? [...items, item] : [item]);\n }\n },\n debounce,\n }, deps);\n return result;\n}\n","//\n// interval.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { useEffect } from '../effect';\n\n/**\n * A hook that repeatedly calls the provided callback function at the specified interval.\n * \n * @param callback - The function to be executed at each interval.\n * @param ms - The delay in milliseconds between each call to the callback. If not provided, the interval will not be set.\n * @returns void\n * \n * @example\n * useInterval(() => {\n * // Code to run every 1000ms\n * }, 1000);\n */\nexport const useInterval = (\n callback: () => void,\n ms?: number,\n) => useEffect(() => {\n if (_.isNil(ms)) return;\n const interval = setInterval(() => {\n callback();\n }, ms);\n return () => clearInterval(interval);\n}, [ms]);\n","//\n// store.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { SetStateAction } from '../../types/common';\nimport { useSyncExternalStore } from '../sync';\n\n/**\n * A class representing a store that holds a value and allows for subscription\n * to changes in that value.\n *\n * @template T - The type of the value stored in the store.\n *\n * @example\n * const store = createStore(0);\n * store.setValue(1);\n * store.subscribe((oldVal, newVal) => {\n * console.log(`Value changed from ${oldVal} to ${newVal}`);\n * });\n */\nclass Store<T> {\n\n #listeners = new Set<(oldVal: T, newVal: T) => void>();\n #value: T;\n\n /** @internal */\n constructor(initialValue: T) {\n this.#value = initialValue;\n }\n\n /**\n * Gets the current value of the store.\n * \n * @returns The current value of the store.\n */\n get value() {\n return this.#value;\n }\n\n /**\n * Sets the value of the store and notifies all subscribers.\n * \n * @param dispatch - The new value or a function that returns the new value.\n */\n setValue(dispatch: SetStateAction<T>) {\n const oldVal = this.#value;\n this.#value = _.isFunction(dispatch) ? dispatch(this.#value) : dispatch;\n this.#listeners.forEach(listener => void listener(oldVal, this.#value));\n }\n\n /**\n * Subscribes to changes in the store's value.\n * \n * @param callback - The function to call when the value changes.\n * @returns A function to unsubscribe from the store.\n */\n subscribe(callback: (oldVal: T, newVal: T) => void) {\n this.#listeners.add(callback);\n return () => { this.#listeners.delete(callback); };\n }\n}\n\n/**\n * Creates a new store with the given initial value.\n * \n * @param initialValue - The initial value to be stored.\n * @returns {Store<T>} A new store instance.\n *\n * @example\n * const counterStore = createStore(0);\n */\nexport const createStore = <T extends unknown = any>(initialValue: T) => new Store(initialValue);\n\n/**\n * A hook to subscribe to a store and select a slice of its state.\n * The component will re-render when the selected state changes.\n * \n * @param store - The store instance to subscribe to.\n * @param selector - A function to select a part of the store's state. Defaults to the entire state.\n * @param equal - A function to compare selected values for equality. Defaults to deep equality.\n * @returns The selected slice of the store's state.\n *\n * @example\n * const count = useStore(counterStore);\n *\n * @example\n * // Using a selector\n * const userName = useStore(userStore, user => user.name);\n */\nexport const useStore = <T extends unknown = any, S = T>(\n store: Store<T>,\n selector: (state: T) => S = v => v as any,\n equal: (value: S, other: S) => boolean = _.isEqual,\n): S => useSyncExternalStore(\n (onStoreChange) => store.subscribe((oldVal, newVal) => {\n if (!equal(selector(oldVal), selector(newVal))) onStoreChange();\n }),\n () => selector(store.value)\n);\n","//\n// awaited.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { reconciler } from '../reconciler/state';\nimport { _useMemo } from '../reconciler/hooks';\n\nconst resolved = new WeakMap<PromiseLike<any>, { result?: any; error?: any; }>();\n\n/**\n * Eagerly resolves a promise returned by the factory function and caches its result or error.\n *\n * This hook ensures the promise settles before rendering completes. If the promise is still pending,\n * it returns `undefined` and schedules an immediate rerender of the current component. Once resolved, it returns the value.\n * If rejected, it throws the error.\n *\n * #### Usage\n * ```typescript\n * const data = useAwaited(() => fetchData(id), [id]);\n * ```\n *\n * #### Parameters\n * - `factory`: `() => PromiseLike<T>` \n * A function that returns a promise to resolve.\n * - `deps` (optional): `any` \n * Dependency array for memoization. The promise is recreated when dependencies change.\n *\n * #### Returns\n * - `T | undefined` \n * The resolved value, once available. Returns `undefined` while the promise is pending.\n * - Throws the rejection error if the promise fails.\n *\n * #### Throws\n * - Error if used outside a render function.\n * - The rejection error if the promise fails.\n *\n * @template T Type of the resolved value.\n */\nexport const useAwaited = <T>(\n factory: () => PromiseLike<T>,\n deps?: any,\n): T | undefined => {\n const state = reconciler.currentHookState;\n if (!state) throw Error('useAwaited must be used within a render function.');\n const promise = _useMemo('useAwaited', () => factory(), deps ?? null);\n if (resolved.has(promise)) {\n const { result, error } = resolved.get(promise) ?? {};\n if (error) throw error;\n return result;\n }\n state.tasks.push((async () => {\n try {\n const result = await promise;\n resolved.set(promise, { result });\n } catch (error) {\n resolved.set(promise, { error });\n }\n })());\n}","//\n// debounce.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\n\nconst debounce = <T extends (...args: any) => any>(\n callback: T,\n settings: _.DebounceSettings & { wait?: number; },\n) => {\n const { wait, ...options } = settings;\n return _.debounce(callback, wait, {\n ...options,\n leading: 'leading' in options ? !!options.leading : true,\n trailing: 'trailing' in options ? !!options.trailing : true,\n });\n}\n\nconst asyncDebounce = <T extends (...args: any) => PromiseLike<any>>(\n func: T,\n settings: _.DebounceSettings & { wait?: number; },\n) => {\n\n type R = T extends (...args: any) => PromiseLike<infer R> ? R : never;\n let preflight: Promise<R>;\n\n const debounced = debounce(async function (\n this: any,\n resolve?: (value: PromiseLike<R>) => void,\n ...args: Parameters<T>\n ) {\n const result = func.call(this, ...args as any) as PromiseLike<R>;\n if (_.isFunction(resolve)) resolve(result);\n return result;\n }, settings);\n\n return function (this: any, ...args: Parameters<T>) {\n if (_.isNil(preflight)) {\n preflight = new Promise<R>(r => debounced.call(this, r, ...args));\n return preflight;\n }\n return debounced.call(this, undefined, ...args) ?? preflight;\n };\n};\n\n/**\n * A hook that creates a debounced version of a function.\n * The debounced function delays invoking the callback until after\n * the specified wait time has elapsed since the last time it was called.\n * \n * This is useful for optimizing performance in scenarios where frequent\n * function calls (e.g., during user input or window resizing) can be expensive.\n * \n * @template T The type of the callback function.\n * @param callback The function to debounce.\n * @param settings Configuration options for debouncing, including:\n * - `wait` (number): The number of milliseconds to delay.\n * - Other lodash debounce options such as `leading` and `trailing`.\n * @returns A debounced version of the callback function.\n */\nexport const useDebounce = <T extends (...args: any) => any>(\n callback: T,\n settings: _.DebounceSettings & { wait?: number; },\n) => {\n const store = _useMemo('useDebounce', () => {\n const store = {\n current: callback,\n stable: debounce((function (this: any, ...args) {\n return store.current.call(this, ...args);\n }) as T, settings),\n };\n return store;\n }, null);\n store.current = callback;\n return store.stable;\n}\n\n/**\n * A hook that creates a debounced version of an asynchronous function.\n * The debounced function delays invoking the callback until after\n * the specified wait time has elapsed since the last time it was called.\n * \n * This is particularly useful for scenarios where frequent API calls\n * or other asynchronous operations need to be throttled to improve performance.\n * \n * @template T The type of the asynchronous callback function.\n * @param callback The asynchronous function to debounce.\n * @param settings Configuration options for debouncing, including:\n * - `wait` (number): The number of milliseconds to delay.\n * - Other lodash debounce options such as `leading` and `trailing`.\n * @returns A debounced version of the asynchronous callback function.\n */\nexport const useAsyncDebounce = <T extends (...args: any) => PromiseLike<any>>(\n callback: T,\n settings: _.DebounceSettings & { wait?: number; },\n) => {\n const store = _useMemo('useAsyncDebounce', () => {\n const store = {\n current: callback,\n stable: asyncDebounce((function (this: any, ...args) {\n return store.current.call(this, ...args);\n }) as T, settings),\n };\n return store;\n }, null);\n store.current = callback;\n return store.stable;\n}\n","//\n// effect.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { Awaitable } from '@o2ter/utils-js';\nimport { _useEffect } from '../reconciler/hooks';\n\n/**\n * A hook that manages side effects with support for an `AbortSignal`.\n * It ensures proper cleanup logic and handles asynchronous operations effectively.\n *\n * @param effect - \n * A function that receives an `AbortSignal` and performs side effects. \n * It can optionally return a cleanup function or a promise that resolves to a cleanup function.\n *\n * @param deps - \n * An optional dependencies that determines when the effect should be re-executed.\n *\n * @example\n * useEffect((signal) => {\n * fetch('/api/data', { signal })\n * .then(response => response.json())\n * .then(data => console.log(data))\n * .catch(err => {\n * if (err.name === 'AbortError') {\n * console.log('Fetch aborted');\n * } else {\n * console.error(err);\n * }\n * });\n * \n * return () => {\n * console.log('Cleanup logic here');\n * };\n * }, []);\n */\nexport const useEffect = (\n effect: (\n signal: AbortSignal,\n ) => Awaitable<void | (() => Awaitable<void>)>,\n deps?: any,\n) => _useEffect('useEffect', () => {\n const abort = new AbortController();\n try {\n const destructor = effect(abort.signal);\n return () => {\n abort.abort();\n (async () => {\n try {\n const _destructor = await destructor;\n if (_.isFunction(_destructor)) _destructor();\n } catch (e) {\n console.error(e);\n }\n })();\n };\n } catch (e) {\n console.error(e);\n return () => abort.abort();\n }\n}, deps);","//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { reconciler } from '../reconciler/state';\nimport { ComponentType, ElementNode } from '../types/common';\n\nconst _contextDefaultValue = new WeakMap<Context<any>, any>();\n\nexport const isContext = (type: any): type is Context<any> => {\n return _contextDefaultValue.has(type as any);\n};\n\nexport type Context<Value> = ReturnType<typeof _createContext<Value>>;\nexport type ContextType<C extends Context<any>> = C extends Context<infer T> ? T : never;\n\nconst _createContext = <Value extends unknown>(defaultValue: Value) => {\n const _context: ComponentType<{\n value: Value;\n children?: ElementNode | ((value: Value) => ElementNode);\n }> = ({ value, children }) => {\n return _.isFunction(children) ? children(value) : children;\n };\n const Consumer: ComponentType<{\n children: (value: Value) => ElementNode;\n }> = ({ children }) => {\n const value = useContext(_context as Context<Value>);\n return children(value);\n };\n _contextDefaultValue.set(_context as Context<Value>, defaultValue);\n return _.assign(_context, { Consumer });\n};\n\n/**\n * Creates a new context object with an optional default value.\n *\n * A context object allows you to share a value across a component tree\n * without explicitly passing it as a prop to every level.\n *\n * @template Value - The type of the value to be stored in the context.\n * @param - The default value for the context.\n * @returns A context object that can be used to provide and consume the value.\n */\n\nexport function createContext<Value>(defaultValue: Value): Context<Value>;\nexport function createContext<Value = undefined>(): Context<Value | undefined>;\n\nexport function createContext(defaultValue?: any) {\n return _createContext(defaultValue);\n}\n\n/**\n * A hook that retrieves the current value of a context and optionally applies\n * a selector function to transform the context value. This hook ensures that the component\n * subscribes to the context and re-renders when the context value changes.\n *\n * @template T - The type of the context value.\n * @template R - The type of the transformed value returned by the selector.\n * @param context - The context object to retrieve the value from.\n * @param selector - An optional selector function to transform the context value.\n * Defaults to an identity function.\n * @returns - The current value of the context, optionally transformed by the selector.\n *\n * @throws - Throws an error if the provided context is invalid or if the hook\n * is used outside of a render function.\n *\n * @example\n * const MyContext = createContext({ user: null });\n * \n * function MyComponent() {\n * const user = useContext(MyContext, context => context.user);\n * return <div>{user ? `Hello, ${user.name}` : 'Hello, Guest'}</div>;\n * }\n */\nexport const useContext = <T, R = T>(\n context: Context<T>,\n selector: (state: T) => R = v => v as any\n) => {\n if (!isContext(context)) throw Error(`Invalid type of ${context}`);\n const state = reconciler.currentHookState;\n if (!state) throw Error('useContext must be used within a render function.');\n const { contextValue, listens } = state;\n listens.add(context);\n const { value = _contextDefaultValue.get(context) } = contextValue.get(context) ?? {};\n return selector(value);\n};\n","//\n// memo.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\n\n/**\n * A utility function that memoizes the result of a factory function.\n * \n * @template T The type of the value returned by the factory function.\n * @param factory A function that produces a value to be memoized.\n * @param deps An optional dependency array. The memoized value is recalculated \n * only when the dependencies change.\n * @returns The memoized value produced by the factory function.\n */\nexport const useMemo = <T>(\n factory: () => T,\n deps?: any,\n) => _useMemo('useMemo', () => factory(), deps);\n","//\n// memo.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useEffect, _useMemo } from '../reconciler/hooks';\nimport { Ref, RefObject } from '../types/common';\n\n/**\n * Creates a mutable reference object that persists across function calls.\n * \n * @template T The type of the value stored in the reference.\n * @param initialValue The initial value to store in the reference.\n * @returns An object with a `current` property that holds the value.\n */\nexport function useRef<T>(initialValue: T): RefObject<T>;\nexport function useRef<T = undefined>(): RefObject<T | undefined>;\n\nexport function useRef(initialValue?: any) {\n return _useMemo('useRef', () => ({ current: initialValue }), null);\n}\n\n/**\n * Associates a reference with a value created by an initializer function.\n * \n * @template T The type of the reference.\n * @template R The type of the value created by the initializer function.\n * @param ref A reference object or a callback function to receive the value.\n * @param init A function that initializes and returns the value to associate with the reference.\n * @param deps An optional dependency array. The initializer function is re-executed when the dependencies change.\n */\nexport const useRefHandle = <T, R extends T>(\n ref: Ref<T> | undefined,\n init: () => R,\n deps?: any\n) => _useEffect('useRefHandle', () => {\n try {\n if (ref) {\n const _ref = init();\n if (typeof ref === 'function') ref(_ref);\n else if (typeof ref === 'object') ref.current = _ref;\n }\n return () => void 0;\n } catch (e) {\n console.error(e);\n return () => void 0;\n }\n}, deps);","//\n// memo.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\n\n/**\n * A hook that memoizes a callback function, ensuring that it only changes\n * if its dependencies change. This is useful for optimizing performance by preventing\n * unnecessary re-creations of functions.\n *\n * @template T - The type of the callback function.\n * @param callback - The callback function to be memoized.\n * @param deps - An optional dependencies. If provided, the callback\n * will only be updated when one of these dependencies changes.\n * If not provided, the callback will remain stable.\n * @returns - A stable version of the callback function that will not change unless\n * its dependencies change.\n *\n * @example\n * const memoizedCallback = useCallback(() => {\n * console.log('This function is memoized!');\n * }, [dependency]);\n */\n\nexport function useCallback<T extends (...args: any) => any>(\n callback: T,\n deps?: any\n): T;\n\nexport function useCallback<T extends ((...args: any) => any) | _.Falsey>(\n callback: T,\n deps?: any\n): T;\n\nexport function useCallback<T extends ((...args: any) => any) | _.Falsey>(\n callback: T,\n deps?: any\n): T {\n if (!_.isUndefined(deps)) return _useMemo('useCallback', () => callback, deps);\n const store = _useMemo('useCallback', () => {\n const store = {\n current: callback,\n stable: function (this: any, ...args: any) {\n if (_.isFunction(store.current))\n return store.current.call(this, ...args);\n },\n };\n return store;\n }, null);\n if (_.isFunction(callback)) store.current = callback;\n return callback && (store.stable as T);\n}\n","//\n// memo.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\nimport { SetStateAction } from '../types/common';\n\n/**\n * A hook function for managing state within a custom framework or library.\n *\n * @template T - The type of the state value.\n * @param - The initial state value or a function that returns the initial state.\n * @returns - A tuple containing the current state value and a function to update the state.\n *\n * The `useState` function provides a way to manage stateful values. It returns the current state\n * and a setter function that can update the state. The setter function accepts either a new value\n * or a function that receives the current state and returns the updated state.\n *\n * Example:\n * ```typescript\n * const [count, setCount] = useState(0);\n * setCount(5); // Updates the state to 5\n * setCount(prev => prev + 1); // Updates the state to the previous value + 1\n * ```\n */\nexport function useState<T>(initialState: T | (() => T)): [T, (dispatch: SetStateAction<T>) => void];\nexport function useState<T = undefined>(): [T | undefined, (dispatch: SetStateAction<T | undefined>) => void];\n\nexport function useState(initialState?: any) {\n const { value, setValue } = _useMemo('useState', ({ node }) => {\n const state = {\n value: _.isFunction(initialState) ? initialState() : initialState,\n setValue: (dispatch: SetStateAction<any>) => {\n const oldValue = state.value;\n const newValue = _.isFunction(dispatch) ? dispatch(oldValue) : dispatch;\n if (oldValue === newValue) return;\n state.value = newValue;\n node?._setDirty();\n },\n };\n return state;\n }, null);\n return [value, setValue];\n}\n","//\n// stack.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { reconciler } from '../reconciler/state';\n\n/**\n * Retrieves the stack of parent components from the current hook state.\n *\n * This function accesses the current hook state and extracts the stack of \n * parent components. It throws an error if called outside of a valid render \n * context.\n *\n * @returns An array of parent components from the current hook state.\n * @throws Will throw an error if the function is called outside of a valid render context.\n */\nexport const useStack = () => {\n const state = reconciler.currentHookState;\n if (!state) throw Error('useStack must be used within a render function.');\n return _.map(state.stack, x => x._component);\n}\n","//\n// reducer.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\n\n/**\n * A utility function that manages state using a reducer pattern.\n * \n * @template T The type of the state.\n * @template A The type of the action object (optional).\n * @param reducer A function that takes the current state and an action, and returns the new state.\n * @param initialState The initial state value or a function that returns the initial state.\n * @returns A tuple containing the current state and a dispatch function to update the state.\n */\nexport function useReducer<T>(\n reducer: (prevState: T) => T,\n initialState: T | (() => T),\n): [T, (dispatch: () => void) => void];\n\nexport function useReducer<T, A = any>(\n reducer: (prevState: T, action: A) => T,\n initialState: T | (() => T),\n): [T, (dispatch: (action: A) => void) => void];\n\nexport function useReducer<T = undefined>(\n reducer: (prevState: T | undefined) => T | undefined\n): [T | undefined, (dispatch: () => void) => void];\n\nexport function useReducer<T = undefined, A = any>(\n reducer: (prevState: T | undefined, action: A) => T | undefined\n): [T | undefined, (dispatch: (action: A) => void) => void];\n\nexport function useReducer(\n reducer: (prevState: any, action?: any) => any,\n initialState?: any,\n) {\n const { value, dispatch } = _useMemo('useReducer', ({ node }) => {\n const state = {\n value: _.isFunction(initialState) ? initialState() : initialState,\n dispatch: (action?: any) => {\n const oldValue = state.value;\n const newValue = reducer(state.value, action);\n if (oldValue === newValue) return;\n state.value = newValue;\n node?._setDirty();\n },\n };\n return state;\n }, null);\n return [value, dispatch];\n}\n","//\n// sync.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { Awaitable } from '@o2ter/utils-js';\nimport { _useEffect } from '../reconciler/hooks';\nimport { reconciler } from '../reconciler/state';\n\n/**\n * A hook utility for synchronizing with an external store.\n *\n * @template Snapshot - The type of the snapshot returned by the store.\n * @param subscribe - A function that sets up a subscription to the external store.\n * - `onStoreChange`: A callback to invoke when the store changes.\n * - `signal`: An `AbortSignal` to handle cleanup when the subscription is no longer needed.\n * - Returns an optional cleanup function or a promise resolving to one.\n * @param getSnapshot - A function that retrieves the current snapshot of the store.\n * @param getServerSnapshot - (Optional) A function that retrieves the snapshot of the store\n * in a server environment.\n * @returns The current snapshot of the store.\n *\n * @throws Will throw an error if used outside of a valid render context.\n */\nexport const useSyncExternalStore = <Snapshot>(\n subscribe: (\n onStoreChange: () => void,\n signal: AbortSignal,\n ) => Awaitable<void | (() => Awaitable<void>)>,\n getSnapshot: () => Snapshot,\n getServerSnapshot?: () => Snapshot,\n) => {\n const state = reconciler.currentHookState;\n if (!state) throw Error('useSyncExternalStore must be used within a render function.');\n _useEffect('useSyncExternalStore', ({ node }) => {\n const abort = new AbortController();\n try {\n const destructor = subscribe(() => { node?._setDirty(); }, abort.signal);\n return () => {\n abort.abort();\n (async () => {\n try {\n const _destructor = await destructor;\n if (_.isFunction(_destructor)) _destructor();\n } catch (e) {\n console.error(e);\n }\n })();\n };\n } catch (e) {\n console.error(e);\n return () => abort.abort();\n }\n }, null);\n if (getServerSnapshot && state.renderer._server) {\n return getServerSnapshot();\n }\n return getSnapshot();\n};","//\n// storage.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { reconciler } from '../reconciler/state';\n\nconst storage = new WeakMap<any, Map<any, any>>();\n\n/**\n * Returns a persistent storage Map associated with the current renderer instance.\n * This hook allows components to store and retrieve values that persist across renders,\n * scoped to the renderer. Must be called within a render function.\n *\n * @throws Error if called outside of a render function.\n * @returns {Map<any, any>} The storage map for the current renderer.\n */\nexport const useRendererStorage = () => {\n const state = reconciler.currentHookState;\n if (!state) throw Error('useRendererStorage must be used within a render function.');\n const found = storage.get(state.renderer);\n const store = found ?? new Map<any, any>();\n if (!found) storage.set(state.renderer, store);\n return store;\n};\n","//\n// error.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { ComponentType, PropsWithChildren } from './common';\nimport { ComponentNode } from './component';\n\ntype ErrorBoundaryProps = PropsWithChildren<{\n silent?: boolean;\n onError?: (\n error: any,\n component: ComponentNode,\n stack: ComponentNode[],\n ) => void;\n}>;\n\nexport const ErrorBoundary: ComponentType<ErrorBoundaryProps> = ({ children }) => {\n return children;\n}\n","//\n// props.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { ComponentType, PropsWithChildren } from './common';\nimport { NativeElementType } from './component';\nimport { _ElementType, PropsType } from './runtime';\n\ntype PropsProviderProps = PropsWithChildren<{\n callback: (v: {\n type: _ElementType | typeof NativeElementType,\n props: PropsType\n }) => PropsType | undefined | null;\n}>;\n\nexport const PropsProvider: ComponentType<PropsProviderProps> = ({ children }) => {\n return children;\n}\n"],"names":[],"mappings":";;;;;;;;AAOO;AACP;AACA;AACA;AACA;AACA;;ACTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;;ACpDA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;;AC3DP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;;ACXP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;;AC9DP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;;AC5BP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;;AC5BA;AACA;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACA;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;;AC/CP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;;ACRP;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACA;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;;AClBP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACA;;ACnBP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACA;;ACpBP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;;ACVP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACA;AACA;AACA;;ACXP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;;AChBP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;;ACNP;AACA;AACA;AACA;AACO;;ACHP;AACA;AACA;AACA;AACA;AACA;AACO;;;"}
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  var jsxRuntime = require('./jsx-runtime.js');
4
- var state = require('./internals/state-BUsKrPS6.js');
4
+ var state = require('./internals/state-4DjTr6NP.js');
5
5
  var _ = require('lodash');
6
- var sync = require('./internals/sync-DddZEmk8.js');
6
+ var sync = require('./internals/sync-h5hbWjqx.js');
7
7
  var runtime = require('./internals/runtime-PKOt40BM.js');
8
8
  require('myers.js');
9
9
 
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import { jsx } from './jsx-runtime.mjs';
2
2
  export { Fragment } from './jsx-runtime.mjs';
3
- import { r as reconciler, c as createContext, u as useContext, a as uniqueId } from './internals/state-ChcSdPG6.mjs';
4
- export { E as ErrorBoundary, P as PropsProvider, b as createPairs, m as mergeRefs } from './internals/state-ChcSdPG6.mjs';
3
+ import { r as reconciler, c as createContext, u as useContext, a as uniqueId } from './internals/state-DHNx5rLZ.mjs';
4
+ export { E as ErrorBoundary, P as PropsProvider, b as createPairs, m as mergeRefs } from './internals/state-DHNx5rLZ.mjs';
5
5
  import _ from 'lodash';
6
- import { _ as _useMemo, u as useMemo, a as useEffect, b as useCallback, c as useSyncExternalStore, d as _useEffect } from './internals/sync-BTwu3J9M.mjs';
6
+ import { _ as _useMemo, u as useMemo, a as useEffect, b as useCallback, c as useSyncExternalStore, d as _useEffect } from './internals/sync-0lfEEQfP.mjs';
7
7
  export { C as ComponentNode, c as createElement } from './internals/runtime-DrGYUphO.mjs';
8
8
  import 'myers.js';
9
9
 
@@ -3419,7 +3419,7 @@ declare abstract class NativeElementType {
3419
3419
  constructor(...args: any[]);
3420
3420
  }
3421
3421
  declare class ComponentNode {
3422
- get type(): _ElementType | typeof NativeElementType;
3422
+ get type(): typeof NativeElementType | _ElementType;
3423
3423
  get props(): PropsType;
3424
3424
  get key(): string | number | undefined;
3425
3425
  }
@@ -3448,4 +3448,4 @@ type ComponentRef<T> = ComponentProps<T> extends RefAttribute<infer R> ? R : nev
3448
3448
 
3449
3449
  export { ComponentNode as C, NativeElementType as N, createElement as d };
3450
3450
  export type { ElementNode as E, PropsWithChildren as P, RefObject as R, SetStateAction as S, _ElementType as _, ComponentType as a, Ref as b, PropsType as c, ClassName as e, StyleProp as f, ExtendedCSSProperties as g, CSSProperties as h, RefAttribute as i, ComponentProps as j, ComponentPropsWithoutRef as k, RefCallback as l, ComponentRef as m, _IntrinsicElements as n, _IntrinsicAttributes as o };
3451
- //# sourceMappingURL=common-BcsIDGYU.d.ts.map
3451
+ //# sourceMappingURL=common-CpEB3ieX.d.ts.map