@lipsjs/lips 0.0.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 PWS-Hub
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,138 @@
1
+ # Lips: Fast, Lightweight Reactive UI Framework
2
+
3
+ Lips is a modern, runtime-based UI framework that brings fine-grained reactivity without the need for build steps. Create dynamic web applications with a simple, declarative syntax that feels familiar to HTML developers while providing powerful reactive capabilities.
4
+
5
+ ## ✨ Key Features
6
+
7
+ - **Zero Build Step**: Just import the script and start building
8
+ - **Fine-Grained Reactivity**: Only updates what changed, not the entire component
9
+ - **Intuitive Template Syntax**: Simple yet powerful templating that's familiar to HTML developers
10
+ - **TypeScript Support**: Full type definitions for better developer experience
11
+ - **Built-in Performance Monitoring**: Track rendering performance with integrated benchmarking
12
+ - **Flexible Component Architecture**: Object-based or ES Module syntax for your components
13
+ - **Context API**: Share state across components without prop drilling
14
+ - **Lifecycle Hooks**: Fine-grained control over component behavior
15
+ - **Built-in Routing & i18n**: Everything you need in a single package
16
+
17
+ ## 🚀 Quick Start
18
+
19
+ ```html
20
+ <!DOCTYPE html>
21
+ <html>
22
+ <head>
23
+ <title>My Lips App</title>
24
+ <script src="https://cdn.jsdelivr.net/npm/@fabrice8/lips/dist/lips.min.js"></script>
25
+ </head>
26
+ <body>
27
+ <div id="app"></div>
28
+
29
+ <script>
30
+ const lips = new Lips();
31
+
32
+ const counter = {
33
+ state: { count: 0 },
34
+ handler: {
35
+ increment() { this.state.count++; }
36
+ },
37
+ default: `
38
+ <div>
39
+ <h2>Count: {state.count}</h2>
40
+ <button on-click(increment)>Increment</button>
41
+ </div>
42
+ `
43
+ };
44
+
45
+ lips.root(counter, '#app');
46
+ </script>
47
+ </body>
48
+ </html>
49
+ ```
50
+
51
+ ## 📦 Installation
52
+
53
+ ### Via NPM
54
+
55
+ ```bash
56
+ npm install @fabrice8/lips
57
+ ```
58
+
59
+ ### Via CDN
60
+
61
+ ```html
62
+ <script src="https://cdn.jsdelivr.net/npm/@fabrice8/lips/dist/lips.min.js"></script>
63
+ ```
64
+
65
+ ## 📖 Documentation
66
+
67
+ For comprehensive documentation, examples, and API reference, visit:
68
+
69
+ [Full Lips Documentation](https://github.com/fabrice8/lips/tree/main/docs/index.md)
70
+
71
+ ## 🏗️ Building from Source
72
+
73
+ Lips is developed using [Bun](https://bun.sh) runtime environment.
74
+
75
+ ```bash
76
+ # Clone the repository
77
+ git clone https://github.com/fabrice8/lips.git
78
+ cd lips
79
+
80
+ # Install dependencies
81
+ npm install
82
+
83
+ # Make sure you have Bun installed
84
+ # If not: curl -fsSL https://bun.sh/install | bash
85
+
86
+ # Development with watch mode
87
+ bun run dev
88
+
89
+ # Build for production
90
+ bun run compile
91
+
92
+ # Build type declarations
93
+ bun run build:declaration
94
+ ```
95
+
96
+ ## 🤝 Contributing
97
+
98
+ Contributions are welcome! Here's how you can help:
99
+
100
+ 1. **Fork the repository**
101
+ 2. **Create a feature branch**:
102
+ ```bash
103
+ git checkout -b feature/amazing-feature
104
+ ```
105
+ 3. **Commit your changes**:
106
+ ```bash
107
+ git commit -m 'Add some amazing feature'
108
+ ```
109
+ 4. **Push to the branch**:
110
+ ```bash
111
+ git push origin feature/amazing-feature
112
+ ```
113
+ 5. **Open a Pull Request**
114
+
115
+ Please ensure your code follows the existing style and includes appropriate tests.
116
+
117
+ ### Development Guidelines
118
+
119
+ - Ensure you have [Bun](https://bun.sh) installed for development
120
+ - Follow the TypeScript coding style
121
+ - Add unit tests for new features
122
+ - Maintain the zero-build philosophy for runtime usage
123
+ - Update documentation for any new features or changes
124
+
125
+ ## 📄 License
126
+
127
+ This project is licensed under the MIT License - see the LICENSE file for details.
128
+
129
+ ## 🙏 Acknowledgements
130
+
131
+ - [Bun](https://bun.sh) for the fast JavaScript runtime and bundler
132
+ - [Cash-DOM](https://github.com/fabiospampinato/cash) for the lightweight jQuery alternative
133
+ - [Stylis](https://github.com/thysultan/stylis) for the CSS preprocessor
134
+ - All contributors who have helped make Lips better
135
+
136
+ ---
137
+
138
+ Lips - Reactive UI without the complexity. Created with ❤️ by [Fabrice K.E.M](https://github.com/fabrice8)
@@ -0,0 +1,3 @@
1
+ var ZZ=Object.create;var{defineProperty:T1,getPrototypeOf:JZ,getOwnPropertyNames:QZ}=Object;var WZ=Object.prototype.hasOwnProperty;var s0=(Z,Q,W)=>{W=Z!=null?ZZ(JZ(Z)):{};const q=Q||!Z||!Z.__esModule?T1(W,"default",{value:Z,enumerable:!0}):W;for(let Y of QZ(Z))if(!WZ.call(q,Y))T1(q,Y,{get:()=>Z[Y],enumerable:!0});return q};var XZ=(Z,Q)=>()=>(Q||Z((Q={exports:{}}).exports,Q),Q.exports);var m0=(Z,Q)=>{for(var W in Q)T1(Z,W,{get:Q[W],enumerable:!0,configurable:!0,set:(q)=>Q[W]=()=>q})};var u0=XZ((t1,a1)=>{(function(){var Z=document,Q=window,W=Z.documentElement,q=Z.createElement.bind(Z),Y=q("div"),B=q("table"),G=q("tbody"),X=q("tr"),D=Array.isArray,O=Array.prototype,j=O.concat,E=O.filter,x=O.indexOf,A=O.map,u=O.push,i=O.slice,e=O.some,r=O.splice,c=/^#(?:[\w-]|\\.|[^\x00-\xa0])*$/,d=/^\.(?:[\w-]|\\.|[^\x00-\xa0])*$/,k=/<.+>/,y=/^\w+$/;function $(J,H){var z=o(H);return!J||!z&&!T(H)&&!P(H)?[]:!z&&d.test(J)?H.getElementsByClassName(J.slice(1).replace(/\\/g,"")):!z&&y.test(J)?H.getElementsByTagName(J):H.querySelectorAll(J)}var K=function(){function J(H,z){if(!H)return;if(L(H))return H;var M=H;if(S(H)){var I=z||Z;if(M=c.test(H)&&T(I)?I.getElementById(H.slice(1).replace(/\\/g,"")):k.test(H)?y1(H):L(I)?I.find(H):S(I)?U(I).find(H):$(H,I),!M)return}else if(V(H))return this.ready(H);if(M.nodeType||M===Q)M=[M];this.length=M.length;for(var N=0,f=this.length;N<f;N++)this[N]=M[N]}return J.prototype.init=function(H,z){return new J(H,z)},J}(),w=K.prototype,U=w.init;if(U.fn=U.prototype=w,w.length=0,w.splice=r,typeof Symbol==="function")w[Symbol.iterator]=O[Symbol.iterator];function L(J){return J instanceof K}function C(J){return!!J&&J===J.window}function T(J){return!!J&&J.nodeType===9}function o(J){return!!J&&J.nodeType===11}function P(J){return!!J&&J.nodeType===1}function h(J){return!!J&&J.nodeType===3}function v(J){return typeof J==="boolean"}function V(J){return typeof J==="function"}function S(J){return typeof J==="string"}function _(J){return J===void 0}function R(J){return J===null}function F(J){return!isNaN(parseFloat(J))&&isFinite(J)}function g(J){if(typeof J!=="object"||J===null)return!1;var H=Object.getPrototypeOf(J);return H===null||H===Object.prototype}U.isWindow=C,U.isFunction=V,U.isArray=D,U.isNumeric=F,U.isPlainObject=g;function b(J,H,z){if(z){var M=J.length;while(M--)if(H.call(J[M],M,J[M])===!1)return J}else if(g(J)){var I=Object.keys(J);for(var M=0,N=I.length;M<N;M++){var f=I[M];if(H.call(J[f],f,J[f])===!1)return J}}else for(var M=0,N=J.length;M<N;M++)if(H.call(J[M],M,J[M])===!1)return J;return J}U.each=b,w.each=function(J){return b(this,J)},w.empty=function(){return this.each(function(J,H){while(H.firstChild)H.removeChild(H.firstChild)})};function s(){var J=[];for(var H=0;H<arguments.length;H++)J[H]=arguments[H];var z=v(J[0])?J.shift():!1,M=J.shift(),I=J.length;if(!M)return{};if(!I)return s(z,U,M);for(var N=0;N<I;N++){var f=J[N];for(var m in f)if(z&&(D(f[m])||g(f[m]))){if(!M[m]||M[m].constructor!==f[m].constructor)M[m]=new f[m].constructor;s(z,M[m],f[m])}else M[m]=f[m]}return M}U.extend=s,w.extend=function(J){return s(w,J)};var l=/\S+/g;function p(J){return S(J)?J.match(l)||[]:[]}w.toggleClass=function(J,H){var z=p(J),M=!_(H);return this.each(function(I,N){if(!P(N))return;b(z,function(f,m){if(M)H?N.classList.add(m):N.classList.remove(m);else N.classList.toggle(m)})})},w.addClass=function(J){return this.toggleClass(J,!0)},w.removeAttr=function(J){var H=p(J);return this.each(function(z,M){if(!P(M))return;b(H,function(I,N){M.removeAttribute(N)})})};function D0(J,H){if(!J)return;if(S(J)){if(arguments.length<2){if(!this[0]||!P(this[0]))return;var z=this[0].getAttribute(J);return R(z)?void 0:z}if(_(H))return this;if(R(H))return this.removeAttr(J);return this.each(function(I,N){if(!P(N))return;N.setAttribute(J,H)})}for(var M in J)this.attr(M,J[M]);return this}w.attr=D0,w.removeClass=function(J){if(arguments.length)return this.toggleClass(J,!1);return this.attr("class","")},w.hasClass=function(J){return!!J&&e.call(this,function(H){return P(H)&&H.classList.contains(J)})},w.get=function(J){if(_(J))return i.call(this);return J=Number(J),this[J<0?J+this.length:J]},w.eq=function(J){return U(this.get(J))},w.first=function(){return this.eq(0)},w.last=function(){return this.eq(-1)};function Z0(J){if(_(J))return this.get().map(function(H){return P(H)||h(H)?H.textContent:""}).join("");return this.each(function(H,z){if(!P(z))return;z.textContent=J})}w.text=Z0;function n(J,H,z){if(!P(J))return;var M=Q.getComputedStyle(J,null);return z?M.getPropertyValue(H)||void 0:M[H]||J.style[H]}function q0(J,H){return parseInt(n(J,H),10)||0}function v0(J,H){return q0(J,"border".concat(H?"Left":"Top","Width"))+q0(J,"padding".concat(H?"Left":"Top"))+q0(J,"padding".concat(H?"Right":"Bottom"))+q0(J,"border".concat(H?"Right":"Bottom","Width"))}var T0={};function C0(J){if(T0[J])return T0[J];var H=q(J);Z.body.insertBefore(H,null);var z=n(H,"display");return Z.body.removeChild(H),T0[J]=z!=="none"?z:"block"}function K0(J){return n(J,"display")==="none"}function _0(J,H){var z=J&&(J.matches||J.webkitMatchesSelector||J.msMatchesSelector);return!!z&&!!H&&z.call(J,H)}function R0(J){return S(J)?function(H,z){return _0(z,J)}:V(J)?J:L(J)?function(H,z){return J.is(z)}:!J?function(){return!1}:function(H,z){return z===J}}w.filter=function(J){var H=R0(J);return U(E.call(this,function(z,M){return H.call(z,M,z)}))};function P0(J,H){return!H?J:J.filter(H)}w.detach=function(J){return P0(this,J).each(function(H,z){if(z.parentNode)z.parentNode.removeChild(z)}),this};var T5=/^\s*<(\w+)[^>]*>/,R5=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,k1={"*":Y,tr:G,td:X,th:X,thead:B,tbody:B,tfoot:B};function y1(J){if(!S(J))return[];if(R5.test(J))return[q(RegExp.$1)];var H=T5.test(J)&&RegExp.$1,z=k1[H]||k1["*"];return z.innerHTML=J,U(z.childNodes).detach().get()}U.parseHTML=y1,w.has=function(J){var H=S(J)?function(z,M){return $(J,M).length}:function(z,M){return M.contains(J)};return this.filter(H)},w.not=function(J){var H=R0(J);return this.filter(function(z,M){return(!S(J)||P(M))&&!H.call(M,z,M)})};function F0(J,H,z,M){var I=[],N=V(H),f=M&&R0(M);for(var m=0,U0=J.length;m<U0;m++)if(N){var W0=H(J[m]);if(W0.length)u.apply(I,W0)}else{var Y0=J[m][H];while(Y0!=null){if(M&&f(-1,Y0))break;I.push(Y0),Y0=z?Y0[H]:null}}return I}function v1(J){if(J.multiple&&J.options)return F0(E.call(J.options,function(H){return H.selected&&!H.disabled&&!H.parentNode.disabled}),"value");return J.value||""}function $5(J){if(!arguments.length)return this[0]&&v1(this[0]);return this.each(function(H,z){var M=z.multiple&&z.options;if(M||n1.test(z.type)){var I=D(J)?A.call(J,String):R(J)?[]:[String(J)];if(M)b(z.options,function(N,f){f.selected=I.indexOf(f.value)>=0},!0);else z.checked=I.indexOf(z.value)>=0}else z.value=_(J)||R(J)?"":J})}w.val=$5,w.is=function(J){var H=R0(J);return e.call(this,function(z,M){return H.call(z,M,z)})},U.guid=1;function j0(J){return J.length>1?E.call(J,function(H,z,M){return x.call(M,H)===z}):J}U.unique=j0,w.add=function(J,H){return U(j0(this.get().concat(U(J,H).get())))},w.children=function(J){return P0(U(j0(F0(this,function(H){return H.children}))),J)},w.parent=function(J){return P0(U(j0(F0(this,"parentNode"))),J)},w.index=function(J){var H=J?U(J)[0]:this[0],z=J?this:U(H).parent().children();return x.call(z,H)},w.closest=function(J){var H=this.filter(J);if(H.length)return H;var z=this.parent();if(!z.length)return H;return z.closest(J)},w.siblings=function(J){return P0(U(j0(F0(this,function(H){return U(H).parent().children().not(H)}))),J)},w.find=function(J){return U(j0(F0(this,function(H){return $(J,H)})))};var A5=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,_5=/^$|^module$|\/(java|ecma)script/i,x5=["type","src","nonce","noModule"];function b5(J,H){var z=U(J);z.filter("script").add(z.find("script")).each(function(M,I){if(_5.test(I.type)&&W.contains(I)){var N=q("script");N.text=I.textContent.replace(A5,""),b(x5,function(f,m){if(I[m])N[m]=I[m]}),H.head.insertBefore(N,null),H.head.removeChild(N)}})}function h5(J,H,z,M,I){if(M)J.insertBefore(H,z?J.firstChild:null);else if(J.nodeName==="HTML")J.parentNode.replaceChild(H,J);else J.parentNode.insertBefore(H,z?J:J.nextSibling);if(I)b5(H,J.ownerDocument)}function S0(J,H,z,M,I,N,f,m){return b(J,function(U0,W0){b(U(W0),function(Y0,$0){b(U(H),function(M0,o0){var C1=z?$0:o0,P1=z?o0:$0,B0=z?Y0:M0;h5(C1,!B0?P1:P1.cloneNode(!0),M,I,!B0)},m)},f)},N),H}w.after=function(){return S0(arguments,this,!1,!1,!1,!0,!0)},w.append=function(){return S0(arguments,this,!1,!1,!0)};function f5(J){if(!arguments.length)return this[0]&&this[0].innerHTML;if(_(J))return this;var H=/<script[\s>]/.test(J);return this.each(function(z,M){if(!P(M))return;if(H)U(M).empty().append(J);else M.innerHTML=J})}w.html=f5,w.appendTo=function(J){return S0(arguments,this,!0,!1,!0)},w.wrapInner=function(J){return this.each(function(H,z){var M=U(z),I=M.contents();I.length?I.wrapAll(J):M.append(J)})},w.before=function(){return S0(arguments,this,!1,!0)},w.wrapAll=function(J){var H=U(J),z=H[0];while(z.children.length)z=z.firstElementChild;return this.first().before(H),this.appendTo(z)},w.wrap=function(J){return this.each(function(H,z){var M=U(J)[0];U(z).wrapAll(!H?M:M.cloneNode(!0))})},w.insertAfter=function(J){return S0(arguments,this,!0,!1,!1,!1,!1,!0)},w.insertBefore=function(J){return S0(arguments,this,!0,!0)},w.prepend=function(){return S0(arguments,this,!1,!0,!0,!0,!0)},w.prependTo=function(J){return S0(arguments,this,!0,!0,!0,!1,!1,!0)},w.contents=function(){return U(j0(F0(this,function(J){return J.tagName==="IFRAME"?[J.contentDocument]:J.tagName==="TEMPLATE"?J.content.childNodes:J.childNodes})))},w.next=function(J,H,z){return P0(U(j0(F0(this,"nextElementSibling",H,z))),J)},w.nextAll=function(J){return this.next(J,!0)},w.nextUntil=function(J,H){return this.next(H,!0,J)},w.parents=function(J,H){return P0(U(j0(F0(this,"parentElement",!0,H))),J)},w.parentsUntil=function(J,H){return this.parents(H,J)},w.prev=function(J,H,z){return P0(U(j0(F0(this,"previousElementSibling",H,z))),J)},w.prevAll=function(J){return this.prev(J,!0)},w.prevUntil=function(J,H){return this.prev(H,!0,J)},w.map=function(J){return U(j.apply([],A.call(this,function(H,z){return J.call(H,z,H)})))},w.clone=function(){return this.map(function(J,H){return H.cloneNode(!0)})},w.offsetParent=function(){return this.map(function(J,H){var z=H.offsetParent;while(z&&n(z,"position")==="static")z=z.offsetParent;return z||W})},w.slice=function(J,H){return U(i.call(this,J,H))};var g5=/-([a-z])/g;function D1(J){return J.replace(g5,function(H,z){return z.toUpperCase()})}w.ready=function(J){var H=function(){return setTimeout(J,0,U)};if(Z.readyState!=="loading")H();else Z.addEventListener("DOMContentLoaded",H);return this},w.unwrap=function(){return this.parent().each(function(J,H){if(H.tagName==="BODY")return;var z=U(H);z.replaceWith(z.children())}),this},w.offset=function(){var J=this[0];if(!J)return;var H=J.getBoundingClientRect();return{top:H.top+Q.pageYOffset,left:H.left+Q.pageXOffset}},w.position=function(){var J=this[0];if(!J)return;var H=n(J,"position")==="fixed",z=H?J.getBoundingClientRect():this.offset();if(!H){var M=J.ownerDocument,I=J.offsetParent||M.documentElement;while((I===M.body||I===M.documentElement)&&n(I,"position")==="static")I=I.parentNode;if(I!==J&&P(I)){var N=U(I).offset();z.top-=N.top+q0(I,"borderTopWidth"),z.left-=N.left+q0(I,"borderLeftWidth")}}return{top:z.top-q0(J,"marginTop"),left:z.left-q0(J,"marginLeft")}};var m1={class:"className",contenteditable:"contentEditable",for:"htmlFor",readonly:"readOnly",maxlength:"maxLength",tabindex:"tabIndex",colspan:"colSpan",rowspan:"rowSpan",usemap:"useMap"};w.prop=function(J,H){if(!J)return;if(S(J)){if(J=m1[J]||J,arguments.length<2)return this[0]&&this[0][J];return this.each(function(M,I){I[J]=H})}for(var z in J)this.prop(z,J[z]);return this},w.removeProp=function(J){return this.each(function(H,z){delete z[m1[J]||J]})};var k5=/^--/;function j1(J){return k5.test(J)}var F1={},y5=Y.style,v5=["webkit","moz","ms"];function m5(J,H){if(H===void 0)H=j1(J);if(H)return J;if(!F1[J]){var z=D1(J),M="".concat(z[0].toUpperCase()).concat(z.slice(1)),I="".concat(z," ").concat(v5.join("".concat(M," "))).concat(M).split(" ");b(I,function(N,f){if(f in y5)return F1[J]=f,!1})}return F1[J]}var u5={animationIterationCount:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0};function u1(J,H,z){if(z===void 0)z=j1(J);return!z&&!u5[J]&&F(H)?"".concat(H,"px"):H}function d5(J,H){if(S(J)){var z=j1(J);if(J=m5(J,z),arguments.length<2)return this[0]&&n(this[0],J,z);if(!J)return this;return H=u1(J,H,z),this.each(function(I,N){if(!P(N))return;if(z)N.style.setProperty(J,H);else N.style[J]=H})}for(var M in J)this.css(M,J[M]);return this}w.css=d5;function d1(J,H){try{return J(H)}catch(z){return H}}var i5=/^\s+|\s+$/;function i1(J,H){var z=J.dataset[H]||J.dataset[D1(H)];if(i5.test(z))return z;return d1(JSON.parse,z)}function c5(J,H,z){z=d1(JSON.stringify,z),J.dataset[D1(H)]=z}function p5(J,H){if(!J){if(!this[0])return;var z={};for(var M in this[0].dataset)z[M]=i1(this[0],M);return z}if(S(J)){if(arguments.length<2)return this[0]&&i1(this[0],J);if(_(H))return this;return this.each(function(I,N){c5(N,J,H)})}for(var M in J)this.data(M,J[M]);return this}w.data=p5;function c1(J,H){var z=J.documentElement;return Math.max(J.body["scroll".concat(H)],z["scroll".concat(H)],J.body["offset".concat(H)],z["offset".concat(H)],z["client".concat(H)])}b([!0,!1],function(J,H){b(["Width","Height"],function(z,M){var I="".concat(H?"outer":"inner").concat(M);w[I]=function(N){if(!this[0])return;if(C(this[0]))return H?this[0]["inner".concat(M)]:this[0].document.documentElement["client".concat(M)];if(T(this[0]))return c1(this[0],M);return this[0]["".concat(H?"offset":"client").concat(M)]+(N&&H?q0(this[0],"margin".concat(z?"Top":"Left"))+q0(this[0],"margin".concat(z?"Bottom":"Right")):0)}})}),b(["Width","Height"],function(J,H){var z=H.toLowerCase();w[z]=function(M){if(!this[0])return _(M)?void 0:this;if(!arguments.length){if(C(this[0]))return this[0].document.documentElement["client".concat(H)];if(T(this[0]))return c1(this[0],H);return this[0].getBoundingClientRect()[z]-v0(this[0],!J)}var I=parseInt(M,10);return this.each(function(N,f){if(!P(f))return;var m=n(f,"boxSizing");f.style[z]=u1(z,I+(m==="border-box"?v0(f,!J):0))})}});var p1="___cd";w.toggle=function(J){return this.each(function(H,z){if(!P(z))return;var M=K0(z),I=_(J)?M:J;if(I){if(z.style.display=z[p1]||"",K0(z))z.style.display=C0(z.tagName)}else if(!M)z[p1]=n(z,"display"),z.style.display="none"})},w.hide=function(){return this.toggle(!1)},w.show=function(){return this.toggle(!0)};var o1="___ce",I1=".",L1={focus:"focusin",blur:"focusout"},s1={mouseenter:"mouseover",mouseleave:"mouseout"},o5=/^(mouse|pointer|contextmenu|drag|drop|click|dblclick)/i;function V1(J){return s1[J]||L1[J]||J}function N1(J){var H=J.split(I1);return[H[0],H.slice(1).sort()]}w.trigger=function(J,H){if(S(J)){var z=N1(J),M=z[0],I=z[1],N=V1(M);if(!N)return this;var f=o5.test(N)?"MouseEvents":"HTMLEvents";J=Z.createEvent(f),J.initEvent(N,!0,!0),J.namespace=I.join(I1),J.___ot=M}J.___td=H;var m=J.___ot in L1;return this.each(function(U0,W0){if(m&&V(W0[J.___ot]))W0["___i".concat(J.type)]=!0,W0[J.___ot](),W0["___i".concat(J.type)]=!1;W0.dispatchEvent(J)})};function l1(J){return J[o1]=J[o1]||{}}function s5(J,H,z,M,I){var N=l1(J);N[H]=N[H]||[],N[H].push([z,M,I]),J.addEventListener(H,I)}function r1(J,H){return!H||!e.call(H,function(z){return J.indexOf(z)<0})}function p0(J,H,z,M,I){var N=l1(J);if(!H)for(H in N)p0(J,H,z,M,I);else if(N[H])N[H]=N[H].filter(function(f){var m=f[0],U0=f[1],W0=f[2];if(I&&W0.guid!==I.guid||!r1(m,z)||M&&M!==U0)return!0;J.removeEventListener(H,W0)})}w.off=function(J,H,z){var M=this;if(_(J))this.each(function(N,f){if(!P(f)&&!T(f)&&!C(f))return;p0(f)});else if(!S(J))for(var I in J)this.off(I,J[I]);else{if(V(H))z=H,H="";b(p(J),function(N,f){var m=N1(f),U0=m[0],W0=m[1],Y0=V1(U0);M.each(function($0,M0){if(!P(M0)&&!T(M0)&&!C(M0))return;p0(M0,Y0,W0,H,z)})})}return this},w.remove=function(J){return P0(this,J).detach().off(),this},w.replaceWith=function(J){return this.before(J).remove()},w.replaceAll=function(J){return U(J).replaceWith(this),this};function l5(J,H,z,M,I){var N=this;if(!S(J)){for(var f in J)this.on(f,H,z,J[f],I);return this}if(!S(H))if(_(H)||R(H))H="";else if(_(z))z=H,H="";else M=z,z=H,H="";if(!V(M))M=z,z=void 0;if(!M)return this;return b(p(J),function(m,U0){var W0=N1(U0),Y0=W0[0],$0=W0[1],M0=V1(Y0),o0=Y0 in s1,C1=Y0 in L1;if(!M0)return;N.each(function(P1,B0){if(!P(B0)&&!T(B0)&&!C(B0))return;var S1=function(X0){if(X0.target["___i".concat(X0.type)])return X0.stopImmediatePropagation();if(X0.namespace&&!r1($0,X0.namespace.split(I1)))return;if(!H&&(C1&&(X0.target!==B0||X0.___ot===M0)||o0&&X0.relatedTarget&&B0.contains(X0.relatedTarget)))return;var E1=B0;if(H){var x0=X0.target;while(!_0(x0,H)){if(x0===B0)return;if(x0=x0.parentNode,!x0)return}E1=x0}Object.defineProperty(X0,"currentTarget",{configurable:!0,get:function(){return E1}}),Object.defineProperty(X0,"delegateTarget",{configurable:!0,get:function(){return B0}}),Object.defineProperty(X0,"data",{configurable:!0,get:function(){return z}});var e5=M.call(E1,X0,X0.___td);if(I)p0(B0,M0,$0,H,S1);if(e5===!1)X0.preventDefault(),X0.stopPropagation()};S1.guid=M.guid=M.guid||U.guid++,s5(B0,M0,$0,H,S1)})}),this}w.on=l5;function r5(J,H,z,M){return this.on(J,H,z,M,!0)}w.one=r5;var n5=/\r?\n/g;function t5(J,H){return"&".concat(encodeURIComponent(J),"=").concat(encodeURIComponent(H.replace(n5,"\r\n")))}var a5=/file|reset|submit|button|image/i,n1=/radio|checkbox/i;if(w.serialize=function(){var J="";return this.each(function(H,z){b(z.elements||[z],function(M,I){if(I.disabled||!I.name||I.tagName==="FIELDSET"||a5.test(I.type)||n1.test(I.type)&&!I.checked)return;var N=v1(I);if(!_(N)){var f=D(N)?N:[N];b(f,function(m,U0){J+=t5(I.name,U0)})}})}),J.slice(1)},typeof t1!=="undefined")a1.exports=U;else Q.cash=Q.$=U})()});var e1=s0(u0(),1);class l0{default=window.navigator.language;LANGUAGE_DICTIONARIES={};setLang(Z){if(this.default!==Z)return this.default=Z,!0;return!1}setDictionary(Z,Q){this.LANGUAGE_DICTIONARIES[Z]=Q}translate(Z,Q){if(Q&&this.default==Q)return{text:Z,lang:this.default};Q=Q||this.default;const[W,q]=Q.split("-");if(this.LANGUAGE_DICTIONARIES[W]&&Z in this.LANGUAGE_DICTIONARIES[W]){if(typeof this.LANGUAGE_DICTIONARIES[W][Z]==="object"){const Y=this.LANGUAGE_DICTIONARIES[W][Z];Z=Y[q||"*"]||Y["*"]}else if(typeof this.LANGUAGE_DICTIONARIES[W][Z]==="string")Z=this.LANGUAGE_DICTIONARIES[W][Z]}return{text:Z,lang:Q}}propagate(Z){const Q=this;function W(){const q=e1.default(this),Y=q.html(),B=q.attr("title"),G=q.attr("placeholder");let X;if(!/<\//.test(Y)&&q.text()){const{text:D,lang:O}=Q.translate(q.text());q.text(D),X=O}if(B){const{text:D,lang:O}=Q.translate(B);q.attr("title",D),X=O}if(G){const{text:D,lang:O}=Q.translate(G);q.attr("placeholder",D),X=O}X&&q.attr("lang",X)}return Z.children().each(W),Z}}class r0{pendingComponents=new Set;isPending=!1;callbacks=new Map;register(Z,Q){this.callbacks.set(Z,Q)}unregister(Z){this.callbacks.delete(Z)}queue(Z){if(!this.callbacks.has(Z))return;if(this.pendingComponents.add(Z),!this.isPending)this.isPending=!0,this.schedule()}schedule(){Promise.resolve().then(()=>this.process())}process(){const Z=Array.from(this.pendingComponents);this.pendingComponents.clear(),this.isPending=!1,Z.forEach((Q)=>{try{const W=this.callbacks.get(Q);if(W)W()}catch(W){console.error(`Error updating component ${Q}:`,W)}})}clear(){this.pendingComponents.clear(),this.isPending=!1}dispose(){this.pendingComponents.clear(),this.callbacks.clear(),this.isPending=!1}}class n0{subscriptions=new Map;tick=new r0;register(Z,Q){this.subscriptions.set(Z,Q),this.tick.register(Z,Q)}unregister(Z){this.subscriptions.delete(Z),this.tick.unregister(Z)}queueUpdate(Z){this.tick.queue(Z)}dispose(){this.subscriptions.clear(),this.tick.dispose()}prepareForPotentialUnload(){this.tick.clear(),this.subscriptions.forEach((Z,Q)=>{this.subscriptions.set(Q,()=>{})})}proxyState(Z,Q){const W=this,q=new WeakMap,Y=(G)=>{if(G instanceof Map)G.forEach((D,O)=>G.set(O,B(D)));else if(Array.isArray(G))G.forEach((D,O)=>G[O]=B(D));else if(typeof G==="object")Object.entries(G).forEach(([D,O])=>G[D]=B(O));let X=new Proxy(G,{get(D,O){if(O==="toJSON")return function(){const E=(x)=>{if(!x||typeof x!=="object")return x;if(q.has(x)){const A=q.get(x);if(A instanceof Map){const i={};return A.forEach((e,r)=>i[typeof r==="object"?JSON.stringify(r):String(r)]=E(e)),i}if(Array.isArray(A))return A.map((i)=>E(i));const u={};return Object.entries(A).forEach(([i,e])=>u[i]=E(e)),u}if(typeof x.toJSON==="function"&&!q.has(x))return x.toJSON();return x};return E(X)};if(O==="reset")return function(){X=null};const j=D[O];if(G instanceof Map&&typeof j==="function")return function(...E){const x=O.toString();if(x==="set"&&E.length>=2)E[1]=B(E[1]);const A=j.apply(D,E);return["set","delete","clear"].includes(x)&&W.queueUpdate(Z),A};if(Array.isArray(G)&&typeof j==="function")return function(...E){const x=O.toString();if(["push","unshift"].includes(x))E=E.map((u)=>B(u));else if(x==="splice"&&E.length>2)E=[E[0],E[1],...E.slice(2).map((u)=>B(u))];const A=j.apply(D,E);return["push","pop","shift","unshift","splice","sort","reverse","fill"].includes(x)&&W.queueUpdate(Z),A};return j},set(D,O,j){if(D[O]===j)return!0;if(j instanceof Map&&D[O]instanceof Map){const E=D[O];return E.clear(),j.forEach((x,A)=>E.set(A,B(x))),W.queueUpdate(Z),!0}return D[O]=B(j),W.queueUpdate(Z),!0}});return q.set(X,G),X},B=(G)=>{if(!G)return G;return G instanceof Map||Array.isArray(G)||typeof G==="object"?Y(G):G};return Y(Q)}}class t0{domObserver;observedComponents=new Map;TIMEOUT=1e4;constructor(){this.domObserver=new MutationObserver(()=>{this.observedComponents.forEach((Z,Q)=>{try{const W=Q.node;if(!W){this.unwatch(Q);return}if(Z.type==="attach"&&document.contains(W[0]))this.unwatch(Q),Q.emit("component:attached",Q),typeof Q.onAttach=="function"&&Q.onAttach.bind(Q)();else if(Z.type==="detach"&&!document.contains(W[0]))this.unwatch(Q),Q.emit("component:detached",Q),typeof Q.onDetach=="function"&&Q.onDetach.bind(Q)()}catch(W){console.log("DWS error --",W)}}),!this.observedComponents.size&&this.domObserver.disconnect()})}watch(Z,Q="attach"){const W=Z.node;if(!W)return;if(Q==="attach"&&document.contains(W[0])){Z.emit("component:attached",Z),typeof Z.onAttach=="function"&&Z.onAttach.bind(Z)();return}if(Q==="detach"&&!document.contains(W[0])){Z.emit("component:detached",Z),typeof Z.onDetach=="function"&&Z.onDetach.bind(Z)();return}this.unwatch(Z);const q=setTimeout(()=>{this.unwatch(Z),Z.emit(`component:${Q}ment-timeout`,Z)},this.TIMEOUT);this.observedComponents.set(Z,{timeout:q,type:Q}),this.observedComponents.size===1&&this.domObserver.observe(document.body,{childList:!0,subtree:!0}),Q==="attach"&&Z.once("component:attached",()=>this.watch(Z,"detach"))}unwatch(Z){const Q=this.observedComponents.get(Z);if(Q)clearTimeout(Q.timeout),this.observedComponents.delete(Z);!this.observedComponents.size&&this.domObserver.disconnect()}dispose(){this.domObserver.disconnect(),this.observedComponents.forEach((Z)=>clearTimeout(Z.timeout)),this.observedComponents.clear()}}class a0{pending=new Set;isPending=!1;component;metrics={batchCount:0,updatesProcessed:0,lastBatchSize:0,avgBatchSize:"0.00"};constructor(Z){this.component=Z}queue(Z){if(this.pending.add(Z),this.component.benchmark.inc("dependencyUpdateCount"),!this.isPending)this.isPending=!0,this.scheduleProcessing()}scheduleProcessing(){Promise.resolve().then(()=>this.processQueue())}processQueue(){const Z=Array.from(this.pending);if(this.metrics.batchCount++,this.metrics.lastBatchSize=Z.length,this.metrics.updatesProcessed+=Z.length,this.metrics.avgBatchSize=(this.metrics.updatesProcessed/this.metrics.batchCount).toFixed(2),this.pending.clear(),this.component.benchmark.trackBatch(Z.length),this.applyUpdates(Z),this.isPending=!1,this.pending.size>0)this.isPending=!0,this.scheduleProcessing()}applyUpdates(Z){Z.forEach(({dep:Q,dependent:W})=>{try{const q=W.update(W.memo,"batch-updator");if(q)typeof q.memo==="object"&&this.component.FGUD.get(Q)?.set(W.path,{...W,memo:q.memo}),typeof q.cleanup==="function"&&q.cleanup()}catch(q){console.error("Failed to update dependency --",q)}})}getMetrics(){return{batchCount:this.metrics.batchCount,lastBatchSize:this.metrics.lastBatchSize,avgBatchSize:this.metrics.avgBatchSize,totalUpdates:this.metrics.updatesProcessed}}}class e0{options={emit:!0};__events={};__once_events={};constructor(Z){if(Z)this.options=Z}on(Z,Q){if(!Array.isArray(this.__events[Z]))this.__events[Z]=[];return this.__events[Z].push(Q),this}once(Z,Q){if(!Array.isArray(this.__once_events[Z]))this.__once_events[Z]=[];return this.__once_events[Z].push(Q),this}off(Z){return delete this.__events[Z],delete this.__once_events[Z],this}emit(Z,...Q){if(!this.options.emit)return;const W=Q.map((q)=>typeof q.toJSON==="function"?q.toJSON():q);this.__events[Z]?.forEach((q)=>q(...W)),this.__once_events[Z]?.forEach((q)=>q(...W)),delete this.__once_events[Z]}}var t=s0(u0(),1);var R1=s0(u0(),1);function H0(Z,Q){if(Z===Q)return!1;if(typeof Z!=="object"||typeof Q!=="object")return!1;if(Z===null||Q===null)return!0;if(Z instanceof Set){if(!(Q instanceof Set))return!0;if(Z.size!==Q.size)return!0;if(Z5(Z)&&Z5(Q)){for(let G of Z)if(!Q.has(G))return!0;return!1}const B=new WeakMap;for(let G of Z){let X=!1;if(typeof G!=="object"){if(Q.has(G))X=!0}else for(let D of Q){if(typeof D!=="object")continue;if(!B.has(G))B.set(G,new WeakMap);const O=B.get(G);if(O.has(D)){if(X=O.get(D),X)break;continue}const j=!H0(G,D);if(O.set(D,j),j){X=!0;break}}if(!X)return!0}return!1}if(Z instanceof Map){if(!(Q instanceof Map))return!0;if(Z.size!==Q.size)return!0;if(J5(Z)&&J5(Q)){for(let[G,X]of Z)if(Q.get(G)!==X)return!0;return!1}const B=new WeakMap;for(let[G,X]of Z){if(typeof G!=="object"){if(!Q.has(G))return!0;const j=Q.get(G);if(typeof X!=="object"){if(X!==j)return!0;continue}if(typeof j!=="object"||H0(X,j))return!0;continue}let D=!1,O=!1;for(let[j,E]of Q){if(typeof j!=="object")continue;if(!B.has(G))B.set(G,new WeakMap);const x=B.get(G);if(x.has(j)){const[A,u]=x.get(j);if(A){D=!0,O=u;break}continue}if(!H0(G,j)){if(D=!0,O=typeof X==="object"&&typeof E==="object"?!H0(X,E):X===E,x.set(j,[!0,O]),O)break}else x.set(j,[!1,!1])}if(!D||!O)return!0}return!1}if(Array.isArray(Z)){if(!Array.isArray(Q))return!0;if(Z.length!==Q.length)return!0;for(let B=0;B<Z.length;B++){const G=Z[B],X=Q[B];if(G!==X&&(typeof G!=="object"||H0(G,X)))return!0}return!1}const W=Object.keys(Z),q=Object.keys(Q);if(W.length!==q.length)return!0;W.sort(),q.sort();const Y=W.length;for(let B=0;B<Y;B++)if(W[B]!==q[B])return!0;for(let B=0;B<Y;B++){const G=W[B],X=Z[G],D=Q[G];if(X===D)continue;if(X instanceof Date){if(!(D instanceof Date)||String(X)!==String(D))return!0;continue}if(X instanceof RegExp){if(!(D instanceof RegExp)||X.source!==D.source||X.flags!==D.flags)return!0;continue}if(X instanceof Map){if(!(D instanceof Map)||H0(X,D))return!0;continue}if(X instanceof Set){if(!(D instanceof Set)||H0(X,D))return!0;continue}if(X instanceof Function){if(!(D instanceof Function))return!0;continue}if(typeof X==="object"){if(typeof D!=="object")return!0;if(X===Z){if(D!==Q)return!0}else if(H0(X,D))return!0}else return!0}return!1}function E0(Z,Q){if(Z===Q)return!0;if(Z==null||Q==null)return Z===Q;const W=typeof Z;if(W!==typeof Q)return!1;if(W!=="object"){if(W==="number"&&isNaN(Z)&&isNaN(Q))return!0;return!1}if(Z instanceof Date)return Q instanceof Date&&Z.getTime()===Q.getTime();if(Z instanceof RegExp)return Q instanceof RegExp&&Z.source===Q.source&&Z.flags===Q.flags;if(Z instanceof Error)return Q instanceof Error&&Z.name===Q.name&&Z.message===Q.message&&(Z.stack===Q.stack||!Z.stack&&!Q.stack);if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView(Z)){if(!ArrayBuffer.isView(Q))return!1;if(Z.byteLength!==Q.byteLength)return!1;const X=new Uint8Array(Z.buffer,Z.byteOffset,Z.byteLength),D=new Uint8Array(Q.buffer,Q.byteOffset,Q.byteLength);for(let O=0;O<X.length;O++)if(X[O]!==D[O])return!1;return!0}if(Z instanceof Promise||Z instanceof WeakMap||Z instanceof WeakSet)return Z===Q;if(typeof Z==="function"){if(typeof Q!=="function")return!1;return Z.toString()===Q.toString()&&Z.name===Q.name}if(Z.constructor!==Q.constructor)return!1;if(Z instanceof Map||Z instanceof Set||Array.isArray(Z)||Object.getPrototypeOf(Z)===Object.prototype)return!H0(Z,Q);const Y=Object.getPrototypeOf(Z);if(Y!==Object.getPrototypeOf(Q))return!1;const B=Object.getOwnPropertyNames(Z),G=Object.getOwnPropertyNames(Q);if(B.length!==G.length)return!1;for(let X of B){if(!Object.prototype.hasOwnProperty.call(Q,X))return!1;if(!E0(Z[X],Q[X]))return!1}if(Y!==null&&Y!==Object.prototype){const X=Object.getOwnPropertyNames(Y),D=Object.getOwnPropertyNames(Object.getPrototypeOf(Q));if(X.length!==D.length)return!1;for(let O of X){if(O==="constructor")continue;if(!E0(Y[O],Object.getPrototypeOf(Q)[O]))return!1}}return!0}var Z5=function(Z){for(let Q of Z)if(typeof Q==="object"&&Q!==null)return!1;return!0},J5=function(Z){for(let[Q,W]of Z)if(typeof Q==="object"&&Q!==null||typeof W==="object"&&W!==null)return!1;return!0};function J0(Z,Q=new WeakMap){if(Z===null||typeof Z!=="object"||Z instanceof Promise)return Z;if(Q.has(Z))return Q.get(Z);if(Z instanceof Date)return new Date(Z.getTime());if(Z instanceof RegExp)return new RegExp(Z.source,Z.flags);if(Z instanceof Map){const Y=new Map;return Q.set(Z,Y),Z.forEach((B,G)=>Y.set(J0(G,Q),J0(B,Q))),Y}if(Z instanceof Set){const Y=new Set;return Q.set(Z,Y),Z.forEach((B)=>Y.add(J0(B,Q))),Y}if(Array.isArray(Z)){const Y=[];Q.set(Z,Y);for(let B=0;B<Z.length;B++)Y[B]=J0(Z[B],Q);return Y}if(ArrayBuffer.isView(Z))return new Z.constructor(Z);const W=Object.create(Object.getPrototypeOf(Z));Q.set(Z,W);const q=Object.getOwnPropertySymbols(Z);for(let Y of q)W[Y]=J0(Z[Y],Q);for(let Y in Z)if(Object.prototype.hasOwnProperty.call(Z,Y))W[Y]=J0(Z[Y],Q);return W}function W5(Z,Q){if(!Z||typeof Z!=="object")throw new TypeError("Original argument must be an object");if(!Q||typeof Q!=="object")throw new TypeError("ToSet argument must be an object");if(!Object.keys(Q).length)return{...Z};function W(Y,B,G){const X=B.split(/\.|\[|\]/).filter(Boolean);let D=Y;for(let O=0;O<X.length;O++){const j=X[O],E=!isNaN(Number(j)),x=O===X.length-1,A=!isNaN(Number(X[O+1]));if(x){D[j]=G;continue}if(!(j in D))D[j]=A?[]:{};else if(A&&!Array.isArray(D[j]))D[j]=[];else if(!A&&Array.isArray(D[j]))D[j]={};D=D[j]}}const q=J0(Z);try{for(let[Y,B]of Object.entries(Q)){if(typeof Y!=="string")throw new TypeError(`Invalid path: ${Y}`);if(!/^[a-zA-Z0-9_\-\[\].]+$/.test(Y))throw new Error(`Invalid path format: ${Y}`);W(q,Y,B)}}catch(Y){throw new Error(`Failed to assign value: ${Y.message}`)}return q}R1.default.fn.extend({attrs:function(){const Z={},Q=this[0];return Q&&Q.nodeType!==Node.TEXT_NODE&&R1.default.each(Q.attributes,function(){Z[this.name]=this.value}),Z}});var I0="syn:",O0="fn:",A0="on-",a=/^\.\.\./,Z1=/^\[(.*?)\]$/,Q5=["@html","@text"];class J1{debug;initialStats={renderCount:0,elementCount:0,renderTime:0,avgRenderTime:0,maxRenderTime:0,componentCount:0,componentUpdateCount:0,partialCount:0,partialUpdateCount:0,memoryUsage:void 0,domOperations:0,domInsertsCount:0,domUpdatesCount:0,domRemovalsCount:0,dependencyTrackCount:0,dependencyUpdateCount:0,batchSize:0,batchCount:0,errorCount:0};stats=this.reset();renderStartTime=0;renderTimes=[];measurementCount=0;maxMeasurements=100;loggingInterval=10;autoSaveInterval;constructor(Z=!1){if(this.debug=Z,this.debug)this.autoSaveInterval=window.setInterval(()=>this.storeMetrics(),5000)}storeMetrics(){try{const Z=JSON.parse(localStorage.getItem("lipsPerformanceMetrics")||"[]");Z.push({timestamp:Date.now(),metrics:{...this.stats}}),Z.length>100&&Z.shift(),localStorage.setItem("lipsPerformanceMetrics",JSON.stringify(Z))}catch(Z){}}startRender(){if(!this.debug)return;this.renderStartTime=performance.now()}endRender(){if(!this.debug||this.renderStartTime===0)return;const Z=performance.now()-this.renderStartTime;this.stats.renderTime=Z,this.stats.maxRenderTime=Math.max(this.stats.maxRenderTime,Z),this.renderTimes.push(Z),this.renderTimes.length>this.maxMeasurements&&this.renderTimes.shift(),this.stats.avgRenderTime=this.renderTimes.reduce((Q,W)=>Q+W,0)/this.renderTimes.length,this.renderStartTime=0,this.measurementCount++}inc(Z){if(!this.debug)return;if(typeof this.stats[Z]==="number")this.stats[Z]++}dec(Z){if(!this.debug)return;if(typeof this.stats[Z]==="number"&&this.stats[Z]>0)this.stats[Z]--}record(Z,Q){if(!this.debug)return;if(typeof this.stats[Z]!=="undefined")this.stats[Z]=Q}add(Z,Q){if(!this.debug)return;if(typeof this.stats[Z]==="number")this.stats[Z]+=Q}reset(){return this.renderTimes=[],this.measurementCount=0,this.stats=J0(this.initialStats)}log(){if(!this.debug)return;if(this.loggingInterval>1&&this.measurementCount%this.loggingInterval!==0)return;const Z={"Render Count":this.stats.renderCount,"Element Count":this.stats.elementCount,"Avg Render Time (ms)":this.stats.avgRenderTime.toFixed(2),"Max Render Time (ms)":this.stats.maxRenderTime.toFixed(2)},Q={"Component Count":this.stats.componentCount,"Component Updates":this.stats.componentUpdateCount},W={"Partial Count":this.stats.partialCount,"Partial Updates":this.stats.partialUpdateCount},q={"DOM Operations":this.stats.domOperations,"DOM Inserts":this.stats.domInsertsCount,"DOM Updates":this.stats.domUpdatesCount,"DOM Removals":this.stats.domRemovalsCount},Y={"Dependencies Tracked":this.stats.dependencyTrackCount,"Dependency Updates":this.stats.dependencyUpdateCount},B={"Batch Count":this.stats.batchCount,"Avg Batch Size":this.stats.batchCount>0?(this.stats.batchSize/this.stats.batchCount).toFixed(2):"0"};console.group("Lips Framework Performance Metrics"),console.table(Z),console.table(Q),console.table(W),console.table(q),console.table(Y),console.table(B),this.stats.memoryUsage&&console.log(`Memory Usage: ${this.stats.memoryUsage.toFixed(2)} MB`),this.stats.errorCount>0&&console.warn(`Errors encountered: ${this.stats.errorCount}`),console.groupEnd(),window.localStorage&&this.measurementCount%10===0&&this.storeMetrics()}trackMemory(){if(!this.debug||!window.performance?.memory)return;this.stats.memoryUsage=window.performance.memory.usedJSHeapSize/1048576}trackBatch(Z){if(!this.debug)return;this.stats.batchCount++,this.stats.batchSize+=Z}trackError(Z){if(!this.debug)return;this.stats.errorCount++,console.error("Lips Framework Error:",Z)}setLoggingInterval(Z){if(!this.debug)return;this.loggingInterval=Z}getSnapshot(){return J0(this.stats)}dispose(){if(!this.debug)return;this.autoSaveInterval&&clearInterval(this.autoSaveInterval)}}var C5=s0(u0(),1);var Q1="comm",W1="rule",X1="decl";var X5="@import";var H5="@namespace",q5="@keyframes";var z5="@layer";function H1(Z){return Z.trim()}function b0(Z,Q,W){return Z.replace(Q,W)}function Y5(Z,Q,W){return Z.indexOf(Q,W)}function L0(Z,Q){return Z.charCodeAt(Q)|0}function V0(Z,Q,W){return Z.slice(Q,W)}function z0(Z){return Z.length}function q1(Z){return Z.length}function h0(Z,Q){return Q.push(Z),Z}var $1=Math.abs,d0=String.fromCharCode;function Y1(Z,Q,W,q,Y,B,G,X){return{value:Z,root:Q,parent:W,type:q,props:Y,children:B,line:z1,column:f0,length:G,return:"",siblings:X}}function G5(){return Q0}function w5(){if(Q0=G0>0?L0(k0,--G0):0,f0--,Q0===10)f0=1,z1--;return Q0}function w0(){if(Q0=G0<B5?L0(k0,G0++):0,f0++,Q0===10)f0=1,z1++;return Q0}function N0(){return L0(k0,G0)}function i0(){return G0}function B1(Z,Q){return V0(k0,Z,Q)}function g0(Z){switch(Z){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function K5(Z){return z1=f0=1,B5=z0(k0=Z),G0=0,[]}function U5(Z){return k0="",Z}function G1(Z){return H1(B1(G0-1,A1(Z===91?Z+2:Z===40?Z+1:Z)))}function M5(Z){while(Q0=N0())if(Q0<33)w0();else break;return g0(Z)>2||g0(Q0)>3?"":" "}function O5(Z,Q){while(--Q&&w0())if(Q0<48||Q0>102||Q0>57&&Q0<65||Q0>70&&Q0<97)break;return B1(Z,i0()+(Q<6&&N0()==32&&w0()==32))}function A1(Z){while(w0())switch(Q0){case Z:return G0;case 34:case 39:if(Z!==34&&Z!==39)A1(Q0);break;case 40:if(Z===41)A1(Z);break;case 92:w0();break}return G0}function D5(Z,Q){while(w0())if(Z+Q0===57)break;else if(Z+Q0===84&&N0()===47)break;return"/*"+B1(Q,G0-1)+"*"+d0(Z===47?Z:w0())}function j5(Z){while(!g0(N0()))w0();return B1(Z,G0)}var z1=1,f0=1,B5=0,G0=0,Q0=0,k0="";function L5(Z){return U5(w1("",null,null,null,[""],Z=K5(Z),0,[0],Z))}function w1(Z,Q,W,q,Y,B,G,X,D){var O=0,j=0,E=G,x=0,A=0,u=0,i=1,e=1,r=1,c=0,d="",k=Y,y=B,$=q,K=d;while(e)switch(u=c,c=w0()){case 40:if(u!=108&&L0(K,E-1)==58){if(Y5(K+=b0(G1(c),"&","&\f"),"&\f",$1(O?X[O-1]:0))!=-1)r=-1;break}case 34:case 39:case 91:K+=G1(c);break;case 9:case 10:case 13:case 32:K+=M5(u);break;case 92:K+=O5(i0()-1,7);continue;case 47:switch(N0()){case 42:case 47:if(h0(qZ(D5(w0(),i0()),Q,W,D),D),(g0(u||1)==5||g0(N0()||1)==5)&&z0(K)&&V0(K,-1,void 0)!==" ")K+=" ";break;default:K+="/"}break;case 123*i:X[O++]=z0(K)*r;case 125*i:case 59:case 0:switch(c){case 0:case 125:e=0;case 59+j:if(r==-1)K=b0(K,/\f/g,"");if(A>0&&(z0(K)-E||i===0&&u===47))h0(A>32?I5(K+";",q,W,E-1,D):I5(b0(K," ","")+";",q,W,E-2,D),D);break;case 59:K+=";";default:if(h0($=F5(K,Q,W,O,j,Y,X,d,k=[],y=[],E,B),B),c===123)if(j===0)w1(K,Q,$,$,k,B,E,X,y);else{switch(x){case 99:if(L0(K,3)===110)break;case 108:if(L0(K,2)===97)break;default:j=0;case 100:case 109:case 115:}if(j)w1(Z,$,$,q&&h0(F5(Z,$,$,0,0,Y,X,d,Y,k=[],E,y),y),Y,y,E,X,q?k:y);else w1(K,$,$,$,[""],y,0,X,y)}}O=j=A=0,i=r=1,d=K="",E=G;break;case 58:E=1+z0(K),A=u;default:if(i<1){if(c==123)--i;else if(c==125&&i++==0&&w5()==125)continue}switch(K+=d0(c),c*i){case 38:r=j>0?1:(K+="\f",-1);break;case 44:X[O++]=(z0(K)-1)*r,r=1;break;case 64:if(N0()===45)K+=G1(w0());x=N0(),j=E=z0(d=K+=j5(i0())),c++;break;case 45:if(u===45&&z0(K)==2)i=0}}return B}function F5(Z,Q,W,q,Y,B,G,X,D,O,j,E){var x=Y-1,A=Y===0?B:[""],u=q1(A);for(var i=0,e=0,r=0;i<q;++i)for(var c=0,d=V0(Z,x+1,x=$1(e=G[i])),k=Z;c<u;++c)if(k=H1(e>0?A[c]+" "+d:b0(d,/&\f/g,A[c])))D[r++]=k;return Y1(Z,Q,W,Y===0?W1:X,D,O,j,E)}function qZ(Z,Q,W,q){return Y1(Z,Q,W,Q1,d0(G5()),V0(Z,2,-2),0,q)}function I5(Z,Q,W,q,Y){return Y1(Z,Q,W,X1,V0(Z,0,q),V0(Z,q+1,-1),q,Y)}function K1(Z,Q){var W="";for(var q=0;q<Z.length;q++)W+=Q(Z[q],q,Z,Q)||"";return W}function V5(Z,Q,W,q){switch(Z.type){case z5:if(Z.children.length)break;case X5:case H5:case X1:return Z.return=Z.return||Z.value;case Q1:return"";case q5:return Z.return=Z.value+"{"+K1(Z.children,q)+"}";case W1:if(!z0(Z.value=Z.props.join(",")))return""}return z0(W=K1(Z.children,q))?Z.return=Z.value+"{"+W+"}":""}function N5(Z){var Q=q1(Z);return function(W,q,Y,B){var G="";for(var X=0;X<Q;X++)G+=Z[X](W,q,Y,B)||"";return G}}class U1{nsp;settings;$head;constructor(Z,Q){if(typeof Z!=="string")throw new Error("Undefined or invalid styles attachement element(s) namespace");this.nsp=Z,this.$head=C5.default("head"),this.settings=Q||{},this.settings&&this.load(this.settings)}compile(Z){try{return K1(L5(Z),N5([V5]))}catch(Q){throw new Error(`Style compilation failed: ${Q.message}`)}}waitForStyles(Z){return new Promise((Q)=>{const W=new MutationObserver(()=>{const q=document.querySelector(Z);if(q&&getComputedStyle(q).cssText)W.disconnect(),Q()});W.observe(document.documentElement,{attributes:!0,childList:!0,subtree:!0})})}async inject(Z){if(!Z)throw new Error("Invalid injection arguments");const Q=`rel="${this.settings.meta?"@":""}${this.nsp}"`;Z=this.settings.meta?Z:`[rel="${this.nsp}"] { ${Z} }`;try{const W=this.compile(Z);if(!W)throw new Error(`<component:${this.nsp}> sheet compilation failed`);const q=document.createElement("style");q.setAttribute("rel",`${this.settings.meta?"@":""}${this.nsp}`),q.textContent=W;let Y=0;const B=this.$head.find(`style[${Q}]`);if(B.length)Y=parseInt(B.attr("dindex"))+1,B.remove();return q.setAttribute("dindex",String(Y)),this.settings.meta?document.head.prepend(q):document.head.appendChild(q),q}catch(W){throw new Error(`Style injection failed: ${W.message}`)}}async load(Z){if(this.settings=Z,typeof this.settings!=="object")throw new Error("Undefined styles settings");if(this.settings.sheet){const Q=await this.inject(this.settings.sheet);await this.waitForStyles(`style[rel="${this.settings.meta?"@":""}${this.nsp}"]`)}}get(){}async clear(){const Z=this.$head.find(`style[rel="${this.settings.meta?"@":""}${this.nsp}"]`);if(!Z.length)return;const Q=parseInt(Z.attr("dindex"));Q===0?Z.remove():Z.attr("dindex",String(Q-1))}async custom(){return{}}async style(){return{}}}var zZ=function(Z){const Q=/on-([a-zA-Z-]+)\s*\(/g;let W=Z,q;while((q=Q.exec(Z))!==null){const Y=q[1],B=q.index+q[0].length;let G=1,X=B;while(X<Z.length&&G>0){if(Z[X]==="(")G++;if(Z[X]===")")G--;X++}if(G===0){const D=Z.slice(B,X-1).trim(),O=Z.slice(0,q.index),j=`${A0}${Y}="${D}"`,E=Z.slice(X);W=O+j+E,Z=W,Q.lastIndex=O.length+j.length}}return W},YZ=function(Z){const Q=[];let q=Z.replace(/<([a-zA-Z][a-zA-Z0-9_-]*)((?:[^>'"]*|'[^']*'|"[^"]*")*?)(?:\/?>)/g,(Y,B,G)=>{return Q.push(G),`<${B}##TAG_ATTRS_${Q.length-1}##>`});for(let Y=0;Y<Q.length;Y++){const B=`##TAG_ATTRS_${Y}##`,G=Q[Y],X=BZ(G);q=q.replace(B,X)}return q},BZ=function(Z){let Q="",W=0,q=!1,Y="",B=0,G=0,X=0;while(W<Z.length){const D=Z[W];if((D==='"'||D==="'")&&(W===0||Z[W-1]!=="\\")){if(!q)q=!0,Y=D;else if(D===Y)q=!1}if(!q){if(D==="(")G++;else if(D===")")G--;else if(D==="{")X++;else if(D==="}")X--}if(!q&&G===0&&X===0&&(D===" "||W===Z.length-1)){let O=W;if(W===Z.length-1)O=W+1;const j=Z.substring(B,O).trim();if(j){const E=GZ(j);Q+=" "+E}B=W+1}W++}return Q},GZ=function(Z){const Q=Z.indexOf("=");if(Q===-1){if(Z.startsWith("...")||Z.startsWith("["))return Z;return`:${Z}="${!Z.startsWith("!")}"`}let W=Z.substring(0,Q).trim(),q=Z.substring(Q+1).trim();if(W.startsWith("@"))return W=!Q5.includes(W)?W.slice(1):W,`:${W}=${q}`;if(W.startsWith(O0)||W.startsWith(A0))return Z;if(q.startsWith('"')&&q.endsWith('"')||q.startsWith("'")&&q.endsWith("'")){const Y=q.substring(1,q.length-1);if(wZ(Y))return`:${W}="${Y}"`;return Z}else return`:${W}="${q}"`};function wZ(Z){if(/\bstate\.|\binput\.|\bself\.|\bcontext\./.test(Z))return!0;if(/[\+\*\/\%\(\)\{\}\[\]]|\?\s*:/.test(Z))return!0;if(/\b[a-zA-Z_][a-zA-Z0-9_]*\.[a-zA-Z_]/.test(Z))return!0;if(Z.includes("{")&&Z.includes("}"))return!0;return!1}function _1(Z){let Q=(Z||"").trim().replace(/>\s*</g,"><").replace(/\s{2,}/g," ").replace(/[\r\n\t]/g,"").replace(/<([a-zA-Z0-9_-]+)([^>]*?)\s*\/>/g,"<$1$2></$1>").replace(/<\{([^}]+)\}\s*(.*?)\/>/g,'<lips dtag="$1" $2></lips>').replace(/(<>)([\s\S]*?)(<\/>)/g,'<lips fragment="true">$2</lips>').replace(/<if\(\s*(.*?)\s*\)>/g,'<if @by="$1">').replace(/<else-if\(\s*(.*?)\s*\)>/g,'<else-if @by="$1">').replace(/<switch\(\s*(.*?)\s*\)>/g,'<switch @by="$1">').replace(/<async await\(\s*(.*?)\s*\)>/g,`<async ${O0}await="\$1">`).replace(/<log\(\s*(.*?)\s*\)>/g,'<log @args="$1">').replace(/\[(.*?)\]/g,(W)=>W.replace(/\s+/g,""));return Q=zZ(Q),Q=YZ(Q),Q}var KZ=function(Z,Q){if(Z.isDisposed)return;Q.add(Z),Z.dependencies.add(Q)},S5=function(Z){for(let Q of Z.dependencies)Q.delete(Z);Z.dependencies.clear()};function y0(Z,Q={maxSize:100}){const W=new Set,q=[{value:Z,timestamp:Date.now()}];let Y=0;const B=()=>{const O=M1[M1.length-1];return O&&KZ(O,W),q[Y].value},G=()=>{const O=[...W];if(P5)for(let j of O)P5.add(j);else for(let j of O)j.execute()};return[B,(O,j)=>{if(Object.is(q[Y].value,O))return;if(Y<q.length-1)q.splice(Y+1);if(q.push({value:O,timestamp:Date.now(),metadata:j}),q.length>Q.maxSize)q.shift(),Y=Math.max(0,Y-1);else Y++;G()},{undo(){if(Y>0)Y--,G()},redo(){if(Y<q.length-1)Y++,G()},jumpTo(O){if(O>=0&&O<q.length&&O!==Y)Y=O,G()},getHistory(){return[...q]},getCurrentIndex(){return Y},canUndo(){return Y>0},canRedo(){return Y<q.length-1},clear(){const O=q[0];q.length=0,q.push(O),Y=0,G()}}]}function O1(Z){let Q=!1;const W=()=>{if(Q)throw new Error("Circular dependency detected");if(q.isDisposed)return;Q=!0,S5(q),M1.push(q);try{Z()}finally{Q=!1,M1.pop()}},q={execute:W,dependencies:new Set,isDisposed:!1};return W(),{dispose:()=>{q.isDisposed=!0,S5(q)}}}var M1=[],P5=null;class c0 extends e0{declaration;$=null;input;state;static;context;__name__;__path__;__template__;__previous;__stylesheet;__macros=new Map;__renderCache=new Map;FGUD=new Map;PCC=new Map;VER=[];prepath="0";debug=!1;isRendered=!1;__setInput;__setState;__getState;UQS;ICE;lips;benchmark;__path="";__pathCounter=0;__renderDepth=0;constructor(Z,Q,{input:W,state:q,context:Y,_static:B,handler:G,stylesheet:X,macros:D,declaration:O},j){super();if(this.lips=j.lips,j?.debug)this.debug=j.debug;if(j?.prepath)this.prepath=j.prepath;if(this.__name__=Z,this.__path__=`${this.prepath}/${this.__name__}`,this.__template__=_1(Q),this.declaration=O||{name:Z},this.input=W||{},this.static=B||{},this.context={},this.state=this.lips.IUC.proxyState(this.__path__,q||{}),D&&this.setMacros(D),G&&this.setHandler(G),X&&this.setStylesheet(X),this.benchmark=new J1(this.debug),this.benchmark.inc("componentCount"),this.UQS=new a0(this),typeof this.onCreate=="function"&&this.onCreate.bind(this)(),this.emit("component:create",this),this.input&&Object.keys(this.input).length&&typeof this.onInput=="function")this.onInput.bind(this)(this.input),this.emit("component:input",this);this.__previous={input:J0(this.input),state:J0(this.state),context:J0(this.context)};const[E,x]=y0(this.input),[A,u]=y0(this.state),[i,e]=y0(this.context);this.__setInput=x,this.__setState=u,this.__getState=A,this.lips.IUC.register(this.__path__,()=>{H0(this.__previous?.state,this.state)&&this.__setState({...this.__getState(),...this.state})}),Array.isArray(Y)&&Y.length&&this.lips.useContext(Y,(r)=>{if(!H0(this.context,r))return;e(r),this.context=r,typeof this.onContext=="function"&&this.onContext.bind(this)(),this.emit("component:context",this)}),this.ICE=O1(()=>{const r=E(),c=A(),d=this.context=i();if(!this.isRendered){this.benchmark.reset();const{$log:k}=this.render("",void 0,void 0,this.FGUD);this.$=k,!O?.syntax&&this.$?.each((y,$)=>typeof $.setAttribute=="function"&&$.setAttribute("rel",this.__name__)),this.isRendered=!0,typeof this.onMount=="function"&&this.onMount.bind(this)(),this.emit("component:mount",this),this.lips.watcher.watch(this)}else this.__updateDepNodes__({state:c,input:r,context:d},this.__previous),typeof this.onUpdate=="function"&&this.onUpdate.bind(this)(),this.emit("component:update",this),this.__previous={input:J0(r),state:J0(c),context:J0(d)},this.input=r;this.benchmark.log(),typeof this.onRender=="function"&&this.onRender.bind(this)(),this.emit("component:render",this)})}setContext(Z,Q){this.lips.setContext(Z,Q)}setInput(Z){if(!H0(this.input,Z))return;this.__setInput(Z),typeof this.onInput=="function"&&this.onInput.bind(this)(Z)}subInput(Z){if(typeof Z!=="object")throw new Error("Invalid sub input data argument");return this.setInput(W5(this.input,Z)),this}setMacros(Z){const Q=_1(Z),W=t.default(Q);if(!W.length)return;const q=this;W.each(function(){const Y=t.default(this),{argv:B,attrs:G}=q.__getAttributes__(Y);if(!Object.keys(G))throw new Error("Invalid macro component definition");if(!G.literals.name)throw new Error("Undefined macro `name` attribute.");if(q.__macros.get(G.literals.name))console.warn(`Duplicate macro <${G.literals.name}> will be override`);if(!Y.contents()?.length)throw new Error("Invalid macro component definition. Template content expected.");q.__macros.set(G.literals.name,{argv:B,$node:Y})})}setHandler(Z){Object.entries(Z).map(([Q,W])=>this[Q]=W.bind(this))}setStylesheet(Z){const Q={sheet:Z,meta:this.__name__==="__ROOT__"};this.__stylesheet=new U1(this.__name__,Q)}get node(){if(!this.$)throw new Error("node() is expected to be call after component get rendered");return this.$}find(Z){return this.$?.find(Z)}render(Z,Q,W={},q,Y){const B=q||new Map,G=[];if(Q&&!Q.length)return console.warn("Undefined node element to render"),{$log:Q,dependencies:B};this.benchmark.startRender();const X=this;let D=t.default();function O(K){const w=j(K);return X.__pathCounter++,X.__path?`${X.__path}/${w}`:`${Z?Z+"/":"#"}${w}`}function j(K){return(K==="component"?"c":"")+X.__pathCounter}function E(K){return K!==null&&typeof K==="object"&&typeof K.mesh==="function"&&typeof K.update==="function"}function x(K){return K!==null&&typeof K==="object"&&typeof K.default&&typeof K.default==="string"}function A(K){if(!K.attr(":dtag")||K.prop("tagName")!=="LIPS")throw new Error("Invalid dynamic tag name");const w=K.attr(":dtag"),U=X.__evaluate__(w,W);if(E(U)||U===null)return r(K,w,U);else if(x(U))return c(K,{template:U});else return c(K,{name:U})}function u(K){const w=K.attr(":args"),U=O("log");if(!w)return;if(X.__evaluate__(`console.log(${w})`,W),X.__isReactive__(w,W))X.__extractExpressionDeps__(w,W).forEach((C)=>X.__trackDep__(B,C,{$fragment:null,path:U,update:(T)=>X.__evaluate__(`console.log(${w})`,T),memo:W,batch:!0}))}function i(K){const w=O("var"),{attrs:U}=X.__getAttributes__(K);if(!U)return;Object.entries(U.literals).forEach(([L,C])=>{if(W[L]&&W[L].type==="const")throw new Error(`Cannot override <const ${L}=[value]/> variable`);W[L]={value:C,type:"let"}}),Object.entries(U.expressions).forEach(([L,C])=>{if(a.test(L)){const T=(P,h)=>{const v=X.__evaluate__(L.replace(a,""),h||W);if(typeof v!=="object")throw new Error(`Invalid spread operator ${L}`);for(let V in v){if(W[V]&&W[V].type==="const")throw new Error(`Cannot override <const ${V}=[value]/> variable`);if(W[V]={value:v[V],type:"let"},h)h[V]=W[V],X.__updateVarDepNodes__(V,w,h)}if(P)return{memo:h}};X.__extractExpressionDeps__(L,W).forEach((P)=>X.__trackDep__(B,P,{$fragment:null,path:`${w}.${L}`,update:(h)=>T(!0,h),memo:W,batch:!0})),T()}else if(C){if(X.__isReactive__(C,W)){const T=X.__extractExpressionDeps__(C,W),o=(P,h)=>{if(W[L]&&W[L].type==="const")throw new Error(`Cannot override <const ${L}=[value]/> variable`);return P[L]=W[L]={value:X.__evaluate__(C,P),type:"let"},X.__updateVarDepNodes__(L,w,P),{memo:P}};T.forEach((P)=>X.__trackDep__(B,P,{$fragment:null,path:`${w}.${L}`,update:o,memo:W,batch:!0}))}if(W[L]&&W[L].type==="const")throw new Error(`Cannot override <const ${L}=[value]/> variable`);W[L]={value:X.__evaluate__(C,W),type:"let"}}}),X.benchmark.inc("elementCount")}function e(K){const{attrs:w}=X.__getAttributes__(K);if(!w)return;Object.entries(w.literals).forEach(([U,L])=>{if(W[U]&&W[U].type==="const")throw new Error(`<const ${U}=[value]/> variable already defined`);if(!L)return;W[U]={value:L,type:"const"}}),Object.entries(w.expressions).forEach(([U,L])=>{if(a.test(U)){const C=X.__evaluate__(U.replace(a,""),W);if(typeof C!=="object")throw new Error(`Invalid spread operator ${U}`);for(let T in C){if(W[T]&&W[T].type==="const")throw new Error(`<const ${T}=[value]/> by spread operator ${U}. [${T}] variable already defined`);W[T]={value:C[T],type:"const"}}}else{if(W[U]&&W[U].type==="const")throw new Error(`<const ${U}=[value]/> variable already defined`);if(!L)return;W[U]={value:X.__evaluate__(L,W),type:"const"}}}),X.benchmark.inc("elementCount")}function r(K,w,U){const{attrs:L}=X.__getAttributes__(K),C=O("element"),T=X.__getBoundaries__(C);let o=t.default(T.start),P={},h=U;if(h){L.literals&&Object.entries(L.literals).forEach(([V,S])=>P[V]={type:"arg",value:S}),L.expressions&&Object.entries(L.expressions).forEach(([V,S])=>{if(!h)return;if(a.test(V)){const _=X.__evaluate__(V.replace(a,""),W);if(typeof _!=="object")throw new Error(`Invalid spread operator ${V}`);for(let R in _){if(R!=="#"&&!h.argv.includes(R))continue;P[R]={type:"arg",value:_[R]}}}else{if(V!=="#"&&!h.argv.includes(V))return;P[V]={type:"arg",value:S?X.__evaluate__(S,W):!0}}});const v=h.mesh(P);if(v&&v.length)o=o.add(v);L.expressions&&Object.entries(L.expressions).forEach(([V,S])=>{if(!h)return;if(a.test(V)&&X.__isReactive__(V,W)){const _=X.__extractExpressionDeps__(V,W),R=(F,g)=>{if(!h)return;const b={},s=X.__evaluate__(V.replace(a,""),F);if(typeof s!=="object")throw new Error(`Invalid spread operator ${V}`);const l=[];for(let p in s){if(p!=="#"&&!h.argv.includes(p))continue;P[p]=b[p]={type:"arg",value:s[p]},(!F[p]||!E0(s[p],F[p].value))&&l.push(p)}l.length&&h.update(l,b,T)};_.forEach((F)=>X.__trackDep__(B,F,{$fragment:null,boundaries:T,path:`${C}.${V}`,update:R,memo:W,batch:!0}))}else if((V==="#"||h.argv.includes(V))&&X.__isReactive__(S,W)){const _=X.__extractExpressionDeps__(S,W),R=(F,g)=>{if(!h)return;const b=P[V]={type:"arg",value:S?X.__evaluate__(S,F):!0};h.update([V],{[V]:b},T)};_.forEach((F)=>X.__trackDep__(B,F,{$fragment:null,boundaries:T,path:`${C}.${V}`,update:R,memo:W,batch:!0}))}})}if(X.__isReactive__(w,W)){const v=(S,_)=>{const R=X.__evaluate__(w,S);let F;if(x(R))F=c(K,{template:R});else if(E(R))P="#"in P?{...S,...P["#"].value}:{...S,...P},h=R,F=h?h.mesh(P):null;if(!document.contains(T.start)||!document.contains(T.end))throw new Error("Dynamic element boundaries not found");const g=[];let b=T.start.nextSibling;while(b&&b!==T.end)g.push(b),b=b.nextSibling;t.default(g).remove(),F&&t.default(T.start).after(F)};X.__extractExpressionDeps__(w,W).forEach((S)=>X.__trackDep__(B,S,{$fragment:null,boundaries:T,path:C,update:v,batch:!0,memo:{...W,...P}}))}return o=o.add(T.end),o}function c(K,w){let U,L;if(w?.template)U=w.template,L=j("component");else{if(L=w?.name||K.prop("tagName")?.toLowerCase(),!L)throw new Error("Invalid component");if(L===X.__name__)throw new Error("Render component within itself is forbidden");U=X.lips.import(L)}if(!U||!L)throw new Error(`<${L}> template not found`);const C=O("component"),T=X.__getBoundaries__(C),{argv:o,attrs:P,events:h}=X.__getAttributes__(K),v={};let V={},S=t.default(T.start),_=X.PCC.get(C);P.literals&&Object.entries(P.literals).forEach(([F,g])=>{if(F=="key")return;V[F]=g}),P.functions&&Object.entries(P.functions).forEach(([F,g])=>{V[F]=X.__evaluateFunction__(g,[],W),U.declaration?.syntax?v[I0+O0+F]=g:v[O0+F]=g}),P.expressions&&Object.entries(P.expressions).forEach(([F,g])=>{if(F=="key")return;if(a.test(F)){const b=X.__evaluate__(F.replace(a,""),W);if(typeof b!=="object")throw new Error(`Invalid spread operator ${F}`);for(let s in b)V[s]=b[s]}else V[F]=g?X.__evaluate__(g,W):!0;U.declaration?.syntax?v[I0+F]=g:v[F]=g});const R=K.contents();if(R.length){if(V={...V,...X.__meshwire__({$node:K,fragmentPath:C,fragmentBoundaries:T,meshPath:null,argv:o,scope:W,xmlns:Y,useAttributes:!0,declaration:U.declaration},v)},U.declaration){if(U.declaration.tags)Object.entries(U.declaration?.tags).forEach(([F,{type:g,many:b}])=>{switch(g){case"nexted":{let s=K.next(F);if(!s.length)return;if(b){V[F]=[];let l=0,p=!1;while(!p){if(V[F].push(X.__meshwire__({$node:s,meshPath:`${F}[${l}]`,fragmentPath:C,fragmentBoundaries:T,argv:o,scope:W,xmlns:Y,useAttributes:!0,declaration:U.declaration},v)),!s.next(F).length){p=!0;break}s=s.next(F),l++}}else V[F]=X.__meshwire__({$node:s,meshPath:F,fragmentPath:C,fragmentBoundaries:T,argv:o,scope:W,xmlns:Y,useAttributes:!0,declaration:U.declaration},v)}break;case"child":{const s=K.children(F);if(b)V[F]=[],s.each(function(l){const p=t.default(this),{argv:D0}=X.__getAttributes__(p);V[F].push(X.__meshwire__({$node:p,meshPath:`${F}[${l}]`,fragmentPath:C,fragmentBoundaries:T,argv:D0,scope:W,xmlns:Y,useAttributes:!0,declaration:U.declaration},v))});else if(K.children(F).first().length){const l=K.children(F).first(),{argv:p}=X.__getAttributes__(l);V[F]=X.__meshwire__({$node:l,meshPath:F,fragmentPath:C,fragmentBoundaries:T,argv:p,scope:W,xmlns:Y,useAttributes:!0,declaration:U.declaration},v)}}break}});else if(U.declaration.contents)V.__contents__=R}}if(_)_.setInput(J0(V)),S=S.add(_.node);else{const{declaration:F,state:g,_static:b,handler:s,context:l,default:p,stylesheet:D0}=U;_=new c0(L,p||"",{state:J0(g),input:J0(V),context:l,_static:J0(b),handler:s,stylesheet:D0,declaration:F},{debug:X.debug,lips:X.lips,prepath:C}),S=S.add(_.node),X.PCC.set(C,_),Object.entries(h).forEach(([Z0,n])=>!!_&&X.__attachEvent__(_,Z0,n,W)),v&&Object.entries(v).forEach(([Z0,n])=>{let q0=!1,v0=!1;if(Z0.startsWith(I0))q0=!0,Z0=Z0.replace(I0,"");if(Z0.startsWith(O0))v0=!0,Z0=Z0.replace(O0,"");if(a.test(Z0)){const T0=(C0)=>{const K0={},_0=X.__evaluate__(Z0.replace(a,""),C0);if(typeof _0!=="object")throw new Error(`Invalid spread operator ${Z0}`);for(let R0 in _0)K0[R0]=_0[R0];_?.subInput(K0)};if(X.__isReactive__(Z0,W))X.__extractExpressionDeps__(n,W).forEach((K0)=>X.__trackDep__(B,K0,{$fragment:null,boundaries:T,path:`${C}.${Z0}`,update:T0,syntax:q0,memo:W,batch:!0}))}else{const T0=(C0)=>{const K0=v0?X.__evaluateFunction__(n,[],C0):n?X.__evaluate__(n,C0):!0;_?.subInput({[Z0]:K0})};if(X.__isReactive__(n,W))X.__extractExpressionDeps__(n,W).forEach((K0)=>X.__trackDep__(B,K0,{$fragment:null,boundaries:T,path:`${C}.${Z0}`,update:T0,syntax:q0,memo:W,batch:!0}))}}),S=S.add(T.end)}return X.benchmark.inc("componentCount"),S}function d(K){const w=K.prop("tagName")?.toLowerCase();if(!w)throw new Error("Invalid macro rendering call");const U=X.__macros.get(w);if(!U)throw new Error("Macro component not found");const L=O("macro"),C=X.__getBoundaries__(L),{attrs:T}=X.__getAttributes__(K),o={};let P={},h={},v=t.default(C.start);if(T.literals&&Object.entries(T.literals).forEach(([R,F])=>P[R]={value:F,type:"arg"}),T.expressions&&Object.entries(T.expressions).forEach(([R,F])=>{if(a.test(R)){const g=X.__evaluate__(R.replace(a,""),W);if(typeof g!=="object")throw new Error(`Invalid spread operator ${R}`);for(let b in g)if(h[b]=g[b],U.argv.includes(b))P[b]={value:g[b],type:"arg"};o[R]=F}else{const g=F?X.__evaluate__(F,W):!0;if(h[R]=g,U.argv.includes(R))P[R]={value:g,type:"arg"};if(U.argv.includes(R))o[R]=F}U.argv.forEach((g)=>{if(P[g]!==void 0)return;P[g]={value:!1,type:"arg"}})}),U.argv.includes("__"))P.__={value:h,type:"arg"};const V={$node:U.$node,meshPath:null,fragmentPath:L,fragmentBoundaries:C,argv:U.argv,scope:W,xmlns:Y,useAttributes:!0},S=X.__meshwire__(V,o),_=S.renderer.mesh(P);return v=v.add(_),o&&Object.entries(o).forEach(([R,F])=>{let g=!1;if(new RegExp(`^${I0}`).test(R))g=!0,R=R.replace(I0,"");if(a.test(R)){if(!X.__isReactive__(R,W))return;const b=X.__extractExpressionDeps__(R,W),s=(l)=>{const p={},D0=X.__evaluate__(R.replace(a,""),l);if(typeof D0!=="object")throw new Error(`Invalid spread operator ${R}`);const Z0=[];for(let n in D0)p[n]={value:D0[n],type:"arg"},(!l[n]||!E0(D0[n],l[n].value))&&Z0.push(n);return Z0.length&&S.renderer.update(Z0,p),{memo:{...l,...p}}};b.forEach((l)=>X.__trackDep__(B,l,{$fragment:null,boundaries:C,path:`${L}.${R}`,update:s,syntax:g,memo:{...W,...P},batch:!0}))}else if(X.__isReactive__(F,W)){const b=X.__extractExpressionDeps__(F,W),s=(l)=>{const p=l[R]={value:F?X.__evaluate__(F,l):!0,type:"arg"};return S.renderer.update([R],{[R]:p}),{memo:l}};b.forEach((l)=>X.__trackDep__(B,l,{$fragment:null,boundaries:C,path:`${L}.${R}`,update:s,syntax:g,memo:{...W,...P},batch:!0}))}}),v=v.add(C.end),X.benchmark.inc("elementCount"),v}function k(K){if(!K.length||!K.prop("tagName"))return K;const w=K.is("svg")||Y,U=w?t.default(document.createElementNS("http://www.w3.org/2000/svg",K.prop("tagName").toLowerCase())):t.default(`<${K.prop("tagName").toLowerCase()}/>`),L=K.contents(),C=O("element");L.length&&U.append(X.__withPath__(C,()=>X.render(C+".n",L,W,B,w).$log));const{attrs:T,events:o}=X.__getAttributes__(K);T.literals&&Object.entries(T.literals).forEach(([h,v])=>U.attr(h,v));const P=(h,v=!1)=>{h&&Object.entries(h).forEach(([V,S])=>{switch(V){case"@html":{const _=(R)=>{U.html(X.__evaluate__(S,R))};if(_(W),v&&X.__isReactive__(S,W))X.__extractExpressionDeps__(S,W).forEach((F)=>X.__trackDep__(B,F,{$fragment:U,path:`${C}.${V}`,update:_,memo:W,batch:!0}))}break;case"@text":{const _=(R)=>{let F=X.__evaluate__(S,R);if(!K.is("[no-translate]")){const{text:g}=X.lips.i18n.translate(F);F=g}U.text(F)};if(_(W),v&&X.__isReactive__(S,W))X.__extractExpressionDeps__(S,W).forEach((F)=>X.__trackDep__(B,F,{$fragment:U,path:`${C}.${V}`,update:_,memo:W,batch:!0}))}break;case"style":{const _=(R)=>{const F=X.__evaluate__(S,R);if(typeof F==="object"){let g="";Object.entries(F).forEach(([b,s])=>g+=`${b}:${s};`),g.length&&U.attr("style",g)}else U.attr("style",F)};if(_(W),v&&X.__isReactive__(S,W))X.__extractExpressionDeps__(S,W).forEach((F)=>X.__trackDep__(B,F,{$fragment:U,path:`${C}.${V}`,update:_,memo:W,batch:!0}))}break;default:{const _=(R)=>{const F=S?X.__evaluate__(S,R):S!==void 0?S:!0;F===void 0||F===!1?U.removeAttr(V):U.attr(V,F)};if(_(W),v&&X.__isReactive__(S,W))X.__extractExpressionDeps__(S,W).forEach((F)=>X.__trackDep__(B,F,{$fragment:U,path:`${C}.${V}`,update:_,memo:W,batch:!0}))}}})};return T.expressions&&Object.keys(T.expressions).forEach((h)=>{if(!a.test(h))return;const v=(V)=>{const S={},_=X.__evaluate__(h.replace(a,""),V);if(typeof _!=="object")throw new Error(`Invalid spread operator ${h}`);for(let R in _)S[R]=_[R];P(S)};if(delete T.expressions[h],v(W),h&&X.__isReactive__(h,W))X.__extractExpressionDeps__(h,W).forEach((S)=>X.__trackDep__(B,S,{$fragment:U,path:`${C}.${h}`,update:v,memo:W,batch:!0}))}),P(T.expressions,!0),o&&Object.entries(o).forEach(([h,v])=>{G.push({_event:h,$fragment:U,instruction:v,scope:W})}),X.benchmark.inc("elementCount"),X.benchmark.inc("domInsertsCount"),U}function y(K){const w=O("element"),U=K.text(),L=t.default(document.createTextNode(X.__interpolate__(U,W)));if(U&&X.__isReactive__(U,W)){const C=X.__extractTextDeps__(U,W),T=(o)=>{const P=X.__interpolate__(U,o);if(!L[0])return;L[0].textContent=P};C.forEach((o)=>X.__trackDep__(B,o,{path:w,$fragment:L,update:T,memo:W,batch:C.length>1}))}return X.benchmark.inc("elementCount"),X.benchmark.inc("domInsertsCount"),L}function $(K){if(K.get(0)?.nodeType===Node.COMMENT_NODE)return K;if(K.get(0)?.nodeType===Node.TEXT_NODE)return y(K);if(K.is("let"))return i(K);else if(K.is("const"))return e(K);else if(K.is("lips")&&K.attr(":dtag"))return A(K);else if(K.is("log"))return u(K);else if(X.__macros.has(K.prop("tagName")?.toLowerCase()))return d(K);else if(K.is("if, for, switch, async")||X.lips.has(K.prop("tagName")?.toLowerCase()))return c(K);else if(K.is("else-if, else"))return;return k(K)}try{this.__renderDepth++,Q=Q||t.default(this.__template__),Q.each(function(){const K=$(t.default(this));if(K)D=D.add(K)}),G.forEach(({$fragment:K,_event:w,instruction:U,scope:L})=>{this.__attachEvent__(K,w,U,L)}),X.benchmark.inc("renderCount")}catch(K){console.error("Rendering Failed --",K),X.benchmark.trackError(K)}finally{if(this.__renderDepth--,this.benchmark.endRender(),this.benchmark.trackMemory(),this.__renderDepth===0)this.__path="",this.__pathCounter=0}return{$log:D,dependencies:B,events:G}}destroy(){this.ICE.dispose(),this.benchmark.dispose(),this.lips.IUC.unregister(this.__path__),this.lips.watcher.unwatch(this),this.VER.forEach(({element:Z,_event:Q})=>this.__detachEvent__(Z,Q)),this.VER=[];for(let Z in this.PCC){const Q=this.PCC.get(Z);Q?.destroy(),Q?.delete(Z)}if(this.$?.remove(),this.PCC?.clear(),this.FGUD?.clear(),this.state.reset(),this.__macros.clear(),this.__stylesheet?.clear(),this.__previous=null,this.state=null,this.input=null,this.context=null,this.$)this.$.each((Z,Q)=>{t.default(Q).off()}),this.$=null;typeof this.onDestroy==="function"&&this.onDestroy.bind(this)(),this.emit("component:destroy",this)}__meshwire__(Z,Q){const W=this,{$node:q,meshPath:Y,fragmentPath:B,fragmentBoundaries:G,argv:X,scope:D,xmlns:O,declaration:j,useAttributes:E}=Z;let x,A=[];const u=[],i=(d,k,y)=>{const $=`${B}.${Y||"r"}${y!==void 0?`[${y}]`:""}`,{$log:K,dependencies:w,events:U}=W.render($,d,{...D,...k},void 0,O);if(u.push($),w?.forEach((L,C)=>{if(!W.FGUD?.has(C))W.FGUD.set(C,new Map);L.forEach((T,o)=>{T.partial?.length?T.partial.push($):T.partial=[$],W.FGUD.get(C)?.set(o,T)})}),W.benchmark.inc("partialCount"),y!==void 0){const L=W.__getBoundaries__($);A[y]={argvalues:k,boundaries:L};let C=t.default(L.start);return C=C.add(K),C=C.add(L.end),C}return K},e=(d,k,y)=>{if(W.benchmark.startRender(),d.forEach(($)=>{const K=W.FGUD.get($);if(!K)return;K.forEach((w)=>{const U=u.find((L)=>w.partial?.find((C)=>L==C));if(!w.partial||!U)return;if(y!==void 0&&!U.endsWith(`r[${y}]`))return;if(G?.start&&!document.contains(G.start)){console.warn(`${Y} -- partial boundaries missing in the DOM`),K.delete(w.path);return}if(w.memo?.[$]&&k?.[$]&&E0(w.memo[$],k[$]))return;if(w.memo={...D,...w.memo,...k},w.batch)W.UQS.queue({dep:$,dependent:w});else{const L=w.update(w.memo,"mesh-partial-updator");if(L)typeof L.memo==="object"&&K.set(w.path,{...w,memo:L.memo}),typeof L.cleanup==="function"&&L.cleanup()}W.benchmark.inc("dependencyUpdateCount")}),!K.size&&W.FGUD.delete($)}),y!==void 0&&A[y])A[y].argvalues=k;W.benchmark.inc("partialUpdateCount"),W.benchmark.endRender()},r=(d)=>{if(!A[d])return;const k=A[d].boundaries;if(delete A[d],!document.contains(k.start)||!document.contains(k.end)){console.warn(`Partial mesh item<${d}> boundaries missing`);return}const y=[];let $=k.start.nextSibling;while($&&$!==k.end)y.push($),$=$.nextSibling;t.default(y).remove(),k.start.remove(),k.end.remove()},c={renderer:{path:Y,argv:X,mesh(d,k=!1){if(x=q.contents(),!x?.length)return null;if(j?.iterator){const y=d?.["#"].value;if(!Array.isArray(d?.["#"].value))throw new Error("Invalid iterator argvalues");if(!y.length)return null;let $=t.default();return y.forEach((K,w)=>{if(!x?.length)return null;$=$.add(i(x,K,w))}),$}else return i(x,d)},update(d,k,y){if(!u.length)return;if(y=y||G,j?.iterator){const $=k?.["#"].value;if(!Array.isArray($))return;if(Array.isArray(A)){if(A.length===$.length){for(let w=0;w<$.length;w++)!E0(A[w].argvalues,$[w])&&e(Object.keys($[w]),$[w],w);return}const K=Math.min(A.length,$.length);for(let w=0;w<K;w++)e(Object.keys($[w]),$[w],w);if($.length>A.length){if(!x?.length)return;for(let w=A.length;w<$.length;w++){const U=i(x,$[w],w);t.default(y.end).before(U)}}else if($.length<A.length)for(let w=$.length;w<A.length;w++)r(w)}}else e(d,k)}}};if(E&&Y){const{attrs:d}=W.__getAttributes__(q);d.literals&&Object.entries(d.literals).forEach(([k,y])=>c[k]=y),d.expressions&&Object.entries(d.expressions).forEach(([k,y])=>{if(a.test(k)){const $=W.__evaluate__(k.replace(a,""),D);if(typeof $!=="object")throw new Error(`Invalid spread operator ${k}`);for(let K in $)c[K]=$[K];Q[`${j?.syntax?I0:""}${Y}.${k}`]=y}else c[k]=y?W.__evaluate__(y,D):!0,Q[`${j?.syntax?I0:""}${Y}.${k}`]=y})}return c}__getBoundaries__(Z){return this.benchmark.inc("domOperations"),this.benchmark.inc("domInsertsCount"),{start:document.createComment(`s:${this.prepath}.${Z}`),end:document.createComment(`e:${this.prepath}.${Z}`)}}__getAttributes__(Z){const Q=Z.attrs(),W={},q={literals:{},functions:{},expressions:{}};let Y=[];return Q&&Object.entries(Q).forEach(([B,G])=>{if(B==":dtag")return;if(B.startsWith(":")||B.startsWith(O0)||B.startsWith(A0)||a.test(B)||Z1.test(B))if(Z1.test(B)){const[X,D]=B.match(Z1)||[];Y=D.split(",")}else if(B.startsWith(A0))W[B.replace(A0,"")]=G;else if(B.startsWith(O0))q.functions[B.replace(O0,"")]=G;else{if(B.startsWith(":"))B=B.slice(1,B.length);q.expressions[B]=G||""}else q.literals[B]=G}),{argv:Y,events:W,attrs:q}}__withPath__(Z,Q){const W=this.__path;this.__path=Z;const q=Q();return this.__path=W,q}__getPathParent__(Z){const Q=Z.split("/");return Q.pop(),Q.join("/")}__hasSamePathParent__(Z,Q){return Z.startsWith(Q)}__evaluate__(Z,Q){try{Z=Z.trim();const W=this.state.toJSON();if(Q){const q={};for(let G in Q)q[G]=Q[G].value;const Y=`with( scope ){ return ${Z}; }`;return new Function("self","input","state","static","context","scope",Y)(this,this.input,W,this.static,this.context,q||{})}else{const q=`return ${Z}`;return new Function("self","input","state","static","context",q)(this,this.input,W,this.static,this.context)}}catch(W){return Z}}__evaluateFunction__(Z,Q,W){if(/(\s*\w+|\s*\([^)]*\)|\s*)\s*=>\s*(\s*\{[^}]*\}|\s*[^\n;"]+)/g.test(Z))return this.__evaluate__(Z,W)(...Q);else{let[q,...Y]=Z.split(/\s*,\s*/),B;if(q=this.__evaluate__(q,W),typeof q==="function")B=q;else{if(typeof this[q]!=="function")throw new Error(`Undefined <${q}> handler method`);B=this[q].bind(this)}if(typeof B!=="function")throw new Error(`Expected <${q}> to be a function or handler method`);let G=Y.map((X)=>this.__evaluate__(X,W));if(Q.length)G=[...G,...Q];return B(...G)}}__interpolate__(Z,Q){return Z.replace(/{\s*([^{}]+)\s*}/g,(W,q)=>this.__evaluate__(q,Q))}__attachEvent__(Z,Q,W,q){Z.on(Q,(...Y)=>this.__evaluateFunction__(W,Y,q)),this.VER.push({element:Z,_event:Q}),this.benchmark.inc("domUpdatesCount"),this.benchmark.inc("domRemovalsCount")}__detachEvent__(Z,Q){Z.off(Q),this.benchmark.inc("domOperations"),this.benchmark.inc("domRemovalsCount")}__extractTextDeps__(Z,Q){const W=new Set;return(Z.match(/{\s*([^{}]+)\s*}/g)||[]).forEach((Y)=>{const B=Y.replace(/[{}]/g,"").trim();this.__extractExpressionDeps__(B,Q).forEach((X)=>W.add(X))}),Array.from(W)}__extractExpressionDeps__(Z,Q){const W=/\b(state|input|context)(?:\.[a-zA-Z_]\w*)+(?=\[|\.|$|\s|;|,|\))/g,q=/\b(self)(?:\.[a-zA-Z_]\w*)+(?=\()/g;let Y=[...Array.from(Z.matchAll(W)),...Array.from(Z.matchAll(q))];if(Q&&Object.keys(Q).length){const B=new RegExp(`\\b(${Object.keys(Q).join("|")})`,"g");Y=[...Y,...Array.from(Z.matchAll(B))]}return[...new Set(Y.map((B)=>B[0]))]}__isReactive__(Z,Q){if(/(state|input|context|self)\.[\w.]+/.test(Z))return!0;if(Q&&Object.keys(Q).length&&new RegExp(Object.keys(Q).join("|")).test(Z))return!0;return!1}__trackDep__(Z,Q,W){if(W.memo&&W.memo[Q]&&W.memo[Q].type==="let")W.haslet=!0;!Z.has(Q)&&Z.set(Q,new Map),Z.get(Q)?.set(W.path,W),this.benchmark.inc("dependencyTrackCount")}__valueDep__(Z,Q){return Q.reduce((W,q)=>W?.[q],Z)}__shouldUpdate__(Z,Q,W,q){if(Z==="self")return!0;const Y=this.__valueDep__(q[Z],Q),B=this.__valueDep__(W[Z],Q);return!E0(Y,B)}__updateDepNodes__(Z,Q){if(!this.FGUD?.size)return;this.benchmark.inc("componentUpdateCount"),this.benchmark.startRender(),this.FGUD.forEach((W,q)=>{const[Y,...B]=q.split(".");if(!this.__shouldUpdate__(Y,B,Z,Q))return;W.forEach((G)=>{const{path:X,batch:D,$fragment:O,boundaries:j,update:E,memo:x,syntax:A}=G;try{if(!A&&(j?.start&&!document.contains(j.start))||O!==null&&!O.closest("body").length){W.delete(X);return}if(D)this.UQS.queue({dep:q,dependent:G});else{const u=E(x,"main-updator");if(u)typeof u.memo==="object"&&W.set(X,{...G,memo:u.memo}),typeof u.cleanup==="function"&&u.cleanup()}this.benchmark.inc("dependencyUpdateCount")}catch(u){console.error("failed to update dependency nodes --",u);return}}),!W.size&&this.FGUD?.delete(q)}),this.benchmark.endRender()}__updateVarDepNodes__(Z,Q,W){if(!this.FGUD?.size)return;this.benchmark.inc("partialUpdateCount"),this.benchmark.startRender(),this.FGUD.get(Z)?.forEach((Y,B)=>{if(!Y.haslet||!this.__hasSamePathParent__(B,this.__getPathParent__(Q)))return;if(Y.memo={...Y.memo,...W},Y.batch)this.UQS.queue({dep:Z,dependent:Y});else{const G=Y.update(Y.memo,"var-partial-updator");typeof G?.cleanup==="function"&&G.cleanup()}}),this.benchmark.endRender()}appendTo(Z){const Q=typeof Z=="string"?t.default(Z):Z;return this.$?.length&&Q.append(this.$),this.benchmark.inc("domOperations"),this}prependTo(Z){const Q=typeof Z=="string"?t.default(Z):Z;return this.$?.length&&Q.prepend(this.$),this.benchmark.inc("domOperations"),this}replaceWith(Z){const Q=typeof Z=="string"?t.default(Z):Z;return this.$?.length&&Q.replaceWith(this.$),this.benchmark.inc("domOperations"),this}}var x1={};m0(x1,{state:()=>{{return MZ}},handler:()=>{{return OZ}},default:()=>{{return DZ}},declaration:()=>{{return UZ}}});var UZ={name:"if",syntax:!0,tags:{"else-if":{type:"nexted",many:!0,optional:!0},else:{type:"nexted",optional:!0}}},MZ={renderer:null},OZ={onInput(){if(!this.input.renderer)return;if(this.input.by)this.state.renderer=this.input.renderer;else{let Z=!1;if(Array.isArray(this.input["else-if"])&&this.input["else-if"].length)this.input["else-if"].forEach((Q)=>{if(Z||!Q.by)return;this.state.renderer=Q.renderer,Z=!0});if(!Z)this.state.renderer=this.input.else?this.input.else.renderer:null}}},DZ="<{state.renderer}/>";var b1={};m0(b1,{state:()=>{{return FZ}},handler:()=>{{return LZ}},default:()=>{{return VZ}},declaration:()=>{{return jZ}},_static:()=>{{return IZ}}});var jZ={name:"for",syntax:!0,iterator:!0},FZ={argvlist:null},IZ={lastInput:null,processingBatch:!1},LZ={onInput(){if(this.static.processingBatch)return;if(!this.input.renderer)throw new Error("Undefined mesh renderer");let{in:Z,from:Q,to:W}=this.input;if(Z===void 0&&Q===void 0)throw new Error("Invalid <for> arguments");this.static.processingBatch=!0;try{if(Q!==void 0){if(Q=parseFloat(String(Q)),W==null)throw new Error("Expected <from> <to> attributes of the for loop to be defined");if(W=parseFloat(String(W)),Q===W)throw new Error("<from> and <to> attribute cannot have the same value");const q=Q<W,Y=Math.abs(W-Q)+1;if(this.state.argvlist&&Array.isArray(this.state.argvlist)&&this.state.argvlist.length===Y){const[G]=this.input.renderer.argv;if(G){let X=Q,D=!0;for(let O=0;O<this.state.argvlist.length;O++){if(this.state.argvlist[O][G].value!==X){D=!1;break}X=q?X+1:X-1}if(D)return;X=Q;for(let O=0;O<this.state.argvlist.length;O++)this.state.argvlist[O][G].value=X,X=q?X+1:X-1;return}}const B=[];for(let G=Q;q?G<=W:G>=W;q?G++:G--){const X={},[D]=this.input.renderer.argv;if(D)X[D]={value:G,type:"arg"};B.push(X)}this.state.argvlist=B}else if(Array.isArray(Z)){if(this.state.argvlist&&this.static.lastInput&&this.input.in===this.static.lastInput)return;if(!Z.length){console.warn("empty for loop <in> attribute Array value"),this.state.argvlist=[];return}if(this.static.lastInput=Z,this.state.argvlist&&Array.isArray(this.state.argvlist)&&this.state.argvlist.length===Z.length){const[B,G]=this.input.renderer.argv;for(let X=0;X<Z.length;X++){const D=this.state.argvlist[X];if(B)D[B].value=Z[X]}return}const q=[];let Y=0;for(let B of Z){const G={},[X,D]=this.input.renderer.argv;if(X)G[X]={value:B,type:"arg"};if(D)G[D]={value:Y,type:"arg"};q.push(G),Y++}this.state.argvlist=q}else if(Z instanceof Map){if(this.state.argvlist&&this.static.lastInput&&this.input.in===this.static.lastInput)return;if(!Z.size){console.warn("empty for loop <in> attribute Map value"),this.state.argvlist=[];return}if(this.static.lastInput=Z,this.state.argvlist&&Array.isArray(this.state.argvlist)&&this.state.argvlist.length===Z.size){const[B,G,X]=this.input.renderer.argv;let D=0;for(let[O,j]of Z){const E=this.state.argvlist[D];if(B)E[B].value=O;if(G)E[G].value=j;D++}return}const q=[];let Y=0;for(let[B,G]of Z){const X={},[D,O,j]=this.input.renderer.argv;if(D)X[D]={value:B,type:"arg"};if(O)X[O]={value:G,type:"arg"};if(j)X[j]={value:Y,type:"arg"};q.push(X),Y++}this.state.argvlist=q}else if(typeof Z=="object"){if(this.state.argvlist&&this.static.lastInput&&this.input.in===this.static.lastInput)return;if(!Object.keys(Z).length){console.warn("empty for loop <in> attribute Object value"),this.state.argvlist=[];return}this.static.lastInput=Z;const q=Object.keys(Z);if(this.state.argvlist&&Array.isArray(this.state.argvlist)&&this.state.argvlist.length===q.length){const[G,X,D]=this.input.renderer.argv;for(let O=0;O<q.length;O++){const j=q[O],E=this.state.argvlist[O];if(G)E[G].value=j;if(X)E[X].value=Z[j]}return}const Y=[];let B=0;for(let G in Z){const X={},[D,O,j]=this.input.renderer.argv;if(D)X[D]={value:G,type:"arg"};if(O)X[O]={value:Z[G],type:"arg"};if(j)X[j]={value:B,type:"arg"};Y.push(X),B++}this.state.argvlist=Y}}finally{this.static.processingBatch=!1}},updateItems(Z){if(!this.input.renderer)throw new Error("Undefined mesh renderer");if(!Array.isArray(Z)||!this.state.argvlist)return;this.static.processingBatch=!0;try{const[Q]=this.input.renderer?.argv;if(!Q)return;for(let{index:W,value:q}of Z)if(W>=0&&W<this.state.argvlist.length)this.state.argvlist[W][Q].value=q}finally{this.static.processingBatch=!1}},updateProperty(Z,Q){if(!this.input.renderer)throw new Error("Undefined mesh renderer");if(!this.state.argvlist)return;this.static.processingBatch=!0;try{for(let W=0;W<this.state.argvlist.length;W++){const q=this.state.argvlist[W];if(q[Z])q[Z].value=typeof Q==="function"?Q(q[Z].value,W):Q}}finally{this.static.processingBatch=!1}}},VZ="<{input.renderer} #=state.argvlist/>";var h1={};m0(h1,{state:()=>{{return CZ}},handler:()=>{{return PZ}},default:()=>{{return SZ}},declaration:()=>{{return NZ}}});var NZ={name:"async",syntax:!0,tags:{then:{type:"child"},catch:{type:"child",optional:!0},loading:{type:"child",optional:!0}}},CZ={renderer:null,props:{}},PZ={onInput(){if(!this.input.await)throw new Error("Undefined async <await> attribute");if(!(this.input.await instanceof Promise))throw new Error("Expected async <await> attribute value to be a function");if(this.input.loading)this.state.renderer=this.input.loading.renderer,this.state.props={};this.input.await.then((Z)=>{if(!this.input.then)return;this.state.renderer=this.input.then.renderer;const[Q]=this.input.then.renderer.argv;this.state.props={[Q]:{value:Z,type:"arg"}}}).catch((Z)=>{if(!this.input.catch)return;this.state.renderer=this.input.catch.renderer;const[Q]=this.input.then.renderer.argv;this.state.props={[Q]:{value:Z,type:"arg"}}})}},SZ="<{state.renderer} #=state.props/>";var f1={};m0(f1,{state:()=>{{return TZ}},handler:()=>{{return RZ}},default:()=>{{return $Z}},declaration:()=>{{return EZ}}});var EZ={name:"switch",syntax:!0,tags:{case:{type:"child",many:!0},default:{type:"child"}}},TZ={renderer:null},RZ={onInput(){let Z=[];for(let Q of this.input.case)if(Q.is==this.input.by||Array.isArray(Q.is)&&Q.is.includes(this.input.by))Array.isArray(Q.is)?Z=[...new Set([...Z,...Q.is])]:Z.push(Q.is),this.state.renderer=Q.renderer;if(!Z.includes(this.input.by))this.state.renderer=this.input.default?this.input.default.renderer:null}},$Z="<{state.renderer}/>";var g1={};m0(g1,{state:()=>{{return AZ}},handler:()=>{{return hZ}},default:()=>{{return fZ}},context:()=>{{return xZ}},_static:()=>{{return _Z}}});var bZ=function(Z){const Q={};return Z.split("&").map((q)=>{const[Y,B]=q.split("=");Q[Y]=B}),Q},AZ={page:null,params:{},query:{}},_Z={global:!1,routes:[],defaultPath:null,currentPath:null,currentRoute:null},xZ=["navigate"],hZ={onInput(){if(!this.input.routes)return;if(this.input.global)this.static.global=this.input.global;if(this.static.routes=this.input.routes.map(({path:Z,template:Q,default:W})=>{if(W)this.static.defaultPath=Z;const q=Z.match(/:[^\/]*(\/|$)/gi)||[],Y=Z.replaceAll("/","\\/").replaceAll(/:[^\/]*(\/|$)/gi,"([^\\/]+)(?:\\/|$)");return{path:Z,template:Q,default:W,pathVars:q,pathRegex:new RegExp(`${Y}\$`,"i")}}),this.input.global){const Z=window.location.pathname;this.static.defaultPath=this.static.defaultPath&&Z=="/"&&Z!==this.static.defaultPath?this.static.defaultPath:Z?Z+window.location.search:this.static.routes[0].path}},onAttach(){if(this.input.global)window.navigate=this.navigate.bind(this),window.addEventListener("popstate",(Z)=>Z.state&&this.navigate(Z.state.path,!0));this.setContext("navigate",this.navigate.bind(this)),this.static.defaultPath&&this.navigate(this.static.defaultPath)},navigate(Z,Q){!Q&&this.static.global&&history.pushState({path:Z},"",Z);const W=Z.split("?");Z=W[0];const q=W[1]?bZ(W[1]):{};let Y=null;if(this.static.currentRoute)Y={path:this.static.currentRoute.path,params:this.state.params},this.emit("before",{fromState:Y,toState:{path:Z,query:q}});const B=this.match(Z);if(!B){this.static.currentRoute=null,this.state.params={},this.state.query={},this.emit("not-found",Z);return}const{route:G,params:X}=B;this.emit("after",{fromState:Y,toState:{path:G.path,params:X,query:q}}),this.static.currentPath=Z,this.static.currentRoute=G,this.state.params=X,this.state.query=q,this.state.page=G.template},match(Z){const Q={};let W=!1;for(let q of this.static.routes){const{pathVars:Y,pathRegex:B}=q,G=Z.match(B);if(G!==null&&G.index===0){for(let X=0;X+1<G.length&&X<Y.length;X++)Q[Y[X].replaceAll(/[\/:]/g,"")]=G[X+1];W=q;break}}return W?{route:W,params:Q}:!1}},fZ="<{state.page} params=state.params query=state.query/>";class E5{debug=!1;store={};__root;i18n=new l0;watcher;IUC;__setContext;__getContext;constructor(Z){if(Z?.debug)this.debug=Z.debug;this.watcher=new t0,this.IUC=new n0;const[Q,W]=y0(Z?.context||{});this.__setContext=W,this.__getContext=Q,this.register("if",x1),this.register("for",b1),this.register("async",h1),this.register("switch",f1),this.register("router",g1)}register(Z,Q){return this.store[Z]=Q,this}unregister(Z){return delete this.store[Z],this}has(Z){return Z in this.store}import(Z){if(!this.has(Z))throw new Error(`<${Z}> component not found`);if(!this.store[Z].declaration?.syntax&&!this.store[Z].default)throw new Error(`Invalid <${Z}> component`);return this.store[Z]}render(Z,Q,W){const{default:q,...Y}=Q,B={debug:this.debug,prepath:"0",lips:this},G=new c0(Z,q||"",{...Y,input:W},B);return window.addEventListener("beforeunload",()=>{return this.dispose(),G.destroy(),null}),window.addEventListener("pagehide",(X)=>{!X.persisted&&this.dispose()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState!=="hidden")return;this.IUC.prepareForPotentialUnload()}),G}root(Z,Q){return this.__root=this.render("__ROOT__",Z),this.__root.appendTo(Q),this.__root}language(Z){this.i18n.setLang(Z)&&this.__root?.rerender()}setContext(Z,Q){const W=this.__getContext();if(typeof Z==="string"){const q={...W,[Z]:Q};H0(W,q)&&this.__setContext(q)}else if(!Array.isArray(Z)){const q={...W,...Z};H0(W,q)&&this.__setContext(q)}else throw new Error("Invalid context data")}getContext(){return this.__getContext()}useContext(Z,Q){if(!Z.length)return;O1(()=>{const W=this.__getContext();if(!W)return;const q=Object.fromEntries(Z.map((Y)=>[Y,W[Y]]));q&&typeof Q==="function"&&Object.keys(q).length&&Q(q)})}dispose(){this.watcher?.dispose(),this.__root?.destroy()}}export{E5 as default};
2
+
3
+ //# debugId=C4417F8F4763143464756e2164756e21