@raphy-js/raph 1.0.1-dev.25 → 1.0.1-dev.54
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.
- package/README.md +100 -0
- package/dist/api/Raph.d.ts +15 -15
- package/dist/api/RaphFacadeSession.d.ts +4 -4
- package/dist/api/RaphReactivityInstance.d.ts +4 -4
- package/dist/api/types.d.ts +11 -11
- package/dist/compact.cjs +1 -0
- package/dist/compact.js +4 -0
- package/dist/debug/reactivity/engine-core.cjs +1 -0
- package/dist/debug/reactivity/engine-core.js +1760 -0
- package/dist/debug/reactivity/engine.cjs +1 -1
- package/dist/debug/reactivity/engine.js +25 -1689
- package/dist/debug/reactivity/reactive-object.cjs +1 -1
- package/dist/debug/reactivity/reactive-object.js +604 -167
- package/dist/debug/runtime/RaphCompactExecutionRuntime.cjs +1 -0
- package/dist/debug/runtime/RaphCompactExecutionRuntime.js +9 -0
- package/dist/debug/runtime/RaphExecutionRuntime.cjs +1 -0
- package/dist/debug/runtime/RaphExecutionRuntime.js +11 -0
- package/dist/debug/runtime/RaphRuntime.cjs +1 -1
- package/dist/debug/runtime/RaphRuntime.js +115 -1176
- package/dist/debug/runtime/RaphRuntimeBase.cjs +1 -0
- package/dist/debug/runtime/RaphRuntimeBase.js +941 -0
- package/dist/debug/runtime/diagnostics/RaphDebug.cjs +1 -1
- package/dist/debug/runtime/diagnostics/RaphDebug.js +72 -66
- package/dist/debug/runtime/ownership/RaphNode.cjs +1 -1
- package/dist/debug/runtime/ownership/RaphNode.js +11 -0
- package/dist/debug/runtime/ownership/RaphScope.cjs +1 -1
- package/dist/debug/runtime/ownership/RaphScope.js +12 -12
- package/dist/debug/runtime/phases/RaphPhasePipeline.cjs +1 -1
- package/dist/debug/runtime/phases/RaphPhasePipeline.js +361 -242
- package/dist/debug/runtime/phases/RaphPhaseTaskRecord.cjs +1 -1
- package/dist/debug/runtime/phases/RaphPhaseTaskRecord.js +23 -22
- package/dist/debug/runtime/reactivity/RaphSelector.cjs +1 -1
- package/dist/debug/runtime/reactivity/RaphSelector.js +111 -90
- package/dist/debug/runtime/reactivity/RuntimeObjectSupport.cjs +1 -0
- package/dist/debug/runtime/reactivity/RuntimeObjectSupport.js +11 -0
- package/dist/debug/runtime/reactivity/RuntimeReactivity.cjs +1 -1
- package/dist/debug/runtime/reactivity/RuntimeReactivity.js +118 -103
- package/dist/debug/runtime/reactivity/RuntimeSelectorSupport.cjs +1 -0
- package/dist/debug/runtime/reactivity/RuntimeSelectorSupport.js +12 -0
- package/dist/entrypoints/compact.d.ts +2 -0
- package/dist/entrypoints/execution.d.ts +2 -0
- package/dist/entrypoints/machine-testing.d.ts +2 -2
- package/dist/entrypoints/machine.d.ts +5 -5
- package/dist/entrypoints/observable.d.ts +4 -0
- package/dist/entrypoints/path.d.ts +14 -14
- package/dist/entrypoints/reactivity.d.ts +1 -1
- package/dist/entrypoints/runtime.d.ts +19 -18
- package/dist/execution.cjs +1 -0
- package/dist/execution.js +4 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +23 -21
- package/dist/machine/compiler.d.ts +1 -1
- package/dist/machine/core.d.ts +2 -2
- package/dist/machine/persistence.d.ts +1 -1
- package/dist/machine/runtime.d.ts +3 -3
- package/dist/machine/testing.d.ts +1 -1
- package/dist/machine/types.d.ts +3 -3
- package/dist/main.d.ts +19 -19
- package/dist/observable/buffer.d.ts +6 -0
- package/dist/observable/class-admin.d.ts +63 -0
- package/dist/observable/class-plan.d.ts +46 -0
- package/dist/observable/classes.d.ts +10 -0
- package/dist/observable/context.d.ts +73 -0
- package/dist/observable/native.d.ts +2 -0
- package/dist/observable/observable.d.ts +13 -0
- package/dist/observable/types.d.ts +60 -0
- package/dist/observable.cjs +1 -0
- package/dist/observable.js +1187 -0
- package/dist/path/DataPath.d.ts +2 -2
- package/dist/path/PathRouter.d.ts +1 -1
- package/dist/path/RaphKernel.d.ts +6 -6
- package/dist/path/data-path.types.d.ts +1 -1
- package/dist/path/data-path.utils.d.ts +2 -2
- package/dist/path/derived/DerivedRegistry.d.ts +3 -3
- package/dist/path/derived/RaphDerivedHandle.d.ts +3 -3
- package/dist/path/derived/derived-collection.types.d.ts +1 -1
- package/dist/path/derived/derived-collection.utils.d.ts +3 -3
- package/dist/path/derived/derived-strategy.utils.d.ts +1 -1
- package/dist/path/meta/MetaController.d.ts +5 -5
- package/dist/path/meta/RaphMeta.d.ts +3 -3
- package/dist/path/meta/RaphMetaStore.d.ts +1 -1
- package/dist/path/meta/meta.types.d.ts +2 -2
- package/dist/path/path.types.d.ts +2 -2
- package/dist/path/pathSegmentKey.d.ts +1 -1
- package/dist/path/storage/AdapterPathStore.d.ts +2 -2
- package/dist/path/storage/DefaultDataAdapter.d.ts +2 -2
- package/dist/path/storage/PathEventHub.d.ts +1 -1
- package/dist/path/storage/PathStore.d.ts +2 -2
- package/dist/path/storage/data-adapter.types.d.ts +1 -1
- package/dist/raph.cjs +1 -1
- package/dist/raph.js +23 -21
- package/dist/reactivity/engine-core.d.ts +600 -0
- package/dist/reactivity/engine.d.ts +6 -550
- package/dist/reactivity/reactive-object.d.ts +143 -2
- package/dist/reactivity/scope.d.ts +7 -6
- package/dist/reactivity/types.d.ts +9 -12
- package/dist/reactivity/watch.d.ts +1 -1
- package/dist/runtime/RaphCompactExecutionRuntime.d.ts +7 -0
- package/dist/runtime/RaphExecutionRuntime.d.ts +6 -0
- package/dist/runtime/RaphRuntime.d.ts +19 -403
- package/dist/runtime/RaphRuntimeBase.d.ts +194 -0
- package/dist/runtime/diagnostics/RaphDebug.d.ts +8 -5
- package/dist/runtime/errors.d.ts +1 -1
- package/dist/runtime/ownership/RaphEffectScope.d.ts +13 -12
- package/dist/runtime/ownership/RaphNode.d.ts +28 -21
- package/dist/runtime/ownership/RaphScope.d.ts +32 -19
- package/dist/runtime/ownership/parent-graph.types.d.ts +1 -1
- package/dist/runtime/ownership/parentGraph.d.ts +2 -2
- package/dist/runtime/phases/RaphFrameLoop.d.ts +1 -1
- package/dist/runtime/phases/RaphPhasePipeline.d.ts +80 -29
- package/dist/runtime/phases/RaphPhaseTaskRecord.d.ts +21 -21
- package/dist/runtime/phases/RaphPhaseWatch.d.ts +3 -3
- package/dist/runtime/phases/orderPhaseTasks.d.ts +4 -2
- package/dist/runtime/phases/phase.types.d.ts +36 -35
- package/dist/runtime/reactivity/PathHandle.d.ts +5 -5
- package/dist/runtime/reactivity/RaphMetaSource.d.ts +7 -7
- package/dist/runtime/reactivity/RaphSelector.d.ts +27 -6
- package/dist/runtime/reactivity/RaphWorkGraph.d.ts +40 -39
- package/dist/runtime/reactivity/RuntimeObjectSupport.d.ts +9 -0
- package/dist/runtime/reactivity/RuntimeReactivity.d.ts +27 -19
- package/dist/runtime/reactivity/RuntimeSelectorSupport.d.ts +10 -0
- package/dist/runtime/reactivity/RuntimeWatch.d.ts +1 -1
- package/dist/runtime/reactivity/disposal-sweep.utils.d.ts +1 -1
- package/dist/runtime/reactivity/runtime-reactivity.types.d.ts +3 -3
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.js +13 -11
- package/package.json +22 -62
package/dist/index.js
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import { RaphCapabilityError as e, RaphConfigurationError as p, RaphDefaultInstanceError as a, RaphError as t, RaphFacadeDisposedError as
|
|
1
|
+
import { RaphCapabilityError as e, RaphConfigurationError as p, RaphDefaultInstanceError as a, RaphError as t, RaphFacadeDisposedError as f } from "./debug/api/errors.js";
|
|
2
2
|
import { Raph as R } from "./debug/api/Raph.js";
|
|
3
3
|
import { RaphReactivityInstance as x } from "./debug/api/RaphReactivityInstance.js";
|
|
4
4
|
import { RaphActionError as n, RaphCrossRuntimeError as s, RaphDisposedError as c, RaphPhaseProcessError as l } from "./debug/runtime/errors.js";
|
|
5
5
|
import { parentGraph as E } from "./debug/runtime/ownership/parentGraph.js";
|
|
6
6
|
import { RaphEffectScope as u } from "./debug/runtime/ownership/RaphEffectScope.js";
|
|
7
7
|
import { RaphNode as P } from "./debug/runtime/ownership/RaphNode.js";
|
|
8
|
-
import { RaphScope as
|
|
9
|
-
import { orderPhaseTasks as
|
|
8
|
+
import { RaphScope as v } from "./debug/runtime/ownership/RaphScope.js";
|
|
9
|
+
import { orderPhaseTasks as K } from "./debug/runtime/phases/orderPhaseTasks.js";
|
|
10
10
|
import { RaphSchedulerType as g } from "./debug/runtime/phases/phase.types.js";
|
|
11
11
|
import { RaphRuntime as B } from "./debug/runtime/RaphRuntime.js";
|
|
12
12
|
import { PathHandle as I } from "./debug/runtime/reactivity/PathHandle.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
13
|
+
import { inspectSelector as k } from "./debug/runtime/reactivity/RaphSelector.js";
|
|
14
|
+
import { DataPath as G } from "./debug/path/DataPath.js";
|
|
15
|
+
import { collectionByKey as N, filterByKey as W, full as j } from "./debug/path/derived/derived-strategy.utils.js";
|
|
16
|
+
import { RaphDerivedHandle as w, RaphDerivedTargetWriteError as z } from "./debug/path/derived/RaphDerivedHandle.js";
|
|
17
|
+
import { RaphMeta as L } from "./debug/path/meta/RaphMeta.js";
|
|
18
|
+
import { RaphKernel as Q } from "./debug/path/RaphKernel.js";
|
|
19
|
+
import { DefaultDataAdapter as V } from "./debug/path/storage/DefaultDataAdapter.js";
|
|
19
20
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
G as DataPath,
|
|
22
|
+
V as DefaultDataAdapter,
|
|
22
23
|
I as PathHandle,
|
|
23
24
|
R as Raph,
|
|
24
25
|
n as RaphActionError,
|
|
@@ -26,23 +27,24 @@ export {
|
|
|
26
27
|
p as RaphConfigurationError,
|
|
27
28
|
s as RaphCrossRuntimeError,
|
|
28
29
|
a as RaphDefaultInstanceError,
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
w as RaphDerivedHandle,
|
|
31
|
+
z as RaphDerivedTargetWriteError,
|
|
31
32
|
c as RaphDisposedError,
|
|
32
33
|
u as RaphEffectScope,
|
|
33
34
|
t as RaphError,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
f as RaphFacadeDisposedError,
|
|
36
|
+
Q as RaphKernel,
|
|
37
|
+
L as RaphMeta,
|
|
37
38
|
P as RaphNode,
|
|
38
39
|
l as RaphPhaseProcessError,
|
|
39
40
|
x as RaphReactivityInstance,
|
|
40
41
|
B as RaphRuntime,
|
|
41
42
|
g as RaphSchedulerType,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
v as RaphScope,
|
|
44
|
+
N as collectionByKey,
|
|
45
|
+
W as filterByKey,
|
|
46
|
+
j as full,
|
|
47
|
+
k as inspectSelector,
|
|
48
|
+
K as orderPhaseTasks,
|
|
47
49
|
E as parentGraph
|
|
48
50
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MachineConfig, MachineEvent, MachineGuardRef, MachineInvokeConfig, MachineMigration, MachineModel, MachineOutputRef, MachineReducerRef } from './types';
|
|
1
|
+
import { MachineConfig, MachineEvent, MachineGuardRef, MachineInvokeConfig, MachineMigration, MachineModel, MachineOutputRef, MachineReducerRef } from './types.js';
|
|
2
2
|
export type CompiledStateKind = 'atomic' | 'compound' | 'final' | 'history' | 'parallel';
|
|
3
3
|
export interface CompiledTransition {
|
|
4
4
|
readonly emit: readonly MachineOutputRef<unknown, MachineEvent, unknown>[];
|
package/dist/machine/core.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CompiledMachine, CompiledTransition } from './compiler';
|
|
2
|
-
import { MachineBindings, MachineEvent, MachineModel, MachineOutputRef, MachineSnapshot, PersistedMachineSnapshot } from './types';
|
|
1
|
+
import { CompiledMachine, CompiledTransition } from './compiler.js';
|
|
2
|
+
import { MachineBindings, MachineEvent, MachineModel, MachineOutputRef, MachineSnapshot, PersistedMachineSnapshot } from './types.js';
|
|
3
3
|
export interface MachineEvaluationHooks {
|
|
4
4
|
readonly guard?: (name: string, passed: boolean, context: Readonly<Record<string, unknown>> | undefined) => void;
|
|
5
5
|
readonly transition?: (details: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MachineEvent, MachineModel, MachineSnapshot, PersistedMachineSnapshot } from './types';
|
|
1
|
+
import { MachineEvent, MachineModel, MachineSnapshot, PersistedMachineSnapshot } from './types.js';
|
|
2
2
|
export declare class MachinePersistenceError extends Error {
|
|
3
3
|
}
|
|
4
4
|
export declare function persistMachineSnapshot<Context, Event extends MachineEvent, Input, Output>(model: MachineModel<Context, Event, Input, Output>, snapshot: MachineSnapshot<Context, Output>): PersistedMachineSnapshot<Context, Output>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RaphNode } from '../runtime/ownership/RaphNode';
|
|
2
|
-
import { CreateMachineOptions, MachineBindings, MachineEvent, MachineInstance, MachineModel } from './types';
|
|
3
|
-
import { RaphScope } from '../runtime/ownership/RaphScope';
|
|
1
|
+
import { RaphNode } from '../runtime/ownership/RaphNode.js';
|
|
2
|
+
import { CreateMachineOptions, MachineBindings, MachineEvent, MachineInstance, MachineModel } from './types.js';
|
|
3
|
+
import { RaphScope } from '../runtime/ownership/RaphScope.js';
|
|
4
4
|
export declare function createMachine<Context, Event extends MachineEvent, Input = void, Output = unknown>(owner: RaphNode | RaphScope, model: MachineModel<Context, Event, Input, Output>, bindings?: MachineBindings<Context, Event, Input>, options?: CreateMachineOptions<Context, Input, Output>): MachineInstance<Context, Event, Input, Output>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MachineBindings, MachineClock, MachineEvent, MachineModel, MachineSnapshot } from './types';
|
|
1
|
+
import { MachineBindings, MachineClock, MachineEvent, MachineModel, MachineSnapshot } from './types.js';
|
|
2
2
|
export interface MachineInspection {
|
|
3
3
|
readonly deadEnds: readonly string[];
|
|
4
4
|
readonly inconsistencies: readonly string[];
|
package/dist/machine/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Disposer, ReadonlySignal } from '../reactivity/types';
|
|
2
|
-
import { RaphNode } from '../runtime/ownership/RaphNode';
|
|
3
|
-
import { RaphScope } from '../runtime/ownership/RaphScope';
|
|
1
|
+
import { Disposer, ReadonlySignal } from '../reactivity/types.js';
|
|
2
|
+
import { RaphNode } from '../runtime/ownership/RaphNode.js';
|
|
3
|
+
import { RaphScope } from '../runtime/ownership/RaphScope.js';
|
|
4
4
|
export interface MachineEvent {
|
|
5
5
|
readonly type: string;
|
|
6
6
|
}
|
package/dist/main.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
export { RaphCapabilityError, RaphConfigurationError, RaphDefaultInstanceError, RaphError, RaphFacadeDisposedError, } from './api/errors';
|
|
2
|
-
export { Raph } from './api/Raph';
|
|
3
|
-
export { RaphReactivityInstance } from './api/RaphReactivityInstance';
|
|
4
|
-
export type { ConfiguredRaph, RaphConfigureOptions, RaphFlatConfigureOptions, RaphInstance, RaphInstanceDefinition, RaphInstanceDefinitions, RaphInstanceMode, RaphInstancesConfigureOptions, RaphReactiveApi, RaphReactivityApi, RaphReactivityConfigureOptions, RaphReactivityInstanceDefinition, RaphReactivityInstanceOptions, RaphRuntimeApi, RaphRuntimeConfigureOptions, RaphRuntimeInstanceDefinition, StrictRaphConfigureOptions, } from './api/types';
|
|
5
|
-
export * from './entrypoints/runtime';
|
|
6
|
-
export type { DataPathParseOptions, PathScalar, PathSegment, PlainDataPath, } from './path/data-path.types';
|
|
7
|
-
export { DataPath } from './path/DataPath';
|
|
8
|
-
export type { DerivedCollectionByKeyStrategy, DerivedFilterByKeyStrategy, DerivedFullStrategy, DerivedStrategy, } from './path/derived/derived-strategy.types';
|
|
9
|
-
export { collectionByKey, filterByKey, full } from './path/derived/derived-strategy.utils';
|
|
10
|
-
export { RaphDerivedHandle, RaphDerivedTargetWriteError } from './path/derived/RaphDerivedHandle';
|
|
11
|
-
export type { DerivedOptions } from './path/derived/RaphDerivedHandle';
|
|
12
|
-
export type { RaphMetaApi, RaphMetaEvents, RaphMetaMutationCause, RaphMetaMutationEvent, RaphMetaMutationKind, RaphMetaReadOptions, RaphMetaWatchCallback, RaphMetaWatchOptions, RaphMetaWriteOptions, } from './path/meta/meta.types';
|
|
13
|
-
export { RaphMeta } from './path/meta/RaphMeta';
|
|
14
|
-
export type { DataPathDef, PathEvent, PathEvents, PathMutationKind, PathOptions, PathWatchCallback, } from './path/path.types';
|
|
15
|
-
export { RaphKernel } from './path/RaphKernel';
|
|
16
|
-
export type { RaphKernelOptions, RaphKernelRoot, RaphKernelRuntime, } from './path/RaphKernel';
|
|
17
|
-
export type { DataAdapter, DataObject, DefaultAdapterOptions, } from './path/storage/data-adapter.types';
|
|
18
|
-
export { DefaultDataAdapter } from './path/storage/DefaultDataAdapter';
|
|
19
|
-
export type { Disposer, ReadonlySignal, Signal, WatchOptions, WatchSource, WatchValue, WritableComputedOptions, } from './reactivity/types';
|
|
1
|
+
export { RaphCapabilityError, RaphConfigurationError, RaphDefaultInstanceError, RaphError, RaphFacadeDisposedError, } from './api/errors.js';
|
|
2
|
+
export { Raph } from './api/Raph.js';
|
|
3
|
+
export { RaphReactivityInstance } from './api/RaphReactivityInstance.js';
|
|
4
|
+
export type { ConfiguredRaph, RaphConfigureOptions, RaphFlatConfigureOptions, RaphInstance, RaphInstanceDefinition, RaphInstanceDefinitions, RaphInstanceMode, RaphInstancesConfigureOptions, RaphReactiveApi, RaphReactivityApi, RaphReactivityConfigureOptions, RaphReactivityInstanceDefinition, RaphReactivityInstanceOptions, RaphRuntimeApi, RaphRuntimeConfigureOptions, RaphRuntimeInstanceDefinition, StrictRaphConfigureOptions, } from './api/types.js';
|
|
5
|
+
export * from './entrypoints/runtime.js';
|
|
6
|
+
export type { DataPathParseOptions, PathScalar, PathSegment, PlainDataPath, } from './path/data-path.types.js';
|
|
7
|
+
export { DataPath } from './path/DataPath.js';
|
|
8
|
+
export type { DerivedCollectionByKeyStrategy, DerivedFilterByKeyStrategy, DerivedFullStrategy, DerivedStrategy, } from './path/derived/derived-strategy.types.js';
|
|
9
|
+
export { collectionByKey, filterByKey, full } from './path/derived/derived-strategy.utils.js';
|
|
10
|
+
export { RaphDerivedHandle, RaphDerivedTargetWriteError } from './path/derived/RaphDerivedHandle.js';
|
|
11
|
+
export type { DerivedOptions } from './path/derived/RaphDerivedHandle.js';
|
|
12
|
+
export type { RaphMetaApi, RaphMetaEvents, RaphMetaMutationCause, RaphMetaMutationEvent, RaphMetaMutationKind, RaphMetaReadOptions, RaphMetaWatchCallback, RaphMetaWatchOptions, RaphMetaWriteOptions, } from './path/meta/meta.types.js';
|
|
13
|
+
export { RaphMeta } from './path/meta/RaphMeta.js';
|
|
14
|
+
export type { DataPathDef, PathEvent, PathEvents, PathMutationKind, PathOptions, PathWatchCallback, } from './path/path.types.js';
|
|
15
|
+
export { RaphKernel } from './path/RaphKernel.js';
|
|
16
|
+
export type { RaphKernelOptions, RaphKernelRoot, RaphKernelRuntime, } from './path/RaphKernel.js';
|
|
17
|
+
export type { DataAdapter, DataObject, DefaultAdapterOptions, } from './path/storage/data-adapter.types.js';
|
|
18
|
+
export { DefaultDataAdapter } from './path/storage/DefaultDataAdapter.js';
|
|
19
|
+
export type { Disposer, ReadonlySignal, Signal, WatchOptions, WatchSource, WatchValue, WritableComputedOptions, } from './reactivity/types.js';
|
|
20
20
|
export type PhaseName = string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { RaphRuntime } from '../runtime/RaphRuntime.js';
|
|
2
|
+
import { ObservableBuffer, ObservableBufferValue } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Наблюдает явно объявленные диапазоны, сохраняя исходный нативный buffer/view.
|
|
5
|
+
*/
|
|
6
|
+
export declare function observableBuffer<T extends ObservableBufferValue>(runtime: RaphRuntime, value: T): ObservableBuffer<T>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ReactiveObjectSupport, ReactivePropertySource } from '../reactivity/reactive-object.js';
|
|
2
|
+
import { ReadonlySignal } from '../reactivity/types.js';
|
|
3
|
+
import { ClassPlan } from './class-plan.js';
|
|
4
|
+
import { ObservableContext } from './context.js';
|
|
5
|
+
import { ObservableAnnotation } from './types.js';
|
|
6
|
+
type IdentityContext = ReturnType<ReactiveObjectSupport['identity']>['context'];
|
|
7
|
+
/** Настройки разметки, закреплённые за экземпляром при первом подключении. */
|
|
8
|
+
export interface ClassOptions {
|
|
9
|
+
readonly deep: boolean;
|
|
10
|
+
readonly autoBind: boolean;
|
|
11
|
+
}
|
|
12
|
+
/** Установленный член экземпляра в кольце metadata. */
|
|
13
|
+
export interface ClassMember {
|
|
14
|
+
readonly key: PropertyKey;
|
|
15
|
+
readonly annotation: ObservableAnnotation | 'autoAction';
|
|
16
|
+
readonly inherited: boolean;
|
|
17
|
+
descriptor?: PropertyDescriptor;
|
|
18
|
+
next?: ClassMember;
|
|
19
|
+
/** Член установлен один раз на prototype планом класса, а не на экземпляре. */
|
|
20
|
+
readonly shared?: true;
|
|
21
|
+
}
|
|
22
|
+
export interface ClassRecord {
|
|
23
|
+
/** Установленные члены образуют кольцо; здесь хранится его хвост. */
|
|
24
|
+
members: ClassMember | undefined;
|
|
25
|
+
readonly options: ClassOptions;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Скрытое non-enumerable поле экземпляра: admin одновременно служит identity record engine,
|
|
29
|
+
* поэтому владение экземпляром проверяется без глобального rawOwners WeakMap.
|
|
30
|
+
*/
|
|
31
|
+
export declare const CLASS_ADMIN: symbol;
|
|
32
|
+
export declare const EMPTY_ARGUMENTS: readonly never[];
|
|
33
|
+
/**
|
|
34
|
+
* Состояние экземпляра, размеченного планом класса. Computed и methods живут на prototype
|
|
35
|
+
* и находят экземпляр через receiver; поля по-прежнему установлены на самом экземпляре.
|
|
36
|
+
*/
|
|
37
|
+
export declare class ClassAdmin implements ClassRecord {
|
|
38
|
+
/** Кольцо членов строится лениво, только для повторной разметки. */
|
|
39
|
+
members: ClassMember | undefined;
|
|
40
|
+
readonly options: ClassOptions;
|
|
41
|
+
/** Identity contract engine: владелец и исходный объект. */
|
|
42
|
+
readonly context: IdentityContext;
|
|
43
|
+
readonly raw: object;
|
|
44
|
+
readonly observable: ObservableContext;
|
|
45
|
+
readonly plan: ClassPlan;
|
|
46
|
+
/** Число полей плана, уже установленных на экземпляре (префикс `plan.fields`). */
|
|
47
|
+
fields: number;
|
|
48
|
+
materialized: boolean;
|
|
49
|
+
attached: boolean;
|
|
50
|
+
/** Ленивые computed sources по slot плана. */
|
|
51
|
+
computed: Array<ReadonlySignal<unknown> | undefined> | undefined;
|
|
52
|
+
/** Значения полей плана по индексу `plan.fields`; общие accessors читают их через receiver. */
|
|
53
|
+
readonly values: unknown[];
|
|
54
|
+
/** Ленивые property sources полей по тому же индексу. */
|
|
55
|
+
sources: Array<ReactivePropertySource | undefined> | undefined;
|
|
56
|
+
constructor(observable: ObservableContext, raw: object, plan: ClassPlan, options: ClassOptions, values: unknown[]);
|
|
57
|
+
}
|
|
58
|
+
/** Возвращает admin только для собственного экземпляра; наследники объекта admin не получают. */
|
|
59
|
+
export declare function adminOf(value: unknown): ClassAdmin | undefined;
|
|
60
|
+
/** Публикует admin на экземпляре; повторный вызов ничего не делает. */
|
|
61
|
+
export declare function attachAdmin(admin: ClassAdmin): void;
|
|
62
|
+
export declare function appendMember(record: ClassRecord, member: ClassMember): void;
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ClassAdmin } from './class-admin.js';
|
|
2
|
+
type AnyFunction = (...args: any[]) => unknown;
|
|
3
|
+
interface PlanComputed {
|
|
4
|
+
readonly kind: 'computed';
|
|
5
|
+
readonly key: PropertyKey;
|
|
6
|
+
readonly getter: () => unknown;
|
|
7
|
+
readonly setter: ((value: unknown) => void) | undefined;
|
|
8
|
+
/** Стабильный индекс ленивого computed source в `ClassAdmin.computed`. */
|
|
9
|
+
readonly slot: number;
|
|
10
|
+
/** Descriptor, установленный на prototype; его get/set — identity члена. */
|
|
11
|
+
readonly installed: PropertyDescriptor;
|
|
12
|
+
}
|
|
13
|
+
interface PlanMethod {
|
|
14
|
+
readonly kind: 'method';
|
|
15
|
+
readonly key: PropertyKey;
|
|
16
|
+
readonly original: AnyFunction;
|
|
17
|
+
readonly wrapper: AnyFunction;
|
|
18
|
+
}
|
|
19
|
+
type PlanMember = PlanComputed | PlanMethod;
|
|
20
|
+
/**
|
|
21
|
+
* План automatic class annotation одного prototype: поля берутся с первого экземпляра,
|
|
22
|
+
* computed и methods один раз устанавливаются на prototype и находят состояние через receiver.
|
|
23
|
+
*/
|
|
24
|
+
export interface ClassPlan {
|
|
25
|
+
readonly prototype: object;
|
|
26
|
+
readonly fields: readonly PropertyKey[];
|
|
27
|
+
/** Общие accessors полей по индексу `fields`: значения хранятся в `ClassAdmin.values`. */
|
|
28
|
+
readonly fieldDescriptors: readonly PropertyDescriptor[];
|
|
29
|
+
readonly members: readonly PlanMember[];
|
|
30
|
+
/** Следующий свободный computed slot; slots переживают перестроение плана. */
|
|
31
|
+
readonly slots: number;
|
|
32
|
+
}
|
|
33
|
+
export declare const CLASS_PLAN: unique symbol;
|
|
34
|
+
/**
|
|
35
|
+
* Возвращает актуальный план. undefined — плана нет или prototype член заменён после
|
|
36
|
+
* установки; null — prototype не поддерживается планом.
|
|
37
|
+
*/
|
|
38
|
+
export declare function currentPlan(prototype: object): ClassPlan | null | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Строит (или перестраивает) план по prototype и полям переданного экземпляра.
|
|
41
|
+
* Возвращает undefined, если этот экземпляр или prototype должен идти прежним путём.
|
|
42
|
+
*/
|
|
43
|
+
export declare function createPlan(prototype: object, target: object): ClassPlan | undefined;
|
|
44
|
+
/** Строит кольцо членов admin для повторной разметки: установленные поля и prototype члены плана. */
|
|
45
|
+
export declare function materializeAdmin(admin: ClassAdmin): void;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RaphRuntime } from '../runtime/RaphRuntime.js';
|
|
2
|
+
import { ObservableAnnotations, ObservableClassOptions } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Размечает только перечисленные члены экземпляра; наследование задаётся в каждом constructor.
|
|
5
|
+
*/
|
|
6
|
+
export declare function makeObservable<T extends object, AdditionalKeys extends PropertyKey = never>(runtime: RaphRuntime, target: T, annotations: ObservableAnnotations<T, NoInfer<AdditionalKeys>>, options?: ObservableClassOptions): T;
|
|
7
|
+
/**
|
|
8
|
+
* Выводит observable/computed/autoAction для инициализированных полей и одного prototype класса.
|
|
9
|
+
*/
|
|
10
|
+
export declare function makeAutoObservable<T extends object, AdditionalKeys extends PropertyKey = never>(runtime: RaphRuntime, target: T, overrides?: ObservableAnnotations<T, NoInfer<AdditionalKeys>>, options?: ObservableClassOptions): T;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { ReactiveObjectExtension, ReactiveObjectSupport, ReactivePropertySource } from '../reactivity/reactive-object.js';
|
|
2
|
+
import { Disposer, ReadonlySignal } from '../reactivity/types.js';
|
|
3
|
+
import { RaphRuntime } from '../runtime/RaphRuntime.js';
|
|
4
|
+
import { ObservableAdapterContext } from './types.js';
|
|
5
|
+
type ClassAction = (method: (...args: any[]) => any, receiver: unknown, args: ArrayLike<unknown>) => unknown;
|
|
6
|
+
/** Narrow source index used by native keys and explicit adapter ranges. */
|
|
7
|
+
export interface ObservableSourceIndex {
|
|
8
|
+
get: (key: any) => ReactivePropertySource | undefined;
|
|
9
|
+
set: (key: any, source: ReactivePropertySource) => unknown;
|
|
10
|
+
delete: (key: any) => boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface NativeRecord {
|
|
13
|
+
readonly raw: any;
|
|
14
|
+
readonly context: ObservableContext;
|
|
15
|
+
readonly kind: string;
|
|
16
|
+
readonly deep: boolean;
|
|
17
|
+
readonly sources: Map<unknown, ReactivePropertySource>;
|
|
18
|
+
view: any;
|
|
19
|
+
parent?: WeakRef<NativeRecord>;
|
|
20
|
+
}
|
|
21
|
+
export declare class ObservableContext implements ReactiveObjectExtension {
|
|
22
|
+
readonly runtime: RaphRuntime;
|
|
23
|
+
readonly support: ReactiveObjectSupport;
|
|
24
|
+
readonly engine: ReturnType<RaphRuntime['_getReactivity']>;
|
|
25
|
+
readonly unwrap: ReactiveObjectSupport['unwrap'];
|
|
26
|
+
readonly write: ReactiveObjectSupport['write'];
|
|
27
|
+
/** Owner record engine для identity экземпляров class plan. */
|
|
28
|
+
readonly identityContext: ReturnType<ReactiveObjectSupport['identity']>['context'];
|
|
29
|
+
private readonly _views;
|
|
30
|
+
private readonly _members;
|
|
31
|
+
private _classActions?;
|
|
32
|
+
private readonly _finalizers;
|
|
33
|
+
private _disposed;
|
|
34
|
+
constructor(runtime: RaphRuntime);
|
|
35
|
+
get disposed(): boolean;
|
|
36
|
+
/** Policy читается каждый раз: Runtime переключает её между быстрой и проверяющей. */
|
|
37
|
+
assertRead(): void;
|
|
38
|
+
wrap(value: unknown, deep?: boolean): any;
|
|
39
|
+
wrapChild(value: unknown, deep: boolean): any;
|
|
40
|
+
assertUnwrappedTarget(value: object): void;
|
|
41
|
+
/**
|
|
42
|
+
* Проверка цели для экземпляра класса с готовым планом. Proxy view создаётся только для plain
|
|
43
|
+
* objects и arrays, native view — только для native prototypes, поэтому достаточно identity.
|
|
44
|
+
*/
|
|
45
|
+
assertUnwrappedClassTarget(value: object): void;
|
|
46
|
+
registerAdapterView(view: unknown, member: unknown): void;
|
|
47
|
+
readValue(value: unknown, deep: boolean): unknown;
|
|
48
|
+
registerNative(record: NativeRecord): void;
|
|
49
|
+
native(value: object): NativeRecord | undefined;
|
|
50
|
+
member<T>(raw: object): T | undefined;
|
|
51
|
+
registerMember(raw: object, member: unknown): void;
|
|
52
|
+
/**
|
|
53
|
+
* Регистрирует admin class plan без глобального rawOwners: владение публикует сам экземпляр
|
|
54
|
+
* через identity record. Read boundary проверяется так же, как в claim.
|
|
55
|
+
*/
|
|
56
|
+
registerClassAdmin(raw: object, admin: unknown): void;
|
|
57
|
+
classAction(key: PropertyKey, original: (...args: any[]) => any): ClassAction;
|
|
58
|
+
track(index: ObservableSourceIndex, key: unknown, onEmpty?: Disposer): void;
|
|
59
|
+
notify(index: ObservableSourceIndex, key: unknown): void;
|
|
60
|
+
retainFinalizer(entry: {
|
|
61
|
+
dispose: Disposer;
|
|
62
|
+
}): void;
|
|
63
|
+
computed(getter: () => unknown): ReadonlySignal<unknown>;
|
|
64
|
+
adapterContext(): {
|
|
65
|
+
context: ObservableAdapterContext;
|
|
66
|
+
dispose: Disposer;
|
|
67
|
+
};
|
|
68
|
+
dispose(): void;
|
|
69
|
+
}
|
|
70
|
+
export declare function observableContext(runtime: RaphRuntime): ObservableContext;
|
|
71
|
+
export declare function isNativeValue(value: object): boolean;
|
|
72
|
+
export declare function isNativeClassTarget(value: object): boolean;
|
|
73
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RaphRuntime } from '../runtime/RaphRuntime.js';
|
|
2
|
+
import { ObservableAdapter, ObservableOptions } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Возвращает стабильное наблюдаемое представление поддерживаемого значения данного runtime.
|
|
5
|
+
*/
|
|
6
|
+
export declare function observable<T extends object, View>(runtime: RaphRuntime, value: T, options: ObservableOptions & {
|
|
7
|
+
readonly adapter: ObservableAdapter<T, View>;
|
|
8
|
+
}): View;
|
|
9
|
+
export declare function observable<T extends object>(runtime: RaphRuntime, value: T, options?: ObservableOptions): T;
|
|
10
|
+
/**
|
|
11
|
+
* Фиксирует явный адаптер без изменения глобальной конфигурации или прототипов.
|
|
12
|
+
*/
|
|
13
|
+
export declare function defineObservableAdapter<T extends object, View>(adapter: ObservableAdapter<T, View>): ObservableAdapter<T, View>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Disposer } from '../reactivity/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Управляет глубиной наблюдения одного значения. Режим закрепляется при первом подключении.
|
|
4
|
+
*/
|
|
5
|
+
export interface ObservableOptions {
|
|
6
|
+
readonly deep?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Строковая разметка полей, вычислений и методов экземпляра.
|
|
10
|
+
*/
|
|
11
|
+
export type ObservableAnnotation = 'observable' | 'shallow' | 'ref' | 'computed' | 'action' | 'action.bound' | 'override' | false;
|
|
12
|
+
/**
|
|
13
|
+
* Разметка допускает symbol-поля и явно исключённые члены экземпляра.
|
|
14
|
+
*/
|
|
15
|
+
export type ObservableAnnotations<T extends object, AdditionalKeys extends PropertyKey = never> = {
|
|
16
|
+
[Key in Exclude<keyof T, 'constructor'>]?: ObservableAnnotation;
|
|
17
|
+
} & Record<AdditionalKeys, ObservableAnnotation>;
|
|
18
|
+
/**
|
|
19
|
+
* Настройки автоматической разметки класса.
|
|
20
|
+
*/
|
|
21
|
+
export interface ObservableClassOptions extends ObservableOptions {
|
|
22
|
+
readonly autoBind?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Мост пользовательского типа к графу и lifecycle переданного runtime.
|
|
26
|
+
*/
|
|
27
|
+
export interface ObservableAdapterContext {
|
|
28
|
+
track: (key: PropertyKey) => void;
|
|
29
|
+
notify: (key: PropertyKey) => void;
|
|
30
|
+
mutate: <T>(key: PropertyKey, operation: () => T) => T;
|
|
31
|
+
onObserved: (key: PropertyKey, subscribe: () => void | Disposer) => void;
|
|
32
|
+
onDispose: (cleanup: Disposer) => void;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Явный адаптер; исходный экземпляр не сканируется и не изменяется автоматически.
|
|
36
|
+
*/
|
|
37
|
+
export interface ObservableAdapter<T extends object, View> {
|
|
38
|
+
readonly create: (value: T, context: ObservableAdapterContext) => View;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Диапазон в байтах относительно исходного buffer/view.
|
|
42
|
+
*/
|
|
43
|
+
export interface ObservableBufferRange {
|
|
44
|
+
readonly offset: number;
|
|
45
|
+
readonly length: number;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Нативные буферы не превращаются в Proxy и остаются совместимыми с WebGL.
|
|
49
|
+
*/
|
|
50
|
+
export type ObservableBufferValue = ArrayBufferLike | ArrayBufferView;
|
|
51
|
+
/**
|
|
52
|
+
* Контролируемые чтения и изменения нативного представления.
|
|
53
|
+
* Прямые изменения value требуют явного notify соответствующего диапазона.
|
|
54
|
+
*/
|
|
55
|
+
export interface ObservableBuffer<T extends ObservableBufferValue> {
|
|
56
|
+
readonly value: T;
|
|
57
|
+
read: <Result>(range: ObservableBufferRange, operation: (value: T) => Result) => Result;
|
|
58
|
+
mutate: <Result>(range: ObservableBufferRange, operation: (value: T) => Result) => Result;
|
|
59
|
+
notify: (range: ObservableBufferRange) => void;
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./debug/reactivity/reactive-object.cjs"),I=Symbol("size"),K=Symbol("time"),V=Symbol("params"),pe=new Set(Object.getOwnPropertyNames(Date.prototype).filter(t=>t.startsWith("set"))),le=new Set(["append","delete","set","sort"]),de=Object.freeze([]);class ${_key;_source;_map;get(e){if(this._source!==void 0&&P(e,this._key))return this._source;const r=this._map?.get(e);return r!==void 0&&(this._key=e,this._source=r),r}set(e,r){this._map!==void 0?this._map.set(e,r):this._source!==void 0&&!P(e,this._key)&&(this._map=new Map([[this._key,this._source],[e,r]])),this._key=e,this._source=r}delete(e){const r=this._source!==void 0&&P(e,this._key),n=this._map?.delete(e)??r;return r&&(this._key=void 0,this._source=void 0),this._map?.size===0&&(this._map=void 0),n}keys(){return this._map?.keys()??(this._source===void 0?[]:[this._key]).values()}}function P(t,e){return t===e||t!==t&&e!==e}function he(t,e,r){const n=e instanceof Map?"map":e instanceof Set?"set":e instanceof WeakMap?"weak-map":e instanceof WeakSet?"weak-set":e instanceof Date?"date":e instanceof URL?"url":e instanceof URLSearchParams?"params":void 0;if(n===void 0)throw new TypeError("[Raph] Unsupported observable value; use makeObservable, an adapter, or observableBuffer.");const o={raw:e,context:t,kind:n,deep:r,sources:new Map,getDeps:new $,hasDeps:new $,sizeSource:void 0,keysSource:void 0,valuesSource:void 0,methods:Object.create(null),view:void 0},s=new Proxy(e,{get(i,a){if(a===m.REACTIVE_OBJECT_IDENTITY)return t.support.identity(e);t.assertRead();const c=o.methods[a];return c===void 0?be(o,a):c},set(i,a,c){if(n!=="url")throw new TypeError("[Raph] Observable native properties cannot be assigned; use their native methods.");return se(o,()=>Reflect.set(e,a,c,e))},defineProperty(){throw new TypeError("[Raph] Observable native properties cannot be redefined.")},deleteProperty(){throw new TypeError("[Raph] Observable native properties cannot be deleted.")}});return o.view=s,t.registerNative(o),s}function be(t,e){const{context:r,raw:n,kind:o,deep:s}=t;if(e==="constructor")return Reflect.get(n,e,n);if(o==="url"){if(e==="searchParams"){const c=r.wrap(n.searchParams,s);return r.native(n.searchParams).parent=new WeakRef(t),c}r.track(t.sources,e)}e==="size"&&(o==="map"||o==="set"?z(t,"sizeSource"):r.track(t.sources,I));const i=Reflect.get(n,e,n);if(typeof i!="function")return i;const a=we(t,e)??((...c)=>ve(t,e,i,c));return t.methods[e]=a,a}function ve(t,e,r,n){const{context:o,raw:s,kind:i}=t;return o.assertRead(),i==="date"?typeof e=="string"&&pe.has(e)?o.write(()=>{const a=s.getTime(),c=Reflect.apply(r,s,n);return Object.is(a,s.getTime())||o.notify(t.sources,K),c}):(o.track(t.sources,K),Reflect.apply(r,s,n)):i==="url"?(o.track(t.sources,"href"),Reflect.apply(r,s,n)):i==="params"?Te(t,e,r,n):i==="weak-map"||i==="weak-set"?_e(t,e,r,n):Reflect.apply(r,s,n)}function we(t,e){const{context:r,raw:n,kind:o}=t;if(!(o!=="map"&&o!=="set")){if(e==="get"&&o==="map")return s=>(r.assertRead(),r.track(t.getDeps,s),r.wrapChild(n.get(s),t.deep));if(e==="has")return s=>(r.assertRead(),r.track(t.hasDeps,s),n.has(s));if(e==="set"&&o==="map")return(s,i)=>{r.assertRead(),r.unwrap(s);const a=r.unwrap(i);return M(t,ye,s,a)};if(e==="add"&&o==="set")return s=>(r.assertRead(),r.unwrap(s),M(t,me,s,void 0));if(e==="delete")return s=>(r.assertRead(),M(t,ge,s,void 0));if(e==="clear")return()=>(r.assertRead(),r.write(()=>{if(n.size===0)return;const s=[...new Set([...t.getDeps.keys(),...t.hasDeps.keys()])].filter(i=>n.has(i));n.clear();for(const i of s)r.notify(t.getDeps,i),r.notify(t.hasDeps,i);te(t)}));if(e==="keys"||e==="values"||e==="entries"||e===Symbol.iterator)return()=>(r.assertRead(),z(t,e==="keys"?"keysSource":"valuesSource"),Oe(t,e));if(e==="forEach")return(s,i)=>{if(r.assertRead(),typeof s!="function")throw new TypeError("[Raph] forEach callback must be a function.");z(t,"valuesSource"),n.forEach((a,c)=>{r.assertRead();const u=o==="map"?r.wrapChild(a,t.deep):a;Reflect.apply(s,i,[u,c,t.view])})}}}function M(t,e,r,n){const o=t.context.support,s=o.openWrite();if(s===m.WRITE_NESTED)return e(t,r,n);if(s===m.WRITE_CALLBACK)return t.context.write(()=>e(t,r,n));let i;try{i=e(t,r,n)}catch(a){throw o.failWrite(a)}return o.closeWrite(),i}function ye(t,e,r){const{context:n,raw:o}=t,s=o.get(e),i=s!==void 0||o.has(e);return o.set(e,r),(!i||!Object.is(s,r))&&(n.notify(t.getDeps,e),y(t,t.valuesSource),i||(n.notify(t.hasDeps,e),y(t,t.sizeSource),y(t,t.keysSource))),t.view}function me(t,e,r){const{context:n,raw:o}=t,s=o.has(e);return o.add(e),s||(y(t,t.valuesSource),n.notify(t.hasDeps,e),y(t,t.sizeSource),y(t,t.keysSource)),t.view}function ge(t,e,r){const{context:n,raw:o}=t,s=o.delete(e);return s&&(n.notify(t.getDeps,e),n.notify(t.hasDeps,e),te(t)),s}class ee{constructor(e,r){this._record=e,this._key=r}_iterator;next(){const e=this._record;if(e===void 0)return{value:void 0,done:!0};try{const r=this._iterator??=Reflect.apply(e.raw[this._key],e.raw,de);e.context.assertRead();const n=r.next();return n.done?(this._close(),{value:void 0,done:!0}):(e.kind==="map"&&this._key!=="keys"&&(this._key==="values"?n.value=e.context.wrapChild(n.value,e.deep):n.value[1]=e.context.wrapChild(n.value[1],e.deep)),n)}catch(r){throw this._close(),r}}return(e){return this._close(),{value:e,done:!0}}throw(e){throw this._close(),e}[Symbol.iterator](){return this}_close(){this._record=void 0,this._iterator=void 0}}Object.setPrototypeOf(ee.prototype,Object.getPrototypeOf(Object.getPrototypeOf((function*(){})())));function Oe(t,e){return new ee(t,e)}function te(t){y(t,t.sizeSource),y(t,t.keysSource),y(t,t.valuesSource)}function y(t,e){e!==void 0&&t.context.support.bridge.trigger(e)}function z(t,e){const r=t.context.support.bridge;if(!r.isTracking())return;let n=t[e];n===void 0&&(n=r.createTransient(()=>{t[e]=void 0}),t[e]=n),r.track(n)}function Re(t,e,r){const{context:n}=t,o=n.support.bridge;if(!o.isTracking()||typeof r!="object"&&typeof r!="function"&&typeof r!="symbol"||r===null||typeof r=="symbol"&&Symbol.keyFor(r)!==void 0)return;let s=e.get(r);if(s===void 0){const i=new WeakRef(r);s=o.createTransient(()=>{const a=i.deref();a!==void 0&&e.delete(a)}),e.set(r,s)}o.track(s)}function _e(t,e,r,n){const{context:o,raw:s}=t;if(e==="get"||e==="has"){Re(t,e==="get"?t.weakGet??=new WeakMap:t.weakHas??=new WeakMap,n[0]);const i=Reflect.apply(r,s,n);return e==="get"?o.wrapChild(i,t.deep):i}if(e==="set"||e==="add"||e==="delete"){o.unwrap(n[0]);const i=e==="set"?o.unwrap(n[1]):n[0];return o.write(()=>{const a=s.has(n[0]),c=t.kind==="weak-map"?s.get(n[0]):n[0],u=Reflect.apply(r,s,e==="set"?[n[0],i]:n);if(e==="delete"?u:!a||!Object.is(c,i)){const p=t.weakGet?.get(n[0]);if(p!==void 0&&o.support.bridge.trigger(p),e==="delete"||!a){const l=t.weakHas?.get(n[0]);l!==void 0&&o.support.bridge.trigger(l)}}return e==="delete"?u:t.view})}return Reflect.apply(r,s,n)}function re(t){const e=new Map;for(const r of t.sources.keys())e.set(r,r===I?t.raw.size:r===V?t.raw.toString():JSON.stringify(t.raw.getAll(r)));return e}function ne(t,e){for(const[r,n]of e){const o=r===I?t.raw.size:r===V?t.raw.toString():JSON.stringify(t.raw.getAll(r));n!==o&&t.context.notify(t.sources,r)}}function Te(t,e,r,n){const{context:o,raw:s}=t;if(typeof e=="string"&&le.has(e)){const a=t.parent?.deref();return a!==void 0?se(a,()=>Reflect.apply(r,s,n)):o.write(()=>{const c=re(t),u=Reflect.apply(r,s,n);return ne(t,c),u})}if(o.track(t.sources,e==="get"||e==="getAll"||e==="has"?String(n[0]):V),e==="forEach"){if(typeof n[0]!="function")throw new TypeError("[Raph] forEach callback must be a function.");return s.forEach((a,c)=>{o.assertRead(),Reflect.apply(n[0],n[1],[a,c,t.view])})}const i=Reflect.apply(r,s,n);return e==="entries"||e==="keys"||e==="values"||e===Symbol.iterator?Se(o,i):i}function*Se(t,e){for(;;){t.assertRead();const r=e.next();if(r.done)return;yield r.value}}function se(t,e){const{context:r,raw:n}=t;return r.write(()=>{const o=new Map;for(const c of t.sources.keys())o.set(c,Reflect.get(n,c,n));const s=r.native(n.searchParams),i=s===void 0?void 0:re(s),a=e();for(const[c,u]of o)u!==Reflect.get(n,c,n)&&r.notify(t.sources,c);return s!==void 0&&i!==void 0&&ne(s,i),a})}const W=new WeakMap;class ke{runtime;support;engine;unwrap;write;identityContext;_views=new WeakMap;_members=new WeakMap;_classActions;_finalizers=new Set;_disposed=!1;constructor(e){this.runtime=e,this.engine=e._getReactivity(),e.reactive({}),this.support=m.getReactiveObjectSupport(this.engine),this.unwrap=this.support.unwrap,this.write=this.support.write,this.identityContext=this.support.identity(this).context,e.rootScope.own(()=>this.dispose())}get disposed(){return this._disposed}assertRead(){this.support.policy.assertRead?.()}wrap(e,r=!0){if(this.assertRead(),e===null||typeof e!="object")return e;const n=this._members.get(e);if(n!==void 0)return Object.hasOwn(n,"view")?n.view:e;const o=this.support.observedView(e)??this._views.get(e);if(o!==void 0){if(o.deep!==r)throw new TypeError("[Raph] Observable depth is already fixed for this value.");return o.view}const s=this.support.unwrap(e),i=this._members.get(s);if(i!==void 0)return Object.hasOwn(i,"view")?i.view:s;if(m.isPlainReactiveValue(s)){const c=this.support.wrap(s,this,r);return this.support.observedView(s)===void 0&&this.support.setObservedView(s,c,r),c}const a=this._views.get(s);if(a!==void 0){if(a.deep!==r)throw new TypeError("[Raph] Observable depth is already fixed for this value.");return a.view}return he(this,s,r)}wrapChild(e,r){if(!r)return this.support.unwrap(e),e;if(e===null||typeof e!="object")return e;const n=this.support.observedView(e)??this._views.get(e);if(n!==void 0){if(!n.deep)throw new TypeError("[Raph] Observable depth is already fixed for this value.");return n.view}const o=this.support.unwrap(e);return m.isPlainReactiveValue(o)||this._members.has(o)||Ae(o)?this.wrap(o,!0):e}assertUnwrappedTarget(e){if(this.unwrap(e)!==e||this.support.hasView(e)||this.support.observedView(e)!==void 0||this._views.has(e))throw new TypeError("[Raph] Instrument the original value before observable wrapping.")}assertUnwrappedClassTarget(e){if(this.unwrap(e)!==e)throw new TypeError("[Raph] Instrument the original value before observable wrapping.")}registerAdapterView(e,r){e===null||typeof e!="object"||this.unwrap(e)!==e||this._members.has(e)||(this.assertUnwrappedTarget(e),this.registerMember(e,r))}readValue(e,r){return this.wrapChild(e,r)}registerNative(e){this.support.claim(e.raw),this._views.set(e.raw,e)}native(e){const r=this._views.get(e);return r!==void 0&&"raw"in r?r:void 0}member(e){return this._members.get(e)}registerMember(e,r){this.support.claim(e),this._members.set(e,r)}registerClassAdmin(e,r){this.assertRead(),this._members.set(e,r)}classAction(e,r){const n=this._classActions??=new WeakMap,o=String(e),s=n.get(r);if(s?.name===o)return s.invoke;if(!o.trim())throw new Error("[Raph] Action name must not be empty.");const i=(a,c,u)=>this.runtime._invokeAction(o,this.runtime.rootScope,a,u,c);return n.set(r,{name:o,invoke:i}),i}track(e,r,n){const o=this.support.bridge;if(!o.isTracking())return;let s=e.get(r);s===void 0&&(s=o.createTransient(()=>{e.delete(r),n?.()}),e.set(r,s)),o.track(s)}notify(e,r){const n=e.get(r);n!==void 0&&this.support.bridge.trigger(n)}retainFinalizer(e){const r=new WeakRef(e);if(this._finalizers.add(r),this._finalizers.size%128===0)for(const n of this._finalizers)n.deref()===void 0&&this._finalizers.delete(n)}computed(e){let r,n;const o=()=>(this.assertRead(),r===void 0&&!this.engine._isTracking()?e():(n===void 0&&(n={dispose:()=>{const s=r;r=void 0,s?.dispose()}},this.retainFinalizer(n)),r??=this.engine._ownedComputed(()=>this.engine.runWithOwner(this.engine._lifecycle,this.runtime.rootScope,e),{dependencyOwner:this.runtime.rootScope,onDependency:()=>()=>{r!==void 0&&!this.support.bridge.hasMultipleSubscribers(r.source)&&n.dispose()}}),r.source.get()));return{get:o,peek:()=>this.runtime.untracked(o)}}adapterContext(){const e=new Map,r=new Map,n=new Set;let o;const s={active:!0,dispose:()=>{if(!s.active)return;s.active=!1,o?.();const a=[];for(const c of r.values()){const u=c.stop;c.stop=void 0,c.count=0;try{u?.()}catch(d){a.push(d)}}for(const c of e.values())try{this.support.bridge.release(c)}catch(u){a.push(u)}e.clear(),r.clear();for(const c of n)try{c()}catch(u){a.push(u)}if(n.clear(),a.length>0)throw new AggregateError(a,"[Raph] Observable adapter cleanup failed.")}};return this.retainFinalizer(s),{context:{track:a=>{if(!s.active)throw this.assertRead(),new Error("[Raph] Adapter is disposed.");this.assertRead();const c=this.support.bridge;if(!c.isTracking())return;let u=e.get(a);u===void 0&&(u=c.create({onDependency:()=>{const d=r.get(a);if(d!==void 0&&d.count++===0)try{d.stop=d.subscribe()??void 0}catch(p){throw--d.count,p}return()=>{if(c.hasMultipleSubscribers(u)||e.delete(a),d!==void 0&&d.count>0&&--d.count===0){const p=d.stop;d.stop=void 0,p?.()}}}}),e.set(a,u)),c.track(u)},notify:a=>{if(!s.active)throw this.assertRead(),new Error("[Raph] Adapter is disposed.");this.assertRead();const c=()=>this.support.bridge.batch(()=>this.notify(e,a));this.support.policy.runWrite===void 0?c():this.support.policy.runWrite(c)},mutate:(a,c)=>{if(!s.active)throw this.assertRead(),new Error("[Raph] Adapter is disposed.");return this.write(()=>{try{return c()}finally{this.notify(e,a)}})},onObserved:(a,c)=>{if(!s.active)throw this.assertRead(),new Error("[Raph] Adapter is disposed.");if(this.assertRead(),e.has(a)||r.has(a))throw new TypeError("[Raph] onObserved must be registered before the first tracked read.");if(typeof c!="function")throw new TypeError("[Raph] subscribe must be a function.");r.set(a,{subscribe:c,count:0})},onDispose:a=>{if(!s.active)throw this.assertRead(),new Error("[Raph] Adapter is disposed.");if(this.assertRead(),typeof a!="function")throw new TypeError("[Raph] cleanup must be a function.");n.add(a),o??=this.runtime.rootScope.own(s.dispose)}},dispose:s.dispose}}dispose(){if(this._disposed)return;this._disposed=!0,W.delete(this.runtime),this._classActions=void 0;const e=[];for(const r of this._finalizers)try{r.deref()?.dispose()}catch(n){e.push(n)}if(this._finalizers.clear(),e.length>0)throw new AggregateError(e,"[Raph] Observable cleanup failed.")}}function L(t){t.rootScope._assertAlive();let e=W.get(t);return e===void 0&&(e=new ke(t),W.set(t,e)),e}const oe=new Set([Map.prototype,Set.prototype,WeakMap.prototype,WeakSet.prototype,Date.prototype,URL.prototype,URLSearchParams.prototype]);function Ae(t){for(let e=Object.getPrototypeOf(t);e!==null&&e!==Object.prototype;e=Object.getPrototypeOf(e))if(oe.has(e))return!0;return!1}const Ee=new Set([...oe,ArrayBuffer.prototype,...typeof SharedArrayBuffer>"u"?[]:[SharedArrayBuffer.prototype]]);function je(t){for(let e=Object.getPrototypeOf(t);e!==null&&e!==Object.prototype;e=Object.getPrototypeOf(e))if(Ee.has(e))return!0;return ArrayBuffer.isView(t)}const Y=new WeakMap;function Pe(t,e){const r=L(t),n=ArrayBuffer.isView(e);if(!n&&!(e instanceof ArrayBuffer)&&!(typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer))throw new TypeError("[Raph] observableBuffer requires ArrayBuffer, SharedArrayBuffer, TypedArray or DataView.");const o=n?e.buffer:e;r.support.claim(o),r.support.claim(e);let s=Y.get(r);s===void 0&&Y.set(r,s=new WeakMap);let i=s.get(o);i===void 0&&(i={context:r,ranges:new Map},s.set(o,i));const a=i,c=n?e.byteOffset:0;function u(p){r.assertRead();let l=e.byteLength;if(l===0&&o.byteLength===0&&(l=new Uint8Array(o,0,0).byteLength),!Number.isSafeInteger(p.offset)||!Number.isSafeInteger(p.length)||p.offset<0||p.length<0||p.offset+p.length>l)throw new RangeError("[Raph] Observable buffer range is outside the native view.");return{start:c+p.offset,end:c+p.offset+p.length}}function d(p,l){for(const[h,f]of a.ranges){if(f.sources.size===0){a.ranges.delete(h);continue}p<f.end&&f.start<l&&r.notify(f.sources,h)}}return{get value(){return r.assertRead(),e},read(p,l){const{start:h,end:f}=u(p);if(h!==f&&r.engine._isTracking()){const v=`${h}:${f}`;let b=a.ranges.get(v);b===void 0&&a.ranges.set(v,b={start:h,end:f,sources:new Map}),r.track(b.sources,v,()=>a.ranges.delete(v))}return G(l(e))},mutate(p,l){const{start:h,end:f}=u(p);return r.write(()=>{try{return G(l(e))}finally{d(h,f)}})},notify(p){const{start:l,end:h}=u(p),f=()=>r.support.bridge.batch(()=>d(l,h));r.support.policy.runWrite===void 0?f():r.support.policy.runWrite(f)}}}function G(t){if(t!==null&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function")throw new TypeError("[Raph] Observable buffer callbacks must be synchronous.");return t}const g=m.REACTIVE_OBJECT_IDENTITY,O=Object.freeze([]);class F{members=void 0;options;context;raw;observable;plan;fields=0;materialized=!1;attached=!1;computed=void 0;values;sources=void 0;constructor(e,r,n,o,s){this.context=e.identityContext,this.raw=r,this.observable=e,this.plan=n,this.options=o,this.values=s}}function S(t){if(t===null||typeof t!="object")return;const e=t[g];return e instanceof F&&e.raw===t?e:void 0}const x={value:void 0,writable:!1,enumerable:!1,configurable:!0};function ie(t){if(!t.attached){x.value=t;try{Object.defineProperty(t.raw,g,x)}finally{x.value=void 0}t.attached=!0}}function N(t,e){const r=t.members;e.next=r===void 0?e:r.next,r!==void 0&&(r.next=e),t.members=e}const k=new WeakMap,U=Symbol("raph.observable.plan"),B=U,D={value:void 0,writable:!0,enumerable:!1,configurable:!0},C=new WeakMap,Me=Object.prototype.__lookupGetter__;function q(t){const e=t[B],r=e!==void 0&&e.prototype===t?e:k.get(t);if(r==null)return r;const n=r.members;for(let o=0;o<n.length;o++){const s=n[o];if((s.kind==="method"?t[s.key]:Me.call(t,s.key))!==(s.kind==="method"?s.wrapper:s.installed.get))return}return r}function xe(t,e){const r=k.get(t);if(r===null)return;const n=[];for(const c of Reflect.ownKeys(e)){if(c===g)continue;const u=Object.getOwnPropertyDescriptor(e,c);if(u===void 0||!("value"in u)||u.writable!==!0||u.configurable!==!0||u.enumerable!==!0)return;n.push(c)}const o=[],s=[];let i=r?.slots??0;for(const c of Reflect.ownKeys(t)){if(c==="constructor"||c===g||c===B||n.includes(c))continue;const u=Object.getOwnPropertyDescriptor(t,c),d=String(c);if(u.configurable!==!0||!d.trim())return H(t);if(u.get!==void 0){const p=C.get(u.get);if(p?.kind==="computed"&&p.key===c&&p.installed.set===u.set){o.push(p);continue}const l=Be(c,d,u,i++);o.push(l),s.push({member:l,installed:l.installed})}else if(u.set===void 0&&typeof u.value=="function"){const p=C.get(u.value);if(p?.kind==="method"&&p.key===c){o.push(p);continue}const l=Ve(c,d,u.value);o.push(l),s.push({member:l,installed:{configurable:!0,enumerable:u.enumerable??!1,writable:u.writable??!0,value:l.wrapper}})}else return H(t)}try{for(const{member:c,installed:u}of s)Object.defineProperty(t,c.key,u),C.set(c.kind==="method"?c.wrapper:c.installed.get,c)}catch{return}const a={prototype:t,fields:n,fieldDescriptors:n.map(De),members:o,slots:i};k.set(t,a),D.value=a;try{Object.defineProperty(t,B,D)}catch{}finally{D.value=void 0}return a}function De(t,e){return{configurable:!0,enumerable:!0,get(){return Ce(J(this,t),e)},set(r){We(J(this,t),e,r)}}}function J(t,e){const r=S(t);if(r===void 0)throw new TypeError(`[Raph] Observable field accessor requires its annotated instance: ${String(e)}`);return r}function Ce(t,e){const r=t.observable;r.assertRead();const n=r.support.bridge,o=t.sources,s=o===void 0?void 0:o[e];s!==void 0?n.track(s):n.isTracking()&&ze(t,e,n);const i=t.values[e];return i===null||typeof i!="object"?i:t.options.deep?r.wrapChild(i,!0):r.wrap(i,!1)}function ze(t,e,r){const n=r.createTransient(()=>{const o=t.sources;o!==void 0&&o[e]===n&&(o[e]=void 0)});(t.sources??=[])[e]=n,r.track(n)}function We(t,e,r){const n=t.observable;if(n.support.tryDirectWrite()){ae(t,e,n.unwrap(r));return}Ne(t,e,r)}function Ne(t,e,r){const n=t.observable;n.write(()=>{ae(t,e,n.unwrap(r))})}function ae(t,e,r){const n=t.values;if(Object.is(r,n[e]))return;n[e]=r;const o=t.sources,s=o===void 0?void 0:o[e];s!==void 0&&t.observable.support.bridge.trigger(s)}function H(t){k.set(t,null)}function Be(t,e,r,n){const o=r.get,s=r.set,i={configurable:!0,enumerable:r.enumerable??!1},a={kind:"computed",key:t,getter:o,setter:s,slot:n,installed:i};return i.get=function(){const c=S(this);return c===void 0?Reflect.apply(o,this,O):Ie(c,a)},s!==void 0&&(i.set=function(c){const u=S(this);if(u===void 0){Reflect.apply(s,this,[c]);return}const d=u.observable.runtime;d._invokeAction(e,d.rootScope,s,[c],u.raw)}),a}function Ie(t,e){const r=t.computed,n=r===void 0?void 0:r[e.slot];if(n!==void 0)return n.get();const o=t.observable;o.assertRead();const s=t.raw;if(!o.engine._isTracking())return Reflect.apply(e.getter,s,O);const i=o.computed(Function.prototype.bind.call(e.getter,s));return(t.computed??=[])[e.slot]=i,i.get()}function Ve(t,e,r){return{kind:"method",key:t,original:r,wrapper:function(){const o=arguments.length===0?O:arguments,s=S(this);if(s===void 0)return Reflect.apply(r,this,o);const i=s.observable;if(i.assertRead(),i.engine._isTracking())return Reflect.apply(r,this,o);const a=i.runtime;return a._invokeAction(e,a.rootScope,r,o,this)}}}function Le(t){if(t.materialized)return;t.materialized=!0;const{plan:e,raw:r,options:n}=t;for(let o=0;o<t.fields;o++){const s=e.fields[o],i=Object.getOwnPropertyDescriptor(r,s),a=i!==void 0&&"value"in i;N(t,{key:s,annotation:a?"autoAction":n.deep?"observable":"shallow",inherited:!1})}for(const o of e.members)N(t,o.kind==="computed"?{key:o.key,annotation:"computed",inherited:!0,descriptor:o.installed,shared:!0}:{key:o.key,annotation:"autoAction",inherited:!0,shared:!0});ie(t)}const A=Object.freeze({deep:!0,autoBind:!1}),T=Object.freeze({});function Fe(t,e,r,n=A){return ce(t,e,r,n,!1)}function Ue(t,e,r=T,n=A){return ce(t,e,r,n,!0)}function ce(t,e,r,n,o){const s=L(t);if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError("[Raph] makeObservable requires an initialized object or class instance.");if(o&&r===T&&n.autoBind!==!0){const f=Object.getPrototypeOf(e),v=f!==null&&f!==Object.prototype?q(f):void 0;if(v!=null&&(s.assertUnwrappedClassTarget(e),s.member(e)===void 0)){const b=Q(s,e,v,Z(n));if(b!==void 0)return b}}if(s.assertUnwrappedTarget(e),je(e))throw new TypeError("[Raph] Native values use observable or observableBuffer, not class annotations.");const i=Z(n),a=s.member(e);if(a instanceof F&&Le(a),a!==void 0&&!Object.hasOwn(a,"members"))throw new TypeError("[Raph] Target already uses a custom observable adapter.");if(a!==void 0&&(a.options.deep!==i.deep||a.options.autoBind!==i.autoBind))throw new TypeError("[Raph] Observable class options are already fixed.");let c;if(a!==void 0){c=new Map;const f=a.members;if(f!==void 0){const v=f.next;let b=v;do c.set(b.key,b),b=b.next;while(b!==v)}}const u=Object.getPrototypeOf(e);if(o&&u!==null&&u!==Object.prototype&&Object.getPrototypeOf(u)!==Object.prototype)throw new TypeError("[Raph] makeAutoObservable does not support inheritance; use makeObservable and override.");if(o&&r===T&&a===void 0){if(!i.autoBind&&u!==null&&u!==Object.prototype){const f=q(u)??xe(u,e);if(f!==void 0){const v=Q(s,e,f,i);if(v!==void 0)return v}}return $e(s,e,u,i)}const d=r===T,p=Reflect.ownKeys(o?e:r);if(o){if(u!==null&&u!==Object.prototype)for(const f of Reflect.ownKeys(u))f!=="constructor"&&f!==U&&!Object.hasOwn(e,f)&&p.push(f);if(!d)for(const f of Reflect.ownKeys(r))p.includes(f)||p.push(f)}let l,h;for(const f of p){if(f==="constructor"||f===g)continue;const v=Object.getOwnPropertyDescriptor(e,f),b=v??(o&&u!==null&&u!==Object.prototype?Object.getOwnPropertyDescriptor(u,f):Je(u,f));if(b===void 0)throw new TypeError(`[Raph] Observable member is not initialized: ${String(f)}`);let w=d?void 0:r[f];const R=c?.get(f);if(d||!Object.hasOwn(r,f)){if(R!==void 0)continue;w=b.get!==void 0?"computed":typeof b.value=="function"?"autoAction":i.deep?"observable":"shallow"}if(w===void 0)throw new TypeError("[Raph] Missing observable annotation.");const E=R?.annotation;if(E!==void 0&&w!=="override"){if(E===w)continue;throw new TypeError(`[Raph] Observable annotation is already fixed: ${String(f)}`)}if(w==="override"){const _=R?.descriptor;if(E===void 0||_===void 0||_.get!==b.get||_.set!==b.set||_.value!==b.value)throw new TypeError("[Raph] override requires an inherited observable method or getter.");if(v===void 0&&R?.shared!==!0)throw new TypeError("[Raph] override requires a previously instrumented member.");continue}if(w!==!1){if(v!==void 0&&b.configurable===!1)throw new TypeError(`[Raph] Observable member must be configurable: ${String(f)}`);if(v===void 0&&!Object.isExtensible(e))throw new TypeError("[Raph] Observable target is not extensible.");if(w==="computed"?typeof b.get!="function":w==="action"||w==="action.bound"||w==="autoAction"?typeof b.value!="function":!(w==="observable"||w==="shallow"||w==="ref")||!("value"in b)||b.writable===!1)throw new TypeError(`[Raph] Observable annotation does not match member: ${String(f)}`);"value"in b&&(b.value=s.unwrap(b.value))}const j={key:f,descriptor:b,annotation:w,inherited:v===void 0,next:void 0};h===void 0?l=j:h.next=j,h=j}return ue(s,e,l,i,a)}function Z(t){return t===A?A:{deep:t.deep??!0,autoBind:t.autoBind??!1}}function Q(t,e,r,n){const o=r.fields,s=o.length,i=e;for(let l=0;l<s;l++){const h=o[l];if(!Object.hasOwn(e,h))return;const f=i[h];f!==null&&typeof f=="object"&&t.unwrap(f)}if(!Object.isExtensible(e))throw new TypeError("[Raph] Observable target is not extensible.");const a=new Array(s),c=new F(t,e,r,n,a);t.registerClassAdmin(e,c);const u=n.deep?"observable":"shallow",d=r.fieldDescriptors;let p=0;try{for(;p<s;p++){const l=o[p],h=i[l],f=typeof h=="function";a[p]=f||h===null||typeof h!="object"?h:t.unwrap(h);const v=f?fe(t,e,l,!1,"autoAction",!1,{configurable:!0,enumerable:!0,writable:!0,value:h}):d[p];Object.defineProperty(e,l,v),c.fields=p+1,c.materialized&&N(c,{key:l,annotation:f?"autoAction":u,inherited:!1})}}catch(l){const h=Ke(e,c,p,l);try{t.support.claim(e)}catch{}throw h}return ie(c),e}function Ke(t,e,r,n){const o=e.plan.fields;if(!e.materialized)for(let s=r-1;s>=0;s--){try{Object.defineProperty(t,o[s],{value:e.values[s],writable:!0,enumerable:!0,configurable:!0})}catch{break}e.fields=s}return n instanceof TypeError&&r<o.length&&Object.getOwnPropertyDescriptor(t,o[r])?.configurable===!1?new TypeError(`[Raph] Observable member must be configurable: ${String(o[r])}`):n}function $e(t,e,r,n){let o,s;for(const i of Reflect.ownKeys(e)){if(i==="constructor"||i===g)continue;const a=X(t,e,i,Object.getOwnPropertyDescriptor(e,i),!1,n);s===void 0?o=a:s.next=a,s=a}if(r!==null&&r!==Object.prototype)for(const i of Reflect.ownKeys(r)){if(i==="constructor"||i===U||Object.hasOwn(e,i))continue;const a=X(t,e,i,Object.getOwnPropertyDescriptor(r,i),!0,n);s===void 0?o=a:s.next=a,s=a}return ue(t,e,o,n)}function X(t,e,r,n,o,s){if(n===void 0)throw new TypeError(`[Raph] Observable member is not initialized: ${String(r)}`);const i=n.get!==void 0?"computed":typeof n.value=="function"?"autoAction":s.deep?"observable":"shallow";if(!o&&n.configurable===!1)throw new TypeError(`[Raph] Observable member must be configurable: ${String(r)}`);if(o&&!Object.isExtensible(e))throw new TypeError("[Raph] Observable target is not extensible.");if((i==="observable"||i==="shallow")&&(!("value"in n)||n.writable===!1))throw new TypeError(`[Raph] Observable annotation does not match member: ${String(r)}`);return i!=="autoAction"&&"value"in n&&(n.value=t.unwrap(n.value)),{key:r,descriptor:n,annotation:i,inherited:o,next:void 0}}function ue(t,e,r,n,o){const s=o??{members:void 0,options:n};t.registerMember(e,s);for(let i=r;i!==void 0;){const a=i.next,{key:c,annotation:u}=i,d=i.descriptor;if(i.descriptor=void 0,u===!1){const f=s.members;i.next=f===void 0?i:f.next,f!==void 0&&(f.next=i),s.members=i,i=a;continue}const p=i.inherited&&(u==="computed"||u==="action"||u==="action.bound"),l=Ye(t,e,i,d,n);Object.defineProperty(e,c,l),p&&(i.descriptor=l);const h=s.members;i.next=h===void 0?i:h.next,h!==void 0&&(h.next=i),s.members=i,i=a}return e}function Ye(t,e,r,n,o){const s=r.annotation;return s==="computed"?Ge(t,e,r.key,n):s==="action"||s==="action.bound"||s==="autoAction"?fe(t,e,r.key,r.inherited,s,o.autoBind,n):qe(t,s,n.value,n.enumerable??!1)}function Ge(t,e,r,n){const o={configurable:!0,enumerable:n.enumerable??!1},s=n.get;let i;if(o.get=()=>i!==void 0?i.get():(t.assertRead(),t.engine._isTracking()?(i=t.computed(Function.prototype.bind.call(s,e)),i.get()):Reflect.apply(s,e,O)),n.set!==void 0){const a=n.set,c=t.classAction(r,a);o.set=u=>c(a,e,[u])}return o}function fe(t,e,r,n,o,s,i){const a=i;a.configurable=!0;const c=i.value,u=typeof r=="string"?r:{key:r,name:String(r)};if(!(typeof u=="string"?u:u.name).trim())throw new Error("[Raph] Action name must not be empty.");const p=function(){const l=arguments.length===0?O:arguments;t.assertRead();const h=typeof u=="string"?u:u.key,f=n?He(Object.getPrototypeOf(e),h)??c:c;return o==="autoAction"&&t.engine._isTracking()?Reflect.apply(f,this,l):t.runtime._invokeAction(typeof u=="string"?u:u.name,t.runtime.rootScope,f,l,this)};return a.value=o==="action.bound"||s?p.bind(e):p,a.writable=!0,a}function qe(t,e,r,n){const o={configurable:!0,enumerable:n};let s=r,i;const a=t.support.bridge;return o.get=()=>(t.assertRead(),i!==void 0?a.track(i):a.isTracking()&&(i=a.createTransient(()=>{i=void 0}),a.track(i)),s===null||typeof s!="object"||e==="ref"?s:e==="shallow"?t.wrap(s,!1):t.wrapChild(s,!0)),o.set=c=>{if(t.support.tryDirectWrite()){const u=t.unwrap(c);if(Object.is(u,s))return;s=u,i!==void 0&&a.trigger(i)}else{const u=c;t.write(()=>{const d=t.unwrap(u);Object.is(d,s)||(s=d,i!==void 0&&a.trigger(i))})}},o}function Je(t,e){for(let r=t;r!==null&&r!==Object.prototype;r=Object.getPrototypeOf(r)){const n=Object.getOwnPropertyDescriptor(r,e);if(n!==void 0)return n}}function He(t,e){for(let r=t;r!==null&&r!==Object.prototype;r=Object.getPrototypeOf(r)){const n=Object.getOwnPropertyDescriptor(r,e);if(n!==void 0)return n.value}}function Ze(t,e,r={}){const n=L(t);if(e===null||typeof e!="object")throw new TypeError("[Raph] observable requires an object; use signal for primitives.");if(r.adapter===void 0)return n.wrap(e,r.deep??!0);n.assertRead();const o=n.member(e);if(o!==void 0){if(o.adapter!==r.adapter)throw new TypeError("[Raph] Observable adapter is already fixed for this value.");return o.view}n.assertUnwrappedTarget(e),n.support.claim(e);const s=n.adapterContext();let i;try{i=r.adapter.create(e,s.context);const a={adapter:r.adapter,view:i};Object.is(i,e)||n.registerAdapterView(i,a),n.registerMember(e,a)}catch(a){try{s.dispose()}catch(c){throw new AggregateError([a,c],"[Raph] Observable adapter creation and cleanup failed.")}throw a}return i}function Qe(t){if(typeof t?.create!="function")throw new TypeError("[Raph] Observable adapter requires create().");return Object.freeze({create:t.create})}exports.defineObservableAdapter=Qe;exports.makeAutoObservable=Ue;exports.makeObservable=Fe;exports.observable=Ze;exports.observableBuffer=Pe;
|