yox
Version:
A lightweight mvvm framework
1 lines • 79.4 kB
JavaScript
const e=/^!(?:\s|--)/,t="undefined"!=typeof window?window:undefined,n="undefined"!=typeof document?document:undefined,r=function(){},i=Object.freeze({}),o=Object.freeze([]),s=/yox/.test(r.toString())?2:3,c={leftDelimiter:"{",rightDelimiter:"}",uglifyCompiled:false,minifyCompiled:false,logLevel:s};function a(e){return"function"==typeof e}function u(e){return Array.isArray(e)}function f(e){return null!==e&&"object"==typeof e}function l(e){return"string"==typeof e}function d(e){return"number"==typeof e&&!isNaN(e)}function p(e){return true===e||false===e}function h(e){return!isNaN(e-parseFloat(e))}var m=Object.freeze({__proto__:null,func:a,array:u,object:f,string:l,number:d,boolean:p,numeric:h});function g(e,t,n){return u(n)?e.apply(t,n):undefined!==t?e.call(t,n):undefined!==n?e(n):e()}class y{constructor(e,t){this.type=e,this.phase=y.PHASE_CURRENT,t&&(this.originalEvent=t)}static is(e){return e instanceof y}preventDefault(){const e=this;if(!e.isPrevented){const{originalEvent:t}=e;t&&t.preventDefault(),e.isPrevented=true}return e}stopPropagation(){const e=this;if(!e.isStoped){const{originalEvent:t}=e;t&&t.stopPropagation(),e.isStoped=true}return e}prevent(){return this.preventDefault()}stop(){return this.stopPropagation()}}function v(e,t,n){const{length:r}=e;if(r)if(n)for(let n=r-1;n>=0&&false!==t(e[n],n);n--);else for(let n=0;n<r&&false!==t(e[n],n);n++);}function $(e,t){e[e.length]=t}function b(e,t){e.unshift(t)}function x(e,t,n){u(t)?v(t,(function(t){n(e,t)})):n(e,t)}function k(e,t){x(e,t,$)}function w(e,t){x(e,t,b)}function T(e,t,n){let r=-1;return v(e,(function(e,i){if(false===n?e==t:e===t)return r=i,false})),r}function S(e){const{length:t}=e;if(t>0)return e[t-1]}function _(e){const{length:t}=e;if(t>0)return e.pop()}function C(e,t,n){let r=0;return v(e,(function(i,o){(false===n?i==t:i===t)&&(e.splice(o,1),r++)}),true),r}function N(e,t,n){return T(e,t,n)>=0}function E(e){return u(e)?e:g(o.slice,e)}function A(e,t,n){let r={};return v(e,(function(e){r[t?e[t]:e]=n||e})),r}function O(e,t){return e.join(t)}function D(e){return!u(e)||!e.length}y.PHASE_CURRENT=0,y.PHASE_UPWARD=1,y.PHASE_DOWNWARD=-1;var z=Object.freeze({__proto__:null,each:v,push:k,unshift:w,indexOf:T,last:S,pop:_,remove:C,has:N,toArray:E,toObject:A,join:O,falsy:D});function L(e,t){return null!=e&&e.toString?e.toString():undefined!==t?t:""}function P(e){return a(e)&&L(e).indexOf("[native code]")>=0}let I=function(){const e=Object.create(null);return{get:t=>e[t],set(t,n){e[t]=n},has:t=>t in e,keys:()=>Object.keys(e)}};P(Object.create)||(I=function(){const e={};return{get:t=>e.hasOwnProperty(t)?e[t]:undefined,set(t,n){e[t]=n},has:t=>e.hasOwnProperty(t),keys:()=>Object.keys(e)}});var j=I;function V(e){const t=j();return function(n){const r=t.get(n);if(undefined!==r)return r;const i=e(n);return t.set(n,i),i}}function U(e){const t=j();return function(n,r){let i=t.get(n);if(i){const e=i.get(r);if(e)return e}else i=j(),t.set(n,i);const o=e(n,r);return i.set(r,o),o}}const M=/-([a-z])/gi,H=/\B([A-Z])/g,R=/^[a-z]/,F=V((function(e){return e.replace(M,(function(e,t){return te(t)}))})),q=V((function(e){return e.replace(H,(function(e,t){return"-"+ne(t)}))})),W=V((function(e){return e.replace(R,te)}));function K(e,t){return O(new Array(t+1),e)}function B(e){return oe(e)?"":e.trim()}function Y(e,t,n){return d(n)?t===n?"":e.slice(t,n):e.slice(t)}function G(e,t,n){return e.indexOf(t,undefined!==n?n:0)}function Z(e,t,n){return e.lastIndexOf(t,undefined!==n?n:e.length)}function J(e,t){return 0===G(e,t)}function Q(e,t){const n=e.length-t.length;return n>=0&&Z(e,t)===n}function X(e,t){return e.charAt(t||0)}function ee(e,t){return e.charCodeAt(t||0)}function te(e){return e.toUpperCase()}function ne(e){return e.toLowerCase()}function re(e,t){return G(e,t)>=0}function ie(e,t){const n=Object.create(null);return v(e.split(t||","),(function(e){n[e]=true})),n}function oe(e){return!l(e)||!e.length}var se=Object.freeze({__proto__:null,camelize:F,hyphenate:q,capitalize:W,repeat:K,trim:B,slice:Y,indexOf:G,lastIndexOf:Z,startsWith:J,endsWith:Q,charAt:X,codeAt:ee,upper:te,lower:ne,has:re,toMap:ie,falsy:oe});const ce=/\./g,ae=/\*/g,ue=/\*\*/g,fe=U((function(e,t){return e===t||J(e,t+=".")?t.length:-1})),le=V((function(e){return G(e,".")<0?[e]:e.split(".")}));function de(e,t){const n=l(e)?le(e):e;for(let e=0,r=n.length-1;e<=r&&false!==t(n[e],e,r);e++);}const pe=U((function(e,t){return e&&t?e+"."+t:e||t})),he=V((function(e){return re(e,"*")})),me=V((function(e){return new RegExp(`^${e.replace(ce,"\\.").replace(ae,"(\\w+)").replace(ue,"([.\\w]+?)")}$`)})),ge=U((function(e,t){const n=e.match(me(t));return n?n[1]:undefined})),ye={value:undefined};function ve(e){return Object.keys(e)}function $e(e,t){for(let n in e)if(false===t(e[n],n))break}function be(e,t){return $e(t,(function(t,n){e[n]=t})),e}function xe(e,t){let n=e;return u(e)?t?(n=[],v(e,(function(e,r){n[r]=xe(e,t)}))):n=e.slice():f(e)&&(n={},$e(e,(function(e,r){n[r]=t?xe(e,t):e}))),n}function ke(e){return a(e.get)?e.get():e}function we(e,t,n){let r=e;return de(t,(function(e,t,i){if(null==r)return r=undefined,false;{let o=r[e],s=undefined!==o;o&&(o=(n||ke)(o)),t===i?s?(ye.value=o,r=ye):r=undefined:r=o}})),r}function Te(e,t){return undefined!==e[t]}var Se=Object.freeze({__proto__:null,keys:ve,each:$e,extend:be,merge:function(e,t){return e&&t?be(be({},e),t):e||t},copy:xe,get:we,set:function(e,t,n,r){let i=e;de(t,(function(e,t,o){if(t===o)i[e]=n;else if(i[e])i=i[e];else{if(!r)return false;i=i[e]={}}}))},has:Te,falsy:function(e){return!f(e)||u(e)||!ve(e).length}});const _e="undefined"!=typeof console?console:null,Ce=t&&/edge|msie|trident/i.test(t.navigator.userAgent)?"":"%c",Ne=_e?Ce?function(e,t,n){_e.log(Ce+e,n,t)}:function(e,t){_e.log(e,t)}:r;function Ee(){const{logLevel:e}=c;return e>=1&&e<=5?e:s}function Ae(e){return`background-color:${e};border-radius:12px;color:#fff;font-size:10px;padding:3px 6px;`}function Oe(e,t){Ee()<=1&&Ne(t||"Yox debug",e,Ae("#999"))}function De(e,t){Ee()<=2&&Ne(t||"Yox info",e,Ae("#2db7f5"))}function ze(e,t){Ee()<=3&&Ne(t||"Yox warn",e,Ae("#f90"))}function Le(e,t){Ee()<=4&&Ne(t||"Yox error",e,Ae("#ed4014"))}function Pe(e,t){if(Ee()<=5)throw new Error(`[${t||"Yox fatal"}]: ${e}`)}var Ie=Object.freeze({__proto__:null,DEBUG:1,INFO:2,WARN:3,ERROR:4,FATAL:5,debug:Oe,info:De,warn:ze,error:Le,fatal:Pe});class je{constructor(e){this.ns=e||false,this.listeners={}}fire(e,t,n){let r=this,i=l(e)?r.toEvent(e):e,o=r.listeners[i.type],s=true;if(o){o=o.slice();const e=t&&y.is(t[0])?t[0]:undefined;for(let c=0,a=o.length;c<a;c++){let a=o[c];if(!Ue(i.ns,a)||!N(o,a)||n&&!n(i,t,a))continue;let u=g(a.listener,a.ctx,t);if(a.num=a.num?a.num+1:1,a.num===a.max&&r.off(i.type,{ns:i.ns,listener:a.listener}),e&&(false===u?e.prevent().stop():e.isStoped&&(u=false)),false===u){s=false;break}}}return s}on(e,t){const n=this,r=n.listeners,i=a(t)?{listener:t}:t;if(f(i)&&a(i.listener)){if(!l(i.ns)){const t=n.toEvent(e);i.ns=t.ns,e=t.type}k(r[e]||(r[e]=[]),i)}else Pe('emitter.on(type, listener) invoke failed:\n\n"listener" is expected to be a Function or an EmitterOptions.\n')}off(e,t){const n=this,r=n.listeners;if(e){const i=n.toFilter(e,t),o=function(e,t){v(e,(function(t,n){Ve(i.listener,t)&&Ue(i.ns,t)&&e.splice(n,1)}),true),e.length||delete r[t]};i.type?r[i.type]&&o(r[i.type],i.type):i.ns&&$e(r,o),arguments.length>1&&null==t&&ze(`emitter.off(type, listener) is invoked, but "listener" is ${t}.`)}else n.listeners={},arguments.length>0&&ze(`emitter.off(type) is invoked, but "type" is ${e}.`)}has(e,t){let n=this.listeners,r=this.toFilter(e,t),i=true,o=function(e){return v(e,(function(e){if(Ve(r.listener,e)&&Ue(r.ns,e))return i=false})),i};return r.type?n[r.type]&&o(n[r.type]):r.ns&&$e(n,o),!i}toEvent(e){const t={type:e,ns:""};if(this.ns){const n=G(e,".");n>=0&&(t.type=Y(e,0,n),t.ns=Y(e,n+1))}return t}toFilter(e,t){let n;if(n=t?a(t)?{listener:t}:t:{},l(n.ns))n.type=e;else{const t=this.toEvent(e);n.type=t.type,n.ns=t.ns}return n}}function Ve(e,t){return!e||e===t.listener}function Ue(e,t){const{ns:n}=t;return!n||!e||n===e}let Me;"function"==typeof setImmediate&&P(setImmediate)&&(Me=setImmediate),Me="function"==typeof MessageChannel&&P(MessageChannel)?function(e){const t=new MessageChannel;t.port1.onmessage=e,t.port2.postMessage(1)}:setTimeout;var He=Me;let Re;class Fe{constructor(e){this.tasks=[],this.hooks=e||i}static shared(){return Re||(Re=new Fe)}append(e,t){const n=this,{tasks:r}=n;k(r,{fn:e,ctx:t}),1===r.length&&He((function(){n.run()}))}prepend(e,t){const n=this,{tasks:r}=n;w(r,{fn:e,ctx:t}),1===r.length&&He((function(){n.run()}))}clear(){this.tasks.length=0}run(){const e=this,{tasks:t,hooks:n}=e,{length:r}=t;if(r){e.tasks=[],n.beforeTask&&n.beforeTask();for(let e=0;e<r;e++)g(t[e].fn,t[e].ctx);n.afterTask&&n.afterTask()}}}function qe(e,t,n){let r;return function(){if(!r){const i=E(arguments);n&&g(e,undefined,i),r=setTimeout((function(){r=undefined,n||g(e,undefined,i)}),t)}}}function We(e,t,n,r,i,o,s){let{name:c,listener:a}=s;if(o){const e=o[c]||o[""];true===e?c="change":e>0&&(a=qe(a,e,"click"===c||"tap"===c))}if(n){if(s.isNative){const t=n.$el;return e.on(t,c,a),function(){e.off(t,c,a)}}n.on(c,s),r["$event_destroy"+i]=function(){n.off(c,s),delete r["$event_destroy"+i]}}else e.on(t,c,a),r["$event_destroy"+i]=function(){e.off(t,i,a),delete r["$event_destroy"+i]}}var Ke=Object.freeze({__proto__:null,afterCreate:function(e,t){const{events:n}=t;if(n){const r=t.node,i=t.component,o=t.lazy,s=t.data;for(let t in n)We(e,r,i,s,t,o,n[t])}},afterUpdate:function(e,t,n){const r=t.events,o=n.events;if(r!==o){const n=t.node,s=t.component,c=t.lazy,a=t.data;if(o){const e=r||i;for(let t in o)if(!e[t]){const e=a["$event_destroy"+t];e&&e()}}if(r){const t=o||i;for(let i in r){const o=r[i],u=t[i];if(u)if(o.value!==u.value){const t=a["$event_destroy"+i];t&&t(),We(e,n,s,a,i,c,o)}else u.runtime&&o.runtime&&(u.runtime.execute=o.runtime.execute,o.runtime=u.runtime);else We(e,n,s,a,i,c,o)}}}},beforeDestroy:function(e,t){const n=t.events,r=t.data;if(n)for(let e in n){const t=r["$event_destroy"+e];t&&t()}}});function Be(e,t){return t&&true!==t?qe(e,t):e}const Ye={set(e,t){e.value=L(t)},sync(e,t,n){n.set(t,e.value)}},Ge={set(e,t){e.checked=e.value===L(t)},sync(e,t,n){e.checked&&n.set(t,e.value)}},Ze={set(e,t){e.checked=u(t)?N(t,e.value,false):!!t},sync(e,t,n){const r=n.get(t);u(r)?e.checked?n.append(t,e.value):n.removeAt(t,T(r,e.value,false)):n.set(t,e.checked)}},Je={set(e,t){const{multiple:n,options:r}=e;for(let i=0,o=r.length;i<o;i++)if(n)r[i].selected=N(t,r[i].value,false);else if(r[i].value==t)return void(e.selectedIndex=i);n||(e.selectedIndex=-1)},sync(e,t,n){const{multiple:r,options:i}=e;if(r){const e=[];for(let t=0,n=i.length;t<n;t++)i[t].selected&&e.push(i[t].value);n.set(t,e)}else n.set(t,i[e.selectedIndex].value)}};function Qe(e,t,n,r,i){let{context:o,model:s,lazy:c,nativeAttrs:a}=i,{keypath:u,value:f}=s,l=c&&(c.model||c[""]);if(n){let e=n.$model,t=Be((function(e){o.set(u,e)}),l);n.watch(e,t),r.$model_destroy=function(){n.unwatch(e,t),delete r.$model_destroy}}else{let n="select"===i.tag?Je:Ye,s="change";if(n===Ye){const e=a&&a.type;"radio"===e?n=Ge:"checkbox"===e?n=Ze:true!==l&&(s="model")}const c=Be((function(){n.sync(t,u,o)}),l);e.on(t,s,c),n.set(t,f),r.$model_control=n,r.$model_destroy=function(){e.off(t,s,c),delete r.$model_destroy,delete r.$model_control}}}var Xe=Object.freeze({__proto__:null,afterCreate:function(e,t){t.model&&Qe(e,t.node,t.component,t.data,t)},afterUpdate:function(e,t,n){const r=t.data,i=t.model,o=n.model;if(i){const n=t.node,s=t.component;if(o)if(i.keypath!==o.keypath)r.$model_destroy(),Qe(e,n,s,r,t);else if(s)s.set(s.$model,i.value);else{const e=r.$model_control;e&&e.set(n,i.value)}else Qe(e,n,s,r,t)}else o&&r.$model_destroy()},beforeDestroy:function(e,t){const n=t.data.$model_destroy;n&&n()}});var et=Object.freeze({__proto__:null,afterCreate:function(e,t){const{nativeAttrs:n}=t;if(n){const r=t.node;for(let t in n)e.setAttr(r,t,n[t])}},afterUpdate:function(e,t,n){const r=t.nativeAttrs,o=n.nativeAttrs;if(r!==o){const n=t.node;if(r){const t=o||i;for(let i in r)undefined!==t[i]&&r[i]===t[i]||e.setAttr(n,i,r[i])}if(o){const t=r||i;for(let r in o)undefined===t[r]&&e.removeAttr(n,r)}}}});var tt=Object.freeze({__proto__:null,afterCreate:function(e,t){const{nativeStyles:n}=t;if(n){const r=t.node.style;for(let t in n)e.setStyle(r,t,n[t])}},afterUpdate:function(e,t,n){const r=t.nativeStyles,o=n.nativeStyles;if(r!==o){const n=t.node.style;if(r){const t=o||i;for(let i in r)undefined!==t[i]&&r[i]===t[i]||e.setStyle(n,i,r[i])}if(o){const t=r||i;for(let r in o)undefined===t[r]&&e.removeStyle(n,r)}}}});function nt(e,t,n){e["$directive_hooks"+n.name]=n.create(t.component||t.node,n,t)}function rt(e,t,n,r){const i=e["$directive_hooks"+n.name],o=i&&i[r];o&&o(n,t)}function it(e){return function(t,n){const{directives:r}=n;if(r){const t=n.data;for(let i in r)rt(t,n,r[i],e)}}}const ot=it("afterMount"),st=it("beforeDestroy");var ct=Object.freeze({__proto__:null,afterCreate:function(e,t){const{directives:n}=t;if(n){const e=t.data;for(let r in n)nt(e,t,n[r])}},beforeUpdate:function(e,t,n){const r=t.directives,o=n.directives,s=t.data;if(o){const e=r||i;for(let n in o)undefined===e[n]&&rt(s,t,o[n],"beforeDestroy")}if(r){const e=o||i,n=[];for(let i in r){const o=r[i];undefined===e[i]?nt(s,t,o):o.value!==e[i].value&&(rt(s,t,o,"beforeUpdate"),n.push(o))}s.$directive_updating=n}},afterUpdate:function(e,t,n){const{data:r}=t;if(r){const e=r.$directive_updating;if(e){for(let n=0,i=e.length;n<i;n++)rt(r,t,e[n],"afterUpdate");r.$directive_updating=undefined}}},afterMount:ot,beforeDestroy:st});function at(e,t){if(5===t.type||7===t.type){const n=t.children[0];return n?at(e,n):e.createComment("")}return t.node}function ut(e,t,n,r){r?e.before(t,n,r):e.append(t,n)}function ft(e,t,n){const r=n.node;t.node=r,t.parentNode=n.parentNode,t.text!==n.text&&e.setNodeText(r,t.text)}function lt(e){e.data&&Mt(e,e.node)}function dt(e,t){e.data&&Ht(e,e.node,t)||t()}function pt(e,t,n,r){r?e.before(t,n.node,r.node):e.append(t,n.node)}function ht(e,t){e.remove(t.parentNode,t.node)}function mt(e,t){t()}function gt(e,t){const n=t.children;for(let t=0,r=n.length;t<r;t++)Lt(e,n[t])}function yt(e,t,n,r){Rt(e,t,n.children,r.children)}function vt(e,t){const n=t.children;for(let t=0,r=n.length;t<r;t++)Vt(e,n[t])}function $t(e,t,n,r){const i=n.children;for(let n=0,o=i.length;n<o;n++)It(e,t,i[n],r)}function bt(e,t){const n=t.children;for(let t=0,r=n.length;t<r;t++)Ut(e,n[t])}const xt={create(e,t){t.node=e.createText(t.text)},update:ft,destroy:r,insert:pt,remove:ht,enter:r,leave:mt},kt={create(e,t){t.node=e.createComment(t.text)},update:ft,destroy:r,insert:pt,remove:ht,enter:r,leave:mt},wt=[et,tt,Object.freeze({__proto__:null,afterCreate:function(e,t){const n=t.ref;if(n){const e=t.context;let r=e.$refs;r||(r=e.$refs={}),r[n]=t.component||t.node}},beforeUpdate:function(e,t,n){const r=t.ref,i=n.ref;if(r||i){const e=t.context,n=t.component||t.node;let o=e.$refs;r?i?r!==i&&(o?o[r]===n&&delete o[r]:o=e.$refs={},o[r]=n):(o||(o=e.$refs={}),o[r]=n):o&&i&&o[i]===n&&delete o[i]}},beforeDestroy:function(e,t){const{ref:n}=t;if(n){const{$refs:e}=t.context,r=t.component||t.node;e&&e[n]===r&&delete e[n]}}}),Ke,Xe,ct],Tt=wt.length;function St(e,t){for(let n=0;n<Tt;n++){const r=wt[n][e];r&&r.apply(undefined,t)}}const _t={create(e,t){const n=t.node=e.createElement(t.tag,t.isSvg);t.children?Pt(e,n,t.children):t.text?e.setElementText(n,t.text):t.html&&e.setHtml(n,t.html),t.isPure||(t.data={}),St("afterCreate",[e,t])},update(e,t,n){const r=n.node;t.node=r,t.parentNode=n.parentNode,t.data=n.data,!t.isPure&&n.isPure&&(t.data={}),St("beforeUpdate",[e,t,n]);const{text:i,html:o,children:s}=t,c=n.text,a=n.html,u=n.children;l(i)?(u&&jt(e,u),i!==c&&e.setElementText(r,i)):l(o)?(u&&jt(e,u),o!==a&&e.setHtml(r,o)):s?u?s!==u&&Rt(e,r,s,u):((c||a)&&e.setElementText(r,""),Pt(e,r,s)):u?jt(e,u):(c||a)&&e.setElementText(r,""),St("afterUpdate",[e,t,n])},destroy(e,t){if(t.isPure)return;St("beforeDestroy",[e,t]);const{children:n}=t;if(n)for(let t=0,r=n.length;t<r;t++)Vt(e,n[t])},insert:pt,remove:ht,enter:lt,leave:dt},Ct={create(e,t){const n=t.data={};let r=undefined;t.tag&&t.context.loadComponent(t.tag,(function(i){Te(n,"$loading")?n.$loading&&(n.$vnode&&(t=n.$vnode,delete n.$vnode),zt(e,t,i),t.operator.enter(t)):r=i})),t.node=e.createComment("component"),r?zt(e,t,r):n.$loading=true},update(e,t,n){const r=n.data;if(t.data=r,t.node=n.node,t.parentNode=n.parentNode,t.component=n.component,r.$loading)return void(r.$vnode=t);St("beforeUpdate",[e,t,n]);const{component:i,slots:o}=t;if(i){let e=t.props;if(e)for(let t in e)i.checkProp(t,e[t]);o&&(e=be(e||{},o)),e&&i.forceUpdate(e)}St("afterUpdate",[e,t,n])},destroy(e,t){const{component:n}=t;n?(St("beforeDestroy",[e,t]),n.destroy(),t.shadow=n.$vnode,t.component=undefined):t.data.$loading=false},insert(e,t,n,r){const{shadow:i}=n;i?(i.operator.insert(e,t,i,r),i.parentNode=t):pt(e,t,n,r)},remove(e,t){const{shadow:n}=t;n?(n.operator.remove(e,n),n.parentNode=undefined):ht(e,t)},enter(e){const{shadow:t}=e;t&&(e.transition?Mt(e,t.node):t.operator.enter(t))},leave(e,t){const{shadow:n}=e;if(n){if(!e.transition)return void n.operator.leave(n,t);if(Ht(e,n.node,t))return}t()}},Nt={create(e,t){gt(e,t),t.node=at(e,t)},update(e,t,n){const{parentNode:r}=n;t.node=n.node,t.parentNode=r,yt(e,r,t,n)},destroy:vt,insert:$t,remove:bt,enter:r,leave:mt},Et={create(e,t){let n=undefined;t.to&&(n=e.find(t.to),n||Pe(`Failed to locate portal target with selector "${t.to}".`)),n||(n=e.getBodyElement()),t.target=n,t.node=e.createComment("");const r=t.children;for(let t=0,i=r.length;t<i;t++)Lt(e,r[t]),It(e,n,r[t])},update(e,t,n){const{target:r}=n;t.node=n.node,t.parentNode=n.parentNode,t.target=r,yt(e,r,t,n)},destroy(e,t){const n=t.children;for(let t=0,r=n.length;t<r;t++)Vt(e,n[t]),Ut(e,n[t])},insert:pt,remove:ht,enter:r,leave:mt},At={create(e,t){gt(e,t),t.data={},t.node=at(e,t),St("afterCreate",[e,t])},update(e,t,n){const{parentNode:r}=n;t.node=n.node,t.parentNode=r,t.data=n.data,St("beforeUpdate",[e,t,n]),yt(e,r,t,n),St("afterUpdate",[e,t,n])},destroy(e,t){St("beforeDestroy",[e,t]),vt(e,t)},insert:$t,remove:bt,enter:lt,leave:dt};function Ot(e,t){return e.type===t.type&&e.tag===t.tag&&e.key===t.key}function Dt(e,t,n){let r,o,s;for(;t<=n;)o=e[t],o&&(s=o.key)&&(r||(r={}),r[s]=t),t++;return r||i}function zt(e,t,n){const r=t.data,i=(t.parent||t.context).createComponent(n,t);return t.component=i,t.shadow=i.$vnode,r.$loading=false,St("afterCreate",[e,t]),i}function Lt(e,t){t.node||t.operator.create(e,t)}function Pt(e,t,n,r,i,o){let s,c=r||0,a=undefined!==i?i:n.length-1;for(;c<=a;)s=n[c],Lt(e,s),It(e,t,s,o),c++}function It(e,t,n,r){const{operator:i}=n;i.insert(e,t,n,r),n.parentNode=t,St("afterMount",[e,n]),i.enter(n)}function jt(e,t,n,r){let i,o=n||0,s=undefined!==r?r:t.length-1;for(;o<=s;)i=t[o],i&&(Vt(e,i),Ut(e,i)),o++}function Vt(e,t){t.operator.destroy(e,t)}function Ut(e,t){const{operator:n}=t;n.leave(t,(function(){n.remove(e,t),t.parentNode=undefined}))}function Mt(e,t){const{context:n,transition:r}=e,i=e.data.$leaving;if(i&&i(),r){const{enter:e}=r;e&&e.call(n,t)}}function Ht(e,t,n){const{context:r,transition:i}=e,o=e.data,s=o.$leaving;if(s&&s(),i){const{leave:e}=i;if(e)return e.call(r,t,o.$leaving=function(){o.$leaving&&(n(),o.$leaving=undefined)}),true}}function Rt(e,t,n,r){let i,o,s=0,c=n.length-1,a=n[s],u=n[c],f=0,l=r.length-1,d=r[f],p=r[l];for(;f<=l&&s<=c;)a?u?d?p?Ot(a,d)?(Ft(e,a,d),a=n[++s],d=r[++f]):Ot(u,p)?(Ft(e,u,p),u=n[--c],p=r[--l]):Ot(u,d)?(Ft(e,u,d),ut(e,t,d.node,e.next(p.node)),u=n[--c],d=r[++f]):Ot(a,p)?(Ft(e,a,p),ut(e,t,p.node,d.node),a=n[++s],p=r[--l]):(i||(i=Dt(r,f,l)),o=a.key?i[a.key]:undefined,undefined!==o?(qt(e,a,r[o]),r[o]=undefined):Lt(e,a),It(e,t,a,d),a=n[++s]):p=r[--l]:d=r[++f]:u=n[--c]:a=n[++s];f>l?Pt(e,t,n,s,c,n[c+1]):s>c&&jt(e,r,f,l)}function Ft(e,t,n){t!==n&&t.operator.update(e,t,n)}function qt(e,t,n){if(t!==n){if(!Ot(t,n)){const r=n.parentNode;return Lt(e,t),void(r&&(It(e,r,t,n),Vt(e,n),Ut(e,n)))}Ft(e,t,n)}}function Wt(e){const{children:t}=e;return{type:e.type,data:e.data,node:e.node,parentNode:e.parentNode,target:e.target,shadow:e.shadow,parent:e.parent,component:e.component,context:e.context,operator:e.operator,tag:e.tag,isSvg:e.isSvg,isStatic:e.isStatic,isPure:e.isPure,slots:e.slots,props:e.props,nativeAttrs:e.nativeAttrs,nativeStyles:e.nativeStyles,directives:e.directives,events:e.events,lazy:e.lazy,transition:e.transition,model:e.model,to:e.to,ref:e.ref,key:e.key,text:e.text,html:e.html,children:t?t.map(Wt):t}}const Kt={},Bt={},Yt={},Gt={};function Zt(e,t){return Bt[t.name]||"portal"===e.tag&&"to"===t.name||"slot"===e.tag&&"name"===t.name}function Jt(e,t){const n=e.split(";");for(let e=0,r=n.length;e<r;e++){const r=n[e],i=r.indexOf(":");if(i>0){const e=B(r.substring(0,i)),n=B(r.substring(i+1));e&&n&&t(F(e),n)}}}function Qt(e,t){return{type:2,isStatic:true,name:e,ns:t}}function Xt(e,t,n){return{type:3,ns:t,name:e,modifier:n}}function en(e,t,n,r){return{type:9,from:e,to:t,equal:n||undefined,index:r,isVirtual:true}}function tn(e){return{type:5,text:e,isStatic:true,isLeaf:true}}Kt.slot=Kt.portal=Kt.fragment=Kt.template=Bt.key=Bt.ref=Bt.slot=true,Yt["if"]=6,Yt.each=9,Gt.fragment=5,Gt.portal=6,Gt.slot=7;const nn=/^[A-Z]|-/,rn=/&[#\w\d]{2,6};/,on=ie("area,base,embed,track,source,param,input,col,img,br,hr"),sn=ie("svg,g,defs,desc,metadata,symbol,use,image,path,rect,circle,line,ellipse,polyline,polygon,text,tspan,tref,textpath,marker,pattern,clippath,mask,filter,cursor,view,animate,font,font-face,glyph,missing-glyph,animateColor,animateMotion,animateTransform,textPath,foreignObject"),cn=ie("min,minlength,max,maxlength,step,size,rows,cols,tabindex,colspan,rowspan,frameborder"),an=ie("disabled,checked,required,multiple,readonly,autofocus,autoplay,reversed,selected,controls,default,loop,muted,novalidate,draggable,contenteditable,hidden,spellcheck,allowfullscreen");function un(e,t,n){if(e.isComponent)return Qt(F(t),n);if("style"===t)return{type:4,isStatic:!0};const r=Qt(t,n);return dn(t)&&(r.defaultValue="spellcheck"===t||"img"===e.tag&&"draggable"===t),r}function fn(e,t,n){return ln(e)?pn(e,t):dn(e)?hn(e,t,n):t}function ln(e){return cn[e]}function dn(e){return an[e]}function pn(e,t){return h(t)||ze(`The value of "${e}" is not a number: ${t}.`),L(t)}function hn(e,t,n){const r=true===t||"true"===t||t===e;return r===n?undefined:r?"true":"false"}function mn(e,t){let n=false,r=false,i=false;return t?i=true:(n=undefined!==sn[e],!n&&nn.test(e)?i=true:"style"===e&&(r=true)),function(e,t,n,r,i){const o="slot"===e,s=!i&&!o&&!!Kt[e],c=!i&&!o&&!s;return{type:1,tag:e,dynamicTag:t,isSvg:n,isStyle:r,isStatic:c,isNative:c,isVirtual:s,isComponent:i}}(e,t,n,r,i)}function gn(e,t){return l(t)&&rn.test(t)?e.html=t:e.text=t,true}function yn(e){return undefined!==e}const vn={};function $n(e){return e>0&&e<33||160===e}function bn(e){return e>47&&e<58}function xn(e){return 64===e}function kn(e){return 36===e||95===e||e>96&&e<123||e>64&&e<91}function wn(e){return kn(e)||bn(e)}function Tn(e,t,n,r){return{type:5,raw:r,left:e,operator:t,right:n,isStatic:On([e,n])}}function Sn(e,t,n){let r=false,i=true,o=0;return"this"===t?(t="",i=false):".."===t?(t="",i=false,o=1):"~"===t?(t="",r=true,i=false):t=An(t),n?_n(t,e):Nn(e,t,r,i,o)}function _n(e,t){return{type:1,raw:t,value:e,isStatic:true}}function Cn(e,t){let n=t.shift(),r=false,i=true,o=0;if(t.length>0){let s=true,c=[],a="",u=[];if(v(t,(function(e){if(s)if(1===e.type){const t=e;if(".."===t.raw)return o+=1,void(a=a?a+"/..":"..");if("this"!==t.raw){const e=L(t.value);k(c,e),a&&(a+=Q(a,"..")?"/":"."),a+=e}}else s=false;s||k(u,e)})),2===n.type){const t=n;r=t.root,i=t.lookup,o+=t.offset;let f=t.name;if(f&&(f=An(f,t),w(c,f)),f=O(c,"."),s)n=Nn(e,f,r,i,o,c);else{let s=t.raw;if(a){let e=".";"~"!==s&&".."!==s||(e="/"),s+=e+a}n=En(e,Nn(s,f,r,i,o,c),undefined,u,r,i,o)}}else n=s?En(e,n,O(c,"."),undefined,r,i,o):En(e,n,undefined,u,r,i,o)}return n}function Nn(e,t,n,r,i,o){return{type:2,raw:e,name:t,root:n,lookup:r,offset:i,literals:o&&o.length>1?o:undefined}}function En(e,t,n,r,i,o,s){return{type:3,raw:e,lead:t,keypath:n,nodes:r,root:i,lookup:o,offset:s,isStatic:t.isStatic&&(!r||On(r))}}function An(e,t){return xn(ee(e,0))&&(e="$slot_"+Y(e,1),t&&(t.name=e)),e}function On(e){let t=true;return v(e,(function(e){if(!e.isStatic)return t=false})),t}vn["true"]=true,vn["false"]=false,vn["null"]=null,vn[void 0]=undefined;const Dn={"+":true,"-":true,"~":true,"!":true,"!!":true},zn={"*":15,"/":15,"%":15,"+":14,"-":14,"<<":13,">>":13,">>>":13,"<":12,"<=":12,">":12,">=":12,"==":11,"!=":11,"===":11,"!==":11,"&":10,"^":9,"|":8,"&&":7,"||":6};class Ln{constructor(e){const t=this;t.index=-1,t.end=e.length,t.code=0,t.content=e,t.go()}go(e){let t=this,{index:n,end:r}=t;n+=e||1,n>=0&&n<r?(t.code=t.codeAt(n),t.index=n):(t.code=0,t.index=n<0?-1:r)}skip(e){const t=this,n=e&&e<0;if(0===t.code){const n=t.index;if(t.go(e),!$n(t.code))return void t.go(n-t.index)}else if(!$n(t.code))return;for(;;){if(!$n(t.code)){n&&t.go();break}t.go(e)}}is(e){return this.code===e}pick(e,t){return Y(this.content,e,yn(t)?t:this.index)}codeAt(e){return ee(this.content,e)}scanToken(){const e=this,{code:t,index:n}=e;let r=false;if(xn(t)&&(r=true,e.go()),kn(e.code))return e.scanTail(n,[e.scanIdentifier(n,r)]);if(r&&e.go(-1),bn(t))return e.scanNumber(n);switch(t){case 0:return;case 39:case 34:return e.scanTail(n,[e.scanString(n,t)]);case 46:return e.go(),bn(e.code)?e.scanNumber(n):e.scanPath(n);case 126:if(47===e.codeAt(n+1))return e.scanPath(n);break;case 40:return e.go(),e.scanTernary(41);case 91:return e.scanTail(n,[(i=e.scanTuple(n,93),o=e.pick(n),{type:7,raw:o,nodes:i,isStatic:On(i)})]);case 123:return e.scanObject(n)}var i,o;const s=e.scanOperator(n);if(s&&Dn[s]){const t=e.scanTernary();if(t){if(1===t.type){const r=t.value;if(d(r))return e.skip(-1),_n(-r,e.pick(n))}return e.skip(-1),function(e,t,n){return{type:4,raw:n,operator:e,node:t,isStatic:t.isStatic}}(s,t,e.pick(n))}e.fatal(n,"Expression expected.")}}scanNumber(e){const t=this;for(;bn(n=t.code)||46===n;)t.go();var n;const r=t.pick(e);if(h(r))return _n(+r,r);t.fatal(e,"Number expected.")}scanString(e,t){const n=this;e:for(;;)switch(n.go(),n.code){case 92:n.go();break;case t:n.go();break e;case 0:n.fatal(e,"Unexpected end of text.");break e}const r=n.pick(e);return _n(new Function("return "+r)(),r)}scanObject(e){let t,n=this,r=[],i=[],o=true;n.go();e:for(;;)switch(n.code){case 125:n.go(),r.length!==i.length&&n.fatal(e,"The length of keys and values must be equal.");break e;case 0:n.fatal(e,"Unexpected end of text.");break e;case 58:n.go(),o=false;break;case 44:n.go(),o=true;break;default:if(t=n.scanTernary(),o){if(t)if(n.skip(),2===t.type)k(r,t.name);else{if(1!==t.type){n.fatal(e,"The key of an object must be a literal or identifier.");break e}k(r,t.value)}}else{if(!t){n.fatal(e,"The value of the object was not found.");break e}n.skip(),k(i,t)}}return function(e,t,n){return{type:8,raw:n,keys:e,values:t,isStatic:On(t)}}(r,i,n.pick(e))}scanTuple(e,t){let n,r=this,i=[];r.go();e:for(;;)switch(r.code){case t:r.go();break e;case 0:r.fatal(e,"Unexpected end of text.");break e;case 44:r.go();break;default:n=r.scanTernary(),n&&(r.skip(),k(i,n))}return i}scanPath(e){let t,n=this,r=[];for(;t="this",n.is(46)?(n.go(),t=".."):n.is(126)&&(n.go(),t="~"),k(r,Sn(t,t,r.length>0)),n.is(47);){n.go();const{index:t,code:i}=n;let o=false;if(xn(i)&&(o=true,n.go()),kn(n.code))return k(r,n.scanIdentifier(t,o,true)),n.scanTail(e,r);if(o&&n.go(-1),!n.is(46)){n.fatal(e,S(r).raw+"/ must be followed by an identifier.");break}n.go()}}scanTail(e,t){let n,r=this;e:for(;;)switch(r.code){case 40:t=[(i=Cn(r.pick(e),t),o=r.scanTuple(r.index,41),s=r.pick(e),{type:9,raw:s,name:i,args:o})];break;case 46:if(r.go(),wn(r.code)){k(t,r.scanIdentifier(r.index,false,true));break}r.fatal(e,"Identifier or number expected.");break e;case 91:if(r.go(),n=r.scanTernary(93),n){k(t,n);break}r.fatal(e,"[] is not allowed.");break e;default:break e}var i,o,s;return Cn(r.pick(e),t)}scanIdentifier(e,t,n){const r=this;do{r.go()}while(wn(r.code));const i=r.pick(e);return t&&1===i.length&&r.fatal(e,"A slot identifier must be followed by its name."),!n&&i in vn?_n(vn[i],i):Sn(i,i,n)}scanOperator(e){const t=this;switch(t.code){case 47:case 37:case 126:case 94:case 42:t.go();break;case 43:t.go(),t.is(43)&&t.fatal(e,'The operator "++" is not supported.');break;case 45:t.go(),t.is(45)&&t.fatal(e,'The operator "--" is not supported.');break;case 33:t.go(),t.is(33)?t.go():t.is(61)&&(t.go(),t.is(61)&&t.go());break;case 38:t.go(),t.is(38)&&t.go();break;case 124:t.go(),t.is(124)&&t.go();break;case 61:t.go(),t.is(61)?(t.go(),t.is(61)&&t.go()):t.fatal(e,"Assignment statements are not supported.");break;case 60:t.go(),(t.is(61)||t.is(60))&&t.go();break;case 62:t.go(),t.is(61)?t.go():t.is(62)&&(t.go(),t.is(62)&&t.go())}if(t.index>e)return t.pick(e)}scanBinary(e){let t,n,r,i,o,s,c=this,a=[];for(;;){if(c.skip(),k(a,c.index),t=c.scanToken(),t){if(k(a,t),k(a,c.index),c.skip(),r=c.scanOperator(c.index),r&&(i=zn[r])){for(;n=a.length-4,(o=a[n])&&(s=zn[o])&&s>=i;)a.splice(n-2,5,Tn(a[n-2],o,a[n+2],c.pick(a[n-3],a[n+3])));k(a,r);continue}r=undefined}else r&&c.fatal(e,"Invalid syntax.");break}for(;;){if(!(a.length>=7))return a[1];n=a.length-4,a.splice(n-2,5,Tn(a[n-2],a[n],a[n+2],c.pick(a[n-3],a[n+3])))}}scanTernary(e){const t=this;t.skip();let n,r,i=t.index,o=t.scanBinary(i);return t.is(63)&&(t.go(),n=t.scanTernary(),t.is(58)&&(t.go(),r=t.scanTernary()),o&&n&&r?(t.skip(-1),o=function(e,t,n,r){return{type:6,raw:r,test:e,yes:t,no:n,isStatic:On([e,t,n])}}(o,n,r,t.pick(i))):t.fatal(i,"Invalid ternary syntax.")),yn(e)&&(t.skip(),t.is(e)?t.go():t.fatal(i,`"${String.fromCharCode(e)}" expected, "${String.fromCharCode(t.code)}" actually.`)),o}fatal(e,t){Pe(`Error compiling expression\n\n${this.content}\n\nmessage: ${t}\n`)}}const Pn=V((function(e){return new Ln(e).scanTernary(0)})),In={},jn=/\s*:\s*([_$a-z]+)$/i,Vn=/^[_$a-z]([\w]+)?$/i,Un=/^[_$a-z]([\w]+)?$/i,Mn=/^[_$a-z]([\w]+)?\.[_$a-z]([\w]+)?$/i,Hn=/^\s*[\n\r]\s*|\s*[\n\r]\s*$/g,Rn=/\s*(=>|->)\s*/,Fn=/<(\/)?([a-z][-a-z0-9]*|\$[^\s]*)/i,qn=/^\s*([-$.:\w]+)(?:=(['"]))?/,Wn=/^[!=]*['"]/,Kn=/^\s*(\/)?>/;function Bn(e,t){return B(Y(e,t.length))}function Yn(e){if(e.safe&&1===e.expr.type)return tn(L(e.expr.value))}function Gn(e){return e&&11===e.type&&!e.safe}function Zn(e,t){return e>=0&&t>=0?e<t?-1:1:e>=0?-1:t>=0?1:0}function Jn(e,t,n,r){for(;;){const i=t.text.indexOf("\x3c!--",t.position),o=t.text.indexOf("--\x3e",t.position);switch(Zn(i,o)){case-1:t.position=i+1;const s={startIndex:i};k(e,s),n&&n(t,s);break;case 1:t.position=o+1;const{length:c}=e;if(c>0){const n=_(e);n.endIndex=o+"--\x3e".length;const i=1===c;if(r){if(false===r(t,n,i))return}if(i)return}break;case 0:return}}}function Qn(e){const t=[];let n=false;for(let r=0;r<e.length;r++){const i=e[r];if(5===i.type){const o=i;Jn(t,{text:o.text,position:0},(function(e,t){t.index=r,t.text=Y(o.text,0,t.startIndex)}),(function(t,i){const s=i.index,c=r,a=i.text,u=Y(o.text,i.endIndex);if(s===c)return t.text=o.text=a+u,void(t.position=i.startIndex);let f=s,l=c;a&&(e[s].text=a,f++),u&&(e[c].text=u,l--);const d=l-f+1;return d>0&&(n=true,e.splice(f,d),r=f-1),false}))}}if(n)for(let t=0;t<e.length;t++){const n=e[t];if(5===n.type){const r=e[t+1];r&&5===r.type&&(n.text+=r.text,e.splice(t+1,1))}}}function Xn(t){let n,r,i,o,s,a=K(c.leftDelimiter,2),u=K(c.rightDelimiter,2),f=c.leftDelimiter,l=c.rightDelimiter,p=[],h=[],m=[],g=[],y=[],$=[],b=t.length,x=0,w=0,C=0,N=0,E=1,A=[],O=[],D=function(e){Pe(`Error compiling template\n\n${t}\n\nmessage: ${e}`)},z=function(e){const t=S(h);if(t&&1===t.type){const r=t;r.tag!==e&&(n=r.tag,void 0!==on[n])&&L(r.type,r.tag)}var n},L=function(e,t){const n=_(h);n&&n.type===e||D("The type of poping node is not expected.");const i=n,o=1===e,s=2===e,c=4===e,a=3===e,u=S(h);o&&t&&i.tag!==t&&D(`End tag is "${t}",but start tag is "${i.tag}".`);let{children:f}=i;if(f&&f.length>1&&(r||(Qn(f),f.length||(f=i.children=undefined))),f){const e=1===f.length&&f[0];if(e)switch(e.type){case 5:o?P(i,e):r&&(s?M(r,i,e):c?V(r,i,e):a&&q(r,i,e));break;case 11:o?I(i,e):r&&(s||c||a)&&H(r,i,e)}}else r&&(s?U(r,i):c?j(r,i):a&&R(r,i));return i.isVirtual&&!i.children&&ee(i),o?Z(i):r&&s&&Q(r,i),u&&u.isStatic&&!i.isStatic&&(u.isStatic=false),i},P=function(e,t){e.isNative&&gn(e,t.text)&&(e.children=undefined)},I=function(e,t){e.isNative&&(t.safe&&gn(e,t.expr)||!t.safe&&function(e,t){return e.html=t,!0}(e,t.expr))&&(e.children=undefined)},j=function(e,t){ee(t)},V=function(e,t,n){n.text?(t.value=n.text,t.children=undefined):ee(t)},U=function(e,t){Zt(e,t)?D(`The value of "${t.name}" is empty.`):t.value=function(e,t,n){return!!e.isComponent||(ln(t)?void 0:dn(t)?hn(t,!0,n):"")}(e,t.name,t.defaultValue)},M=function(e,t,n){const{text:r}=n;e.isNative?t.value=fn(t.name,r,t.defaultValue):t.value=r,t.children=undefined},H=function(e,t,n){const{expr:r}=n;if(1===r.type){let n=r.value;e.isNative&&2===t.type&&(n=fn(t.name,n,t.defaultValue)),t.value=n}else t.expr=r;t.children=undefined},R=function(e,t){t.value=true},q=function(e,t,n){let i,o,{ns:s}=t,{text:c}=n,a="model"===s,u="lazy"===s,f="event"===s,l="o"===s;try{i=Pn(c)}catch(p){o=p}if(i){{const{raw:e}=i;if(u)(1!==i.type||!d(i.value)||i.value<=0)&&D("The value of lazy must be a number greater than 0.");else if(9===i.type){const e=i.name;2!==e.type?D("Invalid method name."):Vn.test(e.name)||D("Invalid method name.")}else f&&(Un.test(e)||Mn.test(e)?(Mn.test(e)&&"native"===e.split(".")[1]&&D('The event namespace "native" is not permitted.'),r&&r.isComponent&&t.name===e&&D("The event name listened and fired can't be the same.")):D("The event name and namespace must be an identifier."));a&&2!==i.type&&D("The value of the model must be an identifier."),l&&9===i.type&&D(`The value of the directive [${t.ns}-${t.name}] can't be a method call.`)}t.expr=i,t.value=1===i.type?i.value:c}else{if(!l)throw o;t.value=c}t.children=undefined},W=function(e){let t=e,n=[],r=false,i=false;for(;k(n,t),t.next;)t=t.next;v(n,(function(e){e.children&&(!r&&e.next&&delete e.next,i=r=true)}),true),i||ee(e)},Z=function(e){const{tag:t,slot:n}=e,r="template"===t,i="fragment"===t,o="portal"===t;r&&(e.key?D('The "key" attribute is not supported in <template>.'):e.ref?D('The "ref" attribute is not supported in <template>.'):e.attrs?D("The attributes and directives are not supported in <template>."):n||D('The "slot" attribute is required in <template>.')),(r||i||o)&&!e.children?ee(e):e.isNative&&function(e){let{attrs:t}=e,n=!1;if(t&&v(t,(function(e){"type"===(2===e.type?e.name:void 0)&&(n=!0)})),e.isStyle&&!n){const t=Qt("type");t.value="text/css",k(e.attrs||(e.attrs=[]),t)}}(e)},Q=function(e,t){const{name:n,value:r}=t,i="slot"===n;if(i){const{tag:t,isComponent:n,isNative:r}=e;"template"===t||n||r||D(`The "slot" attribute can't be used in <${t}>.`)}if(Zt(e,t)){const o=i;S(h)!==e&&D(`The "${n}" attribute can't be used in an if block.`),""===r?D(`The value of "${n}" attribute is empty.`):o&&oe(r)&&D(`The value of "${n}" attribute can only be a string literal.`),e[n]=o?r:t,ee(t),t.isStatic&&(t.isStatic=false)}},ee=function(e,t){let n,i,o,s=S(h);s?(n=r&&r===s,i=n?s.attrs:s.children):i=p,i&&(o=T(i,e),o>=0&&(t?i[o]=t:(i.splice(o,1),s&&!i.length&&(n?delete s.attrs:s.children=undefined))))},te=function(e){r||z();let t=e.type,n=S(h),o=undefined,s=undefined,c=undefined;if(7===t){const e=S(g);e?6===e.type?o=e:7===e.type?s=e:D('The "else" block must not be followed by an "else if" block.'):D('The "if" block is required.')}else if(8===t){const e=S(g),t=S($);e&&n===e?6===e.type?o=e:7===e.type?s=e:D('The "else" block can\'t appear more than once in a conditional statement.'):t&&n===t?9===t.type?c=t:D('The "else" block can\'t appear more than once in a conditional statement.'):D('The "if" block is required.')}else if(n)if(r&&1===n.type)Gn(e)&&D("The dangerous interpolation must be the only child of a HTML element."),k(r.attrs||(r.attrs=[]),e);else{i&&3===i.type&&5!==t?D(`For performance, "${a}" and "${u}" are not allowed in directive value.`):3===t&&"model"===e.ns&&n!==r&&D('The "model" can\'t be used in an if block.');const o=n.children||(n.children=[]),s=S(o);if(11===t&&(!r||i&&o.length>0)){const n=Yn(e);n&&(e=n,t=n.type)}if(s&&5===t){if(5===s.type)return void(s.text+=e.text);if(11===s.type){const t=Yn(s);if(t)return o[o.length-1]=t,void(t.text+=e.text)}}Gn(e)?s?D("The dangerous interpolation must be the only child of a HTML element."):1===n.type&&n.isNative||D("The dangerous interpolation must be the only child of a HTML element."):Gn(s)&&D("The dangerous interpolation must be the only child of a HTML element."),k(o,e)}else Gn(e)&&D("The dangerous interpolation must be under a HTML element."),k(p,e);6===t?(k(m,e),k(g,e)):9===t?(k(y,e),k($,e)):o?(o.next=e,g[g.length-1]=e,L(o.type)):s?(s.next=e,g[g.length-1]=e,L(s.type)):c&&(c.next=e,$[$.length-1]=e,L(c.type)),e.isLeaf?n&&n.isStatic&&!e.isStatic&&(n.isStatic=false):k(h,e)},ne=function(e){(e=e.replace(Hn,""))&&te(tn(e))},re=[function(e){if(!n&&!r){const t=e.match(Fn);if(t&&0===t.index){let e=t[2];if("/"===t[1])z(e),r=L(1,e);else{if("template"===e){const e=S(h);e&&e.isComponent||D("<template> can only be used within an component children.")}let t;"$"===X(e)&&(e=Y(e,1),t=Pn(e),t?2!==t.type&&D(`The dynamic component "${e}" is not a valid identifier.`):D(`The dynamic component "${e}" is not a valid expression.`));const n=mn(e,t);te(n),r=n}return t[0]}}},function(e){if(n)return;const t=e.match(Kn);return t&&r&&!i?("/"===t[1]&&L(r.type,r.tag),r=undefined,t[0]):void 0},function(e){if(!n&&r&&!i){e.match(Wn)&&D("The previous attribute is not end.");const t=e.match(qn);if(t){let e,n=t[1];if("model"===n||"transition"===n)e=Xt("",n);else if(J(n,"on-")){const t=Bn(n,"on-");t||D("The event name is required.");const r=F(t).split(".");e=Xt(r[0],"event",r[1]),r.length>2&&D("Invalid event namespace.")}else if("lazy"===n)e=Xt("","lazy");else if(J(n,"lazy-")){const t=Bn(n,"lazy-");t||D("The lazy name is required."),e=Xt(F(t),"lazy")}else if(J(n,"o-")){const t=Bn(n,"o-");t||D("The directive name is required.");const r=F(t).split(".");e=Xt(r[0],"o",r[1]),r.length>2&&D("Invalid directive modifier.")}else{const t=n.split(":");e=2===t.length?un(r,t[1],t[0]):un(r,n)}return te(e),s=t[2],s?i=e:L(e.type),t[0]}}},function(e){let t,o=undefined;if(!n&&i&&s)t=e.match(In[s]||(In[s]=new RegExp(s))),t?(o=Y(e,0,t.index),ne(o),i.children||te(tn("")),o+=s,L(i.type),i=undefined):(o=e,ne(o));else if(r)B(e)&&D(`Invalid character is found in <${r.tag}> attribute level.`),o=e;else{let r="";if(!n&&(t=e.match(Fn),t)){const n=t.index;Zn(n,e.indexOf("\x3c!--"))<0&&(o=Y(e,0,n),r=o)}if(!yn(o)){let t=-1,i=-1;const s=n,c=n||[];n=undefined,Jn(c,{text:e,position:0},(function(i,s){t<0&&(t=s.startIndex,o=e,r=e,n=c)}),(function(c,a,u){u&&(n=undefined,i=a.endIndex,t>=0?s?(o=Y(e,0,i),r=o):(o=Y(e,0,i),r=Y(e,0,t)):(o=Y(e,0,i),r=o))}))}yn(o)||(o=e,r=e),ne(r)}return o}],ie=[function(e){if(J(e,"#each")){r&&D(i?'The "each" block can\'t be appear in an attribute value.':'The "each" block can\'t be appear in attribute level.');let t=e=B(Bn(e,"#each")),n=undefined,o=e.match(jn);if(o&&(n=o[1],t=Y(e,0,-1*o[0].length)),t&&""!==n||D("Invalid each"),"$scope"!==n&&"$keypath"!==n&&"$length"!==n&&"$event"!==n&&"$data"!==n||D(`The each index can't be "${n}".`),o=t.match(Rn),o){const e=t.split(Rn),r=Pn(e[0]),i=Pn(e[2]);if(r&&i)return en(r,i,"=>"===o[1],n)}else{const e=Pn(t);if(e)return en(e,undefined,false,n)}D("Invalid each")}},function(e){if(J(e,">")){(e=Bn(e,">"))||D("Invalid import"),r&&D(i?'The "import" block can\'t be appear in an attribute value.':'The "import" block can\'t be appear in attribute level.');const t=Pn(e);return t||D("Invalid import"),function(e){return{type:10,expr:e,isLeaf:!0}}(t)}},function(e){if(J(e,"#if")){e=Bn(e,"#if");const t=Pn(e);return t||D("Invalid if"),function(e){return{type:6,expr:e,isVirtual:!0}}(t)}},function(e){if(J(e,"else if")){e=Bn(e,"else if");const t=Pn(e);return t||D("Invalid else if"),function(e){return{type:7,expr:e,isVirtual:!0}}(t)}},function(e){if(J(e,"else"))return B(e=Bn(e,"else"))&&D('The "else" must not be followed by anything.'),{type:8,isVirtual:!0}},function(e){if(J(e,"...")){e=Bn(e,"...");const t=Pn(e);if(t||D("Invalid spread"),r&&r.isComponent)return function(e){return{type:12,expr:e,isLeaf:!0}}(t);D("The spread can only be used by a component.")}},function(t){if(!e.test(t)){t=B(t);const e=Pn(t);return e||D("Invalid expression"),function(e,t){return{type:11,expr:e,safe:t,isLeaf:!0,isStatic:e.isStatic}}(e,2===E)}}],se=function(e){for(;e;)v(re,(function(t){const n=t(e);if(n)return e=Y(e,n.length),false}))},ce=function(e){if("/"===X(e)){z();const t=Y(e,1);let n=Yt[t],r=undefined,i=undefined;if(6===n){const e=_(g);e?(n=e.type,r=_(m)):D('The "if" block is closing, but it\'s not open yet.')}else if(9===n){const e=_($);e?(n=e.type,i=_(y)):D('The "each" block is closing, but it\'s not open yet.')}L(n),r?W(r):i&&W(i)}else v(ie,(function(t){const n=t(e);if(n)return te(n),false}))},ae=function(){if(x=N+u.length,!(x<=b))return true;x<b&&X(t,x)===l?3===E?w=x+1:D(`${a} and ${l}${u} is not a pair.`):2===E?w=x:D(`${a}${f} and ${u} is not a pair.`),_(A),ue(N)},ue=function(e){A.length||k(O,e)};for(;;)if(ue(w),C=G(t,a,w),N=G(t,u,w),N>=w&&(C<0||N<C)){if(ae())break}else{if(!(C>=w))break;if(E=2,ue(C),C+=a.length,C<b)if(X(t,C)===f&&(E=3,C++),ue(C),ue(E),k(A,true),C<b)if(N=G(t,u,C),N>=C){if(w=G(t,a,C),(w<0||N<w)&&ae())break}else D("The end delimiter is not found.");else D("Unterminated template literal.");else D("Unterminated template literal.")}E=1;for(let e=0,n=O.length;e<n;e+=5)x=O[e],C=O[e+1],yn(C)?(se(Y(t,x,C)),C=O[e+2],E=O[e+3],N=O[e+4],o=B(Y(t,C,N)),o&&ce(o)):(E=1,se(Y(t,x)));return h.length&&(z(),h.length&&D("Some nodes is still in the stack.")),p.length>0&&Qn(p),p}let er=undefined,tr=undefined,nr=ie("abstract,goto,native,static,enum,implements,package,super,byte,export,import,private,protected,public,synchronized,char,extends,int,throws,class,final,interface,transient,yield,let,const,float,double,boolean,long,short,volatile,default"),rr=0,ir={},or={},sr="",cr="",ar="",ur="",fr="",lr="",dr="",pr="",hr="";class mr{constructor(e){this.value=e}toString(){const{value:e}=this;return true===e?fr:false===e?lr:null===e?ur:undefined===e?ar:l(e)?Wr(e):""+e}}class gr{constructor(e,t,n,r,i,o){this.left=e,this.right=t,this.separator=n,this.breakLine=r,this.offset=i,this.items=o||[]}unshift(e){w(this.items,e)}push(e){k(this.items,e)}toString(e){let{left:t,right:n,separator:r,breakLine:i,offset:o,items:s}=this,{length:c}=s;if(!c)return`${t}${n}`;const a=e||0,u=a+o,f=K(pr,a),l=K(pr,u),d=s.map((function(e){return e.toString(u)}));return t&&i&&(t+=hr+l),n&&i&&(n=hr+f+n),`${t}${O(d,i?r+hr+l:r+dr)}${n}`}}class yr{constructor(e){this.items=e||[]}add(e){k(this.items,e)}toString(e){const{items:t}=this;return 1===t.length?t[0].toString(e):new gr("(",")",",",true,1,t).toString(e)}}class vr{constructor(e){if(this.fields={},e){const t=this;$e(e,(function(e,n){t.set(n,e)}))}}set(e,t){t instanceof mr&&undefined===t.value||(this.fields[e]=t)}isNotEmpty(){return ve(this.fields).length>0}toString(e){const{fields:t}=this;return Or("{","}",",",true,1,ve(t).sort().map((function(e){return{toString:n=>function(e,t){/^[\w$]+$/.test(e)&&!nr[e]||(e=Wr(e));return`${e}:${dr}${t}`}(e,t[e].toString(n))}}))).toString(e)}}class $r{constructor(e,t){this.name=e,this.args=t}toString(e){const{name:t,args:n}=this,r=n?function(e){let t=[],n=true;return v(e,(function(e){!(e instanceof mr)||undefined!==e.value?(n=false,w(t,e)):n||w(t,Ar(undefined))}),true),t}(n):[];return r.length?`${t.toString(e)}${Or("(",")",",",true,1,r).toString(e)}`:t.toString(e)+"()"}}class br{constructor(e){this.value=e}toString(e){return`(${this.value.toString(e)})`}}class xr{append(e){const{buffer:t}=this;this.buffer=t?Vr(t instanceof Tr?Ir(t):t,"+",e instanceof Tr?Ir(e):e):e}toString(e){return this.buffer.toString(e)}}class kr{constructor(e,t){this.operator=e,this.value=t}toString(e){return`${this.operator}${this.value.toString(e)}`}}class wr{constructor(e,t,n){this.left=e,this.operator=t,this.right=n}toString(e){return`${this.left.toString(e)}${dr}${this.operator}${dr}${this.right.toString(e)}`}}class Tr{constructor(e,t,n){this.test=e,this.yes=t,this.no=n}toString(e){return`${this.test.toString(e)}${dr}?${dr}${this.yes.toString(e)}${dr}:${dr}${this.no.toString(e)}`}}class Sr{constructor(e,t,n){this.args=e,this.body=t,this.returnValue=n}toString(e){const{args:t,body:n,returnValue:r}=this,i=e||0,o=i+1,s=K(pr,i),c=K(pr,o),a=t?Or("","",",",false,1,t).toString(i):"",u=[];return n&&k(u,n.toString(o)+(r?";":"")),r&&k(u,"return "+r.toString(o)),`function${dr}(${a})${dr}{${hr}${c}${O(u,hr+c)}${hr}${s}}`}}class _r{constructor(e,t){this.base=e,this.props=t}toString(e){const{base:t,props:n}=this;let r=t.toString(e);return v(n,(function(t){t instanceof mr?h(t.value)?r+=`[${dr}${t.value}${dr}]`:r+="."+t.value:r+=`[${dr}${t.toString(e)}${dr}]`})),r}}class Cr{constructor(e,t,n){this.name=e,this.value=t,this.isDeclaration=n}toString(e){const{name:t,value:n,isDeclaration:r}=this,i=`${t.toString(e)}${dr}=${dr}${n.toString(e)}`;return r?"var "+i:i}}class Nr{constructor(e,t){this.array=e,this.item=t}toString(e){const{array:t,item:n}=this;return Pr(Hr(t,[Ar("push")]),[n]).toString(e)}}class Er{constructor(e,t){this.value=e,this.type=t}toString(e){const{value:t,type:n}=this;return`typeof ${t.toString(e)}${dr}===${dr}${Wr(n)}`}}function Ar(e){return new mr(e)}function Or(e,t,n,r,i,o){return new gr(e,t,n,r,i,o)}function Dr(e){return new yr(e)}function zr(e,t){let n=Or("[","]",",",true,1,e);return l(t)?{toString:e=>`${n.toString(e)}.join(${Ar(t).toString()})`}:n}function Lr(e){return new vr(e)}function Pr(e,t){return new $r(e,t)}function Ir(e){return new br(e)}function jr(){return new xr}function Vr(e,t,n){return new wr(e,t,n)}function Ur(e,t,n){return new Tr(e,t,n)}function Mr(e,t,n){return new Sr(e,t,n)}function Hr(e,t){return new _r(e,t)}function Rr(e,t,n){return new Cr(e,t,n)}function Fr(e,t){return new Nr(e,t)}function qr(){return cr}function Wr(e){return`"${e=e.replace(/\\?'/g,"\\'").replace(/\\?"/g,'\\"').replace(/\n\s*/g,"\\n")}"`}function Kr(e,t){const n=e?e.toString():undefined;if(t&&n&&or[n])return or[n];const r=sr+rr++;return ir[r]=e,t&&n&&(or[n]=r),r}function Br(e){return e.split(".").filter((function(e){return e.length>0})).map(Ar)}function Yr(e,t){const n=[];$e(ir,(function(e,t){k(n,{toString:n=>function(e,t){return void 0!==t?`${e}${dr}=${dr}${t}`:e}(t,e?e.toString(n):undefined)})}));return`(${Mr(undefined,Or("var ","",",",false,0,n),Mr(e,t)).toString()})()`}function Gr(e){return 6===e.type||5===e.type}function Zr(e,t,n,r,i,o,s){let c,a=false,u=function(e,o){return Zr(e,t,n,r,i,false,o)},f=function(e,t){return e.map((function(e){return u(e,t)}))};switch(e.type){case 1:c=Ar(e.value);break;case 4:const l=e;c=function(e,t){return new kr(e,t)}(l.operator,u(l.node));break;case 5:let d=e,p=u(d.left),h=u(d.right);c=Vr(Gr(d.left)?Ir(p):p,d.operator,Gr(d.right)?Ir(h):h);break;case 6:const m=e;c=Ur(u(m.test),u(m.yes),u(m.no));break;case 7:c=zr(f(e.nodes,s));break;case 8:const g=e,y=Lr();v(g.keys,(function(e,t){const n=g.values[t];y.set(e,u(n))})),c=y;break;case 2:a=true;const $=e;c=t($)||n($,$.name?Br($.name):[],$.name,o,s);break;case 3:a=true;const b=e;if(b.isStatic)c=b.raw;else if(2===b.lead.type){const e=b.lead,i=t(e),a=f(b.nodes||[]);i?c=r(i,a,o):(e.name&&v(Br(e.name),(function(e){a.unshift(e)}),true),c=n(b,a,undefined,o,s))}else c=b.nodes?r(u(b.lead),f(b.nodes||[]),o):r(u(b.lead),Br(b.keypath),o);break;default:a=true;const x=e;c=i(x,u(x.name,x),x.args.length?f(x.args):undefined,o)}return!o||a?c:Lr({value:c})}const Jr=[true],Qr=[],Xr=[],ei=[],ti=[true],ni=[],ri=[],ii=["$keypath","$length","$event","$data"],oi={},si=Ar(undefined),ci=Ar(true);let ai=undefined,ui=undefined,fi="",li="",di="",pi="",hi="",mi="",gi="",yi="",vi="",$i="",bi="",xi="",ki="",wi="",Ti="",Si="",_i="",Ci="",Ni="",Ei="",Ai="",Oi="",Di="",zi="",Li="",Pi="",Ii="",ji="",Vi="",Ui="",Mi="",Hi="",Ri="",Fi="",qi="",Wi="",Ki="",Bi="",Yi="",Gi="",Zi="",Ji="",Qi="";class Xi{constructor(e){this.text=e}toString(e){return Lr({type:Ar(2),isPure:ci,operator:Ai,text:this.text}).toString(e)}}class eo{constructor(e){this.buffer=jr(),this.append(e)}append(e){this.buffer.append(e)}toString(e){return Lr({type:Ar(1),isPure:ci,operator:Ei,text:this.buffer}).toString(e)}}function to(e){if(N(ii,e))switch(e){case"$keypath":return Gi;case"$length":return Zi;case"$event":return Ji;case"$data":return Qi;default:return e}}function no(e){const{name:t,root:n,lookup:r,offset:i,literals:o}=e;if(o){const e=to(o[0]);if(yn(e)){const t=xe(o);return t[0]=e,O(t,".")}}else{const e=to(t);if(yn(e))return e}if(S(Xr)&&false===n&&false===r&&0===i)return""===t?Yi:Hr(Yi,Br(t))}function ro(e,t){return t?e:Hr(e,[Ar("value")])}function io(e,t,n,r,i){const{root:o,lookup:s,offset:c}=e,{length:a}=t,u=function(e,t){return e?Ar(0):Vr(Hr(qi,[Ar("length")]),"-",Ar(1+(t||0)))}(o,c);let f=si;i&&9===i.type&&s&&n&&a>0&&(f=a>1?Hr(Ui,t):ho(Vi,Ui,n));let d=Pr(Ti,[qi,u,l(n)?Ar(n):zr(t,"."),zr(t),s?ci:si,f]);if(n&&1===a)if(o||c||s)if(o||c){const e=Dr(),t=qr();e.add(Rr(t,Hr(qi,[u]))),e.add(Pr(Ci,[Hr(Pr(Hr(t,[Ar("getScope")])),[Ar(n)]),Pr(Hr(t,[Ar("getKeypath")]),[Ar(n)])])),d=e}else d=Pr(Si,[qi,u,Ar(n),f]);else d=Pr(Ci,[Hr(Yi,t),Pr(Hr(Hr(qi,[u]),[Ar("getKeypath")]),[Ar(n)])]);else if(!n&&!a){const e=Dr(),t=qr();e.add(Rr(t,Hr(qi,[u]))),e.add(Pr(Ci,[Pr(Hr(t,[Ar("getScope")])),Hr(t,[Ar("keypath")])])),d=e}return ro(d,r)}function oo(e,t,n){let r;switch(t.length){case 0:r=Pr(Ci,[e]);break;case 1:r=Pr(Ci,[Hr(e,t)]);break;default:r=Pr(_i,[e,zr(t)])}return ro(r,n)}function so(e,t,n,r){const i=Dr(),o=qr();return i.add(Rr(o,t)),i.add(Ur(new Er(o,"function"),Pr(o,n),Pr(Hr(ji,[Ar("fatal")]),[Ar(`[${e.raw}] is not a function.`)]))),ro(Pr(Ci,[i]),r)}function co(e,t){const n=Zr(e,no,io,oo,so,t);return e.isStatic?Kr(n,true):n}function ao(e){const t=jr();return k(ni,t),v(e,(function(e){oi[e.type](e)})),_(ni),t}function uo(e){return yn(e.value)?Ar(e.valu