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

forest

Package Overview
Dependencies
Maintainers
3
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

forest - npm Package Compare versions

Comparing version 0.19.0 to 0.19.1

2

forest.cjs.js

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

function e(e,t){e.cursor[t].prev&&(e.cursor[t].prev.cursor[t].next=e.cursor[t].next),e.cursor[t].next&&(e.cursor[t].next.cursor[t].prev=e.cursor[t].prev),e.queue[t].last===e&&(e.queue[t].last=e.cursor[t].prev),e.queue[t].first===e&&(e.queue[t].first=e.cursor[t].next),e.cursor[t].prev=null,e.cursor[t].next=null}function t(e){var t,n;e.status='active',t=a(e),(n=e).cursor.prev&&(n.cursor.prev.cursor.next=n.cursor.next),n.cursor.next&&(n.cursor.next.cursor.prev=n.cursor.prev),t.last===n&&(t.last=n.cursor.prev),t.first===n&&(t.first=n.cursor.next),n.cursor.prev=null,n.cursor.next=null}function a(e){return e.group.activeChilds[e.priority]}function n(e,a){a.value.active=a.value.pending=e,'active'!==a.status&&t(a)}function l(n,l){if(l.value.active===n)return l.value.pending=n,void('pending'===l.status&&(t(l),a(l).first||e(l.group,l.priority)));var r,o,i,s;'active'===l.status&&(l.status='pending',a(l).first||((i=l.group).queue[s=l.priority].last?(i.cursor[s].prev=i.queue[s].last,i.queue[s].last.cursor[s].next=i,i.queue[s].last=i):i.queue[s].first=i.queue[s].last=i),o=l,(r=a(l)).last?(o.cursor.prev=r.last,r.last.cursor.next=o,r.last=o):r.first=r.last=o),l.value.pending=n,l.group.queue.rafID||(l.group.queue.rafID=Y(l.group.queue.execQueue))}function r(a){J('execQueue');let n,l,r=X(),o=0;e:for(;a.props.first||a.tree.first||a.data.first;){if(X()-r>=10){o=1;break e}let i=!!a.props.first;for(i&&J('props');n=a.props.first;){for(;l=n.activeChilds.props.first;){if(X()-r>=10){o=1,K('props');break e}l.runOp(l.value.pending),l.value.active=l.value.pending,t(l)}e(n,'props')}i&&K('props');let s=!!a.tree.first;for(s&&J('tree');n=a.tree.first;){for(;l=n.activeChilds.tree.first;){if(X()-r>=10){o=1,K('tree');break e}l.runOp(l.value.pending),l.value.active=l.value.pending,t(l)}e(n,'tree')}s&&K('tree');let u=!!a.data.first;for(u&&J('data');n=a.data.first;){for(;l=n.activeChilds.data.first;){if(X()-r>=10){o=1,K('data');break e}l.runOp(l.value.pending),l.value.active=l.value.pending,t(l)}e(n,'data')}u&&K('data')}if(K('execQueue'),o)a.rafID=Y(a.execQueue);else if(a.rafID=null,a.onDrain){let e=a.onDrain;a.onDrain=null,e()}}function o({value:e,runOp:t,group:a,priority:n}){return{value:{active:e,pending:e},runOp:t,status:'active',priority:n,group:a,cursor:{prev:null,next:null}}}function i({onComplete:e}){let t={props:{first:null,last:null},tree:{first:null,last:null},data:{first:null,last:null},rafID:null,execQueue(){},onDrain:e};return t.execQueue=r.bind(null,t),t}function s(e){return{ops:[],queue:e,activeChilds:{props:{first:null,last:null},tree:{first:null,last:null},data:{first:null,last:null}},cursor:{props:{prev:null,next:null},tree:{prev:null,next:null},data:{prev:null,next:null}}}}function u({value:e,group:t,onInit:a,onChange:n,onTerminate:r}){let i=o({value:e,group:t,runOp(e){s.status='A',n(e)},priority:'data'}),s={status:'IA',value:i.value,hooks:{onTerminate:r},ops:{init:o({value:0,group:t,runOp(e){s.status='A',a(s.value.active)},priority:'data'}),change:i,terminate:o({value:0,group:t,runOp(e){s.status='T',s.hooks.onTerminate(1)},priority:'data'})}};return l(1,s.ops.init),s}function c(e){switch(e.status){case'I':case'T':case'AT':return;case'A':e.status='AT',l(1,e.ops.terminate);break;case'AA':e.status='AT',l(1,e.ops.terminate),l(e.value.active,e.ops.change);break;case'IA':e.status='T',l(0,e.ops.init),e.hooks.onTerminate(0)}}function p(e,t){switch(t.status){case'I':case'T':return;case'A':t.value.active!==e&&(t.status='AA',l(e,t.ops.change));break;case'AA':t.value.active===e?(t.status='A',l(e,t.ops.change)):t.value.pending!==e&&(t.value.pending=e);break;case'IA':t.value.active=t.value.pending=e}}function f(e,t){for(let a=0;a<t.length;a++){let{type:n,field:l,value:r}=t[a];Z[n](e,l,r)}}function d(e){return''!==e&&0!==e&&'0'!==e&&(0==e||null==e)}function h(e,t,a){d(a)?e.style.removeProperty("--"+t):e.style.setProperty("--"+t,""+a)}function g(e,t,a){d(a)?delete e.style[t]:e.style[t]=""+a}function m(e,t,a){d(a)?delete e.dataset[t]:e.dataset[t]=""+a}function v(e,t,a){if(d(a)){switch(t){case'value':delete e.value;break;case'checked':e.checked=0;break;case'spellcheck':if(0==a)return void e.setAttribute('spellcheck','false')}e.removeAttribute(t)}else{switch(t){case'value':e.value=""+a;break;case'checked':e.checked=""+a}e.setAttribute(t,""+a)}}function k(e,t){e.replaceData(0,(e.textContent||'').length,String(t))}function y({fn:e,state:t={},defer:a=0,name:n="",draft:l,isSvgRoot:r,namespace:o,env:i,isBlock:s=0}){let u=le,c=ae,p={id:++ee,name:n,plain:[],watch:[],nameMap:{},pages:[],closure:[],childTemplates:[],upward:effector.step.filter({fn(e,t,a){if(!a.page){if(!a.parent||!a.parent.page)return 1;a.page=a.parent.page}if(!a.page.active)return 0;let n=[a.page.template],l=[a.page];{let e=a.page.parent;for(;e;)l.push(e),n.push(e.template),e=e.parent}return a.node.next.forEach(t=>{let r=t.meta.nativeTemplate;r?n.includes(r)?effector.launch({target:b(t,a.forkPage),params:e,defer:1,page:l[n.indexOf(r)],stack:a,forkPage:a.forkPage}):console.error('context drift',{stack:a,node:t}):effector.launch({target:b(t,a.forkPage),params:e,defer:1,page:null,stack:a,forkPage:a.forkPage})}),0}}),loader:effector.step.filter({fn(e,t,a){if(a.parent){let n=a.forkPage?a.forkPage.graphite.id:null;if(a.page){if(!a.page.active)return 0;if(a.page.template===p)return 1;if(a.page.childSpawns[p.id])a.page.childSpawns[p.id].forEach(t=>{(!n||t.leaf.forkPage&&n===t.leaf.forkPage.graphite.id)&&effector.launch({params:e,target:b(a.node,a.forkPage),page:t,defer:1,forkPage:a.forkPage})});else if(t.targetTemplate){let n=[a.page];{let e=a.page.parent;for(;e;)n.push(e),e=e.parent}let l=n.findIndex(e=>t.targetTemplate===e.template);effector.launch(-1===l?{params:e,target:b(a.node,a.forkPage),page:null,defer:1,forkPage:a.forkPage}:{params:e,target:b(a.node,a.forkPage),page:n[l],defer:1,forkPage:a.forkPage})}else p.pages.forEach(t=>{(!n||t.leaf.forkPage&&n===t.leaf.forkPage.graphite.id)&&t.fullID.startsWith(a.page.fullID)&&effector.launch({params:e,target:b(a.node,a.forkPage),page:t,defer:1,forkPage:a.forkPage})})}else p.pages.forEach(t=>{(!n||t.leaf.forkPage&&n===t.leaf.forkPage.graphite.id)&&effector.launch({params:e,target:b(a.node,a.forkPage),page:t,defer:1,forkPage:a.forkPage})});return 0}return 1}}),parent:c};c&&c.childTemplates.push(p);let f=effector.createNode({meta:{template:p}});ae=p;let d=le={template:p,node:f,api:null,trigger:{mount:effector.createEvent(),unmount:effector.createEvent()},draft:l,isSvgRoot:r,namespace:o,env:i,isBlock:s||!(!u||!u.isBlock)};return a?d.deferredInit=()=>{let a=le,n=ae;le=d,ae=p,d.deferredInit=null;try{effector.withRegion(f,()=>{let a=effector.restore(t);d.api=e(a,d.trigger),p.nameMap=a})}finally{le=a,ae=n}}:effector.withRegion(f,()=>{let a=effector.restore(t);d.api=e(a,d.trigger),p.nameMap=a}),le=u,ae=c,p.actor=d,d}function b(e,t){return t&&t.nodeMap[(e=e.graphite||e).id]||e}function w(e,t){let a=e;switch(t&&re(t,e)&&(a=re(t,e)),e.type){case'list':return[...a.current];case'shape':return{...a.current};default:return a.current}}function x(e,t,a){let n=t;for(;n&&!re(n.spawn,e);)n=n.parentLeaf;return n?re(n.spawn,e):a&&re(a,e)?re(a,e):e}function P(e,t,a){return x(e,t,a).current}function I(e,t){re(t.spawn,e)||(t.spawn.reg[e.id]=x(e,t.parentLeaf,t.forkPage))}function S(e,{values:t={},parentLeaf:a,mountNode:n,svgRoot:l,leafData:r,opGroup:o,domSubtree:i,hydration:s,forkPage:u,env:c}){function p(e){if(e.before)for(let t=0;t<e.before.length;t++){let a=e.before[t];switch(a.type){case'map':{let t=a.from;I(t,k),g[e.id].current=a.fn(g[t.id].current);break}case'field':{let t=a.from;I(t,k),g[e.id].current[a.field]=g[t.id].current;break}case'closure':I(a.of,k)}}if(!e.after)return;let t=g[e.id].current;for(let a=0;a<e.after.length;a++){let n=e.after[a],l=n.to;switch(g[l.id]||(g[l.id]={id:l.id,current:P(l,k.parentLeaf,u)}),n.type){case'copy':g[l.id].current=t;break;case'map':g[l.id].current=n.fn(t)}}}function f(e,t,a){let n;t.stop=1;try{for(;t.i<e.length;)n=e[t.i],t.i++,n.fn(a[n.of.id]?a[n.of.id].current:P(n.of,k.parentLeaf,u))}catch(e){console.error(e),t.stop=0}}!c&&a&&(c=a.env);let d=a?a.spawn:null,h=e.template,g={},m={id:++te,fullID:'',reg:g,template:h,parent:d,childSpawns:{},active:1};h.pages.push(m);let v={},k={actor:e,spawn:m,api:v,draft:e.draft,ops:{group:o,domSubtree:i},svgRoot:l,data:r,parentLeaf:a,hydration:s,forkPage:u,env:c},y=ne;ne=k,d&&(d.childSpawns[h.id]||(d.childSpawns[h.id]=[]),d.childSpawns[h.id].push(m)),m.fullID=d?`${d.fullID}_${m.id}`:""+m.id;for(let e=0;e<h.closure.length;e++){let t=h.closure[e],a=t,n=m.parent;e:for(;n;){if(re(n,t)){a=re(n,t);break e}n=n.parent}!n&&u&&re(u,t)&&(a=re(u,t)),g[t.id]=a}for(let e=0;e<h.plain.length;e++){let t=h.plain[e],a={id:t.id,current:w(t,u)};g[t.id]=a}for(let e in t){let a=h.nameMap[e].stateRef.id;g[a]={id:a,current:t[e]}}h.closure.forEach(p),h.plain.forEach(p);let b={i:0,stop:0};for(;!b.stop;)f(h.watch,b,g);if(d)for(let e in m.childSpawns)e in d.childSpawns||(d.childSpawns[e]=[]),d.childSpawns[e].push(...m.childSpawns[e]);if(v.mount=(t,a=1)=>effector.launch({target:e.trigger.mount,params:t,defer:a,page:m,forkPage:u}),v.unmount=(t,a=1)=>effector.launch({target:e.trigger.unmount,params:t,defer:a,page:m,forkPage:u}),e.api)for(let t in e.api)v[t]=(a,n=1)=>effector.launch({target:e.api[t],params:a,defer:n,page:m,forkPage:u});return k.spawn.api=v,k.spawn.leaf=k,k.api.mount({node:n,leaf:k}),ne=y,k}function C(e){let t=function e(t){switch(t.type){case'using':return t;case'fragment':switch(t.parent.type){case'element':case'using':return t.parent}default:return e((e=>{switch(e.type){case'text':case'element':case'list':case'route':case'rec':case'recItem':case'block':case'blockItem':return e.parent;default:switch(e.parent.type){case'using':case'block':return e.parent;default:return e.parent.parent}}})(t))}}(e);return t?t.value:null}function T(e){if(!e.visible)return null;switch(e.type){case'text':case'element':return e;case'route':return T(e.child);case'LF':case'RF':case'FF':case'rec':case'recItem':case'block':case'blockItem':return(e=>{let t=e.child;for(let e=t.length-1;e>=0;e--){let a=T(t[e]);if(a)return a}return null})(e.child);case'list':{let t=e.lastChild;if(!t)return null;for(;t;){let e=T(t);if(e)return e;t=t.left}return null}default:return null}}function R(e){switch(e.type){case'fragment':switch(e.parent.type){case'element':case'using':case'block':return null;case'RF':{let t=e.parent.parent,a=t.parent;for(let e=t.index-1;e>=0;e--){let t=T(a.child[e]);if(t)return t}return R(a)}case'rec':case'recItem':case'block':case'blockItem':case'FF':{let t=e.parent,a=t.parent;for(let e=t.index-1;e>=0;e--){let t=T(a.child[e]);if(t)return t}return R(a)}case'LF':{let t=e.parent.left;for(;t;){let e=T(t);if(e)return e;t=t.left}return R(e.parent.parent)}default:return null}case'element':case'text':case'route':case'rec':case'recItem':case'block':case'blockItem':case'list':{let t=e.parent;for(let a=e.index-1;a>=0;a--){let e=t.child[a];if(!e)continue;let n=T(e);if(n)return n}return R(t)}default:return null}}function q(e){let t=R(e);return t?t.value:null}function A(e,{parentBlockFragment:t,leaf:a,node:n,svgRoot:l,values:r}){e.childTemplates.forEach(e=>{D({parentBlockFragment:t,leaf:a,node:n,svgRoot:l,values:r,actor:e})})}function D({parentBlockFragment:e,leaf:t,node:a,actor:n,svgRoot:l,values:r}){let i,{draft:u}=n,{queue:c}=t.ops.group,p=s(c),d=t.ops.domSubtree,h=d;switch(u.type){case'route':{let t={type:'route',parent:e,child:{type:'RF',parent:null,child:{type:'fragment',parent:null,child:[]},visible:0},visible:1,index:u.inParentIndex};t.child.parent=t,t.child.child.parent=t.child,e.child[u.inParentIndex]=t,i={type:'route',block:t,ops:{},initialized:0};break}case'element':{let a;if(n.isBlock){let e,n,l=t;for(;l&&(!n||!e);){l.actor.env&&(e=l.actor.env);let{draft:t}=l;'element'===t.type&&('svg'===t.tag?n='svg':'foreignObject'===t.tag&&(n='html')),l=l.parentLeaf}n||(n='html'),e&&(a='svg'===n?e.document.createElementNS('http://www.w3.org/2000/svg',u.tag):e.document.createElement(u.tag),f(a,u.staticSeq))}else a=u.stencil.cloneNode();let l={type:'element',parent:e,child:{type:'fragment',parent:null,child:[]},value:a,visible:0,index:u.inParentIndex};l.child.parent=l,e.child[u.inParentIndex]=l,i={type:'element',block:l,ops:{visible:o({value:0,priority:'tree',runOp(e){e?(E(l),i.needToCallNode&&(i.needToCallNode=0,effector.launch({target:oe,params:{element:l.value,fns:u.node},page:g.spawn,forkPage:t.forkPage}))):(l.value.remove(),l.visible=0)},group:d})},needToCallNode:u.node.length>0},h=s(c);break}case'list':{let t={type:'list',parent:e,child:[],lastChild:null,visible:1,index:u.inParentIndex};e.child[u.inParentIndex]=t,i={type:'list',draft:u,block:t};break}case'using':case'listItem':break;case'rec':{let t={type:'rec',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:u.inParentIndex};t.child.parent=t,e.child[u.inParentIndex]=t,i={type:'rec',block:t};break}case'recItem':{let t={type:'recItem',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:u.inParentIndex};t.child.parent=t,e.child[u.inParentIndex]=t,i={type:'rec item',block:t};break}case'block':{let t={type:'block',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:0};t.child.parent=t,e.child[u.inParentIndex]=t,i={type:'block',block:t};break}case'blockItem':{let t={type:'blockItem',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:u.inParentIndex};t.child.parent=t,e.child[u.inParentIndex]=t,i={type:'block item',block:t};break}default:console.warn("unexpected draft type "+u.type)}let g=S(n,{values:r,parentLeaf:t,mountNode:a,svgRoot:l||t.svgRoot,leafData:i,opGroup:p,domSubtree:h,hydration:t.hydration,forkPage:t.forkPage})}function E(e){let t=q(e);t?t.after(e.value):C(e).prepend(e.value),e.visible=1}function F(e,t){if(Array.isArray(t))return t.map(t=>e.map(e=>e[t]));if('object'==typeof t&&null!==t){let a={};for(let n in t){let l=t[n];a[n]=e.map('function'==typeof l?e=>l(e):e=>e[l])}return a}return e.map(e=>e[t])}function M(){if('undefined'!=typeof document)return{document};throw Error('your environment has no document')}function O(e){if(e){if(!e.nodeMap){let t={};for(let a=0;a<e.clones.length;a++){let n=e.clones[a];t[n.meta.forkOf.id]=n}e.nodeMap=t}return e.reg}}function N(e){let t=le.draft;switch(t.type){case'list':return void(e.visible&&(t.itemVisible=e.visible));case'listItem':case'using':case'route':case'rec':case'recItem':case'block':case'blockItem':return}if(e.attr&&t.attr.push(e.attr),e.data&&t.data.push(e.data),'text'in e){let a=e.text,n=t.childCount;Array.isArray(a)?(t.text.push(...a.map((e,t)=>({index:t+n,value:e}))),t.childCount+=a.length):(t.text.push({index:n,value:a}),t.childCount+=1)}if(e.style&&t.styleProp.push(e.style),e.styleVar&&t.styleVar.push(e.styleVar),e.visible&&(t.visible=e.visible),e.handler){let t=e.handler;'object'==typeof t.on?B(t.config||{},t.on):B(t)}e.ɔ&&N(e.ɔ)}function B(e,t){if(!le)return;let a=le.draft;if('element'!==a.type)throw Error(`"handler" extension can be used only with element nodes, got "${a.type}"`);void 0===t&&(t=e,e={});for(let e in t)if(!effector.is.unit(t[e]))throw Error(`handler for "${e}" should be event`);let{passive:n=0,capture:l=0,prevent:r=0,stop:o=0}=e;a.handler.push({options:{prevent:r,stop:o},domConfig:{passive:r?0:n,capture:l},map:t})}function V({source:e,visible:t,fn:a}){if(!le)throw Error('route() called outside from using() closure');let n=y({name:'route',isSvgRoot:0,namespace:le.namespace,env:le.env,draft:{type:'route',childTemplates:[],childCount:0,inParentIndex:-1},fn(n,{mount:l,unmount:r}){let o=e.map(e=>({value:e,visible:t(e)})),i={type:'route',childTemplates:[],childCount:0,inParentIndex:-1},s=y({name:'route item',isSvgRoot:0,namespace:le.namespace,env:le.env,draft:i,state:{store:null},fn({store:e},{mount:t,unmount:n}){let l=effector.createEvent();e.on(l,(e,t)=>t),a({store:e});let r=effector.sample({source:t,clock:o,fn:({leaf:e,node:t},{visible:a,value:n})=>({leaf:e,visible:a,node:t,value:n}),greedy:1});t.watch(({leaf:e,node:t})=>{let a=e.data;a.block.child.visible=1,A(i,{parentBlockFragment:a.block.child.child,leaf:e,node:t})}),r.watch(({leaf:e,visible:t,value:a})=>{e.data.block.child.visible=t,t&&effector.launch({target:l,params:a,defer:1,page:e.spawn,forkPage:e.forkPage}),L(t,e)}),j({unmountSelf:1,mount:t,unmount:n})}});$(s);let{onMount:u,onState:c}=H({mount:l,state:o,onMount:({visible:e,value:t},{leaf:a,node:n})=>({leaf:a,visible:e,node:n,value:t}),onState:({leaf:e,node:t},{visible:a,value:n})=>({leaf:e,visible:a,node:t,value:n})});effector.merge([u,c]).watch(({leaf:e,visible:t,value:a,node:n})=>{let l=e.data;l.block.child.visible=t,t&&!l.initialized&&(D({parentBlockFragment:l.block.child.child,leaf:e,node:n,actor:s,values:{store:a}}),l.initialized=1)}),j({unmountSelf:1,mount:l,unmount:r})}});$(n)}function L(e,t){let a=t=>{let n=t.data;switch(n.type){case'element':l(e,n.ops.visible);break;case'route':case'list':case'list item':Q(t,a);break;default:console.log('unsupported type',n.type)}};Q(t,a)}function j({unmountSelf:e=0,mount:t,unmount:a}){effector.sample({source:t,clock:a,greedy:1}).watch(e?({leaf:e})=>{_(e),z(e)}:({leaf:e})=>{_(e)})}function z({spawn:e}){W(e,e.parent.childSpawns[e.template.id]),W(e,e.template.pages)}function _(e){e.spawn.active=0,Q(e,e=>{e.api.unmount()})}function Q(e,t){let{spawn:a}=e;for(let e in a.childSpawns){let n=a.childSpawns[e];for(let e=0;e<n.length;e++)t(n[e].leaf)}}function G(e){let t='function'==typeof e?e:e.fn,a={type:'rec',childTemplates:[],childCount:0,inParentIndex:0},n=y({name:'rec',state:{store:null},isSvgRoot:0,namespace:null,env:null,draft:a,defer:1,isBlock:1,fn({store:e},{mount:n,unmount:l}){t({store:e,state:e});let r=effector.createEvent();return e.on(r,(e,t)=>t),n.watch(({node:e,leaf:t})=>{A(a,{parentBlockFragment:t.data.block.child,leaf:t,node:e})}),j({mount:n,unmount:l}),{itemUpdater:r}}});return({store:e,state:t=e})=>{n.deferredInit&&n.deferredInit();let{env:a,namespace:l}=le;$(y({name:'rec item',isSvgRoot:0,namespace:l,env:a,draft:{type:'recItem',childTemplates:[],childCount:0,inParentIndex:-1},fn(e,{mount:a,unmount:l}){let{onMount:r,onState:o}=H({state:t,mount:a,onMount:(e,{leaf:t,node:a})=>({state:e,leaf:t,node:a}),onState:({leaf:e,node:t},a)=>({state:a,leaf:e,node:t})});j({mount:a,unmount:l}),o.watch(({state:e,leaf:t})=>{Q(t,t=>{t.api.itemUpdater(e)})}),r.watch(({node:e,leaf:t,state:a})=>{D({parentBlockFragment:t.data.block.child,leaf:t,node:e,actor:n,values:{store:a}})})}}))}}function U(e,t){'function'==typeof t&&(effector.is.unit(e)?e={source:e,fn:t}:e.fn=t);let{fn:a,key:n,source:l,fields:r=[]}=e,o=void 0!==n?'function'==typeof n?n:e=>e[n]:(e,t)=>t,i={type:'list',key:effector.is.store(e)?{type:'index'}:{type:'key',key:e.key},childTemplates:[],childCount:0,inParentIndex:-1};if(!le)throw Error('list() called outside from using() closure');let f=le.env,d=le.namespace;$(y({name:'list',draft:i,isSvgRoot:0,namespace:d,fn(e,{mount:t,unmount:n}){let h=y({name:'list item',state:{id:-1,store:null},draft:i,isSvgRoot:0,namespace:d,fn({id:e,store:t},{mount:n,unmount:l}){a({store:t,key:e,fields:F(t,r)});let o=effector.createEvent();if(t.on(o,(e,t)=>t),effector.sample({source:n,clock:l,greedy:1}).watch(({leaf:e})=>{let t=e.data.block;W(t,t.parent.child);let a=t.left,n=t.right;a&&(a.right=n,n||t.parent.lastChild!==t||(t.parent.lastChild=a)),n&&(n.left=a),a||n||t.parent.lastChild!==t||(t.parent.lastChild=null),t.left=null,t.right=null,_(e),z(e)}),i.itemVisible){let{onMount:e,onState:t}=H({mount:n,state:i.itemVisible,onMount:(e,{node:t,leaf:a})=>({visible:e,node:t,leaf:a}),onState:({node:e,leaf:t},a)=>({visible:a,node:e,leaf:t})});e.watch(({visible:e,node:t,leaf:a})=>{let n=a.data.block;n.visible=e,n.childInitialized=e,e&&A(i,{parentBlockFragment:n.child,leaf:a,node:t})}),t.watch(({visible:e,node:t,leaf:a})=>{let n=a.data.block;n.visible=e,n.childInitialized?L(e,a):e&&(n.childInitialized=1,A(i,{parentBlockFragment:n.child,leaf:a,node:t}))})}else n.watch(({node:e,leaf:t})=>{let a=t.data.block;a.visible=1,a.childInitialized=1,A(i,{parentBlockFragment:a.child,leaf:t,node:e})});return{itemUpdater:o}},env:f}),g=effector.createStore([]),m=l.map(e=>e),v=effector.sample({source:l,clock:t,fn:(e,{node:t,leaf:a})=>({updates:e,node:t,leaf:a,hydration:a.hydration}),greedy:1}),k=effector.sample({source:v,clock:m,fn:({node:e,leaf:t},a)=>({updates:a,node:e,leaf:t,hydration:0}),greedy:1});effector.sample({source:g,clock:[v,k],greedy:1,fn(e,{node:t,updates:a,leaf:n,hydration:r}){let i=n.data.block;J('list update ['+l.shortName+']');let f=Array(a.length).fill(0),d=a.map(o),g=[];for(let t=0;t<e.length;t++){let n=e[t],l=d.indexOf(n.key);-1!==l?(g.push(n),f[l]=1,p(a[l],n.asyncValue)):(n.active=0,n.instance&&n.instance.api.unmount(),c(n.asyncValue))}for(let e=0;e<a.length;e++){if(f[e])continue;let l=a[e],o=d[e],c=s(n.ops.group.queue),p={type:'LF',parent:i,child:{type:'fragment',parent:null,child:[]},childInitialized:0,visible:0,left:null,right:null},m={type:'listItem',key:o,index:o,active:1,leafData:{type:'list item',block:p},asyncValue:u({value:l,group:c,onTerminate(e){},onChange(e){m.instance&&m.instance.api.itemUpdater(e)},onInit(e){m.active&&(r||(m.instance=S(h,{values:{id:o,store:e},parentLeaf:n,mountNode:t,svgRoot:n.svgRoot,leafData:m.leafData,opGroup:c,domSubtree:n.ops.domSubtree,hydration:r,forkPage:n.forkPage})))}})},v=g.length;g.push(m);let k=v>0?g[v-1].leafData:null;if(p.child.parent=p,i.child.push(p),k){let e=k.block;p.left=e;let t=e.right;t?(t.left=p,p.right=t):i.lastChild=p,e.right=p}else i.lastChild=p;r&&(m.instance=S(h,{values:{id:o,store:l},parentLeaf:n,mountNode:t,svgRoot:n.svgRoot,leafData:m.leafData,opGroup:c,domSubtree:n.ops.domSubtree,hydration:r,forkPage:n.forkPage}))}return K('list update ['+l.shortName+']'),0===g.length&&(i.lastChild=null),g},target:g}),effector.sample({source:t,clock:effector.sample({source:g,clock:n,greedy:1}),fn:({leaf:e},t)=>({leaf:e,records:t}),greedy:1}).watch(({leaf:e,records:t})=>{for(let e=0;e<t.length;e++){let a=t[e];a.instance&&a.instance.api.unmount(),a.active=0}e.spawn.active=0,z(e)})},env:f}))}function $(e){if(!le)return;let{draft:t}=e;if('listItem'!==t.type&&'rec'!==t.type)switch(le.draft.type){case'element':case'using':case'route':case'list':case'rec':case'recItem':case'block':case'blockItem':t.inParentIndex=le.draft.childCount,le.draft.childCount+=1,le.draft.childTemplates.push(e);break;default:console.warn("unexpected currentActor type "+le.draft.type)}}function W(e,t){if(!t)return;let a=t.indexOf(e);-1!==a&&t.splice(a,1)}function H({mount:e,state:t,onMount:a,onState:n}){return{onMount:effector.sample({source:t,clock:e,fn:a,greedy:1}),onState:effector.sample({source:e,clock:t,fn:n,greedy:1})}}Object.defineProperty(exports,'__esModule',{value:1});var effector=require('effector');let J,K,X;'undefined'!=typeof performance&&performance.mark?(J=e=>{performance.mark('☄️ '+e+' start')},K=e=>{try{performance.measure('☄️ '+e,'☄️ '+e+' start')}catch(e){}performance.clearMarks('☄️ '+e+' start'),performance.clearMeasures('☄️ '+e)}):(J=()=>{},K=()=>{}),X='undefined'!=typeof performance&&performance.now?()=>performance.now():'undefined'!=typeof process&&process.hrtime?()=>{let e=process.hrtime();return(1e9*e[0]+e[1])/1e6}:()=>Date.now();let Y='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0);const Z={attr:v,data:m,style:g,styleVar:h};let ee=0,te=0,ae=null,ne=null,le=null;const re=(e,t)=>e.reg[t.id];let oe=effector.createEvent();oe.watch(({fns:e,element:t})=>{e.forEach(e=>{e(t)})}),exports.block=({fn:e,env:t,namespace:a="html"})=>{let n={type:'block',childTemplates:[],childCount:0,inParentIndex:0},l=y({name:'block',isSvgRoot:0,namespace:a,env:t,draft:n,isBlock:1,fn({},{mount:t,unmount:a}){e(),t.watch(({node:e,leaf:t})=>{A(n,{parentBlockFragment:t.data.block.child,leaf:t,node:e})}),j({mount:t,unmount:a})}});return()=>{let e={type:'blockItem',childTemplates:[],childCount:0,inParentIndex:-1,itemOf:n},{env:t,namespace:a}=le;$(y({name:'block item',isSvgRoot:0,namespace:a,env:t,draft:e,fn(e,{mount:t,unmount:a}){j({mount:t,unmount:a}),t.watch(({node:e,leaf:t})=>{D({parentBlockFragment:t.data.block.child,leaf:t,node:e,actor:l})})}}))}},exports.h=(e,t)=>{function a(e){return e.data.block.value}function r(e,t,a){let n=e.data.block.child,l={type:'text',parent:n,visible:0,index:a,value:null};if(n.child[a]=l,e.hydration){let a=R(l);if(a)switch(a.type){case'text':l.value=e.env.document.createTextNode(t),a.value.after(l.value);break;case'element':l.value=a.value.nextSibling,k(l.value,t)}else{let e=C(l);l.value=e.firstChild,k(l.value,t)}l.visible=1}else l.value=e.env.document.createTextNode(t),E(l);return l}let i,s=0,u=0;if('function'==typeof t?(s=1,i=t):t&&(u=1,t.fn&&(s=1,i=t.fn),t.ɔ&&('function'==typeof t.ɔ?(s=1,i=t.ɔ):'function'==typeof t.ɔ.fn&&(s=1,i=t.ɔ.fn))),!le)throw Error('h() called outside from using() closure');let c,p=le.env,d=le.namespace,w=d,x='html';w=x='svg'===d?'svg':'html','svg'===e&&(x='svg',w='svg'),le.isBlock||(c='svg'===x?p.document.createElementNS('http://www.w3.org/2000/svg',e):p.document.createElement(e));let P=c,I={type:'element',tag:e,attr:[],data:[],text:[],styleProp:[],styleVar:[],handler:[],stencil:P,seq:[],staticSeq:[],childTemplates:[],childCount:0,inParentIndex:-1,opsAmount:1,node:[]};'foreignObject'===d?(I.attr.push({xmlns:'http://www.w3.org/1999/xhtml'}),w='html'):'svg'===e?(I.attr.push({xmlns:'http://www.w3.org/2000/svg'}),w='svg'):'foreignObject'===e&&(w='foreignObject');let S=y({name:'element',draft:I,isSvgRoot:'svg'===e,namespace:w,fn(e,{mount:c,unmount:p}){function d(e){return H({mount:y,state:e,onMount:(e,t)=>({leaf:t,value:e}),onState:(e,t)=>({leaf:e,value:t})})}let y=effector.createEvent(),w=c.map(({leaf:e})=>e);s&&i(),u&&N(t);let x={attr:{},data:{},text:I.text,styleProp:{},styleVar:{},visible:I.visible||null,handler:I.handler};for(let e=0;e<I.attr.length;e++){let t=I.attr[e];for(let e in t)'xlink:href'===e?x.attr.href=t[e]:x.attr[e]=t[e]}for(let e=0;e<I.data.length;e++){let t=I.data[e];for(let e in t)x.data[e]=t[e]}for(let e=0;e<I.styleProp.length;e++){let t=I.styleProp[e];for(let e in t)e.startsWith('--')?x.styleVar[e.slice(2)]=t[e]:x.styleProp[e]=t[e]}for(let e=0;e<I.styleVar.length;e++){let t=I.styleVar[e];for(let e in t)x.styleVar[e]=t[e]}x.visible&&I.seq.push({type:'visible',value:x.visible});for(let e in x.attr){let t=x.attr[e];effector.is.unit(t)?I.seq.push({type:'attr',field:e,value:t}):I.staticSeq.push({type:'attr',field:e,value:t})}for(let e in x.data){let t=x.data[e];effector.is.unit(t)?I.seq.push({type:'data',field:e,value:t}):I.staticSeq.push({type:'data',field:e,value:t})}for(let e in x.styleProp){let t=x.styleProp[e];effector.is.unit(t)?I.seq.push({type:'style',field:e,value:t}):I.staticSeq.push({type:'style',field:e,value:t})}for(let e in x.styleVar){let t=x.styleVar[e];effector.is.unit(t)?I.seq.push({type:'styleVar',field:e,value:t}):I.staticSeq.push({type:'styleVar',field:e,value:t})}for(let e=0;e<x.text.length;e++){let t=x.text[e];if(null!==t.value)if(effector.is.unit(t.value)){I.seq.push({type:'dynamicText',value:t.value,childIndex:t.index});let e=t.value.stateRef,a=ae;a.plain.includes(e)||a.closure.includes(e)||a.closure.push(e)}else I.seq.push({type:'staticText',value:String(t.value),childIndex:t.index})}for(let e=0;e<x.handler.length;e++){let t=x.handler[e];for(let e in t.map)I.seq.push({type:'handler',for:e,handler:t.map[e],options:t.options,domConfig:t.domConfig})}if(x.visible){let{onMount:e,onState:t}=H({mount:w,state:x.visible,onMount:(e,t)=>({leaf:t,value:e,hydration:t.hydration}),onState:(e,t)=>({leaf:e,value:t,hydration:0})});e.watch(({leaf:e,value:t,hydration:a})=>{let l=e.data,r=l.block;if(a&&(n(t,l.ops.visible),t)){let e,t=q(r);if(e=t?t.nextSibling:C(r).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}r.value=e,r.visible=1}A(I,{parentBlockFragment:r.child,leaf:e,node:r.value,svgRoot:S.isSvgRoot?r.value:null}),t&&l.needToCallNode&&(l.needToCallNode=0,effector.launch({target:oe,params:{element:l.block.value,fns:I.node},page:e.spawn,defer:1,forkPage:e.forkPage})),effector.launch({target:y,params:e,defer:1,page:e.spawn,forkPage:e.forkPage})}),effector.merge([t,e]).watch(({leaf:e,value:t,hydration:a})=>{a||l(t,e.data.ops.visible)})}P&&f(P,I.staticSeq);for(let e=0;e<I.seq.length;e++){let t=I.seq[e];switch(t.type){case'visible':break;case'attr':{let{field:e}=t,n='value'===e||'checked'===e||'min'===e||'max'===e,{onMount:r,onState:i}=d(t.value);if(n)effector.merge([i,r]).watch(({leaf:t,value:n})=>{v(a(t),e,n)});else{let t=I.opsAmount++;r.watch(({value:n,leaf:l})=>{let r=a(l),i=o({value:n,priority:'props',runOp(t){v(r,e,t)},group:l.ops.group});l.ops.group.ops[t]=i,v(r,e,n)}),i.watch(({value:e,leaf:a})=>{l(e,a.ops.group.ops[t])})}break}case'data':{let{field:e}=t,{onMount:n,onState:r}=d(t.value),i=I.opsAmount++;n.watch(({value:t,leaf:n})=>{let l=a(n),r=o({value:t,priority:'props',runOp(t){m(l,e,t)},group:n.ops.group});n.ops.group.ops[i]=r,m(l,e,t)}),r.watch(({value:e,leaf:t})=>{l(e,t.ops.group.ops[i])});break}case'style':{let e=I.opsAmount++,{field:n}=t,{onMount:r,onState:i}=d(t.value);r.watch(({value:t,leaf:l})=>{let r=a(l),i=o({value:t,priority:'props',runOp(e){g(r,n,e)},group:l.ops.group});l.ops.group.ops[e]=i,g(r,n,t)}),i.watch(({value:t,leaf:a})=>{l(t,a.ops.group.ops[e])});break}case'styleVar':{let{field:e}=t,{onMount:n,onState:r}=d(t.value),i=I.opsAmount++;n.watch(({value:t,leaf:n})=>{let l=a(n),r=o({value:t,priority:'props',runOp(t){h(l,e,t)},group:n.ops.group});n.ops.group.ops[i]=r,h(l,e,t)}),r.watch(({value:e,leaf:t})=>{l(e,t.ops.group.ops[i])});break}case'staticText':y.map(e=>e).watch(e=>{r(e,t.value,t.childIndex)});break;case'dynamicText':{let e=I.opsAmount++;effector.sample({source:t.value,clock:y,fn:(e,t)=>({value:String(e),leaf:t}),greedy:1}).watch(({value:a,leaf:n})=>{let l=o({value:a,priority:'props',runOp(e){k(i.value,e)},group:n.ops.group});n.ops.group.ops[e]=l;let i=r(n,a,t.childIndex)}),effector.sample({source:y,clock:t.value,fn:(e,t)=>({leaf:e,text:t}),greedy:1}).watch(({leaf:t,text:a})=>{l(a,t.ops.group.ops[e])});break}case'handler':{let e=t.handler.graphite.meta.nativeTemplate||null;y.watch(n=>{let l=null;if(e){let t=0,a=n.spawn;for(;!t&&a;)a.template===e?(t=1,l=a):a=a.parent}a(n).addEventListener(t.for,e=>{t.options.prevent&&e.preventDefault(),t.options.stop&&e.stopPropagation(),effector.launch({target:b(t.handler,n.forkPage),params:e,page:l,forkPage:n.forkPage})},t.domConfig)});break}}}effector.sample({source:w,clock:p,greedy:1}).watch(e=>{let{spawn:t}=e;W(t,t.parent.childSpawns[t.template.id]),function e(t){t.active=0,W(t,t.template.pages);for(let a in t.childSpawns)t.childSpawns[a].forEach(e)}(t),l(0,e.data.ops.visible)}),c.watch(({leaf:e})=>{let t=e.data;if(!I.visible){let a=t.ops.visible,r=t.block;if(e.hydration){n(1,a);let e,t=q(r);if(e=t?t.nextSibling:C(r).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}r.value=e,r.visible=1}A(I,{parentBlockFragment:r.child,leaf:e,node:r.value,svgRoot:S.isSvgRoot?r.value:null}),effector.launch({target:y,params:e,defer:1,page:e.spawn,forkPage:e.forkPage}),e.hydration?t.needToCallNode&&(t.needToCallNode=0,effector.launch({target:oe,params:{element:t.block.value,fns:I.node},page:e.spawn,defer:1,forkPage:e.forkPage})):l(1,a)}})},env:p});$(S)},exports.handler=B,exports.list=U,exports.node=e=>{let t=le.draft;switch(t.type){case'list':case'listItem':case'using':case'route':case'rec':case'recItem':case'block':case'blockItem':return void console.error('node() hook supported only in h() nodes')}t.node.push(e)},exports.rec=G,exports.remap=F,exports.route=V,exports.spec=N,exports.text=(e,...t)=>{let a=[e[0]];for(let n=0;n<t.length;n++)a.push(t[n],e[n+1]);N({text:a})},exports.tree=({source:e,key:t,child:a,fn:n})=>{let l=G(({store:e})=>{U({source:e,key:t,fn({store:e}){let t=e.map(e=>e[a]||[]);n({store:e,child(){l({store:t})}})}})});l({store:e})},exports.using=(e,t)=>{let a,n,l,r,o,u;if('function'==typeof t)a=t,l=M(),r=0;else{if(!t)throw Error('using() second argument is missing');a=t.fn,l=t.env?t.env:M(),r=t.hydrate,n=t.onComplete,o=t.onRoot,u=t.scope}if(!e)throw Error('using() first argument is missing');let c=e.namespaceURI,p=e.tagName.toLowerCase(),f={type:'using',childTemplates:[],childCount:0,inParentIndex:-1},d=y({name:'using',draft:f,isSvgRoot:'svg'===p,namespace:'http://www.w3.org/2000/svg'===c?'svg':'foreignobject'===p?'foreignObject':'html',fn(e,{mount:t}){a(),t.watch(({node:e,leaf:t})=>{A(f,{parentBlockFragment:t.data.block.child,leaf:t,node:e})})},env:l}),h={type:'using',child:{type:'fragment',parent:null,child:[]},value:e};h.child.parent=h;let g=i({onComplete:n}),m=S(d,{parentLeaf:ne||null,mountNode:e,svgRoot:d.isSvgRoot?e:ne?ne.svgRoot:null,leafData:{type:'using',draft:f,element:e,block:h},opGroup:s(g),domSubtree:s(g),hydration:r,refMap:O(u),forkPage:u,env:l});if(o&&o({template:d,leaf:m}),g.onDrain&&!g.rafID){let e=g.onDrain;g.onDrain=null,e()}},exports.variant=({source:e,cases:t,key:a})=>{if(!effector.is.unit(e))throw Error('variant({source}) should be unit');let n;n='function'==typeof a?a:null==a?e=>String(e):e=>String(e[a]);let l=0;for(let a in t)'__'!==a?V({source:e,visible:e=>n(e)===a,fn:t[a]}):l=1;if(l){let a=Object.keys(t);V({source:e,visible:e=>!a.includes(n(e)),fn:t.__})}};
function e(e,t){e.cursor[t].prev&&(e.cursor[t].prev.cursor[t].next=e.cursor[t].next),e.cursor[t].next&&(e.cursor[t].next.cursor[t].prev=e.cursor[t].prev),e.queue[t].last===e&&(e.queue[t].last=e.cursor[t].prev),e.queue[t].first===e&&(e.queue[t].first=e.cursor[t].next),e.cursor[t].prev=null,e.cursor[t].next=null}function t(e){var t,n;e.status='active',t=a(e),(n=e).cursor.prev&&(n.cursor.prev.cursor.next=n.cursor.next),n.cursor.next&&(n.cursor.next.cursor.prev=n.cursor.prev),t.last===n&&(t.last=n.cursor.prev),t.first===n&&(t.first=n.cursor.next),n.cursor.prev=null,n.cursor.next=null}function a(e){return e.group.activeChilds[e.priority]}function n(e,a){a.value.active=a.value.pending=e,'active'!==a.status&&t(a)}function l(n,l){if(l.value.active===n)return l.value.pending=n,void('pending'===l.status&&(t(l),a(l).first||e(l.group,l.priority)));var r,o,i,s;'active'===l.status&&(l.status='pending',a(l).first||((i=l.group).queue[s=l.priority].last?(i.cursor[s].prev=i.queue[s].last,i.queue[s].last.cursor[s].next=i,i.queue[s].last=i):i.queue[s].first=i.queue[s].last=i),o=l,(r=a(l)).last?(o.cursor.prev=r.last,r.last.cursor.next=o,r.last=o):r.first=r.last=o),l.value.pending=n,l.group.queue.rafID||(l.group.queue.rafID=Y(l.group.queue.execQueue))}function r(a){J('execQueue');let n,l,r=X(),o=0;e:for(;a.props.first||a.tree.first||a.data.first;){if(X()-r>=10){o=1;break e}let i=!!a.props.first;for(i&&J('props');n=a.props.first;){for(;l=n.activeChilds.props.first;){if(X()-r>=10){o=1,K('props');break e}l.runOp(l.value.pending),l.value.active=l.value.pending,t(l)}e(n,'props')}i&&K('props');let s=!!a.tree.first;for(s&&J('tree');n=a.tree.first;){for(;l=n.activeChilds.tree.first;){if(X()-r>=10){o=1,K('tree');break e}l.runOp(l.value.pending),l.value.active=l.value.pending,t(l)}e(n,'tree')}s&&K('tree');let u=!!a.data.first;for(u&&J('data');n=a.data.first;){for(;l=n.activeChilds.data.first;){if(X()-r>=10){o=1,K('data');break e}l.runOp(l.value.pending),l.value.active=l.value.pending,t(l)}e(n,'data')}u&&K('data')}if(K('execQueue'),o)a.rafID=Y(a.execQueue);else if(a.rafID=null,a.onDrain){let e=a.onDrain;a.onDrain=null,e()}}function o({value:e,runOp:t,group:a,priority:n}){return{value:{active:e,pending:e},runOp:t,status:'active',priority:n,group:a,cursor:{prev:null,next:null}}}function i({onComplete:e}){let t={props:{first:null,last:null},tree:{first:null,last:null},data:{first:null,last:null},rafID:null,execQueue(){},onDrain:e};return t.execQueue=r.bind(null,t),t}function s(e){return{ops:[],queue:e,activeChilds:{props:{first:null,last:null},tree:{first:null,last:null},data:{first:null,last:null}},cursor:{props:{prev:null,next:null},tree:{prev:null,next:null},data:{prev:null,next:null}}}}function u({value:e,group:t,onInit:a,onChange:n,onTerminate:r}){let i=o({value:e,group:t,runOp(e){s.status='A',n(e)},priority:'data'}),s={status:'IA',value:i.value,hooks:{onTerminate:r},ops:{init:o({value:0,group:t,runOp(e){s.status='A',a(s.value.active)},priority:'data'}),change:i,terminate:o({value:0,group:t,runOp(e){s.status='T',s.hooks.onTerminate(1)},priority:'data'})}};return l(1,s.ops.init),s}function c(e){switch(e.status){case'I':case'T':case'AT':return;case'A':e.status='AT',l(1,e.ops.terminate);break;case'AA':e.status='AT',l(1,e.ops.terminate),l(e.value.active,e.ops.change);break;case'IA':e.status='T',l(0,e.ops.init),e.hooks.onTerminate(0)}}function p(e,t){switch(t.status){case'I':case'T':return;case'A':t.value.active!==e&&(t.status='AA',l(e,t.ops.change));break;case'AA':t.value.active===e?(t.status='A',l(e,t.ops.change)):t.value.pending!==e&&(t.value.pending=e);break;case'IA':t.value.active=t.value.pending=e}}function f(e,t){for(let a=0;a<t.length;a++){let{type:n,field:l,value:r}=t[a];Z[n](e,l,r)}}function d(e){return''!==e&&0!==e&&'0'!==e&&(0==e||null==e)}function h(e,t,a){d(a)?e.style.removeProperty("--"+t):e.style.setProperty("--"+t,""+a)}function g(e,t,a){d(a)?delete e.style[t]:e.style[t]=""+a}function m(e,t,a){d(a)?delete e.dataset[t]:e.dataset[t]=""+a}function v(e,t,a){if(d(a)){switch(t){case'value':delete e.value;break;case'checked':e.checked=0;break;case'spellcheck':if(0==a)return void e.setAttribute('spellcheck','false')}e.removeAttribute(t)}else{switch(t){case'value':e.value=""+a;break;case'checked':e.checked=""+a}e.setAttribute(t,""+a)}}function k(e,t){e.replaceData(0,(e.textContent||'').length,String(t))}function y({fn:e,state:t={},defer:a=0,name:n="",draft:l,isSvgRoot:r,namespace:o,env:i,isBlock:s=0}){let u=le,c=ae,p={id:++ee,name:n,plain:[],watch:[],nameMap:{},pages:[],closure:[],childTemplates:[],upward:effector.step.filter({fn(e,t,a){if(!a.page){if(!a.parent||!a.parent.page)return 1;a.page=a.parent.page}if(!a.page.active)return 0;let n=[a.page.template],l=[a.page];{let e=a.page.parent;for(;e;)l.push(e),n.push(e.template),e=e.parent}return a.node.next.forEach(t=>{let r=t.meta.nativeTemplate;r?n.includes(r)?effector.launch({target:b(t,a.forkPage),params:e,defer:1,page:l[n.indexOf(r)],stack:a,forkPage:a.forkPage}):console.error('context drift',{stack:a,node:t}):effector.launch({target:b(t,a.forkPage),params:e,defer:1,page:null,stack:a,forkPage:a.forkPage})}),0}}),loader:effector.step.filter({fn(e,t,a){if(a.parent){let n=a.forkPage?a.forkPage.graphite.id:null;if(a.page){if(!a.page.active)return 0;if(a.page.template===p)return 1;if(a.page.childSpawns[p.id])a.page.childSpawns[p.id].forEach(t=>{(!n||t.leaf.forkPage&&n===t.leaf.forkPage.graphite.id)&&effector.launch({params:e,target:b(a.node,a.forkPage),page:t,defer:1,forkPage:a.forkPage})});else if(t.targetTemplate){let n=[a.page];{let e=a.page.parent;for(;e;)n.push(e),e=e.parent}let l=n.findIndex(e=>t.targetTemplate===e.template);effector.launch(-1===l?{params:e,target:b(a.node,a.forkPage),page:null,defer:1,forkPage:a.forkPage}:{params:e,target:b(a.node,a.forkPage),page:n[l],defer:1,forkPage:a.forkPage})}else p.pages.forEach(t=>{(!n||t.leaf.forkPage&&n===t.leaf.forkPage.graphite.id)&&t.fullID.startsWith(a.page.fullID)&&effector.launch({params:e,target:b(a.node,a.forkPage),page:t,defer:1,forkPage:a.forkPage})})}else p.pages.forEach(t=>{(!n||t.leaf.forkPage&&n===t.leaf.forkPage.graphite.id)&&effector.launch({params:e,target:b(a.node,a.forkPage),page:t,defer:1,forkPage:a.forkPage})});return 0}return 1}}),parent:c};c&&c.childTemplates.push(p);let f=effector.createNode({meta:{template:p}});ae=p;let d=le={template:p,node:f,api:null,trigger:{mount:effector.createEvent(),unmount:effector.createEvent()},draft:l,isSvgRoot:r,namespace:o,env:i,isBlock:s||!(!u||!u.isBlock)};return a?d.deferredInit=()=>{let a=le,n=ae;le=d,ae=p,d.deferredInit=null;try{effector.withRegion(f,()=>{let a=effector.restore(t);d.api=e(a,d.trigger),p.nameMap=a})}finally{le=a,ae=n}}:effector.withRegion(f,()=>{let a=effector.restore(t);d.api=e(a,d.trigger),p.nameMap=a}),le=u,ae=c,p.actor=d,d}function b(e,t){return t&&t.nodeMap[(e=e.graphite||e).id]||e}function w(e,t){let a=e;switch(t&&re(t,e)&&(a=re(t,e)),e.type){case'list':return[...a.current];case'shape':return{...a.current};default:return a.current}}function x(e,t,a){let n=t;for(;n&&!re(n.spawn,e);)n=n.parentLeaf;return n?re(n.spawn,e):a&&re(a,e)?re(a,e):e}function P(e,t,a){return x(e,t,a).current}function I(e,t){re(t.spawn,e)||(t.spawn.reg[e.id]=x(e,t.parentLeaf,t.forkPage))}function S(e,{values:t={},parentLeaf:a,mountNode:n,svgRoot:l,leafData:r,opGroup:o,domSubtree:i,hydration:s,forkPage:u,env:c}){function p(e){if(e.before)for(let t=0;t<e.before.length;t++){let a=e.before[t];switch(a.type){case'map':{let t=a.from;I(t,k),g[e.id].current=a.fn(g[t.id].current);break}case'field':{let t=a.from;I(t,k),g[e.id].current[a.field]=g[t.id].current;break}case'closure':I(a.of,k)}}if(!e.after)return;let t=g[e.id].current;for(let a=0;a<e.after.length;a++){let n=e.after[a],l=n.to;switch(g[l.id]||(g[l.id]={id:l.id,current:P(l,k.parentLeaf,u)}),n.type){case'copy':g[l.id].current=t;break;case'map':g[l.id].current=n.fn(t)}}}function f(e,t,a){let n;t.stop=1;try{for(;t.i<e.length;)n=e[t.i],t.i++,n.fn(a[n.of.id]?a[n.of.id].current:P(n.of,k.parentLeaf,u))}catch(e){console.error(e),t.stop=0}}!c&&a&&(c=a.env);let d=a?a.spawn:null,h=e.template,g={},m={id:++te,fullID:'',reg:g,template:h,parent:d,childSpawns:{},active:1};h.pages.push(m);let v={},k={actor:e,spawn:m,api:v,draft:e.draft,ops:{group:o,domSubtree:i},svgRoot:l,data:r,parentLeaf:a,hydration:s,forkPage:u,env:c},y=ne;ne=k,d&&(d.childSpawns[h.id]||(d.childSpawns[h.id]=[]),d.childSpawns[h.id].push(m)),m.fullID=d?`${d.fullID}_${m.id}`:""+m.id;for(let e=0;e<h.closure.length;e++){let t=h.closure[e],a=t,n=m.parent;e:for(;n;){if(re(n,t)){a=re(n,t);break e}n=n.parent}!n&&u&&re(u,t)&&(a=re(u,t)),g[t.id]=a}for(let e=0;e<h.plain.length;e++){let t=h.plain[e],a={id:t.id,current:w(t,u)};g[t.id]=a}for(let e in t){let a=h.nameMap[e].stateRef.id;g[a]={id:a,current:t[e]}}h.closure.forEach(p),h.plain.forEach(p);let b={i:0,stop:0};for(;!b.stop;)f(h.watch,b,g);if(d)for(let e in m.childSpawns)e in d.childSpawns||(d.childSpawns[e]=[]),d.childSpawns[e].push(...m.childSpawns[e]);if(v.mount=(t,a=1)=>effector.launch({target:e.trigger.mount,params:t,defer:a,page:m,forkPage:u}),v.unmount=(t,a=1)=>effector.launch({target:e.trigger.unmount,params:t,defer:a,page:m,forkPage:u}),e.api)for(let t in e.api)v[t]=(a,n=1)=>effector.launch({target:e.api[t],params:a,defer:n,page:m,forkPage:u});return k.spawn.api=v,k.spawn.leaf=k,k.api.mount({node:n,leaf:k}),ne=y,k}function C(e){let t=function e(t){switch(t.type){case'using':return t;case'fragment':switch(t.parent.type){case'element':case'using':return t.parent}default:return e((e=>{switch(e.type){case'text':case'element':case'list':case'route':case'rec':case'recItem':case'block':case'blockItem':return e.parent;default:switch(e.parent.type){case'using':case'block':return e.parent;default:return e.parent.parent}}})(t))}}(e);return t?t.value:null}function T(e){if(!e.visible)return null;switch(e.type){case'text':case'element':return e;case'route':return T(e.child);case'LF':case'RF':case'FF':case'rec':case'recItem':case'block':case'blockItem':return(e=>{let t=e.child;for(let e=t.length-1;e>=0;e--){let a=T(t[e]);if(a)return a}return null})(e.child);case'list':{let t=e.lastChild;if(!t)return null;for(;t;){let e=T(t);if(e)return e;t=t.left}return null}default:return null}}function R(e){switch(e.type){case'fragment':switch(e.parent.type){case'element':case'using':return null;case'RF':{let t=e.parent.parent,a=t.parent;for(let e=t.index-1;e>=0;e--){let t=T(a.child[e]);if(t)return t}return R(a)}case'rec':case'recItem':case'block':case'blockItem':case'FF':{let t=e.parent,a=t.parent;for(let e=t.index-1;e>=0;e--){let t=T(a.child[e]);if(t)return t}return R(a)}case'LF':{let t=e.parent.left;for(;t;){let e=T(t);if(e)return e;t=t.left}return R(e.parent.parent)}default:return null}case'element':case'text':case'route':case'rec':case'recItem':case'block':case'blockItem':case'list':{let t=e.parent;for(let a=e.index-1;a>=0;a--){let e=t.child[a];if(!e)continue;let n=T(e);if(n)return n}return R(t)}default:return null}}function q(e){let t=R(e);return t?t.value:null}function A(e,{parentBlockFragment:t,leaf:a,node:n,svgRoot:l,values:r}){e.childTemplates.forEach(e=>{D({parentBlockFragment:t,leaf:a,node:n,svgRoot:l,values:r,actor:e})})}function D({parentBlockFragment:e,leaf:t,node:a,actor:n,svgRoot:l,values:r}){let i,{draft:u}=n,{queue:c}=t.ops.group,p=s(c),d=t.ops.domSubtree,h=d;switch(u.type){case'route':{let t={type:'route',parent:e,child:{type:'RF',parent:null,child:{type:'fragment',parent:null,child:[]},visible:0},visible:1,index:u.inParentIndex};t.child.parent=t,t.child.child.parent=t.child,e.child[u.inParentIndex]=t,i={type:'route',block:t,ops:{},initialized:0};break}case'element':{let a;if(n.isBlock){let e,n,l=t;for(;l&&(!n||!e);){l.actor.env&&(e=l.actor.env);let{draft:t}=l;'element'===t.type&&('svg'===t.tag?n='svg':'foreignObject'===t.tag&&(n='html')),l=l.parentLeaf}n||(n='html'),e&&(a='svg'===n?e.document.createElementNS('http://www.w3.org/2000/svg',u.tag):e.document.createElement(u.tag),f(a,u.staticSeq))}else a=u.stencil.cloneNode();let l={type:'element',parent:e,child:{type:'fragment',parent:null,child:[]},value:a,visible:0,index:u.inParentIndex};l.child.parent=l,e.child[u.inParentIndex]=l,i={type:'element',block:l,ops:{visible:o({value:0,priority:'tree',runOp(e){e?(E(l),i.needToCallNode&&(i.needToCallNode=0,effector.launch({target:oe,params:{element:l.value,fns:u.node},page:g.spawn,forkPage:t.forkPage}))):(l.value.remove(),l.visible=0)},group:d})},needToCallNode:u.node.length>0},h=s(c);break}case'list':{let t={type:'list',parent:e,child:[],lastChild:null,visible:1,index:u.inParentIndex};e.child[u.inParentIndex]=t,i={type:'list',draft:u,block:t};break}case'using':case'listItem':break;case'rec':{let t={type:'rec',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:u.inParentIndex};t.child.parent=t,e.child[u.inParentIndex]=t,i={type:'rec',block:t};break}case'recItem':{let t={type:'recItem',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:u.inParentIndex};t.child.parent=t,e.child[u.inParentIndex]=t,i={type:'rec item',block:t};break}case'block':{let t={type:'block',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:0};t.child.parent=t,e.child[u.inParentIndex]=t,i={type:'block',block:t};break}case'blockItem':{let t={type:'blockItem',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:u.inParentIndex};t.child.parent=t,e.child[u.inParentIndex]=t,i={type:'block item',block:t};break}default:console.warn("unexpected draft type "+u.type)}let g=S(n,{values:r,parentLeaf:t,mountNode:a,svgRoot:l||t.svgRoot,leafData:i,opGroup:p,domSubtree:h,hydration:t.hydration,forkPage:t.forkPage})}function E(e){let t=q(e);t?t.after(e.value):C(e).prepend(e.value),e.visible=1}function F(e,t){if(Array.isArray(t))return t.map(t=>e.map(e=>e[t]));if('object'==typeof t&&null!==t){let a={};for(let n in t){let l=t[n];a[n]=e.map('function'==typeof l?e=>l(e):e=>e[l])}return a}return e.map(e=>e[t])}function M(){if('undefined'!=typeof document)return{document};throw Error('your environment has no document')}function O(e){if(e){if(!e.nodeMap){let t={};for(let a=0;a<e.clones.length;a++){let n=e.clones[a];t[n.meta.forkOf.id]=n}e.nodeMap=t}return e.reg}}function N(e){let t=le.draft;switch(t.type){case'list':return void(e.visible&&(t.itemVisible=e.visible));case'listItem':case'using':case'route':case'rec':case'recItem':case'block':case'blockItem':return}if(e.attr&&t.attr.push(e.attr),e.data&&t.data.push(e.data),'text'in e){let a=e.text,n=t.childCount;Array.isArray(a)?(t.text.push(...a.map((e,t)=>({index:t+n,value:e}))),t.childCount+=a.length):(t.text.push({index:n,value:a}),t.childCount+=1)}if(e.style&&t.styleProp.push(e.style),e.styleVar&&t.styleVar.push(e.styleVar),e.visible&&(t.visible=e.visible),e.handler){let t=e.handler;'object'==typeof t.on?B(t.config||{},t.on):B(t)}e.ɔ&&N(e.ɔ)}function B(e,t){if(!le)return;let a=le.draft;if('element'!==a.type)throw Error(`"handler" extension can be used only with element nodes, got "${a.type}"`);void 0===t&&(t=e,e={});for(let e in t)if(!effector.is.unit(t[e]))throw Error(`handler for "${e}" should be event`);let{passive:n=0,capture:l=0,prevent:r=0,stop:o=0}=e;a.handler.push({options:{prevent:r,stop:o},domConfig:{passive:r?0:n,capture:l},map:t})}function V({source:e,visible:t,fn:a}){if(!le)throw Error('route() called outside from using() closure');let n=y({name:'route',isSvgRoot:0,namespace:le.namespace,env:le.env,draft:{type:'route',childTemplates:[],childCount:0,inParentIndex:-1},fn(n,{mount:l,unmount:r}){let o=e.map(e=>({value:e,visible:t(e)})),i={type:'route',childTemplates:[],childCount:0,inParentIndex:-1},s=y({name:'route item',isSvgRoot:0,namespace:le.namespace,env:le.env,draft:i,state:{store:null},fn({store:e},{mount:t,unmount:n}){let l=effector.createEvent();e.on(l,(e,t)=>t),a({store:e});let r=effector.sample({source:t,clock:o,fn:({leaf:e,node:t},{visible:a,value:n})=>({leaf:e,visible:a,node:t,value:n}),greedy:1});t.watch(({leaf:e,node:t})=>{let a=e.data;a.block.child.visible=1,A(i,{parentBlockFragment:a.block.child.child,leaf:e,node:t})}),r.watch(({leaf:e,visible:t,value:a})=>{e.data.block.child.visible=t,t&&effector.launch({target:l,params:a,defer:1,page:e.spawn,forkPage:e.forkPage}),L(t,e)}),j({unmountSelf:1,mount:t,unmount:n})}});$(s);let{onMount:u,onState:c}=H({mount:l,state:o,onMount:({visible:e,value:t},{leaf:a,node:n})=>({leaf:a,visible:e,node:n,value:t}),onState:({leaf:e,node:t},{visible:a,value:n})=>({leaf:e,visible:a,node:t,value:n})});effector.merge([u,c]).watch(({leaf:e,visible:t,value:a,node:n})=>{let l=e.data;l.block.child.visible=t,t&&!l.initialized&&(D({parentBlockFragment:l.block.child.child,leaf:e,node:n,actor:s,values:{store:a}}),l.initialized=1)}),j({unmountSelf:1,mount:l,unmount:r})}});$(n)}function L(e,t){let a=t=>{let n=t.data;switch(n.type){case'element':l(e,n.ops.visible);break;case'route':case'list':case'list item':Q(t,a);break;default:console.log('unsupported type',n.type)}};Q(t,a)}function j({unmountSelf:e=0,mount:t,unmount:a}){effector.sample({source:t,clock:a,greedy:1}).watch(e?({leaf:e})=>{_(e),z(e)}:({leaf:e})=>{_(e)})}function z({spawn:e}){W(e,e.parent.childSpawns[e.template.id]),W(e,e.template.pages)}function _(e){e.spawn.active=0,Q(e,e=>{e.api.unmount()})}function Q(e,t){let{spawn:a}=e;for(let e in a.childSpawns){let n=a.childSpawns[e];for(let e=0;e<n.length;e++)t(n[e].leaf)}}function G(e){let t='function'==typeof e?e:e.fn,a={type:'rec',childTemplates:[],childCount:0,inParentIndex:0},n=y({name:'rec',state:{store:null},isSvgRoot:0,namespace:null,env:null,draft:a,defer:1,isBlock:1,fn({store:e},{mount:n,unmount:l}){t({store:e,state:e});let r=effector.createEvent();return e.on(r,(e,t)=>t),n.watch(({node:e,leaf:t})=>{A(a,{parentBlockFragment:t.data.block.child,leaf:t,node:e})}),j({mount:n,unmount:l}),{itemUpdater:r}}});return({store:e,state:t=e})=>{n.deferredInit&&n.deferredInit();let{env:a,namespace:l}=le;$(y({name:'rec item',isSvgRoot:0,namespace:l,env:a,draft:{type:'recItem',childTemplates:[],childCount:0,inParentIndex:-1},fn(e,{mount:a,unmount:l}){let{onMount:r,onState:o}=H({state:t,mount:a,onMount:(e,{leaf:t,node:a})=>({state:e,leaf:t,node:a}),onState:({leaf:e,node:t},a)=>({state:a,leaf:e,node:t})});j({mount:a,unmount:l}),o.watch(({state:e,leaf:t})=>{Q(t,t=>{t.api.itemUpdater(e)})}),r.watch(({node:e,leaf:t,state:a})=>{D({parentBlockFragment:t.data.block.child,leaf:t,node:e,actor:n,values:{store:a}})})}}))}}function U(e,t){'function'==typeof t&&(effector.is.unit(e)?e={source:e,fn:t}:e.fn=t);let{fn:a,key:n,source:l,fields:r=[]}=e,o=void 0!==n?'function'==typeof n?n:e=>e[n]:(e,t)=>t,i={type:'list',key:effector.is.store(e)?{type:'index'}:{type:'key',key:e.key},childTemplates:[],childCount:0,inParentIndex:-1};if(!le)throw Error('list() called outside from using() closure');let f=le.env,d=le.namespace;$(y({name:'list',draft:i,isSvgRoot:0,namespace:d,fn(e,{mount:t,unmount:n}){let h=y({name:'list item',state:{id:-1,store:null},draft:i,isSvgRoot:0,namespace:d,fn({id:e,store:t},{mount:n,unmount:l}){a({store:t,key:e,fields:F(t,r)});let o=effector.createEvent();if(t.on(o,(e,t)=>t),effector.sample({source:n,clock:l,greedy:1}).watch(({leaf:e})=>{let t=e.data.block;W(t,t.parent.child);let a=t.left,n=t.right;a&&(a.right=n,n||t.parent.lastChild!==t||(t.parent.lastChild=a)),n&&(n.left=a),a||n||t.parent.lastChild!==t||(t.parent.lastChild=null),t.left=null,t.right=null,_(e),z(e)}),i.itemVisible){let{onMount:e,onState:t}=H({mount:n,state:i.itemVisible,onMount:(e,{node:t,leaf:a})=>({visible:e,node:t,leaf:a}),onState:({node:e,leaf:t},a)=>({visible:a,node:e,leaf:t})});e.watch(({visible:e,node:t,leaf:a})=>{let n=a.data.block;n.visible=e,n.childInitialized=e,e&&A(i,{parentBlockFragment:n.child,leaf:a,node:t})}),t.watch(({visible:e,node:t,leaf:a})=>{let n=a.data.block;n.visible=e,n.childInitialized?L(e,a):e&&(n.childInitialized=1,A(i,{parentBlockFragment:n.child,leaf:a,node:t}))})}else n.watch(({node:e,leaf:t})=>{let a=t.data.block;a.visible=1,a.childInitialized=1,A(i,{parentBlockFragment:a.child,leaf:t,node:e})});return{itemUpdater:o}},env:f}),g=effector.createStore([]),m=l.map(e=>e),v=effector.sample({source:l,clock:t,fn:(e,{node:t,leaf:a})=>({updates:e,node:t,leaf:a,hydration:a.hydration}),greedy:1}),k=effector.sample({source:v,clock:m,fn:({node:e,leaf:t},a)=>({updates:a,node:e,leaf:t,hydration:0}),greedy:1});effector.sample({source:g,clock:[v,k],greedy:1,fn(e,{node:t,updates:a,leaf:n,hydration:r}){let i=n.data.block;J('list update ['+l.shortName+']');let f=Array(a.length).fill(0),d=a.map(o),g=[];for(let t=0;t<e.length;t++){let n=e[t],l=d.indexOf(n.key);-1!==l?(g.push(n),f[l]=1,p(a[l],n.asyncValue)):(n.active=0,n.instance&&n.instance.api.unmount(),c(n.asyncValue))}for(let e=0;e<a.length;e++){if(f[e])continue;let l=a[e],o=d[e],c=s(n.ops.group.queue),p={type:'LF',parent:i,child:{type:'fragment',parent:null,child:[]},childInitialized:0,visible:0,left:null,right:null},m={type:'listItem',key:o,index:o,active:1,leafData:{type:'list item',block:p},asyncValue:u({value:l,group:c,onTerminate(e){},onChange(e){m.instance&&m.instance.api.itemUpdater(e)},onInit(e){m.active&&(r||(m.instance=S(h,{values:{id:o,store:e},parentLeaf:n,mountNode:t,svgRoot:n.svgRoot,leafData:m.leafData,opGroup:c,domSubtree:n.ops.domSubtree,hydration:r,forkPage:n.forkPage})))}})},v=g.length;g.push(m);let k=v>0?g[v-1].leafData:null;if(p.child.parent=p,i.child.push(p),k){let e=k.block;p.left=e;let t=e.right;t?(t.left=p,p.right=t):i.lastChild=p,e.right=p}else i.lastChild=p;r&&(m.instance=S(h,{values:{id:o,store:l},parentLeaf:n,mountNode:t,svgRoot:n.svgRoot,leafData:m.leafData,opGroup:c,domSubtree:n.ops.domSubtree,hydration:r,forkPage:n.forkPage}))}return K('list update ['+l.shortName+']'),0===g.length&&(i.lastChild=null),g},target:g}),effector.sample({source:t,clock:effector.sample({source:g,clock:n,greedy:1}),fn:({leaf:e},t)=>({leaf:e,records:t}),greedy:1}).watch(({leaf:e,records:t})=>{for(let e=0;e<t.length;e++){let a=t[e];a.instance&&a.instance.api.unmount(),a.active=0}e.spawn.active=0,z(e)})},env:f}))}function $(e){if(!le)return;let{draft:t}=e;if('listItem'!==t.type&&'rec'!==t.type)switch(le.draft.type){case'element':case'using':case'route':case'list':case'rec':case'recItem':case'block':case'blockItem':t.inParentIndex=le.draft.childCount,le.draft.childCount+=1,le.draft.childTemplates.push(e);break;default:console.warn("unexpected currentActor type "+le.draft.type)}}function W(e,t){if(!t)return;let a=t.indexOf(e);-1!==a&&t.splice(a,1)}function H({mount:e,state:t,onMount:a,onState:n}){return{onMount:effector.sample({source:t,clock:e,fn:a,greedy:1}),onState:effector.sample({source:e,clock:t,fn:n,greedy:1})}}Object.defineProperty(exports,'__esModule',{value:1});var effector=require('effector');let J,K,X;'undefined'!=typeof performance&&performance.mark?(J=e=>{performance.mark('☄️ '+e+' start')},K=e=>{try{performance.measure('☄️ '+e,'☄️ '+e+' start')}catch(e){}performance.clearMarks('☄️ '+e+' start'),performance.clearMeasures('☄️ '+e)}):(J=()=>{},K=()=>{}),X='undefined'!=typeof performance&&performance.now?()=>performance.now():'undefined'!=typeof process&&process.hrtime?()=>{let e=process.hrtime();return(1e9*e[0]+e[1])/1e6}:()=>Date.now();let Y='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0);const Z={attr:v,data:m,style:g,styleVar:h};let ee=0,te=0,ae=null,ne=null,le=null;const re=(e,t)=>e.reg[t.id];let oe=effector.createEvent();oe.watch(({fns:e,element:t})=>{e.forEach(e=>{e(t)})}),exports.block=({fn:e,env:t,namespace:a="html"})=>{let n={type:'block',childTemplates:[],childCount:0,inParentIndex:0},l=y({name:'block',isSvgRoot:0,namespace:a,env:t,draft:n,isBlock:1,fn({},{mount:t,unmount:a}){e(),t.watch(({node:e,leaf:t})=>{A(n,{parentBlockFragment:t.data.block.child,leaf:t,node:e})}),j({mount:t,unmount:a})}});return()=>{let e={type:'blockItem',childTemplates:[],childCount:0,inParentIndex:-1,itemOf:n},{env:t,namespace:a}=le;$(y({name:'block item',isSvgRoot:0,namespace:a,env:t,draft:e,fn(e,{mount:t,unmount:a}){j({mount:t,unmount:a}),t.watch(({node:e,leaf:t})=>{D({parentBlockFragment:t.data.block.child,leaf:t,node:e,actor:l})})}}))}},exports.h=(e,t)=>{function a(e){return e.data.block.value}function r(e,t,a){let n=e.data.block.child,l={type:'text',parent:n,visible:0,index:a,value:null};if(n.child[a]=l,e.hydration){let a=R(l);if(a)switch(a.type){case'text':l.value=e.env.document.createTextNode(t),a.value.after(l.value);break;case'element':l.value=a.value.nextSibling,k(l.value,t)}else{let e=C(l);l.value=e.firstChild,k(l.value,t)}l.visible=1}else l.value=e.env.document.createTextNode(t),E(l);return l}let i,s=0,u=0;if('function'==typeof t?(s=1,i=t):t&&(u=1,t.fn&&(s=1,i=t.fn),t.ɔ&&('function'==typeof t.ɔ?(s=1,i=t.ɔ):'function'==typeof t.ɔ.fn&&(s=1,i=t.ɔ.fn))),!le)throw Error('h() called outside from using() closure');let c,p=le.env,d=le.namespace,w=d,x='html';w=x='svg'===d?'svg':'html','svg'===e&&(x='svg',w='svg'),le.isBlock||(c='svg'===x?p.document.createElementNS('http://www.w3.org/2000/svg',e):p.document.createElement(e));let P=c,I={type:'element',tag:e,attr:[],data:[],text:[],styleProp:[],styleVar:[],handler:[],stencil:P,seq:[],staticSeq:[],childTemplates:[],childCount:0,inParentIndex:-1,opsAmount:1,node:[]};'foreignObject'===d?(I.attr.push({xmlns:'http://www.w3.org/1999/xhtml'}),w='html'):'svg'===e?(I.attr.push({xmlns:'http://www.w3.org/2000/svg'}),w='svg'):'foreignObject'===e&&(w='foreignObject');let S=y({name:'element',draft:I,isSvgRoot:'svg'===e,namespace:w,fn(e,{mount:c,unmount:p}){function d(e){return H({mount:y,state:e,onMount:(e,t)=>({leaf:t,value:e}),onState:(e,t)=>({leaf:e,value:t})})}let y=effector.createEvent(),w=c.map(({leaf:e})=>e);s&&i(),u&&N(t);let x={attr:{},data:{},text:I.text,styleProp:{},styleVar:{},visible:I.visible||null,handler:I.handler};for(let e=0;e<I.attr.length;e++){let t=I.attr[e];for(let e in t)'xlink:href'===e?x.attr.href=t[e]:x.attr[e]=t[e]}for(let e=0;e<I.data.length;e++){let t=I.data[e];for(let e in t)x.data[e]=t[e]}for(let e=0;e<I.styleProp.length;e++){let t=I.styleProp[e];for(let e in t)e.startsWith('--')?x.styleVar[e.slice(2)]=t[e]:x.styleProp[e]=t[e]}for(let e=0;e<I.styleVar.length;e++){let t=I.styleVar[e];for(let e in t)x.styleVar[e]=t[e]}x.visible&&I.seq.push({type:'visible',value:x.visible});for(let e in x.attr){let t=x.attr[e];effector.is.unit(t)?I.seq.push({type:'attr',field:e,value:t}):I.staticSeq.push({type:'attr',field:e,value:t})}for(let e in x.data){let t=x.data[e];effector.is.unit(t)?I.seq.push({type:'data',field:e,value:t}):I.staticSeq.push({type:'data',field:e,value:t})}for(let e in x.styleProp){let t=x.styleProp[e];effector.is.unit(t)?I.seq.push({type:'style',field:e,value:t}):I.staticSeq.push({type:'style',field:e,value:t})}for(let e in x.styleVar){let t=x.styleVar[e];effector.is.unit(t)?I.seq.push({type:'styleVar',field:e,value:t}):I.staticSeq.push({type:'styleVar',field:e,value:t})}for(let e=0;e<x.text.length;e++){let t=x.text[e];if(null!==t.value)if(effector.is.unit(t.value)){I.seq.push({type:'dynamicText',value:t.value,childIndex:t.index});let e=t.value.stateRef,a=ae;a.plain.includes(e)||a.closure.includes(e)||a.closure.push(e)}else I.seq.push({type:'staticText',value:String(t.value),childIndex:t.index})}for(let e=0;e<x.handler.length;e++){let t=x.handler[e];for(let e in t.map)I.seq.push({type:'handler',for:e,handler:t.map[e],options:t.options,domConfig:t.domConfig})}if(x.visible){let{onMount:e,onState:t}=H({mount:w,state:x.visible,onMount:(e,t)=>({leaf:t,value:e,hydration:t.hydration}),onState:(e,t)=>({leaf:e,value:t,hydration:0})});e.watch(({leaf:e,value:t,hydration:a})=>{let l=e.data,r=l.block;if(a&&(n(t,l.ops.visible),t)){let e,t=q(r);if(e=t?t.nextSibling:C(r).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}r.value=e,r.visible=1}A(I,{parentBlockFragment:r.child,leaf:e,node:r.value,svgRoot:S.isSvgRoot?r.value:null}),t&&l.needToCallNode&&(l.needToCallNode=0,effector.launch({target:oe,params:{element:l.block.value,fns:I.node},page:e.spawn,defer:1,forkPage:e.forkPage})),effector.launch({target:y,params:e,defer:1,page:e.spawn,forkPage:e.forkPage})}),effector.merge([t,e]).watch(({leaf:e,value:t,hydration:a})=>{a||l(t,e.data.ops.visible)})}P&&f(P,I.staticSeq);for(let e=0;e<I.seq.length;e++){let t=I.seq[e];switch(t.type){case'visible':break;case'attr':{let{field:e}=t,n='value'===e||'checked'===e||'min'===e||'max'===e,{onMount:r,onState:i}=d(t.value);if(n)effector.merge([i,r]).watch(({leaf:t,value:n})=>{v(a(t),e,n)});else{let t=I.opsAmount++;r.watch(({value:n,leaf:l})=>{let r=a(l),i=o({value:n,priority:'props',runOp(t){v(r,e,t)},group:l.ops.group});l.ops.group.ops[t]=i,v(r,e,n)}),i.watch(({value:e,leaf:a})=>{l(e,a.ops.group.ops[t])})}break}case'data':{let{field:e}=t,{onMount:n,onState:r}=d(t.value),i=I.opsAmount++;n.watch(({value:t,leaf:n})=>{let l=a(n),r=o({value:t,priority:'props',runOp(t){m(l,e,t)},group:n.ops.group});n.ops.group.ops[i]=r,m(l,e,t)}),r.watch(({value:e,leaf:t})=>{l(e,t.ops.group.ops[i])});break}case'style':{let e=I.opsAmount++,{field:n}=t,{onMount:r,onState:i}=d(t.value);r.watch(({value:t,leaf:l})=>{let r=a(l),i=o({value:t,priority:'props',runOp(e){g(r,n,e)},group:l.ops.group});l.ops.group.ops[e]=i,g(r,n,t)}),i.watch(({value:t,leaf:a})=>{l(t,a.ops.group.ops[e])});break}case'styleVar':{let{field:e}=t,{onMount:n,onState:r}=d(t.value),i=I.opsAmount++;n.watch(({value:t,leaf:n})=>{let l=a(n),r=o({value:t,priority:'props',runOp(t){h(l,e,t)},group:n.ops.group});n.ops.group.ops[i]=r,h(l,e,t)}),r.watch(({value:e,leaf:t})=>{l(e,t.ops.group.ops[i])});break}case'staticText':y.map(e=>e).watch(e=>{r(e,t.value,t.childIndex)});break;case'dynamicText':{let e=I.opsAmount++;effector.sample({source:t.value,clock:y,fn:(e,t)=>({value:String(e),leaf:t}),greedy:1}).watch(({value:a,leaf:n})=>{let l=o({value:a,priority:'props',runOp(e){k(i.value,e)},group:n.ops.group});n.ops.group.ops[e]=l;let i=r(n,a,t.childIndex)}),effector.sample({source:y,clock:t.value,fn:(e,t)=>({leaf:e,text:t}),greedy:1}).watch(({leaf:t,text:a})=>{l(a,t.ops.group.ops[e])});break}case'handler':{let e=t.handler.graphite.meta.nativeTemplate||null;y.watch(n=>{let l=null;if(e){let t=0,a=n.spawn;for(;!t&&a;)a.template===e?(t=1,l=a):a=a.parent}a(n).addEventListener(t.for,e=>{t.options.prevent&&e.preventDefault(),t.options.stop&&e.stopPropagation(),effector.launch({target:b(t.handler,n.forkPage),params:e,page:l,forkPage:n.forkPage})},t.domConfig)});break}}}effector.sample({source:w,clock:p,greedy:1}).watch(e=>{let{spawn:t}=e;W(t,t.parent.childSpawns[t.template.id]),function e(t){t.active=0,W(t,t.template.pages);for(let a in t.childSpawns)t.childSpawns[a].forEach(e)}(t),l(0,e.data.ops.visible)}),c.watch(({leaf:e})=>{let t=e.data;if(!I.visible){let a=t.ops.visible,r=t.block;if(e.hydration){n(1,a);let e,t=q(r);if(e=t?t.nextSibling:C(r).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}r.value=e,r.visible=1}A(I,{parentBlockFragment:r.child,leaf:e,node:r.value,svgRoot:S.isSvgRoot?r.value:null}),effector.launch({target:y,params:e,defer:1,page:e.spawn,forkPage:e.forkPage}),e.hydration?t.needToCallNode&&(t.needToCallNode=0,effector.launch({target:oe,params:{element:t.block.value,fns:I.node},page:e.spawn,defer:1,forkPage:e.forkPage})):l(1,a)}})},env:p});$(S)},exports.handler=B,exports.list=U,exports.node=e=>{let t=le.draft;switch(t.type){case'list':case'listItem':case'using':case'route':case'rec':case'recItem':case'block':case'blockItem':return void console.error('node() hook supported only in h() nodes')}t.node.push(e)},exports.rec=G,exports.remap=F,exports.route=V,exports.spec=N,exports.text=(e,...t)=>{let a=[e[0]];for(let n=0;n<t.length;n++)a.push(t[n],e[n+1]);N({text:a})},exports.tree=({source:e,key:t,child:a,fn:n})=>{let l=G(({store:e})=>{U({source:e,key:t,fn({store:e}){let t=e.map(e=>e[a]||[]);n({store:e,child(){l({store:t})}})}})});l({store:e})},exports.using=(e,t)=>{let a,n,l,r,o,u;if('function'==typeof t)a=t,l=M(),r=0;else{if(!t)throw Error('using() second argument is missing');a=t.fn,l=t.env?t.env:M(),r=t.hydrate,n=t.onComplete,o=t.onRoot,u=t.scope}if(!e)throw Error('using() first argument is missing');let c=e.namespaceURI,p=e.tagName.toLowerCase(),f={type:'using',childTemplates:[],childCount:0,inParentIndex:-1},d=y({name:'using',draft:f,isSvgRoot:'svg'===p,namespace:'http://www.w3.org/2000/svg'===c?'svg':'foreignobject'===p?'foreignObject':'html',fn(e,{mount:t}){a(),t.watch(({node:e,leaf:t})=>{A(f,{parentBlockFragment:t.data.block.child,leaf:t,node:e})})},env:l}),h={type:'using',child:{type:'fragment',parent:null,child:[]},value:e};h.child.parent=h;let g=i({onComplete:n}),m=S(d,{parentLeaf:ne||null,mountNode:e,svgRoot:d.isSvgRoot?e:ne?ne.svgRoot:null,leafData:{type:'using',draft:f,element:e,block:h},opGroup:s(g),domSubtree:s(g),hydration:r,refMap:O(u),forkPage:u,env:l});if(o&&o({template:d,leaf:m}),g.onDrain&&!g.rafID){let e=g.onDrain;g.onDrain=null,e()}},exports.variant=({source:e,cases:t,key:a})=>{if(!effector.is.unit(e))throw Error('variant({source}) should be unit');let n;n='function'==typeof a?a:null==a?e=>String(e):e=>String(e[a]);let l=0;for(let a in t)'__'!==a?V({source:e,visible:e=>n(e)===a,fn:t[a]}):l=1;if(l){let a=Object.keys(t);V({source:e,visible:e=>!a.includes(n(e)),fn:t.__})}};
//# sourceMappingURL=forest.cjs.js.map

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

