compelem 0.6.0-b1 → 0.6.2-b1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CompElem.d.ts +2 -0
- package/IComponent.d.ts +1 -0
- package/README.md +1 -23
- package/compelem.umd.js +2 -2
- package/decorator/Decorator.d.ts +1 -1
- package/decorators/debounced.d.ts +1 -6
- package/index.js +2 -2
- package/package.json +2 -2
package/CompElem.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export declare class CompElem extends CompElem_base implements IComponent {
|
|
|
33
33
|
get renderRoot(): HTMLElement;
|
|
34
34
|
get renderRoots(): HTMLElement[];
|
|
35
35
|
get parentComponent(): CompElem | null;
|
|
36
|
+
get wrapperComponent(): CompElem | null;
|
|
36
37
|
get slotHooks(): Record<string, (...args: any[]) => Template>;
|
|
37
38
|
get css(): CSSStyleSheet[];
|
|
38
39
|
get isMounted(): boolean;
|
|
@@ -93,6 +94,7 @@ export declare class CompElem extends CompElem_base implements IComponent {
|
|
|
93
94
|
* 1. 取消上溯递归路径
|
|
94
95
|
*/
|
|
95
96
|
_regDeps(varPath: string, renderContext: CompElem | Directive): void;
|
|
97
|
+
_regWrapper(wrapperComponent: CompElem): void;
|
|
96
98
|
/**
|
|
97
99
|
* 抛出自定义事件
|
|
98
100
|
* @param evName 事件名称
|
package/IComponent.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export interface IComponent {
|
|
|
10
10
|
get renderRoot(): HTMLElement;
|
|
11
11
|
get renderRoots(): HTMLElement[];
|
|
12
12
|
get parentComponent(): HTMLElement | null;
|
|
13
|
+
get wrapperComponent(): HTMLElement | null;
|
|
13
14
|
get slots(): Record<string, Array<Node>>;
|
|
14
15
|
get slotHooks(): Record<string, (...args: any[]) => Template>;
|
|
15
16
|
get css(): CSSStyleSheet[];
|
package/README.md
CHANGED
|
@@ -174,22 +174,6 @@ export class PageTest extends CompElem {
|
|
|
174
174
|
属性可以在组件内修改但默认不会同步父组件,除非显式指定`sync`或自行 emit update 事件
|
|
175
175
|
全部注解参数见 `PropOption`
|
|
176
176
|
|
|
177
|
-
> 在某些无法使用装饰器的场景中(如MixinClass),可以使用函数`makeProp(...)`定义prop
|
|
178
|
-
```ts
|
|
179
|
-
export function Loadable<T extends Constructor<any>>(spuerClass: T) {
|
|
180
|
-
return class Loadable extends spuerClass {
|
|
181
|
-
//declare a prop
|
|
182
|
-
name: string
|
|
183
|
-
|
|
184
|
-
constructor(...args: any[]) {
|
|
185
|
-
super()
|
|
186
|
-
//make the prop reactive
|
|
187
|
-
Decorator.call(this, prop, 'name', { type: String })
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
```
|
|
192
|
-
|
|
193
177
|
- ### 状态
|
|
194
178
|
状态是仅由组件内部初始化的响应变量,可通过`@state`注解定义
|
|
195
179
|
```ts
|
|
@@ -250,6 +234,7 @@ export class PageTest extends CompElem {
|
|
|
250
234
|
```
|
|
251
235
|
- ### 内置属性及函数
|
|
252
236
|
- `readonly` parentComponent 父组件引用,可能为空
|
|
237
|
+
- `readonly` wrapperComponent 包装(组件所在视图归属)组件引用,可能为空
|
|
253
238
|
- `readonly` renderRoot/renderRoots 渲染根元素/渲染根元素列表
|
|
254
239
|
- `readonly` shadowRoot 阴影DOM
|
|
255
240
|
- `readonly` slots 插槽元素映射
|
|
@@ -403,13 +388,6 @@ static get autoSlot() {
|
|
|
403
388
|
- @computed 计算属性,仅在响应变量变更时更新缓存值
|
|
404
389
|
- @debounced 定义函数防抖
|
|
405
390
|
|
|
406
|
-
> 装饰器还可通过函数方式进行调用,如
|
|
407
|
-
> ```ts
|
|
408
|
-
> //Decorator.call(class, decorator, fieldName, ...args)
|
|
409
|
-
> Decorator.call(this, prop, 'name', { type: String })
|
|
410
|
-
> ```
|
|
411
|
-
> **注意**,调用入口必须放在类的构造函数中
|
|
412
|
-
|
|
413
391
|
## 事件
|
|
414
392
|
|
|
415
393
|
在CompElem中事件分为三类
|
package/compelem.umd.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* compelem v0.6.
|
|
2
|
+
* compelem v0.6.2-b1.1751990071
|
|
3
3
|
* A modern, reactive, fast, lightweight and flexible lib for building web components
|
|
4
4
|
* @holyhigh2
|
|
5
5
|
* https://github.com/holyhigh2/compelem
|
|
6
6
|
*/
|
|
7
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("myfx")):"function"==typeof define&&define.amd?define(["exports","myfx"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).compelem={},e.myfx)}(this,(function(e,t){"use strict";const s=new WeakMap,r=/\s+\.?key\s*=/;var n,i,o;function a(e){console.error("[CompElem]",e)}function l(e,t){console.error(`[CompElem <${e}>]`,t)}function c(e){return t.toPath(e).join("-")}function d(e){return Object.getPrototypeOf(e)}function p(e){let s=e;return t.isString(e)&&/(?:^true$)|(?:^false$)/.test(s)?s="true"===s:(t.isUndefined(s)||t.isBlank(s))&&(s=!0),s}!function(e){e[e.CSS=1]="CSS",e[e.COMPUTED=2]="COMPUTED"}(n||(n={})),function(e){e.PROPS="__deco_props",e.STATES="__deco_states",e.COMPUTED="__deco_computed",e.WATCH="__deco_watch",e.EVENTS="__deco_events"}(i||(i={})),e.DecoratorType=void 0,(o=e.DecoratorType||(e.DecoratorType={})).CLASS="class",o.FIELD="field",o.METHOD="method";class u{static get priority(){return 0}}const h="getKey",f="__decorators",g=new WeakMap;class m{args;metadata;decoratorClass;instanceMap;key;priority=0;constructor(e,s,r){this.args=e,this.metadata=s,this.decoratorClass=r,this.priority=t.get(r,"priority",0),this.instanceMap=new WeakMap}create(s){let r,n=new this.decoratorClass(...this.args),i=n.targets,o=this.metadata[2];t.isObject(o)&&t.isDefined(t.get(o,"configurable"))?r=e.DecoratorType.METHOD:t.isUndefined(this.metadata[2])&&(r=e.DecoratorType.FIELD),!t.isEmpty(i)&&r&&i.includes(r)?(n.created(s,...this.metadata),this.instanceMap.set(s,n)):a(`Decorator '${this.decoratorClass.name}' is out of targets, expect '${i.join(",")}' bug got '${r}'`)}beforeMount(e,t){this.instanceMap.get(e).beforeMount(e,t,...this.metadata)}mounted(e,t){this.instanceMap.get(e).mounted(e,t,...this.metadata)}updated(e,t){this.instanceMap.get(e).updated(e,t)}}const E=new WeakMap;function y(e){let s=(...s)=>(...r)=>{let n=r[0].constructor,i=t.get(n,f);if(!t.has(n,f)){let e=t.get(Object.getPrototypeOf(n),f);i=e?t.concat(e):[],Reflect.defineProperty(n,f,{configurable:!1,enumerable:!1,value:i})}let o,a={},l=t.get(e,h);if(l){let t=E.get(e);if(t||(t=new WeakMap,E.set(e,t)),a=t.get(n),a||(a={},t.set(n,a)),o=l(...s),a[o])return a[o]}let c=new m(s,r,e);return a[o]=c,i?.push(c),c};return g.set(s,!0),s}const b=new WeakMap;function v(e,s,r,n){let o;if(/[a-z]/.test(s[0])||a(`Prop '${s}' must be in CamelCase`),!t.has(e.constructor,i.PROPS)){const s={};let r=e.constructor;for(;(r=d(r))!==j;)t.merge(s,r[i.PROPS]?t.cloneDeep(r[i.PROPS]):{});Reflect.defineProperty(e.constructor,i.PROPS,{configurable:!1,enumerable:!1,value:s}),o=new Set,t.each(s,((e,s)=>{if(e.attribute){let e=t.kebabCase(s);o?.add(e)}})),b.set(e.constructor,o)}if(n&&(n.get&&(r.getter=n.get),n.set&&(r.setter=n.set)),r.attribute){o||(o=b.get(e.constructor));let r=t.kebabCase(s);o?.add(r)}t.has(e.constructor,"observedAttributes")||(e.constructor.observedAttributes=[]),e.constructor.observedAttributes=t.toArray(o),r.shallow=r.shallow||!1,e.constructor[i.PROPS][s]=r}const T=new Set;function _(e){return b.get(e)??T}const C={collectWatch(e,t,s){let r=w.get(e);r||(r={},w.set(e,r));let n=r[s];n||(n=r[s]=[]),n.push(t)},startCollect(e,t){this.__collectType=t,this.__collecting=e},setUpdater(e){this.__updater=e},endCollect(){this.__collecting=null},__directiveQ:[],setDirectiveQ(e){let s=t.last(this.__directiveQ);const r=e?e.join(","):"",n=s?s.join(","):"";s&&r===n||(s&&s.length<e.length&&t.startsWith(r,n)?this.__directiveQ[this.__directiveQ.length-1]=e:this.__directiveQ.push(e))},popDirectiveQ(){let e=t.concat(this.__directiveQ);return this.__directiveQ=[],e},startRender(e){this.__renderCollecting=!0,this.__renderContext=e},endRender(e){this.__renderCollection.forEach((t=>{e._regDeps(t,this.__renderContext)})),this.__renderCollection.clear(),this.__renderCollecting=!1,this.__renderContext=null},collect(e){this.__renderCollection.add(e)},clear(){this.__directiveQ=[]},__updater:null,__collecting:null,__collectType:-1,__renderCollection:new Set,__renderContext:null,__renderCollecting:!1,__skipCheck:!1},S=new WeakMap,P=new WeakMap,N=new WeakMap,A=new WeakMap,w=new WeakMap,D=new WeakSet;function k(e,r){if(!t.isObject(e))return e;const o=D.has(e)?e:new Proxy(e,{get(e,s,r){if(!s)return;const i=Reflect.get(e,s,r);if("string"!=typeof s&&"number"!=typeof s)return i;let o=s in e;if((C.__renderCollecting||C.__collecting)&&(o&&e.hasOwnProperty(s)||!o)){let e=P.get(r)??[],i=t.concat(e,[s]),o=i.join("-");if(C.__renderCollecting)C.collect(c(i)),C.setDirectiveQ(i);else if(C.__collecting){let e;switch(C.__collectType){case n.COMPUTED:e=N.get(C.__collecting),e||(e={},N.set(C.__collecting,e));break;case n.CSS:e=A.get(C.__collecting),e||(e={},A.set(C.__collecting,e))}let t=e[o];t||(t=e[o]=[]),t.push(C.__updater)}}return i},set(e,r,n,o){if(!r)return!1;let a=e[r];if(!t.isObject(a)&&a===n)return!0;if(Number.isNaN(n)&&Number.isNaN(a))return!0;let l=P.get(o)??[],c=t.concat(l,[r]),d=S.get(o).from,p=t.get(d.constructor,i.PROPS),u=t.get(d.constructor,i.STATES),h=t.get(p,[c[0],"hasChanged"])||t.get(u,[c[0],"hasChanged"]);if(h){if(!h.call(d,n,a))return!0}else if(a===n&&!s.has(a))return!0;p&&p[r]&&e.__isData&&p[r].sync&&d.emit("update:"+r,{value:n});let f=S.get(o)?.contextSet,g=n;!t.isObject(n)||t.isFunction(n)||n instanceof Node||Object.isFrozen(n)||f.forEach((e=>{let s=S.get(o)?.pathMap,n=s?.get(e);n&&(c=t.concat(n,[r]),P.set(g,c),g=k(g,e),D.add(g),P.set(g,c))}));let m=Reflect.set(e,r,g),E=S.get(o).pathMap;return f.forEach((e=>{let s=E.get(e);if(!s)return;e===d&&l.length>1&&s.length>1&&l[0]===s[0]&&(s=l),c=t.concat(s,"length"==r&&t.isArray(o)?[]:[r]);let n=N.get(e),i=A.get(e),p=w.get(e);if(n||i||p){let e=c.length;for(;e;){let s=c.slice(0,e).join("-");if(p){const r=p[s];e===c.length?r?.forEach((e=>{let t=e();t.ov=a,x.pushWatch(t)})):r?.forEach((e=>{let s=e();t.get(s,"deep")&&(s.ov=a,x.pushWatch(s))}))}if(n){let e=n[s];if(!t.isEmpty(e))for(let t=0;t<e.length;t++){const s=e[t];x.pushComputed(s)}}if(i){let e=i[s];if(!t.isEmpty(e))for(let t=0;t<e.length;t++){const s=e[t];x.pushCss(s)}}e--}}let u=e._notify(a,c);x.pushNext(u)})),m}});D.has(o)||D.add(o);let a=P.get(e)??[];if(Object.isExtensible(e)&&!S.get(o)){let e=new Set;e.add(r);let t=new WeakMap;t.set(r,a),S.set(o,{from:r,contextSet:e,pathMap:t})}else{S.get(o).contextSet.add(r);let e=S.get(o).pathMap,s=e.get(r),n=t.concat(a);if(s&&s.join("")!==n.join("")){let e=t.get(r,t.initial(s));t.isArray(e)||function(...e){console.warn("[CompElem]",...e)}(`The object is referenced by more than one @state '${n.join(".")},${s.join(".")}'`),s=n}else e.set(r,n)}let l=t.get(r.constructor,i.PROPS),d=t.get(r.constructor,i.STATES);for(let s in e){const n=e[s];let i=t.get(l,[s,"shallow"])||t.get(d,[s,"shallow"]);!t.isObject(n)||D.has(n)||t.isFunction(n)||n instanceof Node||Object.isFrozen(n)||i||(P.set(n,t.concat(a,[s])),e[s]=k(n,r),D.add(e[s]),P.set(e[s],t.concat(a,[s])))}return o}class x{static watchSet=new Set;static computedSet=new Set;static cssSet=new Set;static nextSet=new Set;static nextPending=!1;static next;static flush(){x.nextPending=!1;let e=Array.from(x.watchSet);x.watchSet.clear();let s=Array.from(x.computedSet);x.computedSet.clear();let r=Array.from(x.cssSet);x.cssSet.clear();let n=Array.from(x.nextSet);x.nextSet.clear(),e.forEach((e=>e(t.get(e,"ov")))),s.forEach((e=>e())),r.forEach((e=>e())),n.forEach((e=>e()))}static pushWatch(e){x.watchSet.add(e)}static pushComputed(e){x.computedSet.add(e)}static pushCss(e){x.cssSet.add(e)}static pushNext(e){x.nextSet.add(e),x.nextPending||(x.nextPending=!0,x.next())}}function O(e){return class extends e{__updatePoints;renderComponent;buildView(e){let t=this instanceof j?this:this.renderComponent,[s,r]=Ne(t,e),n=[],i=Re(n,s,r,t,this);return this.__updatePoints=n,i}updateView(e){if(t.isBlank(t.join(e.strings)))return;if(!this.__updatePoints)return;let{vars:s}=e,r=this instanceof j?this:this.renderComponent;for(let e=0;e<this.__updatePoints.length;e++){const n=this.__updatePoints[e];let i=n.varIndex;if(i<0)continue;let o=n.value,a=s,l=n.node,c=t.split(i,"-");for(let s=0;s<c.length;s++){const r=c[s];a=t.get(a,r),a&&a.vars&&e<c.length-1&&(a=a.vars)}if(!t.isObject(o)&&o===a)continue;let d=l;if(n.isDirective){if(!o.di)continue;a.di=o.di,a.di.renderParams=a.varChain,a.di._renderArgs=a.args,a.point=o.point,a.varPath=o.varPath,o.update(o.point,a.args,o.args)}else if(n.isToggleProp){if(!!a===o)continue;d.toggleAttribute(n.attrName,!!a),t.set(d,n.attrName,!!a)}else if(n.isProp){if(!t.isObject(a)&&a===o)continue;l instanceof j?l._updateProps({[n.attrName]:a}):l instanceof HTMLSlotElement&&r._updateSlot(l.getAttribute("name")||"default",n.attrName,a)}else if(n.attrName&&!n.isEvent){if(!t.isEqual(o,a))switch(n.attrName){case"value":if(l instanceof HTMLInputElement){l.value=a;break}default:l.setAttribute(n.attrName,t.replace(n.attrTmpl,Me,a+""))}}else if(n.isTmpl)(a.strings.join()!==o.tmpl.strings.join()||a.vars.some((e=>t.isObject(e)&&!t.isPlainObject(e)))||o.tmpl.vars.some((e=>t.isObject(e)&&!t.isPlainObject(e)))||!t.isEqual(a.vars,o.tmpl.vars))&&n.value.updateView(a),o.tmpl=a,a=o;else if(n.isText){let e=n.textNode.nextSibling;e&&e===n.node.previousSibling?e.textContent=a:(Le.remove(n.textNode,n.node),Le.insertBefore(n.node,[a]))}n.value=a}}}}(()=>{const e=Promise.resolve(),t=x.flush;x.next=()=>{e.then(t)}})();class M extends(O(Object)){tmpl;constructor(e){super(),this._renderVars=t.get(e,"_renderVars"),this.tmpl=e}}const R={boolean:Boolean,string:String,number:Number,object:Object,array:Array,function:Function,undefined:Object},L=new WeakMap;let U=[];class j extends(O(HTMLElement)){static __l_globalRule=document.createElement("style");static defaults(e){U=t.flatMap(e.css,(e=>{if(t.isString(e)){let t=new CSSStyleSheet;return t.replaceSync(e),t}return e instanceof CSSStyleSheet?e:[]})),e.global,t.each(e,((e,s)=>{t.test(s[0],/[A-Z]/)}))}#e={};#t={"#slots":{}};#s={};#r={};#n;#i={};__events={};get[Symbol.toStringTag](){return this.constructor.name}get reactiveData(){return this.#s}get attrs(){return this.#o}get props(){return this.#a}get renderRoot(){return this.#l}get renderRoots(){return this.#c}get parentComponent(){return this.#d}get slotHooks(){return this.#p}get css(){return L.get(this.constructor)}get isMounted(){return this.#u}get slots(){return this.#t["#slots"]}#o;#a;#l;#c;#d;#h={};#p={};#f={};#u=!1;static get styles(){return[]}static get globalStyles(){return[]}get styles(){return[]}#g=!1;#m=!1;constructor(...e){super(),1===t.size(e)&&(this.#a={},t.assign(this.#a,t.first(e)));let s=this.render.bind(this);this.render=function(){let e;return C.startRender(this),e=s(),C.endRender(this),e};let r=t.get(this.constructor,"globalStyles"),n=t.get(this.constructor,"_global_style_attached");if(!t.isEmpty(r)&&"1"!==n){let e="";r.forEach((s=>{t.isString(s)&&(e+=s+"\n")})),j.__l_globalRule.textContent+=e,t.set(this.constructor,"_global_style_attached","1")}let i=L.get(this.constructor),o=i??[];i||(t.each(t.get(this.constructor,"styles"),(e=>{if(t.isString(e)){let t=new CSSStyleSheet;t.replaceSync(e),o.push(t)}else o.push(e)})),L.set(this.constructor,o)),this.#n=this.attachShadow({mode:"open"}),this.#n.adoptedStyleSheets=[...U,...o],this._slotsPropMap={default:[]};let a=t.get(this.constructor,f);a&&a.sort(((e,t)=>t.priority-e.priority)).forEach((e=>e.create(this))),this.#E=this.#y.bind(this)}#E;connectedCallback(){let e=t.closest(this.parentNode,(e=>e instanceof j||e.host instanceof j),"parentNode");this.#d=e?e instanceof j?e:e.host:null,this.__init()}disconnectedCallback(){}__init(){if(this.#g)return;if(this.#m)return;this.#m=!0,this.#b();const e=this.#v();this.propsReady(e);for(const t in e){const s=e[t];this.#t[t]=s}this.#T(),t.each(this.#t,((e,t)=>{let s=Reflect.getOwnPropertyDescriptor(this.#t,t);Reflect.defineProperty(this,t,{get(){let e=Reflect.get(this.#s,t);return s?.get?s?.get():e},set(e){s?.set?s?.set(e):Reflect.set(this.#s,t,e)}})})),Reflect.defineProperty(this.#t,"__isData",{enumerable:!1,value:!0}),this.#s=k(this.#t,this);let s=t.get(this.constructor,i.COMPUTED);t.each(s,((e,t)=>{C.startCollect(this,n.COMPUTED),C.setUpdater((()=>{this.#s[t]=e.call(this)})),this.#t[t]=e.call(this),C.endCollect(),Reflect.defineProperty(this,t,{get(){return Reflect.get(this.#s,t)},set(e){l(this.tagName,"Cannot set a computed property '"+t+"'")}})}));let r=t.get(this.constructor,i.WATCH);t.each(r,((e,s)=>{e.forEach((e=>{let{source:r,options:n,handler:i}=e,o=i.bind(this);t.get(n,"once",!1)&&(o=t.once(o));const a=function(e){let s=t.get(this,r.replaceAll("-","."));o(s,e,r)}.bind(this);let l=t.get(n,"deep",!1);if(a.deep=l,C.collectWatch(this,(()=>a),s),!t.get(n,"immediate",!1))return;let c=t.get(this,r.replaceAll("-","."));o(c,c,r)}))}));let o=this.render(),a=this.buildView(o);if(a){let e=t.toArray(a);e.forEach((e=>{this.#n.appendChild(e)})),this.#c=t.filter(e,(e=>e.nodeType===Node.ELEMENT_NODE)),this.#l=this.#c[0]}t.each(this.#p,((e,t)=>{this.#_(t)}));const c=this;let d=t.get(this.constructor,f);d&&d.sort(((e,t)=>t.priority-e.priority)).forEach((e=>{e.beforeMount(this,((e,t)=>(c.#s[e]=t,c.#s[e])))})),this.beforeMount();let p=t.get(this.constructor,i.EVENTS);p&&p.forEach((async e=>{let s=e.name,r=t.assign({target:document,once:!1,passive:!1,capture:!1},e.options),n=t.bind(e.fn,this),i=r.target;t.isFunction(i)&&(i=await i.call(this,this)),i?i.addEventListener(s,n,r):l(this.tagName,"The target of @event('"+s+"',...) is invalid")})),C.startCollect(this,n.CSS);let u=[];this.styles.forEach((e=>{if(!t.isFunction(e))return;let s=new CSSStyleSheet;u.push(s),C.setUpdater((()=>{let t=e()??"";s.replaceSync(t)}));let r=e();t.isBlank(r)||s.replaceSync(r)})),C.endCollect(),this.#n.adoptedStyleSheets=[...this.#n.adoptedStyleSheets,...u],setTimeout((()=>{this.#u=!0,this.mounted(),d&&d.forEach((e=>{e.mounted(this,((e,t)=>(c.#s[e]=t,c.#s[e])))}))}),0),this.#g=!0}propsReady(e){}render(){throw Error(`[CompElem <${this.tagName}>] Missing render()`)}beforeMount(){}mounted(){}#C(e,s){this.#b();let r=t.get(this.#e[s],"props");r&&t.each(this.slots,((e,s)=>{e.filter((e=>e.nodeType===Node.ELEMENT_NODE)).forEach((e=>{e instanceof j?e._updateProps(r):t.each(r,((s,r)=>{if(e instanceof HTMLSlotElement){let n=t.get(e,"__l_comp");if(n){let t=e.name||"default",i=n.#e[t];i||(i=n.#e[t]={props:{}}),i.props||(i.props={}),i.props[r]=s,n.#C(e,t)}}else e.setAttribute(r,s)}))}))})),this.slotChange(e,s)}slotChange(e,t){}attributeChangedCallback(e,t,s){this.#S(e,t,s)}shouldUpdate(e){return!0}updated(e){}#P={};_notify(e,r){let n=[];for(let i=0;i<r.length;i++){const o=r[i];n.push(o);let a=t.get(this,n),l=c(n);this.#r[l]={value:a,chain:"slots"===l?["slots"]:n,oldValue:e,end:n.length===r.length},t.isObject(a)&&"#"!=l[0]&&s.set(a,l)}return this.#E}#y(){if(t.size(this.#r)<1)return;const e=this.#r;this.#r={};let r=t.get(this.constructor,f);if(r&&r.sort(((e,t)=>t.priority-e.priority)).forEach((t=>{t.updated(this,e)})),!this.shouldUpdate(e))return;let n=new Set;t.each(e,(({value:e,chain:t,oldValue:s},r)=>{this.#i[r]&&this.#i[r].forEach((e=>{n.add(e)}))})),n.forEach((e=>{if(e===this)this.updateView(this.render());else{let t=e.render(...e._renderArgs?e._renderArgs:[]);t&&e.updateView(t)}})),this.#N.forEach((e=>{this.#_(e)})),this.updated(e),t.each(e,(({value:e,chain:r,oldValue:n},i)=>{t.isObject(e)&&s.has(e)&&s.delete(e)}))}#v(){let e=t.get(this.constructor,i.PROPS),s=this.attributes,r=this.tagName,n=this.#a,o={};t.each(s,(({name:s,value:r})=>{if(s[0]===Ee||s[0]===ye||s[0]===be||s===_e||"slot"===s)return;let n=t.camelCase(s);e&&!e[n]&&(o[s]=r)})),this.#o=this.#o?t.assign(this.#o,o):o;let a={};return t.each(e,((i,o)=>{let c,d=e[o],u=t.has(n,o),h=t.get(this,o);if(!("_defaultValue"in d)&&(d._defaultValue=h,!d.type)){t.isUndefined(h)&&l(r,"Prop '"+o+"' has neither propType nor defaultValue be used for type inference");let e=typeof h;t.isArray(h)&&(e="array");let s=R[e];d.type=s}if(u)c=t.isNil(n[o])?h:n[o];else{c=h;let e=s.getNamedItem(t.kebabCase(o))||s.getNamedItem(ye+t.kebabCase(o));e&&(u=!0,c=e.value)}if(d.required&&!u)return l(r,"Prop '"+o+"' is required"),!1;c=this.#A(e,o,c);let f=t.get(e,[o,"getter"]);f&&(f=t.bind(f,this));let g=t.get(e,[o,"setter"]);if(g&&(g=t.bind(g,this)),(f||g)&&Reflect.defineProperty(this.#t,o,{set:g||function(e){},get:f}),d.attribute&&t.isDefined(c)&&!t.isObject(c)){let e=t.kebabCase(o),s=t.trim(c);(m=d.type)===Boolean||t.some(m,(e=>e===Boolean))?(s=p(c),t.isBoolean(s)?this.toggleAttribute(e,s):this.setAttribute(e,s)):this.setAttribute(e,s)}var m;this.#t[o]=c,a[o]=c})),Object.seal(a)}#w(e,s){let r=e;try{for(let n=0;n<s.length;n++){const i=s[n];r=i===Boolean?p(e):i===Number?Number(e):i===String?String(e):i===Object||i===Array?t.parseJSON(e):i===Date?new Date(e):new i(e)}}catch(t){l(this.tagName,"Convert attribute error with "+e)}return r}#A(e,s,r){let n=e[s];if(!n)return r;let i=n.isValid,o=n.type,a=t.isArray(o)?o:[o],c=n.converter,d=r;if(!t.some(a,(e=>e===String))&&t.isString(d)&&!t.isNull(d))try{d=c?c(d):this.#w(d,a)}catch(e){l(this.tagName,`Convert attribute '${s}' error with `+d)}for(let e=0;e<a.length;e++){"Boolean"===a[e].name&&(d=p(d))}let u=typeof d,h=!t.isDefined(d);for(let e=0;e<a.length;e++){const s=a[e];if(t.test(u,s.name,"i")||d instanceof s||Object.prototype.toString.call(d)===Object.prototype.toString.call(s.prototype)){h=!0;break}}return h||l(this.tagName,`Invalid prop '${s}'. expected '${a.map((e=>e.name||e))}' but got '${u}'`),i&&(i.call(this,d,this.#t)||l(this.tagName,`Invalid prop '${s}'. IsValid() check failed`)),d}#T(){let e=t.get(this.constructor,i.STATES);t.each(e,((s,r)=>{let n=e[r],i=t.get(this,r);if(n){let e=n.prop;i=e?t.cloneDeep(this.#t[e]):t.get(this,r)}this.#t[r]=i}))}#D=t.debounce(this.propsReady,100);_setParentProps(e,s){if(this.#g){let r=t.get(this.constructor,i.PROPS);t.each(e,((e,s)=>{let n=t.camelCase(s),i=r[n];if(!i)return;let o=this.#t[n];e=this.#A(r,n,e),i.hasChanged&&!i.hasChanged.call(this,e,o)||(this.#t[n]=e,this._notify(o,[n]))})),t.assign(this.#a,e),t.assign(this.#o,s),this.#D(this.#a)}}_updateProps(e){let s=t.get(this.constructor,i.PROPS);t.each(e,((e,r)=>{let n=t.camelCase(r);s[n]&&(e=this.#A(s,n,e),C.__skipCheck=!0,t.set(this,n,e),C.__skipCheck=!1)})),t.assign(this.#a,e),this.#D(this.#a)}_initProps(e,s){this.#a=t.merge(this.#a||{},e),this.#o=t.merge({},s)}_bindSlot(e,s,r){if(this.#h[s]||(this.#h[s]=e,Reflect.defineProperty(e,"__l_comp",{value:this})),e.addEventListener("slotchange",(t=>{this.#g&&this.#C(e,"default"===s?"":s)})),!t.isEmpty(r)){let e=this.#e[s];e||(e=this.#e[s]={}),e.props=r}}_bindSlotHook(e,t){this.#p[e]=t}#N=new Set;_updateSlot(e,t,s){let r=this.#h[e],n=this.#p[e];if(!n&&!r)return;let i=this.#e[e];if(t&&(i.props||(i.props={}),i.props[t]=s),n)this.#N.add(e);else{let e=r.assignedElements({flatten:!0});for(let r=0;r<e.length;r++){e[r].setAttribute(t,s+"")}}}#b(){const e=t.flatMap(this.childNodes,(e=>e.nodeType===Node.COMMENT_NODE?[]:e instanceof HTMLSlotElement?e.assignedNodes({flatten:!0}):e));let s=t.groupBy(e,(e=>e.nodeType===Node.TEXT_NODE?"default":e instanceof Element?e.getAttribute("slot")||"default":void 0));if(t.isEmpty(s))return void(t.isEmpty(this.#t["#slots"])||(this.#g?this.#s["#slots"]={}:this.#t["#slots"]={}));t.each(s,((e,s)=>{if(s){for(;e.length>0;){let s=e[0];if(!(s.nodeType===Node.TEXT_NODE&&t.isBlank(s.textContent)||s instanceof HTMLSlotElement&&t.isEmpty(s.assignedNodes({flatten:!0}))))break;e.shift()}for(;e.length>0;){let s=t.last(e);if(!(s.nodeType===Node.TEXT_NODE&&t.isBlank(s.textContent)||s instanceof HTMLSlotElement&&t.isEmpty(s.assignedNodes({flatten:!0}))))break;e.pop()}}}));let r={};t.each(s,((e,s)=>{t.isEmpty(e)||(r[s]=e)})),this.#g?this.#s["#slots"]=r:this.#t["#slots"]=r}#_(e){let s=this.#p[e];if(!s)return;let r=this.#e[e];if(!this.#t["#slots"][e])return;this.renderAsync(s,t.get(r,"props"));const n=this._asyncDirectives.get(s);let i=n?.buildView(s(t.get(r,"props"))),o=t.reject(t.toArray(i),(e=>e.nodeType===Node.COMMENT_NODE));if(o){let s=this.#f[e];if(!t.isEmpty(s))for(let e=0;e<s.length;e++){const t=s[e];t.parentNode?.removeChild(t)}this.#f[e]=o,this.append(...o),this.#N.clear()}}_asyncDirectives=new WeakMap;renderAsync(e,...t){}#S(e,s,r){if(!this.isMounted)return;if(_(this.constructor).has(e)){let s=t.camelCase(e);if(t.isNull(r)){r=t.get(this.constructor,i.PROPS)[s]._defaultValue}this._updateProps({[s]:r})}}_regDeps(e,t){let s=this.#i[e];s||(s=this.#i[e]=new Set),s.add(t);let r=e.split("-");if(r.pop(),r.length<1)return;let n=r.join("-");s=this.#i[n],s||(s=this.#i[n]=new Set),s.add(t)}emit(e,s={},r){r&&r.event&&(s.event=r.event),s.target=this,this.dispatchEvent(new CustomEvent(e,{bubbles:t.get(r,"bubbles",!1),composed:t.get(r,"composed",!1),cancelable:!0,detail:s}))}on(e,t){this.#P[e]||(this.#P[e]=[]);let s=t.bind(this);this.#P[e].push(s),this.addEventListener(e,s)}nextTick(e){x.pushNext(e)}forceUpdate(){t.each(this.#s,((e,t)=>{this.#r[t]={value:void 0,chain:void 0}})),this.#y()}}var V,H,I;document.head.appendChild(j.__l_globalRule),e.DirectiveUpdateTag=void 0,(V=e.DirectiveUpdateTag||(e.DirectiveUpdateTag={})).NONE="NONE",V.REMOVE="REMOVE",V.REPLACE="REPLACE",V.UPDATE="UPDATE",V.APPEND="APPEND";class W{key;varIndex;value;isText=!1;isTmpl=!1;isDirective=!1;node;textNode;isComponent=!1;attrName;attrTmpl;isProp=!1;isToggleProp=!1;isEvent;constructor(e,t,s,r){this.varIndex=e,this.node=t,s&&(this.attrName=s),r&&(this.attrTmpl=r)}}e.EnterPointType=void 0,(H=e.EnterPointType||(e.EnterPointType={})).ATTR="attr",H.PROP="prop",H.TEXT="text",H.CLASS="class",H.STYLE="style",H.SLOT="slot",H.TAG="tag";class ${startNode;endNode;type;attrName;varIndex;expressionChain;nodes;constructor(e,t,s){this.startNode=e,this.attrName=t,this.type=s}setVarIndex(e){this.varIndex=e}getNodes(){let e=this.startNode.nextSibling;if(!this.endNode)return[e];let t=[];for(;e&&e!==this.endNode;)t.push(e),e=e?.nextSibling;return t}}!function(e){e.AFTER_BEGIN="afterbegin"}(I||(I={}));class B{diClass;args;di;varPath;point;slotComponent;varChain;constructor(e,...t){this.diClass=e,this.args=t,this.varChain=C.popDirectiveQ(),this.di=new this.diClass,this.di.renderParams=this.varChain}checkScope(e){let s=t.get(this.diClass,"scopes");t.isEmpty(s)||t.test(s.join(","),e)||a(`Directive '${this.diClass.name}' is out of scopes, expect '${s.join(",")}' bug got '${e}'`)}render(e){let t=this.di;return t.renderComponent||(t.renderComponent=e),this.di=t,t._renderArgs=this.args,this.di.render(...this.args)}update(s,r,n){let i=this.di.update(s,r,n);if(i===e.DirectiveUpdateTag.NONE)return;let o=s.getNodes();if(i===e.DirectiveUpdateTag.REMOVE)for(let e=0;e<o.length;e++){const t=o[e];t.parentNode?.removeChild(t)}else if(i===e.DirectiveUpdateTag.REPLACE){let e=[];for(let e=0;e<o.length;e++){const t=o[e];t.parentNode?.removeChild(t)}let n=this.di.render(...r),i=this.di.buildView(n);e=t.toArray(i);let a=document.createDocumentFragment();a.append(...e),s.endNode.parentNode.insertBefore(a,s.endNode)}else if(i===e.DirectiveUpdateTag.UPDATE){let e,n={},i=[],l=[],c=this.di.render(...r);if(c||(c=new Ve([],[])),t.isEmpty(o)){let e=this.di.buildView(c);return void s.startNode.after(...e)}let d={};c instanceof Ve&&c.vars.forEach((e=>{if(e instanceof Ve){const t=e.getKey();d[t]=e,n[t]=!0,l.push(t)}})),o=t.filter(t.compact(o),(e=>e.nodeType===Node.ELEMENT_NODE)),e=t.filter(t.compact(t.toArray(e)),(e=>e.nodeType===Node.ELEMENT_NODE));let p={},u="",h={};for(let e=0;e<o.length;e++){let t=o[e],s=t.getAttribute("key");if(s){if(p[s]){u=s;break}p[s]=t,i.push(s),h[s]=!0}}if(u)return void a(`${t.camelCase(this.diClass.name)} - duplicate key '${u}'`);let f=n;const g=s.startNode.parentNode;let m=[],E=[];if(t.each(h,((e,s)=>{f[s]||(E.push(s),delete h[s],t.remove(i,(e=>e===s)))})),!t.isEmpty(l)){let e="",r=-1,n=[],o=new Map;for(let a=0;a<l.length;a++){const c=l[a];let d=i.findIndex((e=>e===c));if(d>-1&&d!==a){if(r<0||r-d==1){let e=t.last(n);n.push({nodeId:c,targetId:0===a?I.AFTER_BEGIN:e?e.nodeId:l[a-1]})}else o.set(n.length,{group:n,targetId:""}),n=[],n.push({nodeId:c,targetId:i[d]});r=d}else if(d<0){let t=e?p[e]||s.endNode:s.startNode;m.push({prevNode:t,newkey:c})}e=c}t.isEmpty(o)&&n.length>0&&o.set(n.length,{group:n,targetId:""});let a=t.toArray(o.keys()),c=a.sort(((e,t)=>e-t));if(a.length>0&&a.length<2){let{group:e}=o.get(c[0]);t.initial(e).forEach((({targetId:e,nodeId:t})=>{let r,n=p[t];e===I.AFTER_BEGIN?(r=s.startNode,r.after(n)):(r=p[e],r.after(n))}))}}m.length>0&&this.#k(m,d,l),m.forEach((e=>{let t=e.newkey,r=this.newNodeMap[t],n=e.prevNode;n===s.endNode?n.before(r):(s.startNode,n.after(r))})),E.forEach((e=>{let t=p[e];t&&t.parentNode&&g.removeChild(t)})),this.di.__updatePoints.forEach((e=>{e.key||(e.key=e.value.tmpl.getKey());const t=l.findIndex((t=>t==e.key));e.varIndex=t})),this.di.updateView(c)}}getDirective(){return this.di}newNodeMap={};#k(e,t,s){const r=[],n=[];e.forEach((e=>{let s=e.newkey;r.push(""),n.push(t[s])})),r.push("");let i=new Ve(r,n),o=this.di.__updatePoints,a=this.di.buildView(i),l=new Map;this.di.__updatePoints.forEach(((e,t)=>{const s=e.value.tmpl.getKey();e.key=s,l.set(s,!0)})),o.forEach(((e,t)=>{const s=e.key??e.value.tmpl.getKey();l.get(s)||this.di.__updatePoints.push(e)})),a.forEach((e=>{e instanceof HTMLElement&&(this.newNodeMap[e.getAttribute("key")]=e)}))}}function F(e){return(...s)=>{let r=null;return s.forEach(((e,n)=>{if(t.isFunction(e)){let t=e;s[n]=function(...e){let s=r.di;C.startRender(s);let n=t.call(s.renderComponent,...e);return C.endRender(s.renderComponent),n}}})),r=new B(e,...s),r}}const z=["resize","outside","mutate"],K=new WeakMap,Q=[],q=[],G=[],X=new ResizeObserver((e=>{for(const t of e){const e=Array.isArray(t.contentBoxSize)?t.contentBoxSize[0]:t.contentBoxSize,s=Array.isArray(t.borderBoxSize)?t.borderBoxSize[0]:t.borderBoxSize;let r=K.get(t.target);if(r){r(new CustomEvent("resize",{bubbles:!1,cancelable:!1,detail:{borderBox:{w:s.inlineSize,h:s.blockSize},contentBox:{w:e.inlineSize,h:e.blockSize}}}),t.target)}}}));var Y;!function(e){e.Child="child",e.Tree="tree",e.Attr="attr",e.Char="char"}(Y||(Y={}));const J=new WeakMap,Z=new MutationObserver((e=>{for(let t=0;t<e.length;t++){const s=e[t];let r=J.get(s.target);if(!r)return;let n={target:s.target},i=null;switch(s.type){case"subtree":n.type=Y.Tree,i=r[Y.Tree];break;case"childList":n.type=Y.Child,n.addedNodes=s.addedNodes,n.removedNodes=s.removedNodes,i=r[Y.Child];break;case"attributes":n.type=Y.Attr,n.attributeName=s.attributeName,n.oldValue=s.oldValue,i=r[Y.Attr];break;case"characterData":n.type=Y.Char,n.oldValue=s.oldValue,i=r[Y.Char]}if(i){i(new CustomEvent("mutate",{bubbles:!1,cancelable:!1,detail:n}))}}}));function ee(e,s,r,n){if("resize"===e)!function(e,t){K.has(e)||(K.set(e,t),X.observe(e))}(s,r);else if("outside"===e)switch(n[0]){case"mousedown":!function(e,t){Q.push([e,t])}(s,r);break;case"dblclick":!function(e,t){G.push([e,t])}(s,r);break;default:!function(e,t){q.push([e,t])}(s,r)}else"mutate"===e&&function(e,s,r){let n=t.includes(r,"child"),i=t.includes(r,"attr"),o=t.includes(r,"char"),a=t.includes(r,"tree"),l=J.get(e);l||(l={},J.set(e,l),n&&(l[Y.Child]=s),i&&(l[Y.Attr]=s),o&&(l[Y.Char]=s),a&&(l[Y.Tree]=s),Z.observe(e,{childList:n,attributes:i,characterData:o,subtree:a}))}(s,r,n)}document.addEventListener("mousedown",(e=>{let s=t.get(e.composedPath(),0,e.target);Q.forEach((([r,n])=>{if(!r.contains(s)&&!r.contains(t.closest(s,(e=>e instanceof ShadowRoot),"parentNode")?.host)){n(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:r,event:e}}),r)}}))}),!1),document.addEventListener("click",(e=>{let s=t.get(e.composedPath(),0,e.target);q.forEach((([r,n])=>{if(!r.contains(s)&&!r.contains(t.closest(s,(e=>e instanceof ShadowRoot),"parentNode")?.host)){n(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:r,event:e}}),r)}}))}),!1),document.addEventListener("dblclick",(e=>{let s=t.get(e.composedPath(),0,e.target);G.forEach((([r,n])=>{if(!r.contains(s)&&!r.contains(t.closest(s,(e=>e instanceof ShadowRoot),"parentNode")?.host)){n(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:r,event:e}}),r)}}))}),!1);const te=/,|^(debounce:.+)|(debounce$)/,se=/,|^(throttle:.+)|(throttle$)/,re="self",ne="stop",ie="prevent",oe="once",ae="left",le="right",ce="middle",de="ctrl",pe="alt",ue="shift",he="meta",fe={esc:"escape"},ge=":";function me(e,s,r,n){let i,o=e.split("."),a=o.shift(),l=o.includes(oe),c=s;if(i=t.find(o,(e=>te.test(e)))){let e=i.split(ge);c=t.debounce(c,parseInt(e[1])||100)}if(i=t.find(o,(e=>se.test(e)))){let e=i.split(ge);c=t.throttle(c,parseInt(e[1])||100)}if(l&&(c=t.once(c)),function(e){return z.includes(e)}(a))return ee(a,r,c,o),c;let d=e=>{if(o.includes(ie)&&e.preventDefault(),o.includes(ne)&&e.stopPropagation(),!o.includes(re)||e.target===e.currentTarget){if(e instanceof MouseEvent){if(o.includes(ae)&&0!=e.button)return;if(o.includes(le)&&2!=e.button)return;if(o.includes(ce)&&1!=e.button)return}else if(e instanceof KeyboardEvent){if(t.remove(o,(e=>e==de))[0]&&!e.ctrlKey)return;if(t.remove(o,(e=>e==pe))[0]&&!e.altKey)return;if(t.remove(o,(e=>e==ue))[0]&&!e.shiftKey)return;if(t.remove(o,(e=>e==he))[0]&&!e.metaKey)return;if(!t.map(o,(e=>fe[e]||e)).includes(e.key.toLowerCase()))return}c(e)}};r.addEventListener(a,d);let p=n.__events[a];return p||(p=n.__events[a]=[]),p.push([r,d]),d}const Ee="@",ye=".",be="?",ve="*",Te=":",_e="ref",Ce=/[.?-a-z]+\s*=\s*(['"])\s*([^='"]*<\!--c_ui-pl_df-->){2,}.*?\1/ims,Se=/<\s*[a-z0-9-]+([^>]*<\!--c_ui-pl_df-->)*[^>]*?(?<!-)>/gims,Pe="slot-props";function Ne(e,s){let r="",n=t.concat(s.vars),i=s.strings.length-1,o=s.vars.length-1;for(let n=0;n<=i;n++){const i=s.strings[n];let a=t.get(s.vars,n,"");if(a&&a.di){let t=a.render(e);if(t instanceof Ve){let[s,r]=Ne(e,t);Reflect.defineProperty(a,"_renderVars",{value:r}),a=Ae+s+we}else a=t??xe}else if(a instanceof Ve){let[t,s]=Ne(e,a);Reflect.defineProperty(a,"_renderVars",{value:s}),a=De+t+ke}else a=n>o?"":xe;r+=i+a}let l=r.match(Ce);if(l){return a(`Parse error: attribute value can be set only one interpolation —— \n ${t.replaceAll(l[0],xe,"${...}")}`),["",n]}let c=0;return r=r.replace(Se,((e,s)=>t.replaceAll(e,xe,(()=>xe.replace("--\x3e","")+c++)))),r=r.replace(je,"$1><").trim(),[r,n]}const Ae="\x3c!--c_ui-pl_di-start--\x3e",we="\x3c!--c_ui-pl_di-end--\x3e",De="\x3c!--c_ui-pl_tmpl-start--\x3e",ke="\x3c!--c_ui-pl_tmpl-end--\x3e",xe="\x3c!--c_ui-pl_df--\x3e",Oe="\x3c!--c_ui-pl_df",Me=/<!--c_ui-pl_df\d*(-->)?/;function Re(s,r,n,i,o){const a=document.createElement("div");a.innerHTML=r;const c=document.createNodeIterator(a,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT);let d,p,u=0,h=null,f=[],g=[],m=[],E=[s],y=[],b=[];for(;d=c.nextNode();)if(d instanceof HTMLElement||d instanceof SVGElement){d instanceof j?h=d:h?.contains(d)||(h=null);let r={},o=t.toArray(d.attributes);for(let a=0;a<o.length;a++){const c=o[a];let{name:p,value:f}=c;if(p===Pe){let e=d.getAttribute("name")||"default";if(h){let t=h._slotsPropMap[e];t||(t=h._slotsPropMap[e]=[]),t.push(d)}}if(t.startsWith(p,Oe)){let t=n[u];if(t instanceof B){t.checkScope(e.EnterPointType.TAG);let r=new $(d,p.substring(1),e.EnterPointType.TAG);t.point=r,t.di.slotComponent=h,t.di.renderComponent=i;let n=new W(u,d);n.isDirective=!0,n.value=t,n.isComponent=!!h,s.push(n),u++,t.di.created(r,...t.args)}d.removeAttribute(p)}else if(p[0]!==Ee)if(p!==_e)if(p[0]!==ye||Me.test(f)){if(Me.test(f)){let o=n[u],a=new W(u,d,p.replace(/\.|\?|@/,""),f);if(a.isComponent=!!h,p[0]===ye||p[0]===be||p[0]===ve){if(o instanceof B){o.checkScope(e.EnterPointType.PROP);let t=new $(d,p.substring(1),e.EnterPointType.PROP);o.point=t,o.slotComponent=h,a.value=o,a.isDirective=!0,o&&o.di.created(o.point,...o.args)}else if(p[0]===be)a.isToggleProp=!0,a.value=!!o,a.value&&d.setAttribute(p.substring(1),"");else if(p[0]===ve){a.value=o;let e=p.substring(1);const[s,r]=e.split(Te);let n=s;switch(r){case"camel":n=t.camelCase(n);break;case"kebab":n=t.kebabCase(n);break;case"snake":n=t.snakeCase(n)}a.attrName=n,d.setAttribute(n,o)}else if(d instanceof j||"SLOT"===d.tagName){let e=t.camelCase(p.substring(1));e in d||"SLOT"===d.tagName||l(d.tagName,`Prop '${p}' is not defined in ${d.tagName}`),a.value=o,a.isProp=!0,r[e]=o}else l(d.tagName,`Prop '${p}' can only be set on a CompElem or a slot`);d.removeAttribute(p),o=""}else{let s;if(a.value=o,o instanceof B){let t=e.EnterPointType.ATTR;"class"===p?t=e.EnterPointType.CLASS:"style"===p&&(t=e.EnterPointType.STYLE),o.checkScope(t),a.isDirective=!0;let r=new $(d,p,t);o.point=r,o.di.slotComponent=h,o.di.renderComponent=i,s=o,o=""}f=t.replace(f,Me,o),c.value=f,s&&s.di.created(s.point,...s.args)}s.push(a),u++}}else l(d.tagName,`Prop '${p}' must be an interpolation`);else{if(Me.test(f)){let e=n[u];if(!t.has(e,"current")){l(d.tagName,"Ref must be a RefObject");continue}u++,e.current=d}d.removeAttribute(p)}else{let e=e=>{};if(Me.test(f)){let r=n[u];if(!t.isFunction(r)){l(d.tagName,`Event '${p}' must be a function`);continue}e=r.bind(i);let o=new W(u,d,p.replace(/\.|\?|@/,""),f);o.isComponent=!!h,o.isEvent=!0,s.push(o),u++}me(p.substring(1),e,d,i),d.removeAttribute(p)}}d instanceof j?d._initProps(r):d instanceof HTMLSlotElement&&i._bindSlot(d,d.name||"default",r)}else{let r=d,a=`\x3c!--${r.nodeValue}--\x3e`;if(a===Ae){p&&f.push(p),p=r;let t=n[u],o=new W(u,d);o.isComponent=!!h,o.isDirective=!0,o.value=t;let a=h?e.EnterPointType.SLOT:e.EnterPointType.TEXT,l=new $(p,"",a);t.point=l,t.di.slotComponent=h,t.di.renderComponent=i,g.push(t),s.push(o),m.push(o),s=[],E.push(s),u++,b.push(u),y.push(n),n=t._renderVars,u=0;continue}if(a===we){m.pop().textNode=r;let e=g.pop();e.point.endNode=r,e.di.created(e.point,...e.args),p=f.pop(),e.di.__updatePoints=s,E.pop(),s=t.last(E),n=y.pop(),u=b.pop()}else{if(a===De){p&&f.push(p),p=r;let a=n[u],l=new W(u,d);l.isComponent=!!h,l.isTmpl=!0;let c=t.last(g);(c&&"ForEach"===t.get(c,"diClass.name")||"ForEach"==o.constructor.name)&&(l.key=a.getKey()),a=l.value=new M(a);let v=h?e.EnterPointType.SLOT:e.EnterPointType.TEXT,T=new $(p,"",v);a.point=T,a.slotComponent=h,a.renderComponent=i,g.push(a),s.push(l),m.push(l),s=[],E.push(s),u++,b.push(u),y.push(n),n=a._renderVars,u=0;continue}if(a===ke){m.pop().textNode=r;let e=g.pop();e.point.endNode=r,p=f.pop(),e.__updatePoints=s,E.pop(),s=t.last(E),n=y.pop(),u=b.pop()}}if(a!==xe)continue;let l=new W(u,d);s.push(l),l.isComponent=!!h,l.isText=!0;let c,v=n[u];if(c=document.createComment(`compelem-ui-${u}-child-start`),r.parentNode.insertBefore(c,r),r.nodeValue=`compelem-ui-${u}-child-end`,l.textNode=c,v instanceof B){l.isDirective=!0,l.value=v;let t=h?e.EnterPointType.SLOT:e.EnterPointType.TEXT,s=new $(c,"",t);s.endNode=r,v.point=s,v.di.slotComponent=h,v.di.renderComponent=i,v.di.created(s,...v.args),v=""}else if(v instanceof Ve){l.isTmpl=!0,l.value=v;let[e,t]=Ne(i,v);v=Re(s,e,t,i,o)}else l.value=v;if(u++,t.isUndefined(v))continue;if(v instanceof NodeList){let e=document.createDocumentFragment();e.append(...v),r.parentNode.insertBefore(e,r)}else if(v instanceof Element)r.parentNode.insertBefore(v,r);else if(t.trim(v)){let e=document.createTextNode(v);r.parentNode.insertBefore(e,r)}}return a.childNodes}const Le={insertBefore:function(e,t){if(!e.parentNode)return;let s=document.createDocumentFragment();s.append(...t),e.parentNode.insertBefore(s,e)},remove:function(e,t){if(e===t)return void e?.parentNode?.removeChild(e);let s=e.nextSibling;for(;s&&s!==t;)s?.parentNode?.removeChild(s),s=e.nextSibling}};function Ue(e,...s){return new Ve(t.isString(e)?[e]:e,s)}const je=/([a-z0-9"'])\s*>\s*</gim;class Ve{strings;vars;constructor(e,s){this.strings=t.concat(e),this.vars=s}getKey(){let e=this.vars,s="";return t.each(this.strings,((n,i)=>{if(r.test(n))return s=t.toString(e[i]),!1})),s}getKeys(){let e=this.vars,s=[];for(let n=0;n<this.strings.length;n++){const i=this.strings[n];if(r.test(i)){let r=t.toString(e[n]);s.push(r)}}return t.isEmpty(s)&&e.forEach((e=>{if(e instanceof Ve){let t=e.getKey();s.push(t)}})),s}append(e){let s=t.last(this.strings);return e.strings.forEach(((e,t)=>{0!=t?this.strings.push(e):this.strings[this.strings.length-1]=s+e})),this.vars=t.concat(this.vars,e.vars),this}insert(e,t){let s=t.strings.shift();return this.strings[e]+=s,this.strings.splice(e+1,0,...t.strings),this.vars.splice(e,0,...t.vars),this}getHTML(e){let[s,r]=Ne(e,this),n=Re([],s,r,e,e);return t.reduce(n,((e,t)=>e+t.outerHTML),"")}}var He;e.QueryCache=void 0,(He=e.QueryCache||(e.QueryCache={})).ONCE="once",He.UPDATABLE="updatable";class Ie extends u{static get priority(){return Number.MAX_VALUE}created(e,t,s,...r){}mounted(e,t,...s){}get targets(){return[e.DecoratorType.FIELD]}selector;cache;result;constructor(e,t){super(),this.selector=e,this.cache=t}static getKey(e){return e}getter(e){this.result=e.shadowRoot?.querySelector(this.selector)}beforeMount(e,t,s,r,...n){const i=this;Reflect.defineProperty(e,r,{get:()=>(i.result&&i.cache||i.getter(e),i.result)})}updated(t,s){this.cache===e.QueryCache.UPDATABLE&&this.getter(t)}}const We=y(Ie),$e=y(class extends Ie{getter(e){this.result=e.shadowRoot?.querySelectorAll(this.selector)}});function Be(e,s,r){if(!t.has(e.constructor,i.STATES)){const s={};let r=e.constructor;for(;(r=d(r))!==j;)t.merge(s,r[i.STATES]?t.cloneDeep(r[i.STATES]):{});Reflect.defineProperty(e.constructor,i.STATES,{configurable:!1,enumerable:!1,value:s})}r.shallow=r.shallow||!1,e.constructor[i.STATES][s]=r}class Fe extends(O(Object)){_renderArgs;static get scopes(){return[]}renderParams}const ze=["key"];const Ke=F(class extends Fe{created(e,s){let r=e.startNode;if(r instanceof j){let e={},n={};t.each(s,((t,s)=>{ze.includes(s)||(s in r?e[s]=t:n[s]=t+"")})),r._initProps(e,n)}else t.each(s,((e,t)=>{r.setAttribute(t,e)}))}update(t,s,r){return e.DirectiveUpdateTag.NONE}static get scopes(){return[e.EnterPointType.TAG]}render(e){}});const Qe=F(class extends Fe{created(e,s){let r=[];t.isArray(s)?r=t.compact(s):t.isObject(s)?r=t.flatMap(s,((e,t)=>e?t:[])):t.isString(s)&&(r=s.split(" "));let n=e.startNode;t.each(this.lastCls,(e=>{n.classList.remove(e)})),t.each(r,(e=>{n.classList.add(e)})),this.lastCls=t.concat(r)}update(t,s,r){return this.created(t,s[0]),e.DirectiveUpdateTag.NONE}static get scopes(){return[e.EnterPointType.CLASS]}lastCls;render(e){}});const qe=F(class extends Fe{created(e,...t){}update(s,r,n){if(t.isEmpty(s.getNodes())&&(!r||t.isEmpty(r[0])))return e.DirectiveUpdateTag.NONE;if(t.isMatch(this.lastAry,r[0])&&this.lastAry.length===r[0].length)return e.DirectiveUpdateTag.NONE;if(!t.isEmpty(this.renderParams)){let e=t.last(this.renderParams);t.isArray(e)||(e=[e]),this.renderParams=e}return this.lastAry=t.clone(r[0]),e.DirectiveUpdateTag.UPDATE}constructor(e){super(),t.isEmpty(this.renderParams)||(this.renderParams=t.toArray(t.last(this.renderParams)))}static get scopes(){return[e.EnterPointType.TEXT,e.EnterPointType.SLOT]}lastAry;lastRenderTmpl;render(e,s){let n=t.map(e,((e,t)=>s(e,t)));if(n.length<1)return this.lastRenderTmpl=new Ve([],[]),this.lastRenderTmpl;let i=[],o=[];const l=[],c=[];for(let e=0;e<n.length;e++){const s=n[e];let d=t.last(o),p=s.vars,u=!0,h=s.strings;for(let e=0;e<h.length;e++){const t=h[e];if(r.test(t)){let t=p[e]+"";if(i.includes(t))return void a(`forEach - duplicate key '${t}'`);i.push(t),u=!1}0==e&&d?o[o.length-1]=d+t:o.push(t)}if(u)return void a("forEach - missing 'key' prop");let f=t.last(l);f&&h.length>0&&(l[l.length-1]=t.trim(f)+h.shift()),l.push(""),c.push(s)}return this.lastAry=t.clone(e),l.push(""),this.lastRenderTmpl=new Ve(l,c),this.lastRenderTmpl}});const Ge=F(class extends Fe{created(e,...t){}ifNodes;elseNodes;static get scopes(){return[e.EnterPointType.TEXT,e.EnterPointType.SLOT]}update(t,s,r){return!!s[0]==!!r[0]?e.DirectiveUpdateTag.NONE:(s[0],e.DirectiveUpdateTag.REPLACE)}render(e,t,s){return e?t(e):s(e)}});const Xe=F(class extends Fe{created(e,...t){}static get scopes(){return[e.EnterPointType.TEXT,e.EnterPointType.SLOT]}update(t,s,r){return s[0]===r[0]?e.DirectiveUpdateTag.NONE:s[0]?e.DirectiveUpdateTag.REPLACE:e.DirectiveUpdateTag.REMOVE}render(e,t){return e?t():Ue``}});var Ye;e.ModelTriggerType=void 0,(Ye=e.ModelTriggerType||(e.ModelTriggerType={})).CHANGE="change",Ye.INPUT="input";const Je=F(class extends Fe{created(e,s,r="value"){const n=e.startNode;if("binded"===t.get(n,"_model"))return;let i=t.last(this.renderParams);if(this.updateProp=r,this.modelPath=i,t.isObject(s)||t.trim(s)||(s=""),n instanceof j)n._initProps({[this.updateProp]:s}),n.addEventListener("update:"+r,(e=>{t.set(this.renderComponent,this.modelPath,e.detail.value)})),t.set(n,"_model","binded");else if(n instanceof HTMLTextAreaElement)n.setAttribute(this.updateProp,s+""),n.addEventListener("input",(e=>{let s=e.target;t.set(this.renderComponent,this.modelPath,s.value)})),t.set(n,"_model","binded");else if(n instanceof HTMLInputElement){let e="",i="";switch(n.type){case"checkbox":case"radio":e="checked",i="change";break;default:e="value",i="input"}n.setAttribute(r??e,s+""),n.addEventListener(i,(e=>{let s=e.target;t.set(this.renderComponent,this.modelPath,s.value)})),t.set(n,"_model","binded")}else n instanceof HTMLSelectElement&&(n.setAttribute(this.updateProp,s+""),n.addEventListener("change",(e=>{let s=e.target;t.set(this.renderComponent,this.modelPath,s.value)})),t.set(n,"_model","binded"))}update(s,r,n){if(this.modelPath||(this.modelPath=t.last(this.renderParams)),!t.isEqual(r,n)){const e=s.startNode;if(e instanceof j)e._updateProps({[this.updateProp]:r[0]});else if(e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)e.setAttribute(this.updateProp,r[0]+"");else if(e instanceof HTMLInputElement)switch(e.type){case"checkbox":case"radio":r[0]?e.setAttribute("checked",""):e.removeAttribute("checked");break;default:e.setAttribute(this.updateProp,r[0]+"")}}return e.DirectiveUpdateTag.NONE}static get scopes(){return[e.EnterPointType.TAG]}modelPath;render(e,t="value"){}});const Ze=F(class extends Fe{created(e,s,r){let n=e.startNode;t.isUndefined(this.display)&&(this.display=n.style.display);let i=r;this.renderComponent.nextTick((()=>{n.style.display=s?this.display:"none",i&&i(n,s)}))}update(t,s,r){return this.created(t,s[0],s[1]),e.DirectiveUpdateTag.NONE}display=void 0;static get scopes(){return[e.EnterPointType.TAG]}constructor(e){super(),this.point=e}render(e,t){}});const et=F(class extends Fe{created(e,t,s){t=t.bind(this.renderComponent),this.slotComponent._bindSlotHook(s||"default",t)}update(t,s,r){return e.DirectiveUpdateTag.NONE}static get scopes(){return[e.EnterPointType.SLOT]}render(e,t){}});class tt{static getCssText(e,s=!1){return t.isString(e)?e:t.join(t.map(e,((e,r)=>r.startsWith("--")?r+":"+e+(s?" !important":""):t.kebabCase(r)+":"+e+(s?" !important":""))),";")}static setStyle(e,s){if(t.isString(e)&&!t.trim(e))return{};let r=tt.getCssText(e),n={};return t.each(r.split(";"),(e=>{let r=e.split(":"),i=t.trim(r[0]),o=t.trim(r[1]);n[i]=s.style.getPropertyValue(i),s.style.setProperty(i,o)})),n}}const st=F(class extends Fe{created(e,t){tt.setStyle(t,e.startNode)}update(t,s,r){return this.created(t,s[0]),e.DirectiveUpdateTag.NONE}constructor(e){super(),this.point=e}static get scopes(){return[e.EnterPointType.STYLE]}render(e){}});const rt=F(class extends Fe{created(e,s){this.modelPath||(this.modelPath=t.last(this.renderParams));const r=e.startNode;let n=e.attrName;r._initProps({[n]:s}),r.addEventListener("update:"+n,(e=>{t.set(this.renderComponent,this.modelPath,e.detail.value)}))}update(s,r,n){if(!t.isEqual(r,n)){const e=s.startNode;let t=s.attrName;e._updateProps({[t]:r[0]})}return e.DirectiveUpdateTag.NONE}static get scopes(){return[e.EnterPointType.PROP]}modelPath;constructor(e){super()}render(e){}});const nt=F(class extends Fe{created(e,...t){}static get scopes(){return[e.EnterPointType.TEXT,e.EnterPointType.SLOT]}update(s,r,n){return t.isEqual(r,n)?e.DirectiveUpdateTag.NONE:e.DirectiveUpdateTag.REPLACE}render(e,s){let r=()=>Ue``,n=[],i=[];t.each(s,((e,s)=>{if(t.isFunction(e))n.push(s),i.push(e);else{let t=e[0],s=e[1];n.push(t),i.push(s)}"default"===s&&(r=e)}));let o=t.findIndex(n,(s=>t.isFunction(s)?s(e):s==e));return t.call(i[o]??r)}});e.CompElem=j,e.CssHelper=tt,e.Decorator=u,e.DecoratorWrapper=m,e.Directive=Fe,e.DirectiveWrapper=B,e.EnterPoint=$,e.GetKeyFnName=h,e.Template=Ve,e.UpdatePoint=W,e._DecoratorMap=g,e._DecoratorsKey=f,e._getObservedAttrs=_,e.bind=Ke,e.buildHTML=Ne,e.classes=Qe,e.computed=function(e,s,r){r.get||a(`Computed '${s}' must be a getter`),t.has(e.constructor,i.COMPUTED)||(e.constructor[i.COMPUTED]=t.isEmpty(e.constructor[i.COMPUTED])?{}:t.cloneDeep(e.constructor[i.COMPUTED])),e.constructor[i.COMPUTED][s]=r.get},e.createRef=function(e){return{current:e}},e.debounced=function(e){return(s,r,n)=>{n.value=t.debounce(s[r],e)}},e.decorator=y,e.directive=F,e.event=function(e,s){return(r,n,o)=>{t.has(r.constructor,i.EVENTS)||(r.constructor[i.EVENTS]=t.isEmpty(r.constructor[i.EVENTS])?[]:t.cloneDeep(r.constructor[i.EVENTS])),r.constructor[i.EVENTS].push({name:e,options:s,fn:r[n]})}},e.forEach=qe,e.html=Ue,e.ifElse=Ge,e.ifTrue=Xe,e.makeState=function(e,t,s){Be(e.prototype,t,s||{prop:""})},e.model=Je,e.prop=function(e){if(1===arguments.length)return(t,s,r)=>{e.required=e.required||!1,e.attribute=!1!==e.attribute,v(t,s,e,r)};let s=arguments[0],r=arguments[1],n=arguments[2];e={type:void 0,required:!1,attribute:!0},n&&"function"==typeof n.type&&(e=t.defaults(n,e),n=void 0),v(s,r,e,n)},e.query=We,e.queryAll=$e,e.show=Ze,e.slot=et,e.state=function(e){if(1===arguments.length)return(t,s)=>{Be(t,s,e)};Be(arguments[0],arguments[1],{prop:""})},e.styles=st,e.sync=rt,e.tag=function(e){return t=>{if(t){if(t.prototype.hasOwnProperty("attributeChangedCallback")){let e=t.prototype.attributeChangedCallback;t.prototype.attributeChangedCallback=function(t,s,r){j.prototype.attributeChangedCallback.call(this,t,s,r),e.call(this,t,s,r)}}if(t.prototype.hasOwnProperty("connectedCallback")){let e=t.prototype.connectedCallback;t.prototype.connectedCallback=function(){j.prototype.connectedCallback.call(this),e.call(this)}}if(t.prototype.hasOwnProperty("disconnectedCallback")){let e=t.prototype.disconnectedCallback;t.prototype.disconnectedCallback=function(){j.prototype.disconnectedCallback.call(this),e.call(this)}}customElements.define(e,t)}}},e.watch=function(e,s){return(r,n)=>{t.has(r.constructor,i.WATCH)||(r.constructor[i.WATCH]=t.isEmpty(r.constructor[i.WATCH])?{}:t.cloneDeep(r.constructor[i.WATCH]));(t.isArray(e)?e:[e]).forEach((e=>{let o=e.replaceAll(".","-"),a=r.constructor[i.WATCH][o];t.isArray(a)||(a=r.constructor[i.WATCH][o]=[]),a.push({source:e,options:s,handler:r[n]})}))}},e.when=nt,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
7
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("myfx")):"function"==typeof define&&define.amd?define(["exports","myfx"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).compelem={},e.myfx)}(this,(function(e,t){"use strict";const s=new WeakMap,r=/\s+\.?key\s*=/;var n,i,o;function a(e){console.error("[CompElem]",e)}function l(e,t){console.error(`[CompElem <${e}>]`,t)}function c(e){return t.toPath(e).join("-")}function d(e){return Object.getPrototypeOf(e)}function p(e){let s=e;return t.isString(e)&&/(?:^true$)|(?:^false$)/.test(s)?s="true"===s:(t.isUndefined(s)||t.isBlank(s))&&(s=!0),s}!function(e){e[e.CSS=1]="CSS",e[e.COMPUTED=2]="COMPUTED"}(n||(n={})),function(e){e.PROPS="__deco_props",e.STATES="__deco_states",e.COMPUTED="__deco_computed",e.WATCH="__deco_watch",e.EVENTS="__deco_events"}(i||(i={})),e.DecoratorType=void 0,(o=e.DecoratorType||(e.DecoratorType={})).CLASS="class",o.FIELD="field",o.METHOD="method";class h{static get priority(){return 0}}const u="getKey",f="__decorators",g=new WeakMap;class m{args;metadata;decoratorClass;instanceMap;key;priority=0;constructor(e,s,r){this.args=e,this.metadata=s,this.decoratorClass=r,this.priority=t.get(r,"priority",0),this.instanceMap=new WeakMap}create(s){let r,n=new this.decoratorClass(...this.args),i=n.targets,o=this.metadata[2];t.isObject(o)&&t.isDefined(t.get(o,"configurable"))?r=e.DecoratorType.METHOD:t.isUndefined(this.metadata[2])&&(r=e.DecoratorType.FIELD),!t.isEmpty(i)&&r&&i.includes(r)?(n.created(s,...this.metadata),this.instanceMap.set(s,n)):a(`Decorator '${this.decoratorClass.name}' is out of targets, expect '${i.join(",")}' bug got '${r}'`)}beforeMount(e,t){this.instanceMap.get(e).beforeMount(e,t,...this.metadata)}mounted(e,t){this.instanceMap.get(e).mounted(e,t,...this.metadata)}updated(e,t){this.instanceMap.get(e).updated(e,t)}}const E=new WeakMap;function y(e){let s=(...s)=>(...r)=>{let n=r[0].constructor,i=t.get(n,f);if(!t.has(n,f)){let e=t.get(Object.getPrototypeOf(n),f);i=e?t.concat(e):[],Reflect.defineProperty(n,f,{configurable:!1,enumerable:!1,value:i})}let o,a={},l=t.get(e,u);if(l){let t=E.get(e);if(t||(t=new WeakMap,E.set(e,t)),a=t.get(n),a||(a={},t.set(n,a)),o=l(...s),a[o])return a[o]}let c=new m(s,r,e);return a[o]=c,i?.push(c),c};return g.set(s,!0),s}const b=new WeakMap;function v(e,s,r,n){let o;if(/[a-z]/.test(s[0])||a(`Prop '${s}' must be in CamelCase`),!t.has(e.constructor,i.PROPS)){const s={};let r=e.constructor;for(;(r=d(r))!==j;)t.merge(s,r[i.PROPS]?t.cloneDeep(r[i.PROPS]):{});Reflect.defineProperty(e.constructor,i.PROPS,{configurable:!1,enumerable:!1,value:s}),o=new Set,t.each(s,((e,s)=>{if(e.attribute){let e=t.kebabCase(s);o?.add(e)}})),b.set(e.constructor,o)}if(n&&(n.get&&(r.getter=n.get),n.set&&(r.setter=n.set)),r.attribute){o||(o=b.get(e.constructor));let r=t.kebabCase(s);o?.add(r)}t.has(e.constructor,"observedAttributes")||(e.constructor.observedAttributes=[]),e.constructor.observedAttributes=t.toArray(o),r.shallow=r.shallow||!1,e.constructor[i.PROPS][s]=r}const T=new Set;function _(e){return b.get(e)??T}const C={collectWatch(e,t,s){let r=A.get(e);r||(r={},A.set(e,r));let n=r[s];n||(n=r[s]=[]),n.push(t)},startCollect(e,t){this.__collectType=t,this.__collecting=e},setUpdater(e){this.__updater=e},endCollect(){this.__collecting=null},__directiveQ:[],setDirectiveQ(e){let s=t.last(this.__directiveQ);const r=e?e.join(","):"",n=s?s.join(","):"";s&&r===n||(s&&s.length<e.length&&t.startsWith(r,n)?this.__directiveQ[this.__directiveQ.length-1]=e:this.__directiveQ.push(e))},popDirectiveQ(){let e=t.concat(this.__directiveQ);return this.__directiveQ=[],e},startRender(e){this.__renderCollecting=!0,this.__renderContext=e},endRender(e){this.__renderCollection.forEach((t=>{e._regDeps(t,this.__renderContext)})),this.__renderCollection.clear(),this.__renderCollecting=!1,this.__renderContext=null},collect(e){this.__renderCollection.add(e)},clear(){this.__directiveQ=[]},__updater:null,__collecting:null,__collectType:-1,__renderCollection:new Set,__renderContext:null,__renderCollecting:!1,__skipCheck:!1},S=new WeakMap,P=new WeakMap,N=new WeakMap,w=new WeakMap,A=new WeakMap,D=new WeakSet;function x(e,r){if(!t.isObject(e))return e;const o=D.has(e)?e:new Proxy(e,{get(e,s,r){if(!s)return;const i=Reflect.get(e,s,r);if("string"!=typeof s&&"number"!=typeof s)return i;let o=s in e;if((C.__renderCollecting||C.__collecting)&&(o&&e.hasOwnProperty(s)||!o)){let e=P.get(r)??[],i=t.concat(e,[s]),o=i.join("-");if(C.__renderCollecting)C.collect(c(i)),C.setDirectiveQ(i);else if(C.__collecting){let e;switch(C.__collectType){case n.COMPUTED:e=N.get(C.__collecting),e||(e={},N.set(C.__collecting,e));break;case n.CSS:e=w.get(C.__collecting),e||(e={},w.set(C.__collecting,e))}let t=e[o];t||(t=e[o]=[]),t.push(C.__updater)}}return i},set(e,r,n,o){if(!r)return!1;let a=e[r];if(!t.isObject(a)&&a===n)return!0;if(Number.isNaN(n)&&Number.isNaN(a))return!0;let l=P.get(o)??[],c=t.concat(l,[r]),d=S.get(o).from,p=t.get(d.constructor,i.PROPS),h=t.get(d.constructor,i.STATES),u=t.get(p,[c[0],"hasChanged"])||t.get(h,[c[0],"hasChanged"]);if(u){if(!u.call(d,n,a))return!0}else if(a===n&&!s.has(a))return!0;p&&p[r]&&e.__isData&&p[r].sync&&d.emit("update:"+r,{value:n});let f=S.get(o)?.contextSet,g=n;!t.isObject(n)||t.isFunction(n)||n instanceof Node||Object.isFrozen(n)||f.forEach((e=>{let s=S.get(o)?.pathMap,n=s?.get(e);n&&(c=t.concat(n,[r]),P.set(g,c),g=x(g,e),D.add(g),P.set(g,c))}));let m=Reflect.set(e,r,g),E=S.get(o).pathMap;return f.forEach((e=>{let s=E.get(e);if(!s)return;e===d&&l.length>1&&s.length>1&&l[0]===s[0]&&(s=l),c=t.concat(s,"length"==r&&t.isArray(o)?[]:[r]);let n=N.get(e),i=w.get(e),p=A.get(e);if(n||i||p){let e=c.length;for(;e;){let s=c.slice(0,e).join("-");if(p){const r=p[s];e===c.length?r?.forEach((e=>{let t=e();t.ov=a,k.pushWatch(t)})):r?.forEach((e=>{let s=e();t.get(s,"deep")&&(s.ov=a,k.pushWatch(s))}))}if(n){let e=n[s];if(!t.isEmpty(e))for(let t=0;t<e.length;t++){const s=e[t];k.pushComputed(s)}}if(i){let e=i[s];if(!t.isEmpty(e))for(let t=0;t<e.length;t++){const s=e[t];k.pushCss(s)}}e--}}let h=e._notify(a,c);k.pushNext(h)})),m}});D.has(o)||D.add(o);let a=P.get(e)??[];if(Object.isExtensible(e)&&!S.get(o)){let e=new Set;e.add(r);let t=new WeakMap;t.set(r,a),S.set(o,{from:r,contextSet:e,pathMap:t})}else{S.get(o).contextSet.add(r);let e=S.get(o).pathMap,s=e.get(r),n=t.concat(a);if(s&&s.join("")!==n.join("")){let e=t.get(r,t.initial(s));t.isArray(e)||function(...e){console.warn("[CompElem]",...e)}(`The object is referenced by more than one @state '${n.join(".")},${s.join(".")}'`),s=n}else e.set(r,n)}let l=t.get(r.constructor,i.PROPS),d=t.get(r.constructor,i.STATES);for(let s in e){const n=e[s];let i=t.get(l,[s,"shallow"])||t.get(d,[s,"shallow"]);!t.isObject(n)||D.has(n)||t.isFunction(n)||n instanceof Node||Object.isFrozen(n)||i||(P.set(n,t.concat(a,[s])),e[s]=x(n,r),D.add(e[s]),P.set(e[s],t.concat(a,[s])))}return o}class k{static watchSet=new Set;static computedSet=new Set;static cssSet=new Set;static nextSet=new Set;static nextPending=!1;static next;static flush(){k.nextPending=!1;let e=Array.from(k.watchSet);k.watchSet.clear();let s=Array.from(k.computedSet);k.computedSet.clear();let r=Array.from(k.cssSet);k.cssSet.clear();let n=Array.from(k.nextSet);k.nextSet.clear(),e.forEach((e=>e(t.get(e,"ov")))),s.forEach((e=>e())),r.forEach((e=>e())),n.forEach((e=>e()))}static pushWatch(e){k.watchSet.add(e)}static pushComputed(e){k.computedSet.add(e)}static pushCss(e){k.cssSet.add(e)}static pushNext(e){k.nextSet.add(e),k.nextPending||(k.nextPending=!0,k.next())}}function O(e){return class extends e{__updatePoints;renderComponent;buildView(e){let t=this instanceof j?this:this.renderComponent,[s,r]=Ne(t,e),n=[],i=Re(n,s,r,t,this);return this.__updatePoints=n,i}updateView(e){if(t.isBlank(t.join(e.strings)))return;if(!this.__updatePoints)return;let{vars:s}=e,r=this instanceof j?this:this.renderComponent;for(let e=0;e<this.__updatePoints.length;e++){const n=this.__updatePoints[e];let i=n.varIndex;if(i<0)continue;let o=n.value,a=s,l=n.node,c=t.split(i,"-");for(let s=0;s<c.length;s++){const r=c[s];a=t.get(a,r),a&&a.vars&&e<c.length-1&&(a=a.vars)}if(!t.isObject(o)&&o===a)continue;let d=l;if(n.isDirective){if(!o.di)continue;a.di=o.di,a.di.renderParams=a.varChain,a.di._renderArgs=a.args,a.point=o.point,a.varPath=o.varPath,o.update(o.point,a.args,o.args)}else if(n.isToggleProp){if(!!a===o)continue;d.toggleAttribute(n.attrName,!!a),t.set(d,n.attrName,!!a)}else if(n.isProp){if(!t.isObject(a)&&a===o)continue;l instanceof j?l._updateProps({[n.attrName]:a}):l instanceof HTMLSlotElement&&r._updateSlot(l.getAttribute("name")||"default",n.attrName,a)}else if(n.attrName&&!n.isEvent){if(!t.isEqual(o,a))switch(n.attrName){case"value":if(l instanceof HTMLInputElement){l.value=a;break}default:l.setAttribute(n.attrName,t.replace(n.attrTmpl,Me,a+""))}}else if(n.isTmpl)(a.strings.join()!==o.tmpl.strings.join()||a.vars.some((e=>t.isObject(e)&&!t.isPlainObject(e)))||o.tmpl.vars.some((e=>t.isObject(e)&&!t.isPlainObject(e)))||!t.isEqual(a.vars,o.tmpl.vars))&&n.value.updateView(a),o.tmpl=a,a=o;else if(n.isText){let e=n.textNode.nextSibling;e&&e===n.node.previousSibling?e.textContent=a:(Le.remove(n.textNode,n.node),Le.insertBefore(n.node,[a]))}n.value=a}}}}(()=>{const e=Promise.resolve(),t=k.flush;k.next=()=>{e.then(t)}})();class M extends(O(Object)){tmpl;constructor(e){super(),this._renderVars=t.get(e,"_renderVars"),this.tmpl=e}}const R={boolean:Boolean,string:String,number:Number,object:Object,array:Array,function:Function,undefined:Object},L=new WeakMap;let U=[];class j extends(O(HTMLElement)){static __l_globalRule=document.createElement("style");static defaults(e){U=t.flatMap(e.css,(e=>{if(t.isString(e)){let t=new CSSStyleSheet;return t.replaceSync(e),t}return e instanceof CSSStyleSheet?e:[]})),e.global,t.each(e,((e,s)=>{t.test(s[0],/[A-Z]/)}))}#e={};#t={"#slots":{}};#s={};#r={};#n;#i={};__events={};get[Symbol.toStringTag](){return this.constructor.name}get reactiveData(){return this.#s}get attrs(){return this.#o}get props(){return this.#a}get renderRoot(){return this.#l}get renderRoots(){return this.#c}get parentComponent(){return this.#d}get wrapperComponent(){return this.#p}get slotHooks(){return this.#h}get css(){return L.get(this.constructor)}get isMounted(){return this.#u}get slots(){return this.#t["#slots"]}#o;#a;#l;#c;#d;#p;#f={};#h={};#g={};#u=!1;static get styles(){return[]}static get globalStyles(){return[]}get styles(){return[]}#m=!1;#E=!1;constructor(...e){super(),1===t.size(e)&&(this.#a={},t.assign(this.#a,t.first(e)));let s=this.render.bind(this);this.render=function(){let e;return C.startRender(this),e=s(),C.endRender(this),e};let r=t.get(this.constructor,"globalStyles"),n=t.get(this.constructor,"_global_style_attached");if(!t.isEmpty(r)&&"1"!==n){let e="";r.forEach((s=>{t.isString(s)&&(e+=s+"\n")})),j.__l_globalRule.textContent+=e,t.set(this.constructor,"_global_style_attached","1")}let i=L.get(this.constructor),o=i??[];i||(t.each(t.get(this.constructor,"styles"),(e=>{if(t.isString(e)){let t=new CSSStyleSheet;t.replaceSync(e),o.push(t)}else o.push(e)})),L.set(this.constructor,o)),this.#n=this.attachShadow({mode:"open"}),this.#n.adoptedStyleSheets=[...U,...o],this._slotsPropMap={default:[]};let a=t.get(this.constructor,f);a&&a.sort(((e,t)=>t.priority-e.priority)).forEach((e=>e.create(this))),this.#y=this.#b.bind(this)}#y;connectedCallback(){let e=t.closest(this.parentNode,(e=>e instanceof j||e.host instanceof j),"parentNode");this.#d=e?e instanceof j?e:e.host:null,this.__init()}disconnectedCallback(){}__init(){if(this.#m)return;if(this.#E)return;this.#E=!0,this.#v();const e=this.#T();this.propsReady(e);for(const t in e){const s=e[t];this.#t[t]=s}this.#_(),t.each(this.#t,((e,t)=>{let s=Reflect.getOwnPropertyDescriptor(this.#t,t);Reflect.defineProperty(this,t,{get(){let e=Reflect.get(this.#s,t);return s?.get?s?.get():e},set(e){s?.set?s?.set(e):Reflect.set(this.#s,t,e)}})})),Reflect.defineProperty(this.#t,"__isData",{enumerable:!1,value:!0}),this.#s=x(this.#t,this);let s=t.get(this.constructor,i.COMPUTED);t.each(s,((e,t)=>{C.startCollect(this,n.COMPUTED),C.setUpdater((()=>{this.#s[t]=e.call(this)})),this.#t[t]=e.call(this),C.endCollect(),Reflect.defineProperty(this,t,{get(){return Reflect.get(this.#s,t)},set(e){l(this.tagName,"Cannot set a computed property '"+t+"'")}})}));let r=t.get(this.constructor,i.WATCH);t.each(r,((e,s)=>{e.forEach((e=>{let{source:r,options:n,handler:i}=e,o=i.bind(this);t.get(n,"once",!1)&&(o=t.once(o));const a=function(e){let s=t.get(this,r.replaceAll("-","."));o(s,e,r)}.bind(this);let l=t.get(n,"deep",!1);if(a.deep=l,C.collectWatch(this,(()=>a),s),!t.get(n,"immediate",!1))return;let c=t.get(this,r.replaceAll("-","."));o(c,c,r)}))}));let o=this.render(),a=this.buildView(o);if(a){let e=t.toArray(a);e.forEach((e=>{this.#n.appendChild(e)})),this.#c=t.filter(e,(e=>e.nodeType===Node.ELEMENT_NODE)),this.#l=this.#c[0]}t.each(this.#h,((e,t)=>{this.#C(t)}));const c=this;let d=t.get(this.constructor,f);d&&d.sort(((e,t)=>t.priority-e.priority)).forEach((e=>{e.beforeMount(this,((e,t)=>(c.#s[e]=t,c.#s[e])))})),this.beforeMount();let p=t.get(this.constructor,i.EVENTS);p&&p.forEach((async e=>{let s=e.name,r=t.assign({target:document,once:!1,passive:!1,capture:!1},e.options),n=t.bind(e.fn,this),i=r.target;t.isFunction(i)&&(i=await i.call(this,this)),i?i.addEventListener(s,n,r):l(this.tagName,"The target of @event('"+s+"',...) is invalid")})),C.startCollect(this,n.CSS);let h=[];this.styles.forEach((e=>{if(!t.isFunction(e))return;let s=new CSSStyleSheet;h.push(s),C.setUpdater((()=>{let t=e()??"";s.replaceSync(t)}));let r=e();t.isBlank(r)||s.replaceSync(r)})),C.endCollect(),this.#n.adoptedStyleSheets=[...this.#n.adoptedStyleSheets,...h],setTimeout((()=>{this.#u=!0,this.mounted(),d&&d.forEach((e=>{e.mounted(this,((e,t)=>(c.#s[e]=t,c.#s[e])))}))}),0),this.#m=!0}propsReady(e){}render(){throw Error(`[CompElem <${this.tagName}>] Missing render()`)}beforeMount(){}mounted(){}#S(e,s){this.#v();let r=t.get(this.#e[s],"props");r&&t.each(this.slots,((e,s)=>{e.filter((e=>e.nodeType===Node.ELEMENT_NODE)).forEach((e=>{e instanceof j?e._updateProps(r):t.each(r,((s,r)=>{if(e instanceof HTMLSlotElement){let n=t.get(e,"__l_comp");if(n){let t=e.name||"default",i=n.#e[t];i||(i=n.#e[t]={props:{}}),i.props||(i.props={}),i.props[r]=s,n.#S(e,t)}}else e.setAttribute(r,s)}))}))})),this.slotChange(e,s)}slotChange(e,t){}attributeChangedCallback(e,t,s){this.#P(e,t,s)}shouldUpdate(e){return!0}updated(e){}#N={};_notify(e,r){let n=[];for(let i=0;i<r.length;i++){const o=r[i];n.push(o);let a=t.get(this,n),l=c(n);this.#r[l]={value:a,chain:"slots"===l?["slots"]:n,oldValue:e,end:n.length===r.length},t.isObject(a)&&"#"!=l[0]&&s.set(a,l)}return this.#y}#b(){if(t.size(this.#r)<1)return;const e=this.#r;this.#r={};let r=t.get(this.constructor,f);if(r&&r.sort(((e,t)=>t.priority-e.priority)).forEach((t=>{t.updated(this,e)})),!this.shouldUpdate(e))return;let n=new Set;t.each(e,(({value:e,chain:t,oldValue:s},r)=>{this.#i[r]&&this.#i[r].forEach((e=>{n.add(e)}))})),n.forEach((e=>{if(e===this)this.updateView(this.render());else{let t=e.render(...e._renderArgs?e._renderArgs:[]);t&&e.updateView(t)}})),this.#w.forEach((e=>{this.#C(e)})),this.updated(e),t.each(e,(({value:e,chain:r,oldValue:n},i)=>{t.isObject(e)&&s.has(e)&&s.delete(e)}))}#T(){let e=t.get(this.constructor,i.PROPS),s=this.attributes,r=this.tagName,n=this.#a,o={};t.each(s,(({name:s,value:r})=>{if(s[0]===Ee||s[0]===ye||s[0]===be||s===_e||"slot"===s)return;let n=t.camelCase(s);e&&!e[n]&&(o[s]=r)})),this.#o=this.#o?t.assign(this.#o,o):o;let a={};return t.each(e,((i,o)=>{let c,d=e[o],h=t.has(n,o),u=t.get(this,o);if(!("_defaultValue"in d)&&(d._defaultValue=u,!d.type)){t.isUndefined(u)&&l(r,"Prop '"+o+"' has neither propType nor defaultValue be used for type inference");let e=typeof u;t.isArray(u)&&(e="array");let s=R[e];d.type=s}if(h)c=t.isNil(n[o])?u:n[o];else{c=u;let e=s.getNamedItem(t.kebabCase(o))||s.getNamedItem(ye+t.kebabCase(o));e&&(h=!0,c=e.value)}if(d.required&&!h)return l(r,"Prop '"+o+"' is required"),!1;c=this.#A(e,o,c);let f=t.get(e,[o,"getter"]);f&&(f=t.bind(f,this));let g=t.get(e,[o,"setter"]);if(g&&(g=t.bind(g,this)),(f||g)&&Reflect.defineProperty(this.#t,o,{set:g||function(e){},get:f}),d.attribute&&t.isDefined(c)&&!t.isObject(c)){let e=t.kebabCase(o),s=t.trim(c);(m=d.type)===Boolean||t.some(m,(e=>e===Boolean))?(s=p(c),t.isBoolean(s)?this.toggleAttribute(e,s):this.setAttribute(e,s)):this.setAttribute(e,s)}var m;this.#t[o]=c,a[o]=c})),Object.seal(a)}#D(e,s){let r=e;try{for(let n=0;n<s.length;n++){const i=s[n];r=i===Boolean?p(e):i===Number?Number(e):i===String?String(e):i===Object||i===Array?t.parseJSON(e):i===Date?new Date(e):new i(e)}}catch(t){l(this.tagName,"Convert attribute error with "+e)}return r}#A(e,s,r){let n=e[s];if(!n)return r;let i=n.isValid,o=n.type,a=t.isArray(o)?o:[o],c=n.converter,d=r;if(!t.some(a,(e=>e===String))&&t.isString(d)&&!t.isNull(d))try{d=c?c(d):this.#D(d,a)}catch(e){l(this.tagName,`Convert attribute '${s}' error with `+d)}for(let e=0;e<a.length;e++){"Boolean"===a[e].name&&(d=p(d))}let h=typeof d,u=!t.isDefined(d);for(let e=0;e<a.length;e++){const s=a[e];if(t.test(h,s.name,"i")||d instanceof s||Object.prototype.toString.call(d)===Object.prototype.toString.call(s.prototype)){u=!0;break}}return u||l(this.tagName,`Invalid prop '${s}'. expected '${a.map((e=>e.name||e))}' but got '${h}'`),i&&(i.call(this,d,this.#t)||l(this.tagName,`Invalid prop '${s}'. IsValid() check failed`)),d}#_(){let e=t.get(this.constructor,i.STATES);t.each(e,((s,r)=>{let n=e[r],i=t.get(this,r);if(n){let e=n.prop;i=e?t.cloneDeep(this.#t[e]):t.get(this,r)}this.#t[r]=i}))}#x=t.debounce(this.propsReady,100);_setParentProps(e,s){if(this.#m){let r=t.get(this.constructor,i.PROPS);t.each(e,((e,s)=>{let n=t.camelCase(s),i=r[n];if(!i)return;let o=this.#t[n];e=this.#A(r,n,e),i.hasChanged&&!i.hasChanged.call(this,e,o)||(this.#t[n]=e,this._notify(o,[n]))})),t.assign(this.#a,e),t.assign(this.#o,s),this.#x(this.#a)}}_updateProps(e){let s=t.get(this.constructor,i.PROPS);t.each(e,((e,r)=>{let n=t.camelCase(r);s[n]&&(e=this.#A(s,n,e),C.__skipCheck=!0,t.set(this,n,e),C.__skipCheck=!1)})),t.assign(this.#a,e),this.#x(this.#a)}_initProps(e,s){this.#a=t.merge(this.#a||{},e),this.#o=t.merge({},s)}_bindSlot(e,s,r){if(this.#f[s]||(this.#f[s]=e,Reflect.defineProperty(e,"__l_comp",{value:this})),e.addEventListener("slotchange",(t=>{this.#m&&this.#S(e,"default"===s?"":s)})),!t.isEmpty(r)){let e=this.#e[s];e||(e=this.#e[s]={}),e.props=r}}_bindSlotHook(e,t){this.#h[e]=t}#w=new Set;_updateSlot(e,t,s){let r=this.#f[e],n=this.#h[e];if(!n&&!r)return;let i=this.#e[e];if(t&&(i.props||(i.props={}),i.props[t]=s),n)this.#w.add(e);else{let e=r.assignedElements({flatten:!0});for(let r=0;r<e.length;r++){e[r].setAttribute(t,s+"")}}}#v(){const e=t.flatMap(this.childNodes,(e=>e.nodeType===Node.COMMENT_NODE?[]:e instanceof HTMLSlotElement?e.assignedNodes({flatten:!0}):e));let s=t.groupBy(e,(e=>e.nodeType===Node.TEXT_NODE?"default":e instanceof Element?e.getAttribute("slot")||"default":void 0));if(t.isEmpty(s))return void(t.isEmpty(this.#t["#slots"])||(this.#m?this.#s["#slots"]={}:this.#t["#slots"]={}));t.each(s,((e,s)=>{if(s){for(;e.length>0;){let s=e[0];if(!(s.nodeType===Node.TEXT_NODE&&t.isBlank(s.textContent)||s instanceof HTMLSlotElement&&t.isEmpty(s.assignedNodes({flatten:!0}))))break;e.shift()}for(;e.length>0;){let s=t.last(e);if(!(s.nodeType===Node.TEXT_NODE&&t.isBlank(s.textContent)||s instanceof HTMLSlotElement&&t.isEmpty(s.assignedNodes({flatten:!0}))))break;e.pop()}}}));let r={};t.each(s,((e,s)=>{t.isEmpty(e)||(r[s]=e)})),this.#m?this.#s["#slots"]=r:this.#t["#slots"]=r}#C(e){let s=this.#h[e];if(!s)return;let r=this.#e[e];if(!this.#t["#slots"][e])return;this.renderAsync(s,t.get(r,"props"));const n=this._asyncDirectives.get(s);let i=n?.buildView(s(t.get(r,"props"))),o=t.reject(t.toArray(i),(e=>e.nodeType===Node.COMMENT_NODE));if(o){let s=this.#g[e];if(!t.isEmpty(s))for(let e=0;e<s.length;e++){const t=s[e];t.parentNode?.removeChild(t)}this.#g[e]=o,this.append(...o),this.#w.clear()}}_asyncDirectives=new WeakMap;renderAsync(e,...t){}#P(e,s,r){if(!this.isMounted)return;if(_(this.constructor).has(e)){let s=t.camelCase(e);if(t.isNull(r)){r=t.get(this.constructor,i.PROPS)[s]._defaultValue}this._updateProps({[s]:r})}}_regDeps(e,t){let s=this.#i[e];s||(s=this.#i[e]=new Set),s.add(t);let r=e.split("-");if(r.pop(),r.length<1)return;let n=r.join("-");s=this.#i[n],s||(s=this.#i[n]=new Set),s.add(t)}_regWrapper(e){this.#p=e}emit(e,s={},r){r&&r.event&&(s.event=r.event),s.target=this,this.dispatchEvent(new CustomEvent(e,{bubbles:t.get(r,"bubbles",!1),composed:t.get(r,"composed",!1),cancelable:!0,detail:s}))}on(e,t){this.#N[e]||(this.#N[e]=[]);let s=t.bind(this);this.#N[e].push(s),this.addEventListener(e,s)}nextTick(e){k.pushNext(e)}forceUpdate(){t.each(this.#s,((e,t)=>{this.#r[t]={value:void 0,chain:void 0}})),this.#b()}}var V,H,I;document.head.appendChild(j.__l_globalRule),e.DirectiveUpdateTag=void 0,(V=e.DirectiveUpdateTag||(e.DirectiveUpdateTag={})).NONE="NONE",V.REMOVE="REMOVE",V.REPLACE="REPLACE",V.UPDATE="UPDATE",V.APPEND="APPEND";class W{key;varIndex;value;isText=!1;isTmpl=!1;isDirective=!1;node;textNode;isComponent=!1;attrName;attrTmpl;isProp=!1;isToggleProp=!1;isEvent;constructor(e,t,s,r){this.varIndex=e,this.node=t,s&&(this.attrName=s),r&&(this.attrTmpl=r)}}e.EnterPointType=void 0,(H=e.EnterPointType||(e.EnterPointType={})).ATTR="attr",H.PROP="prop",H.TEXT="text",H.CLASS="class",H.STYLE="style",H.SLOT="slot",H.TAG="tag";class ${startNode;endNode;type;attrName;varIndex;expressionChain;nodes;constructor(e,t,s){this.startNode=e,this.attrName=t,this.type=s}setVarIndex(e){this.varIndex=e}getNodes(){let e=this.startNode.nextSibling;if(!this.endNode)return[e];let t=[];for(;e&&e!==this.endNode;)t.push(e),e=e?.nextSibling;return t}}!function(e){e.AFTER_BEGIN="afterbegin"}(I||(I={}));class B{diClass;args;di;varPath;point;slotComponent;varChain;constructor(e,...t){this.diClass=e,this.args=t,this.varChain=C.popDirectiveQ(),this.di=new this.diClass,this.di.renderParams=this.varChain}checkScope(e){let s=t.get(this.diClass,"scopes");t.isEmpty(s)||t.test(s.join(","),e)||a(`Directive '${this.diClass.name}' is out of scopes, expect '${s.join(",")}' bug got '${e}'`)}render(e){let t=this.di;return t.renderComponent||(t.renderComponent=e),this.di=t,t._renderArgs=this.args,this.di.render(...this.args)}update(s,r,n){let i=this.di.update(s,r,n);if(i===e.DirectiveUpdateTag.NONE)return;let o=s.getNodes();if(i===e.DirectiveUpdateTag.REMOVE)for(let e=0;e<o.length;e++){const t=o[e];t.parentNode?.removeChild(t)}else if(i===e.DirectiveUpdateTag.REPLACE){let e=[];for(let e=0;e<o.length;e++){const t=o[e];t.parentNode?.removeChild(t)}let n=this.di.render(...r),i=this.di.buildView(n);e=t.toArray(i);let a=document.createDocumentFragment();a.append(...e),s.endNode.parentNode.insertBefore(a,s.endNode)}else if(i===e.DirectiveUpdateTag.UPDATE){let e,n={},i=[],l=[],c=this.di.render(...r);if(c||(c=new Ve([],[])),t.isEmpty(o)){let e=this.di.buildView(c);return void s.startNode.after(...e)}let d={};c instanceof Ve&&c.vars.forEach((e=>{if(e instanceof Ve){const t=e.getKey();d[t]=e,n[t]=!0,l.push(t)}})),o=t.filter(t.compact(o),(e=>e.nodeType===Node.ELEMENT_NODE)),e=t.filter(t.compact(t.toArray(e)),(e=>e.nodeType===Node.ELEMENT_NODE));let p={},h="",u={};for(let e=0;e<o.length;e++){let t=o[e],s=t.getAttribute("key");if(s){if(p[s]){h=s;break}p[s]=t,i.push(s),u[s]=!0}}if(h)return void a(`${t.camelCase(this.diClass.name)} - duplicate key '${h}'`);let f=n;const g=s.startNode.parentNode;let m=[],E=[];if(t.each(u,((e,s)=>{f[s]||(E.push(s),delete u[s],t.remove(i,(e=>e===s)))})),!t.isEmpty(l)){let e=-1,r=[],n=[],o=0,a=0;for(;a<l.length;a++){const c=l[a];let d=i.findIndex((e=>e===c));if(d<0){let e=l[a-1],t=e?p[e]||e:s.startNode;m.push({prevNode:t,newkey:c}),o++}else if(d>-1&&d!==a-o){if(e<0||1===Math.abs(e-d)){let e=t.last(r);r.push({nodeId:c,targetId:0===a?I.AFTER_BEGIN:e?e.nodeId:l[a-1]})}else n.push({moveGroup:r,moveIndex:a+r.length}),r=[],r.push({nodeId:c,targetId:l[a-1]});e=d}}if(r.length>0&&n.push({moveGroup:r,moveIndex:a+r.length}),n.length>0){let e=n.sort(((e,t)=>e.moveGroup.length-t.moveGroup.length));if(e.length<2){let{moveGroup:r}=e[0];if(r.length>1){let e=t.last(r).targetId;r[r.length-2].nodeId===e&&(r=t.initial(r))}r.forEach((({targetId:e,nodeId:t})=>{let r,n=p[t];e===I.AFTER_BEGIN?(r=s.startNode,r.after(n)):(r=p[e],r.after(n))}))}else{let r=t.last(e).moveIndex;1===Math.abs(e[e.length-2].moveIndex-r)&&(e=t.initial(e)),e.forEach((({moveGroup:e})=>{e.forEach((({targetId:e,nodeId:t})=>{let r,n=p[t];e===I.AFTER_BEGIN?(r=s.startNode,r.after(n)):(r=p[e],r.after(n))}))}))}}}m.length>0&&this.#k(m,d,l),m.forEach((e=>{let t=e.newkey,r=this.newNodeMap[t],n=e.prevNode;n===s.endNode?n.before(r):n===s.startNode?n.after(r):"string"==typeof n?this.newNodeMap[n].after(r):n.after(r)})),E.forEach((e=>{let t=p[e];t&&t.parentNode&&g.removeChild(t)})),this.di.__updatePoints.forEach((e=>{e.key||(e.key=e.value.tmpl.getKey());const t=l.findIndex((t=>t==e.key));e.varIndex=t})),this.di.updateView(c)}}getDirective(){return this.di}newNodeMap={};#k(e,t,s){const r=[],n=[];e.forEach((e=>{let s=e.newkey;r.push(""),n.push(t[s])})),r.push("");let i=new Ve(r,n),o=this.di.__updatePoints,a=this.di.buildView(i),l=new Map;this.di.__updatePoints.forEach(((e,t)=>{const s=e.value.tmpl.getKey();e.key=s,l.set(s,!0)})),o.forEach(((e,t)=>{const s=e.key??e.value.tmpl.getKey();l.get(s)||this.di.__updatePoints.push(e)})),a.forEach((e=>{e instanceof HTMLElement&&(this.newNodeMap[e.getAttribute("key")]=e)}))}}function F(e){return(...s)=>{let r=null;return s.forEach(((e,n)=>{if(t.isFunction(e)){let t=e;s[n]=function(...e){let s=r.di;C.startRender(s);let n=t.call(s.renderComponent,...e);return C.endRender(s.renderComponent),n}}})),r=new B(e,...s),r}}const z=["resize","outside","mutate"],G=new WeakMap,K=[],Q=[],q=[],X=new ResizeObserver((e=>{for(const t of e){const e=Array.isArray(t.contentBoxSize)?t.contentBoxSize[0]:t.contentBoxSize,s=Array.isArray(t.borderBoxSize)?t.borderBoxSize[0]:t.borderBoxSize;let r=G.get(t.target);if(r){r(new CustomEvent("resize",{bubbles:!1,cancelable:!1,detail:{borderBox:{w:s.inlineSize,h:s.blockSize},contentBox:{w:e.inlineSize,h:e.blockSize}}}),t.target)}}}));var Y;!function(e){e.Child="child",e.Tree="tree",e.Attr="attr",e.Char="char"}(Y||(Y={}));const J=new WeakMap,Z=new MutationObserver((e=>{for(let t=0;t<e.length;t++){const s=e[t];let r=J.get(s.target);if(!r)return;let n={target:s.target},i=null;switch(s.type){case"subtree":n.type=Y.Tree,i=r[Y.Tree];break;case"childList":n.type=Y.Child,n.addedNodes=s.addedNodes,n.removedNodes=s.removedNodes,i=r[Y.Child];break;case"attributes":n.type=Y.Attr,n.attributeName=s.attributeName,n.oldValue=s.oldValue,i=r[Y.Attr];break;case"characterData":n.type=Y.Char,n.oldValue=s.oldValue,i=r[Y.Char]}if(i){i(new CustomEvent("mutate",{bubbles:!1,cancelable:!1,detail:n}))}}}));function ee(e,s,r,n){if("resize"===e)!function(e,t){G.has(e)||(G.set(e,t),X.observe(e))}(s,r);else if("outside"===e)switch(n[0]){case"mousedown":!function(e,t){K.push([e,t])}(s,r);break;case"dblclick":!function(e,t){q.push([e,t])}(s,r);break;default:!function(e,t){Q.push([e,t])}(s,r)}else"mutate"===e&&function(e,s,r){let n=t.includes(r,"child"),i=t.includes(r,"attr"),o=t.includes(r,"char"),a=t.includes(r,"tree"),l=J.get(e);l||(l={},J.set(e,l),n&&(l[Y.Child]=s),i&&(l[Y.Attr]=s),o&&(l[Y.Char]=s),a&&(l[Y.Tree]=s),Z.observe(e,{childList:n,attributes:i,characterData:o,subtree:a}))}(s,r,n)}document.addEventListener("mousedown",(e=>{let s=t.get(e.composedPath(),0,e.target);K.forEach((([r,n])=>{if(!r.contains(s)&&!r.contains(t.closest(s,(e=>e instanceof ShadowRoot),"parentNode")?.host)){n(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:r,event:e}}),r)}}))}),!1),document.addEventListener("click",(e=>{let s=t.get(e.composedPath(),0,e.target);Q.forEach((([r,n])=>{if(!r.contains(s)&&!r.contains(t.closest(s,(e=>e instanceof ShadowRoot),"parentNode")?.host)){n(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:r,event:e}}),r)}}))}),!1),document.addEventListener("dblclick",(e=>{let s=t.get(e.composedPath(),0,e.target);q.forEach((([r,n])=>{if(!r.contains(s)&&!r.contains(t.closest(s,(e=>e instanceof ShadowRoot),"parentNode")?.host)){n(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:r,event:e}}),r)}}))}),!1);const te=/,|^(debounce:.+)|(debounce$)/,se=/,|^(throttle:.+)|(throttle$)/,re="self",ne="stop",ie="prevent",oe="once",ae="left",le="right",ce="middle",de="ctrl",pe="alt",he="shift",ue="meta",fe={esc:"escape"},ge=":";function me(e,s,r,n){let i,o=e.split("."),a=o.shift(),l=o.includes(oe),c=s;if(i=t.find(o,(e=>te.test(e)))){let e=i.split(ge);c=t.debounce(c,parseInt(e[1])||100)}if(i=t.find(o,(e=>se.test(e)))){let e=i.split(ge);c=t.throttle(c,parseInt(e[1])||100)}if(l&&(c=t.once(c)),function(e){return z.includes(e)}(a))return ee(a,r,c,o),c;let d=e=>{if(o.includes(ie)&&e.preventDefault(),o.includes(ne)&&e.stopPropagation(),!o.includes(re)||e.target===e.currentTarget){if(e instanceof MouseEvent){if(o.includes(ae)&&0!=e.button)return;if(o.includes(le)&&2!=e.button)return;if(o.includes(ce)&&1!=e.button)return}else if(e instanceof KeyboardEvent){if(t.remove(o,(e=>e==de))[0]&&!e.ctrlKey)return;if(t.remove(o,(e=>e==pe))[0]&&!e.altKey)return;if(t.remove(o,(e=>e==he))[0]&&!e.shiftKey)return;if(t.remove(o,(e=>e==ue))[0]&&!e.metaKey)return;if(!t.map(o,(e=>fe[e]||e)).includes(e.key.toLowerCase()))return}c(e)}};r.addEventListener(a,d);let p=n.__events[a];return p||(p=n.__events[a]=[]),p.push([r,d]),d}const Ee="@",ye=".",be="?",ve="*",Te=":",_e="ref",Ce=/[.?-a-z]+\s*=\s*(['"])\s*([^='"]*<\!--c_ui-pl_df-->){2,}.*?\1/ims,Se=/<\s*[a-z0-9-]+([^>]*<\!--c_ui-pl_df-->)*[^>]*?(?<!-)>/gims,Pe="slot-props";function Ne(e,s){let r="",n=t.concat(s.vars),i=s.strings.length-1,o=s.vars.length-1;for(let n=0;n<=i;n++){const i=s.strings[n];let a=t.get(s.vars,n,"");if(a&&a.di){let t=a.render(e);if(t instanceof Ve){let[s,r]=Ne(e,t);Reflect.defineProperty(a,"_renderVars",{value:r}),a=we+s+Ae}else a=t??ke}else if(a instanceof Ve){let[t,s]=Ne(e,a);Reflect.defineProperty(a,"_renderVars",{value:s}),a=De+t+xe}else a=n>o?"":ke;r+=i+a}let l=r.match(Ce);if(l){return a(`Parse error: attribute value can be set only one interpolation —— \n ${t.replaceAll(l[0],ke,"${...}")}`),["",n]}let c=0;return r=r.replace(Se,((e,s)=>t.replaceAll(e,ke,(()=>ke.replace("--\x3e","")+c++)))),r=r.replace(je,"$1><").trim(),[r,n]}const we="\x3c!--c_ui-pl_di-start--\x3e",Ae="\x3c!--c_ui-pl_di-end--\x3e",De="\x3c!--c_ui-pl_tmpl-start--\x3e",xe="\x3c!--c_ui-pl_tmpl-end--\x3e",ke="\x3c!--c_ui-pl_df--\x3e",Oe="\x3c!--c_ui-pl_df",Me=/<!--c_ui-pl_df\d*(-->)?/;function Re(s,r,n,i,o){const a=document.createElement("div");a.innerHTML=r;const c=document.createNodeIterator(a,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT);let d,p,h=0,u=null,f=[],g=[],m=[],E=[s],y=[],b=[];for(;d=c.nextNode();)if(d instanceof HTMLElement||d instanceof SVGElement){d instanceof j?u=d:u?.contains(d)||(u=null);let r={},o=t.toArray(d.attributes);for(let a=0;a<o.length;a++){const c=o[a];let{name:p,value:f}=c;if(p===Pe){let e=d.getAttribute("name")||"default";if(u){let t=u._slotsPropMap[e];t||(t=u._slotsPropMap[e]=[]),t.push(d)}}if(t.startsWith(p,Oe)){let t=n[h];if(t instanceof B){t.checkScope(e.EnterPointType.TAG);let r=new $(d,p.substring(1),e.EnterPointType.TAG);t.point=r,t.di.slotComponent=u,t.di.renderComponent=i;let n=new W(h,d);n.isDirective=!0,n.value=t,n.isComponent=!!u,s.push(n),h++,t.di.created(r,...t.args)}d.removeAttribute(p)}else if(p[0]!==Ee)if(p!==_e)if(p[0]!==ye||Me.test(f)){if(Me.test(f)){let o=n[h],a=new W(h,d,p.replace(/\.|\?|@/,""),f);if(a.isComponent=!!u,p[0]===ye||p[0]===be||p[0]===ve){if(o instanceof B){o.checkScope(e.EnterPointType.PROP);let t=new $(d,p.substring(1),e.EnterPointType.PROP);o.point=t,o.slotComponent=u,a.value=o,a.isDirective=!0,o&&o.di.created(o.point,...o.args)}else if(p[0]===be)a.isToggleProp=!0,a.value=!!o,a.value&&d.setAttribute(p.substring(1),"");else if(p[0]===ve){a.value=o;let e=p.substring(1);const[s,r]=e.split(Te);let n=s;switch(r){case"camel":n=t.camelCase(n);break;case"kebab":n=t.kebabCase(n);break;case"snake":n=t.snakeCase(n)}a.attrName=n,d.setAttribute(n,o)}else if(d instanceof j||"SLOT"===d.tagName){let e=t.camelCase(p.substring(1));e in d||"SLOT"===d.tagName||l(d.tagName,`Prop '${p}' is not defined in ${d.tagName}`),a.value=o,a.isProp=!0,r[e]=o}else l(d.tagName,`Prop '${p}' can only be set on a CompElem or a slot`);d.removeAttribute(p),o=""}else{let s;if(a.value=o,o instanceof B){let t=e.EnterPointType.ATTR;"class"===p?t=e.EnterPointType.CLASS:"style"===p&&(t=e.EnterPointType.STYLE),o.checkScope(t),a.isDirective=!0;let r=new $(d,p,t);o.point=r,o.di.slotComponent=u,o.di.renderComponent=i,s=o,o=""}f=t.replace(f,Me,o),c.value=f,s&&s.di.created(s.point,...s.args)}s.push(a),h++}}else l(d.tagName,`Prop '${p}' must be an interpolation`);else{if(Me.test(f)){let e=n[h];if(!t.has(e,"current")){l(d.tagName,"Ref must be a RefObject");continue}h++,e.current=d}d.removeAttribute(p)}else{let e=e=>{};if(Me.test(f)){let r=n[h];if(!t.isFunction(r)){l(d.tagName,`Event '${p}' must be a function`);continue}e=r.bind(i);let o=new W(h,d,p.replace(/\.|\?|@/,""),f);o.isComponent=!!u,o.isEvent=!0,s.push(o),h++}me(p.substring(1),e,d,i),d.removeAttribute(p)}}d instanceof j?(d._initProps(r),d._regWrapper(i)):d instanceof HTMLSlotElement&&i._bindSlot(d,d.name||"default",r)}else{let r=d,a=`\x3c!--${r.nodeValue}--\x3e`;if(a===we){p&&f.push(p),p=r;let t=n[h],o=new W(h,d);o.isComponent=!!u,o.isDirective=!0,o.value=t;let a=u?e.EnterPointType.SLOT:e.EnterPointType.TEXT,l=new $(p,"",a);t.point=l,t.di.slotComponent=u,t.di.renderComponent=i,g.push(t),s.push(o),m.push(o),s=[],E.push(s),h++,b.push(h),y.push(n),n=t._renderVars,h=0;continue}if(a===Ae){m.pop().textNode=r;let e=g.pop();e.point.endNode=r,e.di.created(e.point,...e.args),p=f.pop(),e.di.__updatePoints=s,E.pop(),s=t.last(E),n=y.pop(),h=b.pop()}else{if(a===De){p&&f.push(p),p=r;let a=n[h],l=new W(h,d);l.isComponent=!!u,l.isTmpl=!0;let c=t.last(g);(c&&"ForEach"===t.get(c,"diClass.name")||"ForEach"==o.constructor.name)&&(l.key=a.getKey()),a=l.value=new M(a);let v=u?e.EnterPointType.SLOT:e.EnterPointType.TEXT,T=new $(p,"",v);a.point=T,a.slotComponent=u,a.renderComponent=i,g.push(a),s.push(l),m.push(l),s=[],E.push(s),h++,b.push(h),y.push(n),n=a._renderVars,h=0;continue}if(a===xe){m.pop().textNode=r;let e=g.pop();e.point.endNode=r,p=f.pop(),e.__updatePoints=s,E.pop(),s=t.last(E),n=y.pop(),h=b.pop()}}if(a!==ke)continue;let l=new W(h,d);s.push(l),l.isComponent=!!u,l.isText=!0;let c,v=n[h];if(c=document.createComment(`compelem-ui-${h}-child-start`),r.parentNode.insertBefore(c,r),r.nodeValue=`compelem-ui-${h}-child-end`,l.textNode=c,v instanceof B){l.isDirective=!0,l.value=v;let t=u?e.EnterPointType.SLOT:e.EnterPointType.TEXT,s=new $(c,"",t);s.endNode=r,v.point=s,v.di.slotComponent=u,v.di.renderComponent=i,v.di.created(s,...v.args),v=""}else if(v instanceof Ve){l.isTmpl=!0,l.value=v;let[e,t]=Ne(i,v);v=Re(s,e,t,i,o)}else l.value=v;if(h++,t.isUndefined(v))continue;if(v instanceof NodeList){let e=document.createDocumentFragment();e.append(...v),r.parentNode.insertBefore(e,r)}else if(v instanceof Element)r.parentNode.insertBefore(v,r);else if(t.trim(v)){let e=document.createTextNode(v);r.parentNode.insertBefore(e,r)}}return a.childNodes}const Le={insertBefore:function(e,t){if(!e.parentNode)return;let s=document.createDocumentFragment();s.append(...t),e.parentNode.insertBefore(s,e)},remove:function(e,t){if(e===t)return void e?.parentNode?.removeChild(e);let s=e.nextSibling;for(;s&&s!==t;)s?.parentNode?.removeChild(s),s=e.nextSibling}};function Ue(e,...s){return new Ve(t.isString(e)?[e]:e,s)}const je=/([a-z0-9"'])\s*>\s*</gim;class Ve{strings;vars;constructor(e,s){this.strings=t.concat(e),this.vars=s}getKey(){let e=this.vars,s="";return t.each(this.strings,((n,i)=>{if(r.test(n))return s=t.toString(e[i]),!1})),s}getKeys(){let e=this.vars,s=[];for(let n=0;n<this.strings.length;n++){const i=this.strings[n];if(r.test(i)){let r=t.toString(e[n]);s.push(r)}}return t.isEmpty(s)&&e.forEach((e=>{if(e instanceof Ve){let t=e.getKey();s.push(t)}})),s}append(e){let s=t.last(this.strings);return e.strings.forEach(((e,t)=>{0!=t?this.strings.push(e):this.strings[this.strings.length-1]=s+e})),this.vars=t.concat(this.vars,e.vars),this}insert(e,t){let s=t.strings.shift();return this.strings[e]+=s,this.strings.splice(e+1,0,...t.strings),this.vars.splice(e,0,...t.vars),this}getHTML(e){let[s,r]=Ne(e,this),n=Re([],s,r,e,e);return t.reduce(n,((e,t)=>e+t.outerHTML),"")}}const He=y(class extends h{static get priority(){return Number.MAX_VALUE}created(e,s,r,...n){e[r]=t.debounce(e[r],this.wait,this.immediate)}beforeMount(e,t,...s){}mounted(e,t,...s){}updated(e,t){}get targets(){return[e.DecoratorType.METHOD]}wait;immediate;result;constructor(e,t=!1){super(),this.wait=e,this.immediate=t}});var Ie;e.QueryCache=void 0,(Ie=e.QueryCache||(e.QueryCache={})).ONCE="once",Ie.UPDATABLE="updatable";class We extends h{static get priority(){return Number.MAX_VALUE}created(e,t,s,...r){}mounted(e,t,...s){}get targets(){return[e.DecoratorType.FIELD]}selector;cache;result;constructor(e,t){super(),this.selector=e,this.cache=t}static getKey(e){return e}getter(e){this.result=e.shadowRoot?.querySelector(this.selector)}beforeMount(e,t,s,r,...n){const i=this;Reflect.defineProperty(e,r,{get:()=>(i.result&&i.cache||i.getter(e),i.result)})}updated(t,s){this.cache===e.QueryCache.UPDATABLE&&this.getter(t)}}const $e=y(We),Be=y(class extends We{getter(e){this.result=e.shadowRoot?.querySelectorAll(this.selector)}});function Fe(e,s,r){if(!t.has(e.constructor,i.STATES)){const s={};let r=e.constructor;for(;(r=d(r))!==j;)t.merge(s,r[i.STATES]?t.cloneDeep(r[i.STATES]):{});Reflect.defineProperty(e.constructor,i.STATES,{configurable:!1,enumerable:!1,value:s})}r.shallow=r.shallow||!1,e.constructor[i.STATES][s]=r}class ze extends(O(Object)){_renderArgs;static get scopes(){return[]}renderParams}const Ge=["key"];const Ke=F(class extends ze{created(e,s){let r=e.startNode;if(r instanceof j){let e={},n={};t.each(s,((t,s)=>{Ge.includes(s)||(s in r?e[s]=t:n[s]=t+"")})),r._initProps(e,n)}else t.each(s,((e,t)=>{r.setAttribute(t,e)}))}update(t,s,r){return e.DirectiveUpdateTag.NONE}static get scopes(){return[e.EnterPointType.TAG]}render(e){}});const Qe=F(class extends ze{created(e,s){let r=[];t.isArray(s)?r=t.compact(s):t.isObject(s)?r=t.flatMap(s,((e,t)=>e?t:[])):t.isString(s)&&(r=s.split(" "));let n=e.startNode;t.each(this.lastCls,(e=>{n.classList.remove(e)})),t.each(r,(e=>{n.classList.add(e)})),this.lastCls=t.concat(r)}update(t,s,r){return this.created(t,s[0]),e.DirectiveUpdateTag.NONE}static get scopes(){return[e.EnterPointType.CLASS]}lastCls;render(e){}});const qe=F(class extends ze{created(e,...t){}update(s,r,n){if(t.isEmpty(s.getNodes())&&(!r||t.isEmpty(r[0])))return e.DirectiveUpdateTag.NONE;if(t.isMatch(this.lastAry,r[0])&&this.lastAry.length===r[0].length)return e.DirectiveUpdateTag.NONE;if(!t.isEmpty(this.renderParams)){let e=t.last(this.renderParams);t.isArray(e)||(e=[e]),this.renderParams=e}return this.lastAry=t.clone(r[0]),e.DirectiveUpdateTag.UPDATE}constructor(e){super(),t.isEmpty(this.renderParams)||(this.renderParams=t.toArray(t.last(this.renderParams)))}static get scopes(){return[e.EnterPointType.TEXT,e.EnterPointType.SLOT]}lastAry;lastRenderTmpl;render(e,s){let n=t.map(e,((e,t)=>s(e,t)));if(n.length<1)return this.lastRenderTmpl=new Ve([],[]),this.lastRenderTmpl;let i=[],o=[];const l=[],c=[];for(let e=0;e<n.length;e++){const s=n[e];let d=t.last(o),p=s.vars,h=!0,u=s.strings;for(let e=0;e<u.length;e++){const t=u[e];if(r.test(t)){let t=p[e]+"";if(i.includes(t))return void a(`forEach - duplicate key '${t}'`);i.push(t),h=!1}0==e&&d?o[o.length-1]=d+t:o.push(t)}if(h)return void a("forEach - missing 'key' prop");let f=t.last(l);f&&u.length>0&&(l[l.length-1]=t.trim(f)+u.shift()),l.push(""),c.push(s)}return this.lastAry=t.clone(e),l.push(""),this.lastRenderTmpl=new Ve(l,c),this.lastRenderTmpl}});const Xe=F(class extends ze{created(e,...t){}ifNodes;elseNodes;static get scopes(){return[e.EnterPointType.TEXT,e.EnterPointType.SLOT]}update(t,s,r){return!!s[0]==!!r[0]?e.DirectiveUpdateTag.NONE:(s[0],e.DirectiveUpdateTag.REPLACE)}render(e,t,s){return e?t(e):s(e)}});const Ye=F(class extends ze{created(e,...t){}static get scopes(){return[e.EnterPointType.TEXT,e.EnterPointType.SLOT]}update(t,s,r){return s[0]===r[0]?e.DirectiveUpdateTag.NONE:s[0]?e.DirectiveUpdateTag.REPLACE:e.DirectiveUpdateTag.REMOVE}render(e,t){return e?t():Ue``}});var Je;e.ModelTriggerType=void 0,(Je=e.ModelTriggerType||(e.ModelTriggerType={})).CHANGE="change",Je.INPUT="input";const Ze=F(class extends ze{created(e,s,r="value"){const n=e.startNode;if("binded"===t.get(n,"_model"))return;let i=t.last(this.renderParams);if(this.updateProp=r,this.modelPath=i,t.isObject(s)||t.trim(s)||(s=""),n instanceof j)n._initProps({[this.updateProp]:s}),n.addEventListener("update:"+r,(e=>{t.set(this.renderComponent,this.modelPath,e.detail.value)})),t.set(n,"_model","binded");else if(n instanceof HTMLTextAreaElement)n.setAttribute(this.updateProp,s+""),n.addEventListener("input",(e=>{let s=e.target;t.set(this.renderComponent,this.modelPath,s.value)})),t.set(n,"_model","binded");else if(n instanceof HTMLInputElement){let e="",i="";switch(n.type){case"checkbox":case"radio":e="checked",i="change";break;default:e="value",i="input"}n.setAttribute(r??e,s+""),n.addEventListener(i,(e=>{let s=e.target;t.set(this.renderComponent,this.modelPath,s.value)})),t.set(n,"_model","binded")}else n instanceof HTMLSelectElement&&(n.setAttribute(this.updateProp,s+""),n.addEventListener("change",(e=>{let s=e.target;t.set(this.renderComponent,this.modelPath,s.value)})),t.set(n,"_model","binded"))}update(s,r,n){if(this.modelPath||(this.modelPath=t.last(this.renderParams)),!t.isEqual(r,n)){const e=s.startNode;if(e instanceof j)e._updateProps({[this.updateProp]:r[0]});else if(e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)e.setAttribute(this.updateProp,r[0]+"");else if(e instanceof HTMLInputElement)switch(e.type){case"checkbox":case"radio":r[0]?e.setAttribute("checked",""):e.removeAttribute("checked");break;default:e.setAttribute(this.updateProp,r[0]+"")}}return e.DirectiveUpdateTag.NONE}static get scopes(){return[e.EnterPointType.TAG]}modelPath;render(e,t="value"){}});const et=F(class extends ze{created(e,s,r){let n=e.startNode;t.isUndefined(this.display)&&(this.display=n.style.display);let i=r;this.renderComponent.nextTick((()=>{n.style.display=s?this.display:"none",i&&i(n,s)}))}update(t,s,r){return this.created(t,s[0],s[1]),e.DirectiveUpdateTag.NONE}display=void 0;static get scopes(){return[e.EnterPointType.TAG]}constructor(e){super(),this.point=e}render(e,t){}});const tt=F(class extends ze{created(e,t,s){t=t.bind(this.renderComponent),this.slotComponent._bindSlotHook(s||"default",t)}update(t,s,r){return e.DirectiveUpdateTag.NONE}static get scopes(){return[e.EnterPointType.SLOT]}render(e,t){}});class st{static getCssText(e,s=!1){return t.isString(e)?e:t.join(t.map(e,((e,r)=>r.startsWith("--")?r+":"+e+(s?" !important":""):t.kebabCase(r)+":"+e+(s?" !important":""))),";")}static setStyle(e,s){if(t.isString(e)&&!t.trim(e))return{};let r=st.getCssText(e),n={};return t.each(r.split(";"),(e=>{let r=e.split(":"),i=t.trim(r[0]),o=t.trim(r[1]);n[i]=s.style.getPropertyValue(i),s.style.setProperty(i,o)})),n}}const rt=F(class extends ze{created(e,t){st.setStyle(t,e.startNode)}update(t,s,r){return this.created(t,s[0]),e.DirectiveUpdateTag.NONE}constructor(e){super(),this.point=e}static get scopes(){return[e.EnterPointType.STYLE]}render(e){}});const nt=F(class extends ze{created(e,s){this.modelPath||(this.modelPath=t.last(this.renderParams));const r=e.startNode;let n=e.attrName;r._initProps({[n]:s}),r.addEventListener("update:"+n,(e=>{t.set(this.renderComponent,this.modelPath,e.detail.value)}))}update(s,r,n){if(!t.isEqual(r,n)){const e=s.startNode;let t=s.attrName;e._updateProps({[t]:r[0]})}return e.DirectiveUpdateTag.NONE}static get scopes(){return[e.EnterPointType.PROP]}modelPath;constructor(e){super()}render(e){}});const it=F(class extends ze{created(e,...t){}static get scopes(){return[e.EnterPointType.TEXT,e.EnterPointType.SLOT]}update(s,r,n){return t.isEqual(r,n)?e.DirectiveUpdateTag.NONE:e.DirectiveUpdateTag.REPLACE}render(e,s){let r=()=>Ue``,n=[],i=[];t.each(s,((e,s)=>{if(t.isFunction(e))n.push(s),i.push(e);else{let t=e[0],s=e[1];n.push(t),i.push(s)}"default"===s&&(r=e)}));let o=t.findIndex(n,(s=>t.isFunction(s)?s(e):s==e));return t.call(i[o]??r)}});e.CompElem=j,e.CssHelper=st,e.Decorator=h,e.DecoratorWrapper=m,e.Directive=ze,e.DirectiveWrapper=B,e.EnterPoint=$,e.GetKeyFnName=u,e.Template=Ve,e.UpdatePoint=W,e._DecoratorMap=g,e._DecoratorsKey=f,e._getObservedAttrs=_,e.bind=Ke,e.buildHTML=Ne,e.classes=Qe,e.computed=function(e,s,r){r.get||a(`Computed '${s}' must be a getter`),t.has(e.constructor,i.COMPUTED)||(e.constructor[i.COMPUTED]=t.isEmpty(e.constructor[i.COMPUTED])?{}:t.cloneDeep(e.constructor[i.COMPUTED])),e.constructor[i.COMPUTED][s]=r.get},e.createRef=function(e){return{current:e}},e.debounced=He,e.decorator=y,e.directive=F,e.event=function(e,s){return(r,n,o)=>{t.has(r.constructor,i.EVENTS)||(r.constructor[i.EVENTS]=t.isEmpty(r.constructor[i.EVENTS])?[]:t.cloneDeep(r.constructor[i.EVENTS])),r.constructor[i.EVENTS].push({name:e,options:s,fn:r[n]})}},e.forEach=qe,e.html=Ue,e.ifElse=Xe,e.ifTrue=Ye,e.makeState=function(e,t,s){Fe(e.prototype,t,s||{prop:""})},e.model=Ze,e.prop=function(e){if(1===arguments.length)return(t,s,r)=>{e.required=e.required||!1,e.attribute=!1!==e.attribute,v(t,s,e,r)};let s=arguments[0],r=arguments[1],n=arguments[2];e={type:void 0,required:!1,attribute:!0},n&&"function"==typeof n.type&&(e=t.defaults(n,e),n=void 0),v(s,r,e,n)},e.query=$e,e.queryAll=Be,e.show=et,e.slot=tt,e.state=function(e){if(1===arguments.length)return(t,s)=>{Fe(t,s,e)};Fe(arguments[0],arguments[1],{prop:""})},e.styles=rt,e.sync=nt,e.tag=function(e){return t=>{if(t){if(t.prototype.hasOwnProperty("attributeChangedCallback")){let e=t.prototype.attributeChangedCallback;t.prototype.attributeChangedCallback=function(t,s,r){j.prototype.attributeChangedCallback.call(this,t,s,r),e.call(this,t,s,r)}}if(t.prototype.hasOwnProperty("connectedCallback")){let e=t.prototype.connectedCallback;t.prototype.connectedCallback=function(){j.prototype.connectedCallback.call(this),e.call(this)}}if(t.prototype.hasOwnProperty("disconnectedCallback")){let e=t.prototype.disconnectedCallback;t.prototype.disconnectedCallback=function(){j.prototype.disconnectedCallback.call(this),e.call(this)}}customElements.define(e,t)}}},e.watch=function(e,s){return(r,n)=>{t.has(r.constructor,i.WATCH)||(r.constructor[i.WATCH]=t.isEmpty(r.constructor[i.WATCH])?{}:t.cloneDeep(r.constructor[i.WATCH]));(t.isArray(e)?e:[e]).forEach((e=>{let o=e.replaceAll(".","-"),a=r.constructor[i.WATCH][o];t.isArray(a)||(a=r.constructor[i.WATCH][o]=[]),a.push({source:e,options:s,handler:r[n]})}))}},e.when=it,Object.defineProperty(e,"__esModule",{value:!0})}));
|
package/decorator/Decorator.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export declare abstract class Decorator {
|
|
|
22
22
|
* @param args 自定义参数
|
|
23
23
|
*/
|
|
24
24
|
/**
|
|
25
|
-
* 返回用于识别唯一实例的key,比如@watch(a.b.c)中的变量路径就会作为唯一key
|
|
25
|
+
* 返回用于识别唯一实例的key,比如@watch(a.b.c)中的变量路径就会作为唯一key。key相同的装饰器仅会保存一份,如果无需唯一校验可不实现该函数
|
|
26
26
|
* @param args
|
|
27
27
|
*/
|
|
28
28
|
abstract created(component: CompElem, ...args: any[]): any;
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* 定义防抖函数
|
|
3
|
-
*
|
|
4
|
-
* @param wait 抖动间隔,单位ms
|
|
5
|
-
*/
|
|
6
|
-
export declare function debounced(wait: number): (target: any, name: string, descriptor: PropertyDescriptor) => void;
|
|
1
|
+
export declare const debounced: (wait: number, immediate?: boolean | undefined) => (...metadata: any[]) => any;
|
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* compelem v0.6.
|
|
2
|
+
* compelem v0.6.2-b1.1751990071
|
|
3
3
|
* A modern, reactive, fast, lightweight and flexible lib for building web components
|
|
4
4
|
* @holyhigh2
|
|
5
5
|
* https://github.com/holyhigh2/compelem
|
|
6
6
|
*/
|
|
7
|
-
import{toPath as t,some as e,isString as s,isUndefined as r,isBlank as n,get as i,isObject as o,isDefined as a,isEmpty as l,has as c,concat as d,defaults as u,merge as h,cloneDeep as p,each as f,kebabCase as g,toArray as m,last as E,startsWith as b,isFunction as _,isArray as v,initial as C,join as N,split as S,set as y,isEqual as T,replace as P,isPlainObject as w,flatMap as A,test as x,size as k,assign as M,first as O,closest as R,once as D,filter as L,bind as V,camelCase as H,isNil as I,trim as $,isBoolean as W,parseJSON as j,isNull as B,debounce as U,groupBy as z,reject as F,compact as K,remove as Q,includes as X,find as G,throttle as q,map as Y,replaceAll as Z,snakeCase as J,toString as tt,reduce as et,isMatch as st,clone as rt,findIndex as nt,call as it}from"myfx";const ot=new WeakMap,at=/\s+\.?key\s*=/;var lt,ct,dt;function ut(t){console.error("[CompElem]",t)}function ht(t,e){console.error(`[CompElem <${t}>]`,e)}function pt(e){return t(e).join("-")}function ft(t){return Object.getPrototypeOf(t)}function gt(t){let e=t;return s(t)&&/(?:^true$)|(?:^false$)/.test(e)?e="true"===e:(r(e)||n(e))&&(e=!0),e}!function(t){t[t.CSS=1]="CSS",t[t.COMPUTED=2]="COMPUTED"}(lt||(lt={})),function(t){t.PROPS="__deco_props",t.STATES="__deco_states",t.COMPUTED="__deco_computed",t.WATCH="__deco_watch",t.EVENTS="__deco_events"}(ct||(ct={})),function(t){t.CLASS="class",t.FIELD="field",t.METHOD="method"}(dt||(dt={}));class mt{static get priority(){return 0}}const Et="getKey",bt="__decorators",_t=new WeakMap;class vt{args;metadata;decoratorClass;instanceMap;key;priority=0;constructor(t,e,s){this.args=t,this.metadata=e,this.decoratorClass=s,this.priority=i(s,"priority",0),this.instanceMap=new WeakMap}create(t){let e,s=new this.decoratorClass(...this.args),n=s.targets,c=this.metadata[2];o(c)&&a(i(c,"configurable"))?e=dt.METHOD:r(this.metadata[2])&&(e=dt.FIELD),!l(n)&&e&&n.includes(e)?(s.created(t,...this.metadata),this.instanceMap.set(t,s)):ut(`Decorator '${this.decoratorClass.name}' is out of targets, expect '${n.join(",")}' bug got '${e}'`)}beforeMount(t,e){this.instanceMap.get(t).beforeMount(t,e,...this.metadata)}mounted(t,e){this.instanceMap.get(t).mounted(t,e,...this.metadata)}updated(t,e){this.instanceMap.get(t).updated(t,e)}}const Ct=new WeakMap;function Nt(t){let e=(...e)=>(...s)=>{let r=s[0].constructor,n=i(r,bt);if(!c(r,bt)){let t=i(Object.getPrototypeOf(r),bt);n=t?d(t):[],Reflect.defineProperty(r,bt,{configurable:!1,enumerable:!1,value:n})}let o,a={},l=i(t,Et);if(l){let s=Ct.get(t);if(s||(s=new WeakMap,Ct.set(t,s)),a=s.get(r),a||(a={},s.set(r,a)),o=l(...e),a[o])return a[o]}let u=new vt(e,s,t);return a[o]=u,n?.push(u),u};return _t.set(e,!0),e}const St=new WeakMap;function yt(t){if(1===arguments.length)return(e,s,r)=>{t.required=t.required||!1,t.attribute=!1!==t.attribute,Tt(e,s,t,r)};let e=arguments[0],s=arguments[1],r=arguments[2];t={type:void 0,required:!1,attribute:!0},r&&"function"==typeof r.type&&(t=u(r,t),r=void 0),Tt(e,s,t,r)}function Tt(t,e,s,r){let n;if(/[a-z]/.test(e[0])||ut(`Prop '${e}' must be in CamelCase`),!c(t.constructor,ct.PROPS)){const e={};let s=t.constructor;for(;(s=ft(s))!==Bt;)h(e,s[ct.PROPS]?p(s[ct.PROPS]):{});Reflect.defineProperty(t.constructor,ct.PROPS,{configurable:!1,enumerable:!1,value:e}),n=new Set,f(e,((t,e)=>{if(t.attribute){let t=g(e);n?.add(t)}})),St.set(t.constructor,n)}if(r&&(r.get&&(s.getter=r.get),r.set&&(s.setter=r.set)),s.attribute){n||(n=St.get(t.constructor));let s=g(e);n?.add(s)}c(t.constructor,"observedAttributes")||(t.constructor.observedAttributes=[]),t.constructor.observedAttributes=m(n),s.shallow=s.shallow||!1,t.constructor[ct.PROPS][e]=s}const Pt=new Set;function wt(t){return St.get(t)??Pt}const At={collectWatch(t,e,s){let r=Rt.get(t);r||(r={},Rt.set(t,r));let n=r[s];n||(n=r[s]=[]),n.push(e)},startCollect(t,e){this.__collectType=e,this.__collecting=t},setUpdater(t){this.__updater=t},endCollect(){this.__collecting=null},__directiveQ:[],setDirectiveQ(t){let e=E(this.__directiveQ);const s=t?t.join(","):"",r=e?e.join(","):"";e&&s===r||(e&&e.length<t.length&&b(s,r)?this.__directiveQ[this.__directiveQ.length-1]=t:this.__directiveQ.push(t))},popDirectiveQ(){let t=d(this.__directiveQ);return this.__directiveQ=[],t},startRender(t){this.__renderCollecting=!0,this.__renderContext=t},endRender(t){this.__renderCollection.forEach((e=>{t._regDeps(e,this.__renderContext)})),this.__renderCollection.clear(),this.__renderCollecting=!1,this.__renderContext=null},collect(t){this.__renderCollection.add(t)},clear(){this.__directiveQ=[]},__updater:null,__collecting:null,__collectType:-1,__renderCollection:new Set,__renderContext:null,__renderCollecting:!1,__skipCheck:!1},xt=new WeakMap,kt=new WeakMap,Mt=new WeakMap,Ot=new WeakMap,Rt=new WeakMap,Dt=new WeakSet;function Lt(t,e){if(!o(t))return t;const s=Dt.has(t)?t:new Proxy(t,{get(t,e,s){if(!e)return;const r=Reflect.get(t,e,s);if("string"!=typeof e&&"number"!=typeof e)return r;let n=e in t;if((At.__renderCollecting||At.__collecting)&&(n&&t.hasOwnProperty(e)||!n)){let t=kt.get(s)??[],r=d(t,[e]),n=r.join("-");if(At.__renderCollecting)At.collect(pt(r)),At.setDirectiveQ(r);else if(At.__collecting){let t;switch(At.__collectType){case lt.COMPUTED:t=Mt.get(At.__collecting),t||(t={},Mt.set(At.__collecting,t));break;case lt.CSS:t=Ot.get(At.__collecting),t||(t={},Ot.set(At.__collecting,t))}let e=t[n];e||(e=t[n]=[]),e.push(At.__updater)}}return r},set(t,e,s,r){if(!e)return!1;let n=t[e];if(!o(n)&&n===s)return!0;if(Number.isNaN(s)&&Number.isNaN(n))return!0;let a=kt.get(r)??[],c=d(a,[e]),u=xt.get(r).from,h=i(u.constructor,ct.PROPS),p=i(u.constructor,ct.STATES),f=i(h,[c[0],"hasChanged"])||i(p,[c[0],"hasChanged"]);if(f){if(!f.call(u,s,n))return!0}else if(n===s&&!ot.has(n))return!0;h&&h[e]&&t.__isData&&h[e].sync&&u.emit("update:"+e,{value:s});let g=xt.get(r)?.contextSet,m=s;!o(s)||_(s)||s instanceof Node||Object.isFrozen(s)||g.forEach((t=>{let s=xt.get(r)?.pathMap,n=s?.get(t);n&&(c=d(n,[e]),kt.set(m,c),m=Lt(m,t),Dt.add(m),kt.set(m,c))}));let E=Reflect.set(t,e,m),b=xt.get(r).pathMap;return g.forEach((t=>{let s=b.get(t);if(!s)return;t===u&&a.length>1&&s.length>1&&a[0]===s[0]&&(s=a),c=d(s,"length"==e&&v(r)?[]:[e]);let o=Mt.get(t),h=Ot.get(t),p=Rt.get(t);if(o||h||p){let t=c.length;for(;t;){let e=c.slice(0,t).join("-");if(p){const s=p[e];t===c.length?s?.forEach((t=>{let e=t();e.ov=n,Vt.pushWatch(e)})):s?.forEach((t=>{let e=t();i(e,"deep")&&(e.ov=n,Vt.pushWatch(e))}))}if(o){let t=o[e];if(!l(t))for(let e=0;e<t.length;e++){const s=t[e];Vt.pushComputed(s)}}if(h){let t=h[e];if(!l(t))for(let e=0;e<t.length;e++){const s=t[e];Vt.pushCss(s)}}t--}}let f=t._notify(n,c);Vt.pushNext(f)})),E}});Dt.has(s)||Dt.add(s);let r=kt.get(t)??[];if(Object.isExtensible(t)&&!xt.get(s)){let t=new Set;t.add(e);let n=new WeakMap;n.set(e,r),xt.set(s,{from:e,contextSet:t,pathMap:n})}else{xt.get(s).contextSet.add(e);let t=xt.get(s).pathMap,n=t.get(e),o=d(r);if(n&&n.join("")!==o.join("")){let t=i(e,C(n));v(t)||function(...t){console.warn("[CompElem]",...t)}(`The object is referenced by more than one @state '${o.join(".")},${n.join(".")}'`),n=o}else t.set(e,o)}let n=i(e.constructor,ct.PROPS),a=i(e.constructor,ct.STATES);for(let s in t){const l=t[s];let c=i(n,[s,"shallow"])||i(a,[s,"shallow"]);!o(l)||Dt.has(l)||_(l)||l instanceof Node||Object.isFrozen(l)||c||(kt.set(l,d(r,[s])),t[s]=Lt(l,e),Dt.add(t[s]),kt.set(t[s],d(r,[s])))}return s}class Vt{static watchSet=new Set;static computedSet=new Set;static cssSet=new Set;static nextSet=new Set;static nextPending=!1;static next;static flush(){Vt.nextPending=!1;let t=Array.from(Vt.watchSet);Vt.watchSet.clear();let e=Array.from(Vt.computedSet);Vt.computedSet.clear();let s=Array.from(Vt.cssSet);Vt.cssSet.clear();let r=Array.from(Vt.nextSet);Vt.nextSet.clear(),t.forEach((t=>t(i(t,"ov")))),e.forEach((t=>t())),s.forEach((t=>t())),r.forEach((t=>t()))}static pushWatch(t){Vt.watchSet.add(t)}static pushComputed(t){Vt.computedSet.add(t)}static pushCss(t){Vt.cssSet.add(t)}static pushNext(t){Vt.nextSet.add(t),Vt.nextPending||(Vt.nextPending=!0,Vt.next())}}function Ht(t){return class extends t{__updatePoints;renderComponent;buildView(t){let e=this instanceof Bt?this:this.renderComponent,[s,r]=Me(e,t),n=[],i=$e(n,s,r,e,this);return this.__updatePoints=n,i}updateView(t){if(n(N(t.strings)))return;if(!this.__updatePoints)return;let{vars:e}=t,s=this instanceof Bt?this:this.renderComponent;for(let t=0;t<this.__updatePoints.length;t++){const r=this.__updatePoints[t];let n=r.varIndex;if(n<0)continue;let a=r.value,l=e,c=r.node,d=S(n,"-");for(let e=0;e<d.length;e++){const s=d[e];l=i(l,s),l&&l.vars&&t<d.length-1&&(l=l.vars)}if(!o(a)&&a===l)continue;let u=c;if(r.isDirective){if(!a.di)continue;l.di=a.di,l.di.renderParams=l.varChain,l.di._renderArgs=l.args,l.point=a.point,l.varPath=a.varPath,a.update(a.point,l.args,a.args)}else if(r.isToggleProp){if(!!l===a)continue;u.toggleAttribute(r.attrName,!!l),y(u,r.attrName,!!l)}else if(r.isProp){if(!o(l)&&l===a)continue;c instanceof Bt?c._updateProps({[r.attrName]:l}):c instanceof HTMLSlotElement&&s._updateSlot(c.getAttribute("name")||"default",r.attrName,l)}else if(r.attrName&&!r.isEvent){if(!T(a,l))switch(r.attrName){case"value":if(c instanceof HTMLInputElement){c.value=l;break}default:c.setAttribute(r.attrName,P(r.attrTmpl,Ie,l+""))}}else if(r.isTmpl)(l.strings.join()!==a.tmpl.strings.join()||l.vars.some((t=>o(t)&&!w(t)))||a.tmpl.vars.some((t=>o(t)&&!w(t)))||!T(l.vars,a.tmpl.vars))&&r.value.updateView(l),a.tmpl=l,l=a;else if(r.isText){let t=r.textNode.nextSibling;t&&t===r.node.previousSibling?t.textContent=l:(We.remove(r.textNode,r.node),We.insertBefore(r.node,[l]))}r.value=l}}}}(()=>{const t=Promise.resolve(),e=Vt.flush;Vt.next=()=>{t.then(e)}})();class It extends(Ht(Object)){tmpl;constructor(t){super(),this._renderVars=i(t,"_renderVars"),this.tmpl=t}}const $t={boolean:Boolean,string:String,number:Number,object:Object,array:Array,function:Function,undefined:Object},Wt=new WeakMap;let jt=[];class Bt extends(Ht(HTMLElement)){static __l_globalRule=document.createElement("style");static defaults(t){jt=A(t.css,(t=>{if(s(t)){let e=new CSSStyleSheet;return e.replaceSync(t),e}return t instanceof CSSStyleSheet?t:[]})),t.global,f(t,((t,e)=>{x(e[0],/[A-Z]/)}))}#t={};#e={"#slots":{}};#s={};#r={};#n;#i={};__events={};get[Symbol.toStringTag](){return this.constructor.name}get reactiveData(){return this.#s}get attrs(){return this.#o}get props(){return this.#a}get renderRoot(){return this.#l}get renderRoots(){return this.#c}get parentComponent(){return this.#d}get slotHooks(){return this.#u}get css(){return Wt.get(this.constructor)}get isMounted(){return this.#h}get slots(){return this.#e["#slots"]}#o;#a;#l;#c;#d;#p={};#u={};#f={};#h=!1;static get styles(){return[]}static get globalStyles(){return[]}get styles(){return[]}#g=!1;#m=!1;constructor(...t){super(),1===k(t)&&(this.#a={},M(this.#a,O(t)));let e=this.render.bind(this);this.render=function(){let t;return At.startRender(this),t=e(),At.endRender(this),t};let r=i(this.constructor,"globalStyles"),n=i(this.constructor,"_global_style_attached");if(!l(r)&&"1"!==n){let t="";r.forEach((e=>{s(e)&&(t+=e+"\n")})),Bt.__l_globalRule.textContent+=t,y(this.constructor,"_global_style_attached","1")}let o=Wt.get(this.constructor),a=o??[];o||(f(i(this.constructor,"styles"),(t=>{if(s(t)){let e=new CSSStyleSheet;e.replaceSync(t),a.push(e)}else a.push(t)})),Wt.set(this.constructor,a)),this.#n=this.attachShadow({mode:"open"}),this.#n.adoptedStyleSheets=[...jt,...a],this._slotsPropMap={default:[]};let c=i(this.constructor,bt);c&&c.sort(((t,e)=>e.priority-t.priority)).forEach((t=>t.create(this))),this.#E=this.#b.bind(this)}#E;connectedCallback(){let t=R(this.parentNode,(t=>t instanceof Bt||t.host instanceof Bt),"parentNode");this.#d=t?t instanceof Bt?t:t.host:null,this.__init()}disconnectedCallback(){}__init(){if(this.#g)return;if(this.#m)return;this.#m=!0,this.#_();const t=this.#v();this.propsReady(t);for(const e in t){const s=t[e];this.#e[e]=s}this.#C(),f(this.#e,((t,e)=>{let s=Reflect.getOwnPropertyDescriptor(this.#e,e);Reflect.defineProperty(this,e,{get(){let t=Reflect.get(this.#s,e);return s?.get?s?.get():t},set(t){s?.set?s?.set(t):Reflect.set(this.#s,e,t)}})})),Reflect.defineProperty(this.#e,"__isData",{enumerable:!1,value:!0}),this.#s=Lt(this.#e,this);let e=i(this.constructor,ct.COMPUTED);f(e,((t,e)=>{At.startCollect(this,lt.COMPUTED),At.setUpdater((()=>{this.#s[e]=t.call(this)})),this.#e[e]=t.call(this),At.endCollect(),Reflect.defineProperty(this,e,{get(){return Reflect.get(this.#s,e)},set(t){ht(this.tagName,"Cannot set a computed property '"+e+"'")}})}));let s=i(this.constructor,ct.WATCH);f(s,((t,e)=>{t.forEach((t=>{let{source:s,options:r,handler:n}=t,o=n.bind(this);i(r,"once",!1)&&(o=D(o));const a=function(t){let e=i(this,s.replaceAll("-","."));o(e,t,s)}.bind(this);let l=i(r,"deep",!1);if(a.deep=l,At.collectWatch(this,(()=>a),e),!i(r,"immediate",!1))return;let c=i(this,s.replaceAll("-","."));o(c,c,s)}))}));let r=this.render(),o=this.buildView(r);if(o){let t=m(o);t.forEach((t=>{this.#n.appendChild(t)})),this.#c=L(t,(t=>t.nodeType===Node.ELEMENT_NODE)),this.#l=this.#c[0]}f(this.#u,((t,e)=>{this.#N(e)}));const a=this;let l=i(this.constructor,bt);l&&l.sort(((t,e)=>e.priority-t.priority)).forEach((t=>{t.beforeMount(this,((t,e)=>(a.#s[t]=e,a.#s[t])))})),this.beforeMount();let c=i(this.constructor,ct.EVENTS);c&&c.forEach((async t=>{let e=t.name,s=M({target:document,once:!1,passive:!1,capture:!1},t.options),r=V(t.fn,this),n=s.target;_(n)&&(n=await n.call(this,this)),n?n.addEventListener(e,r,s):ht(this.tagName,"The target of @event('"+e+"',...) is invalid")})),At.startCollect(this,lt.CSS);let d=[];this.styles.forEach((t=>{if(!_(t))return;let e=new CSSStyleSheet;d.push(e),At.setUpdater((()=>{let s=t()??"";e.replaceSync(s)}));let s=t();n(s)||e.replaceSync(s)})),At.endCollect(),this.#n.adoptedStyleSheets=[...this.#n.adoptedStyleSheets,...d],setTimeout((()=>{this.#h=!0,this.mounted(),l&&l.forEach((t=>{t.mounted(this,((t,e)=>(a.#s[t]=e,a.#s[t])))}))}),0),this.#g=!0}propsReady(t){}render(){throw Error(`[CompElem <${this.tagName}>] Missing render()`)}beforeMount(){}mounted(){}#S(t,e){this.#_();let s=i(this.#t[e],"props");s&&f(this.slots,((t,e)=>{t.filter((t=>t.nodeType===Node.ELEMENT_NODE)).forEach((t=>{t instanceof Bt?t._updateProps(s):f(s,((e,s)=>{if(t instanceof HTMLSlotElement){let r=i(t,"__l_comp");if(r){let n=t.name||"default",i=r.#t[n];i||(i=r.#t[n]={props:{}}),i.props||(i.props={}),i.props[s]=e,r.#S(t,n)}}else t.setAttribute(s,e)}))}))})),this.slotChange(t,e)}slotChange(t,e){}attributeChangedCallback(t,e,s){this.#y(t,e,s)}shouldUpdate(t){return!0}updated(t){}#T={};_notify(t,e){let s=[];for(let r=0;r<e.length;r++){const n=e[r];s.push(n);let a=i(this,s),l=pt(s);this.#r[l]={value:a,chain:"slots"===l?["slots"]:s,oldValue:t,end:s.length===e.length},o(a)&&"#"!=l[0]&&ot.set(a,l)}return this.#E}#b(){if(k(this.#r)<1)return;const t=this.#r;this.#r={};let e=i(this.constructor,bt);if(e&&e.sort(((t,e)=>e.priority-t.priority)).forEach((e=>{e.updated(this,t)})),!this.shouldUpdate(t))return;let s=new Set;f(t,(({value:t,chain:e,oldValue:r},n)=>{this.#i[n]&&this.#i[n].forEach((t=>{s.add(t)}))})),s.forEach((t=>{if(t===this)this.updateView(this.render());else{let e=t.render(...t._renderArgs?t._renderArgs:[]);e&&t.updateView(e)}})),this.#P.forEach((t=>{this.#N(t)})),this.updated(t),f(t,(({value:t,chain:e,oldValue:s},r)=>{o(t)&&ot.has(t)&&ot.delete(t)}))}#v(){let t=i(this.constructor,ct.PROPS),s=this.attributes,n=this.tagName,l=this.#a,d={};f(s,(({name:e,value:s})=>{if(e[0]===Ne||e[0]===Se||e[0]===ye||e===we||"slot"===e)return;let r=H(e);t&&!t[r]&&(d[e]=s)})),this.#o=this.#o?M(this.#o,d):d;let u={};return f(t,((d,h)=>{let p,f=t[h],m=c(l,h),E=i(this,h);if(!("_defaultValue"in f)&&(f._defaultValue=E,!f.type)){r(E)&&ht(n,"Prop '"+h+"' has neither propType nor defaultValue be used for type inference");let t=typeof E;v(E)&&(t="array");let e=$t[t];f.type=e}if(m)p=I(l[h])?E:l[h];else{p=E;let t=s.getNamedItem(g(h))||s.getNamedItem(Se+g(h));t&&(m=!0,p=t.value)}if(f.required&&!m)return ht(n,"Prop '"+h+"' is required"),!1;p=this.#w(t,h,p);let b=i(t,[h,"getter"]);b&&(b=V(b,this));let _=i(t,[h,"setter"]);if(_&&(_=V(_,this)),(b||_)&&Reflect.defineProperty(this.#e,h,{set:_||function(t){},get:b}),f.attribute&&a(p)&&!o(p)){let t=g(h),s=$(p);(C=f.type)===Boolean||e(C,(t=>t===Boolean))?(s=gt(p),W(s)?this.toggleAttribute(t,s):this.setAttribute(t,s)):this.setAttribute(t,s)}var C;this.#e[h]=p,u[h]=p})),Object.seal(u)}#A(t,e){let s=t;try{for(let r=0;r<e.length;r++){const n=e[r];s=n===Boolean?gt(t):n===Number?Number(t):n===String?String(t):n===Object||n===Array?j(t):n===Date?new Date(t):new n(t)}}catch(e){ht(this.tagName,"Convert attribute error with "+t)}return s}#w(t,r,n){let i=t[r];if(!i)return n;let o=i.isValid,l=i.type,c=v(l)?l:[l],d=i.converter,u=n;if(!e(c,(t=>t===String))&&s(u)&&!B(u))try{u=d?d(u):this.#A(u,c)}catch(t){ht(this.tagName,`Convert attribute '${r}' error with `+u)}for(let t=0;t<c.length;t++){"Boolean"===c[t].name&&(u=gt(u))}let h=typeof u,p=!a(u);for(let t=0;t<c.length;t++){const e=c[t];if(x(h,e.name,"i")||u instanceof e||Object.prototype.toString.call(u)===Object.prototype.toString.call(e.prototype)){p=!0;break}}return p||ht(this.tagName,`Invalid prop '${r}'. expected '${c.map((t=>t.name||t))}' but got '${h}'`),o&&(o.call(this,u,this.#e)||ht(this.tagName,`Invalid prop '${r}'. IsValid() check failed`)),u}#C(){let t=i(this.constructor,ct.STATES);f(t,((e,s)=>{let r=t[s],n=i(this,s);if(r){let t=r.prop;n=t?p(this.#e[t]):i(this,s)}this.#e[s]=n}))}#x=U(this.propsReady,100);_setParentProps(t,e){if(this.#g){let s=i(this.constructor,ct.PROPS);f(t,((t,e)=>{let r=H(e),n=s[r];if(!n)return;let i=this.#e[r];t=this.#w(s,r,t),n.hasChanged&&!n.hasChanged.call(this,t,i)||(this.#e[r]=t,this._notify(i,[r]))})),M(this.#a,t),M(this.#o,e),this.#x(this.#a)}}_updateProps(t){let e=i(this.constructor,ct.PROPS);f(t,((t,s)=>{let r=H(s);e[r]&&(t=this.#w(e,r,t),At.__skipCheck=!0,y(this,r,t),At.__skipCheck=!1)})),M(this.#a,t),this.#x(this.#a)}_initProps(t,e){this.#a=h(this.#a||{},t),this.#o=h({},e)}_bindSlot(t,e,s){if(this.#p[e]||(this.#p[e]=t,Reflect.defineProperty(t,"__l_comp",{value:this})),t.addEventListener("slotchange",(s=>{this.#g&&this.#S(t,"default"===e?"":e)})),!l(s)){let t=this.#t[e];t||(t=this.#t[e]={}),t.props=s}}_bindSlotHook(t,e){this.#u[t]=e}#P=new Set;_updateSlot(t,e,s){let r=this.#p[t],n=this.#u[t];if(!n&&!r)return;let i=this.#t[t];if(e&&(i.props||(i.props={}),i.props[e]=s),n)this.#P.add(t);else{let t=r.assignedElements({flatten:!0});for(let r=0;r<t.length;r++){t[r].setAttribute(e,s+"")}}}#_(){const t=A(this.childNodes,(t=>t.nodeType===Node.COMMENT_NODE?[]:t instanceof HTMLSlotElement?t.assignedNodes({flatten:!0}):t));let e=z(t,(t=>t.nodeType===Node.TEXT_NODE?"default":t instanceof Element?t.getAttribute("slot")||"default":void 0));if(l(e))return void(l(this.#e["#slots"])||(this.#g?this.#s["#slots"]={}:this.#e["#slots"]={}));f(e,((t,e)=>{if(e){for(;t.length>0;){let e=t[0];if(!(e.nodeType===Node.TEXT_NODE&&n(e.textContent)||e instanceof HTMLSlotElement&&l(e.assignedNodes({flatten:!0}))))break;t.shift()}for(;t.length>0;){let e=E(t);if(!(e.nodeType===Node.TEXT_NODE&&n(e.textContent)||e instanceof HTMLSlotElement&&l(e.assignedNodes({flatten:!0}))))break;t.pop()}}}));let s={};f(e,((t,e)=>{l(t)||(s[e]=t)})),this.#g?this.#s["#slots"]=s:this.#e["#slots"]=s}#N(t){let e=this.#u[t];if(!e)return;let s=this.#t[t];if(!this.#e["#slots"][t])return;this.renderAsync(e,i(s,"props"));const r=this._asyncDirectives.get(e);let n=r?.buildView(e(i(s,"props"))),o=F(m(n),(t=>t.nodeType===Node.COMMENT_NODE));if(o){let e=this.#f[t];if(!l(e))for(let t=0;t<e.length;t++){const s=e[t];s.parentNode?.removeChild(s)}this.#f[t]=o,this.append(...o),this.#P.clear()}}_asyncDirectives=new WeakMap;renderAsync(t,...e){}#y(t,e,s){if(!this.isMounted)return;if(wt(this.constructor).has(t)){let e=H(t);if(B(s)){s=i(this.constructor,ct.PROPS)[e]._defaultValue}this._updateProps({[e]:s})}}_regDeps(t,e){let s=this.#i[t];s||(s=this.#i[t]=new Set),s.add(e);let r=t.split("-");if(r.pop(),r.length<1)return;let n=r.join("-");s=this.#i[n],s||(s=this.#i[n]=new Set),s.add(e)}emit(t,e={},s){s&&s.event&&(e.event=s.event),e.target=this,this.dispatchEvent(new CustomEvent(t,{bubbles:i(s,"bubbles",!1),composed:i(s,"composed",!1),cancelable:!0,detail:e}))}on(t,e){this.#T[t]||(this.#T[t]=[]);let s=e.bind(this);this.#T[t].push(s),this.addEventListener(t,s)}nextTick(t){Vt.pushNext(t)}forceUpdate(){f(this.#s,((t,e)=>{this.#r[e]={value:void 0,chain:void 0}})),this.#b()}}var Ut,zt,Ft;document.head.appendChild(Bt.__l_globalRule),function(t){t.NONE="NONE",t.REMOVE="REMOVE",t.REPLACE="REPLACE",t.UPDATE="UPDATE",t.APPEND="APPEND"}(Ut||(Ut={}));class Kt{key;varIndex;value;isText=!1;isTmpl=!1;isDirective=!1;node;textNode;isComponent=!1;attrName;attrTmpl;isProp=!1;isToggleProp=!1;isEvent;constructor(t,e,s,r){this.varIndex=t,this.node=e,s&&(this.attrName=s),r&&(this.attrTmpl=r)}}!function(t){t.ATTR="attr",t.PROP="prop",t.TEXT="text",t.CLASS="class",t.STYLE="style",t.SLOT="slot",t.TAG="tag"}(zt||(zt={}));class Qt{startNode;endNode;type;attrName;varIndex;expressionChain;nodes;constructor(t,e,s){this.startNode=t,this.attrName=e,this.type=s}setVarIndex(t){this.varIndex=t}getNodes(){let t=this.startNode.nextSibling;if(!this.endNode)return[t];let e=[];for(;t&&t!==this.endNode;)e.push(t),t=t?.nextSibling;return e}}!function(t){t.AFTER_BEGIN="afterbegin"}(Ft||(Ft={}));class Xt{diClass;args;di;varPath;point;slotComponent;varChain;constructor(t,...e){this.diClass=t,this.args=e,this.varChain=At.popDirectiveQ(),this.di=new this.diClass,this.di.renderParams=this.varChain}checkScope(t){let e=i(this.diClass,"scopes");l(e)||x(e.join(","),t)||ut(`Directive '${this.diClass.name}' is out of scopes, expect '${e.join(",")}' bug got '${t}'`)}render(t){let e=this.di;return e.renderComponent||(e.renderComponent=t),this.di=e,e._renderArgs=this.args,this.di.render(...this.args)}update(t,e,s){let r=this.di.update(t,e,s);if(r===Ut.NONE)return;let n=t.getNodes();if(r===Ut.REMOVE)for(let t=0;t<n.length;t++){const e=n[t];e.parentNode?.removeChild(e)}else if(r===Ut.REPLACE){let s=[];for(let t=0;t<n.length;t++){const e=n[t];e.parentNode?.removeChild(e)}let r=this.di.render(...e),i=this.di.buildView(r);s=m(i);let o=document.createDocumentFragment();o.append(...s),t.endNode.parentNode.insertBefore(o,t.endNode)}else if(r===Ut.UPDATE){let s,r={},i=[],o=[],a=this.di.render(...e);if(a||(a=new ze([],[])),l(n)){let e=this.di.buildView(a);return void t.startNode.after(...e)}let c={};a instanceof ze&&a.vars.forEach((t=>{if(t instanceof ze){const e=t.getKey();c[e]=t,r[e]=!0,o.push(e)}})),n=L(K(n),(t=>t.nodeType===Node.ELEMENT_NODE)),s=L(K(m(s)),(t=>t.nodeType===Node.ELEMENT_NODE));let d={},u="",h={};for(let t=0;t<n.length;t++){let e=n[t],s=e.getAttribute("key");if(s){if(d[s]){u=s;break}d[s]=e,i.push(s),h[s]=!0}}if(u)return void ut(`${H(this.diClass.name)} - duplicate key '${u}'`);let p=r;const g=t.startNode.parentNode;let b=[],_=[];if(f(h,((t,e)=>{p[e]||(_.push(e),delete h[e],Q(i,(t=>t===e)))})),!l(o)){let e="",s=-1,r=[],n=new Map;for(let a=0;a<o.length;a++){const l=o[a];let c=i.findIndex((t=>t===l));if(c>-1&&c!==a){if(s<0||s-c==1){let t=E(r);r.push({nodeId:l,targetId:0===a?Ft.AFTER_BEGIN:t?t.nodeId:o[a-1]})}else n.set(r.length,{group:r,targetId:""}),r=[],r.push({nodeId:l,targetId:i[c]});s=c}else if(c<0){let s=e?d[e]||t.endNode:t.startNode;b.push({prevNode:s,newkey:l})}e=l}l(n)&&r.length>0&&n.set(r.length,{group:r,targetId:""});let a=m(n.keys()),c=a.sort(((t,e)=>t-e));if(a.length>0&&a.length<2){let{group:e}=n.get(c[0]);C(e).forEach((({targetId:e,nodeId:s})=>{let r,n=d[s];e===Ft.AFTER_BEGIN?(r=t.startNode,r.after(n)):(r=d[e],r.after(n))}))}}b.length>0&&this.#k(b,c,o),b.forEach((e=>{let s=e.newkey,r=this.newNodeMap[s],n=e.prevNode;n===t.endNode?n.before(r):(t.startNode,n.after(r))})),_.forEach((t=>{let e=d[t];e&&e.parentNode&&g.removeChild(e)})),this.di.__updatePoints.forEach((t=>{t.key||(t.key=t.value.tmpl.getKey());const e=o.findIndex((e=>e==t.key));t.varIndex=e})),this.di.updateView(a)}}getDirective(){return this.di}newNodeMap={};#k(t,e,s){const r=[],n=[];t.forEach((t=>{let s=t.newkey;r.push(""),n.push(e[s])})),r.push("");let i=new ze(r,n),o=this.di.__updatePoints,a=this.di.buildView(i),l=new Map;this.di.__updatePoints.forEach(((t,e)=>{const s=t.value.tmpl.getKey();t.key=s,l.set(s,!0)})),o.forEach(((t,e)=>{const s=t.key??t.value.tmpl.getKey();l.get(s)||this.di.__updatePoints.push(t)})),a.forEach((t=>{t instanceof HTMLElement&&(this.newNodeMap[t.getAttribute("key")]=t)}))}}function Gt(t){return(...e)=>{let s=null;return e.forEach(((t,r)=>{if(_(t)){let n=t;e[r]=function(...t){let e=s.di;At.startRender(e);let r=n.call(e.renderComponent,...t);return At.endRender(e.renderComponent),r}}})),s=new Xt(t,...e),s}}const qt=["resize","outside","mutate"],Yt=new WeakMap,Zt=[],Jt=[],te=[],ee=new ResizeObserver((t=>{for(const e of t){const t=Array.isArray(e.contentBoxSize)?e.contentBoxSize[0]:e.contentBoxSize,s=Array.isArray(e.borderBoxSize)?e.borderBoxSize[0]:e.borderBoxSize;let r=Yt.get(e.target);if(r){r(new CustomEvent("resize",{bubbles:!1,cancelable:!1,detail:{borderBox:{w:s.inlineSize,h:s.blockSize},contentBox:{w:t.inlineSize,h:t.blockSize}}}),e.target)}}}));var se;!function(t){t.Child="child",t.Tree="tree",t.Attr="attr",t.Char="char"}(se||(se={}));const re=new WeakMap,ne=new MutationObserver((t=>{for(let e=0;e<t.length;e++){const s=t[e];let r=re.get(s.target);if(!r)return;let n={target:s.target},i=null;switch(s.type){case"subtree":n.type=se.Tree,i=r[se.Tree];break;case"childList":n.type=se.Child,n.addedNodes=s.addedNodes,n.removedNodes=s.removedNodes,i=r[se.Child];break;case"attributes":n.type=se.Attr,n.attributeName=s.attributeName,n.oldValue=s.oldValue,i=r[se.Attr];break;case"characterData":n.type=se.Char,n.oldValue=s.oldValue,i=r[se.Char]}if(i){i(new CustomEvent("mutate",{bubbles:!1,cancelable:!1,detail:n}))}}}));function ie(t,e,s,r){if("resize"===t)!function(t,e){Yt.has(t)||(Yt.set(t,e),ee.observe(t))}(e,s);else if("outside"===t)switch(r[0]){case"mousedown":!function(t,e){Zt.push([t,e])}(e,s);break;case"dblclick":!function(t,e){te.push([t,e])}(e,s);break;default:!function(t,e){Jt.push([t,e])}(e,s)}else"mutate"===t&&function(t,e,s){let r=X(s,"child"),n=X(s,"attr"),i=X(s,"char"),o=X(s,"tree"),a=re.get(t);a||(a={},re.set(t,a),r&&(a[se.Child]=e),n&&(a[se.Attr]=e),i&&(a[se.Char]=e),o&&(a[se.Tree]=e),ne.observe(t,{childList:r,attributes:n,characterData:i,subtree:o}))}(e,s,r)}document.addEventListener("mousedown",(t=>{let e=i(t.composedPath(),0,t.target);Zt.forEach((([s,r])=>{if(!s.contains(e)&&!s.contains(R(e,(t=>t instanceof ShadowRoot),"parentNode")?.host)){r(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:s,event:t}}),s)}}))}),!1),document.addEventListener("click",(t=>{let e=i(t.composedPath(),0,t.target);Jt.forEach((([s,r])=>{if(!s.contains(e)&&!s.contains(R(e,(t=>t instanceof ShadowRoot),"parentNode")?.host)){r(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:s,event:t}}),s)}}))}),!1),document.addEventListener("dblclick",(t=>{let e=i(t.composedPath(),0,t.target);te.forEach((([s,r])=>{if(!s.contains(e)&&!s.contains(R(e,(t=>t instanceof ShadowRoot),"parentNode")?.host)){r(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:s,event:t}}),s)}}))}),!1);const oe=/,|^(debounce:.+)|(debounce$)/,ae=/,|^(throttle:.+)|(throttle$)/,le="self",ce="stop",de="prevent",ue="once",he="left",pe="right",fe="middle",ge="ctrl",me="alt",Ee="shift",be="meta",_e={esc:"escape"},ve=":";function Ce(t,e,s,r){let n,i=t.split("."),o=i.shift(),a=i.includes(ue),l=e;if(n=G(i,(t=>oe.test(t)))){let t=n.split(ve);l=U(l,parseInt(t[1])||100)}if(n=G(i,(t=>ae.test(t)))){let t=n.split(ve);l=q(l,parseInt(t[1])||100)}if(a&&(l=D(l)),function(t){return qt.includes(t)}(o))return ie(o,s,l,i),l;let c=t=>{if(i.includes(de)&&t.preventDefault(),i.includes(ce)&&t.stopPropagation(),!i.includes(le)||t.target===t.currentTarget){if(t instanceof MouseEvent){if(i.includes(he)&&0!=t.button)return;if(i.includes(pe)&&2!=t.button)return;if(i.includes(fe)&&1!=t.button)return}else if(t instanceof KeyboardEvent){if(Q(i,(t=>t==ge))[0]&&!t.ctrlKey)return;if(Q(i,(t=>t==me))[0]&&!t.altKey)return;if(Q(i,(t=>t==Ee))[0]&&!t.shiftKey)return;if(Q(i,(t=>t==be))[0]&&!t.metaKey)return;if(!Y(i,(t=>_e[t]||t)).includes(t.key.toLowerCase()))return}l(t)}};s.addEventListener(o,c);let d=r.__events[o];return d||(d=r.__events[o]=[]),d.push([s,c]),c}const Ne="@",Se=".",ye="?",Te="*",Pe=":",we="ref",Ae=/[.?-a-z]+\s*=\s*(['"])\s*([^='"]*<\!--c_ui-pl_df-->){2,}.*?\1/ims,xe=/<\s*[a-z0-9-]+([^>]*<\!--c_ui-pl_df-->)*[^>]*?(?<!-)>/gims,ke="slot-props";function Me(t,e){let s="",r=d(e.vars),n=e.strings.length-1,o=e.vars.length-1;for(let r=0;r<=n;r++){const n=e.strings[r];let a=i(e.vars,r,"");if(a&&a.di){let e=a.render(t);if(e instanceof ze){let[s,r]=Me(t,e);Reflect.defineProperty(a,"_renderVars",{value:r}),a=Oe+s+Re}else a=e??Ve}else if(a instanceof ze){let[e,s]=Me(t,a);Reflect.defineProperty(a,"_renderVars",{value:s}),a=De+e+Le}else a=r>o?"":Ve;s+=n+a}let a=s.match(Ae);if(a){return ut(`Parse error: attribute value can be set only one interpolation —— \n ${Z(a[0],Ve,"${...}")}`),["",r]}let l=0;return s=s.replace(xe,((t,e)=>Z(t,Ve,(()=>Ve.replace("--\x3e","")+l++)))),s=s.replace(Be,"$1><").trim(),[s,r]}const Oe="\x3c!--c_ui-pl_di-start--\x3e",Re="\x3c!--c_ui-pl_di-end--\x3e",De="\x3c!--c_ui-pl_tmpl-start--\x3e",Le="\x3c!--c_ui-pl_tmpl-end--\x3e",Ve="\x3c!--c_ui-pl_df--\x3e",He="\x3c!--c_ui-pl_df",Ie=/<!--c_ui-pl_df\d*(-->)?/;function $e(t,e,s,n,o){const a=document.createElement("div");a.innerHTML=e;const l=document.createNodeIterator(a,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT);let d,u,h=0,p=null,f=[],v=[],C=[],N=[t],S=[],y=[];for(;d=l.nextNode();)if(d instanceof HTMLElement||d instanceof SVGElement){d instanceof Bt?p=d:p?.contains(d)||(p=null);let e={},r=m(d.attributes);for(let i=0;i<r.length;i++){const o=r[i];let{name:a,value:l}=o;if(a===ke){let t=d.getAttribute("name")||"default";if(p){let e=p._slotsPropMap[t];e||(e=p._slotsPropMap[t]=[]),e.push(d)}}if(b(a,He)){let e=s[h];if(e instanceof Xt){e.checkScope(zt.TAG);let s=new Qt(d,a.substring(1),zt.TAG);e.point=s,e.di.slotComponent=p,e.di.renderComponent=n;let r=new Kt(h,d);r.isDirective=!0,r.value=e,r.isComponent=!!p,t.push(r),h++,e.di.created(s,...e.args)}d.removeAttribute(a)}else if(a[0]!==Ne)if(a!==we)if(a[0]!==Se||Ie.test(l)){if(Ie.test(l)){let r=s[h],i=new Kt(h,d,a.replace(/\.|\?|@/,""),l);if(i.isComponent=!!p,a[0]===Se||a[0]===ye||a[0]===Te){if(r instanceof Xt){r.checkScope(zt.PROP);let t=new Qt(d,a.substring(1),zt.PROP);r.point=t,r.slotComponent=p,i.value=r,i.isDirective=!0,r&&r.di.created(r.point,...r.args)}else if(a[0]===ye)i.isToggleProp=!0,i.value=!!r,i.value&&d.setAttribute(a.substring(1),"");else if(a[0]===Te){i.value=r;let t=a.substring(1);const[e,s]=t.split(Pe);let n=e;switch(s){case"camel":n=H(n);break;case"kebab":n=g(n);break;case"snake":n=J(n)}i.attrName=n,d.setAttribute(n,r)}else if(d instanceof Bt||"SLOT"===d.tagName){let t=H(a.substring(1));t in d||"SLOT"===d.tagName||ht(d.tagName,`Prop '${a}' is not defined in ${d.tagName}`),i.value=r,i.isProp=!0,e[t]=r}else ht(d.tagName,`Prop '${a}' can only be set on a CompElem or a slot`);d.removeAttribute(a),r=""}else{let t;if(i.value=r,r instanceof Xt){let e=zt.ATTR;"class"===a?e=zt.CLASS:"style"===a&&(e=zt.STYLE),r.checkScope(e),i.isDirective=!0;let s=new Qt(d,a,e);r.point=s,r.di.slotComponent=p,r.di.renderComponent=n,t=r,r=""}l=P(l,Ie,r),o.value=l,t&&t.di.created(t.point,...t.args)}t.push(i),h++}}else ht(d.tagName,`Prop '${a}' must be an interpolation`);else{if(Ie.test(l)){let t=s[h];if(!c(t,"current")){ht(d.tagName,"Ref must be a RefObject");continue}h++,t.current=d}d.removeAttribute(a)}else{let e=t=>{};if(Ie.test(l)){let r=s[h];if(!_(r)){ht(d.tagName,`Event '${a}' must be a function`);continue}e=r.bind(n);let i=new Kt(h,d,a.replace(/\.|\?|@/,""),l);i.isComponent=!!p,i.isEvent=!0,t.push(i),h++}Ce(a.substring(1),e,d,n),d.removeAttribute(a)}}d instanceof Bt?d._initProps(e):d instanceof HTMLSlotElement&&n._bindSlot(d,d.name||"default",e)}else{let e=d,a=`\x3c!--${e.nodeValue}--\x3e`;if(a===Oe){u&&f.push(u),u=e;let r=s[h],i=new Kt(h,d);i.isComponent=!!p,i.isDirective=!0,i.value=r;let o=p?zt.SLOT:zt.TEXT,a=new Qt(u,"",o);r.point=a,r.di.slotComponent=p,r.di.renderComponent=n,v.push(r),t.push(i),C.push(i),t=[],N.push(t),h++,y.push(h),S.push(s),s=r._renderVars,h=0;continue}if(a===Re){C.pop().textNode=e;let r=v.pop();r.point.endNode=e,r.di.created(r.point,...r.args),u=f.pop(),r.di.__updatePoints=t,N.pop(),t=E(N),s=S.pop(),h=y.pop()}else{if(a===De){u&&f.push(u),u=e;let r=s[h],a=new Kt(h,d);a.isComponent=!!p,a.isTmpl=!0;let l=E(v);(l&&"ForEach"===i(l,"diClass.name")||"ForEach"==o.constructor.name)&&(a.key=r.getKey()),r=a.value=new It(r);let c=p?zt.SLOT:zt.TEXT,g=new Qt(u,"",c);r.point=g,r.slotComponent=p,r.renderComponent=n,v.push(r),t.push(a),C.push(a),t=[],N.push(t),h++,y.push(h),S.push(s),s=r._renderVars,h=0;continue}if(a===Le){C.pop().textNode=e;let r=v.pop();r.point.endNode=e,u=f.pop(),r.__updatePoints=t,N.pop(),t=E(N),s=S.pop(),h=y.pop()}}if(a!==Ve)continue;let l=new Kt(h,d);t.push(l),l.isComponent=!!p,l.isText=!0;let c,g=s[h];if(c=document.createComment(`compelem-ui-${h}-child-start`),e.parentNode.insertBefore(c,e),e.nodeValue=`compelem-ui-${h}-child-end`,l.textNode=c,g instanceof Xt){l.isDirective=!0,l.value=g;let t=p?zt.SLOT:zt.TEXT,s=new Qt(c,"",t);s.endNode=e,g.point=s,g.di.slotComponent=p,g.di.renderComponent=n,g.di.created(s,...g.args),g=""}else if(g instanceof ze){l.isTmpl=!0,l.value=g;let[e,s]=Me(n,g);g=$e(t,e,s,n,o)}else l.value=g;if(h++,r(g))continue;if(g instanceof NodeList){let t=document.createDocumentFragment();t.append(...g),e.parentNode.insertBefore(t,e)}else if(g instanceof Element)e.parentNode.insertBefore(g,e);else if($(g)){let t=document.createTextNode(g);e.parentNode.insertBefore(t,e)}}return a.childNodes}const We={insertBefore:function(t,e){if(!t.parentNode)return;let s=document.createDocumentFragment();s.append(...e),t.parentNode.insertBefore(s,t)},remove:function(t,e){if(t===e)return void t?.parentNode?.removeChild(t);let s=t.nextSibling;for(;s&&s!==e;)s?.parentNode?.removeChild(s),s=t.nextSibling}};function je(t,...e){return new ze(s(t)?[t]:t,e)}const Be=/([a-z0-9"'])\s*>\s*</gim;function Ue(t){return{current:t}}class ze{strings;vars;constructor(t,e){this.strings=d(t),this.vars=e}getKey(){let t=this.vars,e="";return f(this.strings,((s,r)=>{if(at.test(s))return e=tt(t[r]),!1})),e}getKeys(){let t=this.vars,e=[];for(let s=0;s<this.strings.length;s++){const r=this.strings[s];if(at.test(r)){let r=tt(t[s]);e.push(r)}}return l(e)&&t.forEach((t=>{if(t instanceof ze){let s=t.getKey();e.push(s)}})),e}append(t){let e=E(this.strings);return t.strings.forEach(((t,s)=>{0!=s?this.strings.push(t):this.strings[this.strings.length-1]=e+t})),this.vars=d(this.vars,t.vars),this}insert(t,e){let s=e.strings.shift();return this.strings[t]+=s,this.strings.splice(t+1,0,...e.strings),this.vars.splice(t,0,...e.vars),this}getHTML(t){let[e,s]=Me(t,this),r=$e([],e,s,t,t);return et(r,((t,e)=>t+e.outerHTML),"")}}function Fe(t,e,s){s.get||ut(`Computed '${e}' must be a getter`),c(t.constructor,ct.COMPUTED)||(t.constructor[ct.COMPUTED]=l(t.constructor[ct.COMPUTED])?{}:p(t.constructor[ct.COMPUTED])),t.constructor[ct.COMPUTED][e]=s.get}function Ke(t){return(e,s,r)=>{r.value=U(e[s],t)}}function Qe(t,e){return(s,r,n)=>{c(s.constructor,ct.EVENTS)||(s.constructor[ct.EVENTS]=l(s.constructor[ct.EVENTS])?[]:p(s.constructor[ct.EVENTS])),s.constructor[ct.EVENTS].push({name:t,options:e,fn:s[r]})}}var Xe;!function(t){t.ONCE="once",t.UPDATABLE="updatable"}(Xe||(Xe={}));class Ge extends mt{static get priority(){return Number.MAX_VALUE}created(t,e,s,...r){}mounted(t,e,...s){}get targets(){return[dt.FIELD]}selector;cache;result;constructor(t,e){super(),this.selector=t,this.cache=e}static getKey(t){return t}getter(t){this.result=t.shadowRoot?.querySelector(this.selector)}beforeMount(t,e,s,r,...n){const i=this;Reflect.defineProperty(t,r,{get:()=>(i.result&&i.cache||i.getter(t),i.result)})}updated(t,e){this.cache===Xe.UPDATABLE&&this.getter(t)}}const qe=Nt(Ge),Ye=Nt(class extends Ge{getter(t){this.result=t.shadowRoot?.querySelectorAll(this.selector)}});function Ze(t){if(1===arguments.length)return(e,s)=>{Je(e,s,t)};Je(arguments[0],arguments[1],{prop:""})}function Je(t,e,s){if(!c(t.constructor,ct.STATES)){const e={};let s=t.constructor;for(;(s=ft(s))!==Bt;)h(e,s[ct.STATES]?p(s[ct.STATES]):{});Reflect.defineProperty(t.constructor,ct.STATES,{configurable:!1,enumerable:!1,value:e})}s.shallow=s.shallow||!1,t.constructor[ct.STATES][e]=s}function ts(t,e,s){Je(t.prototype,e,s||{prop:""})}function es(t){return e=>{if(e){if(e.prototype.hasOwnProperty("attributeChangedCallback")){let t=e.prototype.attributeChangedCallback;e.prototype.attributeChangedCallback=function(e,s,r){Bt.prototype.attributeChangedCallback.call(this,e,s,r),t.call(this,e,s,r)}}if(e.prototype.hasOwnProperty("connectedCallback")){let t=e.prototype.connectedCallback;e.prototype.connectedCallback=function(){Bt.prototype.connectedCallback.call(this),t.call(this)}}if(e.prototype.hasOwnProperty("disconnectedCallback")){let t=e.prototype.disconnectedCallback;e.prototype.disconnectedCallback=function(){Bt.prototype.disconnectedCallback.call(this),t.call(this)}}customElements.define(t,e)}}}function ss(t,e){return(s,r)=>{c(s.constructor,ct.WATCH)||(s.constructor[ct.WATCH]=l(s.constructor[ct.WATCH])?{}:p(s.constructor[ct.WATCH]));(v(t)?t:[t]).forEach((t=>{let n=t.replaceAll(".","-"),i=s.constructor[ct.WATCH][n];v(i)||(i=s.constructor[ct.WATCH][n]=[]),i.push({source:t,options:e,handler:s[r]})}))}}class rs extends(Ht(Object)){_renderArgs;static get scopes(){return[]}renderParams}const ns=["key"];const is=Gt(class extends rs{created(t,e){let s=t.startNode;if(s instanceof Bt){let t={},r={};f(e,((e,n)=>{ns.includes(n)||(n in s?t[n]=e:r[n]=e+"")})),s._initProps(t,r)}else f(e,((t,e)=>{s.setAttribute(e,t)}))}update(t,e,s){return Ut.NONE}static get scopes(){return[zt.TAG]}render(t){}});const os=Gt(class extends rs{created(t,e){let r=[];v(e)?r=K(e):o(e)?r=A(e,((t,e)=>t?e:[])):s(e)&&(r=e.split(" "));let n=t.startNode;f(this.lastCls,(t=>{n.classList.remove(t)})),f(r,(t=>{n.classList.add(t)})),this.lastCls=d(r)}update(t,e,s){return this.created(t,e[0]),Ut.NONE}static get scopes(){return[zt.CLASS]}lastCls;render(t){}});const as=Gt(class extends rs{created(t,...e){}update(t,e,s){if(l(t.getNodes())&&(!e||l(e[0])))return Ut.NONE;if(st(this.lastAry,e[0])&&this.lastAry.length===e[0].length)return Ut.NONE;if(!l(this.renderParams)){let t=E(this.renderParams);v(t)||(t=[t]),this.renderParams=t}return this.lastAry=rt(e[0]),Ut.UPDATE}constructor(t){super(),l(this.renderParams)||(this.renderParams=m(E(this.renderParams)))}static get scopes(){return[zt.TEXT,zt.SLOT]}lastAry;lastRenderTmpl;render(t,e){let s=Y(t,((t,s)=>e(t,s)));if(s.length<1)return this.lastRenderTmpl=new ze([],[]),this.lastRenderTmpl;let r=[],n=[];const i=[],o=[];for(let t=0;t<s.length;t++){const e=s[t];let a=E(n),l=e.vars,c=!0,d=e.strings;for(let t=0;t<d.length;t++){const e=d[t];if(at.test(e)){let e=l[t]+"";if(r.includes(e))return void ut(`forEach - duplicate key '${e}'`);r.push(e),c=!1}0==t&&a?n[n.length-1]=a+e:n.push(e)}if(c)return void ut("forEach - missing 'key' prop");let u=E(i);u&&d.length>0&&(i[i.length-1]=$(u)+d.shift()),i.push(""),o.push(e)}return this.lastAry=rt(t),i.push(""),this.lastRenderTmpl=new ze(i,o),this.lastRenderTmpl}});const ls=Gt(class extends rs{created(t,...e){}ifNodes;elseNodes;static get scopes(){return[zt.TEXT,zt.SLOT]}update(t,e,s){return!!e[0]==!!s[0]?Ut.NONE:(e[0],Ut.REPLACE)}render(t,e,s){return t?e(t):s(t)}});const cs=Gt(class extends rs{created(t,...e){}static get scopes(){return[zt.TEXT,zt.SLOT]}update(t,e,s){return e[0]===s[0]?Ut.NONE:e[0]?Ut.REPLACE:Ut.REMOVE}render(t,e){return t?e():je``}});var ds;!function(t){t.CHANGE="change",t.INPUT="input"}(ds||(ds={}));const us=Gt(class extends rs{created(t,e,s="value"){const r=t.startNode;if("binded"===i(r,"_model"))return;let n=E(this.renderParams);if(this.updateProp=s,this.modelPath=n,o(e)||$(e)||(e=""),r instanceof Bt)r._initProps({[this.updateProp]:e}),r.addEventListener("update:"+s,(t=>{y(this.renderComponent,this.modelPath,t.detail.value)})),y(r,"_model","binded");else if(r instanceof HTMLTextAreaElement)r.setAttribute(this.updateProp,e+""),r.addEventListener("input",(t=>{let e=t.target;y(this.renderComponent,this.modelPath,e.value)})),y(r,"_model","binded");else if(r instanceof HTMLInputElement){let t="",n="";switch(r.type){case"checkbox":case"radio":t="checked",n="change";break;default:t="value",n="input"}r.setAttribute(s??t,e+""),r.addEventListener(n,(t=>{let e=t.target;y(this.renderComponent,this.modelPath,e.value)})),y(r,"_model","binded")}else r instanceof HTMLSelectElement&&(r.setAttribute(this.updateProp,e+""),r.addEventListener("change",(t=>{let e=t.target;y(this.renderComponent,this.modelPath,e.value)})),y(r,"_model","binded"))}update(t,e,s){if(this.modelPath||(this.modelPath=E(this.renderParams)),!T(e,s)){const s=t.startNode;if(s instanceof Bt)s._updateProps({[this.updateProp]:e[0]});else if(s instanceof HTMLTextAreaElement||s instanceof HTMLSelectElement)s.setAttribute(this.updateProp,e[0]+"");else if(s instanceof HTMLInputElement)switch(s.type){case"checkbox":case"radio":e[0]?s.setAttribute("checked",""):s.removeAttribute("checked");break;default:s.setAttribute(this.updateProp,e[0]+"")}}return Ut.NONE}static get scopes(){return[zt.TAG]}modelPath;render(t,e="value"){}});const hs=Gt(class extends rs{created(t,e,s){let n=t.startNode;r(this.display)&&(this.display=n.style.display);let i=s;this.renderComponent.nextTick((()=>{n.style.display=e?this.display:"none",i&&i(n,e)}))}update(t,e,s){return this.created(t,e[0],e[1]),Ut.NONE}display=void 0;static get scopes(){return[zt.TAG]}constructor(t){super(),this.point=t}render(t,e){}});const ps=Gt(class extends rs{created(t,e,s){e=e.bind(this.renderComponent),this.slotComponent._bindSlotHook(s||"default",e)}update(t,e,s){return Ut.NONE}static get scopes(){return[zt.SLOT]}render(t,e){}});class fs{static getCssText(t,e=!1){return s(t)?t:N(Y(t,((t,s)=>s.startsWith("--")?s+":"+t+(e?" !important":""):g(s)+":"+t+(e?" !important":""))),";")}static setStyle(t,e){if(s(t)&&!$(t))return{};let r=fs.getCssText(t),n={};return f(r.split(";"),(t=>{let s=t.split(":"),r=$(s[0]),i=$(s[1]);n[r]=e.style.getPropertyValue(r),e.style.setProperty(r,i)})),n}}const gs=Gt(class extends rs{created(t,e){fs.setStyle(e,t.startNode)}update(t,e,s){return this.created(t,e[0]),Ut.NONE}constructor(t){super(),this.point=t}static get scopes(){return[zt.STYLE]}render(t){}});const ms=Gt(class extends rs{created(t,e){this.modelPath||(this.modelPath=E(this.renderParams));const s=t.startNode;let r=t.attrName;s._initProps({[r]:e}),s.addEventListener("update:"+r,(t=>{y(this.renderComponent,this.modelPath,t.detail.value)}))}update(t,e,s){if(!T(e,s)){const s=t.startNode;let r=t.attrName;s._updateProps({[r]:e[0]})}return Ut.NONE}static get scopes(){return[zt.PROP]}modelPath;constructor(t){super()}render(t){}});const Es=Gt(class extends rs{created(t,...e){}static get scopes(){return[zt.TEXT,zt.SLOT]}update(t,e,s){return T(e,s)?Ut.NONE:Ut.REPLACE}render(t,e){let s=()=>je``,r=[],n=[];f(e,((t,e)=>{if(_(t))r.push(e),n.push(t);else{let e=t[0],s=t[1];r.push(e),n.push(s)}"default"===e&&(s=t)}));let i=nt(r,(e=>_(e)?e(t):e==t));return it(n[i]??s)}});export{Bt as CompElem,fs as CssHelper,mt as Decorator,dt as DecoratorType,vt as DecoratorWrapper,rs as Directive,Ut as DirectiveUpdateTag,Xt as DirectiveWrapper,Qt as EnterPoint,zt as EnterPointType,Et as GetKeyFnName,ds as ModelTriggerType,Xe as QueryCache,ze as Template,Kt as UpdatePoint,_t as _DecoratorMap,bt as _DecoratorsKey,wt as _getObservedAttrs,is as bind,Me as buildHTML,os as classes,Fe as computed,Ue as createRef,Ke as debounced,Nt as decorator,Gt as directive,Qe as event,as as forEach,je as html,ls as ifElse,cs as ifTrue,ts as makeState,us as model,yt as prop,qe as query,Ye as queryAll,hs as show,ps as slot,Ze as state,gs as styles,ms as sync,es as tag,ss as watch,Es as when};
|
|
7
|
+
import{toPath as t,some as e,isString as s,isUndefined as r,isBlank as n,get as i,isObject as o,isDefined as a,isEmpty as l,has as c,concat as d,defaults as u,merge as h,cloneDeep as p,each as f,kebabCase as g,toArray as m,last as E,startsWith as b,isFunction as _,isArray as v,initial as C,join as N,split as y,set as S,isEqual as T,replace as P,isPlainObject as w,flatMap as A,test as x,size as M,assign as k,first as O,closest as R,once as D,filter as L,bind as V,camelCase as I,isNil as H,trim as W,isBoolean as $,parseJSON as j,isNull as B,debounce as U,groupBy as z,reject as G,compact as F,remove as K,includes as X,find as Q,throttle as q,map as Y,replaceAll as Z,snakeCase as J,toString as tt,reduce as et,isMatch as st,clone as rt,findIndex as nt,call as it}from"myfx";const ot=new WeakMap,at=/\s+\.?key\s*=/;var lt,ct,dt;function ut(t){console.error("[CompElem]",t)}function ht(t,e){console.error(`[CompElem <${t}>]`,e)}function pt(e){return t(e).join("-")}function ft(t){return Object.getPrototypeOf(t)}function gt(t){let e=t;return s(t)&&/(?:^true$)|(?:^false$)/.test(e)?e="true"===e:(r(e)||n(e))&&(e=!0),e}!function(t){t[t.CSS=1]="CSS",t[t.COMPUTED=2]="COMPUTED"}(lt||(lt={})),function(t){t.PROPS="__deco_props",t.STATES="__deco_states",t.COMPUTED="__deco_computed",t.WATCH="__deco_watch",t.EVENTS="__deco_events"}(ct||(ct={})),function(t){t.CLASS="class",t.FIELD="field",t.METHOD="method"}(dt||(dt={}));class mt{static get priority(){return 0}}const Et="getKey",bt="__decorators",_t=new WeakMap;class vt{args;metadata;decoratorClass;instanceMap;key;priority=0;constructor(t,e,s){this.args=t,this.metadata=e,this.decoratorClass=s,this.priority=i(s,"priority",0),this.instanceMap=new WeakMap}create(t){let e,s=new this.decoratorClass(...this.args),n=s.targets,c=this.metadata[2];o(c)&&a(i(c,"configurable"))?e=dt.METHOD:r(this.metadata[2])&&(e=dt.FIELD),!l(n)&&e&&n.includes(e)?(s.created(t,...this.metadata),this.instanceMap.set(t,s)):ut(`Decorator '${this.decoratorClass.name}' is out of targets, expect '${n.join(",")}' bug got '${e}'`)}beforeMount(t,e){this.instanceMap.get(t).beforeMount(t,e,...this.metadata)}mounted(t,e){this.instanceMap.get(t).mounted(t,e,...this.metadata)}updated(t,e){this.instanceMap.get(t).updated(t,e)}}const Ct=new WeakMap;function Nt(t){let e=(...e)=>(...s)=>{let r=s[0].constructor,n=i(r,bt);if(!c(r,bt)){let t=i(Object.getPrototypeOf(r),bt);n=t?d(t):[],Reflect.defineProperty(r,bt,{configurable:!1,enumerable:!1,value:n})}let o,a={},l=i(t,Et);if(l){let s=Ct.get(t);if(s||(s=new WeakMap,Ct.set(t,s)),a=s.get(r),a||(a={},s.set(r,a)),o=l(...e),a[o])return a[o]}let u=new vt(e,s,t);return a[o]=u,n?.push(u),u};return _t.set(e,!0),e}const yt=new WeakMap;function St(t){if(1===arguments.length)return(e,s,r)=>{t.required=t.required||!1,t.attribute=!1!==t.attribute,Tt(e,s,t,r)};let e=arguments[0],s=arguments[1],r=arguments[2];t={type:void 0,required:!1,attribute:!0},r&&"function"==typeof r.type&&(t=u(r,t),r=void 0),Tt(e,s,t,r)}function Tt(t,e,s,r){let n;if(/[a-z]/.test(e[0])||ut(`Prop '${e}' must be in CamelCase`),!c(t.constructor,ct.PROPS)){const e={};let s=t.constructor;for(;(s=ft(s))!==Bt;)h(e,s[ct.PROPS]?p(s[ct.PROPS]):{});Reflect.defineProperty(t.constructor,ct.PROPS,{configurable:!1,enumerable:!1,value:e}),n=new Set,f(e,((t,e)=>{if(t.attribute){let t=g(e);n?.add(t)}})),yt.set(t.constructor,n)}if(r&&(r.get&&(s.getter=r.get),r.set&&(s.setter=r.set)),s.attribute){n||(n=yt.get(t.constructor));let s=g(e);n?.add(s)}c(t.constructor,"observedAttributes")||(t.constructor.observedAttributes=[]),t.constructor.observedAttributes=m(n),s.shallow=s.shallow||!1,t.constructor[ct.PROPS][e]=s}const Pt=new Set;function wt(t){return yt.get(t)??Pt}const At={collectWatch(t,e,s){let r=Rt.get(t);r||(r={},Rt.set(t,r));let n=r[s];n||(n=r[s]=[]),n.push(e)},startCollect(t,e){this.__collectType=e,this.__collecting=t},setUpdater(t){this.__updater=t},endCollect(){this.__collecting=null},__directiveQ:[],setDirectiveQ(t){let e=E(this.__directiveQ);const s=t?t.join(","):"",r=e?e.join(","):"";e&&s===r||(e&&e.length<t.length&&b(s,r)?this.__directiveQ[this.__directiveQ.length-1]=t:this.__directiveQ.push(t))},popDirectiveQ(){let t=d(this.__directiveQ);return this.__directiveQ=[],t},startRender(t){this.__renderCollecting=!0,this.__renderContext=t},endRender(t){this.__renderCollection.forEach((e=>{t._regDeps(e,this.__renderContext)})),this.__renderCollection.clear(),this.__renderCollecting=!1,this.__renderContext=null},collect(t){this.__renderCollection.add(t)},clear(){this.__directiveQ=[]},__updater:null,__collecting:null,__collectType:-1,__renderCollection:new Set,__renderContext:null,__renderCollecting:!1,__skipCheck:!1},xt=new WeakMap,Mt=new WeakMap,kt=new WeakMap,Ot=new WeakMap,Rt=new WeakMap,Dt=new WeakSet;function Lt(t,e){if(!o(t))return t;const s=Dt.has(t)?t:new Proxy(t,{get(t,e,s){if(!e)return;const r=Reflect.get(t,e,s);if("string"!=typeof e&&"number"!=typeof e)return r;let n=e in t;if((At.__renderCollecting||At.__collecting)&&(n&&t.hasOwnProperty(e)||!n)){let t=Mt.get(s)??[],r=d(t,[e]),n=r.join("-");if(At.__renderCollecting)At.collect(pt(r)),At.setDirectiveQ(r);else if(At.__collecting){let t;switch(At.__collectType){case lt.COMPUTED:t=kt.get(At.__collecting),t||(t={},kt.set(At.__collecting,t));break;case lt.CSS:t=Ot.get(At.__collecting),t||(t={},Ot.set(At.__collecting,t))}let e=t[n];e||(e=t[n]=[]),e.push(At.__updater)}}return r},set(t,e,s,r){if(!e)return!1;let n=t[e];if(!o(n)&&n===s)return!0;if(Number.isNaN(s)&&Number.isNaN(n))return!0;let a=Mt.get(r)??[],c=d(a,[e]),u=xt.get(r).from,h=i(u.constructor,ct.PROPS),p=i(u.constructor,ct.STATES),f=i(h,[c[0],"hasChanged"])||i(p,[c[0],"hasChanged"]);if(f){if(!f.call(u,s,n))return!0}else if(n===s&&!ot.has(n))return!0;h&&h[e]&&t.__isData&&h[e].sync&&u.emit("update:"+e,{value:s});let g=xt.get(r)?.contextSet,m=s;!o(s)||_(s)||s instanceof Node||Object.isFrozen(s)||g.forEach((t=>{let s=xt.get(r)?.pathMap,n=s?.get(t);n&&(c=d(n,[e]),Mt.set(m,c),m=Lt(m,t),Dt.add(m),Mt.set(m,c))}));let E=Reflect.set(t,e,m),b=xt.get(r).pathMap;return g.forEach((t=>{let s=b.get(t);if(!s)return;t===u&&a.length>1&&s.length>1&&a[0]===s[0]&&(s=a),c=d(s,"length"==e&&v(r)?[]:[e]);let o=kt.get(t),h=Ot.get(t),p=Rt.get(t);if(o||h||p){let t=c.length;for(;t;){let e=c.slice(0,t).join("-");if(p){const s=p[e];t===c.length?s?.forEach((t=>{let e=t();e.ov=n,Vt.pushWatch(e)})):s?.forEach((t=>{let e=t();i(e,"deep")&&(e.ov=n,Vt.pushWatch(e))}))}if(o){let t=o[e];if(!l(t))for(let e=0;e<t.length;e++){const s=t[e];Vt.pushComputed(s)}}if(h){let t=h[e];if(!l(t))for(let e=0;e<t.length;e++){const s=t[e];Vt.pushCss(s)}}t--}}let f=t._notify(n,c);Vt.pushNext(f)})),E}});Dt.has(s)||Dt.add(s);let r=Mt.get(t)??[];if(Object.isExtensible(t)&&!xt.get(s)){let t=new Set;t.add(e);let n=new WeakMap;n.set(e,r),xt.set(s,{from:e,contextSet:t,pathMap:n})}else{xt.get(s).contextSet.add(e);let t=xt.get(s).pathMap,n=t.get(e),o=d(r);if(n&&n.join("")!==o.join("")){let t=i(e,C(n));v(t)||function(...t){console.warn("[CompElem]",...t)}(`The object is referenced by more than one @state '${o.join(".")},${n.join(".")}'`),n=o}else t.set(e,o)}let n=i(e.constructor,ct.PROPS),a=i(e.constructor,ct.STATES);for(let s in t){const l=t[s];let c=i(n,[s,"shallow"])||i(a,[s,"shallow"]);!o(l)||Dt.has(l)||_(l)||l instanceof Node||Object.isFrozen(l)||c||(Mt.set(l,d(r,[s])),t[s]=Lt(l,e),Dt.add(t[s]),Mt.set(t[s],d(r,[s])))}return s}class Vt{static watchSet=new Set;static computedSet=new Set;static cssSet=new Set;static nextSet=new Set;static nextPending=!1;static next;static flush(){Vt.nextPending=!1;let t=Array.from(Vt.watchSet);Vt.watchSet.clear();let e=Array.from(Vt.computedSet);Vt.computedSet.clear();let s=Array.from(Vt.cssSet);Vt.cssSet.clear();let r=Array.from(Vt.nextSet);Vt.nextSet.clear(),t.forEach((t=>t(i(t,"ov")))),e.forEach((t=>t())),s.forEach((t=>t())),r.forEach((t=>t()))}static pushWatch(t){Vt.watchSet.add(t)}static pushComputed(t){Vt.computedSet.add(t)}static pushCss(t){Vt.cssSet.add(t)}static pushNext(t){Vt.nextSet.add(t),Vt.nextPending||(Vt.nextPending=!0,Vt.next())}}function It(t){return class extends t{__updatePoints;renderComponent;buildView(t){let e=this instanceof Bt?this:this.renderComponent,[s,r]=ke(e,t),n=[],i=We(n,s,r,e,this);return this.__updatePoints=n,i}updateView(t){if(n(N(t.strings)))return;if(!this.__updatePoints)return;let{vars:e}=t,s=this instanceof Bt?this:this.renderComponent;for(let t=0;t<this.__updatePoints.length;t++){const r=this.__updatePoints[t];let n=r.varIndex;if(n<0)continue;let a=r.value,l=e,c=r.node,d=y(n,"-");for(let e=0;e<d.length;e++){const s=d[e];l=i(l,s),l&&l.vars&&t<d.length-1&&(l=l.vars)}if(!o(a)&&a===l)continue;let u=c;if(r.isDirective){if(!a.di)continue;l.di=a.di,l.di.renderParams=l.varChain,l.di._renderArgs=l.args,l.point=a.point,l.varPath=a.varPath,a.update(a.point,l.args,a.args)}else if(r.isToggleProp){if(!!l===a)continue;u.toggleAttribute(r.attrName,!!l),S(u,r.attrName,!!l)}else if(r.isProp){if(!o(l)&&l===a)continue;c instanceof Bt?c._updateProps({[r.attrName]:l}):c instanceof HTMLSlotElement&&s._updateSlot(c.getAttribute("name")||"default",r.attrName,l)}else if(r.attrName&&!r.isEvent){if(!T(a,l))switch(r.attrName){case"value":if(c instanceof HTMLInputElement){c.value=l;break}default:c.setAttribute(r.attrName,P(r.attrTmpl,He,l+""))}}else if(r.isTmpl)(l.strings.join()!==a.tmpl.strings.join()||l.vars.some((t=>o(t)&&!w(t)))||a.tmpl.vars.some((t=>o(t)&&!w(t)))||!T(l.vars,a.tmpl.vars))&&r.value.updateView(l),a.tmpl=l,l=a;else if(r.isText){let t=r.textNode.nextSibling;t&&t===r.node.previousSibling?t.textContent=l:($e.remove(r.textNode,r.node),$e.insertBefore(r.node,[l]))}r.value=l}}}}(()=>{const t=Promise.resolve(),e=Vt.flush;Vt.next=()=>{t.then(e)}})();class Ht extends(It(Object)){tmpl;constructor(t){super(),this._renderVars=i(t,"_renderVars"),this.tmpl=t}}const Wt={boolean:Boolean,string:String,number:Number,object:Object,array:Array,function:Function,undefined:Object},$t=new WeakMap;let jt=[];class Bt extends(It(HTMLElement)){static __l_globalRule=document.createElement("style");static defaults(t){jt=A(t.css,(t=>{if(s(t)){let e=new CSSStyleSheet;return e.replaceSync(t),e}return t instanceof CSSStyleSheet?t:[]})),t.global,f(t,((t,e)=>{x(e[0],/[A-Z]/)}))}#t={};#e={"#slots":{}};#s={};#r={};#n;#i={};__events={};get[Symbol.toStringTag](){return this.constructor.name}get reactiveData(){return this.#s}get attrs(){return this.#o}get props(){return this.#a}get renderRoot(){return this.#l}get renderRoots(){return this.#c}get parentComponent(){return this.#d}get wrapperComponent(){return this.#u}get slotHooks(){return this.#h}get css(){return $t.get(this.constructor)}get isMounted(){return this.#p}get slots(){return this.#e["#slots"]}#o;#a;#l;#c;#d;#u;#f={};#h={};#g={};#p=!1;static get styles(){return[]}static get globalStyles(){return[]}get styles(){return[]}#m=!1;#E=!1;constructor(...t){super(),1===M(t)&&(this.#a={},k(this.#a,O(t)));let e=this.render.bind(this);this.render=function(){let t;return At.startRender(this),t=e(),At.endRender(this),t};let r=i(this.constructor,"globalStyles"),n=i(this.constructor,"_global_style_attached");if(!l(r)&&"1"!==n){let t="";r.forEach((e=>{s(e)&&(t+=e+"\n")})),Bt.__l_globalRule.textContent+=t,S(this.constructor,"_global_style_attached","1")}let o=$t.get(this.constructor),a=o??[];o||(f(i(this.constructor,"styles"),(t=>{if(s(t)){let e=new CSSStyleSheet;e.replaceSync(t),a.push(e)}else a.push(t)})),$t.set(this.constructor,a)),this.#n=this.attachShadow({mode:"open"}),this.#n.adoptedStyleSheets=[...jt,...a],this._slotsPropMap={default:[]};let c=i(this.constructor,bt);c&&c.sort(((t,e)=>e.priority-t.priority)).forEach((t=>t.create(this))),this.#b=this.#_.bind(this)}#b;connectedCallback(){let t=R(this.parentNode,(t=>t instanceof Bt||t.host instanceof Bt),"parentNode");this.#d=t?t instanceof Bt?t:t.host:null,this.__init()}disconnectedCallback(){}__init(){if(this.#m)return;if(this.#E)return;this.#E=!0,this.#v();const t=this.#C();this.propsReady(t);for(const e in t){const s=t[e];this.#e[e]=s}this.#N(),f(this.#e,((t,e)=>{let s=Reflect.getOwnPropertyDescriptor(this.#e,e);Reflect.defineProperty(this,e,{get(){let t=Reflect.get(this.#s,e);return s?.get?s?.get():t},set(t){s?.set?s?.set(t):Reflect.set(this.#s,e,t)}})})),Reflect.defineProperty(this.#e,"__isData",{enumerable:!1,value:!0}),this.#s=Lt(this.#e,this);let e=i(this.constructor,ct.COMPUTED);f(e,((t,e)=>{At.startCollect(this,lt.COMPUTED),At.setUpdater((()=>{this.#s[e]=t.call(this)})),this.#e[e]=t.call(this),At.endCollect(),Reflect.defineProperty(this,e,{get(){return Reflect.get(this.#s,e)},set(t){ht(this.tagName,"Cannot set a computed property '"+e+"'")}})}));let s=i(this.constructor,ct.WATCH);f(s,((t,e)=>{t.forEach((t=>{let{source:s,options:r,handler:n}=t,o=n.bind(this);i(r,"once",!1)&&(o=D(o));const a=function(t){let e=i(this,s.replaceAll("-","."));o(e,t,s)}.bind(this);let l=i(r,"deep",!1);if(a.deep=l,At.collectWatch(this,(()=>a),e),!i(r,"immediate",!1))return;let c=i(this,s.replaceAll("-","."));o(c,c,s)}))}));let r=this.render(),o=this.buildView(r);if(o){let t=m(o);t.forEach((t=>{this.#n.appendChild(t)})),this.#c=L(t,(t=>t.nodeType===Node.ELEMENT_NODE)),this.#l=this.#c[0]}f(this.#h,((t,e)=>{this.#y(e)}));const a=this;let l=i(this.constructor,bt);l&&l.sort(((t,e)=>e.priority-t.priority)).forEach((t=>{t.beforeMount(this,((t,e)=>(a.#s[t]=e,a.#s[t])))})),this.beforeMount();let c=i(this.constructor,ct.EVENTS);c&&c.forEach((async t=>{let e=t.name,s=k({target:document,once:!1,passive:!1,capture:!1},t.options),r=V(t.fn,this),n=s.target;_(n)&&(n=await n.call(this,this)),n?n.addEventListener(e,r,s):ht(this.tagName,"The target of @event('"+e+"',...) is invalid")})),At.startCollect(this,lt.CSS);let d=[];this.styles.forEach((t=>{if(!_(t))return;let e=new CSSStyleSheet;d.push(e),At.setUpdater((()=>{let s=t()??"";e.replaceSync(s)}));let s=t();n(s)||e.replaceSync(s)})),At.endCollect(),this.#n.adoptedStyleSheets=[...this.#n.adoptedStyleSheets,...d],setTimeout((()=>{this.#p=!0,this.mounted(),l&&l.forEach((t=>{t.mounted(this,((t,e)=>(a.#s[t]=e,a.#s[t])))}))}),0),this.#m=!0}propsReady(t){}render(){throw Error(`[CompElem <${this.tagName}>] Missing render()`)}beforeMount(){}mounted(){}#S(t,e){this.#v();let s=i(this.#t[e],"props");s&&f(this.slots,((t,e)=>{t.filter((t=>t.nodeType===Node.ELEMENT_NODE)).forEach((t=>{t instanceof Bt?t._updateProps(s):f(s,((e,s)=>{if(t instanceof HTMLSlotElement){let r=i(t,"__l_comp");if(r){let n=t.name||"default",i=r.#t[n];i||(i=r.#t[n]={props:{}}),i.props||(i.props={}),i.props[s]=e,r.#S(t,n)}}else t.setAttribute(s,e)}))}))})),this.slotChange(t,e)}slotChange(t,e){}attributeChangedCallback(t,e,s){this.#T(t,e,s)}shouldUpdate(t){return!0}updated(t){}#P={};_notify(t,e){let s=[];for(let r=0;r<e.length;r++){const n=e[r];s.push(n);let a=i(this,s),l=pt(s);this.#r[l]={value:a,chain:"slots"===l?["slots"]:s,oldValue:t,end:s.length===e.length},o(a)&&"#"!=l[0]&&ot.set(a,l)}return this.#b}#_(){if(M(this.#r)<1)return;const t=this.#r;this.#r={};let e=i(this.constructor,bt);if(e&&e.sort(((t,e)=>e.priority-t.priority)).forEach((e=>{e.updated(this,t)})),!this.shouldUpdate(t))return;let s=new Set;f(t,(({value:t,chain:e,oldValue:r},n)=>{this.#i[n]&&this.#i[n].forEach((t=>{s.add(t)}))})),s.forEach((t=>{if(t===this)this.updateView(this.render());else{let e=t.render(...t._renderArgs?t._renderArgs:[]);e&&t.updateView(e)}})),this.#w.forEach((t=>{this.#y(t)})),this.updated(t),f(t,(({value:t,chain:e,oldValue:s},r)=>{o(t)&&ot.has(t)&&ot.delete(t)}))}#C(){let t=i(this.constructor,ct.PROPS),s=this.attributes,n=this.tagName,l=this.#a,d={};f(s,(({name:e,value:s})=>{if(e[0]===Ne||e[0]===ye||e[0]===Se||e===we||"slot"===e)return;let r=I(e);t&&!t[r]&&(d[e]=s)})),this.#o=this.#o?k(this.#o,d):d;let u={};return f(t,((d,h)=>{let p,f=t[h],m=c(l,h),E=i(this,h);if(!("_defaultValue"in f)&&(f._defaultValue=E,!f.type)){r(E)&&ht(n,"Prop '"+h+"' has neither propType nor defaultValue be used for type inference");let t=typeof E;v(E)&&(t="array");let e=Wt[t];f.type=e}if(m)p=H(l[h])?E:l[h];else{p=E;let t=s.getNamedItem(g(h))||s.getNamedItem(ye+g(h));t&&(m=!0,p=t.value)}if(f.required&&!m)return ht(n,"Prop '"+h+"' is required"),!1;p=this.#A(t,h,p);let b=i(t,[h,"getter"]);b&&(b=V(b,this));let _=i(t,[h,"setter"]);if(_&&(_=V(_,this)),(b||_)&&Reflect.defineProperty(this.#e,h,{set:_||function(t){},get:b}),f.attribute&&a(p)&&!o(p)){let t=g(h),s=W(p);(C=f.type)===Boolean||e(C,(t=>t===Boolean))?(s=gt(p),$(s)?this.toggleAttribute(t,s):this.setAttribute(t,s)):this.setAttribute(t,s)}var C;this.#e[h]=p,u[h]=p})),Object.seal(u)}#x(t,e){let s=t;try{for(let r=0;r<e.length;r++){const n=e[r];s=n===Boolean?gt(t):n===Number?Number(t):n===String?String(t):n===Object||n===Array?j(t):n===Date?new Date(t):new n(t)}}catch(e){ht(this.tagName,"Convert attribute error with "+t)}return s}#A(t,r,n){let i=t[r];if(!i)return n;let o=i.isValid,l=i.type,c=v(l)?l:[l],d=i.converter,u=n;if(!e(c,(t=>t===String))&&s(u)&&!B(u))try{u=d?d(u):this.#x(u,c)}catch(t){ht(this.tagName,`Convert attribute '${r}' error with `+u)}for(let t=0;t<c.length;t++){"Boolean"===c[t].name&&(u=gt(u))}let h=typeof u,p=!a(u);for(let t=0;t<c.length;t++){const e=c[t];if(x(h,e.name,"i")||u instanceof e||Object.prototype.toString.call(u)===Object.prototype.toString.call(e.prototype)){p=!0;break}}return p||ht(this.tagName,`Invalid prop '${r}'. expected '${c.map((t=>t.name||t))}' but got '${h}'`),o&&(o.call(this,u,this.#e)||ht(this.tagName,`Invalid prop '${r}'. IsValid() check failed`)),u}#N(){let t=i(this.constructor,ct.STATES);f(t,((e,s)=>{let r=t[s],n=i(this,s);if(r){let t=r.prop;n=t?p(this.#e[t]):i(this,s)}this.#e[s]=n}))}#M=U(this.propsReady,100);_setParentProps(t,e){if(this.#m){let s=i(this.constructor,ct.PROPS);f(t,((t,e)=>{let r=I(e),n=s[r];if(!n)return;let i=this.#e[r];t=this.#A(s,r,t),n.hasChanged&&!n.hasChanged.call(this,t,i)||(this.#e[r]=t,this._notify(i,[r]))})),k(this.#a,t),k(this.#o,e),this.#M(this.#a)}}_updateProps(t){let e=i(this.constructor,ct.PROPS);f(t,((t,s)=>{let r=I(s);e[r]&&(t=this.#A(e,r,t),At.__skipCheck=!0,S(this,r,t),At.__skipCheck=!1)})),k(this.#a,t),this.#M(this.#a)}_initProps(t,e){this.#a=h(this.#a||{},t),this.#o=h({},e)}_bindSlot(t,e,s){if(this.#f[e]||(this.#f[e]=t,Reflect.defineProperty(t,"__l_comp",{value:this})),t.addEventListener("slotchange",(s=>{this.#m&&this.#S(t,"default"===e?"":e)})),!l(s)){let t=this.#t[e];t||(t=this.#t[e]={}),t.props=s}}_bindSlotHook(t,e){this.#h[t]=e}#w=new Set;_updateSlot(t,e,s){let r=this.#f[t],n=this.#h[t];if(!n&&!r)return;let i=this.#t[t];if(e&&(i.props||(i.props={}),i.props[e]=s),n)this.#w.add(t);else{let t=r.assignedElements({flatten:!0});for(let r=0;r<t.length;r++){t[r].setAttribute(e,s+"")}}}#v(){const t=A(this.childNodes,(t=>t.nodeType===Node.COMMENT_NODE?[]:t instanceof HTMLSlotElement?t.assignedNodes({flatten:!0}):t));let e=z(t,(t=>t.nodeType===Node.TEXT_NODE?"default":t instanceof Element?t.getAttribute("slot")||"default":void 0));if(l(e))return void(l(this.#e["#slots"])||(this.#m?this.#s["#slots"]={}:this.#e["#slots"]={}));f(e,((t,e)=>{if(e){for(;t.length>0;){let e=t[0];if(!(e.nodeType===Node.TEXT_NODE&&n(e.textContent)||e instanceof HTMLSlotElement&&l(e.assignedNodes({flatten:!0}))))break;t.shift()}for(;t.length>0;){let e=E(t);if(!(e.nodeType===Node.TEXT_NODE&&n(e.textContent)||e instanceof HTMLSlotElement&&l(e.assignedNodes({flatten:!0}))))break;t.pop()}}}));let s={};f(e,((t,e)=>{l(t)||(s[e]=t)})),this.#m?this.#s["#slots"]=s:this.#e["#slots"]=s}#y(t){let e=this.#h[t];if(!e)return;let s=this.#t[t];if(!this.#e["#slots"][t])return;this.renderAsync(e,i(s,"props"));const r=this._asyncDirectives.get(e);let n=r?.buildView(e(i(s,"props"))),o=G(m(n),(t=>t.nodeType===Node.COMMENT_NODE));if(o){let e=this.#g[t];if(!l(e))for(let t=0;t<e.length;t++){const s=e[t];s.parentNode?.removeChild(s)}this.#g[t]=o,this.append(...o),this.#w.clear()}}_asyncDirectives=new WeakMap;renderAsync(t,...e){}#T(t,e,s){if(!this.isMounted)return;if(wt(this.constructor).has(t)){let e=I(t);if(B(s)){s=i(this.constructor,ct.PROPS)[e]._defaultValue}this._updateProps({[e]:s})}}_regDeps(t,e){let s=this.#i[t];s||(s=this.#i[t]=new Set),s.add(e);let r=t.split("-");if(r.pop(),r.length<1)return;let n=r.join("-");s=this.#i[n],s||(s=this.#i[n]=new Set),s.add(e)}_regWrapper(t){this.#u=t}emit(t,e={},s){s&&s.event&&(e.event=s.event),e.target=this,this.dispatchEvent(new CustomEvent(t,{bubbles:i(s,"bubbles",!1),composed:i(s,"composed",!1),cancelable:!0,detail:e}))}on(t,e){this.#P[t]||(this.#P[t]=[]);let s=e.bind(this);this.#P[t].push(s),this.addEventListener(t,s)}nextTick(t){Vt.pushNext(t)}forceUpdate(){f(this.#s,((t,e)=>{this.#r[e]={value:void 0,chain:void 0}})),this.#_()}}var Ut,zt,Gt;document.head.appendChild(Bt.__l_globalRule),function(t){t.NONE="NONE",t.REMOVE="REMOVE",t.REPLACE="REPLACE",t.UPDATE="UPDATE",t.APPEND="APPEND"}(Ut||(Ut={}));class Ft{key;varIndex;value;isText=!1;isTmpl=!1;isDirective=!1;node;textNode;isComponent=!1;attrName;attrTmpl;isProp=!1;isToggleProp=!1;isEvent;constructor(t,e,s,r){this.varIndex=t,this.node=e,s&&(this.attrName=s),r&&(this.attrTmpl=r)}}!function(t){t.ATTR="attr",t.PROP="prop",t.TEXT="text",t.CLASS="class",t.STYLE="style",t.SLOT="slot",t.TAG="tag"}(zt||(zt={}));class Kt{startNode;endNode;type;attrName;varIndex;expressionChain;nodes;constructor(t,e,s){this.startNode=t,this.attrName=e,this.type=s}setVarIndex(t){this.varIndex=t}getNodes(){let t=this.startNode.nextSibling;if(!this.endNode)return[t];let e=[];for(;t&&t!==this.endNode;)e.push(t),t=t?.nextSibling;return e}}!function(t){t.AFTER_BEGIN="afterbegin"}(Gt||(Gt={}));class Xt{diClass;args;di;varPath;point;slotComponent;varChain;constructor(t,...e){this.diClass=t,this.args=e,this.varChain=At.popDirectiveQ(),this.di=new this.diClass,this.di.renderParams=this.varChain}checkScope(t){let e=i(this.diClass,"scopes");l(e)||x(e.join(","),t)||ut(`Directive '${this.diClass.name}' is out of scopes, expect '${e.join(",")}' bug got '${t}'`)}render(t){let e=this.di;return e.renderComponent||(e.renderComponent=t),this.di=e,e._renderArgs=this.args,this.di.render(...this.args)}update(t,e,s){let r=this.di.update(t,e,s);if(r===Ut.NONE)return;let n=t.getNodes();if(r===Ut.REMOVE)for(let t=0;t<n.length;t++){const e=n[t];e.parentNode?.removeChild(e)}else if(r===Ut.REPLACE){let s=[];for(let t=0;t<n.length;t++){const e=n[t];e.parentNode?.removeChild(e)}let r=this.di.render(...e),i=this.di.buildView(r);s=m(i);let o=document.createDocumentFragment();o.append(...s),t.endNode.parentNode.insertBefore(o,t.endNode)}else if(r===Ut.UPDATE){let s,r={},i=[],o=[],a=this.di.render(...e);if(a||(a=new ze([],[])),l(n)){let e=this.di.buildView(a);return void t.startNode.after(...e)}let c={};a instanceof ze&&a.vars.forEach((t=>{if(t instanceof ze){const e=t.getKey();c[e]=t,r[e]=!0,o.push(e)}})),n=L(F(n),(t=>t.nodeType===Node.ELEMENT_NODE)),s=L(F(m(s)),(t=>t.nodeType===Node.ELEMENT_NODE));let d={},u="",h={};for(let t=0;t<n.length;t++){let e=n[t],s=e.getAttribute("key");if(s){if(d[s]){u=s;break}d[s]=e,i.push(s),h[s]=!0}}if(u)return void ut(`${I(this.diClass.name)} - duplicate key '${u}'`);let p=r;const g=t.startNode.parentNode;let b=[],_=[];if(f(h,((t,e)=>{p[e]||(_.push(e),delete h[e],K(i,(t=>t===e)))})),!l(o)){let e=-1,s=[],r=[],n=0,a=0;for(;a<o.length;a++){const l=o[a];let c=i.findIndex((t=>t===l));if(c<0){let e=o[a-1],s=e?d[e]||e:t.startNode;b.push({prevNode:s,newkey:l}),n++}else if(c>-1&&c!==a-n){if(e<0||1===Math.abs(e-c)){let t=E(s);s.push({nodeId:l,targetId:0===a?Gt.AFTER_BEGIN:t?t.nodeId:o[a-1]})}else r.push({moveGroup:s,moveIndex:a+s.length}),s=[],s.push({nodeId:l,targetId:o[a-1]});e=c}}if(s.length>0&&r.push({moveGroup:s,moveIndex:a+s.length}),r.length>0){let e=r.sort(((t,e)=>t.moveGroup.length-e.moveGroup.length));if(e.length<2){let{moveGroup:s}=e[0];if(s.length>1){let t=E(s).targetId;s[s.length-2].nodeId===t&&(s=C(s))}s.forEach((({targetId:e,nodeId:s})=>{let r,n=d[s];e===Gt.AFTER_BEGIN?(r=t.startNode,r.after(n)):(r=d[e],r.after(n))}))}else{let s=E(e).moveIndex;1===Math.abs(e[e.length-2].moveIndex-s)&&(e=C(e)),e.forEach((({moveGroup:e})=>{e.forEach((({targetId:e,nodeId:s})=>{let r,n=d[s];e===Gt.AFTER_BEGIN?(r=t.startNode,r.after(n)):(r=d[e],r.after(n))}))}))}}}b.length>0&&this.#k(b,c,o),b.forEach((e=>{let s=e.newkey,r=this.newNodeMap[s],n=e.prevNode;n===t.endNode?n.before(r):n===t.startNode?n.after(r):"string"==typeof n?this.newNodeMap[n].after(r):n.after(r)})),_.forEach((t=>{let e=d[t];e&&e.parentNode&&g.removeChild(e)})),this.di.__updatePoints.forEach((t=>{t.key||(t.key=t.value.tmpl.getKey());const e=o.findIndex((e=>e==t.key));t.varIndex=e})),this.di.updateView(a)}}getDirective(){return this.di}newNodeMap={};#k(t,e,s){const r=[],n=[];t.forEach((t=>{let s=t.newkey;r.push(""),n.push(e[s])})),r.push("");let i=new ze(r,n),o=this.di.__updatePoints,a=this.di.buildView(i),l=new Map;this.di.__updatePoints.forEach(((t,e)=>{const s=t.value.tmpl.getKey();t.key=s,l.set(s,!0)})),o.forEach(((t,e)=>{const s=t.key??t.value.tmpl.getKey();l.get(s)||this.di.__updatePoints.push(t)})),a.forEach((t=>{t instanceof HTMLElement&&(this.newNodeMap[t.getAttribute("key")]=t)}))}}function Qt(t){return(...e)=>{let s=null;return e.forEach(((t,r)=>{if(_(t)){let n=t;e[r]=function(...t){let e=s.di;At.startRender(e);let r=n.call(e.renderComponent,...t);return At.endRender(e.renderComponent),r}}})),s=new Xt(t,...e),s}}const qt=["resize","outside","mutate"],Yt=new WeakMap,Zt=[],Jt=[],te=[],ee=new ResizeObserver((t=>{for(const e of t){const t=Array.isArray(e.contentBoxSize)?e.contentBoxSize[0]:e.contentBoxSize,s=Array.isArray(e.borderBoxSize)?e.borderBoxSize[0]:e.borderBoxSize;let r=Yt.get(e.target);if(r){r(new CustomEvent("resize",{bubbles:!1,cancelable:!1,detail:{borderBox:{w:s.inlineSize,h:s.blockSize},contentBox:{w:t.inlineSize,h:t.blockSize}}}),e.target)}}}));var se;!function(t){t.Child="child",t.Tree="tree",t.Attr="attr",t.Char="char"}(se||(se={}));const re=new WeakMap,ne=new MutationObserver((t=>{for(let e=0;e<t.length;e++){const s=t[e];let r=re.get(s.target);if(!r)return;let n={target:s.target},i=null;switch(s.type){case"subtree":n.type=se.Tree,i=r[se.Tree];break;case"childList":n.type=se.Child,n.addedNodes=s.addedNodes,n.removedNodes=s.removedNodes,i=r[se.Child];break;case"attributes":n.type=se.Attr,n.attributeName=s.attributeName,n.oldValue=s.oldValue,i=r[se.Attr];break;case"characterData":n.type=se.Char,n.oldValue=s.oldValue,i=r[se.Char]}if(i){i(new CustomEvent("mutate",{bubbles:!1,cancelable:!1,detail:n}))}}}));function ie(t,e,s,r){if("resize"===t)!function(t,e){Yt.has(t)||(Yt.set(t,e),ee.observe(t))}(e,s);else if("outside"===t)switch(r[0]){case"mousedown":!function(t,e){Zt.push([t,e])}(e,s);break;case"dblclick":!function(t,e){te.push([t,e])}(e,s);break;default:!function(t,e){Jt.push([t,e])}(e,s)}else"mutate"===t&&function(t,e,s){let r=X(s,"child"),n=X(s,"attr"),i=X(s,"char"),o=X(s,"tree"),a=re.get(t);a||(a={},re.set(t,a),r&&(a[se.Child]=e),n&&(a[se.Attr]=e),i&&(a[se.Char]=e),o&&(a[se.Tree]=e),ne.observe(t,{childList:r,attributes:n,characterData:i,subtree:o}))}(e,s,r)}document.addEventListener("mousedown",(t=>{let e=i(t.composedPath(),0,t.target);Zt.forEach((([s,r])=>{if(!s.contains(e)&&!s.contains(R(e,(t=>t instanceof ShadowRoot),"parentNode")?.host)){r(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:s,event:t}}),s)}}))}),!1),document.addEventListener("click",(t=>{let e=i(t.composedPath(),0,t.target);Jt.forEach((([s,r])=>{if(!s.contains(e)&&!s.contains(R(e,(t=>t instanceof ShadowRoot),"parentNode")?.host)){r(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:s,event:t}}),s)}}))}),!1),document.addEventListener("dblclick",(t=>{let e=i(t.composedPath(),0,t.target);te.forEach((([s,r])=>{if(!s.contains(e)&&!s.contains(R(e,(t=>t instanceof ShadowRoot),"parentNode")?.host)){r(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:s,event:t}}),s)}}))}),!1);const oe=/,|^(debounce:.+)|(debounce$)/,ae=/,|^(throttle:.+)|(throttle$)/,le="self",ce="stop",de="prevent",ue="once",he="left",pe="right",fe="middle",ge="ctrl",me="alt",Ee="shift",be="meta",_e={esc:"escape"},ve=":";function Ce(t,e,s,r){let n,i=t.split("."),o=i.shift(),a=i.includes(ue),l=e;if(n=Q(i,(t=>oe.test(t)))){let t=n.split(ve);l=U(l,parseInt(t[1])||100)}if(n=Q(i,(t=>ae.test(t)))){let t=n.split(ve);l=q(l,parseInt(t[1])||100)}if(a&&(l=D(l)),function(t){return qt.includes(t)}(o))return ie(o,s,l,i),l;let c=t=>{if(i.includes(de)&&t.preventDefault(),i.includes(ce)&&t.stopPropagation(),!i.includes(le)||t.target===t.currentTarget){if(t instanceof MouseEvent){if(i.includes(he)&&0!=t.button)return;if(i.includes(pe)&&2!=t.button)return;if(i.includes(fe)&&1!=t.button)return}else if(t instanceof KeyboardEvent){if(K(i,(t=>t==ge))[0]&&!t.ctrlKey)return;if(K(i,(t=>t==me))[0]&&!t.altKey)return;if(K(i,(t=>t==Ee))[0]&&!t.shiftKey)return;if(K(i,(t=>t==be))[0]&&!t.metaKey)return;if(!Y(i,(t=>_e[t]||t)).includes(t.key.toLowerCase()))return}l(t)}};s.addEventListener(o,c);let d=r.__events[o];return d||(d=r.__events[o]=[]),d.push([s,c]),c}const Ne="@",ye=".",Se="?",Te="*",Pe=":",we="ref",Ae=/[.?-a-z]+\s*=\s*(['"])\s*([^='"]*<\!--c_ui-pl_df-->){2,}.*?\1/ims,xe=/<\s*[a-z0-9-]+([^>]*<\!--c_ui-pl_df-->)*[^>]*?(?<!-)>/gims,Me="slot-props";function ke(t,e){let s="",r=d(e.vars),n=e.strings.length-1,o=e.vars.length-1;for(let r=0;r<=n;r++){const n=e.strings[r];let a=i(e.vars,r,"");if(a&&a.di){let e=a.render(t);if(e instanceof ze){let[s,r]=ke(t,e);Reflect.defineProperty(a,"_renderVars",{value:r}),a=Oe+s+Re}else a=e??Ve}else if(a instanceof ze){let[e,s]=ke(t,a);Reflect.defineProperty(a,"_renderVars",{value:s}),a=De+e+Le}else a=r>o?"":Ve;s+=n+a}let a=s.match(Ae);if(a){return ut(`Parse error: attribute value can be set only one interpolation —— \n ${Z(a[0],Ve,"${...}")}`),["",r]}let l=0;return s=s.replace(xe,((t,e)=>Z(t,Ve,(()=>Ve.replace("--\x3e","")+l++)))),s=s.replace(Be,"$1><").trim(),[s,r]}const Oe="\x3c!--c_ui-pl_di-start--\x3e",Re="\x3c!--c_ui-pl_di-end--\x3e",De="\x3c!--c_ui-pl_tmpl-start--\x3e",Le="\x3c!--c_ui-pl_tmpl-end--\x3e",Ve="\x3c!--c_ui-pl_df--\x3e",Ie="\x3c!--c_ui-pl_df",He=/<!--c_ui-pl_df\d*(-->)?/;function We(t,e,s,n,o){const a=document.createElement("div");a.innerHTML=e;const l=document.createNodeIterator(a,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT);let d,u,h=0,p=null,f=[],v=[],C=[],N=[t],y=[],S=[];for(;d=l.nextNode();)if(d instanceof HTMLElement||d instanceof SVGElement){d instanceof Bt?p=d:p?.contains(d)||(p=null);let e={},r=m(d.attributes);for(let i=0;i<r.length;i++){const o=r[i];let{name:a,value:l}=o;if(a===Me){let t=d.getAttribute("name")||"default";if(p){let e=p._slotsPropMap[t];e||(e=p._slotsPropMap[t]=[]),e.push(d)}}if(b(a,Ie)){let e=s[h];if(e instanceof Xt){e.checkScope(zt.TAG);let s=new Kt(d,a.substring(1),zt.TAG);e.point=s,e.di.slotComponent=p,e.di.renderComponent=n;let r=new Ft(h,d);r.isDirective=!0,r.value=e,r.isComponent=!!p,t.push(r),h++,e.di.created(s,...e.args)}d.removeAttribute(a)}else if(a[0]!==Ne)if(a!==we)if(a[0]!==ye||He.test(l)){if(He.test(l)){let r=s[h],i=new Ft(h,d,a.replace(/\.|\?|@/,""),l);if(i.isComponent=!!p,a[0]===ye||a[0]===Se||a[0]===Te){if(r instanceof Xt){r.checkScope(zt.PROP);let t=new Kt(d,a.substring(1),zt.PROP);r.point=t,r.slotComponent=p,i.value=r,i.isDirective=!0,r&&r.di.created(r.point,...r.args)}else if(a[0]===Se)i.isToggleProp=!0,i.value=!!r,i.value&&d.setAttribute(a.substring(1),"");else if(a[0]===Te){i.value=r;let t=a.substring(1);const[e,s]=t.split(Pe);let n=e;switch(s){case"camel":n=I(n);break;case"kebab":n=g(n);break;case"snake":n=J(n)}i.attrName=n,d.setAttribute(n,r)}else if(d instanceof Bt||"SLOT"===d.tagName){let t=I(a.substring(1));t in d||"SLOT"===d.tagName||ht(d.tagName,`Prop '${a}' is not defined in ${d.tagName}`),i.value=r,i.isProp=!0,e[t]=r}else ht(d.tagName,`Prop '${a}' can only be set on a CompElem or a slot`);d.removeAttribute(a),r=""}else{let t;if(i.value=r,r instanceof Xt){let e=zt.ATTR;"class"===a?e=zt.CLASS:"style"===a&&(e=zt.STYLE),r.checkScope(e),i.isDirective=!0;let s=new Kt(d,a,e);r.point=s,r.di.slotComponent=p,r.di.renderComponent=n,t=r,r=""}l=P(l,He,r),o.value=l,t&&t.di.created(t.point,...t.args)}t.push(i),h++}}else ht(d.tagName,`Prop '${a}' must be an interpolation`);else{if(He.test(l)){let t=s[h];if(!c(t,"current")){ht(d.tagName,"Ref must be a RefObject");continue}h++,t.current=d}d.removeAttribute(a)}else{let e=t=>{};if(He.test(l)){let r=s[h];if(!_(r)){ht(d.tagName,`Event '${a}' must be a function`);continue}e=r.bind(n);let i=new Ft(h,d,a.replace(/\.|\?|@/,""),l);i.isComponent=!!p,i.isEvent=!0,t.push(i),h++}Ce(a.substring(1),e,d,n),d.removeAttribute(a)}}d instanceof Bt?(d._initProps(e),d._regWrapper(n)):d instanceof HTMLSlotElement&&n._bindSlot(d,d.name||"default",e)}else{let e=d,a=`\x3c!--${e.nodeValue}--\x3e`;if(a===Oe){u&&f.push(u),u=e;let r=s[h],i=new Ft(h,d);i.isComponent=!!p,i.isDirective=!0,i.value=r;let o=p?zt.SLOT:zt.TEXT,a=new Kt(u,"",o);r.point=a,r.di.slotComponent=p,r.di.renderComponent=n,v.push(r),t.push(i),C.push(i),t=[],N.push(t),h++,S.push(h),y.push(s),s=r._renderVars,h=0;continue}if(a===Re){C.pop().textNode=e;let r=v.pop();r.point.endNode=e,r.di.created(r.point,...r.args),u=f.pop(),r.di.__updatePoints=t,N.pop(),t=E(N),s=y.pop(),h=S.pop()}else{if(a===De){u&&f.push(u),u=e;let r=s[h],a=new Ft(h,d);a.isComponent=!!p,a.isTmpl=!0;let l=E(v);(l&&"ForEach"===i(l,"diClass.name")||"ForEach"==o.constructor.name)&&(a.key=r.getKey()),r=a.value=new Ht(r);let c=p?zt.SLOT:zt.TEXT,g=new Kt(u,"",c);r.point=g,r.slotComponent=p,r.renderComponent=n,v.push(r),t.push(a),C.push(a),t=[],N.push(t),h++,S.push(h),y.push(s),s=r._renderVars,h=0;continue}if(a===Le){C.pop().textNode=e;let r=v.pop();r.point.endNode=e,u=f.pop(),r.__updatePoints=t,N.pop(),t=E(N),s=y.pop(),h=S.pop()}}if(a!==Ve)continue;let l=new Ft(h,d);t.push(l),l.isComponent=!!p,l.isText=!0;let c,g=s[h];if(c=document.createComment(`compelem-ui-${h}-child-start`),e.parentNode.insertBefore(c,e),e.nodeValue=`compelem-ui-${h}-child-end`,l.textNode=c,g instanceof Xt){l.isDirective=!0,l.value=g;let t=p?zt.SLOT:zt.TEXT,s=new Kt(c,"",t);s.endNode=e,g.point=s,g.di.slotComponent=p,g.di.renderComponent=n,g.di.created(s,...g.args),g=""}else if(g instanceof ze){l.isTmpl=!0,l.value=g;let[e,s]=ke(n,g);g=We(t,e,s,n,o)}else l.value=g;if(h++,r(g))continue;if(g instanceof NodeList){let t=document.createDocumentFragment();t.append(...g),e.parentNode.insertBefore(t,e)}else if(g instanceof Element)e.parentNode.insertBefore(g,e);else if(W(g)){let t=document.createTextNode(g);e.parentNode.insertBefore(t,e)}}return a.childNodes}const $e={insertBefore:function(t,e){if(!t.parentNode)return;let s=document.createDocumentFragment();s.append(...e),t.parentNode.insertBefore(s,t)},remove:function(t,e){if(t===e)return void t?.parentNode?.removeChild(t);let s=t.nextSibling;for(;s&&s!==e;)s?.parentNode?.removeChild(s),s=t.nextSibling}};function je(t,...e){return new ze(s(t)?[t]:t,e)}const Be=/([a-z0-9"'])\s*>\s*</gim;function Ue(t){return{current:t}}class ze{strings;vars;constructor(t,e){this.strings=d(t),this.vars=e}getKey(){let t=this.vars,e="";return f(this.strings,((s,r)=>{if(at.test(s))return e=tt(t[r]),!1})),e}getKeys(){let t=this.vars,e=[];for(let s=0;s<this.strings.length;s++){const r=this.strings[s];if(at.test(r)){let r=tt(t[s]);e.push(r)}}return l(e)&&t.forEach((t=>{if(t instanceof ze){let s=t.getKey();e.push(s)}})),e}append(t){let e=E(this.strings);return t.strings.forEach(((t,s)=>{0!=s?this.strings.push(t):this.strings[this.strings.length-1]=e+t})),this.vars=d(this.vars,t.vars),this}insert(t,e){let s=e.strings.shift();return this.strings[t]+=s,this.strings.splice(t+1,0,...e.strings),this.vars.splice(t,0,...e.vars),this}getHTML(t){let[e,s]=ke(t,this),r=We([],e,s,t,t);return et(r,((t,e)=>t+e.outerHTML),"")}}function Ge(t,e,s){s.get||ut(`Computed '${e}' must be a getter`),c(t.constructor,ct.COMPUTED)||(t.constructor[ct.COMPUTED]=l(t.constructor[ct.COMPUTED])?{}:p(t.constructor[ct.COMPUTED])),t.constructor[ct.COMPUTED][e]=s.get}const Fe=Nt(class extends mt{static get priority(){return Number.MAX_VALUE}created(t,e,s,...r){t[s]=U(t[s],this.wait,this.immediate)}beforeMount(t,e,...s){}mounted(t,e,...s){}updated(t,e){}get targets(){return[dt.METHOD]}wait;immediate;result;constructor(t,e=!1){super(),this.wait=t,this.immediate=e}});function Ke(t,e){return(s,r,n)=>{c(s.constructor,ct.EVENTS)||(s.constructor[ct.EVENTS]=l(s.constructor[ct.EVENTS])?[]:p(s.constructor[ct.EVENTS])),s.constructor[ct.EVENTS].push({name:t,options:e,fn:s[r]})}}var Xe;!function(t){t.ONCE="once",t.UPDATABLE="updatable"}(Xe||(Xe={}));class Qe extends mt{static get priority(){return Number.MAX_VALUE}created(t,e,s,...r){}mounted(t,e,...s){}get targets(){return[dt.FIELD]}selector;cache;result;constructor(t,e){super(),this.selector=t,this.cache=e}static getKey(t){return t}getter(t){this.result=t.shadowRoot?.querySelector(this.selector)}beforeMount(t,e,s,r,...n){const i=this;Reflect.defineProperty(t,r,{get:()=>(i.result&&i.cache||i.getter(t),i.result)})}updated(t,e){this.cache===Xe.UPDATABLE&&this.getter(t)}}const qe=Nt(Qe),Ye=Nt(class extends Qe{getter(t){this.result=t.shadowRoot?.querySelectorAll(this.selector)}});function Ze(t){if(1===arguments.length)return(e,s)=>{Je(e,s,t)};Je(arguments[0],arguments[1],{prop:""})}function Je(t,e,s){if(!c(t.constructor,ct.STATES)){const e={};let s=t.constructor;for(;(s=ft(s))!==Bt;)h(e,s[ct.STATES]?p(s[ct.STATES]):{});Reflect.defineProperty(t.constructor,ct.STATES,{configurable:!1,enumerable:!1,value:e})}s.shallow=s.shallow||!1,t.constructor[ct.STATES][e]=s}function ts(t,e,s){Je(t.prototype,e,s||{prop:""})}function es(t){return e=>{if(e){if(e.prototype.hasOwnProperty("attributeChangedCallback")){let t=e.prototype.attributeChangedCallback;e.prototype.attributeChangedCallback=function(e,s,r){Bt.prototype.attributeChangedCallback.call(this,e,s,r),t.call(this,e,s,r)}}if(e.prototype.hasOwnProperty("connectedCallback")){let t=e.prototype.connectedCallback;e.prototype.connectedCallback=function(){Bt.prototype.connectedCallback.call(this),t.call(this)}}if(e.prototype.hasOwnProperty("disconnectedCallback")){let t=e.prototype.disconnectedCallback;e.prototype.disconnectedCallback=function(){Bt.prototype.disconnectedCallback.call(this),t.call(this)}}customElements.define(t,e)}}}function ss(t,e){return(s,r)=>{c(s.constructor,ct.WATCH)||(s.constructor[ct.WATCH]=l(s.constructor[ct.WATCH])?{}:p(s.constructor[ct.WATCH]));(v(t)?t:[t]).forEach((t=>{let n=t.replaceAll(".","-"),i=s.constructor[ct.WATCH][n];v(i)||(i=s.constructor[ct.WATCH][n]=[]),i.push({source:t,options:e,handler:s[r]})}))}}class rs extends(It(Object)){_renderArgs;static get scopes(){return[]}renderParams}const ns=["key"];const is=Qt(class extends rs{created(t,e){let s=t.startNode;if(s instanceof Bt){let t={},r={};f(e,((e,n)=>{ns.includes(n)||(n in s?t[n]=e:r[n]=e+"")})),s._initProps(t,r)}else f(e,((t,e)=>{s.setAttribute(e,t)}))}update(t,e,s){return Ut.NONE}static get scopes(){return[zt.TAG]}render(t){}});const os=Qt(class extends rs{created(t,e){let r=[];v(e)?r=F(e):o(e)?r=A(e,((t,e)=>t?e:[])):s(e)&&(r=e.split(" "));let n=t.startNode;f(this.lastCls,(t=>{n.classList.remove(t)})),f(r,(t=>{n.classList.add(t)})),this.lastCls=d(r)}update(t,e,s){return this.created(t,e[0]),Ut.NONE}static get scopes(){return[zt.CLASS]}lastCls;render(t){}});const as=Qt(class extends rs{created(t,...e){}update(t,e,s){if(l(t.getNodes())&&(!e||l(e[0])))return Ut.NONE;if(st(this.lastAry,e[0])&&this.lastAry.length===e[0].length)return Ut.NONE;if(!l(this.renderParams)){let t=E(this.renderParams);v(t)||(t=[t]),this.renderParams=t}return this.lastAry=rt(e[0]),Ut.UPDATE}constructor(t){super(),l(this.renderParams)||(this.renderParams=m(E(this.renderParams)))}static get scopes(){return[zt.TEXT,zt.SLOT]}lastAry;lastRenderTmpl;render(t,e){let s=Y(t,((t,s)=>e(t,s)));if(s.length<1)return this.lastRenderTmpl=new ze([],[]),this.lastRenderTmpl;let r=[],n=[];const i=[],o=[];for(let t=0;t<s.length;t++){const e=s[t];let a=E(n),l=e.vars,c=!0,d=e.strings;for(let t=0;t<d.length;t++){const e=d[t];if(at.test(e)){let e=l[t]+"";if(r.includes(e))return void ut(`forEach - duplicate key '${e}'`);r.push(e),c=!1}0==t&&a?n[n.length-1]=a+e:n.push(e)}if(c)return void ut("forEach - missing 'key' prop");let u=E(i);u&&d.length>0&&(i[i.length-1]=W(u)+d.shift()),i.push(""),o.push(e)}return this.lastAry=rt(t),i.push(""),this.lastRenderTmpl=new ze(i,o),this.lastRenderTmpl}});const ls=Qt(class extends rs{created(t,...e){}ifNodes;elseNodes;static get scopes(){return[zt.TEXT,zt.SLOT]}update(t,e,s){return!!e[0]==!!s[0]?Ut.NONE:(e[0],Ut.REPLACE)}render(t,e,s){return t?e(t):s(t)}});const cs=Qt(class extends rs{created(t,...e){}static get scopes(){return[zt.TEXT,zt.SLOT]}update(t,e,s){return e[0]===s[0]?Ut.NONE:e[0]?Ut.REPLACE:Ut.REMOVE}render(t,e){return t?e():je``}});var ds;!function(t){t.CHANGE="change",t.INPUT="input"}(ds||(ds={}));const us=Qt(class extends rs{created(t,e,s="value"){const r=t.startNode;if("binded"===i(r,"_model"))return;let n=E(this.renderParams);if(this.updateProp=s,this.modelPath=n,o(e)||W(e)||(e=""),r instanceof Bt)r._initProps({[this.updateProp]:e}),r.addEventListener("update:"+s,(t=>{S(this.renderComponent,this.modelPath,t.detail.value)})),S(r,"_model","binded");else if(r instanceof HTMLTextAreaElement)r.setAttribute(this.updateProp,e+""),r.addEventListener("input",(t=>{let e=t.target;S(this.renderComponent,this.modelPath,e.value)})),S(r,"_model","binded");else if(r instanceof HTMLInputElement){let t="",n="";switch(r.type){case"checkbox":case"radio":t="checked",n="change";break;default:t="value",n="input"}r.setAttribute(s??t,e+""),r.addEventListener(n,(t=>{let e=t.target;S(this.renderComponent,this.modelPath,e.value)})),S(r,"_model","binded")}else r instanceof HTMLSelectElement&&(r.setAttribute(this.updateProp,e+""),r.addEventListener("change",(t=>{let e=t.target;S(this.renderComponent,this.modelPath,e.value)})),S(r,"_model","binded"))}update(t,e,s){if(this.modelPath||(this.modelPath=E(this.renderParams)),!T(e,s)){const s=t.startNode;if(s instanceof Bt)s._updateProps({[this.updateProp]:e[0]});else if(s instanceof HTMLTextAreaElement||s instanceof HTMLSelectElement)s.setAttribute(this.updateProp,e[0]+"");else if(s instanceof HTMLInputElement)switch(s.type){case"checkbox":case"radio":e[0]?s.setAttribute("checked",""):s.removeAttribute("checked");break;default:s.setAttribute(this.updateProp,e[0]+"")}}return Ut.NONE}static get scopes(){return[zt.TAG]}modelPath;render(t,e="value"){}});const hs=Qt(class extends rs{created(t,e,s){let n=t.startNode;r(this.display)&&(this.display=n.style.display);let i=s;this.renderComponent.nextTick((()=>{n.style.display=e?this.display:"none",i&&i(n,e)}))}update(t,e,s){return this.created(t,e[0],e[1]),Ut.NONE}display=void 0;static get scopes(){return[zt.TAG]}constructor(t){super(),this.point=t}render(t,e){}});const ps=Qt(class extends rs{created(t,e,s){e=e.bind(this.renderComponent),this.slotComponent._bindSlotHook(s||"default",e)}update(t,e,s){return Ut.NONE}static get scopes(){return[zt.SLOT]}render(t,e){}});class fs{static getCssText(t,e=!1){return s(t)?t:N(Y(t,((t,s)=>s.startsWith("--")?s+":"+t+(e?" !important":""):g(s)+":"+t+(e?" !important":""))),";")}static setStyle(t,e){if(s(t)&&!W(t))return{};let r=fs.getCssText(t),n={};return f(r.split(";"),(t=>{let s=t.split(":"),r=W(s[0]),i=W(s[1]);n[r]=e.style.getPropertyValue(r),e.style.setProperty(r,i)})),n}}const gs=Qt(class extends rs{created(t,e){fs.setStyle(e,t.startNode)}update(t,e,s){return this.created(t,e[0]),Ut.NONE}constructor(t){super(),this.point=t}static get scopes(){return[zt.STYLE]}render(t){}});const ms=Qt(class extends rs{created(t,e){this.modelPath||(this.modelPath=E(this.renderParams));const s=t.startNode;let r=t.attrName;s._initProps({[r]:e}),s.addEventListener("update:"+r,(t=>{S(this.renderComponent,this.modelPath,t.detail.value)}))}update(t,e,s){if(!T(e,s)){const s=t.startNode;let r=t.attrName;s._updateProps({[r]:e[0]})}return Ut.NONE}static get scopes(){return[zt.PROP]}modelPath;constructor(t){super()}render(t){}});const Es=Qt(class extends rs{created(t,...e){}static get scopes(){return[zt.TEXT,zt.SLOT]}update(t,e,s){return T(e,s)?Ut.NONE:Ut.REPLACE}render(t,e){let s=()=>je``,r=[],n=[];f(e,((t,e)=>{if(_(t))r.push(e),n.push(t);else{let e=t[0],s=t[1];r.push(e),n.push(s)}"default"===e&&(s=t)}));let i=nt(r,(e=>_(e)?e(t):e==t));return it(n[i]??s)}});export{Bt as CompElem,fs as CssHelper,mt as Decorator,dt as DecoratorType,vt as DecoratorWrapper,rs as Directive,Ut as DirectiveUpdateTag,Xt as DirectiveWrapper,Kt as EnterPoint,zt as EnterPointType,Et as GetKeyFnName,ds as ModelTriggerType,Xe as QueryCache,ze as Template,Ft as UpdatePoint,_t as _DecoratorMap,bt as _DecoratorsKey,wt as _getObservedAttrs,is as bind,ke as buildHTML,os as classes,Ge as computed,Ue as createRef,Fe as debounced,Nt as decorator,Qt as directive,Ke as event,as as forEach,je as html,ls as ifElse,cs as ifTrue,ts as makeState,us as model,St as prop,qe as query,Ye as queryAll,hs as show,ps as slot,Ze as state,gs as styles,ms as sync,es as tag,ss as watch,Es as when};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "compelem",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2-b1",
|
|
4
4
|
"description": "A modern, reactive, fast, lightweight and flexible lib for building web components",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"bootstrap-icons": "^1.11.3",
|
|
36
36
|
"eslint": "9.19.0",
|
|
37
37
|
"eslint-config-prettier": "^10.0.1",
|
|
38
|
-
"myfx": "^1.
|
|
38
|
+
"myfx": "^1.11.3",
|
|
39
39
|
"postcss": "^8.4.38",
|
|
40
40
|
"prettier": "^2.8.3",
|
|
41
41
|
"rollup-plugin-banner2": "1.2.2",
|