Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mobx-state-tree

Package Overview
Dependencies
Maintainers
3
Versions
129
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mobx-state-tree - npm Package Compare versions

Comparing version 3.2.3 to 3.2.4

32

dist/core/action.d.ts

@@ -13,11 +13,3 @@ import { IDisposer, IAnyStateTreeNode } from "../internal";

};
export declare type IMiddleware = {
handler: IMiddlewareHandler;
includeHooks: boolean;
};
export declare type IMiddlewareHandler = (actionCall: IMiddlewareEvent, next: (actionCall: IMiddlewareEvent, callback?: (value: any) => any) => void, abort: (value: any) => void) => any;
export declare function getNextActionId(): number;
export declare function runWithActionContext(context: IMiddlewareEvent, fn: Function): any;
export declare function getActionContext(): IMiddlewareEvent;
export declare function createActionInvoker<T extends Function>(target: IAnyStateTreeNode, name: string, fn: T): () => any;
/**

@@ -35,2 +27,24 @@ * Middleware can be used to intercept any action is invoked on the subtree where it is attached.

export declare function addMiddleware(target: IAnyStateTreeNode, handler: IMiddlewareHandler, includeHooks?: boolean): IDisposer;
export declare function decorate<T extends Function>(middleware: IMiddlewareHandler, fn: T): T;
/**
* Binds middleware to a specific action
*
* @example
* type.actions(self => {
* function takeA____() {
* self.toilet.donate()
* self.wipe()
* self.wipe()
* self.toilet.flush()
* }
* return {
* takeA____: decorate(atomic, takeA____)
* }
* })
*
* @export
* @template T
* @param {IMiddlewareHandler} handler
* @param Function} fn
* @returns the original function
*/
export declare function decorate<T extends Function>(handler: IMiddlewareHandler, fn: T): T;

@@ -10,2 +10,1 @@ export declare function flow<R>(generator: () => IterableIterator<any>): () => Promise<R>;

export declare function flow<A1, A2, A3, A4, A5, A6, A7, A8>(generator: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8) => IterableIterator<any>): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8) => Promise<any>;
export declare function createFlowSpawner(name: string, generator: Function): (this: any) => Promise<{}>;

@@ -9,4 +9,2 @@ export interface IJsonPatch {

}
export declare function splitPatch(patch: IReversibleJsonPatch): [IJsonPatch, IJsonPatch];
export declare function stripPatch(patch: IReversibleJsonPatch): IJsonPatch;
/**

@@ -13,0 +11,0 @@ * escape slashes and backslashes

@@ -10,3 +10,3 @@ import { ExtractS, ExtractT, IAnyStateTreeNode, ExtractC, IType } from "../internal";

*/
export declare function getType(object: IAnyStateTreeNode): IType<any, any, any>;
export declare function getType(object: IAnyStateTreeNode): IAnyType;
/**

@@ -26,3 +26,3 @@ * Returns the _declared_ type of the given sub property of an object, array or map.

*/
export declare function getChildType(object: IAnyStateTreeNode, child: string): IType<any, any, any>;
export declare function getChildType(object: IAnyStateTreeNode, child: string): IAnyType;
/**

@@ -29,0 +29,0 @@ * Registers a function that will be invoked for each mutation that is applied to the provided model instance, or to any of its children.

@@ -1,3 +0,1 @@

import { INode, ObjectNode, ScalarNode, IType } from "../../internal";
export declare function createNode<C, S, T>(type: IType<C, S, T>, parent: ObjectNode | null, subpath: string, environment: any, initialValue: any): ObjectNode | ScalarNode;
export declare function isNode(value: any): value is INode;
export {};

@@ -1,10 +0,1 @@

import { ObjectNode, IAnyType } from "../../internal";
export declare class IdentifierCache {
private cache;
constructor();
addNodeToCache(node: ObjectNode): this;
mergeCache(node: ObjectNode): void;
notifyDied(node: ObjectNode): void;
splitCache(node: ObjectNode): IdentifierCache;
resolve(type: IAnyType, identifier: string): ObjectNode | null;
}
export {};

@@ -1,25 +0,1 @@

import { ObjectNode, IChildNodesMap, IAnyType } from "../../internal";
export declare enum NodeLifeCycle {
INITIALIZING = 0,
CREATED = 1,
FINALIZED = 2,
DETACHING = 3,
DEAD = 4
}
export interface INode {
readonly type: IAnyType;
readonly storedValue: any;
readonly path: string;
readonly isRoot: boolean;
readonly parent: ObjectNode | null;
readonly root: ObjectNode;
readonly _environment: any;
subpath: string;
isAlive: boolean;
readonly value: any;
readonly snapshot: any;
getSnapshot(): any;
setParent(newParent: ObjectNode | null, subpath?: string | null): void;
die(): void;
}
export interface IStateTreeNode<C = any, S = any> {

@@ -31,10 +7,2 @@ readonly $treenode?: any;

}
export interface IMembers {
properties: {
[name: string]: IAnyType;
};
actions: Object;
views: Object;
volatile: Object;
}
/**

@@ -50,11 +18,1 @@ * Returns true if the given value is a node in a state tree.

export declare function isStateTreeNode<C = any, S = any>(value: any): value is IStateTreeNode<C, S>;
export declare function getStateTreeNode(value: IAnyStateTreeNode): ObjectNode;
export declare function getStateTreeNodeSafe(value: IAnyStateTreeNode): ObjectNode;
export declare function canAttachNode(value: any): boolean;
export declare function toJSON<S>(this: IStateTreeNode<any, S>): S;
export declare function getRelativePathBetweenNodes(base: ObjectNode, target: ObjectNode): string;
export declare function resolveNodeByPath(base: ObjectNode, pathParts: string): INode;
export declare function resolveNodeByPath(base: ObjectNode, pathParts: string, failIfResolveFails: boolean): INode | undefined;
export declare function resolveNodeByPathParts(base: ObjectNode, pathParts: string[]): INode;
export declare function resolveNodeByPathParts(base: ObjectNode, pathParts: string[], failIfResolveFails: boolean): INode | undefined;
export declare function convertChildNodesToArray(childNodes: IChildNodesMap | null): INode[];

@@ -1,3 +0,1 @@

import { IAtom } from "mobx";
import { IAnyType, IdentifierCache, IDisposer, IJsonPatch, IMiddleware, IMiddlewareHandler, INode, IReversibleJsonPatch, NodeLifeCycle } from "../../internal";
export declare type LivelynessMode = "warn" | "error" | "ignore";

@@ -15,70 +13,1 @@ /**

export declare function setLivelynessChecking(mode: LivelynessMode): void;
export interface IChildNodesMap {
[key: string]: INode;
}
export declare class ObjectNode implements INode {
nodeId: number;
readonly type: IAnyType;
readonly identifierAttribute: string | undefined;
readonly identifier: string | null;
subpathAtom: IAtom;
subpath: string;
escapedSubpath: string;
parent: ObjectNode | null;
state: NodeLifeCycle;
storedValue: any;
identifierCache: IdentifierCache | undefined;
isProtectionEnabled: boolean;
middlewares: IMiddleware[] | null;
applyPatches(patches: IJsonPatch[]): void;
applySnapshot(snapshot: any): void;
_autoUnbox: boolean;
_environment: any;
_isRunningAction: boolean;
_hasSnapshotReaction: boolean;
private _disposers;
private _patchSubscribers;
private _snapshotSubscribers;
private _observableInstanceCreated;
private _childNodes;
private _initialSnapshot;
private _cachedInitialSnapshot;
constructor(type: IAnyType, parent: ObjectNode | null, subpath: string, environment: any, initialSnapshot: any);
private _createObservableInstance;
readonly path: string;
readonly root: ObjectNode;
readonly isRoot: boolean;
setParent(newParent: ObjectNode | null, subpath?: string | null): void;
fireHook(name: string): void;
readonly value: any;
readonly snapshot: any;
getSnapshot(): any;
private _getActualSnapshot;
private _getInitialSnapshot;
isRunningAction(): boolean;
readonly isAlive: boolean;
assertAlive(): void;
getChildNode(subpath: string): INode;
getChildren(): ReadonlyArray<INode>;
getChildType(key: string): IAnyType;
readonly isProtected: boolean;
assertWritable(): void;
removeChild(subpath: string): void;
unbox(childNode: INode): any;
toString(): string;
finalizeCreation(): void;
detach(): void;
preboot(): void;
die(): void;
aboutToDie(): void;
finalizeDeath(): void;
onSnapshot(onChange: (snapshot: any) => void): IDisposer;
emitSnapshot(snapshot: any): void;
onPatch(handler: (patch: IJsonPatch, reversePatch: IJsonPatch) => void): IDisposer;
emitPatch(basePatch: IReversibleJsonPatch, source: INode): void;
addDisposer(disposer: () => void): void;
removeMiddleware(handler: IMiddlewareHandler): void;
addMiddleWare(handler: IMiddlewareHandler, includeHooks?: boolean): () => void;
applyPatchLocally(subpath: string, patch: IJsonPatch): void;
private _addSnapshotReaction;
}

@@ -1,21 +0,1 @@

import { INode, ObjectNode, IAnyType } from "../../internal";
export declare class ScalarNode implements INode {
readonly type: IAnyType;
readonly storedValue: any;
parent: ObjectNode | null;
subpath: string;
private state;
private readonly _initialSnapshot;
_environment: any;
constructor(type: IAnyType, parent: ObjectNode | null, subpath: string, environment: any, initialSnapshot: any);
readonly path: string;
readonly isRoot: boolean;
readonly root: ObjectNode;
setParent(newParent: ObjectNode | null, subpath?: string | null): void;
readonly value: any;
readonly snapshot: any;
getSnapshot(): any;
readonly isAlive: boolean;
toString(): string;
die(): void;
}
export {};

@@ -0,10 +1,18 @@

/** @deprecated has been renamed to `flow()`. */
export declare function process<R>(generator: () => IterableIterator<any>): () => Promise<R>;
/** @deprecated has been renamed to `flow()`. */
export declare function process<A1>(generator: (a1: A1) => IterableIterator<any>): (a1: A1) => Promise<any>;
/** @deprecated has been renamed to `flow()`. */
export declare function process<A1, A2>(generator: (a1: A1, a2: A2) => IterableIterator<any>): (a1: A1, a2: A2) => Promise<any>;
/** @deprecated has been renamed to `flow()`. */
export declare function process<A1, A2, A3>(generator: (a1: A1, a2: A2, a3: A3) => IterableIterator<any>): (a1: A1, a2: A2, a3: A3) => Promise<any>;
/** @deprecated has been renamed to `flow()`. */
export declare function process<A1, A2, A3, A4>(generator: (a1: A1, a2: A2, a3: A3, a4: A4) => IterableIterator<any>): (a1: A1, a2: A2, a3: A3, a4: A4) => Promise<any>;
/** @deprecated has been renamed to `flow()`. */
export declare function process<A1, A2, A3, A4, A5>(generator: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5) => IterableIterator<any>): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5) => Promise<any>;
/** @deprecated has been renamed to `flow()`. */
export declare function process<A1, A2, A3, A4, A5, A6>(generator: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6) => IterableIterator<any>): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6) => Promise<any>;
/** @deprecated has been renamed to `flow()`. */
export declare function process<A1, A2, A3, A4, A5, A6, A7>(generator: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7) => IterableIterator<any>): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7) => Promise<any>;
/** @deprecated has been renamed to `flow()`. */
export declare function process<A1, A2, A3, A4, A5, A6, A7, A8>(generator: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8) => IterableIterator<any>): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8) => Promise<any>;
export declare function createProcessSpawner(name: string, generator: Function): (this: any) => Promise<{}>;

@@ -13,9 +13,2 @@ import { IAnyType } from "../../internal";

export declare type IValidationResult = IValidationError[];
export declare function prettyPrintValue(value: any): string;
export declare function getDefaultContext(type: IAnyType): IContext;
export declare function getContextForPath(context: IContext, path: string, type?: IAnyType): IContext;
export declare function typeCheckSuccess(): IValidationResult;
export declare function typeCheckFailure(context: IContext, value: any, message?: string): IValidationResult;
export declare function flattenTypeErrors(errors: IValidationResult[]): IValidationResult;
export declare function typecheck(type: IAnyType, value: any): void;
/**

@@ -26,3 +19,2 @@ * Run's the typechecker on the given type.

*
* @alias typecheck
* @export

@@ -32,2 +24,2 @@ * @param {IAnyType} type

*/
export declare function typecheckPublic(type: IAnyType, value: any): void;
export declare function typecheck(type: IAnyType, value: any): void;

@@ -1,29 +0,7 @@

import { IContext, IValidationResult, INode, IStateTreeNode, IJsonPatch, ObjectNode, IChildNodesMap, ModelPrimitive } from "../../internal";
export declare enum TypeFlags {
String = 1,
Number = 2,
Boolean = 4,
Date = 8,
Literal = 16,
Array = 32,
Map = 64,
Object = 128,
Frozen = 256,
Optional = 512,
Reference = 1024,
Identifier = 2048,
Late = 4096,
Refinement = 8192,
Union = 16384,
Null = 32768,
Undefined = 65536,
Integer = 131072
}
import { IContext, IValidationResult, IStateTreeNode, ModelPrimitive } from "../../internal";
export interface IType<C, S, T> {
name: string;
flags: TypeFlags;
create(snapshot?: C, environment?: any): T;
is(thing: any): thing is C | S | T;
validate(thing: any, context: IContext): IValidationResult;
create(snapshot?: C, environment?: any): T;
isType: boolean;
describe(): string;

@@ -33,19 +11,5 @@ Type: T;

CreationType: C;
instantiate(parent: INode | null, subpath: string, environment: any, initialValue?: any): INode;
initializeChildNodes(node: INode, snapshot: any): IChildNodesMap;
createNewInstance(node: INode, childNodes: IChildNodesMap, snapshot: any): any;
finalizeNewInstance(node: INode, instance: any): void;
reconcile(current: INode, newValue: any): INode;
getValue(node: INode): T;
getSnapshot(node: INode, applyPostProcess?: boolean): S;
applySnapshot(node: INode, snapshot: C): void;
applyPatchLocally(node: INode, subpath: string, patch: IJsonPatch): void;
getChildren(node: INode): ReadonlyArray<INode>;
getChildNode(node: INode, key: string): INode;
getChildType(key: string): IAnyType;
removeChild(node: INode, subpath: string): void;
isAssignableFrom(type: IAnyType): boolean;
shouldAttachNode: boolean;
}
export declare type IAnyType = IType<any, any, any>;
export interface IAnyType extends IType<any, any, any> {
}
export interface ISimpleType<T> extends IType<T, T, T> {

@@ -60,3 +24,4 @@ }

}
export declare type IAnyComplexType = IComplexType<any, any, any>;
export interface IAnyComplexType extends IComplexType<any, any, any> {
}
export declare type ExtractC<T extends IAnyType> = T extends IType<infer C, any, any> ? C : never;

@@ -94,47 +59,9 @@ export declare type ExtractS<T extends IAnyType> = T extends IType<any, infer S, any> ? S : never;

export declare type SnapshotOrInstance<T> = SnapshotIn<T> | Instance<T>;
export declare abstract class ComplexType<C, S, T> implements IComplexType<C, S, T> {
readonly isType: boolean;
readonly name: string;
constructor(name: string);
create(snapshot?: C, environment?: any): any;
initializeChildNodes(node: INode, snapshot: any): IChildNodesMap;
createNewInstance(node: INode, childNodes: IChildNodesMap, snapshot: any): any;
finalizeNewInstance(node: INode, instance: any): void;
abstract instantiate(parent: INode | null, subpath: string, environment: any, initialValue: any): INode;
abstract flags: TypeFlags;
abstract describe(): string;
abstract applySnapshot(node: INode, snapshot: any): void;
abstract getDefaultSnapshot(): any;
abstract getChildren(node: INode): ReadonlyArray<INode>;
abstract getChildNode(node: INode, key: string): INode;
abstract getValue(node: INode): T;
abstract getSnapshot(node: INode, applyPostProcess?: boolean): any;
abstract applyPatchLocally(node: INode, subpath: string, patch: IJsonPatch): void;
abstract getChildType(key: string): IAnyType;
abstract removeChild(node: INode, subpath: string): void;
abstract isValidSnapshot(value: any, context: IContext): IValidationResult;
abstract shouldAttachNode: boolean;
processInitialSnapshot(childNodes: IChildNodesMap, snapshot: any): any;
isAssignableFrom(type: IAnyType): boolean;
validate(value: any, context: IContext): IValidationResult;
is(value: any): value is S | T;
reconcile(current: ObjectNode, newValue: any): INode;
readonly Type: T;
readonly SnapshotType: S;
readonly CreationType: C;
}
export declare abstract class Type<C, S, T> extends ComplexType<C, S, T> implements IType<C, S, T> {
constructor(name: string);
abstract instantiate(parent: INode | null, subpath: string, environment: any, initialValue: any): INode;
getValue(node: INode): any;
getSnapshot(node: INode): any;
getDefaultSnapshot(): undefined;
applySnapshot(node: INode, snapshot: C): void;
applyPatchLocally(node: INode, subpath: string, patch: IJsonPatch): void;
getChildren(node: INode): INode[];
getChildNode(node: INode, key: string): INode;
getChildType(key: string): IAnyType;
reconcile(current: INode, newValue: any): INode;
removeChild(node: INode, subpath: string): void;
}
/**
* Returns if a given value represents a type.
*
* @export
* @param {*} value
* @returns {value is IAnyType}
*/
export declare function isType(value: any): value is IAnyType;
import "./internal";
import { IType, ISimpleType, map, array, model, compose, reference, union, optional, literal, maybe, refinement, frozen, late, enumeration, custom, maybeNull } from "./internal";
import { enumeration, model, compose, custom, reference, union, optional, literal, maybe, maybeNull, refinement, map, array, frozen, late } from "./internal";
export declare const types: {

@@ -29,3 +29,3 @@ enumeration: typeof enumeration;

};
export { IModelType, IAnyModelType, IMSTMap, IMapType, IMSTArray, IArrayType, IType, IAnyType, ISimpleType, IComplexType, IAnyComplexType, IReferenceType, typecheckPublic as typecheck, escapeJsonPath, unescapeJsonPath, joinJsonPath, splitJsonPath, IJsonPatch, IReversibleJsonPatch, decorate, addMiddleware, IMiddlewareEvent, IMiddlewareHandler, IMiddlewareEventType, process, isStateTreeNode, IStateTreeNode, IAnyStateTreeNode, flow, applyAction, onAction, IActionRecorder, ISerializedActionCall, recordActions, createActionTrackingMiddleware, setLivelynessChecking, LivelynessMode, TypeFlags, ModelSnapshotType, ModelCreationType, ModelInstanceType, ModelPropertiesDeclarationToProperties, ModelProperties, ModelPropertiesDeclaration, OptionalPropertyTypes, ModelActions, ModelTypeConfig, CustomTypeOptions, UnionOptions, Instance, SnapshotIn, SnapshotOut, SnapshotOrInstance } from "./internal";
export * from "./core/mst-operations";
import { IModelType, IAnyModelType, IMSTMap, IMapType, IMSTArray, IArrayType, IType, IAnyType, ISimpleType, IComplexType, IAnyComplexType, IReferenceType, typecheck, escapeJsonPath, unescapeJsonPath, joinJsonPath, splitJsonPath, IJsonPatch, IReversibleJsonPatch, decorate, addMiddleware, IMiddlewareEvent, IMiddlewareHandler, IMiddlewareEventType, process, isStateTreeNode, IStateTreeNode, IAnyStateTreeNode, flow, applyAction, onAction, IActionRecorder, ISerializedActionCall, recordActions, createActionTrackingMiddleware, setLivelynessChecking, LivelynessMode, ModelSnapshotType, ModelCreationType, ModelInstanceType, ModelPropertiesDeclarationToProperties, ModelProperties, ModelPropertiesDeclaration, OptionalProperty, ModelActions, CustomTypeOptions, UnionOptions, Instance, SnapshotIn, SnapshotOut, SnapshotOrInstance, TypeOrStateTreeNodeToStateTreeNode, UnionStringArray, getType, getChildType, onPatch, onSnapshot, applyPatch, IPatchRecorder, recordPatches, protect, unprotect, isProtected, applySnapshot, getSnapshot, hasParent, getParent, hasParentOfType, getParentOfType, getRoot, getPath, getPathParts, isRoot, resolvePath, resolveIdentifier, getIdentifier, tryResolve, getRelativePath, clone, detach, destroy, isAlive, addDisposer, getEnv, walk, IModelReflectionData, getMembers, CastedType, cast, isType, isArrayType, isFrozenType, isIdentifierType, isLateType, isLiteralType, isMapType, isModelType, isOptionalType, isPrimitiveType, isReferenceType, isRefinementType, isUnionType, ExtractIStateTreeNode } from "./internal";
export { IModelType, IAnyModelType, IMSTMap, IMapType, IMSTArray, IArrayType, IType, IAnyType, ISimpleType, IComplexType, IAnyComplexType, IReferenceType, typecheck, escapeJsonPath, unescapeJsonPath, joinJsonPath, splitJsonPath, IJsonPatch, IReversibleJsonPatch, decorate, addMiddleware, IMiddlewareEvent, IMiddlewareHandler, IMiddlewareEventType, process, isStateTreeNode, IStateTreeNode, IAnyStateTreeNode, flow, applyAction, onAction, IActionRecorder, ISerializedActionCall, recordActions, createActionTrackingMiddleware, setLivelynessChecking, LivelynessMode, ModelSnapshotType, ModelCreationType, ModelInstanceType, ModelPropertiesDeclarationToProperties, ModelProperties, ModelPropertiesDeclaration, OptionalProperty, ModelActions, CustomTypeOptions, UnionOptions, Instance, SnapshotIn, SnapshotOut, SnapshotOrInstance, TypeOrStateTreeNodeToStateTreeNode, UnionStringArray, getType, getChildType, onPatch, onSnapshot, applyPatch, IPatchRecorder, recordPatches, protect, unprotect, isProtected, applySnapshot, getSnapshot, hasParent, getParent, hasParentOfType, getParentOfType, getRoot, getPath, getPathParts, isRoot, resolvePath, resolveIdentifier, getIdentifier, tryResolve, getRelativePath, clone, detach, destroy, isAlive, addDisposer, getEnv, walk, IModelReflectionData, getMembers, CastedType, cast, isType, isArrayType, isFrozenType, isIdentifierType, isLateType, isLiteralType, isMapType, isModelType, isOptionalType, isPrimitiveType, isReferenceType, isRefinementType, isUnionType, ExtractIStateTreeNode };

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("mobx")):"function"==typeof define&&define.amd?define(["exports","mobx"],e):e(t.mobxStateTree={},t.mobx)}(this,function(u,l){"use strict";var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function a(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var i=function(){return(i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function n(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;0<=s;s--)(i=t[s])&&(a=(o<3?i(a):3<o?i(e,n,a):i(e,n))||a);return 3<o&&a&&Object.defineProperty(e,n,a),a}function p(t){return W(t).type}function o(t,e){return W(t).onPatch(e)}function s(t,e){W(t).applyPatches(it(e))}function c(t,e){return W(t).applySnapshot(e)}function h(t){return W(t).root.storedValue}function f(t,e){var n=G(W(t),e,!1);if(void 0!==n)try{return n.value}catch(t){return}}function d(t,e){var n=W(t);n.getChildren().forEach(function(t){$(t.storedValue)&&d(t.storedValue,e)}),e(n.storedValue)}var y=function(){function t(t,e,n,r,i){this.parent=null,this.subpath="",this.state=M.INITIALIZING,this._environment=void 0,this._initialSnapshot=i,this.type=t,this.parent=e,this.subpath=n;var o=!0;try{this.storedValue=t.createNewInstance(this,{},i),this.state=M.CREATED,o=!1}finally{o&&(this.state=M.DEAD)}}return Object.defineProperty(t.prototype,"path",{get:function(){return this.parent?this.parent.path+"/"+dt(this.subpath):""},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isRoot",{get:function(){return null===this.parent},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this.parent?this.parent.root:tt("This scalar node is not part of a tree")},enumerable:!0,configurable:!0}),t.prototype.setParent=function(t,e){if(void 0===e&&(e=null),this.parent!==t||this.subpath!==e)if(this.parent&&!t)this.die();else{var n=null===e?"":e;this.subpath!==n&&(this.subpath=n),t&&t!==this.parent&&(this.parent=t)}},Object.defineProperty(t.prototype,"value",{get:function(){return this.type.getValue(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return ut(this.getSnapshot())},enumerable:!0,configurable:!0}),t.prototype.getSnapshot=function(){return this.type.getSnapshot(this)},Object.defineProperty(t.prototype,"isAlive",{get:function(){return this.state!==M.DEAD},enumerable:!0,configurable:!0}),t.prototype.toString=function(){return this.type.name+"@"+(this.path||"<root>")+(this.isAlive?"":"[dead]")},t.prototype.die=function(){this.state=M.DEAD},t}(),v=1,e="warn";var t,b={onError:function(t){throw t}},g=function(){function r(t,e,n,r,i){this.nodeId=++v,this.subpathAtom=l.createAtom("path"),this.subpath="",this.parent=null,this.state=M.INITIALIZING,this.isProtectionEnabled=!0,this.middlewares=null,this._autoUnbox=!0,this._environment=void 0,this._isRunningAction=!1,this._hasSnapshotReaction=!1,this._disposers=null,this._patchSubscribers=null,this._snapshotSubscribers=null,this._observableInstanceCreated=!1,this._cachedInitialSnapshot=null,this._environment=r,this._initialSnapshot=ut(i),this.type=t,this.parent=e,this.subpath=n,this.escapedSubpath=dt(this.subpath),this.identifierAttribute=t.identifierAttribute,this.identifier=this.identifierAttribute&&this._initialSnapshot?""+this._initialSnapshot[this.identifierAttribute]:null,e||(this.identifierCache=new H),this._childNodes=t.initializeChildNodes(this,this._initialSnapshot),e?e.root.identifierCache.addNodeToCache(this):this.identifierCache.addNodeToCache(this)}return r.prototype.applyPatches=function(t){this._observableInstanceCreated||this._createObservableInstance(),this.applyPatches(t)},r.prototype.applySnapshot=function(t){this._observableInstanceCreated||this._createObservableInstance(),this.applySnapshot(t)},r.prototype._createObservableInstance=function(){var t=this.type;this.storedValue=t.createNewInstance(this,this._childNodes,this._initialSnapshot),this.preboot();var e,n,r=!0;this._observableInstanceCreated=!0;try{this._isRunningAction=!0,t.finalizeNewInstance(this,this.storedValue),this._isRunningAction=!1,this.fireHook("afterCreate"),this.state=M.CREATED,r=!1}finally{r&&(this.state=M.DEAD)}e=this,n="snapshot",l.getAtom(e,n).trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this.finalizeCreation(),this._childNodes=Q},Object.defineProperty(r.prototype,"path",{get:function(){return this.subpathAtom.reportObserved(),this.parent?this.parent.path+"/"+this.escapedSubpath:""},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"root",{get:function(){var t=this.parent;return t?t.root:this},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isRoot",{get:function(){return null===this.parent},enumerable:!0,configurable:!0}),r.prototype.setParent=function(t,e){if(void 0===e&&(e=null),this.parent!==t||this.subpath!==e)if(this.parent&&!t)this.die();else{var n=null===e?"":e;this.subpath!==n&&(this.subpath=n,this.escapedSubpath=dt(this.subpath),this.subpathAtom.reportChanged()),t&&t!==this.parent&&(t.root.identifierCache.mergeCache(this),this.parent=t,this.subpathAtom.reportChanged(),this.fireHook("afterAttach"))}},r.prototype.fireHook=function(t){var e=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[t];"function"==typeof e&&e.apply(this.storedValue)},Object.defineProperty(r.prototype,"value",{get:function(){if(this._observableInstanceCreated||this._createObservableInstance(),this.isAlive)return this.type.getValue(this)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"snapshot",{get:function(){if(this.isAlive)return ut(this.getSnapshot())},enumerable:!0,configurable:!0}),r.prototype.getSnapshot=function(){if(this.isAlive)return this._observableInstanceCreated?this._getActualSnapshot():this._getInitialSnapshot()},r.prototype._getActualSnapshot=function(){return this.type.getSnapshot(this)},r.prototype._getInitialSnapshot=function(){if(this.isAlive){if(!this._initialSnapshot)return this._initialSnapshot;if(this._cachedInitialSnapshot)return this._cachedInitialSnapshot;var t=this.type,e=this._childNodes,n=this._initialSnapshot;return this._cachedInitialSnapshot=t.processInitialSnapshot(e,n),this._cachedInitialSnapshot}},r.prototype.isRunningAction=function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()},Object.defineProperty(r.prototype,"isAlive",{get:function(){return this.state!==M.DEAD},enumerable:!0,configurable:!0}),r.prototype.assertAlive=function(){if(!this.isAlive){var t="[mobx-state-tree][error] You are trying to read or write to an object that is no longer part of a state tree. (Object type was '"+this.type.name+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree.";switch(e){case"error":throw new Error(t);case"warn":console.warn(t+' Use setLivelynessChecking("error") to simplify debugging this error.')}}},r.prototype.getChildNode=function(t){this.assertAlive(),this._autoUnbox=!1;try{return this._observableInstanceCreated?this.type.getChildNode(this,t):this._childNodes[t]}finally{this._autoUnbox=!0}},r.prototype.getChildren=function(){this.assertAlive(),this._autoUnbox=!1;try{return this._observableInstanceCreated?this.type.getChildren(this):K(this._childNodes)}finally{this._autoUnbox=!0}},r.prototype.getChildType=function(t){return this.type.getChildType(t)},Object.defineProperty(r.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!0,configurable:!0}),r.prototype.assertWritable=function(){this.assertAlive(),!this.isRunningAction()&&this.isProtected&&tt("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")},r.prototype.removeChild=function(t){this.type.removeChild(this,t)},r.prototype.unbox=function(t){return t&&t.parent&&t.parent.assertAlive(),t&&t.parent&&t.parent._autoUnbox?t.value:t},r.prototype.toString=function(){var t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+(this.path||"<root>")+t+(this.isAlive?"":"[dead]")},r.prototype.finalizeCreation=function(){if(this.state===M.CREATED){if(this.parent){if(this.parent.state!==M.FINALIZED)return;this.fireHook("afterAttach")}this.state=M.FINALIZED;for(var t=0,e=this.getChildren();t<e.length;t++){var n=e[t];n instanceof r&&n.finalizeCreation()}}},r.prototype.detach=function(){this.isAlive||tt("Error while detaching, node is not alive."),this.isRoot||(this.fireHook("beforeDetach"),this._environment=this.root._environment,this.state=M.DETACHING,this.identifierCache=this.root.identifierCache.splitCache(this),this.parent.removeChild(this.subpath),this.parent=null,this.subpath=this.escapedSubpath="",this.subpathAtom.reportChanged(),this.state=M.FINALIZED)},r.prototype.preboot=function(){var n=this;this.applyPatches=j(this.storedValue,"@APPLY_PATCHES",function(t){t.forEach(function(t){var e=bt(t.path);B(n,e.slice(0,-1)).applyPatchLocally(e[e.length-1],t)})}),this.applySnapshot=j(this.storedValue,"@APPLY_SNAPSHOT",function(t){if(t!==n.snapshot)return n.type.applySnapshot(n,t)}),pt(this.storedValue,"$treenode",this),pt(this.storedValue,"toJSON",J)},r.prototype.die=function(){this.state!==M.DETACHING&&$(this.storedValue)&&(d(this.storedValue,function(t){var e=W(t);e instanceof r&&e.aboutToDie()}),d(this.storedValue,function(t){var e=W(t);e instanceof r&&e.finalizeDeath()}))},r.prototype.aboutToDie=function(){this._disposers&&(this._disposers.forEach(function(t){return t()}),this._disposers=null),this.fireHook("beforeDestroy")},r.prototype.finalizeDeath=function(){var t,e,n;this.root.identifierCache.notifyDied(this),e="snapshot",n=(t=this).snapshot,Object.defineProperty(t,e,{enumerable:!0,writable:!1,configurable:!0,value:n}),this._patchSubscribers&&(this._patchSubscribers=null),this._snapshotSubscribers&&(this._snapshotSubscribers=null),this.state=M.DEAD,this.subpath=this.escapedSubpath="",this.parent=null,this.subpathAtom.reportChanged()},r.prototype.onSnapshot=function(t){return this._addSnapshotReaction(),this._snapshotSubscribers||(this._snapshotSubscribers=[]),ct(this._snapshotSubscribers,t)},r.prototype.emitSnapshot=function(e){this._snapshotSubscribers&&this._snapshotSubscribers.forEach(function(t){return t(e)})},r.prototype.onPatch=function(t){return this._patchSubscribers||(this._patchSubscribers=[]),ct(this._patchSubscribers,t)},r.prototype.emitPatch=function(t,e){var n=this._patchSubscribers;if(n&&n.length){var r=function(t){"oldValue"in t||tt("Patches without `oldValue` field cannot be inversed");return[function(t){switch(t.op){case"add":return{op:"add",path:t.path,value:t.value};case"remove":return{op:"remove",path:t.path};case"replace":return{op:"replace",path:t.path,value:t.value}}}(t),function(t){switch(t.op){case"add":return{op:"remove",path:t.path};case"remove":return{op:"add",path:t.path,value:t.oldValue};case"replace":return{op:"replace",path:t.path,value:t.oldValue}}}(t)]}(function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0;r<e.length;r++){var i=e[r];for(var o in i)t[o]=i[o]}return t}({},t,{path:e.path.substr(this.path.length)+"/"+t.path})),i=r[0],o=r[1];n.forEach(function(t){return t(i,o)})}this.parent&&this.parent.emitPatch(t,e)},r.prototype.addDisposer=function(t){this._disposers?this._disposers.unshift(t):this._disposers=[t]},r.prototype.removeMiddleware=function(e){this.middlewares&&(this.middlewares=this.middlewares.filter(function(t){return t.handler!==e}))},r.prototype.addMiddleWare=function(t,e){var n=this;return void 0===e&&(e=!0),this.middlewares?this.middlewares.push({handler:t,includeHooks:e}):this.middlewares=[{handler:t,includeHooks:e}],function(){n.removeMiddleware(t)}},r.prototype.applyPatchLocally=function(t,e){this.assertWritable(),this._observableInstanceCreated||this._createObservableInstance(),this.type.applyPatchLocally(this,t,e)},r.prototype._addSnapshotReaction=function(){var e=this;if(!this._hasSnapshotReaction){var t=l.reaction(function(){return e.snapshot},function(t){return e.emitSnapshot(t)},b);this.addDisposer(t),this._hasSnapshotReaction=!0}},n([l.action],r.prototype,"_createObservableInstance",null),n([l.computed],r.prototype,"snapshot",null),n([l.action],r.prototype,"detach",null),n([l.action],r.prototype,"die",null),r}();(t=u.TypeFlags||(u.TypeFlags={}))[t.String=1]="String",t[t.Number=2]="Number",t[t.Boolean=4]="Boolean",t[t.Date=8]="Date",t[t.Literal=16]="Literal",t[t.Array=32]="Array",t[t.Map=64]="Map",t[t.Object=128]="Object",t[t.Frozen=256]="Frozen",t[t.Optional=512]="Optional",t[t.Reference=1024]="Reference",t[t.Identifier=2048]="Identifier",t[t.Late=4096]="Late",t[t.Refinement=8192]="Refinement",t[t.Union=16384]="Union",t[t.Null=32768]="Null",t[t.Undefined=65536]="Undefined",t[t.Integer=131072]="Integer";var m=function(){function t(t){this.isType=!0,this.name=t}return t.prototype.create=function(t,e){return void 0===t&&(t=this.getDefaultSnapshot()),this.instantiate(null,"",e,t).value},t.prototype.initializeChildNodes=function(t,e){return Q},t.prototype.createNewInstance=function(t,e,n){return n},t.prototype.finalizeNewInstance=function(t,e){},t.prototype.processInitialSnapshot=function(t,e){return e},t.prototype.isAssignableFrom=function(t){return t===this},t.prototype.validate=function(t,e){return $(t)?p(t)===this||this.isAssignableFrom(p(t))?F():R(e,t):this.isValidSnapshot(t,e)},t.prototype.is=function(t){return 0===this.validate(t,[{path:"",type:this}]).length},t.prototype.reconcile=function(t,e){if(t.snapshot===e)return t;if($(e)&&W(e)===t)return t;if(t.type===this&&at(e)&&!$(e)&&(!t.identifierAttribute||t.identifier===""+e[t.identifierAttribute]))return t.applySnapshot(e),t;var n=t.parent,r=t.subpath;if(t.die(),$(e)&&this.isAssignableFrom(p(e))){var i=W(e);return i.setParent(n,r),i}return this.instantiate(n,r,t._environment,e)},Object.defineProperty(t.prototype,"Type",{get:function(){return tt("Factory.Type should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.Type`")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"SnapshotType",{get:function(){return tt("Factory.SnapshotType should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.SnapshotType`")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"CreationType",{get:function(){return tt("Factory.CreationType should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.CreationType`")},enumerable:!0,configurable:!0}),n([l.action],t.prototype,"create",null),t}(),w=function(e){function t(t){return e.call(this,t)||this}return a(t,e),t.prototype.getValue=function(t){return t.storedValue},t.prototype.getSnapshot=function(t){return t.storedValue},t.prototype.getDefaultSnapshot=function(){},t.prototype.applySnapshot=function(t,e){tt("Immutable types do not support applying snapshots")},t.prototype.applyPatchLocally=function(t,e,n){tt("Immutable types do not support applying patches")},t.prototype.getChildren=function(t){return q},t.prototype.getChildNode=function(t,e){return tt("No child '"+e+"' available in type: "+this.name)},t.prototype.getChildType=function(t){return tt("No child '"+t+"' available in type: "+this.name)},t.prototype.reconcile=function(t,e){if(t.type===this&&t.storedValue===e)return t;var n=this.instantiate(t.parent,t.subpath,t._environment,e);return t.die(),n},t.prototype.removeChild=function(t,e){return tt("No child '"+e+"' available in type: "+this.name)},t}(m);function A(t){return"object"==typeof t&&t&&!0===t.isType}var S=new Map;function T(t){return{$MST_UNSERIALIZABLE:!0,type:t}}function P(e,t){l.runInAction(function(){it(t).forEach(function(t){return function(t,e){var n=f(t,e.path||"");if(!n)return tt("Invalid action path: "+(e.path||""));var r=W(n);if("@APPLY_PATCHES"===e.name)return s.call(null,n,e.args[0]);if("@APPLY_SNAPSHOT"===e.name)return c.call(null,n,e.args[0]);"function"!=typeof n[e.name]&&tt("Action '"+e.name+"' does not exist in '"+r.path+"'");return n[e.name].apply(n,e.args?e.args.map(function(t){return(e=t)&&"object"==typeof e&&"$MST_DATE"in e?new Date(e.$MST_DATE):e;var e}):[])}(e,t)})})}function V(o,a,s){return void 0===s&&(s=!1),O(o,function(n,t){if("action"===n.type&&n.id===n.rootId){var e=W(n.context),r={name:n.name,path:Z(W(o),e),args:n.args.map(function(t,e){return function(t,e,n,r){if(r instanceof Date)return{$MST_DATE:r.getTime()};if(st(r))return r;if($(r))return T("[MSTNode: "+p(r).name+"]");if("function"==typeof r)return T("[function]");if("object"==typeof r&&!ot(r)&&!rt(r))return T("[object "+(r&&r.constructor&&r.constructor.name||"Complex Object")+"]");try{return JSON.stringify(r),r}catch(t){return T(""+t)}}(0,n.name,0,t)})};if(s){var i=t(n);return a(r),i}return a(r),t(n)}return t(n)})}var _=1,N=null;function C(){return _++}function I(t,e){var n=W(t.context),r=n._isRunningAction,i=N;"action"===t.type&&n.assertAlive(),n._isRunningAction=!0,N=t;try{return function(t,e,s){var u=function(t,e,n){var r=n.$mst_middleware||q,i=t;for(;i;)i.middlewares&&(r=r.concat(i.middlewares)),i=i.parent;return r}(t,0,s);if(!u.length)return l.action(s).apply(null,e.args);var p=0,c=null;return function n(t){var e=u[p++];var r=e&&e.handler;function i(t,e){c=e?e(n(t)||c):n(t)}function o(t){c=t}var a=function(){return r(t,i,o),c};return r&&e.includeHooks?a():r&&!e.includeHooks?Nt[t.name]?n(t):a():l.action(s).apply(null,t.args)}(e)}(n,t,e)}finally{N=i,n._isRunningAction=r}}function j(e,n,r){var t=function(){var t=C();return I({type:"action",name:n,id:t,args:lt(arguments),context:e,tree:h(e),rootId:N?N.rootId:t,parentId:N?N.id:0},r)};return t._isMSTAction=!0,t}function O(t,e,n){return void 0===n&&(n=!0),W(t).addMiddleWare(e,n)}function E(t){return"function"==typeof t?"<function"+(t.name?" "+t.name:"")+">":$(t)?"<"+t+">":"`"+function(t){try{return JSON.stringify(t)}catch(t){return"<Unserializable: "+t+">"}}(t)+"`"}function D(t){var e,n=t.value,r=t.context[t.context.length-1].type,i=t.context.map(function(t){return t.path}).filter(function(t){return 0<t.length}).join("/"),o=0<i.length?'at path "/'+i+'" ':"",a=$(n)?"value of type "+W(n).type.name+":":st(n)?"value":"snapshot",s=r&&$(n)&&r.is(W(n).snapshot);return""+o+a+" "+E(n)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(t.message?" ("+t.message+")":"")+(r?A(e=r)&&0<(e.flags&(u.TypeFlags.String|u.TypeFlags.Number|u.TypeFlags.Integer|u.TypeFlags.Boolean|u.TypeFlags.Date))||st(n)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(s?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function x(t,e,n){return t.concat([{path:e,type:n}])}function F(){return q}function R(t,e,n){return[{context:t,value:e,message:n}]}function k(t){return t.reduce(function(t,e){return t.concat(e)},[])}function z(t,e){var n,r=t.validate(e,[{path:"",type:t}]);0<r.length&&tt("Error while converting "+((n=E(e)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `"+t.name+"`:\n\n "+r.map(D).join("\n "))}var M,L,H=function(){function e(){this.cache=l.observable.map()}return e.prototype.addNodeToCache=function(t){if(t.identifierAttribute){var e=t.identifier;this.cache.has(e)||this.cache.set(e,l.observable.array([],X));var n=this.cache.get(e);-1!==n.indexOf(t)&&tt("Already registered"),n.push(t)}return this},e.prototype.mergeCache=function(t){var e=this;l.values(t.identifierCache.cache).forEach(function(t){return t.forEach(function(t){e.addNodeToCache(t)})})},e.prototype.notifyDied=function(t){if(t.identifierAttribute){var e=this.cache.get(t.identifier);e&&e.remove(t)}},e.prototype.splitCache=function(t){var n=new e,r=t.path;return l.values(this.cache).forEach(function(t){for(var e=t.length-1;0<=e;e--)0===t[e].path.indexOf(r)&&(n.addNodeToCache(t[e]),t.splice(e,1))}),n},e.prototype.resolve=function(e,t){var n=this.cache.get(""+t);if(!n)return null;var r=n.filter(function(t){return e.isAssignableFrom(t.type)});switch(r.length){case 0:return null;case 1:return r[0];default:return tt("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map(function(t){return t.path}).join(", "))}},e}();function U(t,e,n,r,i){var o,a=(o=i)&&o.$treenode||null;if(a){if(a.isRoot)return a.setParent(e,n),a;tt("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(e?e.path:"")+"/"+n+"', but it lives already at '"+a.path+"'")}return new(t.shouldAttachNode?g:y)(t,e,n,r,i)}function $(t){return!(!t||!t.$treenode)}function W(t){return $(t)?t.$treenode:tt("Value "+t+" is no MST Node")}function J(){return W(this).snapshot}(L=M||(M={}))[L.INITIALIZING=0]="INITIALIZING",L[L.CREATED=1]="CREATED",L[L.FINALIZED=2]="FINALIZED",L[L.DETACHING=3]="DETACHING",L[L.DEAD=4]="DEAD";var Y=function(t){return".."};function Z(t,e){t.root!==e.root&&tt("Cannot calculate relative path: objects '"+t+"' and '"+e+"' are not part of the same object tree");for(var n=bt(t.path),r=bt(e.path),i=0;i<n.length&&n[i]===r[i];i++);return n.slice(i).map(Y).join("/")+vt(r.slice(i))}function G(t,e,n){return void 0===n&&(n=!0),B(t,bt(e),n)}function B(t,e,n){void 0===n&&(n=!0);for(var r=t,i=0;i<e.length;i++){var o=e[i];if(""!==o){if(".."===o){if(r=r.parent)continue}else{if("."===o||""===o)continue;if(r){if(r instanceof y)try{var a=r.value;$(a)&&(r=W(a))}catch(t){if(!n)return;throw t}if(r instanceof g)if(r.getChildType(o)&&(r=r.getChildNode(o)))continue}}return n?tt("Could not resolve '"+o+"' in path '"+(vt(e.slice(0,i))||"/")+"' while resolving '"+vt(e)+"'"):void 0}r=r.root}return r}function K(n){if(!n)return q;var t=Object.keys(n);if(!t.length)return q;var r=new Array(t.length);return t.forEach(function(t,e){r[e]=n[t]}),r}var q=Object.freeze([]),Q=Object.freeze({}),X="string"==typeof l.$mobx?{deep:!1}:{deep:!1,proxy:!1};function tt(t){throw void 0===t&&(t="Illegal state"),new Error("[mobx-state-tree] "+t)}function et(t){return t}Object.freeze(X);var nt=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t};function rt(t){return!(!Array.isArray(t)&&!l.isObservableArray(t))}function it(t){return t?rt(t)?t:[t]:q}function ot(t){if(null===t||"object"!=typeof t)return!1;var e=Object.getPrototypeOf(t);return e===Object.prototype||null===e}function at(t){return!(null===t||"object"!=typeof t||t instanceof Date||t instanceof RegExp)}function st(t){return null==t||("string"==typeof t||"number"==typeof t||"boolean"==typeof t||t instanceof Date)}function ut(t){return t}function pt(t,e,n){Object.defineProperty(t,e,{enumerable:!1,writable:!1,configurable:!0,value:n})}function ct(r,i){return r.push(i),function(){var t,e,n;e=i,-1!==(n=(t=r).indexOf(e))&&t.splice(n,1)}}function lt(t){for(var e=new Array(t.length),n=0;n<t.length;n++)e[n]=t[n];return e}var ht=function(){};function ft(t){return l=t.name,h=t,f=function(){var s=C(),u=N||tt("Not running an action!"),p=arguments;function c(t,e,n){t.$mst_middleware=f.$mst_middleware,I({name:l,type:e,id:s,args:[n],tree:u.tree,context:u.context,parentId:u.id,rootId:u.rootId},t)}return new Promise(function(e,n){var r,t=function(){r=h.apply(null,arguments),i(void 0)};function i(t){var e;try{c(function(t){e=r.next(t)},"flow_resume",t)}catch(e){return void setImmediate(function(){c(function(t){n(e)},"flow_throw",e)})}a(e)}function o(t){var e;try{c(function(t){e=r.throw(t)},"flow_resume_error",t)}catch(e){return void setImmediate(function(){c(function(t){n(e)},"flow_throw",e)})}a(e)}function a(t){if(!t.done)return t.value&&"function"==typeof t.value.then||tt("Only promises can be yielded to `async`, got: "+t),t.value.then(i,o);setImmediate(function(){c(function(t){e(t)},"flow_return",t.value)})}t.$mst_middleware=f.$mst_middleware,I({name:l,type:"flow_spawn",id:s,args:lt(p),tree:u.tree,context:u.context,parentId:u.id,rootId:u.rootId},t)})};var l,h,f}function dt(t){return!0==("number"==typeof t)?""+t:t.replace(/~/g,"~1").replace(/\//g,"~0")}function yt(t){return t.replace(/~0/g,"/").replace(/~1/g,"~")}function vt(t){return 0===t.length?"":"/"+t.map(dt).join("/")}function bt(t){var e=t.split("/").map(yt);return""===e[0]?e.slice(1):e}(ht=function(t,e){}).ids={};var gt,mt,wt="Map.put can only be used to store complex values that have an identifier type attribute";(mt=gt||(gt={}))[mt.UNKNOWN=0]="UNKNOWN",mt[mt.YES=1]="YES",mt[mt.NO=2]="NO";var At=function(n){function t(t){return n.call(this,t,l.observable.ref.enhancer)||this}return a(t,n),t.prototype.get=function(t){return n.prototype.get.call(this,""+t)},t.prototype.has=function(t){return n.prototype.has.call(this,""+t)},t.prototype.delete=function(t){return n.prototype.delete.call(this,""+t)},t.prototype.set=function(t,e){return n.prototype.set.call(this,""+t,e)},t.prototype.put=function(t){if(t||tt("Map.put cannot be used to set empty values"),$(t)){var e=W(t),n=e.identifier;return this.set(n,e.value),e.value}if(at(t)){n=void 0;var r=W(this).type;return r.identifierMode===gt.NO?tt(wt):r.identifierMode===gt.YES?(n=""+t[r.identifierAttribute],this.set(n,t),this.get(n)):tt(wt)}return tt("Map.put can only be used to store complex values")},t}(l.ObservableMap),St=function(r){function t(t,e){var n=r.call(this,t)||this;return n.shouldAttachNode=!0,n.identifierMode=gt.UNKNOWN,n.identifierAttribute=void 0,n.flags=u.TypeFlags.Map,n.subType=e,n._determineIdentifierMode(),n}return a(t,r),t.prototype.instantiate=function(t,e,n,r){return this.identifierMode===gt.UNKNOWN&&this._determineIdentifierMode(),U(this,t,e,n,r)},t.prototype._determineIdentifierMode=function(){var t=[];if(function t(e,n){if(e instanceof xt)n.push(e);else if(e instanceof Bt){if(!t(e.type,n))return!1}else if(e instanceof Zt){for(var r=0;r<e.types.length;r++)if(!t(e.types[r],n))return!1}else if(e instanceof Xt){var i=e.getSubType(!1);if(!i)return!1;t(i,n)}return!0}(this.subType,t)){var e=void 0;t.forEach(function(t){t.identifierAttribute&&(e&&e!==t.identifierAttribute&&tt("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier"),e=t.identifierAttribute)}),e?(this.identifierMode=gt.YES,this.identifierAttribute=e):this.identifierMode=gt.NO}},t.prototype.initializeChildNodes=function(e,n){void 0===n&&(n={});var r=e.type.subType,i=e._environment,o={};return Object.keys(n).forEach(function(t){o[t]=r.instantiate(e,t,i,n[t])}),o},t.prototype.createNewInstance=function(t,e,n){return new At(e)},t.prototype.finalizeNewInstance=function(t,e){l._interceptReads(e,t.unbox),l.intercept(e,this.willChange),l.observe(e,this.didChange)},t.prototype.describe=function(){return"Map<string, "+this.subType.describe()+">"},t.prototype.getChildren=function(t){return l.values(t.storedValue)},t.prototype.getChildNode=function(t,e){var n=t.storedValue.get(""+e);return n||tt("Not a child "+e),n},t.prototype.willChange=function(t){var e=W(t.object),n=t.name;e.assertWritable();var r=e.type,i=r.subType;switch(t.type){case"update":var o=t.newValue;if(o===t.object.get(n))return null;t.newValue=i.reconcile(e.getChildNode(n),t.newValue),r.processIdentifier(n,t.newValue);break;case"add":t.newValue,t.newValue=i.instantiate(e,n,void 0,t.newValue),r.processIdentifier(n,t.newValue)}return t},t.prototype.processIdentifier=function(t,e){if(this.identifierMode===gt.YES&&e instanceof g){var n=e.identifier;n!==t&&tt("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+t+"'")}},t.prototype.getValue=function(t){return t.storedValue},t.prototype.getSnapshot=function(t){var e={};return t.getChildren().forEach(function(t){e[t.subpath]=t.snapshot}),e},t.prototype.processInitialSnapshot=function(e,t){var n={};return Object.keys(e).forEach(function(t){n[t]=e[t].getSnapshot()}),n},t.prototype.didChange=function(t){var e=W(t.object);switch(t.type){case"update":return void e.emitPatch({op:"replace",path:dt(t.name),value:t.newValue.snapshot,oldValue:t.oldValue?t.oldValue.snapshot:void 0},e);case"add":return void e.emitPatch({op:"add",path:dt(t.name),value:t.newValue.snapshot,oldValue:void 0},e);case"delete":var n=t.oldValue.snapshot;return t.oldValue.die(),void e.emitPatch({op:"remove",path:dt(t.name),oldValue:n},e)}},t.prototype.applyPatchLocally=function(t,e,n){var r=t.storedValue;switch(n.op){case"add":case"replace":r.set(e,n.value);break;case"remove":r.delete(e)}},t.prototype.applySnapshot=function(t,e){var n=t.storedValue,r={};for(var i in Array.from(n.keys()).forEach(function(t){r[t]=!1}),e)n.set(i,e[i]),r[""+i]=!0;Object.keys(r).forEach(function(t){!1===r[t]&&n.delete(t)})},t.prototype.getChildType=function(t){return this.subType},t.prototype.isValidSnapshot=function(e,n){var r=this;return ot(e)?k(Object.keys(e).map(function(t){return r.subType.validate(e[t],x(n,t,r.subType))})):R(n,e,"Value is not a plain object")},t.prototype.getDefaultSnapshot=function(){return Q},t.prototype.removeChild=function(t,e){t.storedValue.delete(e)},n([l.action],t.prototype,"applySnapshot",null),t}(m);var Tt=function(r){function t(t,e){var n=r.call(this,t)||this;return n.shouldAttachNode=!0,n.flags=u.TypeFlags.Array,n.subType=e,n}return a(t,r),t.prototype.instantiate=function(t,e,n,r){return U(this,t,e,n,r)},t.prototype.initializeChildNodes=function(r,t){void 0===t&&(t=[]);var i=r.type.subType,o=r._environment,a={};return t.forEach(function(t,e){var n=""+e;a[n]=i.instantiate(r,n,o,t)}),a},t.prototype.createNewInstance=function(t,e,n){return l.observable.array(K(e),X)},t.prototype.finalizeNewInstance=function(t,e){l._getAdministration(e).dehancer=t.unbox,l.intercept(e,this.willChange),l.observe(e,this.didChange)},t.prototype.describe=function(){return this.subType.describe()+"[]"},t.prototype.getChildren=function(t){return t.storedValue.slice()},t.prototype.getChildNode=function(t,e){var n=parseInt(e,10);return n<t.storedValue.length?t.storedValue[n]:tt("Not a child: "+e)},t.prototype.willChange=function(t){var e=W(t.object);e.assertWritable();var n=e.type.subType,r=e.getChildren(),i=null;switch(t.type){case"update":if(t.newValue===t.object[t.index])return null;if(!(i=Pt(e,n,[r[t.index]],[t.newValue],[t.index])))return null;t.newValue=i[0];break;case"splice":var o=t.index,a=t.removedCount,s=t.added;if(!(i=Pt(e,n,r.slice(o,o+a),s,s.map(function(t,e){return o+e}))))return null;t.added=i;for(var u=o+a;u<r.length;u++)r[u].setParent(e,""+(u+s.length-a))}return t},t.prototype.getValue=function(t){return t.storedValue},t.prototype.getSnapshot=function(t){return t.getChildren().map(function(t){return t.snapshot})},t.prototype.processInitialSnapshot=function(e,t){var n=[];return Object.keys(e).forEach(function(t){n.push(e[t].getSnapshot())}),n},t.prototype.didChange=function(t){var e=W(t.object);switch(t.type){case"update":return void e.emitPatch({op:"replace",path:""+t.index,value:t.newValue.snapshot,oldValue:t.oldValue?t.oldValue.snapshot:void 0},e);case"splice":for(var n=t.removedCount-1;0<=n;n--)e.emitPatch({op:"remove",path:""+(t.index+n),oldValue:t.removed[n].snapshot},e);for(n=0;n<t.addedCount;n++)e.emitPatch({op:"add",path:""+(t.index+n),value:e.getChildNode(""+(t.index+n)).snapshot,oldValue:void 0},e);return}},t.prototype.applyPatchLocally=function(t,e,n){var r=t.storedValue,i="-"===e?r.length:parseInt(e);switch(n.op){case"replace":r[i]=n.value;break;case"add":r.splice(i,0,n.value);break;case"remove":r.splice(i,1)}},t.prototype.applySnapshot=function(t,e){t.storedValue.replace(e)},t.prototype.getChildType=function(t){return this.subType},t.prototype.isValidSnapshot=function(t,n){var r=this;return rt(t)?k(t.map(function(t,e){return r.subType.validate(t,x(n,""+e,r.subType))})):R(n,t,"Value is not an array")},t.prototype.getDefaultSnapshot=function(){return q},t.prototype.removeChild=function(t,e){t.storedValue.splice(parseInt(e,10),1)},n([l.action],t.prototype,"applySnapshot",null),t}(m);function Pt(t,e,n,r,i){for(var o,a,s,u=!1,p=void 0,c=!0,l=0;u=l<=r.length-1,o=n[l],a=u?r[l]:void 0,((s=a)instanceof y||s instanceof g)&&(a=a.storedValue),o||u;l++)if(u)if(o)if(_t(o,a))n[l]=Vt(e,t,""+i[l],a,o);else{p=void 0;for(var h=l;h<n.length;h++)if(_t(n[h],a)){p=n.splice(h,1)[0];break}n.splice(l,0,Vt(e,t,""+i[l],a,p)),c=!1}else $(a)&&W(a).parent===t&&tt("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+t.path+"/"+i[l]+"', but it lives already at '"+W(a).path+"'"),n.splice(l,0,Vt(e,t,""+i[l],a)),c=!1;else o.die(),n.splice(l,1),l--,c=!1;return c?null:n}function Vt(t,e,n,r,i){var o;if($(r)&&((o=W(r)).assertAlive(),null!==o.parent&&o.parent===e))return o.setParent(e,n),i&&i!==o&&i.die(),o;return i?((o=t.reconcile(i,r)).setParent(e,n),o):t.instantiate(e,n,e._environment,r)}function _t(t,e){return $(e)?W(e)===t:t.snapshot===e||!!(t instanceof g&&null!==t.identifier&&t.identifierAttribute&&ot(e)&&t.identifier===""+e[t.identifierAttribute])}var Nt,Ct,It="preProcessSnapshot",jt="postProcessSnapshot";function Ot(){return W(this).toString()}(Ct=Nt||(Nt={})).afterCreate="afterCreate",Ct.afterAttach="afterAttach",Ct.beforeDetach="beforeDetach",Ct.beforeDestroy="beforeDestroy";var Et={name:"AnonymousModel",properties:{},initializers:q};function Dt(t){return Object.keys(t).reduce(function(t,e){var n,r,i;if(e in Nt)return tt("Hook '"+e+"' was defined as property. Hooks should be defined as part of the actions");var o=Object.getOwnPropertyDescriptor(t,e);"get"in o&&tt("Getters are not supported as properties. Please use views instead");var a=o.value;if(null==a)tt("The default value of an attribute cannot be null or undefined as the type cannot be inferred. Did you mean `types.maybe(someType)`?");else{if(st(a))return Object.assign({},t,((n={})[e]=Kt(function(t){switch(typeof t){case"string":return kt;case"number":return zt;case"boolean":return Lt;case"object":if(t instanceof Date)return $t}return tt("Cannot determine primitive type from value "+t)}(a),a),n));if(a instanceof St)return Object.assign({},t,((r={})[e]=Kt(a,{}),r));if(a instanceof Tt)return Object.assign({},t,((i={})[e]=Kt(a,[]),i));if(A(a))return t;tt("Invalid type definition for property '"+e+"', cannot infer a type from a value like '"+a+"' ("+typeof a+")")}},t)}var xt=function(r){function e(t){var e=r.call(this,t.name||Et.name)||this;e.flags=u.TypeFlags.Object,e.shouldAttachNode=!0;var n=t.name||Et.name;return/^\w[\w\d_]*$/.test(n)||tt("Typename should be a valid identifier: "+n),Object.assign(e,Et,t),e.properties=Dt(e.properties),ut(e.properties),e.propertyNames=Object.keys(e.properties),e.identifierAttribute=e._getIdentifierAttribute(),e}return a(e,r),e.prototype._getIdentifierAttribute=function(){var n=void 0;return this.forAllProps(function(t,e){e.flags&u.TypeFlags.Identifier&&(n&&tt("Cannot define property '"+t+"' as object identifier, property '"+n+"' is already defined as identifier property"),n=t)}),n},e.prototype.cloneAndEnhance=function(t){return new e({name:t.name||this.name,properties:Object.assign({},this.properties,t.properties),initializers:this.initializers.concat(t.initializers||[]),preProcessor:t.preProcessor||this.preProcessor,postProcessor:t.postProcessor||this.postProcessor})},e.prototype.actions=function(e){var n=this;return this.cloneAndEnhance({initializers:[function(t){return n.instantiateActions(t,e(t)),t}]})},e.prototype.instantiateActions=function(i,o){ot(o)||tt("actions initializer should return a plain object containing actions"),Object.keys(o).forEach(function(t){t===It&&tt("Cannot define action '"+It+"', it should be defined using 'type.preProcessSnapshot(fn)' instead"),t===jt&&tt("Cannot define action '"+jt+"', it should be defined using 'type.postProcessSnapshot(fn)' instead");var e=o[t],n=i[t];if(t in Nt&&n){var r=e;e=function(){n.apply(null,arguments),r.apply(null,arguments)}}pt(i,t,j(i,t,e))})},e.prototype.named=function(t){return this.cloneAndEnhance({name:t})},e.prototype.props=function(t){return this.cloneAndEnhance({properties:t})},e.prototype.volatile=function(e){var n=this;return this.cloneAndEnhance({initializers:[function(t){return n.instantiateVolatileState(t,e(t)),t}]})},e.prototype.instantiateVolatileState=function(t,e){ot(e)||tt("volatile state initializer should return a plain object containing state"),l.set(t,e)},e.prototype.extend=function(s){var u=this;return this.cloneAndEnhance({initializers:[function(t){var e=s(t),n=e.actions,r=e.views,i=e.state,o=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&(n[r[i]]=t[r[i]])}return n}(e,["actions","views","state"]);for(var a in o)tt("The `extend` function should return an object with a subset of the fields 'actions', 'views' and 'state'. Found invalid key '"+a+"'");return i&&u.instantiateVolatileState(t,i),r&&u.instantiateViews(t,r),n&&u.instantiateActions(t,n),t}]})},e.prototype.views=function(e){var n=this;return this.cloneAndEnhance({initializers:[function(t){return n.instantiateViews(t,e(t)),t}]})},e.prototype.instantiateViews=function(i,o){ot(o)||tt("views initializer should return a plain object containing views"),Object.keys(o).forEach(function(t){var e=Object.getOwnPropertyDescriptor(o,t),n=e.value;if("get"in e)if(l.isComputedProp(i,t)){var r=l._getAdministration(i,t);r.derivation=e.get,r.scope=i,e.set&&(r.setter=l.action(r.name+"-setter",e.set))}else l.computed(i,t,e,!0);else"function"==typeof n?pt(i,t,n):tt("A view member should either be a function or getter based property")})},e.prototype.preProcessSnapshot=function(e){var n=this.preProcessor;return n?this.cloneAndEnhance({preProcessor:function(t){return n(e(t))}}):this.cloneAndEnhance({preProcessor:e})},e.prototype.postProcessSnapshot=function(e){var n=this.postProcessor;return n?this.cloneAndEnhance({postProcessor:function(t){return e(n(t))}}):this.cloneAndEnhance({postProcessor:e})},e.prototype.instantiate=function(t,e,n,r){return U(this,t,e,n,$(r)?r:this.applySnapshotPreProcessor(r))},e.prototype.initializeChildNodes=function(n,r){void 0===r&&(r={});var t=n.type,i={};return t.forAllProps(function(t,e){i[t]=e.instantiate(n,t,n._environment,r[t])}),i},e.prototype.createNewInstance=function(t,e,n){return l.observable.object(e,Q,X)},e.prototype.finalizeNewInstance=function(e,n){pt(n,"toString",Ot),this.forAllProps(function(t){l._interceptReads(n,t,e.unbox)}),this.initializers.reduce(function(t,e){return e(t)},n),l.intercept(n,this.willChange),l.observe(n,this.didChange)},e.prototype.willChange=function(t){var e=W(t.object);e.assertWritable();var n=e.type.properties[t.name];return n&&(t.newValue,t.newValue=n.reconcile(e.getChildNode(t.name),t.newValue)),t},e.prototype.didChange=function(t){var e=W(t.object);if(e.type.properties[t.name]){var n=t.oldValue?t.oldValue.snapshot:void 0;e.emitPatch({op:"replace",path:dt(t.name),value:t.newValue.snapshot,oldValue:n},e)}},e.prototype.getChildren=function(n){var r=this,i=[];return this.forAllProps(function(t,e){i.push(r.getChildNode(n,t))}),i},e.prototype.getChildNode=function(t,e){if(!(e in this.properties))return tt("Not a value property: "+e);var n=l._getAdministration(t.storedValue,e).value;return n||tt("Node not available for property "+e)},e.prototype.getValue=function(t){return t.storedValue},e.prototype.getSnapshot=function(n,t){var r=this;void 0===t&&(t=!0);var i={};return this.forAllProps(function(t,e){l.getAtom(n.storedValue,t).reportObserved(),i[t]=r.getChildNode(n,t).snapshot}),t?this.applySnapshotPostProcessor(i):i},e.prototype.processInitialSnapshot=function(e,t){var n={};return Object.keys(e).forEach(function(t){n[t]=e[t].getSnapshot()}),this.applySnapshotPostProcessor(this.applyOptionalValuesToSnapshot(n))},e.prototype.applyPatchLocally=function(t,e,n){"replace"!==n.op&&"add"!==n.op&&tt("object does not support operation "+n.op),t.storedValue[e]=n.value},e.prototype.applySnapshot=function(n,t){var r=this.applySnapshotPreProcessor(t);this.forAllProps(function(t,e){n.storedValue[t]=r[t]})},e.prototype.applySnapshotPreProcessor=function(t){var e=this.preProcessor;return e?e.call(null,t):t},e.prototype.applyOptionalValuesToSnapshot=function(r){return r&&(r=Object.assign({},r),this.forAllProps(function(t,e){if(!(t in r)){var n=Ft(e);n&&(r[t]=n.getDefaultValueSnapshot())}})),r},e.prototype.applySnapshotPostProcessor=function(t){var e=this.postProcessor;return e?e.call(null,t):t},e.prototype.getChildType=function(t){return this.properties[t]},e.prototype.isValidSnapshot=function(t,e){var n=this,r=this.applySnapshotPreProcessor(t);return ot(r)?k(this.propertyNames.map(function(t){return n.properties[t].validate(r[t],x(e,t,n.properties[t]))})):R(e,r,"Value is not a plain object")},e.prototype.forAllProps=function(e){var n=this;this.propertyNames.forEach(function(t){return e(t,n.properties[t])})},e.prototype.describe=function(){var e=this;return"{ "+this.propertyNames.map(function(t){return t+": "+e.properties[t].describe()}).join("; ")+" }"},e.prototype.getDefaultSnapshot=function(){return Q},e.prototype.removeChild=function(t,e){t.storedValue[e]=null},n([l.action],e.prototype,"applySnapshot",null),e}(m);function Ft(t){if(t)return t.flags&u.TypeFlags.Union&&t.types?t.types.find(Ft):t.flags&u.TypeFlags.Late&&t.getSubType&&t.getSubType(!1)?Ft(t.subType):t.flags&u.TypeFlags.Optional?t:void 0}var Rt=function(o){function t(t,e,n,r){void 0===r&&(r=et);var i=o.call(this,t)||this;return i.shouldAttachNode=!1,i.flags=e,i.checker=n,i.initializer=r,i}return a(t,o),t.prototype.describe=function(){return this.name},t.prototype.instantiate=function(t,e,n,r){return U(this,t,e,n,r)},t.prototype.createNewInstance=function(t,e,n){return this.initializer(n)},t.prototype.isValidSnapshot=function(t,e){return st(t)&&this.checker(t)?F():R(e,t,"Value is not a "+("Date"===this.name?"Date or a unix milliseconds timestamp":this.name))},t}(w),kt=new Rt("string",u.TypeFlags.String,function(t){return"string"==typeof t}),zt=new Rt("number",u.TypeFlags.Number,function(t){return"number"==typeof t}),Mt=new Rt("integer",u.TypeFlags.Integer,function(t){return nt(t)}),Lt=new Rt("boolean",u.TypeFlags.Boolean,function(t){return"boolean"==typeof t}),Ht=new Rt("null",u.TypeFlags.Null,function(t){return null===t}),Ut=new Rt("undefined",u.TypeFlags.Undefined,function(t){return void 0===t}),$t=new Rt("Date",u.TypeFlags.Date,function(t){return"number"==typeof t||t instanceof Date},function(t){return t instanceof Date?t:new Date(t)});$t.getSnapshot=function(t){return t.storedValue.getTime()};var Wt=function(n){function t(t){var e=n.call(this,JSON.stringify(t))||this;return e.shouldAttachNode=!1,e.flags=u.TypeFlags.Literal,e.value=t,e}return a(t,n),t.prototype.instantiate=function(t,e,n,r){return U(this,t,e,n,r)},t.prototype.describe=function(){return JSON.stringify(this.value)},t.prototype.isValidSnapshot=function(t,e){return st(t)&&t===this.value?F():R(e,t,"Value is not a literal "+JSON.stringify(this.value))},t}(w);function Jt(t){return new Wt(t)}var Yt=function(o){function t(t,e,n,r){var i=o.call(this,t)||this;return i.type=e,i.predicate=n,i.message=r,i}return a(t,o),Object.defineProperty(t.prototype,"flags",{get:function(){return this.type.flags|u.TypeFlags.Refinement},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"shouldAttachNode",{get:function(){return this.type.shouldAttachNode},enumerable:!0,configurable:!0}),t.prototype.describe=function(){return this.name},t.prototype.instantiate=function(t,e,n,r){return this.type.instantiate(t,e,n,r)},t.prototype.isAssignableFrom=function(t){return this.type.isAssignableFrom(t)},t.prototype.isValidSnapshot=function(t,e){var n=this.type.validate(t,e);if(0<n.length)return n;var r=$(t)?W(t).snapshot:t;return this.predicate(r)?F():R(e,t,this.message(t))},t}(w);var Zt=function(i){function t(t,e,n){var r=i.call(this,t)||this;return r.eager=!0,r.dispatcher=n&&n.dispatcher,n&&!n.eager&&(r.eager=!1),r.types=e,r}return a(t,i),Object.defineProperty(t.prototype,"flags",{get:function(){var e=u.TypeFlags.Union;return this.types.forEach(function(t){e|=t.flags}),e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"shouldAttachNode",{get:function(){return this.types.some(function(t){return t.shouldAttachNode})},enumerable:!0,configurable:!0}),t.prototype.isAssignableFrom=function(e){return this.types.some(function(t){return t.isAssignableFrom(e)})},t.prototype.describe=function(){return"("+this.types.map(function(t){return t.describe()}).join(" | ")+")"},t.prototype.instantiate=function(t,e,n,r){var i=this.determineType(r);return i?i.instantiate(t,e,n,r):tt("No matching type for union "+this.describe())},t.prototype.reconcile=function(t,e){var n=this.determineType(e);return n?n.reconcile(t,e):tt("No matching type for union "+this.describe())},t.prototype.determineType=function(e){return this.dispatcher?this.dispatcher(e):this.types.find(function(t){return t.is(e)})},t.prototype.isValidSnapshot=function(t,e){if(this.dispatcher)return this.dispatcher(t).validate(t,e);for(var n=[],r=0,i=0;i<this.types.length;i++){var o=this.types[i].validate(t,e);if(0===o.length){if(this.eager)return F();r++}else n.push(o)}return 1===r?F():R(e,t,"No type is applicable for the union").concat(k(n))},t}(w);function Gt(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=A(t)?void 0:t,i=A(t)?[t].concat(e):e,o="("+i.map(function(t){return t.name}).join(" | ")+")";return new Zt(o,i,r)}var Bt=function(r){function t(t,e){var n=r.call(this,t.name)||this;return n.type=t,n.defaultValue=e,n}return a(t,r),Object.defineProperty(t.prototype,"flags",{get:function(){return this.type.flags|u.TypeFlags.Optional},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"shouldAttachNode",{get:function(){return this.type.shouldAttachNode},enumerable:!0,configurable:!0}),t.prototype.describe=function(){return this.type.describe()+"?"},t.prototype.instantiate=function(t,e,n,r){if(void 0===r){var i=this.getDefaultValueSnapshot();return this.type.instantiate(t,e,n,i)}return this.type.instantiate(t,e,n,r)},t.prototype.reconcile=function(t,e){return this.type.reconcile(t,this.type.is(e)&&void 0!==e?e:this.getDefaultValue())},t.prototype.getDefaultValue=function(){var t="function"==typeof this.defaultValue?this.defaultValue():this.defaultValue;return this.defaultValue,t},t.prototype.getDefaultValueSnapshot=function(){var t=this.getDefaultValue();return $(t)?W(t).snapshot:t},t.prototype.isValidSnapshot=function(t,e){return void 0===t?F():this.type.validate(t,e)},t.prototype.isAssignableFrom=function(t){return this.type.isAssignableFrom(t)},t}(w);function Kt(t,e){return new Bt(t,e)}var qt=Kt(Ut,void 0),Qt=Kt(Ht,null);var Xt=function(r){function t(t,e){var n=r.call(this,t)||this;return n._subType=null,n.definition=e,n}return a(t,r),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|u.TypeFlags.Late},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"shouldAttachNode",{get:function(){return this.getSubType(!0).shouldAttachNode},enumerable:!0,configurable:!0}),t.prototype.getSubType=function(t){if(null===this._subType){var e=void 0;try{e=this.definition()}catch(t){if(!(t instanceof ReferenceError))throw t;e=void 0}if(t&&void 0===e&&tt("Late type seems to be used too early, the definition (still) returns undefined"),e)return this._subType=e}return this._subType},t.prototype.instantiate=function(t,e,n,r){return this.getSubType(!0).instantiate(t,e,n,r)},t.prototype.reconcile=function(t,e){return this.getSubType(!0).reconcile(t,e)},t.prototype.describe=function(){var t=this.getSubType(!1);return t?t.name:"<uknown late type>"},t.prototype.isValidSnapshot=function(t,e){var n=this.getSubType(!1);return n?n.validate(t,e):F()},t.prototype.isAssignableFrom=function(t){var e=this.getSubType(!1);return!!e&&e.isAssignableFrom(t)},t}(w);var te=function(n){function t(t){var e=n.call(this,t?"frozen("+t.name+")":"frozen")||this;return e.subType=t,e.shouldAttachNode=!1,e.flags=u.TypeFlags.Frozen,e}return a(t,n),t.prototype.describe=function(){return"<any immutable value>"},t.prototype.instantiate=function(t,e,n,r){return U(this,t,e,n,r)},t.prototype.isValidSnapshot=function(t,e){return"function"==typeof t?R(e,t,"Value is not serializable and cannot be frozen"):this.subType?this.subType.validate(t,e):F()},t}(w),ee=new te;var ne=function(){function t(t,e,n){if(this.mode=t,this.value=e,this.targetType=n,"object"===t){if(!$(e))return tt("Can only store references to tree nodes, got: '"+e+"'");if(!W(e).identifierAttribute)return tt("Can only store references with a defined identifier attribute.")}}return Object.defineProperty(t.prototype,"resolvedValue",{get:function(){var t=this.node,e=this.targetType,n=t.root.identifierCache.resolve(e,this.value);return n?n.value:tt("Failed to resolve reference '"+this.value+"' to type '"+this.targetType.name+"' (from node: "+t.path+")")},enumerable:!0,configurable:!0}),n([l.computed],t.prototype,"resolvedValue",null),t}(),re=function(n){function t(t){var e=n.call(this,"reference("+t.name+")")||this;return e.targetType=t,e.shouldAttachNode=!1,e.flags=u.TypeFlags.Reference,e}return a(t,n),t.prototype.describe=function(){return this.name},t.prototype.isAssignableFrom=function(t){return this.targetType.isAssignableFrom(t)},t.prototype.isValidSnapshot=function(t,e){return"string"==typeof t||"number"==typeof t?F():R(e,t,"Value is not a valid identifier, which is a string or a number")},t}(w),ie=function(e){function t(t){return e.call(this,t)||this}return a(t,e),t.prototype.getValue=function(t){if(t.isAlive){var e=t.storedValue;return"object"===e.mode?e.value:e.resolvedValue}},t.prototype.getSnapshot=function(t){var e=t.storedValue;switch(e.mode){case"identifier":return e.value;case"object":return e.value[W(e.value).identifierAttribute]}},t.prototype.instantiate=function(t,e,n,r){var i,o=$(r)?"object":"identifier",a=U(this,t,e,n,i=new ne(o,r,this.targetType));return i.node=a},t.prototype.reconcile=function(t,e){if(t.type===this){var n=$(e)?"object":"identifier",r=t.storedValue;if(n===r.mode&&r.value===e)return t}var i=this.instantiate(t.parent,t.subpath,t._environment,e);return t.die(),i},t}(re),oe=function(r){function t(t,e){var n=r.call(this,t)||this;return n.options=e,n}return a(t,r),t.prototype.getValue=function(t){if(t.isAlive)return this.options.get(t.storedValue,t.parent?t.parent.storedValue:null)},t.prototype.getSnapshot=function(t){return t.storedValue},t.prototype.instantiate=function(t,e,n,r){return U(this,t,e,n,$(r)?this.options.set(r,t?t.storedValue:null):r)},t.prototype.reconcile=function(t,e){var n=$(e)?this.options.set(e,t?t.storedValue:null):e;if(t.type===this&&t.storedValue===n)return t;var r=this.instantiate(t.parent,t.subpath,t._environment,n);return t.die(),r},t}(re);var ae=function(e){function t(){var t=e.call(this,"identifier")||this;return t.shouldAttachNode=!1,t.flags=u.TypeFlags.Identifier,t}return a(t,e),t.prototype.instantiate=function(t,e,n,r){return t&&t.type instanceof xt||tt("Identifier types can only be instantiated as direct child of a model type"),U(this,t,e,n,r)},t.prototype.reconcile=function(t,e){return t.storedValue!==e?tt("Tried to change identifier from '"+t.storedValue+"' to '"+e+"'. Changing identifiers is not allowed."):t},t.prototype.describe=function(){return"identifier"},t.prototype.isValidSnapshot=function(t,e){return"string"!=typeof t?R(e,t,"Value is not a valid identifier, expected a string"):F()},t}(w),se=function(i){function t(){var t=i.call(this)||this;return t.name="identifierNumber",t}return a(t,i),t.prototype.instantiate=function(t,e,n,r){return i.prototype.instantiate.call(this,t,e,n,r)},t.prototype.isValidSnapshot=function(t,e){return"number"==typeof t?F():R(e,t,"Value is not a valid identifierNumber, expected a number")},t.prototype.reconcile=function(t,e){return i.prototype.reconcile.call(this,t,e)},t.prototype.getSnapshot=function(t){return t.storedValue},t.prototype.describe=function(){return"identifierNumber"},t}(ae),ue=new ae,pe=new se;var ce=function(n){function t(t){var e=n.call(this,t.name)||this;return e.options=t,e.flags=u.TypeFlags.Reference,e.shouldAttachNode=!1,e}return a(t,n),t.prototype.describe=function(){return this.name},t.prototype.isAssignableFrom=function(t){return t===this},t.prototype.isValidSnapshot=function(t,e){if(this.options.isTargetType(t))return F();var n=this.options.getValidationMessage(t);return n?R(e,t,"Invalid value for type '"+this.name+"': "+n):F()},t.prototype.getValue=function(t){if(t.isAlive)return t.storedValue},t.prototype.getSnapshot=function(t){return this.options.toSnapshot(t.storedValue)},t.prototype.instantiate=function(t,e,n,r){return U(this,t,e,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r))},t.prototype.reconcile=function(t,e){var n=!this.options.isTargetType(e);if(t.type===this&&(n?e===t.snapshot:e===t.storedValue))return t;var r=n?this.options.fromSnapshot(e):e,i=this.instantiate(t.parent,t.subpath,t._environment,r);return t.die(),i},t}(w),le={enumeration:function(t,e){var n=Gt.apply(void 0,("string"==typeof t?e:t).map(function(t){return Jt(""+t)}));return"string"==typeof t&&(n.name=t),n},model:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="string"==typeof t[0]?t.shift():"AnonymousModel",r=t.shift()||{};return new xt({name:n,properties:r})},compose:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="string"==typeof t[0]?t.shift():"AnonymousModel";return t.reduce(function(t,e){return t.cloneAndEnhance({name:t.name+"_"+e.name,properties:e.properties,initializers:e.initializers})}).named(n)},custom:function(t){return new ce(t)},reference:function(t,e){return e?new oe(t,e):new ie(t)},union:Gt,optional:Kt,literal:Jt,maybe:function(t){return Gt(t,qt)},maybeNull:function(t){return Gt(t,Qt)},refinement:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="string"==typeof t[0]?t.shift():A(t[0])?t[0].name:null,r=t[0],i=t[1],o=t[2]?t[2]:function(t){return"Value does not respect the refinement predicate"};return new Yt(n,r,i,o)},string:kt,boolean:Lt,number:zt,integer:Mt,Date:$t,map:function(t){return new St("map<string, "+t.name+">",t)},array:function(t){return new Tt(t.name+"[]",t)},frozen:function(t){return 0===arguments.length?ee:A(t)?new te(t):Kt(ee,t)},identifier:ue,identifierNumber:pe,late:function(t,e){var n="string"==typeof t?t:"late("+t.toString()+")";return new Xt(n,"string"==typeof t?e:t)},undefined:Ut,null:Ht};u.types=le,u.typecheck=z,u.escapeJsonPath=dt,u.unescapeJsonPath=yt,u.joinJsonPath=vt,u.splitJsonPath=bt,u.decorate=function(t,e){var n={handler:t,includeHooks:!0};return e.$mst_middleware?e.$mst_middleware.push(n):e.$mst_middleware=[n],e},u.addMiddleware=O,u.process=function(t){return ht("process","`process()` has been renamed to `flow()`. See https://github.com/mobxjs/mobx-state-tree/issues/399 for more information. Note that the middleware event types starting with `process` now start with `flow`."),ft(t)},u.isStateTreeNode=$,u.flow=ft,u.applyAction=P,u.onAction=V,u.recordActions=function(t){var e={actions:[],stop:function(){return n()},replay:function(t){P(t,e.actions)}},n=V(t,e.actions.push.bind(e.actions));return e},u.createActionTrackingMiddleware=function(a){return function(e,t,n){switch(e.type){case"action":if(a.filter&&!0!==a.filter(e))return t(e);var r=a.onStart(e);a.onResume(e,r),S.set(e.id,{call:e,context:r,async:!1});try{var i=t(e);return a.onSuspend(e,r),!1===S.get(e.id).async&&(S.delete(e.id),a.onSuccess(e,r,i)),i}catch(t){throw S.delete(e.id),a.onFail(e,r,t),t}case"flow_spawn":return(o=S.get(e.rootId)).async=!0,t(e);case"flow_resume":case"flow_resume_error":var o=S.get(e.rootId);a.onResume(e,o.context);try{return t(e)}finally{a.onSuspend(e,o.context)}case"flow_throw":return o=S.get(e.rootId),S.delete(e.id),a.onFail(e,o.context,e.args[0]),t(e);case"flow_return":return o=S.get(e.rootId),S.delete(e.id),a.onSuccess(e,o.context,e.args[0]),t(e)}}},u.setLivelynessChecking=function(t){e=t},u.getType=p,u.getChildType=function(t,e){return W(t).getChildType(e)},u.onPatch=o,u.onSnapshot=function(t,e){return W(t).onSnapshot(e)},u.applyPatch=s,u.recordPatches=function(e){var t=null;function n(){t||(t=o(e,function(t,e){r.rawPatches.push([t,e])}))}var r={rawPatches:[],get patches(){return this.rawPatches.map(function(t){return t[0]})},get inversePatches(){return this.rawPatches.map(function(t){return t[0],t[1]})},stop:function(){t&&t(),t=null},resume:n,replay:function(t){s(t||e,r.patches)},undo:function(t){s(t||e,r.inversePatches.slice().reverse())}};return n(),r},u.protect=function(t){var e=W(t);e.isRoot||tt("`protect` can only be invoked on root nodes"),e.isProtectionEnabled=!0},u.unprotect=function(t){var e=W(t);e.isRoot||tt("`unprotect` can only be invoked on root nodes"),e.isProtectionEnabled=!1},u.isProtected=function(t){return W(t).isProtected},u.applySnapshot=c,u.getSnapshot=function(t,e){void 0===e&&(e=!0);var n=W(t);return e?n.snapshot:ut(n.type.getSnapshot(n,!1))},u.hasParent=function(t,e){void 0===e&&(e=1);for(var n=W(t).parent;n;){if(0==--e)return!0;n=n.parent}return!1},u.getParent=function(t,e){void 0===e&&(e=1);for(var n=e,r=W(t).parent;r;){if(0==--n)return r.storedValue;r=r.parent}return tt("Failed to find the parent of "+W(t)+" at depth "+e)},u.hasParentOfType=function(t,e){for(var n=W(t).parent;n;){if(e.is(n.storedValue))return!0;n=n.parent}return!1},u.getParentOfType=function(t,e){for(var n=W(t).parent;n;){if(e.is(n.storedValue))return n.storedValue;n=n.parent}return tt("Failed to find the parent of "+W(t)+" of a given type")},u.getRoot=h,u.getPath=function(t){return W(t).path},u.getPathParts=function(t){return bt(W(t).path)},u.isRoot=function(t){return W(t).isRoot},u.resolvePath=function(t,e){var n=G(W(t),e);return n?n.value:void 0},u.resolveIdentifier=function(t,e,n){var r=W(e).root.identifierCache.resolve(t,""+n);return r?r.value:void 0},u.getIdentifier=function(t){return W(t).identifier},u.tryResolve=f,u.getRelativePath=function(t,e){return Z(W(t),W(e))},u.clone=function(t,e){void 0===e&&(e=!0);var n=W(t);return n.type.create(n.snapshot,!0===e?n.root._environment:!1===e?void 0:e)},u.detach=function(t){return W(t).detach(),t},u.destroy=function(t){var e=W(t);e.isRoot?e.die():e.parent.removeChild(e.subpath)},u.isAlive=function(t){return W(t).isAlive},u.addDisposer=function(t,e){W(t).addDisposer(e)},u.getEnv=function(t){var e=W(t).root._environment;return e||Q},u.walk=d,u.getMembers=function(n){var t=W(n).type,e=Object.getOwnPropertyNames(n),r={name:t.name,properties:i({},t.properties),actions:[],volatile:[],views:[]};return e.forEach(function(t){if(!(t in r.properties)){var e=Object.getOwnPropertyDescriptor(n,t);e.get?l.isComputedProp(n,t)?r.views.push(t):r.volatile.push(t):!0===e.value._isMSTAction?r.actions.push(t):l.isObservableProp(n,t)?r.volatile.push(t):r.views.push(t)}}),r},u.cast=function(t){return t},Object.defineProperty(u,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("mobx")):"function"==typeof define&&define.amd?define(["exports","mobx"],e):e(t.mobxStateTree={},t.mobx)}(this,function(t,l){"use strict";var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function a(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var i=function(){return(i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function n(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;0<=s;s--)(i=t[s])&&(a=(o<3?i(a):3<o?i(e,n,a):i(e,n))||a);return 3<o&&a&&Object.defineProperty(e,n,a),a}function u(t){return J(t).type}function o(t,e){return J(t).onPatch(e)}function s(t,e){J(t).applyPatches(ot(e))}function p(t,e){return J(t).applySnapshot(e)}function c(t){return J(t).root.storedValue}function h(t,e){var n=B(J(t),e,!1);if(void 0!==n)try{return n.value}catch(t){return}}function f(t,e){var n=J(t);n.getChildren().forEach(function(t){W(t.storedValue)&&f(t.storedValue,e)}),e(n.storedValue)}var d=function(){function t(t,e,n,r,i){this.parent=null,this.subpath="",this.state=F.INITIALIZING,this._environment=void 0,this._initialSnapshot=i,this.type=t,this.parent=e,this.subpath=n;var o=!0;try{this.storedValue=t.createNewInstance(this,{},i),this.state=F.CREATED,o=!1}finally{o&&(this.state=F.DEAD)}}return Object.defineProperty(t.prototype,"path",{get:function(){return this.parent?this.parent.path+"/"+yt(this.subpath):""},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isRoot",{get:function(){return null===this.parent},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this.parent?this.parent.root:et("This scalar node is not part of a tree")},enumerable:!0,configurable:!0}),t.prototype.setParent=function(t,e){if(void 0===e&&(e=null),this.parent!==t||this.subpath!==e)if(this.parent&&!t)this.die();else{var n=null===e?"":e;this.subpath!==n&&(this.subpath=n),t&&t!==this.parent&&(this.parent=t)}},Object.defineProperty(t.prototype,"value",{get:function(){return this.type.getValue(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return pt(this.getSnapshot())},enumerable:!0,configurable:!0}),t.prototype.getSnapshot=function(){return this.type.getSnapshot(this)},Object.defineProperty(t.prototype,"isAlive",{get:function(){return this.state!==F.DEAD},enumerable:!0,configurable:!0}),t.prototype.toString=function(){return this.type.name+"@"+(this.path||"<root>")+(this.isAlive?"":"[dead]")},t.prototype.die=function(){this.state=F.DEAD},t}(),y=1,e="warn";var v,b,g={onError:function(t){throw t}},m=function(){function r(t,e,n,r,i){this.nodeId=++y,this.subpathAtom=l.createAtom("path"),this.subpath="",this.parent=null,this.state=F.INITIALIZING,this.isProtectionEnabled=!0,this.middlewares=null,this._autoUnbox=!0,this._environment=void 0,this._isRunningAction=!1,this._hasSnapshotReaction=!1,this._disposers=null,this._patchSubscribers=null,this._snapshotSubscribers=null,this._observableInstanceCreated=!1,this._cachedInitialSnapshot=null,this._environment=r,this._initialSnapshot=pt(i),this.type=t,this.parent=e,this.subpath=n,this.escapedSubpath=yt(this.subpath),this.identifierAttribute=t.identifierAttribute,this.identifier=this.identifierAttribute&&this._initialSnapshot?""+this._initialSnapshot[this.identifierAttribute]:null,e||(this.identifierCache=new H),this._childNodes=t.initializeChildNodes(this,this._initialSnapshot),e?e.root.identifierCache.addNodeToCache(this):this.identifierCache.addNodeToCache(this)}return r.prototype.applyPatches=function(t){this._observableInstanceCreated||this._createObservableInstance(),this.applyPatches(t)},r.prototype.applySnapshot=function(t){this._observableInstanceCreated||this._createObservableInstance(),this.applySnapshot(t)},r.prototype._createObservableInstance=function(){var t=this.type;this.storedValue=t.createNewInstance(this,this._childNodes,this._initialSnapshot),this.preboot();var e,n,r=!0;this._observableInstanceCreated=!0;try{this._isRunningAction=!0,t.finalizeNewInstance(this,this.storedValue),this._isRunningAction=!1,this.fireHook("afterCreate"),this.state=F.CREATED,r=!1}finally{r&&(this.state=F.DEAD)}e=this,n="snapshot",l.getAtom(e,n).trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this.finalizeCreation(),this._childNodes=X},Object.defineProperty(r.prototype,"path",{get:function(){return this.subpathAtom.reportObserved(),this.parent?this.parent.path+"/"+this.escapedSubpath:""},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"root",{get:function(){var t=this.parent;return t?t.root:this},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isRoot",{get:function(){return null===this.parent},enumerable:!0,configurable:!0}),r.prototype.setParent=function(t,e){if(void 0===e&&(e=null),this.parent!==t||this.subpath!==e)if(this.parent&&!t)this.die();else{var n=null===e?"":e;this.subpath!==n&&(this.subpath=n,this.escapedSubpath=yt(this.subpath),this.subpathAtom.reportChanged()),t&&t!==this.parent&&(t.root.identifierCache.mergeCache(this),this.parent=t,this.subpathAtom.reportChanged(),this.fireHook("afterAttach"))}},r.prototype.fireHook=function(t){var e=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[t];"function"==typeof e&&e.apply(this.storedValue)},Object.defineProperty(r.prototype,"value",{get:function(){if(this._observableInstanceCreated||this._createObservableInstance(),this.isAlive)return this.type.getValue(this)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"snapshot",{get:function(){if(this.isAlive)return pt(this.getSnapshot())},enumerable:!0,configurable:!0}),r.prototype.getSnapshot=function(){if(this.isAlive)return this._observableInstanceCreated?this._getActualSnapshot():this._getInitialSnapshot()},r.prototype._getActualSnapshot=function(){return this.type.getSnapshot(this)},r.prototype._getInitialSnapshot=function(){if(this.isAlive){if(!this._initialSnapshot)return this._initialSnapshot;if(this._cachedInitialSnapshot)return this._cachedInitialSnapshot;var t=this.type,e=this._childNodes,n=this._initialSnapshot;return this._cachedInitialSnapshot=t.processInitialSnapshot(e,n),this._cachedInitialSnapshot}},r.prototype.isRunningAction=function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()},Object.defineProperty(r.prototype,"isAlive",{get:function(){return this.state!==F.DEAD},enumerable:!0,configurable:!0}),r.prototype.assertAlive=function(){if(!this.isAlive){var t="[mobx-state-tree][error] You are trying to read or write to an object that is no longer part of a state tree. (Object type was '"+this.type.name+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree.";switch(e){case"error":throw new Error(t);case"warn":console.warn(t+' Use setLivelynessChecking("error") to simplify debugging this error.')}}},r.prototype.getChildNode=function(t){this.assertAlive(),this._autoUnbox=!1;try{return this._observableInstanceCreated?this.type.getChildNode(this,t):this._childNodes[t]}finally{this._autoUnbox=!0}},r.prototype.getChildren=function(){this.assertAlive(),this._autoUnbox=!1;try{return this._observableInstanceCreated?this.type.getChildren(this):q(this._childNodes)}finally{this._autoUnbox=!0}},r.prototype.getChildType=function(t){return this.type.getChildType(t)},Object.defineProperty(r.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!0,configurable:!0}),r.prototype.assertWritable=function(){this.assertAlive(),!this.isRunningAction()&&this.isProtected&&et("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")},r.prototype.removeChild=function(t){this.type.removeChild(this,t)},r.prototype.unbox=function(t){return t&&t.parent&&t.parent.assertAlive(),t&&t.parent&&t.parent._autoUnbox?t.value:t},r.prototype.toString=function(){var t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+(this.path||"<root>")+t+(this.isAlive?"":"[dead]")},r.prototype.finalizeCreation=function(){if(this.state===F.CREATED){if(this.parent){if(this.parent.state!==F.FINALIZED)return;this.fireHook("afterAttach")}this.state=F.FINALIZED;for(var t=0,e=this.getChildren();t<e.length;t++){var n=e[t];n instanceof r&&n.finalizeCreation()}}},r.prototype.detach=function(){this.isAlive||et("Error while detaching, node is not alive."),this.isRoot||(this.fireHook("beforeDetach"),this._environment=this.root._environment,this.state=F.DETACHING,this.identifierCache=this.root.identifierCache.splitCache(this),this.parent.removeChild(this.subpath),this.parent=null,this.subpath=this.escapedSubpath="",this.subpathAtom.reportChanged(),this.state=F.FINALIZED)},r.prototype.preboot=function(){var n=this;this.applyPatches=O(this.storedValue,"@APPLY_PATCHES",function(t){t.forEach(function(t){var e=gt(t.path);K(n,e.slice(0,-1)).applyPatchLocally(e[e.length-1],t)})}),this.applySnapshot=O(this.storedValue,"@APPLY_SNAPSHOT",function(t){if(t!==n.snapshot)return n.type.applySnapshot(n,t)}),ct(this.storedValue,"$treenode",this),ct(this.storedValue,"toJSON",Y)},r.prototype.die=function(){this.state!==F.DETACHING&&W(this.storedValue)&&(f(this.storedValue,function(t){var e=J(t);e instanceof r&&e.aboutToDie()}),f(this.storedValue,function(t){var e=J(t);e instanceof r&&e.finalizeDeath()}))},r.prototype.aboutToDie=function(){this._disposers&&(this._disposers.forEach(function(t){return t()}),this._disposers=null),this.fireHook("beforeDestroy")},r.prototype.finalizeDeath=function(){var t,e,n;this.root.identifierCache.notifyDied(this),e="snapshot",n=(t=this).snapshot,Object.defineProperty(t,e,{enumerable:!0,writable:!1,configurable:!0,value:n}),this._patchSubscribers&&(this._patchSubscribers=null),this._snapshotSubscribers&&(this._snapshotSubscribers=null),this.state=F.DEAD,this.subpath=this.escapedSubpath="",this.parent=null,this.subpathAtom.reportChanged()},r.prototype.onSnapshot=function(t){return this._addSnapshotReaction(),this._snapshotSubscribers||(this._snapshotSubscribers=[]),lt(this._snapshotSubscribers,t)},r.prototype.emitSnapshot=function(e){this._snapshotSubscribers&&this._snapshotSubscribers.forEach(function(t){return t(e)})},r.prototype.onPatch=function(t){return this._patchSubscribers||(this._patchSubscribers=[]),lt(this._patchSubscribers,t)},r.prototype.emitPatch=function(t,e){var n=this._patchSubscribers;if(n&&n.length){var r=function(t){"oldValue"in t||et("Patches without `oldValue` field cannot be inversed");return[function(t){switch(t.op){case"add":return{op:"add",path:t.path,value:t.value};case"remove":return{op:"remove",path:t.path};case"replace":return{op:"replace",path:t.path,value:t.value}}}(t),function(t){switch(t.op){case"add":return{op:"remove",path:t.path};case"remove":return{op:"add",path:t.path,value:t.oldValue};case"replace":return{op:"replace",path:t.path,value:t.oldValue}}}(t)]}(function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0;r<e.length;r++){var i=e[r];for(var o in i)t[o]=i[o]}return t}({},t,{path:e.path.substr(this.path.length)+"/"+t.path})),i=r[0],o=r[1];n.forEach(function(t){return t(i,o)})}this.parent&&this.parent.emitPatch(t,e)},r.prototype.addDisposer=function(t){this._disposers?this._disposers.unshift(t):this._disposers=[t]},r.prototype.removeMiddleware=function(e){this.middlewares&&(this.middlewares=this.middlewares.filter(function(t){return t.handler!==e}))},r.prototype.addMiddleWare=function(t,e){var n=this;return void 0===e&&(e=!0),this.middlewares?this.middlewares.push({handler:t,includeHooks:e}):this.middlewares=[{handler:t,includeHooks:e}],function(){n.removeMiddleware(t)}},r.prototype.applyPatchLocally=function(t,e){this.assertWritable(),this._observableInstanceCreated||this._createObservableInstance(),this.type.applyPatchLocally(this,t,e)},r.prototype._addSnapshotReaction=function(){var e=this;if(!this._hasSnapshotReaction){var t=l.reaction(function(){return e.snapshot},function(t){return e.emitSnapshot(t)},g);this.addDisposer(t),this._hasSnapshotReaction=!0}},n([l.action],r.prototype,"_createObservableInstance",null),n([l.computed],r.prototype,"snapshot",null),n([l.action],r.prototype,"detach",null),n([l.action],r.prototype,"die",null),r}();(b=v||(v={}))[b.String=1]="String",b[b.Number=2]="Number",b[b.Boolean=4]="Boolean",b[b.Date=8]="Date",b[b.Literal=16]="Literal",b[b.Array=32]="Array",b[b.Map=64]="Map",b[b.Object=128]="Object",b[b.Frozen=256]="Frozen",b[b.Optional=512]="Optional",b[b.Reference=1024]="Reference",b[b.Identifier=2048]="Identifier",b[b.Late=4096]="Late",b[b.Refinement=8192]="Refinement",b[b.Union=16384]="Union",b[b.Null=32768]="Null",b[b.Undefined=65536]="Undefined",b[b.Integer=131072]="Integer";var A=function(){function t(t){this.isType=!0,this.name=t}return t.prototype.create=function(t,e){return void 0===t&&(t=this.getDefaultSnapshot()),this.instantiate(null,"",e,t).value},t.prototype.initializeChildNodes=function(t,e){return X},t.prototype.createNewInstance=function(t,e,n){return n},t.prototype.finalizeNewInstance=function(t,e){},t.prototype.processInitialSnapshot=function(t,e){return e},t.prototype.isAssignableFrom=function(t){return t===this},t.prototype.validate=function(t,e){return W(t)?u(t)===this||this.isAssignableFrom(u(t))?k():z(e,t):this.isValidSnapshot(t,e)},t.prototype.is=function(t){return 0===this.validate(t,[{path:"",type:this}]).length},t.prototype.reconcile=function(t,e){if(t.snapshot===e)return t;if(W(e)&&J(e)===t)return t;if(t.type===this&&st(e)&&!W(e)&&(!t.identifierAttribute||t.identifier===""+e[t.identifierAttribute]))return t.applySnapshot(e),t;var n=t.parent,r=t.subpath;if(t.die(),W(e)&&this.isAssignableFrom(u(e))){var i=J(e);return i.setParent(n,r),i}return this.instantiate(n,r,t._environment,e)},Object.defineProperty(t.prototype,"Type",{get:function(){return et("Factory.Type should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.Type`")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"SnapshotType",{get:function(){return et("Factory.SnapshotType should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.SnapshotType`")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"CreationType",{get:function(){return et("Factory.CreationType should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.CreationType`")},enumerable:!0,configurable:!0}),n([l.action],t.prototype,"create",null),t}(),w=function(e){function t(t){return e.call(this,t)||this}return a(t,e),t.prototype.getValue=function(t){return t.storedValue},t.prototype.getSnapshot=function(t){return t.storedValue},t.prototype.getDefaultSnapshot=function(){},t.prototype.applySnapshot=function(t,e){et("Immutable types do not support applying snapshots")},t.prototype.applyPatchLocally=function(t,e,n){et("Immutable types do not support applying patches")},t.prototype.getChildren=function(t){return Q},t.prototype.getChildNode=function(t,e){return et("No child '"+e+"' available in type: "+this.name)},t.prototype.getChildType=function(t){return et("No child '"+t+"' available in type: "+this.name)},t.prototype.reconcile=function(t,e){if(t.type===this&&t.storedValue===e)return t;var n=this.instantiate(t.parent,t.subpath,t._environment,e);return t.die(),n},t.prototype.removeChild=function(t,e){return et("No child '"+e+"' available in type: "+this.name)},t}(A);function S(t){return"object"==typeof t&&t&&!0===t.isType}var P=new Map;function V(t){return{$MST_UNSERIALIZABLE:!0,type:t}}function _(e,t){l.runInAction(function(){ot(t).forEach(function(t){return function(t,e){var n=h(t,e.path||"");if(!n)return et("Invalid action path: "+(e.path||""));var r=J(n);if("@APPLY_PATCHES"===e.name)return s.call(null,n,e.args[0]);if("@APPLY_SNAPSHOT"===e.name)return p.call(null,n,e.args[0]);"function"!=typeof n[e.name]&&et("Action '"+e.name+"' does not exist in '"+r.path+"'");return n[e.name].apply(n,e.args?e.args.map(function(t){return(e=t)&&"object"==typeof e&&"$MST_DATE"in e?new Date(e.$MST_DATE):e;var e}):[])}(e,t)})})}function T(o,a,s){return void 0===s&&(s=!1),E(o,function(n,t){if("action"===n.type&&n.id===n.rootId){var e=J(n.context),r={name:n.name,path:G(J(o),e),args:n.args.map(function(t,e){return function(t,e,n,r){if(r instanceof Date)return{$MST_DATE:r.getTime()};if(ut(r))return r;if(W(r))return V("[MSTNode: "+u(r).name+"]");if("function"==typeof r)return V("[function]");if("object"==typeof r&&!at(r)&&!it(r))return V("[object "+(r&&r.constructor&&r.constructor.name||"Complex Object")+"]");try{return JSON.stringify(r),r}catch(t){return V(""+t)}}(0,n.name,0,t)})};if(s){var i=t(n);return a(r),i}return a(r),t(n)}return t(n)})}var N=1,C=null;function I(){return N++}function j(t,e){var n=J(t.context),r=n._isRunningAction,i=C;"action"===t.type&&n.assertAlive(),n._isRunningAction=!0,C=t;try{return function(t,e,s){var u=function(t,e,n){var r=n.$mst_middleware||Q,i=t;for(;i;)i.middlewares&&(r=r.concat(i.middlewares)),i=i.parent;return r}(t,0,s);if(!u.length)return l.action(s).apply(null,e.args);var p=0,c=null;return function n(t){var e=u[p++];var r=e&&e.handler;function i(t,e){c=e?e(n(t)||c):n(t)}function o(t){c=t}var a=function(){return r(t,i,o),c};return r&&e.includeHooks?a():r&&!e.includeHooks?Ct[t.name]?n(t):a():l.action(s).apply(null,t.args)}(e)}(n,t,e)}finally{C=i,n._isRunningAction=r}}function O(e,n,r){var t=function(){var t=I();return j({type:"action",name:n,id:t,args:ht(arguments),context:e,tree:c(e),rootId:C?C.rootId:t,parentId:C?C.id:0},r)};return t._isMSTAction=!0,t}function E(t,e,n){return void 0===n&&(n=!0),J(t).addMiddleWare(e,n)}function D(t){return"function"==typeof t?"<function"+(t.name?" "+t.name:"")+">":W(t)?"<"+t+">":"`"+function(t){try{return JSON.stringify(t)}catch(t){return"<Unserializable: "+t+">"}}(t)+"`"}function x(t){var e=t.value,n=t.context[t.context.length-1].type,r=t.context.map(function(t){return t.path}).filter(function(t){return 0<t.length}).join("/"),i=0<r.length?'at path "/'+r+'" ':"",o=W(e)?"value of type "+J(e).type.name+":":ut(e)?"value":"snapshot",a=n&&W(e)&&n.is(J(e).snapshot);return""+i+o+" "+D(e)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(t.message?" ("+t.message+")":"")+(n?Jt(n)||ut(e)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function R(t,e,n){return t.concat([{path:e,type:n}])}function k(){return Q}function z(t,e,n){return[{context:t,value:e,message:n}]}function M(t){return t.reduce(function(t,e){return t.concat(e)},[])}function L(t,e){var n,r=t.validate(e,[{path:"",type:t}]);0<r.length&&et("Error while converting "+((n=D(e)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `"+t.name+"`:\n\n "+r.map(x).join("\n "))}var F,U,H=function(){function e(){this.cache=l.observable.map()}return e.prototype.addNodeToCache=function(t){if(t.identifierAttribute){var e=t.identifier;this.cache.has(e)||this.cache.set(e,l.observable.array([],tt));var n=this.cache.get(e);-1!==n.indexOf(t)&&et("Already registered"),n.push(t)}return this},e.prototype.mergeCache=function(t){var e=this;l.values(t.identifierCache.cache).forEach(function(t){return t.forEach(function(t){e.addNodeToCache(t)})})},e.prototype.notifyDied=function(t){if(t.identifierAttribute){var e=this.cache.get(t.identifier);e&&e.remove(t)}},e.prototype.splitCache=function(t){var n=new e,r=t.path;return l.values(this.cache).forEach(function(t){for(var e=t.length-1;0<=e;e--)0===t[e].path.indexOf(r)&&(n.addNodeToCache(t[e]),t.splice(e,1))}),n},e.prototype.resolve=function(e,t){var n=this.cache.get(""+t);if(!n)return null;var r=n.filter(function(t){return e.isAssignableFrom(t.type)});switch(r.length){case 0:return null;case 1:return r[0];default:return et("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map(function(t){return t.path}).join(", "))}},e}();function $(t,e,n,r,i){var o,a=(o=i)&&o.$treenode||null;if(a){if(a.isRoot)return a.setParent(e,n),a;et("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(e?e.path:"")+"/"+n+"', but it lives already at '"+a.path+"'")}return new(t.shouldAttachNode?m:d)(t,e,n,r,i)}function W(t){return!(!t||!t.$treenode)}function J(t){return W(t)?t.$treenode:et("Value "+t+" is no MST Node")}function Y(){return J(this).snapshot}(U=F||(F={}))[U.INITIALIZING=0]="INITIALIZING",U[U.CREATED=1]="CREATED",U[U.FINALIZED=2]="FINALIZED",U[U.DETACHING=3]="DETACHING",U[U.DEAD=4]="DEAD";var Z=function(t){return".."};function G(t,e){t.root!==e.root&&et("Cannot calculate relative path: objects '"+t+"' and '"+e+"' are not part of the same object tree");for(var n=gt(t.path),r=gt(e.path),i=0;i<n.length&&n[i]===r[i];i++);return n.slice(i).map(Z).join("/")+bt(r.slice(i))}function B(t,e,n){return void 0===n&&(n=!0),K(t,gt(e),n)}function K(t,e,n){void 0===n&&(n=!0);for(var r=t,i=0;i<e.length;i++){var o=e[i];if(""!==o){if(".."===o){if(r=r.parent)continue}else{if("."===o||""===o)continue;if(r){if(r instanceof d)try{var a=r.value;W(a)&&(r=J(a))}catch(t){if(!n)return;throw t}if(r instanceof m)if(r.getChildType(o)&&(r=r.getChildNode(o)))continue}}return n?et("Could not resolve '"+o+"' in path '"+(bt(e.slice(0,i))||"/")+"' while resolving '"+bt(e)+"'"):void 0}r=r.root}return r}function q(n){if(!n)return Q;var t=Object.keys(n);if(!t.length)return Q;var r=new Array(t.length);return t.forEach(function(t,e){r[e]=n[t]}),r}var Q=Object.freeze([]),X=Object.freeze({}),tt="string"==typeof l.$mobx?{deep:!1}:{deep:!1,proxy:!1};function et(t){throw void 0===t&&(t="Illegal state"),new Error("[mobx-state-tree] "+t)}function nt(t){return t}Object.freeze(tt);var rt=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t};function it(t){return!(!Array.isArray(t)&&!l.isObservableArray(t))}function ot(t){return t?it(t)?t:[t]:Q}function at(t){if(null===t||"object"!=typeof t)return!1;var e=Object.getPrototypeOf(t);return e===Object.prototype||null===e}function st(t){return!(null===t||"object"!=typeof t||t instanceof Date||t instanceof RegExp)}function ut(t){return null==t||("string"==typeof t||"number"==typeof t||"boolean"==typeof t||t instanceof Date)}function pt(t){return t}function ct(t,e,n){Object.defineProperty(t,e,{enumerable:!1,writable:!1,configurable:!0,value:n})}function lt(r,i){return r.push(i),function(){var t,e,n;e=i,-1!==(n=(t=r).indexOf(e))&&t.splice(n,1)}}function ht(t){for(var e=new Array(t.length),n=0;n<t.length;n++)e[n]=t[n];return e}var ft=function(t,e){};function dt(t){return l=t.name,h=t,f=function(){var s=I(),u=C||et("Not running an action!"),p=arguments;function c(t,e,n){t.$mst_middleware=f.$mst_middleware,j({name:l,type:e,id:s,args:[n],tree:u.tree,context:u.context,parentId:u.id,rootId:u.rootId},t)}return new Promise(function(e,n){var r,t=function(){r=h.apply(null,arguments),i(void 0)};function i(t){var e;try{c(function(t){e=r.next(t)},"flow_resume",t)}catch(e){return void setImmediate(function(){c(function(t){n(e)},"flow_throw",e)})}a(e)}function o(t){var e;try{c(function(t){e=r.throw(t)},"flow_resume_error",t)}catch(e){return void setImmediate(function(){c(function(t){n(e)},"flow_throw",e)})}a(e)}function a(t){if(!t.done)return t.value&&"function"==typeof t.value.then||et("Only promises can be yielded to `async`, got: "+t),t.value.then(i,o);setImmediate(function(){c(function(t){e(t)},"flow_return",t.value)})}t.$mst_middleware=f.$mst_middleware,j({name:l,type:"flow_spawn",id:s,args:ht(p),tree:u.tree,context:u.context,parentId:u.id,rootId:u.rootId},t)})};var l,h,f}function yt(t){return!0==("number"==typeof t)?""+t:t.replace(/~/g,"~1").replace(/\//g,"~0")}function vt(t){return t.replace(/~0/g,"/").replace(/~1/g,"~")}function bt(t){return 0===t.length?"":"/"+t.map(yt).join("/")}function gt(t){var e=t.split("/").map(vt);return""===e[0]?e.slice(1):e}ft.ids={};var mt,At,wt="Map.put can only be used to store complex values that have an identifier type attribute";(At=mt||(mt={}))[At.UNKNOWN=0]="UNKNOWN",At[At.YES=1]="YES",At[At.NO=2]="NO";var St=function(n){function t(t){return n.call(this,t,l.observable.ref.enhancer)||this}return a(t,n),t.prototype.get=function(t){return n.prototype.get.call(this,""+t)},t.prototype.has=function(t){return n.prototype.has.call(this,""+t)},t.prototype.delete=function(t){return n.prototype.delete.call(this,""+t)},t.prototype.set=function(t,e){return n.prototype.set.call(this,""+t,e)},t.prototype.put=function(t){if(t||et("Map.put cannot be used to set empty values"),W(t)){var e=J(t),n=e.identifier;return this.set(n,e.value),e.value}if(st(t)){n=void 0;var r=J(this).type;return r.identifierMode===mt.NO?et(wt):r.identifierMode===mt.YES?(n=""+t[r.identifierAttribute],this.set(n,t),this.get(n)):et(wt)}return et("Map.put can only be used to store complex values")},t}(l.ObservableMap),Pt=function(r){function t(t,e){var n=r.call(this,t)||this;return n.shouldAttachNode=!0,n.identifierMode=mt.UNKNOWN,n.identifierAttribute=void 0,n.flags=v.Map,n.subType=e,n._determineIdentifierMode(),n}return a(t,r),t.prototype.instantiate=function(t,e,n,r){return this.identifierMode===mt.UNKNOWN&&this._determineIdentifierMode(),$(this,t,e,n,r)},t.prototype._determineIdentifierMode=function(){var t=[];if(function t(e,n){if(e instanceof Rt)n.push(e);else if(e instanceof qt){if(!t(e.type,n))return!1}else if(e instanceof Bt){for(var r=0;r<e.types.length;r++)if(!t(e.types[r],n))return!1}else if(e instanceof ee){var i=e.getSubType(!1);if(!i)return!1;t(i,n)}return!0}(this.subType,t)){var e=void 0;t.forEach(function(t){t.identifierAttribute&&(e&&e!==t.identifierAttribute&&et("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier"),e=t.identifierAttribute)}),e?(this.identifierMode=mt.YES,this.identifierAttribute=e):this.identifierMode=mt.NO}},t.prototype.initializeChildNodes=function(e,n){void 0===n&&(n={});var r=e.type.subType,i=e._environment,o={};return Object.keys(n).forEach(function(t){o[t]=r.instantiate(e,t,i,n[t])}),o},t.prototype.createNewInstance=function(t,e,n){return new St(e)},t.prototype.finalizeNewInstance=function(t,e){l._interceptReads(e,t.unbox),l.intercept(e,this.willChange),l.observe(e,this.didChange)},t.prototype.describe=function(){return"Map<string, "+this.subType.describe()+">"},t.prototype.getChildren=function(t){return l.values(t.storedValue)},t.prototype.getChildNode=function(t,e){var n=t.storedValue.get(""+e);return n||et("Not a child "+e),n},t.prototype.willChange=function(t){var e=J(t.object),n=t.name;e.assertWritable();var r=e.type,i=r.subType;switch(t.type){case"update":var o=t.newValue;if(o===t.object.get(n))return null;t.newValue=i.reconcile(e.getChildNode(n),t.newValue),r.processIdentifier(n,t.newValue);break;case"add":t.newValue,t.newValue=i.instantiate(e,n,void 0,t.newValue),r.processIdentifier(n,t.newValue)}return t},t.prototype.processIdentifier=function(t,e){if(this.identifierMode===mt.YES&&e instanceof m){var n=e.identifier;n!==t&&et("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+t+"'")}},t.prototype.getValue=function(t){return t.storedValue},t.prototype.getSnapshot=function(t){var e={};return t.getChildren().forEach(function(t){e[t.subpath]=t.snapshot}),e},t.prototype.processInitialSnapshot=function(e,t){var n={};return Object.keys(e).forEach(function(t){n[t]=e[t].getSnapshot()}),n},t.prototype.didChange=function(t){var e=J(t.object);switch(t.type){case"update":return void e.emitPatch({op:"replace",path:yt(t.name),value:t.newValue.snapshot,oldValue:t.oldValue?t.oldValue.snapshot:void 0},e);case"add":return void e.emitPatch({op:"add",path:yt(t.name),value:t.newValue.snapshot,oldValue:void 0},e);case"delete":var n=t.oldValue.snapshot;return t.oldValue.die(),void e.emitPatch({op:"remove",path:yt(t.name),oldValue:n},e)}},t.prototype.applyPatchLocally=function(t,e,n){var r=t.storedValue;switch(n.op){case"add":case"replace":r.set(e,n.value);break;case"remove":r.delete(e)}},t.prototype.applySnapshot=function(t,e){var n=t.storedValue,r={};for(var i in Array.from(n.keys()).forEach(function(t){r[t]=!1}),e)n.set(i,e[i]),r[""+i]=!0;Object.keys(r).forEach(function(t){!1===r[t]&&n.delete(t)})},t.prototype.getChildType=function(t){return this.subType},t.prototype.isValidSnapshot=function(e,n){var r=this;return at(e)?M(Object.keys(e).map(function(t){return r.subType.validate(e[t],R(n,t,r.subType))})):z(n,e,"Value is not a plain object")},t.prototype.getDefaultSnapshot=function(){return X},t.prototype.removeChild=function(t,e){t.storedValue.delete(e)},n([l.action],t.prototype,"applySnapshot",null),t}(A);var Vt=function(r){function t(t,e){var n=r.call(this,t)||this;return n.shouldAttachNode=!0,n.flags=v.Array,n.subType=e,n}return a(t,r),t.prototype.instantiate=function(t,e,n,r){return $(this,t,e,n,r)},t.prototype.initializeChildNodes=function(r,t){void 0===t&&(t=[]);var i=r.type.subType,o=r._environment,a={};return t.forEach(function(t,e){var n=""+e;a[n]=i.instantiate(r,n,o,t)}),a},t.prototype.createNewInstance=function(t,e,n){return l.observable.array(q(e),tt)},t.prototype.finalizeNewInstance=function(t,e){l._getAdministration(e).dehancer=t.unbox,l.intercept(e,this.willChange),l.observe(e,this.didChange)},t.prototype.describe=function(){return this.subType.describe()+"[]"},t.prototype.getChildren=function(t){return t.storedValue.slice()},t.prototype.getChildNode=function(t,e){var n=parseInt(e,10);return n<t.storedValue.length?t.storedValue[n]:et("Not a child: "+e)},t.prototype.willChange=function(t){var e=J(t.object);e.assertWritable();var n=e.type.subType,r=e.getChildren(),i=null;switch(t.type){case"update":if(t.newValue===t.object[t.index])return null;if(!(i=_t(e,n,[r[t.index]],[t.newValue],[t.index])))return null;t.newValue=i[0];break;case"splice":var o=t.index,a=t.removedCount,s=t.added;if(!(i=_t(e,n,r.slice(o,o+a),s,s.map(function(t,e){return o+e}))))return null;t.added=i;for(var u=o+a;u<r.length;u++)r[u].setParent(e,""+(u+s.length-a))}return t},t.prototype.getValue=function(t){return t.storedValue},t.prototype.getSnapshot=function(t){return t.getChildren().map(function(t){return t.snapshot})},t.prototype.processInitialSnapshot=function(e,t){var n=[];return Object.keys(e).forEach(function(t){n.push(e[t].getSnapshot())}),n},t.prototype.didChange=function(t){var e=J(t.object);switch(t.type){case"update":return void e.emitPatch({op:"replace",path:""+t.index,value:t.newValue.snapshot,oldValue:t.oldValue?t.oldValue.snapshot:void 0},e);case"splice":for(var n=t.removedCount-1;0<=n;n--)e.emitPatch({op:"remove",path:""+(t.index+n),oldValue:t.removed[n].snapshot},e);for(n=0;n<t.addedCount;n++)e.emitPatch({op:"add",path:""+(t.index+n),value:e.getChildNode(""+(t.index+n)).snapshot,oldValue:void 0},e);return}},t.prototype.applyPatchLocally=function(t,e,n){var r=t.storedValue,i="-"===e?r.length:parseInt(e);switch(n.op){case"replace":r[i]=n.value;break;case"add":r.splice(i,0,n.value);break;case"remove":r.splice(i,1)}},t.prototype.applySnapshot=function(t,e){t.storedValue.replace(e)},t.prototype.getChildType=function(t){return this.subType},t.prototype.isValidSnapshot=function(t,n){var r=this;return it(t)?M(t.map(function(t,e){return r.subType.validate(t,R(n,""+e,r.subType))})):z(n,t,"Value is not an array")},t.prototype.getDefaultSnapshot=function(){return Q},t.prototype.removeChild=function(t,e){t.storedValue.splice(parseInt(e,10),1)},n([l.action],t.prototype,"applySnapshot",null),t}(A);function _t(t,e,n,r,i){for(var o,a,s,u=!1,p=void 0,c=!0,l=0;u=l<=r.length-1,o=n[l],a=u?r[l]:void 0,((s=a)instanceof d||s instanceof m)&&(a=a.storedValue),o||u;l++)if(u)if(o)if(Nt(o,a))n[l]=Tt(e,t,""+i[l],a,o);else{p=void 0;for(var h=l;h<n.length;h++)if(Nt(n[h],a)){p=n.splice(h,1)[0];break}n.splice(l,0,Tt(e,t,""+i[l],a,p)),c=!1}else W(a)&&J(a).parent===t&&et("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+t.path+"/"+i[l]+"', but it lives already at '"+J(a).path+"'"),n.splice(l,0,Tt(e,t,""+i[l],a)),c=!1;else o.die(),n.splice(l,1),l--,c=!1;return c?null:n}function Tt(t,e,n,r,i){var o;if(W(r)&&((o=J(r)).assertAlive(),null!==o.parent&&o.parent===e))return o.setParent(e,n),i&&i!==o&&i.die(),o;return i?((o=t.reconcile(i,r)).setParent(e,n),o):t.instantiate(e,n,e._environment,r)}function Nt(t,e){return W(e)?J(e)===t:t.snapshot===e||!!(t instanceof m&&null!==t.identifier&&t.identifierAttribute&&at(e)&&t.identifier===""+e[t.identifierAttribute])}var Ct,It,jt="preProcessSnapshot",Ot="postProcessSnapshot";function Et(){return J(this).toString()}(It=Ct||(Ct={})).afterCreate="afterCreate",It.afterAttach="afterAttach",It.beforeDetach="beforeDetach",It.beforeDestroy="beforeDestroy";var Dt={name:"AnonymousModel",properties:{},initializers:Q};function xt(t){return Object.keys(t).reduce(function(t,e){var n,r,i;if(e in Ct)return et("Hook '"+e+"' was defined as property. Hooks should be defined as part of the actions");var o=Object.getOwnPropertyDescriptor(t,e);"get"in o&&et("Getters are not supported as properties. Please use views instead");var a=o.value;if(null==a)et("The default value of an attribute cannot be null or undefined as the type cannot be inferred. Did you mean `types.maybe(someType)`?");else{if(ut(a))return Object.assign({},t,((n={})[e]=Qt(function(t){switch(typeof t){case"string":return Mt;case"number":return Lt;case"boolean":return Ut;case"object":if(t instanceof Date)return Wt}return et("Cannot determine primitive type from value "+t)}(a),a),n));if(a instanceof Pt)return Object.assign({},t,((r={})[e]=Qt(a,{}),r));if(a instanceof Vt)return Object.assign({},t,((i={})[e]=Qt(a,[]),i));if(S(a))return t;et("Invalid type definition for property '"+e+"', cannot infer a type from a value like '"+a+"' ("+typeof a+")")}},t)}var Rt=function(r){function e(t){var e=r.call(this,t.name||Dt.name)||this;e.flags=v.Object,e.shouldAttachNode=!0;var n=t.name||Dt.name;return/^\w[\w\d_]*$/.test(n)||et("Typename should be a valid identifier: "+n),Object.assign(e,Dt,t),e.properties=xt(e.properties),pt(e.properties),e.propertyNames=Object.keys(e.properties),e.identifierAttribute=e._getIdentifierAttribute(),e}return a(e,r),e.prototype._getIdentifierAttribute=function(){var n=void 0;return this.forAllProps(function(t,e){e.flags&v.Identifier&&(n&&et("Cannot define property '"+t+"' as object identifier, property '"+n+"' is already defined as identifier property"),n=t)}),n},e.prototype.cloneAndEnhance=function(t){return new e({name:t.name||this.name,properties:Object.assign({},this.properties,t.properties),initializers:this.initializers.concat(t.initializers||[]),preProcessor:t.preProcessor||this.preProcessor,postProcessor:t.postProcessor||this.postProcessor})},e.prototype.actions=function(e){var n=this;return this.cloneAndEnhance({initializers:[function(t){return n.instantiateActions(t,e(t)),t}]})},e.prototype.instantiateActions=function(i,o){at(o)||et("actions initializer should return a plain object containing actions"),Object.keys(o).forEach(function(t){t===jt&&et("Cannot define action '"+jt+"', it should be defined using 'type.preProcessSnapshot(fn)' instead"),t===Ot&&et("Cannot define action '"+Ot+"', it should be defined using 'type.postProcessSnapshot(fn)' instead");var e=o[t],n=i[t];if(t in Ct&&n){var r=e;e=function(){n.apply(null,arguments),r.apply(null,arguments)}}ct(i,t,O(i,t,e))})},e.prototype.named=function(t){return this.cloneAndEnhance({name:t})},e.prototype.props=function(t){return this.cloneAndEnhance({properties:t})},e.prototype.volatile=function(e){var n=this;return this.cloneAndEnhance({initializers:[function(t){return n.instantiateVolatileState(t,e(t)),t}]})},e.prototype.instantiateVolatileState=function(t,e){at(e)||et("volatile state initializer should return a plain object containing state"),l.set(t,e)},e.prototype.extend=function(s){var u=this;return this.cloneAndEnhance({initializers:[function(t){var e=s(t),n=e.actions,r=e.views,i=e.state,o=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&(n[r[i]]=t[r[i]])}return n}(e,["actions","views","state"]);for(var a in o)et("The `extend` function should return an object with a subset of the fields 'actions', 'views' and 'state'. Found invalid key '"+a+"'");return i&&u.instantiateVolatileState(t,i),r&&u.instantiateViews(t,r),n&&u.instantiateActions(t,n),t}]})},e.prototype.views=function(e){var n=this;return this.cloneAndEnhance({initializers:[function(t){return n.instantiateViews(t,e(t)),t}]})},e.prototype.instantiateViews=function(i,o){at(o)||et("views initializer should return a plain object containing views"),Object.keys(o).forEach(function(t){var e=Object.getOwnPropertyDescriptor(o,t),n=e.value;if("get"in e)if(l.isComputedProp(i,t)){var r=l._getAdministration(i,t);r.derivation=e.get,r.scope=i,e.set&&(r.setter=l.action(r.name+"-setter",e.set))}else l.computed(i,t,e,!0);else"function"==typeof n?ct(i,t,n):et("A view member should either be a function or getter based property")})},e.prototype.preProcessSnapshot=function(e){var n=this.preProcessor;return n?this.cloneAndEnhance({preProcessor:function(t){return n(e(t))}}):this.cloneAndEnhance({preProcessor:e})},e.prototype.postProcessSnapshot=function(e){var n=this.postProcessor;return n?this.cloneAndEnhance({postProcessor:function(t){return e(n(t))}}):this.cloneAndEnhance({postProcessor:e})},e.prototype.instantiate=function(t,e,n,r){return $(this,t,e,n,W(r)?r:this.applySnapshotPreProcessor(r))},e.prototype.initializeChildNodes=function(n,r){void 0===r&&(r={});var t=n.type,i={};return t.forAllProps(function(t,e){i[t]=e.instantiate(n,t,n._environment,r[t])}),i},e.prototype.createNewInstance=function(t,e,n){return l.observable.object(e,X,tt)},e.prototype.finalizeNewInstance=function(e,n){ct(n,"toString",Et),this.forAllProps(function(t){l._interceptReads(n,t,e.unbox)}),this.initializers.reduce(function(t,e){return e(t)},n),l.intercept(n,this.willChange),l.observe(n,this.didChange)},e.prototype.willChange=function(t){var e=J(t.object);e.assertWritable();var n=e.type.properties[t.name];return n&&(t.newValue,t.newValue=n.reconcile(e.getChildNode(t.name),t.newValue)),t},e.prototype.didChange=function(t){var e=J(t.object);if(e.type.properties[t.name]){var n=t.oldValue?t.oldValue.snapshot:void 0;e.emitPatch({op:"replace",path:yt(t.name),value:t.newValue.snapshot,oldValue:n},e)}},e.prototype.getChildren=function(n){var r=this,i=[];return this.forAllProps(function(t,e){i.push(r.getChildNode(n,t))}),i},e.prototype.getChildNode=function(t,e){if(!(e in this.properties))return et("Not a value property: "+e);var n=l._getAdministration(t.storedValue,e).value;return n||et("Node not available for property "+e)},e.prototype.getValue=function(t){return t.storedValue},e.prototype.getSnapshot=function(n,t){var r=this;void 0===t&&(t=!0);var i={};return this.forAllProps(function(t,e){l.getAtom(n.storedValue,t).reportObserved(),i[t]=r.getChildNode(n,t).snapshot}),t?this.applySnapshotPostProcessor(i):i},e.prototype.processInitialSnapshot=function(e,t){var n={};return Object.keys(e).forEach(function(t){n[t]=e[t].getSnapshot()}),this.applySnapshotPostProcessor(this.applyOptionalValuesToSnapshot(n))},e.prototype.applyPatchLocally=function(t,e,n){"replace"!==n.op&&"add"!==n.op&&et("object does not support operation "+n.op),t.storedValue[e]=n.value},e.prototype.applySnapshot=function(n,t){var r=this.applySnapshotPreProcessor(t);this.forAllProps(function(t,e){n.storedValue[t]=r[t]})},e.prototype.applySnapshotPreProcessor=function(t){var e=this.preProcessor;return e?e.call(null,t):t},e.prototype.applyOptionalValuesToSnapshot=function(r){return r&&(r=Object.assign({},r),this.forAllProps(function(t,e){if(!(t in r)){var n=kt(e);n&&(r[t]=n.getDefaultValueSnapshot())}})),r},e.prototype.applySnapshotPostProcessor=function(t){var e=this.postProcessor;return e?e.call(null,t):t},e.prototype.getChildType=function(t){return this.properties[t]},e.prototype.isValidSnapshot=function(t,e){var n=this,r=this.applySnapshotPreProcessor(t);return at(r)?M(this.propertyNames.map(function(t){return n.properties[t].validate(r[t],R(e,t,n.properties[t]))})):z(e,r,"Value is not a plain object")},e.prototype.forAllProps=function(e){var n=this;this.propertyNames.forEach(function(t){return e(t,n.properties[t])})},e.prototype.describe=function(){var e=this;return"{ "+this.propertyNames.map(function(t){return t+": "+e.properties[t].describe()}).join("; ")+" }"},e.prototype.getDefaultSnapshot=function(){return X},e.prototype.removeChild=function(t,e){t.storedValue[e]=void 0},n([l.action],e.prototype,"applySnapshot",null),e}(A);function kt(t){if(t)return t.flags&v.Union&&t.types?t.types.find(kt):t.flags&v.Late&&t.getSubType&&t.getSubType(!1)?kt(t.subType):t.flags&v.Optional?t:void 0}var zt=function(o){function t(t,e,n,r){void 0===r&&(r=nt);var i=o.call(this,t)||this;return i.shouldAttachNode=!1,i.flags=e,i.checker=n,i.initializer=r,i}return a(t,o),t.prototype.describe=function(){return this.name},t.prototype.instantiate=function(t,e,n,r){return $(this,t,e,n,r)},t.prototype.createNewInstance=function(t,e,n){return this.initializer(n)},t.prototype.isValidSnapshot=function(t,e){return ut(t)&&this.checker(t)?k():z(e,t,"Value is not a "+("Date"===this.name?"Date or a unix milliseconds timestamp":this.name))},t}(w),Mt=new zt("string",v.String,function(t){return"string"==typeof t}),Lt=new zt("number",v.Number,function(t){return"number"==typeof t}),Ft=new zt("integer",v.Integer,function(t){return rt(t)}),Ut=new zt("boolean",v.Boolean,function(t){return"boolean"==typeof t}),Ht=new zt("null",v.Null,function(t){return null===t}),$t=new zt("undefined",v.Undefined,function(t){return void 0===t}),Wt=new zt("Date",v.Date,function(t){return"number"==typeof t||t instanceof Date},function(t){return t instanceof Date?t:new Date(t)});function Jt(t){return S(t)&&0<(t.flags&(v.String|v.Number|v.Integer|v.Boolean|v.Date))}Wt.getSnapshot=function(t){return t.storedValue.getTime()};var Yt=function(n){function t(t){var e=n.call(this,JSON.stringify(t))||this;return e.shouldAttachNode=!1,e.flags=v.Literal,e.value=t,e}return a(t,n),t.prototype.instantiate=function(t,e,n,r){return $(this,t,e,n,r)},t.prototype.describe=function(){return JSON.stringify(this.value)},t.prototype.isValidSnapshot=function(t,e){return ut(t)&&t===this.value?k():z(e,t,"Value is not a literal "+JSON.stringify(this.value))},t}(w);function Zt(t){return new Yt(t)}var Gt=function(o){function t(t,e,n,r){var i=o.call(this,t)||this;return i.type=e,i.predicate=n,i.message=r,i}return a(t,o),Object.defineProperty(t.prototype,"flags",{get:function(){return this.type.flags|v.Refinement},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"shouldAttachNode",{get:function(){return this.type.shouldAttachNode},enumerable:!0,configurable:!0}),t.prototype.describe=function(){return this.name},t.prototype.instantiate=function(t,e,n,r){return this.type.instantiate(t,e,n,r)},t.prototype.isAssignableFrom=function(t){return this.type.isAssignableFrom(t)},t.prototype.isValidSnapshot=function(t,e){var n=this.type.validate(t,e);if(0<n.length)return n;var r=W(t)?J(t).snapshot:t;return this.predicate(r)?k():z(e,t,this.message(t))},t}(w);var Bt=function(i){function t(t,e,n){var r=i.call(this,t)||this;return r.eager=!0,r.dispatcher=n&&n.dispatcher,n&&!n.eager&&(r.eager=!1),r.types=e,r}return a(t,i),Object.defineProperty(t.prototype,"flags",{get:function(){var e=v.Union;return this.types.forEach(function(t){e|=t.flags}),e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"shouldAttachNode",{get:function(){return this.types.some(function(t){return t.shouldAttachNode})},enumerable:!0,configurable:!0}),t.prototype.isAssignableFrom=function(e){return this.types.some(function(t){return t.isAssignableFrom(e)})},t.prototype.describe=function(){return"("+this.types.map(function(t){return t.describe()}).join(" | ")+")"},t.prototype.instantiate=function(t,e,n,r){var i=this.determineType(r);return i?i.instantiate(t,e,n,r):et("No matching type for union "+this.describe())},t.prototype.reconcile=function(t,e){var n=this.determineType(e);return n?n.reconcile(t,e):et("No matching type for union "+this.describe())},t.prototype.determineType=function(e){return this.dispatcher?this.dispatcher(e):this.types.find(function(t){return t.is(e)})},t.prototype.isValidSnapshot=function(t,e){if(this.dispatcher)return this.dispatcher(t).validate(t,e);for(var n=[],r=0,i=0;i<this.types.length;i++){var o=this.types[i].validate(t,e);if(0===o.length){if(this.eager)return k();r++}else n.push(o)}return 1===r?k():z(e,t,"No type is applicable for the union").concat(M(n))},t}(w);function Kt(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=S(t)?void 0:t,i=S(t)?[t].concat(e):e,o="("+i.map(function(t){return t.name}).join(" | ")+")";return new Bt(o,i,r)}var qt=function(r){function t(t,e){var n=r.call(this,t.name)||this;return n.type=t,n.defaultValue=e,n}return a(t,r),Object.defineProperty(t.prototype,"flags",{get:function(){return this.type.flags|v.Optional},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"shouldAttachNode",{get:function(){return this.type.shouldAttachNode},enumerable:!0,configurable:!0}),t.prototype.describe=function(){return this.type.describe()+"?"},t.prototype.instantiate=function(t,e,n,r){if(void 0===r){var i=this.getDefaultValueSnapshot();return this.type.instantiate(t,e,n,i)}return this.type.instantiate(t,e,n,r)},t.prototype.reconcile=function(t,e){return this.type.reconcile(t,this.type.is(e)&&void 0!==e?e:this.getDefaultValue())},t.prototype.getDefaultValue=function(){var t="function"==typeof this.defaultValue?this.defaultValue():this.defaultValue;return this.defaultValue,t},t.prototype.getDefaultValueSnapshot=function(){var t=this.getDefaultValue();return W(t)?J(t).snapshot:t},t.prototype.isValidSnapshot=function(t,e){return void 0===t?k():this.type.validate(t,e)},t.prototype.isAssignableFrom=function(t){return this.type.isAssignableFrom(t)},t}(w);function Qt(t,e){return new qt(t,e)}var Xt=Qt($t,void 0),te=Qt(Ht,null);var ee=function(r){function t(t,e){var n=r.call(this,t)||this;return n._subType=null,n.definition=e,n}return a(t,r),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|v.Late},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"shouldAttachNode",{get:function(){return this.getSubType(!0).shouldAttachNode},enumerable:!0,configurable:!0}),t.prototype.getSubType=function(t){if(null===this._subType){var e=void 0;try{e=this.definition()}catch(t){if(!(t instanceof ReferenceError))throw t;e=void 0}if(t&&void 0===e&&et("Late type seems to be used too early, the definition (still) returns undefined"),e)return this._subType=e}return this._subType},t.prototype.instantiate=function(t,e,n,r){return this.getSubType(!0).instantiate(t,e,n,r)},t.prototype.reconcile=function(t,e){return this.getSubType(!0).reconcile(t,e)},t.prototype.describe=function(){var t=this.getSubType(!1);return t?t.name:"<uknown late type>"},t.prototype.isValidSnapshot=function(t,e){var n=this.getSubType(!1);return n?n.validate(t,e):k()},t.prototype.isAssignableFrom=function(t){var e=this.getSubType(!1);return!!e&&e.isAssignableFrom(t)},t}(w);var ne=function(n){function t(t){var e=n.call(this,t?"frozen("+t.name+")":"frozen")||this;return e.subType=t,e.shouldAttachNode=!1,e.flags=v.Frozen,e}return a(t,n),t.prototype.describe=function(){return"<any immutable value>"},t.prototype.instantiate=function(t,e,n,r){return $(this,t,e,n,r)},t.prototype.isValidSnapshot=function(t,e){return"function"==typeof t?z(e,t,"Value is not serializable and cannot be frozen"):this.subType?this.subType.validate(t,e):k()},t}(w),re=new ne;var ie=function(){function t(t,e,n){if(this.mode=t,this.value=e,this.targetType=n,"object"===t){if(!W(e))return et("Can only store references to tree nodes, got: '"+e+"'");if(!J(e).identifierAttribute)return et("Can only store references with a defined identifier attribute.")}}return Object.defineProperty(t.prototype,"resolvedValue",{get:function(){var t=this.node,e=this.targetType,n=t.root.identifierCache.resolve(e,this.value);return n?n.value:et("Failed to resolve reference '"+this.value+"' to type '"+this.targetType.name+"' (from node: "+t.path+")")},enumerable:!0,configurable:!0}),n([l.computed],t.prototype,"resolvedValue",null),t}(),oe=function(n){function t(t){var e=n.call(this,"reference("+t.name+")")||this;return e.targetType=t,e.shouldAttachNode=!1,e.flags=v.Reference,e}return a(t,n),t.prototype.describe=function(){return this.name},t.prototype.isAssignableFrom=function(t){return this.targetType.isAssignableFrom(t)},t.prototype.isValidSnapshot=function(t,e){return"string"==typeof t||"number"==typeof t?k():z(e,t,"Value is not a valid identifier, which is a string or a number")},t}(w),ae=function(e){function t(t){return e.call(this,t)||this}return a(t,e),t.prototype.getValue=function(t){if(t.isAlive){var e=t.storedValue;return"object"===e.mode?e.value:e.resolvedValue}},t.prototype.getSnapshot=function(t){var e=t.storedValue;switch(e.mode){case"identifier":return e.value;case"object":return e.value[J(e.value).identifierAttribute]}},t.prototype.instantiate=function(t,e,n,r){var i,o=W(r)?"object":"identifier",a=$(this,t,e,n,i=new ie(o,r,this.targetType));return i.node=a},t.prototype.reconcile=function(t,e){if(t.type===this){var n=W(e)?"object":"identifier",r=t.storedValue;if(n===r.mode&&r.value===e)return t}var i=this.instantiate(t.parent,t.subpath,t._environment,e);return t.die(),i},t}(oe),se=function(r){function t(t,e){var n=r.call(this,t)||this;return n.options=e,n}return a(t,r),t.prototype.getValue=function(t){if(t.isAlive)return this.options.get(t.storedValue,t.parent?t.parent.storedValue:null)},t.prototype.getSnapshot=function(t){return t.storedValue},t.prototype.instantiate=function(t,e,n,r){return $(this,t,e,n,W(r)?this.options.set(r,t?t.storedValue:null):r)},t.prototype.reconcile=function(t,e){var n=W(e)?this.options.set(e,t?t.storedValue:null):e;if(t.type===this&&t.storedValue===n)return t;var r=this.instantiate(t.parent,t.subpath,t._environment,n);return t.die(),r},t}(oe);var ue=function(e){function t(){var t=e.call(this,"identifier")||this;return t.shouldAttachNode=!1,t.flags=v.Identifier,t}return a(t,e),t.prototype.instantiate=function(t,e,n,r){return t&&t.type instanceof Rt||et("Identifier types can only be instantiated as direct child of a model type"),$(this,t,e,n,r)},t.prototype.reconcile=function(t,e){return t.storedValue!==e?et("Tried to change identifier from '"+t.storedValue+"' to '"+e+"'. Changing identifiers is not allowed."):t},t.prototype.describe=function(){return"identifier"},t.prototype.isValidSnapshot=function(t,e){return"string"!=typeof t?z(e,t,"Value is not a valid identifier, expected a string"):k()},t}(w),pe=function(i){function t(){var t=i.call(this)||this;return t.name="identifierNumber",t}return a(t,i),t.prototype.instantiate=function(t,e,n,r){return i.prototype.instantiate.call(this,t,e,n,r)},t.prototype.isValidSnapshot=function(t,e){return"number"==typeof t?k():z(e,t,"Value is not a valid identifierNumber, expected a number")},t.prototype.reconcile=function(t,e){return i.prototype.reconcile.call(this,t,e)},t.prototype.getSnapshot=function(t){return t.storedValue},t.prototype.describe=function(){return"identifierNumber"},t}(ue),ce=new ue,le=new pe;var he=function(n){function t(t){var e=n.call(this,t.name)||this;return e.options=t,e.flags=v.Reference,e.shouldAttachNode=!1,e}return a(t,n),t.prototype.describe=function(){return this.name},t.prototype.isAssignableFrom=function(t){return t===this},t.prototype.isValidSnapshot=function(t,e){if(this.options.isTargetType(t))return k();var n=this.options.getValidationMessage(t);return n?z(e,t,"Invalid value for type '"+this.name+"': "+n):k()},t.prototype.getValue=function(t){if(t.isAlive)return t.storedValue},t.prototype.getSnapshot=function(t){return this.options.toSnapshot(t.storedValue)},t.prototype.instantiate=function(t,e,n,r){return $(this,t,e,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r))},t.prototype.reconcile=function(t,e){var n=!this.options.isTargetType(e);if(t.type===this&&(n?e===t.snapshot:e===t.storedValue))return t;var r=n?this.options.fromSnapshot(e):e,i=this.instantiate(t.parent,t.subpath,t._environment,r);return t.die(),i},t}(w),fe={enumeration:function(t,e){var n=Kt.apply(void 0,("string"==typeof t?e:t).map(function(t){return Zt(""+t)}));return"string"==typeof t&&(n.name=t),n},model:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="string"==typeof t[0]?t.shift():"AnonymousModel",r=t.shift()||{};return new Rt({name:n,properties:r})},compose:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="string"==typeof t[0]?t.shift():"AnonymousModel";return t.reduce(function(t,e){return t.cloneAndEnhance({name:t.name+"_"+e.name,properties:e.properties,initializers:e.initializers})}).named(n)},custom:function(t){return new he(t)},reference:function(t,e){return e?new se(t,e):new ae(t)},union:Kt,optional:Qt,literal:Zt,maybe:function(t){return Kt(t,Xt)},maybeNull:function(t){return Kt(t,te)},refinement:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="string"==typeof t[0]?t.shift():S(t[0])?t[0].name:null,r=t[0],i=t[1],o=t[2]?t[2]:function(t){return"Value does not respect the refinement predicate"};return new Gt(n,r,i,o)},string:Mt,boolean:Ut,number:Lt,integer:Ft,Date:Wt,map:function(t){return new Pt("map<string, "+t.name+">",t)},array:function(t){return new Vt(t.name+"[]",t)},frozen:function(t){return 0===arguments.length?re:S(t)?new ne(t):Qt(re,t)},identifier:ce,identifierNumber:le,late:function(t,e){var n="string"==typeof t?t:"late("+t.toString()+")";return new ee(n,"string"==typeof t?e:t)},undefined:$t,null:Ht};t.types=fe,t.typecheck=L,t.escapeJsonPath=yt,t.unescapeJsonPath=vt,t.joinJsonPath=bt,t.splitJsonPath=gt,t.decorate=function(t,e){var n={handler:t,includeHooks:!0};return e.$mst_middleware&&e.$mst_middleware.push(n),e.$mst_middleware=[n],e},t.addMiddleware=E,t.process=function(t){return ft("process","`process()` has been renamed to `flow()`. See https://github.com/mobxjs/mobx-state-tree/issues/399 for more information. Note that the middleware event types starting with `process` now start with `flow`."),dt(t)},t.isStateTreeNode=W,t.flow=dt,t.applyAction=_,t.onAction=T,t.recordActions=function(t){var e={actions:[],stop:function(){return n()},replay:function(t){_(t,e.actions)}},n=T(t,e.actions.push.bind(e.actions));return e},t.createActionTrackingMiddleware=function(a){return function(e,t,n){switch(e.type){case"action":if(a.filter&&!0!==a.filter(e))return t(e);var r=a.onStart(e);a.onResume(e,r),P.set(e.id,{call:e,context:r,async:!1});try{var i=t(e);return a.onSuspend(e,r),!1===P.get(e.id).async&&(P.delete(e.id),a.onSuccess(e,r,i)),i}catch(t){throw P.delete(e.id),a.onFail(e,r,t),t}case"flow_spawn":return(o=P.get(e.rootId)).async=!0,t(e);case"flow_resume":case"flow_resume_error":var o=P.get(e.rootId);a.onResume(e,o.context);try{return t(e)}finally{a.onSuspend(e,o.context)}case"flow_throw":return o=P.get(e.rootId),P.delete(e.id),a.onFail(e,o.context,e.args[0]),t(e);case"flow_return":return o=P.get(e.rootId),P.delete(e.id),a.onSuccess(e,o.context,e.args[0]),t(e)}}},t.setLivelynessChecking=function(t){e=t},t.getType=u,t.getChildType=function(t,e){return J(t).getChildType(e)},t.onPatch=o,t.onSnapshot=function(t,e){return J(t).onSnapshot(e)},t.applyPatch=s,t.recordPatches=function(e){var t=null;function n(){t||(t=o(e,function(t,e){r.rawPatches.push([t,e])}))}var r={rawPatches:[],get patches(){return this.rawPatches.map(function(t){return t[0]})},get inversePatches(){return this.rawPatches.map(function(t){return t[0],t[1]})},stop:function(){t&&t(),t=null},resume:n,replay:function(t){s(t||e,r.patches)},undo:function(t){s(t||e,r.inversePatches.slice().reverse())}};return n(),r},t.protect=function(t){var e=J(t);e.isRoot||et("`protect` can only be invoked on root nodes"),e.isProtectionEnabled=!0},t.unprotect=function(t){var e=J(t);e.isRoot||et("`unprotect` can only be invoked on root nodes"),e.isProtectionEnabled=!1},t.isProtected=function(t){return J(t).isProtected},t.applySnapshot=p,t.getSnapshot=function(t,e){void 0===e&&(e=!0);var n=J(t);return e?n.snapshot:pt(n.type.getSnapshot(n,!1))},t.hasParent=function(t,e){void 0===e&&(e=1);for(var n=J(t).parent;n;){if(0==--e)return!0;n=n.parent}return!1},t.getParent=function(t,e){void 0===e&&(e=1);for(var n=e,r=J(t).parent;r;){if(0==--n)return r.storedValue;r=r.parent}return et("Failed to find the parent of "+J(t)+" at depth "+e)},t.hasParentOfType=function(t,e){for(var n=J(t).parent;n;){if(e.is(n.storedValue))return!0;n=n.parent}return!1},t.getParentOfType=function(t,e){for(var n=J(t).parent;n;){if(e.is(n.storedValue))return n.storedValue;n=n.parent}return et("Failed to find the parent of "+J(t)+" of a given type")},t.getRoot=c,t.getPath=function(t){return J(t).path},t.getPathParts=function(t){return gt(J(t).path)},t.isRoot=function(t){return J(t).isRoot},t.resolvePath=function(t,e){var n=B(J(t),e);return n?n.value:void 0},t.resolveIdentifier=function(t,e,n){var r=J(e).root.identifierCache.resolve(t,""+n);return r?r.value:void 0},t.getIdentifier=function(t){return J(t).identifier},t.tryResolve=h,t.getRelativePath=function(t,e){return G(J(t),J(e))},t.clone=function(t,e){void 0===e&&(e=!0);var n=J(t);return n.type.create(n.snapshot,!0===e?n.root._environment:!1===e?void 0:e)},t.detach=function(t){return J(t).detach(),t},t.destroy=function(t){var e=J(t);e.isRoot?e.die():e.parent.removeChild(e.subpath)},t.isAlive=function(t){return J(t).isAlive},t.addDisposer=function(t,e){J(t).addDisposer(e)},t.getEnv=function(t){var e=J(t).root._environment;return e||X},t.walk=f,t.getMembers=function(n){var t=J(n).type,e=Object.getOwnPropertyNames(n),r={name:t.name,properties:i({},t.properties),actions:[],volatile:[],views:[]};return e.forEach(function(t){if(!(t in r.properties)){var e=Object.getOwnPropertyDescriptor(n,t);e.get?l.isComputedProp(n,t)?r.views.push(t):r.volatile.push(t):!0===e.value._isMSTAction?r.actions.push(t):l.isObservableProp(n,t)?r.volatile.push(t):r.views.push(t)}}),r},t.cast=function(t){return t},t.isType=S,t.isArrayType=function(t){return S(t)&&0<(t.flags&v.Array)},t.isFrozenType=function(t){return S(t)&&0<(t.flags&v.Frozen)},t.isIdentifierType=function(t){return S(t)&&0<(t.flags&v.Identifier)},t.isLateType=function(t){return S(t)&&0<(t.flags&v.Late)},t.isLiteralType=function(t){return S(t)&&0<(t.flags&v.Literal)},t.isMapType=function(t){return S(t)&&0<(t.flags&v.Map)},t.isModelType=function(t){return S(t)&&0<(t.flags&v.Object)},t.isOptionalType=function(t){return S(t)&&0<(t.flags&v.Optional)},t.isPrimitiveType=Jt,t.isReferenceType=function(t){return 0<(t.flags&v.Reference)},t.isRefinementType=function(t){return 0<(t.flags&v.Refinement)},t.isUnionType=function(t){return 0<(t.flags&v.Union)},Object.defineProperty(t,"__esModule",{value:!0})});

@@ -1,32 +0,7 @@

import { IArrayChange, IArraySplice, IArrayWillChange, IArrayWillSplice, IObservableArray } from "mobx";
import { ComplexType, IAnyType, IChildNodesMap, IComplexType, IContext, IJsonPatch, INode, IType, IValidationResult, ObjectNode, TypeFlags } from "../../internal";
import { IObservableArray } from "mobx";
import { IComplexType, IType, OptionalProperty } from "../../internal";
export interface IMSTArray<C, S, T> extends IObservableArray<T> {
}
export interface IArrayType<C, S, T> extends IComplexType<C[] | undefined, S[], IMSTArray<C, S, T>> {
flags: TypeFlags.Optional;
export interface IArrayType<C, S, T> extends IComplexType<C[] | undefined, S[], IMSTArray<C, S, T>>, OptionalProperty {
}
export declare class ArrayType<C, S, T> extends ComplexType<C[] | undefined, S[], IMSTArray<C, S, T>> {
shouldAttachNode: boolean;
subType: IAnyType;
readonly flags: TypeFlags;
constructor(name: string, subType: IAnyType);
instantiate(parent: ObjectNode | null, subpath: string, environment: any, snapshot: S): INode;
initializeChildNodes(objNode: ObjectNode, snapshot?: S[]): IChildNodesMap;
createNewInstance(node: ObjectNode, childNodes: IChildNodesMap, snapshot: any): IObservableArray<any>;
finalizeNewInstance(node: ObjectNode, instance: IObservableArray<any>): void;
describe(): string;
getChildren(node: ObjectNode): INode[];
getChildNode(node: ObjectNode, key: string): INode;
willChange(change: IArrayWillChange<any> | IArrayWillSplice<any>): Object | null;
getValue(node: ObjectNode): any;
getSnapshot(node: ObjectNode): any;
processInitialSnapshot(childNodes: IChildNodesMap, snapshot: any): any;
didChange(this: {}, change: IArrayChange<any> | IArraySplice<any>): void;
applyPatchLocally(node: ObjectNode, subpath: string, patch: IJsonPatch): void;
applySnapshot(node: ObjectNode, snapshot: any[]): void;
getChildType(key: string): IAnyType;
isValidSnapshot(value: any, context: IContext): IValidationResult;
getDefaultSnapshot(): ReadonlyArray<any>;
removeChild(node: ObjectNode, subpath: string): void;
}
/**

@@ -57,2 +32,10 @@ * Creates an index based collection type who's children are all of a uniform declared type.

export declare function array<C, S, T>(subtype: IType<C, S, T>): IArrayType<C, S, T>;
/**
* Returns if a given value represents an array type.
*
* @export
* @template IT
* @param {IT} type
* @returns {type is IT}
*/
export declare function isArrayType<IT extends IArrayType<any, any, any>>(type: IT): type is IT;
import { IInterceptor, IKeyValueMap, IMapDidChange, IMapWillChange, Lambda } from "mobx";
import { ComplexType, IAnyType, IChildNodesMap, IComplexType, IContext, IJsonPatch, INode, IType, IValidationResult, ObjectNode, TypeFlags } from "../../internal";
export interface IMapType<C, S, T> extends IComplexType<IKeyValueMap<C> | undefined, IKeyValueMap<S>, IMSTMap<C, S, T>> {
flags: TypeFlags.Optional;
import { IComplexType, IType, OptionalProperty } from "../../internal";
export interface IMapType<C, S, T> extends IComplexType<IKeyValueMap<C> | undefined, IKeyValueMap<S>, IMSTMap<C, S, T>>, OptionalProperty {
}

@@ -21,3 +20,2 @@ export interface IMSTMap<C, S, T> {

merge(other: IMSTMap<any, any, T> | IKeyValueMap<C | S | T> | any): this;
clear(): void;
replace(values: IMSTMap<any, any, T> | IKeyValueMap<T>): this;

@@ -46,35 +44,2 @@ /**

}
export declare enum MapIdentifierMode {
UNKNOWN = 0,
YES = 1,
NO = 2
}
export declare class MapType<C, S, T> extends ComplexType<IKeyValueMap<C> | undefined, IKeyValueMap<S>, IMSTMap<C, S, T>> {
shouldAttachNode: boolean;
subType: IAnyType;
identifierMode: MapIdentifierMode;
identifierAttribute: string | undefined;
readonly flags: TypeFlags;
constructor(name: string, subType: IAnyType);
instantiate(parent: ObjectNode | null, subpath: string, environment: any, snapshot: S): INode;
private _determineIdentifierMode;
initializeChildNodes(objNode: ObjectNode, initialSnapshot?: any): IChildNodesMap;
createNewInstance(node: INode, childNodes: IChildNodesMap, snapshot: any): IMSTMap<any, any, any>;
finalizeNewInstance(node: ObjectNode, instance: any): void;
describe(): string;
getChildren(node: ObjectNode): ReadonlyArray<INode>;
getChildNode(node: ObjectNode, key: string): INode;
willChange(change: IMapWillChange<any, any>): IMapWillChange<any, any> | null;
private processIdentifier;
getValue(node: ObjectNode): any;
getSnapshot(node: ObjectNode): IKeyValueMap<S>;
processInitialSnapshot(childNodes: IChildNodesMap, snapshot: any): any;
didChange(change: IMapDidChange<any, any>): void;
applyPatchLocally(node: ObjectNode, subpath: string, patch: IJsonPatch): void;
applySnapshot(node: ObjectNode, snapshot: any): void;
getChildType(key: string): IAnyType;
isValidSnapshot(value: any, context: IContext): IValidationResult;
getDefaultSnapshot(): {};
removeChild(node: ObjectNode, subpath: string): void;
}
/**

@@ -108,2 +73,10 @@ * Creates a key based collection type who's children are all of a uniform declared type.

export declare function map<C, S, T>(subtype: IType<C, S, T>): IMapType<C, S, T>;
/**
* Returns if a given value represents a map type.
*
* @export
* @template IT
* @param {IT} type
* @returns {type is IT}
*/
export declare function isMapType<IT extends IMapType<any, any, any>>(type: IT): type is IT;

@@ -1,9 +0,2 @@

import { IObjectWillChange, IObservableObject } from "mobx";
import { ComplexType, ExtractIStateTreeNode, IAnyType, IChildNodesMap, IComplexType, IContext, IJsonPatch, INode, IStateTreeNode, IType, IValidationResult, ObjectNode, TypeFlags } from "../../internal";
export declare enum HookNames {
afterCreate = "afterCreate",
afterAttach = "afterAttach",
beforeDetach = "beforeDetach",
beforeDestroy = "beforeDestroy"
}
import { ExtractIStateTreeNode, IAnyType, IComplexType, IStateTreeNode, IType } from "../../internal";
export interface ModelProperties {

@@ -20,20 +13,12 @@ [key: string]: IAnyType;

export declare type ModelPropertiesDeclarationToProperties<T extends ModelPropertiesDeclaration> = {
[K in keyof T]: T[K] extends string ? IType<string | undefined, string, string> & {
flags: TypeFlags.Optional;
} : T[K] extends number ? IType<number | undefined, number, number> & {
flags: TypeFlags.Optional;
} : T[K] extends boolean ? IType<boolean | undefined, boolean, boolean> & {
flags: TypeFlags.Optional;
} : T[K] extends Date ? IType<number | Date | undefined, number, Date> & {
flags: TypeFlags.Optional;
} : T[K] extends IAnyType ? T[K] : never;
[K in keyof T]: T[K] extends string ? IType<string | undefined, string, string> & OptionalProperty : T[K] extends number ? IType<number | undefined, number, number> & OptionalProperty : T[K] extends boolean ? IType<boolean | undefined, boolean, boolean> & OptionalProperty : T[K] extends Date ? IType<number | Date | undefined, number, Date> & OptionalProperty : T[K] extends IAnyType ? T[K] : never;
};
export interface OptionalPropertyTypes {
flags: TypeFlags.Optional;
export interface OptionalProperty {
optional: true;
}
export declare type RequiredPropNames<T> = {
[K in keyof T]: T[K] extends OptionalPropertyTypes ? never : K;
[K in keyof T]: T[K] extends OptionalProperty ? never : K;
}[keyof T];
export declare type OptionalPropNames<T> = {
[K in keyof T]: T[K] extends OptionalPropertyTypes ? K : never;
[K in keyof T]: T[K] extends OptionalProperty ? K : never;
}[keyof T];

@@ -74,58 +59,6 @@ export declare type RequiredProps<T> = Pick<T, RequiredPropNames<T>>;

}
export declare type IAnyModelType = IModelType<any, any, any, any, any>;
export interface IAnyModelType extends IModelType<any, any, any, any, any> {
}
export declare type ExtractProps<T extends IAnyModelType> = T extends IModelType<infer P, any> ? P : never;
export declare type ExtractOthers<T extends IAnyModelType> = T extends IModelType<any, infer O> ? O : never;
export interface ModelTypeConfig {
name?: string;
properties?: ModelProperties;
initializers?: ReadonlyArray<((instance: any) => any)>;
preProcessor?: (snapshot: any) => any;
postProcessor?: (snapshot: any) => any;
}
export declare class ModelType<S extends ModelProperties, T> extends ComplexType<any, any, any> implements IModelType<S, T> {
readonly flags: TypeFlags;
shouldAttachNode: boolean;
readonly identifierAttribute: string | undefined;
readonly initializers: ((instance: any) => any)[];
readonly properties: any;
private preProcessor;
private postProcessor;
private readonly propertyNames;
constructor(opts: ModelTypeConfig);
private _getIdentifierAttribute;
cloneAndEnhance(opts: ModelTypeConfig): ModelType<any, any>;
actions(fn: (self: any) => any): any;
instantiateActions(self: T, actions: any): void;
named(name: string): this;
props(properties: ModelPropertiesDeclaration): any;
volatile(fn: (self: any) => any): any;
instantiateVolatileState(self: T, state: Object): void;
extend(fn: (self: any) => any): any;
views(fn: (self: any) => any): any;
instantiateViews(self: T, views: Object): void;
preProcessSnapshot(preProcessor: (snapshot: any) => any): any;
postProcessSnapshot(postProcessor: (snapshot: any) => any): any;
instantiate(parent: ObjectNode | null, subpath: string, environment: any, snapshot: any): INode;
initializeChildNodes(objNode: ObjectNode, initialSnapshot?: any): IChildNodesMap;
createNewInstance(node: ObjectNode, childNodes: IChildNodesMap, snapshot: any): any;
finalizeNewInstance(node: ObjectNode, instance: IObservableObject): void;
willChange(change: any): IObjectWillChange | null;
didChange(change: any): void;
getChildren(node: ObjectNode): INode[];
getChildNode(node: ObjectNode, key: string): INode;
getValue(node: ObjectNode): any;
getSnapshot(node: ObjectNode, applyPostProcess?: boolean): any;
processInitialSnapshot(childNodes: IChildNodesMap, snapshot: any): any;
applyPatchLocally(node: ObjectNode, subpath: string, patch: IJsonPatch): void;
applySnapshot(node: ObjectNode, snapshot: any): void;
applySnapshotPreProcessor(snapshot: any): any;
applyOptionalValuesToSnapshot(snapshot: any): any;
applySnapshotPostProcessor(snapshot: any): any;
getChildType(key: string): IAnyType;
isValidSnapshot(value: any, context: IContext): IValidationResult;
private forAllProps;
describe(): string;
getDefaultSnapshot(): any;
removeChild(node: ObjectNode, subpath: string): void;
}
export declare function model<T extends ModelPropertiesDeclaration = {}>(name: string, properties?: T): IModelType<ModelPropertiesDeclarationToProperties<T>, {}>;

@@ -149,2 +82,10 @@ export declare function model<T extends ModelPropertiesDeclaration = {}>(properties?: T): IModelType<ModelPropertiesDeclarationToProperties<T>, {}>;

export declare function compose<PA extends ModelProperties, OA, CA, SA, TA, PB extends ModelProperties, OB, CB, SB, TB, PC extends ModelProperties, OC, CC, SC, TC, PD extends ModelProperties, OD, CD, SD, TD, PE extends ModelProperties, OE, CE, SE, TE, PF extends ModelProperties, OF, CF, SF, TF, PG extends ModelProperties, OG, CG, SG, TG, PH extends ModelProperties, OH, CH, SH, TH, PI extends ModelProperties, OI, CI, SI, TI>(A: IModelType<PA, OA, CA, SA, TA>, B: IModelType<PB, OB, CB, SB, TB>, C: IModelType<PC, OC, CC, SC, TC>, D: IModelType<PD, OD, CD, SD, TD>, E: IModelType<PE, OE, CE, SE, TE>, F: IModelType<PF, OF, CF, SF, TF>, G: IModelType<PG, OG, CG, SG, TG>, H: IModelType<PH, OH, CH, SH, TH>, I: IModelType<PI, OI, CI, SI, TI>): IModelType<PA & PB & PC & PD & PE & PF & PG & PH & PI, OA & OB & OC & OD & OE & OF & OG & OH & OI, CA & CB & CC & CD & CE & CF & CG & CH & CI, SA & SB & SC & SD & SE & SF & SG & SH & SI, TA & TB & TC & TD & TE & TF & TG & TH & TI>;
/**
* Returns if a given value represents a model type.
*
* @export
* @template IT
* @param {IT} type
* @returns {type is IT}
*/
export declare function isModelType<IT extends IModelType<any, any>>(type: IT): type is IT;

@@ -1,13 +0,2 @@

import { Type, INode, ISimpleType, IType, TypeFlags, IContext, IValidationResult, ObjectNode, IAnyType, IChildNodesMap } from "../internal";
export declare class CoreType<C, S, T> extends Type<C, S, T> {
readonly shouldAttachNode: boolean;
readonly checker: (value: any) => boolean;
readonly flags: TypeFlags;
readonly initializer: (v: any) => any;
constructor(name: any, flags: TypeFlags, checker: any, initializer?: (v: any) => any);
describe(): string;
instantiate(parent: ObjectNode | null, subpath: string, environment: any, snapshot: T): INode;
createNewInstance(node: INode, childNodes: IChildNodesMap, snapshot: any): any;
isValidSnapshot(value: any, context: IContext): IValidationResult;
}
import { ISimpleType, IType } from "../internal";
/**

@@ -92,3 +81,10 @@ * Creates a type that can only contain a string value.

export declare const DatePrimitive: IType<number | Date, number, Date>;
export declare function getPrimitiveFactoryFromValue(value: any): ISimpleType<any>;
export declare function isPrimitiveType<C = any, S = any, T = any>(type: IAnyType): type is CoreType<C, S, T>;
/**
* Returns if a given value represents a primitive type.
*
* @export
* @template IT
* @param {IT} type
* @returns {type is IT}
*/
export declare function isPrimitiveType<IT extends ISimpleType<string> | ISimpleType<number> | ISimpleType<boolean> | typeof DatePrimitive>(type: IT): type is IT;

@@ -1,2 +0,2 @@

import { INode, Type, IType, TypeFlags, IContext, IValidationResult, ObjectNode, IAnyType } from "../../internal";
import { IType } from "../../internal";
export interface CustomTypeOptions<S, T> {

@@ -29,5 +29,2 @@ name: string;

*
* @export
* @alias types.custom
*
* @example

@@ -54,16 +51,10 @@ * const DecimalPrimitive = types.custom<string, Decimal>({

* })
*
* @export
* @alias types.custom
* @template S
* @template T
* @param {CustomTypeOptions<S, T>} options
* @returns {(IType<S | T, S, T>)}
*/
export declare function custom<S, T>(options: CustomTypeOptions<S, T>): IType<S | T, S, T>;
export declare class CustomType<S, T> extends Type<S, S, T> {
protected readonly options: CustomTypeOptions<S, T>;
readonly flags: TypeFlags;
readonly shouldAttachNode: boolean;
constructor(options: CustomTypeOptions<S, T>);
describe(): string;
isAssignableFrom(type: IAnyType): boolean;
isValidSnapshot(value: any, context: IContext): IValidationResult;
getValue(node: INode): any;
getSnapshot(node: INode): any;
instantiate(parent: ObjectNode | null, subpath: string, environment: any, snapshot: any): INode;
reconcile(current: INode, value: any): INode;
}

@@ -1,16 +0,14 @@

import { INode, Type, IContext, IValidationResult, TypeFlags, ObjectNode, IType } from "../../internal";
export declare class Frozen<T> extends Type<T, T, T> {
private subType?;
readonly shouldAttachNode: boolean;
flags: TypeFlags;
constructor(subType?: IType<any, any, any> | undefined);
describe(): string;
instantiate(parent: ObjectNode | null, subpath: string, environment: any, value: any): INode;
isValidSnapshot(value: any, context: IContext): IValidationResult;
}
import { IType, OptionalProperty } from "../../internal";
export declare function frozen<C>(subType: IType<C, any, any>): IType<C, C, C>;
export declare function frozen<T>(defaultValue: T): IType<T | undefined | null, T, T> & {
flags: TypeFlags.Optional;
};
export declare function frozen<T>(defaultValue: T): IType<T | undefined | null, T, T> & OptionalProperty;
export declare function frozen<T>(): IType<T, T, T>;
/**
* Returns if a given value represents a frozen type.
*
* @export
* @template IT
* @template T
* @param {IT} type
* @returns {type is IT}
*/
export declare function isFrozenType<IT extends IType<T | any, T, T>, T = any>(type: IT): type is IT;

@@ -1,19 +0,2 @@

import { INode, Type, TypeFlags, IContext, IValidationResult, ObjectNode, ISimpleType } from "../../internal";
export declare class IdentifierType extends Type<string, string, string> {
readonly shouldAttachNode: boolean;
readonly flags: TypeFlags;
constructor();
instantiate(parent: ObjectNode | null, subpath: string, environment: any, snapshot: string): INode;
reconcile(current: INode, newValue: string): INode;
describe(): string;
isValidSnapshot(value: any, context: IContext): IValidationResult;
}
export declare class IdentifierNumberType extends IdentifierType {
constructor();
instantiate(parent: ObjectNode | null, subpath: string, environment: any, snapshot: any): INode;
isValidSnapshot(value: any, context: IContext): IValidationResult;
reconcile(current: INode, newValue: any): INode;
getSnapshot(node: INode): any;
describe(): string;
}
import { ISimpleType } from "../../internal";
/**

@@ -53,2 +36,10 @@ * Identifiers are used to make references, lifecycle events and reconciling works.

export declare const identifierNumber: ISimpleType<number>;
/**
* Returns if a given value represents an identifier type.
*
* @export
* @template IT
* @param {IT} type
* @returns {type is IT}
*/
export declare function isIdentifierType<IT extends typeof identifier | typeof identifierNumber>(type: IT): type is IT;

@@ -1,18 +0,12 @@

import { INode, Type, IContext, IValidationResult, IAnyType } from "../../internal";
export declare class Late<C, S, T> extends Type<C, S, T> {
readonly definition: () => IAnyType;
private _subType;
readonly flags: number;
readonly shouldAttachNode: boolean;
getSubType(mustSucceed: true): IAnyType;
getSubType(mustSucceed: false): IAnyType | null;
constructor(name: string, definition: () => IAnyType);
instantiate(parent: INode | null, subpath: string, environment: any, snapshot: any): INode;
reconcile(current: INode, newValue: any): INode;
describe(): string;
isValidSnapshot(value: any, context: IContext): IValidationResult;
isAssignableFrom(type: IAnyType): boolean;
}
import { IAnyType } from "../../internal";
export declare function late<T extends IAnyType>(type: () => T): T;
export declare function late<T extends IAnyType>(name: string, type: () => T): T;
/**
* Returns if a given value represents a late type.
*
* @export
* @template IT
* @param {IT} type
* @returns {type is IT}
*/
export declare function isLateType<IT extends IAnyType>(type: IT): type is IT;

@@ -1,12 +0,2 @@

import { INode, ISimpleType, Type, TypeFlags, IContext, IValidationResult, ObjectNode } from "../../internal";
import { Primitives } from "../../core/type/type";
export declare class Literal<T> extends Type<T, T, T> {
readonly shouldAttachNode: boolean;
readonly value: any;
readonly flags: TypeFlags;
constructor(value: any);
instantiate(parent: ObjectNode | null, subpath: string, environment: any, snapshot: T): INode;
describe(): string;
isValidSnapshot(value: any, context: IContext): IValidationResult;
}
import { ISimpleType, Primitives } from "../../internal";
/**

@@ -30,2 +20,10 @@ * The literal type will return a type that will match only the exact given type.

export declare function literal<S extends Primitives>(value: S): ISimpleType<S>;
/**
* Returns if a given value represents a literal type.
*
* @export
* @template IT
* @param {IT} type
* @returns {type is IT}
*/
export declare function isLiteralType<IT extends ISimpleType<any>>(type: IT): type is IT;

@@ -1,7 +0,3 @@

import { IType, TypeFlags, IComplexType, IAnyType, ExtractC, ExtractS, ExtractT, IAnyComplexType } from "../../internal";
export declare type IMaybeTypeBase<IT extends IAnyType, C, O> = IT extends IAnyComplexType ? IComplexType<ExtractC<IT> | C, ExtractS<IT> | O, ExtractT<IT> | O> & {
flags: TypeFlags.Optional;
} : IT extends IAnyType ? IType<ExtractC<IT> | C, ExtractS<IT> | O, ExtractT<IT> | O> & {
flags: TypeFlags.Optional;
} : never;
import { IType, IComplexType, IAnyType, ExtractC, ExtractS, ExtractT, IAnyComplexType, OptionalProperty } from "../../internal";
export declare type IMaybeTypeBase<IT extends IAnyType, C, O> = IT extends IAnyComplexType ? IComplexType<ExtractC<IT> | C, ExtractS<IT> | O, ExtractT<IT> | O> & OptionalProperty : IT extends IAnyType ? IType<ExtractC<IT> | C, ExtractS<IT> | O, ExtractT<IT> | O> & OptionalProperty : never;
export declare type IMaybeType<IT extends IAnyType> = IMaybeTypeBase<IT, undefined, undefined>;

@@ -8,0 +4,0 @@ /**

@@ -1,32 +0,14 @@

import { INode, Type, IType, TypeFlags, IContext, IValidationResult, IAnyType, IComplexType } from "../../internal";
export declare type IFunctionReturn<T> = () => T;
export declare type IOptionalValue<C, S, T> = C | S | T | IFunctionReturn<C | S | T>;
export declare class OptionalValue<C, S, T> extends Type<C, S, T> {
readonly type: IType<C, S, T>;
readonly defaultValue: IOptionalValue<C, S, T>;
readonly flags: number;
readonly shouldAttachNode: boolean;
constructor(type: IType<C, S, T>, defaultValue: IOptionalValue<C, S, T>);
describe(): string;
instantiate(parent: INode, subpath: string, environment: any, value: S): INode;
reconcile(current: INode, newValue: any): INode;
private getDefaultValue;
getDefaultValueSnapshot(): any;
isValidSnapshot(value: any, context: IContext): IValidationResult;
isAssignableFrom(type: IAnyType): boolean;
}
export declare function optional<C, S, T>(type: IComplexType<C, S, T>, defaultValueOrFunction: C | S | T): IComplexType<C | undefined, S, T> & {
flags: TypeFlags.Optional;
};
export declare function optional<C, S, T>(type: IComplexType<C, S, T>, defaultValueOrFunction: () => C | S | T): IComplexType<C | undefined, S, T> & {
flags: TypeFlags.Optional;
};
export declare function optional<C, S, T>(type: IType<C, S, T>, defaultValueOrFunction: C | S | T): IType<C | undefined, S, T> & {
flags: TypeFlags.Optional;
};
export declare function optional<C, S, T>(type: IType<C, S, T>, defaultValueOrFunction: () => C | S | T): IType<C | undefined, S, T> & {
flags: TypeFlags.Optional;
};
export declare function isOptionalType<IT extends IType<any | undefined, any, any> & {
flags: TypeFlags.Optional;
}>(type: IT): type is IT;
import { IType, IComplexType, OptionalProperty } from "../../internal";
export declare function optional<C, S, T>(type: IComplexType<C, S, T>, defaultValueOrFunction: C | S | T): IComplexType<C | undefined, S, T> & OptionalProperty;
export declare function optional<C, S, T>(type: IComplexType<C, S, T>, defaultValueOrFunction: () => C | S | T): IComplexType<C | undefined, S, T> & OptionalProperty;
export declare function optional<C, S, T>(type: IType<C, S, T>, defaultValueOrFunction: C | S | T): IType<C | undefined, S, T> & OptionalProperty;
export declare function optional<C, S, T>(type: IType<C, S, T>, defaultValueOrFunction: () => C | S | T): IType<C | undefined, S, T> & OptionalProperty;
/**
* Returns if a value represents an optional type.
*
* @export
* @template IT
* @param {IT} type
* @returns {type is IT}
*/
export declare function isOptionalType<IT extends IType<any | undefined, any, any> & OptionalProperty>(type: IT): type is IT;

@@ -1,26 +0,2 @@

import { INode, Type, IType, TypeFlags, IContext, IValidationResult, ObjectNode, IAnyType, ExtractT, IComplexType, IAnyStateTreeNode, IAnyModelType } from "../../internal";
export declare abstract class BaseReferenceType<T> extends Type<string | number | T, string | number, T> {
protected readonly targetType: IType<any, any, T>;
readonly shouldAttachNode: boolean;
readonly flags: TypeFlags;
constructor(targetType: IType<any, any, T>);
describe(): string;
isAssignableFrom(type: IAnyType): boolean;
isValidSnapshot(value: any, context: IContext): IValidationResult;
}
export declare class IdentifierReferenceType<T> extends BaseReferenceType<T> {
constructor(targetType: IType<any, any, T>);
getValue(node: INode): any;
getSnapshot(node: INode): any;
instantiate(parent: ObjectNode | null, subpath: string, environment: any, snapshot: any): INode;
reconcile(current: INode, newValue: any): INode;
}
export declare class CustomReferenceType<T> extends BaseReferenceType<T> {
private readonly options;
constructor(targetType: IType<any, any, T>, options: ReferenceOptions<T>);
getValue(node: INode): T | undefined;
getSnapshot(node: INode): any;
instantiate(parent: ObjectNode | null, subpath: string, environment: any, snapshot: any): INode;
reconcile(current: INode, snapshot: any): INode;
}
import { ExtractT, IComplexType, IAnyStateTreeNode, IAnyModelType } from "../../internal";
export interface ReferenceOptions<T> {

@@ -31,3 +7,2 @@ get(identifier: string | number, parent: IAnyStateTreeNode | null): T;

export interface IReferenceType<IR extends IAnyModelType> extends IComplexType<string | number | ExtractT<IR>, string | number, ExtractT<IR>> {
flags: TypeFlags.Reference;
}

@@ -42,2 +17,10 @@ /**

export declare function reference<IT extends IAnyModelType>(subType: IT, options?: ReferenceOptions<ExtractT<IT>>): IReferenceType<IT>;
/**
* Returns if a given value represents a reference type.
*
* @export
* @template IT
* @param {IT} type
* @returns {type is IT}
*/
export declare function isReferenceType<IT extends IReferenceType<any>>(type: IT): type is IT;

@@ -1,16 +0,12 @@

import { INode, Type, IContext, IValidationResult, IAnyType, ExtractC } from "../../internal";
export declare class Refinement<C, S, T> extends Type<C, S, T> {
readonly type: IAnyType;
readonly predicate: (v: any) => boolean;
readonly message: (v: any) => string;
readonly flags: number;
readonly shouldAttachNode: boolean;
constructor(name: string, type: IAnyType, predicate: (v: any) => boolean, message: (v: any) => string);
describe(): string;
instantiate(parent: INode, subpath: string, environment: any, value: any): INode;
isAssignableFrom(type: IAnyType): boolean;
isValidSnapshot(value: any, context: IContext): IValidationResult;
}
import { IAnyType, ExtractC } from "../../internal";
export declare function refinement<IT extends IAnyType>(name: string, type: IT, predicate: (snapshot: ExtractC<IT>) => boolean, message?: string | ((v: any) => string)): IT;
export declare function refinement<IT extends IAnyType>(type: IT, predicate: (snapshot: ExtractC<IT>) => boolean, message?: string | ((v: any) => string)): IT;
/**
* Returns if a given value is a refinement type.
*
* @export
* @template IT
* @param {IT} type
* @returns {type is IT}
*/
export declare function isRefinementType<IT extends IAnyType>(type: IT): type is IT;

@@ -1,3 +0,2 @@

import { IContext, IValidationResult, TypeFlags, IType, Type, INode, IAnyType, IComplexType, IModelType } from "../../internal";
import { ModelProperties } from "../complex-types/model";
import { IType, IAnyType, IComplexType, IModelType, ModelProperties } from "../../internal";
export declare type ITypeDispatcher = (snapshot: any) => IAnyType;

@@ -8,16 +7,2 @@ export interface UnionOptions {

}
export declare class Union extends Type<any, any, any> {
readonly dispatcher?: ITypeDispatcher;
readonly eager: boolean;
readonly types: IAnyType[];
readonly flags: TypeFlags;
readonly shouldAttachNode: boolean;
constructor(name: string, types: IAnyType[], options?: UnionOptions);
isAssignableFrom(type: IAnyType): boolean;
describe(): string;
instantiate(parent: INode, subpath: string, environment: any, value: any): INode;
reconcile(current: INode, newValue: any): INode;
determineType(value: any): IAnyType | undefined;
isValidSnapshot(value: any, context: IContext): IValidationResult;
}
export declare function union<PA extends ModelProperties, OA, CA, SA, TA, PB extends ModelProperties, OB, CB, SB, TB>(A: IModelType<PA, OA, CA, SA, TA>, B: IModelType<PB, OB, CB, SB, TB>): IModelType<PA | PB, OA | OB, CA | CB, SA | SB, TA | TB>;

@@ -73,2 +58,10 @@ export declare function union<PA extends ModelProperties, OA, CA, SA, TA, PB extends ModelProperties, OB, CB, SB, TB>(options: UnionOptions, A: IModelType<PA, OA, CA, SA, TA>, B: IModelType<PB, OB, CB, SB, TB>): IModelType<PA | PB, OA | OB, CA | CB, SA | SB, TA | TB>;

export declare function union(dispatchOrType: UnionOptions | IAnyType, ...otherTypes: IAnyType[]): IAnyType;
/**
* Returns if a given value represents a union type.
*
* @export
* @template IT
* @param {IT} type
* @returns {type is IT}
*/
export declare function isUnionType<IT extends IAnyType>(type: IT): type is IT;

@@ -1,46 +0,1 @@

export declare const EMPTY_ARRAY: ReadonlyArray<any>;
export declare const EMPTY_OBJECT: {};
export declare const mobxShallow: {
deep: boolean;
proxy?: undefined;
} | {
deep: boolean;
proxy: boolean;
};
export declare type IDisposer = () => void;
export declare function fail(message?: string): never;
export declare function identity<T>(_: T): T;
export declare function nothing(): null;
export declare function noop(): void;
export declare const isInteger: (number: number) => boolean;
export declare function isArray(val: any): boolean;
export declare function asArray<T>(val: undefined | null | T | T[] | ReadonlyArray<T>): T[];
export declare function extend<A, B>(a: A, b: B): A & B;
export declare function extend<A, B, C>(a: A, b: B, c: C): A & B & C;
export declare function extend<A, B, C, D>(a: A, b: B, c: C, d: D): A & B & C & D;
export declare function extend(a: any, ...b: any[]): any;
export declare function extendKeepGetter<A, B>(a: A, b: B): A & B;
export declare function extendKeepGetter<A, B, C>(a: A, b: B, c: C): A & B & C;
export declare function extendKeepGetter<A, B, C, D>(a: A, b: B, c: C, d: D): A & B & C & D;
export declare function extendKeepGetter(a: any, ...b: any[]): any;
export declare function isPlainObject(value: any): boolean;
export declare function isMutable(value: any): boolean;
export declare function isPrimitive(value: any): boolean;
export declare function freeze<T>(value: T): T;
export declare function deepFreeze<T>(value: T): T;
export declare function isSerializable(value: any): boolean;
export declare function addHiddenFinalProp(object: any, propName: string, value: any): void;
export declare function addHiddenWritableProp(object: any, propName: string, value: any): void;
export declare function addReadOnlyProp(object: any, propName: string, value: any): void;
export declare function remove<T>(collection: T[], item: T): void;
export declare function registerEventHandler(handlers: Function[], handler: Function): IDisposer;
export declare function hasOwnProperty(object: Object, propName: string): any;
export declare function argsToArray(args: IArguments): any[];
export declare function invalidateComputed(target: any, propName: string): void;
export declare type DeprecatedFunction = Function & {
ids?: {
[id: string]: true;
};
};
declare let deprecated: DeprecatedFunction;
export { deprecated };
{
"name": "mobx-state-tree",
"version": "3.2.3",
"version": "3.2.4",
"description": "Opinionated, transactional, MobX powered state container",

@@ -20,3 +20,4 @@ "main": "dist/mobx-state-tree.js",

"coverage": "yarn jest --coverage",
"build-docs": "tsc && documentation build lib/index.js --sort-order alpha -f md -o ../../API.md.tmp && concat -o ../../API.md ../../docs/API_header.md ../../API.md.tmp && rm ../../API.md.tmp",
"lint-docs": "tsc && documentation lint lib/index.js",
"build-docs": "tsc && documentation build lib/index.js --sort-order alpha -f md -o ../../API.md.tmp && concat -o ../../API.md ../../docs/API_header.md ../../API.md.tmp && shx rm ../../API.md.tmp",
"lint": "tslint -c ../../tslint.json 'src/**/*.ts'"

@@ -48,3 +49,3 @@ },

"mobx": "^5.0.3",
"rollup": "^0.64.0",
"rollup": "^0.65.0",
"rollup-plugin-commonjs": "^9.0.0",

@@ -55,2 +56,3 @@ "rollup-plugin-filesize": "^4.0.0",

"rollup-plugin-uglify": "^4.0.0",
"shx": "^0.3.2",
"sinon": "^6.0.0",

@@ -57,0 +59,0 @@ "ts-jest": "^23.0.1",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc