You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3 lines
18 KiB

3 years ago
(()=>{"use strict";var t,e={352:()=>{function t(t){return t.replace(/-(\w)/g,((t,e)=>e.toUpperCase()))}function e(t,n){t.firstChild&&(n.appendChild(t.firstChild),e(t,n))}function n(t){r(t.childNodes)}function r(t){Array.from(t).forEach(s)}const s=t=>t&&t.parentNode&&t.parentNode.removeChild(t),o=(t,e)=>e&&e.parentNode&&e.parentNode.insertBefore(t,e),i=new Map,a=Symbol("riot-component"),u=new Set,c="is",l="mount",p="update",h="unmount",d="shouldUpdate",m="onBeforeMount",f="onMounted",b="onBeforeUpdate",O="onUpdated",v="onBeforeUnmount",g="onUnmounted",E="props",N="state",y="slots",T="root",x=Symbol("pure"),_=Symbol("is_updating"),A=Symbol("parent"),M=Symbol("attributes"),j=Symbol("template");var S=Object.freeze({__proto__:null,COMPONENTS_IMPLEMENTATION_MAP:i,DOM_COMPONENT_INSTANCE_PROPERTY:a,PLUGINS_SET:u,IS_DIRECTIVE:c,VALUE_ATTRIBUTE:"value",MOUNT_METHOD_KEY:l,UPDATE_METHOD_KEY:p,UNMOUNT_METHOD_KEY:h,SHOULD_UPDATE_KEY:d,ON_BEFORE_MOUNT_KEY:m,ON_MOUNTED_KEY:f,ON_BEFORE_UPDATE_KEY:b,ON_UPDATED_KEY:O,ON_BEFORE_UNMOUNT_KEY:v,ON_UNMOUNTED_KEY:g,PROPS_KEY:E,STATE_KEY:N,SLOTS_KEY:y,ROOT_KEY:T,IS_PURE_SYMBOL:x,IS_COMPONENT_UPDATING:_,PARENT_KEY_SYMBOL:A,ATTRIBUTES_KEY_SYMBOL:M,TEMPLATE_KEY_SYMBOL:j});var w={EACH:0,IF:1,SIMPLE:2,TAG:3,SLOT:4};var P={ATTRIBUTE:0,EVENT:1,TEXT:2,VALUE:3};const U=Symbol("head"),C=Symbol("tail");function D(t){const e=t.dom.cloneNode(!0),{head:n,tail:r}=function(){const t=document.createTextNode(""),e=document.createTextNode("");return t[U]=!0,e[C]=!0,{head:t,tail:e}}();return{avoidDOMInjection:!0,fragment:e,head:n,tail:r,children:[n,...Array.from(e.childNodes),r]}}function I(t,e,n,r){return void 0===r&&(r={}),Object.defineProperty(t,e,Object.assign({value:n,enumerable:!1,writable:!1,configurable:!0},r)),t}function L(t,e,n){return Object.entries(e).forEach((e=>{let[r,s]=e;I(t,r,s,n)})),t}function Y(t,e){return Object.entries(e).forEach((e=>{let[n,r]=e;t[n]||(t[n]=r)})),t}function K(t,e){return typeof t===e}function k(t){const e=t.ownerSVGElement;return!!e||null===e}function B(t){return"template"===t.tagName.toLowerCase()}function R(t){return K(t,"function")}function $(t){return!z(t)&&t.constructor===Object}function z(t){return null==t}const F=Symbol("unmount"),H={nodes:[],mount(t,e){return this.update(t,e)},update(t,e){const{placeholder:n,nodes:r,childrenMap:i}=this,a=t===F?null:this.evaluate(t),u=a?Array.from(a):[],{newChildrenMap:c,batches:l,futureNodes:p}=function(t,e,n,r){const{condition:s,template:o,childrenMap:i,itemName:a,getKey:u,indexName:c,root:l,isTemplateTag:p}=r,h=new Map,d=[],m=[];return t.forEach(((t,r)=>{const f=function(t,e){let{itemName:n,indexName:r,index:s,item:o}=e;I(t,n,o),r&&I(t,r,s);return t}(Object.create(e),{itemName:a,indexName:c,index:r,item:t}),b=u?u(f):r,O=i.get(b),v=[];if(function(t,e){return!!t&&!t(e)}(s,f))return;const g=!O,E=O?O.template:o.clone(),N=E.el||l.cloneNode(),y=p&&g?D(E):E.meta;g?d.push((()=>E.mount(N,f,n,y))):d.push((()=>E.update(f,n))),p?v.push(...y.children):v.push(N),i.delete(b),m.push(...v),h.set(b,{nodes:v,template:E,context:f,index:r})})),{newChildrenMap:h,batches:d,futureNodes:m}}(u,t,e,this);return((t,e,n,r)=>{const i=e.length;let a=t.length,u=i,c=0,l=0,p=null;for(;c<a||l<u;)if(a===c){const t=u<i?l?n(e[l-1],-0).nextSibling:n(e[u-l],0):r;for(;l<u;)o(n(e[l++],1),t)}else if(u===l)for(;c<a;)p&&p.has(t[c])||s(n(t[c],-1)),c++;else if(t[c]===e[l])c++,l++;else if(t[a-1]===e[u-1])a--,u--;else if(t[c]===e[u-1]&&e[l]===t[a-1]){const r=n(t[--a],-1).nextSibling;o(n(e[l++],1),n(t[c++],-1).nextSibling),o(n(e[--u],1),r),t[a]=e[u]}else{if(!p){p=new Map;let t=l;for(;t<u;)p.set(e[t],t++)}if(p.has(t[c])){const r=p.get(t[c]);if(l<r&&r<u){let s=c,i=1;for(;++s<a&&s<u&&p.get(t[s])===r+i;)i++;if(i>r-l){const s=n(t[c],0);for(;l<r;)o(n(e[l++],1),s)}else h=n(e[l++],1),(d=n(t[c++],-1))&&d.parentNode&&d.parentNode.replaceChild(h,d)}else c++}else s(n(t[c++],-1))}var h,d})(r,p,function(t,e){return(n,r)=>{if(r<0){const n=t[t.length-1];if(n){const{template:r,nodes:s,context:o}=n;s.pop(),s.length||(t.pop(),r.unmount(o,e,null))}}return n}}(Array.from(i.values()),e),n),l.forEach((t=>t
3 years ago
/* Riot v6.1.2, @license MIT */
3 years ago
var s;return t[(s=n,s.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase())]=$t(r),t}),{})}(e.exports?e.exports.components:{});return t(gt,P,w,(t=>t===e.name?Yt(e):n[t]||i.get(t)))}function $t(t){const{css:e,template:n,exports:r,name:s}=t,o=n?Rt(n,t):Lt;return t=>{let{slots:i,attributes:a,props:u}=t;if(r&&r[x])return function(t,e){let{slots:n,attributes:r,props:s,css:o,template:i}=e;i&&V("Pure components can not have html"),o&&V("Pure components do not have css");const a=Y(t({slots:n,attributes:r,props:s}),Dt);return Bt((t=>function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];if(t===l){const[t]=n;I(t,x,!0),kt(t,a)}return a[t](...n),a}))}(r,{slots:i,attributes:a,props:u,css:e,template:n});const c=Nt(r)||{},p=zt({css:e,template:o,componentAPI:c,name:s})({slots:i,attributes:a,props:u});return{mount:(t,e,n)=>p.mount(t,n,e),update:(t,e)=>p.update(e,t),unmount:t=>p.unmount(t)}}}function zt(t){let{css:e,template:n,componentAPI:r,name:s}=t;return e&&s&&wt.add(s,e),Pt(Ht)(L(Y(r,Object.assign({},It,{[E]:{},[N]:{}})),Object.assign({[y]:null,[T]:null},Ct,{name:s,css:e,template:n})))}function Ft(t,e){return Object.assign({},t,Nt(e))}function Ht(t,e){let{slots:n,attributes:r,props:s}=e;return o=function(t){return[...u].reduce(((t,e)=>e(t)||t),t)}(L($(t)?Object.create(t):t,{mount(e,o,i){return void 0===o&&(o={}),I(e,x,!1),this[A]=i,this[M]=function(t,e){void 0===e&&(e=[]);const n=e.map((e=>at(t,e))),r={};return Object.assign(r,Object.assign({expressions:n},Bt((t=>e=>(n.forEach((n=>n[t](e))),r)))))}(e,r).mount(i),I(this,E,Object.freeze(Object.assign({},Kt(e,s),W(this[M].expressions)))),this.state=Ft(this.state,o),this[j]=this.template.createDOM(e).clone(),kt(e,this),t.name&&function(t,e){Ut(t)!==e&&_t(t,c,e)}(e,t.name),I(this,T,e),I(this,y,n),this.onBeforeMount(this.props,this.state),this[j].mount(e,this,i),this.onMounted(this.props,this.state),this},update(t,e){void 0===t&&(t={}),e&&(this[A]=e,this[M].update(e));const n=W(this[M].expressions);if(!1!==this.shouldUpdate(n,this.props))return I(this,E,Object.freeze(Object.assign({},this.props,n))),this.state=Ft(this.state,t),this.onBeforeUpdate(this.props,this.state),this[_]||(this[_]=!0,this[j].update(this,this[A])),this.onUpdated(this.props,this.state),this[_]=!1,this},unmount(t){return this.onBeforeUnmount(this.props,this.state),this[M].unmount(),this[j].unmount(this,this[A],null===t?null:!t),this.onUnmounted(this.props,this.state),this}})),Object.keys(t).filter((e=>R(t[e]))).forEach((t=>{o[t]=o[t].bind(o)})),o;var o}const{DOM_COMPONENT_INSTANCE_PROPERTY:Gt,COMPONENTS_IMPLEMENTATION_MAP:Vt,PLUGINS_SET:qt}=S;function Wt(t,e){let{css:n,template:r,exports:s}=e;return Vt.has(t)&&V(`The component "${t}" was already registered`),Vt.set(t,$t({name:t,css:n,template:r,exports:s})),Vt}function Xt(t,e,n){return Tt(t).map((t=>function(t,e,n){const r=n||Ut(t);return i.has(r)||V(`The component named "${r}" was never registered`),i.get(r)({props:e}).mount(t)}(t,e,n)))}const Zt={css:null,exports:{state:{isActive:!1},handleSwitch(){!0===this.state.isActive?this.state.isActive=!1:this.state.isActive=!0,this.update()}},template:(t,e,n,r)=>t('<div class="example m-top-5"><label class="field-label"><input expr1="expr1" class="field-choice" type="checkbox" name="radio" value="true"/><span class="field-switch"></span></label><div expr2="expr2" class="panel"></div></div>',[{redundantAttribute:"expr1",selector:"[expr1]",expressions:[{type:e.EVENT,name:"onchange",evaluate:t=>()=>{t.handleSwitch()}}]},{type:n.IF,evaluate:t=>t.state.isActive,redundantAttribute:"expr2",selector:"[expr2]",template:t('<div class="panel__body"><tiny-loading expr3="expr3"></tiny-loading></div>',[{type:n.TAG,getComponent:r,evaluate:t=>"tiny-loading",slots:[],attributes:[{type:e.ATTRIBUTE,name:"active",evaluate:t=>t.state.isActive}],redundantAttribute:"expr3",selector:"[expr3]"}])}]),name:"example-loading"};Wt("tiny-loading",{css:null,exports:null,template:(t,e,n,r)=>t('<div expr0="expr0" class="loading-wrapper"></div>',[{type:n.IF,evaluate:t=>t.props.active,redundantAttribute:"expr0",selector:"[expr0]",templat