((e,t)=>{'object'==typeof exports&&'undefined'!=typeof module?t(exports,require('effector')):'function'==typeof define&&define.amd?define(['exports','effector'],t):t((e=e||self).forest={},e.effector)})(this,(e,effector)=>{function t(e,t){e.cursor[t].prev&&(e.cursor[t].prev.cursor[t].next=e.cursor[t].next),e.cursor[t].next&&(e.cursor[t].next.cursor[t].prev=e.cursor[t].prev),e.queue[t].last===e&&(e.queue[t].last=e.cursor[t].prev),e.queue[t].first===e&&(e.queue[t].first=e.cursor[t].next),e.cursor[t].prev=null,e.cursor[t].next=null}function a(e){e.status='active',((e,t)=>{t.cursor.prev&&(t.cursor.prev.cursor.next=t.cursor.next),t.cursor.next&&(t.cursor.next.cursor.prev=t.cursor.prev),e.last===t&&(e.last=t.cursor.prev),e.first===t&&(e.first=t.cursor.next),t.cursor.prev=null,t.cursor.next=null})(n(e),e)}function n(e){return e.group.activeChilds[e.priority]}function l(e,t){t.value.active=t.value.pending=e,'active'!==t.status&&a(t)}function r(e,l){if(l.value.active===e)return l.value.pending=e,void('pending'===l.status&&(a(l),n(l).first||t(l.group,l.priority)));'active'===l.status&&(l.status='pending',n(l).first||((e,t)=>{e.queue[t].last?(e.cursor[t].prev=e.queue[t].last,e.queue[t].last.cursor[t].next=e,e.queue[t].last=e):e.queue[t].first=e.queue[t].last=e})(l.group,l.priority),((e,t)=>{e.last?(t.cursor.prev=e.last,e.last.cursor.next=t,e.last=t):e.first=e.last=t})(n(l),l)),l.value.pending=e,l.group.queue.rafID||(l.group.queue.rafID=Z(l.group.queue.execQueue))}function o(e){K('execQueue');let n,l,r=Y(),o=0;e:for(;e.props.first||e.tree.first||e.data.first;){if(Y()-r>=10){o=1;break e}let i=!!e.props.first;for(i&&K('props');n=e.props.first;){for(;l=n.activeChilds.props.first;){if(Y()-r>=10){o=1,X('props');break e}l.runOp(l.value.pending),l.value.active=l.value.pending,a(l)}t(n,'props')}i&&X('props');let s=!!e.tree.first;for(s&&K('tree');n=e.tree.first;){for(;l=n.activeChilds.tree.first;){if(Y()-r>=10){o=1,X('tree');break e}l.runOp(l.value.pending),l.value.active=l.value.pending,a(l)}t(n,'tree')}s&&X('tree');let u=!!e.data.first;for(u&&K('data');n=e.data.first;){for(;l=n.activeChilds.data.first;){if(Y()-r>=10){o=1,X('data');break e}l.runOp(l.value.pending),l.value.active=l.value.pending,a(l)}t(n,'data')}u&&X('data')}if(X('execQueue'),o)e.rafID=Z(e.execQueue);else if(e.rafID=null,e.onDrain){let t=e.onDrain;e.onDrain=null,t()}}function i({value:e,runOp:t,group:a,priority:n}){return{value:{active:e,pending:e},runOp:t,status:'active',priority:n,group:a,cursor:{prev:null,next:null}}}function s({onComplete:e}){let t={props:{first:null,last:null},tree:{first:null,last:null},data:{first:null,last:null},rafID:null,execQueue(){},onDrain:e};return t.execQueue=o.bind(null,t),t}function u(e){return{ops:[],queue:e,activeChilds:{props:{first:null,last:null},tree:{first:null,last:null},data:{first:null,last:null}},cursor:{props:{prev:null,next:null},tree:{prev:null,next:null},data:{prev:null,next:null}}}}function c({value:e,group:t,onInit:a,onChange:n,onTerminate:l}){let o=i({value:e,group:t,runOp(e){s.status='A',n(e)},priority:'data'}),s={status:'IA',value:o.value,hooks:{onTerminate:l},ops:{init:i({value:0,group:t,runOp(e){s.status='A',a(s.value.active)},priority:'data'}),change:o,terminate:i({value:0,group:t,runOp(e){s.status='T',s.hooks.onTerminate(1)},priority:'data'})}};return r(1,s.ops.init),s}function p(e){switch(e.status){case'I':case'T':case'AT':return;case'A':e.status='AT',r(1,e.ops.terminate);break;case'AA':e.status='AT',r(1,e.ops.terminate),r(e.value.active,e.ops.change);break;case'IA':e.status='T',r(0,e.ops.init),e.hooks.onTerminate(0)}}function f(e,t){switch(t.status){case'I':case'T':return;case'A':t.value.active!==e&&(t.status='AA',r(e,t.ops.change));break;case'AA':t.value.active===e?(t.status='A',r(e,t.ops.change)):t.value.pending!==e&&(t.value.pending=e);break;case'IA':t.value.active=t.value.pending=e}}function d(e,t){for(let a=0;a<t.length;a++){let{type:n,field:l,value:r}=t[a];ee[n](e,l,r)}}function h(e){return''!==e&&0!==e&&'0'!==e&&(0==e||null==e)}function g(e,t,a){h(a)?e.style.removeProperty("--"+t):e.style.setProperty("--"+t,""+a)}function m(e,t,a){h(a)?delete e.style[t]:e.style[t]=""+a}function v(e,t,a){h(a)?delete e.dataset[t]:e.dataset[t]=""+a}function k(e,t,a){if(h(a)){switch(t){case'value':delete e.value;break;case'checked':e.checked=0;break;case'spellcheck':if(0==a)return void e.setAttribute('spellcheck','false')}e.removeAttribute(t)}else{switch(t){case'value':e.value=""+a;break;case'checked':e.checked=""+a}e.setAttribute(t,""+a)}}function y(e,t){e.replaceData(0,(e.textContent||'').length,String(t))}function b({fn:e,state:t={},defer:a=0,name:n="",draft:l,isSvgRoot:r,namespace:o,env:i,isBlock:s=0}){let u=re,c=ne,p={id:++te,name:n,plain:[],watch:[],nameMap:{},pages:[],closure:[],childTemplates:[],upward:effector.step.filter({fn(e,t,a){if(!a.page){if(!a.parent||!a.parent.page)return 1;a.page=a.parent.page}if(!a.page.active)return 0;let n=[a.page.template],l=[a.page];{let e=a.page.parent;for(;e;)l.push(e),n.push(e.template),e=e.parent}return a.node.next.forEach(t=>{let r=t.meta.nativeTemplate;r?n.includes(r)?effector.launch({target:w(t,a.forkPage),params:e,defer:1,page:l[n.indexOf(r)],stack:a,forkPage:a.forkPage}):console.error('context drift',{stack:a,node:t}):effector.launch({target:w(t,a.forkPage),params:e,defer:1,page:null,stack:a,forkPage:a.forkPage})}),0}}),loader:effector.step.filter({fn(e,t,a){if(a.parent){let n=a.forkPage?a.forkPage.graphite.id:null;if(a.page){if(!a.page.active)return 0;if(a.page.template===p)return 1;if(a.page.childSpawns[p.id])a.page.childSpawns[p.id].forEach(t=>{(!n||t.leaf.forkPage&&n===t.leaf.forkPage.graphite.id)&&effector.launch({params:e,target:w(a.node,a.forkPage),page:t,defer:1,forkPage:a.forkPage})});else if(t.targetTemplate){let n=[a.page];{let e=a.page.parent;for(;e;)n.push(e),e=e.parent}let l=n.findIndex(e=>t.targetTemplate===e.template);effector.launch(-1===l?{params:e,target:w(a.node,a.forkPage),page:null,defer:1,forkPage:a.forkPage}:{params:e,target:w(a.node,a.forkPage),page:n[l],defer:1,forkPage:a.forkPage})}else p.pages.forEach(t=>{(!n||t.leaf.forkPage&&n===t.leaf.forkPage.graphite.id)&&t.fullID.startsWith(a.page.fullID)&&effector.launch({params:e,target:w(a.node,a.forkPage),page:t,defer:1,forkPage:a.forkPage})})}else p.pages.forEach(t=>{(!n||t.leaf.forkPage&&n===t.leaf.forkPage.graphite.id)&&effector.launch({params:e,target:w(a.node,a.forkPage),page:t,defer:1,forkPage:a.forkPage})});return 0}return 1}}),parent:c};c&&c.childTemplates.push(p);let f=effector.createNode({meta:{template:p}});ne=p;let d=re={template:p,node:f,api:null,trigger:{mount:effector.createEvent(),unmount:effector.createEvent()},draft:l,isSvgRoot:r,namespace:o,env:i,isBlock:s||!(!u||!u.isBlock)};return a?d.deferredInit=()=>{let a=re,n=ne;re=d,ne=p,d.deferredInit=null;try{effector.withRegion(f,()=>{let a=effector.restore(t);d.api=e(a,d.trigger),p.nameMap=a})}finally{re=a,ne=n}}:effector.withRegion(f,()=>{let a=effector.restore(t);d.api=e(a,d.trigger),p.nameMap=a}),re=u,ne=c,p.actor=d,d}function w(e,t){return t&&t.nodeMap[(e=e.graphite||e).id]||e}function x(e,t){let a=e;switch(t&&oe(t,e)&&(a=oe(t,e)),e.type){case'list':return[...a.current];case'shape':return{...a.current};default:return a.current}}function P(e,t,a){let n=t;for(;n&&!oe(n.spawn,e);)n=n.parentLeaf;return n?oe(n.spawn,e):a&&oe(a,e)?oe(a,e):e}function I(e,t,a){return P(e,t,a).current}function S(e,t){oe(t.spawn,e)||(t.spawn.reg[e.id]=P(e,t.parentLeaf,t.forkPage))}function C(e,{values:t={},parentLeaf:a,mountNode:n,svgRoot:l,leafData:r,opGroup:o,domSubtree:i,hydration:s,forkPage:u,env:c}){function p(e){if(e.before)for(let t=0;t<e.before.length;t++){let a=e.before[t];switch(a.type){case'map':{let t=a.from;S(t,k),g[e.id].current=a.fn(g[t.id].current);break}case'field':{let t=a.from;S(t,k),g[e.id].current[a.field]=g[t.id].current;break}case'closure':S(a.of,k)}}if(!e.after)return;let t=g[e.id].current;for(let a=0;a<e.after.length;a++){let n=e.after[a],l=n.to;switch(g[l.id]||(g[l.id]={id:l.id,current:I(l,k.parentLeaf,u)}),n.type){case'copy':g[l.id].current=t;break;case'map':g[l.id].current=n.fn(t)}}}function f(e,t,a){let n;t.stop=1;try{for(;t.i<e.length;)n=e[t.i],t.i++,n.fn(a[n.of.id]?a[n.of.id].current:I(n.of,k.parentLeaf,u))}catch(e){console.error(e),t.stop=0}}!c&&a&&(c=a.env);let d=a?a.spawn:null,h=e.template,g={},m={id:++ae,fullID:'',reg:g,template:h,parent:d,childSpawns:{},active:1};h.pages.push(m);let v={},k={actor:e,spawn:m,api:v,draft:e.draft,ops:{group:o,domSubtree:i},svgRoot:l,data:r,parentLeaf:a,hydration:s,forkPage:u,env:c},y=le;le=k,d&&(d.childSpawns[h.id]||(d.childSpawns[h.id]=[]),d.childSpawns[h.id].push(m)),m.fullID=d?`${d.fullID}_${m.id}`:""+m.id;for(let e=0;e<h.closure.length;e++){let t=h.closure[e],a=t,n=m.parent;e:for(;n;){if(oe(n,t)){a=oe(n,t);break e}n=n.parent}!n&&u&&oe(u,t)&&(a=oe(u,t)),g[t.id]=a}for(let e=0;e<h.plain.length;e++){let t=h.plain[e],a={id:t.id,current:x(t,u)};g[t.id]=a}for(let e in t){let a=h.nameMap[e].stateRef.id;g[a]={id:a,current:t[e]}}h.closure.forEach(p),h.plain.forEach(p);let b={i:0,stop:0};for(;!b.stop;)f(h.watch,b,g);if(d)for(let e in m.childSpawns)e in d.childSpawns||(d.childSpawns[e]=[]),d.childSpawns[e].push(...m.childSpawns[e]);if(v.mount=(t,a=1)=>effector.launch({target:e.trigger.mount,params:t,defer:a,page:m,forkPage:u}),v.unmount=(t,a=1)=>effector.launch({target:e.trigger.unmount,params:t,defer:a,page:m,forkPage:u}),e.api)for(let t in e.api)v[t]=(a,n=1)=>effector.launch({target:e.api[t],params:a,defer:n,page:m,forkPage:u});return k.spawn.api=v,k.spawn.leaf=k,k.api.mount({node:n,leaf:k}),le=y,k}function T(e){let t=function e(t){switch(t.type){case'using':return t;case'fragment':switch(t.parent.type){case'element':case'using':return t.parent}default:return e((e=>{switch(e.type){case'text':case'element':case'list':case'route':case'rec':case'recItem':case'block':case'blockItem':return e.parent;default:switch(e.parent.type){case'using':case'block':return e.parent;default:return e.parent.parent}}})(t))}}(e);return t?t.value:null}function R(e){if(!e.visible)return null;switch(e.type){case'text':case'element':return e;case'route':return R(e.child);case'LF':case'RF':case'FF':case'rec':case'recItem':case'block':case'blockItem':return(e=>{let t=e.child;for(let e=t.length-1;e>=0;e--){let a=R(t[e]);if(a)return a}return null})(e.child);case'list':{let t=e.lastChild;if(!t)return null;for(;t;){let e=R(t);if(e)return e;t=t.left}return null}default:return null}}function q(e){switch(e.type){case'fragment':switch(e.parent.type){case'element':case'using':case'block':return null;case'RF':{let t=e.parent.parent,a=t.parent;for(let e=t.index-1;e>=0;e--){let t=R(a.child[e]);if(t)return t}return q(a)}case'rec':case'recItem':case'block':case'blockItem':case'FF':{let t=e.parent,a=t.parent;for(let e=t.index-1;e>=0;e--){let t=R(a.child[e]);if(t)return t}return q(a)}case'LF':{let t=e.parent.left;for(;t;){let e=R(t);if(e)return e;t=t.left}return q(e.parent.parent)}default:return null}case'element':case'text':case'route':case'rec':case'recItem':case'block':case'blockItem':case'list':{let t=e.parent;for(let a=e.index-1;a>=0;a--){let e=t.child[a];if(!e)continue;let n=R(e);if(n)return n}return q(t)}default:return null}}function A(e){let t=q(e);return t?t.value:null}function D(e,{parentBlockFragment:t,leaf:a,node:n,svgRoot:l,values:r}){e.childTemplates.forEach(e=>{E({parentBlockFragment:t,leaf:a,node:n,svgRoot:l,values:r,actor:e})})}function E({parentBlockFragment:e,leaf:t,node:a,actor:n,svgRoot:l,values:r}){let o,{draft:s}=n,{queue:c}=t.ops.group,p=u(c),f=t.ops.domSubtree,h=f;switch(s.type){case'route':{let t={type:'route',parent:e,child:{type:'RF',parent:null,child:{type:'fragment',parent:null,child:[]},visible:0},visible:1,index:s.inParentIndex};t.child.parent=t,t.child.child.parent=t.child,e.child[s.inParentIndex]=t,o={type:'route',block:t,ops:{},initialized:0};break}case'element':{let a;if(n.isBlock){let e,n,l=t;for(;l&&(!n||!e);){l.actor.env&&(e=l.actor.env);let{draft:t}=l;'element'===t.type&&('svg'===t.tag?n='svg':'foreignObject'===t.tag&&(n='html')),l=l.parentLeaf}n||(n='html'),e&&(a='svg'===n?e.document.createElementNS('http://www.w3.org/2000/svg',s.tag):e.document.createElement(s.tag),d(a,s.staticSeq))}else a=s.stencil.cloneNode();let l={type:'element',parent:e,child:{type:'fragment',parent:null,child:[]},value:a,visible:0,index:s.inParentIndex};l.child.parent=l,e.child[s.inParentIndex]=l,o={type:'element',block:l,ops:{visible:i({value:0,priority:'tree',runOp(e){e?(F(l),o.needToCallNode&&(o.needToCallNode=0,effector.launch({target:ie,params:{element:l.value,fns:s.node},page:g.spawn,forkPage:t.forkPage}))):(l.value.remove(),l.visible=0)},group:f})},needToCallNode:s.node.length>0},h=u(c);break}case'list':{let t={type:'list',parent:e,child:[],lastChild:null,visible:1,index:s.inParentIndex};e.child[s.inParentIndex]=t,o={type:'list',draft:s,block:t};break}case'using':case'listItem':break;case'rec':{let t={type:'rec',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:s.inParentIndex};t.child.parent=t,e.child[s.inParentIndex]=t,o={type:'rec',block:t};break}case'recItem':{let t={type:'recItem',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:s.inParentIndex};t.child.parent=t,e.child[s.inParentIndex]=t,o={type:'rec item',block:t};break}case'block':{let t={type:'block',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:0};t.child.parent=t,e.child[s.inParentIndex]=t,o={type:'block',block:t};break}case'blockItem':{let t={type:'blockItem',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:s.inParentIndex};t.child.parent=t,e.child[s.inParentIndex]=t,o={type:'block item',block:t};break}default:console.warn("unexpected draft type "+s.type)}let g=C(n,{values:r,parentLeaf:t,mountNode:a,svgRoot:l||t.svgRoot,leafData:o,opGroup:p,domSubtree:h,hydration:t.hydration,forkPage:t.forkPage})}function F(e){let t=A(e);t?t.after(e.value):T(e).prepend(e.value),e.visible=1}function M(e,t){if(Array.isArray(t))return t.map(t=>e.map(e=>e[t]));if('object'==typeof t&&null!==t){let a={};for(let n in t){let l=t[n];a[n]=e.map('function'==typeof l?e=>l(e):e=>e[l])}return a}return e.map(e=>e[t])}function O(){if('undefined'!=typeof document)return{document};throw Error('your environment has no document')}function N(e){if(e){if(!e.nodeMap){let t={};for(let a=0;a<e.clones.length;a++){let n=e.clones[a];t[n.meta.forkOf.id]=n}e.nodeMap=t}return e.reg}}function B(e){let t=re.draft;switch(t.type){case'list':return void(e.visible&&(t.itemVisible=e.visible));case'listItem':case'using':case'route':case'rec':case'recItem':case'block':case'blockItem':return}if(e.attr&&t.attr.push(e.attr),e.data&&t.data.push(e.data),'text'in e){let a=e.text,n=t.childCount;Array.isArray(a)?(t.text.push(...a.map((e,t)=>({index:t+n,value:e}))),t.childCount+=a.length):(t.text.push({index:n,value:a}),t.childCount+=1)}if(e.style&&t.styleProp.push(e.style),e.styleVar&&t.styleVar.push(e.styleVar),e.visible&&(t.visible=e.visible),e.handler){let t=e.handler;'object'==typeof t.on?V(t.config||{},t.on):V(t)}e.ɔ&&B(e.ɔ)}function V(e,t){if(!re)return;let a=re.draft;if('element'!==a.type)throw Error(`"handler" extension can be used only with element nodes, got "${a.type}"`);void 0===t&&(t=e,e={});for(let e in t)if(!effector.is.unit(t[e]))throw Error(`handler for "${e}" should be event`);let{passive:n=0,capture:l=0,prevent:r=0,stop:o=0}=e;a.handler.push({options:{prevent:r,stop:o},domConfig:{passive:r?0:n,capture:l},map:t})}function L({source:e,visible:t,fn:a}){if(!re)throw Error('route() called outside from using() closure');let n=b({name:'route',isSvgRoot:0,namespace:re.namespace,env:re.env,draft:{type:'route',childTemplates:[],childCount:0,inParentIndex:-1},fn(n,{mount:l,unmount:r}){let o=e.map(e=>({value:e,visible:t(e)})),i={type:'route',childTemplates:[],childCount:0,inParentIndex:-1},s=b({name:'route item',isSvgRoot:0,namespace:re.namespace,env:re.env,draft:i,state:{store:null},fn({store:e},{mount:t,unmount:n}){let l=effector.createEvent();e.on(l,(e,t)=>t),a({store:e});let r=effector.sample({source:t,clock:o,fn:({leaf:e,node:t},{visible:a,value:n})=>({leaf:e,visible:a,node:t,value:n}),greedy:1});t.watch(({leaf:e,node:t})=>{let a=e.data;a.block.child.visible=1,D(i,{parentBlockFragment:a.block.child.child,leaf:e,node:t})}),r.watch(({leaf:e,visible:t,value:a})=>{e.data.block.child.visible=t,t&&effector.launch({target:l,params:a,defer:1,page:e.spawn,forkPage:e.forkPage}),j(t,e)}),z({unmountSelf:1,mount:t,unmount:n})}});W(s);let{onMount:u,onState:c}=J({mount:l,state:o,onMount:({visible:e,value:t},{leaf:a,node:n})=>({leaf:a,visible:e,node:n,value:t}),onState:({leaf:e,node:t},{visible:a,value:n})=>({leaf:e,visible:a,node:t,value:n})});effector.merge([u,c]).watch(({leaf:e,visible:t,value:a,node:n})=>{let l=e.data;l.block.child.visible=t,t&&!l.initialized&&(E({parentBlockFragment:l.block.child.child,leaf:e,node:n,actor:s,values:{store:a}}),l.initialized=1)}),z({unmountSelf:1,mount:l,unmount:r})}});W(n)}function j(e,t){let a=t=>{let n=t.data;switch(n.type){case'element':r(e,n.ops.visible);break;case'route':case'list':case'list item':G(t,a);break;default:console.log('unsupported type',n.type)}};G(t,a)}function z({unmountSelf:e=0,mount:t,unmount:a}){effector.sample({source:t,clock:a,greedy:1}).watch(e?({leaf:e})=>{Q(e),_(e)}:({leaf:e})=>{Q(e)})}function _({spawn:e}){H(e,e.parent.childSpawns[e.template.id]),H(e,e.template.pages)}function Q(e){e.spawn.active=0,G(e,e=>{e.api.unmount()})}function G(e,t){let{spawn:a}=e;for(let e in a.childSpawns){let n=a.childSpawns[e];for(let e=0;e<n.length;e++)t(n[e].leaf)}}function U(e){let t='function'==typeof e?e:e.fn,a={type:'rec',childTemplates:[],childCount:0,inParentIndex:0},n=b({name:'rec',state:{store:null},isSvgRoot:0,namespace:null,env:null,draft:a,defer:1,isBlock:1,fn({store:e},{mount:n,unmount:l}){t({store:e,state:e});let r=effector.createEvent();return e.on(r,(e,t)=>t),n.watch(({node:e,leaf:t})=>{D(a,{parentBlockFragment:t.data.block.child,leaf:t,node:e})}),z({mount:n,unmount:l}),{itemUpdater:r}}});return({store:e,state:t=e})=>{n.deferredInit&&n.deferredInit();let{env:a,namespace:l}=re;W(b({name:'rec item',isSvgRoot:0,namespace:l,env:a,draft:{type:'recItem',childTemplates:[],childCount:0,inParentIndex:-1},fn(e,{mount:a,unmount:l}){let{onMount:r,onState:o}=J({state:t,mount:a,onMount:(e,{leaf:t,node:a})=>({state:e,leaf:t,node:a}),onState:({leaf:e,node:t},a)=>({state:a,leaf:e,node:t})});z({mount:a,unmount:l}),o.watch(({state:e,leaf:t})=>{G(t,t=>{t.api.itemUpdater(e)})}),r.watch(({node:e,leaf:t,state:a})=>{E({parentBlockFragment:t.data.block.child,leaf:t,node:e,actor:n,values:{store:a}})})}}))}}function $(e,t){'function'==typeof t&&(effector.is.unit(e)?e={source:e,fn:t}:e.fn=t);let{fn:a,key:n,source:l,fields:r=[]}=e,o=void 0!==n?'function'==typeof n?n:e=>e[n]:(e,t)=>t,i={type:'list',key:effector.is.store(e)?{type:'index'}:{type:'key',key:e.key},childTemplates:[],childCount:0,inParentIndex:-1};if(!re)throw Error('list() called outside from using() closure');let s=re.env,d=re.namespace;W(b({name:'list',draft:i,isSvgRoot:0,namespace:d,fn(e,{mount:t,unmount:n}){let h=b({name:'list item',state:{id:-1,store:null},draft:i,isSvgRoot:0,namespace:d,fn({id:e,store:t},{mount:n,unmount:l}){a({store:t,key:e,fields:M(t,r)});let o=effector.createEvent();if(t.on(o,(e,t)=>t),effector.sample({source:n,clock:l,greedy:1}).watch(({leaf:e})=>{let t=e.data.block;H(t,t.parent.child);let a=t.left,n=t.right;a&&(a.right=n,n||t.parent.lastChild!==t||(t.parent.lastChild=a)),n&&(n.left=a),a||n||t.parent.lastChild!==t||(t.parent.lastChild=null),t.left=null,t.right=null,Q(e),_(e)}),i.itemVisible){let{onMount:e,onState:t}=J({mount:n,state:i.itemVisible,onMount:(e,{node:t,leaf:a})=>({visible:e,node:t,leaf:a}),onState:({node:e,leaf:t},a)=>({visible:a,node:e,leaf:t})});e.watch(({visible:e,node:t,leaf:a})=>{let n=a.data.block;n.visible=e,n.childInitialized=e,e&&D(i,{parentBlockFragment:n.child,leaf:a,node:t})}),t.watch(({visible:e,node:t,leaf:a})=>{let n=a.data.block;n.visible=e,n.childInitialized?j(e,a):e&&(n.childInitialized=1,D(i,{parentBlockFragment:n.child,leaf:a,node:t}))})}else n.watch(({node:e,leaf:t})=>{let a=t.data.block;a.visible=1,a.childInitialized=1,D(i,{parentBlockFragment:a.child,leaf:t,node:e})});return{itemUpdater:o}},env:s}),g=effector.createStore([]),m=l.map(e=>e),v=effector.sample({source:l,clock:t,fn:(e,{node:t,leaf:a})=>({updates:e,node:t,leaf:a,hydration:a.hydration}),greedy:1}),k=effector.sample({source:v,clock:m,fn:({node:e,leaf:t},a)=>({updates:a,node:e,leaf:t,hydration:0}),greedy:1});effector.sample({source:g,clock:[v,k],greedy:1,fn(e,{node:t,updates:a,leaf:n,hydration:r}){let i=n.data.block;K('list update ['+l.shortName+']');let s=Array(a.length).fill(0),d=a.map(o),g=[];for(let t=0;t<e.length;t++){let n=e[t],l=d.indexOf(n.key);-1!==l?(g.push(n),s[l]=1,f(a[l],n.asyncValue)):(n.active=0,n.instance&&n.instance.api.unmount(),p(n.asyncValue))}for(let e=0;e<a.length;e++){if(s[e])continue;let l=a[e],o=d[e],p=u(n.ops.group.queue),f={type:'LF',parent:i,child:{type:'fragment',parent:null,child:[]},childInitialized:0,visible:0,left:null,right:null},m={type:'listItem',key:o,index:o,active:1,leafData:{type:'list item',block:f},asyncValue:c({value:l,group:p,onTerminate(e){},onChange(e){m.instance&&m.instance.api.itemUpdater(e)},onInit(e){m.active&&(r||(m.instance=C(h,{values:{id:o,store:e},parentLeaf:n,mountNode:t,svgRoot:n.svgRoot,leafData:m.leafData,opGroup:p,domSubtree:n.ops.domSubtree,hydration:r,forkPage:n.forkPage})))}})},v=g.length;g.push(m);let k=v>0?g[v-1].leafData:null;if(f.child.parent=f,i.child.push(f),k){let e=k.block;f.left=e;let t=e.right;t?(t.left=f,f.right=t):i.lastChild=f,e.right=f}else i.lastChild=f;r&&(m.instance=C(h,{values:{id:o,store:l},parentLeaf:n,mountNode:t,svgRoot:n.svgRoot,leafData:m.leafData,opGroup:p,domSubtree:n.ops.domSubtree,hydration:r,forkPage:n.forkPage}))}return X('list update ['+l.shortName+']'),0===g.length&&(i.lastChild=null),g},target:g}),effector.sample({source:t,clock:effector.sample({source:g,clock:n,greedy:1}),fn:({leaf:e},t)=>({leaf:e,records:t}),greedy:1}).watch(({leaf:e,records:t})=>{for(let e=0;e<t.length;e++){let a=t[e];a.instance&&a.instance.api.unmount(),a.active=0}e.spawn.active=0,_(e)})},env:s}))}function W(e){if(!re)return;let{draft:t}=e;if('listItem'!==t.type&&'rec'!==t.type)switch(re.draft.type){case'element':case'using':case'route':case'list':case'rec':case'recItem':case'block':case'blockItem':t.inParentIndex=re.draft.childCount,re.draft.childCount+=1,re.draft.childTemplates.push(e);break;default:console.warn("unexpected currentActor type "+re.draft.type)}}function H(e,t){if(!t)return;let a=t.indexOf(e);-1!==a&&t.splice(a,1)}function J({mount:e,state:t,onMount:a,onState:n}){return{onMount:effector.sample({source:t,clock:e,fn:a,greedy:1}),onState:effector.sample({source:e,clock:t,fn:n,greedy:1})}}let K,X,Y;'undefined'!=typeof performance&&performance.mark?(K=e=>{performance.mark('☄️ '+e+' start')},X=e=>{try{performance.measure('☄️ '+e,'☄️ '+e+' start')}catch(e){}performance.clearMarks('☄️ '+e+' start'),performance.clearMeasures('☄️ '+e)}):(K=()=>{},X=()=>{}),Y='undefined'!=typeof performance&&performance.now?()=>performance.now():'undefined'!=typeof process&&process.hrtime?()=>{let e=process.hrtime();return(1e9*e[0]+e[1])/1e6}:()=>Date.now();let Z='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0);const ee={attr:k,data:v,style:m,styleVar:g};let te=0,ae=0,ne=null,le=null,re=null;const oe=(e,t)=>e.reg[t.id];let ie=effector.createEvent();ie.watch(({fns:e,element:t})=>{e.forEach(e=>{e(t)})}),e.block=({fn:e,env:t,namespace:a="html"})=>{let n={type:'block',childTemplates:[],childCount:0,inParentIndex:0},l=b({name:'block',isSvgRoot:0,namespace:a,env:t,draft:n,isBlock:1,fn({},{mount:t,unmount:a}){e(),t.watch(({node:e,leaf:t})=>{D(n,{parentBlockFragment:t.data.block.child,leaf:t,node:e})}),z({mount:t,unmount:a})}});return()=>{let e={type:'blockItem',childTemplates:[],childCount:0,inParentIndex:-1,itemOf:n},{env:t,namespace:a}=re;W(b({name:'block item',isSvgRoot:0,namespace:a,env:t,draft:e,fn(e,{mount:t,unmount:a}){z({mount:t,unmount:a}),t.watch(({node:e,leaf:t})=>{E({parentBlockFragment:t.data.block.child,leaf:t,node:e,actor:l})})}}))}},e.h=(e,t)=>{function a(e){return e.data.block.value}function n(e,t,a){let n=e.data.block.child,l={type:'text',parent:n,visible:0,index:a,value:null};if(n.child[a]=l,e.hydration){let a=q(l);if(a)switch(a.type){case'text':l.value=e.env.document.createTextNode(t),a.value.after(l.value);break;case'element':l.value=a.value.nextSibling,y(l.value,t)}else{let e=T(l);l.value=e.firstChild,y(l.value,t)}l.visible=1}else l.value=e.env.document.createTextNode(t),F(l);return l}let o,s=0,u=0;if('function'==typeof t?(s=1,o=t):t&&(u=1,t.fn&&(s=1,o=t.fn),t.ɔ&&('function'==typeof t.ɔ?(s=1,o=t.ɔ):'function'==typeof t.ɔ.fn&&(s=1,o=t.ɔ.fn))),!re)throw Error('h() called outside from using() closure');let c,p=re.env,f=re.namespace,h=f,x='html';h=x='svg'===f?'svg':'html','svg'===e&&(x='svg',h='svg'),re.isBlock||(c='svg'===x?p.document.createElementNS('http://www.w3.org/2000/svg',e):p.document.createElement(e));let P=c,I={type:'element',tag:e,attr:[],data:[],text:[],styleProp:[],styleVar:[],handler:[],stencil:P,seq:[],staticSeq:[],childTemplates:[],childCount:0,inParentIndex:-1,opsAmount:1,node:[]};'foreignObject'===f?(I.attr.push({xmlns:'http://www.w3.org/1999/xhtml'}),h='html'):'svg'===e?(I.attr.push({xmlns:'http://www.w3.org/2000/svg'}),h='svg'):'foreignObject'===e&&(h='foreignObject');let S=b({name:'element',draft:I,isSvgRoot:'svg'===e,namespace:h,fn(e,{mount:c,unmount:p}){function f(e){return J({mount:h,state:e,onMount:(e,t)=>({leaf:t,value:e}),onState:(e,t)=>({leaf:e,value:t})})}let h=effector.createEvent(),b=c.map(({leaf:e})=>e);s&&o(),u&&B(t);let x={attr:{},data:{},text:I.text,styleProp:{},styleVar:{},visible:I.visible||null,handler:I.handler};for(let e=0;e<I.attr.length;e++){let t=I.attr[e];for(let e in t)'xlink:href'===e?x.attr.href=t[e]:x.attr[e]=t[e]}for(let e=0;e<I.data.length;e++){let t=I.data[e];for(let e in t)x.data[e]=t[e]}for(let e=0;e<I.styleProp.length;e++){let t=I.styleProp[e];for(let e in t)e.startsWith('--')?x.styleVar[e.slice(2)]=t[e]:x.styleProp[e]=t[e]}for(let e=0;e<I.styleVar.length;e++){let t=I.styleVar[e];for(let e in t)x.styleVar[e]=t[e]}x.visible&&I.seq.push({type:'visible',value:x.visible});for(let e in x.attr){let t=x.attr[e];effector.is.unit(t)?I.seq.push({type:'attr',field:e,value:t}):I.staticSeq.push({type:'attr',field:e,value:t})}for(let e in x.data){let t=x.data[e];effector.is.unit(t)?I.seq.push({type:'data',field:e,value:t}):I.staticSeq.push({type:'data',field:e,value:t})}for(let e in x.styleProp){let t=x.styleProp[e];effector.is.unit(t)?I.seq.push({type:'style',field:e,value:t}):I.staticSeq.push({type:'style',field:e,value:t})}for(let e in x.styleVar){let t=x.styleVar[e];effector.is.unit(t)?I.seq.push({type:'styleVar',field:e,value:t}):I.staticSeq.push({type:'styleVar',field:e,value:t})}for(let e=0;e<x.text.length;e++){let t=x.text[e];if(null!==t.value)if(effector.is.unit(t.value)){I.seq.push({type:'dynamicText',value:t.value,childIndex:t.index});let e=t.value.stateRef,a=ne;a.plain.includes(e)||a.closure.includes(e)||a.closure.push(e)}else I.seq.push({type:'staticText',value:String(t.value),childIndex:t.index})}for(let e=0;e<x.handler.length;e++){let t=x.handler[e];for(let e in t.map)I.seq.push({type:'handler',for:e,handler:t.map[e],options:t.options,domConfig:t.domConfig})}if(x.visible){let{onMount:e,onState:t}=J({mount:b,state:x.visible,onMount:(e,t)=>({leaf:t,value:e,hydration:t.hydration}),onState:(e,t)=>({leaf:e,value:t,hydration:0})});e.watch(({leaf:e,value:t,hydration:a})=>{let n=e.data,r=n.block;if(a&&(l(t,n.ops.visible),t)){let e,t=A(r);if(e=t?t.nextSibling:T(r).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}r.value=e,r.visible=1}D(I,{parentBlockFragment:r.child,leaf:e,node:r.value,svgRoot:S.isSvgRoot?r.value:null}),t&&n.needToCallNode&&(n.needToCallNode=0,effector.launch({target:ie,params:{element:n.block.value,fns:I.node},page:e.spawn,defer:1,forkPage:e.forkPage})),effector.launch({target:h,params:e,defer:1,page:e.spawn,forkPage:e.forkPage})}),effector.merge([t,e]).watch(({leaf:e,value:t,hydration:a})=>{a||r(t,e.data.ops.visible)})}P&&d(P,I.staticSeq);for(let e=0;e<I.seq.length;e++){let t=I.seq[e];switch(t.type){case'visible':break;case'attr':{let{field:e}=t,n='value'===e||'checked'===e||'min'===e||'max'===e,{onMount:l,onState:o}=f(t.value);if(n)effector.merge([o,l]).watch(({leaf:t,value:n})=>{k(a(t),e,n)});else{let t=I.opsAmount++;l.watch(({value:n,leaf:l})=>{let r=a(l),o=i({value:n,priority:'props',runOp(t){k(r,e,t)},group:l.ops.group});l.ops.group.ops[t]=o,k(r,e,n)}),o.watch(({value:e,leaf:a})=>{r(e,a.ops.group.ops[t])})}break}case'data':{let{field:e}=t,{onMount:n,onState:l}=f(t.value),o=I.opsAmount++;n.watch(({value:t,leaf:n})=>{let l=a(n),r=i({value:t,priority:'props',runOp(t){v(l,e,t)},group:n.ops.group});n.ops.group.ops[o]=r,v(l,e,t)}),l.watch(({value:e,leaf:t})=>{r(e,t.ops.group.ops[o])});break}case'style':{let e=I.opsAmount++,{field:n}=t,{onMount:l,onState:o}=f(t.value);l.watch(({value:t,leaf:l})=>{let r=a(l),o=i({value:t,priority:'props',runOp(e){m(r,n,e)},group:l.ops.group});l.ops.group.ops[e]=o,m(r,n,t)}),o.watch(({value:t,leaf:a})=>{r(t,a.ops.group.ops[e])});break}case'styleVar':{let{field:e}=t,{onMount:n,onState:l}=f(t.value),o=I.opsAmount++;n.watch(({value:t,leaf:n})=>{let l=a(n),r=i({value:t,priority:'props',runOp(t){g(l,e,t)},group:n.ops.group});n.ops.group.ops[o]=r,g(l,e,t)}),l.watch(({value:e,leaf:t})=>{r(e,t.ops.group.ops[o])});break}case'staticText':h.map(e=>e).watch(e=>{n(e,t.value,t.childIndex)});break;case'dynamicText':{let e=I.opsAmount++;effector.sample({source:t.value,clock:h,fn:(e,t)=>({value:String(e),leaf:t}),greedy:1}).watch(({value:a,leaf:l})=>{let r=i({value:a,priority:'props',runOp(e){y(o.value,e)},group:l.ops.group});l.ops.group.ops[e]=r;let o=n(l,a,t.childIndex)}),effector.sample({source:h,clock:t.value,fn:(e,t)=>({leaf:e,text:t}),greedy:1}).watch(({leaf:t,text:a})=>{r(a,t.ops.group.ops[e])});break}case'handler':{let e=t.handler.graphite.meta.nativeTemplate||null;h.watch(n=>{let l=null;if(e){let t=0,a=n.spawn;for(;!t&&a;)a.template===e?(t=1,l=a):a=a.parent}a(n).addEventListener(t.for,e=>{t.options.prevent&&e.preventDefault(),t.options.stop&&e.stopPropagation(),effector.launch({target:w(t.handler,n.forkPage),params:e,page:l,forkPage:n.forkPage})},t.domConfig)});break}}}effector.sample({source:b,clock:p,greedy:1}).watch(e=>{let{spawn:t}=e;H(t,t.parent.childSpawns[t.template.id]),function e(t){t.active=0,H(t,t.template.pages);for(let a in t.childSpawns)t.childSpawns[a].forEach(e)}(t),r(0,e.data.ops.visible)}),c.watch(({leaf:e})=>{let t=e.data;if(!I.visible){let a=t.ops.visible,n=t.block;if(e.hydration){l(1,a);let e,t=A(n);if(e=t?t.nextSibling:T(n).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}n.value=e,n.visible=1}D(I,{parentBlockFragment:n.child,leaf:e,node:n.value,svgRoot:S.isSvgRoot?n.value:null}),effector.launch({target:h,params:e,defer:1,page:e.spawn,forkPage:e.forkPage}),e.hydration?t.needToCallNode&&(t.needToCallNode=0,effector.launch({target:ie,params:{element:t.block.value,fns:I.node},page:e.spawn,defer:1,forkPage:e.forkPage})):r(1,a)}})},env:p});W(S)},e.handler=V,e.list=$,e.node=e=>{let t=re.draft;switch(t.type){case'list':case'listItem':case'using':case'route':case'rec':case'recItem':case'block':case'blockItem':return void console.error('node() hook supported only in h() nodes')}t.node.push(e)},e.rec=U,e.remap=M,e.route=L,e.spec=B,e.text=(e,...t)=>{let a=[e[0]];for(let n=0;n<t.length;n++)a.push(t[n],e[n+1]);B({text:a})},e.tree=({source:e,key:t,child:a,fn:n})=>{let l=U(({store:e})=>{$({source:e,key:t,fn({store:e}){let t=e.map(e=>e[a]||[]);n({store:e,child(){l({store:t})}})}})});l({store:e})},e.using=(e,t)=>{let a,n,l,r,o,i;if('function'==typeof t)a=t,l=O(),r=0;else{if(!t)throw Error('using() second argument is missing');a=t.fn,l=t.env?t.env:O(),r=t.hydrate,n=t.onComplete,o=t.onRoot,i=t.scope}if(!e)throw Error('using() first argument is missing');let c=e.namespaceURI,p=e.tagName.toLowerCase(),f={type:'using',childTemplates:[],childCount:0,inParentIndex:-1},d=b({name:'using',draft:f,isSvgRoot:'svg'===p,namespace:'http://www.w3.org/2000/svg'===c?'svg':'foreignobject'===p?'foreignObject':'html',fn(e,{mount:t}){a(),t.watch(({node:e,leaf:t})=>{D(f,{parentBlockFragment:t.data.block.child,leaf:t,node:e})})},env:l}),h={type:'using',child:{type:'fragment',parent:null,child:[]},value:e};h.child.parent=h;let g=s({onComplete:n}),m=C(d,{parentLeaf:le||null,mountNode:e,svgRoot:d.isSvgRoot?e:le?le.svgRoot:null,leafData:{type:'using',draft:f,element:e,block:h},opGroup:u(g),domSubtree:u(g),hydration:r,refMap:N(i),forkPage:i,env:l});if(o&&o({template:d,leaf:m}),g.onDrain&&!g.rafID){let e=g.onDrain;g.onDrain=null,e()}},e.variant=({source:e,cases:t,key:a})=>{if(!effector.is.unit(e))throw Error('variant({source}) should be unit');let n;n='function'==typeof a?a:null==a?e=>String(e):e=>String(e[a]);let l=0;for(let a in t)'__'!==a?L({source:e,visible:e=>n(e)===a,fn:t[a]}):l=1;if(l){let a=Object.keys(t);L({source:e,visible:e=>!a.includes(n(e)),fn:t.__})}},Object.defineProperty(e,'__esModule',{value:1})});
((e,t)=>{'object'==typeof exports&&'undefined'!=typeof module?t(exports,require('effector')):'function'==typeof define&&define.amd?define(['exports','effector'],t):t((e=e||self).forest={},e.effector)})(this,(e,effector)=>{function t(e,t){e.cursor[t].prev&&(e.cursor[t].prev.cursor[t].next=e.cursor[t].next),e.cursor[t].next&&(e.cursor[t].next.cursor[t].prev=e.cursor[t].prev),e.queue[t].last===e&&(e.queue[t].last=e.cursor[t].prev),e.queue[t].first===e&&(e.queue[t].first=e.cursor[t].next),e.cursor[t].prev=null,e.cursor[t].next=null}function a(e){e.status='active',((e,t)=>{t.cursor.prev&&(t.cursor.prev.cursor.next=t.cursor.next),t.cursor.next&&(t.cursor.next.cursor.prev=t.cursor.prev),e.last===t&&(e.last=t.cursor.prev),e.first===t&&(e.first=t.cursor.next),t.cursor.prev=null,t.cursor.next=null})(n(e),e)}function n(e){return e.group.activeChilds[e.priority]}function l(e,t){t.value.active=t.value.pending=e,'active'!==t.status&&a(t)}function r(e,l){if(l.value.active===e)return l.value.pending=e,void('pending'===l.status&&(a(l),n(l).first||t(l.group,l.priority)));'active'===l.status&&(l.status='pending',n(l).first||((e,t)=>{e.queue[t].last?(e.cursor[t].prev=e.queue[t].last,e.queue[t].last.cursor[t].next=e,e.queue[t].last=e):e.queue[t].first=e.queue[t].last=e})(l.group,l.priority),((e,t)=>{e.last?(t.cursor.prev=e.last,e.last.cursor.next=t,e.last=t):e.first=e.last=t})(n(l),l)),l.value.pending=e,l.group.queue.rafID||(l.group.queue.rafID=Z(l.group.queue.execQueue))}function o(e){K('execQueue');let n,l,r=Y(),o=0;e:for(;e.props.first||e.tree.first||e.data.first;){if(Y()-r>=10){o=1;break e}let i=!!e.props.first;for(i&&K('props');n=e.props.first;){for(;l=n.activeChilds.props.first;){if(Y()-r>=10){o=1,X('props');break e}l.runOp(l.value.pending),l.value.active=l.value.pending,a(l)}t(n,'props')}i&&X('props');let s=!!e.tree.first;for(s&&K('tree');n=e.tree.first;){for(;l=n.activeChilds.tree.first;){if(Y()-r>=10){o=1,X('tree');break e}l.runOp(l.value.pending),l.value.active=l.value.pending,a(l)}t(n,'tree')}s&&X('tree');let u=!!e.data.first;for(u&&K('data');n=e.data.first;){for(;l=n.activeChilds.data.first;){if(Y()-r>=10){o=1,X('data');break e}l.runOp(l.value.pending),l.value.active=l.value.pending,a(l)}t(n,'data')}u&&X('data')}if(X('execQueue'),o)e.rafID=Z(e.execQueue);else if(e.rafID=null,e.onDrain){let t=e.onDrain;e.onDrain=null,t()}}function i({value:e,runOp:t,group:a,priority:n}){return{value:{active:e,pending:e},runOp:t,status:'active',priority:n,group:a,cursor:{prev:null,next:null}}}function s({onComplete:e}){let t={props:{first:null,last:null},tree:{first:null,last:null},data:{first:null,last:null},rafID:null,execQueue(){},onDrain:e};return t.execQueue=o.bind(null,t),t}function u(e){return{ops:[],queue:e,activeChilds:{props:{first:null,last:null},tree:{first:null,last:null},data:{first:null,last:null}},cursor:{props:{prev:null,next:null},tree:{prev:null,next:null},data:{prev:null,next:null}}}}function c({value:e,group:t,onInit:a,onChange:n,onTerminate:l}){let o=i({value:e,group:t,runOp(e){s.status='A',n(e)},priority:'data'}),s={status:'IA',value:o.value,hooks:{onTerminate:l},ops:{init:i({value:0,group:t,runOp(e){s.status='A',a(s.value.active)},priority:'data'}),change:o,terminate:i({value:0,group:t,runOp(e){s.status='T',s.hooks.onTerminate(1)},priority:'data'})}};return r(1,s.ops.init),s}function p(e){switch(e.status){case'I':case'T':case'AT':return;case'A':e.status='AT',r(1,e.ops.terminate);break;case'AA':e.status='AT',r(1,e.ops.terminate),r(e.value.active,e.ops.change);break;case'IA':e.status='T',r(0,e.ops.init),e.hooks.onTerminate(0)}}function f(e,t){switch(t.status){case'I':case'T':return;case'A':t.value.active!==e&&(t.status='AA',r(e,t.ops.change));break;case'AA':t.value.active===e?(t.status='A',r(e,t.ops.change)):t.value.pending!==e&&(t.value.pending=e);break;case'IA':t.value.active=t.value.pending=e}}function d(e,t){for(let a=0;a<t.length;a++){let{type:n,field:l,value:r}=t[a];ee[n](e,l,r)}}function h(e){return''!==e&&0!==e&&'0'!==e&&(0==e||null==e)}function g(e,t,a){h(a)?e.style.removeProperty("--"+t):e.style.setProperty("--"+t,""+a)}function m(e,t,a){h(a)?delete e.style[t]:e.style[t]=""+a}function v(e,t,a){h(a)?delete e.dataset[t]:e.dataset[t]=""+a}function k(e,t,a){if(h(a)){switch(t){case'value':delete e.value;break;case'checked':e.checked=0;break;case'spellcheck':if(0==a)return void e.setAttribute('spellcheck','false')}e.removeAttribute(t)}else{switch(t){case'value':e.value=""+a;break;case'checked':e.checked=""+a}e.setAttribute(t,""+a)}}function y(e,t){e.replaceData(0,(e.textContent||'').length,String(t))}function b({fn:e,state:t={},defer:a=0,name:n="",draft:l,isSvgRoot:r,namespace:o,env:i,isBlock:s=0}){let u=re,c=ne,p={id:++te,name:n,plain:[],watch:[],nameMap:{},pages:[],closure:[],childTemplates:[],upward:effector.step.filter({fn(e,t,a){if(!a.page){if(!a.parent||!a.parent.page)return 1;a.page=a.parent.page}if(!a.page.active)return 0;let n=[a.page.template],l=[a.page];{let e=a.page.parent;for(;e;)l.push(e),n.push(e.template),e=e.parent}return a.node.next.forEach(t=>{let r=t.meta.nativeTemplate;r?n.includes(r)?effector.launch({target:w(t,a.forkPage),params:e,defer:1,page:l[n.indexOf(r)],stack:a,forkPage:a.forkPage}):console.error('context drift',{stack:a,node:t}):effector.launch({target:w(t,a.forkPage),params:e,defer:1,page:null,stack:a,forkPage:a.forkPage})}),0}}),loader:effector.step.filter({fn(e,t,a){if(a.parent){let n=a.forkPage?a.forkPage.graphite.id:null;if(a.page){if(!a.page.active)return 0;if(a.page.template===p)return 1;if(a.page.childSpawns[p.id])a.page.childSpawns[p.id].forEach(t=>{(!n||t.leaf.forkPage&&n===t.leaf.forkPage.graphite.id)&&effector.launch({params:e,target:w(a.node,a.forkPage),page:t,defer:1,forkPage:a.forkPage})});else if(t.targetTemplate){let n=[a.page];{let e=a.page.parent;for(;e;)n.push(e),e=e.parent}let l=n.findIndex(e=>t.targetTemplate===e.template);effector.launch(-1===l?{params:e,target:w(a.node,a.forkPage),page:null,defer:1,forkPage:a.forkPage}:{params:e,target:w(a.node,a.forkPage),page:n[l],defer:1,forkPage:a.forkPage})}else p.pages.forEach(t=>{(!n||t.leaf.forkPage&&n===t.leaf.forkPage.graphite.id)&&t.fullID.startsWith(a.page.fullID)&&effector.launch({params:e,target:w(a.node,a.forkPage),page:t,defer:1,forkPage:a.forkPage})})}else p.pages.forEach(t=>{(!n||t.leaf.forkPage&&n===t.leaf.forkPage.graphite.id)&&effector.launch({params:e,target:w(a.node,a.forkPage),page:t,defer:1,forkPage:a.forkPage})});return 0}return 1}}),parent:c};c&&c.childTemplates.push(p);let f=effector.createNode({meta:{template:p}});ne=p;let d=re={template:p,node:f,api:null,trigger:{mount:effector.createEvent(),unmount:effector.createEvent()},draft:l,isSvgRoot:r,namespace:o,env:i,isBlock:s||!(!u||!u.isBlock)};return a?d.deferredInit=()=>{let a=re,n=ne;re=d,ne=p,d.deferredInit=null;try{effector.withRegion(f,()=>{let a=effector.restore(t);d.api=e(a,d.trigger),p.nameMap=a})}finally{re=a,ne=n}}:effector.withRegion(f,()=>{let a=effector.restore(t);d.api=e(a,d.trigger),p.nameMap=a}),re=u,ne=c,p.actor=d,d}function w(e,t){return t&&t.nodeMap[(e=e.graphite||e).id]||e}function x(e,t){let a=e;switch(t&&oe(t,e)&&(a=oe(t,e)),e.type){case'list':return[...a.current];case'shape':return{...a.current};default:return a.current}}function P(e,t,a){let n=t;for(;n&&!oe(n.spawn,e);)n=n.parentLeaf;return n?oe(n.spawn,e):a&&oe(a,e)?oe(a,e):e}function I(e,t,a){return P(e,t,a).current}function S(e,t){oe(t.spawn,e)||(t.spawn.reg[e.id]=P(e,t.parentLeaf,t.forkPage))}function C(e,{values:t={},parentLeaf:a,mountNode:n,svgRoot:l,leafData:r,opGroup:o,domSubtree:i,hydration:s,forkPage:u,env:c}){function p(e){if(e.before)for(let t=0;t<e.before.length;t++){let a=e.before[t];switch(a.type){case'map':{let t=a.from;S(t,k),g[e.id].current=a.fn(g[t.id].current);break}case'field':{let t=a.from;S(t,k),g[e.id].current[a.field]=g[t.id].current;break}case'closure':S(a.of,k)}}if(!e.after)return;let t=g[e.id].current;for(let a=0;a<e.after.length;a++){let n=e.after[a],l=n.to;switch(g[l.id]||(g[l.id]={id:l.id,current:I(l,k.parentLeaf,u)}),n.type){case'copy':g[l.id].current=t;break;case'map':g[l.id].current=n.fn(t)}}}function f(e,t,a){let n;t.stop=1;try{for(;t.i<e.length;)n=e[t.i],t.i++,n.fn(a[n.of.id]?a[n.of.id].current:I(n.of,k.parentLeaf,u))}catch(e){console.error(e),t.stop=0}}!c&&a&&(c=a.env);let d=a?a.spawn:null,h=e.template,g={},m={id:++ae,fullID:'',reg:g,template:h,parent:d,childSpawns:{},active:1};h.pages.push(m);let v={},k={actor:e,spawn:m,api:v,draft:e.draft,ops:{group:o,domSubtree:i},svgRoot:l,data:r,parentLeaf:a,hydration:s,forkPage:u,env:c},y=le;le=k,d&&(d.childSpawns[h.id]||(d.childSpawns[h.id]=[]),d.childSpawns[h.id].push(m)),m.fullID=d?`${d.fullID}_${m.id}`:""+m.id;for(let e=0;e<h.closure.length;e++){let t=h.closure[e],a=t,n=m.parent;e:for(;n;){if(oe(n,t)){a=oe(n,t);break e}n=n.parent}!n&&u&&oe(u,t)&&(a=oe(u,t)),g[t.id]=a}for(let e=0;e<h.plain.length;e++){let t=h.plain[e],a={id:t.id,current:x(t,u)};g[t.id]=a}for(let e in t){let a=h.nameMap[e].stateRef.id;g[a]={id:a,current:t[e]}}h.closure.forEach(p),h.plain.forEach(p);let b={i:0,stop:0};for(;!b.stop;)f(h.watch,b,g);if(d)for(let e in m.childSpawns)e in d.childSpawns||(d.childSpawns[e]=[]),d.childSpawns[e].push(...m.childSpawns[e]);if(v.mount=(t,a=1)=>effector.launch({target:e.trigger.mount,params:t,defer:a,page:m,forkPage:u}),v.unmount=(t,a=1)=>effector.launch({target:e.trigger.unmount,params:t,defer:a,page:m,forkPage:u}),e.api)for(let t in e.api)v[t]=(a,n=1)=>effector.launch({target:e.api[t],params:a,defer:n,page:m,forkPage:u});return k.spawn.api=v,k.spawn.leaf=k,k.api.mount({node:n,leaf:k}),le=y,k}function T(e){let t=function e(t){switch(t.type){case'using':return t;case'fragment':switch(t.parent.type){case'element':case'using':return t.parent}default:return e((e=>{switch(e.type){case'text':case'element':case'list':case'route':case'rec':case'recItem':case'block':case'blockItem':return e.parent;default:switch(e.parent.type){case'using':case'block':return e.parent;default:return e.parent.parent}}})(t))}}(e);return t?t.value:null}function R(e){if(!e.visible)return null;switch(e.type){case'text':case'element':return e;case'route':return R(e.child);case'LF':case'RF':case'FF':case'rec':case'recItem':case'block':case'blockItem':return(e=>{let t=e.child;for(let e=t.length-1;e>=0;e--){let a=R(t[e]);if(a)return a}return null})(e.child);case'list':{let t=e.lastChild;if(!t)return null;for(;t;){let e=R(t);if(e)return e;t=t.left}return null}default:return null}}function q(e){switch(e.type){case'fragment':switch(e.parent.type){case'element':case'using':return null;case'RF':{let t=e.parent.parent,a=t.parent;for(let e=t.index-1;e>=0;e--){let t=R(a.child[e]);if(t)return t}return q(a)}case'rec':case'recItem':case'block':case'blockItem':case'FF':{let t=e.parent,a=t.parent;for(let e=t.index-1;e>=0;e--){let t=R(a.child[e]);if(t)return t}return q(a)}case'LF':{let t=e.parent.left;for(;t;){let e=R(t);if(e)return e;t=t.left}return q(e.parent.parent)}default:return null}case'element':case'text':case'route':case'rec':case'recItem':case'block':case'blockItem':case'list':{let t=e.parent;for(let a=e.index-1;a>=0;a--){let e=t.child[a];if(!e)continue;let n=R(e);if(n)return n}return q(t)}default:return null}}function A(e){let t=q(e);return t?t.value:null}function D(e,{parentBlockFragment:t,leaf:a,node:n,svgRoot:l,values:r}){e.childTemplates.forEach(e=>{E({parentBlockFragment:t,leaf:a,node:n,svgRoot:l,values:r,actor:e})})}function E({parentBlockFragment:e,leaf:t,node:a,actor:n,svgRoot:l,values:r}){let o,{draft:s}=n,{queue:c}=t.ops.group,p=u(c),f=t.ops.domSubtree,h=f;switch(s.type){case'route':{let t={type:'route',parent:e,child:{type:'RF',parent:null,child:{type:'fragment',parent:null,child:[]},visible:0},visible:1,index:s.inParentIndex};t.child.parent=t,t.child.child.parent=t.child,e.child[s.inParentIndex]=t,o={type:'route',block:t,ops:{},initialized:0};break}case'element':{let a;if(n.isBlock){let e,n,l=t;for(;l&&(!n||!e);){l.actor.env&&(e=l.actor.env);let{draft:t}=l;'element'===t.type&&('svg'===t.tag?n='svg':'foreignObject'===t.tag&&(n='html')),l=l.parentLeaf}n||(n='html'),e&&(a='svg'===n?e.document.createElementNS('http://www.w3.org/2000/svg',s.tag):e.document.createElement(s.tag),d(a,s.staticSeq))}else a=s.stencil.cloneNode();let l={type:'element',parent:e,child:{type:'fragment',parent:null,child:[]},value:a,visible:0,index:s.inParentIndex};l.child.parent=l,e.child[s.inParentIndex]=l,o={type:'element',block:l,ops:{visible:i({value:0,priority:'tree',runOp(e){e?(F(l),o.needToCallNode&&(o.needToCallNode=0,effector.launch({target:ie,params:{element:l.value,fns:s.node},page:g.spawn,forkPage:t.forkPage}))):(l.value.remove(),l.visible=0)},group:f})},needToCallNode:s.node.length>0},h=u(c);break}case'list':{let t={type:'list',parent:e,child:[],lastChild:null,visible:1,index:s.inParentIndex};e.child[s.inParentIndex]=t,o={type:'list',draft:s,block:t};break}case'using':case'listItem':break;case'rec':{let t={type:'rec',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:s.inParentIndex};t.child.parent=t,e.child[s.inParentIndex]=t,o={type:'rec',block:t};break}case'recItem':{let t={type:'recItem',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:s.inParentIndex};t.child.parent=t,e.child[s.inParentIndex]=t,o={type:'rec item',block:t};break}case'block':{let t={type:'block',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:0};t.child.parent=t,e.child[s.inParentIndex]=t,o={type:'block',block:t};break}case'blockItem':{let t={type:'blockItem',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:s.inParentIndex};t.child.parent=t,e.child[s.inParentIndex]=t,o={type:'block item',block:t};break}default:console.warn("unexpected draft type "+s.type)}let g=C(n,{values:r,parentLeaf:t,mountNode:a,svgRoot:l||t.svgRoot,leafData:o,opGroup:p,domSubtree:h,hydration:t.hydration,forkPage:t.forkPage})}function F(e){let t=A(e);t?t.after(e.value):T(e).prepend(e.value),e.visible=1}function M(e,t){if(Array.isArray(t))return t.map(t=>e.map(e=>e[t]));if('object'==typeof t&&null!==t){let a={};for(let n in t){let l=t[n];a[n]=e.map('function'==typeof l?e=>l(e):e=>e[l])}return a}return e.map(e=>e[t])}function O(){if('undefined'!=typeof document)return{document};throw Error('your environment has no document')}function N(e){if(e){if(!e.nodeMap){let t={};for(let a=0;a<e.clones.length;a++){let n=e.clones[a];t[n.meta.forkOf.id]=n}e.nodeMap=t}return e.reg}}function B(e){let t=re.draft;switch(t.type){case'list':return void(e.visible&&(t.itemVisible=e.visible));case'listItem':case'using':case'route':case'rec':case'recItem':case'block':case'blockItem':return}if(e.attr&&t.attr.push(e.attr),e.data&&t.data.push(e.data),'text'in e){let a=e.text,n=t.childCount;Array.isArray(a)?(t.text.push(...a.map((e,t)=>({index:t+n,value:e}))),t.childCount+=a.length):(t.text.push({index:n,value:a}),t.childCount+=1)}if(e.style&&t.styleProp.push(e.style),e.styleVar&&t.styleVar.push(e.styleVar),e.visible&&(t.visible=e.visible),e.handler){let t=e.handler;'object'==typeof t.on?V(t.config||{},t.on):V(t)}e.ɔ&&B(e.ɔ)}function V(e,t){if(!re)return;let a=re.draft;if('element'!==a.type)throw Error(`"handler" extension can be used only with element nodes, got "${a.type}"`);void 0===t&&(t=e,e={});for(let e in t)if(!effector.is.unit(t[e]))throw Error(`handler for "${e}" should be event`);let{passive:n=0,capture:l=0,prevent:r=0,stop:o=0}=e;a.handler.push({options:{prevent:r,stop:o},domConfig:{passive:r?0:n,capture:l},map:t})}function L({source:e,visible:t,fn:a}){if(!re)throw Error('route() called outside from using() closure');let n=b({name:'route',isSvgRoot:0,namespace:re.namespace,env:re.env,draft:{type:'route',childTemplates:[],childCount:0,inParentIndex:-1},fn(n,{mount:l,unmount:r}){let o=e.map(e=>({value:e,visible:t(e)})),i={type:'route',childTemplates:[],childCount:0,inParentIndex:-1},s=b({name:'route item',isSvgRoot:0,namespace:re.namespace,env:re.env,draft:i,state:{store:null},fn({store:e},{mount:t,unmount:n}){let l=effector.createEvent();e.on(l,(e,t)=>t),a({store:e});let r=effector.sample({source:t,clock:o,fn:({leaf:e,node:t},{visible:a,value:n})=>({leaf:e,visible:a,node:t,value:n}),greedy:1});t.watch(({leaf:e,node:t})=>{let a=e.data;a.block.child.visible=1,D(i,{parentBlockFragment:a.block.child.child,leaf:e,node:t})}),r.watch(({leaf:e,visible:t,value:a})=>{e.data.block.child.visible=t,t&&effector.launch({target:l,params:a,defer:1,page:e.spawn,forkPage:e.forkPage}),j(t,e)}),z({unmountSelf:1,mount:t,unmount:n})}});W(s);let{onMount:u,onState:c}=J({mount:l,state:o,onMount:({visible:e,value:t},{leaf:a,node:n})=>({leaf:a,visible:e,node:n,value:t}),onState:({leaf:e,node:t},{visible:a,value:n})=>({leaf:e,visible:a,node:t,value:n})});effector.merge([u,c]).watch(({leaf:e,visible:t,value:a,node:n})=>{let l=e.data;l.block.child.visible=t,t&&!l.initialized&&(E({parentBlockFragment:l.block.child.child,leaf:e,node:n,actor:s,values:{store:a}}),l.initialized=1)}),z({unmountSelf:1,mount:l,unmount:r})}});W(n)}function j(e,t){let a=t=>{let n=t.data;switch(n.type){case'element':r(e,n.ops.visible);break;case'route':case'list':case'list item':G(t,a);break;default:console.log('unsupported type',n.type)}};G(t,a)}function z({unmountSelf:e=0,mount:t,unmount:a}){effector.sample({source:t,clock:a,greedy:1}).watch(e?({leaf:e})=>{Q(e),_(e)}:({leaf:e})=>{Q(e)})}function _({spawn:e}){H(e,e.parent.childSpawns[e.template.id]),H(e,e.template.pages)}function Q(e){e.spawn.active=0,G(e,e=>{e.api.unmount()})}function G(e,t){let{spawn:a}=e;for(let e in a.childSpawns){let n=a.childSpawns[e];for(let e=0;e<n.length;e++)t(n[e].leaf)}}function U(e){let t='function'==typeof e?e:e.fn,a={type:'rec',childTemplates:[],childCount:0,inParentIndex:0},n=b({name:'rec',state:{store:null},isSvgRoot:0,namespace:null,env:null,draft:a,defer:1,isBlock:1,fn({store:e},{mount:n,unmount:l}){t({store:e,state:e});let r=effector.createEvent();return e.on(r,(e,t)=>t),n.watch(({node:e,leaf:t})=>{D(a,{parentBlockFragment:t.data.block.child,leaf:t,node:e})}),z({mount:n,unmount:l}),{itemUpdater:r}}});return({store:e,state:t=e})=>{n.deferredInit&&n.deferredInit();let{env:a,namespace:l}=re;W(b({name:'rec item',isSvgRoot:0,namespace:l,env:a,draft:{type:'recItem',childTemplates:[],childCount:0,inParentIndex:-1},fn(e,{mount:a,unmount:l}){let{onMount:r,onState:o}=J({state:t,mount:a,onMount:(e,{leaf:t,node:a})=>({state:e,leaf:t,node:a}),onState:({leaf:e,node:t},a)=>({state:a,leaf:e,node:t})});z({mount:a,unmount:l}),o.watch(({state:e,leaf:t})=>{G(t,t=>{t.api.itemUpdater(e)})}),r.watch(({node:e,leaf:t,state:a})=>{E({parentBlockFragment:t.data.block.child,leaf:t,node:e,actor:n,values:{store:a}})})}}))}}function $(e,t){'function'==typeof t&&(effector.is.unit(e)?e={source:e,fn:t}:e.fn=t);let{fn:a,key:n,source:l,fields:r=[]}=e,o=void 0!==n?'function'==typeof n?n:e=>e[n]:(e,t)=>t,i={type:'list',key:effector.is.store(e)?{type:'index'}:{type:'key',key:e.key},childTemplates:[],childCount:0,inParentIndex:-1};if(!re)throw Error('list() called outside from using() closure');let s=re.env,d=re.namespace;W(b({name:'list',draft:i,isSvgRoot:0,namespace:d,fn(e,{mount:t,unmount:n}){let h=b({name:'list item',state:{id:-1,store:null},draft:i,isSvgRoot:0,namespace:d,fn({id:e,store:t},{mount:n,unmount:l}){a({store:t,key:e,fields:M(t,r)});let o=effector.createEvent();if(t.on(o,(e,t)=>t),effector.sample({source:n,clock:l,greedy:1}).watch(({leaf:e})=>{let t=e.data.block;H(t,t.parent.child);let a=t.left,n=t.right;a&&(a.right=n,n||t.parent.lastChild!==t||(t.parent.lastChild=a)),n&&(n.left=a),a||n||t.parent.lastChild!==t||(t.parent.lastChild=null),t.left=null,t.right=null,Q(e),_(e)}),i.itemVisible){let{onMount:e,onState:t}=J({mount:n,state:i.itemVisible,onMount:(e,{node:t,leaf:a})=>({visible:e,node:t,leaf:a}),onState:({node:e,leaf:t},a)=>({visible:a,node:e,leaf:t})});e.watch(({visible:e,node:t,leaf:a})=>{let n=a.data.block;n.visible=e,n.childInitialized=e,e&&D(i,{parentBlockFragment:n.child,leaf:a,node:t})}),t.watch(({visible:e,node:t,leaf:a})=>{let n=a.data.block;n.visible=e,n.childInitialized?j(e,a):e&&(n.childInitialized=1,D(i,{parentBlockFragment:n.child,leaf:a,node:t}))})}else n.watch(({node:e,leaf:t})=>{let a=t.data.block;a.visible=1,a.childInitialized=1,D(i,{parentBlockFragment:a.child,leaf:t,node:e})});return{itemUpdater:o}},env:s}),g=effector.createStore([]),m=l.map(e=>e),v=effector.sample({source:l,clock:t,fn:(e,{node:t,leaf:a})=>({updates:e,node:t,leaf:a,hydration:a.hydration}),greedy:1}),k=effector.sample({source:v,clock:m,fn:({node:e,leaf:t},a)=>({updates:a,node:e,leaf:t,hydration:0}),greedy:1});effector.sample({source:g,clock:[v,k],greedy:1,fn(e,{node:t,updates:a,leaf:n,hydration:r}){let i=n.data.block;K('list update ['+l.shortName+']');let s=Array(a.length).fill(0),d=a.map(o),g=[];for(let t=0;t<e.length;t++){let n=e[t],l=d.indexOf(n.key);-1!==l?(g.push(n),s[l]=1,f(a[l],n.asyncValue)):(n.active=0,n.instance&&n.instance.api.unmount(),p(n.asyncValue))}for(let e=0;e<a.length;e++){if(s[e])continue;let l=a[e],o=d[e],p=u(n.ops.group.queue),f={type:'LF',parent:i,child:{type:'fragment',parent:null,child:[]},childInitialized:0,visible:0,left:null,right:null},m={type:'listItem',key:o,index:o,active:1,leafData:{type:'list item',block:f},asyncValue:c({value:l,group:p,onTerminate(e){},onChange(e){m.instance&&m.instance.api.itemUpdater(e)},onInit(e){m.active&&(r||(m.instance=C(h,{values:{id:o,store:e},parentLeaf:n,mountNode:t,svgRoot:n.svgRoot,leafData:m.leafData,opGroup:p,domSubtree:n.ops.domSubtree,hydration:r,forkPage:n.forkPage})))}})},v=g.length;g.push(m);let k=v>0?g[v-1].leafData:null;if(f.child.parent=f,i.child.push(f),k){let e=k.block;f.left=e;let t=e.right;t?(t.left=f,f.right=t):i.lastChild=f,e.right=f}else i.lastChild=f;r&&(m.instance=C(h,{values:{id:o,store:l},parentLeaf:n,mountNode:t,svgRoot:n.svgRoot,leafData:m.leafData,opGroup:p,domSubtree:n.ops.domSubtree,hydration:r,forkPage:n.forkPage}))}return X('list update ['+l.shortName+']'),0===g.length&&(i.lastChild=null),g},target:g}),effector.sample({source:t,clock:effector.sample({source:g,clock:n,greedy:1}),fn:({leaf:e},t)=>({leaf:e,records:t}),greedy:1}).watch(({leaf:e,records:t})=>{for(let e=0;e<t.length;e++){let a=t[e];a.instance&&a.instance.api.unmount(),a.active=0}e.spawn.active=0,_(e)})},env:s}))}function W(e){if(!re)return;let{draft:t}=e;if('listItem'!==t.type&&'rec'!==t.type)switch(re.draft.type){case'element':case'using':case'route':case'list':case'rec':case'recItem':case'block':case'blockItem':t.inParentIndex=re.draft.childCount,re.draft.childCount+=1,re.draft.childTemplates.push(e);break;default:console.warn("unexpected currentActor type "+re.draft.type)}}function H(e,t){if(!t)return;let a=t.indexOf(e);-1!==a&&t.splice(a,1)}function J({mount:e,state:t,onMount:a,onState:n}){return{onMount:effector.sample({source:t,clock:e,fn:a,greedy:1}),onState:effector.sample({source:e,clock:t,fn:n,greedy:1})}}let K,X,Y;'undefined'!=typeof performance&&performance.mark?(K=e=>{performance.mark('☄️ '+e+' start')},X=e=>{try{performance.measure('☄️ '+e,'☄️ '+e+' start')}catch(e){}performance.clearMarks('☄️ '+e+' start'),performance.clearMeasures('☄️ '+e)}):(K=()=>{},X=()=>{}),Y='undefined'!=typeof performance&&performance.now?()=>performance.now():'undefined'!=typeof process&&process.hrtime?()=>{let e=process.hrtime();return(1e9*e[0]+e[1])/1e6}:()=>Date.now();let Z='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0);const ee={attr:k,data:v,style:m,styleVar:g};let te=0,ae=0,ne=null,le=null,re=null;const oe=(e,t)=>e.reg[t.id];let ie=effector.createEvent();ie.watch(({fns:e,element:t})=>{e.forEach(e=>{e(t)})}),e.block=({fn:e,env:t,namespace:a="html"})=>{let n={type:'block',childTemplates:[],childCount:0,inParentIndex:0},l=b({name:'block',isSvgRoot:0,namespace:a,env:t,draft:n,isBlock:1,fn({},{mount:t,unmount:a}){e(),t.watch(({node:e,leaf:t})=>{D(n,{parentBlockFragment:t.data.block.child,leaf:t,node:e})}),z({mount:t,unmount:a})}});return()=>{let e={type:'blockItem',childTemplates:[],childCount:0,inParentIndex:-1,itemOf:n},{env:t,namespace:a}=re;W(b({name:'block item',isSvgRoot:0,namespace:a,env:t,draft:e,fn(e,{mount:t,unmount:a}){z({mount:t,unmount:a}),t.watch(({node:e,leaf:t})=>{E({parentBlockFragment:t.data.block.child,leaf:t,node:e,actor:l})})}}))}},e.h=(e,t)=>{function a(e){return e.data.block.value}function n(e,t,a){let n=e.data.block.child,l={type:'text',parent:n,visible:0,index:a,value:null};if(n.child[a]=l,e.hydration){let a=q(l);if(a)switch(a.type){case'text':l.value=e.env.document.createTextNode(t),a.value.after(l.value);break;case'element':l.value=a.value.nextSibling,y(l.value,t)}else{let e=T(l);l.value=e.firstChild,y(l.value,t)}l.visible=1}else l.value=e.env.document.createTextNode(t),F(l);return l}let o,s=0,u=0;if('function'==typeof t?(s=1,o=t):t&&(u=1,t.fn&&(s=1,o=t.fn),t.ɔ&&('function'==typeof t.ɔ?(s=1,o=t.ɔ):'function'==typeof t.ɔ.fn&&(s=1,o=t.ɔ.fn))),!re)throw Error('h() called outside from using() closure');let c,p=re.env,f=re.namespace,h=f,x='html';h=x='svg'===f?'svg':'html','svg'===e&&(x='svg',h='svg'),re.isBlock||(c='svg'===x?p.document.createElementNS('http://www.w3.org/2000/svg',e):p.document.createElement(e));let P=c,I={type:'element',tag:e,attr:[],data:[],text:[],styleProp:[],styleVar:[],handler:[],stencil:P,seq:[],staticSeq:[],childTemplates:[],childCount:0,inParentIndex:-1,opsAmount:1,node:[]};'foreignObject'===f?(I.attr.push({xmlns:'http://www.w3.org/1999/xhtml'}),h='html'):'svg'===e?(I.attr.push({xmlns:'http://www.w3.org/2000/svg'}),h='svg'):'foreignObject'===e&&(h='foreignObject');let S=b({name:'element',draft:I,isSvgRoot:'svg'===e,namespace:h,fn(e,{mount:c,unmount:p}){function f(e){return J({mount:h,state:e,onMount:(e,t)=>({leaf:t,value:e}),onState:(e,t)=>({leaf:e,value:t})})}let h=effector.createEvent(),b=c.map(({leaf:e})=>e);s&&o(),u&&B(t);let x={attr:{},data:{},text:I.text,styleProp:{},styleVar:{},visible:I.visible||null,handler:I.handler};for(let e=0;e<I.attr.length;e++){let t=I.attr[e];for(let e in t)'xlink:href'===e?x.attr.href=t[e]:x.attr[e]=t[e]}for(let e=0;e<I.data.length;e++){let t=I.data[e];for(let e in t)x.data[e]=t[e]}for(let e=0;e<I.styleProp.length;e++){let t=I.styleProp[e];for(let e in t)e.startsWith('--')?x.styleVar[e.slice(2)]=t[e]:x.styleProp[e]=t[e]}for(let e=0;e<I.styleVar.length;e++){let t=I.styleVar[e];for(let e in t)x.styleVar[e]=t[e]}x.visible&&I.seq.push({type:'visible',value:x.visible});for(let e in x.attr){let t=x.attr[e];effector.is.unit(t)?I.seq.push({type:'attr',field:e,value:t}):I.staticSeq.push({type:'attr',field:e,value:t})}for(let e in x.data){let t=x.data[e];effector.is.unit(t)?I.seq.push({type:'data',field:e,value:t}):I.staticSeq.push({type:'data',field:e,value:t})}for(let e in x.styleProp){let t=x.styleProp[e];effector.is.unit(t)?I.seq.push({type:'style',field:e,value:t}):I.staticSeq.push({type:'style',field:e,value:t})}for(let e in x.styleVar){let t=x.styleVar[e];effector.is.unit(t)?I.seq.push({type:'styleVar',field:e,value:t}):I.staticSeq.push({type:'styleVar',field:e,value:t})}for(let e=0;e<x.text.length;e++){let t=x.text[e];if(null!==t.value)if(effector.is.unit(t.value)){I.seq.push({type:'dynamicText',value:t.value,childIndex:t.index});let e=t.value.stateRef,a=ne;a.plain.includes(e)||a.closure.includes(e)||a.closure.push(e)}else I.seq.push({type:'staticText',value:String(t.value),childIndex:t.index})}for(let e=0;e<x.handler.length;e++){let t=x.handler[e];for(let e in t.map)I.seq.push({type:'handler',for:e,handler:t.map[e],options:t.options,domConfig:t.domConfig})}if(x.visible){let{onMount:e,onState:t}=J({mount:b,state:x.visible,onMount:(e,t)=>({leaf:t,value:e,hydration:t.hydration}),onState:(e,t)=>({leaf:e,value:t,hydration:0})});e.watch(({leaf:e,value:t,hydration:a})=>{let n=e.data,r=n.block;if(a&&(l(t,n.ops.visible),t)){let e,t=A(r);if(e=t?t.nextSibling:T(r).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}r.value=e,r.visible=1}D(I,{parentBlockFragment:r.child,leaf:e,node:r.value,svgRoot:S.isSvgRoot?r.value:null}),t&&n.needToCallNode&&(n.needToCallNode=0,effector.launch({target:ie,params:{element:n.block.value,fns:I.node},page:e.spawn,defer:1,forkPage:e.forkPage})),effector.launch({target:h,params:e,defer:1,page:e.spawn,forkPage:e.forkPage})}),effector.merge([t,e]).watch(({leaf:e,value:t,hydration:a})=>{a||r(t,e.data.ops.visible)})}P&&d(P,I.staticSeq);for(let e=0;e<I.seq.length;e++){let t=I.seq[e];switch(t.type){case'visible':break;case'attr':{let{field:e}=t,n='value'===e||'checked'===e||'min'===e||'max'===e,{onMount:l,onState:o}=f(t.value);if(n)effector.merge([o,l]).watch(({leaf:t,value:n})=>{k(a(t),e,n)});else{let t=I.opsAmount++;l.watch(({value:n,leaf:l})=>{let r=a(l),o=i({value:n,priority:'props',runOp(t){k(r,e,t)},group:l.ops.group});l.ops.group.ops[t]=o,k(r,e,n)}),o.watch(({value:e,leaf:a})=>{r(e,a.ops.group.ops[t])})}break}case'data':{let{field:e}=t,{onMount:n,onState:l}=f(t.value),o=I.opsAmount++;n.watch(({value:t,leaf:n})=>{let l=a(n),r=i({value:t,priority:'props',runOp(t){v(l,e,t)},group:n.ops.group});n.ops.group.ops[o]=r,v(l,e,t)}),l.watch(({value:e,leaf:t})=>{r(e,t.ops.group.ops[o])});break}case'style':{let e=I.opsAmount++,{field:n}=t,{onMount:l,onState:o}=f(t.value);l.watch(({value:t,leaf:l})=>{let r=a(l),o=i({value:t,priority:'props',runOp(e){m(r,n,e)},group:l.ops.group});l.ops.group.ops[e]=o,m(r,n,t)}),o.watch(({value:t,leaf:a})=>{r(t,a.ops.group.ops[e])});break}case'styleVar':{let{field:e}=t,{onMount:n,onState:l}=f(t.value),o=I.opsAmount++;n.watch(({value:t,leaf:n})=>{let l=a(n),r=i({value:t,priority:'props',runOp(t){g(l,e,t)},group:n.ops.group});n.ops.group.ops[o]=r,g(l,e,t)}),l.watch(({value:e,leaf:t})=>{r(e,t.ops.group.ops[o])});break}case'staticText':h.map(e=>e).watch(e=>{n(e,t.value,t.childIndex)});break;case'dynamicText':{let e=I.opsAmount++;effector.sample({source:t.value,clock:h,fn:(e,t)=>({value:String(e),leaf:t}),greedy:1}).watch(({value:a,leaf:l})=>{let r=i({value:a,priority:'props',runOp(e){y(o.value,e)},group:l.ops.group});l.ops.group.ops[e]=r;let o=n(l,a,t.childIndex)}),effector.sample({source:h,clock:t.value,fn:(e,t)=>({leaf:e,text:t}),greedy:1}).watch(({leaf:t,text:a})=>{r(a,t.ops.group.ops[e])});break}case'handler':{let e=t.handler.graphite.meta.nativeTemplate||null;h.watch(n=>{let l=null;if(e){let t=0,a=n.spawn;for(;!t&&a;)a.template===e?(t=1,l=a):a=a.parent}a(n).addEventListener(t.for,e=>{t.options.prevent&&e.preventDefault(),t.options.stop&&e.stopPropagation(),effector.launch({target:w(t.handler,n.forkPage),params:e,page:l,forkPage:n.forkPage})},t.domConfig)});break}}}effector.sample({source:b,clock:p,greedy:1}).watch(e=>{let{spawn:t}=e;H(t,t.parent.childSpawns[t.template.id]),function e(t){t.active=0,H(t,t.template.pages);for(let a in t.childSpawns)t.childSpawns[a].forEach(e)}(t),r(0,e.data.ops.visible)}),c.watch(({leaf:e})=>{let t=e.data;if(!I.visible){let a=t.ops.visible,n=t.block;if(e.hydration){l(1,a);let e,t=A(n);if(e=t?t.nextSibling:T(n).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}n.value=e,n.visible=1}D(I,{parentBlockFragment:n.child,leaf:e,node:n.value,svgRoot:S.isSvgRoot?n.value:null}),effector.launch({target:h,params:e,defer:1,page:e.spawn,forkPage:e.forkPage}),e.hydration?t.needToCallNode&&(t.needToCallNode=0,effector.launch({target:ie,params:{element:t.block.value,fns:I.node},page:e.spawn,defer:1,forkPage:e.forkPage})):r(1,a)}})},env:p});W(S)},e.handler=V,e.list=$,e.node=e=>{let t=re.draft;switch(t.type){case'list':case'listItem':case'using':case'route':case'rec':case'recItem':case'block':case'blockItem':return void console.error('node() hook supported only in h() nodes')}t.node.push(e)},e.rec=U,e.remap=M,e.route=L,e.spec=B,e.text=(e,...t)=>{let a=[e[0]];for(let n=0;n<t.length;n++)a.push(t[n],e[n+1]);B({text:a})},e.tree=({source:e,key:t,child:a,fn:n})=>{let l=U(({store:e})=>{$({source:e,key:t,fn({store:e}){let t=e.map(e=>e[a]||[]);n({store:e,child(){l({store:t})}})}})});l({store:e})},e.using=(e,t)=>{let a,n,l,r,o,i;if('function'==typeof t)a=t,l=O(),r=0;else{if(!t)throw Error('using() second argument is missing');a=t.fn,l=t.env?t.env:O(),r=t.hydrate,n=t.onComplete,o=t.onRoot,i=t.scope}if(!e)throw Error('using() first argument is missing');let c=e.namespaceURI,p=e.tagName.toLowerCase(),f={type:'using',childTemplates:[],childCount:0,inParentIndex:-1},d=b({name:'using',draft:f,isSvgRoot:'svg'===p,namespace:'http://www.w3.org/2000/svg'===c?'svg':'foreignobject'===p?'foreignObject':'html',fn(e,{mount:t}){a(),t.watch(({node:e,leaf:t})=>{D(f,{parentBlockFragment:t.data.block.child,leaf:t,node:e})})},env:l}),h={type:'using',child:{type:'fragment',parent:null,child:[]},value:e};h.child.parent=h;let g=s({onComplete:n}),m=C(d,{parentLeaf:le||null,mountNode:e,svgRoot:d.isSvgRoot?e:le?le.svgRoot:null,leafData:{type:'using',draft:f,element:e,block:h},opGroup:u(g),domSubtree:u(g),hydration:r,refMap:N(i),forkPage:i,env:l});if(o&&o({template:d,leaf:m}),g.onDrain&&!g.rafID){let e=g.onDrain;g.onDrain=null,e()}},e.variant=({source:e,cases:t,key:a})=>{if(!effector.is.unit(e))throw Error('variant({source}) should be unit');let n;n='function'==typeof a?a:null==a?e=>String(e):e=>String(e[a]);let l=0;for(let a in t)'__'!==a?L({source:e,visible:e=>n(e)===a,fn:t[a]}):l=1;if(l){let a=Object.keys(t);L({source:e,visible:e=>!a.includes(n(e)),fn:t.__})}},Object.defineProperty(e,'__esModule',{value:1})});
//# sourceMappingURL=forest.umd.js.map
{
"name": "forest",
"version": "0.19.0",
"version": "0.19.1",
"description": "UI engine for web",

@@ -5,0 +5,0 @@ "main": "forest.cjs.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc