@jasonshimmy/custom-elements-runtime 2.2.4 → 2.2.6

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/README.md CHANGED
@@ -258,6 +258,7 @@ Explore the complete documentation for every runtime feature:
258
258
  ### 🎨 **Styling**
259
259
 
260
260
  - [🎨 JIT CSS](./docs/jit-css.md) - On-demand utility-first styling system
261
+ - [📝 Prose Typography](./docs/prose.md) - Beautiful typography for long-form content
261
262
 
262
263
  ### 🔗 **Communication & State**
263
264
 
@@ -1,18 +1,19 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./namespace-helpers-DwMMXN9Q.cjs"),P=require("./logger-CqdBMdui.cjs"),W=require("./transitions-Bv8lUAOe.cjs");function Ye(e,n,t){if(t)for(const[s,r]of Object.entries(t)){let o,i={};if(Array.isArray(r)?(o=r[0],i=r[1]||{}):o=r,n.set(s,{callback:o,options:i,oldValue:f.getNestedValue(e,s)}),i.immediate)try{const a=f.getNestedValue(e,s);o(a,void 0,e)}catch(a){P.devError(`Error in immediate watcher for "${s}":`,a)}}}function Xe(e,n,t,s){const r=(i,a)=>{if(i===a)return!0;if(typeof i!=typeof a||typeof i!="object"||i===null||a===null)return!1;if(Array.isArray(i)&&Array.isArray(a))return i.length!==a.length?!1:i.every((g,T)=>r(g,a[T]));const d=i,u=a,A=Object.keys(d||{}),v=Object.keys(u||{});return A.length!==v.length?!1:A.every(g=>r(d[g],u[g]))},o=n.get(t);if(o&&!r(s,o.oldValue))try{o.callback(s,o.oldValue,e),o.oldValue=s}catch(i){P.devError(`Error in watcher for "${t}":`,i)}for(const[i,a]of n.entries())if(a.options.deep&&t.startsWith(i+"."))try{const d=f.getNestedValue(e,i);r(d,a.oldValue)||(a.callback(d,a.oldValue,e),a.oldValue=d)}catch(d){P.devError(`Error in deep watcher for "${i}":`,d)}}function Te(e,n){return n===Boolean?e===""||e==="true":n===Number?Number(e):e}function Qe(e,n,t){if(n)for(const s in n){const r=n[s],o=f.toKebab(s),i=e.getAttribute(o);if(r.type===Function&&typeof e[s]=="function")t[s]=e[s];else if(i!==null)t[s]=Te(i,r.type);else if(typeof e[s]<"u")try{const a=e[s];if(r.type===String&&a&&typeof a=="object")try{t[s]=Te(String(a),r.type)}catch{t[s]=a}else r.type===Boolean&&typeof a=="boolean"||r.type===Number&&typeof a=="number"||r.type===Function&&typeof a=="function"?t[s]=a:t[s]=Te(String(a),r.type)}catch{t[s]=e[s]}else"default"in r&&r.default!==void 0&&(t[s]=r.default)}}function et(e,n,t){if(!n.props){try{const s=t?._hookCallbacks?.props||{},r=Array.from(new Set([...Object.keys(e||{}),...Object.keys(s||{})]));for(const o of r){if(typeof o!="string"||o.startsWith("_"))continue;const i=Object.getOwnPropertyDescriptor(t,o);if(!(!Object.prototype.hasOwnProperty.call(s,o)&&i&&(i.get||i.set||!i.configurable)))try{Object.defineProperty(t,o,{enumerable:!0,configurable:!0,get(){try{const d=f.toKebab(o),u=e.getAttribute(d);if(u!==null)return u;const A=e[o];let v;return f.isReactiveState(A)||A&&typeof A=="object"&&"value"in A&&!(A instanceof Node)?v=A.value:v=A,v}catch{return e[o]}}})}catch{}}}catch{}return}Qe(e,n.props,t)}function tt(e,n,t,s){e.onConnected&&!t&&(e.onConnected(n),s(!0))}function nt(e,n,t,s,r,o,i,a){e.onDisconnected&&e.onDisconnected(n),t.forEach(d=>d()),s(),r(),o(!1),i(null),a(!1)}function rt(e,n,t,s,r){e.onAttributeChanged&&e.onAttributeChanged(n,t,s,r)}class st{static cache=new Map;static maxCacheSize=1e3;static dangerousPatterns=[/constructor/i,/prototype/i,/__proto__/i,/function/i,/eval/i,/import/i,/require/i,/window/i,/document/i,/global/i,/process/i,/setTimeout/i,/setInterval/i,/fetch/i,/XMLHttpRequest/i];static evaluate(n,t){const s=this.cache.get(n);if(s){if(!s.isSecure){P.devWarn("Blocked cached dangerous expression:",n);return}try{this.cache.delete(n),this.cache.set(n,s)}catch{}return s.evaluator(t)}const r=this.createEvaluator(n);if(this.cache.size>=this.maxCacheSize){const o=this.cache.keys().next().value;o&&this.cache.delete(o)}if(this.cache.set(n,r),!r.isSecure){P.devWarn("Blocked dangerous expression:",n);return}return r.evaluator(t)}static createEvaluator(n){if(this.hasDangerousPatterns(n))return{evaluator:()=>{},isSecure:!1};if(n.length>1e3)return{evaluator:()=>{},isSecure:!1};try{return{evaluator:this.createSafeEvaluator(n),isSecure:!0}}catch(t){return P.devWarn("Failed to create evaluator for expression:",n,t),{evaluator:()=>{},isSecure:!1}}}static hasDangerousPatterns(n){return this.dangerousPatterns.some(t=>t.test(n))}static createSafeEvaluator(n){const t=n.trim();if(t.startsWith("{")&&t.endsWith("}"))return this.createObjectEvaluator(n);if(/^ctx\.[a-zA-Z0-9_.]+$/.test(n.trim())){const s=n.trim().slice(4);return r=>f.getNestedValue(r,s)}return n.includes("ctx")||/[+\-*/%<>=&|?:[\]]/.test(n)?this.createSimpleEvaluator(n):s=>f.getNestedValue(s,n)}static createObjectEvaluator(n){const t=n.trim().slice(1,-1),s=this.parseObjectProperties(t);return r=>{const o={};for(const{key:i,value:a}of s)try{if(a.startsWith("ctx.")){const d=a.slice(4);o[i]=f.getNestedValue(r,d)}else o[i]=this.evaluateSimpleValue(a,r)}catch{o[i]=void 0}return o}}static parseObjectProperties(n){const t=[],s=n.split(",");for(const r of s){const o=r.indexOf(":");if(o===-1)continue;const i=r.slice(0,o).trim(),a=r.slice(o+1).trim(),d=i.replace(/^['"]|['"]$/g,"");t.push({key:d,value:a})}return t}static createSimpleEvaluator(n){return t=>{try{let s=n;const r=[];s=s.replace(/("[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*')/g,v=>`<<#${r.push(v)-1}#>>`);const o=s.match(/ctx\.[\w.]+/g)||[];for(const v of o){const g=v.slice(4),T=f.getNestedValue(t,g);if(T===void 0)return;const p=r.push(JSON.stringify(T))-1;s=s.replace(new RegExp(v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),`<<#${p}#>>`)}const i=/\b[a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)+\b/g,a=s.match(i)||[];for(const v of a){if(v.startsWith("ctx."))continue;const g=f.getNestedValue(t,v);if(g===void 0)return;const T=r.push(JSON.stringify(g))-1;s=s.replace(new RegExp(v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),`<<#${T}#>>`)}const d=/\b([a-zA-Z_][a-zA-Z0-9_]*)\b/g;let u;const A=new Set;for(;(u=d.exec(s))!==null;){const v=u[1];if(["true","false","null","undefined"].includes(v)||/^[0-9]+$/.test(v)||v==="ctx"||A.has(v))continue;A.add(v);const g=f.getNestedValue(t,v);if(g===void 0)return;const T=JSON.stringify(g),p=r.push(T)-1;v.includes(".")?s=s.replace(new RegExp(v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),`<<#${p}#>>`):s=s.replace(new RegExp("\\b"+v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"\\b","g"),`<<#${p}#>>`)}s=s.replace(/<<#(\d+)#>>/g,(v,g)=>r[Number(g)]);try{return this.evaluateBasicExpression(s)}catch{return}}catch{return}}}static evaluateBasicExpression(n){const t=this.tokenize(n);let s=0;function r(){return t[s]}function o(c){const E=t[s++];if(c&&!E)throw new Error(`Unexpected token EOF, expected ${c}`);if(c&&E&&E.type!==c&&E.value!==c)throw new Error(`Unexpected token ${E.type}/${E.value}, expected ${c}`);return E}function i(){return p()}function a(c){if(typeof c=="number")return c;if(c==null)return NaN;if(typeof c=="boolean")return c?1:0;const E=Number(c);return Number.isNaN(E)?NaN:E}function d(c,E){return typeof c=="string"||typeof E=="string"?String(c)+String(E):a(c)+a(E)}function u(c,E){return a(c)-a(E)}function A(c,E){return a(c)*a(E)}function v(c,E){return a(c)/a(E)}function g(c,E){return a(c)%a(E)}function T(c,E,m){if(typeof E=="number"&&typeof m=="number")switch(c){case">":return E>m;case"<":return E<m;case">=":return E>=m;case"<=":return E<=m;default:return!1}const y=String(E),w=String(m);switch(c){case">":return y>w;case"<":return y<w;case">=":return y>=w;case"<=":return y<=w;default:return!1}}function p(){const c=_(),E=r();if(E&&E.value==="?"){o("?");const m=i();o(":");const y=i();return c?m:y}return c}function _(){let c=l();for(;;){const E=r();if(!E||E.value!=="||")break;o("OP");const m=l();c=c||m}return c}function l(){let c=C();for(;;){const E=r();if(!E||E.value!=="&&")break;o("OP");const m=C();c=c&&m}return c}function C(){let c=S();for(;;){const E=r();if(!E||!["==","!=","===","!=="].includes(E.value))break;const m=o("OP").value,y=S();switch(m){case"==":c=c==y;break;case"!=":c=c!=y;break;case"===":c=c===y;break;case"!==":c=c!==y;break}}return c}function S(){let c=b();for(;;){const E=r();if(!E||![">","<",">=","<="].includes(E.value))break;const m=o("OP").value,y=b();switch(m){case">":c=T(">",c,y);break;case"<":c=T("<",c,y);break;case">=":c=T(">=",c,y);break;case"<=":c=T("<=",c,y);break}}return c}function b(){let c=h();for(;;){const E=r();if(!E||E.value!=="+"&&E.value!=="-")break;const m=o("OP").value,y=h();c=m==="+"?d(c,y):u(c,y)}return c}function h(){let c=k();for(;;){const E=r();if(!E||E.value!=="*"&&E.value!=="/"&&E.value!=="%")break;const m=o("OP").value,y=k();switch(m){case"*":c=A(c,y);break;case"/":c=v(c,y);break;case"%":c=g(c,y);break}}return c}function k(){const c=r();if(c&&c.value==="!")return o("OP"),!k();if(c&&c.value==="-"){o("OP");const E=k();return u(0,E)}return N()}function N(){const c=r();if(c){if(c.type==="NUMBER")return o("NUMBER"),Number(c.value);if(c.type==="STRING")return o("STRING"),c.value.slice(1,-1);if(c.type==="IDENT")return o("IDENT"),c.value==="true"?!0:c.value==="false"?!1:c.value==="null"?null:void 0;if(c.value==="["){o("PUNC");const E=[];for(;;){const m=r();if(!m||m.value==="]")break;E.push(i());const y=r();y&&y.value===","&&o("PUNC")}return o("PUNC"),E}if(c.value==="("){o("PUNC");const E=i();return o("PUNC"),E}throw new Error("Unexpected token in expression")}}return i()}static tokenize(n){const t=[],s=/\s*(=>|===|!==|==|!=|>=|<=|\|\||&&|[()?:,[\]]|\+|-|\*|\/|%|>|<|!|\d+\.?\d*|"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|[a-zA-Z_][a-zA-Z0-9_]*|\S)\s*/g;let r;for(;(r=s.exec(n))!==null;){const o=r[1];o&&(/^\d/.test(o)?t.push({type:"NUMBER",value:o}):/^"/.test(o)||/^'/.test(o)?t.push({type:"STRING",value:o}):/^[a-zA-Z_]/.test(o)?t.push({type:"IDENT",value:o}):/^[()?:,[\]]$/.test(o)?t.push({type:"PUNC",value:o}):t.push({type:"OP",value:o}))}return t}static evaluateSimpleValue(n,t){if(n==="true")return!0;if(n==="false")return!1;if(!isNaN(Number(n)))return Number(n);if(n.startsWith("ctx.")){const s=n.slice(4);return f.getNestedValue(t,s)}return n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'")?n.slice(1,-1):n}static clearCache(){this.cache.clear()}static getCacheSize(){return this.cache.size}}class q{static cleanupFunctions=new WeakMap;static addListener(n,t,s,r){n.addEventListener(t,s,r);const i={event:t,handler:s,wrapper:s,options:r,cleanup:()=>n.removeEventListener(t,s,r),addedAt:Date.now()};this.cleanupFunctions.has(n)||this.cleanupFunctions.set(n,[]);const a=this.cleanupFunctions.get(n);a.push(i),a.__metaList=a}static removeListener(n,t,s,r){n.removeEventListener(t,s,r);const o=this.cleanupFunctions.get(n);if(o)for(let i=0;i<o.length;i++){const a=o[i];if(a.event===t&&a.handler===s){o.splice(i,1),o.length===0&&this.cleanupFunctions.delete(n);return}}}static cleanup(n){const t=this.cleanupFunctions.get(n);t&&(t.forEach(s=>{try{s.cleanup()}catch{}}),this.cleanupFunctions.delete(n))}static cleanupAll(){this.cleanupFunctions=new WeakMap}static hasListeners(n){const t=this.cleanupFunctions.get(n);return!!(t&&t.length>0)}static getListenerCount(n){const t=this.cleanupFunctions.get(n);return t?t.length:0}static getListenerInfo(n){const t=this.cleanupFunctions.get(n);return t?t.map(s=>({event:s.event,handler:s.handler,wrapper:s.wrapper,options:s.options})):[]}}function _e(e,n){return Array.isArray(e)&&Array.isArray(n)?JSON.stringify([...e].sort())!==JSON.stringify([...n].sort()):e!==n}function xe(e,n,t,s,r){if(e){const o=n.value;if(r&&typeof o=="object"&&o!==null){const i={...o};i[r]=t,n.value=i}else n.value=t}else{const o=s._state||s;f.setNestedValue(o,n,t)}}function Ae(e,n,t,s){if(typeof e._requestRender=="function"&&e._requestRender(),typeof e._triggerWatchers=="function"){const r=n?"reactiveState":t;e._triggerWatchers(r,s)}}function it(e,n,t){const s=`update:${f.toKebab(n)}`,r=`update:${n}`,o=new CustomEvent(s,{detail:t,bubbles:!0,cancelable:!0}),i=new CustomEvent(r,{detail:t,bubbles:!0,cancelable:!0});e.dispatchEvent(o),e.dispatchEvent(i)}function Ie(e,n,t,s){const r=t;if(f.safe(()=>{if(typeof e.setAttribute=="function")try{e[n]=r}catch{}else e[n]=r}),r==null||typeof r=="string"||typeof r=="number"||typeof r=="boolean"){const o=f.safeSerializeAttr(r);o!==null?f.safe(()=>{typeof e.setAttribute=="function"&&f.setAttributeSmart(e,f.toKebab(n),String(o))}):f.safe(()=>{typeof e.removeAttribute=="function"&&f.removeAttributeSmart(e,f.toKebab(n))})}}function ot(e,n,t,s){if(e){const r=n.value;return s&&typeof r=="object"&&r!==null?r[s]:r}else{const r=t._state||t;return f.getNestedValue(r,n)}}function ie(e){return e?e.split(/\s+/).filter(Boolean):[]}function oe(e,n){if(n.length===0)return;const t=n.filter(s=>s&&!e.classList.contains(s));t.length>0&&e.classList.add(...t)}function se(e,n){if(n.length===0)return;const t=n.filter(Boolean);t.length>0&&e.classList.remove(...t)}let we=!1;async function at(e,n,t=10){if(!we){if(!e.isConnected){P.devWarn("⚠️ Element not connected to DOM, skipping style wait");return}for(let s=0;s<t;s++){const r=window.getComputedStyle(e),o=r.transform&&r.transform!=="",i=r.opacity&&r.opacity!=="";if(o||i){we=!0;return}await new Promise(a=>requestAnimationFrame(()=>a(void 0)))}we=!0,P.devWarn("⚠️ Styles did not load in time for transition, continuing anyway")}}function ct(e){const n=window.getComputedStyle(e),t=n.transitionDuration||"0s",s=n.transitionDelay||"0s",r=o=>{const i=parseFloat(o);return o.includes("ms")?i:i*1e3};return r(t)+r(s)}function Ke(e,n){return new Promise(t=>{const s=n??ct(e);if(s<=0){t();return}let r=!1;const o=()=>{r||(r=!0,e.removeEventListener("transitionend",i),e.removeEventListener("transitioncancel",i),t())},i=()=>o();e.addEventListener("transitionend",i),e.addEventListener("transitioncancel",i),setTimeout(o,s+50)})}async function he(e,n){const{classes:t,hooks:s,css:r,duration:o}=n;if(s?.onBeforeEnter)try{s.onBeforeEnter(e)}catch(p){P.devError("Transition onBeforeEnter error:",p)}if(!r)return s?.onEnter?new Promise(p=>{const _=s.onEnter;typeof _=="function"?_(e,()=>{if(s?.onAfterEnter)try{s.onAfterEnter(e)}catch(l){P.devError("Transition onAfterEnter error:",l)}p()}):p()}):void 0;const i=ie(t?.enterFrom),a=ie(t?.enterActive),d=ie(t?.enterTo);oe(e,i),e.offsetHeight,oe(e,a),e.offsetHeight;let u;if(s?.onEnter){const p=new Promise(_=>{u=_});try{const _=s.onEnter;typeof _=="function"&&_(e,()=>{u&&u()})}catch(_){P.devError("Transition onEnter error:",_)}u&&await p}await new Promise(p=>requestAnimationFrame(()=>p(void 0))),e.offsetHeight;const A=window.getComputedStyle(e),v=A.transform,g=A.opacity;se(e,i),v&&v!=="none"&&(e.style.transform=v),g&&g!==""&&(e.style.opacity=g),e.offsetHeight,await new Promise(p=>requestAnimationFrame(()=>p(void 0))),e.style.transform="",e.style.opacity="",oe(e,d),e.offsetHeight,await new Promise(p=>requestAnimationFrame(()=>p(void 0)));let T;if(typeof o=="number"?T=o:o&&typeof o=="object"&&"enter"in o&&(T=o.enter),await Ke(e,T),se(e,a),s?.onAfterEnter)try{s.onAfterEnter(e)}catch(p){P.devError("Transition onAfterEnter error:",p)}}async function Le(e,n){const{classes:t,hooks:s,css:r,duration:o}=n;if(s?.onBeforeLeave)try{s.onBeforeLeave(e)}catch(v){P.devError("Transition onBeforeLeave error:",v)}if(!r)return s?.onLeave?new Promise(v=>{const g=s.onLeave;typeof g=="function"?g(e,()=>{if(s?.onAfterLeave)try{s.onAfterLeave(e)}catch(T){P.devError("Transition onAfterLeave error:",T)}v()}):v()}):void 0;const i=ie(t?.leaveFrom),a=ie(t?.leaveActive),d=ie(t?.leaveTo);oe(e,i),e.offsetHeight,oe(e,a);let u;if(s?.onLeave){const v=new Promise(g=>{u=g});try{const g=s.onLeave;typeof g=="function"&&g(e,()=>{u&&u()})}catch(g){P.devError("Transition onLeave error:",g)}u&&await v}await new Promise(v=>requestAnimationFrame(()=>v(void 0))),await at(e,[...i,...a]),se(e,i),oe(e,d);let A;if(typeof o=="number"?A=o:o&&typeof o=="object"&&"leave"in o&&(A=o.leave),await Ke(e,A),se(e,a),se(e,d),se(e,i),s?.onAfterLeave)try{s.onAfterLeave(e)}catch(v){P.devError("Transition onAfterLeave error:",v)}}const Ve=new WeakMap,Ue=new WeakMap;function Ce(e){if(!e)return;const n=Ve.get(e);if(n!==void 0)return n;try{const t=e;if(t&&t.key!=null)return String(t.key)}catch{}if(e instanceof Element){const t=e.getAttribute("data-anchor-key");if(t)return t}}function K(e,n){try{Ve.set(e,n)}catch{}try{e.key=n}catch{}try{if(e instanceof Element){const t=f.safeSerializeAttr(n);t!==null&&f.setAttributeSmart(e,"data-anchor-key",t)}}catch{}}function lt(e){if(!e)return;const n=Ue.get(e);if(n!==void 0)return n;try{const t=e;if(t&&t._transitionGroup!=null)return t._transitionGroup}catch{}}function ft(e,n){try{Ue.set(e,n)}catch{}try{e._transitionGroup=n}catch{}}function ae(e){return e!==null&&typeof e=="object"&&"value"in e}function Oe(e){try{if(f.isReactiveState(e))return e.value}catch{}try{if(ae(e))return e.value}catch{}return e}function Y(e,n,t){try{e&&e.attrs&&(e.attrs[n]=t)}catch{}}function U(e){return e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLButtonElement}function ce(e){return e===""?!0:typeof e=="string"?e==="false"?!1:e==="true"?!0:e!=="":e&&typeof e=="object"?f.isReactiveState(e)||"value"in e?!!e.value:!1:!!e}function re(e,n){if(!n||!(e instanceof Element))return;q.cleanup(e);for(const s in n)n[s]===e&&delete n[s];const t=e.childNodes;for(let s=0;s<t.length;s++)re(t[s],n)}function ye(e,n,t){if(typeof e=="string")return;const s=e.props?.reactiveRef??(e.props?.props&&e.props.props.reactiveRef),r=e.props?.ref??(e.props?.props&&e.props.props.ref);if(s)try{if(f.isReactiveState(s)||typeof s=="object"&&"value"in s)s.value=n;else if(typeof s=="function")s(n);else if(typeof s=="string"&&t)try{const o=String(s);t[o]=n}catch{}}catch{}else if(r&&t)try{const o=String(r);t[o]=n}catch{}}function ut(e,n,t,s,r,o,i,a){if(!o)return;const d=n.includes("lazy"),u=n.includes("trim"),A=n.includes("number"),v=()=>{if(f.isReactiveState(e)){const h=e.value;return a&&i&&(i instanceof HTMLInputElement||i instanceof HTMLTextAreaElement||i instanceof HTMLSelectElement)&&typeof h=="object"&&h!==null?h[a]:h}const b=o?._state||o;return f.getNestedValue(b,e)},g=v();let T="text";i instanceof HTMLInputElement?T=s?.type||i.type||"text":i instanceof HTMLSelectElement?T="select":i instanceof HTMLTextAreaElement&&(T="textarea");const p=i instanceof HTMLInputElement||i instanceof HTMLTextAreaElement||i instanceof HTMLSelectElement,l=p?T==="checkbox"||T==="radio"?"checked":"value":a??"modelValue";if(T==="checkbox")if(Array.isArray(g))t[l]=g.includes(String(i?.getAttribute("value")??s?.value??""));else{const b=i?.getAttribute("true-value")??!0;t[l]=g===b}else if(T==="radio")t[l]=g===(s?.value??"");else if(T==="select")if(i&&i.hasAttribute("multiple")&&i instanceof HTMLSelectElement){const b=Array.isArray(g)?g.map(String):[];setTimeout(()=>{Array.from(i.options).forEach(h=>{h.selected=b.includes(h.value)})},0),t[l]=Array.isArray(g)?g:[]}else t[l]=g;else{!p&&f.isReactiveState(e)?t[l]=e:t[l]=g;try{const b=f.toKebab(l);s&&(s[b]=g)}catch{}}const C=d||T==="checkbox"||T==="radio"||T==="select"?"change":"input",S=b=>{if(b.isComposing||r._isComposing)return;const h=globalThis.process,k=!!h&&h.env?.NODE_ENV==="test"||typeof window<"u"&&globalThis.__vitest__;if(b.isTrusted===!1&&!k)return;const N=b.target;if(!N||N._modelUpdating)return;let R=N.value;if(T==="checkbox"){const m=v();if(Array.isArray(m)){const y=N.getAttribute("value")??"",w=Array.from(m);if(N.checked)w.includes(y)||w.push(y);else{const M=w.indexOf(y);M>-1&&w.splice(M,1)}R=w}else{const y=N.getAttribute("true-value")??!0,w=N.getAttribute("false-value")??!1;R=N.checked?y:w}}else if(T==="radio")R=N.getAttribute("value")??N.value;else if(T==="select"&&N.multiple)R=Array.from(N.selectedOptions).map(m=>m.value);else if(u&&typeof R=="string"&&(R=R.trim()),A){const m=Number(R);isNaN(m)||(R=m)}const c=v();if(_e(R,c)){N._modelUpdating=!0;try{xe(f.isReactiveState(e),e,R,o,a),Ae(o,f.isReactiveState(e),e,R),N&&it(N,l,R)}finally{setTimeout(()=>N._modelUpdating=!1,0)}}};if(p){if(r[C]){const b=r[C];i&&q.removeListener(i,C,b)}r[C]=S}else{const b=`update:${f.toKebab(l)}`,h=`update:${l}`;if(r[b]){const k=r[b];i&&q.removeListener(i,b,k)}if(r[h]){const k=r[h];i&&q.removeListener(i,h,k)}if(r[b]=k=>{const N=k.detail;let R=N!==void 0?N:void 0;if(R===void 0){const m=k.target;if(m&&typeof m=="object"&&"value"in m)try{R=m.value}catch{R=void 0}}const c=ot(f.isReactiveState(e),e,o,a);if(_e(R,c)){xe(f.isReactiveState(e),e,R,o,a),Ae(o,f.isReactiveState(e),e,R);const m=k.target;m&&Ie(m,l,f.isReactiveState(e)?e:R,f.isReactiveState(e))}},f.isReactiveState(e)&&typeof e.value=="object"&&e.value!==null){let k=[];try{k=Reflect.ownKeys(e.value)}catch{k=Object.keys(e.value)}const N=k.filter(R=>typeof R=="string"&&!String(R).startsWith("_")&&R!=="constructor");for(const R of N){const c=String(R),E=`update:${f.toKebab(c)}`,m=`update:${c}`;r[E]||(r[E]=y=>{const w=y.detail!==void 0?y.detail:y.target?.value,M=f.isReactiveState(e)?e.value[c]:f.getNestedValue(o?._state||o,e);if(!_e(w,M))return;if(f.isReactiveState(e)){const x={...e.value};x[c]=w,e.value=x}else f.setNestedValue(o?._state||o,e,w);Ae(o,f.isReactiveState(e),e,w);const L=y.currentTarget||i||y.target;L&&Ie(L,l,f.isReactiveState(e)?e:w,f.isReactiveState(e))},r[m]=r[E])}}r[h]=r[b]}(T==="text"||T==="textarea")&&(r.compositionstart=()=>r._isComposing=!0,r.compositionend=b=>{r._isComposing=!1;const h=b.target;h&&setTimeout(()=>{const k=h.value,N=o?._state||o,R=f.getNestedValue(N,e);let c=k;if(u&&(c=c.trim()),A){const m=Number(c);isNaN(m)||(c=m)}if(_e(c,R)){h._modelUpdating=!0;try{f.setNestedValue(N,e,c),Ae(o,f.isReactiveState(e),e,c)}finally{setTimeout(()=>h._modelUpdating=!1,0)}}},0)})}function Fe(e){const n=e.slice(2);return n?n.charAt(0).toLowerCase()+n.slice(1):""}function dt(e,n,t,s,r){if(typeof e=="object"&&e!==null)for(const[o,i]of Object.entries(e))if(o.startsWith("data-")||o.startsWith("aria-")||o==="class")t[o]=i;else if(o==="disabled"&&r&&U(r)){const a=i&&typeof i=="object"&&"value"in i;(()=>{try{return f.isReactiveState(i)}catch{return!1}})()||a?n[o]=i:t[o]=i}else n[o]=i;else if(typeof e=="string"){if(!s)return;try{const o=Se(e,s);if(typeof o=="object"&&o!==null){for(const[i,a]of Object.entries(o))if(i.startsWith("data-")||i.startsWith("aria-")||i==="class")t[i]=a;else if(i==="disabled"&&r&&U(r)){const d=a&&typeof a=="object"&&"value"in a;(()=>{try{return f.isReactiveState(a)}catch{return!1}})()||d?n[i]=a:t[i]=a}else n[i]=a;return}else{t[e]=o;return}}catch{const o=f.getNestedValue(s,e);t[e]=o}}}function pt(e,n,t){let s;if(typeof e=="string"){if(!t)return;s=Se(e,t)}else s=e;const r=String(n.style||"");let o=r;if(s){if(r){const i=String(r).split(";").map(d=>d.trim()).filter(Boolean),a=i.findIndex(d=>d.startsWith("display:"));a>=0&&i[a]==="display: none"&&(i.splice(a,1),o=i.length>0?i.join("; ")+";":"")}}else if(r){const i=String(r).split(";").filter(Boolean),a=i.findIndex(d=>d.trim().startsWith("display:"));a>=0?i[a]="display: none":i.push("display: none"),o=i.join("; ")}else o="display: none";o!==r&&(o?n.style=o:n.style=void 0)}function Se(e,n){return st.evaluate(e,n)}function ht(e,n,t,s){let r;if(typeof e=="string"){if(!t)return;r=Se(e,t)}else r=e;try{if(r&&typeof r=="object"){if(f.isReactiveState(r))r=r.value;else if("value"in r&&typeof r.value<"u"){const u=r.value;u instanceof Node||(r=u)}}}catch{}let o=[];if(typeof r=="string")o=[r];else if(Array.isArray(r))o=r.filter(Boolean);else if(typeof r=="object"&&r!==null)for(const[u,A]of Object.entries(r))A&&o.push(u);const i=o.join(" "),a=s&&s.class||n.class||"",d=a?`${a} ${i}`.trim():i.trim();d?n.class=d:n.class=void 0}function Me(e){if(e===!0||e===!1)return!0;if(e==null)return!1;if(typeof e==="string")return e===""||e==="true"||e==="false";try{if(e&&typeof e=="object"&&"value"in e){const t=e.value,s=typeof t;return s==="boolean"?!0:s==="string"?t===""||t==="true"||t==="false":!1}}catch{}return!1}function yt(e,n,t){let s;if(typeof e=="string"){if(!t)return;s=Se(e,t)}else s=e;let r="";if(typeof s=="string")r=s;else if(s&&typeof s=="object"){const i=[];for(const[a,d]of Object.entries(s))if(d!=null&&d!==""){const u=a.replace(/[A-Z]/g,g=>`-${g.toLowerCase()}`),A=["width","height","top","right","bottom","left","margin","margin-top","margin-right","margin-bottom","margin-left","padding","padding-top","padding-right","padding-bottom","padding-left","font-size","line-height","border-width","border-radius","min-width","max-width","min-height","max-height"];let v=String(d);typeof d=="number"&&A.includes(u)&&(v=`${d}px`),i.push(`${u}: ${v}`)}r=i.join("; ")+(i.length>0?";":"")}const o=String(n.style||"");n.style=o+(o&&!o.endsWith(";")?"; ":"")+r}function mt(e,n,t){let s=e;typeof e=="string"&&t&&(s=Se(e,t)),f.isReactiveState(s)?n.reactiveRef=s:n.ref=s}function qe(e,n,t,s){const r={},o={...s||{}},i={};for(const[a,d]of Object.entries(e)){const{value:u,modifiers:A,arg:v}=d;if(a==="model"||a.startsWith("model:")){const g=a.split(":"),T=g.length>1?g[1]:v;ut(u,A,r,o,i,n,t,T);continue}switch(a){case"bind":dt(u,r,o,n,t);break;case"show":pt(u,o,n);break;case"class":ht(u,o,n,s);break;case"style":yt(u,o,n);break;case"ref":mt(u,r,n);break}}try{if(Object.prototype.hasOwnProperty.call(r,"disabled")&&t&&U(t)){const d=r.disabled,u=d&&typeof d=="object"&&"value"in d;let A=!1;try{A=f.isReactiveState(d)}catch{A=!1}if(!u&&!A)try{o.disabled=d,delete r.disabled;const v=globalThis;v.__VDOM_DISABLED_PROMOTIONS||(v.__VDOM_DISABLED_PROMOTIONS=[]),v.__VDOM_DISABLED_PROMOTIONS.push({phase:"bind-directive:postfix-move",location:"attrs",key:"disabled",value:d,time:Date.now(),stack:new Error().stack})}catch{}}}catch{}return{props:r,attrs:o,listeners:i}}function $e(e,n){if(Array.isArray(e)){const o=new Set;return e.map(i=>{if(!i||typeof i!="object")return i;let a=i.props?.key??i.key;if(!a){const v=i.tag||"node",T=[i.props?.attrs?.id,i.props?.attrs?.name,i.props?.attrs?.["data-key"],i.props?.props?.id,i.props?.props?.name,i.props?.props?.dataKey,i.props?.props?.["data-key"]].find(p=>p!=null)??"";a=T?`${n}:${v}:${T}`:`${n}:${v}`}let d=a,u=1;for(;o.has(d);)d=`${a}#${u++}`;o.add(d);let A=i.children;return Array.isArray(A)&&(A=$e(A,d)),{...i,key:d,children:A}})}const t=e,s=t.props?.key??t.key??n;let r=t.children;return Array.isArray(r)&&(r=$e(r,s)),{...t,key:s,children:r}}function Be(e,n,t,s){const r=t.directives??{},o=qe(r,s,e,t.attrs),i={...n.props||{},...t.props||{},...o.props||{}},a={...n.attrs||{},...t.attrs||{},...o.attrs||{}},d=n.props??{},u=i,A=!!(t?.isCustomElement??n?.isCustomElement??!1);let v=!1;for(const p in{...d,...u}){const _=d[p],l=u[p];let C=_,S=l;if(f.safe(()=>{(f.isReactiveState(_)||ae(_))&&(C=_.value)}),f.safe(()=>{(f.isReactiveState(l)||ae(l))&&(S=l.value)}),!(_===l&&C===S))if(v=!0,p==="value"&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)){const b=Oe(l),h=b==null?"":String(b);e.value!==h&&(e.value=h)}else if(p==="checked"&&e instanceof HTMLInputElement){const b=Oe(l);e.checked=!!b}else if(p.startsWith("on")&&typeof l=="function"){const b=Fe(p);typeof _=="function"&&q.removeListener(e,b,_),typeof l=="function"&&q.addListener(e,b,l);try{if(b&&b.startsWith("update:")){const h=b.split(":",2)[1],k=u[h];let N=[];try{if(f.isReactiveState(k)){const c=k.value;N=c&&typeof c=="object"?Object.keys(c):[]}else k&&typeof k=="object"&&(N=Object.keys(k))}catch{N=[]}const R=N.filter(c=>typeof c=="string"&&!c.startsWith("_")&&c!=="constructor");for(const c of R){const E=`update:${c}`,m=y=>{const w=y.detail!==void 0?y.detail:y.target instanceof HTMLInputElement||y.target instanceof HTMLTextAreaElement||y.target instanceof HTMLSelectElement?y.target.value:void 0,O={...f.isReactiveState(k)?k.value||{}:u[h]||{},[c]:w};try{typeof l=="function"&&l({detail:O})}catch{}};f.safe(()=>{q.addListener(e,E,m)})}}}catch{}}else if(l==null)f.removeAttributeSmart(e,p);else{const b=t?.isCustomElement??n?.isCustomElement??!1;if(b||p in e)try{e[p]=l,p==="disabled"&&l===!1&&!b&&U(e)&&f.removeAttributeSmart(e,"disabled")}catch{}else l===!1&&f.removeAttributeSmart(e,p)}}for(const[p,_]of Object.entries(o.listeners||{})){q.addListener(e,p,_);try{const l=e&&e.parentElement;l&&l!==e&&q.addListener(l,p,_)}catch{}}const g={...n.attrs??{}},T=a;try{const p=o&&o.attrs||{};if(Object.prototype.hasOwnProperty.call(p,"class")&&p.class===void 0&&typeof e.getAttribute=="function"){const _=e.getAttribute("class");_!==null&&(g.class=_)}if(Object.prototype.hasOwnProperty.call(p,"style")&&p.style===void 0&&typeof e.getAttribute=="function"){const _=e.getAttribute("style");_!==null&&(g.style=_)}try{if(typeof e.getAttribute=="function"){const _=e.getAttribute("class");try{e instanceof HTMLInputElement&&e.type==="text"&&_!==null&&_!==g.class&&(g.class=_)}catch{}}}catch{}}catch{}for(const p in{...g,...T}){const _=g[p],l=T[p];let C=_,S=l;if(f.isReactiveState(_)&&(C=_.value),f.isReactiveState(l)&&(S=l.value),C!==S)if(v=!0,S==null||S===!1)f.safe(()=>{f.removeAttributeSmart(e,p)}),Y(n,p,void 0),p==="value"&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement?f.safe(()=>{e.value=""}):e instanceof HTMLSelectElement?f.safe(()=>{e.value=""}):e instanceof HTMLProgressElement&&f.safe(()=>{e.value=0})),p==="checked"&&e instanceof HTMLInputElement&&f.safe(()=>{e.checked=!1}),p==="disabled"&&U(e)&&f.safe(()=>{(e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLButtonElement)&&(e.disabled=!1)});else{if(p==="value"){if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement){f.safe(()=>{e.value=S??""});continue}else if(e instanceof HTMLSelectElement){f.safe(()=>{e.value=S??""});continue}else if(e instanceof HTMLProgressElement){f.safe(()=>{e.value=Number(S)});continue}}if(p==="checked"&&e instanceof HTMLInputElement){f.safe(()=>{e.checked=!!S});continue}if(p==="style"){const h=f.safeSerializeAttr(S);h!==null&&f.setAttributeSmart(e,p,String(h)),Y(n,p,S);continue}if(p==="class"){const h=f.safeSerializeAttr(S);h!==null&&f.setAttributeSmart(e,p,String(h)),Y(n,p,S);continue}if(p==="disabled"&&U(e)){f.safe(()=>{const h=ce(S);(e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLButtonElement)&&(e.disabled=h)}),ce(S)?f.safe(()=>{f.setAttributeSmart(e,p,"")}):f.safe(()=>{f.removeAttributeSmart(e,p)});continue}const b=e.namespaceURI==="http://www.w3.org/2000/svg";if(A&&!b&&p.includes("-"))if(f.isClassLikeAttr(p)){const h=f.safeSerializeAttr(l??S);if(h!==null){try{f.setAttributeSmart(e,p,String(h))}catch{}Y(n,p,S)}}else{const h=f.toCamel(p);try{const k=e;k[h]=f.isReactiveState(l)?l:S,Y(n,p,S)}catch{const k=f.safeSerializeAttr(l??S);k!==null&&f.setAttributeSmart(e,p,String(k))}}else if(!b&&p in e)try{const h=e;h[p]=f.isReactiveState(l)?l:S,Y(n,p,S)}catch{const h=f.safeSerializeAttr(S);h!==null&&(f.setAttributeSmart(e,p,String(h)),Y(n,p,S))}else{const h=f.safeSerializeAttr(S);h!==null&&(f.setAttributeSmart(e,p,String(h)),Y(n,p,S))}}}try{if(U(e)){const p=i.disabled;let _;try{const C=Object.prototype.hasOwnProperty.call(o.props||{},"disabled"),S=p&&typeof p=="object"&&"value"in p;let b=!1;f.safe(()=>{b=!!f.isReactiveState(p)});const h=Me(p);b||S||C||h?_=p:_=a.disabled}catch{_=a.disabled}const l=ce(_);f.safe(()=>{(e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLButtonElement)&&(e.disabled=l)}),l?f.safe(()=>{f.setAttributeSmart(e,"disabled","")}):f.safe(()=>{f.removeAttributeSmart(e,"disabled")})}}catch{}if(A&&v){const p=e;f.safe(()=>{p._applyProps?.(p._cfg)}),f.safe(()=>{typeof p.requestRender=="function"?p.requestRender():typeof p._render=="function"&&p._render?.(p._cfg)})}}function V(e,n,t,s=null){if(typeof e=="string")return document.createTextNode(e);if(e.tag==="#text"){const l=document.createTextNode(typeof e.children=="string"?e.children:"");return e.key!=null&&K(l,e.key),l}if(e.tag==="#raw"){const l=typeof e.children=="string"?e.children:"";return document.createRange().createContextualFragment(l)}if(e.tag==="#anchor"){const l=e,C=Array.isArray(l.children)?l.children:[],S=document.createTextNode(""),b=document.createTextNode("");l.key!=null&&(K(S,`${l.key}:start`),K(b,`${l.key}:end`)),l._startNode=S,l._endNode=b;const h=document.createDocumentFragment();h.appendChild(S);for(const k of C){const N=V(k,n,t,s);if(l.key!=null&&N instanceof Element&&!N.hasAttribute("data-anchor-key")){const R=k;R&&typeof R=="object"&&R.key!=null||K(N,String(l.key))}h.appendChild(N)}return h.appendChild(b),h}const r=e&&typeof e=="object"&&e.props&&e.props.attrs?e.props.attrs:void 0,i=(r&&typeof r.xmlns=="string"?String(r.xmlns):void 0)??s??f.TAG_NAMESPACE_MAP[e.tag]??null,a=i?document.createElementNS(i,e.tag):document.createElement(e.tag);e.key!=null&&K(a,e.key),e.props&&e.props?._transitionGroup&&ft(a,e.props?._transitionGroup);const{props:d={},attrs:u={},directives:A={}}=e.props??{},v=qe(A,n,a instanceof HTMLElement?a:void 0,u),g={...d,...v.props},T={...u,...v.attrs};try{const l=(T&&T.class)??(g&&g.class)??(e.props&&e.props.attrs&&e.props.attrs.class)??(e.props&&e.props.props&&e.props.props.class),C=f.safeSerializeAttr(l);if(C!==null){const S=String(C).trim();S&&f.setAttributeSmart(a,"class",S)}}catch{}try{if(g.disabled!==void 0&&a&&U(a)){const l=g.disabled,C=l&&typeof l=="object"&&"value"in l;let S=!1;try{S=f.isReactiveState(l)}catch{S=!1}!C&&!S&&f.safe(()=>{T.disabled=l,delete g.disabled})}}catch{}const p=a.namespaceURI==="http://www.w3.org/2000/svg";for(const l in T){const C=T[l];if(typeof l!="string"||/\[object Object\]/.test(l))continue;const S=Oe(C);if(typeof S=="boolean")S?f.setAttributeSmart(a,l,""):f.safe(()=>{f.removeAttributeSmart(a,l)});else if(S!=null){if(l==="disabled"&&U(a)){const b=g.disabled,h=Me(b)?b:S,k=ce(h);f.safe(()=>{a.disabled=k}),k?f.safe(()=>{f.setAttributeSmart(a,l,"")}):f.safe(()=>{f.removeAttributeSmart(a,l)});continue}if(!p&&l==="value"&&(a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement||a instanceof HTMLSelectElement||a instanceof HTMLProgressElement))try{a instanceof HTMLProgressElement?a.value=Number(S):a.value=String(S??"")}catch{const b=f.safeSerializeAttr(S);b!==null&&f.setAttributeSmart(a,l,String(b))}else if(!p&&l==="checked"&&a instanceof HTMLInputElement)try{a.checked=!!S}catch{const b=f.safeSerializeAttr(S);b!==null&&f.setAttributeSmart(a,l,String(b))}else if(!p&&l in a)try{a[l]=S,l==="disabled"&&S===!1&&U(a)&&f.removeAttributeSmart(a,"disabled"),Y(e.props,l,S)}catch{const b=f.safeSerializeAttr(S);b!==null&&f.setAttributeSmart(a,l,String(b))}else if((e.props?.isCustomElement??!1)&&!p&&l.includes("-")){const h=f.toCamel(l);try{a[h]=S}catch{const k=f.safeSerializeAttr(S);k!==null&&f.setAttributeSmart(a,l,String(k))}}else{const h=f.safeSerializeAttr(S);h!==null&&f.setAttributeSmart(a,l,String(h))}}}for(const l in g){const C=g[l];if(!(typeof l!="string"||/\[object Object\]/.test(l)))if(l==="value"&&(a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement||a instanceof HTMLSelectElement)){const S=typeof C=="object"&&C!==null&&ae(C)?C.value:C;f.safe(()=>{a.value=String(S??"")})}else if(l.startsWith("on")&&typeof C=="function"){const S=Fe(l),b=S.includes(":")?(()=>{const h=S.split(":"),k=h[1];if(k.includes("-")){const N=k.split("-").map((R,c)=>c===0?R:R.charAt(0).toUpperCase()+R.slice(1)).join("");return`${h[0]}:${N}`}else{const N=k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return`${h[0]}:${N}`}})():S;v.listeners&&(v.listeners[S]||v.listeners[b])||q.addListener(a,S,C)}else{if(l.startsWith("on")&&C===void 0)continue;if(C==null||C===!1)f.removeAttributeSmart(a,l);else{const S=e.props?.isCustomElement??!1,b=typeof C=="object"&&C!==null&&f.isReactiveState(C)?C:ae(C)&&typeof C.value<"u"?C.value:C;if(l==="class"||l==="style"){try{const h=f.safeSerializeAttr(b);h!==null&&f.setAttributeSmart(a,l,String(h))}catch{}continue}if(S||l in a)try{const h=typeof C=="object"&&C!==null&&f.isReactiveState(C)?C:ae(C)?C.value:C;if(l==="disabled"&&U(a)){const k=g.disabled!==void 0?g.disabled:h,N=ce(k);f.safe(()=>{a.disabled=N}),N?f.safe(()=>{f.setAttributeSmart(a,l,"")}):f.safe(()=>{f.removeAttributeSmart(a,l)});continue}try{if(typeof a[l]=="boolean"){let N=h;typeof h=="string"?h==="false"?N=!1:h==="true"?N=!0:N=!!h&&h!=="":N=!!h,a[l]=N}else a[l]=h}catch{a[l]=h}}catch{}}}}for(const[l,C]of Object.entries(v.listeners||{}))q.addListener(a,l,C);const _={...e,props:{...e.props,...v.props}};ye(_,a,t);try{const l=a;if(typeof l._applyProps=="function")try{l._applyProps(l._cfg)}catch{}typeof l.requestRender=="function"?l.requestRender():typeof l._render=="function"&&l._render(l._cfg)}catch{}if(Array.isArray(e.children)){const l=e.tag==="foreignObject"&&i===f.SVG_NS?null:a.namespaceURI??null;for(const C of e.children)a.appendChild(V(C,n,t,l))}else typeof e.children=="string"&&(a.textContent=e.children);try{if(a instanceof HTMLSelectElement&&T&&Object.prototype.hasOwnProperty.call(T,"value"))try{a.value=String(T.value??"")}catch{}}catch{}try{if(U(a)){const l=g.disabled,C=T.disabled,S=l&&typeof l=="object"&&"value"in l;let b=!1;try{b=!!f.isReactiveState(l)}catch{b=!1}const k=b||S||Me(l)?l:C,N=ce(k);f.safe(()=>{a.disabled=N}),N?f.safe(()=>{f.setAttributeSmart(a,"disabled","")}):f.safe(()=>{f.removeAttributeSmart(a,"disabled")})}}catch{}return a}function gt(e,n,t,s,r){if(typeof t=="string"){e.textContent!==t&&(e.textContent=t);return}if(!Array.isArray(t))return;const o=e.childNodes,i=[];for(let _=0;_<o.length;_++)i.push(o[_]);const a=Array.isArray(n)?n:[],d=lt(e);if(d){const _=b=>{if(typeof b=="string")return b.startsWith("each-")?b.substring(5):b;if(typeof b=="number")return String(b)},l=[],C=[];for(const b of t)if(b&&b.tag==="#anchor"){const h=Array.isArray(b.children)?b.children:[];for(const k of h){const N=_(k.key??b.key??"unknown");l.push({...k,key:N})}}else b&&l.push({...b,key:_(b.key)});for(const b of a)if(b&&b.tag==="#anchor"){const h=Array.isArray(b.children)?b.children:[];for(const k of h){const N=_(k.key??b.key??"unknown");C.push({...k,key:N})}}else b&&C.push({...b,key:_(b.key)});if(l.some(b=>b&&b.key!=null)||C.some(b=>b&&b.key!=null)){const b=new Map,h=new Map;for(const m of C)if(m&&m.key!=null){const y=String(m.key);b.set(y,m)}for(let m=0;m<i.length;m++){const y=i[m];let w=Ce(y);if(w=_(w),w!=null&&y instanceof Element&&y.nodeType===Node.ELEMENT_NODE){let M=typeof w=="string"&&w.includes(":")?w.substring(0,w.lastIndexOf(":")):w;M=String(M),h.set(M,y)}}const k=new Set,N=new Map,R=i.length>0;if(d.moveClass&&R)for(let m=0;m<i.length;m++){const y=i[m];if(y instanceof HTMLElement&&y.parentElement){const w=y.getBoundingClientRect();N.set(y,w)}}const c=[];for(const m of l){let y=m.key;if(y==null)continue;y=String(y);const w=b.get(y);let M=h.get(y);if(M&&w){const O=me(M,w,m,s);k.add(M);const L=String(y);K(O,L),c.push({node:O,key:y,newVNode:m,oldVNode:w,isNew:!1})}else{M=V(m,s,void 0,e instanceof Element?e.namespaceURI??null:null),K(M,String(y)),e.appendChild(M);const O=R||d.appear===!0;M instanceof HTMLElement&&O&&he(M,d).catch(L=>{P.devError("Enter transition error:",L)}),c.push({node:M,key:y,newVNode:m,isNew:!0})}}const E=[];for(let m=0;m<i.length;m++){const y=i[m],w=Ce(y);if(!k.has(y)&&w!=null&&y instanceof HTMLElement){const O=Le(y,d).then(()=>{e.contains(y)&&e.removeChild(y)}).catch(L=>{P.devError("Leave transition error:",L),e.contains(y)&&e.removeChild(y)});E.push(O)}}if(E.length===0){let m=e.firstChild;for(const{node:y}of c)y!==m&&e.insertBefore(y,m),m=y.nextSibling;if(d.moveClass&&N.size>0){const y=[];for(const{node:w,isNew:M}of c)if(!M&&w instanceof HTMLElement){const O=N.get(w);if(O){const L=w.getBoundingClientRect(),x=O.left-L.left,j=O.top-L.top;if(x!==0||j!==0){const G=d.moveClass.split(/\s+/).filter(D=>D);y.push({node:w,deltaX:x,deltaY:j,moveClasses:G})}}}if(y.length>0){for(const{node:w,deltaX:M,deltaY:O}of y)w.style.transform=`translate(${M}px, ${O}px)`,w.style.transitionProperty="none";e.offsetHeight,requestAnimationFrame(()=>{requestAnimationFrame(()=>{for(const{node:w,moveClasses:M}of y)for(const O of M)w.classList.add(O);requestAnimationFrame(()=>{const w=d.moveClass||"",M=w.match(/duration-(\d+)/),O=M?`${M[1]}ms`:"300ms",L=w.match(/ease-(out|in|in-out|linear)/),x=L?`ease-${L[1]}`:"ease-out";for(const{node:j}of y)j.style.transition=`transform ${O} ${x}`;requestAnimationFrame(()=>{for(const{node:j,moveClasses:G}of y){j.style.removeProperty("transform");const D=()=>{for(const H of G)j.classList.remove(H);j.style.removeProperty("transition"),j.removeEventListener("transitionend",D),j.removeEventListener("transitioncancel",D)};j.addEventListener("transitionend",D,{once:!0}),j.addEventListener("transitioncancel",D,{once:!0})}})})})})}}}return}}const u=new Map;for(const _ of a)_&&_.key!=null&&u.set(_.key,_);const A=new Map;for(let _=0;_<i.length;_++){const l=i[_],C=Ce(l);C!=null&&A.set(C,l)}const v=new Set;let g=e.firstChild;function T(_,l){let C=_;for(;C&&(v.add(C),C!==l);)C=C.nextSibling}function p(_,l,C,S,b,h=!0){const k=[];let N=_.nextSibling;for(;N&&N!==l;)k.push(N),N=N.nextSibling;const R=Array.isArray(C)?C:[];if(S.some(E=>E&&E.key!=null)||R.some(E=>E&&E.key!=null)){const E=new Map,m=new Map;for(const O of R)O&&O.key!=null&&E.set(O.key,O);for(const O of k){const L=Ce(O);L!=null&&m.set(L,O)}const y=b&&b.state==="visible"&&R.length===0&&S.length>0,w=new Set;let M=_.nextSibling;for(const O of S){let L;if(O.key!=null&&m.has(O.key)){const x=E.get(O.key);L=me(m.get(O.key),x,O,s),w.add(L),b&&L instanceof HTMLElement&&y&&b.appear&&he(L,b).catch(j=>{P.devError("Transition enter error (appear):",j)}),L!==M&&e.contains(L)&&e.insertBefore(L,M)}else L=V(O,s,void 0,e instanceof Element?e.namespaceURI??null:null),e.insertBefore(L,M),w.add(L),b&&L instanceof HTMLElement&&h&&he(L,b).catch(x=>{P.devError("Transition enter error:",x)});M=L.nextSibling}for(const O of k)!w.has(O)&&e.contains(O)&&(b&&O instanceof HTMLElement&&h?Le(O,b).then(()=>{e.contains(O)&&e.removeChild(O)}).catch(L=>{P.devError("Transition leave error:",L),e.contains(O)&&e.removeChild(O)}):e.removeChild(O))}else{const E=Math.min(R.length,S.length);for(let m=0;m<E;m++){const y=R[m],w=S[m],M=me(k[m],y,w,s);M!==k[m]&&(e.insertBefore(M,k[m]),e.removeChild(k[m]))}for(let m=E;m<S.length;m++){const y=V(S[m],s,void 0,e instanceof Element?e.namespaceURI??null:null);e.insertBefore(y,l),b&&y instanceof HTMLElement&&h&&he(y,b).catch(w=>{P.devError("Transition enter error:",w)})}for(let m=E;m<k.length;m++){const y=k[m];b&&y instanceof HTMLElement&&h?Le(y,b).then(()=>{e.contains(y)&&e.removeChild(y)}).catch(w=>{P.devError("Transition leave error:",w),e.contains(y)&&e.removeChild(y)}):e.removeChild(y)}}}for(const _ of t){let l;if(_.tag==="#anchor"){const C=_.key,S=`${C}:start`,b=`${C}:end`;let h=A.get(S),k=A.get(b);const N=Array.isArray(_.children)?_.children:[];if(h||(h=document.createTextNode(""),K(h,S)),k||(k=document.createTextNode(""),K(k,b)),_._startNode=h,_._endNode=k,!e.contains(h)||!e.contains(k)){e.insertBefore(h,g);const R=_._transition,E=!(R&&R.state==="visible"&&N.length>0)||R.appear;for(const m of N){const y=V(m,s,r,e instanceof Element?e.namespaceURI??null:null);e.insertBefore(y,g),R&&y instanceof HTMLElement&&E&&he(y,R).catch(w=>{P.devError("Transition enter error:",w)})}e.insertBefore(k,g)}else{const R=_._transition,E=u.get(C)._transition,m=E&&E.state!==R?.state,y=R&&R.state==="visible"&&N.length>0&&!m,w=m||!y||R?.appear===!0;p(h,k,u.get(C)?.children,N,R,w)}T(h,k),g=k.nextSibling;continue}if(_.key!=null&&A.has(_.key)){const C=u.get(_.key);l=me(A.get(_.key),C,_,s,r),v.add(l),l!==g&&e.contains(l)&&(g&&!e.contains(g)&&(g=null),e.insertBefore(l,g))}else l=V(_,s,r,e instanceof Element?e.namespaceURI??null:null),g&&!e.contains(g)&&(g=null),e.insertBefore(l,g),v.add(l);g=l.nextSibling}for(let _=0;_<i.length;_++){const l=i[_];!v.has(l)&&e.contains(l)&&(re(l,r),e.removeChild(l))}}function me(e,n,t,s,r){if(n&&typeof n!="string"&&n.props?.ref&&r&&re(e,r),n===t)return e;if(typeof t=="string"){if(e.nodeType===Node.TEXT_NODE)return e.textContent!==t&&(e.textContent=t),e;{const i=document.createTextNode(t);return e.parentNode?.replaceChild(i,e),i}}if(t&&typeof t!="string"&&t.tag==="#anchor"){const i=t,a=Array.isArray(i.children)?i.children:[],d=i._startNode??document.createTextNode(""),u=i._endNode??document.createTextNode("");i.key!=null&&(K(d,`${i.key}:start`),K(u,`${i.key}:end`)),i._startNode=d,i._endNode=u;const A=document.createDocumentFragment();A.appendChild(d);for(const v of a){const g=V(v,s,r,e.parentNode instanceof Element?e.parentNode.namespaceURI??null:null);A.appendChild(g)}return A.appendChild(u),e.parentNode?.replaceChild(A,e),d}if(!t){re(e,r);const i=document.createComment("removed");return e.parentNode?.replaceChild(i,e),i}if(!n||typeof n=="string"){re(e,r);const i=V(t,s,r,e.parentNode instanceof Element?e.parentNode.namespaceURI??null:null);return ye(t,i,r),e.parentNode?.replaceChild(i,e),i}if(t.tag==="#anchor"){const i=Array.isArray(t.children)?t.children:[],a=t._startNode??document.createTextNode(""),d=t._endNode??document.createTextNode("");t.key!=null&&(K(a,`${t.key}:start`),K(d,`${t.key}:end`)),t._startNode=a,t._endNode=d;const u=document.createDocumentFragment();u.appendChild(a);for(const A of i)u.appendChild(V(A,s,r,e.parentNode instanceof Element?e.parentNode.namespaceURI??null:null));return u.appendChild(d),e.parentNode?.replaceChild(u,e),a}if(typeof n!="string"&&typeof t!="string"&&n.tag===t.tag&&n.key===t.key){const i=e;return Be(i,n.props||{},t.props||{},s),gt(i,n.children,t.children,s,r),ye(t,i,r),i}if(typeof n!="string"&&typeof t!="string"&&n.tag===t.tag&&(n.tag&&String(n.tag).includes("-")||t.props&&t.props.isCustomElement||n.props&&n.props.isCustomElement))try{const a=e;return Be(a,n.props||{},t.props||{},s),ye(t,a,r),a}catch{}re(e,r);const o=V(t,s,r,e.parentNode instanceof Element?e.parentNode.namespaceURI??null:null);return ye(t,o,r),e.parentNode?.replaceChild(o,e),o}function bt(e,n,t,s){let r;Array.isArray(n)?n.length===1?(r=n[0],r&&typeof r=="object"&&r.key==null&&(r={...r,key:"__root__"})):r={tag:"div",key:"__root__",children:n}:(r=n,r&&typeof r=="object"&&r.key==null&&(r={...r,key:"__root__"})),r&&typeof r=="object"&&r.tag==="#anchor"&&(r={tag:"div",key:"__anchor_root__",props:{attrs:{"data-anchor-block-root":"",key:"__anchor_root__"}},children:[r]}),r=$e(r,String(r.key??"root"));const o=e._prevVNode??null,i=e._prevDom??e.firstChild??null;let a;o&&i?typeof o!="string"&&typeof r!="string"&&o.tag===r.tag&&o.key===r.key?a=me(i,o,r,t,s):(a=V(r,t,s,e.host instanceof Element?e.host.namespaceURI??null:null),e.replaceChild(a,i)):(a=V(r,t,s,e.host instanceof Element?e.host.namespaceURI??null:null),e.firstChild?e.replaceChild(a,e.firstChild):e.appendChild(a));const d=[];for(let u=0;u<e.childNodes.length;u++){const A=e.childNodes[u];A!==a&&A.nodeName!=="STYLE"&&(re(A,s),d.push(A))}d.forEach(u=>e.removeChild(u)),e._prevVNode=r,e._prevDom=a}const ge=[];function St(e,n,t,s,r,o,i,a){if(e){ge.push(t);try{const d=n.render(t);if(d instanceof Promise){o(!0),d.then(u=>{o(!1),i(null),We(e,u,t,s,r),a(e.innerHTML)}).catch(u=>{o(!1),i(u)});return}We(e,d,t,s,r),a(e.innerHTML)}finally{ge.pop()}}}function We(e,n,t,s,r){e&&(bt(e,Array.isArray(n)?n:[n],t,s),r(e.innerHTML))}function vt(e,n,t,s,r,o,i){if(o!==null&&clearTimeout(o),Date.now()-n<16){if(r(t+1),t===15)P.devWarn(`⚠️ Component is re-rendering rapidly. This might indicate:
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./namespace-helpers-DwMMXN9Q.cjs"),j=require("./logger-CqdBMdui.cjs"),D=require("./transitions-BAjG4ZyQ.cjs");function tt(e,n,t){if(t)for(const[s,r]of Object.entries(t)){let i,o={};if(Array.isArray(r)?(i=r[0],o=r[1]||{}):i=r,n.set(s,{callback:i,options:o,oldValue:c.getNestedValue(e,s)}),o.immediate)try{const a=c.getNestedValue(e,s);i(a,void 0,e)}catch(a){j.devError(`Error in immediate watcher for "${s}":`,a)}}}function nt(e,n,t,s){const r=(o,a)=>{if(o===a)return!0;if(typeof o!=typeof a||typeof o!="object"||o===null||a===null)return!1;if(Array.isArray(o)&&Array.isArray(a))return o.length!==a.length?!1:o.every((b,w)=>r(b,a[w]));const u=o,d=a,E=Object.keys(u||{}),v=Object.keys(d||{});return E.length!==v.length?!1:E.every(b=>r(u[b],d[b]))},i=n.get(t);if(i&&!r(s,i.oldValue))try{i.callback(s,i.oldValue,e),i.oldValue=s}catch(o){j.devError(`Error in watcher for "${t}":`,o)}for(const[o,a]of n.entries())if(a.options.deep&&t.startsWith(o+"."))try{const u=c.getNestedValue(e,o);r(u,a.oldValue)||(a.callback(u,a.oldValue,e),a.oldValue=u)}catch(u){j.devError(`Error in deep watcher for "${o}":`,u)}}function Ne(e,n){return n===Boolean?e===""||e==="true":n===Number?Number(e):e}function rt(e,n,t){if(n)for(const s in n){const r=n[s],i=c.toKebab(s),o=e.getAttribute(i);if(r.type===Function&&typeof e[s]=="function")t[s]=e[s];else if(o!==null)t[s]=Ne(o,r.type);else if(typeof e[s]<"u")try{const a=e[s];if(r.type===String&&a&&typeof a=="object")try{t[s]=Ne(String(a),r.type)}catch{t[s]=a}else r.type===Boolean&&typeof a=="boolean"||r.type===Number&&typeof a=="number"||r.type===Function&&typeof a=="function"?t[s]=a:t[s]=Ne(String(a),r.type)}catch{t[s]=e[s]}else"default"in r&&r.default!==void 0&&(t[s]=r.default)}}function st(e,n,t){if(!n.props){try{const s=t?._hookCallbacks?.props||{},r=Array.from(new Set([...Object.keys(e||{}),...Object.keys(s||{})]));for(const i of r){if(typeof i!="string"||i.startsWith("_"))continue;const o=Object.getOwnPropertyDescriptor(t,i);if(!(!Object.prototype.hasOwnProperty.call(s,i)&&o&&(o.get||o.set||!o.configurable)))try{Object.defineProperty(t,i,{enumerable:!0,configurable:!0,get(){try{const u=c.toKebab(i),d=e.getAttribute(u);if(d!==null)return d;const E=e[i];let v;return c.isReactiveState(E)||E&&typeof E=="object"&&"value"in E&&!(E instanceof Node)?v=E.value:v=E,v}catch{return e[i]}}})}catch{}}}catch{}return}rt(e,n.props,t)}function it(e,n,t,s){e.onConnected&&!t&&(e.onConnected(n),s(!0))}function ot(e,n,t,s,r,i,o,a){e.onDisconnected&&e.onDisconnected(n),t.forEach(u=>u()),s(),r(),i(!1),o(null),a(!1)}function at(e,n,t,s,r){e.onAttributeChanged&&e.onAttributeChanged(n,t,s,r)}class ct{static cache=new Map;static maxCacheSize=1e3;static dangerousPatterns=[/constructor/i,/prototype/i,/__proto__/i,/function/i,/eval/i,/import/i,/require/i,/window/i,/document/i,/global/i,/process/i,/setTimeout/i,/setInterval/i,/fetch/i,/XMLHttpRequest/i];static evaluate(n,t){const s=this.cache.get(n);if(s){if(!s.isSecure){j.devWarn("Blocked cached dangerous expression:",n);return}try{this.cache.delete(n),this.cache.set(n,s)}catch{}return s.evaluator(t)}const r=this.createEvaluator(n);if(this.cache.size>=this.maxCacheSize){const i=this.cache.keys().next().value;i&&this.cache.delete(i)}if(this.cache.set(n,r),!r.isSecure){j.devWarn("Blocked dangerous expression:",n);return}return r.evaluator(t)}static createEvaluator(n){if(this.hasDangerousPatterns(n))return{evaluator:()=>{},isSecure:!1};if(n.length>1e3)return{evaluator:()=>{},isSecure:!1};try{return{evaluator:this.createSafeEvaluator(n),isSecure:!0}}catch(t){return j.devWarn("Failed to create evaluator for expression:",n,t),{evaluator:()=>{},isSecure:!1}}}static hasDangerousPatterns(n){return this.dangerousPatterns.some(t=>t.test(n))}static createSafeEvaluator(n){const t=n.trim();if(t.startsWith("{")&&t.endsWith("}"))return this.createObjectEvaluator(n);if(/^ctx\.[a-zA-Z0-9_.]+$/.test(n.trim())){const s=n.trim().slice(4);return r=>c.getNestedValue(r,s)}return n.includes("ctx")||/[+\-*/%<>=&|?:[\]]/.test(n)?this.createSimpleEvaluator(n):s=>c.getNestedValue(s,n)}static createObjectEvaluator(n){const t=n.trim().slice(1,-1),s=this.parseObjectProperties(t);return r=>{const i={};for(const{key:o,value:a}of s)try{if(a.startsWith("ctx.")){const u=a.slice(4);i[o]=c.getNestedValue(r,u)}else i[o]=this.evaluateSimpleValue(a,r)}catch{i[o]=void 0}return i}}static parseObjectProperties(n){const t=[],s=n.split(",");for(const r of s){const i=r.indexOf(":");if(i===-1)continue;const o=r.slice(0,i).trim(),a=r.slice(i+1).trim(),u=o.replace(/^['"]|['"]$/g,"");t.push({key:u,value:a})}return t}static createSimpleEvaluator(n){return t=>{try{let s=n;const r=[];s=s.replace(/("[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*')/g,v=>`<<#${r.push(v)-1}#>>`);const i=s.match(/ctx\.[\w.]+/g)||[];for(const v of i){const b=v.slice(4),w=c.getNestedValue(t,b);if(w===void 0)return;const p=r.push(JSON.stringify(w))-1;s=s.replace(new RegExp(v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),`<<#${p}#>>`)}const o=/\b[a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)+\b/g,a=s.match(o)||[];for(const v of a){if(v.startsWith("ctx."))continue;const b=c.getNestedValue(t,v);if(b===void 0)return;const w=r.push(JSON.stringify(b))-1;s=s.replace(new RegExp(v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),`<<#${w}#>>`)}const u=/\b([a-zA-Z_][a-zA-Z0-9_]*)\b/g;let d;const E=new Set;for(;(d=u.exec(s))!==null;){const v=d[1];if(["true","false","null","undefined"].includes(v)||/^[0-9]+$/.test(v)||v==="ctx"||E.has(v))continue;E.add(v);const b=c.getNestedValue(t,v);if(b===void 0)return;const w=JSON.stringify(b),p=r.push(w)-1;v.includes(".")?s=s.replace(new RegExp(v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),`<<#${p}#>>`):s=s.replace(new RegExp("\\b"+v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"\\b","g"),`<<#${p}#>>`)}s=s.replace(/<<#(\d+)#>>/g,(v,b)=>r[Number(b)]);try{return this.evaluateBasicExpression(s)}catch{return}}catch{return}}}static evaluateBasicExpression(n){const t=this.tokenize(n);let s=0;function r(){return t[s]}function i(m){const k=t[s++];if(m&&!k)throw new Error(`Unexpected token EOF, expected ${m}`);if(m&&k&&k.type!==m&&k.value!==m)throw new Error(`Unexpected token ${k.type}/${k.value}, expected ${m}`);return k}function o(){return p()}function a(m){if(typeof m=="number")return m;if(m==null)return NaN;if(typeof m=="boolean")return m?1:0;const k=Number(m);return Number.isNaN(k)?NaN:k}function u(m,k){return typeof m=="string"||typeof k=="string"?String(m)+String(k):a(m)+a(k)}function d(m,k){return a(m)-a(k)}function E(m,k){return a(m)*a(k)}function v(m,k){return a(m)/a(k)}function b(m,k){return a(m)%a(k)}function w(m,k,f){if(typeof k=="number"&&typeof f=="number")switch(m){case">":return k>f;case"<":return k<f;case">=":return k>=f;case"<=":return k<=f;default:return!1}const g=String(k),T=String(f);switch(m){case">":return g>T;case"<":return g<T;case">=":return g>=T;case"<=":return g<=T;default:return!1}}function p(){const m=C(),k=r();if(k&&k.value==="?"){i("?");const f=o();i(":");const g=o();return m?f:g}return m}function C(){let m=l();for(;;){const k=r();if(!k||k.value!=="||")break;i("OP");const f=l();m=m||f}return m}function l(){let m=A();for(;;){const k=r();if(!k||k.value!=="&&")break;i("OP");const f=A();m=m&&f}return m}function A(){let m=S();for(;;){const k=r();if(!k||!["==","!=","===","!=="].includes(k.value))break;const f=i("OP").value,g=S();switch(f){case"==":m=m==g;break;case"!=":m=m!=g;break;case"===":m=m===g;break;case"!==":m=m!==g;break}}return m}function S(){let m=y();for(;;){const k=r();if(!k||![">","<",">=","<="].includes(k.value))break;const f=i("OP").value,g=y();switch(f){case">":m=w(">",m,g);break;case"<":m=w("<",m,g);break;case">=":m=w(">=",m,g);break;case"<=":m=w("<=",m,g);break}}return m}function y(){let m=h();for(;;){const k=r();if(!k||k.value!=="+"&&k.value!=="-")break;const f=i("OP").value,g=h();m=f==="+"?u(m,g):d(m,g)}return m}function h(){let m=_();for(;;){const k=r();if(!k||k.value!=="*"&&k.value!=="/"&&k.value!=="%")break;const f=i("OP").value,g=_();switch(f){case"*":m=E(m,g);break;case"/":m=v(m,g);break;case"%":m=b(m,g);break}}return m}function _(){const m=r();if(m&&m.value==="!")return i("OP"),!_();if(m&&m.value==="-"){i("OP");const k=_();return d(0,k)}return L()}function L(){const m=r();if(m){if(m.type==="NUMBER")return i("NUMBER"),Number(m.value);if(m.type==="STRING")return i("STRING"),m.value.slice(1,-1);if(m.type==="IDENT")return i("IDENT"),m.value==="true"?!0:m.value==="false"?!1:m.value==="null"?null:void 0;if(m.value==="["){i("PUNC");const k=[];for(;;){const f=r();if(!f||f.value==="]")break;k.push(o());const g=r();g&&g.value===","&&i("PUNC")}return i("PUNC"),k}if(m.value==="("){i("PUNC");const k=o();return i("PUNC"),k}throw new Error("Unexpected token in expression")}}return o()}static tokenize(n){const t=[],s=/\s*(=>|===|!==|==|!=|>=|<=|\|\||&&|[()?:,[\]]|\+|-|\*|\/|%|>|<|!|\d+\.?\d*|"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|[a-zA-Z_][a-zA-Z0-9_]*|\S)\s*/g;let r;for(;(r=s.exec(n))!==null;){const i=r[1];i&&(/^\d/.test(i)?t.push({type:"NUMBER",value:i}):/^"/.test(i)||/^'/.test(i)?t.push({type:"STRING",value:i}):/^[a-zA-Z_]/.test(i)?t.push({type:"IDENT",value:i}):/^[()?:,[\]]$/.test(i)?t.push({type:"PUNC",value:i}):t.push({type:"OP",value:i}))}return t}static evaluateSimpleValue(n,t){if(n==="true")return!0;if(n==="false")return!1;if(!isNaN(Number(n)))return Number(n);if(n.startsWith("ctx.")){const s=n.slice(4);return c.getNestedValue(t,s)}return n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'")?n.slice(1,-1):n}static clearCache(){this.cache.clear()}static getCacheSize(){return this.cache.size}}class Z{static cleanupFunctions=new WeakMap;static addListener(n,t,s,r){n.addEventListener(t,s,r);const o={event:t,handler:s,wrapper:s,options:r,cleanup:()=>n.removeEventListener(t,s,r),addedAt:Date.now()};this.cleanupFunctions.has(n)||this.cleanupFunctions.set(n,[]);const a=this.cleanupFunctions.get(n);a.push(o),a.__metaList=a}static removeListener(n,t,s,r){n.removeEventListener(t,s,r);const i=this.cleanupFunctions.get(n);if(i)for(let o=0;o<i.length;o++){const a=i[o];if(a.event===t&&a.handler===s){i.splice(o,1),i.length===0&&this.cleanupFunctions.delete(n);return}}}static cleanup(n){const t=this.cleanupFunctions.get(n);t&&(t.forEach(s=>{try{s.cleanup()}catch{}}),this.cleanupFunctions.delete(n))}static cleanupAll(){this.cleanupFunctions=new WeakMap}static hasListeners(n){const t=this.cleanupFunctions.get(n);return!!(t&&t.length>0)}static getListenerCount(n){const t=this.cleanupFunctions.get(n);return t?t.length:0}static getListenerInfo(n){const t=this.cleanupFunctions.get(n);return t?t.map(s=>({event:s.event,handler:s.handler,wrapper:s.wrapper,options:s.options})):[]}}function ke(e,n){return Array.isArray(e)&&Array.isArray(n)?JSON.stringify([...e].sort())!==JSON.stringify([...n].sort()):e!==n}function Be(e,n,t,s,r){if(e){const i=n.value;if(r&&typeof i=="object"&&i!==null){const o={...i};o[r]=t,n.value=o}else n.value=t}else{const i=s._state||s;c.setNestedValue(i,n,t)}}function Te(e,n,t,s){if(typeof e._requestRender=="function"&&e._requestRender(),typeof e._triggerWatchers=="function"){const r=n?"reactiveState":t;e._triggerWatchers(r,s)}}function lt(e,n,t){const s=`update:${c.toKebab(n)}`,r=`update:${n}`,i=new CustomEvent(s,{detail:t,bubbles:!0,cancelable:!0}),o=new CustomEvent(r,{detail:t,bubbles:!0,cancelable:!0});e.dispatchEvent(i),e.dispatchEvent(o)}function De(e,n,t,s){const r=t;if(c.safe(()=>{if(typeof e.setAttribute=="function")try{e[n]=r}catch{}else e[n]=r}),r==null||typeof r=="string"||typeof r=="number"||typeof r=="boolean"){const i=c.safeSerializeAttr(r);i!==null?c.safe(()=>{typeof e.setAttribute=="function"&&c.setAttributeSmart(e,c.toKebab(n),String(i))}):c.safe(()=>{typeof e.removeAttribute=="function"&&c.removeAttributeSmart(e,c.toKebab(n))})}}function ft(e,n,t,s){if(e){const r=n.value;return s&&typeof r=="object"&&r!==null?r[s]:r}else{const r=t._state||t;return c.getNestedValue(r,n)}}function ae(e){return e?e.split(/\s+/).filter(Boolean):[]}function ce(e,n){if(n.length===0)return;const t=n.filter(s=>s&&!e.classList.contains(s));t.length>0&&e.classList.add(...t)}function oe(e,n){if(n.length===0)return;const t=n.filter(Boolean);t.length>0&&e.classList.remove(...t)}let Re=!1;async function ut(e,n,t=10){if(!Re){if(!e.isConnected){j.devWarn("⚠️ Element not connected to DOM, skipping style wait");return}for(let s=0;s<t;s++){const r=window.getComputedStyle(e),i=r.transform&&r.transform!=="",o=r.opacity&&r.opacity!=="";if(i||o){Re=!0;return}await new Promise(a=>requestAnimationFrame(()=>a(void 0)))}Re=!0,j.devWarn("⚠️ Styles did not load in time for transition, continuing anyway")}}function dt(e){const n=window.getComputedStyle(e),t=n.transitionDuration||"0s",s=n.transitionDelay||"0s",r=i=>{const o=parseFloat(i);return i.includes("ms")?o:o*1e3};return r(t)+r(s)}function qe(e,n){return new Promise(t=>{const s=n??dt(e);if(s<=0){t();return}let r=!1;const i=()=>{r||(r=!0,e.removeEventListener("transitionend",o),e.removeEventListener("transitioncancel",o),t())},o=()=>i();e.addEventListener("transitionend",o),e.addEventListener("transitioncancel",o),setTimeout(i,s+50)})}async function me(e,n){const{classes:t,hooks:s,css:r,duration:i}=n;if(s?.onBeforeEnter)try{s.onBeforeEnter(e)}catch(p){j.devError("Transition onBeforeEnter error:",p)}if(!r)return s?.onEnter?new Promise(p=>{const C=s.onEnter;typeof C=="function"?C(e,()=>{if(s?.onAfterEnter)try{s.onAfterEnter(e)}catch(l){j.devError("Transition onAfterEnter error:",l)}p()}):p()}):void 0;const o=ae(t?.enterFrom),a=ae(t?.enterActive),u=ae(t?.enterTo);ce(e,o),e.offsetHeight,ce(e,a),e.offsetHeight;let d;if(s?.onEnter){const p=new Promise(C=>{d=C});try{const C=s.onEnter;typeof C=="function"&&C(e,()=>{d&&d()})}catch(C){j.devError("Transition onEnter error:",C)}d&&await p}await new Promise(p=>requestAnimationFrame(()=>p(void 0))),e.offsetHeight;const E=window.getComputedStyle(e),v=E.transform,b=E.opacity;oe(e,o),v&&v!=="none"&&(e.style.transform=v),b&&b!==""&&(e.style.opacity=b),e.offsetHeight,await new Promise(p=>requestAnimationFrame(()=>p(void 0))),e.style.transform="",e.style.opacity="",ce(e,u),e.offsetHeight,await new Promise(p=>requestAnimationFrame(()=>p(void 0)));let w;if(typeof i=="number"?w=i:i&&typeof i=="object"&&"enter"in i&&(w=i.enter),await qe(e,w),oe(e,a),s?.onAfterEnter)try{s.onAfterEnter(e)}catch(p){j.devError("Transition onAfterEnter error:",p)}}async function Oe(e,n){const{classes:t,hooks:s,css:r,duration:i}=n;if(s?.onBeforeLeave)try{s.onBeforeLeave(e)}catch(v){j.devError("Transition onBeforeLeave error:",v)}if(!r)return s?.onLeave?new Promise(v=>{const b=s.onLeave;typeof b=="function"?b(e,()=>{if(s?.onAfterLeave)try{s.onAfterLeave(e)}catch(w){j.devError("Transition onAfterLeave error:",w)}v()}):v()}):void 0;const o=ae(t?.leaveFrom),a=ae(t?.leaveActive),u=ae(t?.leaveTo);ce(e,o),e.offsetHeight,ce(e,a);let d;if(s?.onLeave){const v=new Promise(b=>{d=b});try{const b=s.onLeave;typeof b=="function"&&b(e,()=>{d&&d()})}catch(b){j.devError("Transition onLeave error:",b)}d&&await v}await new Promise(v=>requestAnimationFrame(()=>v(void 0))),await ut(e,[...o,...a]),oe(e,o),ce(e,u);let E;if(typeof i=="number"?E=i:i&&typeof i=="object"&&"leave"in i&&(E=i.leave),await qe(e,E),oe(e,a),oe(e,u),oe(e,o),s?.onAfterLeave)try{s.onAfterLeave(e)}catch(v){j.devError("Transition onAfterLeave error:",v)}}const Ge=new WeakMap,Ze=new WeakMap;function we(e){if(!e)return;const n=Ge.get(e);if(n!==void 0)return n;try{const t=e;if(t&&t.key!=null)return String(t.key)}catch{}if(e instanceof Element){const t=e.getAttribute("data-anchor-key");if(t)return t}}function V(e,n){try{Ge.set(e,n)}catch{}try{e.key=n}catch{}try{if(e instanceof Element){const t=c.safeSerializeAttr(n);t!==null&&c.setAttributeSmart(e,"data-anchor-key",t)}}catch{}}function pt(e){if(!e)return;const n=Ze.get(e);if(n!==void 0)return n;try{const t=e;if(t&&t._transitionGroup!=null)return t._transitionGroup}catch{}}function ht(e,n){try{Ze.set(e,n)}catch{}try{e._transitionGroup=n}catch{}}function le(e){return e!==null&&typeof e=="object"&&"value"in e}function $e(e){try{if(c.isReactiveState(e))return e.value}catch{}try{if(le(e))return e.value}catch{}return e}function X(e,n,t){try{e&&e.attrs&&(e.attrs[n]=t)}catch{}}function q(e){return e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLButtonElement}function fe(e){return e===""?!0:typeof e=="string"?e==="false"?!1:e==="true"?!0:e!=="":e&&typeof e=="object"?c.isReactiveState(e)||"value"in e?!!e.value:!1:!!e}function ie(e,n){if(!n||!(e instanceof Element))return;Z.cleanup(e);for(const s in n)n[s]===e&&delete n[s];const t=e.childNodes;for(let s=0;s<t.length;s++)ie(t[s],n)}function ge(e,n,t){if(typeof e=="string")return;const s=e.props?.reactiveRef??(e.props?.props&&e.props.props.reactiveRef),r=e.props?.ref??(e.props?.props&&e.props.props.ref);if(s)try{if(c.isReactiveState(s)||typeof s=="object"&&"value"in s)s.value=n;else if(typeof s=="function")s(n);else if(typeof s=="string"&&t)try{const i=String(s);t[i]=n}catch{}}catch{}else if(r&&t)try{const i=String(r);t[i]=n}catch{}}function yt(e,n,t,s,r,i,o,a){if(!i)return;const u=n.includes("lazy"),d=n.includes("trim"),E=n.includes("number"),v=()=>{if(c.isReactiveState(e)){const h=e.value;return a&&o&&(o instanceof HTMLInputElement||o instanceof HTMLTextAreaElement||o instanceof HTMLSelectElement)&&typeof h=="object"&&h!==null?h[a]:h}const y=i?._state||i;return c.getNestedValue(y,e)},b=v();let w="text";o instanceof HTMLInputElement?w=s?.type||o.type||"text":o instanceof HTMLSelectElement?w="select":o instanceof HTMLTextAreaElement&&(w="textarea");const p=o instanceof HTMLInputElement||o instanceof HTMLTextAreaElement||o instanceof HTMLSelectElement,l=p?w==="checkbox"||w==="radio"?"checked":"value":a??"modelValue";if(w==="checkbox")if(Array.isArray(b))t[l]=b.includes(String(o?.getAttribute("value")??s?.value??""));else{const y=o?.getAttribute("true-value")??!0;t[l]=b===y}else if(w==="radio")t[l]=b===(s?.value??"");else if(w==="select")if(o&&o.hasAttribute("multiple")&&o instanceof HTMLSelectElement){const y=Array.isArray(b)?b.map(String):[];setTimeout(()=>{Array.from(o.options).forEach(h=>{h.selected=y.includes(h.value)})},0),t[l]=Array.isArray(b)?b:[]}else t[l]=b;else{!p&&c.isReactiveState(e)?t[l]=e:t[l]=b;try{const y=c.toKebab(l);s&&(s[y]=b)}catch{}}const A=u||w==="checkbox"||w==="radio"||w==="select"?"change":"input",S=y=>{if(y.isComposing||r._isComposing)return;const h=globalThis.process,_=!!h&&h.env?.NODE_ENV==="test"||typeof window<"u"&&globalThis.__vitest__;if(y.isTrusted===!1&&!_)return;const L=y.target;if(!L||L._modelUpdating)return;let N=L.value;if(w==="checkbox"){const f=v();if(Array.isArray(f)){const g=L.getAttribute("value")??"",T=Array.from(f);if(L.checked)T.includes(g)||T.push(g);else{const R=T.indexOf(g);R>-1&&T.splice(R,1)}N=T}else{const g=L.getAttribute("true-value")??!0,T=L.getAttribute("false-value")??!1;N=L.checked?g:T}}else if(w==="radio")N=L.getAttribute("value")??L.value;else if(w==="select"&&L.multiple)N=Array.from(L.selectedOptions).map(f=>f.value);else if(d&&typeof N=="string"&&(N=N.trim()),E){const f=Number(N);isNaN(f)||(N=f)}const m=v();if(ke(N,m)){L._modelUpdating=!0;try{Be(c.isReactiveState(e),e,N,i,a),Te(i,c.isReactiveState(e),e,N),L&&lt(L,l,N)}finally{setTimeout(()=>L._modelUpdating=!1,0)}}};if(p){if(r[A]){const y=r[A];o&&Z.removeListener(o,A,y)}r[A]=S}else{const y=`update:${c.toKebab(l)}`,h=`update:${l}`;if(r[y]){const _=r[y];o&&Z.removeListener(o,y,_)}if(r[h]){const _=r[h];o&&Z.removeListener(o,h,_)}if(r[y]=_=>{const L=_.detail;let N=L!==void 0?L:void 0;if(N===void 0){const f=_.target;if(f&&typeof f=="object"&&"value"in f)try{N=f.value}catch{N=void 0}}const m=ft(c.isReactiveState(e),e,i,a);if(ke(N,m)){Be(c.isReactiveState(e),e,N,i,a),Te(i,c.isReactiveState(e),e,N);const f=_.target;f&&De(f,l,c.isReactiveState(e)?e:N,c.isReactiveState(e))}},c.isReactiveState(e)&&typeof e.value=="object"&&e.value!==null){let _=[];try{_=Reflect.ownKeys(e.value)}catch{_=Object.keys(e.value)}const L=_.filter(N=>typeof N=="string"&&!String(N).startsWith("_")&&N!=="constructor");for(const N of L){const m=String(N),k=`update:${c.toKebab(m)}`,f=`update:${m}`;r[k]||(r[k]=g=>{const T=g.detail!==void 0?g.detail:g.target?.value,R=c.isReactiveState(e)?e.value[m]:c.getNestedValue(i?._state||i,e);if(!ke(T,R))return;if(c.isReactiveState(e)){const I={...e.value};I[m]=T,e.value=I}else c.setNestedValue(i?._state||i,e,T);Te(i,c.isReactiveState(e),e,T);const P=g.currentTarget||o||g.target;P&&De(P,l,c.isReactiveState(e)?e:T,c.isReactiveState(e))},r[f]=r[k])}}r[h]=r[y]}(w==="text"||w==="textarea")&&(r.compositionstart=()=>r._isComposing=!0,r.compositionend=y=>{r._isComposing=!1;const h=y.target;h&&setTimeout(()=>{const _=h.value,L=i?._state||i,N=c.getNestedValue(L,e);let m=_;if(d&&(m=m.trim()),E){const f=Number(m);isNaN(f)||(m=f)}if(ke(m,N)){h._modelUpdating=!0;try{c.setNestedValue(L,e,m),Te(i,c.isReactiveState(e),e,m)}finally{setTimeout(()=>h._modelUpdating=!1,0)}}},0)})}function Je(e){const n=e.slice(2);return n?n.charAt(0).toLowerCase()+n.slice(1):""}function mt(e,n,t,s,r){if(typeof e=="object"&&e!==null)for(const[i,o]of Object.entries(e))if(i.startsWith("data-")||i.startsWith("aria-")||i==="class")t[i]=o;else if(i==="disabled"&&r&&q(r)){const a=o&&typeof o=="object"&&"value"in o;(()=>{try{return c.isReactiveState(o)}catch{return!1}})()||a?n[i]=o:t[i]=o}else n[i]=o;else if(typeof e=="string"){if(!s)return;try{const i=Ce(e,s);if(typeof i=="object"&&i!==null){for(const[o,a]of Object.entries(i))if(o.startsWith("data-")||o.startsWith("aria-")||o==="class")t[o]=a;else if(o==="disabled"&&r&&q(r)){const u=a&&typeof a=="object"&&"value"in a;(()=>{try{return c.isReactiveState(a)}catch{return!1}})()||u?n[o]=a:t[o]=a}else n[o]=a;return}else{t[e]=i;return}}catch{const i=c.getNestedValue(s,e);t[e]=i}}}function gt(e,n,t){let s;if(typeof e=="string"){if(!t)return;s=Ce(e,t)}else s=e;const r=String(n.style||"");let i=r;if(s){if(r){const o=String(r).split(";").map(u=>u.trim()).filter(Boolean),a=o.findIndex(u=>u.startsWith("display:"));a>=0&&o[a]==="display: none"&&(o.splice(a,1),i=o.length>0?o.join("; ")+";":"")}}else if(r){const o=String(r).split(";").filter(Boolean),a=o.findIndex(u=>u.trim().startsWith("display:"));a>=0?o[a]="display: none":o.push("display: none"),i=o.join("; ")}else i="display: none";i!==r&&(i?n.style=i:n.style=void 0)}function Ce(e,n){return ct.evaluate(e,n)}function bt(e,n,t,s){let r;if(typeof e=="string"){if(!t)return;r=Ce(e,t)}else r=e;try{if(r&&typeof r=="object"){if(c.isReactiveState(r))r=r.value;else if("value"in r&&typeof r.value<"u"){const d=r.value;d instanceof Node||(r=d)}}}catch{}let i=[];if(typeof r=="string")i=[r];else if(Array.isArray(r))i=r.filter(Boolean);else if(typeof r=="object"&&r!==null)for(const[d,E]of Object.entries(r))E&&i.push(d);const o=i.join(" "),a=s&&s.class||n.class||"",u=a?`${a} ${o}`.trim():o.trim();u?n.class=u:n.class=void 0}function je(e){if(e===!0||e===!1)return!0;if(e==null)return!1;if(typeof e==="string")return e===""||e==="true"||e==="false";try{if(e&&typeof e=="object"&&"value"in e){const t=e.value,s=typeof t;return s==="boolean"?!0:s==="string"?t===""||t==="true"||t==="false":!1}}catch{}return!1}function St(e,n,t){let s;if(typeof e=="string"){if(!t)return;s=Ce(e,t)}else s=e;let r="";if(typeof s=="string")r=s;else if(s&&typeof s=="object"){const o=[];for(const[a,u]of Object.entries(s))if(u!=null&&u!==""){const d=a.replace(/[A-Z]/g,b=>`-${b.toLowerCase()}`),E=["width","height","top","right","bottom","left","margin","margin-top","margin-right","margin-bottom","margin-left","padding","padding-top","padding-right","padding-bottom","padding-left","font-size","line-height","border-width","border-radius","min-width","max-width","min-height","max-height"];let v=String(u);typeof u=="number"&&E.includes(d)&&(v=`${u}px`),o.push(`${d}: ${v}`)}r=o.join("; ")+(o.length>0?";":"")}const i=String(n.style||"");n.style=i+(i&&!i.endsWith(";")?"; ":"")+r}function vt(e,n,t){let s=e;typeof e=="string"&&t&&(s=Ce(e,t)),c.isReactiveState(s)?n.reactiveRef=s:n.ref=s}function Ye(e,n,t,s){const r={},i={...s||{}},o={};for(const[a,u]of Object.entries(e)){const{value:d,modifiers:E,arg:v}=u;if(a==="model"||a.startsWith("model:")){const b=a.split(":"),w=b.length>1?b[1]:v;yt(d,E,r,i,o,n,t,w);continue}switch(a){case"bind":mt(d,r,i,n,t);break;case"show":gt(d,i,n);break;case"class":bt(d,i,n,s);break;case"style":St(d,i,n);break;case"ref":vt(d,r,n);break}}try{if(Object.prototype.hasOwnProperty.call(r,"disabled")&&t&&q(t)){const u=r.disabled,d=u&&typeof u=="object"&&"value"in u;let E=!1;try{E=c.isReactiveState(u)}catch{E=!1}if(!d&&!E)try{i.disabled=u,delete r.disabled;const v=globalThis;v.__VDOM_DISABLED_PROMOTIONS||(v.__VDOM_DISABLED_PROMOTIONS=[]),v.__VDOM_DISABLED_PROMOTIONS.push({phase:"bind-directive:postfix-move",location:"attrs",key:"disabled",value:u,time:Date.now(),stack:new Error().stack})}catch{}}}catch{}return{props:r,attrs:i,listeners:o}}function He(e,n){if(Array.isArray(e)){const i=new Set;return e.map(o=>{if(!o||typeof o!="object")return o;let a=o.props?.key??o.key;if(!a){const v=o.tag||"node",w=[o.props?.attrs?.id,o.props?.attrs?.name,o.props?.attrs?.["data-key"],o.props?.props?.id,o.props?.props?.name,o.props?.props?.dataKey,o.props?.props?.["data-key"]].find(p=>p!=null)??"";a=w?`${n}:${v}:${w}`:`${n}:${v}`}let u=a,d=1;for(;i.has(u);)u=`${a}#${d++}`;i.add(u);let E=o.children;return Array.isArray(E)&&(E=He(E,u)),{...o,key:u,children:E}})}const t=e,s=t.props?.key??t.key??n;let r=t.children;return Array.isArray(r)&&(r=He(r,s)),{...t,key:s,children:r}}function ze(e,n,t,s){const r=t.directives??{},i=Ye(r,s,e,t.attrs),o={...n.props||{},...t.props||{},...i.props||{}},a={...n.attrs||{},...t.attrs||{},...i.attrs||{}},u=n.props??{},d=o,E=!!(t?.isCustomElement??n?.isCustomElement??!1);let v=!1;for(const p in{...u,...d}){const C=u[p],l=d[p];let A=C,S=l;if(c.safe(()=>{(c.isReactiveState(C)||le(C))&&(A=C.value)}),c.safe(()=>{(c.isReactiveState(l)||le(l))&&(S=l.value)}),!(C===l&&A===S))if(v=!0,p==="value"&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)){const y=$e(l),h=y==null?"":String(y);e.value!==h&&(e.value=h)}else if(p==="checked"&&e instanceof HTMLInputElement){const y=$e(l);e.checked=!!y}else if(p.startsWith("on")&&typeof l=="function"){const y=Je(p);typeof C=="function"&&Z.removeListener(e,y,C),typeof l=="function"&&Z.addListener(e,y,l);try{if(y&&y.startsWith("update:")){const h=y.split(":",2)[1],_=d[h];let L=[];try{if(c.isReactiveState(_)){const m=_.value;L=m&&typeof m=="object"?Object.keys(m):[]}else _&&typeof _=="object"&&(L=Object.keys(_))}catch{L=[]}const N=L.filter(m=>typeof m=="string"&&!m.startsWith("_")&&m!=="constructor");for(const m of N){const k=`update:${m}`,f=g=>{const T=g.detail!==void 0?g.detail:g.target instanceof HTMLInputElement||g.target instanceof HTMLTextAreaElement||g.target instanceof HTMLSelectElement?g.target.value:void 0,O={...c.isReactiveState(_)?_.value||{}:d[h]||{},[m]:T};try{typeof l=="function"&&l({detail:O})}catch{}};c.safe(()=>{Z.addListener(e,k,f)})}}}catch{}}else if(l==null)c.removeAttributeSmart(e,p);else{const y=t?.isCustomElement??n?.isCustomElement??!1;if(y||p in e)try{e[p]=l,p==="disabled"&&l===!1&&!y&&q(e)&&c.removeAttributeSmart(e,"disabled")}catch{}else l===!1&&c.removeAttributeSmart(e,p)}}for(const[p,C]of Object.entries(i.listeners||{})){Z.addListener(e,p,C);try{const l=e&&e.parentElement;l&&l!==e&&Z.addListener(l,p,C)}catch{}}const b={...n.attrs??{}},w=a;try{const p=i&&i.attrs||{};if(Object.prototype.hasOwnProperty.call(p,"class")&&p.class===void 0&&typeof e.getAttribute=="function"){const C=e.getAttribute("class");C!==null&&(b.class=C)}if(Object.prototype.hasOwnProperty.call(p,"style")&&p.style===void 0&&typeof e.getAttribute=="function"){const C=e.getAttribute("style");C!==null&&(b.style=C)}try{if(typeof e.getAttribute=="function"){const C=e.getAttribute("class");try{e instanceof HTMLInputElement&&e.type==="text"&&C!==null&&C!==b.class&&(b.class=C)}catch{}}}catch{}}catch{}for(const p in{...b,...w}){const C=b[p],l=w[p];let A=C,S=l;if(c.isReactiveState(C)&&(A=C.value),c.isReactiveState(l)&&(S=l.value),A!==S)if(v=!0,S==null||S===!1)c.safe(()=>{c.removeAttributeSmart(e,p)}),X(n,p,void 0),p==="value"&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement?c.safe(()=>{e.value=""}):e instanceof HTMLSelectElement?c.safe(()=>{e.value=""}):e instanceof HTMLProgressElement&&c.safe(()=>{e.value=0})),p==="checked"&&e instanceof HTMLInputElement&&c.safe(()=>{e.checked=!1}),p==="disabled"&&q(e)&&c.safe(()=>{(e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLButtonElement)&&(e.disabled=!1)});else{if(p==="value"){if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement){c.safe(()=>{e.value=S??""});continue}else if(e instanceof HTMLSelectElement){c.safe(()=>{e.value=S??""});continue}else if(e instanceof HTMLProgressElement){c.safe(()=>{e.value=Number(S)});continue}}if(p==="checked"&&e instanceof HTMLInputElement){c.safe(()=>{e.checked=!!S});continue}if(p==="style"){const h=c.safeSerializeAttr(S);h!==null&&c.setAttributeSmart(e,p,String(h)),X(n,p,S);continue}if(p==="class"){const h=c.safeSerializeAttr(S);h!==null&&c.setAttributeSmart(e,p,String(h)),X(n,p,S);continue}if(p==="disabled"&&q(e)){c.safe(()=>{const h=fe(S);(e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLButtonElement)&&(e.disabled=h)}),fe(S)?c.safe(()=>{c.setAttributeSmart(e,p,"")}):c.safe(()=>{c.removeAttributeSmart(e,p)});continue}const y=e.namespaceURI==="http://www.w3.org/2000/svg";if(E&&!y&&p.includes("-"))if(c.isClassLikeAttr(p)){const h=c.safeSerializeAttr(l??S);if(h!==null){try{c.setAttributeSmart(e,p,String(h))}catch{}X(n,p,S)}}else{const h=c.toCamel(p);try{const _=e;_[h]=c.isReactiveState(l)?l:S,X(n,p,S)}catch{const _=c.safeSerializeAttr(l??S);_!==null&&c.setAttributeSmart(e,p,String(_))}}else if(!y&&p in e)try{const h=e;h[p]=c.isReactiveState(l)?l:S,X(n,p,S)}catch{const h=c.safeSerializeAttr(S);h!==null&&(c.setAttributeSmart(e,p,String(h)),X(n,p,S))}else{const h=c.safeSerializeAttr(S);h!==null&&(c.setAttributeSmart(e,p,String(h)),X(n,p,S))}}}try{if(q(e)){const p=o.disabled;let C;try{const A=Object.prototype.hasOwnProperty.call(i.props||{},"disabled"),S=p&&typeof p=="object"&&"value"in p;let y=!1;c.safe(()=>{y=!!c.isReactiveState(p)});const h=je(p);y||S||A||h?C=p:C=a.disabled}catch{C=a.disabled}const l=fe(C);c.safe(()=>{(e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLButtonElement)&&(e.disabled=l)}),l?c.safe(()=>{c.setAttributeSmart(e,"disabled","")}):c.safe(()=>{c.removeAttributeSmart(e,"disabled")})}}catch{}if(E&&v){const p=e;c.safe(()=>{p._applyProps?.(p._cfg)}),c.safe(()=>{typeof p.requestRender=="function"?p.requestRender():typeof p._render=="function"&&p._render?.(p._cfg)})}}function U(e,n,t,s=null){if(typeof e=="string")return document.createTextNode(e);if(e.tag==="#text"){const l=document.createTextNode(typeof e.children=="string"?e.children:"");return e.key!=null&&V(l,e.key),l}if(e.tag==="#raw"){const l=typeof e.children=="string"?e.children:"";return document.createRange().createContextualFragment(l)}if(e.tag==="#anchor"){const l=e,A=Array.isArray(l.children)?l.children:[],S=document.createTextNode(""),y=document.createTextNode("");l.key!=null&&(V(S,`${l.key}:start`),V(y,`${l.key}:end`)),l._startNode=S,l._endNode=y;const h=document.createDocumentFragment();h.appendChild(S);for(const _ of A){const L=U(_,n,t,s);if(l.key!=null&&L instanceof Element&&!L.hasAttribute("data-anchor-key")){const N=_;N&&typeof N=="object"&&N.key!=null||V(L,String(l.key))}h.appendChild(L)}return h.appendChild(y),h}const r=e&&typeof e=="object"&&e.props&&e.props.attrs?e.props.attrs:void 0,o=(r&&typeof r.xmlns=="string"?String(r.xmlns):void 0)??s??c.TAG_NAMESPACE_MAP[e.tag]??null,a=o?document.createElementNS(o,e.tag):document.createElement(e.tag);e.key!=null&&V(a,e.key),e.props&&e.props?._transitionGroup&&ht(a,e.props?._transitionGroup);const{props:u={},attrs:d={},directives:E={}}=e.props??{},v=Ye(E,n,a instanceof HTMLElement?a:void 0,d),b={...u,...v.props},w={...d,...v.attrs};try{const l=(w&&w.class)??(b&&b.class)??(e.props&&e.props.attrs&&e.props.attrs.class)??(e.props&&e.props.props&&e.props.props.class),A=c.safeSerializeAttr(l);if(A!==null){const S=String(A).trim();S&&c.setAttributeSmart(a,"class",S)}}catch{}try{if(b.disabled!==void 0&&a&&q(a)){const l=b.disabled,A=l&&typeof l=="object"&&"value"in l;let S=!1;try{S=c.isReactiveState(l)}catch{S=!1}!A&&!S&&c.safe(()=>{w.disabled=l,delete b.disabled})}}catch{}const p=a.namespaceURI==="http://www.w3.org/2000/svg";for(const l in w){const A=w[l];if(typeof l!="string"||/\[object Object\]/.test(l))continue;const S=$e(A);if(typeof S=="boolean")S?c.setAttributeSmart(a,l,""):c.safe(()=>{c.removeAttributeSmart(a,l)});else if(S!=null){if(l==="disabled"&&q(a)){const y=b.disabled,h=je(y)?y:S,_=fe(h);c.safe(()=>{a.disabled=_}),_?c.safe(()=>{c.setAttributeSmart(a,l,"")}):c.safe(()=>{c.removeAttributeSmart(a,l)});continue}if(!p&&l==="value"&&(a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement||a instanceof HTMLSelectElement||a instanceof HTMLProgressElement))try{a instanceof HTMLProgressElement?a.value=Number(S):a.value=String(S??"")}catch{const y=c.safeSerializeAttr(S);y!==null&&c.setAttributeSmart(a,l,String(y))}else if(!p&&l==="checked"&&a instanceof HTMLInputElement)try{a.checked=!!S}catch{const y=c.safeSerializeAttr(S);y!==null&&c.setAttributeSmart(a,l,String(y))}else if(!p&&l in a)try{a[l]=S,l==="disabled"&&S===!1&&q(a)&&c.removeAttributeSmart(a,"disabled"),X(e.props,l,S)}catch{const y=c.safeSerializeAttr(S);y!==null&&c.setAttributeSmart(a,l,String(y))}else if((e.props?.isCustomElement??!1)&&!p&&l.includes("-")){const h=c.toCamel(l);try{a[h]=S}catch{const _=c.safeSerializeAttr(S);_!==null&&c.setAttributeSmart(a,l,String(_))}}else{const h=c.safeSerializeAttr(S);h!==null&&c.setAttributeSmart(a,l,String(h))}}}for(const l in b){const A=b[l];if(!(typeof l!="string"||/\[object Object\]/.test(l)))if(l==="value"&&(a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement||a instanceof HTMLSelectElement)){const S=typeof A=="object"&&A!==null&&le(A)?A.value:A;c.safe(()=>{a.value=String(S??"")})}else if(l.startsWith("on")&&typeof A=="function"){const S=Je(l),y=S.includes(":")?(()=>{const h=S.split(":"),_=h[1];if(_.includes("-")){const L=_.split("-").map((N,m)=>m===0?N:N.charAt(0).toUpperCase()+N.slice(1)).join("");return`${h[0]}:${L}`}else{const L=_.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return`${h[0]}:${L}`}})():S;v.listeners&&(v.listeners[S]||v.listeners[y])||Z.addListener(a,S,A)}else{if(l.startsWith("on")&&A===void 0)continue;if(A==null||A===!1)c.removeAttributeSmart(a,l);else{const S=e.props?.isCustomElement??!1,y=typeof A=="object"&&A!==null&&c.isReactiveState(A)?A:le(A)&&typeof A.value<"u"?A.value:A;if(l==="class"||l==="style"){try{const h=c.safeSerializeAttr(y);h!==null&&c.setAttributeSmart(a,l,String(h))}catch{}continue}if(S||l in a)try{const h=typeof A=="object"&&A!==null&&c.isReactiveState(A)?A:le(A)?A.value:A;if(l==="disabled"&&q(a)){const _=b.disabled!==void 0?b.disabled:h,L=fe(_);c.safe(()=>{a.disabled=L}),L?c.safe(()=>{c.setAttributeSmart(a,l,"")}):c.safe(()=>{c.removeAttributeSmart(a,l)});continue}try{if(typeof a[l]=="boolean"){let L=h;typeof h=="string"?h==="false"?L=!1:h==="true"?L=!0:L=!!h&&h!=="":L=!!h,a[l]=L}else a[l]=h}catch{a[l]=h}}catch{}}}}for(const[l,A]of Object.entries(v.listeners||{}))Z.addListener(a,l,A);const C={...e,props:{...e.props,...v.props}};ge(C,a,t);try{const l=a;if(typeof l._applyProps=="function")try{l._applyProps(l._cfg)}catch{}typeof l.requestRender=="function"?l.requestRender():typeof l._render=="function"&&l._render(l._cfg)}catch{}if(Array.isArray(e.children)){const l=e.tag==="foreignObject"&&o===c.SVG_NS?null:a.namespaceURI??null;for(const A of e.children)a.appendChild(U(A,n,t,l))}else typeof e.children=="string"&&(a.textContent=e.children);try{if(a instanceof HTMLSelectElement&&w&&Object.prototype.hasOwnProperty.call(w,"value"))try{a.value=String(w.value??"")}catch{}}catch{}try{if(q(a)){const l=b.disabled,A=w.disabled,S=l&&typeof l=="object"&&"value"in l;let y=!1;try{y=!!c.isReactiveState(l)}catch{y=!1}const _=y||S||je(l)?l:A,L=fe(_);c.safe(()=>{a.disabled=L}),L?c.safe(()=>{c.setAttributeSmart(a,"disabled","")}):c.safe(()=>{c.removeAttributeSmart(a,"disabled")})}}catch{}return a}function Et(e,n,t,s,r){if(typeof t=="string"){e.textContent!==t&&(e.textContent=t);return}if(!Array.isArray(t))return;const i=e.childNodes,o=[];for(let C=0;C<i.length;C++)o.push(i[C]);const a=Array.isArray(n)?n:[],u=pt(e);if(u){const C=y=>{if(typeof y=="string")return y.startsWith("each-")?y.substring(5):y;if(typeof y=="number")return String(y)},l=[],A=[];for(const y of t)if(y&&y.tag==="#anchor"){const h=Array.isArray(y.children)?y.children:[];for(const _ of h){const L=C(_.key??y.key??"unknown");l.push({..._,key:L})}}else y&&l.push({...y,key:C(y.key)});for(const y of a)if(y&&y.tag==="#anchor"){const h=Array.isArray(y.children)?y.children:[];for(const _ of h){const L=C(_.key??y.key??"unknown");A.push({..._,key:L})}}else y&&A.push({...y,key:C(y.key)});if(l.some(y=>y&&y.key!=null)||A.some(y=>y&&y.key!=null)){const y=new Map,h=new Map;for(const f of A)if(f&&f.key!=null){const g=String(f.key);y.set(g,f)}for(let f=0;f<o.length;f++){const g=o[f];let T=we(g);if(T=C(T),T!=null&&g instanceof Element&&g.nodeType===Node.ELEMENT_NODE){let R=typeof T=="string"&&T.includes(":")?T.substring(0,T.lastIndexOf(":")):T;R=String(R),h.set(R,g)}}const _=new Set,L=new Map,N=o.length>0;if(u.moveClass&&N)for(let f=0;f<o.length;f++){const g=o[f];if(g instanceof HTMLElement&&g.parentElement){const T=g.getBoundingClientRect();L.set(g,T)}}const m=[];for(const f of l){let g=f.key;if(g==null)continue;g=String(g);const T=y.get(g);let R=h.get(g);if(R&&T){const O=be(R,T,f,s);_.add(R);const P=String(g);V(O,P),m.push({node:O,key:g,newVNode:f,oldVNode:T,isNew:!1})}else{R=U(f,s,void 0,e instanceof Element?e.namespaceURI??null:null),V(R,String(g)),e.appendChild(R);const O=N||u.appear===!0;R instanceof HTMLElement&&O&&me(R,u).catch(P=>{j.devError("Enter transition error:",P)}),m.push({node:R,key:g,newVNode:f,isNew:!0})}}const k=[];for(let f=0;f<o.length;f++){const g=o[f],T=we(g);if(!_.has(g)&&T!=null&&g instanceof HTMLElement){const O=Oe(g,u).then(()=>{e.contains(g)&&e.removeChild(g)}).catch(P=>{j.devError("Leave transition error:",P),e.contains(g)&&e.removeChild(g)});k.push(O)}}if(k.length===0){let f=e.firstChild;for(const{node:g}of m)g!==f&&e.insertBefore(g,f),f=g.nextSibling;if(u.moveClass&&L.size>0){const g=[];for(const{node:T,isNew:R}of m)if(!R&&T instanceof HTMLElement){const O=L.get(T);if(O){const P=T.getBoundingClientRect(),I=O.left-P.left,M=O.top-P.top;if(I!==0||M!==0){const z=u.moveClass.split(/\s+/).filter(x=>x);g.push({node:T,deltaX:I,deltaY:M,moveClasses:z})}}}if(g.length>0){for(const{node:T,deltaX:R,deltaY:O}of g)T.style.transform=`translate(${R}px, ${O}px)`,T.style.transitionProperty="none";e.offsetHeight,requestAnimationFrame(()=>{requestAnimationFrame(()=>{for(const{node:T,moveClasses:R}of g)for(const O of R)T.classList.add(O);requestAnimationFrame(()=>{const T=u.moveClass||"",R=T.match(/duration-(\d+)/),O=R?`${R[1]}ms`:"300ms",P=T.match(/ease-(out|in|in-out|linear)/),I=P?`ease-${P[1]}`:"ease-out";for(const{node:M}of g)M.style.transition=`transform ${O} ${I}`;requestAnimationFrame(()=>{for(const{node:M,moveClasses:z}of g){M.style.removeProperty("transform");const x=()=>{for(const Q of z)M.classList.remove(Q);M.style.removeProperty("transition"),M.removeEventListener("transitionend",x),M.removeEventListener("transitioncancel",x)};M.addEventListener("transitionend",x,{once:!0}),M.addEventListener("transitioncancel",x,{once:!0})}})})})})}}}return}}const d=new Map;for(const C of a)C&&C.key!=null&&d.set(C.key,C);const E=new Map;for(let C=0;C<o.length;C++){const l=o[C],A=we(l);A!=null&&E.set(A,l)}const v=new Set;let b=e.firstChild;function w(C,l){let A=C;for(;A&&(v.add(A),A!==l);)A=A.nextSibling}function p(C,l,A,S,y,h=!0){const _=[];let L=C.nextSibling;for(;L&&L!==l;)_.push(L),L=L.nextSibling;const N=Array.isArray(A)?A:[];if(S.some(k=>k&&k.key!=null)||N.some(k=>k&&k.key!=null)){const k=new Map,f=new Map;for(const O of N)O&&O.key!=null&&k.set(O.key,O);for(const O of _){const P=we(O);P!=null&&f.set(P,O)}const g=y&&y.state==="visible"&&N.length===0&&S.length>0,T=new Set;let R=C.nextSibling;for(const O of S){let P;if(O.key!=null&&f.has(O.key)){const I=k.get(O.key);P=be(f.get(O.key),I,O,s),T.add(P),y&&P instanceof HTMLElement&&g&&y.appear&&me(P,y).catch(M=>{j.devError("Transition enter error (appear):",M)}),P!==R&&e.contains(P)&&e.insertBefore(P,R)}else P=U(O,s,void 0,e instanceof Element?e.namespaceURI??null:null),e.insertBefore(P,R),T.add(P),y&&P instanceof HTMLElement&&h&&me(P,y).catch(I=>{j.devError("Transition enter error:",I)});R=P.nextSibling}for(const O of _)!T.has(O)&&e.contains(O)&&(y&&O instanceof HTMLElement&&h?Oe(O,y).then(()=>{e.contains(O)&&e.removeChild(O)}).catch(P=>{j.devError("Transition leave error:",P),e.contains(O)&&e.removeChild(O)}):e.removeChild(O))}else{const k=Math.min(N.length,S.length);for(let f=0;f<k;f++){const g=N[f],T=S[f],R=be(_[f],g,T,s);R!==_[f]&&(e.insertBefore(R,_[f]),e.removeChild(_[f]))}for(let f=k;f<S.length;f++){const g=U(S[f],s,void 0,e instanceof Element?e.namespaceURI??null:null);e.insertBefore(g,l),y&&g instanceof HTMLElement&&h&&me(g,y).catch(T=>{j.devError("Transition enter error:",T)})}for(let f=k;f<_.length;f++){const g=_[f];y&&g instanceof HTMLElement&&h?Oe(g,y).then(()=>{e.contains(g)&&e.removeChild(g)}).catch(T=>{j.devError("Transition leave error:",T),e.contains(g)&&e.removeChild(g)}):e.removeChild(g)}}}for(const C of t){let l;if(C.tag==="#anchor"){const A=C.key,S=`${A}:start`,y=`${A}:end`;let h=E.get(S),_=E.get(y);const L=Array.isArray(C.children)?C.children:[];if(h||(h=document.createTextNode(""),V(h,S)),_||(_=document.createTextNode(""),V(_,y)),C._startNode=h,C._endNode=_,!e.contains(h)||!e.contains(_)){e.insertBefore(h,b);const N=C._transition,k=!(N&&N.state==="visible"&&L.length>0)||N.appear;for(const f of L){const g=U(f,s,r,e instanceof Element?e.namespaceURI??null:null);e.insertBefore(g,b),N&&g instanceof HTMLElement&&k&&me(g,N).catch(T=>{j.devError("Transition enter error:",T)})}e.insertBefore(_,b)}else{const N=C._transition,k=d.get(A)._transition,f=k&&k.state!==N?.state,g=N&&N.state==="visible"&&L.length>0&&!f,T=f||!g||N?.appear===!0;p(h,_,d.get(A)?.children,L,N,T)}w(h,_),b=_.nextSibling;continue}if(C.key!=null&&E.has(C.key)){const A=d.get(C.key);l=be(E.get(C.key),A,C,s,r),v.add(l),l!==b&&e.contains(l)&&(b&&!e.contains(b)&&(b=null),e.insertBefore(l,b))}else l=U(C,s,r,e instanceof Element?e.namespaceURI??null:null),b&&!e.contains(b)&&(b=null),e.insertBefore(l,b),v.add(l);b=l.nextSibling}for(let C=0;C<o.length;C++){const l=o[C];!v.has(l)&&e.contains(l)&&(ie(l,r),e.removeChild(l))}}function be(e,n,t,s,r){if(n&&typeof n!="string"&&n.props?.ref&&r&&ie(e,r),n===t)return e;if(typeof t=="string"){if(e.nodeType===Node.TEXT_NODE)return e.textContent!==t&&(e.textContent=t),e;{const o=document.createTextNode(t);return e.parentNode?.replaceChild(o,e),o}}if(t&&typeof t!="string"&&t.tag==="#anchor"){const o=t,a=Array.isArray(o.children)?o.children:[],u=o._startNode??document.createTextNode(""),d=o._endNode??document.createTextNode("");o.key!=null&&(V(u,`${o.key}:start`),V(d,`${o.key}:end`)),o._startNode=u,o._endNode=d;const E=document.createDocumentFragment();E.appendChild(u);for(const v of a){const b=U(v,s,r,e.parentNode instanceof Element?e.parentNode.namespaceURI??null:null);E.appendChild(b)}return E.appendChild(d),e.parentNode?.replaceChild(E,e),u}if(!t){ie(e,r);const o=document.createComment("removed");return e.parentNode?.replaceChild(o,e),o}if(!n||typeof n=="string"){ie(e,r);const o=U(t,s,r,e.parentNode instanceof Element?e.parentNode.namespaceURI??null:null);return ge(t,o,r),e.parentNode?.replaceChild(o,e),o}if(t.tag==="#anchor"){const o=Array.isArray(t.children)?t.children:[],a=t._startNode??document.createTextNode(""),u=t._endNode??document.createTextNode("");t.key!=null&&(V(a,`${t.key}:start`),V(u,`${t.key}:end`)),t._startNode=a,t._endNode=u;const d=document.createDocumentFragment();d.appendChild(a);for(const E of o)d.appendChild(U(E,s,r,e.parentNode instanceof Element?e.parentNode.namespaceURI??null:null));return d.appendChild(u),e.parentNode?.replaceChild(d,e),a}if(typeof n!="string"&&typeof t!="string"&&n.tag===t.tag&&n.key===t.key){const o=e;return ze(o,n.props||{},t.props||{},s),Et(o,n.children,t.children,s,r),ge(t,o,r),o}if(typeof n!="string"&&typeof t!="string"&&n.tag===t.tag&&(n.tag&&String(n.tag).includes("-")||t.props&&t.props.isCustomElement||n.props&&n.props.isCustomElement))try{const a=e;return ze(a,n.props||{},t.props||{},s),ge(t,a,r),a}catch{}ie(e,r);const i=U(t,s,r,e.parentNode instanceof Element?e.parentNode.namespaceURI??null:null);return ge(t,i,r),e.parentNode?.replaceChild(i,e),i}function Ct(e,n,t,s){let r;Array.isArray(n)?n.length===1?(r=n[0],r&&typeof r=="object"&&r.key==null&&(r={...r,key:"__root__"})):r={tag:"div",key:"__root__",children:n}:(r=n,r&&typeof r=="object"&&r.key==null&&(r={...r,key:"__root__"})),r&&typeof r=="object"&&r.tag==="#anchor"&&(r={tag:"div",key:"__anchor_root__",props:{attrs:{"data-anchor-block-root":"",key:"__anchor_root__"}},children:[r]}),r=He(r,String(r.key??"root"));const i=e._prevVNode??null,o=e._prevDom??e.firstChild??null;let a;i&&o?typeof i!="string"&&typeof r!="string"&&i.tag===r.tag&&i.key===r.key?a=be(o,i,r,t,s):(a=U(r,t,s,e.host instanceof Element?e.host.namespaceURI??null:null),e.replaceChild(a,o)):(a=U(r,t,s,e.host instanceof Element?e.host.namespaceURI??null:null),e.firstChild?e.replaceChild(a,e.firstChild):e.appendChild(a));const u=[];for(let d=0;d<e.childNodes.length;d++){const E=e.childNodes[d];E!==a&&E.nodeName!=="STYLE"&&(ie(E,s),u.push(E))}u.forEach(d=>e.removeChild(d)),e._prevVNode=r,e._prevDom=a}const Se=[],Ke=new WeakMap,ve=new WeakMap;function _t(e,n){ve.has(e)||ve.set(e,new Set),ve.get(e).add(n)}function At(e,n){const t=ve.get(e);t&&t.delete(n)}function kt(e,n,t,s,r,i,o,a){if(e){Se.push(t);try{const u=n.render(t);if(u instanceof Promise){i(!0),u.then(d=>{i(!1),o(null),Ve(e,d,t,s,r),a(e.innerHTML)}).catch(d=>{i(!1),o(d)});return}Ve(e,u,t,s,r),a(e.innerHTML)}finally{Se.pop()}}}function Ve(e,n,t,s,r){e&&(Ct(e,Array.isArray(n)?n:[n],t,s),r(e.innerHTML))}function Tt(e,n,t,s,r,i,o){if(i!==null&&clearTimeout(i),Date.now()-n<16){if(r(t+1),t===15)j.devWarn(`⚠️ Component is re-rendering rapidly. This might indicate:
2
2
  Common causes:
3
3
  • Event handler calling a function immediately: @click="\${fn()}" should be @click="\${fn}"
4
4
  • State modification during render
5
5
  • Missing dependencies in computed/watch
6
- Component rendering will be throttled to prevent browser freeze.`);else if(t>20){P.devError(`🛑 Infinite loop detected in component render:
6
+ Component rendering will be throttled to prevent browser freeze.`);else if(t>20){j.devError(`🛑 Infinite loop detected in component render:
7
7
  • This might be caused by state updates during render
8
8
  • Ensure all state modifications are done in event handlers or effects
9
- Stopping runaway component render to prevent browser freeze`),i(null);return}}else r(0);const u=setTimeout(()=>{s(Date.now()),e(),i(null)},t>10?100:0);i(u)}function Et(e,n,t,s,r){if(!e)return;let o=t||"";try{if(e){const l=Array.from(e.querySelectorAll("*"));for(const C of l)try{const S=C.lastHtmlStringForJitCSS;S&&typeof S=="string"&&S.trim()&&(o+=`
10
- `+S)}catch{}}}catch{}const i=W.jitCSS(o);if((!i||i.trim()==="")&&!n._computedStyle){if(r(null),"adoptedStyleSheets"in e&&typeof CSSStyleSheet<"u")e.adoptedStyleSheets=[W.getBaseResetSheet(),W.getTransitionStyleSheet()];else{const C=W.minifyCSS(W.baseReset),S=W.getTransitionStyleSheet();let b="";try{S&&"cssRules"in S&&(b=Array.from(S.cssRules).map(N=>N.cssText).join(`
11
- `))}catch{b=""}const h=W.minifyCSS(`${C}
12
- ${b}`);let k=e.querySelector("style[data-cer-runtime]");k||(k=document.createElement("style"),f.setAttributeSmart(k,"data-cer-runtime","true"),e.appendChild(k));try{k.textContent=h}catch{}try{e.adoptedStyleSheets=[W.getBaseResetSheet(),W.getTransitionStyleSheet()]}catch{}}return}let a="";n._computedStyle&&(a=n._computedStyle??"");let d=W.sanitizeCSS(`${a}
13
- ${i}
14
- `);d=W.minifyCSS(d);let u=s;if("adoptedStyleSheets"in e&&typeof CSSStyleSheet<"u"){if(u||(u=new CSSStyleSheet),u.cssRules.length===0||u.cssRules.length>0&&Array.from(u.cssRules).map(C=>C.cssText).join("")!==d)try{u.replaceSync(d)}catch{u=null}if(u){e.adoptedStyleSheets=[W.getBaseResetSheet(),W.getTransitionStyleSheet(),u],r(u);return}}const v=W.minifyCSS(W.baseReset),g=W.getTransitionStyleSheet();let T="";try{g&&"cssRules"in g&&(T=Array.from(g.cssRules).map(l=>l.cssText).join(`
15
- `))}catch{T=""}const p=W.minifyCSS(`${v}
16
- ${T}
17
- ${d}`);let _=e.querySelector("style[data-cer-runtime]");_||(_=document.createElement("style"),f.setAttributeSmart(_,"data-cer-runtime","true"),e.appendChild(_));try{_.textContent=p}catch{}try{const l=[W.getBaseResetSheet(),W.getTransitionStyleSheet()];if(typeof CSSStyleSheet<"u")try{const C=new CSSStyleSheet;try{C.replaceSync(d),l.push(C)}catch{l.push({cssRules:[],replaceSync:()=>{}})}}catch{}e.adoptedStyleSheets=l}catch{}r(null)}let I=null;function De(e){I=e}function Ne(){I=null}function _t(){if(!I)throw new Error("useEmit must be called during component render");const e=I.emit;if(typeof e!="function")throw new Error("useEmit requires an emit function on the component context");const n=e;return(t,s,r)=>n(t,s,r)}function fe(e){e._hookCallbacks||Object.defineProperty(e,"_hookCallbacks",{value:{},writable:!0,enumerable:!1,configurable:!1})}function At(e){if(!I)throw new Error("useOnConnected must be called during component render");fe(I),I._hookCallbacks.onConnected=e}function Ct(e){if(!I)throw new Error("useOnDisconnected must be called during component render");fe(I),I._hookCallbacks.onDisconnected=e}function kt(e){if(!I)throw new Error("useOnAttributeChanged must be called during component render");fe(I),I._hookCallbacks.onAttributeChanged=e}function Tt(e){if(!I)throw new Error("useOnError must be called during component render");fe(I),I._hookCallbacks.onError=n=>{try{n instanceof Error?e(n):e(new Error(String(n)))}catch{}}}function wt(e){if(!I)throw new Error("useProps must be called during component render");fe(I);const n=I._hookCallbacks;n.props={...n.props||{},...e};const t=I;try{const r=Object.keys(e||{});for(const o of r){if(typeof o!="string"||o.startsWith("_"))continue;const i=Object.getOwnPropertyDescriptor(t,o);if(!(i&&!i.configurable))try{let d=Object.prototype.hasOwnProperty.call(t,o)?t[o]:void 0;Object.defineProperty(t,o,{configurable:!0,enumerable:!0,get(){try{const u=t&&t._host;if(u){const A=f.toKebab(o),v=u.getAttribute(A);if(v!==null){const g=typeof e[o];return g==="boolean"?v===""||v==="true":g==="number"?Number(v):v}if(typeof u[o]<"u"){const g=u[o];if(f.isReactiveState(g)||g&&typeof g=="object"&&"value"in g&&!(g instanceof Node))return g.value;const T=typeof e[o];if(!(T==="string"&&g&&typeof g=="object"))return T==="boolean"&&typeof g=="string"?g===""||g==="true":g}}}catch{}return d},set(u){d=u}})}catch{}}}catch{}return new Proxy({},{get(r,o){if(typeof o!="string")return;const i=e[o];try{const d=t&&t._host;if(d){if(d instanceof HTMLElement||typeof d.getAttribute=="function"&&typeof d.hasAttribute=="function"){const A=o.replace(/([A-Z])/g,"-$1").toLowerCase(),v=d.getAttribute(A);if(v!==null)return typeof i=="boolean"?v===""||v==="true":typeof i=="number"?Number(v):v}const u=d[o];if(typeof u<"u"&&u!==""){const A=u&&typeof u=="object"&&"value"in u&&!(u instanceof Node);if(!(typeof i=="string"&&u&&typeof u=="object"&&!A&&!f.isReactiveState(u)))return typeof i=="boolean"&&i===!1&&u===""?i:f.isReactiveState(u)||A?u.value:typeof i=="boolean"&&typeof u=="string"?u==="true"||u!==""&&u!=="false":typeof i=="number"&&typeof u=="string"&&!Number.isNaN(Number(u))?Number(u):u}}}catch{}const a=t[o];return typeof i=="boolean"&&a===""?i===!1?i:!0:f.isReactiveState(a)||a&&typeof a=="object"&&"value"in a&&!(a instanceof Node)?a.value:a!=null&&a!==""?typeof i=="boolean"&&typeof a=="string"?a==="true":typeof i=="number"&&typeof a=="string"&&!Number.isNaN(Number(a))?Number(a):a:i},has(r,o){return typeof o=="string"&&(o in t||o in e)},ownKeys(){return Array.from(new Set([...Object.keys(e),...Object.keys(t||{})]))},getOwnPropertyDescriptor(){return{configurable:!0,enumerable:!0}}})}function Lt(e){if(!I)throw new Error("useStyle must be called during component render");fe(I);try{const n=e();Object.defineProperty(I,"_computedStyle",{value:n,writable:!0,enumerable:!1,configurable:!0})}catch(n){P.devWarn("Error in useStyle callback:",n),Object.defineProperty(I,"_computedStyle",{value:"",writable:!0,enumerable:!1,configurable:!0})}}const le=new Map,ze=Symbol.for("cer.registry");function Nt(){if(typeof window<"u"){const e=globalThis;e[ze]||(e[ze]=le)}}function Rt(e,n){if(!n.render)throw new Error("Component must have a render function");return typeof window>"u"?class{constructor(){}}:class extends HTMLElement{context;_refs={};_listeners=[];_watchers=new Map;_renderTimeoutId=null;_mounted=!1;_hasError=!1;_initializing=!0;_componentId;_styleSheet=null;_lastHtmlStringForJitCSS="";get lastHtmlStringForJitCSS(){return this._lastHtmlStringForJitCSS}get isLoading(){return this._templateLoading}get lastError(){return this._templateError}_cfg;_lastRenderTime=0;_renderCount=0;_templateLoading=!1;_templateError=null;constructor(){super(),this.attachShadow({mode:"open"}),this._cfg=le.get(e)||n,this._componentId=`${e}-${Math.random().toString(36).substr(2,9)}`;const t=this._initContext(n),s=(o,i,a)=>{Object.defineProperty(o,i,{value:a,writable:!1,enumerable:!1,configurable:!1})};s(t,"refs",this._refs),s(t,"requestRender",()=>this.requestRender()),s(t,"_requestRender",()=>this._requestRender()),s(t,"_componentId",this._componentId),s(t,"_triggerWatchers",(o,i)=>this._triggerWatchers(o,i)),this.context=t,f.safe(()=>{s(t,"_host",this)}),s(this.context,"emit",(o,i,a)=>{const d={detail:i,bubbles:!0,composed:!0,...a||{}},u=new CustomEvent(o,d);this.dispatchEvent(u);const A=o.indexOf(":");if(A>0){const v=o.substring(0,A),g=o.substring(A+1),T=g.includes("-")?`${v}:${g.split("-").map((p,_)=>_===0?p:p.charAt(0).toUpperCase()+p.slice(1)).join("")}`:`${v}:${g.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`;T!==o&&f.safe(()=>{this.dispatchEvent(new CustomEvent(T,d))})}return!u.defaultPrevented});const r=le.get(e)||n;for(const o in r){const i=r[o];typeof i=="function"&&(this.context[o]=(...a)=>i(...a,this.context))}if(r.props)for(const o in r.props){let i=this[o];Object.defineProperty(this,o,{get(){return i},set(a){const d=i;i=a,this.context[o]=a,this._initializing||(this._applyProps(r),d!==a&&this._requestRender())},enumerable:!0,configurable:!0})}this._initializing=!1,this._initWatchers(r),this._applyProps(r),this._render(r)}connectedCallback(){this._runLogicWithinErrorBoundary(n,()=>{this._applyProps(n),this._requestRender(),tt(n,this.context,this._mounted,t=>{this._mounted=t})})}disconnectedCallback(){this._runLogicWithinErrorBoundary(n,()=>{nt(n,this.context,this._listeners,()=>{this._listeners=[]},()=>{this._watchers.clear()},t=>{this._templateLoading=t},t=>{this._templateError=t},t=>{this._mounted=t})})}attributeChangedCallback(t,s,r){this._runLogicWithinErrorBoundary(n,()=>{this._applyProps(n),s!==r&&this._requestRender(),rt(n,t,s,r,this.context)})}static get observedAttributes(){return n.props?Object.keys(n.props).map(f.toKebab):[]}_render(t){this._runLogicWithinErrorBoundary(t,()=>{St(this.shadowRoot,t,this.context,this._refs,s=>{this._lastHtmlStringForJitCSS=s,typeof this.onHtmlStringUpdate=="function"&&this?.onHtmlStringUpdate?.(s)},s=>{this._templateLoading=s,this?.onLoadingStateChange?.(s)},s=>{this._templateError=s,this?.onErrorStateChange?.(s)},s=>this._applyStyle(t,s))})}requestRender(){this._requestRender()}_requestRender(){this._runLogicWithinErrorBoundary(this._cfg,()=>{f.scheduleDOMUpdate(()=>{vt(()=>this._render(this._cfg),this._lastRenderTime,this._renderCount,t=>{this._lastRenderTime=t},t=>{this._renderCount=t},this._renderTimeoutId,t=>{this._renderTimeoutId=t})},this._componentId)})}_applyStyle(t,s){this._runLogicWithinErrorBoundary(t,()=>{Et(this.shadowRoot,this.context,s,this._styleSheet,r=>{this._styleSheet=r})})}_runLogicWithinErrorBoundary(t,s){this._hasError&&(this._hasError=!1);try{s()}catch(r){this._hasError=!0;try{const o=this.tagName?.toLowerCase?.()||"<unknown>",i=this._componentId||"<unknown-id>",a={};if(t&&t.props)for(const d of Object.keys(t.props))try{const u=this.context[d];u instanceof Node?a[d]=`[DOM Node: ${u.nodeName}]`:typeof u=="object"&&u!==null?a[d]=Object.keys(u).length>5?`[object(${Object.keys(u).length} keys)]`:u:a[d]=u}catch{a[d]="[unreadable]"}P.devError(`Error rendering component <${o}> (id=${i}):`,r),P.devError("Component props snapshot:",a),P.devWarn("Common causes: accessing properties of null/undefined inside template interpolations; expensive or throwing expressions inside templates that evaluate eagerly. Fixes: use optional chaining (obj?.prop), guard with ternary, or use the runtime lazy overload: when(cond, () => html`...`).")}catch{}t.onError&&t.onError(r,this.context)}}_initContext(t){try{let s=function(o,i=""){if(Array.isArray(o))return new Proxy(o,{get(a,d,u){const A=Reflect.get(a,d,u);return typeof A=="function"&&typeof d=="string"&&["push","pop","shift","unshift","splice","sort","reverse"].includes(d)?function(...g){const T=A.apply(a,g);if(!r._initializing){const p=i||"root";r._triggerWatchers(p,a),f.scheduleDOMUpdate(()=>r._render(t),r._componentId)}return T}:A},set(a,d,u){if(a[String(d)]=u,!r._initializing){const A=i?`${i}.${String(d)}`:String(d);r._triggerWatchers(A,u),f.scheduleDOMUpdate(()=>r._render(t),r._componentId)}return!0},deleteProperty(a,d){if(delete a[String(d)],!r._initializing){const u=i?`${i}.${String(d)}`:String(d);r._triggerWatchers(u,void 0),f.scheduleDOMUpdate(()=>r._render(t),r._componentId)}return!0}});if(o&&typeof o=="object"){if(f.isReactiveState(o))return o;for(const a in o){const d=i?`${i}.${a}`:a;o[a]=s(o[a],d)}return new Proxy(o,{set(a,d,u){const A=i?`${i}.${String(d)}`:String(d);return a[String(d)]=s(u,A),r._initializing||(r._triggerWatchers(A,a[String(d)]),f.scheduleDOMUpdate(()=>r._render(t),r._componentId)),!0},get(a,d,u){return Reflect.get(a,d,u)}})}return o};const r=this;return s({...t.props?Object.fromEntries(Object.entries(t.props).map(([o,i])=>[o,i.default])):{}})}catch{return{}}}_initWatchers(t){this._runLogicWithinErrorBoundary(t,()=>{Ye(this.context,this._watchers,{})})}_triggerWatchers(t,s){Xe(this.context,this._watchers,t,s)}_applyProps(t){this._runLogicWithinErrorBoundary(t,()=>{try{et(this,t,this.context)}catch(s){this._hasError=!0,t.onError&&t.onError(s,this.context)}})}}}function Ot(e,n){Nt();let t=f.toKebab(e);t.includes("-")||(t=`cer-${t}`);const s={},r={props:{},onConnected:()=>{s.onConnected&&s.onConnected()},onDisconnected:()=>{s.onDisconnected&&s.onDisconnected()},onAttributeChanged:(o,i,a)=>{s.onAttributeChanged&&s.onAttributeChanged(o,i,a)},onError:o=>{s.onError&&o&&s.onError(o)},render:o=>{const i=o,a=i._componentId||`${t}-${Math.random().toString(36).substr(2,9)}`;f.reactiveSystem.setCurrentComponent(a,()=>{o.requestRender&&o.requestRender()});try{De(o);let d;try{d=n()}catch(u){try{const A=i._hookCallbacks;if(A&&typeof A.onError=="function")try{A.onError(u)}catch{}}catch{}throw u}if(i._hookCallbacks){const u=i._hookCallbacks;if(u.onConnected&&(s.onConnected=u.onConnected),u.onDisconnected&&(s.onDisconnected=u.onDisconnected),u.onAttributeChanged&&(s.onAttributeChanged=u.onAttributeChanged),u.onError&&(s.onError=u.onError),u.style&&(i._styleCallback=u.style),u.props){const A=u.props;r.props=Object.fromEntries(Object.entries(A).map(([v,g])=>[v,{type:typeof g=="boolean"?Boolean:typeof g=="number"?Number:typeof g=="string"?String:Function,default:g}])),le.set(t,r)}}return d}finally{Ne(),f.reactiveSystem.clearCurrentComponent()}}};if(le.set(t,r),typeof window<"u"){try{const o={_hookCallbacks:{},requestRender:()=>{},emit:()=>!0};De(o);try{n()}catch(i){try{const a=o?._hookCallbacks;if(a&&typeof a.onError=="function")try{a.onError(i)}catch{}P.devError(`Error during component discovery render <${t}>:`,i),P.devWarn("Error occurred during initial component discovery render. Consider guarding expensive expressions or using lazy factories for directives like when().")}catch{}throw Ne(),i}if(Ne(),o._hookCallbacks?.props){const i=o._hookCallbacks.props;r.props=Object.fromEntries(Object.entries(i).map(([a,d])=>[a,{type:typeof d=="boolean"?Boolean:typeof d=="number"?Number:typeof d=="string"?String:Function,default:d}])),le.set(t,r)}}catch{}customElements.get(t)||customElements.define(t,Rt(t,r))}}class Mt{map=new Map;maxSize;constructor(n){this.maxSize=n}get(n){const t=this.map.get(n);if(t!==void 0)return this.map.delete(n),this.map.set(n,t),t}set(n,t){if(this.map.delete(n),this.map.set(n,t),this.map.size>this.maxSize){const s=this.map.keys().next().value;s!==void 0&&this.map.delete(s)}}has(n){return this.map.has(n)}clear(){this.map.clear()}}const Re=new Mt(500);function $t(e,n){if(e==null){P.devWarn(`⚠️ Event handler for '@${n}' is ${e}. This will prevent the event from working. Use a function reference instead: @${n}="\${functionName}"`);return}typeof e!="function"&&P.devWarn(`🚨 Potential infinite loop detected! Event handler for '@${n}' appears to be the result of a function call (${typeof e}) instead of a function reference. Change @${n}="\${functionName()}" to @${n}="\${functionName}" to pass the function reference instead of calling it immediately.`),e===void 0&&typeof e!="function"&&P.devWarn(`💡 Tip: If your event handler function returns undefined, make sure you're passing the function reference, not calling it. Use @${n}="\${fn}" not @${n}="\${fn()}"`)}function X(e,n={},t,s){const r=s??n.key;return{tag:e,key:r,props:n,children:t}}function be(e){return!!e&&typeof e=="object"&&(e.type==="AnchorBlock"||e.tag==="#anchor")}function ne(e){return typeof e=="object"&&e!==null&&"tag"in e&&!be(e)}function jt(e,n){return e.key!=null?e:{...e,key:n}}function Pt(e,n=[],t={}){const s={},r={},o={},i=[],a=/([:@#]?)([a-zA-Z0-9-:.]+)(?:\s*=\s*("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)'|([^\s>]+)))?/g;let d;for(;d=a.exec(e);){const u=d[1],A=d[2];let v="";for(let l=3;l<d.length;l++)if(d[l]!==void 0){v=d[l];break}v.length>=2&&(v[0]==='"'&&v[v.length-1]==='"'||v[0]==="'"&&v[v.length-1]==="'")&&(v=v.slice(1,-1));const g=!/=/.test(d[0]),T=v.match(/^{{(\d+)}}$/);let p=g?!0:T?n[Number(T[1])]??null:v;T||(p==="true"?p=!0:p==="false"?p=!1:p==="null"?p=null:isNaN(Number(p))||(p=Number(p)));const _=["model","bind","show","class","style","ref","when"];if(u===":"){const[l,C]=A.split(":"),[S,...b]=l.split(".");if(_.includes(S)){const h=[...b],k=S==="model"&&C?`model:${C}`:S;o[k]={value:p,modifiers:h,arg:C}}else if(A==="disabled"){let h=p;h&&f.isReactiveState(h)&&(h=h.value);const k=typeof h;if(h===""||k==="boolean"||k==="string"&&(h==="true"||h==="false")||h==null||k==="number")s[A]=h;else{let c=p;c&&f.isReactiveState(c)&&(c=c.value),r[A]=c}i.push(A)}else{let h=p;h&&f.isReactiveState(h)&&(h=h.value),r[A]=h,i.push(A)}}else if(u==="@"){const[l,...C]=A.split("."),S=C;$t(p,l);const b=typeof p=="function"?p:typeof t[p]=="function"?t[p]:void 0;if(b){const h=N=>{if(S.includes("prevent")&&N.preventDefault(),S.includes("stop")&&N.stopPropagation(),!(S.includes("self")&&N.target!==N.currentTarget))return S.includes("once")&&N.currentTarget?.removeEventListener(l,h),b(N)},k="on"+l.charAt(0).toUpperCase()+l.slice(1);s[k]=h}}else A==="ref"?s.ref=p:r[A]=p}return{props:s,attrs:r,directives:o,bound:i}}function je(e){if(!ne(e)||be(e))return e;const n=e.props?.directives;if(n&&n.when){const t=n.when.value,s=f.isReactiveState(t)?t.value:t,r={...n};delete r.when;const o={...e.props};Object.keys(r).length>0?o.directives=r:delete o.directives;const i={...e,props:o};return Array.isArray(i.children)&&(i.children=i.children.map(d=>typeof d=="object"&&d!==null?je(d):d)),{tag:"#anchor",key:e.key!=null?`when-${e.key}`:`when-${e.tag}`,children:s?[i]:[]}}if(Array.isArray(e.children)){const t=e.children.map(s=>typeof s=="object"&&s!==null?je(s):s);return{...e,children:t}}return e}function Ht(e,n,t){const s=ge.length>0?ge[ge.length-1]:void 0,r=t??s,o=!t&&n.length===0,i=o?e.join("<!--TEMPLATE_DELIM-->"):null;if(o&&i){const c=Re.get(i);if(c)return c}function a(c,E){return X("#text",{},c,E)}function d(c,E){let m=typeof c=="string"?f.decodeEntities(c):c;return typeof m=="string"&&/[\r\n]/.test(m)&&(m=m.replace(/\s+/g," ")),X("#text",{},m,E)}let u="";for(let c=0;c<e.length;c++)u+=e[c],c<n.length&&(u+=`{{${c}}}`);const A=/<!--[\s\S]*?-->|<\/?([a-zA-Z0-9-]+)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|[^\s>]+))?)*)\s*\/?>|{{(\d+)}}|([^<]+)/g,v=[];let g,T=[],p=null,_={},l,C=0;const S=[];function b(c){if(!c||typeof c!="object"||be(c))return;const E=c,m=_;if(E.props||E.attrs){const y=E;y.props&&(m.props||(m.props={}),Object.assign(m.props,y.props)),y.attrs&&(m.attrs||(m.attrs={}),Object.keys(y.attrs).forEach(w=>{if(w==="style"&&m.attrs.style){const M=String(m.attrs.style).replace(/;?\s*$/,""),O=String(y.attrs.style).replace(/^;?\s*/,"");m.attrs.style=M+"; "+O}else if(w==="class"&&m.attrs.class){const M=String(m.attrs.class).trim().split(/\s+/).filter(Boolean),O=String(y.attrs.class).trim().split(/\s+/).filter(Boolean),L=[...new Set([...M,...O])];m.attrs.class=L.join(" ")}else m.attrs[w]=y.attrs[w]}))}else m.props||(m.props={}),Object.assign(m.props,E)}function h(c,E){const m=p?T:S;if(be(c)){const y=c.key??E,w=c.children;m.push({...c,key:y,children:w});return}if(ne(c)){m.push(jt(c,void 0));return}if(Array.isArray(c)){if(c.length===0)return;for(let y=0;y<c.length;y++){const w=c[y];be(w)||ne(w)||Array.isArray(w)?h(w,`${E}-${y}`):w!==null&&typeof w=="object"?f.isUnsafeHTML(w)?m.push(X("#raw",{},w.__rawHTML,`${E}-${y}`)):b(w):m.push(a(String(w),`${E}-${y}`))}return}if(c!==null&&typeof c=="object"){if(f.isUnsafeHTML(c)){const y=c.__rawHTML??"";m.push(X("#raw",{},y,E));return}b(c);return}m.push(a(String(c),E))}const k=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);for(;g=A.exec(u);)if(!(g[0].startsWith("<!--")&&g[0].endsWith("-->"))){if(g[1]){const c=g[1],E=g[0][1]==="/",m=g[0][g[0].length-2]==="/"||k.has(c),{props:y,attrs:w,directives:M,bound:O}=Pt(g[2]||"",n,r??{}),L={props:{},attrs:{}};for(const x in y)L.props[x]=y[x];for(const x in w)L.attrs[x]=w[x];L.attrs&&Object.prototype.hasOwnProperty.call(L.attrs,"key")&&!(L.props&&Object.prototype.hasOwnProperty.call(L.props,"key"))&&f.safe(()=>{L.props.key=L.attrs.key});try{const x={input:["value","checked","readonly","required","placeholder","maxlength","minlength"],textarea:["value","readonly","required","placeholder","maxlength","minlength"],select:["value","required","multiple"],option:["selected","value"],video:["muted","autoplay","controls","loop","playsinline"],audio:["muted","autoplay","controls","loop"],img:["src","alt","width","height"],button:["type","name","value","autofocus","form"]},j=c.toLowerCase(),G=x[j]??[];if(L.attrs){for(const H of G)if(O&&O.includes(H)&&H in L.attrs&&!(L.props&&H in L.props)){let $=L.attrs[H];if($&&f.isReactiveState($))$=$.value,L.props[H]=$,delete L.attrs[H];else if($&&typeof $=="object"&&"value"in $&&!($ instanceof Node))try{const B=$.value;L.props[H]=(j==="select"||j==="option")&&H==="value"?String(B):B,delete L.attrs[H]}catch{}else{const B=typeof $;if(H==="disabled")($===""||B==="boolean"||B==="string"&&($==="true"||$==="false")||$==null||B==="number")&&(L.props[H]=$,delete L.attrs[H]);else if($===""||B==="string"||B==="number"||B==="boolean"||$==null){const F=(j==="select"||j==="option")&&H==="value"?String($):$;L.props[H]=F,delete L.attrs[H]}}}}if(c.includes("-")||!!r?.__customElements?.has?.(c)){if(L.isCustomElement=!0,O&&L.attrs){const H=new Set(["id","name","data-key","key"]);for(const $ of O)if($ in L.attrs&&!(L.props&&$ in L.props)){const B=$.includes("-")?f.toCamel($):$,F=L.attrs[$];if(L.props[B]=F,H.has($)||f.isClassLikeAttr($))try{const Ee=f.safeSerializeAttr(L.attrs[$]);Ee===null?delete L.attrs[$]:L.attrs[$]=Ee}catch{delete L.attrs[$]}else delete L.attrs[$]}}try{if(L.attrs&&!(L.props&&"modelValue"in L.props)){const H=L.attrs["model-value"]??L.attrs.modelValue;typeof H<"u"&&(L.props.modelValue=H)}}catch{}}}catch{}if(M&&Object.keys(M).some(x=>x==="model"||x.startsWith("model:")))try{const x=Symbol.for("cer.registry"),j=globalThis[x],G=!!(j&&typeof j.has=="function"&&j.has(c)),D=r,H=!!(D&&(D.__customElements instanceof Set&&D.__customElements.has(c)||Array.isArray(D.__isCustomElements)&&D.__isCustomElements.includes(c)));if(!!(c.includes("-")||H||G))for(const F of Object.keys(M)){if(F!=="model"&&!F.startsWith("model:"))continue;const ve=M[F],Ee=ve.arg??(F.includes(":")?F.split(":",2)[1]:void 0),z=ve.value,ke=Ee??"modelValue",Pe=f.getNestedValue,Ge=f.setNestedValue,ue=r?._state||r;let J;typeof z=="string"&&ue?J=Pe(ue,z):J=z,L.props[ke]=J;try{const Q=f.toKebab(ke);L.attrs||(L.attrs={}),J!=null&&(typeof J=="string"||typeof J=="number"||typeof J=="boolean")&&(L.attrs[Q]=J)}catch{}L.isCustomElement=!0;const He=`update:${f.toKebab(ke)}`.replace(/-([a-z])/g,(Q,Z)=>Z.toUpperCase()),Ze="on"+He.charAt(0).toUpperCase()+He.slice(1);L.props[Ze]=function(Q){const Z=Q.detail!==void 0?Q.detail:Q.target?Q.target.value:void 0;if(ue)if(z&&f.isReactiveState(z)){const ee=z.value;if(Array.isArray(Z)&&Array.isArray(ee)?JSON.stringify([...Z].sort())!==JSON.stringify([...ee].sort()):Z!==ee){z.value=Z;try{const te=r;if(te){const de=te.requestRender,pe=te._requestRender;typeof de=="function"?de():typeof pe=="function"&&pe()}}catch{}}}else{const ee=Pe(ue||{},typeof z=="string"?z:String(z));if(Array.isArray(Z)&&Array.isArray(ee)?JSON.stringify([...Z].sort())!==JSON.stringify([...ee].sort()):Z!==ee){Ge(ue||{},typeof z=="string"?z:String(z),Z);try{const te=r;if(te){const de=te.requestRender,pe=te._requestRender;typeof de=="function"?de():typeof pe=="function"&&pe()}}catch{}}}},delete M[F]}}catch{}if(Object.keys(M).length>0&&(L.directives={...M}),E){const x=T.some(H=>typeof H=="object"&&H.tag!=="#text");let j=T;if(x&&T.length>0){let H=0;for(;H<T.length;){const B=T[H];if(!ne(B)||B.tag!=="#text"||typeof B.children!="string"||B.children.trim()!=="")break;H++}let $=T.length-1;for(;$>=0;){const B=T[$];if(!ne(B)||B.tag!=="#text"||typeof B.children!="string"||B.children.trim()!=="")break;$--}H===0&&$===T.length-1?j=T:H>$?j=[]:j=T.slice(H,$+1)}const G=X(p,_,j.length===1&&ne(j[0])&&j[0].tag==="#text"?typeof j[0].children=="string"?j[0].children:"":j.length?j:void 0,l),D=v.pop();D?(p=D.tag,_=D.props,l=D.key,T=D.children,T.push(G)):(S.push(G),p=null,_={},l=void 0,T=[])}else m?p?T.push(X(c,L,void 0,void 0)):S.push(X(c,L,void 0,void 0)):(p&&v.push({tag:p,props:_,children:T,key:l}),p=c,_=L,T=[])}else if(typeof g[3]<"u"){const c=Number(g[3]),E=n[c],m=`interp-${c}`;h(E,m)}else if(g[4]){const c=g[4],E=p?T:S,m=c.split(/({{\d+}})/);for(const y of m){if(!y)continue;const w=y.match(/^{{(\d+)}}$/);if(w){const M=Number(w[1]),O=n[M],L=`interp-${M}`;h(O,L)}else{const M=`text-${C++}`;E.push(d(y,M))}}}}const R=S.filter(c=>ne(c)&&c.tag==="#text"?typeof c.children=="string"&&c.children.trim()!=="":!0).map(c=>je(c));if(R.length===1){const c=R[0];return o&&i&&Re.set(i,c),c}else if(R.length>1){const c=R;return o&&i&&Re.set(i,c),c}return X("div",{},"","fallback-root")}function xt(e,...n){const t=n[n.length-1],s=typeof t=="object"&&t&&!Array.isArray(t)?t:void 0;return Ht(e,n,s)}exports.computed=f.computed;exports.decodeEntities=f.decodeEntities;exports.ref=f.ref;exports.unsafeHTML=f.unsafeHTML;exports.watch=f.watch;exports.css=W.css;exports.component=Ot;exports.html=xt;exports.useEmit=_t;exports.useOnAttributeChanged=kt;exports.useOnConnected=At;exports.useOnDisconnected=Ct;exports.useOnError=Tt;exports.useProps=wt;exports.useStyle=Lt;
9
+ Stopping runaway component render to prevent browser freeze`),o(null);return}}else r(0);const d=setTimeout(()=>{s(Date.now()),e(),o(null)},t>10?100:0);o(d)}function wt(e,n,t,s,r){if(!e)return;let i=t||"";try{const S=ve.get(e);if(S&&S.size>0)for(const y of S)try{const h=y.lastHtmlStringForJitCSS;h&&typeof h=="string"&&h.trim()&&(i+=`
10
+ `+h)}catch{}else{const y=Array.from(e.querySelectorAll("*"));for(const h of y)try{const _=h.lastHtmlStringForJitCSS;_&&typeof _=="string"&&_.trim()&&(i+=`
11
+ `+_)}catch{}}}catch{}if(Ke.get(e)===i)return;Ke.set(e,i);const a=D.jitCSS(i),u=D.getProseSheet();if((!a||a.trim()==="")&&!n._computedStyle&&!u){if(r(null),"adoptedStyleSheets"in e&&typeof CSSStyleSheet<"u"){const y=[D.getBaseResetSheet(),D.getTransitionStyleSheet()];e.adoptedStyleSheets=y}else{const y=D.minifyCSS(D.baseReset),h=D.getTransitionStyleSheet();let _="";try{h&&"cssRules"in h&&(_=Array.from(h.cssRules).map(m=>m.cssText).join(`
12
+ `))}catch{_=""}const L=D.minifyCSS(`${y}
13
+ ${_}`);let N=e.querySelector("style[data-cer-runtime]");N||(N=document.createElement("style"),c.setAttributeSmart(N,"data-cer-runtime","true"),e.appendChild(N));try{N.textContent=L}catch{}try{const m=[D.getBaseResetSheet(),D.getTransitionStyleSheet()];e.adoptedStyleSheets=m}catch{}}return}let d="";n._computedStyle&&(d=n._computedStyle??"");let E=D.sanitizeCSS(`${d}
14
+ ${a}
15
+ `);E=D.minifyCSS(E);let v=s;if("adoptedStyleSheets"in e&&typeof CSSStyleSheet<"u"){v||(v=new CSSStyleSheet);try{v.replaceSync(E)}catch{v=null}if(v){const S=[D.getBaseResetSheet(),D.getTransitionStyleSheet()];u&&S.push(u),S.push(v),e.adoptedStyleSheets=S,r(v);return}}const w=D.minifyCSS(D.baseReset),p=D.getTransitionStyleSheet();let C="";try{p&&"cssRules"in p&&(C=Array.from(p.cssRules).map(S=>S.cssText).join(`
16
+ `))}catch{C=""}const l=D.minifyCSS(`${w}
17
+ ${C}
18
+ ${E}`);let A=e.querySelector("style[data-cer-runtime]");A||(A=document.createElement("style"),c.setAttributeSmart(A,"data-cer-runtime","true"),e.appendChild(A));try{A.textContent=l}catch{}try{const S=[D.getBaseResetSheet(),D.getTransitionStyleSheet()];if(u&&S.push(u),typeof CSSStyleSheet<"u")try{const y=new CSSStyleSheet;try{y.replaceSync(E),S.push(y)}catch{S.push({cssRules:[],replaceSync:()=>{}})}}catch{}e.adoptedStyleSheets=S}catch{}r(null)}let W=null;function Ue(e){W=e}function Me(){W=null}function Lt(){if(!W)throw new Error("useEmit must be called during component render");const e=W.emit;if(typeof e!="function")throw new Error("useEmit requires an emit function on the component context");const n=e;return(t,s,r)=>n(t,s,r)}function de(e){e._hookCallbacks||Object.defineProperty(e,"_hookCallbacks",{value:{},writable:!0,enumerable:!1,configurable:!1})}function Nt(e){if(!W)throw new Error("useOnConnected must be called during component render");de(W),W._hookCallbacks.onConnected=e}function Rt(e){if(!W)throw new Error("useOnDisconnected must be called during component render");de(W),W._hookCallbacks.onDisconnected=e}function Ot(e){if(!W)throw new Error("useOnAttributeChanged must be called during component render");de(W),W._hookCallbacks.onAttributeChanged=e}function Mt(e){if(!W)throw new Error("useOnError must be called during component render");de(W),W._hookCallbacks.onError=n=>{try{n instanceof Error?e(n):e(new Error(String(n)))}catch{}}}function Pt(e){if(!W)throw new Error("useProps must be called during component render");de(W);const n=W._hookCallbacks;n.props={...n.props||{},...e};const t=W;try{const r=Object.keys(e||{});for(const i of r){if(typeof i!="string"||i.startsWith("_"))continue;const o=Object.getOwnPropertyDescriptor(t,i);if(!(o&&!o.configurable))try{let u=Object.prototype.hasOwnProperty.call(t,i)?t[i]:void 0;Object.defineProperty(t,i,{configurable:!0,enumerable:!0,get(){try{const d=t&&t._host;if(d){const E=c.toKebab(i),v=d.getAttribute(E);if(v!==null){const b=typeof e[i];return b==="boolean"?v===""||v==="true":b==="number"?Number(v):v}if(typeof d[i]<"u"){const b=d[i];if(c.isReactiveState(b)||b&&typeof b=="object"&&"value"in b&&!(b instanceof Node))return b.value;const w=typeof e[i];if(!(w==="string"&&b&&typeof b=="object"))return w==="boolean"&&typeof b=="string"?b===""||b==="true":b}}}catch{}return u},set(d){u=d}})}catch{}}}catch{}return new Proxy({},{get(r,i){if(typeof i!="string")return;const o=e[i];try{const u=t&&t._host;if(u){if(u instanceof HTMLElement||typeof u.getAttribute=="function"&&typeof u.hasAttribute=="function"){const E=i.replace(/([A-Z])/g,"-$1").toLowerCase(),v=u.getAttribute(E);if(v!==null)return typeof o=="boolean"?v===""||v==="true":typeof o=="number"?Number(v):v}const d=u[i];if(typeof d<"u"&&d!==""){const E=d&&typeof d=="object"&&"value"in d&&!(d instanceof Node);if(!(typeof o=="string"&&d&&typeof d=="object"&&!E&&!c.isReactiveState(d)))return typeof o=="boolean"&&o===!1&&d===""?o:c.isReactiveState(d)||E?d.value:typeof o=="boolean"&&typeof d=="string"?d==="true"||d!==""&&d!=="false":typeof o=="number"&&typeof d=="string"&&!Number.isNaN(Number(d))?Number(d):d}}}catch{}const a=t[i];return typeof o=="boolean"&&a===""?o===!1?o:!0:c.isReactiveState(a)||a&&typeof a=="object"&&"value"in a&&!(a instanceof Node)?a.value:a!=null&&a!==""?typeof o=="boolean"&&typeof a=="string"?a==="true":typeof o=="number"&&typeof a=="string"&&!Number.isNaN(Number(a))?Number(a):a:o},has(r,i){return typeof i=="string"&&(i in t||i in e)},ownKeys(){return Array.from(new Set([...Object.keys(e),...Object.keys(t||{})]))},getOwnPropertyDescriptor(){return{configurable:!0,enumerable:!0}}})}function $t(e){if(!W)throw new Error("useStyle must be called during component render");de(W);try{const n=e();Object.defineProperty(W,"_computedStyle",{value:n,writable:!0,enumerable:!1,configurable:!0})}catch(n){j.devWarn("Error in useStyle callback:",n),Object.defineProperty(W,"_computedStyle",{value:"",writable:!0,enumerable:!1,configurable:!0})}}const ue=new Map,Fe=Symbol.for("cer.registry");function jt(){if(typeof window<"u"){const e=globalThis;e[Fe]||(e[Fe]=ue)}}function Ht(e,n){if(!n.render)throw new Error("Component must have a render function");return typeof window>"u"?class{constructor(){}}:class extends HTMLElement{context;_refs={};_listeners=[];_watchers=new Map;_renderTimeoutId=null;_mounted=!1;_hasError=!1;_initializing=!0;_componentId;_styleSheet=null;_lastHtmlStringForJitCSS="";get lastHtmlStringForJitCSS(){return this._lastHtmlStringForJitCSS}get isLoading(){return this._templateLoading}get lastError(){return this._templateError}_cfg;_lastRenderTime=0;_renderCount=0;_templateLoading=!1;_templateError=null;constructor(){super(),this.attachShadow({mode:"open"}),this._cfg=ue.get(e)||n,this._componentId=`${e}-${Math.random().toString(36).substr(2,9)}`;const t=this._initContext(n),s=(i,o,a)=>{Object.defineProperty(i,o,{value:a,writable:!1,enumerable:!1,configurable:!1})};s(t,"refs",this._refs),s(t,"requestRender",()=>this.requestRender()),s(t,"_requestRender",()=>this._requestRender()),s(t,"_componentId",this._componentId),s(t,"_triggerWatchers",(i,o)=>this._triggerWatchers(i,o)),this.context=t,c.safe(()=>{s(t,"_host",this)}),s(this.context,"emit",(i,o,a)=>{const u={detail:o,bubbles:!0,composed:!0,...a||{}},d=new CustomEvent(i,u);this.dispatchEvent(d);const E=i.indexOf(":");if(E>0){const v=i.substring(0,E),b=i.substring(E+1),w=b.includes("-")?`${v}:${b.split("-").map((p,C)=>C===0?p:p.charAt(0).toUpperCase()+p.slice(1)).join("")}`:`${v}:${b.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`;w!==i&&c.safe(()=>{this.dispatchEvent(new CustomEvent(w,u))})}return!d.defaultPrevented});const r=ue.get(e)||n;for(const i in r){const o=r[i];typeof o=="function"&&(this.context[i]=(...a)=>o(...a,this.context))}if(r.props)for(const i in r.props){let o=this[i];Object.defineProperty(this,i,{get(){return o},set(a){const u=o;o=a,this.context[i]=a,this._initializing||(this._applyProps(r),u!==a&&this._requestRender())},enumerable:!0,configurable:!0})}this._initializing=!1,this._initWatchers(r),this._applyProps(r),this._render(r)}connectedCallback(){this._runLogicWithinErrorBoundary(n,()=>{const t=this.getRootNode();t&&t!==document&&"host"in t&&_t(t,this),this._applyProps(n),this._requestRender(),it(n,this.context,this._mounted,s=>{this._mounted=s})})}disconnectedCallback(){this._runLogicWithinErrorBoundary(n,()=>{const t=this.getRootNode();t&&t!==document&&"host"in t&&At(t,this),ot(n,this.context,this._listeners,()=>{this._listeners=[]},()=>{this._watchers.clear()},s=>{this._templateLoading=s},s=>{this._templateError=s},s=>{this._mounted=s})})}attributeChangedCallback(t,s,r){this._runLogicWithinErrorBoundary(n,()=>{this._applyProps(n),s!==r&&this._requestRender(),at(n,t,s,r,this.context)})}static get observedAttributes(){return n.props?Object.keys(n.props).map(c.toKebab):[]}_render(t){this._runLogicWithinErrorBoundary(t,()=>{kt(this.shadowRoot,t,this.context,this._refs,s=>{this._lastHtmlStringForJitCSS=s,typeof this.onHtmlStringUpdate=="function"&&this?.onHtmlStringUpdate?.(s)},s=>{this._templateLoading=s,this?.onLoadingStateChange?.(s)},s=>{this._templateError=s,this?.onErrorStateChange?.(s)},s=>this._applyStyle(t,s))})}requestRender(){this._requestRender()}_requestRender(){this._runLogicWithinErrorBoundary(this._cfg,()=>{c.scheduleDOMUpdate(()=>{Tt(()=>this._render(this._cfg),this._lastRenderTime,this._renderCount,t=>{this._lastRenderTime=t},t=>{this._renderCount=t},this._renderTimeoutId,t=>{this._renderTimeoutId=t})},this._componentId)})}_applyStyle(t,s){this._runLogicWithinErrorBoundary(t,()=>{wt(this.shadowRoot,this.context,s,this._styleSheet,r=>{this._styleSheet=r})})}_runLogicWithinErrorBoundary(t,s){this._hasError&&(this._hasError=!1);try{s()}catch(r){this._hasError=!0;try{const i=this.tagName?.toLowerCase?.()||"<unknown>",o=this._componentId||"<unknown-id>",a={};if(t&&t.props)for(const u of Object.keys(t.props))try{const d=this.context[u];d instanceof Node?a[u]=`[DOM Node: ${d.nodeName}]`:typeof d=="object"&&d!==null?a[u]=Object.keys(d).length>5?`[object(${Object.keys(d).length} keys)]`:d:a[u]=d}catch{a[u]="[unreadable]"}j.devError(`Error rendering component <${i}> (id=${o}):`,r),j.devError("Component props snapshot:",a),j.devWarn("Common causes: accessing properties of null/undefined inside template interpolations; expensive or throwing expressions inside templates that evaluate eagerly. Fixes: use optional chaining (obj?.prop), guard with ternary, or use the runtime lazy overload: when(cond, () => html`...`).")}catch{}t.onError&&t.onError(r,this.context)}}_initContext(t){try{let s=function(i,o=""){if(Array.isArray(i))return new Proxy(i,{get(a,u,d){const E=Reflect.get(a,u,d);return typeof E=="function"&&typeof u=="string"&&["push","pop","shift","unshift","splice","sort","reverse"].includes(u)?function(...b){const w=E.apply(a,b);if(!r._initializing){const p=o||"root";r._triggerWatchers(p,a),c.scheduleDOMUpdate(()=>r._render(t),r._componentId)}return w}:E},set(a,u,d){if(a[String(u)]=d,!r._initializing){const E=o?`${o}.${String(u)}`:String(u);r._triggerWatchers(E,d),c.scheduleDOMUpdate(()=>r._render(t),r._componentId)}return!0},deleteProperty(a,u){if(delete a[String(u)],!r._initializing){const d=o?`${o}.${String(u)}`:String(u);r._triggerWatchers(d,void 0),c.scheduleDOMUpdate(()=>r._render(t),r._componentId)}return!0}});if(i&&typeof i=="object"){if(c.isReactiveState(i))return i;for(const a in i){const u=o?`${o}.${a}`:a;i[a]=s(i[a],u)}return new Proxy(i,{set(a,u,d){const E=o?`${o}.${String(u)}`:String(u);return a[String(u)]=s(d,E),r._initializing||(r._triggerWatchers(E,a[String(u)]),c.scheduleDOMUpdate(()=>r._render(t),r._componentId)),!0},get(a,u,d){return Reflect.get(a,u,d)}})}return i};const r=this;return s({...t.props?Object.fromEntries(Object.entries(t.props).map(([i,o])=>[i,o.default])):{}})}catch{return{}}}_initWatchers(t){this._runLogicWithinErrorBoundary(t,()=>{tt(this.context,this._watchers,{})})}_triggerWatchers(t,s){nt(this.context,this._watchers,t,s)}_applyProps(t){this._runLogicWithinErrorBoundary(t,()=>{try{st(this,t,this.context)}catch(s){this._hasError=!0,t.onError&&t.onError(s,this.context)}})}}}function xt(e,n){jt();let t=c.toKebab(e);t.includes("-")||(t=`cer-${t}`);const s={},r={props:{},onConnected:i=>{if(s.onConnected)try{s.onConnected(i)}catch{}},onDisconnected:i=>{if(s.onDisconnected)try{s.onDisconnected(i)}catch{}},onAttributeChanged:(i,o,a,u)=>{if(s.onAttributeChanged)try{s.onAttributeChanged(i,o,a,u)}catch{}},onError:(i,o)=>{if(s.onError&&i)try{s.onError(i,o)}catch{}},render:i=>{const o=i,a=o._componentId||`${t}-${Math.random().toString(36).substr(2,9)}`;c.reactiveSystem.setCurrentComponent(a,()=>{i.requestRender&&i.requestRender()});try{Ue(i);let u;try{u=n()}catch(d){try{const E=o._hookCallbacks;if(E&&typeof E.onError=="function")try{E.onError(d)}catch{}}catch{}throw d}if(o._hookCallbacks){const d=o._hookCallbacks;if(d.onConnected&&(s.onConnected=d.onConnected),d.onDisconnected&&(s.onDisconnected=d.onDisconnected),d.onAttributeChanged&&(s.onAttributeChanged=d.onAttributeChanged),d.onError&&(s.onError=d.onError),d.style&&(o._styleCallback=d.style),d.props){const E=d.props;r.props=Object.fromEntries(Object.entries(E).map(([v,b])=>[v,{type:typeof b=="boolean"?Boolean:typeof b=="number"?Number:typeof b=="string"?String:Function,default:b}])),ue.set(t,r)}}return u}finally{Me(),c.reactiveSystem.clearCurrentComponent()}}};if(ue.set(t,r),typeof window<"u"){try{const i={_hookCallbacks:{},requestRender:()=>{},emit:()=>!0};Ue(i);try{n()}catch(o){try{const a=i?._hookCallbacks;if(a&&typeof a.onError=="function")try{a.onError(o)}catch{}j.devError(`Error during component discovery render <${t}>:`,o),j.devWarn("Error occurred during initial component discovery render. Consider guarding expensive expressions or using lazy factories for directives like when().")}catch{}throw Me(),o}if(Me(),i._hookCallbacks?.props){const o=i._hookCallbacks.props;r.props=Object.fromEntries(Object.entries(o).map(([a,u])=>[a,{type:typeof u=="boolean"?Boolean:typeof u=="number"?Number:typeof u=="string"?String:Function,default:u}])),ue.set(t,r)}}catch{}customElements.get(t)||customElements.define(t,Ht(t,r))}}class It{map=new Map;maxSize;constructor(n){this.maxSize=n}get(n){const t=this.map.get(n);if(t!==void 0)return this.map.delete(n),this.map.set(n,t),t}set(n,t){if(this.map.delete(n),this.map.set(n,t),this.map.size>this.maxSize){const s=this.map.keys().next().value;s!==void 0&&this.map.delete(s)}}has(n){return this.map.has(n)}clear(){this.map.clear()}}const Pe=new It(500);function Wt(e,n){if(e==null){j.devWarn(`⚠️ Event handler for '@${n}' is ${e}. This will prevent the event from working. Use a function reference instead: @${n}="\${functionName}"`);return}typeof e!="function"&&j.devWarn(`🚨 Potential infinite loop detected! Event handler for '@${n}' appears to be the result of a function call (${typeof e}) instead of a function reference. Change @${n}="\${functionName()}" to @${n}="\${functionName}" to pass the function reference instead of calling it immediately.`),e===void 0&&typeof e!="function"&&j.devWarn(`💡 Tip: If your event handler function returns undefined, make sure you're passing the function reference, not calling it. Use @${n}="\${fn}" not @${n}="\${fn()}"`)}function ee(e,n={},t,s){const r=s??n.key;return{tag:e,key:r,props:n,children:t}}function Ee(e){return!!e&&typeof e=="object"&&(e.type==="AnchorBlock"||e.tag==="#anchor")}function se(e){return typeof e=="object"&&e!==null&&"tag"in e&&!Ee(e)}function Bt(e,n){return e.key!=null?e:{...e,key:n}}function Dt(e,n=[],t={}){const s={},r={},i={},o=[],a=/([:@#]?)([a-zA-Z0-9-:.]+)(?:\s*=\s*("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)'|([^\s>]+)))?/g;let u;for(;u=a.exec(e);){const d=u[1],E=u[2];let v="";for(let l=3;l<u.length;l++)if(u[l]!==void 0){v=u[l];break}v.length>=2&&(v[0]==='"'&&v[v.length-1]==='"'||v[0]==="'"&&v[v.length-1]==="'")&&(v=v.slice(1,-1));const b=!/=/.test(u[0]),w=v.match(/^{{(\d+)}}$/);let p=b?!0:w?n[Number(w[1])]??null:v;w||(p==="true"?p=!0:p==="false"?p=!1:p==="null"?p=null:isNaN(Number(p))||(p=Number(p)));const C=["model","bind","show","class","style","ref","when"];if(d===":"){const[l,A]=E.split(":"),[S,...y]=l.split(".");if(C.includes(S)){const h=[...y],_=S==="model"&&A?`model:${A}`:S;i[_]={value:p,modifiers:h,arg:A}}else if(E==="disabled"){let h=p;h&&c.isReactiveState(h)&&(h=h.value);const _=typeof h;if(h===""||_==="boolean"||_==="string"&&(h==="true"||h==="false")||h==null||_==="number")s[E]=h;else{let m=p;m&&c.isReactiveState(m)&&(m=m.value),r[E]=m}o.push(E)}else{let h=p;h&&c.isReactiveState(h)&&(h=h.value),r[E]=h,o.push(E)}}else if(d==="@"){const[l,...A]=E.split("."),S=A;Wt(p,l);const y=typeof p=="function"?p:typeof t[p]=="function"?t[p]:void 0;if(y){const h=L=>{if(S.includes("prevent")&&L.preventDefault(),S.includes("stop")&&L.stopPropagation(),!(S.includes("self")&&L.target!==L.currentTarget))return S.includes("once")&&L.currentTarget?.removeEventListener(l,h),y(L)},_="on"+l.charAt(0).toUpperCase()+l.slice(1);s[_]=h}}else E==="ref"?s.ref=p:r[E]=p}return{props:s,attrs:r,directives:i,bound:o}}function xe(e){if(!se(e)||Ee(e))return e;const n=e.props?.directives;if(n&&n.when){const t=n.when.value,s=c.isReactiveState(t)?t.value:t,r={...n};delete r.when;const i={...e.props};Object.keys(r).length>0?i.directives=r:delete i.directives;const o={...e,props:i};return Array.isArray(o.children)&&(o.children=o.children.map(u=>typeof u=="object"&&u!==null?xe(u):u)),{tag:"#anchor",key:e.key!=null?`when-${e.key}`:`when-${e.tag}`,children:s?[o]:[]}}if(Array.isArray(e.children)){const t=e.children.map(s=>typeof s=="object"&&s!==null?xe(s):s);return{...e,children:t}}return e}function zt(e,n,t){const s=Se.length>0?Se[Se.length-1]:void 0,r=t??s,i=!t&&n.length===0,o=i?e.join("<!--TEMPLATE_DELIM-->"):null;if(i&&o){const f=Pe.get(o);if(f)return f}function a(f,g){return ee("#text",{},f,g)}function u(f,g,T=!1){let R=typeof f=="string"?c.decodeEntities(f):f;return!T&&typeof R=="string"&&/[\r\n]/.test(R)&&(R=R.replace(/\s+/g," ")),ee("#text",{},R,g)}let d="";for(let f=0;f<e.length;f++)d+=e[f],f<n.length&&(d+=`{{${f}}}`);const E=/<!--[\s\S]*?-->|<\/?([a-zA-Z0-9-]+)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|[^\s>]+))?)*)\s*\/?>|{{(\d+)}}|([^<]+)/g,v=[];let b,w=[],p=null,C={},l,A=0;const S=[],y=new Set(["pre","code","textarea","script","style"]);function h(){if(p&&y.has(p.toLowerCase()))return!0;for(const f of v)if(y.has(f.tag.toLowerCase()))return!0;return!1}function _(f){if(!f||typeof f!="object"||Ee(f))return;const g=f,T=C;if(g.props||g.attrs){const R=g;R.props&&(T.props||(T.props={}),Object.assign(T.props,R.props)),R.attrs&&(T.attrs||(T.attrs={}),Object.keys(R.attrs).forEach(O=>{if(O==="style"&&T.attrs.style){const P=String(T.attrs.style).replace(/;?\s*$/,""),I=String(R.attrs.style).replace(/^;?\s*/,"");T.attrs.style=P+"; "+I}else if(O==="class"&&T.attrs.class){const P=String(T.attrs.class).trim().split(/\s+/).filter(Boolean),I=String(R.attrs.class).trim().split(/\s+/).filter(Boolean),M=[...new Set([...P,...I])];T.attrs.class=M.join(" ")}else T.attrs[O]=R.attrs[O]}))}else T.props||(T.props={}),Object.assign(T.props,g)}function L(f,g){const T=p?w:S;if(Ee(f)){const R=f.key??g,O=f.children;T.push({...f,key:R,children:O});return}if(se(f)){T.push(Bt(f,void 0));return}if(Array.isArray(f)){if(f.length===0)return;for(let R=0;R<f.length;R++){const O=f[R];Ee(O)||se(O)||Array.isArray(O)?L(O,`${g}-${R}`):O!==null&&typeof O=="object"?c.isUnsafeHTML(O)?T.push(ee("#raw",{},O.__rawHTML,`${g}-${R}`)):_(O):T.push(a(String(O),`${g}-${R}`))}return}if(f!==null&&typeof f=="object"){if(c.isUnsafeHTML(f)){const R=f.__rawHTML??"";T.push(ee("#raw",{},R,g));return}_(f);return}T.push(a(String(f),g))}const N=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);for(;b=E.exec(d);)if(!(b[0].startsWith("<!--")&&b[0].endsWith("-->"))){if(b[1]){const f=b[1],g=b[0][1]==="/",T=b[0][b[0].length-2]==="/"||N.has(f),{props:R,attrs:O,directives:P,bound:I}=Dt(b[2]||"",n,r??{}),M={props:{},attrs:{}};for(const z in R)M.props[z]=R[z];for(const z in O)M.attrs[z]=O[z];M.attrs&&Object.prototype.hasOwnProperty.call(M.attrs,"key")&&!(M.props&&Object.prototype.hasOwnProperty.call(M.props,"key"))&&c.safe(()=>{M.props.key=M.attrs.key});try{const z={input:["value","checked","readonly","required","placeholder","maxlength","minlength"],textarea:["value","readonly","required","placeholder","maxlength","minlength"],select:["value","required","multiple"],option:["selected","value"],video:["muted","autoplay","controls","loop","playsinline"],audio:["muted","autoplay","controls","loop"],img:["src","alt","width","height"],button:["type","name","value","autofocus","form"]},x=f.toLowerCase(),Q=z[x]??[];if(M.attrs){for(const H of Q)if(I&&I.includes(H)&&H in M.attrs&&!(M.props&&H in M.props)){let $=M.attrs[H];if($&&c.isReactiveState($))$=$.value,M.props[H]=$,delete M.attrs[H];else if($&&typeof $=="object"&&"value"in $&&!($ instanceof Node))try{const B=$.value;M.props[H]=(x==="select"||x==="option")&&H==="value"?String(B):B,delete M.attrs[H]}catch{}else{const B=typeof $;if(H==="disabled")($===""||B==="boolean"||B==="string"&&($==="true"||$==="false")||$==null||B==="number")&&(M.props[H]=$,delete M.attrs[H]);else if($===""||B==="string"||B==="number"||B==="boolean"||$==null){const G=(x==="select"||x==="option")&&H==="value"?String($):$;M.props[H]=G,delete M.attrs[H]}}}}if(f.includes("-")||!!r?.__customElements?.has?.(f)){if(M.isCustomElement=!0,I&&M.attrs){const H=new Set(["id","name","data-key","key"]);for(const $ of I)if($ in M.attrs&&!(M.props&&$ in M.props)){const B=$.includes("-")?c.toCamel($):$,G=M.attrs[$];if(M.props[B]=G,H.has($)||c.isClassLikeAttr($))try{const Ae=c.safeSerializeAttr(M.attrs[$]);Ae===null?delete M.attrs[$]:M.attrs[$]=Ae}catch{delete M.attrs[$]}else delete M.attrs[$]}}try{if(M.attrs&&!(M.props&&"modelValue"in M.props)){const H=M.attrs["model-value"]??M.attrs.modelValue;typeof H<"u"&&(M.props.modelValue=H)}}catch{}}}catch{}if(P&&Object.keys(P).some(z=>z==="model"||z.startsWith("model:")))try{const z=Symbol.for("cer.registry"),x=globalThis[z],Q=!!(x&&typeof x.has=="function"&&x.has(f)),F=r,H=!!(F&&(F.__customElements instanceof Set&&F.__customElements.has(f)||Array.isArray(F.__isCustomElements)&&F.__isCustomElements.includes(f)));if(!!(f.includes("-")||H||Q))for(const G of Object.keys(P)){if(G!=="model"&&!G.startsWith("model:"))continue;const _e=P[G],Ae=_e.arg??(G.includes(":")?G.split(":",2)[1]:void 0),K=_e.value,Le=Ae??"modelValue",Ie=c.getNestedValue,Xe=c.setNestedValue,pe=r?._state||r;let Y;typeof K=="string"&&pe?Y=Ie(pe,K):Y=K,M.props[Le]=Y;try{const te=c.toKebab(Le);M.attrs||(M.attrs={}),Y!=null&&(typeof Y=="string"||typeof Y=="number"||typeof Y=="boolean")&&(M.attrs[te]=Y)}catch{}M.isCustomElement=!0;const We=`update:${c.toKebab(Le)}`.replace(/-([a-z])/g,(te,J)=>J.toUpperCase()),Qe="on"+We.charAt(0).toUpperCase()+We.slice(1);M.props[Qe]=function(te){const J=te.detail!==void 0?te.detail:te.target?te.target.value:void 0;if(pe)if(K&&c.isReactiveState(K)){const ne=K.value;if(Array.isArray(J)&&Array.isArray(ne)?JSON.stringify([...J].sort())!==JSON.stringify([...ne].sort()):J!==ne){K.value=J;try{const re=r;if(re){const he=re.requestRender,ye=re._requestRender;typeof he=="function"?he():typeof ye=="function"&&ye()}}catch{}}}else{const ne=Ie(pe||{},typeof K=="string"?K:String(K));if(Array.isArray(J)&&Array.isArray(ne)?JSON.stringify([...J].sort())!==JSON.stringify([...ne].sort()):J!==ne){Xe(pe||{},typeof K=="string"?K:String(K),J);try{const re=r;if(re){const he=re.requestRender,ye=re._requestRender;typeof he=="function"?he():typeof ye=="function"&&ye()}}catch{}}}},delete P[G]}}catch{}if(Object.keys(P).length>0&&(M.directives={...P}),g){const z=w.some(H=>typeof H=="object"&&H.tag!=="#text");let x=w;if(z&&w.length>0){let H=0;for(;H<w.length;){const B=w[H];if(!se(B)||B.tag!=="#text"||typeof B.children!="string"||B.children.trim()!=="")break;H++}let $=w.length-1;for(;$>=0;){const B=w[$];if(!se(B)||B.tag!=="#text"||typeof B.children!="string"||B.children.trim()!=="")break;$--}H===0&&$===w.length-1?x=w:H>$?x=[]:x=w.slice(H,$+1)}const Q=ee(p,C,x.length===1&&se(x[0])&&x[0].tag==="#text"?typeof x[0].children=="string"?x[0].children:"":x.length?x:void 0,l),F=v.pop();F?(p=F.tag,C=F.props,l=F.key,w=F.children,w.push(Q)):(S.push(Q),p=null,C={},l=void 0,w=[])}else T?p?w.push(ee(f,M,void 0,void 0)):S.push(ee(f,M,void 0,void 0)):(p&&v.push({tag:p,props:C,children:w,key:l}),p=f,C=M,w=[])}else if(typeof b[3]<"u"){const f=Number(b[3]),g=n[f],T=`interp-${f}`;L(g,T)}else if(b[4]){const f=b[4],g=p?w:S,T=f.split(/({{\d+}})/);for(const R of T){if(!R)continue;const O=R.match(/^{{(\d+)}}$/);if(O){const P=Number(O[1]),I=n[P],M=`interp-${P}`;L(I,M)}else{const P=`text-${A++}`,I=h();g.push(u(R,P,I))}}}}const k=S.filter(f=>se(f)&&f.tag==="#text"?typeof f.children=="string"&&f.children.trim()!=="":!0).map(f=>xe(f));if(k.length===1){const f=k[0];return i&&o&&Pe.set(o,f),f}else if(k.length>1){const f=k;return i&&o&&Pe.set(o,f),f}return ee("div",{},"","fallback-root")}function Kt(e,...n){const t=n[n.length-1],s=typeof t=="object"&&t&&!Array.isArray(t)?t:void 0;return zt(e,n,s)}exports.computed=c.computed;exports.decodeEntities=c.decodeEntities;exports.ref=c.ref;exports.unsafeHTML=c.unsafeHTML;exports.watch=c.watch;exports.css=D.css;exports.component=xt;exports.html=Kt;exports.useEmit=Lt;exports.useOnAttributeChanged=Ot;exports.useOnConnected=Nt;exports.useOnDisconnected=Rt;exports.useOnError=Mt;exports.useProps=Pt;exports.useStyle=$t;
18
19
  //# sourceMappingURL=custom-elements-runtime.cjs.js.map