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

forest

Package Overview
Dependencies
Maintainers
5
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.21.1 to 0.21.2

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,l;e.status='active',t=a(e),(l=e).cursor.prev&&(l.cursor.prev.cursor.next=l.cursor.next),l.cursor.next&&(l.cursor.next.cursor.prev=l.cursor.prev),t.last===l&&(t.last=l.cursor.prev),t.first===l&&(t.first=l.cursor.next),l.cursor.prev=null,l.cursor.next=null}function a(e){return e.group.activeChilds[e.priority]}function l(e,a){a.value.active=a.value.pending=e,'active'!==a.status&&t(a)}function n(l,n){if(n.value.active===l)return n.value.pending=l,void('pending'===n.status&&(t(n),a(n).first||e(n.group,n.priority)));var r,o,s,i;'active'===n.status&&(n.status='pending',a(n).first||((s=n.group).queue[i=n.priority].last?(s.cursor[i].prev=s.queue[i].last,s.queue[i].last.cursor[i].next=s,s.queue[i].last=s):s.queue[i].first=s.queue[i].last=s),o=n,(r=a(n)).last?(o.cursor.prev=r.last,r.last.cursor.next=o,r.last=o):r.first=r.last=o),n.value.pending=l,n.group.queue.rafID||(n.group.queue.rafID=ue(n.group.queue.execQueue))}function r(a){ie('execQueue');let l,n,r=le(),o=0;e:for(;a.props.first||a.tree.first||a.data.first;){if(le()-r>=1e3){o=1;break e}let s=!!a.props.first;for(s&&ie('props');l=a.props.first;){for(;n=l.activeChilds.props.first;){if(le()-r>=1e3){o=1,ce('props');break e}n.runOp(n.value.pending),n.value.active=n.value.pending,t(n)}e(l,'props')}s&&ce('props');let i=!!a.tree.first;for(i&&ie('tree');l=a.tree.first;){for(;n=l.activeChilds.tree.first;){if(le()-r>=1e3){o=1,ce('tree');break e}n.runOp(n.value.pending),n.value.active=n.value.pending,t(n)}e(l,'tree')}i&&ce('tree');let c=!!a.data.first;for(c&&ie('data');l=a.data.first;){for(;n=l.activeChilds.data.first;){if(le()-r>=1e3){o=1,ce('data');break e}n.runOp(n.value.pending),n.value.active=n.value.pending,t(n)}e(l,'data')}c&&ce('data')}if(ce('execQueue'),o)a.rafID=ue(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:l}){return{value:{active:e,pending:e},runOp:t,status:'active',priority:l,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=r.bind(null,t),t}function i(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:l}){let r=o({value:e,group:t,runOp(e){s.status='A',l(e)},priority:'data'}),s={status:'IA',value:r.value,ops:{init:o({value:0,group:t,runOp(e){s.status='A',a(s.value.active)},priority:'data'}),change:r,terminate:o({value:0,group:t,runOp(e){s.status='T'},priority:'data'})}};return n(1,s.ops.init),s}function u(e){switch(e.status){case'I':case'T':case'AT':return;case'A':e.status='AT',n(1,e.ops.terminate);break;case'AA':e.status='AT',n(1,e.ops.terminate),n(e.value.active,e.ops.change);break;case'IA':e.status='T',n(0,e.ops.init)}}function p(e,t){switch(t.status){case'I':case'T':return;case'A':t.value.active!==e&&(t.status='AA',n(e,t.ops.change));break;case'AA':t.value.active===e?(t.status='A',n(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){switch(e=String(e)){case'__proto__':case'__defineGetter__':case'__defineSetter__':case'constructor':case'prototype':case'hasOwnProperty':case'toString':case'valueOf':case'setProperty':case'removeProperty':return'forbidden';default:return e.replace(/[^a-zA-Z0-9\-_]/g,'')}}function f(e,t){for(let a=0;a<t.length;a++){let{type:l,field:n,value:r}=t[a];pe[l](e,n,r)}}function m(e){return''!==e&&0!==e&&'0'!==e&&(0==e||null==e)}function v(e,t,a){m(a)?e.style.removeProperty(`--${t}`):e.style.setProperty(`--${t}`,`${a}`)}function h(e,t,a){m(a)?delete e.style[t]:e.style[t]=`${a}`}function g(e,t,a){t&&t.trim().length>0&&(a?e.classList.add(t):(e.classList.remove(t),0===e.classList.length&&e.removeAttribute('class')))}function b(e,t,a){m(a)?delete e.dataset[t]:e.dataset[t]=`${a}`}function y(e,t,a){if(m(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 x({fn:e,state:t={},defer:a=0,name:l="",draft:n,isSvgRoot:r,namespace:o,env:s,isBlock:i=0}){let c=he,u={id:++me,name:l,plain:[],watch:[],nameMap:{},pages:[],closure:[],childTemplates:[],handlers:fe,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.root.activeSpawns.has(a.page.fullID))return console.count('inactive page upward'),0;let l=[a.page.template],n=[a.page];{let e=a.page.parent;for(;e;)n.push(e),l.push(e.template),e=e.parent}return a.node.next.forEach((t=>{let r=t.meta.nativeTemplate;if(r)if(l.includes(r)){let o=n[l.indexOf(r)];effector.launch({target:t,params:e,defer:1,page:o,stack:a,scope:a.scope})}else console.error('context drift',{stack:a,node:t});else effector.launch({target:t,params:e,defer:1,page:a.page,stack:a,scope:a.scope})})),0}}),loader:effector.step.filter({fn(e,t,a){if(a.parent){let t=a.scope?a.scope.graphite.id:null;if(a.page){if(!a.page.root.activeSpawns.has(a.page.fullID))return console.count('inactive page loader'),0;if(a.page.template===u)return 1;if(a.page.root.childSpawns[a.page.fullID][u.id])a.page.root.childSpawns[a.page.fullID][u.id].forEach((l=>{(!t||l.root.scope&&t===l.root.scope.graphite.id)&&effector.launch({params:e,target:a.node,page:l,defer:1,scope:a.scope})}));else{let l=a.page.fullID,n='rec'===a.page.template.name;u.pages.forEach((r=>{if(!t||r.root.scope&&t===r.root.scope.graphite.id)if(r.fullID===l||r.fullID.startsWith(`${l}_`)){let t=1;if(n){let e=a.page.template.id,l=r.parent;for(;l&&l!==a.page;){if(l.template.id===e){t=0;break}l=l.parent}}t&&effector.launch({params:e,target:a.node,page:r,defer:1,scope:a.scope})}else l.startsWith(`${r.fullID}_`)&&effector.launch({params:e,target:a.node,page:a.page,defer:1,scope:a.scope})}))}}else u.pages.forEach((l=>{(!t||l.root.scope&&t===l.root.scope.graphite.id)&&effector.launch({params:e,target:a.node,page:l,defer:1,scope:a.scope})}));return 0}return 1}}),parent:c,node:null,api:null,trigger:{mount:effector.createEvent({named:'mount'})},draft:n,isSvgRoot:r,namespace:o,env:s,isBlock:i||!(!c||!c.isBlock)};c&&c.childTemplates.push(u);let p=effector.createNode({meta:{template:u}});return u.node=p,he=u,a?u.deferredInit=()=>{let a=he;he=u,u.deferredInit=null;try{effector.withRegion(p,(()=>{let a=effector.restore(t);u.api=e(a,u.trigger),u.nameMap=a}))}finally{he=a}}:effector.withRegion(p,(()=>{let a=effector.restore(t);u.api=e(a,u.trigger),u.nameMap=a})),he=c,u}function I(e,t){let a;switch(a=t?t.getState(e):e.current,e.type){case'list':return[...a];case'shape':return{...a};default:return a}}function w(e,t,a){let l=t;for(;l&&!be(l,e);)l=l.parent;return l?be(l,e):a?(a.getState(e),a.reg[e.id]):e}function S(e,t){be(t,e)||(t.reg[e.id]=w(e,t.parent,t.root.scope))}function D(e,t,a){t in a||(a[t]=[]),a[t].push(...e)}function C(e,{values:t={},parentLeaf:a,mountNode:l,svgRoot:n,leafData:r,opGroup:o,domSubtree:s,hydration:i,root:c}){function u(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,l=a.from;if(!a.fn&&!l)break;l&&(S(l,f),t=d[l.id].current),d[e.id].current=a.fn?a.fn(t):t;break}case'field':{let t=a.from;S(t,f),d[e.id].current[a.field]=d[t.id].current;break}case'closure':S(a.of,f)}}}function p(e,t,a){let l;t.stop=1;try{for(;t.i<e.length;)l=e[t.i],t.i++,l.fn(a[l.of.id]?a[l.of.id].current:w(l.of,f.parent,f.root.scope).current)}catch(e){console.error(e),t.stop=0}}let d={},f={draft:e.draft,svgRoot:n,data:r,parent:a,hydration:i,mountNode:l,root:c,id:++ve,fullID:'',reg:d,template:e};e.pages.push(f);let m=ge;ge=f,a&&D([f],e.id,c.childSpawns[a.fullID]),f.fullID=a?`${a.fullID}_${f.id}`:`${f.id}`,c.childSpawns[f.fullID]={},c.activeSpawns.add(f.fullID),c.leafOps[f.fullID]={group:o,domSubtree:s};for(let t=0;t<e.closure.length;t++){let a=e.closure[t],l=a,n=f.parent;e:for(;n;){if(be(n,a)){l=be(n,a);break e}n=n.parent}!n&&c.scope&&(c.scope.getState(a),l=c.scope.reg[a.id]),d[a.id]=l}for(let t=0;t<e.plain.length;t++){let a=e.plain[t],l={id:a.id,current:I(a,c.scope)};d[a.id]=l}for(let a in t){let l=e.nameMap[a].stateRef.id;d[l]={id:l,current:t[a]}}e.closure.forEach(u),e.plain.forEach(u);let v={i:0,stop:0};for(;!v.stop;)p(e.watch,v,d);if(a)for(let e in c.childSpawns[f.fullID])D(c.childSpawns[f.fullID][e],e,c.childSpawns[a.fullID]);if(ye)ye.steps.push({target:e.trigger.mount,params:f,defer:1,page:f,scope:c.scope});else{let t;ye={parent:ye,steps:[{target:e.trigger.mount,params:f,defer:1,page:f,scope:c.scope}]};do{for(;t=ye.steps.shift();)ye={parent:ye,steps:[]},effector.launch(t)}while(ye=ye.parent)}return ge=m,f}function O(e){let t=e.parent;for(;'element'!==t.type&&'using'!==t.type;)t=t.parent;return t?t.value:null}function T(e){if(!e.visible)return null;switch(e.type){case'text':case'element':return e;case'LF':case'route':case'rec':case'recItem':case'block':case'blockItem':for(let t=e.child.length-1;t>=0;t--){let a=T(e.child[t]);if(a)return a}return null;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 q(e){switch(e.type){case'using':return null;case'LF':{let t=e.left;for(;t;){let e=T(t);if(e)return e;t=t.left}return q(e.parent)}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 l=T(e);if(l)return l}switch(t.type){case'element':case'using':return null}return q(t)}default:return null}}function R(e){let t=q(e);return t?t.value:null}function A(e,t){if(!e)throw Error(t)}function E(e,t){if(!e)throw Error(`${t}() called outside from using() closure`)}function P(e){if(!he)return;let{draft:t}=e;if('listItem'!==t.type&&'rec'!==t.type)switch(he.draft.type){case'element':case'using':case'route':case'list':case'rec':case'recItem':case'block':case'blockItem':t.inParentIndex=he.draft.childCount,he.draft.childCount+=1,he.draft.childTemplates.push(e);break;default:console.warn(`unexpected currentTemplate type ${he.draft.type}`)}}function M(e,{parentBlockFragment:t,leaf:a,node:l,svgRoot:n,values:r}){e.childTemplates.forEach((e=>{N({parentBlockFragment:t,leaf:a,node:l,svgRoot:n,values:r,actor:e})}))}function N({parentBlockFragment:e,leaf:t,node:a=t.mountNode,actor:l,svgRoot:n,values:r}){let s;A(ke.includes(e.type),`incorrect parent ${e.type}`);let{draft:c}=l,{queue:u}=t.root.leafOps[t.fullID].group,p=i(u),d=t.root.leafOps[t.fullID].domSubtree,m=d;switch(c.type){case'route':{let t={type:'route',parent:e,child:[],visible:0,index:c.inParentIndex};e.child[c.inParentIndex]=t,s={type:'route',block:t,ops:{},initialized:0,pendingInit:null};break}case'element':{let a;if(l.isBlock){let e,l,n=t;for(;n&&(!l||!e);){n.template.env&&(e=n.template.env);let{draft:t}=n;'element'===t.type&&('svg'===t.tag?l='svg':'foreignObject'===t.tag&&(l='html')),n=n.parent}l||(l='html'),e&&(a='svg'===l?e.document.createElementNS('http://www.w3.org/2000/svg',c.tag):e.document.createElement(c.tag),f(a,c.staticSeq))}else a=c.stencil.cloneNode();let n={type:'element',parent:e,child:[],value:a,visible:0,index:c.inParentIndex};e.child[c.inParentIndex]=n,s={type:'element',block:n,ops:{visible:o({value:0,priority:'tree',runOp(e){if(e){L(n);let e=s;e.needToCallNode&&(e.needToCallNode=0,effector.launch({target:xe,params:{element:n.value,fns:c.node},page:v,scope:t.root.scope})),n.visible=1}else n.value.remove(),n.visible=0},group:d})},needToCallNode:c.node.length>0},m=i(u);break}case'list':{let t={type:'list',parent:e,child:[],lastChild:null,visible:1,index:c.inParentIndex};e.child[c.inParentIndex]=t,s={type:'list',draft:c,block:t,records:[],pendingUpdate:null};break}case'using':case'listItem':break;case'rec':{let t={type:'rec',parent:e,child:[],visible:1,index:c.inParentIndex};e.child[c.inParentIndex]=t,s={type:'rec',block:t};break}case'recItem':{let t={type:'recItem',parent:e,child:[],visible:1,index:c.inParentIndex};e.child[c.inParentIndex]=t,s={type:'rec item',block:t};break}case'block':{let t={type:'block',parent:e,child:[],visible:1,index:c.inParentIndex};e.child[c.inParentIndex]=t,s={type:'block',block:t};break}case'blockItem':{let t={type:'blockItem',parent:e,child:[],visible:1,index:c.inParentIndex};e.child[c.inParentIndex]=t,s={type:'block item',block:t};break}default:console.warn(`unexpected draft type ${c.type}`)}let v=C(l,{values:r,parentLeaf:t,mountNode:a,svgRoot:n||t.svgRoot,leafData:s,opGroup:p,domSubtree:m,hydration:t.hydration,root:t.root})}function L(e){let t=R(e);t?t.after(e.value):O(e).prepend(e.value),e.visible=1}function B({mount:e,state:t,onMount:a,onState:l}){return{onMount:effector.sample({source:t,clock:e,fn:a,greedy:1}),onState:effector.sample({source:e,clock:t,fn:l,greedy:1})}}function F(e,t){for(let a in e)t(e[a],a)}function _(e,t){if(!he)return;let a=he.draft;A('element'===a.type,`"handler" extension can be used only with element nodes, got "${a.type}"`),void 0===t&&(t=e,e={});for(let e in t)A(effector.is.unit(t[e]),`handler for "${e}" should be event`);let{passive:l=0,capture:n=0,prevent:r=0,stop:o=0}=e;a.handler.push({options:{prevent:r,stop:o},domConfig:{passive:r?0:l,capture:n},map:t})}function $(e){E(he,'spec');let t=he.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,l=t.childCount;Array.isArray(a)?(t.text.push(...a.map(((e,t)=>({index:t+l,value:e})))),t.childCount+=a.length):(t.text.push({index:l,value:a}),t.childCount+=1)}if(e.style){let a={};for(let t in e.style)a[d(t)]=e.style[t];t.style.push(a)}var a,l;if(e.classList&&(a=e.classList,l=e=>t.classList.push(e),Array.isArray(a)?a.forEach((e=>{let t='string'==typeof e?e:e.map((e=>e||'')),a='string'==typeof e?1:e.map((e=>null!==e));l({name:t,enabled:a})})):F(a,((e,t)=>{l({name:t,enabled:e})}))),e.styleVar&&t.styleVar.push(e.styleVar),e.visible&&(t.visible=e.visible),e.handler){let t=e.handler;'object'==typeof t.on?_(t.config||{},t.on):_(t)}e.\u0254&&$(e.\u0254)}function V(e,{initCtx:t,runOp:a,hooks:{onMount:l,onState:r}}){let s=e.opsAmount++;l.watch((({value:e,leaf:l})=>{let n=t(e,l),r=o({value:e,priority:'props',runOp(e){a(e,n)},group:l.root.leafOps[l.fullID].group});l.root.leafOps[l.fullID].group.ops[s]=r})),r.watch((({value:e,leaf:t})=>{n(e,t.root.leafOps[t.fullID].group.ops[s])}))}function U(e,t,a){e[t].forEach((e=>{F(e,((e,l)=>{switch(t){case'data':case'styleVar':a[t][l]=e;break;case'attr':a.attr['xlink:href'===l?'href':l]=e;break;case'style':l.startsWith('--')?a.styleVar[l.slice(2)]=e:a.style[l]=e}}))}))}function j(e,t,a){let l=e.data.block,n={type:'text',parent:l,visible:0,index:a,value:null};if(l.child[a]=n,e.hydration){let a=q(n);if(a)switch(a.type){case'text':n.value=e.root.env.document.createTextNode(t),a.value.after(n.value);break;case'element':n.value=a.value.nextSibling,k(n.value,t)}else{let e=O(n);n.value=e.firstChild,k(n.value,t)}n.visible=1}else n.value=e.root.env.document.createTextNode(t),L(n);return n}function z(e){let t=e.stateRef,a=he;a.plain.includes(t)||a.closure.includes(t)||a.closure.push(t)}function G(){if('undefined'!=typeof document)return{document};throw Error('your environment has no document')}function Q(e,t){let a=e.root.childSpawns[e.fullID];for(let e in a){let l=a[e];for(let e=0;e<l.length;e++)t(l[e])}}function W(e,t){let a=t=>{let l=t.data;if(e&&'list'===l.type&&l.pendingUpdate){let e=l.pendingUpdate;l.pendingUpdate=null,effector.launch({target:t.template.api.pendingUpdate,params:e,defer:1,page:t,scope:t.root.scope})}if(e&&'route'===l.type)if(l.pendingInit){let e=l.pendingInit.value;l.pendingInit=null,effector.launch({target:t.template.api.pendingInit,params:e,defer:1,page:t,scope:t.root.scope})}else if(!l.block.visible)return;switch(l.type){case'element':n(e,l.ops.visible);break;case'route':case'list':case'list item':Q(t,a);break;default:console.log('unsupported type',l.type)}};Q(t,a)}function Z(e){e.root.activeSpawns.delete(e.fullID),Q(e,J)}function H(e){K(e,e.root.childSpawns[e.parent.fullID][e.template.id]),K(e,e.template.pages)}function J(e){let{data:t,root:a}=e;switch(t.type){case'element':K(e,a.childSpawns[e.parent.fullID][e.template.id]),function e(t){a.activeSpawns.delete(t.fullID);let l=a.childSpawns[t.fullID];delete a.childSpawns[t.fullID],delete a.leafOps[t.fullID],K(t,t.template.pages);for(let t in l)l[t].forEach(e)}(e),n(0,t.ops.visible);break;case'list':{let a=t.records;for(let e=0;e<a.length;e++){let t=a[e];t.instance&&J(t.instance),t.active=0}e.root.activeSpawns.delete(e.fullID),H(e);break}case'list item':{let a=t.block;K(a,a.parent.child);let l=a.left,n=a.right;l&&(l.right=n,n||a.parent.lastChild!==a||(a.parent.lastChild=l)),n&&(n.left=l),l||n||a.parent.lastChild!==a||(a.parent.lastChild=null),a.left=null,a.right=null,Z(e),H(e);break}case'route':Z(e),H(e);break;case'block':case'block item':case'rec':case'rec item':Z(e)}delete a.childSpawns[e.fullID],delete a.leafOps[e.fullID]}function K(e,t){if(!t)return;let a=t.indexOf(e);-1!==a&&t.splice(a,1)}function X(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 l in t){let n=t[l];a[l]=e.map('function'==typeof n?e=>n(e):e=>e[n])}return a}return e.map((e=>e[t]))}function Y(e,t){E(he,'list'),'function'==typeof t&&(effector.is.unit(e)?e={source:e,fn:t}:e.fn=t);let{fn:a,key:l,source:n,fields:r=[]}=e,o=void 0!==l?'function'==typeof l?l:e=>e[l]:(e,t)=>t,s={type:'list',key:effector.is.store(e)?{type:'index'}:{type:'key',key:e.key},childTemplates:[],childCount:0,inParentIndex:-1},{env:d,namespace:f}=he;P(x({name:'list',draft:s,isSvgRoot:0,namespace:f,fn(e,{mount:t}){let l=x({name:'list item',state:{id:-1,store:null},draft:s,isSvgRoot:0,namespace:f,fn({id:e,store:t},{mount:l}){a({store:t,key:e,fields:X(t,r)});let n=effector.createEvent({named:'itemUpdater'});if(t.on(n,((e,t)=>t)),s.itemVisible){let{onMount:e,onState:t}=B({mount:l,state:s.itemVisible,onMount:(e,t)=>({visible:e,leaf:t}),onState:(e,t)=>({visible:t,leaf:e})});e.watch((({visible:e,leaf:t})=>{let a=t.data.block;a.visible=e,a.childInitialized=e,e&&M(s,{parentBlockFragment:a,leaf:t})})),t.watch((({visible:e,leaf:t})=>{let a=t.data.block;a.visible=e,a.childInitialized?W(e,t):e&&(a.childInitialized=1,M(s,{parentBlockFragment:a,leaf:t}))}))}else l.watch(De.listItem);return{itemUpdater:n}},env:d}),m=effector.createStore([]),v=n.map((e=>e)),h=effector.sample({source:n,clock:t,fn:(e,t)=>({updates:e,leaf:t,hydration:t.hydration}),greedy:1}),g=effector.createEvent(),b=effector.sample({source:h,clock:[v,g],fn:({leaf:e},t)=>({updates:t,leaf:e,hydration:0}),greedy:1});return effector.sample({source:m,clock:[h,b],greedy:1,fn(e,{updates:t,leaf:a,hydration:r}){let d=a.data,f=a;for(;f;){if('route'===f.data.type&&!f.data.block.visible)return void(d.pendingUpdate=t);f=f.parent}let m=d.block;ie('list update ['+n.shortName+']');let v=Array(t.length).fill(0),h=t.map(o),g=[];for(let a=0;a<e.length;a++){let l=e[a],n=h.indexOf(l.key);-1!==n?(g.push(l),v[n]=1,p(t[n],l.asyncValue)):(l.active=0,l.instance&&J(l.instance),u(l.asyncValue))}for(let e=0;e<t.length;e++){if(v[e])continue;let n=t[e],o=h[e],u=i(a.root.leafOps[a.fullID].group.queue),p={type:'LF',parent:m,child:[],childInitialized:0,visible:0,left:null,right:null},d={type:'listItem',key:o,index:o,active:1,leafData:{type:'list item',block:p,listDraft:s},asyncValue:c({value:n,group:u,onChange(e){d.instance&&effector.launch({target:d.instance.template.api.itemUpdater,params:e,defer:1,page:d.instance,scope:d.instance.root.scope})},onInit(e){d.active&&(r||(d.instance=C(l,{values:{id:o,store:e},parentLeaf:a,mountNode:a.mountNode,svgRoot:a.svgRoot,leafData:d.leafData,opGroup:u,domSubtree:a.root.leafOps[a.fullID].domSubtree,hydration:r,root:a.root})))}})},f=g.length;g.push(d);let b=f>0?g[f-1].leafData:null;if(m.child.push(p),b){let e=b.block;p.left=e;let t=e.right;t?(t.left=p,p.right=t):m.lastChild=p,e.right=p}else m.lastChild=p;r&&(d.instance=C(l,{values:{id:o,store:n},parentLeaf:a,mountNode:a.mountNode,svgRoot:a.svgRoot,leafData:d.leafData,opGroup:u,domSubtree:a.root.leafOps[a.fullID].domSubtree,hydration:r,root:a.root}))}return ce('list update ['+n.shortName+']'),0===g.length&&(m.lastChild=null),d.records=g,g},target:m}),{pendingUpdate:g}},env:d}))}function ee({source:e,visible:t,fn:a}){E(he,'route');let{env:l,namespace:n}=he,r=x({name:'route',isSvgRoot:0,namespace:n,env:l,draft:{type:'route',childTemplates:[],childCount:0,inParentIndex:-1},fn(r,{mount:o}){let s;if(effector.is.store(t))s=effector.combine({value:e,visible:t});else{let a=t;s=e.map((e=>({value:e,visible:a(e)})))}let i=x({name:'route item',isSvgRoot:0,namespace:n,env:l,draft:{type:'route',childTemplates:[],childCount:0,inParentIndex:-1},state:{store:null},fn({store:e},{mount:t}){let l=effector.createEvent({named:'itemUpdater'});e.on(l,((e,t)=>t)),a({store:e});let n=effector.sample({source:t,clock:s,fn:(e,{visible:t,value:a})=>({leaf:e,visible:t,value:a}),greedy:1});t.watch(De.routeItem),n.watch((({leaf:e,visible:t,value:a})=>{if(e.data.block.visible=t,t&&effector.launch({target:l,params:a,defer:1,page:e,scope:e.root.scope}),t){let t=e.parent;for(;t;){if('route'===t.data.type&&!t.data.block.visible)return;t=t.parent}}W(t,e)}))}});P(i);let{onMount:c,onState:u}=B({mount:o,state:s,onMount:({visible:e,value:t},a)=>({leaf:a,visible:e,value:t}),onState:(e,{visible:t,value:a})=>({leaf:e,visible:t,value:a})}),p=effector.createEvent(),d=effector.sample({source:o,clock:p,greedy:1,fn:(e,t)=>({leaf:e,value:t,visible:1})});return effector.merge([c,u,d]).watch((({leaf:e,visible:t,value:a})=>{let l=e.data;if(l.block.visible=t,t||l.initialized||!l.pendingInit){if(t&&!l.initialized){let t=e.parent;for(;t;){if('route'===t.data.type&&!t.data.block.visible)return void(l.pendingInit={value:a});t=t.parent}}t&&!l.initialized&&(N({parentBlockFragment:l.block,leaf:e,actor:i,values:{store:a}}),l.initialized=1)}else l.pendingInit=null})),{pendingInit:p}}});P(r)}function te(e){let t='function'==typeof e?e:e.fn,a=x({name:'rec',state:{store:null},isSvgRoot:0,namespace:null,env:null,draft:{type:'rec',childTemplates:[],childCount:0,inParentIndex:0},defer:1,isBlock:1,fn({store:e},{mount:a}){t({store:e,state:e});let l=effector.createEvent({named:'itemUpdater'});return e.on(l,((e,t)=>t)),a.watch(De.rec),{itemUpdater:l}}});return({store:e,state:t=e})=>{E(he,'(rec instance)');let{env:l,namespace:n}=he;a.deferredInit&&a.deferredInit(),P(x({name:'rec item',isSvgRoot:0,namespace:n,env:l,draft:{type:'recItem',childTemplates:[],childCount:0,inParentIndex:-1},fn(e,{mount:l}){let{onMount:n,onState:r}=B({state:t,mount:l,onMount:(e,t)=>({state:e,leaf:t}),onState:(e,t)=>({state:t,leaf:e})});r.watch((({state:e,leaf:t})=>{Q(t,(a=>{effector.launch({target:a.template.api.itemUpdater,params:e,defer:1,page:t,scope:t.root.scope})}))})),n.watch((({leaf:e,state:t})=>{N({parentBlockFragment:e.data.block,leaf:e,actor:a,values:{store:t}})}))}}))}}function ae(e,t){if(0===t.length)return e;let a=[e[0]];for(let l=0;l<t.length;l++)a.push(t[l],e[l+1]);return a}Object.defineProperty(exports,'__esModule',{value:1});var effector=require('effector');let le;le='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 ne=new Map;const re=[],oe=e=>{let t=ne.get(e);t||(t={calls:0,time:0,label:e,childTime:0},ne.set(e,t)),t.calls+=1,re.push({bucket:t,pendingStart:le()})},se=e=>{let t=ne.get(e),a=re.pop().pendingStart,l=le()-a;t.time+=l,re.length>0&&(re[re.length-1].bucket.childTime+=l)};let ie,ce;'undefined'!=typeof performance&&performance.mark?(ie=e=>{performance.mark('\u2604\ufe0f '+e+' start'),oe(e)},ce=e=>{se(e);try{performance.measure('\u2604\ufe0f '+e,'\u2604\ufe0f '+e+' start')}catch(e){}performance.clearMarks('\u2604\ufe0f '+e+' start'),performance.clearMeasures('\u2604\ufe0f '+e)}):(ie=e=>{oe(e)},ce=e=>{se(e)});let ue='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0);const pe={attr:y,data:b,style:h,styleVar:v,classList:g},de=(e,t)=>e.includes(t);let fe={storeBase(e,t){e.plain.push(t)},storeOnMap(e,t,a,l){var n,r;a.unshift(e.loader),a.push(e.upward),l&&(de(e.plain,l)||(de(e.closure,l)||e.closure.push(l),r={type:'closure',of:l},(n=t).before||(n.before=[]),n.before.push(r)))},storeMap(e,t,a){de(e.plain,t)||de(a.seq,e.loader)||a.seq.unshift(e.loader)},storeWatch:(e,t,a)=>(e.watch.push({of:t,fn:a}),1),eventPrepend(e,t){t.seq.push(e.upward)},combineBase(e,t,a){e.plain.push(t,a)},combineField(e,t,a){de(e.plain,t)||a.seq.unshift(e.loader)},splitBase(e,t){e.plain.push(t)},splitMatchStore(e,t,a){de(e.plain,t)||a.seq.unshift(e.loader)},sampleSource(e,t,a,l){t.current?de(e.plain,a)||de(e.closure,a)||e.closure.push(a):e.plain.push(a),e.plain.push(t),de(e.plain,l)||e.plain.push(l)},sampleTarget(e,t){t.seq.push(e.loader)},sampleSourceLoader:e=>e.loader,sampleSourceUpward:(e,t)=>t&&e.upward},me=0,ve=0,he=null,ge=null;const be=(e,t)=>e.reg[t.id];let ye=null;const ke=['LF','using','element','recItem','rec','block','blockItem','route'];let xe=effector.createEvent({named:'onMount'});xe.watch((({fns:e,element:t})=>{e.forEach((e=>{e(t)}))}));const Ie=[{type:'attr',field:'value'},{type:'attr',field:'checked'},{type:'attr',field:'min'},{type:'attr',field:'max'}],we={attr:y,data:b,style:h,styleVar:v,classList:g},Se=e=>e.data.block.value;let De={using(e){let t=e.data;M(t.draft,{parentBlockFragment:t.block,leaf:e})},routeItem(e){let t=e.draft,a=e.data;a.block.visible=1,M(t,{parentBlockFragment:a.block,leaf:e})},block(e){M(e.draft,{parentBlockFragment:e.data.block,leaf:e})},blockItem(e){N({parentBlockFragment:e.data.block,leaf:e,actor:e.draft.itemOf})},rec(e){M(e.draft,{parentBlockFragment:e.data.block,leaf:e})},listItem(e){let t=e.data,a=t.block;a.visible=1,a.childInitialized=1,M(t.listDraft,{parentBlockFragment:a,leaf:e})}};exports.block=({fn:e,env:t,namespace:a="html"})=>{let l=x({name:'block',isSvgRoot:0,namespace:a,env:t,draft:{type:'block',childTemplates:[],childCount:0,inParentIndex:0},isBlock:1,fn({},{mount:t}){e(),t.watch(De.block)}});return()=>{E(he,'(block instance)');let e={type:'blockItem',childTemplates:[],childCount:0,inParentIndex:-1,itemOf:l},{env:t,namespace:a}=he;P(x({name:'block item',isSvgRoot:0,namespace:a,env:t,draft:e,fn(e,{mount:t}){t.watch(De.blockItem)}}))}},exports.h=(e,t)=>{let a,r=0,o=0;'function'==typeof t?(r=1,a=t):t&&(o=1,t.fn&&(r=1,a=t.fn),t.\u0254&&('function'==typeof t.\u0254?(r=1,a=t.\u0254):'function'==typeof t.\u0254.fn&&(r=1,a=t.\u0254.fn))),E(he,'h');let s,i=he.env,c=he.namespace,u=c,p='html';u=p='svg'===c?'svg':'html','svg'===e&&(p='svg',u='svg'),he.isBlock||(s='svg'===p?i.document.createElementNS('http://www.w3.org/2000/svg',e):i.document.createElement(e));let d=s,m={type:'element',tag:e,attr:[],data:[],text:[],style:[],styleVar:[],classList:[],handler:[],stencil:d,seq:[],staticSeq:[],childTemplates:[],childCount:0,inParentIndex:-1,opsAmount:1,node:[]};'foreignObject'===c?(m.attr.push({xmlns:'http://www.w3.org/1999/xhtml'}),u='html'):'svg'===e?(m.attr.push({xmlns:'http://www.w3.org/2000/svg'}),u='svg'):'foreignObject'===e&&(u='foreignObject');let v=x({name:'element',draft:m,isSvgRoot:'svg'===e,namespace:u,fn(e,{mount:s}){let i=effector.createEvent({named:'domElementCreated'});r&&a(),o&&$(t),effector.is.unit(m.visible)&&(m.seq.push({type:'visible',value:m.visible}),z(m.visible));let c={attr:{},data:{},style:{},styleVar:{}};U(m,'attr',c),U(m,'data',c),U(m,'style',c),U(m,'styleVar',c),F(c,((e,t)=>{F(e,((e,a)=>{effector.is.unit(e)?(m.seq.push({type:t,field:a,value:e}),z(e)):m.staticSeq.push({type:t,field:a,value:e})}))})),m.classList.forEach((e=>{if(effector.is.unit(e.name)||effector.is.unit(e.enabled)){let t=effector.is.unit(e.name)?e.name:effector.createStore(e.name),a=effector.is.unit(e.enabled)?e.enabled:effector.createStore(e.enabled);m.seq.push({type:'classList',field:t,value:a}),z(t),z(a)}else effector.is.unit(e.name)||m.staticSeq.push({type:'classList',field:e.name,value:e.enabled})})),m.text.forEach((e=>{null!==e.value&&(effector.is.unit(e.value)?(m.seq.push({type:'dynamicText',value:e.value,childIndex:e.index}),z(e.value)):m.seq.push({type:'staticText',value:String(e.value),childIndex:e.index}))})),m.handler.forEach((e=>{F(e.map,((t,a)=>{m.seq.push({type:'handler',for:a,handler:t,options:e.options,domConfig:e.domConfig})}))})),d&&f(d,m.staticSeq),m.seq.forEach((e=>{switch(e.type){case'visible':{let{onMount:t,onState:a}=B({mount:s,state:e.value,onMount:(e,t)=>({leaf:t,value:e,hydration:t.hydration}),onState:(e,t)=>({leaf:e,value:t,hydration:0})});t.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=R(r);if(e=t?t.nextSibling:O(r).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}r.value=e,r.visible=1}M(m,{parentBlockFragment:r,leaf:e,node:r.value,svgRoot:v.isSvgRoot?r.value:null}),t&&n.needToCallNode&&(n.needToCallNode=0,effector.launch({target:xe,params:{element:n.block.value,fns:m.node},page:e,defer:1,scope:e.root.scope})),effector.launch({target:i,params:e,defer:1,page:e,scope:e.root.scope})})),effector.merge([a,t]).watch((({leaf:e,value:t,hydration:a})=>{a||n(t,e.data.ops.visible)}));break}case'attr':case'data':case'style':case'styleVar':{let t=we[e.type],a=Ie.some((({type:t,field:a})=>e.type===t&&e.field===a)),l=B({mount:i,state:e.value,onMount:(e,t)=>({leaf:t,value:e}),onState:(e,t)=>({leaf:e,value:t})});a?effector.merge([l.onState,l.onMount]).watch((({leaf:a,value:l})=>{t(Se(a),e.field,l)})):V(m,{initCtx(a,l){let n=Se(l);return t(n,e.field,a),n},runOp(a,l){t(l,e.field,a)},hooks:l});break}case'classList':{let t=we.classList,a=effector.createStore({prev:'',curr:e.field.getState()}).on(e.field,(({curr:e},t)=>({prev:e,curr:t}))),l=B({mount:i,state:effector.combine({name:a,enabled:e.value}),onMount:(e,t)=>({leaf:t,value:e}),onState:(e,t)=>({leaf:e,value:t})});V(m,{initCtx(e,a){let l=Se(a);return t(l,e.name.curr,e.enabled),l},runOp(e,a){e.name.prev!==e.name.curr&&t(a,e.name.prev,0),t(a,e.name.curr,e.enabled)},hooks:l});break}case'dynamicText':V(m,{initCtx:(t,a)=>j(a,t,e.childIndex),runOp(e,t){k(t.value,e)},hooks:B({mount:i,state:e.value,onMount:(e,t)=>({leaf:t,value:String(e)}),onState:(e,t)=>({leaf:e,value:String(t)})})});break;case'staticText':i.watch((t=>{j(t,e.value,e.childIndex)}));break;case'handler':{let t=e.handler.graphite.meta.nativeTemplate||null;i.watch((a=>{let l=null;if(t){let e=0,n=a;for(;!e&&n;)n.template===t?(e=1,l=n):n=n.parent}else l=null;Se(a).addEventListener(e.for,(t=>{e.options.prevent&&t.preventDefault(),e.options.stop&&t.stopPropagation(),effector.launch({target:e.handler,params:t,page:l,scope:a.root.scope})}),e.domConfig)}));break}}})),s.watch((e=>{let t=e.data;if(!m.visible){let a=t.ops.visible,r=t.block;if(e.hydration){l(1,a);let e,t=R(r);if(e=t?t.nextSibling:O(r).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}r.value=e,r.visible=1}M(m,{parentBlockFragment:r,leaf:e,node:r.value,svgRoot:v.isSvgRoot?r.value:null}),effector.launch({target:i,params:e,defer:1,page:e,scope:e.root.scope}),e.hydration?t.needToCallNode&&(t.needToCallNode=0,effector.launch({target:xe,params:{element:t.block.value,fns:m.node},page:e,defer:1,scope:e.root.scope})):n(1,a)}}))},env:i});P(v)},exports.handler=_,exports.list=Y,exports.node=e=>{E(he,'node');let t=he.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=te,exports.remap=X,exports.route=ee,exports.spec=$,exports.text=(e,...t)=>{Array.isArray(e)?$({text:ae(e,t)}):$({text:e})},exports.tree=({source:e,key:t,child:a,fn:l})=>{let n=te((({store:e})=>{Y({source:e,key:t,fn({store:e}){let t=e.map((e=>e[a]||[]));l({store:e,child(){n({store:t})}})}})}));n({store:e})},exports.using=(e,t)=>{let a,l,n,r,o,c;if('function'==typeof t)a=t,n=G(),r=0;else{if(!t)throw Error('using() second argument is missing');a=t.fn,n=t.env?t.env:G(),r=t.hydrate,l=t.onComplete,o=t.onRoot,c=t.scope}A(e,'using() first argument is missing');let u={scope:c,env:n,activeSpawns:new Set,childSpawns:{},leafOps:{}},p=e.namespaceURI,d=e.tagName.toLowerCase(),f={type:'using',childTemplates:[],childCount:0,inParentIndex:-1},m=x({name:'using',draft:f,isSvgRoot:'svg'===d,namespace:'http://www.w3.org/2000/svg'===p?'svg':'foreignobject'===d?'foreignObject':'html',fn(e,{mount:t}){a(),t.watch(De.using)},env:n}),v={type:'using',child:[],value:e},h=s({onComplete:l}),g=C(m,{parentLeaf:ge||null,mountNode:e,svgRoot:m.isSvgRoot?e:ge?ge.svgRoot:null,leafData:{type:'using',draft:f,element:e,block:v},opGroup:i(h),domSubtree:i(h),hydration:r,root:u});if(o&&o({template:m,leaf:g}),h.onDrain&&!h.rafID){let e=h.onDrain;h.onDrain=null,e()}},exports.val=(e,...t)=>t.every((e=>!effector.is.store(e)))?ae(e,t).join(''):effector.combine(t,(t=>ae(e,t).join(''))),exports.variant=({source:e,cases:t,key:a})=>{let l;E(he,'variant'),A(effector.is.unit(e),'variant({source}) should be unit'),l='function'==typeof a?a:null==a?e=>String(e):e=>String(e[a]);let n=0;for(let a in t)'__'!==a?ee({source:e,visible:e=>l(e)===a,fn:t[a]}):n=1;if(n){let a=Object.keys(t);ee({source:e,visible:e=>!a.includes(l(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,l;e.status='active',t=a(e),(l=e).cursor.prev&&(l.cursor.prev.cursor.next=l.cursor.next),l.cursor.next&&(l.cursor.next.cursor.prev=l.cursor.prev),t.last===l&&(t.last=l.cursor.prev),t.first===l&&(t.first=l.cursor.next),l.cursor.prev=null,l.cursor.next=null}function a(e){return e.group.activeChilds[e.priority]}function l(e,a){a.value.active=a.value.pending=e,'active'!==a.status&&t(a)}function n(l,n){if(n.value.active===l)return n.value.pending=l,void('pending'===n.status&&(t(n),a(n).first||e(n.group,n.priority)));var r,o,s,i;'active'===n.status&&(n.status='pending',a(n).first||((s=n.group).queue[i=n.priority].last?(s.cursor[i].prev=s.queue[i].last,s.queue[i].last.cursor[i].next=s,s.queue[i].last=s):s.queue[i].first=s.queue[i].last=s),o=n,(r=a(n)).last?(o.cursor.prev=r.last,r.last.cursor.next=o,r.last=o):r.first=r.last=o),n.value.pending=l,n.group.queue.rafID||(n.group.queue.rafID=pe(n.group.queue.execQueue))}function r(a){ce('execQueue');let l,n,r=ne(),o=0;e:for(;a.props.first||a.tree.first||a.data.first;){if(ne()-r>=1e3){o=1;break e}let s=!!a.props.first;for(s&&ce('props');l=a.props.first;){for(;n=l.activeChilds.props.first;){if(ne()-r>=1e3){o=1,ue('props');break e}n.runOp(n.value.pending),n.value.active=n.value.pending,t(n)}e(l,'props')}s&&ue('props');let i=!!a.tree.first;for(i&&ce('tree');l=a.tree.first;){for(;n=l.activeChilds.tree.first;){if(ne()-r>=1e3){o=1,ue('tree');break e}n.runOp(n.value.pending),n.value.active=n.value.pending,t(n)}e(l,'tree')}i&&ue('tree');let c=!!a.data.first;for(c&&ce('data');l=a.data.first;){for(;n=l.activeChilds.data.first;){if(ne()-r>=1e3){o=1,ue('data');break e}n.runOp(n.value.pending),n.value.active=n.value.pending,t(n)}e(l,'data')}c&&ue('data')}if(ue('execQueue'),o)a.rafID=pe(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:l}){return{value:{active:e,pending:e},runOp:t,status:'active',priority:l,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=r.bind(null,t),t}function i(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:l}){let r=o({value:e,group:t,runOp(e){s.status='A',l(e)},priority:'data'}),s={status:'IA',value:r.value,ops:{init:o({value:0,group:t,runOp(e){s.status='A',a(s.value.active)},priority:'data'}),change:r,terminate:o({value:0,group:t,runOp(e){s.status='T'},priority:'data'})}};return n(1,s.ops.init),s}function u(e){switch(e.status){case'I':case'T':case'AT':return;case'A':e.status='AT',n(1,e.ops.terminate);break;case'AA':e.status='AT',n(1,e.ops.terminate),n(e.value.active,e.ops.change);break;case'IA':e.status='T',n(0,e.ops.init)}}function p(e,t){switch(t.status){case'I':case'T':return;case'A':t.value.active!==e&&(t.status='AA',n(e,t.ops.change));break;case'AA':t.value.active===e?(t.status='A',n(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){switch(e=String(e)){case'__proto__':case'__defineGetter__':case'__defineSetter__':case'constructor':case'prototype':case'hasOwnProperty':case'toString':case'valueOf':case'setProperty':case'removeProperty':return'forbidden';default:return e.replace(/[^a-zA-Z0-9\-_]/g,'')}}function f(e,t){for(let a=0;a<t.length;a++){let{type:l,field:n,value:r}=t[a];de[l](e,n,r)}}function m(e){return''!==e&&0!==e&&'0'!==e&&(0==e||null==e)}function v(e,t,a){m(a)?e.style.removeProperty(`--${t}`):e.style.setProperty(`--${t}`,`${a}`)}function h(e,t,a){m(a)?delete e.style[t]:e.style[t]=`${a}`}function g(e,t,a){t&&t.trim().length>0&&(a?e.classList.add(t):(e.classList.remove(t),0===e.classList.length&&e.removeAttribute('class')))}function b(e,t,a){m(a)?delete e.dataset[t]:e.dataset[t]=`${a}`}function y(e,t,a){if(m(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 x({fn:e,state:t={},defer:a=0,name:l="",draft:n,isSvgRoot:r,namespace:o,env:s,isBlock:i=0}){let c=ge,u={id:++ve,name:l,plain:[],watch:[],nameMap:{},pages:[],closure:[],childTemplates:[],handlers:me,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.root.activeSpawns.has(a.page.fullID))return console.count('inactive page upward'),0;let l=[a.page.template],n=[a.page];{let e=a.page.parent;for(;e;)n.push(e),l.push(e.template),e=e.parent}return a.node.next.forEach((t=>{let r=t.meta.nativeTemplate;if(r)if(l.includes(r)){let o=n[l.indexOf(r)];effector.launch({target:t,params:e,defer:1,page:o,stack:a,scope:a.scope})}else console.error('context drift',{stack:a,node:t});else effector.launch({target:t,params:e,defer:1,page:a.page,stack:a,scope:a.scope})})),0}}),loader:effector.step.filter({fn(e,t,a){if(a.parent){let t=a.scope?a.scope.graphite.id:null;if(a.page){if(!a.page.root.activeSpawns.has(a.page.fullID))return console.count('inactive page loader'),0;if(a.page.template===u)return 1;if(a.page.root.childSpawns[a.page.fullID][u.id])a.page.root.childSpawns[a.page.fullID][u.id].forEach((l=>{(!t||l.root.scope&&t===l.root.scope.graphite.id)&&effector.launch({params:e,target:a.node,page:l,defer:1,scope:a.scope})}));else{let l=a.page.fullID,n='rec'===a.page.template.name;u.pages.forEach((r=>{if(!t||r.root.scope&&t===r.root.scope.graphite.id)if(r.fullID===l||r.fullID.startsWith(`${l}_`)){let t=1;if(n){let e=a.page.template.id,l=r.parent;for(;l&&l!==a.page;){if(l.template.id===e){t=0;break}l=l.parent}}t&&effector.launch({params:e,target:a.node,page:r,defer:1,scope:a.scope})}else l.startsWith(`${r.fullID}_`)&&effector.launch({params:e,target:a.node,page:a.page,defer:1,scope:a.scope})}))}}else u.pages.forEach((l=>{(!t||l.root.scope&&t===l.root.scope.graphite.id)&&effector.launch({params:e,target:a.node,page:l,defer:1,scope:a.scope})}));return 0}return 1}}),parent:c,node:null,api:null,trigger:{mount:effector.createEvent({named:'mount'})},draft:n,isSvgRoot:r,namespace:o,env:s,isBlock:i||!(!c||!c.isBlock)};c&&c.childTemplates.push(u);let p=effector.createNode({meta:{template:u}});return u.node=p,ge=u,a?u.deferredInit=()=>{let a=ge;ge=u,u.deferredInit=null;try{effector.withRegion(p,(()=>{let a=effector.restore(t);u.api=e(a,u.trigger),u.nameMap=a}))}finally{ge=a}}:effector.withRegion(p,(()=>{let a=effector.restore(t);u.api=e(a,u.trigger),u.nameMap=a})),ge=c,u}function I(e,t){let a;switch(a=t?t.getState(e):e.current,e.type){case'list':return[...a];case'shape':return{...a};default:return a}}function w(e,t,a){let l=t;for(;l&&!ye(l,e);)l=l.parent;return l?ye(l,e):a?(a.getState(e),a.reg[e.id]):e}function S(e,t){ye(t,e)||(t.reg[e.id]=w(e,t.parent,t.root.scope))}function D(e,t,a){t in a||(a[t]=[]),a[t].push(...e)}function C(e,{values:t={},parentLeaf:a,mountNode:l,svgRoot:n,leafData:r,opGroup:o,domSubtree:s,hydration:i,root:c}){function u(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,l=a.from;if(!a.fn&&!l)break;l&&(S(l,f),t=d[l.id].current),d[e.id].current=a.fn?a.fn(t):t;break}case'field':{let t=a.from;S(t,f),d[e.id].current[a.field]=d[t.id].current;break}case'closure':S(a.of,f)}}}function p(e,t,a){let l;t.stop=1;try{for(;t.i<e.length;)l=e[t.i],t.i++,l.fn(a[l.of.id]?a[l.of.id].current:w(l.of,f.parent,f.root.scope).current)}catch(e){console.error(e),t.stop=0}}let d={},f={draft:e.draft,svgRoot:n,data:r,parent:a,hydration:i,mountNode:l,root:c,id:++he,fullID:'',reg:d,template:e};e.pages.push(f);let m=be;be=f,a&&D([f],e.id,c.childSpawns[a.fullID]),f.fullID=a?`${a.fullID}_${f.id}`:`${f.id}`,c.childSpawns[f.fullID]={},c.activeSpawns.add(f.fullID),c.leafOps[f.fullID]={group:o,domSubtree:s};for(let t=0;t<e.closure.length;t++){let a=e.closure[t],l=a,n=f.parent;e:for(;n;){if(ye(n,a)){l=ye(n,a);break e}n=n.parent}!n&&c.scope&&(c.scope.getState(a),l=c.scope.reg[a.id]),d[a.id]=l}for(let t=0;t<e.plain.length;t++){let a=e.plain[t],l={id:a.id,current:I(a,c.scope)};d[a.id]=l}for(let a in t){let l=e.nameMap[a].stateRef.id;d[l]={id:l,current:t[a]}}e.closure.forEach(u),e.plain.forEach(u);let v={i:0,stop:0};for(;!v.stop;)p(e.watch,v,d);if(a)for(let e in c.childSpawns[f.fullID])D(c.childSpawns[f.fullID][e],e,c.childSpawns[a.fullID]);if(ke)ke.steps.push({target:e.trigger.mount,params:f,defer:1,page:f,scope:c.scope});else{let t;ke={parent:ke,steps:[{target:e.trigger.mount,params:f,defer:1,page:f,scope:c.scope}]};do{for(;t=ke.steps.shift();)ke={parent:ke,steps:[]},effector.launch(t)}while(ke=ke.parent)}return be=m,f}function O(e){let t=e.parent;for(;'element'!==t.type&&'using'!==t.type;)t=t.parent;return t?t.value:null}function T(e){if(!e.visible)return null;switch(e.type){case'text':case'element':return e;case'LF':case'route':case'rec':case'recItem':case'block':case'blockItem':for(let t=e.child.length-1;t>=0;t--){let a=T(e.child[t]);if(a)return a}return null;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 q(e){switch(e.type){case'using':return null;case'LF':{let t=e.left;for(;t;){let e=T(t);if(e)return e;t=t.left}return q(e.parent)}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 l=T(e);if(l)return l}switch(t.type){case'element':case'using':return null}return q(t)}default:return null}}function E(e){let t=q(e);return t?t.value:null}function R(e,t){if(!e)throw Error(t)}function A(e,t){if(!e)throw Error(`${t}() called outside from using() closure`)}function P(e){if(!ge)return;let{draft:t}=e;if('listItem'!==t.type&&'rec'!==t.type)switch(ge.draft.type){case'element':case'using':case'route':case'list':case'rec':case'recItem':case'block':case'blockItem':t.inParentIndex=ge.draft.childCount,ge.draft.childCount+=1,ge.draft.childTemplates.push(e);break;default:console.warn(`unexpected currentTemplate type ${ge.draft.type}`)}}function M(e,{parentBlockFragment:t,leaf:a,node:l,svgRoot:n,values:r}){e.childTemplates.forEach((e=>{N({parentBlockFragment:t,leaf:a,node:l,svgRoot:n,values:r,actor:e})}))}function N({parentBlockFragment:e,leaf:t,node:a=t.mountNode,actor:l,svgRoot:n,values:r}){let s;R(xe.includes(e.type),`incorrect parent ${e.type}`);let{draft:c}=l,{queue:u}=t.root.leafOps[t.fullID].group,p=i(u),d=t.root.leafOps[t.fullID].domSubtree,m=d;switch(c.type){case'route':{let t={type:'route',parent:e,child:[],visible:0,index:c.inParentIndex};e.child[c.inParentIndex]=t,s={type:'route',block:t,ops:{},initialized:0,pendingInit:null};break}case'element':{let a;if(l.isBlock){let e,l,n=t;for(;n&&(!l||!e);){n.template.env&&(e=n.template.env);let{draft:t}=n;'element'===t.type&&('svg'===t.tag?l='svg':'foreignObject'===t.tag&&(l='html')),n=n.parent}l||(l='html'),e&&(a='svg'===l?e.document.createElementNS('http://www.w3.org/2000/svg',c.tag):e.document.createElement(c.tag),f(a,c.staticSeq))}else a=c.stencil.cloneNode();let n={type:'element',parent:e,child:[],value:a,visible:0,index:c.inParentIndex};e.child[c.inParentIndex]=n,s={type:'element',block:n,ops:{visible:o({value:0,priority:'tree',runOp(e){if(e){L(n);let e=s;e.needToCallNode&&(e.needToCallNode=0,effector.launch({target:Ie,params:{element:n.value,fns:c.node},page:v,scope:t.root.scope})),n.visible=1}else n.value.remove(),n.visible=0},group:d})},needToCallNode:c.node.length>0},m=i(u);break}case'list':{let t={type:'list',parent:e,child:[],lastChild:null,visible:1,index:c.inParentIndex};e.child[c.inParentIndex]=t,s={type:'list',draft:c,block:t,records:[],pendingUpdate:null};break}case'using':case'listItem':break;case'rec':{let t={type:'rec',parent:e,child:[],visible:1,index:c.inParentIndex};e.child[c.inParentIndex]=t,s={type:'rec',block:t};break}case'recItem':{let t={type:'recItem',parent:e,child:[],visible:1,index:c.inParentIndex};e.child[c.inParentIndex]=t,s={type:'rec item',block:t};break}case'block':{let t={type:'block',parent:e,child:[],visible:1,index:c.inParentIndex};e.child[c.inParentIndex]=t,s={type:'block',block:t};break}case'blockItem':{let t={type:'blockItem',parent:e,child:[],visible:1,index:c.inParentIndex};e.child[c.inParentIndex]=t,s={type:'block item',block:t};break}default:console.warn(`unexpected draft type ${c.type}`)}let v=C(l,{values:r,parentLeaf:t,mountNode:a,svgRoot:n||t.svgRoot,leafData:s,opGroup:p,domSubtree:m,hydration:t.hydration,root:t.root})}function L(e){let t=E(e);t?t.after(e.value):O(e).prepend(e.value),e.visible=1}function B({mount:e,state:t,onMount:a,onState:l}){return{onMount:effector.sample({source:t,clock:e,fn:a,greedy:1}),onState:effector.sample({source:e,clock:t,fn:l,greedy:1})}}function F(e,t){for(let a in e)t(e[a],a)}function _(e,t){if(!ge)return;let a=ge.draft;R('element'===a.type,`"handler" extension can be used only with element nodes, got "${a.type}"`),void 0===t&&(t=e,e={});for(let e in t)R(effector.is.unit(t[e]),`handler for "${e}" should be event`);let{passive:l=0,capture:n=0,prevent:r=0,stop:o=0}=e;a.handler.push({options:{prevent:r,stop:o},domConfig:{passive:r?0:l,capture:n},map:t})}function $(e){A(ge,'spec');let t=ge.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,l=t.childCount;Array.isArray(a)?(t.text.push(...a.map(((e,t)=>({index:t+l,value:e})))),t.childCount+=a.length):(t.text.push({index:l,value:a}),t.childCount+=1)}if(e.style){let a={};for(let t in e.style)a[d(t)]=e.style[t];t.style.push(a)}var a,l;if(e.classList&&(a=e.classList,l=e=>t.classList.push(e),Array.isArray(a)?a.forEach((e=>{let t='string'==typeof e?V(e):e.map((e=>V(e||''))),a='string'==typeof e?1:e.map((e=>null!==e));l({name:t,enabled:a})})):F(a,((e,t)=>{let a=V(t);l({name:a,enabled:e})}))),e.styleVar&&t.styleVar.push(e.styleVar),e.visible&&(t.visible=e.visible),e.handler){let t=e.handler;'object'==typeof t.on?_(t.config||{},t.on):_(t)}e.\u0254&&$(e.\u0254)}function V(e){return e.split(' ').map((e=>e.trim())).filter((e=>e.length>0))}function U(e,{initCtx:t,runOp:a,hooks:{onMount:l,onState:r}}){let s=e.opsAmount++;l.watch((({value:e,leaf:l})=>{let n=t(e,l),r=o({value:e,priority:'props',runOp(e){a(e,n)},group:l.root.leafOps[l.fullID].group});l.root.leafOps[l.fullID].group.ops[s]=r})),r.watch((({value:e,leaf:t})=>{n(e,t.root.leafOps[t.fullID].group.ops[s])}))}function j(e,t,a){e[t].forEach((e=>{F(e,((e,l)=>{switch(t){case'data':case'styleVar':a[t][l]=e;break;case'attr':a.attr['xlink:href'===l?'href':l]=e;break;case'style':l.startsWith('--')?a.styleVar[l.slice(2)]=e:a.style[l]=e}}))}))}function z(e,t,a){let l=e.data.block,n={type:'text',parent:l,visible:0,index:a,value:null};if(l.child[a]=n,e.hydration){let a=q(n);if(a)switch(a.type){case'text':n.value=e.root.env.document.createTextNode(t),a.value.after(n.value);break;case'element':n.value=a.value.nextSibling,k(n.value,t)}else{let e=O(n);n.value=e.firstChild,k(n.value,t)}n.visible=1}else n.value=e.root.env.document.createTextNode(t),L(n);return n}function G(e){let t=e.stateRef,a=ge;a.plain.includes(t)||a.closure.includes(t)||a.closure.push(t)}function Q(){if('undefined'!=typeof document)return{document};throw Error('your environment has no document')}function W(e,t){let a=e.root.childSpawns[e.fullID];for(let e in a){let l=a[e];for(let e=0;e<l.length;e++)t(l[e])}}function Z(e,t){let a=t=>{let l=t.data;if(e&&'list'===l.type&&l.pendingUpdate){let e=l.pendingUpdate;l.pendingUpdate=null,effector.launch({target:t.template.api.pendingUpdate,params:e,defer:1,page:t,scope:t.root.scope})}if(e&&'route'===l.type)if(l.pendingInit){let e=l.pendingInit.value;l.pendingInit=null,effector.launch({target:t.template.api.pendingInit,params:e,defer:1,page:t,scope:t.root.scope})}else if(!l.block.visible)return;switch(l.type){case'element':n(e,l.ops.visible);break;case'route':case'list':case'list item':W(t,a);break;default:console.log('unsupported type',l.type)}};W(t,a)}function H(e){e.root.activeSpawns.delete(e.fullID),W(e,K)}function J(e){X(e,e.root.childSpawns[e.parent.fullID][e.template.id]),X(e,e.template.pages)}function K(e){let{data:t,root:a}=e;switch(t.type){case'element':X(e,a.childSpawns[e.parent.fullID][e.template.id]),function e(t){a.activeSpawns.delete(t.fullID);let l=a.childSpawns[t.fullID];delete a.childSpawns[t.fullID],delete a.leafOps[t.fullID],X(t,t.template.pages);for(let t in l)l[t].forEach(e)}(e),n(0,t.ops.visible);break;case'list':{let a=t.records;for(let e=0;e<a.length;e++){let t=a[e];t.instance&&K(t.instance),t.active=0}e.root.activeSpawns.delete(e.fullID),J(e);break}case'list item':{let a=t.block;X(a,a.parent.child);let l=a.left,n=a.right;l&&(l.right=n,n||a.parent.lastChild!==a||(a.parent.lastChild=l)),n&&(n.left=l),l||n||a.parent.lastChild!==a||(a.parent.lastChild=null),a.left=null,a.right=null,H(e),J(e);break}case'route':H(e),J(e);break;case'block':case'block item':case'rec':case'rec item':H(e)}delete a.childSpawns[e.fullID],delete a.leafOps[e.fullID]}function X(e,t){if(!t)return;let a=t.indexOf(e);-1!==a&&t.splice(a,1)}function Y(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 l in t){let n=t[l];a[l]=e.map('function'==typeof n?e=>n(e):e=>e[n])}return a}return e.map((e=>e[t]))}function ee(e,t){A(ge,'list'),'function'==typeof t&&(effector.is.unit(e)?e={source:e,fn:t}:e.fn=t);let{fn:a,key:l,source:n,fields:r=[]}=e,o=void 0!==l?'function'==typeof l?l:e=>e[l]:(e,t)=>t,s={type:'list',key:effector.is.store(e)?{type:'index'}:{type:'key',key:e.key},childTemplates:[],childCount:0,inParentIndex:-1},{env:d,namespace:f}=ge;P(x({name:'list',draft:s,isSvgRoot:0,namespace:f,fn(e,{mount:t}){let l=x({name:'list item',state:{id:-1,store:null},draft:s,isSvgRoot:0,namespace:f,fn({id:e,store:t},{mount:l}){a({store:t,key:e,fields:Y(t,r)});let n=effector.createEvent({named:'itemUpdater'});if(t.on(n,((e,t)=>t)),s.itemVisible){let{onMount:e,onState:t}=B({mount:l,state:s.itemVisible,onMount:(e,t)=>({visible:e,leaf:t}),onState:(e,t)=>({visible:t,leaf:e})});e.watch((({visible:e,leaf:t})=>{let a=t.data.block;a.visible=e,a.childInitialized=e,e&&M(s,{parentBlockFragment:a,leaf:t})})),t.watch((({visible:e,leaf:t})=>{let a=t.data.block;a.visible=e,a.childInitialized?Z(e,t):e&&(a.childInitialized=1,M(s,{parentBlockFragment:a,leaf:t}))}))}else l.watch(Ce.listItem);return{itemUpdater:n}},env:d}),m=effector.createStore([]),v=n.map((e=>e)),h=effector.sample({source:n,clock:t,fn:(e,t)=>({updates:e,leaf:t,hydration:t.hydration}),greedy:1}),g=effector.createEvent(),b=effector.sample({source:h,clock:[v,g],fn:({leaf:e},t)=>({updates:t,leaf:e,hydration:0}),greedy:1});return effector.sample({source:m,clock:[h,b],greedy:1,fn(e,{updates:t,leaf:a,hydration:r}){let d=a.data,f=a;for(;f;){if('route'===f.data.type&&!f.data.block.visible)return void(d.pendingUpdate=t);f=f.parent}let m=d.block;ce('list update ['+n.shortName+']');let v=Array(t.length).fill(0),h=t.map(o),g=[];for(let a=0;a<e.length;a++){let l=e[a],n=h.indexOf(l.key);-1!==n?(g.push(l),v[n]=1,p(t[n],l.asyncValue)):(l.active=0,l.instance&&K(l.instance),u(l.asyncValue))}for(let e=0;e<t.length;e++){if(v[e])continue;let n=t[e],o=h[e],u=i(a.root.leafOps[a.fullID].group.queue),p={type:'LF',parent:m,child:[],childInitialized:0,visible:0,left:null,right:null},d={type:'listItem',key:o,index:o,active:1,leafData:{type:'list item',block:p,listDraft:s},asyncValue:c({value:n,group:u,onChange(e){d.instance&&effector.launch({target:d.instance.template.api.itemUpdater,params:e,defer:1,page:d.instance,scope:d.instance.root.scope})},onInit(e){d.active&&(r||(d.instance=C(l,{values:{id:o,store:e},parentLeaf:a,mountNode:a.mountNode,svgRoot:a.svgRoot,leafData:d.leafData,opGroup:u,domSubtree:a.root.leafOps[a.fullID].domSubtree,hydration:r,root:a.root})))}})},f=g.length;g.push(d);let b=f>0?g[f-1].leafData:null;if(m.child.push(p),b){let e=b.block;p.left=e;let t=e.right;t?(t.left=p,p.right=t):m.lastChild=p,e.right=p}else m.lastChild=p;r&&(d.instance=C(l,{values:{id:o,store:n},parentLeaf:a,mountNode:a.mountNode,svgRoot:a.svgRoot,leafData:d.leafData,opGroup:u,domSubtree:a.root.leafOps[a.fullID].domSubtree,hydration:r,root:a.root}))}return ue('list update ['+n.shortName+']'),0===g.length&&(m.lastChild=null),d.records=g,g},target:m}),{pendingUpdate:g}},env:d}))}function te({source:e,visible:t,fn:a}){A(ge,'route');let{env:l,namespace:n}=ge,r=x({name:'route',isSvgRoot:0,namespace:n,env:l,draft:{type:'route',childTemplates:[],childCount:0,inParentIndex:-1},fn(r,{mount:o}){let s;if(effector.is.store(t))s=effector.combine({value:e,visible:t});else{let a=t;s=e.map((e=>({value:e,visible:a(e)})))}let i=x({name:'route item',isSvgRoot:0,namespace:n,env:l,draft:{type:'route',childTemplates:[],childCount:0,inParentIndex:-1},state:{store:null},fn({store:e},{mount:t}){let l=effector.createEvent({named:'itemUpdater'});e.on(l,((e,t)=>t)),a({store:e});let n=effector.sample({source:t,clock:s,fn:(e,{visible:t,value:a})=>({leaf:e,visible:t,value:a}),greedy:1});t.watch(Ce.routeItem),n.watch((({leaf:e,visible:t,value:a})=>{if(e.data.block.visible=t,t&&effector.launch({target:l,params:a,defer:1,page:e,scope:e.root.scope}),t){let t=e.parent;for(;t;){if('route'===t.data.type&&!t.data.block.visible)return;t=t.parent}}Z(t,e)}))}});P(i);let{onMount:c,onState:u}=B({mount:o,state:s,onMount:({visible:e,value:t},a)=>({leaf:a,visible:e,value:t}),onState:(e,{visible:t,value:a})=>({leaf:e,visible:t,value:a})}),p=effector.createEvent(),d=effector.sample({source:o,clock:p,greedy:1,fn:(e,t)=>({leaf:e,value:t,visible:1})});return effector.merge([c,u,d]).watch((({leaf:e,visible:t,value:a})=>{let l=e.data;if(l.block.visible=t,t||l.initialized||!l.pendingInit){if(t&&!l.initialized){let t=e.parent;for(;t;){if('route'===t.data.type&&!t.data.block.visible)return void(l.pendingInit={value:a});t=t.parent}}t&&!l.initialized&&(N({parentBlockFragment:l.block,leaf:e,actor:i,values:{store:a}}),l.initialized=1)}else l.pendingInit=null})),{pendingInit:p}}});P(r)}function ae(e){let t='function'==typeof e?e:e.fn,a=x({name:'rec',state:{store:null},isSvgRoot:0,namespace:null,env:null,draft:{type:'rec',childTemplates:[],childCount:0,inParentIndex:0},defer:1,isBlock:1,fn({store:e},{mount:a}){t({store:e,state:e});let l=effector.createEvent({named:'itemUpdater'});return e.on(l,((e,t)=>t)),a.watch(Ce.rec),{itemUpdater:l}}});return({store:e,state:t=e})=>{A(ge,'(rec instance)');let{env:l,namespace:n}=ge;a.deferredInit&&a.deferredInit(),P(x({name:'rec item',isSvgRoot:0,namespace:n,env:l,draft:{type:'recItem',childTemplates:[],childCount:0,inParentIndex:-1},fn(e,{mount:l}){let{onMount:n,onState:r}=B({state:t,mount:l,onMount:(e,t)=>({state:e,leaf:t}),onState:(e,t)=>({state:t,leaf:e})});r.watch((({state:e,leaf:t})=>{W(t,(a=>{effector.launch({target:a.template.api.itemUpdater,params:e,defer:1,page:t,scope:t.root.scope})}))})),n.watch((({leaf:e,state:t})=>{N({parentBlockFragment:e.data.block,leaf:e,actor:a,values:{store:t}})}))}}))}}function le(e,t){if(0===t.length)return e;let a=[e[0]];for(let l=0;l<t.length;l++)a.push(t[l],e[l+1]);return a}Object.defineProperty(exports,'__esModule',{value:1});var effector=require('effector');let ne;ne='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 re=new Map;const oe=[],se=e=>{let t=re.get(e);t||(t={calls:0,time:0,label:e,childTime:0},re.set(e,t)),t.calls+=1,oe.push({bucket:t,pendingStart:ne()})},ie=e=>{let t=re.get(e),a=oe.pop().pendingStart,l=ne()-a;t.time+=l,oe.length>0&&(oe[oe.length-1].bucket.childTime+=l)};let ce,ue;'undefined'!=typeof performance&&performance.mark?(ce=e=>{performance.mark('\u2604\ufe0f '+e+' start'),se(e)},ue=e=>{ie(e);try{performance.measure('\u2604\ufe0f '+e,'\u2604\ufe0f '+e+' start')}catch(e){}performance.clearMarks('\u2604\ufe0f '+e+' start'),performance.clearMeasures('\u2604\ufe0f '+e)}):(ce=e=>{se(e)},ue=e=>{ie(e)});let pe='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0);const de={attr:y,data:b,style:h,styleVar:v,classList:g},fe=(e,t)=>e.includes(t);let me={storeBase(e,t){e.plain.push(t)},storeOnMap(e,t,a,l){var n,r;a.unshift(e.loader),a.push(e.upward),l&&(fe(e.plain,l)||(fe(e.closure,l)||e.closure.push(l),r={type:'closure',of:l},(n=t).before||(n.before=[]),n.before.push(r)))},storeMap(e,t,a){fe(e.plain,t)||fe(a.seq,e.loader)||a.seq.unshift(e.loader)},storeWatch:(e,t,a)=>(e.watch.push({of:t,fn:a}),1),eventPrepend(e,t){t.seq.push(e.upward)},combineBase(e,t,a){e.plain.push(t,a)},combineField(e,t,a){fe(e.plain,t)||a.seq.unshift(e.loader)},splitBase(e,t){e.plain.push(t)},splitMatchStore(e,t,a){fe(e.plain,t)||a.seq.unshift(e.loader)},sampleSource(e,t,a,l){t.current?fe(e.plain,a)||fe(e.closure,a)||e.closure.push(a):e.plain.push(a),e.plain.push(t),fe(e.plain,l)||e.plain.push(l)},sampleTarget(e,t){t.seq.push(e.loader)},sampleSourceLoader:e=>e.loader,sampleSourceUpward:(e,t)=>t&&e.upward},ve=0,he=0,ge=null,be=null;const ye=(e,t)=>e.reg[t.id];let ke=null;const xe=['LF','using','element','recItem','rec','block','blockItem','route'];let Ie=effector.createEvent({named:'onMount'});Ie.watch((({fns:e,element:t})=>{e.forEach((e=>{e(t)}))}));const we=[{type:'attr',field:'value'},{type:'attr',field:'checked'},{type:'attr',field:'min'},{type:'attr',field:'max'}],Se={attr:y,data:b,style:h,styleVar:v,classList:g},De=e=>e.data.block.value;let Ce={using(e){let t=e.data;M(t.draft,{parentBlockFragment:t.block,leaf:e})},routeItem(e){let t=e.draft,a=e.data;a.block.visible=1,M(t,{parentBlockFragment:a.block,leaf:e})},block(e){M(e.draft,{parentBlockFragment:e.data.block,leaf:e})},blockItem(e){N({parentBlockFragment:e.data.block,leaf:e,actor:e.draft.itemOf})},rec(e){M(e.draft,{parentBlockFragment:e.data.block,leaf:e})},listItem(e){let t=e.data,a=t.block;a.visible=1,a.childInitialized=1,M(t.listDraft,{parentBlockFragment:a,leaf:e})}};exports.block=({fn:e,env:t,namespace:a="html"})=>{let l=x({name:'block',isSvgRoot:0,namespace:a,env:t,draft:{type:'block',childTemplates:[],childCount:0,inParentIndex:0},isBlock:1,fn({},{mount:t}){e(),t.watch(Ce.block)}});return()=>{A(ge,'(block instance)');let e={type:'blockItem',childTemplates:[],childCount:0,inParentIndex:-1,itemOf:l},{env:t,namespace:a}=ge;P(x({name:'block item',isSvgRoot:0,namespace:a,env:t,draft:e,fn(e,{mount:t}){t.watch(Ce.blockItem)}}))}},exports.h=(e,t)=>{let a,r=0,o=0;'function'==typeof t?(r=1,a=t):t&&(o=1,t.fn&&(r=1,a=t.fn),t.\u0254&&('function'==typeof t.\u0254?(r=1,a=t.\u0254):'function'==typeof t.\u0254.fn&&(r=1,a=t.\u0254.fn))),A(ge,'h');let s,i=ge.env,c=ge.namespace,u=c,p='html';u=p='svg'===c?'svg':'html','svg'===e&&(p='svg',u='svg'),ge.isBlock||(s='svg'===p?i.document.createElementNS('http://www.w3.org/2000/svg',e):i.document.createElement(e));let d=s,m={type:'element',tag:e,attr:[],data:[],text:[],style:[],styleVar:[],classList:[],handler:[],stencil:d,seq:[],staticSeq:[],childTemplates:[],childCount:0,inParentIndex:-1,opsAmount:1,node:[]};'foreignObject'===c?(m.attr.push({xmlns:'http://www.w3.org/1999/xhtml'}),u='html'):'svg'===e?(m.attr.push({xmlns:'http://www.w3.org/2000/svg'}),u='svg'):'foreignObject'===e&&(u='foreignObject');let v=x({name:'element',draft:m,isSvgRoot:'svg'===e,namespace:u,fn(e,{mount:s}){let i=effector.createEvent({named:'domElementCreated'});r&&a(),o&&$(t),effector.is.unit(m.visible)&&(m.seq.push({type:'visible',value:m.visible}),G(m.visible));let c={attr:{},data:{},style:{},styleVar:{}};j(m,'attr',c),j(m,'data',c),j(m,'style',c),j(m,'styleVar',c),F(c,((e,t)=>{F(e,((e,a)=>{effector.is.unit(e)?(m.seq.push({type:t,field:a,value:e}),G(e)):m.staticSeq.push({type:t,field:a,value:e})}))})),m.classList.forEach((e=>{if(effector.is.unit(e.name)||effector.is.unit(e.enabled)){let t=effector.is.unit(e.name)?e.name:effector.createStore(e.name),a=effector.is.unit(e.enabled)?e.enabled:effector.createStore(e.enabled);m.seq.push({type:'classList',field:t,value:a}),G(t),G(a)}else effector.is.unit(e.name)||e.name.map((t=>m.staticSeq.push({type:'classList',field:t,value:e.enabled})))})),m.text.forEach((e=>{null!==e.value&&(effector.is.unit(e.value)?(m.seq.push({type:'dynamicText',value:e.value,childIndex:e.index}),G(e.value)):m.seq.push({type:'staticText',value:String(e.value),childIndex:e.index}))})),m.handler.forEach((e=>{F(e.map,((t,a)=>{m.seq.push({type:'handler',for:a,handler:t,options:e.options,domConfig:e.domConfig})}))})),d&&f(d,m.staticSeq),m.seq.forEach((e=>{switch(e.type){case'visible':{let{onMount:t,onState:a}=B({mount:s,state:e.value,onMount:(e,t)=>({leaf:t,value:e,hydration:t.hydration}),onState:(e,t)=>({leaf:e,value:t,hydration:0})});t.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=E(r);if(e=t?t.nextSibling:O(r).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}r.value=e,r.visible=1}M(m,{parentBlockFragment:r,leaf:e,node:r.value,svgRoot:v.isSvgRoot?r.value:null}),t&&n.needToCallNode&&(n.needToCallNode=0,effector.launch({target:Ie,params:{element:n.block.value,fns:m.node},page:e,defer:1,scope:e.root.scope})),effector.launch({target:i,params:e,defer:1,page:e,scope:e.root.scope})})),effector.merge([a,t]).watch((({leaf:e,value:t,hydration:a})=>{a||n(t,e.data.ops.visible)}));break}case'attr':case'data':case'style':case'styleVar':{let t=Se[e.type],a=we.some((({type:t,field:a})=>e.type===t&&e.field===a)),l=B({mount:i,state:e.value,onMount:(e,t)=>({leaf:t,value:e}),onState:(e,t)=>({leaf:e,value:t})});a?effector.merge([l.onState,l.onMount]).watch((({leaf:a,value:l})=>{t(De(a),e.field,l)})):U(m,{initCtx(a,l){let n=De(l);return t(n,e.field,a),n},runOp(a,l){t(l,e.field,a)},hooks:l});break}case'classList':{var t;let a=Se.classList,l=effector.createStore({prev:[],curr:null!==(t=e.field.getState())&&void 0!==t?t:[]}).on(e.field,(({curr:e},t)=>({prev:e,curr:t}))),n=B({mount:i,state:effector.combine({name:l,enabled:e.value}),onMount:(e,t)=>({leaf:t,value:e}),onState:(e,t)=>({leaf:e,value:t})});U(m,{initCtx(e,t){let l=De(t);return e.name.curr.forEach((t=>{a(l,t,e.enabled)})),l},runOp(e,t){e.name.prev.filter((t=>!e.name.curr.includes(t))).forEach((e=>{a(t,e,0)})),e.name.curr.forEach((l=>{a(t,l,e.enabled)}))},hooks:n});break}case'dynamicText':U(m,{initCtx:(t,a)=>z(a,t,e.childIndex),runOp(e,t){k(t.value,e)},hooks:B({mount:i,state:e.value,onMount:(e,t)=>({leaf:t,value:String(e)}),onState:(e,t)=>({leaf:e,value:String(t)})})});break;case'staticText':i.watch((t=>{z(t,e.value,e.childIndex)}));break;case'handler':{let t=e.handler.graphite.meta.nativeTemplate||null;i.watch((a=>{let l=null;if(t){let e=0,n=a;for(;!e&&n;)n.template===t?(e=1,l=n):n=n.parent}else l=null;De(a).addEventListener(e.for,(t=>{e.options.prevent&&t.preventDefault(),e.options.stop&&t.stopPropagation(),effector.launch({target:e.handler,params:t,page:l,scope:a.root.scope})}),e.domConfig)}));break}}})),s.watch((e=>{let t=e.data;if(!m.visible){let a=t.ops.visible,r=t.block;if(e.hydration){l(1,a);let e,t=E(r);if(e=t?t.nextSibling:O(r).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}r.value=e,r.visible=1}M(m,{parentBlockFragment:r,leaf:e,node:r.value,svgRoot:v.isSvgRoot?r.value:null}),effector.launch({target:i,params:e,defer:1,page:e,scope:e.root.scope}),e.hydration?t.needToCallNode&&(t.needToCallNode=0,effector.launch({target:Ie,params:{element:t.block.value,fns:m.node},page:e,defer:1,scope:e.root.scope})):n(1,a)}}))},env:i});P(v)},exports.handler=_,exports.list=ee,exports.node=e=>{A(ge,'node');let t=ge.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=ae,exports.remap=Y,exports.route=te,exports.spec=$,exports.text=(e,...t)=>{Array.isArray(e)?$({text:le(e,t)}):$({text:e})},exports.tree=({source:e,key:t,child:a,fn:l})=>{let n=ae((({store:e})=>{ee({source:e,key:t,fn({store:e}){let t=e.map((e=>e[a]||[]));l({store:e,child(){n({store:t})}})}})}));n({store:e})},exports.using=(e,t)=>{let a,l,n,r,o,c;if('function'==typeof t)a=t,n=Q(),r=0;else{if(!t)throw Error('using() second argument is missing');a=t.fn,n=t.env?t.env:Q(),r=t.hydrate,l=t.onComplete,o=t.onRoot,c=t.scope}R(e,'using() first argument is missing');let u={scope:c,env:n,activeSpawns:new Set,childSpawns:{},leafOps:{}},p=e.namespaceURI,d=e.tagName.toLowerCase(),f={type:'using',childTemplates:[],childCount:0,inParentIndex:-1},m=x({name:'using',draft:f,isSvgRoot:'svg'===d,namespace:'http://www.w3.org/2000/svg'===p?'svg':'foreignobject'===d?'foreignObject':'html',fn(e,{mount:t}){a(),t.watch(Ce.using)},env:n}),v={type:'using',child:[],value:e},h=s({onComplete:l}),g=C(m,{parentLeaf:be||null,mountNode:e,svgRoot:m.isSvgRoot?e:be?be.svgRoot:null,leafData:{type:'using',draft:f,element:e,block:v},opGroup:i(h),domSubtree:i(h),hydration:r,root:u});if(o&&o({template:m,leaf:g}),h.onDrain&&!h.rafID){let e=h.onDrain;h.onDrain=null,e()}},exports.val=(e,...t)=>t.every((e=>!effector.is.store(e)))?le(e,t).join(''):effector.combine(t,(t=>le(e,t).join(''))),exports.variant=({source:e,cases:t,key:a})=>{let l;A(ge,'variant'),R(effector.is.unit(e),'variant({source}) should be unit'),l='function'==typeof a?a:null==a?e=>String(e):e=>String(e[a]);let n=0;for(let a in t)'__'!==a?te({source:e,visible:e=>l(e)===a,fn:t[a]}):n=1;if(n){let a=Object.keys(t);te({source:e,visible:e=>!a.includes(l(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='undefined'!=typeof globalThis?globalThis: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})(l(e),e)}function l(e){return e.group.activeChilds[e.priority]}function n(e,t){t.value.active=t.value.pending=e,'active'!==t.status&&a(t)}function r(e,n){if(n.value.active===e)return n.value.pending=e,void('pending'===n.status&&(a(n),l(n).first||t(n.group,n.priority)));'active'===n.status&&(n.status='pending',l(n).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})(n.group,n.priority),((e,t)=>{e.last?(t.cursor.prev=e.last,e.last.cursor.next=t,e.last=t):e.first=e.last=t})(l(n),n)),n.value.pending=e,n.group.queue.rafID||(n.group.queue.rafID=fe(n.group.queue.execQueue))}function o(e){pe('execQueue');let l,n,r=re(),o=0;e:for(;e.props.first||e.tree.first||e.data.first;){if(re()-r>=oe){o=1;break e}let i=!!e.props.first;for(i&&pe('props');l=e.props.first;){for(;n=l.activeChilds.props.first;){if(re()-r>=oe){o=1,de('props');break e}n.runOp(n.value.pending),n.value.active=n.value.pending,a(n)}t(l,'props')}i&&de('props');let s=!!e.tree.first;for(s&&pe('tree');l=e.tree.first;){for(;n=l.activeChilds.tree.first;){if(re()-r>=oe){o=1,de('tree');break e}n.runOp(n.value.pending),n.value.active=n.value.pending,a(n)}t(l,'tree')}s&&de('tree');let c=!!e.data.first;for(c&&pe('data');l=e.data.first;){for(;n=l.activeChilds.data.first;){if(re()-r>=oe){o=1,de('data');break e}n.runOp(n.value.pending),n.value.active=n.value.pending,a(n)}t(l,'data')}c&&de('data')}if(de('execQueue'),o)e.rafID=fe(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:l}){return{value:{active:e,pending:e},runOp:t,status:'active',priority:l,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 c(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:l}){let n=i({value:e,group:t,runOp(e){o.status='A',l(e)},priority:'data'}),o={status:'IA',value:n.value,ops:{init:i({value:0,group:t,runOp(e){o.status='A',a(o.value.active)},priority:'data'}),change:n,terminate:i({value:0,group:t,runOp(e){o.status='T'},priority:'data'})}};return r(1,o.ops.init),o}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)}}function d(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 f(e){switch(e=String(e)){case'__proto__':case'__defineGetter__':case'__defineSetter__':case'constructor':case'prototype':case'hasOwnProperty':case'toString':case'valueOf':case'setProperty':case'removeProperty':return'forbidden';default:return e.replace(/[^a-zA-Z0-9\-_]/g,'')}}function m(e,t){for(let a=0;a<t.length;a++){let{type:l,field:n,value:r}=t[a];me[l](e,n,r)}}function v(e){return''!==e&&0!==e&&'0'!==e&&(0==e||null==e)}function h(e,t,a){v(a)?e.style.removeProperty(`--${t}`):e.style.setProperty(`--${t}`,`${a}`)}function g(e,t,a){v(a)?delete e.style[t]:e.style[t]=`${a}`}function b(e,t,a){t&&t.trim().length>0&&(a?e.classList.add(t):(e.classList.remove(t),0===e.classList.length&&e.removeAttribute('class')))}function y(e,t,a){v(a)?delete e.dataset[t]:e.dataset[t]=`${a}`}function k(e,t,a){if(v(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 I(e,t){e.replaceData(0,(e.textContent||'').length,String(t))}function x({fn:e,state:t={},defer:a=0,name:l="",draft:n,isSvgRoot:r,namespace:o,env:i,isBlock:s=0}){let c=ye,u={id:++ge,name:l,plain:[],watch:[],nameMap:{},pages:[],closure:[],childTemplates:[],handlers:he,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.root.activeSpawns.has(a.page.fullID))return console.count('inactive page upward'),0;let l=[a.page.template],n=[a.page];{let e=a.page.parent;for(;e;)n.push(e),l.push(e.template),e=e.parent}return a.node.next.forEach((t=>{let r=t.meta.nativeTemplate;if(r)if(l.includes(r)){let o=n[l.indexOf(r)];effector.launch({target:t,params:e,defer:1,page:o,stack:a,scope:a.scope})}else console.error('context drift',{stack:a,node:t});else effector.launch({target:t,params:e,defer:1,page:a.page,stack:a,scope:a.scope})})),0}}),loader:effector.step.filter({fn(e,t,a){if(a.parent){let t=a.scope?a.scope.graphite.id:null;if(a.page){if(!a.page.root.activeSpawns.has(a.page.fullID))return console.count('inactive page loader'),0;if(a.page.template===u)return 1;if(a.page.root.childSpawns[a.page.fullID][u.id])a.page.root.childSpawns[a.page.fullID][u.id].forEach((l=>{(!t||l.root.scope&&t===l.root.scope.graphite.id)&&effector.launch({params:e,target:a.node,page:l,defer:1,scope:a.scope})}));else{let l=a.page.fullID,n='rec'===a.page.template.name;u.pages.forEach((r=>{if(!t||r.root.scope&&t===r.root.scope.graphite.id)if(r.fullID===l||r.fullID.startsWith(`${l}_`)){let t=1;if(n){let e=a.page.template.id,l=r.parent;for(;l&&l!==a.page;){if(l.template.id===e){t=0;break}l=l.parent}}t&&effector.launch({params:e,target:a.node,page:r,defer:1,scope:a.scope})}else l.startsWith(`${r.fullID}_`)&&effector.launch({params:e,target:a.node,page:a.page,defer:1,scope:a.scope})}))}}else u.pages.forEach((l=>{(!t||l.root.scope&&t===l.root.scope.graphite.id)&&effector.launch({params:e,target:a.node,page:l,defer:1,scope:a.scope})}));return 0}return 1}}),parent:c,node:null,api:null,trigger:{mount:effector.createEvent({named:'mount'})},draft:n,isSvgRoot:r,namespace:o,env:i,isBlock:s||!(!c||!c.isBlock)};c&&c.childTemplates.push(u);let p=effector.createNode({meta:{template:u}});return u.node=p,ye=u,a?u.deferredInit=()=>{let a=ye;ye=u,u.deferredInit=null;try{effector.withRegion(p,(()=>{let a=effector.restore(t);u.api=e(a,u.trigger),u.nameMap=a}))}finally{ye=a}}:effector.withRegion(p,(()=>{let a=effector.restore(t);u.api=e(a,u.trigger),u.nameMap=a})),ye=c,u}function w(e,t){let a;switch(a=t?t.getState(e):e.current,e.type){case'list':return[...a];case'shape':return{...a};default:return a}}function S(e,t,a){let l=t;for(;l&&!Ie(l,e);)l=l.parent;return l?Ie(l,e):a?(a.getState(e),a.reg[e.id]):e}function D(e,t,a){return S(e,t,a).current}function C(e,t){Ie(t,e)||(t.reg[e.id]=S(e,t.parent,t.root.scope))}function T(e,t,a){t in a||(a[t]=[]),a[t].push(...e)}function O(e,{values:t={},parentLeaf:a,mountNode:l,svgRoot:n,leafData:r,opGroup:o,domSubtree:i,hydration:s,root:c}){function u(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,l=a.from;if(!a.fn&&!l)break;l&&(C(l,f),t=d[l.id].current),d[e.id].current=a.fn?a.fn(t):t;break}case'field':{let t=a.from;C(t,f),d[e.id].current[a.field]=d[t.id].current;break}case'closure':C(a.of,f)}}}function p(e,t,a){let l;t.stop=1;try{for(;t.i<e.length;)l=e[t.i],t.i++,l.fn(a[l.of.id]?a[l.of.id].current:D(l.of,f.parent,f.root.scope))}catch(e){console.error(e),t.stop=0}}let d={},f={draft:e.draft,svgRoot:n,data:r,parent:a,hydration:s,mountNode:l,root:c,id:++be,fullID:'',reg:d,template:e};e.pages.push(f);let m=ke;ke=f,a&&T([f],e.id,c.childSpawns[a.fullID]),f.fullID=a?`${a.fullID}_${f.id}`:`${f.id}`,c.childSpawns[f.fullID]={},c.activeSpawns.add(f.fullID),c.leafOps[f.fullID]={group:o,domSubtree:i};for(let t=0;t<e.closure.length;t++){let a=e.closure[t],l=a,n=f.parent;e:for(;n;){if(Ie(n,a)){l=Ie(n,a);break e}n=n.parent}!n&&c.scope&&(c.scope.getState(a),l=c.scope.reg[a.id]),d[a.id]=l}for(let t=0;t<e.plain.length;t++){let a=e.plain[t],l={id:a.id,current:w(a,c.scope)};d[a.id]=l}for(let a in t){let l=e.nameMap[a].stateRef.id;d[l]={id:l,current:t[a]}}e.closure.forEach(u),e.plain.forEach(u);let v={i:0,stop:0};for(;!v.stop;)p(e.watch,v,d);if(a)for(let e in c.childSpawns[f.fullID])T(c.childSpawns[f.fullID][e],e,c.childSpawns[a.fullID]);if(xe)xe.steps.push({target:e.trigger.mount,params:f,defer:1,page:f,scope:c.scope});else{let t;xe={parent:xe,steps:[{target:e.trigger.mount,params:f,defer:1,page:f,scope:c.scope}]};do{for(;t=xe.steps.shift();)xe={parent:xe,steps:[]},effector.launch(t)}while(xe=xe.parent)}return ke=m,f}function q(e){let t=e.parent;for(;'element'!==t.type&&'using'!==t.type;)t=t.parent;return t?t.value:null}function R(e){if(!e.visible)return null;switch(e.type){case'text':case'element':return e;case'LF':case'route':case'rec':case'recItem':case'block':case'blockItem':for(let t=e.child.length-1;t>=0;t--){let a=R(e.child[t]);if(a)return a}return null;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 A(e){switch(e.type){case'using':return null;case'LF':{let t=e.left;for(;t;){let e=R(t);if(e)return e;t=t.left}return A(e.parent)}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 l=R(e);if(l)return l}switch(t.type){case'element':case'using':return null}return A(t)}default:return null}}function E(e){let t=A(e);return t?t.value:null}function P(e,t){if(!e)throw Error(t)}function M(e,t){if(!e)throw Error(`${t}() called outside from using() closure`)}function N(e){if(!ye)return;let{draft:t}=e;if('listItem'!==t.type&&'rec'!==t.type)switch(ye.draft.type){case'element':case'using':case'route':case'list':case'rec':case'recItem':case'block':case'blockItem':t.inParentIndex=ye.draft.childCount,ye.draft.childCount+=1,ye.draft.childTemplates.push(e);break;default:console.warn(`unexpected currentTemplate type ${ye.draft.type}`)}}function L(e,{parentBlockFragment:t,leaf:a,node:l,svgRoot:n,values:r}){e.childTemplates.forEach((e=>{B({parentBlockFragment:t,leaf:a,node:l,svgRoot:n,values:r,actor:e})}))}function B({parentBlockFragment:e,leaf:t,node:a=t.mountNode,actor:l,svgRoot:n,values:r}){let o;P(we.includes(e.type),`incorrect parent ${e.type}`);let{draft:s}=l,{queue:u}=t.root.leafOps[t.fullID].group,p=c(u),d=t.root.leafOps[t.fullID].domSubtree,f=d;switch(s.type){case'route':{let t={type:'route',parent:e,child:[],visible:0,index:s.inParentIndex};e.child[s.inParentIndex]=t,o={type:'route',block:t,ops:{},initialized:0,pendingInit:null};break}case'element':{let a;if(l.isBlock){let e,l,n=t;for(;n&&(!l||!e);){n.template.env&&(e=n.template.env);let{draft:t}=n;'element'===t.type&&('svg'===t.tag?l='svg':'foreignObject'===t.tag&&(l='html')),n=n.parent}l||(l='html'),e&&(a='svg'===l?e.document.createElementNS('http://www.w3.org/2000/svg',s.tag):e.document.createElement(s.tag),m(a,s.staticSeq))}else a=s.stencil.cloneNode();let n={type:'element',parent:e,child:[],value:a,visible:0,index:s.inParentIndex};e.child[s.inParentIndex]=n,o={type:'element',block:n,ops:{visible:i({value:0,priority:'tree',runOp(e){if(e){F(n);let e=o;e.needToCallNode&&(e.needToCallNode=0,effector.launch({target:Se,params:{element:n.value,fns:s.node},page:v,scope:t.root.scope})),n.visible=1}else n.value.remove(),n.visible=0},group:d})},needToCallNode:s.node.length>0},f=c(u);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,records:[],pendingUpdate:null};break}case'using':case'listItem':break;case'rec':{let t={type:'rec',parent:e,child:[],visible:1,index:s.inParentIndex};e.child[s.inParentIndex]=t,o={type:'rec',block:t};break}case'recItem':{let t={type:'recItem',parent:e,child:[],visible:1,index:s.inParentIndex};e.child[s.inParentIndex]=t,o={type:'rec item',block:t};break}case'block':{let t={type:'block',parent:e,child:[],visible:1,index:s.inParentIndex};e.child[s.inParentIndex]=t,o={type:'block',block:t};break}case'blockItem':{let t={type:'blockItem',parent:e,child:[],visible:1,index:s.inParentIndex};e.child[s.inParentIndex]=t,o={type:'block item',block:t};break}default:console.warn(`unexpected draft type ${s.type}`)}let v=O(l,{values:r,parentLeaf:t,mountNode:a,svgRoot:n||t.svgRoot,leafData:o,opGroup:p,domSubtree:f,hydration:t.hydration,root:t.root})}function F(e){let t=E(e);t?t.after(e.value):q(e).prepend(e.value),e.visible=1}function _({mount:e,state:t,onMount:a,onState:l}){return{onMount:effector.sample({source:t,clock:e,fn:a,greedy:1}),onState:effector.sample({source:e,clock:t,fn:l,greedy:1})}}function $(e,t){for(let a in e)t(e[a],a)}function V(e,t){if(!ye)return;let a=ye.draft;P('element'===a.type,`"handler" extension can be used only with element nodes, got "${a.type}"`),void 0===t&&(t=e,e={});for(let e in t)P(effector.is.unit(t[e]),`handler for "${e}" should be event`);let{passive:l=0,capture:n=0,prevent:r=0,stop:o=0}=e;a.handler.push({options:{prevent:r,stop:o},domConfig:{passive:r?0:l,capture:n},map:t})}function U(e){M(ye,'spec');let t=ye.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,l=t.childCount;Array.isArray(a)?(t.text.push(...a.map(((e,t)=>({index:t+l,value:e})))),t.childCount+=a.length):(t.text.push({index:l,value:a}),t.childCount+=1)}if(e.style){let a={};for(let t in e.style)a[f(t)]=e.style[t];t.style.push(a)}if(e.classList&&((e,t)=>{Array.isArray(e)?e.forEach((e=>{let a='string'==typeof e?e:e.map((e=>e||'')),l='string'==typeof e?1:e.map((e=>null!==e));t({name:a,enabled:l})})):$(e,((e,a)=>{t({name:a,enabled:e})}))})(e.classList,(e=>t.classList.push(e))),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.\u0254&&U(e.\u0254)}function j(e,{initCtx:t,runOp:a,hooks:{onMount:l,onState:n}}){let o=e.opsAmount++;l.watch((({value:e,leaf:l})=>{let n=t(e,l),r=i({value:e,priority:'props',runOp(e){a(e,n)},group:l.root.leafOps[l.fullID].group});l.root.leafOps[l.fullID].group.ops[o]=r})),n.watch((({value:e,leaf:t})=>{r(e,t.root.leafOps[t.fullID].group.ops[o])}))}function z(e,t,a){e[t].forEach((e=>{$(e,((e,l)=>{switch(t){case'data':case'styleVar':a[t][l]=e;break;case'attr':a.attr['xlink:href'===l?'href':l]=e;break;case'style':l.startsWith('--')?a.styleVar[l.slice(2)]=e:a.style[l]=e}}))}))}function G(e,t,a){let l=e.data.block,n={type:'text',parent:l,visible:0,index:a,value:null};if(l.child[a]=n,e.hydration){let a=A(n);if(a)switch(a.type){case'text':n.value=e.root.env.document.createTextNode(t),a.value.after(n.value);break;case'element':n.value=a.value.nextSibling,I(n.value,t)}else{let e=q(n);n.value=e.firstChild,I(n.value,t)}n.visible=1}else n.value=e.root.env.document.createTextNode(t),F(n);return n}function Q(e){let t=e.stateRef,a=ye;a.plain.includes(t)||a.closure.includes(t)||a.closure.push(t)}function W(){if('undefined'!=typeof document)return{document};throw Error('your environment has no document')}function Z(e,t){let a=e.root.childSpawns[e.fullID];for(let e in a){let l=a[e];for(let e=0;e<l.length;e++)t(l[e])}}function H(e,t){let a=t=>{let l=t.data;if(e&&'list'===l.type&&l.pendingUpdate){let e=l.pendingUpdate;l.pendingUpdate=null,effector.launch({target:t.template.api.pendingUpdate,params:e,defer:1,page:t,scope:t.root.scope})}if(e&&'route'===l.type)if(l.pendingInit){let e=l.pendingInit.value;l.pendingInit=null,effector.launch({target:t.template.api.pendingInit,params:e,defer:1,page:t,scope:t.root.scope})}else if(!l.block.visible)return;switch(l.type){case'element':r(e,l.ops.visible);break;case'route':case'list':case'list item':Z(t,a);break;default:console.log('unsupported type',l.type)}};Z(t,a)}function J(e){e.root.activeSpawns.delete(e.fullID),Z(e,X)}function K(e){Y(e,e.root.childSpawns[e.parent.fullID][e.template.id]),Y(e,e.template.pages)}function X(e){let{data:t,root:a}=e;switch(t.type){case'element':Y(e,a.childSpawns[e.parent.fullID][e.template.id]),function e(t){a.activeSpawns.delete(t.fullID);let l=a.childSpawns[t.fullID];delete a.childSpawns[t.fullID],delete a.leafOps[t.fullID],Y(t,t.template.pages);for(let t in l)l[t].forEach(e)}(e),r(0,t.ops.visible);break;case'list':{let a=t.records;for(let e=0;e<a.length;e++){let t=a[e];t.instance&&X(t.instance),t.active=0}e.root.activeSpawns.delete(e.fullID),K(e);break}case'list item':{let a=t.block;Y(a,a.parent.child);let l=a.left,n=a.right;l&&(l.right=n,n||a.parent.lastChild!==a||(a.parent.lastChild=l)),n&&(n.left=l),l||n||a.parent.lastChild!==a||(a.parent.lastChild=null),a.left=null,a.right=null,J(e),K(e);break}case'route':J(e),K(e);break;case'block':case'block item':case'rec':case'rec item':J(e)}delete a.childSpawns[e.fullID],delete a.leafOps[e.fullID]}function Y(e,t){if(!t)return;let a=t.indexOf(e);-1!==a&&t.splice(a,1)}function ee(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 l in t){let n=t[l];a[l]=e.map('function'==typeof n?e=>n(e):e=>e[n])}return a}return e.map((e=>e[t]))}function te(e,t){M(ye,'list'),'function'==typeof t&&(effector.is.unit(e)?e={source:e,fn:t}:e.fn=t);let{fn:a,key:l,source:n,fields:r=[]}=e,o=void 0!==l?'function'==typeof l?l:e=>e[l]:(e,t)=>t,i={type:'list',key:effector.is.store(e)?{type:'index'}:{type:'key',key:e.key},childTemplates:[],childCount:0,inParentIndex:-1},{env:s,namespace:f}=ye;N(x({name:'list',draft:i,isSvgRoot:0,namespace:f,fn(e,{mount:t}){let l=x({name:'list item',state:{id:-1,store:null},draft:i,isSvgRoot:0,namespace:f,fn({id:e,store:t},{mount:l}){a({store:t,key:e,fields:ee(t,r)});let n=effector.createEvent({named:'itemUpdater'});if(t.on(n,((e,t)=>t)),i.itemVisible){let{onMount:e,onState:t}=_({mount:l,state:i.itemVisible,onMount:(e,t)=>({visible:e,leaf:t}),onState:(e,t)=>({visible:t,leaf:e})});e.watch((({visible:e,leaf:t})=>{let a=t.data.block;a.visible=e,a.childInitialized=e,e&&L(i,{parentBlockFragment:a,leaf:t})})),t.watch((({visible:e,leaf:t})=>{let a=t.data.block;a.visible=e,a.childInitialized?H(e,t):e&&(a.childInitialized=1,L(i,{parentBlockFragment:a,leaf:t}))}))}else l.watch(Oe.listItem);return{itemUpdater:n}},env:s}),m=effector.createStore([]),v=n.map((e=>e)),h=effector.sample({source:n,clock:t,fn:(e,t)=>({updates:e,leaf:t,hydration:t.hydration}),greedy:1}),g=effector.createEvent(),b=effector.sample({source:h,clock:[v,g],fn:({leaf:e},t)=>({updates:t,leaf:e,hydration:0}),greedy:1});return effector.sample({source:m,clock:[h,b],greedy:1,fn(e,{updates:t,leaf:a,hydration:r}){let s=a.data,f=a;for(;f;){if('route'===f.data.type&&!f.data.block.visible)return void(s.pendingUpdate=t);f=f.parent}let m=s.block;pe('list update ['+n.shortName+']');let v=Array(t.length).fill(0),h=t.map(o),g=[];for(let a=0;a<e.length;a++){let l=e[a],n=h.indexOf(l.key);-1!==n?(g.push(l),v[n]=1,d(t[n],l.asyncValue)):(l.active=0,l.instance&&X(l.instance),p(l.asyncValue))}for(let e=0;e<t.length;e++){if(v[e])continue;let n=t[e],o=h[e],s=c(a.root.leafOps[a.fullID].group.queue),p={type:'LF',parent:m,child:[],childInitialized:0,visible:0,left:null,right:null},d={type:'listItem',key:o,index:o,active:1,leafData:{type:'list item',block:p,listDraft:i},asyncValue:u({value:n,group:s,onChange(e){d.instance&&effector.launch({target:d.instance.template.api.itemUpdater,params:e,defer:1,page:d.instance,scope:d.instance.root.scope})},onInit(e){d.active&&(r||(d.instance=O(l,{values:{id:o,store:e},parentLeaf:a,mountNode:a.mountNode,svgRoot:a.svgRoot,leafData:d.leafData,opGroup:s,domSubtree:a.root.leafOps[a.fullID].domSubtree,hydration:r,root:a.root})))}})},f=g.length;g.push(d);let b=f>0?g[f-1].leafData:null;if(m.child.push(p),b){let e=b.block;p.left=e;let t=e.right;t?(t.left=p,p.right=t):m.lastChild=p,e.right=p}else m.lastChild=p;r&&(d.instance=O(l,{values:{id:o,store:n},parentLeaf:a,mountNode:a.mountNode,svgRoot:a.svgRoot,leafData:d.leafData,opGroup:s,domSubtree:a.root.leafOps[a.fullID].domSubtree,hydration:r,root:a.root}))}return de('list update ['+n.shortName+']'),0===g.length&&(m.lastChild=null),s.records=g,g},target:m}),{pendingUpdate:g}},env:s}))}function ae({source:e,visible:t,fn:a}){M(ye,'route');let{env:l,namespace:n}=ye,r=x({name:'route',isSvgRoot:0,namespace:n,env:l,draft:{type:'route',childTemplates:[],childCount:0,inParentIndex:-1},fn(r,{mount:o}){let i;if(effector.is.store(t))i=effector.combine({value:e,visible:t});else{let a=t;i=e.map((e=>({value:e,visible:a(e)})))}let s=x({name:'route item',isSvgRoot:0,namespace:n,env:l,draft:{type:'route',childTemplates:[],childCount:0,inParentIndex:-1},state:{store:null},fn({store:e},{mount:t}){let l=effector.createEvent({named:'itemUpdater'});e.on(l,((e,t)=>t)),a({store:e});let n=effector.sample({source:t,clock:i,fn:(e,{visible:t,value:a})=>({leaf:e,visible:t,value:a}),greedy:1});t.watch(Oe.routeItem),n.watch((({leaf:e,visible:t,value:a})=>{if(e.data.block.visible=t,t&&effector.launch({target:l,params:a,defer:1,page:e,scope:e.root.scope}),t){let t=e.parent;for(;t;){if('route'===t.data.type&&!t.data.block.visible)return;t=t.parent}}H(t,e)}))}});N(s);let{onMount:c,onState:u}=_({mount:o,state:i,onMount:({visible:e,value:t},a)=>({leaf:a,visible:e,value:t}),onState:(e,{visible:t,value:a})=>({leaf:e,visible:t,value:a})}),p=effector.createEvent(),d=effector.sample({source:o,clock:p,greedy:1,fn:(e,t)=>({leaf:e,value:t,visible:1})});return effector.merge([c,u,d]).watch((({leaf:e,visible:t,value:a})=>{let l=e.data;if(l.block.visible=t,t||l.initialized||!l.pendingInit){if(t&&!l.initialized){let t=e.parent;for(;t;){if('route'===t.data.type&&!t.data.block.visible)return void(l.pendingInit={value:a});t=t.parent}}t&&!l.initialized&&(B({parentBlockFragment:l.block,leaf:e,actor:s,values:{store:a}}),l.initialized=1)}else l.pendingInit=null})),{pendingInit:p}}});N(r)}function le(e){let t='function'==typeof e?e:e.fn,a=x({name:'rec',state:{store:null},isSvgRoot:0,namespace:null,env:null,draft:{type:'rec',childTemplates:[],childCount:0,inParentIndex:0},defer:1,isBlock:1,fn({store:e},{mount:a}){t({store:e,state:e});let l=effector.createEvent({named:'itemUpdater'});return e.on(l,((e,t)=>t)),a.watch(Oe.rec),{itemUpdater:l}}});return({store:e,state:t=e})=>{M(ye,'(rec instance)');let{env:l,namespace:n}=ye;a.deferredInit&&a.deferredInit(),N(x({name:'rec item',isSvgRoot:0,namespace:n,env:l,draft:{type:'recItem',childTemplates:[],childCount:0,inParentIndex:-1},fn(e,{mount:l}){let{onMount:n,onState:r}=_({state:t,mount:l,onMount:(e,t)=>({state:e,leaf:t}),onState:(e,t)=>({state:t,leaf:e})});r.watch((({state:e,leaf:t})=>{Z(t,(a=>{effector.launch({target:a.template.api.itemUpdater,params:e,defer:1,page:t,scope:t.root.scope})}))})),n.watch((({leaf:e,state:t})=>{B({parentBlockFragment:e.data.block,leaf:e,actor:a,values:{store:t}})}))}}))}}function ne(e,t){if(0===t.length)return e;let a=[e[0]];for(let l=0;l<t.length;l++)a.push(t[l],e[l+1]);return a}let re,oe=1e3;re='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 ie=new Map;const se=[],ce=e=>{let t=ie.get(e);t||(t={calls:0,time:0,label:e,childTime:0},ie.set(e,t)),t.calls+=1,se.push({bucket:t,pendingStart:re()})},ue=e=>{let t=ie.get(e),a=se.pop().pendingStart,l=re()-a;t.time+=l,se.length>0&&(se[se.length-1].bucket.childTime+=l)};let pe,de;'undefined'!=typeof performance&&performance.mark?(pe=e=>{performance.mark('\u2604\ufe0f '+e+' start'),ce(e)},de=e=>{ue(e);try{performance.measure('\u2604\ufe0f '+e,'\u2604\ufe0f '+e+' start')}catch(e){}performance.clearMarks('\u2604\ufe0f '+e+' start'),performance.clearMeasures('\u2604\ufe0f '+e)}):(pe=e=>{ce(e)},de=e=>{ue(e)});let fe='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0);const me={attr:k,data:y,style:g,styleVar:h,classList:b},ve=(e,t)=>e.includes(t);let he={storeBase(e,t){e.plain.push(t)},storeOnMap(e,t,a,l){a.unshift(e.loader),a.push(e.upward),l&&(ve(e.plain,l)||(ve(e.closure,l)||e.closure.push(l),((e,t)=>{e.before||(e.before=[]),e.before.push(t)})(t,{type:'closure',of:l})))},storeMap(e,t,a){ve(e.plain,t)||ve(a.seq,e.loader)||a.seq.unshift(e.loader)},storeWatch:(e,t,a)=>(e.watch.push({of:t,fn:a}),1),eventPrepend(e,t){t.seq.push(e.upward)},combineBase(e,t,a){e.plain.push(t,a)},combineField(e,t,a){ve(e.plain,t)||a.seq.unshift(e.loader)},splitBase(e,t){e.plain.push(t)},splitMatchStore(e,t,a){ve(e.plain,t)||a.seq.unshift(e.loader)},sampleSource(e,t,a,l){t.current?ve(e.plain,a)||ve(e.closure,a)||e.closure.push(a):e.plain.push(a),e.plain.push(t),ve(e.plain,l)||e.plain.push(l)},sampleTarget(e,t){t.seq.push(e.loader)},sampleSourceLoader:e=>e.loader,sampleSourceUpward:(e,t)=>t&&e.upward},ge=0,be=0,ye=null,ke=null;const Ie=(e,t)=>e.reg[t.id];let xe=null;const we=['LF','using','element','recItem','rec','block','blockItem','route'];let Se=effector.createEvent({named:'onMount'});Se.watch((({fns:e,element:t})=>{e.forEach((e=>{e(t)}))}));const De=[{type:'attr',field:'value'},{type:'attr',field:'checked'},{type:'attr',field:'min'},{type:'attr',field:'max'}],Ce={attr:k,data:y,style:g,styleVar:h,classList:b},Te=e=>e.data.block.value;let Oe={using(e){let t=e.data;L(t.draft,{parentBlockFragment:t.block,leaf:e})},routeItem(e){let t=e.draft,a=e.data;a.block.visible=1,L(t,{parentBlockFragment:a.block,leaf:e})},block(e){L(e.draft,{parentBlockFragment:e.data.block,leaf:e})},blockItem(e){B({parentBlockFragment:e.data.block,leaf:e,actor:e.draft.itemOf})},rec(e){L(e.draft,{parentBlockFragment:e.data.block,leaf:e})},listItem(e){let t=e.data,a=t.block;a.visible=1,a.childInitialized=1,L(t.listDraft,{parentBlockFragment:a,leaf:e})}};e.block=({fn:e,env:t,namespace:a="html"})=>{let l=x({name:'block',isSvgRoot:0,namespace:a,env:t,draft:{type:'block',childTemplates:[],childCount:0,inParentIndex:0},isBlock:1,fn({},{mount:t}){e(),t.watch(Oe.block)}});return()=>{M(ye,'(block instance)');let e={type:'blockItem',childTemplates:[],childCount:0,inParentIndex:-1,itemOf:l},{env:t,namespace:a}=ye;N(x({name:'block item',isSvgRoot:0,namespace:a,env:t,draft:e,fn(e,{mount:t}){t.watch(Oe.blockItem)}}))}},e.h=(e,t)=>{let a,l=0,o=0;'function'==typeof t?(l=1,a=t):t&&(o=1,t.fn&&(l=1,a=t.fn),t.\u0254&&('function'==typeof t.\u0254?(l=1,a=t.\u0254):'function'==typeof t.\u0254.fn&&(l=1,a=t.\u0254.fn))),M(ye,'h');let i,s=ye.env,c=ye.namespace,u=c,p='html';u=p='svg'===c?'svg':'html','svg'===e&&(p='svg',u='svg'),ye.isBlock||(i='svg'===p?s.document.createElementNS('http://www.w3.org/2000/svg',e):s.document.createElement(e));let d=i,f={type:'element',tag:e,attr:[],data:[],text:[],style:[],styleVar:[],classList:[],handler:[],stencil:d,seq:[],staticSeq:[],childTemplates:[],childCount:0,inParentIndex:-1,opsAmount:1,node:[]};'foreignObject'===c?(f.attr.push({xmlns:'http://www.w3.org/1999/xhtml'}),u='html'):'svg'===e?(f.attr.push({xmlns:'http://www.w3.org/2000/svg'}),u='svg'):'foreignObject'===e&&(u='foreignObject');let v=x({name:'element',draft:f,isSvgRoot:'svg'===e,namespace:u,fn(e,{mount:i}){let s=effector.createEvent({named:'domElementCreated'});l&&a(),o&&U(t),effector.is.unit(f.visible)&&(f.seq.push({type:'visible',value:f.visible}),Q(f.visible));let c={attr:{},data:{},style:{},styleVar:{}};z(f,'attr',c),z(f,'data',c),z(f,'style',c),z(f,'styleVar',c),$(c,((e,t)=>{$(e,((e,a)=>{effector.is.unit(e)?(f.seq.push({type:t,field:a,value:e}),Q(e)):f.staticSeq.push({type:t,field:a,value:e})}))})),f.classList.forEach((e=>{if(effector.is.unit(e.name)||effector.is.unit(e.enabled)){let t=effector.is.unit(e.name)?e.name:effector.createStore(e.name),a=effector.is.unit(e.enabled)?e.enabled:effector.createStore(e.enabled);f.seq.push({type:'classList',field:t,value:a}),Q(t),Q(a)}else effector.is.unit(e.name)||f.staticSeq.push({type:'classList',field:e.name,value:e.enabled})})),f.text.forEach((e=>{null!==e.value&&(effector.is.unit(e.value)?(f.seq.push({type:'dynamicText',value:e.value,childIndex:e.index}),Q(e.value)):f.seq.push({type:'staticText',value:String(e.value),childIndex:e.index}))})),f.handler.forEach((e=>{$(e.map,((t,a)=>{f.seq.push({type:'handler',for:a,handler:t,options:e.options,domConfig:e.domConfig})}))})),d&&m(d,f.staticSeq),f.seq.forEach((e=>{switch(e.type){case'visible':{let{onMount:t,onState:a}=_({mount:i,state:e.value,onMount:(e,t)=>({leaf:t,value:e,hydration:t.hydration}),onState:(e,t)=>({leaf:e,value:t,hydration:0})});t.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=E(r);if(e=t?t.nextSibling:q(r).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}r.value=e,r.visible=1}L(f,{parentBlockFragment:r,leaf:e,node:r.value,svgRoot:v.isSvgRoot?r.value:null}),t&&l.needToCallNode&&(l.needToCallNode=0,effector.launch({target:Se,params:{element:l.block.value,fns:f.node},page:e,defer:1,scope:e.root.scope})),effector.launch({target:s,params:e,defer:1,page:e,scope:e.root.scope})})),effector.merge([a,t]).watch((({leaf:e,value:t,hydration:a})=>{a||r(t,e.data.ops.visible)}));break}case'attr':case'data':case'style':case'styleVar':{let t=Ce[e.type],a=De.some((({type:t,field:a})=>e.type===t&&e.field===a)),l=_({mount:s,state:e.value,onMount:(e,t)=>({leaf:t,value:e}),onState:(e,t)=>({leaf:e,value:t})});a?effector.merge([l.onState,l.onMount]).watch((({leaf:a,value:l})=>{t(Te(a),e.field,l)})):j(f,{initCtx(a,l){let n=Te(l);return t(n,e.field,a),n},runOp(a,l){t(l,e.field,a)},hooks:l});break}case'classList':{let t=Ce.classList,a=effector.createStore({prev:'',curr:e.field.getState()}).on(e.field,(({curr:e},t)=>({prev:e,curr:t}))),l=_({mount:s,state:effector.combine({name:a,enabled:e.value}),onMount:(e,t)=>({leaf:t,value:e}),onState:(e,t)=>({leaf:e,value:t})});j(f,{initCtx(e,a){let l=Te(a);return t(l,e.name.curr,e.enabled),l},runOp(e,a){e.name.prev!==e.name.curr&&t(a,e.name.prev,0),t(a,e.name.curr,e.enabled)},hooks:l});break}case'dynamicText':j(f,{initCtx:(t,a)=>G(a,t,e.childIndex),runOp(e,t){I(t.value,e)},hooks:_({mount:s,state:e.value,onMount:(e,t)=>({leaf:t,value:String(e)}),onState:(e,t)=>({leaf:e,value:String(t)})})});break;case'staticText':s.watch((t=>{G(t,e.value,e.childIndex)}));break;case'handler':{let t=e.handler.graphite.meta.nativeTemplate||null;s.watch((a=>{let l=null;if(t){let e=0,n=a;for(;!e&&n;)n.template===t?(e=1,l=n):n=n.parent}else l=null;Te(a).addEventListener(e.for,(t=>{e.options.prevent&&t.preventDefault(),e.options.stop&&t.stopPropagation(),effector.launch({target:e.handler,params:t,page:l,scope:a.root.scope})}),e.domConfig)}));break}}})),i.watch((e=>{let t=e.data;if(!f.visible){let a=t.ops.visible,l=t.block;if(e.hydration){n(1,a);let e,t=E(l);if(e=t?t.nextSibling:q(l).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}l.value=e,l.visible=1}L(f,{parentBlockFragment:l,leaf:e,node:l.value,svgRoot:v.isSvgRoot?l.value:null}),effector.launch({target:s,params:e,defer:1,page:e,scope:e.root.scope}),e.hydration?t.needToCallNode&&(t.needToCallNode=0,effector.launch({target:Se,params:{element:t.block.value,fns:f.node},page:e,defer:1,scope:e.root.scope})):r(1,a)}}))},env:s});N(v)},e.handler=V,e.list=te,e.node=e=>{M(ye,'node');let t=ye.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=le,e.remap=ee,e.route=ae,e.spec=U,e.text=(e,...t)=>{Array.isArray(e)?U({text:ne(e,t)}):U({text:e})},e.tree=({source:e,key:t,child:a,fn:l})=>{let n=le((({store:e})=>{te({source:e,key:t,fn({store:e}){let t=e.map((e=>e[a]||[]));l({store:e,child(){n({store:t})}})}})}));n({store:e})},e.using=(e,t)=>{let a,l,n,r,o,i;if('function'==typeof t)a=t,n=W(),r=0;else{if(!t)throw Error('using() second argument is missing');a=t.fn,n=t.env?t.env:W(),r=t.hydrate,l=t.onComplete,o=t.onRoot,i=t.scope}P(e,'using() first argument is missing');let u={scope:i,env:n,activeSpawns:new Set,childSpawns:{},leafOps:{}},p=e.namespaceURI,d=e.tagName.toLowerCase(),f={type:'using',childTemplates:[],childCount:0,inParentIndex:-1},m=x({name:'using',draft:f,isSvgRoot:'svg'===d,namespace:'http://www.w3.org/2000/svg'===p?'svg':'foreignobject'===d?'foreignObject':'html',fn(e,{mount:t}){a(),t.watch(Oe.using)},env:n}),v={type:'using',child:[],value:e},h=s({onComplete:l}),g=O(m,{parentLeaf:ke||null,mountNode:e,svgRoot:m.isSvgRoot?e:ke?ke.svgRoot:null,leafData:{type:'using',draft:f,element:e,block:v},opGroup:c(h),domSubtree:c(h),hydration:r,root:u});if(o&&o({template:m,leaf:g}),h.onDrain&&!h.rafID){let e=h.onDrain;h.onDrain=null,e()}},e.val=(e,...t)=>t.every((e=>!effector.is.store(e)))?ne(e,t).join(''):effector.combine(t,(t=>ne(e,t).join(''))),e.variant=({source:e,cases:t,key:a})=>{let l;M(ye,'variant'),P(effector.is.unit(e),'variant({source}) should be unit'),l='function'==typeof a?a:null==a?e=>String(e):e=>String(e[a]);let n=0;for(let a in t)'__'!==a?ae({source:e,visible:e=>l(e)===a,fn:t[a]}):n=1;if(n){let a=Object.keys(t);ae({source:e,visible:e=>!a.includes(l(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='undefined'!=typeof globalThis?globalThis: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})(l(e),e)}function l(e){return e.group.activeChilds[e.priority]}function n(e,t){t.value.active=t.value.pending=e,'active'!==t.status&&a(t)}function r(e,n){if(n.value.active===e)return n.value.pending=e,void('pending'===n.status&&(a(n),l(n).first||t(n.group,n.priority)));'active'===n.status&&(n.status='pending',l(n).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})(n.group,n.priority),((e,t)=>{e.last?(t.cursor.prev=e.last,e.last.cursor.next=t,e.last=t):e.first=e.last=t})(l(n),n)),n.value.pending=e,n.group.queue.rafID||(n.group.queue.rafID=me(n.group.queue.execQueue))}function o(e){de('execQueue');let l,n,r=oe(),o=0;e:for(;e.props.first||e.tree.first||e.data.first;){if(oe()-r>=ie){o=1;break e}let i=!!e.props.first;for(i&&de('props');l=e.props.first;){for(;n=l.activeChilds.props.first;){if(oe()-r>=ie){o=1,fe('props');break e}n.runOp(n.value.pending),n.value.active=n.value.pending,a(n)}t(l,'props')}i&&fe('props');let s=!!e.tree.first;for(s&&de('tree');l=e.tree.first;){for(;n=l.activeChilds.tree.first;){if(oe()-r>=ie){o=1,fe('tree');break e}n.runOp(n.value.pending),n.value.active=n.value.pending,a(n)}t(l,'tree')}s&&fe('tree');let c=!!e.data.first;for(c&&de('data');l=e.data.first;){for(;n=l.activeChilds.data.first;){if(oe()-r>=ie){o=1,fe('data');break e}n.runOp(n.value.pending),n.value.active=n.value.pending,a(n)}t(l,'data')}c&&fe('data')}if(fe('execQueue'),o)e.rafID=me(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:l}){return{value:{active:e,pending:e},runOp:t,status:'active',priority:l,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 c(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:l}){let n=i({value:e,group:t,runOp(e){o.status='A',l(e)},priority:'data'}),o={status:'IA',value:n.value,ops:{init:i({value:0,group:t,runOp(e){o.status='A',a(o.value.active)},priority:'data'}),change:n,terminate:i({value:0,group:t,runOp(e){o.status='T'},priority:'data'})}};return r(1,o.ops.init),o}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)}}function d(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 f(e){switch(e=String(e)){case'__proto__':case'__defineGetter__':case'__defineSetter__':case'constructor':case'prototype':case'hasOwnProperty':case'toString':case'valueOf':case'setProperty':case'removeProperty':return'forbidden';default:return e.replace(/[^a-zA-Z0-9\-_]/g,'')}}function m(e,t){for(let a=0;a<t.length;a++){let{type:l,field:n,value:r}=t[a];he[l](e,n,r)}}function h(e){return''!==e&&0!==e&&'0'!==e&&(0==e||null==e)}function v(e,t,a){h(a)?e.style.removeProperty(`--${t}`):e.style.setProperty(`--${t}`,`${a}`)}function g(e,t,a){h(a)?delete e.style[t]:e.style[t]=`${a}`}function b(e,t,a){t&&t.trim().length>0&&(a?e.classList.add(t):(e.classList.remove(t),0===e.classList.length&&e.removeAttribute('class')))}function y(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 I(e,t){e.replaceData(0,(e.textContent||'').length,String(t))}function x({fn:e,state:t={},defer:a=0,name:l="",draft:n,isSvgRoot:r,namespace:o,env:i,isBlock:s=0}){let c=ke,u={id:++be,name:l,plain:[],watch:[],nameMap:{},pages:[],closure:[],childTemplates:[],handlers:ge,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.root.activeSpawns.has(a.page.fullID))return console.count('inactive page upward'),0;let l=[a.page.template],n=[a.page];{let e=a.page.parent;for(;e;)n.push(e),l.push(e.template),e=e.parent}return a.node.next.forEach((t=>{let r=t.meta.nativeTemplate;if(r)if(l.includes(r)){let o=n[l.indexOf(r)];effector.launch({target:t,params:e,defer:1,page:o,stack:a,scope:a.scope})}else console.error('context drift',{stack:a,node:t});else effector.launch({target:t,params:e,defer:1,page:a.page,stack:a,scope:a.scope})})),0}}),loader:effector.step.filter({fn(e,t,a){if(a.parent){let t=a.scope?a.scope.graphite.id:null;if(a.page){if(!a.page.root.activeSpawns.has(a.page.fullID))return console.count('inactive page loader'),0;if(a.page.template===u)return 1;if(a.page.root.childSpawns[a.page.fullID][u.id])a.page.root.childSpawns[a.page.fullID][u.id].forEach((l=>{(!t||l.root.scope&&t===l.root.scope.graphite.id)&&effector.launch({params:e,target:a.node,page:l,defer:1,scope:a.scope})}));else{let l=a.page.fullID,n='rec'===a.page.template.name;u.pages.forEach((r=>{if(!t||r.root.scope&&t===r.root.scope.graphite.id)if(r.fullID===l||r.fullID.startsWith(`${l}_`)){let t=1;if(n){let e=a.page.template.id,l=r.parent;for(;l&&l!==a.page;){if(l.template.id===e){t=0;break}l=l.parent}}t&&effector.launch({params:e,target:a.node,page:r,defer:1,scope:a.scope})}else l.startsWith(`${r.fullID}_`)&&effector.launch({params:e,target:a.node,page:a.page,defer:1,scope:a.scope})}))}}else u.pages.forEach((l=>{(!t||l.root.scope&&t===l.root.scope.graphite.id)&&effector.launch({params:e,target:a.node,page:l,defer:1,scope:a.scope})}));return 0}return 1}}),parent:c,node:null,api:null,trigger:{mount:effector.createEvent({named:'mount'})},draft:n,isSvgRoot:r,namespace:o,env:i,isBlock:s||!(!c||!c.isBlock)};c&&c.childTemplates.push(u);let p=effector.createNode({meta:{template:u}});return u.node=p,ke=u,a?u.deferredInit=()=>{let a=ke;ke=u,u.deferredInit=null;try{effector.withRegion(p,(()=>{let a=effector.restore(t);u.api=e(a,u.trigger),u.nameMap=a}))}finally{ke=a}}:effector.withRegion(p,(()=>{let a=effector.restore(t);u.api=e(a,u.trigger),u.nameMap=a})),ke=c,u}function w(e,t){let a;switch(a=t?t.getState(e):e.current,e.type){case'list':return[...a];case'shape':return{...a};default:return a}}function S(e,t,a){let l=t;for(;l&&!xe(l,e);)l=l.parent;return l?xe(l,e):a?(a.getState(e),a.reg[e.id]):e}function D(e,t,a){return S(e,t,a).current}function C(e,t){xe(t,e)||(t.reg[e.id]=S(e,t.parent,t.root.scope))}function T(e,t,a){t in a||(a[t]=[]),a[t].push(...e)}function O(e,{values:t={},parentLeaf:a,mountNode:l,svgRoot:n,leafData:r,opGroup:o,domSubtree:i,hydration:s,root:c}){function u(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,l=a.from;if(!a.fn&&!l)break;l&&(C(l,f),t=d[l.id].current),d[e.id].current=a.fn?a.fn(t):t;break}case'field':{let t=a.from;C(t,f),d[e.id].current[a.field]=d[t.id].current;break}case'closure':C(a.of,f)}}}function p(e,t,a){let l;t.stop=1;try{for(;t.i<e.length;)l=e[t.i],t.i++,l.fn(a[l.of.id]?a[l.of.id].current:D(l.of,f.parent,f.root.scope))}catch(e){console.error(e),t.stop=0}}let d={},f={draft:e.draft,svgRoot:n,data:r,parent:a,hydration:s,mountNode:l,root:c,id:++ye,fullID:'',reg:d,template:e};e.pages.push(f);let m=Ie;Ie=f,a&&T([f],e.id,c.childSpawns[a.fullID]),f.fullID=a?`${a.fullID}_${f.id}`:`${f.id}`,c.childSpawns[f.fullID]={},c.activeSpawns.add(f.fullID),c.leafOps[f.fullID]={group:o,domSubtree:i};for(let t=0;t<e.closure.length;t++){let a=e.closure[t],l=a,n=f.parent;e:for(;n;){if(xe(n,a)){l=xe(n,a);break e}n=n.parent}!n&&c.scope&&(c.scope.getState(a),l=c.scope.reg[a.id]),d[a.id]=l}for(let t=0;t<e.plain.length;t++){let a=e.plain[t],l={id:a.id,current:w(a,c.scope)};d[a.id]=l}for(let a in t){let l=e.nameMap[a].stateRef.id;d[l]={id:l,current:t[a]}}e.closure.forEach(u),e.plain.forEach(u);let h={i:0,stop:0};for(;!h.stop;)p(e.watch,h,d);if(a)for(let e in c.childSpawns[f.fullID])T(c.childSpawns[f.fullID][e],e,c.childSpawns[a.fullID]);if(we)we.steps.push({target:e.trigger.mount,params:f,defer:1,page:f,scope:c.scope});else{let t;we={parent:we,steps:[{target:e.trigger.mount,params:f,defer:1,page:f,scope:c.scope}]};do{for(;t=we.steps.shift();)we={parent:we,steps:[]},effector.launch(t)}while(we=we.parent)}return Ie=m,f}function q(e){let t=e.parent;for(;'element'!==t.type&&'using'!==t.type;)t=t.parent;return t?t.value:null}function E(e){if(!e.visible)return null;switch(e.type){case'text':case'element':return e;case'LF':case'route':case'rec':case'recItem':case'block':case'blockItem':for(let t=e.child.length-1;t>=0;t--){let a=E(e.child[t]);if(a)return a}return null;case'list':{let t=e.lastChild;if(!t)return null;for(;t;){let e=E(t);if(e)return e;t=t.left}return null}default:return null}}function R(e){switch(e.type){case'using':return null;case'LF':{let t=e.left;for(;t;){let e=E(t);if(e)return e;t=t.left}return R(e.parent)}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 l=E(e);if(l)return l}switch(t.type){case'element':case'using':return null}return R(t)}default:return null}}function A(e){let t=R(e);return t?t.value:null}function P(e,t){if(!e)throw Error(t)}function M(e,t){if(!e)throw Error(`${t}() called outside from using() closure`)}function N(e){if(!ke)return;let{draft:t}=e;if('listItem'!==t.type&&'rec'!==t.type)switch(ke.draft.type){case'element':case'using':case'route':case'list':case'rec':case'recItem':case'block':case'blockItem':t.inParentIndex=ke.draft.childCount,ke.draft.childCount+=1,ke.draft.childTemplates.push(e);break;default:console.warn(`unexpected currentTemplate type ${ke.draft.type}`)}}function L(e,{parentBlockFragment:t,leaf:a,node:l,svgRoot:n,values:r}){e.childTemplates.forEach((e=>{B({parentBlockFragment:t,leaf:a,node:l,svgRoot:n,values:r,actor:e})}))}function B({parentBlockFragment:e,leaf:t,node:a=t.mountNode,actor:l,svgRoot:n,values:r}){let o;P(Se.includes(e.type),`incorrect parent ${e.type}`);let{draft:s}=l,{queue:u}=t.root.leafOps[t.fullID].group,p=c(u),d=t.root.leafOps[t.fullID].domSubtree,f=d;switch(s.type){case'route':{let t={type:'route',parent:e,child:[],visible:0,index:s.inParentIndex};e.child[s.inParentIndex]=t,o={type:'route',block:t,ops:{},initialized:0,pendingInit:null};break}case'element':{let a;if(l.isBlock){let e,l,n=t;for(;n&&(!l||!e);){n.template.env&&(e=n.template.env);let{draft:t}=n;'element'===t.type&&('svg'===t.tag?l='svg':'foreignObject'===t.tag&&(l='html')),n=n.parent}l||(l='html'),e&&(a='svg'===l?e.document.createElementNS('http://www.w3.org/2000/svg',s.tag):e.document.createElement(s.tag),m(a,s.staticSeq))}else a=s.stencil.cloneNode();let n={type:'element',parent:e,child:[],value:a,visible:0,index:s.inParentIndex};e.child[s.inParentIndex]=n,o={type:'element',block:n,ops:{visible:i({value:0,priority:'tree',runOp(e){if(e){F(n);let e=o;e.needToCallNode&&(e.needToCallNode=0,effector.launch({target:De,params:{element:n.value,fns:s.node},page:h,scope:t.root.scope})),n.visible=1}else n.value.remove(),n.visible=0},group:d})},needToCallNode:s.node.length>0},f=c(u);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,records:[],pendingUpdate:null};break}case'using':case'listItem':break;case'rec':{let t={type:'rec',parent:e,child:[],visible:1,index:s.inParentIndex};e.child[s.inParentIndex]=t,o={type:'rec',block:t};break}case'recItem':{let t={type:'recItem',parent:e,child:[],visible:1,index:s.inParentIndex};e.child[s.inParentIndex]=t,o={type:'rec item',block:t};break}case'block':{let t={type:'block',parent:e,child:[],visible:1,index:s.inParentIndex};e.child[s.inParentIndex]=t,o={type:'block',block:t};break}case'blockItem':{let t={type:'blockItem',parent:e,child:[],visible:1,index:s.inParentIndex};e.child[s.inParentIndex]=t,o={type:'block item',block:t};break}default:console.warn(`unexpected draft type ${s.type}`)}let h=O(l,{values:r,parentLeaf:t,mountNode:a,svgRoot:n||t.svgRoot,leafData:o,opGroup:p,domSubtree:f,hydration:t.hydration,root:t.root})}function F(e){let t=A(e);t?t.after(e.value):q(e).prepend(e.value),e.visible=1}function _({mount:e,state:t,onMount:a,onState:l}){return{onMount:effector.sample({source:t,clock:e,fn:a,greedy:1}),onState:effector.sample({source:e,clock:t,fn:l,greedy:1})}}function $(e,t){for(let a in e)t(e[a],a)}function V(e,t){if(!ke)return;let a=ke.draft;P('element'===a.type,`"handler" extension can be used only with element nodes, got "${a.type}"`),void 0===t&&(t=e,e={});for(let e in t)P(effector.is.unit(t[e]),`handler for "${e}" should be event`);let{passive:l=0,capture:n=0,prevent:r=0,stop:o=0}=e;a.handler.push({options:{prevent:r,stop:o},domConfig:{passive:r?0:l,capture:n},map:t})}function U(e){M(ke,'spec');let t=ke.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,l=t.childCount;Array.isArray(a)?(t.text.push(...a.map(((e,t)=>({index:t+l,value:e})))),t.childCount+=a.length):(t.text.push({index:l,value:a}),t.childCount+=1)}if(e.style){let a={};for(let t in e.style)a[f(t)]=e.style[t];t.style.push(a)}if(e.classList&&((e,t)=>{Array.isArray(e)?e.forEach((e=>{let a='string'==typeof e?j(e):e.map((e=>j(e||''))),l='string'==typeof e?1:e.map((e=>null!==e));t({name:a,enabled:l})})):$(e,((e,a)=>{let l=j(a);t({name:l,enabled:e})}))})(e.classList,(e=>t.classList.push(e))),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.\u0254&&U(e.\u0254)}function j(e){return e.split(' ').map((e=>e.trim())).filter((e=>e.length>0))}function z(e,{initCtx:t,runOp:a,hooks:{onMount:l,onState:n}}){let o=e.opsAmount++;l.watch((({value:e,leaf:l})=>{let n=t(e,l),r=i({value:e,priority:'props',runOp(e){a(e,n)},group:l.root.leafOps[l.fullID].group});l.root.leafOps[l.fullID].group.ops[o]=r})),n.watch((({value:e,leaf:t})=>{r(e,t.root.leafOps[t.fullID].group.ops[o])}))}function G(e,t,a){e[t].forEach((e=>{$(e,((e,l)=>{switch(t){case'data':case'styleVar':a[t][l]=e;break;case'attr':a.attr['xlink:href'===l?'href':l]=e;break;case'style':l.startsWith('--')?a.styleVar[l.slice(2)]=e:a.style[l]=e}}))}))}function Q(e,t,a){let l=e.data.block,n={type:'text',parent:l,visible:0,index:a,value:null};if(l.child[a]=n,e.hydration){let a=R(n);if(a)switch(a.type){case'text':n.value=e.root.env.document.createTextNode(t),a.value.after(n.value);break;case'element':n.value=a.value.nextSibling,I(n.value,t)}else{let e=q(n);n.value=e.firstChild,I(n.value,t)}n.visible=1}else n.value=e.root.env.document.createTextNode(t),F(n);return n}function W(e){let t=e.stateRef,a=ke;a.plain.includes(t)||a.closure.includes(t)||a.closure.push(t)}function Z(){if('undefined'!=typeof document)return{document};throw Error('your environment has no document')}function H(e,t){let a=e.root.childSpawns[e.fullID];for(let e in a){let l=a[e];for(let e=0;e<l.length;e++)t(l[e])}}function J(e,t){let a=t=>{let l=t.data;if(e&&'list'===l.type&&l.pendingUpdate){let e=l.pendingUpdate;l.pendingUpdate=null,effector.launch({target:t.template.api.pendingUpdate,params:e,defer:1,page:t,scope:t.root.scope})}if(e&&'route'===l.type)if(l.pendingInit){let e=l.pendingInit.value;l.pendingInit=null,effector.launch({target:t.template.api.pendingInit,params:e,defer:1,page:t,scope:t.root.scope})}else if(!l.block.visible)return;switch(l.type){case'element':r(e,l.ops.visible);break;case'route':case'list':case'list item':H(t,a);break;default:console.log('unsupported type',l.type)}};H(t,a)}function K(e){e.root.activeSpawns.delete(e.fullID),H(e,Y)}function X(e){ee(e,e.root.childSpawns[e.parent.fullID][e.template.id]),ee(e,e.template.pages)}function Y(e){let{data:t,root:a}=e;switch(t.type){case'element':ee(e,a.childSpawns[e.parent.fullID][e.template.id]),function e(t){a.activeSpawns.delete(t.fullID);let l=a.childSpawns[t.fullID];delete a.childSpawns[t.fullID],delete a.leafOps[t.fullID],ee(t,t.template.pages);for(let t in l)l[t].forEach(e)}(e),r(0,t.ops.visible);break;case'list':{let a=t.records;for(let e=0;e<a.length;e++){let t=a[e];t.instance&&Y(t.instance),t.active=0}e.root.activeSpawns.delete(e.fullID),X(e);break}case'list item':{let a=t.block;ee(a,a.parent.child);let l=a.left,n=a.right;l&&(l.right=n,n||a.parent.lastChild!==a||(a.parent.lastChild=l)),n&&(n.left=l),l||n||a.parent.lastChild!==a||(a.parent.lastChild=null),a.left=null,a.right=null,K(e),X(e);break}case'route':K(e),X(e);break;case'block':case'block item':case'rec':case'rec item':K(e)}delete a.childSpawns[e.fullID],delete a.leafOps[e.fullID]}function ee(e,t){if(!t)return;let a=t.indexOf(e);-1!==a&&t.splice(a,1)}function te(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 l in t){let n=t[l];a[l]=e.map('function'==typeof n?e=>n(e):e=>e[n])}return a}return e.map((e=>e[t]))}function ae(e,t){M(ke,'list'),'function'==typeof t&&(effector.is.unit(e)?e={source:e,fn:t}:e.fn=t);let{fn:a,key:l,source:n,fields:r=[]}=e,o=void 0!==l?'function'==typeof l?l:e=>e[l]:(e,t)=>t,i={type:'list',key:effector.is.store(e)?{type:'index'}:{type:'key',key:e.key},childTemplates:[],childCount:0,inParentIndex:-1},{env:s,namespace:f}=ke;N(x({name:'list',draft:i,isSvgRoot:0,namespace:f,fn(e,{mount:t}){let l=x({name:'list item',state:{id:-1,store:null},draft:i,isSvgRoot:0,namespace:f,fn({id:e,store:t},{mount:l}){a({store:t,key:e,fields:te(t,r)});let n=effector.createEvent({named:'itemUpdater'});if(t.on(n,((e,t)=>t)),i.itemVisible){let{onMount:e,onState:t}=_({mount:l,state:i.itemVisible,onMount:(e,t)=>({visible:e,leaf:t}),onState:(e,t)=>({visible:t,leaf:e})});e.watch((({visible:e,leaf:t})=>{let a=t.data.block;a.visible=e,a.childInitialized=e,e&&L(i,{parentBlockFragment:a,leaf:t})})),t.watch((({visible:e,leaf:t})=>{let a=t.data.block;a.visible=e,a.childInitialized?J(e,t):e&&(a.childInitialized=1,L(i,{parentBlockFragment:a,leaf:t}))}))}else l.watch(qe.listItem);return{itemUpdater:n}},env:s}),m=effector.createStore([]),h=n.map((e=>e)),v=effector.sample({source:n,clock:t,fn:(e,t)=>({updates:e,leaf:t,hydration:t.hydration}),greedy:1}),g=effector.createEvent(),b=effector.sample({source:v,clock:[h,g],fn:({leaf:e},t)=>({updates:t,leaf:e,hydration:0}),greedy:1});return effector.sample({source:m,clock:[v,b],greedy:1,fn(e,{updates:t,leaf:a,hydration:r}){let s=a.data,f=a;for(;f;){if('route'===f.data.type&&!f.data.block.visible)return void(s.pendingUpdate=t);f=f.parent}let m=s.block;de('list update ['+n.shortName+']');let h=Array(t.length).fill(0),v=t.map(o),g=[];for(let a=0;a<e.length;a++){let l=e[a],n=v.indexOf(l.key);-1!==n?(g.push(l),h[n]=1,d(t[n],l.asyncValue)):(l.active=0,l.instance&&Y(l.instance),p(l.asyncValue))}for(let e=0;e<t.length;e++){if(h[e])continue;let n=t[e],o=v[e],s=c(a.root.leafOps[a.fullID].group.queue),p={type:'LF',parent:m,child:[],childInitialized:0,visible:0,left:null,right:null},d={type:'listItem',key:o,index:o,active:1,leafData:{type:'list item',block:p,listDraft:i},asyncValue:u({value:n,group:s,onChange(e){d.instance&&effector.launch({target:d.instance.template.api.itemUpdater,params:e,defer:1,page:d.instance,scope:d.instance.root.scope})},onInit(e){d.active&&(r||(d.instance=O(l,{values:{id:o,store:e},parentLeaf:a,mountNode:a.mountNode,svgRoot:a.svgRoot,leafData:d.leafData,opGroup:s,domSubtree:a.root.leafOps[a.fullID].domSubtree,hydration:r,root:a.root})))}})},f=g.length;g.push(d);let b=f>0?g[f-1].leafData:null;if(m.child.push(p),b){let e=b.block;p.left=e;let t=e.right;t?(t.left=p,p.right=t):m.lastChild=p,e.right=p}else m.lastChild=p;r&&(d.instance=O(l,{values:{id:o,store:n},parentLeaf:a,mountNode:a.mountNode,svgRoot:a.svgRoot,leafData:d.leafData,opGroup:s,domSubtree:a.root.leafOps[a.fullID].domSubtree,hydration:r,root:a.root}))}return fe('list update ['+n.shortName+']'),0===g.length&&(m.lastChild=null),s.records=g,g},target:m}),{pendingUpdate:g}},env:s}))}function le({source:e,visible:t,fn:a}){M(ke,'route');let{env:l,namespace:n}=ke,r=x({name:'route',isSvgRoot:0,namespace:n,env:l,draft:{type:'route',childTemplates:[],childCount:0,inParentIndex:-1},fn(r,{mount:o}){let i;if(effector.is.store(t))i=effector.combine({value:e,visible:t});else{let a=t;i=e.map((e=>({value:e,visible:a(e)})))}let s=x({name:'route item',isSvgRoot:0,namespace:n,env:l,draft:{type:'route',childTemplates:[],childCount:0,inParentIndex:-1},state:{store:null},fn({store:e},{mount:t}){let l=effector.createEvent({named:'itemUpdater'});e.on(l,((e,t)=>t)),a({store:e});let n=effector.sample({source:t,clock:i,fn:(e,{visible:t,value:a})=>({leaf:e,visible:t,value:a}),greedy:1});t.watch(qe.routeItem),n.watch((({leaf:e,visible:t,value:a})=>{if(e.data.block.visible=t,t&&effector.launch({target:l,params:a,defer:1,page:e,scope:e.root.scope}),t){let t=e.parent;for(;t;){if('route'===t.data.type&&!t.data.block.visible)return;t=t.parent}}J(t,e)}))}});N(s);let{onMount:c,onState:u}=_({mount:o,state:i,onMount:({visible:e,value:t},a)=>({leaf:a,visible:e,value:t}),onState:(e,{visible:t,value:a})=>({leaf:e,visible:t,value:a})}),p=effector.createEvent(),d=effector.sample({source:o,clock:p,greedy:1,fn:(e,t)=>({leaf:e,value:t,visible:1})});return effector.merge([c,u,d]).watch((({leaf:e,visible:t,value:a})=>{let l=e.data;if(l.block.visible=t,t||l.initialized||!l.pendingInit){if(t&&!l.initialized){let t=e.parent;for(;t;){if('route'===t.data.type&&!t.data.block.visible)return void(l.pendingInit={value:a});t=t.parent}}t&&!l.initialized&&(B({parentBlockFragment:l.block,leaf:e,actor:s,values:{store:a}}),l.initialized=1)}else l.pendingInit=null})),{pendingInit:p}}});N(r)}function ne(e){let t='function'==typeof e?e:e.fn,a=x({name:'rec',state:{store:null},isSvgRoot:0,namespace:null,env:null,draft:{type:'rec',childTemplates:[],childCount:0,inParentIndex:0},defer:1,isBlock:1,fn({store:e},{mount:a}){t({store:e,state:e});let l=effector.createEvent({named:'itemUpdater'});return e.on(l,((e,t)=>t)),a.watch(qe.rec),{itemUpdater:l}}});return({store:e,state:t=e})=>{M(ke,'(rec instance)');let{env:l,namespace:n}=ke;a.deferredInit&&a.deferredInit(),N(x({name:'rec item',isSvgRoot:0,namespace:n,env:l,draft:{type:'recItem',childTemplates:[],childCount:0,inParentIndex:-1},fn(e,{mount:l}){let{onMount:n,onState:r}=_({state:t,mount:l,onMount:(e,t)=>({state:e,leaf:t}),onState:(e,t)=>({state:t,leaf:e})});r.watch((({state:e,leaf:t})=>{H(t,(a=>{effector.launch({target:a.template.api.itemUpdater,params:e,defer:1,page:t,scope:t.root.scope})}))})),n.watch((({leaf:e,state:t})=>{B({parentBlockFragment:e.data.block,leaf:e,actor:a,values:{store:t}})}))}}))}}function re(e,t){if(0===t.length)return e;let a=[e[0]];for(let l=0;l<t.length;l++)a.push(t[l],e[l+1]);return a}let oe,ie=1e3;oe='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 se=new Map;const ce=[],ue=e=>{let t=se.get(e);t||(t={calls:0,time:0,label:e,childTime:0},se.set(e,t)),t.calls+=1,ce.push({bucket:t,pendingStart:oe()})},pe=e=>{let t=se.get(e),a=ce.pop().pendingStart,l=oe()-a;t.time+=l,ce.length>0&&(ce[ce.length-1].bucket.childTime+=l)};let de,fe;'undefined'!=typeof performance&&performance.mark?(de=e=>{performance.mark('\u2604\ufe0f '+e+' start'),ue(e)},fe=e=>{pe(e);try{performance.measure('\u2604\ufe0f '+e,'\u2604\ufe0f '+e+' start')}catch(e){}performance.clearMarks('\u2604\ufe0f '+e+' start'),performance.clearMeasures('\u2604\ufe0f '+e)}):(de=e=>{ue(e)},fe=e=>{pe(e)});let me='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0);const he={attr:k,data:y,style:g,styleVar:v,classList:b},ve=(e,t)=>e.includes(t);let ge={storeBase(e,t){e.plain.push(t)},storeOnMap(e,t,a,l){a.unshift(e.loader),a.push(e.upward),l&&(ve(e.plain,l)||(ve(e.closure,l)||e.closure.push(l),((e,t)=>{e.before||(e.before=[]),e.before.push(t)})(t,{type:'closure',of:l})))},storeMap(e,t,a){ve(e.plain,t)||ve(a.seq,e.loader)||a.seq.unshift(e.loader)},storeWatch:(e,t,a)=>(e.watch.push({of:t,fn:a}),1),eventPrepend(e,t){t.seq.push(e.upward)},combineBase(e,t,a){e.plain.push(t,a)},combineField(e,t,a){ve(e.plain,t)||a.seq.unshift(e.loader)},splitBase(e,t){e.plain.push(t)},splitMatchStore(e,t,a){ve(e.plain,t)||a.seq.unshift(e.loader)},sampleSource(e,t,a,l){t.current?ve(e.plain,a)||ve(e.closure,a)||e.closure.push(a):e.plain.push(a),e.plain.push(t),ve(e.plain,l)||e.plain.push(l)},sampleTarget(e,t){t.seq.push(e.loader)},sampleSourceLoader:e=>e.loader,sampleSourceUpward:(e,t)=>t&&e.upward},be=0,ye=0,ke=null,Ie=null;const xe=(e,t)=>e.reg[t.id];let we=null;const Se=['LF','using','element','recItem','rec','block','blockItem','route'];let De=effector.createEvent({named:'onMount'});De.watch((({fns:e,element:t})=>{e.forEach((e=>{e(t)}))}));const Ce=[{type:'attr',field:'value'},{type:'attr',field:'checked'},{type:'attr',field:'min'},{type:'attr',field:'max'}],Te={attr:k,data:y,style:g,styleVar:v,classList:b},Oe=e=>e.data.block.value;let qe={using(e){let t=e.data;L(t.draft,{parentBlockFragment:t.block,leaf:e})},routeItem(e){let t=e.draft,a=e.data;a.block.visible=1,L(t,{parentBlockFragment:a.block,leaf:e})},block(e){L(e.draft,{parentBlockFragment:e.data.block,leaf:e})},blockItem(e){B({parentBlockFragment:e.data.block,leaf:e,actor:e.draft.itemOf})},rec(e){L(e.draft,{parentBlockFragment:e.data.block,leaf:e})},listItem(e){let t=e.data,a=t.block;a.visible=1,a.childInitialized=1,L(t.listDraft,{parentBlockFragment:a,leaf:e})}};e.block=({fn:e,env:t,namespace:a="html"})=>{let l=x({name:'block',isSvgRoot:0,namespace:a,env:t,draft:{type:'block',childTemplates:[],childCount:0,inParentIndex:0},isBlock:1,fn({},{mount:t}){e(),t.watch(qe.block)}});return()=>{M(ke,'(block instance)');let e={type:'blockItem',childTemplates:[],childCount:0,inParentIndex:-1,itemOf:l},{env:t,namespace:a}=ke;N(x({name:'block item',isSvgRoot:0,namespace:a,env:t,draft:e,fn(e,{mount:t}){t.watch(qe.blockItem)}}))}},e.h=(e,t)=>{let a,l=0,o=0;'function'==typeof t?(l=1,a=t):t&&(o=1,t.fn&&(l=1,a=t.fn),t.\u0254&&('function'==typeof t.\u0254?(l=1,a=t.\u0254):'function'==typeof t.\u0254.fn&&(l=1,a=t.\u0254.fn))),M(ke,'h');let i,s=ke.env,c=ke.namespace,u=c,p='html';u=p='svg'===c?'svg':'html','svg'===e&&(p='svg',u='svg'),ke.isBlock||(i='svg'===p?s.document.createElementNS('http://www.w3.org/2000/svg',e):s.document.createElement(e));let d=i,f={type:'element',tag:e,attr:[],data:[],text:[],style:[],styleVar:[],classList:[],handler:[],stencil:d,seq:[],staticSeq:[],childTemplates:[],childCount:0,inParentIndex:-1,opsAmount:1,node:[]};'foreignObject'===c?(f.attr.push({xmlns:'http://www.w3.org/1999/xhtml'}),u='html'):'svg'===e?(f.attr.push({xmlns:'http://www.w3.org/2000/svg'}),u='svg'):'foreignObject'===e&&(u='foreignObject');let h=x({name:'element',draft:f,isSvgRoot:'svg'===e,namespace:u,fn(e,{mount:i}){let s=effector.createEvent({named:'domElementCreated'});l&&a(),o&&U(t),effector.is.unit(f.visible)&&(f.seq.push({type:'visible',value:f.visible}),W(f.visible));let c={attr:{},data:{},style:{},styleVar:{}};G(f,'attr',c),G(f,'data',c),G(f,'style',c),G(f,'styleVar',c),$(c,((e,t)=>{$(e,((e,a)=>{effector.is.unit(e)?(f.seq.push({type:t,field:a,value:e}),W(e)):f.staticSeq.push({type:t,field:a,value:e})}))})),f.classList.forEach((e=>{if(effector.is.unit(e.name)||effector.is.unit(e.enabled)){let t=effector.is.unit(e.name)?e.name:effector.createStore(e.name),a=effector.is.unit(e.enabled)?e.enabled:effector.createStore(e.enabled);f.seq.push({type:'classList',field:t,value:a}),W(t),W(a)}else effector.is.unit(e.name)||e.name.map((t=>f.staticSeq.push({type:'classList',field:t,value:e.enabled})))})),f.text.forEach((e=>{null!==e.value&&(effector.is.unit(e.value)?(f.seq.push({type:'dynamicText',value:e.value,childIndex:e.index}),W(e.value)):f.seq.push({type:'staticText',value:String(e.value),childIndex:e.index}))})),f.handler.forEach((e=>{$(e.map,((t,a)=>{f.seq.push({type:'handler',for:a,handler:t,options:e.options,domConfig:e.domConfig})}))})),d&&m(d,f.staticSeq),f.seq.forEach((e=>{switch(e.type){case'visible':{let{onMount:t,onState:a}=_({mount:i,state:e.value,onMount:(e,t)=>({leaf:t,value:e,hydration:t.hydration}),onState:(e,t)=>({leaf:e,value:t,hydration:0})});t.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=A(r);if(e=t?t.nextSibling:q(r).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}r.value=e,r.visible=1}L(f,{parentBlockFragment:r,leaf:e,node:r.value,svgRoot:h.isSvgRoot?r.value:null}),t&&l.needToCallNode&&(l.needToCallNode=0,effector.launch({target:De,params:{element:l.block.value,fns:f.node},page:e,defer:1,scope:e.root.scope})),effector.launch({target:s,params:e,defer:1,page:e,scope:e.root.scope})})),effector.merge([a,t]).watch((({leaf:e,value:t,hydration:a})=>{a||r(t,e.data.ops.visible)}));break}case'attr':case'data':case'style':case'styleVar':{let t=Te[e.type],a=Ce.some((({type:t,field:a})=>e.type===t&&e.field===a)),l=_({mount:s,state:e.value,onMount:(e,t)=>({leaf:t,value:e}),onState:(e,t)=>({leaf:e,value:t})});a?effector.merge([l.onState,l.onMount]).watch((({leaf:a,value:l})=>{t(Oe(a),e.field,l)})):z(f,{initCtx(a,l){let n=Oe(l);return t(n,e.field,a),n},runOp(a,l){t(l,e.field,a)},hooks:l});break}case'classList':{var t;let a=Te.classList,l=effector.createStore({prev:[],curr:null!==(t=e.field.getState())&&void 0!==t?t:[]}).on(e.field,(({curr:e},t)=>({prev:e,curr:t}))),n=_({mount:s,state:effector.combine({name:l,enabled:e.value}),onMount:(e,t)=>({leaf:t,value:e}),onState:(e,t)=>({leaf:e,value:t})});z(f,{initCtx(e,t){let l=Oe(t);return e.name.curr.forEach((t=>{a(l,t,e.enabled)})),l},runOp(e,t){e.name.prev.filter((t=>!e.name.curr.includes(t))).forEach((e=>{a(t,e,0)})),e.name.curr.forEach((l=>{a(t,l,e.enabled)}))},hooks:n});break}case'dynamicText':z(f,{initCtx:(t,a)=>Q(a,t,e.childIndex),runOp(e,t){I(t.value,e)},hooks:_({mount:s,state:e.value,onMount:(e,t)=>({leaf:t,value:String(e)}),onState:(e,t)=>({leaf:e,value:String(t)})})});break;case'staticText':s.watch((t=>{Q(t,e.value,e.childIndex)}));break;case'handler':{let t=e.handler.graphite.meta.nativeTemplate||null;s.watch((a=>{let l=null;if(t){let e=0,n=a;for(;!e&&n;)n.template===t?(e=1,l=n):n=n.parent}else l=null;Oe(a).addEventListener(e.for,(t=>{e.options.prevent&&t.preventDefault(),e.options.stop&&t.stopPropagation(),effector.launch({target:e.handler,params:t,page:l,scope:a.root.scope})}),e.domConfig)}));break}}})),i.watch((e=>{let t=e.data;if(!f.visible){let a=t.ops.visible,l=t.block;if(e.hydration){n(1,a);let e,t=A(l);if(e=t?t.nextSibling:q(l).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}l.value=e,l.visible=1}L(f,{parentBlockFragment:l,leaf:e,node:l.value,svgRoot:h.isSvgRoot?l.value:null}),effector.launch({target:s,params:e,defer:1,page:e,scope:e.root.scope}),e.hydration?t.needToCallNode&&(t.needToCallNode=0,effector.launch({target:De,params:{element:t.block.value,fns:f.node},page:e,defer:1,scope:e.root.scope})):r(1,a)}}))},env:s});N(h)},e.handler=V,e.list=ae,e.node=e=>{M(ke,'node');let t=ke.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=ne,e.remap=te,e.route=le,e.spec=U,e.text=(e,...t)=>{Array.isArray(e)?U({text:re(e,t)}):U({text:e})},e.tree=({source:e,key:t,child:a,fn:l})=>{let n=ne((({store:e})=>{ae({source:e,key:t,fn({store:e}){let t=e.map((e=>e[a]||[]));l({store:e,child(){n({store:t})}})}})}));n({store:e})},e.using=(e,t)=>{let a,l,n,r,o,i;if('function'==typeof t)a=t,n=Z(),r=0;else{if(!t)throw Error('using() second argument is missing');a=t.fn,n=t.env?t.env:Z(),r=t.hydrate,l=t.onComplete,o=t.onRoot,i=t.scope}P(e,'using() first argument is missing');let u={scope:i,env:n,activeSpawns:new Set,childSpawns:{},leafOps:{}},p=e.namespaceURI,d=e.tagName.toLowerCase(),f={type:'using',childTemplates:[],childCount:0,inParentIndex:-1},m=x({name:'using',draft:f,isSvgRoot:'svg'===d,namespace:'http://www.w3.org/2000/svg'===p?'svg':'foreignobject'===d?'foreignObject':'html',fn(e,{mount:t}){a(),t.watch(qe.using)},env:n}),h={type:'using',child:[],value:e},v=s({onComplete:l}),g=O(m,{parentLeaf:Ie||null,mountNode:e,svgRoot:m.isSvgRoot?e:Ie?Ie.svgRoot:null,leafData:{type:'using',draft:f,element:e,block:h},opGroup:c(v),domSubtree:c(v),hydration:r,root:u});if(o&&o({template:m,leaf:g}),v.onDrain&&!v.rafID){let e=v.onDrain;v.onDrain=null,e()}},e.val=(e,...t)=>t.every((e=>!effector.is.store(e)))?re(e,t).join(''):effector.combine(t,(t=>re(e,t).join(''))),e.variant=({source:e,cases:t,key:a})=>{let l;M(ke,'variant'),P(effector.is.unit(e),'variant({source}) should be unit'),l='function'==typeof a?a:null==a?e=>String(e):e=>String(e[a]);let n=0;for(let a in t)'__'!==a?le({source:e,visible:e=>l(e)===a,fn:t[a]}):n=1;if(n){let a=Object.keys(t);le({source:e,visible:e=>!a.includes(l(e)),fn:t.__})}},Object.defineProperty(e,'__esModule',{value:1})}));
//# sourceMappingURL=forest.umd.js.map
{
"name": "forest",
"version": "0.21.1",
"version": "0.21.2",
"description": "UI engine for web",

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

"exports": {
"./package.json": "./package.json",
".": {
"types": "./index.d.ts",
"import": "./forest.mjs",

@@ -14,4 +16,9 @@ "require": "./forest.cjs.js",

},
"./forest.mjs": "./forest.mjs",
"./forest.mjs": {
"types": "./forest.mjs.d.ts",
"import": "./forest.mjs",
"default": "./forest.mjs"
},
"./server": {
"types": "./server.d.ts",
"import": "./server.mjs",

@@ -21,3 +28,7 @@ "require": "./server.js",

},
"./forest.umd": "./forest.umd.js"
"./forest.umd": {
"types": "./forest.umd.d.ts",
"require": "./forest.umd.js",
"default": "./forest.umd.js"
}
},

@@ -29,3 +40,3 @@ "umd:main": "forest.umd.js",

"peerDependencies": {
"effector": "^22.2.0"
"effector": "^22.3.0"
},

@@ -32,0 +43,0 @@ "keywords": [

@@ -293,6 +293,6 @@ # forest

key: string
cases: {[caseName: string]: ({store: Store<T>}) => void
}
}):
void
cases: {
[caseName: string]: ({store: Store<T>}) => void
}
}): void
```

@@ -432,3 +432,3 @@

```ts
```typescript
spec({

@@ -450,2 +450,6 @@ classList: {

spec({ classList: { classList: ['class-name', $stringStore] } })
```typescript
spec({
classList: ['class-name', $stringStore],
})
```

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