2 lines
138 KiB
JavaScript
2 lines
138 KiB
JavaScript
!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports,require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom"],factory):factory((global=global||self).Recoil={},global.React,global.ReactDOM)}(this,(function(exports,react,reactDom){"use strict";react=react&&Object.prototype.hasOwnProperty.call(react,"default")?react.default:react,reactDom=reactDom&&Object.prototype.hasOwnProperty.call(reactDom,"default")?reactDom.default:reactDom;var Recoil_err=function(message){const error=new Error(message);if(void 0===error.stack)try{throw error}catch(_){}return error};var Recoil_isPromise=function(p){return!!p&&"function"==typeof p.then};var Recoil_nullthrows=function(x,message){if(null!=x)return x;throw Recoil_err(null!=message?message:"Got unexpected null or undefined")};function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}class BaseLoadable{getValue(){throw Recoil_err("BaseLoadable")}toPromise(){throw Recoil_err("BaseLoadable")}valueMaybe(){throw Recoil_err("BaseLoadable")}valueOrThrow(){throw Recoil_err(`Loadable expected value, but in "${this.state}" state`)}promiseMaybe(){throw Recoil_err("BaseLoadable")}promiseOrThrow(){throw Recoil_err(`Loadable expected promise, but in "${this.state}" state`)}errorMaybe(){throw Recoil_err("BaseLoadable")}errorOrThrow(){throw Recoil_err(`Loadable expected error, but in "${this.state}" state`)}is(other){return other.state===this.state&&other.contents===this.contents}map(_map){throw Recoil_err("BaseLoadable")}}class ValueLoadable extends BaseLoadable{constructor(value){super(),_defineProperty(this,"state","hasValue"),_defineProperty(this,"contents",void 0),this.contents=value}getValue(){return this.contents}toPromise(){return Promise.resolve(this.contents)}valueMaybe(){return this.contents}valueOrThrow(){return this.contents}promiseMaybe(){}errorMaybe(){}map(map){try{const next=map(this.contents);return Recoil_isPromise(next)?loadableWithPromise(next):isLoadable(next)?next:loadableWithValue(next)}catch(e){return Recoil_isPromise(e)?loadableWithPromise(e.next(()=>this.map(map))):loadableWithError(e)}}}class ErrorLoadable extends BaseLoadable{constructor(error){super(),_defineProperty(this,"state","hasError"),_defineProperty(this,"contents",void 0),this.contents=error}getValue(){throw this.contents}toPromise(){return Promise.reject(this.contents)}valueMaybe(){}promiseMaybe(){}errorMaybe(){return this.contents}errorOrThrow(){return this.contents}map(_map){return this}}class LoadingLoadable extends BaseLoadable{constructor(promise){super(),_defineProperty(this,"state","loading"),_defineProperty(this,"contents",void 0),this.contents=promise}getValue(){throw this.contents}toPromise(){return this.contents}valueMaybe(){}promiseMaybe(){return this.contents}promiseOrThrow(){return this.contents}errorMaybe(){}map(map){return loadableWithPromise(this.contents.then(value=>{const next=map(value);if(isLoadable(next)){const nextLoadable=next;switch(nextLoadable.state){case"hasValue":return nextLoadable.contents;case"hasError":throw nextLoadable.contents;case"loading":return nextLoadable.contents}}return next}).catch(e=>{if(Recoil_isPromise(e))return e.then(()=>this.map(map).contents);throw e}))}}function loadableWithValue(value){return Object.freeze(new ValueLoadable(value))}function loadableWithError(error){return Object.freeze(new ErrorLoadable(error))}function loadableWithPromise(promise){return Object.freeze(new LoadingLoadable(promise))}function loadableLoading(){return Object.freeze(new LoadingLoadable(new Promise(()=>{})))}function loadableAll(inputs){const output=function(inputs){return inputs.every(i=>"hasValue"===i.state)?loadableWithValue(inputs.map(i=>i.contents)):inputs.some(i=>"hasError"===i.state)?loadableWithError(Recoil_nullthrows(inputs.find(i=>"hasError"===i.state),"Invalid loadable passed to loadableAll").contents):loadableWithPromise(Promise.all(inputs.map(i=>i.contents)))}((Array.isArray(inputs)?inputs:Object.getOwnPropertyNames(inputs).map(key=>inputs[key])).map(x=>isLoadable(x)?x:Recoil_isPromise(x)?loadableWithPromise(x):loadableWithValue(x)));return Array.isArray(inputs)?output:output.map(outputs=>Object.getOwnPropertyNames(inputs).reduce((out,key,idx)=>({...out,[key]:outputs[idx]}),{}))}function isLoadable(x){return x instanceof BaseLoadable}const LoadableStaticInterface={of:value=>Recoil_isPromise(value)?loadableWithPromise(value):isLoadable(value)?value:loadableWithValue(value),error:error=>loadableWithError(error),loading:()=>loadableLoading(),all:loadableAll,isLoadable:isLoadable};var Recoil_Loadable={loadableWithValue:loadableWithValue,loadableWithError:loadableWithError,loadableWithPromise:loadableWithPromise,loadableLoading:loadableLoading,loadableAll:loadableAll,isLoadable:isLoadable,RecoilLoadable:LoadableStaticInterface},Recoil_Loadable_1=Recoil_Loadable.loadableWithValue,Recoil_Loadable_2=Recoil_Loadable.loadableWithError,Recoil_Loadable_3=Recoil_Loadable.loadableWithPromise,Recoil_Loadable_4=Recoil_Loadable.loadableLoading,Recoil_Loadable_5=Recoil_Loadable.loadableAll,Recoil_Loadable_6=Recoil_Loadable.isLoadable,Recoil_Loadable_7=Recoil_Loadable.RecoilLoadable,Recoil_Loadable$1=Object.freeze({__proto__:null,loadableWithValue:Recoil_Loadable_1,loadableWithError:Recoil_Loadable_2,loadableWithPromise:Recoil_Loadable_3,loadableLoading:Recoil_Loadable_4,loadableAll:Recoil_Loadable_5,isLoadable:Recoil_Loadable_6,RecoilLoadable:Recoil_Loadable_7});const env={RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED:!0,RECOIL_GKS_ENABLED:new Set(["recoil_hamt_2020","recoil_sync_external_store","recoil_suppress_rerender_in_callback","recoil_memory_managament_2020"])};var _process;"undefined"!=typeof process&&null!=(null===(_process=process)||void 0===_process?void 0:_process.env)&&(function(name,set){var _process$env$name,_process$env$name$toL;const sanitizedValue=null===(_process$env$name=process.env[name])||void 0===_process$env$name||null===(_process$env$name$toL=_process$env$name.toLowerCase())||void 0===_process$env$name$toL?void 0:_process$env$name$toL.trim();if(null!=sanitizedValue&&""!==sanitizedValue){if(!["true","false"].includes(sanitizedValue))throw Recoil_err(`process.env.${name} value must be 'true', 'false', or empty: ${sanitizedValue}`);set("true"===sanitizedValue)}}("RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED",value=>{env.RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED=value}),function(name,set){var _process$env$name2;const sanitizedValue=null===(_process$env$name2=process.env[name])||void 0===_process$env$name2?void 0:_process$env$name2.trim();null!=sanitizedValue&&""!==sanitizedValue&&set(sanitizedValue.split(/\s*,\s*|\s+/))}("RECOIL_GKS_ENABLED",value=>{value.forEach(gk=>{env.RECOIL_GKS_ENABLED.add(gk)})}));var Recoil_RecoilEnv=env;function Recoil_gkx_OSS(gk){return Recoil_RecoilEnv.RECOIL_GKS_ENABLED.has(gk)}Recoil_gkx_OSS.setPass=gk=>{Recoil_RecoilEnv.RECOIL_GKS_ENABLED.add(gk)},Recoil_gkx_OSS.setFail=gk=>{Recoil_RecoilEnv.RECOIL_GKS_ENABLED.delete(gk)},Recoil_gkx_OSS.clear=()=>{Recoil_RecoilEnv.RECOIL_GKS_ENABLED.clear()};var Recoil_gkx=Recoil_gkx_OSS;var _createMutableSource,_useMutableSource,_useSyncExternalStore,Recoil_recoverableViolation=function(message,_projectName,{error:error}={}){return null};const createMutableSource=null!==(_createMutableSource=react.createMutableSource)&&void 0!==_createMutableSource?_createMutableSource:react.unstable_createMutableSource,useMutableSource=null!==(_useMutableSource=react.useMutableSource)&&void 0!==_useMutableSource?_useMutableSource:react.unstable_useMutableSource,useSyncExternalStore=null!==(_useSyncExternalStore=react.useSyncExternalStore)&&void 0!==_useSyncExternalStore?_useSyncExternalStore:react.unstable_useSyncExternalStore;var Recoil_ReactMode={createMutableSource:createMutableSource,useMutableSource:useMutableSource,useSyncExternalStore:useSyncExternalStore,currentRendererSupportsUseSyncExternalStore:function(){var _ReactCurrentDispatch;const{ReactCurrentDispatcher:ReactCurrentDispatcher,ReactCurrentOwner:ReactCurrentOwner}=react.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;return null!=(null!==(_ReactCurrentDispatch=null==ReactCurrentDispatcher?void 0:ReactCurrentDispatcher.current)&&void 0!==_ReactCurrentDispatch?_ReactCurrentDispatch:ReactCurrentOwner.currentDispatcher).useSyncExternalStore},reactMode:function(){return Recoil_gkx("recoil_transition_support")?{mode:"TRANSITION_SUPPORT",early:!0,concurrent:!0}:Recoil_gkx("recoil_sync_external_store")&&null!=useSyncExternalStore?{mode:"SYNC_EXTERNAL_STORE",early:!0,concurrent:!1}:Recoil_gkx("recoil_mutable_source")&&null!=useMutableSource&&"undefined"!=typeof window&&!window.$disableRecoilValueMutableSource_TEMP_HACK_DO_NOT_USE?Recoil_gkx("recoil_suppress_rerender_in_callback")?{mode:"MUTABLE_SOURCE",early:!0,concurrent:!0}:{mode:"MUTABLE_SOURCE",early:!1,concurrent:!1}:Recoil_gkx("recoil_suppress_rerender_in_callback")?{mode:"LEGACY",early:!0,concurrent:!1}:{mode:"LEGACY",early:!1,concurrent:!1}},isFastRefreshEnabled:function(){return!1}};class AbstractRecoilValue{constructor(newKey){_defineProperty(this,"key",void 0),this.key=newKey}toJSON(){return{key:this.key}}}class RecoilState extends AbstractRecoilValue{}class RecoilValueReadOnly extends AbstractRecoilValue{}var Recoil_RecoilValue={AbstractRecoilValue:AbstractRecoilValue,RecoilState:RecoilState,RecoilValueReadOnly:RecoilValueReadOnly,isRecoilValue:function(x){return x instanceof RecoilState||x instanceof RecoilValueReadOnly}},Recoil_RecoilValue_1=Recoil_RecoilValue.AbstractRecoilValue,Recoil_RecoilValue_2=Recoil_RecoilValue.RecoilState,Recoil_RecoilValue_3=Recoil_RecoilValue.RecoilValueReadOnly,Recoil_RecoilValue_4=Recoil_RecoilValue.isRecoilValue,Recoil_RecoilValue$1=Object.freeze({__proto__:null,AbstractRecoilValue:Recoil_RecoilValue_1,RecoilState:Recoil_RecoilValue_2,RecoilValueReadOnly:Recoil_RecoilValue_3,isRecoilValue:Recoil_RecoilValue_4});var Recoil_mapIterable=function(iterable,callback){return function*(){let index=0;for(const value of iterable)yield callback(value,index++)}()};class DefaultValue{}const DEFAULT_VALUE=new DefaultValue,nodes=new Map,recoilValues=new Map;class NodeMissingError extends Error{}const configDeletionHandlers=new Map;function getConfigDeletionHandler(key){return configDeletionHandlers.get(key)}var Recoil_Node={nodes:nodes,recoilValues:recoilValues,registerNode:function(node){Recoil_RecoilEnv.RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED&&function(key){if(nodes.has(key)){const message=`Duplicate atom key "${key}". This is a FATAL ERROR in\n production. But it is safe to ignore this warning if it occurred because of\n hot module replacement.`;console.warn(message)}}(node.key),nodes.set(node.key,node);const recoilValue=null==node.set?new Recoil_RecoilValue$1.RecoilValueReadOnly(node.key):new Recoil_RecoilValue$1.RecoilState(node.key);return recoilValues.set(node.key,recoilValue),recoilValue},getNode:function(key){const node=nodes.get(key);if(null==node)throw new NodeMissingError(`Missing definition for RecoilValue: "${key}""`);return node},getNodeMaybe:function(key){return nodes.get(key)},deleteNodeConfigIfPossible:function(key){var _node$shouldDeleteCon;if(!Recoil_gkx("recoil_memory_managament_2020"))return;const node=nodes.get(key);var _getConfigDeletionHan;null!=node&&null!==(_node$shouldDeleteCon=node.shouldDeleteConfigOnRelease)&&void 0!==_node$shouldDeleteCon&&_node$shouldDeleteCon.call(node)&&(nodes.delete(key),null===(_getConfigDeletionHan=getConfigDeletionHandler(key))||void 0===_getConfigDeletionHan||_getConfigDeletionHan(),configDeletionHandlers.delete(key))},setConfigDeletionHandler:function(key,fn){Recoil_gkx("recoil_memory_managament_2020")&&(void 0===fn?configDeletionHandlers.delete(key):configDeletionHandlers.set(key,fn))},getConfigDeletionHandler:getConfigDeletionHandler,recoilValuesForKeys:function(keys){return Recoil_mapIterable(keys,key=>Recoil_nullthrows(recoilValues.get(key)))},NodeMissingError:NodeMissingError,DefaultValue:DefaultValue,DEFAULT_VALUE:DEFAULT_VALUE};var Recoil_Queue={enqueueExecution:function(s,f){f()}};var hamt_1=function(fn,module){return fn(module={exports:{}},module.exports),module.exports}((function(module){var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},hamt={},BUCKET_SIZE=Math.pow(2,5),MASK=BUCKET_SIZE-1,MAX_INDEX_NODE=BUCKET_SIZE/2,MIN_ARRAY_NODE=BUCKET_SIZE/4,nothing={},constant=function(x){return function(){return x}},hash=hamt.hash=function(str){var type=void 0===str?"undefined":_typeof(str);if("number"===type)return str;"string"!==type&&(str+="");for(var hash=0,i=0,len=str.length;i<len;++i){hash=(hash<<5)-hash+str.charCodeAt(i)|0}return hash},hashFragment=function(shift,h){return h>>>shift&MASK},toBitmap=function(x){return 1<<x},fromBitmap=function(bitmap,bit){return x=bitmap&bit-1,x=(x=(858993459&(x-=x>>1&1431655765))+(x>>2&858993459))+(x>>4)&252645135,x+=x>>8,127&(x+=x>>16);var x},arrayUpdate=function(mutate,at,v,arr){var out=arr;if(!mutate){var len=arr.length;out=new Array(len);for(var i=0;i<len;++i)out[i]=arr[i]}return out[at]=v,out},arraySpliceOut=function(mutate,at,arr){var newLen=arr.length-1,i=0,g=0,out=arr;if(mutate)i=g=at;else for(out=new Array(newLen);i<at;)out[g++]=arr[i++];for(++i;i<=newLen;)out[g++]=arr[i++];return mutate&&(out.length=newLen),out},empty={__hamt_isEmpty:!0},isEmptyNode=function(x){return x===empty||x&&x.__hamt_isEmpty},Leaf=function(edit,hash,key,value){return{type:1,edit:edit,hash:hash,key:key,value:value,_modify:Leaf__modify}},Collision=function(edit,hash,children){return{type:2,edit:edit,hash:hash,children:children,_modify:Collision__modify}},IndexedNode=function(edit,mask,children){return{type:3,edit:edit,mask:mask,children:children,_modify:IndexedNode__modify}},ArrayNode=function(edit,size,children){return{type:4,edit:edit,size:size,children:children,_modify:ArrayNode__modify}},mergeLeaves=function mergeLeaves(edit,shift,h1,n1,h2,n2){if(h1===h2)return Collision(edit,h1,[n2,n1]);var subH1=hashFragment(shift,h1),subH2=hashFragment(shift,h2);return IndexedNode(edit,toBitmap(subH1)|toBitmap(subH2),subH1===subH2?[mergeLeaves(edit,shift+5,h1,n1,h2,n2)]:subH1<subH2?[n1,n2]:[n2,n1])},canEditNode=function(edit,node){return edit===node.edit},Leaf__modify=function(edit,keyEq,shift,f,h,k,size){if(keyEq(k,this.key)){var _v=f(this.value);return _v===this.value?this:_v===nothing?(--size.value,empty):canEditNode(edit,this)?(this.value=_v,this):Leaf(edit,h,k,_v)}var v=f();return v===nothing?this:(++size.value,mergeLeaves(edit,shift,this.hash,this,h,Leaf(edit,h,k,v)))},Collision__modify=function(edit,keyEq,shift,f,h,k,size){if(h===this.hash){var list=function(mutate,edit,keyEq,h,list,f,k,size){for(var len=list.length,i=0;i<len;++i){var child=list[i];if(keyEq(k,child.key)){var value=child.value,_newValue=f(value);return _newValue===value?list:_newValue===nothing?(--size.value,arraySpliceOut(mutate,i,list)):arrayUpdate(mutate,i,Leaf(edit,h,k,_newValue),list)}}var newValue=f();return newValue===nothing?list:(++size.value,arrayUpdate(mutate,len,Leaf(edit,h,k,newValue),list))}(canEditNode(edit,this),edit,keyEq,this.hash,this.children,f,k,size);return list===this.children?this:list.length>1?Collision(edit,this.hash,list):list[0]}var v=f();return v===nothing?this:(++size.value,mergeLeaves(edit,shift,this.hash,this,h,Leaf(edit,h,k,v)))},IndexedNode__modify=function(edit,keyEq,shift,f,h,k,size){var mask=this.mask,children=this.children,frag=hashFragment(shift,h),bit=toBitmap(frag),indx=fromBitmap(mask,bit),exists=mask&bit,current=exists?children[indx]:empty,child=current._modify(edit,keyEq,shift+5,f,h,k,size);if(current===child)return this;var node,canEdit=canEditNode(edit,this),bitmap=mask,newChildren=void 0;if(exists&&isEmptyNode(child)){if(!(bitmap&=~bit))return empty;if(children.length<=2&&((node=children[1^indx])===empty||1===node.type||2===node.type))return children[1^indx];newChildren=arraySpliceOut(canEdit,indx,children)}else if(exists||isEmptyNode(child))newChildren=arrayUpdate(canEdit,indx,child,children);else{if(children.length>=MAX_INDEX_NODE)return function(edit,frag,child,bitmap,subNodes){for(var arr=[],bit=bitmap,count=0,i=0;bit;++i)1&bit&&(arr[i]=subNodes[count++]),bit>>>=1;return arr[frag]=child,ArrayNode(edit,count+1,arr)}(edit,frag,child,mask,children);bitmap|=bit,newChildren=function(mutate,at,v,arr){var len=arr.length;if(mutate){for(var _i=len;_i>=at;)arr[_i--]=arr[_i];return arr[at]=v,arr}for(var i=0,g=0,out=new Array(len+1);i<at;)out[g++]=arr[i++];for(out[at]=v;i<len;)out[++g]=arr[i++];return out}(canEdit,indx,child,children)}return canEdit?(this.mask=bitmap,this.children=newChildren,this):IndexedNode(edit,bitmap,newChildren)},ArrayNode__modify=function(edit,keyEq,shift,f,h,k,size){var count=this.size,children=this.children,frag=hashFragment(shift,h),child=children[frag],newChild=(child||empty)._modify(edit,keyEq,shift+5,f,h,k,size);if(child===newChild)return this;var canEdit=canEditNode(edit,this),newChildren=void 0;if(isEmptyNode(child)&&!isEmptyNode(newChild))++count,newChildren=arrayUpdate(canEdit,frag,newChild,children);else if(!isEmptyNode(child)&&isEmptyNode(newChild)){if(--count<=MIN_ARRAY_NODE)return function(edit,count,removed,elements){for(var children=new Array(count-1),g=0,bitmap=0,i=0,len=elements.length;i<len;++i)if(i!==removed){var elem=elements[i];elem&&!isEmptyNode(elem)&&(children[g++]=elem,bitmap|=1<<i)}return IndexedNode(edit,bitmap,children)}(edit,count,frag,children);newChildren=arrayUpdate(canEdit,frag,empty,children)}else newChildren=arrayUpdate(canEdit,frag,newChild,children);return canEdit?(this.size=count,this.children=newChildren,this):ArrayNode(edit,count,newChildren)};function Map(editable,edit,config,root,size){this._editable=editable,this._edit=edit,this._config=config,this._root=root,this._size=size}empty._modify=function(edit,keyEq,shift,f,h,k,size){var v=f();return v===nothing?empty:(++size.value,Leaf(edit,h,k,v))},Map.prototype.setTree=function(newRoot,newSize){return this._editable?(this._root=newRoot,this._size=newSize,this):newRoot===this._root?this:new Map(this._editable,this._edit,this._config,newRoot,newSize)};var tryGetHash=hamt.tryGetHash=function(alt,hash,key,map){for(var node=map._root,shift=0,keyEq=map._config.keyEq;;)switch(node.type){case 1:return keyEq(key,node.key)?node.value:alt;case 2:if(hash===node.hash)for(var children=node.children,i=0,len=children.length;i<len;++i){var child=children[i];if(keyEq(key,child.key))return child.value}return alt;case 3:var frag=hashFragment(shift,hash),bit=toBitmap(frag);if(node.mask&bit){node=node.children[fromBitmap(node.mask,bit)],shift+=5;break}return alt;case 4:if(node=node.children[hashFragment(shift,hash)]){shift+=5;break}return alt;default:return alt}};Map.prototype.tryGetHash=function(alt,hash,key){return tryGetHash(alt,hash,key,this)};var tryGet=hamt.tryGet=function(alt,key,map){return tryGetHash(alt,map._config.hash(key),key,map)};Map.prototype.tryGet=function(alt,key){return tryGet(alt,key,this)};var getHash=hamt.getHash=function(hash,key,map){return tryGetHash(void 0,hash,key,map)};Map.prototype.getHash=function(hash,key){return getHash(hash,key,this)};hamt.get=function(key,map){return tryGetHash(void 0,map._config.hash(key),key,map)};Map.prototype.get=function(key,alt){return tryGet(alt,key,this)};var hasHash=hamt.has=function(hash,key,map){return tryGetHash(nothing,hash,key,map)!==nothing};Map.prototype.hasHash=function(hash,key){return hasHash(hash,key,this)};var has=hamt.has=function(key,map){return hasHash(map._config.hash(key),key,map)};Map.prototype.has=function(key){return has(key,this)};var defKeyCompare=function(x,y){return x===y};hamt.make=function(config){return new Map(0,0,{keyEq:config&&config.keyEq||defKeyCompare,hash:config&&config.hash||hash},empty,0)},hamt.empty=hamt.make();var isEmpty=hamt.isEmpty=function(map){return map&&!!isEmptyNode(map._root)};Map.prototype.isEmpty=function(){return isEmpty(this)};var modifyHash=hamt.modifyHash=function(f,hash,key,map){var size={value:map._size},newRoot=map._root._modify(map._editable?map._edit:NaN,map._config.keyEq,0,f,hash,key,size);return map.setTree(newRoot,size.value)};Map.prototype.modifyHash=function(hash,key,f){return modifyHash(f,hash,key,this)};var modify=hamt.modify=function(f,key,map){return modifyHash(f,map._config.hash(key),key,map)};Map.prototype.modify=function(key,f){return modify(f,key,this)};var setHash=hamt.setHash=function(hash,key,value,map){return modifyHash(constant(value),hash,key,map)};Map.prototype.setHash=function(hash,key,value){return setHash(hash,key,value,this)};var set=hamt.set=function(key,value,map){return setHash(map._config.hash(key),key,value,map)};Map.prototype.set=function(key,value){return set(key,value,this)};var del=constant(nothing),removeHash=hamt.removeHash=function(hash,key,map){return modifyHash(del,hash,key,map)};Map.prototype.removeHash=Map.prototype.deleteHash=function(hash,key){return removeHash(hash,key,this)};var remove=hamt.remove=function(key,map){return removeHash(map._config.hash(key),key,map)};Map.prototype.remove=Map.prototype.delete=function(key){return remove(key,this)};var beginMutation=hamt.beginMutation=function(map){return new Map(map._editable+1,map._edit+1,map._config,map._root,map._size)};Map.prototype.beginMutation=function(){return beginMutation(this)};var endMutation=hamt.endMutation=function(map){return map._editable=map._editable&&map._editable-1,map};Map.prototype.endMutation=function(){return endMutation(this)};var mutate=hamt.mutate=function(f,map){var transient=beginMutation(map);return f(transient),endMutation(transient)};Map.prototype.mutate=function(f){return mutate(f,this)};var appk=function(k){return k&&lazyVisitChildren(k[0],k[1],k[2],k[3],k[4])},lazyVisitChildren=function(len,children,i,f,k){for(;i<len;){var child=children[i++];if(child&&!isEmptyNode(child))return lazyVisit(child,f,[len,children,i,f,k])}return appk(k)},lazyVisit=function(node,f,k){switch(node.type){case 1:return{value:f(node),rest:k};case 2:case 4:case 3:var children=node.children;return lazyVisitChildren(children.length,children,0,f,k);default:return appk(k)}},DONE={done:!0};function MapIterator(v){this.v=v}MapIterator.prototype.next=function(){if(!this.v)return DONE;var v0=this.v;return this.v=appk(v0.rest),v0},MapIterator.prototype[Symbol.iterator]=function(){return this};var visit=function(map,f){return new MapIterator(lazyVisit(map._root,f))},buildPairs=function(x){return[x.key,x.value]},entries=hamt.entries=function(map){return visit(map,buildPairs)};Map.prototype.entries=Map.prototype[Symbol.iterator]=function(){return entries(this)};var buildKeys=function(x){return x.key},keys=hamt.keys=function(map){return visit(map,buildKeys)};Map.prototype.keys=function(){return keys(this)};var buildValues=function(x){return x.value},values=hamt.values=Map.prototype.values=function(map){return visit(map,buildValues)};Map.prototype.values=function(){return values(this)};var fold=hamt.fold=function(f,z,m){var root=m._root;if(1===root.type)return f(z,root.value,root.key);for(var toVisit=[root.children],children=void 0;children=toVisit.pop();)for(var i=0,len=children.length;i<len;){var child=children[i++];child&&child.type&&(1===child.type?z=f(z,child.value,child.key):toVisit.push(child.children))}return z};Map.prototype.fold=function(f,z){return fold(f,z,this)};var forEach=hamt.forEach=function(f,map){return fold((function(_,value,key){return f(value,key,map)}),null,map)};Map.prototype.forEach=function(f){return forEach(f,this)};var count=hamt.count=function(map){return map._size};Map.prototype.count=function(){return count(this)},Object.defineProperty(Map.prototype,"size",{get:Map.prototype.count}),module.exports?module.exports=hamt:(void 0).hamt=hamt}));class BuiltInMap{constructor(existing){_defineProperty(this,"_map",void 0),this._map=new Map(null==existing?void 0:existing.entries())}keys(){return this._map.keys()}entries(){return this._map.entries()}get(k){return this._map.get(k)}has(k){return this._map.has(k)}set(k,v){return this._map.set(k,v),this}delete(k){return this._map.delete(k),this}clone(){return persistentMap(this)}toMap(){return new Map(this._map)}}class HashArrayMappedTrieMap{constructor(existing){if(_defineProperty(this,"_hamt",hamt_1.empty.beginMutation()),existing instanceof HashArrayMappedTrieMap){const h=existing._hamt.endMutation();existing._hamt=h.beginMutation(),this._hamt=h.beginMutation()}else if(existing)for(const[k,v]of existing.entries())this._hamt.set(k,v)}keys(){return this._hamt.keys()}entries(){return this._hamt.entries()}get(k){return this._hamt.get(k)}has(k){return this._hamt.has(k)}set(k,v){return this._hamt.set(k,v),this}delete(k){return this._hamt.delete(k),this}clone(){return persistentMap(this)}toMap(){return new Map(this._hamt)}}function persistentMap(existing){return Recoil_gkx("recoil_hamt_2020")?new HashArrayMappedTrieMap(existing):new BuiltInMap(existing)}var Recoil_PersistentMap_1=persistentMap,Recoil_PersistentMap$1=Object.freeze({__proto__:null,persistentMap:Recoil_PersistentMap_1});var Recoil_differenceSets=function(set,...setsWithValuesToRemove){const ret=new Set;FIRST:for(const value of set){for(const otherSet of setsWithValuesToRemove)if(otherSet.has(value))continue FIRST;ret.add(value)}return ret};var Recoil_mapMap=function(map,callback){const result=new Map;return map.forEach((value,key)=>{result.set(key,callback(value,key))}),result};function mergeDepsIntoGraph(key,newDeps,graph,olderGraph){const{nodeDeps:nodeDeps,nodeToNodeSubscriptions:nodeToNodeSubscriptions}=graph,oldDeps=nodeDeps.get(key);if(oldDeps&&olderGraph&&oldDeps!==olderGraph.nodeDeps.get(key))return;nodeDeps.set(key,newDeps);const addedDeps=null==oldDeps?newDeps:Recoil_differenceSets(newDeps,oldDeps);for(const dep of addedDeps){nodeToNodeSubscriptions.has(dep)||nodeToNodeSubscriptions.set(dep,new Set);Recoil_nullthrows(nodeToNodeSubscriptions.get(dep)).add(key)}if(oldDeps){const removedDeps=Recoil_differenceSets(oldDeps,newDeps);for(const dep of removedDeps){if(!nodeToNodeSubscriptions.has(dep))return;const existing=Recoil_nullthrows(nodeToNodeSubscriptions.get(dep));existing.delete(key),0===existing.size&&nodeToNodeSubscriptions.delete(dep)}}}var Recoil_Graph={cloneGraph:function(graph){return{nodeDeps:Recoil_mapMap(graph.nodeDeps,s=>new Set(s)),nodeToNodeSubscriptions:Recoil_mapMap(graph.nodeToNodeSubscriptions,s=>new Set(s))}},graph:function(){return{nodeDeps:new Map,nodeToNodeSubscriptions:new Map}},saveDepsToStore:function(key,deps,store,version){var _storeState$nextTree,_storeState$previousT,_storeState$previousT2,_storeState$previousT3;const storeState=store.getState();version!==storeState.currentTree.version&&version!==(null===(_storeState$nextTree=storeState.nextTree)||void 0===_storeState$nextTree?void 0:_storeState$nextTree.version)&&(null===(_storeState$previousT=storeState.previousTree)||void 0===_storeState$previousT||_storeState$previousT.version);const graph=store.getGraph(version);if(mergeDepsIntoGraph(key,deps,graph),version===(null===(_storeState$previousT2=storeState.previousTree)||void 0===_storeState$previousT2?void 0:_storeState$previousT2.version)){mergeDepsIntoGraph(key,deps,store.getGraph(storeState.currentTree.version),graph)}if(version===(null===(_storeState$previousT3=storeState.previousTree)||void 0===_storeState$previousT3?void 0:_storeState$previousT3.version)||version===storeState.currentTree.version){var _storeState$nextTree2;const nextVersion=null===(_storeState$nextTree2=storeState.nextTree)||void 0===_storeState$nextTree2?void 0:_storeState$nextTree2.version;if(void 0!==nextVersion){mergeDepsIntoGraph(key,deps,store.getGraph(nextVersion),graph)}}}};let nextTreeStateVersion=0;let nextStoreID=0;let nextComponentID=0;var Recoil_Keys={getNextTreeStateVersion:()=>nextTreeStateVersion++,getNextStoreID:()=>nextStoreID++,getNextComponentID:()=>nextComponentID++};const{persistentMap:persistentMap$1}=Recoil_PersistentMap$1,{graph:graph}=Recoil_Graph,{getNextTreeStateVersion:getNextTreeStateVersion$1}=Recoil_Keys;function makeEmptyTreeState(){const version=getNextTreeStateVersion$1();return{version:version,stateID:version,transactionMetadata:{},dirtyAtoms:new Set,atomValues:persistentMap$1(),nonvalidatedAtoms:persistentMap$1()}}var Recoil_State={makeEmptyTreeState:makeEmptyTreeState,makeEmptyStoreState:function(){const currentTree=makeEmptyTreeState();return{currentTree:currentTree,nextTree:null,previousTree:null,commitDepth:0,knownAtoms:new Set,knownSelectors:new Set,transactionSubscriptions:new Map,nodeTransactionSubscriptions:new Map,nodeToComponentSubscriptions:new Map,queuedComponentCallbacks_DEPRECATED:[],suspendedComponentResolvers:new Set,graphsByVersion:(new Map).set(currentTree.version,graph()),retention:{referenceCounts:new Map,nodesRetainedByZone:new Map,retainablesToCheckForRelease:new Set},nodeCleanupFunctions:new Map}},getNextTreeStateVersion:getNextTreeStateVersion$1};class RetentionZone{}var Recoil_RetentionZone={RetentionZone:RetentionZone,retentionZone:function(){return new RetentionZone}};var Recoil_CopyOnWrite={setByAddingToSet:function(set,v){const next=new Set(set);return next.add(v),next},setByDeletingFromSet:function(set,v){const next=new Set(set);return next.delete(v),next},mapBySettingInMap:function(map,k,v){const next=new Map(map);return next.set(k,v),next},mapByUpdatingInMap:function(map,k,updater){const next=new Map(map);return next.set(k,updater(next.get(k))),next},mapByDeletingFromMap:function(map,k){const next=new Map(map);return next.delete(k),next},mapByDeletingMultipleFromMap:function(map,ks){const next=new Map(map);return ks.forEach(k=>next.delete(k)),next}};var Recoil_filterIterable=function*(iterable,predicate){let index=0;for(const value of iterable)predicate(value,index++)&&(yield value)};var Recoil_lazyProxy=function(base,factories){return new Proxy(base,{get:(target,prop)=>(!(prop in target)&&prop in factories&&(target[prop]=factories[prop]()),target[prop]),ownKeys:target=>Object.keys(target)})};const{getNode:getNode$1,getNodeMaybe:getNodeMaybe$1,recoilValuesForKeys:recoilValuesForKeys$1}=Recoil_Node,{RetentionZone:RetentionZone$1}=Recoil_RetentionZone,{setByAddingToSet:setByAddingToSet$1}=Recoil_CopyOnWrite,emptySet=Object.freeze(new Set);class ReadOnlyRecoilValueError extends Error{}function initializeNodeIfNewToStore(store,treeState,key,trigger){const storeState=store.getState();if(storeState.nodeCleanupFunctions.has(key))return;const node=getNode$1(key),retentionCleanup=function(store,nodeKey,retainedBy){if(!Recoil_gkx("recoil_memory_managament_2020"))return()=>{};const{nodesRetainedByZone:nodesRetainedByZone}=store.getState().retention;function addToZone(zone){let set=nodesRetainedByZone.get(zone);set||nodesRetainedByZone.set(zone,set=new Set),set.add(nodeKey)}if(retainedBy instanceof RetentionZone$1)addToZone(retainedBy);else if(Array.isArray(retainedBy))for(const zone of retainedBy)addToZone(zone);return()=>{if(!Recoil_gkx("recoil_memory_managament_2020"))return;const{retention:retention}=store.getState();function deleteFromZone(zone){const set=retention.nodesRetainedByZone.get(zone);null==set||set.delete(nodeKey),set&&0===set.size&&retention.nodesRetainedByZone.delete(zone)}if(retainedBy instanceof RetentionZone$1)deleteFromZone(retainedBy);else if(Array.isArray(retainedBy))for(const zone of retainedBy)deleteFromZone(zone)}}(store,key,node.retainedBy),nodeCleanup=node.init(store,treeState,trigger);storeState.nodeCleanupFunctions.set(key,()=>{nodeCleanup(),retentionCleanup()})}function peekNodeLoadable(store,state,key){return getNode$1(key).peek(store,state)}function getDownstreamNodes(store,state,keys){const visitedNodes=new Set,visitingNodes=Array.from(keys),graph=store.getGraph(state.version);for(let key=visitingNodes.pop();key;key=visitingNodes.pop()){var _graph$nodeToNodeSubs;visitedNodes.add(key);const subscribedNodes=null!==(_graph$nodeToNodeSubs=graph.nodeToNodeSubscriptions.get(key))&&void 0!==_graph$nodeToNodeSubs?_graph$nodeToNodeSubs:emptySet;for(const downstreamNode of subscribedNodes)visitedNodes.has(downstreamNode)||visitingNodes.push(downstreamNode)}return visitedNodes}var Recoil_FunctionalCore={getNodeLoadable:function(store,state,key){return initializeNodeIfNewToStore(store,state,key,"get"),getNode$1(key).get(store,state)},peekNodeLoadable:peekNodeLoadable,setNodeValue:function(store,state,key,newValue){const node=getNode$1(key);if(null==node.set)throw new ReadOnlyRecoilValueError("Attempt to set read-only RecoilValue: "+key);const set=node.set;return initializeNodeIfNewToStore(store,state,key,"set"),set(store,state,newValue)},initializeNode:function(store,key,trigger){initializeNodeIfNewToStore(store,store.getState().currentTree,key,trigger)},cleanUpNode:function(store,key){var _state$nodeCleanupFun;const state=store.getState();null===(_state$nodeCleanupFun=state.nodeCleanupFunctions.get(key))||void 0===_state$nodeCleanupFun||_state$nodeCleanupFun(),state.nodeCleanupFunctions.delete(key)},setUnvalidatedAtomValue_DEPRECATED:function(state,key,newValue){var _node$invalidate;const node=getNodeMaybe$1(key);return null==node||null===(_node$invalidate=node.invalidate)||void 0===_node$invalidate||_node$invalidate.call(node,state),{...state,atomValues:state.atomValues.clone().delete(key),nonvalidatedAtoms:state.nonvalidatedAtoms.clone().set(key,newValue),dirtyAtoms:setByAddingToSet$1(state.dirtyAtoms,key)}},peekNodeInfo:function(store,state,key){const storeState=store.getState(),graph=store.getGraph(state.version),type=getNode$1(key).nodeType;return Recoil_lazyProxy({type:type},{loadable:()=>peekNodeLoadable(store,state,key),isActive:()=>storeState.knownAtoms.has(key)||storeState.knownSelectors.has(key),isSet:()=>"selector"!==type&&state.atomValues.has(key),isModified:()=>state.dirtyAtoms.has(key),deps:()=>{var _graph$nodeDeps$get;return recoilValuesForKeys$1(null!==(_graph$nodeDeps$get=graph.nodeDeps.get(key))&&void 0!==_graph$nodeDeps$get?_graph$nodeDeps$get:[])},subscribers:()=>{var _storeState$nodeToCom,_storeState$nodeToCom2;return{nodes:recoilValuesForKeys$1(Recoil_filterIterable(getDownstreamNodes(store,state,new Set([key])),nodeKey=>nodeKey!==key)),components:Recoil_mapIterable(null!==(_storeState$nodeToCom=null===(_storeState$nodeToCom2=storeState.nodeToComponentSubscriptions.get(key))||void 0===_storeState$nodeToCom2?void 0:_storeState$nodeToCom2.values())&&void 0!==_storeState$nodeToCom?_storeState$nodeToCom:[],([name])=>({name:name}))}}})},getDownstreamNodes:getDownstreamNodes};let _invalidateMemoizedSnapshot=null;var Recoil_SnapshotCache={setInvalidateMemoizedSnapshot:function(invalidate){_invalidateMemoizedSnapshot=invalidate},invalidateMemoizedSnapshot:function(){var _invalidateMemoizedSn;null===(_invalidateMemoizedSn=_invalidateMemoizedSnapshot)||void 0===_invalidateMemoizedSn||_invalidateMemoizedSn()}};const{getDownstreamNodes:getDownstreamNodes$1,getNodeLoadable:getNodeLoadable$1,setNodeValue:setNodeValue$1}=Recoil_FunctionalCore,{getNextComponentID:getNextComponentID$1}=Recoil_Keys,{getNode:getNode$2,getNodeMaybe:getNodeMaybe$2}=Recoil_Node,{DefaultValue:DefaultValue$1}=Recoil_Node,{reactMode:reactMode$1}=Recoil_ReactMode,{AbstractRecoilValue:AbstractRecoilValue$1,RecoilState:RecoilState$1,RecoilValueReadOnly:RecoilValueReadOnly$1,isRecoilValue:isRecoilValue$1}=Recoil_RecoilValue$1,{invalidateMemoizedSnapshot:invalidateMemoizedSnapshot$1}=Recoil_SnapshotCache;function applyAction(store,state,action){if("set"===action.type){const{recoilValue:recoilValue,valueOrUpdater:valueOrUpdater}=action,newValue=function(store,state,{key:key},valueOrUpdater){if("function"==typeof valueOrUpdater){const current=getNodeLoadable$1(store,state,key);if("loading"===current.state){throw Recoil_err(`Tried to set atom or selector "${key}" using an updater function while the current state is pending, this is not currently supported.`)}if("hasError"===current.state)throw current.contents;return valueOrUpdater(current.contents)}return valueOrUpdater}(store,state,recoilValue,valueOrUpdater),writes=setNodeValue$1(store,state,recoilValue.key,newValue);for(const[key,loadable]of writes.entries())writeLoadableToTreeState(state,key,loadable)}else if("setLoadable"===action.type){const{recoilValue:{key:key},loadable:loadable}=action;writeLoadableToTreeState(state,key,loadable)}else if("markModified"===action.type){const{recoilValue:{key:key}}=action;state.dirtyAtoms.add(key)}else if("setUnvalidated"===action.type){var _node$invalidate;const{recoilValue:{key:key},unvalidatedValue:unvalidatedValue}=action,node=getNodeMaybe$2(key);null==node||null===(_node$invalidate=node.invalidate)||void 0===_node$invalidate||_node$invalidate.call(node,state),state.atomValues.delete(key),state.nonvalidatedAtoms.set(key,unvalidatedValue),state.dirtyAtoms.add(key)}else Recoil_recoverableViolation("Unknown action "+action.type)}function writeLoadableToTreeState(state,key,loadable){"hasValue"===loadable.state&&loadable.contents instanceof DefaultValue$1?state.atomValues.delete(key):state.atomValues.set(key,loadable),state.dirtyAtoms.add(key),state.nonvalidatedAtoms.delete(key)}function applyActionsToStore(store,actions){store.replaceState(state=>{const newState=copyTreeState(state);for(const action of actions)applyAction(store,newState,action);return invalidateDownstreams(store,newState),invalidateMemoizedSnapshot$1(),newState})}function queueOrPerformStateUpdate(store,action){if(batchStack.length){const actionsByStore=batchStack[batchStack.length-1];let actions=actionsByStore.get(store);actions||actionsByStore.set(store,actions=[]),actions.push(action)}else applyActionsToStore(store,[action])}const batchStack=[];function copyTreeState(state){return{...state,atomValues:state.atomValues.clone(),nonvalidatedAtoms:state.nonvalidatedAtoms.clone(),dirtyAtoms:new Set(state.dirtyAtoms)}}function invalidateDownstreams(store,state){const downstreams=getDownstreamNodes$1(store,state,state.dirtyAtoms);for(const key of downstreams){var _getNodeMaybe,_getNodeMaybe$invalid;null===(_getNodeMaybe=getNodeMaybe$2(key))||void 0===_getNodeMaybe||null===(_getNodeMaybe$invalid=_getNodeMaybe.invalidate)||void 0===_getNodeMaybe$invalid||_getNodeMaybe$invalid.call(_getNodeMaybe,state)}}function setRecoilValue(store,recoilValue,valueOrUpdater){queueOrPerformStateUpdate(store,{type:"set",recoilValue:recoilValue,valueOrUpdater:valueOrUpdater})}var Recoil_RecoilValueInterface={RecoilValueReadOnly:RecoilValueReadOnly$1,AbstractRecoilValue:AbstractRecoilValue$1,RecoilState:RecoilState$1,getRecoilValueAsLoadable:function(store,{key:key},treeState=store.getState().currentTree){var _storeState$nextTree,_storeState$previousT;const storeState=store.getState();treeState.version!==storeState.currentTree.version&&treeState.version!==(null===(_storeState$nextTree=storeState.nextTree)||void 0===_storeState$nextTree?void 0:_storeState$nextTree.version)&&(treeState.version,null===(_storeState$previousT=storeState.previousTree)||void 0===_storeState$previousT||_storeState$previousT.version);const loadable=getNodeLoadable$1(store,treeState,key);return"loading"===loadable.state&&loadable.contents.catch(()=>{}),loadable},setRecoilValue:setRecoilValue,setRecoilValueLoadable:function(store,recoilValue,loadable){if(loadable instanceof DefaultValue$1)return setRecoilValue(store,recoilValue,loadable);queueOrPerformStateUpdate(store,{type:"setLoadable",recoilValue:recoilValue,loadable:loadable})},markRecoilValueModified:function(store,recoilValue){queueOrPerformStateUpdate(store,{type:"markModified",recoilValue:recoilValue})},setUnvalidatedRecoilValue:function(store,recoilValue,unvalidatedValue){queueOrPerformStateUpdate(store,{type:"setUnvalidated",recoilValue:recoilValue,unvalidatedValue:unvalidatedValue})},subscribeToRecoilValue:function(store,{key:key},callback,componentDebugName=null){const subID=getNextComponentID$1(),storeState=store.getState();storeState.nodeToComponentSubscriptions.has(key)||storeState.nodeToComponentSubscriptions.set(key,new Map),Recoil_nullthrows(storeState.nodeToComponentSubscriptions.get(key)).set(subID,[null!=componentDebugName?componentDebugName:"<not captured>",callback]);const mode=reactMode$1();if(mode.early&&("LEGACY"===mode.mode||"MUTABLE_SOURCE"===mode.mode)){const nextTree=store.getState().nextTree;nextTree&&nextTree.dirtyAtoms.has(key)&&callback(nextTree)}return{release:()=>{const releaseStoreState=store.getState(),subs=releaseStoreState.nodeToComponentSubscriptions.get(key);void 0!==subs&&subs.has(subID)&&(subs.delete(subID),0===subs.size&&releaseStoreState.nodeToComponentSubscriptions.delete(key))}}},isRecoilValue:isRecoilValue$1,applyAtomValueWrites:function(atomValues,writes){const result=atomValues.clone();return writes.forEach((v,k)=>{"hasValue"===v.state&&v.contents instanceof DefaultValue$1?result.delete(k):result.set(k,v)}),result},batchStart:function(){const actionsByStore=new Map;return batchStack.push(actionsByStore),()=>{for(const[store,actions]of actionsByStore)applyActionsToStore(store,actions);batchStack.pop()}},writeLoadableToTreeState:writeLoadableToTreeState,invalidateDownstreams:invalidateDownstreams,copyTreeState:copyTreeState,refreshRecoilValue:function(store,recoilValue){var _node$clearCache;const{currentTree:currentTree}=store.getState(),node=getNode$2(recoilValue.key);null===(_node$clearCache=node.clearCache)||void 0===_node$clearCache||_node$clearCache.call(node,store,currentTree)}};var Recoil_someSet=function(set,callback,context){const iterator=set.entries();let current=iterator.next();for(;!current.done;){const entry=current.value;if(callback.call(context,entry[1],entry[0],set))return!0;current=iterator.next()}return!1};const{cleanUpNode:cleanUpNode$1}=Recoil_FunctionalCore,{deleteNodeConfigIfPossible:deleteNodeConfigIfPossible$1,getNode:getNode$3}=Recoil_Node,{RetentionZone:RetentionZone$2}=Recoil_RetentionZone,emptySet$1=new Set;function releaseRetainablesNowOnCurrentTree(store,retainables){const storeState=store.getState(),treeState=storeState.currentTree;if(storeState.nextTree)return;const nodes=new Set;for(const r of retainables)if(r instanceof RetentionZone$2)for(const n of nodesRetainedByZone(storeState,r))nodes.add(n);else nodes.add(r);const releasableNodes=function(store,searchFromNodes){const storeState=store.getState(),treeState=storeState.currentTree,graph=store.getGraph(treeState.version),releasableNodes=new Set,nonReleasableNodes=new Set;return findReleasableNodesInner(searchFromNodes),releasableNodes;function findReleasableNodesInner(searchFromNodes){const releasableNodesFoundThisIteration=new Set,downstreams=function(store,treeState,nodes,doNotDescendInto1,doNotDescendInto2){const graph=store.getGraph(treeState.version),answer=[],visited=new Set;for(;nodes.size>0;)visit(Recoil_nullthrows(nodes.values().next().value));return answer;function visit(node){if(doNotDescendInto1.has(node)||doNotDescendInto2.has(node))return void nodes.delete(node);if(visited.has(node))return;const children=graph.nodeToNodeSubscriptions.get(node);if(children)for(const child of children)visit(child);visited.add(node),nodes.delete(node),answer.push(node)}}(store,treeState,searchFromNodes,releasableNodes,nonReleasableNodes);for(const node of downstreams){var _storeState$retention;if("recoilRoot"===getNode$3(node).retainedBy){nonReleasableNodes.add(node);continue}if((null!==(_storeState$retention=storeState.retention.referenceCounts.get(node))&&void 0!==_storeState$retention?_storeState$retention:0)>0){nonReleasableNodes.add(node);continue}if(zonesThatCouldRetainNode(node).some(z=>storeState.retention.referenceCounts.get(z))){nonReleasableNodes.add(node);continue}const nodeChildren=graph.nodeToNodeSubscriptions.get(node);nodeChildren&&Recoil_someSet(nodeChildren,child=>nonReleasableNodes.has(child))?nonReleasableNodes.add(node):(releasableNodes.add(node),releasableNodesFoundThisIteration.add(node))}const parents=new Set;for(const node of releasableNodesFoundThisIteration)for(const parent of null!==(_graph$nodeDeps$get=graph.nodeDeps.get(node))&&void 0!==_graph$nodeDeps$get?_graph$nodeDeps$get:emptySet$1){var _graph$nodeDeps$get;releasableNodes.has(parent)||parents.add(parent)}parents.size&&findReleasableNodesInner(parents)}}(store,nodes);for(const node of releasableNodes)releaseNode(store,treeState,node)}function releaseNode(store,treeState,node){if(!Recoil_gkx("recoil_memory_managament_2020"))return;cleanUpNode$1(store,node);const storeState=store.getState();storeState.knownAtoms.delete(node),storeState.knownSelectors.delete(node),storeState.nodeTransactionSubscriptions.delete(node),storeState.retention.referenceCounts.delete(node);const zones=zonesThatCouldRetainNode(node);for(const zone of zones){var _storeState$retention2;null===(_storeState$retention2=storeState.retention.nodesRetainedByZone.get(zone))||void 0===_storeState$retention2||_storeState$retention2.delete(node)}treeState.atomValues.delete(node),treeState.dirtyAtoms.delete(node),treeState.nonvalidatedAtoms.delete(node);const graph=storeState.graphsByVersion.get(treeState.version);if(graph){const deps=graph.nodeDeps.get(node);if(void 0!==deps){graph.nodeDeps.delete(node);for(const dep of deps){var _graph$nodeToNodeSubs;null===(_graph$nodeToNodeSubs=graph.nodeToNodeSubscriptions.get(dep))||void 0===_graph$nodeToNodeSubs||_graph$nodeToNodeSubs.delete(node)}}graph.nodeToNodeSubscriptions.delete(node)}deleteNodeConfigIfPossible$1(node)}function nodesRetainedByZone(storeState,zone){var _storeState$retention3;return null!==(_storeState$retention3=storeState.retention.nodesRetainedByZone.get(zone))&&void 0!==_storeState$retention3?_storeState$retention3:emptySet$1}function zonesThatCouldRetainNode(node){const retainedBy=getNode$3(node).retainedBy;return void 0===retainedBy||"components"===retainedBy||"recoilRoot"===retainedBy?[]:retainedBy instanceof RetentionZone$2?[retainedBy]:retainedBy}function updateRetainCountToZero(store,retainable){if(!Recoil_gkx("recoil_memory_managament_2020"))return;store.getState().retention.referenceCounts.delete(retainable),function(store,retainable){const state=store.getState();state.nextTree?state.retention.retainablesToCheckForRelease.add(retainable):releaseRetainablesNowOnCurrentTree(store,new Set([retainable]))}(store,retainable)}var Recoil_Retention={SUSPENSE_TIMEOUT_MS:12e4,updateRetainCount:function(store,retainable,delta){var _map$get;if(!Recoil_gkx("recoil_memory_managament_2020"))return;const map=store.getState().retention.referenceCounts,newCount=(null!==(_map$get=map.get(retainable))&&void 0!==_map$get?_map$get:0)+delta;0===newCount?updateRetainCountToZero(store,retainable):map.set(retainable,newCount)},updateRetainCountToZero:updateRetainCountToZero,releaseScheduledRetainablesNow:function(store){if(!Recoil_gkx("recoil_memory_managament_2020"))return;const state=store.getState();releaseRetainablesNowOnCurrentTree(store,state.retention.retainablesToCheckForRelease),state.retention.retainablesToCheckForRelease.clear()},retainedByOptionWithDefault:function(r){return void 0===r?"recoilRoot":r}};const{unstable_batchedUpdates:unstable_batchedUpdates}=reactDom;var ReactBatchedUpdates={unstable_batchedUpdates:unstable_batchedUpdates};const{unstable_batchedUpdates:unstable_batchedUpdates$1}=ReactBatchedUpdates;var Recoil_ReactBatchedUpdates={unstable_batchedUpdates:unstable_batchedUpdates$1};const{batchStart:batchStart$1}=Recoil_RecoilValueInterface,{unstable_batchedUpdates:unstable_batchedUpdates$2}=Recoil_ReactBatchedUpdates;let batcher=unstable_batchedUpdates$2||(batchFn=>batchFn());var Recoil_Batching={getBatcher:()=>batcher,setBatcher:newBatcher=>{batcher=newBatcher},batchUpdates:callback=>{batcher(()=>{let batchEnd=()=>{};try{batchEnd=batchStart$1(),callback()}finally{batchEnd()}})}};var Recoil_concatIterables=function*(iters){for(const iter of iters)for(const val of iter)yield val};const isSSR="undefined"==typeof Window||"undefined"==typeof window,isReactNative="undefined"!=typeof navigator&&"ReactNative"===navigator.product;var Recoil_Environment={isSSR:isSSR,isReactNative:isReactNative,isWindow:value=>!isSSR&&(value===window||value instanceof Window)};var Recoil_Memoize={memoizeWithArgsHash:function(fn,hashFunction){let cache;return(...args)=>{cache||(cache={});const key=hashFunction(...args);return Object.hasOwnProperty.call(cache,key)||(cache[key]=fn(...args)),cache[key]}},memoizeOneWithArgsHash:function(fn,hashFunction){let lastKey,lastResult;return(...args)=>{const key=hashFunction(...args);return lastKey===key||(lastKey=key,lastResult=fn(...args)),lastResult}},memoizeOneWithArgsHashAndInvalidation:function(fn,hashFunction){let lastKey,lastResult;return[(...args)=>{const key=hashFunction(...args);return lastKey===key||(lastKey=key,lastResult=fn(...args)),lastResult},()=>{lastKey=null}]}};const{batchUpdates:batchUpdates$1}=Recoil_Batching,{initializeNode:initializeNode$1,peekNodeInfo:peekNodeInfo$1}=Recoil_FunctionalCore,{graph:graph$1}=Recoil_Graph,{getNextStoreID:getNextStoreID$1}=Recoil_Keys,{DEFAULT_VALUE:DEFAULT_VALUE$1,recoilValues:recoilValues$1,recoilValuesForKeys:recoilValuesForKeys$2}=Recoil_Node,{AbstractRecoilValue:AbstractRecoilValue$2,getRecoilValueAsLoadable:getRecoilValueAsLoadable$1,setRecoilValue:setRecoilValue$1,setUnvalidatedRecoilValue:setUnvalidatedRecoilValue$1}=Recoil_RecoilValueInterface,{updateRetainCount:updateRetainCount$1}=Recoil_Retention,{setInvalidateMemoizedSnapshot:setInvalidateMemoizedSnapshot$1}=Recoil_SnapshotCache,{getNextTreeStateVersion:getNextTreeStateVersion$2,makeEmptyStoreState:makeEmptyStoreState$1}=Recoil_State,{isSSR:isSSR$1}=Recoil_Environment,{memoizeOneWithArgsHashAndInvalidation:memoizeOneWithArgsHashAndInvalidation$1}=Recoil_Memoize;class Snapshot{constructor(storeState,parentStoreID){_defineProperty(this,"_store",void 0),_defineProperty(this,"_refCount",1),_defineProperty(this,"getLoadable",recoilValue=>(this.checkRefCount_INTERNAL(),getRecoilValueAsLoadable$1(this._store,recoilValue))),_defineProperty(this,"getPromise",recoilValue=>(this.checkRefCount_INTERNAL(),this.getLoadable(recoilValue).toPromise())),_defineProperty(this,"getNodes_UNSTABLE",opt=>{if(this.checkRefCount_INTERNAL(),!0===(null==opt?void 0:opt.isModified)){if(!1===(null==opt?void 0:opt.isInitialized))return[];const state=this._store.getState().currentTree;return recoilValuesForKeys$2(state.dirtyAtoms)}const knownAtoms=this._store.getState().knownAtoms,knownSelectors=this._store.getState().knownSelectors;return null==(null==opt?void 0:opt.isInitialized)?recoilValues$1.values():!0===opt.isInitialized?recoilValuesForKeys$2(Recoil_concatIterables([knownAtoms,knownSelectors])):Recoil_filterIterable(recoilValues$1.values(),({key:key})=>!knownAtoms.has(key)&&!knownSelectors.has(key))}),_defineProperty(this,"getInfo_UNSTABLE",({key:key})=>(this.checkRefCount_INTERNAL(),peekNodeInfo$1(this._store,this._store.getState().currentTree,key))),_defineProperty(this,"map",mapper=>{this.checkRefCount_INTERNAL();const mutableSnapshot=new MutableSnapshot(this,batchUpdates$1);return mapper(mutableSnapshot),mutableSnapshot}),_defineProperty(this,"asyncMap",async mapper=>{this.checkRefCount_INTERNAL();const mutableSnapshot=new MutableSnapshot(this,batchUpdates$1);return mutableSnapshot.retain(),await mapper(mutableSnapshot),mutableSnapshot.autoRelease_INTERNAL(),mutableSnapshot}),this._store={storeID:getNextStoreID$1(),parentStoreID:parentStoreID,getState:()=>storeState,replaceState:replacer=>{storeState.currentTree=replacer(storeState.currentTree)},getGraph:version=>{const graphs=storeState.graphsByVersion;if(graphs.has(version))return Recoil_nullthrows(graphs.get(version));const newGraph=graph$1();return graphs.set(version,newGraph),newGraph},subscribeToTransactions:()=>({release:()=>{}}),addTransactionMetadata:()=>{throw Recoil_err("Cannot subscribe to Snapshots")}};for(const nodeKey of this._store.getState().knownAtoms)initializeNode$1(this._store,nodeKey,"get"),updateRetainCount$1(this._store,nodeKey,1);this.autoRelease_INTERNAL()}retain(){this._refCount,this._refCount++;let released=!1;return()=>{released||(released=!0,this._release())}}autoRelease_INTERNAL(){isSSR$1||window.setTimeout(()=>this._release(),10)}_release(){if(this._refCount--,0===this._refCount){if(this._store.getState().nodeCleanupFunctions.forEach(cleanup=>cleanup()),this._store.getState().nodeCleanupFunctions.clear(),!Recoil_gkx("recoil_memory_managament_2020"))return}else this._refCount}isRetained(){return this._refCount>0}checkRefCount_INTERNAL(){Recoil_gkx("recoil_memory_managament_2020")&&this._refCount}getStore_INTERNAL(){return this.checkRefCount_INTERNAL(),this._store}getID(){return this.checkRefCount_INTERNAL(),this._store.getState().currentTree.stateID}getStoreID(){return this.checkRefCount_INTERNAL(),this._store.storeID}}function cloneStoreState(store,treeState,bumpVersion=!1){const storeState=store.getState(),version=bumpVersion?getNextTreeStateVersion$2():treeState.version;return{currentTree:{version:bumpVersion?version:treeState.version,stateID:bumpVersion?version:treeState.stateID,transactionMetadata:{...treeState.transactionMetadata},dirtyAtoms:new Set(treeState.dirtyAtoms),atomValues:treeState.atomValues.clone(),nonvalidatedAtoms:treeState.nonvalidatedAtoms.clone()},commitDepth:0,nextTree:null,previousTree:null,knownAtoms:new Set(storeState.knownAtoms),knownSelectors:new Set(storeState.knownSelectors),transactionSubscriptions:new Map,nodeTransactionSubscriptions:new Map,nodeToComponentSubscriptions:new Map,queuedComponentCallbacks_DEPRECATED:[],suspendedComponentResolvers:new Set,graphsByVersion:(new Map).set(version,store.getGraph(treeState.version)),retention:{referenceCounts:new Map,nodesRetainedByZone:new Map,retainablesToCheckForRelease:new Set},nodeCleanupFunctions:new Map(Recoil_mapIterable(storeState.nodeCleanupFunctions.entries(),([key])=>[key,()=>{}]))}}const[memoizedCloneSnapshot,invalidateMemoizedSnapshot$2]=memoizeOneWithArgsHashAndInvalidation$1((store,version)=>{var _storeState$nextTree;const storeState=store.getState(),treeState="latest"===version?null!==(_storeState$nextTree=storeState.nextTree)&&void 0!==_storeState$nextTree?_storeState$nextTree:storeState.currentTree:Recoil_nullthrows(storeState.previousTree);return new Snapshot(cloneStoreState(store,treeState),store.storeID)},(store,version)=>{var _store$getState$nextT,_store$getState$previ;return String(version)+String(store.storeID)+String(null===(_store$getState$nextT=store.getState().nextTree)||void 0===_store$getState$nextT?void 0:_store$getState$nextT.version)+String(store.getState().currentTree.version)+String(null===(_store$getState$previ=store.getState().previousTree)||void 0===_store$getState$previ?void 0:_store$getState$previ.version)});setInvalidateMemoizedSnapshot$1(invalidateMemoizedSnapshot$2);class MutableSnapshot extends Snapshot{constructor(snapshot,batch){super(cloneStoreState(snapshot.getStore_INTERNAL(),snapshot.getStore_INTERNAL().getState().currentTree,!0),snapshot.getStoreID()),_defineProperty(this,"_batch",void 0),_defineProperty(this,"set",(recoilState,newValueOrUpdater)=>{this.checkRefCount_INTERNAL();const store=this.getStore_INTERNAL();this._batch(()=>{updateRetainCount$1(store,recoilState.key,1),setRecoilValue$1(this.getStore_INTERNAL(),recoilState,newValueOrUpdater)})}),_defineProperty(this,"reset",recoilState=>{this.checkRefCount_INTERNAL();const store=this.getStore_INTERNAL();this._batch(()=>{updateRetainCount$1(store,recoilState.key,1),setRecoilValue$1(this.getStore_INTERNAL(),recoilState,DEFAULT_VALUE$1)})}),_defineProperty(this,"setUnvalidatedAtomValues_DEPRECATED",values=>{this.checkRefCount_INTERNAL();const store=this.getStore_INTERNAL();batchUpdates$1(()=>{for(const[k,v]of values.entries())updateRetainCount$1(store,k,1),setUnvalidatedRecoilValue$1(store,new AbstractRecoilValue$2(k),v)})}),this._batch=batch}}var Recoil_Snapshot={Snapshot:Snapshot,MutableSnapshot:MutableSnapshot,freshSnapshot:function(initializeState){const snapshot=new Snapshot(makeEmptyStoreState$1());return null!=initializeState?snapshot.map(initializeState):snapshot},cloneSnapshot:function(store,version="latest"){const snapshot=memoizedCloneSnapshot(store,version);return snapshot.isRetained()?snapshot:(invalidateMemoizedSnapshot$2(),memoizedCloneSnapshot(store,version))}},Recoil_Snapshot_1=Recoil_Snapshot.Snapshot,Recoil_Snapshot_2=Recoil_Snapshot.MutableSnapshot,Recoil_Snapshot_3=Recoil_Snapshot.freshSnapshot,Recoil_Snapshot_4=Recoil_Snapshot.cloneSnapshot,Recoil_Snapshot$1=Object.freeze({__proto__:null,Snapshot:Recoil_Snapshot_1,MutableSnapshot:Recoil_Snapshot_2,freshSnapshot:Recoil_Snapshot_3,cloneSnapshot:Recoil_Snapshot_4});var Recoil_unionSets=function(...sets){const result=new Set;for(const set of sets)for(const value of set)result.add(value);return result};const{useRef:useRef}=react;var Recoil_useRefInitOnce=function(initialValue){const ref=useRef(initialValue);return ref.current===initialValue&&"function"==typeof initialValue&&(ref.current=initialValue()),ref};const{getNextTreeStateVersion:getNextTreeStateVersion$3,makeEmptyStoreState:makeEmptyStoreState$2}=Recoil_State,{cleanUpNode:cleanUpNode$2,getDownstreamNodes:getDownstreamNodes$2,initializeNode:initializeNode$2,setNodeValue:setNodeValue$2,setUnvalidatedAtomValue_DEPRECATED:setUnvalidatedAtomValue_DEPRECATED$1}=Recoil_FunctionalCore,{graph:graph$2}=Recoil_Graph,{cloneGraph:cloneGraph$1}=Recoil_Graph,{getNextStoreID:getNextStoreID$2}=Recoil_Keys,{createMutableSource:createMutableSource$1,reactMode:reactMode$2}=Recoil_ReactMode,{applyAtomValueWrites:applyAtomValueWrites$1}=Recoil_RecoilValueInterface,{releaseScheduledRetainablesNow:releaseScheduledRetainablesNow$1}=Recoil_Retention,{freshSnapshot:freshSnapshot$1}=Recoil_Snapshot$1,{useCallback:useCallback,useContext:useContext,useEffect:useEffect,useMemo:useMemo,useRef:useRef$1,useState:useState}=react;function notInAContext(){throw Recoil_err("This component must be used inside a <RecoilRoot> component.")}const defaultStore=Object.freeze({storeID:getNextStoreID$2(),getState:notInAContext,replaceState:notInAContext,getGraph:notInAContext,subscribeToTransactions:notInAContext,addTransactionMetadata:notInAContext});let stateReplacerIsBeingExecuted=!1;function startNextTreeIfNeeded(store){if(stateReplacerIsBeingExecuted)throw Recoil_err("An atom update was triggered within the execution of a state updater function. State updater functions provided to Recoil must be pure functions.");const storeState=store.getState();if(null===storeState.nextTree){Recoil_gkx("recoil_memory_managament_2020")&&Recoil_gkx("recoil_release_on_cascading_update_killswitch_2021")&&storeState.commitDepth>0&&releaseScheduledRetainablesNow$1(store);const version=storeState.currentTree.version,nextVersion=getNextTreeStateVersion$3();storeState.nextTree={...storeState.currentTree,version:nextVersion,stateID:nextVersion,dirtyAtoms:new Set,transactionMetadata:{}},storeState.graphsByVersion.set(nextVersion,cloneGraph$1(Recoil_nullthrows(storeState.graphsByVersion.get(version))))}}const AppContext=react.createContext({current:defaultStore}),useStoreRef=()=>useContext(AppContext),MutableSourceContext=react.createContext(null);function notifyComponents(store,storeState,treeState){const dependentNodes=getDownstreamNodes$2(store,treeState,treeState.dirtyAtoms);for(const key of dependentNodes){const comps=storeState.nodeToComponentSubscriptions.get(key);if(comps)for(const[_subID,[_debugName,callback]]of comps)callback(treeState)}}function sendEndOfBatchNotifications(store){const storeState=store.getState(),treeState=storeState.currentTree,dirtyAtoms=treeState.dirtyAtoms;if(dirtyAtoms.size){for(const[key,subscriptions]of storeState.nodeTransactionSubscriptions)if(dirtyAtoms.has(key))for(const[_,subscription]of subscriptions)subscription(store);for(const[_,subscription]of storeState.transactionSubscriptions)subscription(store);(!reactMode$2().early||storeState.suspendedComponentResolvers.size>0)&&(notifyComponents(store,storeState,treeState),storeState.suspendedComponentResolvers.forEach(cb=>cb()),storeState.suspendedComponentResolvers.clear())}storeState.queuedComponentCallbacks_DEPRECATED.forEach(cb=>cb(treeState)),storeState.queuedComponentCallbacks_DEPRECATED.splice(0,storeState.queuedComponentCallbacks_DEPRECATED.length)}function Batcher({setNotifyBatcherOfChange:setNotifyBatcherOfChange}){const storeRef=useStoreRef(),[,setState]=useState([]);return setNotifyBatcherOfChange(()=>setState({})),useEffect(()=>(setNotifyBatcherOfChange(()=>setState({})),()=>{setNotifyBatcherOfChange(()=>{})}),[setNotifyBatcherOfChange]),useEffect(()=>{Recoil_Queue.enqueueExecution("Batcher",()=>{!function(store){const storeState=store.getState();storeState.commitDepth++;try{const{nextTree:nextTree}=storeState;if(null==nextTree)return;storeState.previousTree=storeState.currentTree,storeState.currentTree=nextTree,storeState.nextTree=null,sendEndOfBatchNotifications(store),null!=storeState.previousTree?storeState.graphsByVersion.delete(storeState.previousTree.version):Recoil_recoverableViolation("Ended batch with no previous state, which is unexpected","recoil"),storeState.previousTree=null,Recoil_gkx("recoil_memory_managament_2020")&&null==nextTree&&releaseScheduledRetainablesNow$1(store)}finally{storeState.commitDepth--}}(storeRef.current)})}),null}let nextID=0;function RecoilRoot_INTERNAL({initializeState_DEPRECATED:initializeState_DEPRECATED,initializeState:initializeState,store_INTERNAL:storeProp,children:children}){let storeStateRef;const getGraph=version=>{const graphs=storeStateRef.current.graphsByVersion;if(graphs.has(version))return Recoil_nullthrows(graphs.get(version));const newGraph=graph$2();return graphs.set(version,newGraph),newGraph},subscribeToTransactions=(callback,key)=>{if(null==key){const{transactionSubscriptions:transactionSubscriptions}=storeRef.current.getState(),id=nextID++;return transactionSubscriptions.set(id,callback),{release:()=>{transactionSubscriptions.delete(id)}}}{const{nodeTransactionSubscriptions:nodeTransactionSubscriptions}=storeRef.current.getState();nodeTransactionSubscriptions.has(key)||nodeTransactionSubscriptions.set(key,new Map);const id=nextID++;return Recoil_nullthrows(nodeTransactionSubscriptions.get(key)).set(id,callback),{release:()=>{const subs=nodeTransactionSubscriptions.get(key);subs&&(subs.delete(id),0===subs.size&&nodeTransactionSubscriptions.delete(key))}}}},addTransactionMetadata=metadata=>{startNextTreeIfNeeded(storeRef.current);for(const k of Object.keys(metadata))Recoil_nullthrows(storeRef.current.getState().nextTree).transactionMetadata[k]=metadata[k]},replaceState=replacer=>{startNextTreeIfNeeded(storeRef.current);const nextTree=Recoil_nullthrows(storeStateRef.current.nextTree);let replaced;try{stateReplacerIsBeingExecuted=!0,replaced=replacer(nextTree)}finally{stateReplacerIsBeingExecuted=!1}replaced!==nextTree&&(storeStateRef.current.nextTree=replaced,reactMode$2().early&¬ifyComponents(storeRef.current,storeStateRef.current,replaced),Recoil_nullthrows(notifyBatcherOfChange.current)())},notifyBatcherOfChange=useRef$1(null),setNotifyBatcherOfChange=useCallback(x=>{notifyBatcherOfChange.current=x},[notifyBatcherOfChange]),storeRef=Recoil_useRefInitOnce(()=>null!=storeProp?storeProp:{storeID:getNextStoreID$2(),getState:()=>storeStateRef.current,replaceState:replaceState,getGraph:getGraph,subscribeToTransactions:subscribeToTransactions,addTransactionMetadata:addTransactionMetadata});null!=storeProp&&(storeRef.current=storeProp),storeStateRef=Recoil_useRefInitOnce(()=>null!=initializeState_DEPRECATED?function(store,initializeState){const initial=makeEmptyStoreState$2();return initializeState({set:(atom,value)=>{const state=initial.currentTree,writes=setNodeValue$2(store,state,atom.key,value),writtenNodes=new Set(writes.keys()),nonvalidatedAtoms=state.nonvalidatedAtoms.clone();for(const n of writtenNodes)nonvalidatedAtoms.delete(n);initial.currentTree={...state,dirtyAtoms:Recoil_unionSets(state.dirtyAtoms,writtenNodes),atomValues:applyAtomValueWrites$1(state.atomValues,writes),nonvalidatedAtoms:nonvalidatedAtoms}},setUnvalidatedAtomValues:atomValues=>{atomValues.forEach((v,k)=>{initial.currentTree=setUnvalidatedAtomValue_DEPRECATED$1(initial.currentTree,k,v)})}}),initial}(storeRef.current,initializeState_DEPRECATED):null!=initializeState?function(initializeState){const snapshot=freshSnapshot$1(initializeState),storeState=snapshot.getStore_INTERNAL().getState();return snapshot.retain(),storeState.nodeCleanupFunctions.forEach(cleanup=>cleanup()),storeState.nodeCleanupFunctions.clear(),storeState}(initializeState):makeEmptyStoreState$2());const mutableSource=useMemo(()=>null==createMutableSource$1?void 0:createMutableSource$1(storeStateRef,()=>storeStateRef.current.currentTree.version),[storeStateRef]);return useEffect(()=>{const store=storeRef.current;for(const atomKey of new Set(store.getState().knownAtoms))initializeNode$2(store,atomKey,"get");return()=>{for(const atomKey of store.getState().knownAtoms)cleanUpNode$2(store,atomKey)}},[storeRef]),react.createElement(AppContext.Provider,{value:storeRef},react.createElement(MutableSourceContext.Provider,{value:mutableSource},react.createElement(Batcher,{setNotifyBatcherOfChange:setNotifyBatcherOfChange}),children))}var Recoil_RecoilRoot={RecoilRoot:function(props){const{override:override,...propsExceptOverride}=props,ancestorStoreRef=useStoreRef();return!1===override&&ancestorStoreRef.current!==defaultStore?props.children:react.createElement(RecoilRoot_INTERNAL,propsExceptOverride)},useStoreRef:useStoreRef,useRecoilMutableSource:function(){return useContext(MutableSourceContext)},useRecoilStoreID:function(){return useStoreRef().current.storeID},notifyComponents_FOR_TESTING:notifyComponents,sendEndOfBatchNotifications_FOR_TESTING:sendEndOfBatchNotifications};var Recoil_shallowArrayEqual=function(a,b){if(a===b)return!0;if(a.length!==b.length)return!1;for(let i=0,l=a.length;i<l;i++)if(a[i]!==b[i])return!1;return!0};const{useEffect:useEffect$1,useRef:useRef$2}=react;var Recoil_usePrevious=function(value){const ref=useRef$2();return useEffect$1(()=>{ref.current=value}),ref.current};const{useStoreRef:useStoreRef$1}=Recoil_RecoilRoot,{SUSPENSE_TIMEOUT_MS:SUSPENSE_TIMEOUT_MS$1}=Recoil_Retention,{updateRetainCount:updateRetainCount$2}=Recoil_Retention,{RetentionZone:RetentionZone$3}=Recoil_RetentionZone,{useEffect:useEffect$2,useRef:useRef$3}=react,{isSSR:isSSR$2}=Recoil_Environment;var Recoil_useRetain=function(toRetain){if(Recoil_gkx("recoil_memory_managament_2020"))return function(toRetain){const retainables=(Array.isArray(toRetain)?toRetain:[toRetain]).map(a=>a instanceof RetentionZone$3?a:a.key),storeRef=useStoreRef$1();useEffect$2(()=>{if(!Recoil_gkx("recoil_memory_managament_2020"))return;const store=storeRef.current;if(timeoutID.current&&!isSSR$2)window.clearTimeout(timeoutID.current),timeoutID.current=null;else for(const r of retainables)updateRetainCount$2(store,r,1);return()=>{for(const r of retainables)updateRetainCount$2(store,r,-1)}},[storeRef,...retainables]);const timeoutID=useRef$3(),previousRetainables=Recoil_usePrevious(retainables);if(!(isSSR$2||void 0!==previousRetainables&&Recoil_shallowArrayEqual(previousRetainables,retainables))){const store=storeRef.current;for(const r of retainables)updateRetainCount$2(store,r,1);if(previousRetainables)for(const r of previousRetainables)updateRetainCount$2(store,r,-1);timeoutID.current&&window.clearTimeout(timeoutID.current),timeoutID.current=window.setTimeout(()=>{timeoutID.current=null;for(const r of retainables)updateRetainCount$2(store,r,-1)},SUSPENSE_TIMEOUT_MS$1)}}(toRetain)};var Recoil_useComponentName=function(){return"<component name not available>"};const{batchUpdates:batchUpdates$2}=Recoil_Batching,{DEFAULT_VALUE:DEFAULT_VALUE$2}=Recoil_Node,{currentRendererSupportsUseSyncExternalStore:currentRendererSupportsUseSyncExternalStore$1,reactMode:reactMode$3,useMutableSource:useMutableSource$1,useSyncExternalStore:useSyncExternalStore$1}=Recoil_ReactMode,{useRecoilMutableSource:useRecoilMutableSource$1,useStoreRef:useStoreRef$2}=Recoil_RecoilRoot,{AbstractRecoilValue:AbstractRecoilValue$3,getRecoilValueAsLoadable:getRecoilValueAsLoadable$2,setRecoilValue:setRecoilValue$2,setUnvalidatedRecoilValue:setUnvalidatedRecoilValue$2,subscribeToRecoilValue:subscribeToRecoilValue$1}=Recoil_RecoilValueInterface,{useCallback:useCallback$1,useEffect:useEffect$3,useMemo:useMemo$1,useRef:useRef$4,useState:useState$1}=react,{setByAddingToSet:setByAddingToSet$2}=Recoil_CopyOnWrite,{isSSR:isSSR$3}=Recoil_Environment;function handleLoadable(loadable,recoilValue,storeRef){if("hasValue"===loadable.state)return loadable.contents;if("loading"===loadable.state){throw new Promise(resolve=>{const suspendedComponentResolvers=storeRef.current.getState().suspendedComponentResolvers;suspendedComponentResolvers.add(resolve),isSSR$3&&Recoil_isPromise(loadable.contents)&&loadable.contents.finally(()=>{suspendedComponentResolvers.delete(resolve)})})}throw"hasError"===loadable.state?loadable.contents:Recoil_err(`Invalid value of loadable atom "${recoilValue.key}"`)}function useRecoilValueLoadable_SYNC_EXTERNAL_STORE(recoilValue){const storeRef=useStoreRef$2(),componentName=Recoil_useComponentName(),getSnapshot=useCallback$1(()=>{var _storeState$nextTree2;const store=storeRef.current,storeState=store.getState(),treeState=reactMode$3().early&&null!==(_storeState$nextTree2=storeState.nextTree)&&void 0!==_storeState$nextTree2?_storeState$nextTree2:storeState.currentTree;return{loadable:getRecoilValueAsLoadable$2(store,recoilValue,treeState),key:recoilValue.key}},[storeRef,recoilValue]),memoizePreviousSnapshot=useCallback$1(getState=>{let prevState;return()=>{var _prevState,_prevState2;const nextState=getState();return null!==(_prevState=prevState)&&void 0!==_prevState&&_prevState.loadable.is(nextState.loadable)&&(null===(_prevState2=prevState)||void 0===_prevState2?void 0:_prevState2.key)===nextState.key?prevState:(prevState=nextState,nextState)}},[]),getMemoizedSnapshot=useMemo$1(()=>memoizePreviousSnapshot(getSnapshot),[getSnapshot,memoizePreviousSnapshot]),subscribe=useCallback$1(notify=>{const store=storeRef.current;return subscribeToRecoilValue$1(store,recoilValue,notify,componentName).release},[storeRef,recoilValue,componentName]);return useSyncExternalStore$1(subscribe,getMemoizedSnapshot,getMemoizedSnapshot).loadable}function useRecoilValueLoadable_MUTABLE_SOURCE(recoilValue){const storeRef=useStoreRef$2(),getLoadable=useCallback$1(()=>{var _storeState$nextTree3;const store=storeRef.current,storeState=store.getState(),treeState=reactMode$3().early&&null!==(_storeState$nextTree3=storeState.nextTree)&&void 0!==_storeState$nextTree3?_storeState$nextTree3:storeState.currentTree;return getRecoilValueAsLoadable$2(store,recoilValue,treeState)},[storeRef,recoilValue]),getLoadableWithTesting=useCallback$1(()=>getLoadable(),[getLoadable]),componentName=Recoil_useComponentName(),subscribe=useCallback$1((_storeState,notify)=>{const store=storeRef.current;return subscribeToRecoilValue$1(store,recoilValue,()=>{if(!Recoil_gkx("recoil_suppress_rerender_in_callback"))return notify();const newLoadable=getLoadable();prevLoadableRef.current.is(newLoadable)||notify(),prevLoadableRef.current=newLoadable},componentName).release},[storeRef,recoilValue,componentName,getLoadable]),source=useRecoilMutableSource$1();if(null==source)throw Recoil_err("Recoil hooks must be used in components contained within a <RecoilRoot> component.");const loadable=useMutableSource$1(source,getLoadableWithTesting,subscribe),prevLoadableRef=useRef$4(loadable);return useEffect$3(()=>{prevLoadableRef.current=loadable}),loadable}function useRecoilValueLoadable_TRANSITION_SUPPORT(recoilValue){const storeRef=useStoreRef$2(),componentName=Recoil_useComponentName(),getLoadable=useCallback$1(()=>{var _storeState$nextTree4;const store=storeRef.current,storeState=store.getState(),treeState=reactMode$3().early&&null!==(_storeState$nextTree4=storeState.nextTree)&&void 0!==_storeState$nextTree4?_storeState$nextTree4:storeState.currentTree;return getRecoilValueAsLoadable$2(store,recoilValue,treeState)},[storeRef,recoilValue]),getState=useCallback$1(()=>({loadable:getLoadable(),key:recoilValue.key}),[getLoadable,recoilValue.key]),updateState=useCallback$1(prevState=>{const nextState=getState();return prevState.loadable.is(nextState.loadable)&&prevState.key===nextState.key?prevState:nextState},[getState]);useEffect$3(()=>{const subscription=subscribeToRecoilValue$1(storeRef.current,recoilValue,_state=>{setState(updateState)},componentName);return setState(updateState),subscription.release},[componentName,recoilValue,storeRef,updateState]);const[state,setState]=useState$1(getState);return state.key!==recoilValue.key?getState().loadable:state.loadable}function useRecoilValueLoadable_LEGACY(recoilValue){const storeRef=useStoreRef$2(),[,forceUpdate]=useState$1([]),componentName=Recoil_useComponentName(),getLoadable=useCallback$1(()=>{var _storeState$nextTree5;const store=storeRef.current,storeState=store.getState(),treeState=reactMode$3().early&&null!==(_storeState$nextTree5=storeState.nextTree)&&void 0!==_storeState$nextTree5?_storeState$nextTree5:storeState.currentTree;return getRecoilValueAsLoadable$2(store,recoilValue,treeState)},[storeRef,recoilValue]),loadable=getLoadable(),prevLoadableRef=useRef$4(loadable);return useEffect$3(()=>{prevLoadableRef.current=loadable}),useEffect$3(()=>{const store=storeRef.current,storeState=store.getState(),subscription=subscribeToRecoilValue$1(store,recoilValue,_state=>{var _prevLoadableRef$curr;if(!Recoil_gkx("recoil_suppress_rerender_in_callback"))return forceUpdate([]);const newLoadable=getLoadable();null!==(_prevLoadableRef$curr=prevLoadableRef.current)&&void 0!==_prevLoadableRef$curr&&_prevLoadableRef$curr.is(newLoadable)||forceUpdate(newLoadable),prevLoadableRef.current=newLoadable},componentName);if(storeState.nextTree)store.getState().queuedComponentCallbacks_DEPRECATED.push(()=>{prevLoadableRef.current=null,forceUpdate([])});else{var _prevLoadableRef$curr2;if(!Recoil_gkx("recoil_suppress_rerender_in_callback"))return forceUpdate([]);const newLoadable=getLoadable();null!==(_prevLoadableRef$curr2=prevLoadableRef.current)&&void 0!==_prevLoadableRef$curr2&&_prevLoadableRef$curr2.is(newLoadable)||forceUpdate(newLoadable),prevLoadableRef.current=newLoadable}return subscription.release},[componentName,getLoadable,recoilValue,storeRef]),loadable}function useRecoilValueLoadable(recoilValue){return Recoil_gkx("recoil_memory_managament_2020")&&Recoil_useRetain(recoilValue),{TRANSITION_SUPPORT:useRecoilValueLoadable_TRANSITION_SUPPORT,SYNC_EXTERNAL_STORE:currentRendererSupportsUseSyncExternalStore$1()?useRecoilValueLoadable_SYNC_EXTERNAL_STORE:useRecoilValueLoadable_TRANSITION_SUPPORT,MUTABLE_SOURCE:useRecoilValueLoadable_MUTABLE_SOURCE,LEGACY:useRecoilValueLoadable_LEGACY}[reactMode$3().mode](recoilValue)}function useRecoilValue(recoilValue){const storeRef=useStoreRef$2();return handleLoadable(useRecoilValueLoadable(recoilValue),recoilValue,storeRef)}function useSetRecoilState(recoilState){const storeRef=useStoreRef$2();return useCallback$1(newValueOrUpdater=>{setRecoilValue$2(storeRef.current,recoilState,newValueOrUpdater)},[storeRef,recoilState])}function useRecoilValueLoadable_TRANSITION_SUPPORT_UNSTABLE(recoilValue){return Recoil_gkx("recoil_memory_managament_2020")&&Recoil_useRetain(recoilValue),useRecoilValueLoadable_TRANSITION_SUPPORT(recoilValue)}function useRecoilValue_TRANSITION_SUPPORT_UNSTABLE(recoilValue){const storeRef=useStoreRef$2();return handleLoadable(useRecoilValueLoadable_TRANSITION_SUPPORT_UNSTABLE(recoilValue),recoilValue,storeRef)}var Recoil_Hooks={recoilComponentGetRecoilValueCount_FOR_TESTING:{current:0},useRecoilInterface:function(){const componentName=Recoil_useComponentName(),storeRef=useStoreRef$2(),[,forceUpdate]=useState$1([]),recoilValuesUsed=useRef$4(new Set);recoilValuesUsed.current=new Set;const previousSubscriptions=useRef$4(new Set),subscriptions=useRef$4(new Map),unsubscribeFrom=useCallback$1(key=>{const sub=subscriptions.current.get(key);sub&&(sub.release(),subscriptions.current.delete(key))},[subscriptions]),updateState=useCallback$1((_state,key)=>{subscriptions.current.has(key)&&forceUpdate([])},[]);return useEffect$3(()=>{const store=storeRef.current;Recoil_differenceSets(recoilValuesUsed.current,previousSubscriptions.current).forEach(key=>{if(subscriptions.current.has(key))return;const sub=subscribeToRecoilValue$1(store,new AbstractRecoilValue$3(key),state=>updateState(state,key),componentName);subscriptions.current.set(key,sub);store.getState().nextTree?store.getState().queuedComponentCallbacks_DEPRECATED.push(()=>{updateState(store.getState(),key)}):updateState(store.getState(),key)}),Recoil_differenceSets(previousSubscriptions.current,recoilValuesUsed.current).forEach(key=>{unsubscribeFrom(key)}),previousSubscriptions.current=recoilValuesUsed.current}),useEffect$3(()=>{const currentSubscriptions=subscriptions.current;return Recoil_differenceSets(recoilValuesUsed.current,new Set(currentSubscriptions.keys())).forEach(key=>{const sub=subscribeToRecoilValue$1(storeRef.current,new AbstractRecoilValue$3(key),state=>updateState(state,key),componentName);currentSubscriptions.set(key,sub)}),()=>currentSubscriptions.forEach((_,key)=>unsubscribeFrom(key))},[componentName,storeRef,unsubscribeFrom,updateState]),useMemo$1(()=>{function useSetRecoilState(recoilState){return newValueOrUpdater=>{setRecoilValue$2(storeRef.current,recoilState,newValueOrUpdater)}}function useRecoilValueLoadable(recoilValue){var _storeState$nextTree;recoilValuesUsed.current.has(recoilValue.key)||(recoilValuesUsed.current=setByAddingToSet$2(recoilValuesUsed.current,recoilValue.key));const storeState=storeRef.current.getState();return getRecoilValueAsLoadable$2(storeRef.current,recoilValue,reactMode$3().early&&null!==(_storeState$nextTree=storeState.nextTree)&&void 0!==_storeState$nextTree?_storeState$nextTree:storeState.currentTree)}function useRecoilValue(recoilValue){return handleLoadable(useRecoilValueLoadable(recoilValue),recoilValue,storeRef)}return{getRecoilValue:useRecoilValue,getRecoilValueLoadable:useRecoilValueLoadable,getRecoilState:function(recoilState){return[useRecoilValue(recoilState),useSetRecoilState(recoilState)]},getRecoilStateLoadable:function(recoilState){return[useRecoilValueLoadable(recoilState),useSetRecoilState(recoilState)]},getSetRecoilState:useSetRecoilState,getResetRecoilState:function(recoilState){return()=>setRecoilValue$2(storeRef.current,recoilState,DEFAULT_VALUE$2)}}},[recoilValuesUsed,storeRef])},useRecoilState:function(recoilState){return[useRecoilValue(recoilState),useSetRecoilState(recoilState)]},useRecoilStateLoadable:function(recoilState){return[useRecoilValueLoadable(recoilState),useSetRecoilState(recoilState)]},useRecoilValue:useRecoilValue,useRecoilValueLoadable:useRecoilValueLoadable,useResetRecoilState:function(recoilState){const storeRef=useStoreRef$2();return useCallback$1(()=>{setRecoilValue$2(storeRef.current,recoilState,DEFAULT_VALUE$2)},[storeRef,recoilState])},useSetRecoilState:useSetRecoilState,useSetUnvalidatedAtomValues:function(){const storeRef=useStoreRef$2();return(values,transactionMetadata={})=>{batchUpdates$2(()=>{storeRef.current.addTransactionMetadata(transactionMetadata),values.forEach((value,key)=>setUnvalidatedRecoilValue$2(storeRef.current,new AbstractRecoilValue$3(key),value))})}},useRecoilValueLoadable_TRANSITION_SUPPORT_UNSTABLE:useRecoilValueLoadable_TRANSITION_SUPPORT_UNSTABLE,useRecoilValue_TRANSITION_SUPPORT_UNSTABLE:useRecoilValue_TRANSITION_SUPPORT_UNSTABLE,useRecoilState_TRANSITION_SUPPORT_UNSTABLE:function(recoilState){return[useRecoilValue_TRANSITION_SUPPORT_UNSTABLE(recoilState),useSetRecoilState(recoilState)]}};var Recoil_filterMap=function(map,callback){const result=new Map;for(const[key,value]of map)callback(value,key)&&result.set(key,value);return result};var Recoil_filterSet=function(set,callback){const result=new Set;for(const value of set)callback(value)&&result.add(value);return result};var Recoil_mergeMaps=function(...maps){const result=new Map;for(let i=0;i<maps.length;i++){const iterator=maps[i].keys();let nextKey;for(;!(nextKey=iterator.next()).done;)result.set(nextKey.value,maps[i].get(nextKey.value))}return result};const{batchUpdates:batchUpdates$3}=Recoil_Batching,{DEFAULT_VALUE:DEFAULT_VALUE$3,getNode:getNode$4,nodes:nodes$1}=Recoil_Node,{useStoreRef:useStoreRef$3}=Recoil_RecoilRoot,{AbstractRecoilValue:AbstractRecoilValue$4,setRecoilValueLoadable:setRecoilValueLoadable$1}=Recoil_RecoilValueInterface,{SUSPENSE_TIMEOUT_MS:SUSPENSE_TIMEOUT_MS$2}=Recoil_Retention,{cloneSnapshot:cloneSnapshot$1}=Recoil_Snapshot$1,{useCallback:useCallback$2,useEffect:useEffect$4,useRef:useRef$5,useState:useState$2}=react,{isSSR:isSSR$4}=Recoil_Environment;function useTransactionSubscription(callback){const storeRef=useStoreRef$3();useEffect$4(()=>storeRef.current.subscribeToTransactions(callback).release,[callback,storeRef])}function externallyVisibleAtomValuesInState(state){const atomValues=state.atomValues.toMap(),persistedAtomContentsValues=Recoil_mapMap(Recoil_filterMap(atomValues,(v,k)=>{const persistence=getNode$4(k).persistence_UNSTABLE;return null!=persistence&&"none"!==persistence.type&&"hasValue"===v.state}),v=>v.contents);return Recoil_mergeMaps(state.nonvalidatedAtoms.toMap(),persistedAtomContentsValues)}function gotoSnapshot(store,snapshot){var _storeState$nextTree;const storeState=store.getState(),prev=null!==(_storeState$nextTree=storeState.nextTree)&&void 0!==_storeState$nextTree?_storeState$nextTree:storeState.currentTree,next=snapshot.getStore_INTERNAL().getState().currentTree;batchUpdates$3(()=>{const keysToUpdate=new Set;for(const keys of[prev.atomValues.keys(),next.atomValues.keys()])for(const key of keys){var _prev$atomValues$get,_next$atomValues$get;(null===(_prev$atomValues$get=prev.atomValues.get(key))||void 0===_prev$atomValues$get?void 0:_prev$atomValues$get.contents)!==(null===(_next$atomValues$get=next.atomValues.get(key))||void 0===_next$atomValues$get?void 0:_next$atomValues$get.contents)&&getNode$4(key).shouldRestoreFromSnapshots&&keysToUpdate.add(key)}keysToUpdate.forEach(key=>{setRecoilValueLoadable$1(store,new AbstractRecoilValue$4(key),next.atomValues.has(key)?Recoil_nullthrows(next.atomValues.get(key)):DEFAULT_VALUE$3)}),store.replaceState(state=>({...state,stateID:snapshot.getID()}))})}var Recoil_SnapshotHooks={useRecoilSnapshot:function(){const storeRef=useStoreRef$3(),[snapshot,setSnapshot]=useState$2(()=>cloneSnapshot$1(storeRef.current)),previousSnapshot=Recoil_usePrevious(snapshot),timeoutID=useRef$5(),releaseRef=useRef$5();if(useTransactionSubscription(useCallback$2(store=>setSnapshot(cloneSnapshot$1(store)),[])),useEffect$4(()=>{const release=snapshot.retain();var _releaseRef$current;timeoutID.current&&!isSSR$4&&(window.clearTimeout(timeoutID.current),timeoutID.current=null,null===(_releaseRef$current=releaseRef.current)||void 0===_releaseRef$current||_releaseRef$current.call(releaseRef),releaseRef.current=null);return()=>{window.setTimeout(release,10)}},[snapshot]),previousSnapshot!==snapshot&&!isSSR$4){var _releaseRef$current2;if(timeoutID.current)window.clearTimeout(timeoutID.current),timeoutID.current=null,null===(_releaseRef$current2=releaseRef.current)||void 0===_releaseRef$current2||_releaseRef$current2.call(releaseRef),releaseRef.current=null;releaseRef.current=snapshot.retain(),timeoutID.current=window.setTimeout(()=>{var _releaseRef$current3;timeoutID.current=null,null===(_releaseRef$current3=releaseRef.current)||void 0===_releaseRef$current3||_releaseRef$current3.call(releaseRef),releaseRef.current=null},SUSPENSE_TIMEOUT_MS$2)}return snapshot},gotoSnapshot:gotoSnapshot,useGotoRecoilSnapshot:function(){const storeRef=useStoreRef$3();return useCallback$2(snapshot=>gotoSnapshot(storeRef.current,snapshot),[storeRef])},useRecoilTransactionObserver:function(callback){useTransactionSubscription(useCallback$2(store=>{const snapshot=cloneSnapshot$1(store,"latest"),previousSnapshot=cloneSnapshot$1(store,"previous");callback({snapshot:snapshot,previousSnapshot:previousSnapshot})},[callback]))},useTransactionObservation_DEPRECATED:function(callback){useTransactionSubscription(useCallback$2(store=>{let previousTree=store.getState().previousTree;const currentTree=store.getState().currentTree;previousTree||(previousTree=store.getState().currentTree);const atomValues=externallyVisibleAtomValuesInState(currentTree),previousAtomValues=externallyVisibleAtomValuesInState(previousTree),atomInfo=Recoil_mapMap(nodes$1,node=>{var _node$persistence_UNS,_node$persistence_UNS2,_node$persistence_UNS3,_node$persistence_UNS4;return{persistence_UNSTABLE:{type:null!==(_node$persistence_UNS=null===(_node$persistence_UNS2=node.persistence_UNSTABLE)||void 0===_node$persistence_UNS2?void 0:_node$persistence_UNS2.type)&&void 0!==_node$persistence_UNS?_node$persistence_UNS:"none",backButton:null!==(_node$persistence_UNS3=null===(_node$persistence_UNS4=node.persistence_UNSTABLE)||void 0===_node$persistence_UNS4?void 0:_node$persistence_UNS4.backButton)&&void 0!==_node$persistence_UNS3&&_node$persistence_UNS3}}}),modifiedAtoms=Recoil_filterSet(currentTree.dirtyAtoms,k=>atomValues.has(k)||previousAtomValues.has(k));callback({atomValues:atomValues,previousAtomValues:previousAtomValues,atomInfo:atomInfo,modifiedAtoms:modifiedAtoms,transactionMetadata:{...currentTree.transactionMetadata}})},[callback]))},useTransactionSubscription_DEPRECATED:useTransactionSubscription};const{peekNodeInfo:peekNodeInfo$2}=Recoil_FunctionalCore,{useStoreRef:useStoreRef$4}=Recoil_RecoilRoot;var Recoil_useGetRecoilValueInfo=function(){const storeRef=useStoreRef$4();return({key:key})=>peekNodeInfo$2(storeRef.current,storeRef.current.getState().currentTree,key)};const{reactMode:reactMode$4}=Recoil_ReactMode,{RecoilRoot:RecoilRoot$1,useStoreRef:useStoreRef$5}=Recoil_RecoilRoot,{useMemo:useMemo$2}=react;var Recoil_useRecoilBridgeAcrossReactRoots=function(){"MUTABLE_SOURCE"===reactMode$4().mode&&console.warn("Warning: There are known issues using useRecoilBridgeAcrossReactRoots() in recoil_mutable_source rendering mode. Please consider upgrading to recoil_sync_external_store mode.");const store=useStoreRef$5().current;return useMemo$2(()=>function({children:children}){return react.createElement(RecoilRoot$1,{store_INTERNAL:store},children)},[store])};const{loadableWithValue:loadableWithValue$1}=Recoil_Loadable$1,{initializeNode:initializeNode$3}=Recoil_FunctionalCore,{DEFAULT_VALUE:DEFAULT_VALUE$4,getNode:getNode$5}=Recoil_Node,{copyTreeState:copyTreeState$1,getRecoilValueAsLoadable:getRecoilValueAsLoadable$3,invalidateDownstreams:invalidateDownstreams$1,writeLoadableToTreeState:writeLoadableToTreeState$1}=Recoil_RecoilValueInterface;function isAtom(recoilValue){return"atom"===getNode$5(recoilValue.key).nodeType}class TransactionInterfaceImpl{constructor(store,treeState){_defineProperty(this,"_store",void 0),_defineProperty(this,"_treeState",void 0),_defineProperty(this,"_changes",void 0),_defineProperty(this,"get",recoilValue=>{if(this._changes.has(recoilValue.key))return this._changes.get(recoilValue.key);if(!isAtom(recoilValue))throw Recoil_err("Reading selectors within atomicUpdate is not supported");const loadable=getRecoilValueAsLoadable$3(this._store,recoilValue,this._treeState);if("hasValue"===loadable.state)return loadable.contents;throw"hasError"===loadable.state?loadable.contents:Recoil_err(`Expected Recoil atom ${recoilValue.key} to have a value, but it is in a loading state.`)}),_defineProperty(this,"set",(recoilState,valueOrUpdater)=>{if(!isAtom(recoilState))throw Recoil_err("Setting selectors within atomicUpdate is not supported");if("function"==typeof valueOrUpdater){const current=this.get(recoilState);this._changes.set(recoilState.key,valueOrUpdater(current))}else initializeNode$3(this._store,recoilState.key,"set"),this._changes.set(recoilState.key,valueOrUpdater)}),_defineProperty(this,"reset",recoilState=>{this.set(recoilState,DEFAULT_VALUE$4)}),this._store=store,this._treeState=treeState,this._changes=new Map}newTreeState_INTERNAL(){if(0===this._changes.size)return this._treeState;const newState=copyTreeState$1(this._treeState);for(const[k,v]of this._changes)writeLoadableToTreeState$1(newState,k,loadableWithValue$1(v));return invalidateDownstreams$1(this._store,newState),newState}}var Recoil_AtomicUpdates_1=function(store){return fn=>{store.replaceState(treeState=>{const changeset=new TransactionInterfaceImpl(store,treeState);return fn(changeset),changeset.newTreeState_INTERNAL()})}},Recoil_AtomicUpdates$1=Object.freeze({__proto__:null,atomicUpdater:Recoil_AtomicUpdates_1});var Recoil_invariant=function(condition,message){if(!condition)throw new Error(message)};const{atomicUpdater:atomicUpdater$1}=Recoil_AtomicUpdates$1,{batchUpdates:batchUpdates$4}=Recoil_Batching,{DEFAULT_VALUE:DEFAULT_VALUE$5}=Recoil_Node,{useStoreRef:useStoreRef$6}=Recoil_RecoilRoot,{refreshRecoilValue:refreshRecoilValue$1,setRecoilValue:setRecoilValue$3}=Recoil_RecoilValueInterface,{cloneSnapshot:cloneSnapshot$2}=Recoil_Snapshot$1,{gotoSnapshot:gotoSnapshot$1}=Recoil_SnapshotHooks,{useCallback:useCallback$3}=react;class Sentinel{}const SENTINEL=new Sentinel;function recoilCallback(store,fn,args,extraInterface){let releaseSnapshot,ret=SENTINEL;var _releaseSnapshot2;(batchUpdates$4(()=>{const errMsg="useRecoilCallback() expects a function that returns a function: it accepts a function of the type (RecoilInterface) => (Args) => ReturnType and returns a callback function (Args) => ReturnType, where RecoilInterface is an object {snapshot, set, ...} and Args and ReturnType are the argument and return types of the callback you want to create. Please see the docs at recoiljs.org for details.";if("function"!=typeof fn)throw Recoil_err(errMsg);const callbackInterface=Recoil_lazyProxy({...null!=extraInterface?extraInterface:{},set:(node,newValue)=>setRecoilValue$3(store,node,newValue),reset:node=>setRecoilValue$3(store,node,DEFAULT_VALUE$5),refresh:node=>refreshRecoilValue$1(store,node),gotoSnapshot:snapshot=>gotoSnapshot$1(store,snapshot),transact_UNSTABLE:transaction=>atomicUpdater$1(store)(transaction)},{snapshot:()=>{const snapshot=cloneSnapshot$2(store);return releaseSnapshot=snapshot.retain(),snapshot}}),callback=fn(callbackInterface);if("function"!=typeof callback)throw Recoil_err(errMsg);ret=callback(...args)}),ret instanceof Sentinel&&Recoil_invariant(!1),Recoil_isPromise(ret))?ret=ret.finally(()=>{var _releaseSnapshot;null===(_releaseSnapshot=releaseSnapshot)||void 0===_releaseSnapshot||_releaseSnapshot()}):null===(_releaseSnapshot2=releaseSnapshot)||void 0===_releaseSnapshot2||_releaseSnapshot2();return ret}var Recoil_useRecoilCallback={recoilCallback:recoilCallback,useRecoilCallback:function(fn,deps){const storeRef=useStoreRef$6();return useCallback$3((...args)=>recoilCallback(storeRef.current,fn,args),null!=deps?[...deps,storeRef]:void 0)}};const{useStoreRef:useStoreRef$7}=Recoil_RecoilRoot,{refreshRecoilValue:refreshRecoilValue$2}=Recoil_RecoilValueInterface,{useCallback:useCallback$4}=react;var Recoil_useRecoilRefresher=function(recoilValue){const storeRef=useStoreRef$7();return useCallback$4(()=>{const store=storeRef.current;refreshRecoilValue$2(store,recoilValue)},[recoilValue,storeRef])};const{atomicUpdater:atomicUpdater$2}=Recoil_AtomicUpdates$1,{useStoreRef:useStoreRef$8}=Recoil_RecoilRoot,{useMemo:useMemo$3}=react;var Recoil_useRecoilTransaction=function(fn,deps){const storeRef=useStoreRef$8();return useMemo$3(()=>(...args)=>{atomicUpdater$2(storeRef.current)(transactionInterface=>{fn(transactionInterface)(...args)})},null!=deps?[...deps,storeRef]:void 0)};var Recoil_Wrapper_1=class{constructor(value){_defineProperty(this,"value",void 0),this.value=value}},Recoil_Wrapper$1=Object.freeze({__proto__:null,WrappedValue:Recoil_Wrapper_1});const{isFastRefreshEnabled:isFastRefreshEnabled$1}=Recoil_ReactMode;class ChangedPathError extends Error{}var Recoil_TreeCache_1=class{constructor(options){var _options$onHit,_options$onSet,_options$mapNodeValue;_defineProperty(this,"_name",void 0),_defineProperty(this,"_numLeafs",void 0),_defineProperty(this,"_root",void 0),_defineProperty(this,"_onHit",void 0),_defineProperty(this,"_onSet",void 0),_defineProperty(this,"_mapNodeValue",void 0),this._name=null==options?void 0:options.name,this._numLeafs=0,this._root=null,this._onHit=null!==(_options$onHit=null==options?void 0:options.onHit)&&void 0!==_options$onHit?_options$onHit:()=>{},this._onSet=null!==(_options$onSet=null==options?void 0:options.onSet)&&void 0!==_options$onSet?_options$onSet:()=>{},this._mapNodeValue=null!==(_options$mapNodeValue=null==options?void 0:options.mapNodeValue)&&void 0!==_options$mapNodeValue?_options$mapNodeValue:val=>val}size(){return this._numLeafs}root(){return this._root}get(getNodeValue,handlers){var _this$getLeafNode;return null===(_this$getLeafNode=this.getLeafNode(getNodeValue,handlers))||void 0===_this$getLeafNode?void 0:_this$getLeafNode.value}getLeafNode(getNodeValue,handlers){if(null==this._root)return;let node=this._root;for(;node;){if(null==handlers||handlers.onNodeVisit(node),"leaf"===node.type)return this._onHit(node),node;const nodeValue=this._mapNodeValue(getNodeValue(node.nodeKey));node=node.branches.get(nodeValue)}}set(route,value,handlers){const addLeaf=()=>{var _node2,_node3,_this$_root2,_handlers$onNodeVisit2;let node,branchKey;for(const[nodeKey,nodeValue]of route){var _node,_handlers$onNodeVisit,_this$_root;const root=this._root;if("leaf"===(null==root?void 0:root.type))throw this.invalidCacheError();const parent=node;if(node=parent?parent.branches.get(branchKey):root,node=null!==(_node=node)&&void 0!==_node?_node:{type:"branch",nodeKey:nodeKey,parent:parent,branches:new Map,branchKey:branchKey},"branch"!==node.type||node.nodeKey!==nodeKey)throw this.invalidCacheError();null==parent||parent.branches.set(branchKey,node),null==handlers||null===(_handlers$onNodeVisit=handlers.onNodeVisit)||void 0===_handlers$onNodeVisit||_handlers$onNodeVisit.call(handlers,node),branchKey=this._mapNodeValue(nodeValue),this._root=null!==(_this$_root=this._root)&&void 0!==_this$_root?_this$_root:node}const oldLeaf=node?null===(_node2=node)||void 0===_node2?void 0:_node2.branches.get(branchKey):this._root;if(null!=oldLeaf&&("leaf"!==oldLeaf.type||oldLeaf.branchKey!==branchKey))throw this.invalidCacheError();const leafNode={type:"leaf",value:value,parent:node,branchKey:branchKey};null===(_node3=node)||void 0===_node3||_node3.branches.set(branchKey,leafNode),this._root=null!==(_this$_root2=this._root)&&void 0!==_this$_root2?_this$_root2:leafNode,this._numLeafs++,this._onSet(leafNode),null==handlers||null===(_handlers$onNodeVisit2=handlers.onNodeVisit)||void 0===_handlers$onNodeVisit2||_handlers$onNodeVisit2.call(handlers,leafNode)};try{addLeaf()}catch(error){if(!(error instanceof ChangedPathError))throw error;this.clear(),addLeaf()}}delete(leaf){const root=this.root();if(!root)return!1;if(leaf===root)return this._root=null,this._numLeafs=0,!0;let node=leaf.parent,branchKey=leaf.branchKey;for(;node;){var _node4;if(node.branches.delete(branchKey),node===root)return 0===node.branches.size?(this._root=null,this._numLeafs=0):this._numLeafs--,!0;if(node.branches.size>0)break;branchKey=null===(_node4=node)||void 0===_node4?void 0:_node4.branchKey,node=node.parent}for(;node!==root;node=node.parent)if(null==node)return!1;return this._numLeafs--,!0}clear(){this._numLeafs=0,this._root=null}invalidCacheError(){const CHANGED_PATH_ERROR_MESSAGE=isFastRefreshEnabled$1()?"Possible Fast Refresh module reload detected. This may also be caused by an selector returning inconsistent values. Resetting cache.":"Invalid cache values. This happens when selectors do not return consistent values for the same input dependency values. That may also be caused when using Fast Refresh to change a selector implementation. Resetting cache.";throw Recoil_recoverableViolation(CHANGED_PATH_ERROR_MESSAGE+(null!=this._name?" - "+this._name:"")),new ChangedPathError}},Recoil_TreeCache$1=Object.freeze({__proto__:null,TreeCache:Recoil_TreeCache_1});var Recoil_LRUCache_1=class{constructor(options){var _options$mapKey;_defineProperty(this,"_maxSize",void 0),_defineProperty(this,"_size",void 0),_defineProperty(this,"_head",void 0),_defineProperty(this,"_tail",void 0),_defineProperty(this,"_map",void 0),_defineProperty(this,"_keyMapper",void 0),this._maxSize=options.maxSize,this._size=0,this._head=null,this._tail=null,this._map=new Map,this._keyMapper=null!==(_options$mapKey=options.mapKey)&&void 0!==_options$mapKey?_options$mapKey:v=>v}head(){return this._head}tail(){return this._tail}size(){return this._size}maxSize(){return this._maxSize}has(key){return this._map.has(this._keyMapper(key))}get(key){const mappedKey=this._keyMapper(key),node=this._map.get(mappedKey);if(node)return this.set(key,node.value),node.value}set(key,val){const mappedKey=this._keyMapper(key);this._map.get(mappedKey)&&this.delete(key);const head=this.head(),node={key:key,right:head,left:null,value:val};head?head.left=node:this._tail=node,this._map.set(mappedKey,node),this._head=node,this._size++,this._maybeDeleteLRU()}_maybeDeleteLRU(){this.size()>this.maxSize()&&this.deleteLru()}deleteLru(){const tail=this.tail();tail&&this.delete(tail.key)}delete(key){const mappedKey=this._keyMapper(key);if(!this._size||!this._map.has(mappedKey))return;const node=Recoil_nullthrows(this._map.get(mappedKey)),right=node.right,left=node.left;right&&(right.left=node.left),left&&(left.right=node.right),node===this.head()&&(this._head=right),node===this.tail()&&(this._tail=left),this._map.delete(mappedKey),this._size--}clear(){this._size=0,this._head=null,this._tail=null,this._map=new Map}},Recoil_LRUCache$1=Object.freeze({__proto__:null,LRUCache:Recoil_LRUCache_1});const{LRUCache:LRUCache$1}=Recoil_LRUCache$1,{TreeCache:TreeCache$1}=Recoil_TreeCache$1;var Recoil_treeCacheLRU=function({name:name,maxSize:maxSize,mapNodeValue:mapNodeValue=(v=>v)}){const lruCache=new LRUCache$1({maxSize:maxSize}),cache=new TreeCache$1({name:name,mapNodeValue:mapNodeValue,onHit:node=>{lruCache.set(node,!0)},onSet:node=>{const lruNode=lruCache.tail();lruCache.set(node,!0),lruNode&&cache.size()>maxSize&&cache.delete(lruNode.key)}});return cache};var Recoil_stableStringify=function(x,opt={allowFunctions:!1}){return function stringify(x,opt,key){if("string"==typeof x&&!x.includes('"')&&!x.includes("\\"))return`"${x}"`;switch(typeof x){case"undefined":return"";case"boolean":return x?"true":"false";case"number":case"symbol":return String(x);case"string":return JSON.stringify(x);case"function":if(!0!==(null==opt?void 0:opt.allowFunctions))throw Recoil_err("Attempt to serialize function in a Recoil cache key");return`__FUNCTION(${x.name})__`}if(null===x)return"null";var _JSON$stringify;if("object"!=typeof x)return null!==(_JSON$stringify=JSON.stringify(x))&&void 0!==_JSON$stringify?_JSON$stringify:"";if(Recoil_isPromise(x))return"__PROMISE__";if(Array.isArray(x))return`[${x.map((v,i)=>stringify(v,opt,i.toString()))}]`;if("function"==typeof x.toJSON)return stringify(x.toJSON(key),opt,key);if(x instanceof Map){const obj={};for(const[k,v]of x)obj["string"==typeof k?k:stringify(k,opt)]=v;return stringify(obj,opt,key)}return x instanceof Set?stringify(Array.from(x).sort((a,b)=>stringify(a,opt).localeCompare(stringify(b,opt))),opt,key):void 0!==Symbol&&null!=x[Symbol.iterator]&&"function"==typeof x[Symbol.iterator]?stringify(Array.from(x),opt,key):`{${Object.keys(x).filter(k=>void 0!==x[k]).sort().map(k=>`${stringify(k,opt)}:${stringify(x[k],opt,k)}`).join(",")}}`}(x,opt)};const{TreeCache:TreeCache$2}=Recoil_TreeCache$1,defaultPolicy={equality:"reference",eviction:"keep-all",maxSize:1/0};var Recoil_treeCacheFromPolicy=function({equality:equality=defaultPolicy.equality,eviction:eviction=defaultPolicy.eviction,maxSize:maxSize=defaultPolicy.maxSize}=defaultPolicy,name){return function(eviction,maxSize,mapNodeValue,name){switch(eviction){case"keep-all":return new TreeCache$2({name:name,mapNodeValue:mapNodeValue});case"lru":return Recoil_treeCacheLRU({name:name,maxSize:Recoil_nullthrows(maxSize),mapNodeValue:mapNodeValue});case"most-recent":return Recoil_treeCacheLRU({name:name,maxSize:1,mapNodeValue:mapNodeValue})}throw Recoil_err("Unrecognized eviction policy "+eviction)}(eviction,maxSize,function(equality){switch(equality){case"reference":return val=>val;case"value":return val=>Recoil_stableStringify(val)}throw Recoil_err("Unrecognized equality policy "+equality)}(equality),name)};var Recoil_PerformanceTimings={startPerfBlock:function(_id){return()=>null}};const{isLoadable:isLoadable$1,loadableWithError:loadableWithError$1,loadableWithPromise:loadableWithPromise$1,loadableWithValue:loadableWithValue$2}=Recoil_Loadable$1,{WrappedValue:WrappedValue$1}=Recoil_Wrapper$1,{getNodeLoadable:getNodeLoadable$2,peekNodeLoadable:peekNodeLoadable$1,setNodeValue:setNodeValue$3}=Recoil_FunctionalCore,{saveDepsToStore:saveDepsToStore$1}=Recoil_Graph,{DEFAULT_VALUE:DEFAULT_VALUE$6,getConfigDeletionHandler:getConfigDeletionHandler$1,getNode:getNode$6,registerNode:registerNode$1}=Recoil_Node,{isRecoilValue:isRecoilValue$2}=Recoil_RecoilValue$1,{markRecoilValueModified:markRecoilValueModified$1}=Recoil_RecoilValueInterface,{retainedByOptionWithDefault:retainedByOptionWithDefault$1}=Recoil_Retention,{recoilCallback:recoilCallback$1}=Recoil_useRecoilCallback,{startPerfBlock:startPerfBlock$1}=Recoil_PerformanceTimings;class Canceled{}const CANCELED=new Canceled,dependencyStack=[],waitingStores=new Map,getNewExecutionID=(()=>{let executionID=0;return()=>executionID++})();function selector(options){let recoilValue=null;const{key:key,get:get,cachePolicy_UNSTABLE:cachePolicy}=options,set=null!=options.set?options.set:void 0,discoveredDependencyNodeKeys=new Set,cache=Recoil_treeCacheFromPolicy(null!=cachePolicy?cachePolicy:{equality:"reference",eviction:"keep-all"},key),retainedBy=retainedByOptionWithDefault$1(options.retainedBy_UNSTABLE),executionInfoMap=new Map;let liveStoresCount=0;function selectorIsLive(){return!Recoil_gkx("recoil_memory_managament_2020")||liveStoresCount>0}function selectorInit(store){return store.getState().knownSelectors.add(key),liveStoresCount++,()=>{liveStoresCount--}}function selectorShouldDeleteConfigOnRelease(){return void 0!==getConfigDeletionHandler$1(key)&&!selectorIsLive()}function resolveAsync(store,state,executionID,loadable,depValues){setCache(state,loadable,depValues),notifyStoresOfResolvedAsync(store,executionID)}function notifyStoresOfResolvedAsync(store,executionID){isLatestExecution(store,executionID)&&clearExecutionInfo(store),notifyWaitingStores(executionID,!0)}function notifyWaitingStores(executionID,clearWaitlist){const stores=waitingStores.get(executionID);if(null!=stores){for(const waitingStore of stores)markRecoilValueModified$1(waitingStore,Recoil_nullthrows(recoilValue));clearWaitlist&&waitingStores.delete(executionID)}}function markStoreWaitingForResolvedAsync(store,executionID){let stores=waitingStores.get(executionID);null==stores&&waitingStores.set(executionID,stores=new Set),stores.add(store)}function wrapPendingDependencyPromise(store,promise,state,existingDeps,executionID,loadingDepsState){return promise.then(resolvedDep=>{if(!selectorIsLive())throw clearExecutionInfo(store),CANCELED;null!=loadingDepsState.loadingDepKey&&loadingDepsState.loadingDepPromise===promise?state.atomValues.set(loadingDepsState.loadingDepKey,loadableWithValue$2(resolvedDep)):store.getState().knownSelectors.forEach(nodeKey=>{state.atomValues.delete(nodeKey)});const cachedLoadable=getLoadableFromCacheAndUpdateDeps(store,state);if(cachedLoadable&&"loading"!==cachedLoadable.state){if((isLatestExecution(store,executionID)||null==getExecutionInfo(store))&¬ifyStoresOfResolvedAsync(store,executionID),"hasValue"===cachedLoadable.state)return cachedLoadable.contents;throw cachedLoadable.contents}if(!isLatestExecution(store,executionID)){const executionInfo=getInProgressExecutionInfo(store,state);if(null!=executionInfo)return executionInfo.loadingLoadable.contents}const[loadable,depValues]=evaluateSelectorGetter(store,state,executionID);if("loading"!==loadable.state&&resolveAsync(store,state,executionID,loadable,depValues),"hasError"===loadable.state)throw loadable.contents;return loadable.contents}).catch(error=>{if(error instanceof Canceled)throw CANCELED;if(!selectorIsLive())throw clearExecutionInfo(store),CANCELED;const loadable=loadableWithError$1(error);throw resolveAsync(store,state,executionID,loadable,existingDeps),error})}function updateDeps(store,state,deps,executionID){var _store$getState,_store$getState$curre,_store$getState2,_store$getState2$next,_store$getState$nextT,_store$getState3,_store$getState3$next;(isLatestExecution(store,executionID)||state.version===(null===(_store$getState=store.getState())||void 0===_store$getState||null===(_store$getState$curre=_store$getState.currentTree)||void 0===_store$getState$curre?void 0:_store$getState$curre.version)||state.version===(null===(_store$getState2=store.getState())||void 0===_store$getState2||null===(_store$getState2$next=_store$getState2.nextTree)||void 0===_store$getState2$next?void 0:_store$getState2$next.version))&&saveDepsToStore$1(key,deps,store,null!==(_store$getState$nextT=null===(_store$getState3=store.getState())||void 0===_store$getState3||null===(_store$getState3$next=_store$getState3.nextTree)||void 0===_store$getState3$next?void 0:_store$getState3$next.version)&&void 0!==_store$getState$nextT?_store$getState$nextT:store.getState().currentTree.version);for(const nodeKey of deps)discoveredDependencyNodeKeys.add(nodeKey)}function evaluateSelectorGetter(store,state,executionID){const endPerfBlock=startPerfBlock$1(key);let duringSynchronousExecution=!0,duringAsynchronousExecution=!0;const finishEvaluation=()=>{endPerfBlock(),duringAsynchronousExecution=!1};let result,loadable,resultIsError=!1;const loadingDepsState={loadingDepKey:null,loadingDepPromise:null},depValues=new Map;function getRecoilValue({key:depKey}){const depLoadable=getNodeLoadable$2(store,state,depKey);switch(depValues.set(depKey,depLoadable),duringSynchronousExecution||(updateDeps(store,state,new Set(depValues.keys()),executionID),function(store,executionID){if(isLatestExecution(store,executionID)){Recoil_nullthrows(getExecutionInfo(store)).stateVersions.clear(),notifyWaitingStores(executionID,!1)}}(store,executionID)),depLoadable.state){case"hasValue":return depLoadable.contents;case"hasError":throw depLoadable.contents;case"loading":throw loadingDepsState.loadingDepKey=depKey,loadingDepsState.loadingDepPromise=depLoadable.contents,depLoadable.contents}throw Recoil_err("Invalid Loadable state")}const getCallback=fn=>(...args)=>{if(duringAsynchronousExecution)throw Recoil_err("Callbacks from getCallback() should only be called asynchronously after the selector is evalutated. It can be used for selectors to return objects with callbacks that can work with Recoil state without a subscription.");return null==recoilValue&&Recoil_invariant(!1),recoilCallback$1(store,fn,args,{node:recoilValue})};try{result=get({get:getRecoilValue,getCallback:getCallback}),result=isRecoilValue$2(result)?getRecoilValue(result):result,isLoadable$1(result)&&("hasError"===result.state&&(resultIsError=!0),result=result.contents),Recoil_isPromise(result)?result=function(store,promise,state,depValues,executionID,loadingDepsState){return promise.then(value=>{if(!selectorIsLive())throw clearExecutionInfo(store),CANCELED;const loadable=loadableWithValue$2(value);return resolveAsync(store,state,executionID,loadable,depValues),value}).catch(errorOrPromise=>{if(!selectorIsLive())throw clearExecutionInfo(store),CANCELED;if(Recoil_isPromise(errorOrPromise))return wrapPendingDependencyPromise(store,errorOrPromise,state,depValues,executionID,loadingDepsState);const loadable=loadableWithError$1(errorOrPromise);throw resolveAsync(store,state,executionID,loadable,depValues),errorOrPromise})}(store,result,state,depValues,executionID,loadingDepsState).finally(finishEvaluation):finishEvaluation(),result=result instanceof WrappedValue$1?result.value:result}catch(errorOrDepPromise){result=errorOrDepPromise,Recoil_isPromise(result)?result=wrapPendingDependencyPromise(store,result,state,depValues,executionID,loadingDepsState).finally(finishEvaluation):(resultIsError=!0,finishEvaluation())}return loadable=resultIsError?loadableWithError$1(result):Recoil_isPromise(result)?loadableWithPromise$1(result):loadableWithValue$2(result),duringSynchronousExecution=!1,function(store,executionID,depValues){if(isLatestExecution(store,executionID)){const executionInfo=getExecutionInfo(store);null!=executionInfo&&(executionInfo.depValuesDiscoveredSoFarDuringAsyncWork=depValues)}}(store,executionID,depValues),updateDeps(store,state,new Set(depValues.keys()),executionID),[loadable,depValues]}function getLoadableFromCacheAndUpdateDeps(store,state){let cachedLoadable=state.atomValues.get(key);if(null!=cachedLoadable)return cachedLoadable;const depsAfterCacheLookup=new Set;try{cachedLoadable=cache.get(nodeKey=>("string"!=typeof nodeKey&&Recoil_invariant(!1),getNodeLoadable$2(store,state,nodeKey).contents),{onNodeVisit:node=>{"branch"===node.type&&node.nodeKey!==key&&depsAfterCacheLookup.add(node.nodeKey)}})}catch(error){throw Recoil_err(`Problem with cache lookup for selector "${key}": ${error.message}`)}var _getExecutionInfo;cachedLoadable&&(state.atomValues.set(key,cachedLoadable),updateDeps(store,state,depsAfterCacheLookup,null===(_getExecutionInfo=getExecutionInfo(store))||void 0===_getExecutionInfo?void 0:_getExecutionInfo.executionID));return cachedLoadable}function getSelectorLoadableAndUpdateDeps(store,state){const cachedVal=getLoadableFromCacheAndUpdateDeps(store,state);if(null!=cachedVal)return clearExecutionInfo(store),cachedVal;const inProgressExecutionInfo=getInProgressExecutionInfo(store,state);var _inProgressExecutionI;if(null!=inProgressExecutionInfo)return"loading"===(null===(_inProgressExecutionI=inProgressExecutionInfo.loadingLoadable)||void 0===_inProgressExecutionI?void 0:_inProgressExecutionI.state)&&markStoreWaitingForResolvedAsync(store,inProgressExecutionInfo.executionID),inProgressExecutionInfo.loadingLoadable;const newExecutionID=getNewExecutionID(),[loadable,newDepValues]=evaluateSelectorGetter(store,state,newExecutionID);return"loading"===loadable.state?(!function(store,newExecutionID,loadable,depValues,state){executionInfoMap.set(store,{depValuesDiscoveredSoFarDuringAsyncWork:depValues,executionID:newExecutionID,loadingLoadable:loadable,stateVersions:new Map([[state.version,!0]])})}(store,newExecutionID,loadable,newDepValues,state),markStoreWaitingForResolvedAsync(store,newExecutionID)):(clearExecutionInfo(store),setCache(state,loadable,newDepValues)),loadable}function getInProgressExecutionInfo(store,state){const pendingExecutions=Recoil_concatIterables([executionInfoMap.has(store)?[Recoil_nullthrows(executionInfoMap.get(store))]:[],Recoil_mapIterable(Recoil_filterIterable(executionInfoMap,([s])=>s!==store),([,execInfo])=>execInfo)]);function anyDepChanged(execDepValues){for(const[depKey,execLoadable]of execDepValues)if(!getNodeLoadable$2(store,state,depKey).is(execLoadable))return!0;return!1}for(const execInfo of pendingExecutions){if(execInfo.stateVersions.get(state.version)||!anyDepChanged(execInfo.depValuesDiscoveredSoFarDuringAsyncWork))return execInfo.stateVersions.set(state.version,!0),execInfo;execInfo.stateVersions.set(state.version,!1)}}function getExecutionInfo(store){return executionInfoMap.get(store)}function clearExecutionInfo(store){executionInfoMap.delete(store)}function isLatestExecution(store,executionID){var _getExecutionInfo2;return executionID===(null===(_getExecutionInfo2=getExecutionInfo(store))||void 0===_getExecutionInfo2?void 0:_getExecutionInfo2.executionID)}function setCache(state,loadable,depValues){state.atomValues.set(key,loadable);try{cache.set(function(depValues){return Array.from(depValues.entries()).map(([depKey,valLoadable])=>[depKey,valLoadable.contents])}(depValues),loadable)}catch(error){throw Recoil_err(`Problem with setting cache for selector "${key}": ${error.message}`)}}function selectorPeek(store,state){const cachedLoadable=state.atomValues.get(key);return null!=cachedLoadable?cachedLoadable:cache.get(nodeKey=>{var _peekNodeLoadable;return"string"!=typeof nodeKey&&Recoil_invariant(!1),null===(_peekNodeLoadable=peekNodeLoadable$1(store,state,nodeKey))||void 0===_peekNodeLoadable?void 0:_peekNodeLoadable.contents})}function selectorGet(store,state){return function(fn){if(dependencyStack.includes(key)){const message="Recoil selector has circular dependencies: "+dependencyStack.slice(dependencyStack.indexOf(key)).join(" → ");return loadableWithError$1(Recoil_err(message))}dependencyStack.push(key);try{return fn()}finally{dependencyStack.pop()}}(()=>getSelectorLoadableAndUpdateDeps(store,state))}function invalidateSelector(state){state.atomValues.delete(key)}function clearSelectorCache(store,treeState){null==recoilValue&&Recoil_invariant(!1);for(const nodeKey of discoveredDependencyNodeKeys){var _node$clearCache;const node=getNode$6(nodeKey);null===(_node$clearCache=node.clearCache)||void 0===_node$clearCache||_node$clearCache.call(node,store,treeState)}discoveredDependencyNodeKeys.clear(),invalidateSelector(treeState),cache.clear(),markRecoilValueModified$1(store,recoilValue)}if(null!=set){return recoilValue=registerNode$1({key:key,nodeType:"selector",peek:selectorPeek,get:selectorGet,set:(store,state,newValue)=>{let syncSelectorSetFinished=!1;const writes=new Map;function getRecoilValue({key:depKey}){if(syncSelectorSetFinished)throw Recoil_err("Recoil: Async selector sets are not currently supported.");const loadable=getNodeLoadable$2(store,state,depKey);if("hasValue"===loadable.state)return loadable.contents;if("loading"===loadable.state){throw Recoil_err(`Getting value of asynchronous atom or selector "${depKey}" in a pending state while setting selector "${key}" is not yet supported.`)}throw loadable.contents}function setRecoilState(recoilState,valueOrUpdater){if(syncSelectorSetFinished){throw Recoil_err("Recoil: Async selector sets are not currently supported.")}const setValue="function"==typeof valueOrUpdater?valueOrUpdater(getRecoilValue(recoilState)):valueOrUpdater;setNodeValue$3(store,state,recoilState.key,setValue).forEach((v,k)=>writes.set(k,v))}const ret=set({set:setRecoilState,get:getRecoilValue,reset:function(recoilState){setRecoilState(recoilState,DEFAULT_VALUE$6)}},newValue);if(void 0!==ret)throw Recoil_isPromise(ret)?Recoil_err("Recoil: Async selector sets are not currently supported."):Recoil_err("Recoil: selector set should be a void function.");return syncSelectorSetFinished=!0,writes},init:selectorInit,invalidate:invalidateSelector,clearCache:clearSelectorCache,shouldDeleteConfigOnRelease:selectorShouldDeleteConfigOnRelease,dangerouslyAllowMutability:options.dangerouslyAllowMutability,shouldRestoreFromSnapshots:!1,retainedBy:retainedBy})}return recoilValue=registerNode$1({key:key,nodeType:"selector",peek:selectorPeek,get:selectorGet,init:selectorInit,invalidate:invalidateSelector,clearCache:clearSelectorCache,shouldDeleteConfigOnRelease:selectorShouldDeleteConfigOnRelease,dangerouslyAllowMutability:options.dangerouslyAllowMutability,shouldRestoreFromSnapshots:!1,retainedBy:retainedBy})}selector.value=value=>new WrappedValue$1(value);var Recoil_selector=selector;const{isLoadable:isLoadable$2,loadableWithError:loadableWithError$2,loadableWithPromise:loadableWithPromise$2,loadableWithValue:loadableWithValue$3}=Recoil_Loadable$1,{WrappedValue:WrappedValue$2}=Recoil_Wrapper$1,{peekNodeInfo:peekNodeInfo$3}=Recoil_FunctionalCore,{DEFAULT_VALUE:DEFAULT_VALUE$7,DefaultValue:DefaultValue$2,getConfigDeletionHandler:getConfigDeletionHandler$2,registerNode:registerNode$2,setConfigDeletionHandler:setConfigDeletionHandler$1}=Recoil_Node,{isRecoilValue:isRecoilValue$3}=Recoil_RecoilValue$1,{getRecoilValueAsLoadable:getRecoilValueAsLoadable$4,markRecoilValueModified:markRecoilValueModified$2,setRecoilValue:setRecoilValue$4,setRecoilValueLoadable:setRecoilValueLoadable$2}=Recoil_RecoilValueInterface,{retainedByOptionWithDefault:retainedByOptionWithDefault$2}=Recoil_Retention,unwrap=x=>x instanceof WrappedValue$2?x.value:x;function baseAtom(options){const{key:key,persistence_UNSTABLE:persistence}=options,retainedBy=retainedByOptionWithDefault$2(options.retainedBy_UNSTABLE);let liveStoresCount=0;function unwrapPromise(promise){return loadableWithPromise$2(promise.then(value=>(defaultLoadable=loadableWithValue$3(value),value)).catch(error=>{throw defaultLoadable=loadableWithError$2(error),error}))}let defaultLoadable=Recoil_isPromise(options.default)?unwrapPromise(options.default):isLoadable$2(options.default)?"loading"===options.default.state?unwrapPromise(options.default.contents):options.default:loadableWithValue$3(unwrap(options.default));defaultLoadable.contents;let cachedAnswerForUnvalidatedValue=void 0;const cleanupEffectsByStore=new Map;function peekAtom(_store,state){var _ref,_state$atomValues$get3;return null!==(_ref=null!==(_state$atomValues$get3=state.atomValues.get(key))&&void 0!==_state$atomValues$get3?_state$atomValues$get3:cachedAnswerForUnvalidatedValue)&&void 0!==_ref?_ref:defaultLoadable}const node=registerNode$2({key:key,nodeType:"atom",peek:peekAtom,get:function(_store,state){if(state.atomValues.has(key))return Recoil_nullthrows(state.atomValues.get(key));if(state.nonvalidatedAtoms.has(key)){if(null!=cachedAnswerForUnvalidatedValue)return cachedAnswerForUnvalidatedValue;if(null==persistence)return defaultLoadable;const nonvalidatedValue=state.nonvalidatedAtoms.get(key),validatorResult=persistence.validator(nonvalidatedValue,DEFAULT_VALUE$7),validatedValueLoadable=validatorResult instanceof DefaultValue$2?defaultLoadable:loadableWithValue$3(validatorResult);return cachedAnswerForUnvalidatedValue=validatedValueLoadable,cachedAnswerForUnvalidatedValue}return defaultLoadable},set:function(_store,state,newValue){if(state.atomValues.has(key)){const existing=Recoil_nullthrows(state.atomValues.get(key));if("hasValue"===existing.state&&newValue===existing.contents)return new Map}else if(!state.nonvalidatedAtoms.has(key)&&newValue instanceof DefaultValue$2)return new Map;return cachedAnswerForUnvalidatedValue=void 0,(new Map).set(key,loadableWithValue$3(newValue))},init:function(store,initState,trigger){var _options$effects;if(liveStoresCount++,store.getState().knownAtoms.add(key),"loading"===defaultLoadable.state){const notifyDefaultSubscribers=()=>{var _store$getState$nextT3;(null!==(_store$getState$nextT3=store.getState().nextTree)&&void 0!==_store$getState$nextT3?_store$getState$nextT3:store.getState().currentTree).atomValues.has(key)||markRecoilValueModified$2(store,node)};defaultLoadable.contents.finally(notifyDefaultSubscribers)}const effects=null!==(_options$effects=options.effects)&&void 0!==_options$effects?_options$effects:options.effects_UNSTABLE;if(null!=effects){let initValue=DEFAULT_VALUE$7,isDuringInit=!0,isInitError=!1,pendingSetSelf=null;function getLoadable(recoilValue){if(isDuringInit&&recoilValue.key===key){const retValue=initValue;return retValue instanceof DefaultValue$2?peekAtom(store,initState):Recoil_isPromise(retValue)?loadableWithPromise$2(retValue.then(v=>v instanceof DefaultValue$2?defaultLoadable.toPromise():v)):loadableWithValue$3(retValue)}return getRecoilValueAsLoadable$4(store,recoilValue)}function getPromise(recoilValue){return getLoadable(recoilValue).toPromise()}function getInfo_UNSTABLE(recoilValue){var _store$getState$nextT4;const info=peekNodeInfo$3(store,null!==(_store$getState$nextT4=store.getState().nextTree)&&void 0!==_store$getState$nextT4?_store$getState$nextT4:store.getState().currentTree,recoilValue.key);return!isDuringInit||recoilValue.key!==key||initValue instanceof DefaultValue$2?info:{...info,isSet:!0,loadable:getLoadable(recoilValue)}}const setSelf=effect=>valueOrUpdater=>{if(isDuringInit){const currentLoadable=getLoadable(node),currentValue="hasValue"===currentLoadable.state?currentLoadable.contents:DEFAULT_VALUE$7;initValue="function"==typeof valueOrUpdater?valueOrUpdater(currentValue):valueOrUpdater,Recoil_isPromise(initValue)&&(initValue=initValue.then(value=>(pendingSetSelf={effect:effect,value:value},value)))}else{if(Recoil_isPromise(valueOrUpdater))throw Recoil_err("Setting atoms to async values is not implemented.");"function"!=typeof valueOrUpdater&&(pendingSetSelf={effect:effect,value:unwrap(valueOrUpdater)}),setRecoilValue$4(store,node,"function"==typeof valueOrUpdater?currentValue=>{const newValue=unwrap(valueOrUpdater(currentValue));return pendingSetSelf={effect:effect,value:newValue},newValue}:unwrap(valueOrUpdater))}},resetSelf=effect=>()=>setSelf(effect)(DEFAULT_VALUE$7),onSet=effect=>handler=>{var _cleanupEffectsByStor2;const{release:release}=store.subscribeToTransactions(currentStore=>{var _currentTree$atomValu;let{currentTree:currentTree,previousTree:previousTree}=currentStore.getState();previousTree||(previousTree=currentTree);const newLoadable=null!==(_currentTree$atomValu=currentTree.atomValues.get(key))&&void 0!==_currentTree$atomValu?_currentTree$atomValu:defaultLoadable;if("hasValue"===newLoadable.state){var _previousTree$atomVal,_pendingSetSelf,_pendingSetSelf2,_pendingSetSelf3;const newValue=newLoadable.contents,oldLoadable=null!==(_previousTree$atomVal=previousTree.atomValues.get(key))&&void 0!==_previousTree$atomVal?_previousTree$atomVal:defaultLoadable,oldValue="hasValue"===oldLoadable.state?oldLoadable.contents:DEFAULT_VALUE$7;(null===(_pendingSetSelf=pendingSetSelf)||void 0===_pendingSetSelf?void 0:_pendingSetSelf.effect)!==effect||(null===(_pendingSetSelf2=pendingSetSelf)||void 0===_pendingSetSelf2?void 0:_pendingSetSelf2.value)!==newValue?handler(newValue,oldValue,!currentTree.atomValues.has(key)):(null===(_pendingSetSelf3=pendingSetSelf)||void 0===_pendingSetSelf3?void 0:_pendingSetSelf3.effect)===effect&&(pendingSetSelf=null)}},key);cleanupEffectsByStore.set(store,[...null!==(_cleanupEffectsByStor2=cleanupEffectsByStore.get(store))&&void 0!==_cleanupEffectsByStor2?_cleanupEffectsByStor2:[],release])};for(const effect of effects)try{const cleanup=effect({node:node,storeID:store.storeID,parentStoreID_UNSTABLE:store.parentStoreID,trigger:trigger,setSelf:setSelf(effect),resetSelf:resetSelf(effect),onSet:onSet(effect),getPromise:getPromise,getLoadable:getLoadable,getInfo_UNSTABLE:getInfo_UNSTABLE});var _cleanupEffectsByStor3;if(null!=cleanup)cleanupEffectsByStore.set(store,[...null!==(_cleanupEffectsByStor3=cleanupEffectsByStore.get(store))&&void 0!==_cleanupEffectsByStor3?_cleanupEffectsByStor3:[],cleanup])}catch(error){initValue=error,isInitError=!0}if(isDuringInit=!1,!(initValue instanceof DefaultValue$2)){var _store$getState$nextT5;const initLoadable=isInitError?loadableWithError$2(initValue):Recoil_isPromise(initValue)?loadableWithPromise$2(function(store,promise){const wrappedPromise=promise.then(value=>{var _store$getState$nextT,_state$atomValues$get;return(null===(_state$atomValues$get=(null!==(_store$getState$nextT=store.getState().nextTree)&&void 0!==_store$getState$nextT?_store$getState$nextT:store.getState().currentTree).atomValues.get(key))||void 0===_state$atomValues$get?void 0:_state$atomValues$get.contents)===wrappedPromise&&setRecoilValue$4(store,node,value),value}).catch(error=>{var _store$getState$nextT2,_state$atomValues$get2;throw(null===(_state$atomValues$get2=(null!==(_store$getState$nextT2=store.getState().nextTree)&&void 0!==_store$getState$nextT2?_store$getState$nextT2:store.getState().currentTree).atomValues.get(key))||void 0===_state$atomValues$get2?void 0:_state$atomValues$get2.contents)===wrappedPromise&&setRecoilValueLoadable$2(store,node,loadableWithError$2(error)),error});return wrappedPromise}(store,initValue)):loadableWithValue$3(unwrap(initValue));initLoadable.contents,initState.atomValues.set(key,initLoadable),null===(_store$getState$nextT5=store.getState().nextTree)||void 0===_store$getState$nextT5||_store$getState$nextT5.atomValues.set(key,initLoadable)}}return()=>{var _cleanupEffectsByStor;liveStoresCount--,null===(_cleanupEffectsByStor=cleanupEffectsByStore.get(store))||void 0===_cleanupEffectsByStor||_cleanupEffectsByStor.forEach(cleanup=>cleanup()),cleanupEffectsByStore.delete(store)}},invalidate:function(){cachedAnswerForUnvalidatedValue=void 0},shouldDeleteConfigOnRelease:function(){return void 0!==getConfigDeletionHandler$2(key)&&liveStoresCount<=0},dangerouslyAllowMutability:options.dangerouslyAllowMutability,persistence_UNSTABLE:options.persistence_UNSTABLE?{type:options.persistence_UNSTABLE.type,backButton:options.persistence_UNSTABLE.backButton}:void 0,shouldRestoreFromSnapshots:!0,retainedBy:retainedBy});return node}function atom(options){const{...restOptions}=options,optionsDefault="default"in options?options.default:new Promise(()=>{});return isRecoilValue$3(optionsDefault)?function(options){const base=atom({...options,default:DEFAULT_VALUE$7,persistence_UNSTABLE:void 0===options.persistence_UNSTABLE?void 0:{...options.persistence_UNSTABLE,validator:storedValue=>storedValue instanceof DefaultValue$2?storedValue:Recoil_nullthrows(options.persistence_UNSTABLE).validator(storedValue,DEFAULT_VALUE$7)},effects:options.effects,effects_UNSTABLE:options.effects_UNSTABLE}),sel=Recoil_selector({key:options.key+"__withFallback",get:({get:get})=>{const baseValue=get(base);return baseValue instanceof DefaultValue$2?options.default:baseValue},set:({set:set},newValue)=>set(base,newValue),cachePolicy_UNSTABLE:{eviction:"most-recent"},dangerouslyAllowMutability:options.dangerouslyAllowMutability});return setConfigDeletionHandler$1(sel.key,getConfigDeletionHandler$2(options.key)),sel}({...restOptions,default:optionsDefault}):baseAtom({...restOptions,default:optionsDefault})}atom.value=value=>new WrappedValue$2(value);var Recoil_atom=atom;var Recoil_MapCache_1=class{constructor(options){var _options$mapKey;_defineProperty(this,"_map",void 0),_defineProperty(this,"_keyMapper",void 0),this._map=new Map,this._keyMapper=null!==(_options$mapKey=null==options?void 0:options.mapKey)&&void 0!==_options$mapKey?_options$mapKey:v=>v}size(){return this._map.size}has(key){return this._map.has(this._keyMapper(key))}get(key){return this._map.get(this._keyMapper(key))}set(key,val){this._map.set(this._keyMapper(key),val)}delete(key){this._map.delete(this._keyMapper(key))}clear(){this._map.clear()}},Recoil_MapCache$1=Object.freeze({__proto__:null,MapCache:Recoil_MapCache_1});const{LRUCache:LRUCache$2}=Recoil_LRUCache$1,{MapCache:MapCache$1}=Recoil_MapCache$1,defaultPolicy$1={equality:"reference",eviction:"none",maxSize:1/0};var Recoil_cacheFromPolicy=function({equality:equality=defaultPolicy$1.equality,eviction:eviction=defaultPolicy$1.eviction,maxSize:maxSize=defaultPolicy$1.maxSize}=defaultPolicy$1){return function(eviction,maxSize,mapKey){switch(eviction){case"keep-all":return new MapCache$1({mapKey:mapKey});case"lru":return new LRUCache$2({mapKey:mapKey,maxSize:Recoil_nullthrows(maxSize)});case"most-recent":return new LRUCache$2({mapKey:mapKey,maxSize:1})}throw Recoil_err("Unrecognized eviction policy "+eviction)}(eviction,maxSize,function(equality){switch(equality){case"reference":return val=>val;case"value":return val=>Recoil_stableStringify(val)}throw Recoil_err("Unrecognized equality policy "+equality)}(equality))};const{setConfigDeletionHandler:setConfigDeletionHandler$2}=Recoil_Node;var Recoil_atomFamily=function(options){var _options$cachePolicyF,_options$cachePolicyF2;const atomCache=Recoil_cacheFromPolicy({equality:null!==(_options$cachePolicyF=null===(_options$cachePolicyF2=options.cachePolicyForParams_UNSTABLE)||void 0===_options$cachePolicyF2?void 0:_options$cachePolicyF2.equality)&&void 0!==_options$cachePolicyF?_options$cachePolicyF:"value",eviction:"keep-all"});return params=>{var _stableStringify,_options$effects;const cachedAtom=atomCache.get(params);if(null!=cachedAtom)return cachedAtom;const{cachePolicyForParams_UNSTABLE:cachePolicyForParams_UNSTABLE,...atomOptions}=options,optionsDefault="default"in options?options.default:new Promise(()=>{}),newAtom=Recoil_atom({...atomOptions,key:`${options.key}__${null!==(_stableStringify=Recoil_stableStringify(params))&&void 0!==_stableStringify?_stableStringify:"void"}`,default:"function"==typeof optionsDefault?optionsDefault(params):optionsDefault,retainedBy_UNSTABLE:"function"==typeof options.retainedBy_UNSTABLE?options.retainedBy_UNSTABLE(params):options.retainedBy_UNSTABLE,effects:"function"==typeof options.effects?options.effects(params):"function"==typeof options.effects_UNSTABLE?options.effects_UNSTABLE(params):null!==(_options$effects=options.effects)&&void 0!==_options$effects?_options$effects:options.effects_UNSTABLE});return atomCache.set(params,newAtom),setConfigDeletionHandler$2(newAtom.key,()=>{atomCache.delete(params)}),newAtom}};const{setConfigDeletionHandler:setConfigDeletionHandler$3}=Recoil_Node;let nextIndex=0;var Recoil_selectorFamily=function(options){var _options$cachePolicyF,_options$cachePolicyF2;const selectorCache=Recoil_cacheFromPolicy({equality:null!==(_options$cachePolicyF=null===(_options$cachePolicyF2=options.cachePolicyForParams_UNSTABLE)||void 0===_options$cachePolicyF2?void 0:_options$cachePolicyF2.equality)&&void 0!==_options$cachePolicyF?_options$cachePolicyF:"value",eviction:"keep-all"});return params=>{var _stableStringify;let cachedSelector;try{cachedSelector=selectorCache.get(params)}catch(error){throw Recoil_err(`Problem with cache lookup for selector ${options.key}: ${error.message}`)}if(null!=cachedSelector)return cachedSelector;const myKey=`${options.key}__selectorFamily/${null!==(_stableStringify=Recoil_stableStringify(params,{allowFunctions:!0}))&&void 0!==_stableStringify?_stableStringify:"void"}/${nextIndex++}`,myGet=callbacks=>options.get(params)(callbacks),myCachePolicy=options.cachePolicy_UNSTABLE,retainedBy="function"==typeof options.retainedBy_UNSTABLE?options.retainedBy_UNSTABLE(params):options.retainedBy_UNSTABLE;let newSelector;if(null!=options.set){const set=options.set;newSelector=Recoil_selector({key:myKey,get:myGet,set:(callbacks,newValue)=>set(params)(callbacks,newValue),cachePolicy_UNSTABLE:myCachePolicy,dangerouslyAllowMutability:options.dangerouslyAllowMutability,retainedBy_UNSTABLE:retainedBy})}else newSelector=Recoil_selector({key:myKey,get:myGet,cachePolicy_UNSTABLE:myCachePolicy,dangerouslyAllowMutability:options.dangerouslyAllowMutability,retainedBy_UNSTABLE:retainedBy});return selectorCache.set(params,newSelector),setConfigDeletionHandler$3(newSelector.key,()=>{selectorCache.delete(params)}),newSelector}};const constantSelector=Recoil_selectorFamily({key:"__constant",get:constant=>()=>constant,cachePolicyForParams_UNSTABLE:{equality:"reference"}});var Recoil_constSelector=function(constant){return constantSelector(constant)};const throwingSelector=Recoil_selectorFamily({key:"__error",get:message=>()=>{throw Recoil_err(message)},cachePolicyForParams_UNSTABLE:{equality:"reference"}});var Recoil_errorSelector=function(message){return throwingSelector(message)};var Recoil_readOnlySelector=function(atom){return atom};const{loadableWithError:loadableWithError$3,loadableWithPromise:loadableWithPromise$3,loadableWithValue:loadableWithValue$4}=Recoil_Loadable$1;function concurrentRequests(getRecoilValue,deps){const results=Array(deps.length).fill(void 0),exceptions=Array(deps.length).fill(void 0);for(const[i,dep]of deps.entries())try{results[i]=getRecoilValue(dep)}catch(e){exceptions[i]=e}return[results,exceptions]}function isError(exp){return null!=exp&&!Recoil_isPromise(exp)}function unwrapDependencies(dependencies){return Array.isArray(dependencies)?dependencies:Object.getOwnPropertyNames(dependencies).map(key=>dependencies[key])}function wrapResults(dependencies,results){return Array.isArray(dependencies)?results:Object.getOwnPropertyNames(dependencies).reduce((out,key,idx)=>({...out,[key]:results[idx]}),{})}function wrapLoadables(dependencies,results,exceptions){return wrapResults(dependencies,exceptions.map((exception,idx)=>null==exception?loadableWithValue$4(results[idx]):Recoil_isPromise(exception)?loadableWithPromise$3(exception):loadableWithError$3(exception)))}var Recoil_WaitFor={waitForNone:Recoil_selectorFamily({key:"__waitForNone",get:dependencies=>({get:get})=>{const deps=unwrapDependencies(dependencies),[results,exceptions]=concurrentRequests(get,deps);return wrapLoadables(dependencies,results,exceptions)},dangerouslyAllowMutability:!0}),waitForAny:Recoil_selectorFamily({key:"__waitForAny",get:dependencies=>({get:get})=>{const deps=unwrapDependencies(dependencies),[results,exceptions]=concurrentRequests(get,deps);return exceptions.some(exp=>!Recoil_isPromise(exp))?wrapLoadables(dependencies,results,exceptions):new Promise(resolve=>{for(const[i,exp]of exceptions.entries())Recoil_isPromise(exp)&&exp.then(result=>{results[i]=result,exceptions[i]=void 0,resolve(wrapLoadables(dependencies,results,exceptions))}).catch(error=>{exceptions[i]=error,resolve(wrapLoadables(dependencies,results,exceptions))})})},dangerouslyAllowMutability:!0}),waitForAll:Recoil_selectorFamily({key:"__waitForAll",get:dependencies=>({get:get})=>{const deps=unwrapDependencies(dependencies),[results,exceptions]=concurrentRequests(get,deps);if(exceptions.every(exp=>null==exp))return wrapResults(dependencies,results);const error=exceptions.find(isError);if(null!=error)throw error;return Promise.all(exceptions).then(exceptionResults=>{return wrapResults(dependencies,(syncResults=results,exceptionResults.map((result,idx)=>void 0===result?syncResults[idx]:result)));var syncResults})},dangerouslyAllowMutability:!0}),waitForAllSettled:Recoil_selectorFamily({key:"__waitForAllSettled",get:dependencies=>({get:get})=>{const deps=unwrapDependencies(dependencies),[results,exceptions]=concurrentRequests(get,deps);return exceptions.every(exp=>!Recoil_isPromise(exp))?wrapLoadables(dependencies,results,exceptions):Promise.all(exceptions.map((exp,i)=>Recoil_isPromise(exp)?exp.then(result=>{results[i]=result,exceptions[i]=void 0}).catch(error=>{results[i]=void 0,exceptions[i]=error}):null)).then(()=>wrapLoadables(dependencies,results,exceptions))},dangerouslyAllowMutability:!0}),noWait:Recoil_selectorFamily({key:"__noWait",get:dependency=>({get:get})=>{try{return Recoil_selector.value(loadableWithValue$4(get(dependency)))}catch(exception){return Recoil_selector.value(Recoil_isPromise(exception)?loadableWithPromise$3(exception):loadableWithError$3(exception))}},dangerouslyAllowMutability:!0})};const{RecoilLoadable:RecoilLoadable}=Recoil_Loadable$1,{DefaultValue:DefaultValue$3}=Recoil_Node,{RecoilRoot:RecoilRoot$2,useRecoilStoreID:useRecoilStoreID$1}=Recoil_RecoilRoot,{isRecoilValue:isRecoilValue$4}=Recoil_RecoilValue$1,{retentionZone:retentionZone$1}=Recoil_RetentionZone,{freshSnapshot:freshSnapshot$2}=Recoil_Snapshot$1,{useRecoilState:useRecoilState$1,useRecoilState_TRANSITION_SUPPORT_UNSTABLE:useRecoilState_TRANSITION_SUPPORT_UNSTABLE$1,useRecoilStateLoadable:useRecoilStateLoadable$1,useRecoilValue:useRecoilValue$1,useRecoilValue_TRANSITION_SUPPORT_UNSTABLE:useRecoilValue_TRANSITION_SUPPORT_UNSTABLE$1,useRecoilValueLoadable:useRecoilValueLoadable$1,useRecoilValueLoadable_TRANSITION_SUPPORT_UNSTABLE:useRecoilValueLoadable_TRANSITION_SUPPORT_UNSTABLE$1,useResetRecoilState:useResetRecoilState$1,useSetRecoilState:useSetRecoilState$1}=Recoil_Hooks,{useGotoRecoilSnapshot:useGotoRecoilSnapshot$1,useRecoilSnapshot:useRecoilSnapshot$1,useRecoilTransactionObserver:useRecoilTransactionObserver$1}=Recoil_SnapshotHooks,{useRecoilCallback:useRecoilCallback$1}=Recoil_useRecoilCallback,{noWait:noWait$1,waitForAll:waitForAll$1,waitForAllSettled:waitForAllSettled$1,waitForAny:waitForAny$1,waitForNone:waitForNone$1}=Recoil_WaitFor;var Recoil_index={DefaultValue:DefaultValue$3,isRecoilValue:isRecoilValue$4,RecoilLoadable:RecoilLoadable,RecoilEnv:Recoil_RecoilEnv,RecoilRoot:RecoilRoot$2,useRecoilStoreID:useRecoilStoreID$1,useRecoilBridgeAcrossReactRoots_UNSTABLE:Recoil_useRecoilBridgeAcrossReactRoots,atom:Recoil_atom,selector:Recoil_selector,atomFamily:Recoil_atomFamily,selectorFamily:Recoil_selectorFamily,constSelector:Recoil_constSelector,errorSelector:Recoil_errorSelector,readOnlySelector:Recoil_readOnlySelector,noWait:noWait$1,waitForNone:waitForNone$1,waitForAny:waitForAny$1,waitForAll:waitForAll$1,waitForAllSettled:waitForAllSettled$1,useRecoilValue:useRecoilValue$1,useRecoilValueLoadable:useRecoilValueLoadable$1,useRecoilState:useRecoilState$1,useRecoilStateLoadable:useRecoilStateLoadable$1,useSetRecoilState:useSetRecoilState$1,useResetRecoilState:useResetRecoilState$1,useGetRecoilValueInfo_UNSTABLE:Recoil_useGetRecoilValueInfo,useRecoilRefresher_UNSTABLE:Recoil_useRecoilRefresher,useRecoilValueLoadable_TRANSITION_SUPPORT_UNSTABLE:useRecoilValueLoadable_TRANSITION_SUPPORT_UNSTABLE$1,useRecoilValue_TRANSITION_SUPPORT_UNSTABLE:useRecoilValue_TRANSITION_SUPPORT_UNSTABLE$1,useRecoilState_TRANSITION_SUPPORT_UNSTABLE:useRecoilState_TRANSITION_SUPPORT_UNSTABLE$1,useRecoilCallback:useRecoilCallback$1,useRecoilTransaction_UNSTABLE:Recoil_useRecoilTransaction,useGotoRecoilSnapshot:useGotoRecoilSnapshot$1,useRecoilSnapshot:useRecoilSnapshot$1,useRecoilTransactionObserver_UNSTABLE:useRecoilTransactionObserver$1,snapshot_UNSTABLE:freshSnapshot$2,useRetain:Recoil_useRetain,retentionZone:retentionZone$1},Recoil_index_1=Recoil_index.DefaultValue,Recoil_index_2=Recoil_index.isRecoilValue,Recoil_index_3=Recoil_index.RecoilLoadable,Recoil_index_4=Recoil_index.RecoilEnv,Recoil_index_5=Recoil_index.RecoilRoot,Recoil_index_6=Recoil_index.useRecoilStoreID,Recoil_index_7=Recoil_index.useRecoilBridgeAcrossReactRoots_UNSTABLE,Recoil_index_8=Recoil_index.atom,Recoil_index_9=Recoil_index.selector,Recoil_index_10=Recoil_index.atomFamily,Recoil_index_11=Recoil_index.selectorFamily,Recoil_index_12=Recoil_index.constSelector,Recoil_index_13=Recoil_index.errorSelector,Recoil_index_14=Recoil_index.readOnlySelector,Recoil_index_15=Recoil_index.noWait,Recoil_index_16=Recoil_index.waitForNone,Recoil_index_17=Recoil_index.waitForAny,Recoil_index_18=Recoil_index.waitForAll,Recoil_index_19=Recoil_index.waitForAllSettled,Recoil_index_20=Recoil_index.useRecoilValue,Recoil_index_21=Recoil_index.useRecoilValueLoadable,Recoil_index_22=Recoil_index.useRecoilState,Recoil_index_23=Recoil_index.useRecoilStateLoadable,Recoil_index_24=Recoil_index.useSetRecoilState,Recoil_index_25=Recoil_index.useResetRecoilState,Recoil_index_26=Recoil_index.useGetRecoilValueInfo_UNSTABLE,Recoil_index_27=Recoil_index.useRecoilRefresher_UNSTABLE,Recoil_index_28=Recoil_index.useRecoilValueLoadable_TRANSITION_SUPPORT_UNSTABLE,Recoil_index_29=Recoil_index.useRecoilValue_TRANSITION_SUPPORT_UNSTABLE,Recoil_index_30=Recoil_index.useRecoilState_TRANSITION_SUPPORT_UNSTABLE,Recoil_index_31=Recoil_index.useRecoilCallback,Recoil_index_32=Recoil_index.useRecoilTransaction_UNSTABLE,Recoil_index_33=Recoil_index.useGotoRecoilSnapshot,Recoil_index_34=Recoil_index.useRecoilSnapshot,Recoil_index_35=Recoil_index.useRecoilTransactionObserver_UNSTABLE,Recoil_index_36=Recoil_index.snapshot_UNSTABLE,Recoil_index_37=Recoil_index.useRetain,Recoil_index_38=Recoil_index.retentionZone;exports.DefaultValue=Recoil_index_1,exports.RecoilEnv=Recoil_index_4,exports.RecoilLoadable=Recoil_index_3,exports.RecoilRoot=Recoil_index_5,exports.atom=Recoil_index_8,exports.atomFamily=Recoil_index_10,exports.constSelector=Recoil_index_12,exports.default=Recoil_index,exports.errorSelector=Recoil_index_13,exports.isRecoilValue=Recoil_index_2,exports.noWait=Recoil_index_15,exports.readOnlySelector=Recoil_index_14,exports.retentionZone=Recoil_index_38,exports.selector=Recoil_index_9,exports.selectorFamily=Recoil_index_11,exports.snapshot_UNSTABLE=Recoil_index_36,exports.useGetRecoilValueInfo_UNSTABLE=Recoil_index_26,exports.useGotoRecoilSnapshot=Recoil_index_33,exports.useRecoilBridgeAcrossReactRoots_UNSTABLE=Recoil_index_7,exports.useRecoilCallback=Recoil_index_31,exports.useRecoilRefresher_UNSTABLE=Recoil_index_27,exports.useRecoilSnapshot=Recoil_index_34,exports.useRecoilState=Recoil_index_22,exports.useRecoilStateLoadable=Recoil_index_23,exports.useRecoilState_TRANSITION_SUPPORT_UNSTABLE=Recoil_index_30,exports.useRecoilStoreID=Recoil_index_6,exports.useRecoilTransactionObserver_UNSTABLE=Recoil_index_35,exports.useRecoilTransaction_UNSTABLE=Recoil_index_32,exports.useRecoilValue=Recoil_index_20,exports.useRecoilValueLoadable=Recoil_index_21,exports.useRecoilValueLoadable_TRANSITION_SUPPORT_UNSTABLE=Recoil_index_28,exports.useRecoilValue_TRANSITION_SUPPORT_UNSTABLE=Recoil_index_29,exports.useResetRecoilState=Recoil_index_25,exports.useRetain=Recoil_index_37,exports.useSetRecoilState=Recoil_index_24,exports.waitForAll=Recoil_index_18,exports.waitForAllSettled=Recoil_index_19,exports.waitForAny=Recoil_index_17,exports.waitForNone=Recoil_index_16,Object.defineProperty(exports,"__esModule",{value:!0})}));
|