
/*************************************************************************
* ADOBE CONFIDENTIAL
* ___________________
*
* Copyright 2017 Adobe. All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Adobe and its suppliers, if any. The intellectual
* and technical concepts contained herein are proprietary to Adobe
* and its suppliers and are protected by all applicable intellectual
* property laws, including trade secret and copyright laws.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe.
**************************************************************************/

(window.webpackJsonp=window.webpackJsonp||[]).push([[1],{1415:function(module,exports,__webpack_require__){(function(global,process){(function(global){"use strict";function setImmediate(callback){"function"!=typeof callback&&(callback=new Function(""+callback));for(var args=Array(arguments.length-1),i=0;i<args.length;i++)args[i]=arguments[i+1];var task={callback:callback,args:args};return tasksByHandle[nextHandle]=task,registerImmediate(nextHandle),nextHandle++}function clearImmediate(handle){delete tasksByHandle[handle]}function run(task){var callback=task.callback,args=task.args;switch(args.length){case 0:callback();break;case 1:callback(args[0]);break;case 2:callback(args[0],args[1]);break;case 3:callback(args[0],args[1],args[2]);break;default:callback.apply(void 0,args);}}function runIfPresent(handle){if(currentlyRunningATask)setTimeout(runIfPresent,0,handle);else{var task=tasksByHandle[handle];if(task){currentlyRunningATask=!0;try{run(task)}finally{clearImmediate(handle),currentlyRunningATask=!1}}}}function installNextTickImplementation(){registerImmediate=function(handle){process.nextTick(function(){runIfPresent(handle)})}}function canUsePostMessage(){if(global.postMessage&&!global.importScripts){var postMessageIsAsynchronous=!0,oldOnMessage=global.onmessage;return global.onmessage=function(){postMessageIsAsynchronous=!1},global.postMessage("","*"),global.onmessage=oldOnMessage,postMessageIsAsynchronous}}function installPostMessageImplementation(){var messagePrefix="setImmediate$"+Math.random()+"$",onGlobalMessage=function(event){event.source===global&&"string"==typeof event.data&&0===event.data.indexOf(messagePrefix)&&runIfPresent(+event.data.slice(messagePrefix.length))};global.addEventListener?global.addEventListener("message",onGlobalMessage,!1):global.attachEvent("onmessage",onGlobalMessage),registerImmediate=function(handle){global.postMessage(messagePrefix+handle,"*")}}function installMessageChannelImplementation(){var channel=new MessageChannel;channel.port1.onmessage=function(event){var handle=event.data;runIfPresent(handle)},registerImmediate=function(handle){channel.port2.postMessage(handle)}}function installReadyStateChangeImplementation(){var html=doc.documentElement;registerImmediate=function(handle){var script=doc.createElement("script");script.onreadystatechange=function(){runIfPresent(handle),script.onreadystatechange=null,html.removeChild(script),script=null},html.appendChild(script)}}function installSetTimeoutImplementation(){registerImmediate=function(handle){setTimeout(runIfPresent,0,handle)}}if(!global.setImmediate){var registerImmediate,nextHandle=1,tasksByHandle={},currentlyRunningATask=!1,doc=global.document,attachTo=Object.getPrototypeOf&&Object.getPrototypeOf(global);attachTo=attachTo&&attachTo.setTimeout?attachTo:global,"[object process]"==={}.toString.call(global.process)?installNextTickImplementation():canUsePostMessage()?installPostMessageImplementation():global.MessageChannel?installMessageChannelImplementation():doc&&"onreadystatechange"in doc.createElement("script")?installReadyStateChangeImplementation():installSetTimeoutImplementation(),attachTo.setImmediate=setImmediate,attachTo.clearImmediate=clearImmediate}})("undefined"==typeof self?"undefined"==typeof global?this:global:self)}).call(this,__webpack_require__(37),__webpack_require__(143))},393:function(module,__webpack_exports__,__webpack_require__){"use strict";(function(setImmediate){function __extends(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}function __rest(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&0>e.indexOf(p)&&(t[p]=s[p]);if(null!=s&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,p=Object.getOwnPropertySymbols(s);i<p.length;i++)0>e.indexOf(p[i])&&(t[p[i]]=s[p[i]]);return t}function __decorate(decorators,target,key,desc){var d,c=arguments.length,r=3>c?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;0<=i;i--)(d=decorators[i])&&(r=(3>c?d(r):3<c?d(target,key,r):d(target,key))||r);return 3<c&&r&&Object.defineProperty(target,key,r),r}function getType$$1(object){return getStateTreeNode$$1(object).type}function onPatch$$1(target,callback){return!1,getStateTreeNode$$1(target).onPatch(callback)}function applyPatch$$1(target,patch){!1,getStateTreeNode$$1(target).applyPatches(asArray(patch))}function applySnapshot$$1(target,snapshot){return!1,getStateTreeNode$$1(target).applySnapshot(snapshot)}function getSnapshot$$1(target){return!1,getStateTreeNode$$1(target).snapshot}function getRoot$$1(target){return!1,getStateTreeNode$$1(target).root.storedValue}function clone$$1(source,keepEnvironment){void 0===keepEnvironment&&(keepEnvironment=!0),!1;var node=getStateTreeNode$$1(source);return node.type.create(node.snapshot,!0===keepEnvironment?node.root._environment:!1===keepEnvironment?void 0:keepEnvironment)}function walk$$1(target,processor){var node=getStateTreeNode$$1(target);node.getChildren().forEach(function(child){isStateTreeNode$$1(child.storedValue)&&walk$$1(child.storedValue,processor)}),processor(node.storedValue)}function isType$$1(value){return"object"==typeof value&&value&&!0===value.isType}function getNextActionId$$1(){return nextActionId++}function runWithActionContext$$1(context,fn){var node=getStateTreeNode$$1(context.context),baseIsRunningAction=node._isRunningAction,prevContext=currentActionContext;node.assertAlive(),node._isRunningAction=!0,currentActionContext=context;try{return runMiddleWares(node,context,fn)}finally{currentActionContext=prevContext,node._isRunningAction=baseIsRunningAction}}function createActionInvoker$$1(target,name,fn){var res=function(){var id=getNextActionId$$1();return runWithActionContext$$1({type:"action",name:name,id:id,args:argsToArray(arguments),context:target,tree:getRoot$$1(target),rootId:currentActionContext?currentActionContext.rootId:id,parentId:currentActionContext?currentActionContext.id:0},fn)};return res._isMSTAction=!0,res}function collectMiddlewares(node,baseCall,fn){for(var middlewares=fn.$mst_middleware||EMPTY_ARRAY,n=node;n;)n.middlewares&&(middlewares=middlewares.concat(n.middlewares)),n=n.parent;return middlewares}function runMiddleWares(node,baseCall,originalFn){function runNextMiddleware(call){function next(call,callback){nextInvoked=!0,result=callback?callback(runNextMiddleware(call)||result):runNextMiddleware(call)}function abort(value){abortInvoked=!0,result=value}var middleware=middlewares[index++],handler=middleware&&middleware.handler,nextInvoked=!1,abortInvoked=!1,invokeHandler=function(){handler(call,next,abort);return result};return handler&&middleware.includeHooks?invokeHandler():handler&&!middleware.includeHooks?HookNames$$1[call.name]?runNextMiddleware(call):invokeHandler():Object(mobx__WEBPACK_IMPORTED_MODULE_0__.e)(originalFn).apply(null,baseCall.args)}var middlewares=collectMiddlewares(node,baseCall,originalFn);if(!middlewares.length)return Object(mobx__WEBPACK_IMPORTED_MODULE_0__.e)(originalFn).apply(null,baseCall.args);var index=0,result=null;return runNextMiddleware(baseCall)}function safeStringify(value){try{return JSON.stringify(value)}catch(e){return"<Unserializable: "+e+">"}}function prettyPrintValue$$1(value){return"function"==typeof value?"<function"+(value.name?" "+value.name:"")+">":isStateTreeNode$$1(value)?"<"+value+">":"`"+safeStringify(value)+"`"}function shortenPrintValue(valueInString){return 280>valueInString.length?valueInString:valueInString.substring(0,272)+"......"+valueInString.substring(valueInString.length-8)}function toErrorString(error){var value=error.value,type=error.context[error.context.length-1].type,fullPath=error.context.map(function(_a){var path=_a.path;return path}).filter(function(path){return 0<path.length}).join("/"),pathPrefix=0<fullPath.length?"at path \"/"+fullPath+"\" ":"",currentTypename=isStateTreeNode$$1(value)?"value of type "+getStateTreeNode$$1(value).type.name+":":isPrimitive(value)?"value":"snapshot",isSnapshotCompatible=type&&isStateTreeNode$$1(value)&&type.is(getStateTreeNode$$1(value).snapshot);return""+pathPrefix+currentTypename+" "+prettyPrintValue$$1(value)+" is not assignable "+(type?"to type: `"+type.name+"`":"")+(error.message?" ("+error.message+")":"")+(type?isPrimitiveType$$1(type)?".":", expected an instance of `"+type.name+"` or a snapshot like `"+type.describe()+"` instead."+(isSnapshotCompatible?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function getContextForPath$$1(context,path,type){return context.concat([{path:path,type:type}])}function typeCheckSuccess$$1(){return EMPTY_ARRAY}function typeCheckFailure$$1(context,value,message){return[{context:context,value:value,message:message}]}function flattenTypeErrors$$1(errors){return errors.reduce(function(a,i){return a.concat(i)},[])}function typecheck$$1(type,value){}function typecheckPublic$$1(type,value){var errors=type.validate(value,[{path:"",type:type}]);0<errors.length&&(console.error("Failed to create \""+type.name+"\" from:",value),fail("Error while converting "+shortenPrintValue(prettyPrintValue$$1(value))+" to `"+type.name+"`:\n\n    "+errors.map(toErrorString).join("\n    ")))}function createNode$$1(type,parent,subpath,environment,initialValue,createNewInstance,finalizeNewInstance){if(void 0===createNewInstance&&(createNewInstance=identity),void 0===finalizeNewInstance&&(finalizeNewInstance=noop),isStateTreeNode$$1(initialValue)){var targetNode=initialValue.$treenode;return targetNode.isRoot||fail("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 '"+(parent?parent.path:"")+"/"+subpath+"', but it lives already at '"+targetNode.path+"'"),targetNode.setParent(parent,subpath),targetNode}var storedValue=createNewInstance(initialValue);if(type.shouldAttachNode){var node=new ObjectNode$$1(type,parent,subpath,environment,initialValue,storedValue,type.shouldAttachNode,finalizeNewInstance);return node.finalizeCreation(),node}return new ScalarNode$$1(type,parent,subpath,environment,initialValue,storedValue,type.shouldAttachNode,finalizeNewInstance)}function isNode$$1(value){return value instanceof ScalarNode$$1||value instanceof ObjectNode$$1}function isStateTreeNode$$1(value){return!!(value&&value.$treenode)}function getStateTreeNode$$1(value){return isStateTreeNode$$1(value)?value.$treenode:fail("Value "+value+" is no MST Node")}function toJSON$$1(){return getStateTreeNode$$1(this).snapshot}function resolveNodeByPathParts$$1(base,pathParts,failIfResolveFails){void 0===failIfResolveFails&&(failIfResolveFails=!0);for(var part,current=base,i=0;i<pathParts.length;i++){if(part=pathParts[i],""===part){current=current.root;continue}else if(".."===part){if(current=current.parent,current)continue;}else if("."===part||""===part)continue;else if(current){if(current instanceof ScalarNode$$1)try{var value=current.value;isStateTreeNode$$1(value)&&(current=getStateTreeNode$$1(value))}catch(e){if(!failIfResolveFails)return;throw e}if(current instanceof ObjectNode$$1){var subType=current.getChildType(part);if(subType&&(current=current.getChildNode(part),current))continue}}return failIfResolveFails?fail("Could not resolve '"+part+"' in path '"+(joinJsonPath$$1(pathParts.slice(0,i))||"/")+"' while resolving '"+joinJsonPath$$1(pathParts)+"'"):void 0}return current}function fail(message){throw void 0===message&&(message="Illegal state"),new Error("[mobx-state-tree] "+message)}function identity(_){return _}function noop(){}function isArray(val){return!!(Array.isArray(val)||Object(mobx__WEBPACK_IMPORTED_MODULE_0__.p)(val))}function asArray(val){return val?isArray(val)?val:[val]:EMPTY_ARRAY}function extend(a){for(var b=[],_i=1;_i<arguments.length;_i++)b[_i-1]=arguments[_i];for(var current,i=0;i<b.length;i++)for(var key in current=b[i],current)a[key]=current[key];return a}function isPlainObject(value){if(null===value||"object"!=typeof value)return!1;var proto=Object.getPrototypeOf(value);return proto===Object.prototype||null===proto}function isMutable(value){return null!==value&&"object"==typeof value&&!(value instanceof Date)&&!(value instanceof RegExp)}function isPrimitive(value){return!(null!==value&&void 0!==value)||!!("string"==typeof value||"number"==typeof value||"boolean"==typeof value||value instanceof Date)}function freeze(value){return value}function deepFreeze(value){return value}function isSerializable(value){return"function"!=typeof value}function addHiddenFinalProp(object,propName,value){Object.defineProperty(object,propName,{enumerable:!1,writable:!1,configurable:!0,value:value})}function addReadOnlyProp(object,propName,value){Object.defineProperty(object,propName,{enumerable:!0,writable:!1,configurable:!0,value:value})}function remove(collection,item){var idx=collection.indexOf(item);-1!==idx&&collection.splice(idx,1)}function registerEventHandler(handlers,handler){return handlers.push(handler),function(){remove(handlers,handler)}}function argsToArray(args){for(var res=Array(args.length),i=0;i<args.length;i++)res[i]=args[i];return res}function splitPatch$$1(patch){return"oldValue"in patch||fail("Patches without `oldValue` field cannot be inversed"),[stripPatch$$1(patch),invertPatch(patch)]}function stripPatch$$1(patch){switch(patch.op){case"add":return{op:"add",path:patch.path,value:patch.value};case"remove":return{op:"remove",path:patch.path};case"replace":return{op:"replace",path:patch.path,value:patch.value};}}function invertPatch(patch){switch(patch.op){case"add":return{op:"remove",path:patch.path};case"remove":return{op:"add",path:patch.path,value:patch.oldValue};case"replace":return{op:"replace",path:patch.path,value:patch.oldValue};}}function isNumber(x){return"number"==typeof x}function escapeJsonPath$$1(str){return!0===isNumber(str)?""+str:str.replace(/~/g,"~1").replace(/\//g,"~0")}function unescapeJsonPath$$1(str){return str.replace(/~0/g,"/").replace(/~1/g,"~")}function joinJsonPath$$1(path){return 0===path.length?"":"/"+path.map(escapeJsonPath$$1).join("/")}function splitJsonPath$$1(path){var parts=path.split("/").map(unescapeJsonPath$$1);return""===parts[0]?parts.slice(1):parts}function mapToString$$1(){return getStateTreeNode$$1(this)+"("+this.size+" items)"}function put(value){if(!!value||fail("Map.put cannot be used to set empty values"),isStateTreeNode$$1(value)){var node=getStateTreeNode$$1(value);return!1,this.set(""+node.identifier,node.value),this}if(!isMutable(value))return fail("Map.put can only be used to store complex values");var mapType=getStateTreeNode$$1(this).type;if(mapType.identifierMode===MapIdentifierMode$$1.NO)return fail(needsIdentifierError);if(mapType.identifierMode===MapIdentifierMode$$1.YES)return this.set(""+value[mapType.identifierAttribute],value),this;var node=getStateTreeNode$$1(mapType.subType.create(value));return node.identifierAttribute?(this.set(""+node.value[node.identifierAttribute],node.value),this):fail(needsIdentifierError)}function arrayToString$$1(){return getStateTreeNode$$1(this)+"("+this.length+" items)"}function reconcileArrayChildren(parent,childType,oldNodes,newValues,newPaths){for(var oldNode,newValue,hasNewNode=!1,oldMatch=void 0,i=0;;i++)if(hasNewNode=i<=newValues.length-1,oldNode=oldNodes[i],newValue=hasNewNode?newValues[i]:void 0,isNode$$1(newValue)&&(newValue=newValue.storedValue),!oldNode&&!hasNewNode)break;else if(!hasNewNode)oldNode.die(),oldNodes.splice(i,1),i--;else if(!oldNode)isStateTreeNode$$1(newValue)&&getStateTreeNode$$1(newValue).parent===parent&&fail("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 '"+parent.path+"/"+newPaths[i]+"', but it lives already at '"+getStateTreeNode$$1(newValue).path+"'"),oldNodes.splice(i,0,valueAsNode(childType,parent,""+newPaths[i],newValue));else if(areSame(oldNode,newValue))oldNodes[i]=valueAsNode(childType,parent,""+newPaths[i],newValue,oldNode);else{oldMatch=void 0;for(var j=i;j<oldNodes.length;j++)if(areSame(oldNodes[j],newValue)){oldMatch=oldNodes.splice(j,1)[0];break}oldNodes.splice(i,0,valueAsNode(childType,parent,""+newPaths[i],newValue,oldMatch))}return oldNodes}function valueAsNode(childType,parent,subpath,newValue,oldNode){if(typecheck$$1(childType,newValue),isStateTreeNode$$1(newValue)){var childNode_1=getStateTreeNode$$1(newValue);if(childNode_1.assertAlive(),null!==childNode_1.parent&&childNode_1.parent===parent)return childNode_1.setParent(parent,subpath),oldNode&&oldNode!==childNode_1&&oldNode.die(),childNode_1}if(oldNode){var childNode_2=childType.reconcile(oldNode,newValue);return childNode_2.setParent(parent,subpath),childNode_2}var childNode=childType.instantiate(parent,subpath,parent._environment,newValue);return childNode}function areSame(oldNode,newValue){return isStateTreeNode$$1(newValue)?getStateTreeNode$$1(newValue)===oldNode:!!(isMutable(newValue)&&oldNode.snapshot===newValue)||!!(oldNode instanceof ObjectNode$$1&&null!==oldNode.identifier&&oldNode.identifierAttribute&&isPlainObject(newValue)&&newValue[oldNode.identifierAttribute]===oldNode.identifier)}function objectTypeToString(){return getStateTreeNode$$1(this).toString()}function toPropertiesObject(properties){return Object.keys(properties).reduce(function(properties,key){if(key in HookNames$$1)return fail("Hook '"+key+"' was defined as property. Hooks should be defined as part of the actions");var descriptor=Object.getOwnPropertyDescriptor(properties,key);"get"in descriptor&&fail("Getters are not supported as properties. Please use views instead");var value=descriptor.value;if(null===value||value===void 0)fail("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(isPrimitive(value))return Object.assign({},properties,(_a={},_a[key]=optional$$1(getPrimitiveFactoryFromValue$$1(value),value),_a));if(isType$$1(value))return properties;"function"==typeof value?fail("Functions are not supported as properties, use views instead"):"object"==typeof value?fail("In property '"+key+"': base models should not contain complex values: '"+value+"'"):fail("Unexpected value for property '"+key+"'")}var _a},properties)}function getPrimitiveFactoryFromValue$$1(value){switch(typeof value){case"string":return string$$1;case"number":return number$$1;case"boolean":return boolean$$1;case"object":if(value instanceof Date)return DatePrimitive$$1;}return fail("Cannot determine primitive type from value "+value)}function isPrimitiveType$$1(type){return isType$$1(type)&&0<(type.flags&(TypeFlags$$1.String|TypeFlags$$1.Number|TypeFlags$$1.Boolean|TypeFlags$$1.Date))}function literal$$1(value){return!1,new Literal$$1(value)}function union$$1(dispatchOrType){for(var otherTypes=[],_i=1;_i<arguments.length;_i++)otherTypes[_i-1]=arguments[_i];var dispatcher=isType$$1(dispatchOrType)?null:dispatchOrType,types=isType$$1(dispatchOrType)?otherTypes.concat(dispatchOrType):otherTypes,name="("+types.map(function(type){return type.name}).join(" | ")+")";return!1,new Union$$1(name,types,dispatcher)}function optional$$1(type,defaultValueOrFunction){return new OptionalValue$$1(type,defaultValueOrFunction)}__webpack_require__.d(__webpack_exports__,"f",function(){return types}),__webpack_require__.d(__webpack_exports__,"e",function(){return onPatch$$1}),__webpack_require__.d(__webpack_exports__,"a",function(){return applyPatch$$1}),__webpack_require__.d(__webpack_exports__,"b",function(){return applySnapshot$$1}),__webpack_require__.d(__webpack_exports__,"d",function(){return getSnapshot$$1}),__webpack_require__.d(__webpack_exports__,"c",function(){return clone$$1});var TypeFlags$$1,mobx__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(51),extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])},__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i],s)Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t},ScalarNode$$1=function(){function ScalarNode$$1(type,parent,subpath,environment,initialValue,storedValue,canAttachTreeNode,finalizeNewInstance){void 0===finalizeNewInstance&&(finalizeNewInstance=noop),this.subpath="",this._environment=void 0,this._autoUnbox=!0,this.state=NodeLifeCycle$$1.INITIALIZING,this.type=type,this.storedValue=storedValue,this._parent=parent,this.subpath=subpath,this.storedValue=storedValue,this._environment=environment,this.unbox=this.unbox.bind(this),canAttachTreeNode&&addHiddenFinalProp(this.storedValue,"$treenode",this);var sawException=!0;try{canAttachTreeNode&&addHiddenFinalProp(this.storedValue,"toJSON",toJSON$$1),finalizeNewInstance(this,initialValue),this.state=NodeLifeCycle$$1.CREATED,sawException=!1}finally{sawException&&(this.state=NodeLifeCycle$$1.DEAD)}}return Object.defineProperty(ScalarNode$$1.prototype,"path",{get:function(){return this.parent?this.parent.path+"/"+escapeJsonPath$$1(this.subpath):""},enumerable:!0,configurable:!0}),Object.defineProperty(ScalarNode$$1.prototype,"isRoot",{get:function(){return null===this.parent},enumerable:!0,configurable:!0}),Object.defineProperty(ScalarNode$$1.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(ScalarNode$$1.prototype,"root",{get:function(){return this._parent?this._parent.root:fail("This scalar node is not part of a tree")},enumerable:!0,configurable:!0}),ScalarNode$$1.prototype.setParent=function(newParent,subpath){void 0===subpath&&(subpath=null),this.parent!==newParent&&fail("Cannot change parent of immutable node"),this.subpath===subpath||(this.subpath=subpath||"")},Object.defineProperty(ScalarNode$$1.prototype,"value",{get:function(){return this.type.getValue(this)},enumerable:!0,configurable:!0}),Object.defineProperty(ScalarNode$$1.prototype,"snapshot",{get:function(){var snapshot=this.type.getSnapshot(this);return freeze(snapshot)},enumerable:!0,configurable:!0}),Object.defineProperty(ScalarNode$$1.prototype,"isAlive",{get:function(){return this.state!==NodeLifeCycle$$1.DEAD},enumerable:!0,configurable:!0}),ScalarNode$$1.prototype.unbox=function(childNode){return childNode&&!0===this._autoUnbox?childNode.value:childNode},ScalarNode$$1.prototype.toString=function(){return this.type.name+"@"+(this.path||"<root>")+(this.isAlive?"":"[dead]")},ScalarNode$$1.prototype.die=function(){this.state=NodeLifeCycle$$1.DEAD},__decorate([mobx__WEBPACK_IMPORTED_MODULE_0__.t],ScalarNode$$1.prototype,"subpath",void 0),ScalarNode$$1}(),nextNodeId=1,ObjectNode$$1=function(){function ObjectNode$$1(type,parent,subpath,environment,initialValue,storedValue,canAttachTreeNode,finalizeNewInstance){void 0===finalizeNewInstance&&(finalizeNewInstance=noop);var _this=this;this.nodeId=++nextNodeId,this.subpath="",this._parent=null,this._isRunningAction=!1,this.isProtectionEnabled=!0,this.identifierAttribute=void 0,this._environment=void 0,this._autoUnbox=!0,this.state=NodeLifeCycle$$1.INITIALIZING,this.middlewares=EMPTY_ARRAY,this.type=type,this.storedValue=storedValue,this._parent=parent,this.subpath=subpath,this._environment=environment,this.unbox=this.unbox.bind(this),this.preboot(),parent||(this.identifierCache=new IdentifierCache$$1),canAttachTreeNode&&addHiddenFinalProp(this.storedValue,"$treenode",this);var sawException=!0;try{canAttachTreeNode&&addHiddenFinalProp(this.storedValue,"toJSON",toJSON$$1),this._isRunningAction=!0,finalizeNewInstance(this,initialValue),this._isRunningAction=!1,parent?parent.root.identifierCache.addNodeToCache(this):this.identifierCache.addNodeToCache(this),this.fireHook("afterCreate"),this.state=NodeLifeCycle$$1.CREATED,sawException=!1}finally{sawException&&(this.state=NodeLifeCycle$$1.DEAD)}var snapshotDisposer=Object(mobx__WEBPACK_IMPORTED_MODULE_0__.v)(function(){return _this.snapshot},function(snapshot){_this.emitSnapshot(snapshot)},{onError:function(e){throw e}});this.addDisposer(snapshotDisposer)}return Object.defineProperty(ObjectNode$$1.prototype,"path",{get:function(){return this.parent?this.parent.path+"/"+escapeJsonPath$$1(this.subpath):""},enumerable:!0,configurable:!0}),Object.defineProperty(ObjectNode$$1.prototype,"isRoot",{get:function(){return null===this.parent},enumerable:!0,configurable:!0}),Object.defineProperty(ObjectNode$$1.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(ObjectNode$$1.prototype,"root",{get:function(){for(var p,r=this;p=r.parent;)r=p;return r},enumerable:!0,configurable:!0}),ObjectNode$$1.prototype.setParent=function(newParent,subpath){void 0===subpath&&(subpath=null),this.parent===newParent&&this.subpath===subpath||(newParent&&(this._parent&&newParent!==this._parent&&fail("A node cannot exists twice in the state tree. Failed to add "+this+" to path '"+newParent.path+"/"+subpath+"'."),!this._parent&&newParent.root===this&&fail("A state tree is not allowed to contain itself. Cannot assign "+this+" to path '"+newParent.path+"/"+subpath+"'"),!this._parent&&!!this.root._environment&&this.root._environment!==newParent.root._environment&&fail("A state tree cannot be made part of another state tree as long as their environments are different.")),this.parent&&!newParent?this.die():(this.subpath=subpath||"",newParent&&newParent!==this._parent&&(newParent.root.identifierCache.mergeCache(this),this._parent=newParent,this.fireHook("afterAttach"))))},ObjectNode$$1.prototype.fireHook=function(name){var fn=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[name];"function"==typeof fn&&fn.apply(this.storedValue)},Object.defineProperty(ObjectNode$$1.prototype,"value",{get:function(){return this.isAlive?this.type.getValue(this):void 0},enumerable:!0,configurable:!0}),Object.defineProperty(ObjectNode$$1.prototype,"snapshot",{get:function(){if(this.isAlive){var snapshot=this.type.getSnapshot(this);return freeze(snapshot)}},enumerable:!0,configurable:!0}),ObjectNode$$1.prototype.isRunningAction=function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()},Object.defineProperty(ObjectNode$$1.prototype,"identifier",{get:function(){return this.identifierAttribute?this.storedValue[this.identifierAttribute]:null},enumerable:!0,configurable:!0}),Object.defineProperty(ObjectNode$$1.prototype,"isAlive",{get:function(){return this.state!==NodeLifeCycle$$1.DEAD},enumerable:!0,configurable:!0}),ObjectNode$$1.prototype.assertAlive=function(){this.isAlive||fail(this+" cannot be used anymore as it has died; it has been removed from a state tree. If you want to remove an element from a tree and let it live on, use 'detach' or 'clone' the value")},ObjectNode$$1.prototype.getChildNode=function(subpath){this.assertAlive(),this._autoUnbox=!1;try{return this.type.getChildNode(this,subpath)}finally{this._autoUnbox=!0}},ObjectNode$$1.prototype.getChildren=function(){this.assertAlive(),this._autoUnbox=!1;try{return this.type.getChildren(this)}finally{this._autoUnbox=!0}},ObjectNode$$1.prototype.getChildType=function(key){return this.type.getChildType(key)},Object.defineProperty(ObjectNode$$1.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!0,configurable:!0}),ObjectNode$$1.prototype.assertWritable=function(){this.assertAlive(),!this.isRunningAction()&&this.isProtected&&fail("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")},ObjectNode$$1.prototype.removeChild=function(subpath){this.type.removeChild(this,subpath)},ObjectNode$$1.prototype.unbox=function(childNode){return childNode&&!0===this._autoUnbox?childNode.value:childNode},ObjectNode$$1.prototype.toString=function(){var identifier$$1=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+(this.path||"<root>")+identifier$$1+(this.isAlive?"":"[dead]")},ObjectNode$$1.prototype.finalizeCreation=function(){if(this.state===NodeLifeCycle$$1.CREATED){if(this.parent){if(this.parent.state!==NodeLifeCycle$$1.FINALIZED)return;this.fireHook("afterAttach")}this.state=NodeLifeCycle$$1.FINALIZED;for(var child,_i=0,_a=this.getChildren();_i<_a.length;_i++)child=_a[_i],child instanceof ObjectNode$$1&&child.finalizeCreation()}},ObjectNode$$1.prototype.detach=function(){this.isAlive||fail("Error while detaching, node is not alive."),this.isRoot||(this.fireHook("beforeDetach"),this._environment=this.root._environment,this.state=NodeLifeCycle$$1.DETACHING,this.identifierCache=this.root.identifierCache.splitCache(this),this.parent.removeChild(this.subpath),this._parent=null,this.subpath="",this.state=NodeLifeCycle$$1.FINALIZED)},ObjectNode$$1.prototype.preboot=function(){var _this=this;this.disposers=[],this.middlewares=[],this.snapshotSubscribers=[],this.patchSubscribers=[],this.applyPatches=createActionInvoker$$1(this.storedValue,"@APPLY_PATCHES",function(patches){patches.forEach(function(patch){var parts=splitJsonPath$$1(patch.path),node=resolveNodeByPathParts$$1(_this,parts.slice(0,-1));node.applyPatchLocally(parts[parts.length-1],patch)})}).bind(this.storedValue),this.applySnapshot=createActionInvoker$$1(this.storedValue,"@APPLY_SNAPSHOT",function(snapshot){return snapshot===_this.snapshot?void 0:_this.type.applySnapshot(_this,snapshot)}).bind(this.storedValue)},ObjectNode$$1.prototype.die=function(){this.state===NodeLifeCycle$$1.DETACHING||isStateTreeNode$$1(this.storedValue)&&(walk$$1(this.storedValue,function(child){var node=getStateTreeNode$$1(child);node instanceof ObjectNode$$1&&node.aboutToDie()}),walk$$1(this.storedValue,function(child){var node=getStateTreeNode$$1(child);node instanceof ObjectNode$$1&&node.finalizeDeath()}))},ObjectNode$$1.prototype.aboutToDie=function(){this.disposers.splice(0).forEach(function(f){return f()}),this.fireHook("beforeDestroy")},ObjectNode$$1.prototype.finalizeDeath=function(){this.root.identifierCache.notifyDied(this);var self=this,oldPath=this.path;addReadOnlyProp(this,"snapshot",this.snapshot),this.patchSubscribers.splice(0),this.snapshotSubscribers.splice(0),this.patchSubscribers.splice(0),this.state=NodeLifeCycle$$1.DEAD,this._parent=null,this.subpath="",Object.defineProperty(this.storedValue,"$mobx",{get:function(){fail("This object has died and is no longer part of a state tree. It cannot be used anymore. The object (of type '"+self.type.name+"') used to live at '"+oldPath+"'. It is possible to access the last snapshot of this object using 'getSnapshot', or to create a fresh copy using 'clone'. If you want to remove an object from the tree without killing it, use 'detach' instead.")}})},ObjectNode$$1.prototype.onSnapshot=function(onChange){return registerEventHandler(this.snapshotSubscribers,onChange)},ObjectNode$$1.prototype.emitSnapshot=function(snapshot){this.snapshotSubscribers.forEach(function(f){return f(snapshot)})},ObjectNode$$1.prototype.onPatch=function(handler){return registerEventHandler(this.patchSubscribers,handler)},ObjectNode$$1.prototype.emitPatch=function(basePatch,source){if(this.patchSubscribers.length){var localizedPatch=extend({},basePatch,{path:source.path.substr(this.path.length)+"/"+basePatch.path}),_a=splitPatch$$1(localizedPatch),patch_1=_a[0],reversePatch_1=_a[1];this.patchSubscribers.forEach(function(f){return f(patch_1,reversePatch_1)})}this.parent&&this.parent.emitPatch(basePatch,source)},ObjectNode$$1.prototype.addDisposer=function(disposer){this.disposers.unshift(disposer)},ObjectNode$$1.prototype.removeMiddleware=function(handler){this.middlewares=this.middlewares.filter(function(middleware){return middleware.handler!==handler})},ObjectNode$$1.prototype.addMiddleWare=function(handler,includeHooks){var _this=this;return void 0===includeHooks&&(includeHooks=!0),this.middlewares.push({handler:handler,includeHooks:includeHooks}),function(){_this.removeMiddleware(handler)}},ObjectNode$$1.prototype.applyPatchLocally=function(subpath,patch){this.assertWritable(),this.type.applyPatchLocally(this,subpath,patch)},__decorate([mobx__WEBPACK_IMPORTED_MODULE_0__.t],ObjectNode$$1.prototype,"subpath",void 0),__decorate([mobx__WEBPACK_IMPORTED_MODULE_0__.t],ObjectNode$$1.prototype,"_parent",void 0),__decorate([mobx__WEBPACK_IMPORTED_MODULE_0__.g],ObjectNode$$1.prototype,"path",null),__decorate([mobx__WEBPACK_IMPORTED_MODULE_0__.g],ObjectNode$$1.prototype,"value",null),__decorate([mobx__WEBPACK_IMPORTED_MODULE_0__.g],ObjectNode$$1.prototype,"snapshot",null),ObjectNode$$1}();/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0

THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.

See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */(function(TypeFlags$$1){TypeFlags$$1[TypeFlags$$1.String=1]="String",TypeFlags$$1[TypeFlags$$1.Number=2]="Number",TypeFlags$$1[TypeFlags$$1.Boolean=4]="Boolean",TypeFlags$$1[TypeFlags$$1.Date=8]="Date",TypeFlags$$1[TypeFlags$$1.Literal=16]="Literal",TypeFlags$$1[TypeFlags$$1.Array=32]="Array",TypeFlags$$1[TypeFlags$$1.Map=64]="Map",TypeFlags$$1[TypeFlags$$1.Object=128]="Object",TypeFlags$$1[TypeFlags$$1.Frozen=256]="Frozen",TypeFlags$$1[TypeFlags$$1.Optional=512]="Optional",TypeFlags$$1[TypeFlags$$1.Reference=1024]="Reference",TypeFlags$$1[TypeFlags$$1.Identifier=2048]="Identifier",TypeFlags$$1[TypeFlags$$1.Late=4096]="Late",TypeFlags$$1[TypeFlags$$1.Refinement=8192]="Refinement",TypeFlags$$1[TypeFlags$$1.Union=16384]="Union",TypeFlags$$1[TypeFlags$$1.Null=32768]="Null",TypeFlags$$1[TypeFlags$$1.Undefined=65536]="Undefined"})(TypeFlags$$1||(TypeFlags$$1={}));var NodeLifeCycle$$1,ComplexType$$1=function(){function ComplexType$$1(name){this.isType=!0,this.name=name}return ComplexType$$1.prototype.create=function(snapshot,environment){return void 0===snapshot&&(snapshot=this.getDefaultSnapshot()),typecheck$$1(this,snapshot),this.instantiate(null,"",environment,snapshot).value},ComplexType$$1.prototype.isAssignableFrom=function(type){return type===this},ComplexType$$1.prototype.validate=function(value,context){return isStateTreeNode$$1(value)?getType$$1(value)===this||this.isAssignableFrom(getType$$1(value))?typeCheckSuccess$$1():typeCheckFailure$$1(context,value):this.isValidSnapshot(value,context)},ComplexType$$1.prototype.is=function(value){return 0===this.validate(value,[{path:"",type:this}]).length},ComplexType$$1.prototype.reconcile=function(current,newValue){if(current.snapshot===newValue)return current;if(isStateTreeNode$$1(newValue)&&getStateTreeNode$$1(newValue)===current)return current;if(current.type===this&&isMutable(newValue)&&!isStateTreeNode$$1(newValue)&&(!current.identifierAttribute||current.identifier===newValue[current.identifierAttribute]))return current.applySnapshot(newValue),current;var parent=current.parent,subpath=current.subpath;if(current.die(),isStateTreeNode$$1(newValue)&&this.isAssignableFrom(getType$$1(newValue))){var newNode=getStateTreeNode$$1(newValue);return newNode.setParent(parent,subpath),newNode}return this.instantiate(parent,subpath,current._environment,newValue)},Object.defineProperty(ComplexType$$1.prototype,"Type",{get:function(){return fail("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(ComplexType$$1.prototype,"SnapshotType",{get:function(){return fail("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}),__decorate([mobx__WEBPACK_IMPORTED_MODULE_0__.e],ComplexType$$1.prototype,"create",null),ComplexType$$1}(),Type$$1=function(_super){function Type$$1(name){return _super.call(this,name)||this}return __extends(Type$$1,_super),Type$$1.prototype.getValue=function(node){return node.storedValue},Type$$1.prototype.getSnapshot=function(node){return node.storedValue},Type$$1.prototype.getDefaultSnapshot=function(){},Type$$1.prototype.applySnapshot=function(){fail("Immutable types do not support applying snapshots")},Type$$1.prototype.applyPatchLocally=function(){fail("Immutable types do not support applying patches")},Type$$1.prototype.getChildren=function(){return EMPTY_ARRAY},Type$$1.prototype.getChildNode=function(node,key){return fail("No child '"+key+"' available in type: "+this.name)},Type$$1.prototype.getChildType=function(key){return fail("No child '"+key+"' available in type: "+this.name)},Type$$1.prototype.reconcile=function(current,newValue){if(current.type===this&&current.storedValue===newValue)return current;var res=this.instantiate(current.parent,current.subpath,current._environment,newValue);return current.die(),res},Type$$1.prototype.removeChild=function(node,subpath){return fail("No child '"+subpath+"' available in type: "+this.name)},Type$$1}(ComplexType$$1),runningActions=new Map,nextActionId=1,currentActionContext=null,IdentifierCache$$1=function(){function IdentifierCache$$1(){this.cache=mobx__WEBPACK_IMPORTED_MODULE_0__.t.map()}return IdentifierCache$$1.prototype.addNodeToCache=function(node){if(node.identifierAttribute){var identifier$$1=""+node.identifier;this.cache.has(identifier$$1)||this.cache.set(identifier$$1,mobx__WEBPACK_IMPORTED_MODULE_0__.t.array([],mobxShallow));var set=this.cache.get(identifier$$1);-1!==set.indexOf(node)&&fail("Already registered"),set.push(node)}return this},IdentifierCache$$1.prototype.mergeCache=function(node){var _this=this;Object(mobx__WEBPACK_IMPORTED_MODULE_0__.z)(node.identifierCache.cache).forEach(function(nodes){return nodes.forEach(function(child){_this.addNodeToCache(child)})})},IdentifierCache$$1.prototype.notifyDied=function(node){if(node.identifierAttribute){var set=this.cache.get(""+node.identifier);set&&set.remove(node)}},IdentifierCache$$1.prototype.splitCache=function(node){var res=new IdentifierCache$$1,basePath=node.path;return Object(mobx__WEBPACK_IMPORTED_MODULE_0__.z)(this.cache).forEach(function(nodes){for(var i=nodes.length-1;0<=i;i--)0===nodes[i].path.indexOf(basePath)&&(res.addNodeToCache(nodes[i]),nodes.splice(i,1))}),res},IdentifierCache$$1.prototype.resolve=function(type,identifier$$1){var set=this.cache.get(""+identifier$$1);if(!set)return null;var matches=set.filter(function(candidate){return type.isAssignableFrom(candidate.type)});switch(matches.length){case 0:return null;case 1:return matches[0];default:return fail("Cannot resolve a reference to type '"+type.name+"' with id: '"+identifier$$1+"' unambigously, there are multiple candidates: "+matches.map(function(n){return n.path}).join(", "));}},IdentifierCache$$1}();(function(NodeLifeCycle$$1){NodeLifeCycle$$1[NodeLifeCycle$$1.INITIALIZING=0]="INITIALIZING",NodeLifeCycle$$1[NodeLifeCycle$$1.CREATED=1]="CREATED",NodeLifeCycle$$1[NodeLifeCycle$$1.FINALIZED=2]="FINALIZED",NodeLifeCycle$$1[NodeLifeCycle$$1.DETACHING=3]="DETACHING",NodeLifeCycle$$1[NodeLifeCycle$$1.DEAD=4]="DEAD"})(NodeLifeCycle$$1||(NodeLifeCycle$$1={}));var doubleDot=function(){return".."},EMPTY_ARRAY=Object.freeze([]),EMPTY_OBJECT=Object.freeze({}),mobxShallow={deep:!1};Object.freeze(mobxShallow);var deprecated=function(){};deprecated=function(id,message){},deprecated.ids={};var MapIdentifierMode$$1,needsIdentifierError="Map.put can only be used to store complex values that have an identifier type attribute";(function(MapIdentifierMode$$1){MapIdentifierMode$$1[MapIdentifierMode$$1.UNKNOWN=0]="UNKNOWN",MapIdentifierMode$$1[MapIdentifierMode$$1.YES=1]="YES",MapIdentifierMode$$1[MapIdentifierMode$$1.NO=2]="NO"})(MapIdentifierMode$$1||(MapIdentifierMode$$1={}));var HookNames$$1,MapType$$1=function(_super){function MapType$$1(name,subType){var _this=_super.call(this,name)||this;return _this.shouldAttachNode=!0,_this.identifierMode=MapIdentifierMode$$1.UNKNOWN,_this.identifierAttribute=void 0,_this.flags=TypeFlags$$1.Map,_this.createNewInstance=function(){var map$$1=mobx__WEBPACK_IMPORTED_MODULE_0__.t.map({},mobxShallow);return addHiddenFinalProp(map$$1,"put",put),addHiddenFinalProp(map$$1,"toString",mapToString$$1),map$$1},_this.finalizeNewInstance=function(node,snapshot){var objNode=node,instance=objNode.storedValue;Object(mobx__WEBPACK_IMPORTED_MODULE_0__.d)(instance,objNode.unbox),Object(mobx__WEBPACK_IMPORTED_MODULE_0__.m)(instance,function(c){return _this.willChange(c)}),objNode.applySnapshot(snapshot),Object(mobx__WEBPACK_IMPORTED_MODULE_0__.u)(instance,_this.didChange)},_this.subType=subType,_this}return __extends(MapType$$1,_super),MapType$$1.prototype.instantiate=function(parent,subpath,environment,snapshot){return createNode$$1(this,parent,subpath,environment,snapshot,this.createNewInstance,this.finalizeNewInstance)},MapType$$1.prototype.describe=function(){return"Map<string, "+this.subType.describe()+">"},MapType$$1.prototype.getChildren=function(node){return Object(mobx__WEBPACK_IMPORTED_MODULE_0__.z)(node.storedValue)},MapType$$1.prototype.getChildNode=function(node,key){var childNode=node.storedValue.get(""+key);return childNode||fail("Not a child "+key),childNode},MapType$$1.prototype.willChange=function(change){var node=getStateTreeNode$$1(change.object),key=""+change.name;switch(node.assertWritable(),change.type){case"update":{var newValue=change.newValue,oldValue=change.object.get(key);if(newValue===oldValue)return null;typecheck$$1(this.subType,newValue),change.newValue=this.subType.reconcile(node.getChildNode(key),change.newValue),this.processIdentifier(key,change.newValue)}break;case"add":typecheck$$1(this.subType,change.newValue),change.newValue=this.subType.instantiate(node,key,void 0,change.newValue),this.processIdentifier(key,change.newValue);}return change},MapType$$1.prototype.processIdentifier=function(expected,node){if(node instanceof ObjectNode$$1&&(this.identifierMode===MapIdentifierMode$$1.UNKNOWN&&(this.identifierMode=void 0===node.identifierAttribute?MapIdentifierMode$$1.NO:MapIdentifierMode$$1.YES,this.identifierAttribute=node.identifierAttribute),node.identifierAttribute!==this.identifierAttribute&&fail("The objects in a map should all have the same identifier attribute, expected '"+this.identifierAttribute+"', but child of type '"+node.type.name+"' declared attribute '"+node.identifierAttribute+"' as identifier"),this.identifierMode===MapIdentifierMode$$1.YES)){var identifier$$1=""+node.identifier;identifier$$1!==expected&&fail("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+identifier$$1+"', but expected: '"+expected+"'")}},MapType$$1.prototype.getValue=function(node){return node.storedValue},MapType$$1.prototype.getSnapshot=function(node){var res={};return node.getChildren().forEach(function(childNode){res[childNode.subpath]=childNode.snapshot}),res},MapType$$1.prototype.didChange=function(change){var node=getStateTreeNode$$1(change.object);switch(change.type){case"update":return void node.emitPatch({op:"replace",path:escapeJsonPath$$1(change.name),value:change.newValue.snapshot,oldValue:change.oldValue?change.oldValue.snapshot:void 0},node);case"add":return void node.emitPatch({op:"add",path:escapeJsonPath$$1(change.name),value:change.newValue.snapshot,oldValue:void 0},node);case"delete":var oldSnapshot=change.oldValue.snapshot;return change.oldValue.die(),void node.emitPatch({op:"remove",path:escapeJsonPath$$1(change.name),oldValue:oldSnapshot},node);}},MapType$$1.prototype.applyPatchLocally=function(node,subpath,patch){var target=node.storedValue;switch(patch.op){case"add":case"replace":target.set(subpath,patch.value);break;case"remove":target.delete(subpath);}},MapType$$1.prototype.applySnapshot=function(node,snapshot){typecheck$$1(this,snapshot);var target=node.storedValue,currentKeys={};for(var key in Array.from(target.keys()).forEach(function(key){currentKeys[key]=!1}),snapshot)target.set(""+key,snapshot[key]),currentKeys[""+key]=!0;Object.keys(currentKeys).forEach(function(key){!1===currentKeys[key]&&target.delete(key)})},MapType$$1.prototype.getChildType=function(){return this.subType},MapType$$1.prototype.isValidSnapshot=function(value,context){var _this=this;return isPlainObject(value)?flattenTypeErrors$$1(Object.keys(value).map(function(path){return _this.subType.validate(value[path],getContextForPath$$1(context,path,_this.subType))})):typeCheckFailure$$1(context,value,"Value is not a plain object")},MapType$$1.prototype.getDefaultSnapshot=function(){return{}},MapType$$1.prototype.removeChild=function(node,subpath){node.storedValue.delete(subpath)},__decorate([mobx__WEBPACK_IMPORTED_MODULE_0__.e],MapType$$1.prototype,"applySnapshot",null),MapType$$1}(ComplexType$$1),ArrayType$$1=function(_super){function ArrayType$$1(name,subType){var _this=_super.call(this,name)||this;return _this.shouldAttachNode=!0,_this.flags=TypeFlags$$1.Array,_this.createNewInstance=function(){var array$$1=mobx__WEBPACK_IMPORTED_MODULE_0__.t.array([],mobxShallow);return addHiddenFinalProp(array$$1,"toString",arrayToString$$1),array$$1},_this.finalizeNewInstance=function(node,snapshot){var objNode=node,instance=objNode.storedValue;Object(mobx__WEBPACK_IMPORTED_MODULE_0__.c)(instance).dehancer=objNode.unbox,Object(mobx__WEBPACK_IMPORTED_MODULE_0__.m)(instance,function(change){return _this.willChange(change)}),objNode.applySnapshot(snapshot),Object(mobx__WEBPACK_IMPORTED_MODULE_0__.u)(instance,_this.didChange)},_this.subType=subType,_this}return __extends(ArrayType$$1,_super),ArrayType$$1.prototype.describe=function(){return this.subType.describe()+"[]"},ArrayType$$1.prototype.instantiate=function(parent,subpath,environment,snapshot){return createNode$$1(this,parent,subpath,environment,snapshot,this.createNewInstance,this.finalizeNewInstance)},ArrayType$$1.prototype.getChildren=function(node){return node.storedValue.peek()},ArrayType$$1.prototype.getChildNode=function(node,key){var index=parseInt(key,10);return index<node.storedValue.length?node.storedValue[index]:fail("Not a child: "+key)},ArrayType$$1.prototype.willChange=function(change){var node=getStateTreeNode$$1(change.object);node.assertWritable();var childNodes=node.getChildren();switch(change.type){case"update":if(change.newValue===change.object[change.index])return null;change.newValue=reconcileArrayChildren(node,this.subType,[childNodes[change.index]],[change.newValue],[change.index])[0];break;case"splice":var index_1=change.index,removedCount=change.removedCount,added=change.added;change.added=reconcileArrayChildren(node,this.subType,childNodes.slice(index_1,index_1+removedCount),added,added.map(function(_,i){return index_1+i}));for(var i=index_1+removedCount;i<childNodes.length;i++)childNodes[i].setParent(node,""+(i+added.length-removedCount));}return change},ArrayType$$1.prototype.getValue=function(node){return node.storedValue},ArrayType$$1.prototype.getSnapshot=function(node){return node.getChildren().map(function(childNode){return childNode.snapshot})},ArrayType$$1.prototype.didChange=function(change){var node=getStateTreeNode$$1(change.object);switch(change.type){case"update":return void node.emitPatch({op:"replace",path:""+change.index,value:change.newValue.snapshot,oldValue:change.oldValue?change.oldValue.snapshot:void 0},node);case"splice":for(var i=change.removedCount-1;0<=i;i--)node.emitPatch({op:"remove",path:""+(change.index+i),oldValue:change.removed[i].snapshot},node);for(var i=0;i<change.addedCount;i++)node.emitPatch({op:"add",path:""+(change.index+i),value:node.getChildNode(""+(change.index+i)).snapshot,oldValue:void 0},node);}},ArrayType$$1.prototype.applyPatchLocally=function(node,subpath,patch){var target=node.storedValue,index="-"===subpath?target.length:parseInt(subpath);switch(patch.op){case"replace":target[index]=patch.value;break;case"add":target.splice(index,0,patch.value);break;case"remove":target.splice(index,1);}},ArrayType$$1.prototype.applySnapshot=function(node,snapshot){typecheck$$1(this,snapshot);var target=node.storedValue;target.replace(snapshot)},ArrayType$$1.prototype.getChildType=function(){return this.subType},ArrayType$$1.prototype.isValidSnapshot=function(value,context){var _this=this;return isArray(value)?flattenTypeErrors$$1(value.map(function(item,index){return _this.subType.validate(item,getContextForPath$$1(context,""+index,_this.subType))})):typeCheckFailure$$1(context,value,"Value is not an array")},ArrayType$$1.prototype.getDefaultSnapshot=function(){return[]},ArrayType$$1.prototype.removeChild=function(node,subpath){node.storedValue.splice(parseInt(subpath,10),1)},__decorate([mobx__WEBPACK_IMPORTED_MODULE_0__.e],ArrayType$$1.prototype,"applySnapshot",null),ArrayType$$1}(ComplexType$$1),PRE_PROCESS_SNAPSHOT="preProcessSnapshot";(function(HookNames$$1){HookNames$$1.afterCreate="afterCreate",HookNames$$1.afterAttach="afterAttach",HookNames$$1.postProcessSnapshot="postProcessSnapshot",HookNames$$1.beforeDetach="beforeDetach",HookNames$$1.beforeDestroy="beforeDestroy"})(HookNames$$1||(HookNames$$1={}));var defaultObjectOptions={name:"AnonymousModel",properties:{},initializers:EMPTY_ARRAY},ModelType$$1=function(_super){function ModelType$$1(opts){var _this=_super.call(this,opts.name||defaultObjectOptions.name)||this;_this.flags=TypeFlags$$1.Object,_this.shouldAttachNode=!0,_this.properties={},_this.createNewInstance=function(){var instance=mobx__WEBPACK_IMPORTED_MODULE_0__.t.object(EMPTY_OBJECT,EMPTY_OBJECT,mobxShallow);return addHiddenFinalProp(instance,"toString",objectTypeToString),instance},_this.finalizeNewInstance=function(node,snapshot){var objNode=node,instance=objNode.storedValue;_this.forAllProps(function(name,type){Object(mobx__WEBPACK_IMPORTED_MODULE_0__.j)(instance,(_a={},_a[name]=type.instantiate(objNode,name,objNode._environment,snapshot[name]),_a),EMPTY_OBJECT,mobxShallow),Object(mobx__WEBPACK_IMPORTED_MODULE_0__.d)(instance,name,objNode.unbox);var _a}),_this.initializers.reduce(function(self,fn){return fn(self)},instance),Object(mobx__WEBPACK_IMPORTED_MODULE_0__.m)(instance,function(change){return _this.willChange(change)}),Object(mobx__WEBPACK_IMPORTED_MODULE_0__.u)(instance,_this.didChange)},_this.didChange=function(change){if(_this.properties[change.name]){var node=getStateTreeNode$$1(change.object),oldValue=change.oldValue?change.oldValue.snapshot:void 0;node.emitPatch({op:"replace",path:escapeJsonPath$$1(change.name),value:change.newValue.snapshot,oldValue:oldValue},node)}};var name=opts.name||defaultObjectOptions.name;return /^\w[\w\d_]*$/.test(name)||fail("Typename should be a valid identifier: "+name),Object.assign(_this,defaultObjectOptions,opts),_this.properties=toPropertiesObject(_this.properties),freeze(_this.properties),_this}return __extends(ModelType$$1,_super),Object.defineProperty(ModelType$$1.prototype,"propertyNames",{get:function(){return Object.keys(this.properties)},enumerable:!0,configurable:!0}),ModelType$$1.prototype.cloneAndEnhance=function(opts){return new ModelType$$1({name:opts.name||this.name,properties:Object.assign({},this.properties,opts.properties),initializers:this.initializers.concat(opts.initializers||[]),preProcessor:opts.preProcessor||this.preProcessor})},ModelType$$1.prototype.actions=function(fn){var _this=this;return this.cloneAndEnhance({initializers:[function(self){return _this.instantiateActions(self,fn(self)),self}]})},ModelType$$1.prototype.instantiateActions=function(self,actions){isPlainObject(actions)||fail("actions initializer should return a plain object containing actions"),Object.keys(actions).forEach(function(name){if(name===PRE_PROCESS_SNAPSHOT)return fail("Cannot define action '"+PRE_PROCESS_SNAPSHOT+"', it should be defined using 'type.preProcessSnapshot(fn)' instead");var action$$1=actions[name],baseAction=self[name];if(name in HookNames$$1&&baseAction){var specializedAction_1=action$$1;action$$1=name===HookNames$$1.postProcessSnapshot?function(snapshot){return specializedAction_1(baseAction(snapshot))}:function(){baseAction.apply(null,arguments),specializedAction_1.apply(null,arguments)}}addHiddenFinalProp(self,name,createActionInvoker$$1(self,name,action$$1))})},ModelType$$1.prototype.named=function(name){return this.cloneAndEnhance({name:name})},ModelType$$1.prototype.props=function(properties){return this.cloneAndEnhance({properties:properties})},ModelType$$1.prototype.volatile=function(fn){var _this=this;return this.cloneAndEnhance({initializers:[function(self){return _this.instantiateVolatileState(self,fn(self)),self}]})},ModelType$$1.prototype.instantiateVolatileState=function(self,state){isPlainObject(state)||fail("volatile state initializer should return a plain object containing state"),Object(mobx__WEBPACK_IMPORTED_MODULE_0__.j)(self,state,EMPTY_OBJECT,mobxShallow)},ModelType$$1.prototype.extend=function(fn){var _this=this;return this.cloneAndEnhance({initializers:[function(self){var _a=fn(self),actions=_a.actions,views=_a.views,state=_a.state,rest=__rest(_a,["actions","views","state"]);for(var key in rest)fail("The `extend` function should return an object with a subset of the fields 'actions', 'views' and 'state'. Found invalid key '"+key+"'");return state&&_this.instantiateVolatileState(self,state),views&&_this.instantiateViews(self,views),actions&&_this.instantiateActions(self,actions),self}]})},ModelType$$1.prototype.views=function(fn){var _this=this;return this.cloneAndEnhance({initializers:[function(self){return _this.instantiateViews(self,fn(self)),self}]})},ModelType$$1.prototype.instantiateViews=function(self,views){isPlainObject(views)||fail("views initializer should return a plain object containing views"),Object.keys(views).forEach(function(key){var descriptor=Object.getOwnPropertyDescriptor(views,key),value=descriptor.value;if(!("get"in descriptor))"function"==typeof value?addHiddenFinalProp(self,key,value):fail("A view member should either be a function or getter based property");else if(Object(mobx__WEBPACK_IMPORTED_MODULE_0__.n)(self.$mobx.values[key]))self.$mobx.values[key]=Object(mobx__WEBPACK_IMPORTED_MODULE_0__.g)(descriptor.get,{name:key,set:descriptor.set,context:self});else{var tmp={};Object.defineProperty(tmp,key,{get:descriptor.get,set:descriptor.set,enumerable:!0}),Object(mobx__WEBPACK_IMPORTED_MODULE_0__.j)(self,tmp,EMPTY_OBJECT,mobxShallow)}})},ModelType$$1.prototype.preProcessSnapshot=function(preProcessor){var currentPreprocessor=this.preProcessor;return currentPreprocessor?this.cloneAndEnhance({preProcessor:function(snapshot){return currentPreprocessor(preProcessor(snapshot))}}):this.cloneAndEnhance({preProcessor:preProcessor})},ModelType$$1.prototype.instantiate=function(parent,subpath,environment,snapshot){return createNode$$1(this,parent,subpath,environment,this.applySnapshotPreProcessor(snapshot),this.createNewInstance,this.finalizeNewInstance)},ModelType$$1.prototype.willChange=function(change){var node=getStateTreeNode$$1(change.object);node.assertWritable();var type=this.properties[change.name];return type&&(typecheck$$1(type,change.newValue),change.newValue=type.reconcile(node.getChildNode(change.name),change.newValue)),change},ModelType$$1.prototype.getChildren=function(node){var _this=this,res=[];return this.forAllProps(function(name){res.push(_this.getChildNode(node,name))}),res},ModelType$$1.prototype.getChildNode=function(node,key){if(!(key in this.properties))return fail("Not a value property: "+key);var childNode=node.storedValue.$mobx.values[key].value;return childNode?childNode:fail("Node not available for property "+key)},ModelType$$1.prototype.getValue=function(node){return node.storedValue},ModelType$$1.prototype.getSnapshot=function(node){var _this=this,res={};return this.forAllProps(function(name){Object(mobx__WEBPACK_IMPORTED_MODULE_0__.k)(node.storedValue,name).reportObserved(),res[name]=_this.getChildNode(node,name).snapshot}),"function"==typeof node.storedValue.postProcessSnapshot?node.storedValue.postProcessSnapshot.call(null,res):res},ModelType$$1.prototype.applyPatchLocally=function(node,subpath,patch){"replace"===patch.op||"add"===patch.op||fail("object does not support operation "+patch.op),node.storedValue[subpath]=patch.value},ModelType$$1.prototype.applySnapshot=function(node,snapshot){var s=this.applySnapshotPreProcessor(snapshot);typecheck$$1(this,s),this.forAllProps(function(name){node.storedValue[name]=s[name]})},ModelType$$1.prototype.applySnapshotPreProcessor=function(snapshot){return this.preProcessor?this.preProcessor.call(null,snapshot):snapshot},ModelType$$1.prototype.getChildType=function(key){return this.properties[key]},ModelType$$1.prototype.isValidSnapshot=function(value,context){var _this=this,snapshot=this.applySnapshotPreProcessor(value);return isPlainObject(snapshot)?flattenTypeErrors$$1(this.propertyNames.map(function(key){return _this.properties[key].validate(snapshot[key],getContextForPath$$1(context,key,_this.properties[key]))})):typeCheckFailure$$1(context,snapshot,"Value is not a plain object")},ModelType$$1.prototype.forAllProps=function(fn){var _this=this;this.propertyNames.forEach(function(key){return fn(key,_this.properties[key])})},ModelType$$1.prototype.describe=function(){var _this=this;return"{ "+this.propertyNames.map(function(key){return key+": "+_this.properties[key].describe()}).join("; ")+" }"},ModelType$$1.prototype.getDefaultSnapshot=function(){return{}},ModelType$$1.prototype.removeChild=function(node,subpath){node.storedValue[subpath]=null},__decorate([mobx__WEBPACK_IMPORTED_MODULE_0__.e],ModelType$$1.prototype,"applySnapshot",null),ModelType$$1}(ComplexType$$1),CoreType$$1=function(_super){function CoreType$$1(name,flags,checker,initializer){void 0===initializer&&(initializer=identity);var _this=_super.call(this,name)||this;return _this.shouldAttachNode=!1,_this.flags=flags,_this.checker=checker,_this.initializer=initializer,_this}return __extends(CoreType$$1,_super),CoreType$$1.prototype.describe=function(){return this.name},CoreType$$1.prototype.instantiate=function(parent,subpath,environment,snapshot){return createNode$$1(this,parent,subpath,environment,snapshot,this.initializer)},CoreType$$1.prototype.isValidSnapshot=function(value,context){if(isPrimitive(value)&&this.checker(value))return typeCheckSuccess$$1();var typeName="Date"===this.name?"Date or a unix milliseconds timestamp":this.name;return typeCheckFailure$$1(context,value,"Value is not a "+typeName)},CoreType$$1}(Type$$1),string$$1=new CoreType$$1("string",TypeFlags$$1.String,function(v){return"string"==typeof v}),number$$1=new CoreType$$1("number",TypeFlags$$1.Number,function(v){return"number"==typeof v}),boolean$$1=new CoreType$$1("boolean",TypeFlags$$1.Boolean,function(v){return"boolean"==typeof v}),nullType$$1=new CoreType$$1("null",TypeFlags$$1.Null,function(v){return null===v}),undefinedType$$1=new CoreType$$1("undefined",TypeFlags$$1.Undefined,function(v){return v===void 0}),DatePrimitive$$1=new CoreType$$1("Date",TypeFlags$$1.Date,function(v){return"number"==typeof v||v instanceof Date},function(v){return v instanceof Date?v:new Date(v)});DatePrimitive$$1.getSnapshot=function(node){return node.storedValue.getTime()};var Literal$$1=function(_super){function Literal$$1(value){var _this=_super.call(this,JSON.stringify(value))||this;return _this.shouldAttachNode=!1,_this.flags=TypeFlags$$1.Literal,_this.value=value,_this}return __extends(Literal$$1,_super),Literal$$1.prototype.instantiate=function(parent,subpath,environment,snapshot){return createNode$$1(this,parent,subpath,environment,snapshot)},Literal$$1.prototype.describe=function(){return JSON.stringify(this.value)},Literal$$1.prototype.isValidSnapshot=function(value,context){return isPrimitive(value)&&value===this.value?typeCheckSuccess$$1():typeCheckFailure$$1(context,value,"Value is not a literal "+JSON.stringify(this.value))},Literal$$1}(Type$$1),Refinement$$1=function(_super){function Refinement$$1(name,type,predicate,message){var _this=_super.call(this,name)||this;return _this.type=type,_this.predicate=predicate,_this.message=message,_this}return __extends(Refinement$$1,_super),Object.defineProperty(Refinement$$1.prototype,"flags",{get:function(){return this.type.flags|TypeFlags$$1.Refinement},enumerable:!0,configurable:!0}),Object.defineProperty(Refinement$$1.prototype,"shouldAttachNode",{get:function(){return this.type.shouldAttachNode},enumerable:!0,configurable:!0}),Refinement$$1.prototype.describe=function(){return this.name},Refinement$$1.prototype.instantiate=function(parent,subpath,environment,value){var inst=this.type.instantiate(parent,subpath,environment,value);return inst},Refinement$$1.prototype.isAssignableFrom=function(type){return this.type.isAssignableFrom(type)},Refinement$$1.prototype.isValidSnapshot=function(value,context){var subtypeErrors=this.type.validate(value,context);if(0<subtypeErrors.length)return subtypeErrors;var snapshot=isStateTreeNode$$1(value)?getStateTreeNode$$1(value).snapshot:value;return this.predicate(snapshot)?typeCheckSuccess$$1():typeCheckFailure$$1(context,value,this.message(value))},Refinement$$1}(Type$$1),Union$$1=function(_super){function Union$$1(name,types,dispatcher){var _this=_super.call(this,name)||this;return _this.dispatcher=null,_this.dispatcher=dispatcher,_this.types=types,_this}return __extends(Union$$1,_super),Object.defineProperty(Union$$1.prototype,"flags",{get:function(){var result=TypeFlags$$1.Union;return this.types.forEach(function(type){result|=type.flags}),result},enumerable:!0,configurable:!0}),Object.defineProperty(Union$$1.prototype,"shouldAttachNode",{get:function(){return this.types.some(function(type){return type.shouldAttachNode})},enumerable:!0,configurable:!0}),Union$$1.prototype.isAssignableFrom=function(type){return this.types.some(function(subType){return subType.isAssignableFrom(type)})},Union$$1.prototype.describe=function(){return"("+this.types.map(function(factory){return factory.describe()}).join(" | ")+")"},Union$$1.prototype.instantiate=function(parent,subpath,environment,value){return this.determineType(value).instantiate(parent,subpath,environment,value)},Union$$1.prototype.reconcile=function(current,newValue){return this.determineType(newValue).reconcile(current,newValue)},Union$$1.prototype.determineType=function(value){if(null!==this.dispatcher)return this.dispatcher(value);var applicableTypes=this.types.filter(function(type){return type.is(value)});return 1<applicableTypes.length?fail("Ambiguos snapshot "+JSON.stringify(value)+" for union "+this.name+". Please provide a dispatch in the union declaration."):applicableTypes[0]},Union$$1.prototype.isValidSnapshot=function(value,context){if(null!==this.dispatcher)return this.dispatcher(value).validate(value,context);var errors=this.types.map(function(type){return type.validate(value,context)}),applicableTypes=errors.filter(function(errorArray){return 0===errorArray.length});return 1<applicableTypes.length?typeCheckFailure$$1(context,value,"Multiple types are applicable for the union (hint: provide a dispatch function)"):0===applicableTypes.length?typeCheckFailure$$1(context,value,"No type is applicable for the union").concat(flattenTypeErrors$$1(errors)):typeCheckSuccess$$1()},Union$$1}(Type$$1),OptionalValue$$1=function(_super){function OptionalValue$$1(type,defaultValue){var _this=_super.call(this,type.name)||this;return _this.type=type,_this.defaultValue=defaultValue,_this}return __extends(OptionalValue$$1,_super),Object.defineProperty(OptionalValue$$1.prototype,"flags",{get:function(){return this.type.flags|TypeFlags$$1.Optional},enumerable:!0,configurable:!0}),Object.defineProperty(OptionalValue$$1.prototype,"shouldAttachNode",{get:function(){return this.type.shouldAttachNode},enumerable:!0,configurable:!0}),OptionalValue$$1.prototype.describe=function(){return this.type.describe()+"?"},OptionalValue$$1.prototype.instantiate=function(parent,subpath,environment,value){if("undefined"==typeof value){var defaultValue=this.getDefaultValue(),defaultSnapshot=isStateTreeNode$$1(defaultValue)?getStateTreeNode$$1(defaultValue).snapshot:defaultValue;return this.type.instantiate(parent,subpath,environment,defaultSnapshot)}return this.type.instantiate(parent,subpath,environment,value)},OptionalValue$$1.prototype.reconcile=function(current,newValue){return this.type.reconcile(current,this.type.is(newValue)?newValue:this.getDefaultValue())},OptionalValue$$1.prototype.getDefaultValue=function(){var defaultValue="function"==typeof this.defaultValue?this.defaultValue():this.defaultValue;return"function"==typeof this.defaultValue&&typecheck$$1(this,defaultValue),defaultValue},OptionalValue$$1.prototype.isValidSnapshot=function(value,context){return void 0===value?typeCheckSuccess$$1():this.type.validate(value,context)},OptionalValue$$1.prototype.isAssignableFrom=function(type){return this.type.isAssignableFrom(type)},OptionalValue$$1}(Type$$1),optionalNullType=optional$$1(nullType$$1,null),Late$$1=function(_super){function Late$$1(name,definition){var _this=_super.call(this,name)||this;return _this._subType=null,_this.definition=definition,_this}return __extends(Late$$1,_super),Object.defineProperty(Late$$1.prototype,"flags",{get:function(){return this.subType.flags|TypeFlags$$1.Late},enumerable:!0,configurable:!0}),Object.defineProperty(Late$$1.prototype,"shouldAttachNode",{get:function(){return this.subType.shouldAttachNode},enumerable:!0,configurable:!0}),Object.defineProperty(Late$$1.prototype,"subType",{get:function(){return null===this._subType&&(this._subType=this.definition()),this._subType},enumerable:!0,configurable:!0}),Late$$1.prototype.instantiate=function(parent,subpath,environment,snapshot){return this.subType.instantiate(parent,subpath,environment,snapshot)},Late$$1.prototype.reconcile=function(current,newValue){return this.subType.reconcile(current,newValue)},Late$$1.prototype.describe=function(){return this.subType.name},Late$$1.prototype.isValidSnapshot=function(value,context){return this.subType.validate(value,context)},Late$$1.prototype.isAssignableFrom=function(type){return this.subType.isAssignableFrom(type)},Late$$1}(Type$$1),Frozen$$1=function(_super){function Frozen$$1(){var _this=_super.call(this,"frozen")||this;return _this.shouldAttachNode=!1,_this.flags=TypeFlags$$1.Frozen,_this}return __extends(Frozen$$1,_super),Frozen$$1.prototype.describe=function(){return"<any immutable value>"},Frozen$$1.prototype.instantiate=function(parent,subpath,environment,value){return createNode$$1(this,parent,subpath,environment,deepFreeze(value))},Frozen$$1.prototype.isValidSnapshot=function(value,context){return isSerializable(value)?typeCheckSuccess$$1():typeCheckFailure$$1(context,value,"Value is not serializable and cannot be frozen")},Frozen$$1}(Type$$1),frozen$$1=new Frozen$$1,StoredReference=function(){return function(mode,value){if(this.mode=mode,this.value=value,"object"===mode){if(!isStateTreeNode$$1(value))return fail("Can only store references to tree nodes, got: '"+value+"'");var targetNode=getStateTreeNode$$1(value);if(!targetNode.identifierAttribute)return fail("Can only store references with a defined identifier attribute.")}}}(),BaseReferenceType$$1=function(_super){function BaseReferenceType$$1(targetType){var _this=_super.call(this,"reference("+targetType.name+")")||this;return _this.targetType=targetType,_this.shouldAttachNode=!1,_this.flags=TypeFlags$$1.Reference,_this}return __extends(BaseReferenceType$$1,_super),BaseReferenceType$$1.prototype.describe=function(){return this.name},BaseReferenceType$$1.prototype.isAssignableFrom=function(type){return this.targetType.isAssignableFrom(type)},BaseReferenceType$$1.prototype.isValidSnapshot=function(value,context){return"string"==typeof value||"number"==typeof value?typeCheckSuccess$$1():typeCheckFailure$$1(context,value,"Value is not a valid identifier, which is a string or a number")},BaseReferenceType$$1}(Type$$1),IdentifierReferenceType$$1=function(_super){function IdentifierReferenceType$$1(targetType){return _super.call(this,targetType)||this}return __extends(IdentifierReferenceType$$1,_super),IdentifierReferenceType$$1.prototype.getValue=function(node){if(node.isAlive){var ref=node.storedValue;if("object"===ref.mode)return ref.value;var target=node.root.identifierCache.resolve(this.targetType,ref.value);return target?target.value:fail("Failed to resolve reference '"+ref.value+"' to type '"+this.targetType.name+"' (from node: "+node.path+")")}},IdentifierReferenceType$$1.prototype.getSnapshot=function(node){var ref=node.storedValue;switch(ref.mode){case"identifier":return ref.value;case"object":return getStateTreeNode$$1(ref.value).identifier;}},IdentifierReferenceType$$1.prototype.instantiate=function(parent,subpath,environment,snapshot){return createNode$$1(this,parent,subpath,environment,new StoredReference(isStateTreeNode$$1(snapshot)?"object":"identifier",snapshot))},IdentifierReferenceType$$1.prototype.reconcile=function(current,newValue){if(current.type===this){var targetMode=isStateTreeNode$$1(newValue)?"object":"identifier",ref=current.storedValue;if(targetMode===ref.mode&&ref.value===newValue)return current}var newNode=this.instantiate(current.parent,current.subpath,current._environment,newValue);return current.die(),newNode},IdentifierReferenceType$$1}(BaseReferenceType$$1),CustomReferenceType$$1=function(_super){function CustomReferenceType$$1(targetType,options){var _this=_super.call(this,targetType)||this;return _this.options=options,_this}return __extends(CustomReferenceType$$1,_super),CustomReferenceType$$1.prototype.getValue=function(node){return node.isAlive?this.options.get(node.storedValue,node.parent?node.parent.storedValue:null):void 0},CustomReferenceType$$1.prototype.getSnapshot=function(node){return node.storedValue},CustomReferenceType$$1.prototype.instantiate=function(parent,subpath,environment,snapshot){var identifier$$1=isStateTreeNode$$1(snapshot)?this.options.set(snapshot,parent?parent.storedValue:null):snapshot;return createNode$$1(this,parent,subpath,environment,identifier$$1)},CustomReferenceType$$1.prototype.reconcile=function(current,snapshot){var newIdentifier=isStateTreeNode$$1(snapshot)?this.options.set(snapshot,current?current.storedValue:null):snapshot;if(current.type===this&&current.storedValue===newIdentifier)return current;var newNode=this.instantiate(current.parent,current.subpath,current._environment,newIdentifier);return current.die(),newNode},CustomReferenceType$$1}(BaseReferenceType$$1),IdentifierType$$1=function(_super){function IdentifierType$$1(identifierType){var _this=_super.call(this,"identifier("+identifierType.name+")")||this;return _this.identifierType=identifierType,_this.shouldAttachNode=!1,_this.flags=TypeFlags$$1.Identifier,_this}return __extends(IdentifierType$$1,_super),IdentifierType$$1.prototype.instantiate=function(parent,subpath,environment,snapshot){return parent&&isStateTreeNode$$1(parent.storedValue)?(parent.identifierAttribute&&fail("Cannot define property '"+subpath+"' as object identifier, property '"+parent.identifierAttribute+"' is already defined as identifier property"),parent.identifierAttribute=subpath,createNode$$1(this,parent,subpath,environment,snapshot)):fail("Identifier types can only be instantiated as direct child of a model type")},IdentifierType$$1.prototype.reconcile=function(current,newValue){return current.storedValue===newValue?current:fail("Tried to change identifier from '"+current.storedValue+"' to '"+newValue+"'. Changing identifiers is not allowed.")},IdentifierType$$1.prototype.describe=function(){return"identifier("+this.identifierType.describe()+")"},IdentifierType$$1.prototype.isValidSnapshot=function(value,context){return void 0===value||null===value||"string"==typeof value||"number"==typeof value?this.identifierType.validate(value,context):typeCheckFailure$$1(context,value,"Value is not a valid identifier, which is a string or a number")},IdentifierType$$1}(Type$$1),CustomType$$1=function(_super){function CustomType$$1(options){var _this=_super.call(this,options.name)||this;return _this.options=options,_this.flags=TypeFlags$$1.Reference,_this.shouldAttachNode=!1,_this}return __extends(CustomType$$1,_super),CustomType$$1.prototype.describe=function(){return this.name},CustomType$$1.prototype.isAssignableFrom=function(type){return type===this},CustomType$$1.prototype.isValidSnapshot=function(value,context){if(this.options.isTargetType(value))return typeCheckSuccess$$1();var typeError=this.options.getValidationMessage(value);return typeError?typeCheckFailure$$1(context,value,"Invalid value for type '"+this.name+"': "+typeError):typeCheckSuccess$$1()},CustomType$$1.prototype.getValue=function(node){return node.isAlive?node.storedValue:void 0},CustomType$$1.prototype.getSnapshot=function(node){return this.options.toSnapshot(node.storedValue)},CustomType$$1.prototype.instantiate=function(parent,subpath,environment,snapshot){var valueToStore=this.options.isTargetType(snapshot)?snapshot:this.options.fromSnapshot(snapshot);return createNode$$1(this,parent,subpath,environment,valueToStore)},CustomType$$1.prototype.reconcile=function(current,value){var isSnapshot=!this.options.isTargetType(value),unchanged=!0;if(current.type===this&&(unchanged=isSnapshot?value===current.snapshot:value===current.storedValue),unchanged)return current;var valueToStore=isSnapshot?this.options.fromSnapshot(value):value,newNode=this.instantiate(current.parent,current.subpath,current._environment,valueToStore);return current.die(),newNode},CustomType$$1}(Type$$1),types={enumeration:function(name,options){var realOptions="string"==typeof name?options:name;var type=union$$1.apply(void 0,realOptions.map(function(option){return literal$$1(""+option)}));return"string"==typeof name&&(type.name=name),type},model:function(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];var name="string"==typeof args[0]?args.shift():"AnonymousModel",properties=args.shift()||{};return new ModelType$$1({name:name,properties:properties})},compose:function(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];var typeName="string"==typeof args[0]?args.shift():"AnonymousModel";return!1,args.reduce(function(prev,cur){return prev.cloneAndEnhance({name:prev.name+"_"+cur.name,properties:cur.properties,initializers:cur.initializers})}).named(typeName)},custom:function(options){return new CustomType$$1(options)},reference:function(subType,options){return!1,options?new CustomReferenceType$$1(subType,options):new IdentifierReferenceType$$1(subType)},union:union$$1,optional:optional$$1,literal:literal$$1,maybe:function(type){return!1,union$$1(optionalNullType,type)},refinement:function(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];var name="string"==typeof args[0]?args.shift():isType$$1(args[0])?args[0].name:null,type=args[0],predicate=args[1],message=args[2]?args[2]:function(){return"Value does not respect the refinement predicate"};return!1,new Refinement$$1(name,type,predicate,message)},string:string$$1,boolean:boolean$$1,number:number$$1,Date:DatePrimitive$$1,map:function(subtype){return new MapType$$1("map<string, "+subtype.name+">",subtype)},array:function(subtype){return!1,new ArrayType$$1(subtype.name+"[]",subtype)},frozen:frozen$$1,identifier:function(baseType){return void 0===baseType&&(baseType=string$$1),!1,new IdentifierType$$1(baseType)},late:function(nameOrType,maybeType){var name="string"==typeof nameOrType?nameOrType:"late("+nameOrType.toString()+")",type="string"==typeof nameOrType?maybeType:nameOrType;return!1,new Late$$1(name,type)},undefined:undefinedType$$1,null:nullType$$1}}).call(this,__webpack_require__(795).setImmediate)},795:function(module,exports,__webpack_require__){(function(global){function Timeout(id,clearFn){this._id=id,this._clearFn=clearFn}var apply=Function.prototype.apply;exports.setTimeout=function(){return new Timeout(apply.call(setTimeout,window,arguments),clearTimeout)},exports.setInterval=function(){return new Timeout(apply.call(setInterval,window,arguments),clearInterval)},exports.clearTimeout=exports.clearInterval=function(timeout){timeout&&timeout.close()},Timeout.prototype.unref=Timeout.prototype.ref=function(){},Timeout.prototype.close=function(){this._clearFn.call(window,this._id)},exports.enroll=function(item,msecs){clearTimeout(item._idleTimeoutId),item._idleTimeout=msecs},exports.unenroll=function(item){clearTimeout(item._idleTimeoutId),item._idleTimeout=-1},exports._unrefActive=exports.active=function(item){clearTimeout(item._idleTimeoutId);var msecs=item._idleTimeout;0<=msecs&&(item._idleTimeoutId=setTimeout(function(){item._onTimeout&&item._onTimeout()},msecs))},__webpack_require__(1415),exports.setImmediate="undefined"!=typeof self&&self.setImmediate||"undefined"!=typeof global&&global.setImmediate||this&&this.setImmediate,exports.clearImmediate="undefined"!=typeof self&&self.clearImmediate||"undefined"!=typeof global&&global.clearImmediate||this&&this.clearImmediate}).call(this,__webpack_require__(37))},796:function(module){(function(){"use strict";function log(){console.log.apply(console,arguments)}function Fuse(list,options){for(var key in this.list=list,this.options=options=options||{},defaultOptions)defaultOptions.hasOwnProperty(key)&&(this.options[key]="boolean"==typeof defaultOptions[key]?key in options?options[key]:defaultOptions[key]:options[key]||defaultOptions[key])}function deepValue(obj,path,list){var firstSegment,remaining,dotIndex,value,i,len;if(!path)list.push(obj);else if(dotIndex=path.indexOf("."),-1===dotIndex?firstSegment=path:(firstSegment=path.slice(0,dotIndex),remaining=path.slice(dotIndex+1)),value=obj[firstSegment],null!==value&&void 0!==value)if(!remaining&&("string"==typeof value||"number"==typeof value))list.push(value);else if(isArray(value))for(i=0,len=value.length;i<len;i++)deepValue(value[i],remaining,list);else remaining&&deepValue(value,remaining,list);return list}function isArray(obj){return"[object Array]"===Object.prototype.toString.call(obj)}function BitapSearcher(pattern,options){options=options||{},this.options=options,this.options.location=options.location||BitapSearcher.defaultOptions.location,this.options.distance="distance"in options?options.distance:BitapSearcher.defaultOptions.distance,this.options.threshold="threshold"in options?options.threshold:BitapSearcher.defaultOptions.threshold,this.options.maxPatternLength=options.maxPatternLength||BitapSearcher.defaultOptions.maxPatternLength,this.pattern=options.caseSensitive?pattern:pattern.toLowerCase(),this.patternLen=pattern.length,this.patternLen<=this.options.maxPatternLength&&(this.matchmask=1<<this.patternLen-1,this.patternAlphabet=this._calculatePatternAlphabet())}var _Mathmin=Math.min,defaultOptions={id:null,caseSensitive:!1,include:[],shouldSort:!0,searchFn:BitapSearcher,sortFn:function(a,b){return a.score-b.score},getFn:deepValue,keys:[],verbose:!1,tokenize:!1,matchAllTokens:!1,tokenSeparator:/ +/g,minMatchCharLength:1,findAllMatches:!1};Fuse.VERSION="2.7.3",Fuse.prototype.set=function(list){return this.list=list,list},Fuse.prototype.search=function(pattern){this.options.verbose&&log("\nSearch term:",pattern,"\n"),this.pattern=pattern,this.results=[],this.resultMap={},this._keyMap=null,this._prepareSearchers(),this._startSearch(),this._computeScore(),this._sort();var output=this._format();return output},Fuse.prototype._prepareSearchers=function(){var options=this.options,pattern=this.pattern,searchFn=options.searchFn,tokens=pattern.split(options.tokenSeparator),i=0,len=tokens.length;if(this.options.tokenize)for(this.tokenSearchers=[];i<len;i++)this.tokenSearchers.push(new searchFn(tokens[i],options));this.fullSeacher=new searchFn(pattern,options)},Fuse.prototype._startSearch=function(){var key,weight,i,j,options=this.options,getFn=options.getFn,list=this.list,listLen=list.length,keys=this.options.keys,keysLen=keys.length,item=null;if("string"==typeof list[0])for(i=0;i<listLen;i++)this._analyze("",list[i],i,i);else for(this._keyMap={},i=0;i<listLen;i++)for(item=list[i],j=0;j<keysLen;j++){if(key=keys[j],"string"!=typeof key){if(weight=1-key.weight||1,this._keyMap[key.name]={weight:weight},0>=key.weight||1<key.weight)throw new Error("Key weight has to be > 0 and <= 1");key=key.name}else this._keyMap[key]={weight:1};this._analyze(key,getFn(item,key,[]),item,i)}},Fuse.prototype._analyze=function(key,text,entity,index){var words,scores,existingResult,averageScore,finalScore,scoresLen,mainSearchResult,tokenSearcher,termScores,word,tokenSearchResult,hasMatchInText,checkTextMatches,i,j,options=this.options,exists=!1;if(void 0!==text&&null!==text){scores=[];var numTextMatches=0;if("string"==typeof text){if(words=text.split(options.tokenSeparator),options.verbose&&log("---------\nKey:",key),this.options.tokenize){for(i=0;i<this.tokenSearchers.length;i++){for(tokenSearcher=this.tokenSearchers[i],options.verbose&&log("Pattern:",tokenSearcher.pattern),termScores=[],hasMatchInText=!1,j=0;j<words.length;j++){word=words[j],tokenSearchResult=tokenSearcher.search(word);var obj={};tokenSearchResult.isMatch?(obj[word]=tokenSearchResult.score,exists=!0,hasMatchInText=!0,scores.push(tokenSearchResult.score)):(obj[word]=1,!this.options.matchAllTokens&&scores.push(1)),termScores.push(obj)}hasMatchInText&&numTextMatches++,options.verbose&&log("Token scores:",termScores)}for(averageScore=scores[0],scoresLen=scores.length,i=1;i<scoresLen;i++)averageScore+=scores[i];averageScore/=scoresLen,options.verbose&&log("Token score average:",averageScore)}mainSearchResult=this.fullSeacher.search(text),options.verbose&&log("Full text score:",mainSearchResult.score),finalScore=mainSearchResult.score,void 0!==averageScore&&(finalScore=(finalScore+averageScore)/2),options.verbose&&log("Score average:",finalScore),checkTextMatches=!(this.options.tokenize&&this.options.matchAllTokens)||numTextMatches>=this.tokenSearchers.length,options.verbose&&log("Check Matches",checkTextMatches),(exists||mainSearchResult.isMatch)&&checkTextMatches&&(existingResult=this.resultMap[index],existingResult?existingResult.output.push({key:key,score:finalScore,matchedIndices:mainSearchResult.matchedIndices}):(this.resultMap[index]={item:entity,output:[{key:key,score:finalScore,matchedIndices:mainSearchResult.matchedIndices}]},this.results.push(this.resultMap[index])))}else if(isArray(text))for(i=0;i<text.length;i++)this._analyze(key,text[i],entity,index)}},Fuse.prototype._computeScore=function(){var i,j,totalScore,output,scoreLen,score,weight,bestScore,nScore,keyMap=this._keyMap,results=this.results;for(this.options.verbose&&log("\n\nComputing score:\n"),i=0;i<results.length;i++){for(totalScore=0,output=results[i].output,scoreLen=output.length,bestScore=1,j=0;j<scoreLen;j++)score=output[j].score,weight=keyMap?keyMap[output[j].key].weight:1,nScore=score*weight,1===weight?(totalScore+=nScore,output[j].nScore=nScore):bestScore=_Mathmin(bestScore,nScore);results[i].score=1===bestScore?totalScore/scoreLen:bestScore,this.options.verbose&&log(results[i])}},Fuse.prototype._sort=function(){var options=this.options;options.shouldSort&&(options.verbose&&log("\n\nSorting...."),this.results.sort(options.sortFn))},Fuse.prototype._format=function(){var i,len,replaceValue,getItemAtIndex,options=this.options,getFn=options.getFn,finalOutput=[],results=this.results,include=options.include;for(options.verbose&&log("\n\nOutput:\n\n",results),replaceValue=options.id?function(index){results[index].item=getFn(results[index].item,options.id,[])[0]}:function(){},getItemAtIndex=function(index){var data,j,output,_item,_result,record=results[index];if(0<include.length){if(data={item:record.item},-1!==include.indexOf("matches"))for(output=record.output,data.matches=[],j=0;j<output.length;j++)_item=output[j],_result={indices:_item.matchedIndices},_item.key&&(_result.key=_item.key),data.matches.push(_result);-1!==include.indexOf("score")&&(data.score=results[index].score)}else data=record.item;return data},(i=0,len=results.length);i<len;i++)replaceValue(i),finalOutput.push(getItemAtIndex(i));return finalOutput},BitapSearcher.defaultOptions={location:0,distance:100,threshold:.6,maxPatternLength:32},BitapSearcher.prototype._calculatePatternAlphabet=function(){var mask={},i=0;for(i=0;i<this.patternLen;i++)mask[this.pattern.charAt(i)]=0;for(i=0;i<this.patternLen;i++)mask[this.pattern.charAt(i)]|=1<<this.pattern.length-i-1;return mask},BitapSearcher.prototype._bitapScore=function(errors,location){var accuracy=errors/this.patternLen,proximity=Math.abs(this.options.location-location);return this.options.distance?accuracy+proximity/this.options.distance:proximity?1:accuracy},BitapSearcher.prototype.search=function(text){var i,j,textLen,findAllMatches,location,threshold,bestLoc,binMin,binMid,binMax,start,finish,bitArr,lastBitArr,charMatch,score,locations,matches,isMatched,matchMask,matchedIndices,matchesLen,match,_Mathmax=Math.max,options=this.options;if(text=options.caseSensitive?text:text.toLowerCase(),this.pattern===text)return{isMatch:!0,score:0,matchedIndices:[[0,text.length-1]]};if(this.patternLen>options.maxPatternLength){if(matches=text.match(new RegExp(this.pattern.replace(options.tokenSeparator,"|"))),isMatched=!!matches,isMatched)for(matchedIndices=[],i=0,matchesLen=matches.length;i<matchesLen;i++)match=matches[i],matchedIndices.push([text.indexOf(match),match.length-1]);return{isMatch:isMatched,score:isMatched?.5:1,matchedIndices:matchedIndices}}for(findAllMatches=options.findAllMatches,location=options.location,textLen=text.length,threshold=options.threshold,bestLoc=text.indexOf(this.pattern,location),matchMask=[],i=0;i<textLen;i++)matchMask[i]=0;for(-1!=bestLoc&&(threshold=_Mathmin(this._bitapScore(0,bestLoc),threshold),bestLoc=text.lastIndexOf(this.pattern,location+this.patternLen),-1!=bestLoc&&(threshold=_Mathmin(this._bitapScore(0,bestLoc),threshold))),bestLoc=-1,score=1,locations=[],binMax=this.patternLen+textLen,i=0;i<this.patternLen;i++){for(binMin=0,binMid=binMax;binMin<binMid;)this._bitapScore(i,location+binMid)<=threshold?binMin=binMid:binMax=binMid,binMid=Math.floor((binMax-binMin)/2+binMin);for(binMax=binMid,start=_Mathmax(1,location-binMid+1),finish=findAllMatches?textLen:_Mathmin(location+binMid,textLen)+this.patternLen,bitArr=Array(finish+2),bitArr[finish+1]=(1<<i)-1,j=finish;j>=start;j--)if(charMatch=this.patternAlphabet[text.charAt(j-1)],charMatch&&(matchMask[j-1]=1),bitArr[j]=(1|bitArr[j+1]<<1)&charMatch,0!==i&&(bitArr[j]|=1|(lastBitArr[j+1]|lastBitArr[j])<<1|lastBitArr[j+1]),bitArr[j]&this.matchmask&&(score=this._bitapScore(i,j-1),score<=threshold)){if(threshold=score,bestLoc=j-1,locations.push(bestLoc),bestLoc<=location)break;start=_Mathmax(1,2*location-bestLoc)}if(this._bitapScore(i+1,location)>threshold)break;lastBitArr=bitArr}return matchedIndices=this._getMatchedIndices(matchMask),{isMatch:0<=bestLoc,score:0===score?.001:score,matchedIndices:matchedIndices}},BitapSearcher.prototype._getMatchedIndices=function(matchMask){for(var match,matchedIndices=[],start=-1,end=-1,i=0,len=matchMask.length;i<len;i++)match=matchMask[i],match&&-1==start?start=i:!match&&-1!=start&&(end=i-1,end-start+1>=this.options.minMatchCharLength&&matchedIndices.push([start,end]),start=-1);return matchMask[i-1]&&i-1-start+1>=this.options.minMatchCharLength&&matchedIndices.push([start,i-1]),matchedIndices},module.exports=Fuse})(this);/**
 * @license
 * Fuse - Lightweight fuzzy-search
 *
 * Copyright (c) 2012-2016 Kirollos Risk <kirollos@gmail.com>.
 * All Rights Reserved. Apache Software License 2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License")
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */}}]);