effector-dom
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -1,2 +0,2 @@ | ||
function e(e,t){const n=U(e);for(let e=0;e<t.length;e++){const s=U(t[e]);s.family.type='crosslink';const l=B(s),i=Z(n);l.includes(n)||l.push(n),i.includes(s)||i.push(s)}}function t(e,t){n(e,t),s(t,e)}function n(e,t){e&&e!==t&&(e.locality.sibling.right.ref=t)}function s(e,t){e&&e!==t&&(e.locality.sibling.left.ref=t)}function l(){const e={stack:null},t=G.get(),n=effector.createNode({node:[J,K],parent:[t&&t.signal].filter(Boolean),meta:{unit:'signal'},scope:e});return e.self=n,n}function i(e){switch(e=String(e)){case'__proto__':case'__defineGetter__':case'__defineSetter__':case'constructor':case'prototype':case'hasOwnProperty':case'toString':case'valueOf':return'blacklisted';default:return e.replace(Q,'')}}function r(e){return String(e).replace(ee,'')}function o({node:e,append:t,reverse:n=0}){if(0===t.length)return;const s=le.createDocumentFragment();if(n){for(let e=t.length-1;e>=0;e--)s.appendChild(t[e]);e.prepend(s)}else{for(let e=0;e<t.length;e++)s.appendChild(t[e]);e.appendChild(s)}}function a(e,t){t.parent=e,t.signal.seq.push(ie),t.signal.scope.stack=t,e.child.push(t)}function c(e,t){return effector.createNode({node:[re],parent:e,meta:{op:'watch'},scope:{fn:t},family:{type:'crosslink',owners:[e]}})}function f(){de=0,ae('batchRAF'),he(),ce('batchRAF')}function h(e,t,n){const s=(e=>'high'===we.get(e)?ve:ke)(e);let l=s.get(e);if(l||(l=[],s.set(e,l)),t)for(let e=0;e<n.length;e++)l.push(n[e]);else l.push(n);be()}function u(t,n,s=0,l="low"){const i=++xe,r=effector.createEvent(),o=effector.is.store(a=t)?a.updates:a;var a;const c={type:'crosslink',owners:[o,r]};return effector.createNode({node:[Ae],parent:[o],scope:{taskID:i,flat:s},family:c}),e(t,[r]),ye.set(i,effector.createNode({node:[Oe],child:[effector.createNode({node:[Re,_e,Ce],scope:{taskID:i},family:c}),effector.createNode({node:[Se,_e],child:[r],family:c})],scope:{fn:n},family:c})),we.set(i,l),r}function p({trigger:e=effector.createEvent(),fn:t,priority:n="low",timeout:s=1/0,batchWindow:l=0,retries:i=1/0,mark:r=e.shortName}){const o=u(e.map(e=>[{inserted:fe(),retry:0,value:e}]),(e,n)=>{let o,a=0;const c=[],f=[];for(ae(r),o=0;o<e.length;o++){const i=e[o],r=fe();if(i.inserted+l>r){f.push(i);continue}if(i.inserted+s<r)continue;if(r-n>=oe){a=1;break}const h=t(i.value);void 0!==h&&c.push(h)}if(a)for(let t=o;t<e.length;t++){const n=e[t];n.retry+=1,n.retry>=i||f.push(n)}return ce(r),{done:c,fail:f}},1,n);return{trigger:e,processed:o,connect:t=>{effector.createNode({node:[],parent:t,child:e,family:{type:'crosslink',owners:[t,e]}})}}}function d({trigger:e=effector.createEvent(),fn:t,priority:n="low",timeout:s=1/0,batchWindow:l=0,retries:i=1/0,mark:r=e.shortName,flatten:o}){const a=u(e.map(e=>{const t=[],n=fe();for(let s=0;s<e.length;s++){const l=o(e[s]);for(let e=0;e<l.length;e++)t.push({inserted:n,retry:0,value:l[e]})}return t}),(e,n)=>{let o,a=0;const c=[],f=[];for(ae(r),o=0;o<e.length;o++){const i=e[o],r=fe();if(i.inserted+l>r){f.push(i);continue}if(i.inserted+s<r)continue;if(r-n>=oe){a=1;break}const h=t(i.value);void 0!==h&&c.push(h)}if(a)for(let t=o;t<e.length;t++){const n=e[t];n.retry+=1,n.retry>=i||f.push(n)}return ce(r),{done:c,fail:f}},1,n);return{trigger:e,processed:a,connect:t=>{effector.createNode({node:[Ie],parent:t,child:e,family:{type:'crosslink',owners:[t,e]}})}}}function g(e,t,n){c(e,t.watch(n))}function m(e,t,n){effector.createNode({node:[$e],parent:t,child:[Pe],family:{type:'crosslink',owners:e},scope:{handler:n},meta:{op:'debounceRaf'}}),effector.is.store(t)&&effector.launch(Pe,{data:t.getState(),handler:n},1)}function b(e,t,n,s){effector.is.unit(n)?(e?g:m)(t,n,s):s(n)}function y(e){return''!==e&&0!==e&&(0==e||null==e)}function v(e,t,n){y(n)?delete e[t]:e[t]=`${n}`}function k(e,t=e.child.length-1){for(let n=t;n>=0;n--){const t=e.child[n];switch(t.node.type){case'element':case'using':if(!t.visible)continue;return t}const s=k(t);if(s)return s}return null}function w(e,t,n,s){if(n.visible=s,s){if(!t.contains(e)){const s=(e=>{if(!e.parent)return null;switch(e.parent.node.type){case'element':case'using':{const t=k(e.parent,e.parent.child.indexOf(e)-1);if(t)return t;break}case'list':case'listItem':{let t=e,n=e.parent;for(;n;){const e=k(n,n.child.indexOf(t)-1);if(e)return e;t=n,n=n.parent}break}}return null})(n);s&&t.contains(s.targetElement)?s.targetElement.after(e):t.appendChild(e)}}else e.remove()}function x(e,t,n){if(y(n)){switch(t){case'value':delete e.value;break;case'checked':delete e.checked;break;case'spellcheck':if(0==n)return void e.setAttribute('spellcheck','false')}e.removeAttribute(t)}else{switch(t){case'value':e.value=`${n}`;break;case'checked':e.checked=`${n}`}e.setAttribute(t,`${n}`)}}function N(e,t,n,s,l){const i=e.createSVGTransform();b(0,t,s,l.bind(null,i)),n.appendItem(i)}function E(e,t){const n=le.createTextNode(`${t}`),s=e.firstChild;s?s.replaceWith(n):e.appendChild(n)}function S(e){e.focus()}function R(e){e.blur()}function _(e,t){return e.bind(null,t)}function C(t,n){const s=G.get();if(Array.isArray(n)){const l=[];for(let e=0;e<n.length;e++)l[e]=t.map(_(A,n[e]));return s&&e(s.signal,l),l}if('object'==typeof n&&null!==n){const l=[],i={};for(const e in n)i[e]=t.map(_(A,n[e])),l.push(i[e]);return s&&e(s.signal,l),i}const l=t.map(_(A,n));return s&&e(s.signal,l),l}function A(e,t){return t[e]}function O(t,n){let s,i,r=0;effector.is.store(t)?(i=ze,s=t):(i=_(Le,t.key),s=t.source,r=!!t.reverse);const o=G.get(),f=l(),h={parent:o,signal:f,namespace:o.namespace,targetElement:o.targetElement,svgRoot:o.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'list',pure:0,reverse:r,key:effector.is.store(t)?{type:'index'}:{type:'key',key:t.key},store:s,cb:n},mountStatus:'initial',visible:1};a(o,h),G.replace(h);const u={parentNode:o.targetElement,cb:n,shortName:s.shortName,reverse:r,parentStack:h,getID:i},p=effector.createStore(I(u,[],s.getState()));e(f,[p]),c(f,_(We,p)),effector.sample({source:p,clock:s,fn:_(I,u),target:p}),G.replace(o)}function I(i,r,o){ae('list update ['+i.shortName+']');const c=Array(o.length).fill(0),f=o.map(i.getID),h=[],u=[],p=[];for(let e=0;e<r.length;e++){const t=r[e],n=t.node,s=f.indexOf(n.key);-1!==s?(u.push(t),c[s]=1,n.store.getState()!==o[s]&&effector.launch(n.store,o[s],1)):p.push(t)}if(p.length>0){for(let e=0;e<p.length;e++){const l=p[e],{node:i,locality:r}=l;i.active=0,i.store=null,t(r.sibling.left.ref,r.sibling.right.ref),n(l,null),s(l,null)}effector.launch(qe,p,1)}let d=u.length>0?u[u.length-1]:null;for(let n=0;n<o.length;n++){if(c[n])continue;const s=o[n],r=effector.createStore(s),f=l();e(f,[r]);const p=i.getID(s,n),g={parent:i.parentStack,signal:f,namespace:i.parentStack.namespace,targetElement:i.parentStack.targetElement,svgRoot:i.parentStack.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'listItem',pure:0,key:p,index:p,store:r,signal:f,active:1,nodes:[]},mountStatus:'initial',visible:1};t(d,g),d=g,a(i.parentStack,g),h.push(g),u.push(g)}return h.length>0&&effector.launch(Me,{context:i,list:h},1),ce('list update ['+i.shortName+']'),u}function $(t){const n=G.get();return n&&e(n.signal,[t]),t}function P(){const e=G.get();if('element'!==e.node.type&&'using'!==e.node.type)throw Error(`this extension can be used only with element nodes, got "${e.node.type}"`)}function V(e){const t=G.get();t.targetElement.__STATIC__||e(t.targetElement)}function D(e){e.attr&&T(e.attr),e.data&&j(e.data),e.transform&&F(e.transform),'text'in e&&M(e.text),'visible'in e&&z(e.visible),(e.style||e.styleVar)&&L({prop:e.style,val:e.styleVar}),e.focus&&W(e.focus),e.handler&&q(e.handler)}function T(e){P(),G.getElementNode().attr.push(e)}function j(e){P(),G.getElementNode().data.push(e)}function F(e){P(),G.getElementNode().transform.push(e)}function M(e){P(),G.getElementNode().text.push(e)}function z(e){P(),G.getElementNode().visible.push(e)}function L({prop:e,val:t}){P(),e&&G.getElementNode().styleProp.push(e),t&&G.getElementNode().styleVar.push(t)}function q(e,t){P(),void 0===t&&(t=e,e={});const{passive:n=1,capture:s=0}=e;G.getElementNode().handler.push({options:{passive:n,capture:s},map:t})}function W({focus:e,blur:t}){P();const n=G.getElementNode();e&&n.focus.push(e),t&&n.blur.push(t)}Object.defineProperty(exports,'__esModule',{value:1});var effector=require('effector');const X=[];let Y;const G={get:()=>Y,replace(e){Y=e},getElementNode:()=>Y.node},U=e=>e.graphite||e,B=e=>e.family.owners,Z=e=>e.family.links,H=effector.createNode({node:[effector.step.run({fn(e){effector.clearNode(e)}})]}),J=effector.step.compute({fn(e,l){l.self.next.push(H);const{stack:i}=l,{parent:r}=i,{left:o,right:a}=i.locality.sibling;r&&(r.locality.child.last.ref===i&&(r.locality.child.last.ref=o.ref),r.locality.child.first.ref===i&&(r.locality.child.first.ref=a.ref)),o.ref&&o.ref.locality.sibling.right.ref===i&&a.ref&&a.ref.locality.sibling.left.ref===i?t(o.ref,a.ref):o.ref&&o.ref.locality.sibling.right.ref===i?n(o.ref,null):a.ref&&a.ref.locality.sibling.left.ref===i&&s(a.ref,null)}}),K=effector.step.compute({fn:(e,{self:t})=>t}),Q=/[^a-zA-Z0-9\-]/g,ee=/[\\<>"]/g;class te{constructor(){this.properties=Object.create(null)}setProperty(e,t){this.properties[i(e)]=r(t)}removeProperty(e){delete this.properties[i(e)]}}class ne{constructor(){this.items=[]}appendItem(e){this.items.push(e)}}class se{constructor(){this.value=''}setTranslate(e,t){this.value=`translate(${e} ${t})`}setScale(e,t){this.value=`scale(${e} ${t})`}setRotate(e,t,n){this.value=0!==t||0!==n?`rotate(${e} ${t} ${n})`:`rotate(${e})`}setSkewX(e){this.value=`skewX(${e})`}setSkewY(e){this.value=`skewY(${e})`}}(new class{constructor(){this.child={first:null,last:null},this.sibling={left:null,right:null},this.parent=null,this.tagName='',this.namespaceURI='http://www.w3.org/1999/xhtml',this.dataset=Object.create(null),this.style=new te,this.firstChild=null,this.transform={baseVal:new ne},this.isFragment=1,this.attributes=Object.create(null),this.textContent=null,this.__STATIC__=1}appendChild(e){if(e.parent&&e.remove(),e.isFragment&&null===e.textContent){let t,n=e.firstChild;for(;n;)t=n.sibling.right,this.appendChild(n),n=t}else this.child.last?(this.child.last.sibling.right=e,e.sibling.left=this.child.last):(this.child.first=e,this.firstChild=e),this.child.last=e,e.parent=this}prepend(e){e.parent&&e.remove(),this.child.last?(this.child.first.sibling.left=e,e.sibling.right=this.child.first):(this.child.first=e,this.child.last=e),this.child.first=e,this.firstChild=e,e.parent=this}contains(e){let t=e;for(;t;){if(t===this)return 1;t=t.parent}return 0}remove(){if(!this.parent)return;const{parent:e}=this;e.child.first===this&&e.child.last===this?(e.firstChild=null,e.child.first=null,e.child.last=null):e.child.first===this?(e.child.first=this.sibling.right,e.firstChild=this.sibling.right,this.sibling.right.sibling.left=null):e.child.last===this?(e.child.last=this.sibling.left,this.sibling.left.sibling.right=null):(this.sibling.right.sibling.left=this.sibling.left,this.sibling.left.sibling.right=this.sibling.right),this.sibling.left=null,this.sibling.right=null,this.parent=null}addEventListener(e,t,n){}removeEventListener(e,t,n){}setAttribute(e,t){this.attributes[i(e)]=r(t)}removeAttribute(e){delete this.attributes[i(e)]}replaceWith(e){if(!this.parent)return;const{parent:t}=this;e.parent&&e.remove(),t.child.first===this&&t.child.last===this?(t.firstChild=e,t.child.first=e,t.child.last=e):t.child.first===this?(t.child.first=e,t.firstChild=e,this.sibling.right.sibling.left=e):t.child.last===this?(t.child.last=e,this.sibling.left.sibling.right=e):(this.sibling.right.sibling.left=e,this.sibling.left.sibling.right=e),e.sibling.left=this.sibling.left,e.sibling.right=this.sibling.right,e.parent=t,this.sibling.left=null,this.sibling.right=null,this.parent=null}focus(){}blur(){}createSVGTransform(){return new se}}).isBody=1;let le='undefined'!=typeof document?document:null;const ie=effector.step.compute({fn(e,t){if(!t.stack)return e;const{stack:n}=t;t.stack=null;const s=n.parent.child.indexOf(n);return-1!==s&&n.parent.child.splice(s,1),n.parent=null,e}}),re=effector.step.run({fn(e,{fn:t}){t(e)}}),oe=10;let ae,ce,fe;ae=()=>{},ce=()=>{},fe='undefined'!=typeof performance&&performance.now?()=>performance.now():'undefined'!=typeof process&&process.hrtime?()=>{const e=process.hrtime();return(1e9*e[0]+e[1])/1e6}:()=>Date.now();const he=effector.createEvent();let ue,pe=0,de=0;const ge='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0),me='undefined'!=typeof cancelAnimationFrame?cancelAnimationFrame:clearTimeout,be=()=>{de||(de=1,ue=ge(f))},ye=new Map,ve=new Map,ke=new Map,we=new Map;let xe=0,Ne=0;const Ee=effector.createNode({node:[effector.step.run({fn:()=>{}}),effector.step.filter({fn:()=>0===ve.size&&0===ke.size?0:fe()-Ne>=oe?0:(me(ue),pe=1,de=0,1)})],child:[he]});he.watch(()=>{if(de)return;if(0===ve.size&&0===ke.size)return void(pe=0);let e=0;pe||(Ne=fe()),pe=0,ae('plan');for(const[t,n]of ve){if(fe()-Ne>=oe){be(),e=1;break}ve.delete(t);const s=ye.get(t);effector.launch(s,n,1)}if(!e)for(const[t,n]of ke){if(fe()-Ne>=oe){be(),e=1;break}ke.delete(t);const s=ye.get(t);effector.launch(s,n,1)}effector.launch(Ee,null,1),ce('plan')});const Se=effector.step.compute({fn:({done:e})=>e}),Re=effector.step.compute({fn:({fail:e})=>e}),_e=effector.step.filter({fn:e=>e.length>0}),Ce=effector.step.compute({fn(e,{taskID:t}){h(t,1,e)}}),Ae=effector.step.compute({fn(e,{taskID:t,flat:n}){h(t,n,e)}}),Oe=effector.step.run({fn:(e,{fn:t})=>t(e,Ne)}),Ie=effector.step.compute({fn:e=>[e]}),$e=effector.step.run({fn:(e,{handler:t})=>({data:e,handler:t})}),{trigger:Pe}=p({priority:'high',mark:'domOperation',fn({handler:e,data:t}){e(t)}}),Ve=(e,{map:t,options:n})=>{for(const s in t)e.removeEventListener(s,t[s],n)},De=(e,t,n)=>{y(n)?delete e[t]:e[t]=n},Te=(e,t,n)=>{y(n)?e.removeProperty(t):e.setProperty(t,n)},je={translate(e,{x:t=0,y:n=0}){e.setTranslate(t,n)},scale(e,{x:t=0,y:n=0}){e.setScale(t,n)},rotate(e,t){'number'==typeof t?e.setRotate(t,0,0):e.setRotate(t.angle||0,t.x||0,t.y||0)},skewX(e,t){e.setSkewX(t)},skewY(e,t){e.setSkewY(t)}},{trigger:Fe}=p({mark:'append DOM nodes',fn:e=>{const t=[];for(let n=0;n<e.append.length;n++){const s=e.append[n];if(0!=s.listItem.active)for(let e=0;e<s.appended.length;e++)t.push(s.appended[e])}t.length>0&&o({node:e.node,append:t,reverse:e.reverse})}}),{trigger:Me}=p({mark:'addRecords',fn:({context:e,list:t})=>{const{shortName:n,parentStack:s,parentNode:l,cb:i,reverse:r}=e;ae('initRecord '+n);const o=G.get();G.replace(s);const a=[],c=[];X.push({node:l,append:c,reverse:r});for(let e=0;e<t.length;e++){const n=t[e],s=n.node;if(s.active){G.replace(n),effector.withRegion(n.signal,_(i,s));for(let e=0;e<c.length;e++)s.nodes.push(c[e]);a.push({appended:c.slice(),listItem:s}),c.length=0}}X.pop(),a.length>0&&effector.launch(Fe,{node:l,append:a,reverse:r},1),G.replace(o),ce('initRecord '+n)}}),ze=(e,t)=>t,Le=(e,t)=>t[e],qe=effector.createEvent();d({trigger:qe,priority:'high',mark:'runSignals',flatten:({signal:e})=>[e],fn:e=>{e.scope&&effector.launch(e,null,0)}}),d({trigger:qe,priority:'high',mark:'remove DOM nodes',flatten({node:e}){const{nodes:t}=e;return t},fn:e=>(e.remove(),e)});const We=e=>{const t=e.getState();for(let e=0;e<t.length;e++){const n=t[e].node;n.active=0,n.store=null}effector.launch(qe,t,1)};exports.attr=T,exports.combine=({source:e,fn:t})=>$(effector.combine(e,t)),exports.data=j,exports.explicitUnmount=e=>{const t=G.get();t&&effector.createNode({node:[],parent:e,child:t.signal,family:{type:'crosslink',owners:[t.signal,e]}})},exports.focus=W,exports.h=(e,t,n)=>{'function'==typeof t&&(n=t,t={}),void 0===t&&(t={});const{noAppend:s=0}=t,i=G.get(),r=i?i.namespace:'html';let f=r,h='html';'type'in t?(h=t.type,f=t.type):f=h='svg'===r?'svg':'html','svg'===e&&(h='svg',f='svg');const u='svg'===h?le.createElementNS('http://www.w3.org/2000/svg',e):le.createElement(e);'foreignObject'===r?(u.setAttribute('xmlns','http://www.w3.org/1999/xhtml'),f='html'):'svg'===e?(u.setAttribute('xmlns','http://www.w3.org/2000/svg'),f='svg'):'foreignObject'===e&&(f='foreignObject');const p=l(),d={type:'element',pure:0,tag:e,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},g={parent:null,signal:p,namespace:f,targetElement:u,svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:d,mountStatus:'initial',visible:1};i&&a(i,g),'svg'===e?g.svgRoot=u:i&&(g.svgRoot=i.svgRoot),G.replace(g),n?((e,t,n,s)=>{let l=0;X.push({node:t,append:[],reverse:0});try{effector.withRegion(e,s),l=1}finally{o(X.pop()),l||G.replace(n)}})(p,u,i,n):(d.pure=1,D(t));const y=(()=>{const e=(()=>{const e=G.getElementNode(),t={attr:{},data:{},visible:null,text:null,styleVar:{},styleProp:{},handler:e.handler,transform:e.transform,focus:e.focus,blur:e.blur};for(let n=0;n<e.attr.length;n++){const s=e.attr[n];for(const e in s)t.attr[e]=s[e]}for(let n=0;n<e.data.length;n++){const s=e.data[n];for(const e in s)t.data[e]=s[e]}e.visible.length>0&&(t.visible=e.visible[e.visible.length-1]),e.text.length>0&&(t.text=e.text[e.text.length-1]);for(let n=0;n<e.styleVar.length;n++){const s=e.styleVar[n];for(const e in s)t.styleVar[e]=s[e]}for(let n=0;n<e.styleProp.length;n++){const s=e.styleProp[n];for(const e in s)t.styleProp[e]=s[e]}return t})(),t=G.get(),n=t.targetElement,s=t.signal;return((e,t,n)=>{for(const s in n)b('value'!==s&&'checked'!==s&&'min'!==s&&'max'!==s,t,n[s],x.bind(null,e,s))})(n,s,e.attr),((e,t,n)=>{for(const s in n)b(0,t,n[s],v.bind(null,e.dataset,s))})(n,s,e.data),((e,t,n)=>{for(let s=0;s<n.length;s++){const{options:l,map:i}=n[s];for(const t in i)e.addEventListener(t,i[t],l);c(t,Ve.bind(null,e,n[s]))}})(n,s,e.handler),((e,t,n)=>{const s=e.style;for(const e in n)b(0,t,n[e],De.bind(null,s,e))})(n,s,e.styleProp),((e,t,n)=>{const s=e.style;for(const e in n)b(0,t,n[e],Te.bind(null,s,`--${e}`))})(n,s,e.styleVar),((e,t,n)=>{const s=G.get();if('svg'!==s.namespace)return;if(0===n.length)return;const l=e.transform.baseVal,i=s.svgRoot;for(let e=0;e<n.length;e++){const s=n[e];for(const e in s)N(i,t,l,s[e],je[e])}})(n,s,e.transform),((e,t,n)=>{null!==n&&(effector.is.unit(n)?m(t,n,E.bind(null,e)):E(e,n))})(n,s,e.text),((e,t,n)=>{if(null===n)return;const s=G.get().parent.targetElement;m(t,n,w.bind(null,e,s,G.get()))})(n,s,e.visible),((e,t,n)=>{for(let s=0;s<n.length;s++)b(1,t,n[s],S.bind(null,e))})(n,s,e.focus),((e,t,n)=>{for(let s=0;s<n.length;s++)b(1,t,n[s],R.bind(null,e))})(n,s,e.blur),e})();G.replace(i),g.visible=!y.visible||y.visible.getState(),s||X.length>0&&g.visible&&X[X.length-1].append.push(u)},exports.handler=q,exports.list=O,exports.map=(e,{fn:t})=>$(e.map(t)),exports.node=V,exports.nodeMethod=e=>{let t;return V(e=>{t=e}),(...n)=>{if(t)return t[e](...n)}},exports.remap=C,exports.signalOwn=$,exports.spec=D,exports.storeField=(t,n)=>{const s=t.map(_(A,n)),l=G.get();return l&&e(l.signal,[s]),s},exports.style=L,exports.text=M,exports.transform=F,exports.tree=function e({key:t,child:n,source:s},l){O({source:s,key:t},({store:s,key:i,signal:r})=>{const[o]=C(s,[n]);l({store:s,key:i,signal:r},()=>{e({key:t,child:n,source:o},l)})})},exports.using=(e,t)=>{const n=e.namespaceURI,s=e.tagName.toLowerCase(),i='http://www.w3.org/2000/svg'===n?'svg':'foreignObject'===s?'foreignObject':'html',r=G.get(),a={parent:r,signal:r&&r.signal?r.signal:l(),namespace:i,targetElement:e,svgRoot:'svg'===s?e:r?r.svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'using',pure:0,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},mountStatus:'initial',visible:1};G.replace(a),X.push({node:e,append:[],reverse:0});try{effector.withRegion(a.signal,t)}finally{o(X.pop()),G.replace(r)}},exports.visible=z; | ||
function e(e,t){const n=Z(e);for(let e=0;e<t.length;e++){const s=Z(t[e]);s.family.type='crosslink';const r=H(s),l=J(n);r.includes(n)||r.push(n),l.includes(s)||l.push(s)}}function t(e,t){n(e,t),s(t,e)}function n(e,t){e&&e!==t&&(e.locality.sibling.right.ref=t)}function s(e,t){e&&e!==t&&(e.locality.sibling.left.ref=t)}function r(){const e={stack:null},t=B.get(),n=effector.createNode({node:[Q,ee],parent:[t&&t.signal].filter(Boolean),meta:{unit:'signal'},scope:e});return e.self=n,n}function l(e){switch(e=String(e)){case'__proto__':case'__defineGetter__':case'__defineSetter__':case'constructor':case'prototype':case'hasOwnProperty':case'toString':case'valueOf':return'blacklisted';default:return e.replace(te,'')}}function i(e){return String(e).replace(ne,'')}function o({node:e,append:t,reverse:n=0}){if(0===t.length)return;const s=ie.createDocumentFragment();if(n){for(let e=t.length-1;e>=0;e--)s.appendChild(t[e]);e.prepend(s)}else{for(let e=0;e<t.length;e++)s.appendChild(t[e]);e.appendChild(s)}}function a(e,t){t.parent=e,t.signal.seq.push(oe),t.signal.scope.stack=t,e.child.push(t)}function c(e,t){return effector.createNode({node:[ae],parent:e,meta:{op:'watch'},scope:{fn:t},family:{type:'crosslink',owners:[e]}})}function f(){ge=0,ue()}function p(e,t,n){const s=(e=>'high'===xe.get(e)?ke:we)(e);let r=s.get(e);if(r||(r=[],s.set(e,r)),t)for(let e=0;e<n.length;e++)r.push(n[e]);else r.push(n);ye()}function u(t,n,s=0,r="low"){const l=++Ee,i=effector.createEvent(),o=effector.is.store(a=t)?a.updates:a;var a;const c={type:'crosslink',owners:[o,i]};return effector.createNode({node:[Oe],parent:[o],scope:{taskID:l,flat:s},family:c}),e(t,[i]),ve.set(l,effector.createNode({node:[Ae],child:[effector.createNode({node:[_e,Re,Ie],scope:{taskID:l},family:c}),effector.createNode({node:[Ce,Re],child:[i],family:c})],scope:{fn:n},family:c})),xe.set(l,r),i}function h({trigger:e=effector.createEvent(),fn:t,priority:n="low",timeout:s=1/0,batchWindow:r=0,retries:l=1/0,mark:i=e.shortName}){const o=u(e.map(e=>[{inserted:pe(),retry:0,value:e}]),(e,n)=>{let i,o=0;const a=[],c=[];for(i=0;i<e.length;i++){const l=e[i],f=pe();if(l.inserted+r>f){c.push(l);continue}if(l.inserted+s<f)continue;if(f-n>=10){o=1;break}const p=t(l.value);void 0!==p&&a.push(p)}if(o)for(let t=i;t<e.length;t++){const n=e[t];n.retry+=1,n.retry>=l||c.push(n)}return{done:a,fail:c}},1,n);return{trigger:e,processed:o,connect:t=>{effector.createNode({node:[],parent:t,child:e,family:{type:'crosslink',owners:[t,e]}})}}}function d({trigger:e=effector.createEvent(),fn:t,priority:n="low",timeout:s=1/0,batchWindow:r=0,retries:l=1/0,mark:i=e.shortName,flatten:o}){const a=u(e.map(e=>{const t=[],n=pe();for(let s=0;s<e.length;s++){const r=o(e[s]);for(let e=0;e<r.length;e++)t.push({inserted:n,retry:0,value:r[e]})}return t}),(e,n)=>{let i,o=0;const a=[],c=[];for(i=0;i<e.length;i++){const l=e[i],f=pe();if(l.inserted+r>f){c.push(l);continue}if(l.inserted+s<f)continue;if(f-n>=10){o=1;break}const p=t(l.value);void 0!==p&&a.push(p)}if(o)for(let t=i;t<e.length;t++){const n=e[t];n.retry+=1,n.retry>=l||c.push(n)}return{done:a,fail:c}},1,n);return{trigger:e,processed:a,connect:t=>{effector.createNode({node:[$e],parent:t,child:e,family:{type:'crosslink',owners:[t,e]}})}}}function g(e,t,n){c(e,t.watch(n))}function m(e,t,n){effector.createNode({node:[Pe],parent:t,child:[Ve],family:{type:'crosslink',owners:e},scope:{handler:n},meta:{op:'debounceRaf'}}),effector.is.store(t)&&effector.launch(Ve,{data:t.getState(),handler:n},1)}function b(e,t,n,s){effector.is.unit(n)?(e?g:m)(t,n,s):s(n)}function y(e,t=e.child.length-1){for(let n=t;n>=0;n--){const t=e.child[n];switch(t.node.type){case'element':case'using':if(!t.visible)continue;return t}const s=y(t);if(s)return s}return null}function v(e){if(!e.parent)return null;switch(e.parent.node.type){case'element':case'using':{const t=y(e.parent,e.parent.child.indexOf(e)-1);if(t)return t;break}case'list':case'listItem':{let t=e,n=e.parent;for(;n;){const e=y(n,n.child.indexOf(t)-1);if(e)return e;t=n,n=n.parent}break}}return null}function k(e){return''!==e&&0!==e&&(0==e||null==e)}function w(e,t,n){k(n)?delete e[t]:e[t]=`${n}`}function x(e,t,n,s){if(n.visible=s,s){if(!t.contains(e)){const s=v(n);s&&t.contains(s.targetElement)?s.targetElement.after(e):t.appendChild(e)}}else e.remove()}function E(e,t,n){if(null===n)return;const s=B.get().parent.targetElement;m(t,n,x.bind(null,e,s,B.get()))}function S(e,t,n){if(k(n)){switch(t){case'value':delete e.value;break;case'checked':e.checked=0;break;case'spellcheck':if(0==n)return void e.setAttribute('spellcheck','false')}e.removeAttribute(t)}else{switch(t){case'value':e.value=`${n}`;break;case'checked':e.checked=`${n}`}e.setAttribute(t,`${n}`)}}function N(e,t,n,s,r,l){const i=e.createSVGTransform();switch(l){case'translate':case'scale':s=(e=>effector.is.store(e)?e:effector.is.store(e.x)?effector.is.store(e.y)?effector.combine({x:e.x,y:e.y}):e.x.map(Fe.bind(null,e.y)):effector.is.store(e.y)?e.y.map(Me.bind(null,e.x)):e)(s)}b(0,t,s,r.bind(null,i)),n.appendItem(i)}function C(e,t){const n=ie.createTextNode(`${t}`),s=e.firstChild;s?s.replaceWith(n):e.appendChild(n)}function _(e){e.focus()}function R(e){e.blur()}function I(e,t){return e.bind(null,t)}function O(t,n){const s=B.get();if(Array.isArray(n)){const r=[];for(let e=0;e<n.length;e++)r[e]=t.map(I(A,n[e]));return s&&e(s.signal,r),r}if('object'==typeof n&&null!==n){const r=[],l={};for(const e in n)l[e]=t.map(I(A,n[e])),r.push(l[e]);return s&&e(s.signal,r),l}const r=t.map(I(A,n));return s&&e(s.signal,r),r}function A(e,t){return t[e]}function $(t,n){let s,l,i=0;effector.is.store(t)?(l=We,s=t):(l=I(Xe,t.key),s=t.source,i=!!t.reverse);const o=B.get(),f=r(),p={parent:o,signal:f,namespace:o.namespace,targetElement:o.targetElement,svgRoot:o.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'list',pure:0,reverse:i,key:effector.is.store(t)?{type:'index'}:{type:'key',key:t.key},store:s,cb:n},mountStatus:'initial',visible:1};a(o,p),B.replace(p);const u={parentNode:o.targetElement,cb:n,shortName:s.shortName,reverse:i,parentStack:p,getID:l},h=effector.createStore(P(u,[],s.getState()));e(f,[h]),c(f,I(Ge,h)),effector.sample({source:h,clock:s,fn:I(P,u),target:h}),B.replace(o)}function P(l,i,o){const c=Array(o.length).fill(0),f=o.map(l.getID),p=[],u=[],h=[];for(let e=0;e<i.length;e++){const t=i[e],n=t.node,s=f.indexOf(n.key);-1!==s?(u.push(t),c[s]=1,n.store.getState()!==o[s]&&effector.launch(n.store,o[s],1)):h.push(t)}if(h.length>0){for(let e=0;e<h.length;e++){const r=h[e],{node:l,locality:i}=r;l.active=0,l.store=null,t(i.sibling.left.ref,i.sibling.right.ref),n(r,null),s(r,null)}effector.launch(Ye,h,1)}let d=u.length>0?u[u.length-1]:null;for(let n=0;n<o.length;n++){if(c[n])continue;const s=o[n],i=effector.createStore(s),f=r();e(f,[i]);const h=l.getID(s,n),g={parent:l.parentStack,signal:f,namespace:l.parentStack.namespace,targetElement:l.parentStack.targetElement,svgRoot:l.parentStack.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'listItem',pure:0,key:h,index:h,store:i,signal:f,active:1,nodes:[]},mountStatus:'initial',visible:1};t(d,g),d=g,a(l.parentStack,g),p.push(g),u.push(g)}return p.length>0&&effector.launch(qe,{context:l,list:p},1),u}function V(t){const n=B.get();return n&&e(n.signal,[t]),t}function D(){const e=B.get();if('element'!==e.node.type&&'using'!==e.node.type)throw Error(`this extension can be used only with element nodes, got "${e.node.type}"`)}function T(e){const t=B.get();t.targetElement.__STATIC__||e(t.targetElement)}function j(e){e.attr&&F(e.attr),e.data&&M(e.data),e.transform&&z(e.transform),'text'in e&&L(e.text),'visible'in e&&q(e.visible),(e.style||e.styleVar)&&W({prop:e.style,val:e.styleVar}),e.focus&&Y(e.focus),e.handler&&X(e.handler)}function F(e){D(),B.getElementNode().attr.push(e)}function M(e){D(),B.getElementNode().data.push(e)}function z(e){D(),B.getElementNode().transform.push(e)}function L(e){D(),B.getElementNode().text.push(e)}function q(e){D(),B.getElementNode().visible.push(e)}function W({prop:e,val:t}){D(),e&&B.getElementNode().styleProp.push(e),t&&B.getElementNode().styleVar.push(t)}function X(e,t){D(),void 0===t&&(t=e,e={});const{passive:n=1,capture:s=0}=e;B.getElementNode().handler.push({options:{passive:n,capture:s},map:t})}function Y({focus:e,blur:t}){D();const n=B.getElementNode();e&&n.focus.push(e),t&&n.blur.push(t)}Object.defineProperty(exports,'__esModule',{value:1});var effector=require('effector');const G=[];let U;const B={get:()=>U,replace(e){U=e},getElementNode:()=>U.node},Z=e=>e.graphite||e,H=e=>e.family.owners,J=e=>e.family.links,K=effector.createNode({node:[effector.step.run({fn(e){effector.clearNode(e)}})]}),Q=effector.step.compute({fn(e,r){r.self.next.push(K);const{stack:l}=r,{parent:i}=l,{left:o,right:a}=l.locality.sibling;i&&(i.locality.child.last.ref===l&&(i.locality.child.last.ref=o.ref),i.locality.child.first.ref===l&&(i.locality.child.first.ref=a.ref)),o.ref&&o.ref.locality.sibling.right.ref===l&&a.ref&&a.ref.locality.sibling.left.ref===l?t(o.ref,a.ref):o.ref&&o.ref.locality.sibling.right.ref===l?n(o.ref,null):a.ref&&a.ref.locality.sibling.left.ref===l&&s(a.ref,null)}}),ee=effector.step.compute({fn:(e,{self:t})=>t}),te=/[^a-zA-Z0-9\-]/g,ne=/[\\<>"]/g;class se{constructor(){this.properties=Object.create(null)}setProperty(e,t){this.properties[l(e)]=i(t)}removeProperty(e){delete this.properties[l(e)]}}class re{constructor(){this.items=[]}appendItem(e){this.items.push(e)}}class le{constructor(){this.value=''}setTranslate(e,t){this.value=`translate(${e} ${t})`}setScale(e,t){this.value=`scale(${e} ${t})`}setRotate(e,t,n){this.value=0!==t||0!==n?`rotate(${e} ${t} ${n})`:`rotate(${e})`}setSkewX(e){this.value=`skewX(${e})`}setSkewY(e){this.value=`skewY(${e})`}}(new class{constructor(){this.child={first:null,last:null},this.sibling={left:null,right:null},this.parent=null,this.tagName='',this.namespaceURI='http://www.w3.org/1999/xhtml',this.dataset=Object.create(null),this.style=new se,this.firstChild=null,this.transform={baseVal:new re},this.isFragment=1,this.attributes=Object.create(null),this.textContent=null,this.__STATIC__=1}appendChild(e){if(e.parent&&e.remove(),e.isFragment&&null===e.textContent){let t,n=e.firstChild;for(;n;)t=n.sibling.right,this.appendChild(n),n=t}else this.child.last?(this.child.last.sibling.right=e,e.sibling.left=this.child.last):(this.child.first=e,this.firstChild=e),this.child.last=e,e.parent=this}prepend(e){e.parent&&e.remove(),this.child.last?(this.child.first.sibling.left=e,e.sibling.right=this.child.first):(this.child.first=e,this.child.last=e),this.child.first=e,this.firstChild=e,e.parent=this}contains(e){let t=e;for(;t;){if(t===this)return 1;t=t.parent}return 0}remove(){if(!this.parent)return;const{parent:e}=this;e.child.first===this&&e.child.last===this?(e.firstChild=null,e.child.first=null,e.child.last=null):e.child.first===this?(e.child.first=this.sibling.right,e.firstChild=this.sibling.right,this.sibling.right.sibling.left=null):e.child.last===this?(e.child.last=this.sibling.left,this.sibling.left.sibling.right=null):(this.sibling.right.sibling.left=this.sibling.left,this.sibling.left.sibling.right=this.sibling.right),this.sibling.left=null,this.sibling.right=null,this.parent=null}addEventListener(e,t,n){}removeEventListener(e,t,n){}setAttribute(e,t){this.attributes[l(e)]=i(t)}removeAttribute(e){delete this.attributes[l(e)]}replaceWith(e){if(!this.parent)return;const{parent:t}=this;e.parent&&e.remove(),t.child.first===this&&t.child.last===this?(t.firstChild=e,t.child.first=e,t.child.last=e):t.child.first===this?(t.child.first=e,t.firstChild=e,this.sibling.right.sibling.left=e):t.child.last===this?(t.child.last=e,this.sibling.left.sibling.right=e):(this.sibling.right.sibling.left=e,this.sibling.left.sibling.right=e),e.sibling.left=this.sibling.left,e.sibling.right=this.sibling.right,e.parent=t,this.sibling.left=null,this.sibling.right=null,this.parent=null}focus(){}blur(){}createSVGTransform(){return new le}}).isBody=1;let ie='undefined'!=typeof document?document:null;const oe=effector.step.compute({fn(e,t){if(!t.stack)return e;const{stack:n}=t;t.stack=null;const s=n.parent.child.indexOf(n);return-1!==s&&n.parent.child.splice(s,1),n.parent=null,e}}),ae=effector.step.run({fn(e,{fn:t}){t(e)}});let ce,fe,pe;ce=()=>{},fe=()=>{},pe='undefined'!=typeof performance&&performance.now?()=>performance.now():'undefined'!=typeof process&&process.hrtime?()=>{const e=process.hrtime();return(1e9*e[0]+e[1])/1e6}:()=>Date.now();const ue=effector.createEvent();let he,de=0,ge=0;const me='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0),be='undefined'!=typeof cancelAnimationFrame?cancelAnimationFrame:clearTimeout,ye=()=>{ge||(ge=1,he=me(f))},ve=new Map,ke=new Map,we=new Map,xe=new Map;let Ee=0,Se=0;const Ne=effector.createNode({node:[effector.step.run({fn:()=>{}}),effector.step.filter({fn:()=>0===ke.size&&0===we.size?0:pe()-Se>=10?0:(be(he),de=1,ge=0,1)})],child:[ue]});ue.watch(()=>{if(ge)return;if(0===ke.size&&0===we.size)return void(de=0);let e=0;de||(Se=pe()),de=0;for(const[t,n]of ke){if(pe()-Se>=10){ye(),e=1;break}ke.delete(t),effector.launch({target:ve.get(t),params:n,defer:1})}if(!e)for(const[t,n]of we){if(pe()-Se>=10){ye(),e=1;break}we.delete(t),effector.launch({target:ve.get(t),params:n,defer:1})}effector.launch({target:Ne,params:null,defer:1})});const Ce=effector.step.compute({fn:({done:e})=>e}),_e=effector.step.compute({fn:({fail:e})=>e}),Re=effector.step.filter({fn:e=>e.length>0}),Ie=effector.step.compute({fn(e,{taskID:t}){p(t,1,e)}}),Oe=effector.step.compute({fn(e,{taskID:t,flat:n}){p(t,n,e)}}),Ae=effector.step.run({fn:(e,{fn:t})=>t(e,Se)}),$e=effector.step.compute({fn:e=>[e]}),Pe=effector.step.run({fn:(e,{handler:t})=>({data:e,handler:t})}),{trigger:Ve}=h({priority:'high',mark:'domOperation',fn({handler:e,data:t}){e(t)}}),De=(e,{map:t,options:n})=>{for(const s in t)e.removeEventListener(s,t[s],n)},Te=(e,t,n)=>{k(n)?delete e[t]:e[t]=n},je=(e,t,n)=>{k(n)?e.removeProperty(t):e.setProperty(t,n)},Fe=(e,t)=>({x:t,y:e}),Me=(e,t)=>({x:e,y:t}),ze={translate(e,{x:t=0,y:n=0}){e.setTranslate(t,n)},scale(e,{x:t=0,y:n=0}){e.setScale(t,n)},rotate(e,t){'number'==typeof t?e.setRotate(t,0,0):e.setRotate(t.angle||0,t.x||0,t.y||0)},skewX(e,t){e.setSkewX(t)},skewY(e,t){e.setSkewY(t)}},{trigger:Le}=h({mark:'append DOM nodes',fn:e=>{for(let t=0;t<e.append.length;t++){const n=e.append[t];if(0==n.listItem.active)continue;if(0===n.appended.length)continue;const s=ie.createDocumentFragment();if(e.reverse)for(let e=n.appended.length-1;e>=0;e--)s.appendChild(n.appended[e]);else for(let e=0;e<n.appended.length;e++)s.appendChild(n.appended[e]);const r=v(n.listItemStack);r&&e.node.contains(r.targetElement)?e.reverse?r.targetElement.before(s):r.targetElement.after(s):e.node.appendChild(s)}}}),{trigger:qe}=h({mark:'addRecords',fn:({context:e,list:t})=>{const{parentStack:n,parentNode:s,cb:r,reverse:l}=e,i=B.get();B.replace(n);const o=[],a=[];G.push({node:s,append:a,reverse:l});for(let e=0;e<t.length;e++){const n=t[e],s=n.node;if(s.active){B.replace(n),effector.withRegion(n.signal,I(r,s));for(let e=0;e<a.length;e++)s.nodes.push(a[e]);o.push({listItemStack:n,appended:a.slice(),listItem:s}),a.length=0}}G.pop(),o.length>0&&effector.launch({target:Le,params:{node:s,append:o,reverse:l},defer:1}),B.replace(i)}}),We=(e,t)=>t,Xe=(e,t)=>t[e],Ye=effector.createEvent();d({trigger:Ye,priority:'high',mark:'runSignals',flatten:({signal:e})=>[e],fn:e=>{e.scope&&effector.launch(e,null,0)}}),d({trigger:Ye,priority:'high',mark:'remove DOM nodes',flatten({node:e}){const{nodes:t}=e;return t},fn:e=>(e.remove(),e)});const Ge=e=>{const t=e.getState();for(let e=0;e<t.length;e++){const n=t[e].node;n.active=0,n.store=null}effector.launch(Ye,t,1)};exports.attr=F,exports.combine=({source:e,fn:t})=>(console.error('separate combine method is deprecated, use common combine method as usual'),V(effector.combine(e,t))),exports.data=M,exports.explicitUnmount=e=>{const t=B.get();t&&effector.createNode({node:[],parent:e,child:t.signal,family:{type:'crosslink',owners:[t.signal,e]}})},exports.focus=Y,exports.h=(e,t,n)=>{'function'==typeof t&&(n=t,t={}),void 0===t&&(t={});const{noAppend:s=0}=t,l=B.get(),i=l?l.namespace:'html';let f=i,p='html';'type'in t?(p=t.type,f=t.type):f=p='svg'===i?'svg':'html','svg'===e&&(p='svg',f='svg');const u='svg'===p?ie.createElementNS('http://www.w3.org/2000/svg',e):ie.createElement(e);'foreignObject'===i?(u.setAttribute('xmlns','http://www.w3.org/1999/xhtml'),f='html'):'svg'===e?(u.setAttribute('xmlns','http://www.w3.org/2000/svg'),f='svg'):'foreignObject'===e&&(f='foreignObject');const h=r(),d={type:'element',pure:0,tag:e,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},g={parent:null,signal:h,namespace:f,targetElement:u,svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:d,mountStatus:'initial',visible:1};l&&a(l,g),'svg'===e?g.svgRoot=u:l&&(g.svgRoot=l.svgRoot),B.replace(g),n?((e,t,n,s)=>{let r=0;G.push({node:t,append:[],reverse:0});try{effector.withRegion(e,s),r=1}finally{o(G.pop()),r||B.replace(n)}})(h,u,l,n):(d.pure=1,j(t));const y=(()=>{const e=(()=>{const e=B.getElementNode(),t={attr:{},data:{},visible:null,text:null,styleVar:{},styleProp:{},handler:e.handler,transform:e.transform,focus:e.focus,blur:e.blur};for(let n=0;n<e.attr.length;n++){const s=e.attr[n];for(const e in s)t.attr[e]=s[e]}for(let n=0;n<e.data.length;n++){const s=e.data[n];for(const e in s)t.data[e]=s[e]}e.visible.length>0&&(t.visible=e.visible[e.visible.length-1]),e.text.length>0&&(t.text=e.text[e.text.length-1]);for(let n=0;n<e.styleVar.length;n++){const s=e.styleVar[n];for(const e in s)t.styleVar[e]=s[e]}for(let n=0;n<e.styleProp.length;n++){const s=e.styleProp[n];for(const e in s)t.styleProp[e]=s[e]}return t})(),t=B.get(),n=t.targetElement,s=t.signal;return((e,t,n)=>{for(const s in n)b('value'!==s&&'checked'!==s&&'min'!==s&&'max'!==s,t,n[s],S.bind(null,e,s))})(n,s,e.attr),((e,t,n)=>{for(const s in n)b(0,t,n[s],w.bind(null,e.dataset,s))})(n,s,e.data),((e,t,n)=>{for(let s=0;s<n.length;s++){const{options:r,map:l}=n[s];for(const t in l)e.addEventListener(t,l[t],r);c(t,De.bind(null,e,n[s]))}})(n,s,e.handler),((e,t,n)=>{const s=e.style;for(const e in n)b(0,t,n[e],Te.bind(null,s,e))})(n,s,e.styleProp),((e,t,n)=>{const s=e.style;for(const e in n)b(0,t,n[e],je.bind(null,s,`--${e}`))})(n,s,e.styleVar),((e,t,n)=>{const s=B.get();if('svg'!==s.namespace)return;if(0===n.length)return;const r=e.transform.baseVal,l=s.svgRoot;for(let e=0;e<n.length;e++){const s=n[e];for(const e in s)N(l,t,r,s[e],ze[e],e)}})(n,s,e.transform),((e,t,n)=>{null!==n&&(effector.is.unit(n)?m(t,n,C.bind(null,e)):C(e,n))})(n,s,e.text),E(n,s,e.visible),((e,t,n)=>{for(let s=0;s<n.length;s++)b(1,t,n[s],_.bind(null,e))})(n,s,e.focus),((e,t,n)=>{for(let s=0;s<n.length;s++)b(1,t,n[s],R.bind(null,e))})(n,s,e.blur),e})();B.replace(l),g.visible=!y.visible||y.visible.getState(),s||G.length>0&&g.visible&&G[G.length-1].append.push(u)},exports.handler=X,exports.list=$,exports.map=(e,{fn:t})=>(console.error('separate map method is deprecated, use store.map as usual'),V(e.map(t))),exports.node=T,exports.nodeMethod=e=>{let t;return T(e=>{t=e}),(...n)=>{if(t)return t[e](...n)}},exports.remap=O,exports.signalOwn=V,exports.spec=j,exports.storeField=(t,n)=>{const s=t.map(I(A,n)),r=B.get();return r&&e(r.signal,[s]),s},exports.style=W,exports.text=L,exports.transform=z,exports.tree=function e({key:t,child:n,source:s},r){$({source:s,key:t},({store:s,key:l,signal:i})=>{const[o]=O(s,[n]);r({store:s,key:l,signal:i},()=>{e({key:t,child:n,source:o},r)})})},exports.using=(e,t)=>{const n=e.namespaceURI,s=e.tagName.toLowerCase(),l='http://www.w3.org/2000/svg'===n?'svg':'foreignObject'===s?'foreignObject':'html',i=B.get(),a={parent:i,signal:i&&i.signal?i.signal:r(),namespace:l,targetElement:e,svgRoot:'svg'===s?e:i?i.svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'using',pure:0,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},mountStatus:'initial',visible:1};B.replace(a),G.push({node:e,append:[],reverse:0});try{effector.withRegion(a.signal,t)}finally{o(G.pop()),B.replace(i)}},exports.visible=q; | ||
//# sourceMappingURL=effector-dom.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
function t(t,e){const n=ht(t);for(let t=0;t<e.length;t++){const i=ht(e[t]);i.family.type='crosslink';const l=pt(i),s=gt(n);l.includes(n)||l.push(n),s.includes(i)||s.push(i)}}function e(t,e){n(t,e),i(e,t)}function n(t,e){t&&t!==e&&(t.locality.sibling.right.ref=e)}function i(t,e){t&&t!==e&&(t.locality.sibling.left.ref=e)}function l(){const t={stack:null},e=ut.get(),n=K({node:[mt,bt],parent:[e&&e.signal].filter(Boolean),meta:{unit:'signal'},scope:t});return t.self=n,n}function s(t){switch(t=String(t)){case'__proto__':case'__defineGetter__':case'__defineSetter__':case'constructor':case'prototype':case'hasOwnProperty':case'toString':case'valueOf':return'blacklisted';default:return t.replace(yt,'')}}function r(t){return String(t).replace(vt,'')}function o(t,e){const n=t.namespaceURI,i=t.tagName.toLowerCase(),s='http://www.w3.org/2000/svg'===n?'svg':'foreignObject'===i?'foreignObject':'html',r=ut.get(),o={parent:r,signal:r&&r.signal?r.signal:l(),namespace:s,targetElement:t,svgRoot:'svg'===i?t:r?r.svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'using',pure:0,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},mountStatus:'initial',visible:1};ut.replace(o),ct.push({node:t,append:[],reverse:0});try{et(o.signal,e)}finally{a(ct.pop()),ut.replace(r)}}function a({node:t,append:e,reverse:n=0}){if(0===e.length)return;const i=St.createDocumentFragment();if(n){for(let t=e.length-1;t>=0;t--)i.appendChild(e[t]);t.prepend(i)}else{for(let t=0;t<e.length;t++)i.appendChild(e[t]);t.appendChild(i)}}function c(t,e){e.parent=t,e.signal.seq.push(Et),e.signal.scope.stack=e,t.child.push(e)}function f(t,e){return K({node:[Nt],parent:t,meta:{op:'watch'},scope:{fn:e},family:{type:'crosslink',owners:[t]}})}function u(){Vt=0,Ct('batchRAF'),It(),At('batchRAF')}function h(t,e,n){const i=(t=>'high'===zt.get(t)?Ft:Mt)(t);let l=i.get(t);if(l||(l=[],i.set(t,l)),e)for(let t=0;t<n.length;t++)l.push(n[t]);else l.push(n);Tt()}function p(e,n,i=0,l="low"){const s=++Lt,r=nt(),o=st.store(a=e)?a.updates:a;var a;const c={type:'crosslink',owners:[o,r]};return K({node:[Ut],parent:[o],scope:{taskID:s,flat:i},family:c}),t(e,[r]),jt.set(s,K({node:[Zt],child:[K({node:[qt,Gt,Bt],scope:{taskID:s},family:c}),K({node:[Yt,Gt],child:[r],family:c})],scope:{fn:n},family:c})),zt.set(s,l),r}function g({trigger:t=nt(),fn:e,priority:n="low",timeout:i=1/0,batchWindow:l=0,retries:s=1/0,mark:r=t.shortName}){const o=p(t.map(t=>[{inserted:_t(),retry:0,value:t}]),(t,n)=>{let o,a=0;const c=[],f=[];for(Ct(r),o=0;o<t.length;o++){const s=t[o],r=_t();if(s.inserted+l>r){f.push(s);continue}if(s.inserted+i<r)continue;if(r-n>=Rt){a=1;break}const u=e(s.value);void 0!==u&&c.push(u)}if(a)for(let e=o;e<t.length;e++){const n=t[e];n.retry+=1,n.retry>=s||f.push(n)}return At(r),{done:c,fail:f}},1,n);return{trigger:t,processed:o,connect:e=>{K({node:[],parent:e,child:t,family:{type:'crosslink',owners:[e,t]}})}}}function d({trigger:t=nt(),fn:e,priority:n="low",timeout:i=1/0,batchWindow:l=0,retries:s=1/0,mark:r=t.shortName,flatten:o}){const a=p(t.map(t=>{const e=[],n=_t();for(let i=0;i<t.length;i++){const l=o(t[i]);for(let t=0;t<l.length;t++)e.push({inserted:n,retry:0,value:l[t]})}return e}),(t,n)=>{let o,a=0;const c=[],f=[];for(Ct(r),o=0;o<t.length;o++){const s=t[o],r=_t();if(s.inserted+l>r){f.push(s);continue}if(s.inserted+i<r)continue;if(r-n>=Rt){a=1;break}const u=e(s.value);void 0!==u&&c.push(u)}if(a)for(let e=o;e<t.length;e++){const n=t[e];n.retry+=1,n.retry>=s||f.push(n)}return At(r),{done:c,fail:f}},1,n);return{trigger:t,processed:a,connect:e=>{K({node:[Ht],parent:e,child:t,family:{type:'crosslink',owners:[e,t]}})}}}function m(t,e,n){f(t,e.watch(n))}function b(t,e,n){K({node:[Jt],parent:e,child:[Kt],family:{type:'crosslink',owners:t},scope:{handler:n},meta:{op:'debounceRaf'}}),st.store(e)&<(Kt,{data:e.getState(),handler:n},1)}function y(t,e,n,i){st.unit(n)?(t?m:b)(e,n,i):i(n)}function v(t){return''!==t&&0!==t&&(0==t||null==t)}function k(t,e,n){v(n)?delete t[e]:t[e]=`${n}`}function w(t,e=t.child.length-1){for(let n=e;n>=0;n--){const e=t.child[n];switch(e.node.type){case'element':case'using':if(!e.visible)continue;return e}const i=w(e);if(i)return i}return null}function x(t,e,n,i){if(n.visible=i,i){if(!e.contains(t)){const i=(t=>{if(!t.parent)return null;switch(t.parent.node.type){case'element':case'using':{const e=w(t.parent,t.parent.child.indexOf(t)-1);if(e)return e;break}case'list':case'listItem':{let e=t,n=t.parent;for(;n;){const t=w(n,n.child.indexOf(e)-1);if(t)return t;e=n,n=n.parent}break}}return null})(n);i&&e.contains(i.targetElement)?i.targetElement.after(t):e.appendChild(t)}}else t.remove()}function S(t,e,n){if(v(n)){switch(e){case'value':delete t.value;break;case'checked':delete t.checked;break;case'spellcheck':if(0==n)return void t.setAttribute('spellcheck','false')}t.removeAttribute(e)}else{switch(e){case'value':t.value=`${n}`;break;case'checked':t.checked=`${n}`}t.setAttribute(e,`${n}`)}}function E(t,e,n,i,l){const s=t.createSVGTransform();y(0,e,i,l.bind(null,s)),n.appendItem(s)}function N(t,e){const n=St.createTextNode(`${e}`),i=t.firstChild;i?i.replaceWith(n):t.appendChild(n)}function R(t){t.focus()}function C(t){t.blur()}function A(t,e,n){'function'==typeof e&&(n=e,e={}),void 0===e&&(e={});const{noAppend:i=0}=e,s=ut.get(),r=s?s.namespace:'html';let o=r,u='html';'type'in e?(u=e.type,o=e.type):o=u='svg'===r?'svg':'html','svg'===t&&(u='svg',o='svg');const h='svg'===u?St.createElementNS('http://www.w3.org/2000/svg',t):St.createElement(t);'foreignObject'===r?(h.setAttribute('xmlns','http://www.w3.org/1999/xhtml'),o='html'):'svg'===t?(h.setAttribute('xmlns','http://www.w3.org/2000/svg'),o='svg'):'foreignObject'===t&&(o='foreignObject');const p=l(),g={type:'element',pure:0,tag:t,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},d={parent:null,signal:p,namespace:o,targetElement:h,svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:g,mountStatus:'initial',visible:1};s&&c(s,d),'svg'===t?d.svgRoot=h:s&&(d.svgRoot=s.svgRoot),ut.replace(d),n?((t,e,n,i)=>{let l=0;ct.push({node:e,append:[],reverse:0});try{et(t,i),l=1}finally{a(ct.pop()),l||ut.replace(n)}})(p,h,s,n):(g.pure=1,L(e));const m=(()=>{const t=(()=>{const t=ut.getElementNode(),e={attr:{},data:{},visible:null,text:null,styleVar:{},styleProp:{},handler:t.handler,transform:t.transform,focus:t.focus,blur:t.blur};for(let n=0;n<t.attr.length;n++){const i=t.attr[n];for(const t in i)e.attr[t]=i[t]}for(let n=0;n<t.data.length;n++){const i=t.data[n];for(const t in i)e.data[t]=i[t]}t.visible.length>0&&(e.visible=t.visible[t.visible.length-1]),t.text.length>0&&(e.text=t.text[t.text.length-1]);for(let n=0;n<t.styleVar.length;n++){const i=t.styleVar[n];for(const t in i)e.styleVar[t]=i[t]}for(let n=0;n<t.styleProp.length;n++){const i=t.styleProp[n];for(const t in i)e.styleProp[t]=i[t]}return e})(),e=ut.get(),n=e.targetElement,i=e.signal;return((t,e,n)=>{for(const i in n)y('value'!==i&&'checked'!==i&&'min'!==i&&'max'!==i,e,n[i],S.bind(null,t,i))})(n,i,t.attr),((t,e,n)=>{for(const i in n)y(0,e,n[i],k.bind(null,t.dataset,i))})(n,i,t.data),((t,e,n)=>{for(let i=0;i<n.length;i++){const{options:l,map:s}=n[i];for(const e in s)t.addEventListener(e,s[e],l);f(e,Qt.bind(null,t,n[i]))}})(n,i,t.handler),((t,e,n)=>{const i=t.style;for(const t in n)y(0,e,n[t],te.bind(null,i,t))})(n,i,t.styleProp),((t,e,n)=>{const i=t.style;for(const t in n)y(0,e,n[t],ee.bind(null,i,`--${t}`))})(n,i,t.styleVar),((t,e,n)=>{const i=ut.get();if('svg'!==i.namespace)return;if(0===n.length)return;const l=t.transform.baseVal,s=i.svgRoot;for(let t=0;t<n.length;t++){const i=n[t];for(const t in i)E(s,e,l,i[t],ne[t])}})(n,i,t.transform),((t,e,n)=>{null!==n&&(st.unit(n)?b(e,n,N.bind(null,t)):N(t,n))})(n,i,t.text),((t,e,n)=>{if(null===n)return;const i=ut.get().parent.targetElement;b(e,n,x.bind(null,t,i,ut.get()))})(n,i,t.visible),((t,e,n)=>{for(let i=0;i<n.length;i++)y(1,e,n[i],R.bind(null,t))})(n,i,t.focus),((t,e,n)=>{for(let i=0;i<n.length;i++)y(1,e,n[i],C.bind(null,t))})(n,i,t.blur),t})();ut.replace(s),d.visible=!m.visible||m.visible.getState(),i||ct.length>0&&d.visible&&ct[ct.length-1].append.push(h)}function _(t,e){return t.bind(null,e)}function I(e,n){const i=ut.get();if(Array.isArray(n)){const l=[];for(let t=0;t<n.length;t++)l[t]=e.map(_($,n[t]));return i&&t(i.signal,l),l}if('object'==typeof n&&null!==n){const l=[],s={};for(const t in n)s[t]=e.map(_($,n[t])),l.push(s[t]);return i&&t(i.signal,l),s}const l=e.map(_($,n));return i&&t(i.signal,l),l}function O(e,n){const i=e.map(_($,n)),l=ut.get();return l&&t(l.signal,[i]),i}function $(t,e){return e[t]}function V({key:t,child:e,source:n},i){P({source:n,key:t},({store:n,key:l,signal:s})=>{const[r]=I(n,[e]);i({store:n,key:l,signal:s},()=>{V({key:t,child:e,source:r},i)})})}function P(e,n){let i,s,r=0;st.store(e)?(s=se,i=e):(s=_(re,e.key),i=e.source,r=!!e.reverse);const o=ut.get(),a=l(),u={parent:o,signal:a,namespace:o.namespace,targetElement:o.targetElement,svgRoot:o.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'list',pure:0,reverse:r,key:st.store(e)?{type:'index'}:{type:'key',key:e.key},store:i,cb:n},mountStatus:'initial',visible:1};c(o,u),ut.replace(u);const h={parentNode:o.targetElement,cb:n,shortName:i.shortName,reverse:r,parentStack:u,getID:s},p=rt(D(h,[],i.getState()));t(a,[p]),f(a,_(ae,p)),ot({source:p,clock:i,fn:_(D,h),target:p}),ut.replace(o)}function D(s,r,o){Ct('list update ['+s.shortName+']');const a=Array(o.length).fill(0),f=o.map(s.getID),u=[],h=[],p=[];for(let t=0;t<r.length;t++){const e=r[t],n=e.node,i=f.indexOf(n.key);-1!==i?(h.push(e),a[i]=1,n.store.getState()!==o[i]&<(n.store,o[i],1)):p.push(e)}if(p.length>0){for(let t=0;t<p.length;t++){const l=p[t],{node:s,locality:r}=l;s.active=0,s.store=null,e(r.sibling.left.ref,r.sibling.right.ref),n(l,null),i(l,null)}lt(oe,p,1)}let g=h.length>0?h[h.length-1]:null;for(let n=0;n<o.length;n++){if(a[n])continue;const i=o[n],r=rt(i),f=l();t(f,[r]);const p=s.getID(i,n),d={parent:s.parentStack,signal:f,namespace:s.parentStack.namespace,targetElement:s.parentStack.targetElement,svgRoot:s.parentStack.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'listItem',pure:0,key:p,index:p,store:r,signal:f,active:1,nodes:[]},mountStatus:'initial',visible:1};e(g,d),g=d,c(s.parentStack,d),u.push(d),h.push(d)}return u.length>0&<(le,{context:s,list:u},1),At('list update ['+s.shortName+']'),h}function T(t){const e=ut.get();e&&K({node:[],parent:t,child:e.signal,family:{type:'crosslink',owners:[e.signal,t]}})}function j(e){const n=ut.get();return n&&t(n.signal,[e]),e}function F(){const t=ut.get();if('element'!==t.node.type&&'using'!==t.node.type)throw Error(`this extension can be used only with element nodes, got "${t.node.type}"`)}function M(t){let e;return z(t=>{e=t}),(...n)=>{if(e)return e[t](...n)}}function z(t){const e=ut.get();e.targetElement.__STATIC__||t(e.targetElement)}function L(t){t.attr&&W(t.attr),t.data&&X(t.data),t.transform&&Y(t.transform),'text'in t&&q(t.text),'visible'in t&&G(t.visible),(t.style||t.styleVar)&&B({prop:t.style,val:t.styleVar}),t.focus&&Z(t.focus),t.handler&&U(t.handler)}function W(t){F(),ut.getElementNode().attr.push(t)}function X(t){F(),ut.getElementNode().data.push(t)}function Y(t){F(),ut.getElementNode().transform.push(t)}function q(t){F(),ut.getElementNode().text.push(t)}function G(t){F(),ut.getElementNode().visible.push(t)}function B({prop:t,val:e}){F(),t&&ut.getElementNode().styleProp.push(t),e&&ut.getElementNode().styleVar.push(e)}function U(t,e){F(),void 0===e&&(e=t,t={});const{passive:n=1,capture:i=0}=t;ut.getElementNode().handler.push({options:{passive:n,capture:i},map:e})}function Z({focus:t,blur:e}){F();const n=ut.getElementNode();t&&n.focus.push(t),e&&n.blur.push(e)}function H(t,{fn:e}){return j(t.map(e))}function J({source:t,fn:e}){return j(at(t,e))}import{createNode as K,step as Q,clearNode as tt,withRegion as et,createEvent as nt,launch as lt,is as st,createStore as rt,sample as ot,combine as at}from'effector';const ct=[];let ft;const ut={get:()=>ft,replace(t){ft=t},getElementNode:()=>ft.node},ht=t=>t.graphite||t,pt=t=>t.family.owners,gt=t=>t.family.links,dt=K({node:[Q.run({fn(t){tt(t)}})]}),mt=Q.compute({fn(t,l){l.self.next.push(dt);const{stack:s}=l,{parent:r}=s,{left:o,right:a}=s.locality.sibling;r&&(r.locality.child.last.ref===s&&(r.locality.child.last.ref=o.ref),r.locality.child.first.ref===s&&(r.locality.child.first.ref=a.ref)),o.ref&&o.ref.locality.sibling.right.ref===s&&a.ref&&a.ref.locality.sibling.left.ref===s?e(o.ref,a.ref):o.ref&&o.ref.locality.sibling.right.ref===s?n(o.ref,null):a.ref&&a.ref.locality.sibling.left.ref===s&&i(a.ref,null)}}),bt=Q.compute({fn:(t,{self:e})=>e}),yt=/[^a-zA-Z0-9\-]/g,vt=/[\\<>"]/g;class kt{constructor(){this.properties=Object.create(null)}setProperty(t,e){this.properties[s(t)]=r(e)}removeProperty(t){delete this.properties[s(t)]}}class wt{constructor(){this.items=[]}appendItem(t){this.items.push(t)}}class xt{constructor(){this.value=''}setTranslate(t,e){this.value=`translate(${t} ${e})`}setScale(t,e){this.value=`scale(${t} ${e})`}setRotate(t,e,n){this.value=0!==e||0!==n?`rotate(${t} ${e} ${n})`:`rotate(${t})`}setSkewX(t){this.value=`skewX(${t})`}setSkewY(t){this.value=`skewY(${t})`}}(new class{constructor(){this.child={first:null,last:null},this.sibling={left:null,right:null},this.parent=null,this.tagName='',this.namespaceURI='http://www.w3.org/1999/xhtml',this.dataset=Object.create(null),this.style=new kt,this.firstChild=null,this.transform={baseVal:new wt},this.isFragment=1,this.attributes=Object.create(null),this.textContent=null,this.__STATIC__=1}appendChild(t){if(t.parent&&t.remove(),t.isFragment&&null===t.textContent){let e,n=t.firstChild;for(;n;)e=n.sibling.right,this.appendChild(n),n=e}else this.child.last?(this.child.last.sibling.right=t,t.sibling.left=this.child.last):(this.child.first=t,this.firstChild=t),this.child.last=t,t.parent=this}prepend(t){t.parent&&t.remove(),this.child.last?(this.child.first.sibling.left=t,t.sibling.right=this.child.first):(this.child.first=t,this.child.last=t),this.child.first=t,this.firstChild=t,t.parent=this}contains(t){let e=t;for(;e;){if(e===this)return 1;e=e.parent}return 0}remove(){if(!this.parent)return;const{parent:t}=this;t.child.first===this&&t.child.last===this?(t.firstChild=null,t.child.first=null,t.child.last=null):t.child.first===this?(t.child.first=this.sibling.right,t.firstChild=this.sibling.right,this.sibling.right.sibling.left=null):t.child.last===this?(t.child.last=this.sibling.left,this.sibling.left.sibling.right=null):(this.sibling.right.sibling.left=this.sibling.left,this.sibling.left.sibling.right=this.sibling.right),this.sibling.left=null,this.sibling.right=null,this.parent=null}addEventListener(t,e,n){}removeEventListener(t,e,n){}setAttribute(t,e){this.attributes[s(t)]=r(e)}removeAttribute(t){delete this.attributes[s(t)]}replaceWith(t){if(!this.parent)return;const{parent:e}=this;t.parent&&t.remove(),e.child.first===this&&e.child.last===this?(e.firstChild=t,e.child.first=t,e.child.last=t):e.child.first===this?(e.child.first=t,e.firstChild=t,this.sibling.right.sibling.left=t):e.child.last===this?(e.child.last=t,this.sibling.left.sibling.right=t):(this.sibling.right.sibling.left=t,this.sibling.left.sibling.right=t),t.sibling.left=this.sibling.left,t.sibling.right=this.sibling.right,t.parent=e,this.sibling.left=null,this.sibling.right=null,this.parent=null}focus(){}blur(){}createSVGTransform(){return new xt}}).isBody=1;let St='undefined'!=typeof document?document:null;const Et=Q.compute({fn(t,e){if(!e.stack)return t;const{stack:n}=e;e.stack=null;const i=n.parent.child.indexOf(n);return-1!==i&&n.parent.child.splice(i,1),n.parent=null,t}}),Nt=Q.run({fn(t,{fn:e}){e(t)}}),Rt=10;let Ct,At,_t;Ct=()=>{},At=()=>{},_t='undefined'!=typeof performance&&performance.now?()=>performance.now():'undefined'!=typeof process&&process.hrtime?()=>{const t=process.hrtime();return(1e9*t[0]+t[1])/1e6}:()=>Date.now();const It=nt();let Ot,$t=0,Vt=0;const Pt='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:t=>setTimeout(t,0),Dt='undefined'!=typeof cancelAnimationFrame?cancelAnimationFrame:clearTimeout,Tt=()=>{Vt||(Vt=1,Ot=Pt(u))},jt=new Map,Ft=new Map,Mt=new Map,zt=new Map;let Lt=0,Wt=0;const Xt=K({node:[Q.run({fn:()=>{}}),Q.filter({fn:()=>0===Ft.size&&0===Mt.size?0:_t()-Wt>=Rt?0:(Dt(Ot),$t=1,Vt=0,1)})],child:[It]});It.watch(()=>{if(Vt)return;if(0===Ft.size&&0===Mt.size)return void($t=0);let t=0;$t||(Wt=_t()),$t=0,Ct('plan');for(const[e,n]of Ft){if(_t()-Wt>=Rt){Tt(),t=1;break}Ft.delete(e);const i=jt.get(e);lt(i,n,1)}if(!t)for(const[e,n]of Mt){if(_t()-Wt>=Rt){Tt(),t=1;break}Mt.delete(e);const i=jt.get(e);lt(i,n,1)}lt(Xt,null,1),At('plan')});const Yt=Q.compute({fn:({done:t})=>t}),qt=Q.compute({fn:({fail:t})=>t}),Gt=Q.filter({fn:t=>t.length>0}),Bt=Q.compute({fn(t,{taskID:e}){h(e,1,t)}}),Ut=Q.compute({fn(t,{taskID:e,flat:n}){h(e,n,t)}}),Zt=Q.run({fn:(t,{fn:e})=>e(t,Wt)}),Ht=Q.compute({fn:t=>[t]}),Jt=Q.run({fn:(t,{handler:e})=>({data:t,handler:e})}),{trigger:Kt}=g({priority:'high',mark:'domOperation',fn({handler:t,data:e}){t(e)}}),Qt=(t,{map:e,options:n})=>{for(const i in e)t.removeEventListener(i,e[i],n)},te=(t,e,n)=>{v(n)?delete t[e]:t[e]=n},ee=(t,e,n)=>{v(n)?t.removeProperty(e):t.setProperty(e,n)},ne={translate(t,{x:e=0,y:n=0}){t.setTranslate(e,n)},scale(t,{x:e=0,y:n=0}){t.setScale(e,n)},rotate(t,e){'number'==typeof e?t.setRotate(e,0,0):t.setRotate(e.angle||0,e.x||0,e.y||0)},skewX(t,e){t.setSkewX(e)},skewY(t,e){t.setSkewY(e)}},{trigger:ie}=g({mark:'append DOM nodes',fn:t=>{const e=[];for(let n=0;n<t.append.length;n++){const i=t.append[n];if(0!=i.listItem.active)for(let t=0;t<i.appended.length;t++)e.push(i.appended[t])}e.length>0&&a({node:t.node,append:e,reverse:t.reverse})}}),{trigger:le}=g({mark:'addRecords',fn:({context:t,list:e})=>{const{shortName:n,parentStack:i,parentNode:l,cb:s,reverse:r}=t;Ct('initRecord '+n);const o=ut.get();ut.replace(i);const a=[],c=[];ct.push({node:l,append:c,reverse:r});for(let t=0;t<e.length;t++){const n=e[t],i=n.node;if(i.active){ut.replace(n),et(n.signal,_(s,i));for(let t=0;t<c.length;t++)i.nodes.push(c[t]);a.push({appended:c.slice(),listItem:i}),c.length=0}}ct.pop(),a.length>0&<(ie,{node:l,append:a,reverse:r},1),ut.replace(o),At('initRecord '+n)}}),se=(t,e)=>e,re=(t,e)=>e[t],oe=nt();d({trigger:oe,priority:'high',mark:'runSignals',flatten:({signal:t})=>[t],fn:t=>{t.scope&<(t,null,0)}}),d({trigger:oe,priority:'high',mark:'remove DOM nodes',flatten({node:t}){const{nodes:e}=t;return e},fn:t=>(t.remove(),t)});const ae=t=>{const e=t.getState();for(let t=0;t<e.length;t++){const n=e[t].node;n.active=0,n.store=null}lt(oe,e,1)};export{W as attr,J as combine,X as data,T as explicitUnmount,Z as focus,A as h,U as handler,P as list,H as map,z as node,M as nodeMethod,I as remap,j as signalOwn,L as spec,O as storeField,B as style,q as text,Y as transform,V as tree,o as using,G as visible}; | ||
function e(e,t){const n=pe(e);for(let e=0;e<t.length;e++){const l=pe(t[e]);l.family.type='crosslink';const i=de(l),s=ge(n);i.includes(n)||i.push(n),s.includes(l)||s.push(l)}}function t(e,t){n(e,t),l(t,e)}function n(e,t){e&&e!==t&&(e.locality.sibling.right.ref=t)}function l(e,t){e&&e!==t&&(e.locality.sibling.left.ref=t)}function i(){const e={stack:null},t=he.get(),n=ee({node:[be,ye],parent:[t&&t.signal].filter(Boolean),meta:{unit:'signal'},scope:e});return e.self=n,n}function s(e){switch(e=String(e)){case'__proto__':case'__defineGetter__':case'__defineSetter__':case'constructor':case'prototype':case'hasOwnProperty':case'toString':case'valueOf':return'blacklisted';default:return e.replace(ve,'')}}function r(e){return String(e).replace(ke,'')}function o(e,t){const n=e.namespaceURI,l=e.tagName.toLowerCase(),s='http://www.w3.org/2000/svg'===n?'svg':'foreignObject'===l?'foreignObject':'html',r=he.get(),o={parent:r,signal:r&&r.signal?r.signal:i(),namespace:s,targetElement:e,svgRoot:'svg'===l?e:r?r.svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'using',pure:0,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},mountStatus:'initial',visible:1};he.replace(o),fe.push({node:e,append:[],reverse:0});try{le(o.signal,t)}finally{a(fe.pop()),he.replace(r)}}function a({node:e,append:t,reverse:n=0}){if(0===t.length)return;const l=Se.createDocumentFragment();if(n){for(let e=t.length-1;e>=0;e--)l.appendChild(t[e]);e.prepend(l)}else{for(let e=0;e<t.length;e++)l.appendChild(t[e]);e.appendChild(l)}}function c(e,t){t.parent=e,t.signal.seq.push(Ce),t.signal.scope.stack=t,e.child.push(t)}function f(e,t){return ee({node:[Ne],parent:e,meta:{op:'watch'},scope:{fn:t},family:{type:'crosslink',owners:[e]}})}function u(){Ve=0,Re()}function h(e,t,n){const l=(e=>'high'===ze.get(e)?Fe:Me)(e);let i=l.get(e);if(i||(i=[],l.set(e,i)),t)for(let e=0;e<n.length;e++)i.push(n[e]);else i.push(n);Te()}function p(t,n,l=0,i="low"){const s=++Le,r=ie(),o=re.store(a=t)?a.updates:a;var a;const c={type:'crosslink',owners:[o,r]};return ee({node:[Ue],parent:[o],scope:{taskID:s,flat:l},family:c}),e(t,[r]),je.set(s,ee({node:[Ze],child:[ee({node:[qe,Ge,Be],scope:{taskID:s},family:c}),ee({node:[Ye,Ge],child:[r],family:c})],scope:{fn:n},family:c})),ze.set(s,i),r}function d({trigger:e=ie(),fn:t,priority:n="low",timeout:l=1/0,batchWindow:i=0,retries:s=1/0,mark:r=e.shortName}){const o=p(e.map(e=>[{inserted:Ae(),retry:0,value:e}]),(e,n)=>{let r,o=0;const a=[],c=[];for(r=0;r<e.length;r++){const s=e[r],f=Ae();if(s.inserted+i>f){c.push(s);continue}if(s.inserted+l<f)continue;if(f-n>=10){o=1;break}const u=t(s.value);void 0!==u&&a.push(u)}if(o)for(let t=r;t<e.length;t++){const n=e[t];n.retry+=1,n.retry>=s||c.push(n)}return{done:a,fail:c}},1,n);return{trigger:e,processed:o,connect:t=>{ee({node:[],parent:t,child:e,family:{type:'crosslink',owners:[t,e]}})}}}function g({trigger:e=ie(),fn:t,priority:n="low",timeout:l=1/0,batchWindow:i=0,retries:s=1/0,mark:r=e.shortName,flatten:o}){const a=p(e.map(e=>{const t=[],n=Ae();for(let l=0;l<e.length;l++){const i=o(e[l]);for(let e=0;e<i.length;e++)t.push({inserted:n,retry:0,value:i[e]})}return t}),(e,n)=>{let r,o=0;const a=[],c=[];for(r=0;r<e.length;r++){const s=e[r],f=Ae();if(s.inserted+i>f){c.push(s);continue}if(s.inserted+l<f)continue;if(f-n>=10){o=1;break}const u=t(s.value);void 0!==u&&a.push(u)}if(o)for(let t=r;t<e.length;t++){const n=e[t];n.retry+=1,n.retry>=s||c.push(n)}return{done:a,fail:c}},1,n);return{trigger:e,processed:a,connect:t=>{ee({node:[He],parent:t,child:e,family:{type:'crosslink',owners:[t,e]}})}}}function m(e,t,n){f(e,t.watch(n))}function b(e,t,n){ee({node:[Je],parent:t,child:[Ke],family:{type:'crosslink',owners:e},scope:{handler:n},meta:{op:'debounceRaf'}}),re.store(t)&&se(Ke,{data:t.getState(),handler:n},1)}function y(e,t,n,l){re.unit(n)?(e?m:b)(t,n,l):l(n)}function v(e,t=e.child.length-1){for(let n=t;n>=0;n--){const t=e.child[n];switch(t.node.type){case'element':case'using':if(!t.visible)continue;return t}const l=v(t);if(l)return l}return null}function k(e){if(!e.parent)return null;switch(e.parent.node.type){case'element':case'using':{const t=v(e.parent,e.parent.child.indexOf(e)-1);if(t)return t;break}case'list':case'listItem':{let t=e,n=e.parent;for(;n;){const e=v(n,n.child.indexOf(t)-1);if(e)return e;t=n,n=n.parent}break}}return null}function w(e){return''!==e&&0!==e&&(0==e||null==e)}function x(e,t,n){w(n)?delete e[t]:e[t]=`${n}`}function E(e,t,n,l){if(n.visible=l,l){if(!t.contains(e)){const l=k(n);l&&t.contains(l.targetElement)?l.targetElement.after(e):t.appendChild(e)}}else e.remove()}function S(e,t,n){if(null===n)return;const l=he.get().parent.targetElement;b(t,n,E.bind(null,e,l,he.get()))}function C(e,t,n){if(w(n)){switch(t){case'value':delete e.value;break;case'checked':e.checked=0;break;case'spellcheck':if(0==n)return void e.setAttribute('spellcheck','false')}e.removeAttribute(t)}else{switch(t){case'value':e.value=`${n}`;break;case'checked':e.checked=`${n}`}e.setAttribute(t,`${n}`)}}function N(e,t,n,l,i,s){const r=e.createSVGTransform();switch(s){case'translate':case'scale':l=(e=>re.store(e)?e:re.store(e.x)?re.store(e.y)?oe({x:e.x,y:e.y}):e.x.map(nt.bind(null,e.y)):re.store(e.y)?e.y.map(lt.bind(null,e.x)):e)(l)}y(0,t,l,i.bind(null,r)),n.appendItem(r)}function _(e,t){const n=Se.createTextNode(`${t}`),l=e.firstChild;l?l.replaceWith(n):e.appendChild(n)}function I(e){e.focus()}function A(e){e.blur()}function R(e,t,n){'function'==typeof t&&(n=t,t={}),void 0===t&&(t={});const{noAppend:l=0}=t,s=he.get(),r=s?s.namespace:'html';let o=r,u='html';'type'in t?(u=t.type,o=t.type):o=u='svg'===r?'svg':'html','svg'===e&&(u='svg',o='svg');const h='svg'===u?Se.createElementNS('http://www.w3.org/2000/svg',e):Se.createElement(e);'foreignObject'===r?(h.setAttribute('xmlns','http://www.w3.org/1999/xhtml'),o='html'):'svg'===e?(h.setAttribute('xmlns','http://www.w3.org/2000/svg'),o='svg'):'foreignObject'===e&&(o='foreignObject');const p=i(),d={type:'element',pure:0,tag:e,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},g={parent:null,signal:p,namespace:o,targetElement:h,svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:d,mountStatus:'initial',visible:1};s&&c(s,g),'svg'===e?g.svgRoot=h:s&&(g.svgRoot=s.svgRoot),he.replace(g),n?((e,t,n,l)=>{let i=0;fe.push({node:t,append:[],reverse:0});try{le(e,l),i=1}finally{a(fe.pop()),i||he.replace(n)}})(p,h,s,n):(d.pure=1,X(t));const m=(()=>{const e=(()=>{const e=he.getElementNode(),t={attr:{},data:{},visible:null,text:null,styleVar:{},styleProp:{},handler:e.handler,transform:e.transform,focus:e.focus,blur:e.blur};for(let n=0;n<e.attr.length;n++){const l=e.attr[n];for(const e in l)t.attr[e]=l[e]}for(let n=0;n<e.data.length;n++){const l=e.data[n];for(const e in l)t.data[e]=l[e]}e.visible.length>0&&(t.visible=e.visible[e.visible.length-1]),e.text.length>0&&(t.text=e.text[e.text.length-1]);for(let n=0;n<e.styleVar.length;n++){const l=e.styleVar[n];for(const e in l)t.styleVar[e]=l[e]}for(let n=0;n<e.styleProp.length;n++){const l=e.styleProp[n];for(const e in l)t.styleProp[e]=l[e]}return t})(),t=he.get(),n=t.targetElement,l=t.signal;return((e,t,n)=>{for(const l in n)y('value'!==l&&'checked'!==l&&'min'!==l&&'max'!==l,t,n[l],C.bind(null,e,l))})(n,l,e.attr),((e,t,n)=>{for(const l in n)y(0,t,n[l],x.bind(null,e.dataset,l))})(n,l,e.data),((e,t,n)=>{for(let l=0;l<n.length;l++){const{options:i,map:s}=n[l];for(const t in s)e.addEventListener(t,s[t],i);f(t,Qe.bind(null,e,n[l]))}})(n,l,e.handler),((e,t,n)=>{const l=e.style;for(const e in n)y(0,t,n[e],et.bind(null,l,e))})(n,l,e.styleProp),((e,t,n)=>{const l=e.style;for(const e in n)y(0,t,n[e],tt.bind(null,l,`--${e}`))})(n,l,e.styleVar),((e,t,n)=>{const l=he.get();if('svg'!==l.namespace)return;if(0===n.length)return;const i=e.transform.baseVal,s=l.svgRoot;for(let e=0;e<n.length;e++){const l=n[e];for(const e in l)N(s,t,i,l[e],st[e],e)}})(n,l,e.transform),((e,t,n)=>{null!==n&&(re.unit(n)?b(t,n,_.bind(null,e)):_(e,n))})(n,l,e.text),S(n,l,e.visible),((e,t,n)=>{for(let l=0;l<n.length;l++)y(1,t,n[l],I.bind(null,e))})(n,l,e.focus),((e,t,n)=>{for(let l=0;l<n.length;l++)y(1,t,n[l],A.bind(null,e))})(n,l,e.blur),e})();he.replace(s),g.visible=!m.visible||m.visible.getState(),l||fe.length>0&&g.visible&&fe[fe.length-1].append.push(h)}function O(e,t){return e.bind(null,t)}function $(t,n){const l=he.get();if(Array.isArray(n)){const i=[];for(let e=0;e<n.length;e++)i[e]=t.map(O(P,n[e]));return l&&e(l.signal,i),i}if('object'==typeof n&&null!==n){const i=[],s={};for(const e in n)s[e]=t.map(O(P,n[e])),i.push(s[e]);return l&&e(l.signal,i),s}const i=t.map(O(P,n));return l&&e(l.signal,i),i}function V(t,n){const l=t.map(O(P,n)),i=he.get();return i&&e(i.signal,[l]),l}function P(e,t){return t[e]}function D({key:e,child:t,source:n},l){T({source:n,key:e},({store:n,key:i,signal:s})=>{const[r]=$(n,[t]);l({store:n,key:i,signal:s},()=>{D({key:e,child:t,source:r},l)})})}function T(t,n){let l,s,r=0;re.store(t)?(s=at,l=t):(s=O(ct,t.key),l=t.source,r=!!t.reverse);const o=he.get(),a=i(),u={parent:o,signal:a,namespace:o.namespace,targetElement:o.targetElement,svgRoot:o.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'list',pure:0,reverse:r,key:re.store(t)?{type:'index'}:{type:'key',key:t.key},store:l,cb:n},mountStatus:'initial',visible:1};c(o,u),he.replace(u);const h={parentNode:o.targetElement,cb:n,shortName:l.shortName,reverse:r,parentStack:u,getID:s},p=ae(j(h,[],l.getState()));e(a,[p]),f(a,O(ut,p)),ce({source:p,clock:l,fn:O(j,h),target:p}),he.replace(o)}function j(s,r,o){const a=Array(o.length).fill(0),f=o.map(s.getID),u=[],h=[],p=[];for(let e=0;e<r.length;e++){const t=r[e],n=t.node,l=f.indexOf(n.key);-1!==l?(h.push(t),a[l]=1,n.store.getState()!==o[l]&&se(n.store,o[l],1)):p.push(t)}if(p.length>0){for(let e=0;e<p.length;e++){const i=p[e],{node:s,locality:r}=i;s.active=0,s.store=null,t(r.sibling.left.ref,r.sibling.right.ref),n(i,null),l(i,null)}se(ft,p,1)}let d=h.length>0?h[h.length-1]:null;for(let n=0;n<o.length;n++){if(a[n])continue;const l=o[n],r=ae(l),f=i();e(f,[r]);const p=s.getID(l,n),g={parent:s.parentStack,signal:f,namespace:s.parentStack.namespace,targetElement:s.parentStack.targetElement,svgRoot:s.parentStack.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'listItem',pure:0,key:p,index:p,store:r,signal:f,active:1,nodes:[]},mountStatus:'initial',visible:1};t(d,g),d=g,c(s.parentStack,g),u.push(g),h.push(g)}return u.length>0&&se(ot,{context:s,list:u},1),h}function F(e){const t=he.get();t&&ee({node:[],parent:e,child:t.signal,family:{type:'crosslink',owners:[t.signal,e]}})}function M(t){const n=he.get();return n&&e(n.signal,[t]),t}function z(){const e=he.get();if('element'!==e.node.type&&'using'!==e.node.type)throw Error(`this extension can be used only with element nodes, got "${e.node.type}"`)}function L(e){let t;return W(e=>{t=e}),(...n)=>{if(t)return t[e](...n)}}function W(e){const t=he.get();t.targetElement.__STATIC__||e(t.targetElement)}function X(e){e.attr&&Y(e.attr),e.data&&q(e.data),e.transform&&G(e.transform),'text'in e&&B(e.text),'visible'in e&&U(e.visible),(e.style||e.styleVar)&&Z({prop:e.style,val:e.styleVar}),e.focus&&J(e.focus),e.handler&&H(e.handler)}function Y(e){z(),he.getElementNode().attr.push(e)}function q(e){z(),he.getElementNode().data.push(e)}function G(e){z(),he.getElementNode().transform.push(e)}function B(e){z(),he.getElementNode().text.push(e)}function U(e){z(),he.getElementNode().visible.push(e)}function Z({prop:e,val:t}){z(),e&&he.getElementNode().styleProp.push(e),t&&he.getElementNode().styleVar.push(t)}function H(e,t){z(),void 0===t&&(t=e,e={});const{passive:n=1,capture:l=0}=e;he.getElementNode().handler.push({options:{passive:n,capture:l},map:t})}function J({focus:e,blur:t}){z();const n=he.getElementNode();e&&n.focus.push(e),t&&n.blur.push(t)}function K(e,{fn:t}){return console.error('separate map method is deprecated, use store.map as usual'),M(e.map(t))}function Q({source:e,fn:t}){return console.error('separate combine method is deprecated, use common combine method as usual'),M(oe(e,t))}import{createNode as ee,step as te,clearNode as ne,withRegion as le,createEvent as ie,launch as se,is as re,combine as oe,createStore as ae,sample as ce}from'effector';const fe=[];let ue;const he={get:()=>ue,replace(e){ue=e},getElementNode:()=>ue.node},pe=e=>e.graphite||e,de=e=>e.family.owners,ge=e=>e.family.links,me=ee({node:[te.run({fn(e){ne(e)}})]}),be=te.compute({fn(e,i){i.self.next.push(me);const{stack:s}=i,{parent:r}=s,{left:o,right:a}=s.locality.sibling;r&&(r.locality.child.last.ref===s&&(r.locality.child.last.ref=o.ref),r.locality.child.first.ref===s&&(r.locality.child.first.ref=a.ref)),o.ref&&o.ref.locality.sibling.right.ref===s&&a.ref&&a.ref.locality.sibling.left.ref===s?t(o.ref,a.ref):o.ref&&o.ref.locality.sibling.right.ref===s?n(o.ref,null):a.ref&&a.ref.locality.sibling.left.ref===s&&l(a.ref,null)}}),ye=te.compute({fn:(e,{self:t})=>t}),ve=/[^a-zA-Z0-9\-]/g,ke=/[\\<>"]/g;class we{constructor(){this.properties=Object.create(null)}setProperty(e,t){this.properties[s(e)]=r(t)}removeProperty(e){delete this.properties[s(e)]}}class xe{constructor(){this.items=[]}appendItem(e){this.items.push(e)}}class Ee{constructor(){this.value=''}setTranslate(e,t){this.value=`translate(${e} ${t})`}setScale(e,t){this.value=`scale(${e} ${t})`}setRotate(e,t,n){this.value=0!==t||0!==n?`rotate(${e} ${t} ${n})`:`rotate(${e})`}setSkewX(e){this.value=`skewX(${e})`}setSkewY(e){this.value=`skewY(${e})`}}(new class{constructor(){this.child={first:null,last:null},this.sibling={left:null,right:null},this.parent=null,this.tagName='',this.namespaceURI='http://www.w3.org/1999/xhtml',this.dataset=Object.create(null),this.style=new we,this.firstChild=null,this.transform={baseVal:new xe},this.isFragment=1,this.attributes=Object.create(null),this.textContent=null,this.__STATIC__=1}appendChild(e){if(e.parent&&e.remove(),e.isFragment&&null===e.textContent){let t,n=e.firstChild;for(;n;)t=n.sibling.right,this.appendChild(n),n=t}else this.child.last?(this.child.last.sibling.right=e,e.sibling.left=this.child.last):(this.child.first=e,this.firstChild=e),this.child.last=e,e.parent=this}prepend(e){e.parent&&e.remove(),this.child.last?(this.child.first.sibling.left=e,e.sibling.right=this.child.first):(this.child.first=e,this.child.last=e),this.child.first=e,this.firstChild=e,e.parent=this}contains(e){let t=e;for(;t;){if(t===this)return 1;t=t.parent}return 0}remove(){if(!this.parent)return;const{parent:e}=this;e.child.first===this&&e.child.last===this?(e.firstChild=null,e.child.first=null,e.child.last=null):e.child.first===this?(e.child.first=this.sibling.right,e.firstChild=this.sibling.right,this.sibling.right.sibling.left=null):e.child.last===this?(e.child.last=this.sibling.left,this.sibling.left.sibling.right=null):(this.sibling.right.sibling.left=this.sibling.left,this.sibling.left.sibling.right=this.sibling.right),this.sibling.left=null,this.sibling.right=null,this.parent=null}addEventListener(e,t,n){}removeEventListener(e,t,n){}setAttribute(e,t){this.attributes[s(e)]=r(t)}removeAttribute(e){delete this.attributes[s(e)]}replaceWith(e){if(!this.parent)return;const{parent:t}=this;e.parent&&e.remove(),t.child.first===this&&t.child.last===this?(t.firstChild=e,t.child.first=e,t.child.last=e):t.child.first===this?(t.child.first=e,t.firstChild=e,this.sibling.right.sibling.left=e):t.child.last===this?(t.child.last=e,this.sibling.left.sibling.right=e):(this.sibling.right.sibling.left=e,this.sibling.left.sibling.right=e),e.sibling.left=this.sibling.left,e.sibling.right=this.sibling.right,e.parent=t,this.sibling.left=null,this.sibling.right=null,this.parent=null}focus(){}blur(){}createSVGTransform(){return new Ee}}).isBody=1;let Se='undefined'!=typeof document?document:null;const Ce=te.compute({fn(e,t){if(!t.stack)return e;const{stack:n}=t;t.stack=null;const l=n.parent.child.indexOf(n);return-1!==l&&n.parent.child.splice(l,1),n.parent=null,e}}),Ne=te.run({fn(e,{fn:t}){t(e)}});let _e,Ie,Ae;_e=()=>{},Ie=()=>{},Ae='undefined'!=typeof performance&&performance.now?()=>performance.now():'undefined'!=typeof process&&process.hrtime?()=>{const e=process.hrtime();return(1e9*e[0]+e[1])/1e6}:()=>Date.now();const Re=ie();let Oe,$e=0,Ve=0;const Pe='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0),De='undefined'!=typeof cancelAnimationFrame?cancelAnimationFrame:clearTimeout,Te=()=>{Ve||(Ve=1,Oe=Pe(u))},je=new Map,Fe=new Map,Me=new Map,ze=new Map;let Le=0,We=0;const Xe=ee({node:[te.run({fn:()=>{}}),te.filter({fn:()=>0===Fe.size&&0===Me.size?0:Ae()-We>=10?0:(De(Oe),$e=1,Ve=0,1)})],child:[Re]});Re.watch(()=>{if(Ve)return;if(0===Fe.size&&0===Me.size)return void($e=0);let e=0;$e||(We=Ae()),$e=0;for(const[t,n]of Fe){if(Ae()-We>=10){Te(),e=1;break}Fe.delete(t),se({target:je.get(t),params:n,defer:1})}if(!e)for(const[t,n]of Me){if(Ae()-We>=10){Te(),e=1;break}Me.delete(t),se({target:je.get(t),params:n,defer:1})}se({target:Xe,params:null,defer:1})});const Ye=te.compute({fn:({done:e})=>e}),qe=te.compute({fn:({fail:e})=>e}),Ge=te.filter({fn:e=>e.length>0}),Be=te.compute({fn(e,{taskID:t}){h(t,1,e)}}),Ue=te.compute({fn(e,{taskID:t,flat:n}){h(t,n,e)}}),Ze=te.run({fn:(e,{fn:t})=>t(e,We)}),He=te.compute({fn:e=>[e]}),Je=te.run({fn:(e,{handler:t})=>({data:e,handler:t})}),{trigger:Ke}=d({priority:'high',mark:'domOperation',fn({handler:e,data:t}){e(t)}}),Qe=(e,{map:t,options:n})=>{for(const l in t)e.removeEventListener(l,t[l],n)},et=(e,t,n)=>{w(n)?delete e[t]:e[t]=n},tt=(e,t,n)=>{w(n)?e.removeProperty(t):e.setProperty(t,n)},nt=(e,t)=>({x:t,y:e}),lt=(e,t)=>({x:e,y:t}),st={translate(e,{x:t=0,y:n=0}){e.setTranslate(t,n)},scale(e,{x:t=0,y:n=0}){e.setScale(t,n)},rotate(e,t){'number'==typeof t?e.setRotate(t,0,0):e.setRotate(t.angle||0,t.x||0,t.y||0)},skewX(e,t){e.setSkewX(t)},skewY(e,t){e.setSkewY(t)}},{trigger:rt}=d({mark:'append DOM nodes',fn:e=>{for(let t=0;t<e.append.length;t++){const n=e.append[t];if(0==n.listItem.active)continue;if(0===n.appended.length)continue;const l=Se.createDocumentFragment();if(e.reverse)for(let e=n.appended.length-1;e>=0;e--)l.appendChild(n.appended[e]);else for(let e=0;e<n.appended.length;e++)l.appendChild(n.appended[e]);const i=k(n.listItemStack);i&&e.node.contains(i.targetElement)?e.reverse?i.targetElement.before(l):i.targetElement.after(l):e.node.appendChild(l)}}}),{trigger:ot}=d({mark:'addRecords',fn:({context:e,list:t})=>{const{parentStack:n,parentNode:l,cb:i,reverse:s}=e,r=he.get();he.replace(n);const o=[],a=[];fe.push({node:l,append:a,reverse:s});for(let e=0;e<t.length;e++){const n=t[e],l=n.node;if(l.active){he.replace(n),le(n.signal,O(i,l));for(let e=0;e<a.length;e++)l.nodes.push(a[e]);o.push({listItemStack:n,appended:a.slice(),listItem:l}),a.length=0}}fe.pop(),o.length>0&&se({target:rt,params:{node:l,append:o,reverse:s},defer:1}),he.replace(r)}}),at=(e,t)=>t,ct=(e,t)=>t[e],ft=ie();g({trigger:ft,priority:'high',mark:'runSignals',flatten:({signal:e})=>[e],fn:e=>{e.scope&&se(e,null,0)}}),g({trigger:ft,priority:'high',mark:'remove DOM nodes',flatten({node:e}){const{nodes:t}=e;return t},fn:e=>(e.remove(),e)});const ut=e=>{const t=e.getState();for(let e=0;e<t.length;e++){const n=t[e].node;n.active=0,n.store=null}se(ft,t,1)};export{Y as attr,Q as combine,q as data,F as explicitUnmount,J as focus,R as h,H as handler,T as list,K as map,W as node,L as nodeMethod,$ as remap,M as signalOwn,X as spec,V as storeField,Z as style,B as text,G as transform,D as tree,o as using,U as visible}; | ||
//# sourceMappingURL=effector-dom.es.js.map |
@@ -13,10 +13,20 @@ import {Store, Event, Step} from 'effector' | ||
export type TransformMap = { | ||
translate: StoreOrData<{ | ||
x?: number | ||
y?: number | ||
}> | ||
scale: StoreOrData<{ | ||
x?: number | ||
y?: number | ||
}> | ||
translate: | ||
| Store<{ | ||
x?: number | ||
y?: number | ||
}> | ||
| { | ||
x?: StoreOrData<number> | ||
y?: StoreOrData<number> | ||
} | ||
scale: | ||
| Store<{ | ||
x?: number | ||
y?: number | ||
}> | ||
| { | ||
x?: StoreOrData<number> | ||
y?: StoreOrData<number> | ||
} | ||
rotate: StoreOrData< | ||
@@ -23,0 +33,0 @@ | { |
{ | ||
"name": "effector-dom", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Effector package for working with dom", | ||
@@ -12,3 +12,3 @@ "main": "effector-dom.cjs.js", | ||
"peerDependencies": { | ||
"effector": "^20.11.0" | ||
"effector": "^20.11.5" | ||
}, | ||
@@ -15,0 +15,0 @@ "keywords": [ |
@@ -1,2 +0,2 @@ | ||
function e(e){return`-${e.toLowerCase()}`}function t(e){switch(e){case'&':return'&';case'<':return'<';case'>':return'>';case'"':return'"';case"'":return''';default:return e}}function n(e){switch(e=String(e)){case'__proto__':case'__defineGetter__':case'__defineSetter__':case'constructor':case'prototype':case'hasOwnProperty':case'toString':case'valueOf':return'blacklisted';default:return e.replace(B,'')}}function s(e){return String(e).replace(H,'')}function r(){return new Q}function i(t){const r=[];(function t(r,i){if(null!==r.textContent&&i.push(r.textContent),r.isFragment){let e=r.firstChild;for(;e;)t(e,i),e=e.sibling.right;return}i.push('<',r.tagName);for(const e in r.attributes)i.push(' ',e,'=','"',s(r.attributes[e]),'"');for(const t in r.dataset)i.push(' ','data-',n(t).replace(J,e),'=','"',s(r.dataset[t]),'"');const l=[];for(const e in r.style.properties)if(e.startsWith('--'))l.push(`${e}: ${r.style.properties[e]}`);else{const t=e.replace(/[A-Z]/,e=>`-${e.toLowerCase()}`);l.push(`${t}: ${r.style.properties[e]}`)}if(l.length>0&&i.push(' ','style','=','"',l.join(';'),'"'),r.transform.baseVal.items.length>0){i.push(' ','transform','=','"');const e=r.transform.baseVal.items.map(({value:e})=>e);i.push(e.join(' '),'"')}if(!r.firstChild)return void i.push('meta'===r.tagName||'link'===r.tagName?'>':'/>');i.push('>');let o=r.firstChild;for(;o;)t(o,i),o=o.sibling.right;i.push('</',r.tagName,'>')})(t,r);const i=r.join('');return function e(t){if('html'===t.tagName)return 1;if(t.isFragment&&null===t.textContent){const n=t.firstChild;if(n&&t.child.last===n)return e(n)}return 0}(t)?`<!DOCTYPE html>${i}`:i}function l(e,t){const n=ce(e);for(let e=0;e<t.length;e++){const s=ce(t[e]);s.family.type='crosslink';const r=ue(s),i=fe(n);r.includes(n)||r.push(n),i.includes(s)||i.push(s)}}function o(e,t){a(e,t),c(t,e)}function a(e,t){e&&e!==t&&(e.locality.sibling.right.ref=t)}function c(e,t){e&&e!==t&&(e.locality.sibling.left.ref=t)}function u(){const e={stack:null},t=ae.get(),n=effector.createNode({node:[pe,ge],parent:[t&&t.signal].filter(Boolean),meta:{unit:'signal'},scope:e});return e.self=n,n}function f(e,t){const n=e.namespaceURI,s=e.tagName.toLowerCase(),r='http://www.w3.org/2000/svg'===n?'svg':'foreignObject'===s?'foreignObject':'html',i=ae.get(),l={parent:i,signal:i&&i.signal?i.signal:u(),namespace:r,targetElement:e,svgRoot:'svg'===s?e:i?i.svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'using',pure:0,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},mountStatus:'initial',visible:1};ae.replace(l),le.push({node:e,append:[],reverse:0});try{effector.withRegion(l.signal,t)}finally{h(le.pop()),ae.replace(i)}}function h({node:e,append:t,reverse:n=0}){if(0===t.length)return;const s=ie.createDocumentFragment();if(n){for(let e=t.length-1;e>=0;e--)s.appendChild(t[e]);e.prepend(s)}else{for(let e=0;e<t.length;e++)s.appendChild(t[e]);e.appendChild(s)}}function p(e,t){t.parent=e,t.signal.seq.push(de),t.signal.scope.stack=t,e.child.push(t)}function g(e,t){return effector.createNode({node:[me],parent:e,meta:{op:'watch'},scope:{fn:t},family:{type:'crosslink',owners:[e]}})}function d(){Ee=0,ye('batchRAF'),ke(),ve('batchRAF')}function m(e,t,n){const s=(e=>'high'===Oe.get(e)?$e:Ae)(e);let r=s.get(e);if(r||(r=[],s.set(e,r)),t)for(let e=0;e<n.length;e++)r.push(n[e]);else r.push(n);Re()}function b(e,t,n=0,s="low"){const r=++Ie,i=effector.createEvent(),o=effector.is.store(a=e)?a.updates:a;var a;const c={type:'crosslink',owners:[o,i]};return effector.createNode({node:[Me],parent:[o],scope:{taskID:r,flat:n},family:c}),l(e,[i]),_e.set(r,effector.createNode({node:[Le],child:[effector.createNode({node:[De,Te,je],scope:{taskID:r},family:c}),effector.createNode({node:[Ve,Te],child:[i],family:c})],scope:{fn:t},family:c})),Oe.set(r,s),i}function y({trigger:e=effector.createEvent(),fn:t,priority:n="low",timeout:s=1/0,batchWindow:r=0,retries:i=1/0,mark:l=e.shortName}){const o=b(e.map(e=>[{inserted:we(),retry:0,value:e}]),(e,n)=>{let o,a=0;const c=[],u=[];for(ye(l),o=0;o<e.length;o++){const i=e[o],l=we();if(i.inserted+r>l){u.push(i);continue}if(i.inserted+s<l)continue;if(l-n>=be){a=1;break}const f=t(i.value);void 0!==f&&c.push(f)}if(a)for(let t=o;t<e.length;t++){const n=e[t];n.retry+=1,n.retry>=i||u.push(n)}return ve(l),{done:c,fail:u}},1,n);return{trigger:e,processed:o,connect:t=>{effector.createNode({node:[],parent:t,child:e,family:{type:'crosslink',owners:[t,e]}})}}}function v({trigger:e=effector.createEvent(),fn:t,priority:n="low",timeout:s=1/0,batchWindow:r=0,retries:i=1/0,mark:l=e.shortName,flatten:o}){const a=b(e.map(e=>{const t=[],n=we();for(let s=0;s<e.length;s++){const r=o(e[s]);for(let e=0;e<r.length;e++)t.push({inserted:n,retry:0,value:r[e]})}return t}),(e,n)=>{let o,a=0;const c=[],u=[];for(ye(l),o=0;o<e.length;o++){const i=e[o],l=we();if(i.inserted+r>l){u.push(i);continue}if(i.inserted+s<l)continue;if(l-n>=be){a=1;break}const f=t(i.value);void 0!==f&&c.push(f)}if(a)for(let t=o;t<e.length;t++){const n=e[t];n.retry+=1,n.retry>=i||u.push(n)}return ve(l),{done:c,fail:u}},1,n);return{trigger:e,processed:a,connect:t=>{effector.createNode({node:[qe],parent:t,child:e,family:{type:'crosslink',owners:[t,e]}})}}}function w(e,t,n){g(e,t.watch(n))}function k(e,t,n){effector.createNode({node:[ze],parent:t,child:[We],family:{type:'crosslink',owners:e},scope:{handler:n},meta:{op:'debounceRaf'}}),effector.is.store(t)&&effector.launch(We,{data:t.getState(),handler:n},1)}function x(e,t,n,s){effector.is.unit(n)?(e?w:k)(t,n,s):s(n)}function N(e){return''!==e&&0!==e&&(0==e||null==e)}function E(e,t,n){N(n)?delete e[t]:e[t]=`${n}`}function S(e,t=e.child.length-1){for(let n=t;n>=0;n--){const t=e.child[n];switch(t.node.type){case'element':case'using':if(!t.visible)continue;return t}const s=S(t);if(s)return s}return null}function C(e,t,n,s){if(n.visible=s,s){if(!t.contains(e)){const s=(e=>{if(!e.parent)return null;switch(e.parent.node.type){case'element':case'using':{const t=S(e.parent,e.parent.child.indexOf(e)-1);if(t)return t;break}case'list':case'listItem':{let t=e,n=e.parent;for(;n;){const e=S(n,n.child.indexOf(t)-1);if(e)return e;t=n,n=n.parent}break}}return null})(n);s&&t.contains(s.targetElement)?s.targetElement.after(e):t.appendChild(e)}}else e.remove()}function R(e,t,n){if(N(n)){switch(t){case'value':delete e.value;break;case'checked':delete e.checked;break;case'spellcheck':if(0==n)return void e.setAttribute('spellcheck','false')}e.removeAttribute(t)}else{switch(t){case'value':e.value=`${n}`;break;case'checked':e.checked=`${n}`}e.setAttribute(t,`${n}`)}}function _(e,t,n,s,r){const i=e.createSVGTransform();x(0,t,s,r.bind(null,i)),n.appendItem(i)}function $(e,t){const n=ie.createTextNode(`${t}`),s=e.firstChild;s?s.replaceWith(n):e.appendChild(n)}function A(e){e.focus()}function O(e){e.blur()}function I(e,t){return e.bind(null,t)}function F(e,t){const n=ae.get();if(Array.isArray(t)){const s=[];for(let n=0;n<t.length;n++)s[n]=e.map(I(P,t[n]));return n&&l(n.signal,s),s}if('object'==typeof t&&null!==t){const s=[],r={};for(const n in t)r[n]=e.map(I(P,t[n])),s.push(r[n]);return n&&l(n.signal,s),r}const s=e.map(I(P,t));return n&&l(n.signal,s),s}function P(e,t){return t[e]}function V(e,t){let n,s,r=0;effector.is.store(e)?(s=He,n=e):(s=I(Je,e.key),n=e.source,r=!!e.reverse);const i=ae.get(),o=u(),a={parent:i,signal:o,namespace:i.namespace,targetElement:i.targetElement,svgRoot:i.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'list',pure:0,reverse:r,key:effector.is.store(e)?{type:'index'}:{type:'key',key:e.key},store:n,cb:t},mountStatus:'initial',visible:1};p(i,a),ae.replace(a);const c={parentNode:i.targetElement,cb:t,shortName:n.shortName,reverse:r,parentStack:a,getID:s},f=effector.createStore(D(c,[],n.getState()));l(o,[f]),g(o,I(Qe,f)),effector.sample({source:f,clock:n,fn:I(D,c),target:f}),ae.replace(i)}function D(e,t,n){ye('list update ['+e.shortName+']');const s=Array(n.length).fill(0),r=n.map(e.getID),i=[],f=[],h=[];for(let e=0;e<t.length;e++){const i=t[e],l=i.node,o=r.indexOf(l.key);-1!==o?(f.push(i),s[o]=1,l.store.getState()!==n[o]&&effector.launch(l.store,n[o],1)):h.push(i)}if(h.length>0){for(let e=0;e<h.length;e++){const t=h[e],{node:n,locality:s}=t;n.active=0,n.store=null,o(s.sibling.left.ref,s.sibling.right.ref),a(t,null),c(t,null)}effector.launch(Ke,h,1)}let g=f.length>0?f[f.length-1]:null;for(let t=0;t<n.length;t++){if(s[t])continue;const r=n[t],a=effector.createStore(r),c=u();l(c,[a]);const h=e.getID(r,t),d={parent:e.parentStack,signal:c,namespace:e.parentStack.namespace,targetElement:e.parentStack.targetElement,svgRoot:e.parentStack.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'listItem',pure:0,key:h,index:h,store:a,signal:c,active:1,nodes:[]},mountStatus:'initial',visible:1};o(g,d),g=d,p(e.parentStack,d),i.push(d),f.push(d)}return i.length>0&&effector.launch(Be,{context:e,list:i},1),ve('list update ['+e.shortName+']'),f}function T(e){const t=ae.get();return t&&l(t.signal,[e]),e}function j(){const e=ae.get();if('element'!==e.node.type&&'using'!==e.node.type)throw Error(`this extension can be used only with element nodes, got "${e.node.type}"`)}function M(e){const t=ae.get();t.targetElement.__STATIC__||e(t.targetElement)}function L(e){e.attr&&q(e.attr),e.data&&z(e.data),e.transform&&W(e.transform),'text'in e&&Y(e.text),'visible'in e&&U(e.visible),(e.style||e.styleVar)&&X({prop:e.style,val:e.styleVar}),e.focus&&Z(e.focus),e.handler&&G(e.handler)}function q(e){j(),ae.getElementNode().attr.push(e)}function z(e){j(),ae.getElementNode().data.push(e)}function W(e){j(),ae.getElementNode().transform.push(e)}function Y(e){j(),ae.getElementNode().text.push(e)}function U(e){j(),ae.getElementNode().visible.push(e)}function X({prop:e,val:t}){j(),e&&ae.getElementNode().styleProp.push(e),t&&ae.getElementNode().styleVar.push(t)}function G(e,t){j(),void 0===t&&(t=e,e={});const{passive:n=1,capture:s=0}=e;ae.getElementNode().handler.push({options:{passive:n,capture:s},map:t})}function Z({focus:e,blur:t}){j();const n=ae.getElementNode();e&&n.focus.push(e),t&&n.blur.push(t)}Object.defineProperty(exports,'__esModule',{value:1});var effector=require('effector');const B=/[^a-zA-Z0-9\-]/g,H=/[\\<>"]/g,J=/[A-Z]/g,K=/[&<>'"]/g;class Q{constructor(){this.child={first:null,last:null},this.sibling={left:null,right:null},this.parent=null,this.tagName='',this.namespaceURI='http://www.w3.org/1999/xhtml',this.dataset=Object.create(null),this.style=new ee,this.firstChild=null,this.transform={baseVal:new te},this.isFragment=1,this.attributes=Object.create(null),this.textContent=null,this.__STATIC__=1}appendChild(e){if(e.parent&&e.remove(),e.isFragment&&null===e.textContent){let t,n=e.firstChild;for(;n;)t=n.sibling.right,this.appendChild(n),n=t}else this.child.last?(this.child.last.sibling.right=e,e.sibling.left=this.child.last):(this.child.first=e,this.firstChild=e),this.child.last=e,e.parent=this}prepend(e){e.parent&&e.remove(),this.child.last?(this.child.first.sibling.left=e,e.sibling.right=this.child.first):(this.child.first=e,this.child.last=e),this.child.first=e,this.firstChild=e,e.parent=this}contains(e){let t=e;for(;t;){if(t===this)return 1;t=t.parent}return 0}remove(){if(!this.parent)return;const{parent:e}=this;e.child.first===this&&e.child.last===this?(e.firstChild=null,e.child.first=null,e.child.last=null):e.child.first===this?(e.child.first=this.sibling.right,e.firstChild=this.sibling.right,this.sibling.right.sibling.left=null):e.child.last===this?(e.child.last=this.sibling.left,this.sibling.left.sibling.right=null):(this.sibling.right.sibling.left=this.sibling.left,this.sibling.left.sibling.right=this.sibling.right),this.sibling.left=null,this.sibling.right=null,this.parent=null}addEventListener(e,t,n){}removeEventListener(e,t,n){}setAttribute(e,t){this.attributes[n(e)]=s(t)}removeAttribute(e){delete this.attributes[n(e)]}replaceWith(e){if(!this.parent)return;const{parent:t}=this;e.parent&&e.remove(),t.child.first===this&&t.child.last===this?(t.firstChild=e,t.child.first=e,t.child.last=e):t.child.first===this?(t.child.first=e,t.firstChild=e,this.sibling.right.sibling.left=e):t.child.last===this?(t.child.last=e,this.sibling.left.sibling.right=e):(this.sibling.right.sibling.left=e,this.sibling.left.sibling.right=e),e.sibling.left=this.sibling.left,e.sibling.right=this.sibling.right,e.parent=t,this.sibling.left=null,this.sibling.right=null,this.parent=null}focus(){}blur(){}createSVGTransform(){return new ne}}class ee{constructor(){this.properties=Object.create(null)}setProperty(e,t){this.properties[n(e)]=s(t)}removeProperty(e){delete this.properties[n(e)]}}class te{constructor(){this.items=[]}appendItem(e){this.items.push(e)}}class ne{constructor(){this.value=''}setTranslate(e,t){this.value=`translate(${e} ${t})`}setScale(e,t){this.value=`scale(${e} ${t})`}setRotate(e,t,n){this.value=0!==t||0!==n?`rotate(${e} ${t} ${n})`:`rotate(${e})`}setSkewX(e){this.value=`skewX(${e})`}setSkewY(e){this.value=`skewY(${e})`}}const se=new Q;se.isBody=1;var re={__proto__:null,body:se,createTextNode:e=>{const n=new Q;return n.textContent=String(e).replace(K,t),n},createElement:e=>{const t=new Q;return t.tagName=n(e),t.isFragment=0,t},createElementNS:(e,t)=>{switch(e){case'http://www.w3.org/1999/xhtml':case'http://www.w3.org/2000/svg':break;default:e='http://www.w3.org/1999/xhtml'}const s=new Q;return s.tagName=n(t),s.namespaceURI=e,s.isFragment=0,s},createDocumentFragment:r,render:i};let ie='undefined'!=typeof document?document:null;const le=[];let oe;const ae={get:()=>oe,replace(e){oe=e},getElementNode:()=>oe.node},ce=e=>e.graphite||e,ue=e=>e.family.owners,fe=e=>e.family.links,he=effector.createNode({node:[effector.step.run({fn(e){effector.clearNode(e)}})]}),pe=effector.step.compute({fn(e,t){t.self.next.push(he);const{stack:n}=t,{parent:s}=n,{left:r,right:i}=n.locality.sibling;s&&(s.locality.child.last.ref===n&&(s.locality.child.last.ref=r.ref),s.locality.child.first.ref===n&&(s.locality.child.first.ref=i.ref)),r.ref&&r.ref.locality.sibling.right.ref===n&&i.ref&&i.ref.locality.sibling.left.ref===n?o(r.ref,i.ref):r.ref&&r.ref.locality.sibling.right.ref===n?a(r.ref,null):i.ref&&i.ref.locality.sibling.left.ref===n&&c(i.ref,null)}}),ge=effector.step.compute({fn:(e,{self:t})=>t}),de=effector.step.compute({fn(e,t){if(!t.stack)return e;const{stack:n}=t;t.stack=null;const s=n.parent.child.indexOf(n);return-1!==s&&n.parent.child.splice(s,1),n.parent=null,e}}),me=effector.step.run({fn(e,{fn:t}){t(e)}}),be=10;let ye,ve,we;ye=()=>{},ve=()=>{},we='undefined'!=typeof performance&&performance.now?()=>performance.now():'undefined'!=typeof process&&process.hrtime?()=>{const e=process.hrtime();return(1e9*e[0]+e[1])/1e6}:()=>Date.now();const ke=effector.createEvent();let xe,Ne=0,Ee=0;const Se='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0),Ce='undefined'!=typeof cancelAnimationFrame?cancelAnimationFrame:clearTimeout,Re=()=>{Ee||(Ee=1,xe=Se(d))},_e=new Map,$e=new Map,Ae=new Map,Oe=new Map;let Ie=0,Fe=0;const Pe=effector.createNode({node:[effector.step.run({fn:()=>{}}),effector.step.filter({fn:()=>0===$e.size&&0===Ae.size?0:we()-Fe>=be?0:(Ce(xe),Ne=1,Ee=0,1)})],child:[ke]});ke.watch(()=>{if(Ee)return;if(0===$e.size&&0===Ae.size)return void(Ne=0);let e=0;Ne||(Fe=we()),Ne=0,ye('plan');for(const[t,n]of $e){if(we()-Fe>=be){Re(),e=1;break}$e.delete(t);const s=_e.get(t);effector.launch(s,n,1)}if(!e)for(const[t,n]of Ae){if(we()-Fe>=be){Re(),e=1;break}Ae.delete(t);const s=_e.get(t);effector.launch(s,n,1)}effector.launch(Pe,null,1),ve('plan')});const Ve=effector.step.compute({fn:({done:e})=>e}),De=effector.step.compute({fn:({fail:e})=>e}),Te=effector.step.filter({fn:e=>e.length>0}),je=effector.step.compute({fn(e,{taskID:t}){m(t,1,e)}}),Me=effector.step.compute({fn(e,{taskID:t,flat:n}){m(t,n,e)}}),Le=effector.step.run({fn:(e,{fn:t})=>t(e,Fe)}),qe=effector.step.compute({fn:e=>[e]}),ze=effector.step.run({fn:(e,{handler:t})=>({data:e,handler:t})}),{trigger:We}=y({priority:'high',mark:'domOperation',fn({handler:e,data:t}){e(t)}}),Ye=(e,{map:t,options:n})=>{for(const s in t)e.removeEventListener(s,t[s],n)},Ue=(e,t,n)=>{N(n)?delete e[t]:e[t]=n},Xe=(e,t,n)=>{N(n)?e.removeProperty(t):e.setProperty(t,n)},Ge={translate(e,{x:t=0,y:n=0}){e.setTranslate(t,n)},scale(e,{x:t=0,y:n=0}){e.setScale(t,n)},rotate(e,t){'number'==typeof t?e.setRotate(t,0,0):e.setRotate(t.angle||0,t.x||0,t.y||0)},skewX(e,t){e.setSkewX(t)},skewY(e,t){e.setSkewY(t)}},{trigger:Ze}=y({mark:'append DOM nodes',fn:e=>{const t=[];for(let n=0;n<e.append.length;n++){const s=e.append[n];if(0!=s.listItem.active)for(let e=0;e<s.appended.length;e++)t.push(s.appended[e])}t.length>0&&h({node:e.node,append:t,reverse:e.reverse})}}),{trigger:Be}=y({mark:'addRecords',fn:({context:e,list:t})=>{const{shortName:n,parentStack:s,parentNode:r,cb:i,reverse:l}=e;ye('initRecord '+n);const o=ae.get();ae.replace(s);const a=[],c=[];le.push({node:r,append:c,reverse:l});for(let e=0;e<t.length;e++){const n=t[e],s=n.node;if(s.active){ae.replace(n),effector.withRegion(n.signal,I(i,s));for(let e=0;e<c.length;e++)s.nodes.push(c[e]);a.push({appended:c.slice(),listItem:s}),c.length=0}}le.pop(),a.length>0&&effector.launch(Ze,{node:r,append:a,reverse:l},1),ae.replace(o),ve('initRecord '+n)}}),He=(e,t)=>t,Je=(e,t)=>t[e],Ke=effector.createEvent();v({trigger:Ke,priority:'high',mark:'runSignals',flatten:({signal:e})=>[e],fn:e=>{e.scope&&effector.launch(e,null,0)}}),v({trigger:Ke,priority:'high',mark:'remove DOM nodes',flatten({node:e}){const{nodes:t}=e;return t},fn:e=>(e.remove(),e)});const Qe=e=>{const t=e.getState();for(let e=0;e<t.length;e++){const n=t[e].node;n.active=0,n.store=null}effector.launch(Ke,t,1)};ie=re,exports.attr=q,exports.body=se,exports.combine=({source:e,fn:t})=>T(effector.combine(e,t)),exports.createDocumentFragment=r,exports.data=z,exports.explicitUnmount=e=>{const t=ae.get();t&&effector.createNode({node:[],parent:e,child:t.signal,family:{type:'crosslink',owners:[t.signal,e]}})},exports.focus=Z,exports.h=(e,t,n)=>{'function'==typeof t&&(n=t,t={}),void 0===t&&(t={});const{noAppend:s=0}=t,r=ae.get(),i=r?r.namespace:'html';let l=i,o='html';'type'in t?(o=t.type,l=t.type):l=o='svg'===i?'svg':'html','svg'===e&&(o='svg',l='svg');const a='svg'===o?ie.createElementNS('http://www.w3.org/2000/svg',e):ie.createElement(e);'foreignObject'===i?(a.setAttribute('xmlns','http://www.w3.org/1999/xhtml'),l='html'):'svg'===e?(a.setAttribute('xmlns','http://www.w3.org/2000/svg'),l='svg'):'foreignObject'===e&&(l='foreignObject');const c=u(),f={type:'element',pure:0,tag:e,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},d={parent:null,signal:c,namespace:l,targetElement:a,svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:f,mountStatus:'initial',visible:1};r&&p(r,d),'svg'===e?d.svgRoot=a:r&&(d.svgRoot=r.svgRoot),ae.replace(d),n?((e,t,n,s)=>{let r=0;le.push({node:t,append:[],reverse:0});try{effector.withRegion(e,s),r=1}finally{h(le.pop()),r||ae.replace(n)}})(c,a,r,n):(f.pure=1,L(t));const m=(()=>{const e=(()=>{const e=ae.getElementNode(),t={attr:{},data:{},visible:null,text:null,styleVar:{},styleProp:{},handler:e.handler,transform:e.transform,focus:e.focus,blur:e.blur};for(let n=0;n<e.attr.length;n++){const s=e.attr[n];for(const e in s)t.attr[e]=s[e]}for(let n=0;n<e.data.length;n++){const s=e.data[n];for(const e in s)t.data[e]=s[e]}e.visible.length>0&&(t.visible=e.visible[e.visible.length-1]),e.text.length>0&&(t.text=e.text[e.text.length-1]);for(let n=0;n<e.styleVar.length;n++){const s=e.styleVar[n];for(const e in s)t.styleVar[e]=s[e]}for(let n=0;n<e.styleProp.length;n++){const s=e.styleProp[n];for(const e in s)t.styleProp[e]=s[e]}return t})(),t=ae.get(),n=t.targetElement,s=t.signal;return((e,t,n)=>{for(const s in n)x('value'!==s&&'checked'!==s&&'min'!==s&&'max'!==s,t,n[s],R.bind(null,e,s))})(n,s,e.attr),((e,t,n)=>{for(const s in n)x(0,t,n[s],E.bind(null,e.dataset,s))})(n,s,e.data),((e,t,n)=>{for(let s=0;s<n.length;s++){const{options:r,map:i}=n[s];for(const t in i)e.addEventListener(t,i[t],r);g(t,Ye.bind(null,e,n[s]))}})(n,s,e.handler),((e,t,n)=>{const s=e.style;for(const e in n)x(0,t,n[e],Ue.bind(null,s,e))})(n,s,e.styleProp),((e,t,n)=>{const s=e.style;for(const e in n)x(0,t,n[e],Xe.bind(null,s,`--${e}`))})(n,s,e.styleVar),((e,t,n)=>{const s=ae.get();if('svg'!==s.namespace)return;if(0===n.length)return;const r=e.transform.baseVal,i=s.svgRoot;for(let e=0;e<n.length;e++){const s=n[e];for(const e in s)_(i,t,r,s[e],Ge[e])}})(n,s,e.transform),((e,t,n)=>{null!==n&&(effector.is.unit(n)?k(t,n,$.bind(null,e)):$(e,n))})(n,s,e.text),((e,t,n)=>{if(null===n)return;const s=ae.get().parent.targetElement;k(t,n,C.bind(null,e,s,ae.get()))})(n,s,e.visible),((e,t,n)=>{for(let s=0;s<n.length;s++)x(1,t,n[s],A.bind(null,e))})(n,s,e.focus),((e,t,n)=>{for(let s=0;s<n.length;s++)x(1,t,n[s],O.bind(null,e))})(n,s,e.blur),e})();ae.replace(r),d.visible=!m.visible||m.visible.getState(),s||le.length>0&&d.visible&&le[le.length-1].append.push(a)},exports.handler=G,exports.list=V,exports.map=(e,{fn:t})=>T(e.map(t)),exports.node=M,exports.nodeMethod=e=>{let t;return M(e=>{t=e}),(...n)=>{if(t)return t[e](...n)}},exports.remap=F,exports.render=i,exports.renderStatic=e=>{const t=r();return f(t,e),new Promise(e=>setTimeout(e,800)).then(()=>i(t))},exports.signalOwn=T,exports.spec=L,exports.storeField=(e,t)=>{const n=e.map(I(P,t)),s=ae.get();return s&&l(s.signal,[n]),n},exports.style=X,exports.text=Y,exports.transform=W,exports.tree=function e({key:t,child:n,source:s},r){V({source:s,key:t},({store:s,key:i,signal:l})=>{const[o]=F(s,[n]);r({store:s,key:i,signal:l},()=>{e({key:t,child:n,source:o},r)})})},exports.using=f,exports.visible=U; | ||
function e(e){return`-${e.toLowerCase()}`}function t(e){switch(e){case'&':return'&';case'<':return'<';case'>':return'>';case'"':return'"';case"'":return''';default:return e}}function n(e){switch(e=String(e)){case'__proto__':case'__defineGetter__':case'__defineSetter__':case'constructor':case'prototype':case'hasOwnProperty':case'toString':case'valueOf':return'blacklisted';default:return e.replace(J,'')}}function r(e){return String(e).replace(K,'')}function s(){return new te}function i(t){const s=[];(function t(s,i){if(null!==s.textContent&&i.push(s.textContent),s.isFragment){let e=s.firstChild;for(;e;)t(e,i),e=e.sibling.right;return}i.push('<',s.tagName);for(const e in s.attributes)i.push(' ',e,'=','"',r(s.attributes[e]),'"');for(const t in s.dataset)i.push(' ','data-',n(t).replace(Q,e),'=','"',r(s.dataset[t]),'"');const l=[];for(const e in s.style.properties)if(e.startsWith('--'))l.push(`${e}: ${s.style.properties[e]}`);else{const t=e.replace(/[A-Z]/,e=>`-${e.toLowerCase()}`);l.push(`${t}: ${s.style.properties[e]}`)}if(l.length>0&&i.push(' ','style','=','"',l.join(';'),'"'),s.transform.baseVal.items.length>0){i.push(' ','transform','=','"');const e=s.transform.baseVal.items.map(({value:e})=>e);i.push(e.join(' '),'"')}if(!s.firstChild)return void i.push('meta'===s.tagName||'link'===s.tagName?'>':'/>');i.push('>');let o=s.firstChild;for(;o;)t(o,i),o=o.sibling.right;i.push('</',s.tagName,'>')})(t,s);const i=s.join('');return function e(t){if('html'===t.tagName)return 1;if(t.isFragment&&null===t.textContent){const n=t.firstChild;if(n&&t.child.last===n)return e(n)}return 0}(t)?`<!DOCTYPE html>${i}`:i}function l(e,t){const n=fe(e);for(let e=0;e<t.length;e++){const r=fe(t[e]);r.family.type='crosslink';const s=pe(r),i=he(n);s.includes(n)||s.push(n),i.includes(r)||i.push(r)}}function o(e,t){a(e,t),c(t,e)}function a(e,t){e&&e!==t&&(e.locality.sibling.right.ref=t)}function c(e,t){e&&e!==t&&(e.locality.sibling.left.ref=t)}function u(){const e={stack:null},t=ue.get(),n=effector.createNode({node:[ge,me],parent:[t&&t.signal].filter(Boolean),meta:{unit:'signal'},scope:e});return e.self=n,n}function f(e,t){const n=e.namespaceURI,r=e.tagName.toLowerCase(),s='http://www.w3.org/2000/svg'===n?'svg':'foreignObject'===r?'foreignObject':'html',i=ue.get(),l={parent:i,signal:i&&i.signal?i.signal:u(),namespace:s,targetElement:e,svgRoot:'svg'===r?e:i?i.svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'using',pure:0,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},mountStatus:'initial',visible:1};ue.replace(l),ae.push({node:e,append:[],reverse:0});try{effector.withRegion(l.signal,t)}finally{p(ae.pop()),ue.replace(i)}}function p({node:e,append:t,reverse:n=0}){if(0===t.length)return;const r=oe.createDocumentFragment();if(n){for(let e=t.length-1;e>=0;e--)r.appendChild(t[e]);e.prepend(r)}else{for(let e=0;e<t.length;e++)r.appendChild(t[e]);e.appendChild(r)}}function h(e,t){t.parent=e,t.signal.seq.push(be),t.signal.scope.stack=t,e.child.push(t)}function d(e,t){return effector.createNode({node:[ye],parent:e,meta:{op:'watch'},scope:{fn:t},family:{type:'crosslink',owners:[e]}})}function g(){Se=0,xe()}function m(e,t,n){const r=(e=>'high'===Oe.get(e)?Ae:Ie)(e);let s=r.get(e);if(s||(s=[],r.set(e,s)),t)for(let e=0;e<n.length;e++)s.push(n[e]);else s.push(n);$e()}function b(e,t,n=0,r="low"){const s=++Pe,i=effector.createEvent(),o=effector.is.store(a=e)?a.updates:a;var a;const c={type:'crosslink',owners:[o,i]};return effector.createNode({node:[Le],parent:[o],scope:{taskID:s,flat:n},family:c}),l(e,[i]),Re.set(s,effector.createNode({node:[qe],child:[effector.createNode({node:[Te,je,Me],scope:{taskID:s},family:c}),effector.createNode({node:[Fe,je],child:[i],family:c})],scope:{fn:t},family:c})),Oe.set(s,r),i}function y({trigger:e=effector.createEvent(),fn:t,priority:n="low",timeout:r=1/0,batchWindow:s=0,retries:i=1/0,mark:l=e.shortName}){const o=b(e.map(e=>[{inserted:ke(),retry:0,value:e}]),(e,n)=>{let l,o=0;const a=[],c=[];for(l=0;l<e.length;l++){const i=e[l],u=ke();if(i.inserted+s>u){c.push(i);continue}if(i.inserted+r<u)continue;if(u-n>=10){o=1;break}const f=t(i.value);void 0!==f&&a.push(f)}if(o)for(let t=l;t<e.length;t++){const n=e[t];n.retry+=1,n.retry>=i||c.push(n)}return{done:a,fail:c}},1,n);return{trigger:e,processed:o,connect:t=>{effector.createNode({node:[],parent:t,child:e,family:{type:'crosslink',owners:[t,e]}})}}}function v({trigger:e=effector.createEvent(),fn:t,priority:n="low",timeout:r=1/0,batchWindow:s=0,retries:i=1/0,mark:l=e.shortName,flatten:o}){const a=b(e.map(e=>{const t=[],n=ke();for(let r=0;r<e.length;r++){const s=o(e[r]);for(let e=0;e<s.length;e++)t.push({inserted:n,retry:0,value:s[e]})}return t}),(e,n)=>{let l,o=0;const a=[],c=[];for(l=0;l<e.length;l++){const i=e[l],u=ke();if(i.inserted+s>u){c.push(i);continue}if(i.inserted+r<u)continue;if(u-n>=10){o=1;break}const f=t(i.value);void 0!==f&&a.push(f)}if(o)for(let t=l;t<e.length;t++){const n=e[t];n.retry+=1,n.retry>=i||c.push(n)}return{done:a,fail:c}},1,n);return{trigger:e,processed:a,connect:t=>{effector.createNode({node:[ze],parent:t,child:e,family:{type:'crosslink',owners:[t,e]}})}}}function w(e,t,n){d(e,t.watch(n))}function k(e,t,n){effector.createNode({node:[We],parent:t,child:[Ye],family:{type:'crosslink',owners:e},scope:{handler:n},meta:{op:'debounceRaf'}}),effector.is.store(t)&&effector.launch(Ye,{data:t.getState(),handler:n},1)}function x(e,t,n,r){effector.is.unit(n)?(e?w:k)(t,n,r):r(n)}function N(e,t=e.child.length-1){for(let n=t;n>=0;n--){const t=e.child[n];switch(t.node.type){case'element':case'using':if(!t.visible)continue;return t}const r=N(t);if(r)return r}return null}function E(e){if(!e.parent)return null;switch(e.parent.node.type){case'element':case'using':{const t=N(e.parent,e.parent.child.indexOf(e)-1);if(t)return t;break}case'list':case'listItem':{let t=e,n=e.parent;for(;n;){const e=N(n,n.child.indexOf(t)-1);if(e)return e;t=n,n=n.parent}break}}return null}function S(e){return''!==e&&0!==e&&(0==e||null==e)}function C(e,t,n){S(n)?delete e[t]:e[t]=`${n}`}function _(e,t,n,r){if(n.visible=r,r){if(!t.contains(e)){const r=E(n);r&&t.contains(r.targetElement)?r.targetElement.after(e):t.appendChild(e)}}else e.remove()}function $(e,t,n){if(null===n)return;const r=ue.get().parent.targetElement;k(t,n,_.bind(null,e,r,ue.get()))}function R(e,t,n){if(S(n)){switch(t){case'value':delete e.value;break;case'checked':e.checked=0;break;case'spellcheck':if(0==n)return void e.setAttribute('spellcheck','false')}e.removeAttribute(t)}else{switch(t){case'value':e.value=`${n}`;break;case'checked':e.checked=`${n}`}e.setAttribute(t,`${n}`)}}function A(e,t,n,r,s,i){const l=e.createSVGTransform();switch(i){case'translate':case'scale':r=(e=>effector.is.store(e)?e:effector.is.store(e.x)?effector.is.store(e.y)?effector.combine({x:e.x,y:e.y}):e.x.map(Ze.bind(null,e.y)):effector.is.store(e.y)?e.y.map(Be.bind(null,e.x)):e)(r)}x(0,t,r,s.bind(null,l)),n.appendItem(l)}function I(e,t){const n=oe.createTextNode(`${t}`),r=e.firstChild;r?r.replaceWith(n):e.appendChild(n)}function O(e){e.focus()}function P(e){e.blur()}function V(e,t){return e.bind(null,t)}function D(e,t){const n=ue.get();if(Array.isArray(t)){const r=[];for(let n=0;n<t.length;n++)r[n]=e.map(V(F,t[n]));return n&&l(n.signal,r),r}if('object'==typeof t&&null!==t){const r=[],s={};for(const n in t)s[n]=e.map(V(F,t[n])),r.push(s[n]);return n&&l(n.signal,r),s}const r=e.map(V(F,t));return n&&l(n.signal,r),r}function F(e,t){return t[e]}function T(e,t){let n,r,s=0;effector.is.store(e)?(r=Qe,n=e):(r=V(et,e.key),n=e.source,s=!!e.reverse);const i=ue.get(),o=u(),a={parent:i,signal:o,namespace:i.namespace,targetElement:i.targetElement,svgRoot:i.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'list',pure:0,reverse:s,key:effector.is.store(e)?{type:'index'}:{type:'key',key:e.key},store:n,cb:t},mountStatus:'initial',visible:1};h(i,a),ue.replace(a);const c={parentNode:i.targetElement,cb:t,shortName:n.shortName,reverse:s,parentStack:a,getID:r},f=effector.createStore(j(c,[],n.getState()));l(o,[f]),d(o,V(nt,f)),effector.sample({source:f,clock:n,fn:V(j,c),target:f}),ue.replace(i)}function j(e,t,n){const r=Array(n.length).fill(0),s=n.map(e.getID),i=[],f=[],p=[];for(let e=0;e<t.length;e++){const i=t[e],l=i.node,o=s.indexOf(l.key);-1!==o?(f.push(i),r[o]=1,l.store.getState()!==n[o]&&effector.launch(l.store,n[o],1)):p.push(i)}if(p.length>0){for(let e=0;e<p.length;e++){const t=p[e],{node:n,locality:r}=t;n.active=0,n.store=null,o(r.sibling.left.ref,r.sibling.right.ref),a(t,null),c(t,null)}effector.launch(tt,p,1)}let d=f.length>0?f[f.length-1]:null;for(let t=0;t<n.length;t++){if(r[t])continue;const s=n[t],a=effector.createStore(s),c=u();l(c,[a]);const p=e.getID(s,t),g={parent:e.parentStack,signal:c,namespace:e.parentStack.namespace,targetElement:e.parentStack.targetElement,svgRoot:e.parentStack.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'listItem',pure:0,key:p,index:p,store:a,signal:c,active:1,nodes:[]},mountStatus:'initial',visible:1};o(d,g),d=g,h(e.parentStack,g),i.push(g),f.push(g)}return i.length>0&&effector.launch(Ke,{context:e,list:i},1),f}function M(e){const t=ue.get();return t&&l(t.signal,[e]),e}function L(){const e=ue.get();if('element'!==e.node.type&&'using'!==e.node.type)throw Error(`this extension can be used only with element nodes, got "${e.node.type}"`)}function q(e){const t=ue.get();t.targetElement.__STATIC__||e(t.targetElement)}function z(e){e.attr&&W(e.attr),e.data&&Y(e.data),e.transform&&U(e.transform),'text'in e&&X(e.text),'visible'in e&&G(e.visible),(e.style||e.styleVar)&&Z({prop:e.style,val:e.styleVar}),e.focus&&H(e.focus),e.handler&&B(e.handler)}function W(e){L(),ue.getElementNode().attr.push(e)}function Y(e){L(),ue.getElementNode().data.push(e)}function U(e){L(),ue.getElementNode().transform.push(e)}function X(e){L(),ue.getElementNode().text.push(e)}function G(e){L(),ue.getElementNode().visible.push(e)}function Z({prop:e,val:t}){L(),e&&ue.getElementNode().styleProp.push(e),t&&ue.getElementNode().styleVar.push(t)}function B(e,t){L(),void 0===t&&(t=e,e={});const{passive:n=1,capture:r=0}=e;ue.getElementNode().handler.push({options:{passive:n,capture:r},map:t})}function H({focus:e,blur:t}){L();const n=ue.getElementNode();e&&n.focus.push(e),t&&n.blur.push(t)}Object.defineProperty(exports,'__esModule',{value:1});var effector=require('effector');const J=/[^a-zA-Z0-9\-]/g,K=/[\\<>"]/g,Q=/[A-Z]/g,ee=/[&<>'"]/g;class te{constructor(){this.child={first:null,last:null},this.sibling={left:null,right:null},this.parent=null,this.tagName='',this.namespaceURI='http://www.w3.org/1999/xhtml',this.dataset=Object.create(null),this.style=new ne,this.firstChild=null,this.transform={baseVal:new re},this.isFragment=1,this.attributes=Object.create(null),this.textContent=null,this.__STATIC__=1}appendChild(e){if(e.parent&&e.remove(),e.isFragment&&null===e.textContent){let t,n=e.firstChild;for(;n;)t=n.sibling.right,this.appendChild(n),n=t}else this.child.last?(this.child.last.sibling.right=e,e.sibling.left=this.child.last):(this.child.first=e,this.firstChild=e),this.child.last=e,e.parent=this}prepend(e){e.parent&&e.remove(),this.child.last?(this.child.first.sibling.left=e,e.sibling.right=this.child.first):(this.child.first=e,this.child.last=e),this.child.first=e,this.firstChild=e,e.parent=this}contains(e){let t=e;for(;t;){if(t===this)return 1;t=t.parent}return 0}remove(){if(!this.parent)return;const{parent:e}=this;e.child.first===this&&e.child.last===this?(e.firstChild=null,e.child.first=null,e.child.last=null):e.child.first===this?(e.child.first=this.sibling.right,e.firstChild=this.sibling.right,this.sibling.right.sibling.left=null):e.child.last===this?(e.child.last=this.sibling.left,this.sibling.left.sibling.right=null):(this.sibling.right.sibling.left=this.sibling.left,this.sibling.left.sibling.right=this.sibling.right),this.sibling.left=null,this.sibling.right=null,this.parent=null}addEventListener(e,t,n){}removeEventListener(e,t,n){}setAttribute(e,t){this.attributes[n(e)]=r(t)}removeAttribute(e){delete this.attributes[n(e)]}replaceWith(e){if(!this.parent)return;const{parent:t}=this;e.parent&&e.remove(),t.child.first===this&&t.child.last===this?(t.firstChild=e,t.child.first=e,t.child.last=e):t.child.first===this?(t.child.first=e,t.firstChild=e,this.sibling.right.sibling.left=e):t.child.last===this?(t.child.last=e,this.sibling.left.sibling.right=e):(this.sibling.right.sibling.left=e,this.sibling.left.sibling.right=e),e.sibling.left=this.sibling.left,e.sibling.right=this.sibling.right,e.parent=t,this.sibling.left=null,this.sibling.right=null,this.parent=null}focus(){}blur(){}createSVGTransform(){return new se}}class ne{constructor(){this.properties=Object.create(null)}setProperty(e,t){this.properties[n(e)]=r(t)}removeProperty(e){delete this.properties[n(e)]}}class re{constructor(){this.items=[]}appendItem(e){this.items.push(e)}}class se{constructor(){this.value=''}setTranslate(e,t){this.value=`translate(${e} ${t})`}setScale(e,t){this.value=`scale(${e} ${t})`}setRotate(e,t,n){this.value=0!==t||0!==n?`rotate(${e} ${t} ${n})`:`rotate(${e})`}setSkewX(e){this.value=`skewX(${e})`}setSkewY(e){this.value=`skewY(${e})`}}const ie=new te;ie.isBody=1;var le={__proto__:null,body:ie,createTextNode:e=>{const n=new te;return n.textContent=String(e).replace(ee,t),n},createElement:e=>{const t=new te;return t.tagName=n(e),t.isFragment=0,t},createElementNS:(e,t)=>{switch(e){case'http://www.w3.org/1999/xhtml':case'http://www.w3.org/2000/svg':break;default:e='http://www.w3.org/1999/xhtml'}const r=new te;return r.tagName=n(t),r.namespaceURI=e,r.isFragment=0,r},createDocumentFragment:s,render:i};let oe='undefined'!=typeof document?document:null;const ae=[];let ce;const ue={get:()=>ce,replace(e){ce=e},getElementNode:()=>ce.node},fe=e=>e.graphite||e,pe=e=>e.family.owners,he=e=>e.family.links,de=effector.createNode({node:[effector.step.run({fn(e){effector.clearNode(e)}})]}),ge=effector.step.compute({fn(e,t){t.self.next.push(de);const{stack:n}=t,{parent:r}=n,{left:s,right:i}=n.locality.sibling;r&&(r.locality.child.last.ref===n&&(r.locality.child.last.ref=s.ref),r.locality.child.first.ref===n&&(r.locality.child.first.ref=i.ref)),s.ref&&s.ref.locality.sibling.right.ref===n&&i.ref&&i.ref.locality.sibling.left.ref===n?o(s.ref,i.ref):s.ref&&s.ref.locality.sibling.right.ref===n?a(s.ref,null):i.ref&&i.ref.locality.sibling.left.ref===n&&c(i.ref,null)}}),me=effector.step.compute({fn:(e,{self:t})=>t}),be=effector.step.compute({fn(e,t){if(!t.stack)return e;const{stack:n}=t;t.stack=null;const r=n.parent.child.indexOf(n);return-1!==r&&n.parent.child.splice(r,1),n.parent=null,e}}),ye=effector.step.run({fn(e,{fn:t}){t(e)}});let ve,we,ke;ve=()=>{},we=()=>{},ke='undefined'!=typeof performance&&performance.now?()=>performance.now():'undefined'!=typeof process&&process.hrtime?()=>{const e=process.hrtime();return(1e9*e[0]+e[1])/1e6}:()=>Date.now();const xe=effector.createEvent();let Ne,Ee=0,Se=0;const Ce='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0),_e='undefined'!=typeof cancelAnimationFrame?cancelAnimationFrame:clearTimeout,$e=()=>{Se||(Se=1,Ne=Ce(g))},Re=new Map,Ae=new Map,Ie=new Map,Oe=new Map;let Pe=0,Ve=0;const De=effector.createNode({node:[effector.step.run({fn:()=>{}}),effector.step.filter({fn:()=>0===Ae.size&&0===Ie.size?0:ke()-Ve>=10?0:(_e(Ne),Ee=1,Se=0,1)})],child:[xe]});xe.watch(()=>{if(Se)return;if(0===Ae.size&&0===Ie.size)return void(Ee=0);let e=0;Ee||(Ve=ke()),Ee=0;for(const[t,n]of Ae){if(ke()-Ve>=10){$e(),e=1;break}Ae.delete(t),effector.launch({target:Re.get(t),params:n,defer:1})}if(!e)for(const[t,n]of Ie){if(ke()-Ve>=10){$e(),e=1;break}Ie.delete(t),effector.launch({target:Re.get(t),params:n,defer:1})}effector.launch({target:De,params:null,defer:1})});const Fe=effector.step.compute({fn:({done:e})=>e}),Te=effector.step.compute({fn:({fail:e})=>e}),je=effector.step.filter({fn:e=>e.length>0}),Me=effector.step.compute({fn(e,{taskID:t}){m(t,1,e)}}),Le=effector.step.compute({fn(e,{taskID:t,flat:n}){m(t,n,e)}}),qe=effector.step.run({fn:(e,{fn:t})=>t(e,Ve)}),ze=effector.step.compute({fn:e=>[e]}),We=effector.step.run({fn:(e,{handler:t})=>({data:e,handler:t})}),{trigger:Ye}=y({priority:'high',mark:'domOperation',fn({handler:e,data:t}){e(t)}}),Ue=(e,{map:t,options:n})=>{for(const r in t)e.removeEventListener(r,t[r],n)},Xe=(e,t,n)=>{S(n)?delete e[t]:e[t]=n},Ge=(e,t,n)=>{S(n)?e.removeProperty(t):e.setProperty(t,n)},Ze=(e,t)=>({x:t,y:e}),Be=(e,t)=>({x:e,y:t}),He={translate(e,{x:t=0,y:n=0}){e.setTranslate(t,n)},scale(e,{x:t=0,y:n=0}){e.setScale(t,n)},rotate(e,t){'number'==typeof t?e.setRotate(t,0,0):e.setRotate(t.angle||0,t.x||0,t.y||0)},skewX(e,t){e.setSkewX(t)},skewY(e,t){e.setSkewY(t)}},{trigger:Je}=y({mark:'append DOM nodes',fn:e=>{for(let t=0;t<e.append.length;t++){const n=e.append[t];if(0==n.listItem.active)continue;if(0===n.appended.length)continue;const r=oe.createDocumentFragment();if(e.reverse)for(let e=n.appended.length-1;e>=0;e--)r.appendChild(n.appended[e]);else for(let e=0;e<n.appended.length;e++)r.appendChild(n.appended[e]);const s=E(n.listItemStack);s&&e.node.contains(s.targetElement)?e.reverse?s.targetElement.before(r):s.targetElement.after(r):e.node.appendChild(r)}}}),{trigger:Ke}=y({mark:'addRecords',fn:({context:e,list:t})=>{const{parentStack:n,parentNode:r,cb:s,reverse:i}=e,l=ue.get();ue.replace(n);const o=[],a=[];ae.push({node:r,append:a,reverse:i});for(let e=0;e<t.length;e++){const n=t[e],r=n.node;if(r.active){ue.replace(n),effector.withRegion(n.signal,V(s,r));for(let e=0;e<a.length;e++)r.nodes.push(a[e]);o.push({listItemStack:n,appended:a.slice(),listItem:r}),a.length=0}}ae.pop(),o.length>0&&effector.launch({target:Je,params:{node:r,append:o,reverse:i},defer:1}),ue.replace(l)}}),Qe=(e,t)=>t,et=(e,t)=>t[e],tt=effector.createEvent();v({trigger:tt,priority:'high',mark:'runSignals',flatten:({signal:e})=>[e],fn:e=>{e.scope&&effector.launch(e,null,0)}}),v({trigger:tt,priority:'high',mark:'remove DOM nodes',flatten({node:e}){const{nodes:t}=e;return t},fn:e=>(e.remove(),e)});const nt=e=>{const t=e.getState();for(let e=0;e<t.length;e++){const n=t[e].node;n.active=0,n.store=null}effector.launch(tt,t,1)};oe=le,exports.attr=W,exports.body=ie,exports.combine=({source:e,fn:t})=>(console.error('separate combine method is deprecated, use common combine method as usual'),M(effector.combine(e,t))),exports.createDocumentFragment=s,exports.data=Y,exports.explicitUnmount=e=>{const t=ue.get();t&&effector.createNode({node:[],parent:e,child:t.signal,family:{type:'crosslink',owners:[t.signal,e]}})},exports.focus=H,exports.h=(e,t,n)=>{'function'==typeof t&&(n=t,t={}),void 0===t&&(t={});const{noAppend:r=0}=t,s=ue.get(),i=s?s.namespace:'html';let l=i,o='html';'type'in t?(o=t.type,l=t.type):l=o='svg'===i?'svg':'html','svg'===e&&(o='svg',l='svg');const a='svg'===o?oe.createElementNS('http://www.w3.org/2000/svg',e):oe.createElement(e);'foreignObject'===i?(a.setAttribute('xmlns','http://www.w3.org/1999/xhtml'),l='html'):'svg'===e?(a.setAttribute('xmlns','http://www.w3.org/2000/svg'),l='svg'):'foreignObject'===e&&(l='foreignObject');const c=u(),f={type:'element',pure:0,tag:e,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},g={parent:null,signal:c,namespace:l,targetElement:a,svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:f,mountStatus:'initial',visible:1};s&&h(s,g),'svg'===e?g.svgRoot=a:s&&(g.svgRoot=s.svgRoot),ue.replace(g),n?((e,t,n,r)=>{let s=0;ae.push({node:t,append:[],reverse:0});try{effector.withRegion(e,r),s=1}finally{p(ae.pop()),s||ue.replace(n)}})(c,a,s,n):(f.pure=1,z(t));const m=(()=>{const e=(()=>{const e=ue.getElementNode(),t={attr:{},data:{},visible:null,text:null,styleVar:{},styleProp:{},handler:e.handler,transform:e.transform,focus:e.focus,blur:e.blur};for(let n=0;n<e.attr.length;n++){const r=e.attr[n];for(const e in r)t.attr[e]=r[e]}for(let n=0;n<e.data.length;n++){const r=e.data[n];for(const e in r)t.data[e]=r[e]}e.visible.length>0&&(t.visible=e.visible[e.visible.length-1]),e.text.length>0&&(t.text=e.text[e.text.length-1]);for(let n=0;n<e.styleVar.length;n++){const r=e.styleVar[n];for(const e in r)t.styleVar[e]=r[e]}for(let n=0;n<e.styleProp.length;n++){const r=e.styleProp[n];for(const e in r)t.styleProp[e]=r[e]}return t})(),t=ue.get(),n=t.targetElement,r=t.signal;return((e,t,n)=>{for(const r in n)x('value'!==r&&'checked'!==r&&'min'!==r&&'max'!==r,t,n[r],R.bind(null,e,r))})(n,r,e.attr),((e,t,n)=>{for(const r in n)x(0,t,n[r],C.bind(null,e.dataset,r))})(n,r,e.data),((e,t,n)=>{for(let r=0;r<n.length;r++){const{options:s,map:i}=n[r];for(const t in i)e.addEventListener(t,i[t],s);d(t,Ue.bind(null,e,n[r]))}})(n,r,e.handler),((e,t,n)=>{const r=e.style;for(const e in n)x(0,t,n[e],Xe.bind(null,r,e))})(n,r,e.styleProp),((e,t,n)=>{const r=e.style;for(const e in n)x(0,t,n[e],Ge.bind(null,r,`--${e}`))})(n,r,e.styleVar),((e,t,n)=>{const r=ue.get();if('svg'!==r.namespace)return;if(0===n.length)return;const s=e.transform.baseVal,i=r.svgRoot;for(let e=0;e<n.length;e++){const r=n[e];for(const e in r)A(i,t,s,r[e],He[e],e)}})(n,r,e.transform),((e,t,n)=>{null!==n&&(effector.is.unit(n)?k(t,n,I.bind(null,e)):I(e,n))})(n,r,e.text),$(n,r,e.visible),((e,t,n)=>{for(let r=0;r<n.length;r++)x(1,t,n[r],O.bind(null,e))})(n,r,e.focus),((e,t,n)=>{for(let r=0;r<n.length;r++)x(1,t,n[r],P.bind(null,e))})(n,r,e.blur),e})();ue.replace(s),g.visible=!m.visible||m.visible.getState(),r||ae.length>0&&g.visible&&ae[ae.length-1].append.push(a)},exports.handler=B,exports.list=T,exports.map=(e,{fn:t})=>(console.error('separate map method is deprecated, use store.map as usual'),M(e.map(t))),exports.node=q,exports.nodeMethod=e=>{let t;return q(e=>{t=e}),(...n)=>{if(t)return t[e](...n)}},exports.remap=D,exports.render=i,exports.renderStatic=e=>{const t=s();return f(t,e),new Promise(e=>setTimeout(e,800)).then(()=>i(t))},exports.signalOwn=M,exports.spec=z,exports.storeField=(e,t)=>{const n=e.map(V(F,t)),r=ue.get();return r&&l(r.signal,[n]),n},exports.style=Z,exports.text=X,exports.transform=U,exports.tree=function e({key:t,child:n,source:r},s){T({source:r,key:t},({store:r,key:i,signal:l})=>{const[o]=D(r,[n]);s({store:r,key:i,signal:l},()=>{e({key:t,child:n,source:o},s)})})},exports.using=f,exports.visible=G; | ||
//# sourceMappingURL=server.js.map |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
559086
16
1013
1