@symbo.ls/element 3.14.612 → 3.14.628

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/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @symbo.ls/element
2
2
 
3
+ ## 3.14.628
4
+
5
+ ### Patch Changes
6
+
7
+ - Auto-generated cross-repo patch release.
8
+ - Updated dependencies
9
+ - @symbo.ls/signal@3.14.628
10
+ - @symbo.ls/state@3.14.628
11
+
12
+ ## 3.14.622
13
+
14
+ ### Patch Changes
15
+
16
+ - Auto-generated cross-repo patch release.
17
+
3
18
  ## 3.14.612
4
19
 
5
20
  ### Patch Changes
@@ -1,6 +1,6 @@
1
- "use strict";var ot=Object.defineProperty;var Ot=Object.getOwnPropertyDescriptor;var Tt=Object.getOwnPropertyNames;var $t=Object.prototype.hasOwnProperty;var Rt=(t,s)=>{for(var n in s)ot(t,n,{get:s[n],enumerable:!0})},Nt=(t,s,n,r)=>{if(s&&typeof s=="object"||typeof s=="function")for(let f of Tt(s))!$t.call(t,f)&&f!==n&&ot(t,f,{get:()=>s[f],enumerable:!(r=Ot(s,f))||r.enumerable});return t};var Mt=t=>Nt(ot({},"__esModule",{value:!0}),t);var Xt={};Rt(Xt,{create:()=>K,default:()=>Qt,flushMounts:()=>dt});module.exports=Mt(Xt);var E=require("@symbo.ls/signal"),v=require("@symbo.ls/signal"),U=require("./cache.js"),O=require("./registry.js"),Et=require("./delegate.js"),Pt=require("./extends.js"),Lt=require("./methods.js"),oo=require("./dispose.js"),J=require("@symbo.ls/utils"),F=require("@symbo.ls/utils/function.js"),Y=require("@symbo.ls/state"),C=require("css-in-props"),m=require("@symbo.ls/css"),A=require("@symbo.ls/scratch"),G=require("attrs-in-props");let Dt=1;const Q=[];let st=!1;function Ft(){st||(st=!0,typeof requestAnimationFrame=="function"?requestAnimationFrame(dt):setTimeout(dt,0))}function dt(){if(st=!1,!Q.length)return;const t=Q.splice(0,Q.length);for(let s=0;s<t.length;s++){const n=t[s];!n.node||!n.node.isConnected||N("Mounted",n,n.__ref?.__mountOptions||{})}}function ht(t,s){typeof t.onMounted=="function"&&(t.__ref.__mountOptions=s,Q.push(t),Ft())}function _t(t,s){if(typeof t.onContentUpdate!="function")return;t.context?.plugins?.length&&(0,F.runPluginHook)("contentUpdate",t,s);const n=t.context?.designSystem;n&&(0,A.pushConfig)(n);try{t.onContentUpdate(t,t.state,t.context,s)}catch(r){if(t.context?.plugins?.length&&(0,F.runPluginHook)("error",t,{hook:"onContentUpdate",error:r})||console.error('[DOMQL] Lifecycle "onContentUpdate" error:',r),t.context?.strictMode)throw r}finally{n&&(0,A.popConfig)()}}function W(t){return t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90}function It(t){return t.charAt(2).toLowerCase()+t.slice(3)}function Kt(t){return t.toLowerCase()}function gt(t){const s=t.charCodeAt(0);return s===58||s===64||s===38}function Z(t,s){const n={...t};for(const r in s){const f=n[r],o=s[r];f&&o&&typeof f=="object"&&typeof o=="object"&&!Array.isArray(f)&&!Array.isArray(o)&&typeof f!="function"&&typeof o!="function"?n[r]=Z(f,o):n[r]=o}return n}function K(t,s,n,r={},f){if(t==null||t===!1)return null;(typeof t=="string"||typeof t=="number")&&(t={text:t});const o=Object.create(null);o.key=n||t.key||`_${Dt++}`,o.parent=s||null,o.context=t.context||s?.context||r.context||{},o.context.__create||(o.context.__create=K);const i=o.__ref={__if:!0,__children:[],__exec:{},__effects:[],__eventCleanup:[],root:s?.__ref?.root||o,path:s?.__ref?.path?[...s.__ref.path,o.key]:[o.key]};if(n&&!t.extends&&!t.extend){const d=n.indexOf("_");if(d>0){const h=n.substring(0,d),g=o.context?.components;g&&(g[h]||g["smbls."+h])&&(t={...t,extends:h})}}(0,Pt.applyExtends)(o,t,r);const c=new Set(["childProps","attr","style","scope","data"]),e=o.props&&typeof o.props=="object"?o.props:null;for(const d in t){if(d==="parent"||d==="node"||d==="__ref"||d==="extends"||d==="context"||d==="props")continue;const h=t[d],g=o[d],b=g&&h&&typeof g=="object"&&typeof h=="object"&&!Array.isArray(g)&&!Array.isArray(h)&&typeof g!="function"&&typeof h!="function";b&&d.charCodeAt(0)>=65&&d.charCodeAt(0)<=90?o[d]=Z(g,h):b&&c.has(d)?o[d]={...g,...h}:b&&gt(d)?o[d]=Z(g,h):o[d]=h}function a(d){for(const h in d){const g=d[h],b=o[h],x=b&&g&&typeof b=="object"&&typeof g=="object"&&!Array.isArray(b)&&!Array.isArray(g)&&typeof b!="function"&&typeof g!="function";x&&h.charCodeAt(0)>=65&&h.charCodeAt(0)<=90?o[h]=Z(b,g):x&&c.has(h)?o[h]={...b,...g}:x&&gt(h)?o[h]=Z(b,g):o[h]=g}}e&&a(e),t.props&&typeof t.props=="object"&&a(t.props),t.data!==void 0&&(o.data=t.data),t.classlist!==void 0&&(o.classlist=t.classlist),t.text!==void 0&&(o.text=t.text),t.html!==void 0&&(o.html=t.html);const u=o.scope&&typeof o.scope=="object"?o.scope:null,p=s?.scope,l=o.context&&typeof o.context.globalScope=="object"&&o.context.globalScope||null,y=p||l||null;if(t.scope!==void 0||u){const d={};u&&Object.assign(d,u),t.scope!==void 0&&Object.assign(d,t.scope),o.scope=(0,E.createScopeStore)(d,y)}else y&&(o.scope=y);if(t.if!==void 0&&(o.if=t.if),(0,Lt.addMethods)(o),Ut(o,s,t),o.if!=null){let d;if(typeof o.if=="function")try{d=o.if(o,o.state,o.context)}catch(h){if(d=!1,i.__ifError=h,typeof console<"u"&&console.warn){const g=o.key||o.tag||"?";console.warn(`[smbls] \`if:\` evaluator threw on ${g} \u2014 treating as false:`,h?.message||h)}}else d=o.if;i.__if=!!d}if(i.__if)typeof o.if=="function"&&(i.__ifInitialized=!0);else return s&&(s[o.key]=o),typeof o.if=="function"&&At(o,i,o.if),o;o.tag||(o.tag=(0,U.detectTag)(o)),N("Init",o,r);const _=o.node=(0,U.cacheNode)(o);if(!_)return o;if(o.tag==="fragment"){const h=(o.context?.document||globalThis.document).createComment("");_.appendChild(h),i.__fragmentAnchor=h}N("AttachNode",o,r),_.setAttribute&&o.key&&_.setAttribute("data-key",o.key),_.setAttribute&&o.context?.scopeSelector&&o.context.scopeSelector!==":root"&&o.context.key&&o.key===o.context.key&&_.setAttribute("data-smbls-app",o.context.key),o.id&&_.setAttribute&&(_.id=o.id),jt(o,r),bt(o),ct(o),St(o),Zt(o);try{wt(o,r)}catch(d){if(typeof console<"u"&&console.error){const h=o.__ref?.path?.join(".")||o.key||"<root>";console.error(`[smbls] createChildren failed at ${h}:`,d?.message||d,d?.stack?`
2
- `+d.stack.split(`
1
+ "use strict";var ot=Object.defineProperty;var Tt=Object.getOwnPropertyDescriptor;var Rt=Object.getOwnPropertyNames;var $t=Object.prototype.hasOwnProperty;var Mt=(t,s)=>{for(var n in s)ot(t,n,{get:s[n],enumerable:!0})},Nt=(t,s,n,r)=>{if(s&&typeof s=="object"||typeof s=="function")for(let f of Rt(s))!$t.call(t,f)&&f!==n&&ot(t,f,{get:()=>s[f],enumerable:!(r=Tt(s,f))||r.enumerable});return t};var Dt=t=>Nt(ot({},"__esModule",{value:!0}),t);var Jt={};Mt(Jt,{create:()=>U,default:()=>Xt,flushMounts:()=>ut});module.exports=Dt(Jt);var E=require("@symbo.ls/signal"),k=require("@symbo.ls/signal"),V=require("./cache.js"),T=require("./registry.js"),Et=require("./delegate.js"),Pt=require("./extends.js"),Lt=require("./methods.js"),so=require("./dispose.js"),Ot=require("./devRuntime.js"),J=require("@symbo.ls/utils"),I=require("@symbo.ls/utils/function.js"),Y=require("@symbo.ls/state"),C=require("css-in-props"),m=require("@symbo.ls/css"),A=require("@symbo.ls/scratch"),G=require("attrs-in-props");let Ft=1;const Q=[];let st=!1;function It(){st||(st=!0,typeof requestAnimationFrame=="function"?requestAnimationFrame(ut):setTimeout(ut,0))}function ut(){if(st=!1,!Q.length)return;const t=Q.splice(0,Q.length);for(let s=0;s<t.length;s++){const n=t[s];!n.node||!n.node.isConnected||D("Mounted",n,n.__ref?.__mountOptions||{})}}function ht(t,s){typeof t.onMounted=="function"&&(t.__ref.__mountOptions=s,Q.push(t),It())}function _t(t,s){if(typeof t.onContentUpdate!="function")return;t.context?.plugins?.length&&(0,I.runPluginHook)("contentUpdate",t,s);const n=t.context?.designSystem;n&&(0,A.pushConfig)(n);try{t.onContentUpdate(t,t.state,t.context,s)}catch(r){if(t.context?.plugins?.length&&(0,I.runPluginHook)("error",t,{hook:"onContentUpdate",error:r})||console.error('[DOMQL] Lifecycle "onContentUpdate" error:',r),t.context?.strictMode)throw r}finally{n&&(0,A.popConfig)()}}function W(t){return t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90}function Kt(t){return t.charAt(2).toLowerCase()+t.slice(3)}function Ut(t){return t.toLowerCase()}function gt(t){const s=t.charCodeAt(0);return s===58||s===64||s===38}function Z(t,s){const n={...t};for(const r in s){const f=n[r],o=s[r];f&&o&&typeof f=="object"&&typeof o=="object"&&!Array.isArray(f)&&!Array.isArray(o)&&typeof f!="function"&&typeof o!="function"?n[r]=Z(f,o):n[r]=o}return n}function U(t,s,n,r={},f){if(t==null||t===!1)return null;(typeof t=="string"||typeof t=="number")&&(t={text:t});const o=Object.create(null);o.key=n||t.key||`_${Ft++}`,o.parent=s||null,o.context=t.context||s?.context||r.context||{},o.context.__create||(o.context.__create=U);const i=o.__ref={__if:!0,__children:[],__exec:{},__effects:[],__eventCleanup:[],root:s?.__ref?.root||o,path:s?.__ref?.path?[...s.__ref.path,o.key]:[o.key]};if(n&&!t.extends&&!t.extend){const u=n.indexOf("_");if(u>0){const h=n.substring(0,u),x=o.context?.components;x&&(x[h]||x["smbls."+h])?t={...t,extends:h}:x&&(0,Ot.isLoudDevRuntime)()&&/^[A-Z]\w*_\d+$/.test(n)&&console.warn(`[smbls] auto-extend: key "${n}" looks like a multi-instance (${h}_N) but neither "${h}" nor "smbls.${h}" is registered in context.components \u2014 element will render as a plain <div>. Register the base component or rename the key.`)}}(0,Pt.applyExtends)(o,t,r);const c=new Set(["childProps","attr","style","scope","data"]),e=o.props&&typeof o.props=="object"?o.props:null;for(const u in t){if(u==="parent"||u==="node"||u==="__ref"||u==="extends"||u==="context"||u==="props")continue;const h=t[u],x=o[u],b=x&&h&&typeof x=="object"&&typeof h=="object"&&!Array.isArray(x)&&!Array.isArray(h)&&typeof x!="function"&&typeof h!="function";b&&u.charCodeAt(0)>=65&&u.charCodeAt(0)<=90?o[u]=Z(x,h):b&&c.has(u)?o[u]={...x,...h}:b&&gt(u)?o[u]=Z(x,h):o[u]=h}function a(u){for(const h in u){const x=u[h],b=o[h],g=b&&x&&typeof b=="object"&&typeof x=="object"&&!Array.isArray(b)&&!Array.isArray(x)&&typeof b!="function"&&typeof x!="function";g&&h.charCodeAt(0)>=65&&h.charCodeAt(0)<=90?o[h]=Z(b,x):g&&c.has(h)?o[h]={...b,...x}:g&&gt(h)?o[h]=Z(b,x):o[h]=x}}e&&a(e),t.props&&typeof t.props=="object"&&a(t.props),t.data!==void 0&&(o.data=t.data),t.classlist!==void 0&&(o.classlist=t.classlist),t.text!==void 0&&(o.text=t.text),t.html!==void 0&&(o.html=t.html);const d=o.scope&&typeof o.scope=="object"?o.scope:null,p=s?.scope,l=o.context&&typeof o.context.globalScope=="object"&&o.context.globalScope||null,y=p||l||null;if(t.scope!==void 0||d){const u={};d&&Object.assign(u,d),t.scope!==void 0&&Object.assign(u,t.scope),o.scope=(0,E.createScopeStore)(u,y)}else y&&(o.scope=y);if(t.if!==void 0&&(o.if=t.if),(0,Lt.addMethods)(o),Vt(o,s,t),o.if!=null){let u;if(typeof o.if=="function")try{u=o.if(o,o.state,o.context)}catch(h){if(u=!1,i.__ifError=h,typeof console<"u"&&console.warn){const x=o.key||o.tag||"?";console.warn(`[smbls] \`if:\` evaluator threw on ${x} \u2014 treating as false:`,h?.message||h)}}else u=o.if;i.__if=!!u}if(i.__if)typeof o.if=="function"&&(i.__ifInitialized=!0);else return s&&(s[o.key]=o),typeof o.if=="function"&&At(o,i,o.if),o;o.tag||(o.tag=(0,V.detectTag)(o)),D("Init",o,r);const _=o.node=(0,V.cacheNode)(o);if(!_)return o;if(o.tag==="fragment"){const h=(o.context?.document||globalThis.document).createComment("");_.appendChild(h),i.__fragmentAnchor=h}D("AttachNode",o,r),_.setAttribute&&o.key&&_.setAttribute("data-key",o.key),_.setAttribute&&o.context?.scopeSelector&&o.context.scopeSelector!==":root"&&o.context.key&&o.key===o.context.key&&_.setAttribute("data-smbls-app",o.context.key),o.id&&_.setAttribute&&(_.id=o.id),jt(o,r),bt(o),ct(o),St(o),zt(o);try{wt(o,r)}catch(u){if(typeof console<"u"&&console.error){const h=o.__ref?.path?.join(".")||o.key||"<root>";console.error(`[smbls] createChildren failed at ${h}:`,u?.message||u,u?.stack?`
2
+ `+u.stack.split(`
3
3
  `).slice(0,6).join(`
4
- `):"")}}if(at(o,!0),ut(o,s,f),s&&(s[o.key]=o,s.__ref?.__children&&(s.__ref.__children.includes(o.key)||s.__ref.__children.push(o.key))),typeof o.html=="function"&&o.node&&!o.node.innerHTML){const d=o.context?.designSystem;d&&(0,A.pushConfig)(d);try{const h=o.html(o,o.state,o.context);h!=null&&typeof h!="function"&&(o.node.innerHTML=h)}catch{}finally{d&&(0,A.popConfig)()}}if(N("Create",o,r),N("Complete",o,r),N("Render",o,r),N("RenderRouter",o,r),ht(o,r),typeof o.onFrame=="function"){const d=o.onFrame,h=o.context?.designSystem,g=()=>{if(o.node){if(o.node.isConnected){h&&(0,A.pushConfig)(h);try{d(o,o.state,o.context)}catch(b){console.error("[DOMQL] onFrame error:",b)}finally{h&&(0,A.popConfig)()}}requestAnimationFrame(g)}};requestAnimationFrame(g)}return o}function Ut(t,s,n){const r=!s,f=n.state&&typeof n.state=="object"&&!Array.isArray(n.state)&&Object.keys(n.state).length===0,o=r&&f&&t.context?.state,i=n.state!==void 0&&!o?n.state:t.state&&!(0,E.isStore)(t.state)?t.state:void 0;if(i==null){if(s?.state)t.state=s.state,(0,Y.applyStateMethods)(t,t.state);else if(t.context?.state){const c=t.context.state,e={...c},a=t.context?.polyglot;if(a?.translations){const u=c.lang||a.defaultLang||"en",p=a.translations[u];if(p&&typeof p=="object")for(const y in p)e[y]===void 0&&(e[y]=p[y]);const l=new Set(a.languages||[]);for(const y in a.translations)!l.has(y)&&e[y]===void 0&&(e[y]=a.translations[y])}t.state=(0,E.isStore)(e)?e:(0,E.createStore)(e),t.state.__element=t,t.state.root=t.state,(0,Y.applyStateMethods)(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),(0,Y.applyStateMethods)(t,t.state);return}if(typeof i=="string"){if(t.state=xt(i,s),t.state&&typeof t.state=="object"&&!(0,E.isStore)(t.state)){const c=s?.state?.root||s?.state||t.state;Object.defineProperty(t.state,"root",{value:c,enumerable:!1,configurable:!0,writable:!0})}(0,Y.applyStateMethods)(t,t.state);return}if(typeof i=="function"){const c=i(t,s?.state);t.state=(0,E.isStore)(c)?c:(0,E.createStore)(c||{})}else(0,E.isStore)(i)?t.state=i:t.state=(0,E.createStore)({...i});t.state.__element=t,s?.state?(t.state.parent=s.state,t.state.root=s.state.root||s.state):t.state.root=t.state,(0,Y.applyStateMethods)(t,t.state)}function nt(t,s){if(!s)return t;const n=s.split("/");let r=t;for(const f of n){if(r==null)return{};r=r[f]}return r??{}}function xt(t,s){if(!s)return{};if(t===".")return s.state||{};if(t.startsWith("../")){const f=t.slice(3);return f?nt(s.state,f):s.state??{}}if(t.startsWith("~/")){const f=s.state?.root||s.state,o=t.slice(2);return o?nt(f,o):f??{}}if(s.state?.[t]!==void 0)return s.state[t];const n=nt(s.state,t);if(n!=null&&Object.keys(n).length>0)return n;const r=s.context?.polyglot;if(r?.translations){const f=s.state?.root?.lang||r.defaultLang||"en",o=r.translations[f];if(o?.[t]!==void 0)return o[t];if(r.translations[t]!==void 0)return r.translations[t]}return{}}function Vt(t){const s=t.__ref,n=t.tag||"div",r=t.context?.designSystem,f=[],o=Object.keys(t);for(let i=0;i<o.length;i++){const c=o[i];if(typeof t[c]!="function"||O.REGISTRY.has(c))continue;const e=c.charCodeAt(0);e>=65&&e<=90||W(c)||C.CSS_PROPS_REGISTRY[c]||C.DEFAULT_CSS_PROPERTIES_LIST&&C.DEFAULT_CSS_PROPERTIES_LIST.has(c)||(0,G.checkAttributeByTagName)(n,c)||f.push({prop:c,fn:t[c]})}for(let i=0;i<f.length;i++){const{prop:c,fn:e}=f[i];s.__exec[c]=e,Object.defineProperty(t,c,{get(){r&&(0,A.pushConfig)(r);try{return e(t,t.state,t.context)}catch{return}finally{r&&(0,A.popConfig)()}},set(a){delete s.__exec[c],Object.defineProperty(t,c,{value:a,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function bt(t,s){const n=t.__ref,r=!!(s&&s.skipIfEffect);if(Vt(t),typeof t.text=="function"){const o=t.text,i=(0,v.createEffect)(()=>{if(!n.contentManaged)try{let c=o(t,t.state,t.context);t.node&&c!=null&&typeof c!="function"&&typeof c!="object"&&(typeof c=="string"&&c.includes("{{")&&(c=J.replaceLiteralsWithObjectFields.call(t,c,t.state)),t.tag==="string"?t.node.nodeValue=c:t.node.textContent=c)}catch{}},{depth:n.path.length});n.__effects.push(i),n.__exec.text=o}else if(typeof t.text=="string"&&t.text.includes("{{")){const o=t.text,i=(0,v.createEffect)(()=>{if(n.contentManaged)return;const c=J.replaceLiteralsWithObjectFields.call(t,o,t.state);c!=null&&(t.text=c),t.node&&(t.tag==="string"?t.node.nodeValue=c??"":t.node.textContent=c??"")},{depth:n.path.length});n.__effects.push(i),n.__exec.text=o}for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)&&typeof t[o]=="function"&&!O.REGISTRY.has(o)&&!W(o)&&!n.__exec[o]){if(C.CSS_PROPS_REGISTRY[o]){const i=t[o],c=o;let e;const a=(0,v.createEffect)(()=>{const u=t.context?.designSystem;u&&(0,A.pushConfig)(u);try{const p=i(t,t.state,t.context),l=C.CSS_PROPS_REGISTRY[c](p,t,t.state,t.context);if(l&&t.node){const y=Ct(l);(y===null||y!==e)&&(e=y,B(t.node,l))}else t.node&&(c==="show"||c==="hide")&&(e=void 0,t.node.style.display="")}finally{u&&(0,A.popConfig)()}},{depth:n.path.length});n.__effects.push(a),n.__exec[o]=i}else if(C.DEFAULT_CSS_PROPERTIES_LIST&&C.DEFAULT_CSS_PROPERTIES_LIST.has(o)){const i=t[o],c=o;let e;const a=(0,v.createEffect)(()=>{const u=t.context?.designSystem;u&&(0,A.pushConfig)(u);try{const p=i(t,t.state,t.context);if(t.node)if(p!=null){const l=c+":"+String(p);l!==e&&(e=l,B(t.node,{[c]:p}))}else e=void 0,t.node.style[c]=""}finally{u&&(0,A.popConfig)()}},{depth:n.path.length});n.__effects.push(a),n.__exec[o]=i}}if(typeof t.html=="function"){const o=t.html,i=(0,v.createEffect)(()=>{const c=t.context?.designSystem;c&&(0,A.pushConfig)(c);try{const e=o(t,t.state,t.context);t.node&&e!=null&&typeof e!="function"&&(t.node.innerHTML=e)}finally{c&&(0,A.popConfig)()}},{depth:n.path.length});n.__effects.push(i),n.__exec.html=o}if(typeof t.value=="function"){const o=t.value,i=(0,v.createEffect)(()=>{try{const c=o(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const e=c==null?"":String(c);if(t.node.value===e)return;const a=typeof document<"u"&&document.activeElement===t.node,u=a&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,p=a&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=e,a&&u!=null&&p!=null)try{t.node.setSelectionRange(u,p)}catch{}}catch{}},{depth:n.path.length});n.__effects.push(i),n.__exec.value=o}if(typeof t.style=="function"){const o=t.style;let i;const c=(0,v.createEffect)(()=>{const e=o(t,t.state,t.context),a=Ct(e);(a===null||a!==i)&&(i=a,B(t.node,e))},{depth:n.path.length});n.__effects.push(c),n.__exec.style=o}else if(t.style&&typeof t.style=="object")for(const o in t.style){const i=t.style[o];if(typeof i!="function")continue;let c;const e=(0,v.createEffect)(()=>{try{const a=i(t,t.state,t.context);if(t.node){const u=o+":"+String(a);u!==c&&(c=u,B(t.node,{[o]:a}))}}catch{}},{depth:n.path.length});n.__effects.push(e)}if(t.attr&&typeof t.attr=="object"){for(const o in t.attr)if(typeof t.attr[o]=="function"){const i=t.attr[o],c=o,e=(0,v.createEffect)(()=>{try{const a=i(t,t.state,t.context);t.node?.setAttribute&&(a==null||a===!1?t.node.removeAttribute(c):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(c,a===!0?"":a))}catch{}},{depth:n.path.length});n.__effects.push(e)}}if(t.aria&&typeof t.aria=="object")for(const o in t.aria){const i=t.aria[o];if(typeof i!="function")continue;const c="aria-"+o.replace(/[A-Z]/g,a=>"-"+a.toLowerCase()),e=(0,v.createEffect)(()=>{try{const a=i(t,t.state,t.context);if(!t.node?.setAttribute)return;a==null||a===!1?t.node.removeAttribute(c):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(c,a===!0?"":a)}catch{}},{depth:n.path.length});n.__effects.push(e)}if(t.data&&typeof t.data=="object")for(const o in t.data){const i=t.data[o];if(typeof i!="function")continue;const e="data-"+o.replace(/[A-Z]/g,u=>"-"+u.toLowerCase()),a=(0,v.createEffect)(()=>{try{const u=i(t,t.state,t.context);if(!t.node?.setAttribute)return;u==null||u===!1?t.node.removeAttribute(e):typeof u!="function"&&typeof u!="object"&&t.node.setAttribute(e,u===!0?"":u)}catch{}},{depth:n.path.length});n.__effects.push(a)}const f=t.classlist&&typeof t.classlist=="object"&&!Array.isArray(t.classlist)?t.classlist:t.class&&typeof t.class=="object"&&!Array.isArray(t.class)?t.class:null;if(f)for(const o in f){const i=f[o];if(typeof i!="function")continue;const c=(0,v.createEffect)(()=>{try{const e=i(t,t.state,t.context);if(!t.node?.classList)return;typeof e=="string"?t.node.classList.add(e):e?t.node.classList.add(o):t.node.classList.remove(o)}catch{}},{depth:n.path.length});n.__effects.push(c)}!r&&typeof t.if=="function"&&At(t,n,t.if);for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||O.REGISTRY.has(o)||typeof t[o]!="function")continue;const i=o.charCodeAt(0);if(i>=65&&i<=90||W(o))continue;const c=t[o];n.__exec[o]=c;const e=t.tag||"div";if((0,G.checkAttributeByTagName)(e,o)&&!C.CSS_PROPS_REGISTRY[o]&&!(C.DEFAULT_CSS_PROPERTIES_LIST&&C.DEFAULT_CSS_PROPERTIES_LIST.has(o))){const a=o,u=(0,v.createEffect)(()=>{try{const p=c(t,t.state,t.context);t.node?.setAttribute&&(p==null||p===!1?t.node.removeAttribute(a):typeof p!="function"&&typeof p!="object"&&(a==="src"&&"src"in t.node?t.node.src=p:t.node.setAttribute(a,p===!0?"":p)))}catch{}},{depth:n.path.length});n.__effects.push(u)}}if(Ht(t),Yt(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const o=t.onStateUpdate,i=t.stateDeps;let c=!1,e=[];const a=(0,v.createEffect)(()=>{const u=[];for(let _=0;_<i.length;_++){const d=i[_];try{u[_]=typeof d=="function"?d(t,t.state,t.context):t.state?.[d]}catch{u[_]=void 0}}if(!c){c=!0,e=u;return}let p=u.length!==e.length;for(let _=0;!p&&_<u.length;_++)u[_]!==e[_]&&(p=!0);const l=e;if(e=u,!p)return;const y=t.context?.designSystem;y&&(0,A.pushConfig)(y);try{o(t,t.state,t.context,{prev:l,next:u})}catch(_){if(t.context?.plugins?.length&&(0,F.runPluginHook)("error",t,{hook:"onStateUpdate",error:_})||console.error('[DOMQL] Lifecycle "onStateUpdate" error:',_),t.context?.strictMode)throw _}finally{y&&(0,A.popConfig)()}},{depth:n.path.length});n.__effects.push(a)}}function At(t,s,n){const r=(0,v.createEffect)(()=>{let f;try{f=n(t,t.state,t.context)}catch(i){if(f=!1,s.__ifError=i,typeof console<"u"&&console.warn){const c=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${c} \u2014 treating as false:`,i?.message||i)}return}const o=s.__if;if(s.__if=!!f,o&&!s.__if&&t.node)t.node.remove();else if(!o&&s.__if)if(s.__ifInitialized){t.node||(t.node=(0,U.cacheNode)(t)),t.node&&(t.node.ref=t);const i=t.parent,c=i?.node;if(c&&t.node){let e=null;const a=Object.keys(i),u=a.indexOf(t.key);for(let p=u+1;p<a.length;p++){const l=i[a[p]];if(l?.node?.parentNode===c){e=l.node;break}}e?c.insertBefore(t.node,e):c.appendChild(t.node)}else ut(t,t.parent);ct(t)}else{if(s.__ifInitialized=!0,t.tag||(t.tag=(0,U.detectTag)(t)),N("Init",t,{}),t.node||(t.node=(0,U.cacheNode)(t)),!t.node)return;if(t.tag==="fragment"&&!s.__fragmentAnchor){const c=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(c),s.__fragmentAnchor=c}N("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),jt(t,{}),bt(t,{skipIfEffect:!0}),ct(t),St(t),wt(t,{}),ut(t,t.parent),ht(t,{})}},{depth:s.path.length});s.__effects.push(r)}function ct(t){const{node:s}=t;if(s){if(typeof t.text=="string"&&!t.text.includes("{{")?t.tag==="string"?s.nodeValue=t.text:s.textContent=t.text:typeof t.text=="number"&&(s.textContent=t.text),qt(t),typeof t.html=="string"&&(s.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&"value"in s){const n=String(t.value);s.value!==n&&(s.value=n)}if(t.style&&typeof t.style=="object"&&B(s,t.style),t.attr&&typeof t.attr=="object")for(const n in t.attr){const r=t.attr[n];typeof r=="function"||typeof r=="object"||r==null||r===!1||s.setAttribute&&s.setAttribute(n,r===!0?"":r)}if(t.data&&typeof t.data=="object")for(const n in t.data){const r=t.data[n];typeof r=="function"||typeof r=="object"||r==null||r===!1||s.dataset&&(s.dataset[n]=r===!0?"":r)}if(t.classlist||t.class){const n=t.classlist||t.class;if(typeof n=="string")n.split(" ").forEach(r=>r&&s.classList.add(r));else if(typeof n=="object")for(const r in n){const f=typeof n[r]=="function"?n[r](t,t.state,t.context):n[r];f&&s.classList.add(typeof f=="string"?f:r)}}}}function Ct(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function B(t,s){if(!t||!s||!t.style)return;let n=null;for(const r in s){const f=s[r];if(f!=null){if(r.charAt(0)==="&"&&typeof f=="object"){n||(n={}),n[r]=f;continue}try{const o=String(f),i=r.replace(/[A-Z]/g,u=>"-"+u.toLowerCase()),c=o.trim(),e=/\s*!important\s*$/.test(c),a=c.replace(/\s*!important\s*$/,"");t.style.setProperty(i,a,e?"important":"")}catch{}}}n&&Bt(t,n)}let Wt=0;function Bt(t,s){const n=`_ds${Wt++}`;t.classList.add(n);const r=t.ownerDocument;let f=r.querySelector("style[data-smbls-scoped]");f||(f=r.createElement("style"),f.setAttribute("data-smbls-scoped",""),r.head.appendChild(f));let o="";for(const i in s){const c="."+n,e=i.replace(/&/g,c).split(",").map(u=>{const p=u.trim();return p.includes(c)?p:c+p}).join(", "),a=s[i];if(typeof a=="object"){let u="",p="";for(const l in a){const y=a[l];if(typeof y=="object"){const _=l.includes("&")?e.split(", ").map(h=>l.replace(/&/g,h)).join(", "):e.split(", ").map(h=>`${h} ${l}`).join(", ");let d="";for(const h in y)d+=`${h.replace(/[A-Z]/g,g=>"-"+g.toLowerCase())}: ${y[h]};`;p+=`${_} { ${d} }
5
- `}else u+=`${l.replace(/[A-Z]/g,_=>"-"+_.toLowerCase())}: ${y};`}u&&(o+=`${e} { ${u} }
6
- `),p&&(o+=p)}}o&&(f.textContent+=o)}function Ht(t){const s=t.subscribeTo;if(!Array.isArray(s)||s.length===0)return;const n=t.__ref;for(let r=0;r<s.length;r++){const f=s[r];if(typeof f!="string"||f.length===0)continue;const o=f.split("."),i=o[0],c=o.slice(1),e={value:!1},a=(0,v.createEffect)(()=>{const u=t.state&&((0,E.isStore)(t.state)?t.state.root:null);if(!u||!(0,E.isStore)(u))return;let p=u;p=p[i];for(let y=0;y<c.length&&!(p==null||typeof p!="object");y++)if((0,E.isStore)(p))p=p[c[y]];else break;if(!e.value)return;let l=!1;if(typeof t.onBeforeUpdate=="function"){const y=t.context?.designSystem;y&&(0,A.pushConfig)(y);try{t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0})===!1&&(l=!0)}catch(_){t.context?.plugins?.length&&(0,F.runPluginHook)("error",t,{hook:"onBeforeUpdate",error:_})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",_)}finally{y&&(0,A.popConfig)()}}if(!l&&t.node&&n.__effects)for(let y=0;y<n.__effects.length;y++){const _=n.__effects[y];_&&_!==a&&!_._disposed&&!_._isSubscribeToEffect&&typeof _._execute=="function"&&_._execute()}if(!l&&typeof t.onUpdate=="function"){const y=t.context?.designSystem;y&&(0,A.pushConfig)(y);try{t.onUpdate(t,t.state,t.context)}catch(_){t.context?.plugins?.length&&(0,F.runPluginHook)("error",t,{hook:"onUpdate",error:_})||console.error("[DOMQL] subscribeTo onUpdate error:",_)}finally{y&&(0,A.popConfig)()}}},{depth:n.path.length});e.value=!0,a._isSubscribeToEffect=!0,n.__effects.push(a)}}function it(t,s){return t.charCodeAt(0)===64&&t.length>1&&!t.startsWith("@media")&&!t.startsWith("@keyframes")&&!t.startsWith("@supports")&&(t==="@dark"||t==="@light"||!s.context?.designSystem?.media?.[t.slice(1)])}function H(t,s,n){const r={},f=(o,i)=>{if(C.CSS_PROPS_REGISTRY[o]){const c=C.CSS_PROPS_REGISTRY[o](i,s,s.state,s.context);if(c){const e=Array.isArray(c)?c:[c];for(const a of e)a&&Object.assign(r,a)}}else r[o]=i};for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;let i=t[o];if(typeof i=="function"&&(i=i(s,s.state,s.context)),!(i==null||typeof i=="function")){if(typeof i=="object"&&!Array.isArray(i)){if(o==="style"){for(const a in i){let u=i[a];typeof u=="function"&&(u=u(s,s.state,s.context)),!(u==null||typeof u=="function")&&f(a,u)}continue}if(it(o,s)){const a=H(i,s,!0);Object.keys(a).length&&(r[`[data-theme="${o.slice(1)}"] &`]=a);continue}let c=o;if(o.charCodeAt(0)===64&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const a=s.context?.designSystem?.media?.[o.slice(1)];a&&(c=`@media ${a}`)}const e=H(i,s,!1);Object.keys(e).length&&(r[c]=e);continue}f(o,i)}}if(n)for(const o in r){const i=r[o];typeof i=="string"&&!i.includes("!important")&&(r[o]=i+" !important")}return r}function Yt(t){const s=t.__ref;s.__conditionalRunners=[];const n=new Map;for(const r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;const f=r.charAt(0);if(f!=="."&&f!=="!")continue;const o=r.slice(1);if(!o)continue;const i=t[r];if(!i||typeof i!="object")continue;const c=f==="!",e={lastMatch:!1,appliedKeys:null,appliedClasses:null},a=()=>{if(!t.node)return;let p;const l=t[o];if(l===void 0)if(t.state&&o in t.state)p=t.state[o];else{const d=t.context?.cases?.[o];if(d===void 0)return;try{p=typeof d=="function"?d.call(t,t):d}catch(h){p=!1,s.__conditionalError=h,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${r}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,h?.message||h)}}else if(typeof l=="function")try{p=l(t,t.state,t.context)}catch(d){p=!1,s.__conditionalError=d,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${r}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,d?.message||d)}else p=l;const y=c?!p:!!p;if(y===e.lastMatch)return;e.lastMatch=y;const _=t.context?.designSystem;_&&(0,A.pushConfig)(_);try{if(y){const d={},h={};let g=!1;for(const x in i){if(!Object.prototype.hasOwnProperty.call(i,x))continue;const k=i[x],P=x.charAt(0);if((P===":"||P==="@"||P==="&")&&k&&typeof k=="object"&&!Array.isArray(k)){if(it(x,t)){const j=H(k,t,!0);Object.keys(j).length&&(h[`[data-theme="${x.slice(1)}"] &`]=j,g=!0)}else{let j=x;if(P==="@"&&!x.startsWith("@media")&&!x.startsWith("@keyframes")){const I=t.context?.designSystem?.media?.[x.slice(1)];I&&(j=`@media ${I}`)}const D=H(k,t,!1);Object.keys(D).length&&(h[j]=D,g=!0)}continue}const M=typeof k=="function"?k(t,t.state,t.context):k;if(M!=null)if(C.CSS_PROPS_REGISTRY[x]){const j=C.CSS_PROPS_REGISTRY[x](M,t,t.state,t.context);if(j){const D=Array.isArray(j)?j:[j];for(const I of D)I&&Object.assign(d,I)}}else C.DEFAULT_CSS_PROPERTIES_LIST&&C.DEFAULT_CSS_PROPERTIES_LIST.has(x)&&(d[x]=M)}const b=Object.keys(d);if(b.length){B(t.node,d);for(const x of b)n.set(x,r);e.appliedKeys=b}else e.appliedKeys=null;if(g){const x=(0,m.css)(h,null,t.context?.cssPrefix),k=x?x.split(" ").filter(Boolean):[];if(k.length&&t.node.classList){for(const P of k)t.node.classList.add(P);e.appliedClasses=k}else e.appliedClasses=null}else if(e.appliedClasses){for(const x of e.appliedClasses)t.node.classList.remove(x);e.appliedClasses=null}}else{if(e.appliedKeys){for(const d of e.appliedKeys)n.get(d)===r&&(t.node.style[d]="",n.delete(d));e.appliedKeys=null}if(e.appliedClasses){for(const d of e.appliedClasses)t.node.classList.remove(d);e.appliedClasses=null}}}finally{_&&(0,A.popConfig)()}};s.__conditionalRunners.push(a);const u=(0,v.createEffect)(a,{depth:s.path.length});s.__effects.push(u)}}const rt=new WeakSet;function Gt(t){const s=t.ownerDocument;!s||rt.has(s)||(rt.add(s),queueMicrotask(()=>{rt.delete(s);const n=s.body||s.documentElement;n&&n.offsetWidth}))}const et=new WeakSet;let vt=!1;function qt(t){const{node:s}=t;if(!s)return;if(vt||(vt=!0,(0,m.css)({display:"none"})),et.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}et.add(t);const n=t.context?.designSystem;n&&(0,A.pushConfig)(n);try{const r={};let f=!1;for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||typeof t[o]=="function"||O.REGISTRY.has(o))continue;const i=o.charCodeAt(0);if(!(i>=65&&i<=90)&&!W(o)){if(C.CSS_PROPS_REGISTRY[o]){const c=t[o],e=C.CSS_PROPS_REGISTRY[o](c,t,t.state,t.context);if(e){if(Array.isArray(e))for(const a of e)a&&Object.assign(r,a);else Object.assign(r,e);f=!0}}else if(C.DEFAULT_CSS_PROPERTIES_LIST&&C.DEFAULT_CSS_PROPERTIES_LIST.has(o)){const c=t[o];c!=null&&typeof c!="object"&&(r[o]=c,f=!0)}else if(o.charCodeAt(0)===45){const c=t[o];c!=null&&typeof c!="object"&&(r[o]=c,f=!0)}else if(o.charAt(0)==="&"){const c=t[o];c&&typeof c=="object"&&(r[o]=c,f=!0)}else if(o.charAt(0)==="@"||o.charAt(0)===":"){const c=t[o];if(c&&typeof c=="object"){if(it(o,t)){const e=H(c,t,!0);Object.keys(e).length&&(r[`[data-theme="${o.slice(1)}"] &`]=e,f=!0)}else{let e=o;if(o.charAt(0)==="@"&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const u=t.context?.designSystem?.media?.[o.slice(1)];u&&(e=`@media ${u}`)}const a=H(c,t,!1);Object.keys(a).length&&(r[e]=a,f=!0)}f=!0}}}}if(f){r.display&&String(r.display).includes("!important")&&(s.style.setProperty("display",String(r.display).replace(/\s*!important\s*$/,""),"important"),delete r.display);const o=(0,m.css)(r,null,t.context?.cssPrefix);if(o&&s.classList){const c=o.split(" ").filter(Boolean);let e=!1;for(const a of c)s.classList.add(a),e||(a.charCodeAt(0)===95&&a.charCodeAt(1)===99||a.charCodeAt(0)===95&&a.indexOf("_c",1)!==-1)&&(e=!0);e&&Gt(s)}const i=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(i!=null){const c=r.display;if(c&&c!==i)if(i==="none"){const e=[];for(const a of s.classList)a.startsWith("_d-")&&a!=="_d-none"&&e.push(a);for(const a of e)s.classList.remove(a);s.classList.add("_d-none")}else s.style.display=t.display}}}finally{n&&(0,A.popConfig)(),et.delete(t)}}function St(t){const{node:s}=t;if(!s||!s.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const f in t.aria){const o=t.aria[f];if(typeof o=="function"||typeof o=="object"||o==null||o===!1)continue;const i="aria-"+f.replace(/[A-Z]/g,c=>"-"+c.toLowerCase());s.setAttribute(i,o===!0?"":o)}const n=(0,G.applyAttrTransforms)(t);for(const f in n){const o=n[f];o!=null&&o!==!1&&typeof o!="function"&&typeof o!="object"&&s.setAttribute(f,o===!0?"":o)}const r=t.tag||"div";for(const f in t){if(!Object.prototype.hasOwnProperty.call(t,f)||typeof t[f]=="function"||O.REGISTRY.has(f)||f==="on"||n[f]!==void 0)continue;const o=f.charCodeAt(0);if(!(o>=65&&o<=90)&&!W(f)&&!(C.CSS_PROPS_REGISTRY[f]||C.DEFAULT_CSS_PROPERTIES_LIST&&C.DEFAULT_CSS_PROPERTIES_LIST.has(f))&&(0,G.checkAttributeByTagName)(r,f)){let i=t[f];if(i==null||i===!1||(typeof i=="string"&&i.includes("{{")&&(i=(0,J.replaceLiteralsWithObjectFields)(i,t,t.state,t.context),t[f]=i),i==null||i===!1||typeof i=="function"||typeof i=="object"))continue;s.setAttribute(f,i===!0?"":i)}}}function Zt(t){if(!t.autoGrow)return;const s=t.node;if(!s||s.tagName!=="TEXTAREA")return;const n=t.autoGrow,r=n&&typeof n=="object"&&n.max?String(n.max):null;r&&(s.style.maxHeight=r);const f=()=>{s.style.height="auto",s.style.height=s.scrollHeight+"px"};f(),s.addEventListener("input",f),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("input",f)}catch{}})}const kt=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function jt(t,s){for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n)||!W(n)||kt.has(n))continue;let r=t[n];if(typeof r=="string"&&/^[A-Za-z_$][\w$]*$/.test(r)){const o=r;r=function(c){return t.call(o,c)}}if(typeof r!="function")continue;const f=It(n);O.LIFECYCLE_EVENTS.has(f)||(0,Et.registerEvent)(Kt(f),t,r)}zt(t)}function zt(t){const s=t.node;if(!s||!s.addEventListener)return;const n={};let r=!1;for(const l of kt){const y=t[l];typeof y=="function"&&(n[l]=y,r=!0)}if(!r)return;const f=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,o=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let i=0,c=0,e=0,a=!1;const u=l=>{const y=l.touches&&l.touches[0]||l.changedTouches&&l.changedTouches[0];y&&(i=y.clientX,c=y.clientY,e=Date.now(),a=!0)},p=l=>{if(!a)return;a=!1;const y=l.changedTouches&&l.changedTouches[0]||l.touches&&l.touches[0];if(!y)return;const _=y.clientX-i,d=y.clientY-c,h=Date.now()-e;if(h>o)return;const g=Math.abs(_),b=Math.abs(d);if(Math.max(g,b)<f)return;let x;if(g>b*1.2)x=_<0?"left":"right";else if(b>g*1.2)x=d<0?"up":"down";else return;const k="onSwipe"+x.charAt(0).toUpperCase()+x.slice(1),P=n[k],M=n.onSwipe;P&&P.call(t,l,t,t.state,t.context),M&&M.call(t,{direction:x,dx:_,dy:d,dt:h,event:l},t,t.state,t.context)};s.addEventListener("touchstart",u,{passive:!0}),s.addEventListener("touchend",p,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("touchstart",u)}catch{}try{s.removeEventListener("touchend",p)}catch{}})}function X(t,s){const n={...t};for(const r in s){const f=n[r],o=s[r];f&&o&&typeof f=="object"&&typeof o=="object"&&!Array.isArray(f)&&!Array.isArray(o)&&typeof f!="function"&&typeof o!="function"?n[r]=X(f,o):n[r]=o}return n}function ft(t,s,n){if(!s||!t.node)return;const r=t.childExtends;if(Array.isArray(s)){const f=t.tag==="fragment",o=t.context?.document||globalThis.document,i=f?null:o?.createDocumentFragment();if(!f&&!i)return;const c=t.childProps,e=t.childrenAs;for(let a=0;a<s.length;a++){let u=s[a];const p=u;(typeof u=="string"||typeof u=="number")&&(u={text:u});let l=c;if(typeof c=="function")try{l=c(t,u)}catch{l=null}if(e==="state"){let d=p;(typeof p=="string"||typeof p=="number")&&(d={value:p,text:p}),u=l?{...l,state:d}:{state:d}}else l&&(u=X(l,u));if(r&&!u.ignoreChildExtends)if(u.extends){const d=Array.isArray(u.extends)?u.extends:[u.extends],h=Array.isArray(r)?r:[r];u={...u,extends:[...h,...d]}}else u={...u,extends:r};const y=u?.key||p&&typeof p=="object"&&p.key||`${a}`,_=K(u,t,y,n);!f&&_?.node&&i.appendChild(_.node)}f||t.node.appendChild(i);return}if(typeof s=="string"){const f=xt(s,t);if(Array.isArray(f)){ft(t,f,n);return}}if(typeof s=="object")for(const f in s){if(O.REGISTRY.has(f))continue;let o=s[f];if(!(o==null||o===!1)){if((typeof o=="string"||typeof o=="number")&&(o={text:o}),t.childProps&&(o=X(t.childProps,o)),r&&!o.ignoreChildExtends)if(o.extends){const i=Array.isArray(o.extends)?o.extends:[o.extends],c=Array.isArray(r)?r:[r];o={...o,extends:[...c,...i]}}else o={...o,extends:r};K(o,t,f,n)}}}function at(t,s){const n=t.node;if(!n||n.tagName!=="SELECT")return;const r=n.options;if(!r||!r.length)return;const f=t.__ref,o=f&&f.__exec&&f.__exec.value,i=typeof o=="function",c=t.value!=null&&typeof t.value!="function";if(i||c){let u;if(i)try{u=o(t,t.state,t.context)}catch{return}else u=t.value;const p=u==null?"":String(u);n.value!==p&&(n.value=p);return}const e=s||!(f&&f.__selectSynced);if(f&&(f.__selectSynced=!0),!e)return;let a=-1;for(let u=0;u<r.length;u++)r[u].defaultSelected&&(a=u);a>=0&&n.selectedIndex!==a&&(n.selectedIndex=a)}function wt(t,s){let{children:n,content:r}=t;const f=t.childExtends;if(typeof n=="function"){const i=n;n=i(t,t.state,t.context),t.children=n;const c=t.__ref;let e=!1;const a=(0,v.createEffect)(()=>{const u=i(t,t.state,t.context);if(!e){e=!0;return}if(u===t.children)return;t.children=u;const p=typeof t.onContentUpdate=="function",l=p?[]:null,y=p?[]:null,_=p?[]:null;if(Array.isArray(u)&&t.childrenAs==="state"){const b=t.childProps,x=[],k=new Map;for(let w=0;w<u.length;w++){const T=u[w];let S=b;if(typeof b=="function")try{S=b(t,T)}catch{S=null}const V=S&&S.key||T&&T.key||`${w}`;x.push(V),k.set(V,{rawChild:T,childProps:S})}const P=new Set(x),M=c.__children.slice();for(const w of M)if(!P.has(w)){const T=t[w];T?.remove&&T.remove(),delete t[w],y&&y.push(w)}const j=t.childExtends,D=t.tag==="fragment",I=t.context?.document||globalThis.document,q=D?null:I?.createDocumentFragment();for(const w of x){const T=k.get(w),S=T.rawChild,V=t[w];if(V&&V.state){if(S&&typeof S=="object"){const L=V.state,z=L.$replace||L.replace,yt=L.$update||L.update;if(typeof z=="function")z.call(L,S);else if(typeof yt=="function"){for(const R in L)if(!(R==="__element"||R==="root"||R==="parent"||R==="update")&&!Object.prototype.hasOwnProperty.call(S,R))try{L[R]=void 0}catch{}yt.call(L,S)}else for(const R in S)L[R]=S[R]}_&&_.push(w);continue}let tt=S;(typeof S=="string"||typeof S=="number")&&(tt={value:S,text:S});const pt=T.childProps;let $=pt?{...pt,state:tt}:{state:tt};if(j&&!$.ignoreChildExtends)if($.extends){const L=Array.isArray($.extends)?$.extends:[$.extends],z=Array.isArray(j)?j:[j];$={...$,extends:[...z,...L]}}else $={...$,extends:j};const lt=K($,t,w,s);!D&&lt?.node&&q&&q.appendChild(lt.node),l&&l.push(w)}!D&&q&&q.childNodes.length&&t.node&&t.node.appendChild(q),c.__children=x,p&&(l.length||y.length)&&_t(t,{added:l,removed:y,kept:_}),at(t,!1);return}const g=p?[...c.__children]:null;for(const b of[...c.__children]){const x=t[b];x?.remove&&x.remove(),delete t[b]}c.__children=[],ft(t,u,s),at(t,!1),p&&_t(t,{added:[...c.__children],removed:g,kept:[]})},{depth:c.path.length});c.__effects.push(a)}if(ft(t,n||r,s),n||r)return;const o=t.context?.components||{};{const i=Object.keys(t);for(let c=0;c<i.length;c++){const e=i[c];if(!e.endsWith("Extends")||typeof t[e]!="string")continue;const a=e.slice(0,-7);if(!a||a.charCodeAt(0)<65||a.charCodeAt(0)>90)continue;const u={extends:t[e]};delete t[e];for(let p=c+1;p<i.length;p++){const l=i[p],y=l.charCodeAt(0);if(y>=65&&y<=90||O.REGISTRY.has(l)||typeof t[l]=="function"&&(l.startsWith("on")||l.startsWith(".")))break;const _=t[l];_!==void 0&&(u[l]=_,delete t[l])}t[a]&&typeof t[a]=="object"?t[a]={...u,...t[a]}:t[a]=u}}for(const i in t){if(!Object.prototype.hasOwnProperty.call(t,i)||O.REGISTRY.has(i)||typeof t[i]!="object"||t[i]===null)continue;const c=i.charCodeAt(0);if(c<65||c>90)continue;let e=t[i];if(!e.__ref){if(!e.extends&&!e.extend){const a=o[i]||o[`smbls.${i}`];a&&(e={...e,extends:a})}if(t.childProps&&(e=X(t.childProps,e)),f&&!e.ignoreChildExtends)if(e.extends){const a=Array.isArray(e.extends)?e.extends:[e.extends],u=Array.isArray(f)?f:[f];e={...e,extends:[...u,...a]}}else e={...e,extends:f};K(e,t,i,s)}}}function ut(t,s,n){const{node:r}=t;if(!r)return;r.ref=t;const f=s?.tag==="fragment"?s.__ref?.__fragmentAnchor:null;if(f){const i=f.parentNode;if(i){if(n?.position==="before"&&n.node)i.insertBefore(r,n.node);else if(n?.position==="after"&&n.node){const c=n.node.nextSibling;i.insertBefore(r,c||f)}else i.insertBefore(r,f);return}}const o=s?.node||(s?.nodeType?s:null);if(o)if(n?.position==="before"&&n.node)o.insertBefore(r,n.node);else if(n?.position==="after"&&n.node){const i=n.node.nextSibling;i?o.insertBefore(r,i):o.appendChild(r)}else o.appendChild(r)}function N(t,s,n){const r=t.charAt(0).toLowerCase()+t.slice(1);s.context?.plugins?.length&&(0,F.runPluginHook)(r,s,n);const f="on"+t,o=s[f];if(typeof o=="function"){const i=t==="Render"||t==="RenderRouter";if(i){if(s.__ref.__inRender)return!0;s.__ref.__inRender=!0}const c=s.context?.designSystem;c&&(0,A.pushConfig)(c);try{if(o(s,s.state,s.context,n)===!1)return!1}catch(e){if(s.context?.plugins?.length&&(0,F.runPluginHook)("error",s,{hook:f,error:e})||console.error(`[DOMQL] Lifecycle "${f}" error:`,e),s.context?.strictMode)throw e}finally{c&&(0,A.popConfig)(),i&&(s.__ref.__inRender=!1)}}return!0}var Qt=K;
4
+ `):"")}}if(at(o,!0),dt(o,s,f),s&&(s[o.key]=o,s.__ref?.__children&&(s.__ref.__children.includes(o.key)||s.__ref.__children.push(o.key))),typeof o.html=="function"&&o.node&&!o.node.innerHTML){const u=o.context?.designSystem;u&&(0,A.pushConfig)(u);try{const h=o.html(o,o.state,o.context);h!=null&&typeof h!="function"&&(o.node.innerHTML=h)}catch{}finally{u&&(0,A.popConfig)()}}if(D("Create",o,r),D("Complete",o,r),D("Render",o,r),D("RenderRouter",o,r),ht(o,r),typeof o.onFrame=="function"){const u=o.onFrame,h=o.context?.designSystem,x=()=>{if(o.node){if(o.node.isConnected){h&&(0,A.pushConfig)(h);try{u(o,o.state,o.context)}catch(b){console.error("[DOMQL] onFrame error:",b)}finally{h&&(0,A.popConfig)()}}requestAnimationFrame(x)}};requestAnimationFrame(x)}return o}function Vt(t,s,n){const r=!s,f=n.state&&typeof n.state=="object"&&!Array.isArray(n.state)&&Object.keys(n.state).length===0,o=r&&f&&t.context?.state,i=n.state!==void 0&&!o?n.state:t.state&&!(0,E.isStore)(t.state)?t.state:void 0;if(i==null){if(s?.state)t.state=s.state,(0,Y.applyStateMethods)(t,t.state);else if(t.context?.state){const c=t.context.state,e={...c},a=t.context?.polyglot;if(a?.translations){const d=c.lang||a.defaultLang||"en",p=a.translations[d];if(p&&typeof p=="object")for(const y in p)e[y]===void 0&&(e[y]=p[y]);const l=new Set(a.languages||[]);for(const y in a.translations)!l.has(y)&&e[y]===void 0&&(e[y]=a.translations[y])}t.state=(0,E.isStore)(e)?e:(0,E.createStore)(e),t.state.__element=t,t.state.root=t.state,(0,Y.applyStateMethods)(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),(0,Y.applyStateMethods)(t,t.state);return}if(typeof i=="string"){if(t.state=xt(i,s),t.state&&typeof t.state=="object"&&!(0,E.isStore)(t.state)){const c=s?.state?.root||s?.state||t.state;Object.defineProperty(t.state,"root",{value:c,enumerable:!1,configurable:!0,writable:!0})}(0,Y.applyStateMethods)(t,t.state);return}if(typeof i=="function"){const c=i(t,s?.state);t.state=(0,E.isStore)(c)?c:(0,E.createStore)(c||{})}else(0,E.isStore)(i)?t.state=i:t.state=(0,E.createStore)({...i});t.state.__element=t,s?.state?(t.state.parent=s.state,t.state.root=s.state.root||s.state):t.state.root=t.state,(0,Y.applyStateMethods)(t,t.state)}function nt(t,s){if(!s)return t;const n=s.split("/");let r=t;for(const f of n){if(r==null)return{};r=r[f]}return r??{}}function xt(t,s){if(!s)return{};if(t===".")return s.state||{};if(t.startsWith("../")){const f=t.slice(3);return f?nt(s.state,f):s.state??{}}if(t.startsWith("~/")){const f=s.state?.root||s.state,o=t.slice(2);return o?nt(f,o):f??{}}if(s.state?.[t]!==void 0)return s.state[t];const n=nt(s.state,t);if(n!=null&&Object.keys(n).length>0)return n;const r=s.context?.polyglot;if(r?.translations){const f=s.state?.root?.lang||r.defaultLang||"en",o=r.translations[f];if(o?.[t]!==void 0)return o[t];if(r.translations[t]!==void 0)return r.translations[t]}return{}}function Wt(t){const s=t.__ref,n=t.tag||"div",r=t.context?.designSystem,f=[],o=Object.keys(t);for(let i=0;i<o.length;i++){const c=o[i];if(typeof t[c]!="function"||T.REGISTRY.has(c))continue;const e=c.charCodeAt(0);e>=65&&e<=90||W(c)||C.CSS_PROPS_REGISTRY[c]||C.DEFAULT_CSS_PROPERTIES_LIST&&C.DEFAULT_CSS_PROPERTIES_LIST.has(c)||(0,G.checkAttributeByTagName)(n,c)||f.push({prop:c,fn:t[c]})}for(let i=0;i<f.length;i++){const{prop:c,fn:e}=f[i];s.__exec[c]=e,Object.defineProperty(t,c,{get(){r&&(0,A.pushConfig)(r);try{return e(t,t.state,t.context)}catch{return}finally{r&&(0,A.popConfig)()}},set(a){delete s.__exec[c],Object.defineProperty(t,c,{value:a,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function bt(t,s){const n=t.__ref,r=!!(s&&s.skipIfEffect);if(Wt(t),typeof t.text=="function"){const o=t.text,i=(0,k.createEffect)(()=>{if(!n.contentManaged)try{let c=o(t,t.state,t.context);t.node&&c!=null&&typeof c!="function"&&typeof c!="object"&&(typeof c=="string"&&c.includes("{{")&&(c=J.replaceLiteralsWithObjectFields.call(t,c,t.state)),t.tag==="string"?t.node.nodeValue=c:t.node.textContent=c)}catch{}},{depth:n.path.length});n.__effects.push(i),n.__exec.text=o}else if(typeof t.text=="string"&&t.text.includes("{{")){const o=t.text,i=(0,k.createEffect)(()=>{if(n.contentManaged)return;const c=J.replaceLiteralsWithObjectFields.call(t,o,t.state);c!=null&&(t.text=c),t.node&&(t.tag==="string"?t.node.nodeValue=c??"":t.node.textContent=c??"")},{depth:n.path.length});n.__effects.push(i),n.__exec.text=o}for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)&&typeof t[o]=="function"&&!T.REGISTRY.has(o)&&!W(o)&&!n.__exec[o]){if(C.CSS_PROPS_REGISTRY[o]){const i=t[o],c=o;let e;const a=(0,k.createEffect)(()=>{const d=t.context?.designSystem;d&&(0,A.pushConfig)(d);try{const p=i(t,t.state,t.context),l=C.CSS_PROPS_REGISTRY[c](p,t,t.state,t.context);if(l&&t.node){const y=Ct(l);(y===null||y!==e)&&(e=y,B(t.node,l))}else t.node&&(c==="show"||c==="hide")&&(e=void 0,t.node.style.display="")}finally{d&&(0,A.popConfig)()}},{depth:n.path.length});n.__effects.push(a),n.__exec[o]=i}else if(C.DEFAULT_CSS_PROPERTIES_LIST&&C.DEFAULT_CSS_PROPERTIES_LIST.has(o)){const i=t[o],c=o;let e;const a=(0,k.createEffect)(()=>{const d=t.context?.designSystem;d&&(0,A.pushConfig)(d);try{const p=i(t,t.state,t.context);if(t.node)if(p!=null){const l=c+":"+String(p);l!==e&&(e=l,B(t.node,{[c]:p}))}else e=void 0,t.node.style[c]=""}finally{d&&(0,A.popConfig)()}},{depth:n.path.length});n.__effects.push(a),n.__exec[o]=i}}if(typeof t.html=="function"){const o=t.html,i=(0,k.createEffect)(()=>{const c=t.context?.designSystem;c&&(0,A.pushConfig)(c);try{const e=o(t,t.state,t.context);t.node&&e!=null&&typeof e!="function"&&(t.node.innerHTML=e)}finally{c&&(0,A.popConfig)()}},{depth:n.path.length});n.__effects.push(i),n.__exec.html=o}if(typeof t.value=="function"){const o=t.value,i=(0,k.createEffect)(()=>{try{const c=o(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const e=c==null?"":String(c);if(t.node.value===e)return;const a=typeof document<"u"&&document.activeElement===t.node,d=a&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,p=a&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=e,a&&d!=null&&p!=null)try{t.node.setSelectionRange(d,p)}catch{}}catch{}},{depth:n.path.length});n.__effects.push(i),n.__exec.value=o}if(typeof t.style=="function"){const o=t.style;let i;const c=(0,k.createEffect)(()=>{const e=o(t,t.state,t.context),a=Ct(e);(a===null||a!==i)&&(i=a,B(t.node,e))},{depth:n.path.length});n.__effects.push(c),n.__exec.style=o}else if(t.style&&typeof t.style=="object")for(const o in t.style){const i=t.style[o];if(typeof i!="function")continue;let c;const e=(0,k.createEffect)(()=>{try{const a=i(t,t.state,t.context);if(t.node){const d=o+":"+String(a);d!==c&&(c=d,B(t.node,{[o]:a}))}}catch{}},{depth:n.path.length});n.__effects.push(e)}if(t.attr&&typeof t.attr=="object"){for(const o in t.attr)if(typeof t.attr[o]=="function"){const i=t.attr[o],c=o,e=(0,k.createEffect)(()=>{try{const a=i(t,t.state,t.context);t.node?.setAttribute&&(a==null||a===!1?t.node.removeAttribute(c):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(c,a===!0?"":a))}catch{}},{depth:n.path.length});n.__effects.push(e)}}if(t.aria&&typeof t.aria=="object")for(const o in t.aria){const i=t.aria[o];if(typeof i!="function")continue;const c="aria-"+o.replace(/[A-Z]/g,a=>"-"+a.toLowerCase()),e=(0,k.createEffect)(()=>{try{const a=i(t,t.state,t.context);if(!t.node?.setAttribute)return;a==null||a===!1?t.node.removeAttribute(c):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(c,a===!0?"":a)}catch{}},{depth:n.path.length});n.__effects.push(e)}if(t.data&&typeof t.data=="object")for(const o in t.data){const i=t.data[o];if(typeof i!="function")continue;const e="data-"+o.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),a=(0,k.createEffect)(()=>{try{const d=i(t,t.state,t.context);if(!t.node?.setAttribute)return;d==null||d===!1?t.node.removeAttribute(e):typeof d!="function"&&typeof d!="object"&&t.node.setAttribute(e,d===!0?"":d)}catch{}},{depth:n.path.length});n.__effects.push(a)}const f=t.classlist&&typeof t.classlist=="object"&&!Array.isArray(t.classlist)?t.classlist:t.class&&typeof t.class=="object"&&!Array.isArray(t.class)?t.class:null;if(f)for(const o in f){const i=f[o];if(typeof i!="function")continue;const c=(0,k.createEffect)(()=>{try{const e=i(t,t.state,t.context);if(!t.node?.classList)return;typeof e=="string"?t.node.classList.add(e):e?t.node.classList.add(o):t.node.classList.remove(o)}catch{}},{depth:n.path.length});n.__effects.push(c)}!r&&typeof t.if=="function"&&At(t,n,t.if);for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||T.REGISTRY.has(o)||typeof t[o]!="function")continue;const i=o.charCodeAt(0);if(i>=65&&i<=90||W(o))continue;const c=t[o];n.__exec[o]=c;const e=t.tag||"div";if((0,G.checkAttributeByTagName)(e,o)&&!C.CSS_PROPS_REGISTRY[o]&&!(C.DEFAULT_CSS_PROPERTIES_LIST&&C.DEFAULT_CSS_PROPERTIES_LIST.has(o))){const a=o,d=(0,k.createEffect)(()=>{try{const p=c(t,t.state,t.context);t.node?.setAttribute&&(p==null||p===!1?t.node.removeAttribute(a):typeof p!="function"&&typeof p!="object"&&(a==="src"&&"src"in t.node?t.node.src=p:t.node.setAttribute(a,p===!0?"":p)))}catch{}},{depth:n.path.length});n.__effects.push(d)}}if(Yt(t),Gt(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const o=t.onStateUpdate,i=t.stateDeps;let c=!1,e=[];const a=(0,k.createEffect)(()=>{const d=[];for(let _=0;_<i.length;_++){const u=i[_];try{d[_]=typeof u=="function"?u(t,t.state,t.context):t.state?.[u]}catch{d[_]=void 0}}if(!c){c=!0,e=d;return}let p=d.length!==e.length;for(let _=0;!p&&_<d.length;_++)d[_]!==e[_]&&(p=!0);const l=e;if(e=d,!p)return;const y=t.context?.designSystem;y&&(0,A.pushConfig)(y);try{o(t,t.state,t.context,{prev:l,next:d})}catch(_){if(t.context?.plugins?.length&&(0,I.runPluginHook)("error",t,{hook:"onStateUpdate",error:_})||console.error('[DOMQL] Lifecycle "onStateUpdate" error:',_),t.context?.strictMode)throw _}finally{y&&(0,A.popConfig)()}},{depth:n.path.length});n.__effects.push(a)}}function At(t,s,n){const r=(0,k.createEffect)(()=>{let f;try{f=n(t,t.state,t.context)}catch(i){if(f=!1,s.__ifError=i,typeof console<"u"&&console.warn){const c=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${c} \u2014 treating as false:`,i?.message||i)}return}const o=s.__if;if(s.__if=!!f,o&&!s.__if&&t.node)t.node.remove();else if(!o&&s.__if)if(s.__ifInitialized){t.node||(t.node=(0,V.cacheNode)(t)),t.node&&(t.node.ref=t);const i=t.parent,c=i?.node;if(c&&t.node){let e=null;const a=Object.keys(i),d=a.indexOf(t.key);for(let p=d+1;p<a.length;p++){const l=i[a[p]];if(l?.node?.parentNode===c){e=l.node;break}}e?c.insertBefore(t.node,e):c.appendChild(t.node)}else dt(t,t.parent);ct(t)}else{if(s.__ifInitialized=!0,t.tag||(t.tag=(0,V.detectTag)(t)),D("Init",t,{}),t.node||(t.node=(0,V.cacheNode)(t)),!t.node)return;if(t.tag==="fragment"&&!s.__fragmentAnchor){const c=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(c),s.__fragmentAnchor=c}D("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),jt(t,{}),bt(t,{skipIfEffect:!0}),ct(t),St(t),wt(t,{}),dt(t,t.parent),ht(t,{})}},{depth:s.path.length});s.__effects.push(r)}function ct(t){const{node:s}=t;if(s){if(typeof t.text=="string"&&!t.text.includes("{{")?t.tag==="string"?s.nodeValue=t.text:s.textContent=t.text:typeof t.text=="number"&&(s.textContent=t.text),Zt(t),typeof t.html=="string"&&(s.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&"value"in s){const n=String(t.value);s.value!==n&&(s.value=n)}if(t.style&&typeof t.style=="object"&&B(s,t.style),t.attr&&typeof t.attr=="object")for(const n in t.attr){const r=t.attr[n];typeof r=="function"||typeof r=="object"||r==null||r===!1||s.setAttribute&&s.setAttribute(n,r===!0?"":r)}if(t.data&&typeof t.data=="object")for(const n in t.data){const r=t.data[n];typeof r=="function"||typeof r=="object"||r==null||r===!1||s.dataset&&(s.dataset[n]=r===!0?"":r)}if(t.classlist||t.class){const n=t.classlist||t.class;if(typeof n=="string")n.split(" ").forEach(r=>r&&s.classList.add(r));else if(typeof n=="object")for(const r in n){const f=typeof n[r]=="function"?n[r](t,t.state,t.context):n[r];f&&s.classList.add(typeof f=="string"?f:r)}}}}function Ct(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function B(t,s){if(!t||!s||!t.style)return;let n=null;for(const r in s){const f=s[r];if(f!=null){if(r.charAt(0)==="&"&&typeof f=="object"){n||(n={}),n[r]=f;continue}try{const o=String(f),i=r.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),c=o.trim(),e=/\s*!important\s*$/.test(c),a=c.replace(/\s*!important\s*$/,"");t.style.setProperty(i,a,e?"important":"")}catch{}}}n&&Ht(t,n)}let Bt=0;function Ht(t,s){const n=`_ds${Bt++}`;t.classList.add(n);const r=t.ownerDocument;let f=r.querySelector("style[data-smbls-scoped]");f||(f=r.createElement("style"),f.setAttribute("data-smbls-scoped",""),r.head.appendChild(f));let o="";for(const i in s){const c="."+n,e=i.replace(/&/g,c).split(",").map(d=>{const p=d.trim();return p.includes(c)?p:c+p}).join(", "),a=s[i];if(typeof a=="object"){let d="",p="";for(const l in a){const y=a[l];if(typeof y=="object"){const _=l.includes("&")?e.split(", ").map(h=>l.replace(/&/g,h)).join(", "):e.split(", ").map(h=>`${h} ${l}`).join(", ");let u="";for(const h in y)u+=`${h.replace(/[A-Z]/g,x=>"-"+x.toLowerCase())}: ${y[h]};`;p+=`${_} { ${u} }
5
+ `}else d+=`${l.replace(/[A-Z]/g,_=>"-"+_.toLowerCase())}: ${y};`}d&&(o+=`${e} { ${d} }
6
+ `),p&&(o+=p)}}o&&(f.textContent+=o)}function Yt(t){const s=t.subscribeTo;if(!Array.isArray(s)||s.length===0)return;const n=t.__ref;for(let r=0;r<s.length;r++){const f=s[r];if(typeof f!="string"||f.length===0)continue;const o=f.split("."),i=o[0],c=o.slice(1),e={value:!1},a=(0,k.createEffect)(()=>{const d=t.state&&((0,E.isStore)(t.state)?t.state.root:null);if(!d||!(0,E.isStore)(d))return;let p=d;p=p[i];for(let y=0;y<c.length&&!(p==null||typeof p!="object");y++)if((0,E.isStore)(p))p=p[c[y]];else break;if(!e.value)return;let l=!1;if(typeof t.onBeforeUpdate=="function"){const y=t.context?.designSystem;y&&(0,A.pushConfig)(y);try{t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0})===!1&&(l=!0)}catch(_){t.context?.plugins?.length&&(0,I.runPluginHook)("error",t,{hook:"onBeforeUpdate",error:_})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",_)}finally{y&&(0,A.popConfig)()}}if(!l&&t.node&&n.__effects)for(let y=0;y<n.__effects.length;y++){const _=n.__effects[y];_&&_!==a&&!_._disposed&&!_._isSubscribeToEffect&&typeof _._execute=="function"&&_._execute()}if(!l&&typeof t.onUpdate=="function"){const y=t.context?.designSystem;y&&(0,A.pushConfig)(y);try{t.onUpdate(t,t.state,t.context)}catch(_){t.context?.plugins?.length&&(0,I.runPluginHook)("error",t,{hook:"onUpdate",error:_})||console.error("[DOMQL] subscribeTo onUpdate error:",_)}finally{y&&(0,A.popConfig)()}}},{depth:n.path.length});e.value=!0,a._isSubscribeToEffect=!0,n.__effects.push(a)}}function it(t,s){return t.charCodeAt(0)===64&&t.length>1&&!t.startsWith("@media")&&!t.startsWith("@keyframes")&&!t.startsWith("@supports")&&(t==="@dark"||t==="@light"||!s.context?.designSystem?.media?.[t.slice(1)])}function H(t,s,n){const r={},f=(o,i)=>{if(C.CSS_PROPS_REGISTRY[o]){const c=C.CSS_PROPS_REGISTRY[o](i,s,s.state,s.context);if(c){const e=Array.isArray(c)?c:[c];for(const a of e)a&&Object.assign(r,a)}}else r[o]=i};for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;let i=t[o];if(typeof i=="function"&&(i=i(s,s.state,s.context)),!(i==null||typeof i=="function")){if(typeof i=="object"&&!Array.isArray(i)){if(o==="style"){for(const a in i){let d=i[a];typeof d=="function"&&(d=d(s,s.state,s.context)),!(d==null||typeof d=="function")&&f(a,d)}continue}if(it(o,s)){const a=H(i,s,!0);Object.keys(a).length&&(r[`[data-theme="${o.slice(1)}"] &`]=a);continue}let c=o;if(o.charCodeAt(0)===64&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const a=s.context?.designSystem?.media?.[o.slice(1)];a&&(c=`@media ${a}`)}const e=H(i,s,!1);Object.keys(e).length&&(r[c]=e);continue}f(o,i)}}if(n)for(const o in r){const i=r[o];typeof i=="string"&&!i.includes("!important")&&(r[o]=i+" !important")}return r}function Gt(t){const s=t.__ref;s.__conditionalRunners=[];const n=new Map;for(const r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;const f=r.charAt(0);if(f!=="."&&f!=="!")continue;const o=r.slice(1);if(!o)continue;const i=t[r];if(!i||typeof i!="object")continue;const c=f==="!",e={lastMatch:!1,appliedKeys:null,appliedClasses:null},a=()=>{if(!t.node)return;let p;const l=t[o];if(l===void 0)if(t.state&&o in t.state)p=t.state[o];else{const u=t.context?.cases?.[o];if(u===void 0)return;try{p=typeof u=="function"?u.call(t,t):u}catch(h){p=!1,s.__conditionalError=h,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${r}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,h?.message||h)}}else if(typeof l=="function")try{p=l(t,t.state,t.context)}catch(u){p=!1,s.__conditionalError=u,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${r}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,u?.message||u)}else p=l;const y=c?!p:!!p;if(y===e.lastMatch)return;e.lastMatch=y;const _=t.context?.designSystem;_&&(0,A.pushConfig)(_);try{if(y){const u={},h={};let x=!1;for(const g in i){if(!Object.prototype.hasOwnProperty.call(i,g))continue;const j=i[g],L=g.charAt(0);if((L===":"||L==="@"||L==="&")&&j&&typeof j=="object"&&!Array.isArray(j)){if(it(g,t)){const w=H(j,t,!0);Object.keys(w).length&&(h[`[data-theme="${g.slice(1)}"] &`]=w,x=!0)}else{let w=g;if(L==="@"&&!g.startsWith("@media")&&!g.startsWith("@keyframes")){const K=t.context?.designSystem?.media?.[g.slice(1)];K&&(w=`@media ${K}`)}const $=H(j,t,!1);Object.keys($).length&&(h[w]=$,x=!0)}continue}const F=typeof j=="function"?j(t,t.state,t.context):j;if(F!=null)if(C.CSS_PROPS_REGISTRY[g]){const w=C.CSS_PROPS_REGISTRY[g](F,t,t.state,t.context);if(w){const $=Array.isArray(w)?w:[w];for(const K of $)K&&Object.assign(u,K)}}else C.DEFAULT_CSS_PROPERTIES_LIST&&C.DEFAULT_CSS_PROPERTIES_LIST.has(g)&&(u[g]=F)}const b=Object.keys(u);if(b.length){B(t.node,u);for(const g of b)n.set(g,r);e.appliedKeys=b}else e.appliedKeys=null;if(x){const g=(0,m.css)(h,null,t.context?.cssPrefix),j=g?g.split(" ").filter(Boolean):[];if(j.length&&t.node.classList){for(const L of j)t.node.classList.add(L);e.appliedClasses=j}else e.appliedClasses=null}else if(e.appliedClasses){for(const g of e.appliedClasses)t.node.classList.remove(g);e.appliedClasses=null}}else{if(e.appliedKeys){for(const u of e.appliedKeys)n.get(u)===r&&(t.node.style[u]="",n.delete(u));e.appliedKeys=null}if(e.appliedClasses){for(const u of e.appliedClasses)t.node.classList.remove(u);e.appliedClasses=null}}}finally{_&&(0,A.popConfig)()}};s.__conditionalRunners.push(a);const d=(0,k.createEffect)(a,{depth:s.path.length});s.__effects.push(d)}}const rt=new WeakSet;function qt(t){const s=t.ownerDocument;!s||rt.has(s)||(rt.add(s),queueMicrotask(()=>{rt.delete(s);const n=s.body||s.documentElement;n&&n.offsetWidth}))}const et=new WeakSet;let vt=!1;function Zt(t){const{node:s}=t;if(!s)return;if(vt||(vt=!0,(0,m.css)({display:"none"})),et.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}et.add(t);const n=t.context?.designSystem;n&&(0,A.pushConfig)(n);try{const r={};let f=!1;for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||typeof t[o]=="function"||T.REGISTRY.has(o))continue;const i=o.charCodeAt(0);if(!(i>=65&&i<=90)&&!W(o)){if(C.CSS_PROPS_REGISTRY[o]){const c=t[o],e=C.CSS_PROPS_REGISTRY[o](c,t,t.state,t.context);if(e){if(Array.isArray(e))for(const a of e)a&&Object.assign(r,a);else Object.assign(r,e);f=!0}}else if(C.DEFAULT_CSS_PROPERTIES_LIST&&C.DEFAULT_CSS_PROPERTIES_LIST.has(o)){const c=t[o];c!=null&&typeof c!="object"&&(r[o]=c,f=!0)}else if(o.charCodeAt(0)===45){const c=t[o];c!=null&&typeof c!="object"&&(r[o]=c,f=!0)}else if(o.charAt(0)==="&"){const c=t[o];c&&typeof c=="object"&&(r[o]=c,f=!0)}else if(o.charAt(0)==="@"||o.charAt(0)===":"){const c=t[o];if(c&&typeof c=="object"){if(it(o,t)){const e=H(c,t,!0);Object.keys(e).length&&(r[`[data-theme="${o.slice(1)}"] &`]=e,f=!0)}else{let e=o;if(o.charAt(0)==="@"&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const d=t.context?.designSystem?.media?.[o.slice(1)];d&&(e=`@media ${d}`)}const a=H(c,t,!1);Object.keys(a).length&&(r[e]=a,f=!0)}f=!0}}}}if(f){r.display&&String(r.display).includes("!important")&&(s.style.setProperty("display",String(r.display).replace(/\s*!important\s*$/,""),"important"),delete r.display);const o=(0,m.css)(r,null,t.context?.cssPrefix);if(o&&s.classList){const c=o.split(" ").filter(Boolean);let e=!1;for(const a of c)s.classList.add(a),e||(a.charCodeAt(0)===95&&a.charCodeAt(1)===99||a.charCodeAt(0)===95&&a.indexOf("_c",1)!==-1)&&(e=!0);e&&qt(s)}const i=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(i!=null){const c=r.display;if(c&&c!==i)if(i==="none"){const e=[];for(const a of s.classList)a.startsWith("_d-")&&a!=="_d-none"&&e.push(a);for(const a of e)s.classList.remove(a);s.classList.add("_d-none")}else s.style.display=t.display}}}finally{n&&(0,A.popConfig)(),et.delete(t)}}function St(t){const{node:s}=t;if(!s||!s.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const f in t.aria){const o=t.aria[f];if(typeof o=="function"||typeof o=="object"||o==null||o===!1)continue;const i="aria-"+f.replace(/[A-Z]/g,c=>"-"+c.toLowerCase());s.setAttribute(i,o===!0?"":o)}const n=(0,G.applyAttrTransforms)(t);for(const f in n){const o=n[f];o!=null&&o!==!1&&typeof o!="function"&&typeof o!="object"&&s.setAttribute(f,o===!0?"":o)}const r=t.tag||"div";for(const f in t){if(!Object.prototype.hasOwnProperty.call(t,f)||typeof t[f]=="function"||T.REGISTRY.has(f)||f==="on"||n[f]!==void 0)continue;const o=f.charCodeAt(0);if(!(o>=65&&o<=90)&&!W(f)&&!(C.CSS_PROPS_REGISTRY[f]||C.DEFAULT_CSS_PROPERTIES_LIST&&C.DEFAULT_CSS_PROPERTIES_LIST.has(f))&&(0,G.checkAttributeByTagName)(r,f)){let i=t[f];if(i==null||i===!1||(typeof i=="string"&&i.includes("{{")&&(i=(0,J.replaceLiteralsWithObjectFields)(i,t,t.state,t.context),t[f]=i),i==null||i===!1||typeof i=="function"||typeof i=="object"))continue;s.setAttribute(f,i===!0?"":i)}}}function zt(t){if(!t.autoGrow)return;const s=t.node;if(!s||s.tagName!=="TEXTAREA")return;const n=t.autoGrow,r=n&&typeof n=="object"&&n.max?String(n.max):null;r&&(s.style.maxHeight=r);const f=()=>{s.style.height="auto",s.style.height=s.scrollHeight+"px"};f(),s.addEventListener("input",f),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("input",f)}catch{}})}const kt=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function jt(t,s){for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n)||!W(n)||kt.has(n))continue;let r=t[n];if(typeof r=="string"&&/^[A-Za-z_$][\w$]*$/.test(r)){const o=r;r=function(c){return t.call(o,c)}}if(typeof r!="function")continue;const f=Kt(n);T.LIFECYCLE_EVENTS.has(f)||(0,Et.registerEvent)(Ut(f),t,r)}Qt(t)}function Qt(t){const s=t.node;if(!s||!s.addEventListener)return;const n={};let r=!1;for(const l of kt){const y=t[l];typeof y=="function"&&(n[l]=y,r=!0)}if(!r)return;const f=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,o=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let i=0,c=0,e=0,a=!1;const d=l=>{const y=l.touches&&l.touches[0]||l.changedTouches&&l.changedTouches[0];y&&(i=y.clientX,c=y.clientY,e=Date.now(),a=!0)},p=l=>{if(!a)return;a=!1;const y=l.changedTouches&&l.changedTouches[0]||l.touches&&l.touches[0];if(!y)return;const _=y.clientX-i,u=y.clientY-c,h=Date.now()-e;if(h>o)return;const x=Math.abs(_),b=Math.abs(u);if(Math.max(x,b)<f)return;let g;if(x>b*1.2)g=_<0?"left":"right";else if(b>x*1.2)g=u<0?"up":"down";else return;const j="onSwipe"+g.charAt(0).toUpperCase()+g.slice(1),L=n[j],F=n.onSwipe;L&&L.call(t,l,t,t.state,t.context),F&&F.call(t,{direction:g,dx:_,dy:u,dt:h,event:l},t,t.state,t.context)};s.addEventListener("touchstart",d,{passive:!0}),s.addEventListener("touchend",p,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("touchstart",d)}catch{}try{s.removeEventListener("touchend",p)}catch{}})}function X(t,s){const n={...t};for(const r in s){const f=n[r],o=s[r];f&&o&&typeof f=="object"&&typeof o=="object"&&!Array.isArray(f)&&!Array.isArray(o)&&typeof f!="function"&&typeof o!="function"?n[r]=X(f,o):n[r]=o}return n}function ft(t,s,n){if(!s||!t.node)return;const r=t.childExtends;if(Array.isArray(s)){const f=t.tag==="fragment",o=t.context?.document||globalThis.document,i=f?null:o?.createDocumentFragment();if(!f&&!i)return;const c=t.childProps,e=t.childrenAs;for(let a=0;a<s.length;a++){let d=s[a];const p=d;(typeof d=="string"||typeof d=="number")&&(d={text:d});let l=c;if(typeof c=="function")try{l=c(t,d)}catch{l=null}if(e==="state"){let u=p;(typeof p=="string"||typeof p=="number")&&(u={value:p,text:p}),d=l?{...l,state:u}:{state:u}}else l&&(d=X(l,d));if(r&&!d.ignoreChildExtends)if(d.extends){const u=Array.isArray(d.extends)?d.extends:[d.extends],h=Array.isArray(r)?r:[r];d={...d,extends:[...h,...u]}}else d={...d,extends:r};const y=d?.key||p&&typeof p=="object"&&p.key||`${a}`,_=U(d,t,y,n);!f&&_?.node&&i.appendChild(_.node)}f||t.node.appendChild(i);return}if(typeof s=="string"){const f=xt(s,t);if(Array.isArray(f)){ft(t,f,n);return}}if(typeof s=="object")for(const f in s){if(T.REGISTRY.has(f))continue;let o=s[f];if(!(o==null||o===!1)){if((typeof o=="string"||typeof o=="number")&&(o={text:o}),t.childProps&&(o=X(t.childProps,o)),r&&!o.ignoreChildExtends)if(o.extends){const i=Array.isArray(o.extends)?o.extends:[o.extends],c=Array.isArray(r)?r:[r];o={...o,extends:[...c,...i]}}else o={...o,extends:r};U(o,t,f,n)}}}function at(t,s){const n=t.node;if(!n||n.tagName!=="SELECT")return;const r=n.options;if(!r||!r.length)return;const f=t.__ref,o=f&&f.__exec&&f.__exec.value,i=typeof o=="function",c=t.value!=null&&typeof t.value!="function";if(i||c){let d;if(i)try{d=o(t,t.state,t.context)}catch{return}else d=t.value;const p=d==null?"":String(d);n.value!==p&&(n.value=p);return}const e=s||!(f&&f.__selectSynced);if(f&&(f.__selectSynced=!0),!e)return;let a=-1;for(let d=0;d<r.length;d++)r[d].defaultSelected&&(a=d);a>=0&&n.selectedIndex!==a&&(n.selectedIndex=a)}function wt(t,s){let{children:n,content:r}=t;const f=t.childExtends;if(typeof n=="function"){const i=n;n=i(t,t.state,t.context),t.children=n;const c=t.__ref;let e=!1;const a=(0,k.createEffect)(()=>{const d=i(t,t.state,t.context);if(!e){e=!0;return}if(d===t.children)return;t.children=d;const p=typeof t.onContentUpdate=="function",l=p?[]:null,y=p?[]:null,_=p?[]:null;if(Array.isArray(d)&&t.childrenAs==="state"){const b=t.childProps,g=[],j=new Map;for(let S=0;S<d.length;S++){const P=d[S];let v=b;if(typeof b=="function")try{v=b(t,P)}catch{v=null}const M=v&&v.key||P&&P.key||`${S}`;g.push(M),j.set(M,{rawChild:P,childProps:v})}const L=new Set(g),F=c.__children.slice();for(const S of F)if(!L.has(S)){const P=t[S];P?.remove&&P.remove(),delete t[S],y&&y.push(S)}const w=t.childExtends,$=t.tag==="fragment",K=t.context?.document||globalThis.document,q=$?null:K?.createDocumentFragment();for(const S of g){const P=j.get(S),v=P.rawChild,M=t[S];if(M&&M.state){if(v&&typeof v=="object"){const O=M.state,z=O.$replace||O.replace,yt=O.$update||O.update;if(typeof z=="function")z.call(O,v);else if(typeof yt=="function"){for(const N in O)if(!(N==="__element"||N==="root"||N==="parent"||N==="update")&&!Object.prototype.hasOwnProperty.call(v,N))try{O[N]=void 0}catch{}yt.call(O,v)}else for(const N in v)O[N]=v[N]}_&&_.push(S);continue}let tt=v;(typeof v=="string"||typeof v=="number")&&(tt={value:v,text:v});const pt=P.childProps;let R=pt?{...pt,state:tt}:{state:tt};if(w&&!R.ignoreChildExtends)if(R.extends){const O=Array.isArray(R.extends)?R.extends:[R.extends],z=Array.isArray(w)?w:[w];R={...R,extends:[...z,...O]}}else R={...R,extends:w};const lt=U(R,t,S,s);!$&&lt?.node&&q&&q.appendChild(lt.node),l&&l.push(S)}if(!$&&q&&q.childNodes.length&&t.node&&t.node.appendChild(q),!$&&t.node){let S=null;for(const P of g){const v=t[P]?.node;if(!v)continue;const M=S?S.nextSibling:t.node.firstChild;v!==M&&t.node.insertBefore(v,M),S=v}}c.__children=g,p&&(l.length||y.length)&&_t(t,{added:l,removed:y,kept:_}),at(t,!1);return}const x=p?[...c.__children]:null;for(const b of[...c.__children]){const g=t[b];g?.remove&&g.remove(),delete t[b]}c.__children=[],ft(t,d,s),at(t,!1),p&&_t(t,{added:[...c.__children],removed:x,kept:[]})},{depth:c.path.length});c.__effects.push(a)}if(ft(t,n||r,s),n||r)return;const o=t.context?.components||{};{const i=Object.keys(t);for(let c=0;c<i.length;c++){const e=i[c];if(!e.endsWith("Extends")||typeof t[e]!="string")continue;const a=e.slice(0,-7);if(!a||a.charCodeAt(0)<65||a.charCodeAt(0)>90)continue;const d={extends:t[e]};delete t[e];for(let p=c+1;p<i.length;p++){const l=i[p],y=l.charCodeAt(0);if(y>=65&&y<=90||T.REGISTRY.has(l)||typeof t[l]=="function"&&(l.startsWith("on")||l.startsWith(".")))break;const _=t[l];_!==void 0&&(d[l]=_,delete t[l])}t[a]&&typeof t[a]=="object"?t[a]={...d,...t[a]}:t[a]=d}}for(const i in t){if(!Object.prototype.hasOwnProperty.call(t,i)||T.REGISTRY.has(i)||typeof t[i]!="object"||t[i]===null)continue;const c=i.charCodeAt(0);if(c<65||c>90)continue;let e=t[i];if(!e.__ref){if(!e.extends&&!e.extend){const a=o[i]||o[`smbls.${i}`];a&&(e={...e,extends:a})}if(t.childProps&&(e=X(t.childProps,e)),f&&!e.ignoreChildExtends)if(e.extends){const a=Array.isArray(e.extends)?e.extends:[e.extends],d=Array.isArray(f)?f:[f];e={...e,extends:[...d,...a]}}else e={...e,extends:f};U(e,t,i,s)}}}function dt(t,s,n){const{node:r}=t;if(!r)return;r.ref=t;const f=s?.tag==="fragment"?s.__ref?.__fragmentAnchor:null;if(f){const i=f.parentNode;if(i){if(n?.position==="before"&&n.node)i.insertBefore(r,n.node);else if(n?.position==="after"&&n.node){const c=n.node.nextSibling;i.insertBefore(r,c||f)}else i.insertBefore(r,f);return}}const o=s?.node||(s?.nodeType?s:null);if(o)if(n?.position==="before"&&n.node)o.insertBefore(r,n.node);else if(n?.position==="after"&&n.node){const i=n.node.nextSibling;i?o.insertBefore(r,i):o.appendChild(r)}else o.appendChild(r)}function D(t,s,n){const r=t.charAt(0).toLowerCase()+t.slice(1);s.context?.plugins?.length&&(0,I.runPluginHook)(r,s,n);const f="on"+t,o=s[f];if(typeof o=="function"){const i=t==="Render"||t==="RenderRouter";if(i){if(s.__ref.__inRender)return!0;s.__ref.__inRender=!0}const c=s.context?.designSystem;c&&(0,A.pushConfig)(c);try{if(o(s,s.state,s.context,n)===!1)return!1}catch(e){if(s.context?.plugins?.length&&(0,I.runPluginHook)("error",s,{hook:f,error:e})||console.error(`[DOMQL] Lifecycle "${f}" error:`,e),s.context?.strictMode)throw e}finally{c&&(0,A.popConfig)(),i&&(s.__ref.__inRender=!1)}}return!0}var Xt=U;
@@ -0,0 +1 @@
1
+ "use strict";var s=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var a=(n,t)=>{for(var e in t)s(n,e,{get:t[e],enumerable:!0})},p=(n,t,e,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of i(t))!f.call(n,o)&&o!==e&&s(n,o,{get:()=>t[o],enumerable:!(u=c(t,o))||u.enumerable});return n};var h=n=>p(s({},"__esModule",{value:!0}),n);var d={};a(d,{isLoudDevRuntime:()=>l});module.exports=h(d);function l(n){const t=n&&"env"in n?n.env:typeof process<"u"&&process.env?"production":void 0;if(t&&t!=="production")return!0;const e=n&&"hostname"in n?n.hostname:typeof location<"u"?location.hostname:void 0;return typeof e=="string"&&e?e==="localhost"||e==="127.0.0.1"||e.endsWith(".localhost"):!1}
@@ -1 +1 @@
1
- "use strict";var c=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var d=(t,e)=>{for(var n in e)c(t,n,{get:e[n],enumerable:!0})},y=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of g(e))!p.call(t,r)&&r!==n&&c(t,r,{get:()=>e[r],enumerable:!(o=a(e,r))||o.enumerable});return t};var k=t=>y(c({},"__esModule",{value:!0}),t);var R={};d(R,{addMethods:()=>C,elementProto:()=>f});module.exports=k(R);var h=require("./update.js"),_=require("./dispose.js"),v=require("css-in-props"),s=require("@symbo.ls/utils");function u(t,e,n){const o=t?.context?.analyze;if(!o||!o.emit||e==="warn"&&!o.shouldCapture("warnings")||e==="error"&&!o.shouldCapture("errors"))return;const r=n.map(i=>i?.message||(typeof i=="string"?i:null)).filter(Boolean).join(" ");o.emit({id:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,ts:Date.now(),type:e==="error"?"error":"warning",level:e,hook:e==="error"?"el.error":"el.warn",element:{key:t.key!=null?String(t.key):null,name:t.__name||null,tag:t.tag||null},message:r||null,args:n})}function m(...t){return u(this,"warn",t),s.warn.apply(this,t)}function w(...t){return u(this,"error",t),s.error.apply(this,t)}const f={update:h.update,remove:_.remove,getDB:s.getDB,getQuery:s.getQuery,getRootData:s.getRootData,getChildren:s.getChildren,getPath:s.getPath,nextElement:s.nextElement,previousElement:s.previousElement,verbose:s.verbose,warn:m,error:w,variables:s.variables,spotByPath:s.spotByPath,set(t,e){const n=this.__ref;if(n){if(n.__setLocked){n.__setQueued={content:t,options:e};return}n.__setLocked=!0}try{if(this.removeContent(),t!=null){const o=this.context?.__create;o&&o(t,this,"content",e)}this.__ref&&(this.__ref.contentManaged=!0)}finally{if(n){n.__setLocked=!1;const o=n.__setQueued;o&&(n.__setQueued=null,this.set(o.content,o.options))}}},reset(t){const e=this.context?.__create;if(!e)return this;const n=this.parent,o=this.key,r=this.parse();return this.remove(),e(r,n,o,t)},lookup(t){let e=this.parent;for(;e;){if(typeof t=="function"){if(t(e))return e}else if(typeof t=="string"){if(e.key===t)return e;if(e[t]&&e[t].__ref)return e[t]}e=e.parent}return null},lookdown(t){const e=this.__ref;if(!e?.__children)return null;for(const n of e.__children){const o=this[n];if(!o)continue;if(typeof t=="function"){if(t(o))return o}else if(typeof t=="string"&&o.key===t)return o;const r=o.lookdown?.(t);if(r)return r}return null},lookdownAll(t,e=[]){const n=this.__ref;if(!n?.__children)return e;for(const o of n.__children){const r=this[o];r&&(typeof t=="function"?t(r)&&e.push(r):typeof t=="string"&&r.key===t&&e.push(r),r.lookdownAll?.(t,e))}return e},getRef(){return this.__ref},getRoot:s.getRoot,getRootState:s.getRootState,getRootContext:s.getRootContext,getContext:s.getContext,parse(t){const e={},n=t?new Set(t):null,o=this.__ref?.__exec;for(const r in this)if(!(r==="parent"||r==="node"||r==="__ref")&&!n?.has(r)){if(o&&o[r]!==void 0){e[r]=o[r];continue}typeof this[r]!="function"&&(e[r]=this[r])}return e},parseDeep(t){const e=this.parse(t),n=this.__ref;if(n?.__children)for(const o of n.__children)this[o]?.parseDeep&&(e[o]=this[o].parseDeep(t));return e},keys(){return Object.keys(this)},log(...t){if(t.length){const e={};for(const n of t)e[n]=this[n];console.log(e)}else console.log(this)},setProps(t,e){return this.update(t,e)},setNodeStyles(t){if(this.node?.style)for(const e in t){const n=t[e];if(n==null)continue;const o=e.replace(/[A-Z]/g,i=>"-"+i.toLowerCase()),r=String(n).replace(/\s*!important\s*$/,"");this.node.style.setProperty(o,r,"important")}},call(t,...e){const n=this.context,o=n?.methods?.[t]||n?.functions?.[t]||n?.utils?.[t]||this[t];if(typeof o=="function")return o.call(this,...e)},removeContent(){const t=this.__ref;if(!t?.__children)return;const e=this.content;if(e?.remove){e.remove(),delete this.content;const n=t.__children.indexOf("content");n!==-1&&t.__children.splice(n,1)}e?.node?.parentNode&&e.node.parentNode.removeChild(e.node)}},l=new WeakMap;function x(t){if(!t)return f;let e=l.get(t);if(e)return e;e=Object.create(f);const n=t.methods;if(n)for(const o in n)e[o]=n[o];return l.set(t,e),e}function C(t){const e=x(t.context);Object.setPrototypeOf(t,e)}
1
+ "use strict";var c=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var w=(t,e)=>{for(var n in e)c(t,n,{get:e[n],enumerable:!0})},x=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of k(e))!m.call(t,r)&&r!==n&&c(t,r,{get:()=>e[r],enumerable:!(o=y(e,r))||o.enumerable});return t};var C=t=>x(c({},"__esModule",{value:!0}),t);var D={};w(D,{addMethods:()=>P,elementProto:()=>f});module.exports=C(D);var _=require("./update.js"),d=require("./dispose.js"),g=require("./devRuntime.js"),j=require("css-in-props"),s=require("@symbo.ls/utils");function u(t,e,n){const o=t?.context?.analyze;if(!o||!o.emit||e==="warn"&&!o.shouldCapture("warnings")||e==="error"&&!o.shouldCapture("errors"))return;const r=n.map(i=>i?.message||(typeof i=="string"?i:null)).filter(Boolean).join(" ");o.emit({id:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,ts:Date.now(),type:e==="error"?"error":"warning",level:e,hook:e==="error"?"el.error":"el.warn",element:{key:t.key!=null?String(t.key):null,name:t.__name||null,tag:t.tag||null},message:r||null,args:n})}const a=new Set;function S(t,e,n){const o=String(e);if(a.has(o))return;a.add(o);const r=t?.__ref?.path,i=Array.isArray(r)&&r.length?r.join("."):t?.key!=null?String(t.key):"(unknown element)",p=n!=null?`resolves to a non-function (${typeof n}) \u2014 it cannot be called`:"is not registered in context.methods, context.functions, or context.utils, and is not an element method",l=`[smbls] el.call('${o}') at <${i}>: "${o}" ${p}. Returning undefined (unchanged behavior) \u2014 check the name for typos or register the function on the project. Warned once per name; repeat misses are silent.`;u(t,"error",[l]),console.error(l)}function R(...t){return u(this,"warn",t),s.warn.apply(this,t)}function v(...t){return u(this,"error",t),s.error.apply(this,t)}const f={update:_.update,remove:d.remove,getDB:s.getDB,getQuery:s.getQuery,getRootData:s.getRootData,getChildren:s.getChildren,getPath:s.getPath,nextElement:s.nextElement,previousElement:s.previousElement,verbose:s.verbose,warn:R,error:v,variables:s.variables,spotByPath:s.spotByPath,set(t,e){const n=this.__ref;if(n){if(n.__setLocked){n.__setQueued={content:t,options:e};return}n.__setLocked=!0}try{if(this.removeContent(),t!=null){const o=this.context?.__create;o&&o(t,this,"content",e)}this.__ref&&(this.__ref.contentManaged=!0)}finally{if(n){n.__setLocked=!1;const o=n.__setQueued;o&&(n.__setQueued=null,this.set(o.content,o.options))}}},reset(t){const e=this.context?.__create;if(!e)return this;const n=this.parent,o=this.key,r=this.parse();return this.remove(),e(r,n,o,t)},lookup(t){let e=this.parent;for(;e;){if(typeof t=="function"){if(t(e))return e}else if(typeof t=="string"){if(e.key===t)return e;if(e[t]&&e[t].__ref)return e[t]}e=e.parent}return null},lookdown(t){const e=this.__ref;if(!e?.__children)return null;for(const n of e.__children){const o=this[n];if(!o)continue;if(typeof t=="function"){if(t(o))return o}else if(typeof t=="string"&&o.key===t)return o;const r=o.lookdown?.(t);if(r)return r}return null},lookdownAll(t,e=[]){const n=this.__ref;if(!n?.__children)return e;for(const o of n.__children){const r=this[o];r&&(typeof t=="function"?t(r)&&e.push(r):typeof t=="string"&&r.key===t&&e.push(r),r.lookdownAll?.(t,e))}return e},getRef(){return this.__ref},getRoot:s.getRoot,getRootState:s.getRootState,getRootContext:s.getRootContext,getContext:s.getContext,parse(t){const e={},n=t?new Set(t):null,o=this.__ref?.__exec;for(const r in this)if(!(r==="parent"||r==="node"||r==="__ref")&&!n?.has(r)){if(o&&o[r]!==void 0){e[r]=o[r];continue}typeof this[r]!="function"&&(e[r]=this[r])}return e},parseDeep(t){const e=this.parse(t),n=this.__ref;if(n?.__children)for(const o of n.__children)this[o]?.parseDeep&&(e[o]=this[o].parseDeep(t));return e},keys(){return Object.keys(this)},log(...t){if(t.length){const e={};for(const n of t)e[n]=this[n];console.log(e)}else console.log(this)},setProps(t,e){return this.update(t,e)},setNodeStyles(t){if(this.node?.style)for(const e in t){const n=t[e];if(n==null)continue;const o=e.replace(/[A-Z]/g,i=>"-"+i.toLowerCase()),r=String(n).replace(/\s*!important\s*$/,"");this.node.style.setProperty(o,r,"important")}},call(t,...e){const n=this.context,o=n?.methods?.[t]||n?.functions?.[t]||n?.utils?.[t]||this[t];if(typeof o=="function")return o.call(this,...e);(0,g.isLoudDevRuntime)()&&S(this,t,o)},removeContent(){const t=this.__ref;if(!t?.__children)return;const e=this.content;if(e?.remove){e.remove(),delete this.content;const n=t.__children.indexOf("content");n!==-1&&t.__children.splice(n,1)}e?.node?.parentNode&&e.node.parentNode.removeChild(e.node)}},h=new WeakMap;function b(t){if(!t)return f;let e=h.get(t);if(e)return e;e=Object.create(f);const n=t.methods;if(n)for(const o in n)e[o]=n[o];return h.set(t,e),e}function P(t){const e=b(t.context);Object.setPrototypeOf(t,e)}
@@ -1,6 +1,6 @@
1
- import{createStore as m,createScopeStore as Ot,isStore as F}from"@symbo.ls/signal";import{createEffect as C}from"@symbo.ls/signal";import{cacheNode as tt,detectTag as _t}from"./cache.js";import{REGISTRY as I,LIFECYCLE_EVENTS as Tt}from"./registry.js";import{registerEvent as $t}from"./delegate.js";import{applyExtends as Rt}from"./extends.js";import{addMethods as Nt}from"./methods.js";import"./dispose.js";import{replaceLiteralsWithObjectFields as ot}from"@symbo.ls/utils";import{runPluginHook as U}from"@symbo.ls/utils/function.js";import{applyStateMethods as q}from"@symbo.ls/state";import{CSS_PROPS_REGISTRY as O,DEFAULT_CSS_PROPERTIES_LIST as E}from"css-in-props";import{css as st}from"@symbo.ls/css";import{pushConfig as j,popConfig as w}from"@symbo.ls/scratch";import{checkAttributeByTagName as nt,applyAttrTransforms as Mt}from"attrs-in-props";let Dt=1;const Q=[];let ct=!1;function Ft(){ct||(ct=!0,typeof requestAnimationFrame=="function"?requestAnimationFrame(gt):setTimeout(gt,0))}function gt(){if(ct=!1,!Q.length)return;const t=Q.splice(0,Q.length);for(let s=0;s<t.length;s++){const n=t[s];!n.node||!n.node.isConnected||N("Mounted",n,n.__ref?.__mountOptions||{})}}function xt(t,s){typeof t.onMounted=="function"&&(t.__ref.__mountOptions=s,Q.push(t),Ft())}function bt(t,s){if(typeof t.onContentUpdate!="function")return;t.context?.plugins?.length&&U("contentUpdate",t,s);const n=t.context?.designSystem;n&&j(n);try{t.onContentUpdate(t,t.state,t.context,s)}catch(r){if(t.context?.plugins?.length&&U("error",t,{hook:"onContentUpdate",error:r})||console.error('[DOMQL] Lifecycle "onContentUpdate" error:',r),t.context?.strictMode)throw r}finally{n&&w()}}function W(t){return t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90}function It(t){return t.charAt(2).toLowerCase()+t.slice(3)}function Kt(t){return t.toLowerCase()}function At(t){const s=t.charCodeAt(0);return s===58||s===64||s===38}function Z(t,s){const n={...t};for(const r in s){const f=n[r],o=s[r];f&&o&&typeof f=="object"&&typeof o=="object"&&!Array.isArray(f)&&!Array.isArray(o)&&typeof f!="function"&&typeof o!="function"?n[r]=Z(f,o):n[r]=o}return n}function B(t,s,n,r={},f){if(t==null||t===!1)return null;(typeof t=="string"||typeof t=="number")&&(t={text:t});const o=Object.create(null);o.key=n||t.key||`_${Dt++}`,o.parent=s||null,o.context=t.context||s?.context||r.context||{},o.context.__create||(o.context.__create=B);const i=o.__ref={__if:!0,__children:[],__exec:{},__effects:[],__eventCleanup:[],root:s?.__ref?.root||o,path:s?.__ref?.path?[...s.__ref.path,o.key]:[o.key]};if(n&&!t.extends&&!t.extend){const d=n.indexOf("_");if(d>0){const h=n.substring(0,d),g=o.context?.components;g&&(g[h]||g["smbls."+h])&&(t={...t,extends:h})}}Rt(o,t,r);const c=new Set(["childProps","attr","style","scope","data"]),e=o.props&&typeof o.props=="object"?o.props:null;for(const d in t){if(d==="parent"||d==="node"||d==="__ref"||d==="extends"||d==="context"||d==="props")continue;const h=t[d],g=o[d],b=g&&h&&typeof g=="object"&&typeof h=="object"&&!Array.isArray(g)&&!Array.isArray(h)&&typeof g!="function"&&typeof h!="function";b&&d.charCodeAt(0)>=65&&d.charCodeAt(0)<=90?o[d]=Z(g,h):b&&c.has(d)?o[d]={...g,...h}:b&&At(d)?o[d]=Z(g,h):o[d]=h}function a(d){for(const h in d){const g=d[h],b=o[h],x=b&&g&&typeof b=="object"&&typeof g=="object"&&!Array.isArray(b)&&!Array.isArray(g)&&typeof b!="function"&&typeof g!="function";x&&h.charCodeAt(0)>=65&&h.charCodeAt(0)<=90?o[h]=Z(b,g):x&&c.has(h)?o[h]={...b,...g}:x&&At(h)?o[h]=Z(b,g):o[h]=g}}e&&a(e),t.props&&typeof t.props=="object"&&a(t.props),t.data!==void 0&&(o.data=t.data),t.classlist!==void 0&&(o.classlist=t.classlist),t.text!==void 0&&(o.text=t.text),t.html!==void 0&&(o.html=t.html);const u=o.scope&&typeof o.scope=="object"?o.scope:null,p=s?.scope,l=o.context&&typeof o.context.globalScope=="object"&&o.context.globalScope||null,y=p||l||null;if(t.scope!==void 0||u){const d={};u&&Object.assign(d,u),t.scope!==void 0&&Object.assign(d,t.scope),o.scope=Ot(d,y)}else y&&(o.scope=y);if(t.if!==void 0&&(o.if=t.if),Nt(o),Ut(o,s,t),o.if!=null){let d;if(typeof o.if=="function")try{d=o.if(o,o.state,o.context)}catch(h){if(d=!1,i.__ifError=h,typeof console<"u"&&console.warn){const g=o.key||o.tag||"?";console.warn(`[smbls] \`if:\` evaluator threw on ${g} \u2014 treating as false:`,h?.message||h)}}else d=o.if;i.__if=!!d}if(i.__if)typeof o.if=="function"&&(i.__ifInitialized=!0);else return s&&(s[o.key]=o),typeof o.if=="function"&&St(o,i,o.if),o;o.tag||(o.tag=_t(o)),N("Init",o,r);const _=o.node=tt(o);if(!_)return o;if(o.tag==="fragment"){const h=(o.context?.document||globalThis.document).createComment("");_.appendChild(h),i.__fragmentAnchor=h}N("AttachNode",o,r),_.setAttribute&&o.key&&_.setAttribute("data-key",o.key),_.setAttribute&&o.context?.scopeSelector&&o.context.scopeSelector!==":root"&&o.context.key&&o.key===o.context.key&&_.setAttribute("data-smbls-app",o.context.key),o.id&&_.setAttribute&&(_.id=o.id),Pt(o,r),vt(o),rt(o),wt(o),Zt(o);try{Lt(o,r)}catch(d){if(typeof console<"u"&&console.error){const h=o.__ref?.path?.join(".")||o.key||"<root>";console.error(`[smbls] createChildren failed at ${h}:`,d?.message||d,d?.stack?`
2
- `+d.stack.split(`
1
+ import{createStore as m,createScopeStore as Ot,isStore as I}from"@symbo.ls/signal";import{createEffect as v}from"@symbo.ls/signal";import{cacheNode as tt,detectTag as _t}from"./cache.js";import{REGISTRY as K,LIFECYCLE_EVENTS as Tt}from"./registry.js";import{registerEvent as Rt}from"./delegate.js";import{applyExtends as $t}from"./extends.js";import{addMethods as Mt}from"./methods.js";import"./dispose.js";import{isLoudDevRuntime as Nt}from"./devRuntime.js";import{replaceLiteralsWithObjectFields as ot}from"@symbo.ls/utils";import{runPluginHook as V}from"@symbo.ls/utils/function.js";import{applyStateMethods as q}from"@symbo.ls/state";import{CSS_PROPS_REGISTRY as T,DEFAULT_CSS_PROPERTIES_LIST as P}from"css-in-props";import{css as st}from"@symbo.ls/css";import{pushConfig as j,popConfig as w}from"@symbo.ls/scratch";import{checkAttributeByTagName as nt,applyAttrTransforms as Dt}from"attrs-in-props";let Ft=1;const Q=[];let ct=!1;function It(){ct||(ct=!0,typeof requestAnimationFrame=="function"?requestAnimationFrame(gt):setTimeout(gt,0))}function gt(){if(ct=!1,!Q.length)return;const t=Q.splice(0,Q.length);for(let s=0;s<t.length;s++){const n=t[s];!n.node||!n.node.isConnected||D("Mounted",n,n.__ref?.__mountOptions||{})}}function xt(t,s){typeof t.onMounted=="function"&&(t.__ref.__mountOptions=s,Q.push(t),It())}function bt(t,s){if(typeof t.onContentUpdate!="function")return;t.context?.plugins?.length&&V("contentUpdate",t,s);const n=t.context?.designSystem;n&&j(n);try{t.onContentUpdate(t,t.state,t.context,s)}catch(r){if(t.context?.plugins?.length&&V("error",t,{hook:"onContentUpdate",error:r})||console.error('[DOMQL] Lifecycle "onContentUpdate" error:',r),t.context?.strictMode)throw r}finally{n&&w()}}function W(t){return t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90}function Kt(t){return t.charAt(2).toLowerCase()+t.slice(3)}function Ut(t){return t.toLowerCase()}function At(t){const s=t.charCodeAt(0);return s===58||s===64||s===38}function Z(t,s){const n={...t};for(const r in s){const f=n[r],o=s[r];f&&o&&typeof f=="object"&&typeof o=="object"&&!Array.isArray(f)&&!Array.isArray(o)&&typeof f!="function"&&typeof o!="function"?n[r]=Z(f,o):n[r]=o}return n}function B(t,s,n,r={},f){if(t==null||t===!1)return null;(typeof t=="string"||typeof t=="number")&&(t={text:t});const o=Object.create(null);o.key=n||t.key||`_${Ft++}`,o.parent=s||null,o.context=t.context||s?.context||r.context||{},o.context.__create||(o.context.__create=B);const i=o.__ref={__if:!0,__children:[],__exec:{},__effects:[],__eventCleanup:[],root:s?.__ref?.root||o,path:s?.__ref?.path?[...s.__ref.path,o.key]:[o.key]};if(n&&!t.extends&&!t.extend){const u=n.indexOf("_");if(u>0){const h=n.substring(0,u),x=o.context?.components;x&&(x[h]||x["smbls."+h])?t={...t,extends:h}:x&&Nt()&&/^[A-Z]\w*_\d+$/.test(n)&&console.warn(`[smbls] auto-extend: key "${n}" looks like a multi-instance (${h}_N) but neither "${h}" nor "smbls.${h}" is registered in context.components \u2014 element will render as a plain <div>. Register the base component or rename the key.`)}}$t(o,t,r);const c=new Set(["childProps","attr","style","scope","data"]),e=o.props&&typeof o.props=="object"?o.props:null;for(const u in t){if(u==="parent"||u==="node"||u==="__ref"||u==="extends"||u==="context"||u==="props")continue;const h=t[u],x=o[u],b=x&&h&&typeof x=="object"&&typeof h=="object"&&!Array.isArray(x)&&!Array.isArray(h)&&typeof x!="function"&&typeof h!="function";b&&u.charCodeAt(0)>=65&&u.charCodeAt(0)<=90?o[u]=Z(x,h):b&&c.has(u)?o[u]={...x,...h}:b&&At(u)?o[u]=Z(x,h):o[u]=h}function a(u){for(const h in u){const x=u[h],b=o[h],g=b&&x&&typeof b=="object"&&typeof x=="object"&&!Array.isArray(b)&&!Array.isArray(x)&&typeof b!="function"&&typeof x!="function";g&&h.charCodeAt(0)>=65&&h.charCodeAt(0)<=90?o[h]=Z(b,x):g&&c.has(h)?o[h]={...b,...x}:g&&At(h)?o[h]=Z(b,x):o[h]=x}}e&&a(e),t.props&&typeof t.props=="object"&&a(t.props),t.data!==void 0&&(o.data=t.data),t.classlist!==void 0&&(o.classlist=t.classlist),t.text!==void 0&&(o.text=t.text),t.html!==void 0&&(o.html=t.html);const d=o.scope&&typeof o.scope=="object"?o.scope:null,p=s?.scope,l=o.context&&typeof o.context.globalScope=="object"&&o.context.globalScope||null,y=p||l||null;if(t.scope!==void 0||d){const u={};d&&Object.assign(u,d),t.scope!==void 0&&Object.assign(u,t.scope),o.scope=Ot(u,y)}else y&&(o.scope=y);if(t.if!==void 0&&(o.if=t.if),Mt(o),Vt(o,s,t),o.if!=null){let u;if(typeof o.if=="function")try{u=o.if(o,o.state,o.context)}catch(h){if(u=!1,i.__ifError=h,typeof console<"u"&&console.warn){const x=o.key||o.tag||"?";console.warn(`[smbls] \`if:\` evaluator threw on ${x} \u2014 treating as false:`,h?.message||h)}}else u=o.if;i.__if=!!u}if(i.__if)typeof o.if=="function"&&(i.__ifInitialized=!0);else return s&&(s[o.key]=o),typeof o.if=="function"&&St(o,i,o.if),o;o.tag||(o.tag=_t(o)),D("Init",o,r);const _=o.node=tt(o);if(!_)return o;if(o.tag==="fragment"){const h=(o.context?.document||globalThis.document).createComment("");_.appendChild(h),i.__fragmentAnchor=h}D("AttachNode",o,r),_.setAttribute&&o.key&&_.setAttribute("data-key",o.key),_.setAttribute&&o.context?.scopeSelector&&o.context.scopeSelector!==":root"&&o.context.key&&o.key===o.context.key&&_.setAttribute("data-smbls-app",o.context.key),o.id&&_.setAttribute&&(_.id=o.id),Pt(o,r),vt(o),rt(o),wt(o),zt(o);try{Lt(o,r)}catch(u){if(typeof console<"u"&&console.error){const h=o.__ref?.path?.join(".")||o.key||"<root>";console.error(`[smbls] createChildren failed at ${h}:`,u?.message||u,u?.stack?`
2
+ `+u.stack.split(`
3
3
  `).slice(0,6).join(`
4
- `):"")}}if(dt(o,!0),pt(o,s,f),s&&(s[o.key]=o,s.__ref?.__children&&(s.__ref.__children.includes(o.key)||s.__ref.__children.push(o.key))),typeof o.html=="function"&&o.node&&!o.node.innerHTML){const d=o.context?.designSystem;d&&j(d);try{const h=o.html(o,o.state,o.context);h!=null&&typeof h!="function"&&(o.node.innerHTML=h)}catch{}finally{d&&w()}}if(N("Create",o,r),N("Complete",o,r),N("Render",o,r),N("RenderRouter",o,r),xt(o,r),typeof o.onFrame=="function"){const d=o.onFrame,h=o.context?.designSystem,g=()=>{if(o.node){if(o.node.isConnected){h&&j(h);try{d(o,o.state,o.context)}catch(b){console.error("[DOMQL] onFrame error:",b)}finally{h&&w()}}requestAnimationFrame(g)}};requestAnimationFrame(g)}return o}function Ut(t,s,n){const r=!s,f=n.state&&typeof n.state=="object"&&!Array.isArray(n.state)&&Object.keys(n.state).length===0,o=r&&f&&t.context?.state,i=n.state!==void 0&&!o?n.state:t.state&&!F(t.state)?t.state:void 0;if(i==null){if(s?.state)t.state=s.state,q(t,t.state);else if(t.context?.state){const c=t.context.state,e={...c},a=t.context?.polyglot;if(a?.translations){const u=c.lang||a.defaultLang||"en",p=a.translations[u];if(p&&typeof p=="object")for(const y in p)e[y]===void 0&&(e[y]=p[y]);const l=new Set(a.languages||[]);for(const y in a.translations)!l.has(y)&&e[y]===void 0&&(e[y]=a.translations[y])}t.state=F(e)?e:m(e),t.state.__element=t,t.state.root=t.state,q(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),q(t,t.state);return}if(typeof i=="string"){if(t.state=Ct(i,s),t.state&&typeof t.state=="object"&&!F(t.state)){const c=s?.state?.root||s?.state||t.state;Object.defineProperty(t.state,"root",{value:c,enumerable:!1,configurable:!0,writable:!0})}q(t,t.state);return}if(typeof i=="function"){const c=i(t,s?.state);t.state=F(c)?c:m(c||{})}else F(i)?t.state=i:t.state=m({...i});t.state.__element=t,s?.state?(t.state.parent=s.state,t.state.root=s.state.root||s.state):t.state.root=t.state,q(t,t.state)}function it(t,s){if(!s)return t;const n=s.split("/");let r=t;for(const f of n){if(r==null)return{};r=r[f]}return r??{}}function Ct(t,s){if(!s)return{};if(t===".")return s.state||{};if(t.startsWith("../")){const f=t.slice(3);return f?it(s.state,f):s.state??{}}if(t.startsWith("~/")){const f=s.state?.root||s.state,o=t.slice(2);return o?it(f,o):f??{}}if(s.state?.[t]!==void 0)return s.state[t];const n=it(s.state,t);if(n!=null&&Object.keys(n).length>0)return n;const r=s.context?.polyglot;if(r?.translations){const f=s.state?.root?.lang||r.defaultLang||"en",o=r.translations[f];if(o?.[t]!==void 0)return o[t];if(r.translations[t]!==void 0)return r.translations[t]}return{}}function Vt(t){const s=t.__ref,n=t.tag||"div",r=t.context?.designSystem,f=[],o=Object.keys(t);for(let i=0;i<o.length;i++){const c=o[i];if(typeof t[c]!="function"||I.has(c))continue;const e=c.charCodeAt(0);e>=65&&e<=90||W(c)||O[c]||E&&E.has(c)||nt(n,c)||f.push({prop:c,fn:t[c]})}for(let i=0;i<f.length;i++){const{prop:c,fn:e}=f[i];s.__exec[c]=e,Object.defineProperty(t,c,{get(){r&&j(r);try{return e(t,t.state,t.context)}catch{return}finally{r&&w()}},set(a){delete s.__exec[c],Object.defineProperty(t,c,{value:a,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function vt(t,s){const n=t.__ref,r=!!(s&&s.skipIfEffect);if(Vt(t),typeof t.text=="function"){const o=t.text,i=C(()=>{if(!n.contentManaged)try{let c=o(t,t.state,t.context);t.node&&c!=null&&typeof c!="function"&&typeof c!="object"&&(typeof c=="string"&&c.includes("{{")&&(c=ot.call(t,c,t.state)),t.tag==="string"?t.node.nodeValue=c:t.node.textContent=c)}catch{}},{depth:n.path.length});n.__effects.push(i),n.__exec.text=o}else if(typeof t.text=="string"&&t.text.includes("{{")){const o=t.text,i=C(()=>{if(n.contentManaged)return;const c=ot.call(t,o,t.state);c!=null&&(t.text=c),t.node&&(t.tag==="string"?t.node.nodeValue=c??"":t.node.textContent=c??"")},{depth:n.path.length});n.__effects.push(i),n.__exec.text=o}for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)&&typeof t[o]=="function"&&!I.has(o)&&!W(o)&&!n.__exec[o]){if(O[o]){const i=t[o],c=o;let e;const a=C(()=>{const u=t.context?.designSystem;u&&j(u);try{const p=i(t,t.state,t.context),l=O[c](p,t,t.state,t.context);if(l&&t.node){const y=kt(l);(y===null||y!==e)&&(e=y,H(t.node,l))}else t.node&&(c==="show"||c==="hide")&&(e=void 0,t.node.style.display="")}finally{u&&w()}},{depth:n.path.length});n.__effects.push(a),n.__exec[o]=i}else if(E&&E.has(o)){const i=t[o],c=o;let e;const a=C(()=>{const u=t.context?.designSystem;u&&j(u);try{const p=i(t,t.state,t.context);if(t.node)if(p!=null){const l=c+":"+String(p);l!==e&&(e=l,H(t.node,{[c]:p}))}else e=void 0,t.node.style[c]=""}finally{u&&w()}},{depth:n.path.length});n.__effects.push(a),n.__exec[o]=i}}if(typeof t.html=="function"){const o=t.html,i=C(()=>{const c=t.context?.designSystem;c&&j(c);try{const e=o(t,t.state,t.context);t.node&&e!=null&&typeof e!="function"&&(t.node.innerHTML=e)}finally{c&&w()}},{depth:n.path.length});n.__effects.push(i),n.__exec.html=o}if(typeof t.value=="function"){const o=t.value,i=C(()=>{try{const c=o(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const e=c==null?"":String(c);if(t.node.value===e)return;const a=typeof document<"u"&&document.activeElement===t.node,u=a&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,p=a&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=e,a&&u!=null&&p!=null)try{t.node.setSelectionRange(u,p)}catch{}}catch{}},{depth:n.path.length});n.__effects.push(i),n.__exec.value=o}if(typeof t.style=="function"){const o=t.style;let i;const c=C(()=>{const e=o(t,t.state,t.context),a=kt(e);(a===null||a!==i)&&(i=a,H(t.node,e))},{depth:n.path.length});n.__effects.push(c),n.__exec.style=o}else if(t.style&&typeof t.style=="object")for(const o in t.style){const i=t.style[o];if(typeof i!="function")continue;let c;const e=C(()=>{try{const a=i(t,t.state,t.context);if(t.node){const u=o+":"+String(a);u!==c&&(c=u,H(t.node,{[o]:a}))}}catch{}},{depth:n.path.length});n.__effects.push(e)}if(t.attr&&typeof t.attr=="object"){for(const o in t.attr)if(typeof t.attr[o]=="function"){const i=t.attr[o],c=o,e=C(()=>{try{const a=i(t,t.state,t.context);t.node?.setAttribute&&(a==null||a===!1?t.node.removeAttribute(c):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(c,a===!0?"":a))}catch{}},{depth:n.path.length});n.__effects.push(e)}}if(t.aria&&typeof t.aria=="object")for(const o in t.aria){const i=t.aria[o];if(typeof i!="function")continue;const c="aria-"+o.replace(/[A-Z]/g,a=>"-"+a.toLowerCase()),e=C(()=>{try{const a=i(t,t.state,t.context);if(!t.node?.setAttribute)return;a==null||a===!1?t.node.removeAttribute(c):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(c,a===!0?"":a)}catch{}},{depth:n.path.length});n.__effects.push(e)}if(t.data&&typeof t.data=="object")for(const o in t.data){const i=t.data[o];if(typeof i!="function")continue;const e="data-"+o.replace(/[A-Z]/g,u=>"-"+u.toLowerCase()),a=C(()=>{try{const u=i(t,t.state,t.context);if(!t.node?.setAttribute)return;u==null||u===!1?t.node.removeAttribute(e):typeof u!="function"&&typeof u!="object"&&t.node.setAttribute(e,u===!0?"":u)}catch{}},{depth:n.path.length});n.__effects.push(a)}const f=t.classlist&&typeof t.classlist=="object"&&!Array.isArray(t.classlist)?t.classlist:t.class&&typeof t.class=="object"&&!Array.isArray(t.class)?t.class:null;if(f)for(const o in f){const i=f[o];if(typeof i!="function")continue;const c=C(()=>{try{const e=i(t,t.state,t.context);if(!t.node?.classList)return;typeof e=="string"?t.node.classList.add(e):e?t.node.classList.add(o):t.node.classList.remove(o)}catch{}},{depth:n.path.length});n.__effects.push(c)}!r&&typeof t.if=="function"&&St(t,n,t.if);for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||I.has(o)||typeof t[o]!="function")continue;const i=o.charCodeAt(0);if(i>=65&&i<=90||W(o))continue;const c=t[o];n.__exec[o]=c;const e=t.tag||"div";if(nt(e,o)&&!O[o]&&!(E&&E.has(o))){const a=o,u=C(()=>{try{const p=c(t,t.state,t.context);t.node?.setAttribute&&(p==null||p===!1?t.node.removeAttribute(a):typeof p!="function"&&typeof p!="object"&&(a==="src"&&"src"in t.node?t.node.src=p:t.node.setAttribute(a,p===!0?"":p)))}catch{}},{depth:n.path.length});n.__effects.push(u)}}if(Ht(t),Yt(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const o=t.onStateUpdate,i=t.stateDeps;let c=!1,e=[];const a=C(()=>{const u=[];for(let _=0;_<i.length;_++){const d=i[_];try{u[_]=typeof d=="function"?d(t,t.state,t.context):t.state?.[d]}catch{u[_]=void 0}}if(!c){c=!0,e=u;return}let p=u.length!==e.length;for(let _=0;!p&&_<u.length;_++)u[_]!==e[_]&&(p=!0);const l=e;if(e=u,!p)return;const y=t.context?.designSystem;y&&j(y);try{o(t,t.state,t.context,{prev:l,next:u})}catch(_){if(t.context?.plugins?.length&&U("error",t,{hook:"onStateUpdate",error:_})||console.error('[DOMQL] Lifecycle "onStateUpdate" error:',_),t.context?.strictMode)throw _}finally{y&&w()}},{depth:n.path.length});n.__effects.push(a)}}function St(t,s,n){const r=C(()=>{let f;try{f=n(t,t.state,t.context)}catch(i){if(f=!1,s.__ifError=i,typeof console<"u"&&console.warn){const c=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${c} \u2014 treating as false:`,i?.message||i)}return}const o=s.__if;if(s.__if=!!f,o&&!s.__if&&t.node)t.node.remove();else if(!o&&s.__if)if(s.__ifInitialized){t.node||(t.node=tt(t)),t.node&&(t.node.ref=t);const i=t.parent,c=i?.node;if(c&&t.node){let e=null;const a=Object.keys(i),u=a.indexOf(t.key);for(let p=u+1;p<a.length;p++){const l=i[a[p]];if(l?.node?.parentNode===c){e=l.node;break}}e?c.insertBefore(t.node,e):c.appendChild(t.node)}else pt(t,t.parent);rt(t)}else{if(s.__ifInitialized=!0,t.tag||(t.tag=_t(t)),N("Init",t,{}),t.node||(t.node=tt(t)),!t.node)return;if(t.tag==="fragment"&&!s.__fragmentAnchor){const c=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(c),s.__fragmentAnchor=c}N("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),Pt(t,{}),vt(t,{skipIfEffect:!0}),rt(t),wt(t),Lt(t,{}),pt(t,t.parent),xt(t,{})}},{depth:s.path.length});s.__effects.push(r)}function rt(t){const{node:s}=t;if(s){if(typeof t.text=="string"&&!t.text.includes("{{")?t.tag==="string"?s.nodeValue=t.text:s.textContent=t.text:typeof t.text=="number"&&(s.textContent=t.text),qt(t),typeof t.html=="string"&&(s.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&"value"in s){const n=String(t.value);s.value!==n&&(s.value=n)}if(t.style&&typeof t.style=="object"&&H(s,t.style),t.attr&&typeof t.attr=="object")for(const n in t.attr){const r=t.attr[n];typeof r=="function"||typeof r=="object"||r==null||r===!1||s.setAttribute&&s.setAttribute(n,r===!0?"":r)}if(t.data&&typeof t.data=="object")for(const n in t.data){const r=t.data[n];typeof r=="function"||typeof r=="object"||r==null||r===!1||s.dataset&&(s.dataset[n]=r===!0?"":r)}if(t.classlist||t.class){const n=t.classlist||t.class;if(typeof n=="string")n.split(" ").forEach(r=>r&&s.classList.add(r));else if(typeof n=="object")for(const r in n){const f=typeof n[r]=="function"?n[r](t,t.state,t.context):n[r];f&&s.classList.add(typeof f=="string"?f:r)}}}}function kt(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function H(t,s){if(!t||!s||!t.style)return;let n=null;for(const r in s){const f=s[r];if(f!=null){if(r.charAt(0)==="&"&&typeof f=="object"){n||(n={}),n[r]=f;continue}try{const o=String(f),i=r.replace(/[A-Z]/g,u=>"-"+u.toLowerCase()),c=o.trim(),e=/\s*!important\s*$/.test(c),a=c.replace(/\s*!important\s*$/,"");t.style.setProperty(i,a,e?"important":"")}catch{}}}n&&Bt(t,n)}let Wt=0;function Bt(t,s){const n=`_ds${Wt++}`;t.classList.add(n);const r=t.ownerDocument;let f=r.querySelector("style[data-smbls-scoped]");f||(f=r.createElement("style"),f.setAttribute("data-smbls-scoped",""),r.head.appendChild(f));let o="";for(const i in s){const c="."+n,e=i.replace(/&/g,c).split(",").map(u=>{const p=u.trim();return p.includes(c)?p:c+p}).join(", "),a=s[i];if(typeof a=="object"){let u="",p="";for(const l in a){const y=a[l];if(typeof y=="object"){const _=l.includes("&")?e.split(", ").map(h=>l.replace(/&/g,h)).join(", "):e.split(", ").map(h=>`${h} ${l}`).join(", ");let d="";for(const h in y)d+=`${h.replace(/[A-Z]/g,g=>"-"+g.toLowerCase())}: ${y[h]};`;p+=`${_} { ${d} }
5
- `}else u+=`${l.replace(/[A-Z]/g,_=>"-"+_.toLowerCase())}: ${y};`}u&&(o+=`${e} { ${u} }
6
- `),p&&(o+=p)}}o&&(f.textContent+=o)}function Ht(t){const s=t.subscribeTo;if(!Array.isArray(s)||s.length===0)return;const n=t.__ref;for(let r=0;r<s.length;r++){const f=s[r];if(typeof f!="string"||f.length===0)continue;const o=f.split("."),i=o[0],c=o.slice(1),e={value:!1},a=C(()=>{const u=t.state&&(F(t.state)?t.state.root:null);if(!u||!F(u))return;let p=u;p=p[i];for(let y=0;y<c.length&&!(p==null||typeof p!="object");y++)if(F(p))p=p[c[y]];else break;if(!e.value)return;let l=!1;if(typeof t.onBeforeUpdate=="function"){const y=t.context?.designSystem;y&&j(y);try{t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0})===!1&&(l=!0)}catch(_){t.context?.plugins?.length&&U("error",t,{hook:"onBeforeUpdate",error:_})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",_)}finally{y&&w()}}if(!l&&t.node&&n.__effects)for(let y=0;y<n.__effects.length;y++){const _=n.__effects[y];_&&_!==a&&!_._disposed&&!_._isSubscribeToEffect&&typeof _._execute=="function"&&_._execute()}if(!l&&typeof t.onUpdate=="function"){const y=t.context?.designSystem;y&&j(y);try{t.onUpdate(t,t.state,t.context)}catch(_){t.context?.plugins?.length&&U("error",t,{hook:"onUpdate",error:_})||console.error("[DOMQL] subscribeTo onUpdate error:",_)}finally{y&&w()}}},{depth:n.path.length});e.value=!0,a._isSubscribeToEffect=!0,n.__effects.push(a)}}function et(t,s){return t.charCodeAt(0)===64&&t.length>1&&!t.startsWith("@media")&&!t.startsWith("@keyframes")&&!t.startsWith("@supports")&&(t==="@dark"||t==="@light"||!s.context?.designSystem?.media?.[t.slice(1)])}function Y(t,s,n){const r={},f=(o,i)=>{if(O[o]){const c=O[o](i,s,s.state,s.context);if(c){const e=Array.isArray(c)?c:[c];for(const a of e)a&&Object.assign(r,a)}}else r[o]=i};for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;let i=t[o];if(typeof i=="function"&&(i=i(s,s.state,s.context)),!(i==null||typeof i=="function")){if(typeof i=="object"&&!Array.isArray(i)){if(o==="style"){for(const a in i){let u=i[a];typeof u=="function"&&(u=u(s,s.state,s.context)),!(u==null||typeof u=="function")&&f(a,u)}continue}if(et(o,s)){const a=Y(i,s,!0);Object.keys(a).length&&(r[`[data-theme="${o.slice(1)}"] &`]=a);continue}let c=o;if(o.charCodeAt(0)===64&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const a=s.context?.designSystem?.media?.[o.slice(1)];a&&(c=`@media ${a}`)}const e=Y(i,s,!1);Object.keys(e).length&&(r[c]=e);continue}f(o,i)}}if(n)for(const o in r){const i=r[o];typeof i=="string"&&!i.includes("!important")&&(r[o]=i+" !important")}return r}function Yt(t){const s=t.__ref;s.__conditionalRunners=[];const n=new Map;for(const r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;const f=r.charAt(0);if(f!=="."&&f!=="!")continue;const o=r.slice(1);if(!o)continue;const i=t[r];if(!i||typeof i!="object")continue;const c=f==="!",e={lastMatch:!1,appliedKeys:null,appliedClasses:null},a=()=>{if(!t.node)return;let p;const l=t[o];if(l===void 0)if(t.state&&o in t.state)p=t.state[o];else{const d=t.context?.cases?.[o];if(d===void 0)return;try{p=typeof d=="function"?d.call(t,t):d}catch(h){p=!1,s.__conditionalError=h,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${r}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,h?.message||h)}}else if(typeof l=="function")try{p=l(t,t.state,t.context)}catch(d){p=!1,s.__conditionalError=d,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${r}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,d?.message||d)}else p=l;const y=c?!p:!!p;if(y===e.lastMatch)return;e.lastMatch=y;const _=t.context?.designSystem;_&&j(_);try{if(y){const d={},h={};let g=!1;for(const x in i){if(!Object.prototype.hasOwnProperty.call(i,x))continue;const v=i[x],P=x.charAt(0);if((P===":"||P==="@"||P==="&")&&v&&typeof v=="object"&&!Array.isArray(v)){if(et(x,t)){const S=Y(v,t,!0);Object.keys(S).length&&(h[`[data-theme="${x.slice(1)}"] &`]=S,g=!0)}else{let S=x;if(P==="@"&&!x.startsWith("@media")&&!x.startsWith("@keyframes")){const K=t.context?.designSystem?.media?.[x.slice(1)];K&&(S=`@media ${K}`)}const D=Y(v,t,!1);Object.keys(D).length&&(h[S]=D,g=!0)}continue}const M=typeof v=="function"?v(t,t.state,t.context):v;if(M!=null)if(O[x]){const S=O[x](M,t,t.state,t.context);if(S){const D=Array.isArray(S)?S:[S];for(const K of D)K&&Object.assign(d,K)}}else E&&E.has(x)&&(d[x]=M)}const b=Object.keys(d);if(b.length){H(t.node,d);for(const x of b)n.set(x,r);e.appliedKeys=b}else e.appliedKeys=null;if(g){const x=st(h,null,t.context?.cssPrefix),v=x?x.split(" ").filter(Boolean):[];if(v.length&&t.node.classList){for(const P of v)t.node.classList.add(P);e.appliedClasses=v}else e.appliedClasses=null}else if(e.appliedClasses){for(const x of e.appliedClasses)t.node.classList.remove(x);e.appliedClasses=null}}else{if(e.appliedKeys){for(const d of e.appliedKeys)n.get(d)===r&&(t.node.style[d]="",n.delete(d));e.appliedKeys=null}if(e.appliedClasses){for(const d of e.appliedClasses)t.node.classList.remove(d);e.appliedClasses=null}}}finally{_&&w()}};s.__conditionalRunners.push(a);const u=C(a,{depth:s.path.length});s.__effects.push(u)}}const ft=new WeakSet;function Gt(t){const s=t.ownerDocument;!s||ft.has(s)||(ft.add(s),queueMicrotask(()=>{ft.delete(s);const n=s.body||s.documentElement;n&&n.offsetWidth}))}const at=new WeakSet;let jt=!1;function qt(t){const{node:s}=t;if(!s)return;if(jt||(jt=!0,st({display:"none"})),at.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}at.add(t);const n=t.context?.designSystem;n&&j(n);try{const r={};let f=!1;for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||typeof t[o]=="function"||I.has(o))continue;const i=o.charCodeAt(0);if(!(i>=65&&i<=90)&&!W(o)){if(O[o]){const c=t[o],e=O[o](c,t,t.state,t.context);if(e){if(Array.isArray(e))for(const a of e)a&&Object.assign(r,a);else Object.assign(r,e);f=!0}}else if(E&&E.has(o)){const c=t[o];c!=null&&typeof c!="object"&&(r[o]=c,f=!0)}else if(o.charCodeAt(0)===45){const c=t[o];c!=null&&typeof c!="object"&&(r[o]=c,f=!0)}else if(o.charAt(0)==="&"){const c=t[o];c&&typeof c=="object"&&(r[o]=c,f=!0)}else if(o.charAt(0)==="@"||o.charAt(0)===":"){const c=t[o];if(c&&typeof c=="object"){if(et(o,t)){const e=Y(c,t,!0);Object.keys(e).length&&(r[`[data-theme="${o.slice(1)}"] &`]=e,f=!0)}else{let e=o;if(o.charAt(0)==="@"&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const u=t.context?.designSystem?.media?.[o.slice(1)];u&&(e=`@media ${u}`)}const a=Y(c,t,!1);Object.keys(a).length&&(r[e]=a,f=!0)}f=!0}}}}if(f){r.display&&String(r.display).includes("!important")&&(s.style.setProperty("display",String(r.display).replace(/\s*!important\s*$/,""),"important"),delete r.display);const o=st(r,null,t.context?.cssPrefix);if(o&&s.classList){const c=o.split(" ").filter(Boolean);let e=!1;for(const a of c)s.classList.add(a),e||(a.charCodeAt(0)===95&&a.charCodeAt(1)===99||a.charCodeAt(0)===95&&a.indexOf("_c",1)!==-1)&&(e=!0);e&&Gt(s)}const i=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(i!=null){const c=r.display;if(c&&c!==i)if(i==="none"){const e=[];for(const a of s.classList)a.startsWith("_d-")&&a!=="_d-none"&&e.push(a);for(const a of e)s.classList.remove(a);s.classList.add("_d-none")}else s.style.display=t.display}}}finally{n&&w(),at.delete(t)}}function wt(t){const{node:s}=t;if(!s||!s.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const f in t.aria){const o=t.aria[f];if(typeof o=="function"||typeof o=="object"||o==null||o===!1)continue;const i="aria-"+f.replace(/[A-Z]/g,c=>"-"+c.toLowerCase());s.setAttribute(i,o===!0?"":o)}const n=Mt(t);for(const f in n){const o=n[f];o!=null&&o!==!1&&typeof o!="function"&&typeof o!="object"&&s.setAttribute(f,o===!0?"":o)}const r=t.tag||"div";for(const f in t){if(!Object.prototype.hasOwnProperty.call(t,f)||typeof t[f]=="function"||I.has(f)||f==="on"||n[f]!==void 0)continue;const o=f.charCodeAt(0);if(!(o>=65&&o<=90)&&!W(f)&&!(O[f]||E&&E.has(f))&&nt(r,f)){let i=t[f];if(i==null||i===!1||(typeof i=="string"&&i.includes("{{")&&(i=ot(i,t,t.state,t.context),t[f]=i),i==null||i===!1||typeof i=="function"||typeof i=="object"))continue;s.setAttribute(f,i===!0?"":i)}}}function Zt(t){if(!t.autoGrow)return;const s=t.node;if(!s||s.tagName!=="TEXTAREA")return;const n=t.autoGrow,r=n&&typeof n=="object"&&n.max?String(n.max):null;r&&(s.style.maxHeight=r);const f=()=>{s.style.height="auto",s.style.height=s.scrollHeight+"px"};f(),s.addEventListener("input",f),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("input",f)}catch{}})}const Et=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function Pt(t,s){for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n)||!W(n)||Et.has(n))continue;let r=t[n];if(typeof r=="string"&&/^[A-Za-z_$][\w$]*$/.test(r)){const o=r;r=function(c){return t.call(o,c)}}if(typeof r!="function")continue;const f=It(n);Tt.has(f)||$t(Kt(f),t,r)}zt(t)}function zt(t){const s=t.node;if(!s||!s.addEventListener)return;const n={};let r=!1;for(const l of Et){const y=t[l];typeof y=="function"&&(n[l]=y,r=!0)}if(!r)return;const f=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,o=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let i=0,c=0,e=0,a=!1;const u=l=>{const y=l.touches&&l.touches[0]||l.changedTouches&&l.changedTouches[0];y&&(i=y.clientX,c=y.clientY,e=Date.now(),a=!0)},p=l=>{if(!a)return;a=!1;const y=l.changedTouches&&l.changedTouches[0]||l.touches&&l.touches[0];if(!y)return;const _=y.clientX-i,d=y.clientY-c,h=Date.now()-e;if(h>o)return;const g=Math.abs(_),b=Math.abs(d);if(Math.max(g,b)<f)return;let x;if(g>b*1.2)x=_<0?"left":"right";else if(b>g*1.2)x=d<0?"up":"down";else return;const v="onSwipe"+x.charAt(0).toUpperCase()+x.slice(1),P=n[v],M=n.onSwipe;P&&P.call(t,l,t,t.state,t.context),M&&M.call(t,{direction:x,dx:_,dy:d,dt:h,event:l},t,t.state,t.context)};s.addEventListener("touchstart",u,{passive:!0}),s.addEventListener("touchend",p,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("touchstart",u)}catch{}try{s.removeEventListener("touchend",p)}catch{}})}function X(t,s){const n={...t};for(const r in s){const f=n[r],o=s[r];f&&o&&typeof f=="object"&&typeof o=="object"&&!Array.isArray(f)&&!Array.isArray(o)&&typeof f!="function"&&typeof o!="function"?n[r]=X(f,o):n[r]=o}return n}function ut(t,s,n){if(!s||!t.node)return;const r=t.childExtends;if(Array.isArray(s)){const f=t.tag==="fragment",o=t.context?.document||globalThis.document,i=f?null:o?.createDocumentFragment();if(!f&&!i)return;const c=t.childProps,e=t.childrenAs;for(let a=0;a<s.length;a++){let u=s[a];const p=u;(typeof u=="string"||typeof u=="number")&&(u={text:u});let l=c;if(typeof c=="function")try{l=c(t,u)}catch{l=null}if(e==="state"){let d=p;(typeof p=="string"||typeof p=="number")&&(d={value:p,text:p}),u=l?{...l,state:d}:{state:d}}else l&&(u=X(l,u));if(r&&!u.ignoreChildExtends)if(u.extends){const d=Array.isArray(u.extends)?u.extends:[u.extends],h=Array.isArray(r)?r:[r];u={...u,extends:[...h,...d]}}else u={...u,extends:r};const y=u?.key||p&&typeof p=="object"&&p.key||`${a}`,_=B(u,t,y,n);!f&&_?.node&&i.appendChild(_.node)}f||t.node.appendChild(i);return}if(typeof s=="string"){const f=Ct(s,t);if(Array.isArray(f)){ut(t,f,n);return}}if(typeof s=="object")for(const f in s){if(I.has(f))continue;let o=s[f];if(!(o==null||o===!1)){if((typeof o=="string"||typeof o=="number")&&(o={text:o}),t.childProps&&(o=X(t.childProps,o)),r&&!o.ignoreChildExtends)if(o.extends){const i=Array.isArray(o.extends)?o.extends:[o.extends],c=Array.isArray(r)?r:[r];o={...o,extends:[...c,...i]}}else o={...o,extends:r};B(o,t,f,n)}}}function dt(t,s){const n=t.node;if(!n||n.tagName!=="SELECT")return;const r=n.options;if(!r||!r.length)return;const f=t.__ref,o=f&&f.__exec&&f.__exec.value,i=typeof o=="function",c=t.value!=null&&typeof t.value!="function";if(i||c){let u;if(i)try{u=o(t,t.state,t.context)}catch{return}else u=t.value;const p=u==null?"":String(u);n.value!==p&&(n.value=p);return}const e=s||!(f&&f.__selectSynced);if(f&&(f.__selectSynced=!0),!e)return;let a=-1;for(let u=0;u<r.length;u++)r[u].defaultSelected&&(a=u);a>=0&&n.selectedIndex!==a&&(n.selectedIndex=a)}function Lt(t,s){let{children:n,content:r}=t;const f=t.childExtends;if(typeof n=="function"){const i=n;n=i(t,t.state,t.context),t.children=n;const c=t.__ref;let e=!1;const a=C(()=>{const u=i(t,t.state,t.context);if(!e){e=!0;return}if(u===t.children)return;t.children=u;const p=typeof t.onContentUpdate=="function",l=p?[]:null,y=p?[]:null,_=p?[]:null;if(Array.isArray(u)&&t.childrenAs==="state"){const b=t.childProps,x=[],v=new Map;for(let k=0;k<u.length;k++){const T=u[k];let A=b;if(typeof b=="function")try{A=b(t,T)}catch{A=null}const V=A&&A.key||T&&T.key||`${k}`;x.push(V),v.set(V,{rawChild:T,childProps:A})}const P=new Set(x),M=c.__children.slice();for(const k of M)if(!P.has(k)){const T=t[k];T?.remove&&T.remove(),delete t[k],y&&y.push(k)}const S=t.childExtends,D=t.tag==="fragment",K=t.context?.document||globalThis.document,G=D?null:K?.createDocumentFragment();for(const k of x){const T=v.get(k),A=T.rawChild,V=t[k];if(V&&V.state){if(A&&typeof A=="object"){const L=V.state,z=L.$replace||L.replace,ht=L.$update||L.update;if(typeof z=="function")z.call(L,A);else if(typeof ht=="function"){for(const R in L)if(!(R==="__element"||R==="root"||R==="parent"||R==="update")&&!Object.prototype.hasOwnProperty.call(A,R))try{L[R]=void 0}catch{}ht.call(L,A)}else for(const R in A)L[R]=A[R]}_&&_.push(k);continue}let J=A;(typeof A=="string"||typeof A=="number")&&(J={value:A,text:A});const lt=T.childProps;let $=lt?{...lt,state:J}:{state:J};if(S&&!$.ignoreChildExtends)if($.extends){const L=Array.isArray($.extends)?$.extends:[$.extends],z=Array.isArray(S)?S:[S];$={...$,extends:[...z,...L]}}else $={...$,extends:S};const yt=B($,t,k,s);!D&&yt?.node&&G&&G.appendChild(yt.node),l&&l.push(k)}!D&&G&&G.childNodes.length&&t.node&&t.node.appendChild(G),c.__children=x,p&&(l.length||y.length)&&bt(t,{added:l,removed:y,kept:_}),dt(t,!1);return}const g=p?[...c.__children]:null;for(const b of[...c.__children]){const x=t[b];x?.remove&&x.remove(),delete t[b]}c.__children=[],ut(t,u,s),dt(t,!1),p&&bt(t,{added:[...c.__children],removed:g,kept:[]})},{depth:c.path.length});c.__effects.push(a)}if(ut(t,n||r,s),n||r)return;const o=t.context?.components||{};{const i=Object.keys(t);for(let c=0;c<i.length;c++){const e=i[c];if(!e.endsWith("Extends")||typeof t[e]!="string")continue;const a=e.slice(0,-7);if(!a||a.charCodeAt(0)<65||a.charCodeAt(0)>90)continue;const u={extends:t[e]};delete t[e];for(let p=c+1;p<i.length;p++){const l=i[p],y=l.charCodeAt(0);if(y>=65&&y<=90||I.has(l)||typeof t[l]=="function"&&(l.startsWith("on")||l.startsWith(".")))break;const _=t[l];_!==void 0&&(u[l]=_,delete t[l])}t[a]&&typeof t[a]=="object"?t[a]={...u,...t[a]}:t[a]=u}}for(const i in t){if(!Object.prototype.hasOwnProperty.call(t,i)||I.has(i)||typeof t[i]!="object"||t[i]===null)continue;const c=i.charCodeAt(0);if(c<65||c>90)continue;let e=t[i];if(!e.__ref){if(!e.extends&&!e.extend){const a=o[i]||o[`smbls.${i}`];a&&(e={...e,extends:a})}if(t.childProps&&(e=X(t.childProps,e)),f&&!e.ignoreChildExtends)if(e.extends){const a=Array.isArray(e.extends)?e.extends:[e.extends],u=Array.isArray(f)?f:[f];e={...e,extends:[...u,...a]}}else e={...e,extends:f};B(e,t,i,s)}}}function pt(t,s,n){const{node:r}=t;if(!r)return;r.ref=t;const f=s?.tag==="fragment"?s.__ref?.__fragmentAnchor:null;if(f){const i=f.parentNode;if(i){if(n?.position==="before"&&n.node)i.insertBefore(r,n.node);else if(n?.position==="after"&&n.node){const c=n.node.nextSibling;i.insertBefore(r,c||f)}else i.insertBefore(r,f);return}}const o=s?.node||(s?.nodeType?s:null);if(o)if(n?.position==="before"&&n.node)o.insertBefore(r,n.node);else if(n?.position==="after"&&n.node){const i=n.node.nextSibling;i?o.insertBefore(r,i):o.appendChild(r)}else o.appendChild(r)}function N(t,s,n){const r=t.charAt(0).toLowerCase()+t.slice(1);s.context?.plugins?.length&&U(r,s,n);const f="on"+t,o=s[f];if(typeof o=="function"){const i=t==="Render"||t==="RenderRouter";if(i){if(s.__ref.__inRender)return!0;s.__ref.__inRender=!0}const c=s.context?.designSystem;c&&j(c);try{if(o(s,s.state,s.context,n)===!1)return!1}catch(e){if(s.context?.plugins?.length&&U("error",s,{hook:f,error:e})||console.error(`[DOMQL] Lifecycle "${f}" error:`,e),s.context?.strictMode)throw e}finally{c&&w(),i&&(s.__ref.__inRender=!1)}}return!0}var _o=B;export{B as create,_o as default,gt as flushMounts};
4
+ `):"")}}if(ut(o,!0),pt(o,s,f),s&&(s[o.key]=o,s.__ref?.__children&&(s.__ref.__children.includes(o.key)||s.__ref.__children.push(o.key))),typeof o.html=="function"&&o.node&&!o.node.innerHTML){const u=o.context?.designSystem;u&&j(u);try{const h=o.html(o,o.state,o.context);h!=null&&typeof h!="function"&&(o.node.innerHTML=h)}catch{}finally{u&&w()}}if(D("Create",o,r),D("Complete",o,r),D("Render",o,r),D("RenderRouter",o,r),xt(o,r),typeof o.onFrame=="function"){const u=o.onFrame,h=o.context?.designSystem,x=()=>{if(o.node){if(o.node.isConnected){h&&j(h);try{u(o,o.state,o.context)}catch(b){console.error("[DOMQL] onFrame error:",b)}finally{h&&w()}}requestAnimationFrame(x)}};requestAnimationFrame(x)}return o}function Vt(t,s,n){const r=!s,f=n.state&&typeof n.state=="object"&&!Array.isArray(n.state)&&Object.keys(n.state).length===0,o=r&&f&&t.context?.state,i=n.state!==void 0&&!o?n.state:t.state&&!I(t.state)?t.state:void 0;if(i==null){if(s?.state)t.state=s.state,q(t,t.state);else if(t.context?.state){const c=t.context.state,e={...c},a=t.context?.polyglot;if(a?.translations){const d=c.lang||a.defaultLang||"en",p=a.translations[d];if(p&&typeof p=="object")for(const y in p)e[y]===void 0&&(e[y]=p[y]);const l=new Set(a.languages||[]);for(const y in a.translations)!l.has(y)&&e[y]===void 0&&(e[y]=a.translations[y])}t.state=I(e)?e:m(e),t.state.__element=t,t.state.root=t.state,q(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),q(t,t.state);return}if(typeof i=="string"){if(t.state=Ct(i,s),t.state&&typeof t.state=="object"&&!I(t.state)){const c=s?.state?.root||s?.state||t.state;Object.defineProperty(t.state,"root",{value:c,enumerable:!1,configurable:!0,writable:!0})}q(t,t.state);return}if(typeof i=="function"){const c=i(t,s?.state);t.state=I(c)?c:m(c||{})}else I(i)?t.state=i:t.state=m({...i});t.state.__element=t,s?.state?(t.state.parent=s.state,t.state.root=s.state.root||s.state):t.state.root=t.state,q(t,t.state)}function it(t,s){if(!s)return t;const n=s.split("/");let r=t;for(const f of n){if(r==null)return{};r=r[f]}return r??{}}function Ct(t,s){if(!s)return{};if(t===".")return s.state||{};if(t.startsWith("../")){const f=t.slice(3);return f?it(s.state,f):s.state??{}}if(t.startsWith("~/")){const f=s.state?.root||s.state,o=t.slice(2);return o?it(f,o):f??{}}if(s.state?.[t]!==void 0)return s.state[t];const n=it(s.state,t);if(n!=null&&Object.keys(n).length>0)return n;const r=s.context?.polyglot;if(r?.translations){const f=s.state?.root?.lang||r.defaultLang||"en",o=r.translations[f];if(o?.[t]!==void 0)return o[t];if(r.translations[t]!==void 0)return r.translations[t]}return{}}function Wt(t){const s=t.__ref,n=t.tag||"div",r=t.context?.designSystem,f=[],o=Object.keys(t);for(let i=0;i<o.length;i++){const c=o[i];if(typeof t[c]!="function"||K.has(c))continue;const e=c.charCodeAt(0);e>=65&&e<=90||W(c)||T[c]||P&&P.has(c)||nt(n,c)||f.push({prop:c,fn:t[c]})}for(let i=0;i<f.length;i++){const{prop:c,fn:e}=f[i];s.__exec[c]=e,Object.defineProperty(t,c,{get(){r&&j(r);try{return e(t,t.state,t.context)}catch{return}finally{r&&w()}},set(a){delete s.__exec[c],Object.defineProperty(t,c,{value:a,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function vt(t,s){const n=t.__ref,r=!!(s&&s.skipIfEffect);if(Wt(t),typeof t.text=="function"){const o=t.text,i=v(()=>{if(!n.contentManaged)try{let c=o(t,t.state,t.context);t.node&&c!=null&&typeof c!="function"&&typeof c!="object"&&(typeof c=="string"&&c.includes("{{")&&(c=ot.call(t,c,t.state)),t.tag==="string"?t.node.nodeValue=c:t.node.textContent=c)}catch{}},{depth:n.path.length});n.__effects.push(i),n.__exec.text=o}else if(typeof t.text=="string"&&t.text.includes("{{")){const o=t.text,i=v(()=>{if(n.contentManaged)return;const c=ot.call(t,o,t.state);c!=null&&(t.text=c),t.node&&(t.tag==="string"?t.node.nodeValue=c??"":t.node.textContent=c??"")},{depth:n.path.length});n.__effects.push(i),n.__exec.text=o}for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)&&typeof t[o]=="function"&&!K.has(o)&&!W(o)&&!n.__exec[o]){if(T[o]){const i=t[o],c=o;let e;const a=v(()=>{const d=t.context?.designSystem;d&&j(d);try{const p=i(t,t.state,t.context),l=T[c](p,t,t.state,t.context);if(l&&t.node){const y=kt(l);(y===null||y!==e)&&(e=y,H(t.node,l))}else t.node&&(c==="show"||c==="hide")&&(e=void 0,t.node.style.display="")}finally{d&&w()}},{depth:n.path.length});n.__effects.push(a),n.__exec[o]=i}else if(P&&P.has(o)){const i=t[o],c=o;let e;const a=v(()=>{const d=t.context?.designSystem;d&&j(d);try{const p=i(t,t.state,t.context);if(t.node)if(p!=null){const l=c+":"+String(p);l!==e&&(e=l,H(t.node,{[c]:p}))}else e=void 0,t.node.style[c]=""}finally{d&&w()}},{depth:n.path.length});n.__effects.push(a),n.__exec[o]=i}}if(typeof t.html=="function"){const o=t.html,i=v(()=>{const c=t.context?.designSystem;c&&j(c);try{const e=o(t,t.state,t.context);t.node&&e!=null&&typeof e!="function"&&(t.node.innerHTML=e)}finally{c&&w()}},{depth:n.path.length});n.__effects.push(i),n.__exec.html=o}if(typeof t.value=="function"){const o=t.value,i=v(()=>{try{const c=o(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const e=c==null?"":String(c);if(t.node.value===e)return;const a=typeof document<"u"&&document.activeElement===t.node,d=a&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,p=a&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=e,a&&d!=null&&p!=null)try{t.node.setSelectionRange(d,p)}catch{}}catch{}},{depth:n.path.length});n.__effects.push(i),n.__exec.value=o}if(typeof t.style=="function"){const o=t.style;let i;const c=v(()=>{const e=o(t,t.state,t.context),a=kt(e);(a===null||a!==i)&&(i=a,H(t.node,e))},{depth:n.path.length});n.__effects.push(c),n.__exec.style=o}else if(t.style&&typeof t.style=="object")for(const o in t.style){const i=t.style[o];if(typeof i!="function")continue;let c;const e=v(()=>{try{const a=i(t,t.state,t.context);if(t.node){const d=o+":"+String(a);d!==c&&(c=d,H(t.node,{[o]:a}))}}catch{}},{depth:n.path.length});n.__effects.push(e)}if(t.attr&&typeof t.attr=="object"){for(const o in t.attr)if(typeof t.attr[o]=="function"){const i=t.attr[o],c=o,e=v(()=>{try{const a=i(t,t.state,t.context);t.node?.setAttribute&&(a==null||a===!1?t.node.removeAttribute(c):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(c,a===!0?"":a))}catch{}},{depth:n.path.length});n.__effects.push(e)}}if(t.aria&&typeof t.aria=="object")for(const o in t.aria){const i=t.aria[o];if(typeof i!="function")continue;const c="aria-"+o.replace(/[A-Z]/g,a=>"-"+a.toLowerCase()),e=v(()=>{try{const a=i(t,t.state,t.context);if(!t.node?.setAttribute)return;a==null||a===!1?t.node.removeAttribute(c):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(c,a===!0?"":a)}catch{}},{depth:n.path.length});n.__effects.push(e)}if(t.data&&typeof t.data=="object")for(const o in t.data){const i=t.data[o];if(typeof i!="function")continue;const e="data-"+o.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),a=v(()=>{try{const d=i(t,t.state,t.context);if(!t.node?.setAttribute)return;d==null||d===!1?t.node.removeAttribute(e):typeof d!="function"&&typeof d!="object"&&t.node.setAttribute(e,d===!0?"":d)}catch{}},{depth:n.path.length});n.__effects.push(a)}const f=t.classlist&&typeof t.classlist=="object"&&!Array.isArray(t.classlist)?t.classlist:t.class&&typeof t.class=="object"&&!Array.isArray(t.class)?t.class:null;if(f)for(const o in f){const i=f[o];if(typeof i!="function")continue;const c=v(()=>{try{const e=i(t,t.state,t.context);if(!t.node?.classList)return;typeof e=="string"?t.node.classList.add(e):e?t.node.classList.add(o):t.node.classList.remove(o)}catch{}},{depth:n.path.length});n.__effects.push(c)}!r&&typeof t.if=="function"&&St(t,n,t.if);for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||K.has(o)||typeof t[o]!="function")continue;const i=o.charCodeAt(0);if(i>=65&&i<=90||W(o))continue;const c=t[o];n.__exec[o]=c;const e=t.tag||"div";if(nt(e,o)&&!T[o]&&!(P&&P.has(o))){const a=o,d=v(()=>{try{const p=c(t,t.state,t.context);t.node?.setAttribute&&(p==null||p===!1?t.node.removeAttribute(a):typeof p!="function"&&typeof p!="object"&&(a==="src"&&"src"in t.node?t.node.src=p:t.node.setAttribute(a,p===!0?"":p)))}catch{}},{depth:n.path.length});n.__effects.push(d)}}if(Yt(t),Gt(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const o=t.onStateUpdate,i=t.stateDeps;let c=!1,e=[];const a=v(()=>{const d=[];for(let _=0;_<i.length;_++){const u=i[_];try{d[_]=typeof u=="function"?u(t,t.state,t.context):t.state?.[u]}catch{d[_]=void 0}}if(!c){c=!0,e=d;return}let p=d.length!==e.length;for(let _=0;!p&&_<d.length;_++)d[_]!==e[_]&&(p=!0);const l=e;if(e=d,!p)return;const y=t.context?.designSystem;y&&j(y);try{o(t,t.state,t.context,{prev:l,next:d})}catch(_){if(t.context?.plugins?.length&&V("error",t,{hook:"onStateUpdate",error:_})||console.error('[DOMQL] Lifecycle "onStateUpdate" error:',_),t.context?.strictMode)throw _}finally{y&&w()}},{depth:n.path.length});n.__effects.push(a)}}function St(t,s,n){const r=v(()=>{let f;try{f=n(t,t.state,t.context)}catch(i){if(f=!1,s.__ifError=i,typeof console<"u"&&console.warn){const c=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${c} \u2014 treating as false:`,i?.message||i)}return}const o=s.__if;if(s.__if=!!f,o&&!s.__if&&t.node)t.node.remove();else if(!o&&s.__if)if(s.__ifInitialized){t.node||(t.node=tt(t)),t.node&&(t.node.ref=t);const i=t.parent,c=i?.node;if(c&&t.node){let e=null;const a=Object.keys(i),d=a.indexOf(t.key);for(let p=d+1;p<a.length;p++){const l=i[a[p]];if(l?.node?.parentNode===c){e=l.node;break}}e?c.insertBefore(t.node,e):c.appendChild(t.node)}else pt(t,t.parent);rt(t)}else{if(s.__ifInitialized=!0,t.tag||(t.tag=_t(t)),D("Init",t,{}),t.node||(t.node=tt(t)),!t.node)return;if(t.tag==="fragment"&&!s.__fragmentAnchor){const c=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(c),s.__fragmentAnchor=c}D("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),Pt(t,{}),vt(t,{skipIfEffect:!0}),rt(t),wt(t),Lt(t,{}),pt(t,t.parent),xt(t,{})}},{depth:s.path.length});s.__effects.push(r)}function rt(t){const{node:s}=t;if(s){if(typeof t.text=="string"&&!t.text.includes("{{")?t.tag==="string"?s.nodeValue=t.text:s.textContent=t.text:typeof t.text=="number"&&(s.textContent=t.text),Zt(t),typeof t.html=="string"&&(s.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&"value"in s){const n=String(t.value);s.value!==n&&(s.value=n)}if(t.style&&typeof t.style=="object"&&H(s,t.style),t.attr&&typeof t.attr=="object")for(const n in t.attr){const r=t.attr[n];typeof r=="function"||typeof r=="object"||r==null||r===!1||s.setAttribute&&s.setAttribute(n,r===!0?"":r)}if(t.data&&typeof t.data=="object")for(const n in t.data){const r=t.data[n];typeof r=="function"||typeof r=="object"||r==null||r===!1||s.dataset&&(s.dataset[n]=r===!0?"":r)}if(t.classlist||t.class){const n=t.classlist||t.class;if(typeof n=="string")n.split(" ").forEach(r=>r&&s.classList.add(r));else if(typeof n=="object")for(const r in n){const f=typeof n[r]=="function"?n[r](t,t.state,t.context):n[r];f&&s.classList.add(typeof f=="string"?f:r)}}}}function kt(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function H(t,s){if(!t||!s||!t.style)return;let n=null;for(const r in s){const f=s[r];if(f!=null){if(r.charAt(0)==="&"&&typeof f=="object"){n||(n={}),n[r]=f;continue}try{const o=String(f),i=r.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),c=o.trim(),e=/\s*!important\s*$/.test(c),a=c.replace(/\s*!important\s*$/,"");t.style.setProperty(i,a,e?"important":"")}catch{}}}n&&Ht(t,n)}let Bt=0;function Ht(t,s){const n=`_ds${Bt++}`;t.classList.add(n);const r=t.ownerDocument;let f=r.querySelector("style[data-smbls-scoped]");f||(f=r.createElement("style"),f.setAttribute("data-smbls-scoped",""),r.head.appendChild(f));let o="";for(const i in s){const c="."+n,e=i.replace(/&/g,c).split(",").map(d=>{const p=d.trim();return p.includes(c)?p:c+p}).join(", "),a=s[i];if(typeof a=="object"){let d="",p="";for(const l in a){const y=a[l];if(typeof y=="object"){const _=l.includes("&")?e.split(", ").map(h=>l.replace(/&/g,h)).join(", "):e.split(", ").map(h=>`${h} ${l}`).join(", ");let u="";for(const h in y)u+=`${h.replace(/[A-Z]/g,x=>"-"+x.toLowerCase())}: ${y[h]};`;p+=`${_} { ${u} }
5
+ `}else d+=`${l.replace(/[A-Z]/g,_=>"-"+_.toLowerCase())}: ${y};`}d&&(o+=`${e} { ${d} }
6
+ `),p&&(o+=p)}}o&&(f.textContent+=o)}function Yt(t){const s=t.subscribeTo;if(!Array.isArray(s)||s.length===0)return;const n=t.__ref;for(let r=0;r<s.length;r++){const f=s[r];if(typeof f!="string"||f.length===0)continue;const o=f.split("."),i=o[0],c=o.slice(1),e={value:!1},a=v(()=>{const d=t.state&&(I(t.state)?t.state.root:null);if(!d||!I(d))return;let p=d;p=p[i];for(let y=0;y<c.length&&!(p==null||typeof p!="object");y++)if(I(p))p=p[c[y]];else break;if(!e.value)return;let l=!1;if(typeof t.onBeforeUpdate=="function"){const y=t.context?.designSystem;y&&j(y);try{t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0})===!1&&(l=!0)}catch(_){t.context?.plugins?.length&&V("error",t,{hook:"onBeforeUpdate",error:_})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",_)}finally{y&&w()}}if(!l&&t.node&&n.__effects)for(let y=0;y<n.__effects.length;y++){const _=n.__effects[y];_&&_!==a&&!_._disposed&&!_._isSubscribeToEffect&&typeof _._execute=="function"&&_._execute()}if(!l&&typeof t.onUpdate=="function"){const y=t.context?.designSystem;y&&j(y);try{t.onUpdate(t,t.state,t.context)}catch(_){t.context?.plugins?.length&&V("error",t,{hook:"onUpdate",error:_})||console.error("[DOMQL] subscribeTo onUpdate error:",_)}finally{y&&w()}}},{depth:n.path.length});e.value=!0,a._isSubscribeToEffect=!0,n.__effects.push(a)}}function et(t,s){return t.charCodeAt(0)===64&&t.length>1&&!t.startsWith("@media")&&!t.startsWith("@keyframes")&&!t.startsWith("@supports")&&(t==="@dark"||t==="@light"||!s.context?.designSystem?.media?.[t.slice(1)])}function Y(t,s,n){const r={},f=(o,i)=>{if(T[o]){const c=T[o](i,s,s.state,s.context);if(c){const e=Array.isArray(c)?c:[c];for(const a of e)a&&Object.assign(r,a)}}else r[o]=i};for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;let i=t[o];if(typeof i=="function"&&(i=i(s,s.state,s.context)),!(i==null||typeof i=="function")){if(typeof i=="object"&&!Array.isArray(i)){if(o==="style"){for(const a in i){let d=i[a];typeof d=="function"&&(d=d(s,s.state,s.context)),!(d==null||typeof d=="function")&&f(a,d)}continue}if(et(o,s)){const a=Y(i,s,!0);Object.keys(a).length&&(r[`[data-theme="${o.slice(1)}"] &`]=a);continue}let c=o;if(o.charCodeAt(0)===64&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const a=s.context?.designSystem?.media?.[o.slice(1)];a&&(c=`@media ${a}`)}const e=Y(i,s,!1);Object.keys(e).length&&(r[c]=e);continue}f(o,i)}}if(n)for(const o in r){const i=r[o];typeof i=="string"&&!i.includes("!important")&&(r[o]=i+" !important")}return r}function Gt(t){const s=t.__ref;s.__conditionalRunners=[];const n=new Map;for(const r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;const f=r.charAt(0);if(f!=="."&&f!=="!")continue;const o=r.slice(1);if(!o)continue;const i=t[r];if(!i||typeof i!="object")continue;const c=f==="!",e={lastMatch:!1,appliedKeys:null,appliedClasses:null},a=()=>{if(!t.node)return;let p;const l=t[o];if(l===void 0)if(t.state&&o in t.state)p=t.state[o];else{const u=t.context?.cases?.[o];if(u===void 0)return;try{p=typeof u=="function"?u.call(t,t):u}catch(h){p=!1,s.__conditionalError=h,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${r}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,h?.message||h)}}else if(typeof l=="function")try{p=l(t,t.state,t.context)}catch(u){p=!1,s.__conditionalError=u,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${r}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,u?.message||u)}else p=l;const y=c?!p:!!p;if(y===e.lastMatch)return;e.lastMatch=y;const _=t.context?.designSystem;_&&j(_);try{if(y){const u={},h={};let x=!1;for(const g in i){if(!Object.prototype.hasOwnProperty.call(i,g))continue;const S=i[g],L=g.charAt(0);if((L===":"||L==="@"||L==="&")&&S&&typeof S=="object"&&!Array.isArray(S)){if(et(g,t)){const k=Y(S,t,!0);Object.keys(k).length&&(h[`[data-theme="${g.slice(1)}"] &`]=k,x=!0)}else{let k=g;if(L==="@"&&!g.startsWith("@media")&&!g.startsWith("@keyframes")){const U=t.context?.designSystem?.media?.[g.slice(1)];U&&(k=`@media ${U}`)}const $=Y(S,t,!1);Object.keys($).length&&(h[k]=$,x=!0)}continue}const F=typeof S=="function"?S(t,t.state,t.context):S;if(F!=null)if(T[g]){const k=T[g](F,t,t.state,t.context);if(k){const $=Array.isArray(k)?k:[k];for(const U of $)U&&Object.assign(u,U)}}else P&&P.has(g)&&(u[g]=F)}const b=Object.keys(u);if(b.length){H(t.node,u);for(const g of b)n.set(g,r);e.appliedKeys=b}else e.appliedKeys=null;if(x){const g=st(h,null,t.context?.cssPrefix),S=g?g.split(" ").filter(Boolean):[];if(S.length&&t.node.classList){for(const L of S)t.node.classList.add(L);e.appliedClasses=S}else e.appliedClasses=null}else if(e.appliedClasses){for(const g of e.appliedClasses)t.node.classList.remove(g);e.appliedClasses=null}}else{if(e.appliedKeys){for(const u of e.appliedKeys)n.get(u)===r&&(t.node.style[u]="",n.delete(u));e.appliedKeys=null}if(e.appliedClasses){for(const u of e.appliedClasses)t.node.classList.remove(u);e.appliedClasses=null}}}finally{_&&w()}};s.__conditionalRunners.push(a);const d=v(a,{depth:s.path.length});s.__effects.push(d)}}const ft=new WeakSet;function qt(t){const s=t.ownerDocument;!s||ft.has(s)||(ft.add(s),queueMicrotask(()=>{ft.delete(s);const n=s.body||s.documentElement;n&&n.offsetWidth}))}const at=new WeakSet;let jt=!1;function Zt(t){const{node:s}=t;if(!s)return;if(jt||(jt=!0,st({display:"none"})),at.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}at.add(t);const n=t.context?.designSystem;n&&j(n);try{const r={};let f=!1;for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||typeof t[o]=="function"||K.has(o))continue;const i=o.charCodeAt(0);if(!(i>=65&&i<=90)&&!W(o)){if(T[o]){const c=t[o],e=T[o](c,t,t.state,t.context);if(e){if(Array.isArray(e))for(const a of e)a&&Object.assign(r,a);else Object.assign(r,e);f=!0}}else if(P&&P.has(o)){const c=t[o];c!=null&&typeof c!="object"&&(r[o]=c,f=!0)}else if(o.charCodeAt(0)===45){const c=t[o];c!=null&&typeof c!="object"&&(r[o]=c,f=!0)}else if(o.charAt(0)==="&"){const c=t[o];c&&typeof c=="object"&&(r[o]=c,f=!0)}else if(o.charAt(0)==="@"||o.charAt(0)===":"){const c=t[o];if(c&&typeof c=="object"){if(et(o,t)){const e=Y(c,t,!0);Object.keys(e).length&&(r[`[data-theme="${o.slice(1)}"] &`]=e,f=!0)}else{let e=o;if(o.charAt(0)==="@"&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const d=t.context?.designSystem?.media?.[o.slice(1)];d&&(e=`@media ${d}`)}const a=Y(c,t,!1);Object.keys(a).length&&(r[e]=a,f=!0)}f=!0}}}}if(f){r.display&&String(r.display).includes("!important")&&(s.style.setProperty("display",String(r.display).replace(/\s*!important\s*$/,""),"important"),delete r.display);const o=st(r,null,t.context?.cssPrefix);if(o&&s.classList){const c=o.split(" ").filter(Boolean);let e=!1;for(const a of c)s.classList.add(a),e||(a.charCodeAt(0)===95&&a.charCodeAt(1)===99||a.charCodeAt(0)===95&&a.indexOf("_c",1)!==-1)&&(e=!0);e&&qt(s)}const i=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(i!=null){const c=r.display;if(c&&c!==i)if(i==="none"){const e=[];for(const a of s.classList)a.startsWith("_d-")&&a!=="_d-none"&&e.push(a);for(const a of e)s.classList.remove(a);s.classList.add("_d-none")}else s.style.display=t.display}}}finally{n&&w(),at.delete(t)}}function wt(t){const{node:s}=t;if(!s||!s.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const f in t.aria){const o=t.aria[f];if(typeof o=="function"||typeof o=="object"||o==null||o===!1)continue;const i="aria-"+f.replace(/[A-Z]/g,c=>"-"+c.toLowerCase());s.setAttribute(i,o===!0?"":o)}const n=Dt(t);for(const f in n){const o=n[f];o!=null&&o!==!1&&typeof o!="function"&&typeof o!="object"&&s.setAttribute(f,o===!0?"":o)}const r=t.tag||"div";for(const f in t){if(!Object.prototype.hasOwnProperty.call(t,f)||typeof t[f]=="function"||K.has(f)||f==="on"||n[f]!==void 0)continue;const o=f.charCodeAt(0);if(!(o>=65&&o<=90)&&!W(f)&&!(T[f]||P&&P.has(f))&&nt(r,f)){let i=t[f];if(i==null||i===!1||(typeof i=="string"&&i.includes("{{")&&(i=ot(i,t,t.state,t.context),t[f]=i),i==null||i===!1||typeof i=="function"||typeof i=="object"))continue;s.setAttribute(f,i===!0?"":i)}}}function zt(t){if(!t.autoGrow)return;const s=t.node;if(!s||s.tagName!=="TEXTAREA")return;const n=t.autoGrow,r=n&&typeof n=="object"&&n.max?String(n.max):null;r&&(s.style.maxHeight=r);const f=()=>{s.style.height="auto",s.style.height=s.scrollHeight+"px"};f(),s.addEventListener("input",f),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("input",f)}catch{}})}const Et=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function Pt(t,s){for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n)||!W(n)||Et.has(n))continue;let r=t[n];if(typeof r=="string"&&/^[A-Za-z_$][\w$]*$/.test(r)){const o=r;r=function(c){return t.call(o,c)}}if(typeof r!="function")continue;const f=Kt(n);Tt.has(f)||Rt(Ut(f),t,r)}Qt(t)}function Qt(t){const s=t.node;if(!s||!s.addEventListener)return;const n={};let r=!1;for(const l of Et){const y=t[l];typeof y=="function"&&(n[l]=y,r=!0)}if(!r)return;const f=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,o=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let i=0,c=0,e=0,a=!1;const d=l=>{const y=l.touches&&l.touches[0]||l.changedTouches&&l.changedTouches[0];y&&(i=y.clientX,c=y.clientY,e=Date.now(),a=!0)},p=l=>{if(!a)return;a=!1;const y=l.changedTouches&&l.changedTouches[0]||l.touches&&l.touches[0];if(!y)return;const _=y.clientX-i,u=y.clientY-c,h=Date.now()-e;if(h>o)return;const x=Math.abs(_),b=Math.abs(u);if(Math.max(x,b)<f)return;let g;if(x>b*1.2)g=_<0?"left":"right";else if(b>x*1.2)g=u<0?"up":"down";else return;const S="onSwipe"+g.charAt(0).toUpperCase()+g.slice(1),L=n[S],F=n.onSwipe;L&&L.call(t,l,t,t.state,t.context),F&&F.call(t,{direction:g,dx:_,dy:u,dt:h,event:l},t,t.state,t.context)};s.addEventListener("touchstart",d,{passive:!0}),s.addEventListener("touchend",p,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("touchstart",d)}catch{}try{s.removeEventListener("touchend",p)}catch{}})}function X(t,s){const n={...t};for(const r in s){const f=n[r],o=s[r];f&&o&&typeof f=="object"&&typeof o=="object"&&!Array.isArray(f)&&!Array.isArray(o)&&typeof f!="function"&&typeof o!="function"?n[r]=X(f,o):n[r]=o}return n}function dt(t,s,n){if(!s||!t.node)return;const r=t.childExtends;if(Array.isArray(s)){const f=t.tag==="fragment",o=t.context?.document||globalThis.document,i=f?null:o?.createDocumentFragment();if(!f&&!i)return;const c=t.childProps,e=t.childrenAs;for(let a=0;a<s.length;a++){let d=s[a];const p=d;(typeof d=="string"||typeof d=="number")&&(d={text:d});let l=c;if(typeof c=="function")try{l=c(t,d)}catch{l=null}if(e==="state"){let u=p;(typeof p=="string"||typeof p=="number")&&(u={value:p,text:p}),d=l?{...l,state:u}:{state:u}}else l&&(d=X(l,d));if(r&&!d.ignoreChildExtends)if(d.extends){const u=Array.isArray(d.extends)?d.extends:[d.extends],h=Array.isArray(r)?r:[r];d={...d,extends:[...h,...u]}}else d={...d,extends:r};const y=d?.key||p&&typeof p=="object"&&p.key||`${a}`,_=B(d,t,y,n);!f&&_?.node&&i.appendChild(_.node)}f||t.node.appendChild(i);return}if(typeof s=="string"){const f=Ct(s,t);if(Array.isArray(f)){dt(t,f,n);return}}if(typeof s=="object")for(const f in s){if(K.has(f))continue;let o=s[f];if(!(o==null||o===!1)){if((typeof o=="string"||typeof o=="number")&&(o={text:o}),t.childProps&&(o=X(t.childProps,o)),r&&!o.ignoreChildExtends)if(o.extends){const i=Array.isArray(o.extends)?o.extends:[o.extends],c=Array.isArray(r)?r:[r];o={...o,extends:[...c,...i]}}else o={...o,extends:r};B(o,t,f,n)}}}function ut(t,s){const n=t.node;if(!n||n.tagName!=="SELECT")return;const r=n.options;if(!r||!r.length)return;const f=t.__ref,o=f&&f.__exec&&f.__exec.value,i=typeof o=="function",c=t.value!=null&&typeof t.value!="function";if(i||c){let d;if(i)try{d=o(t,t.state,t.context)}catch{return}else d=t.value;const p=d==null?"":String(d);n.value!==p&&(n.value=p);return}const e=s||!(f&&f.__selectSynced);if(f&&(f.__selectSynced=!0),!e)return;let a=-1;for(let d=0;d<r.length;d++)r[d].defaultSelected&&(a=d);a>=0&&n.selectedIndex!==a&&(n.selectedIndex=a)}function Lt(t,s){let{children:n,content:r}=t;const f=t.childExtends;if(typeof n=="function"){const i=n;n=i(t,t.state,t.context),t.children=n;const c=t.__ref;let e=!1;const a=v(()=>{const d=i(t,t.state,t.context);if(!e){e=!0;return}if(d===t.children)return;t.children=d;const p=typeof t.onContentUpdate=="function",l=p?[]:null,y=p?[]:null,_=p?[]:null;if(Array.isArray(d)&&t.childrenAs==="state"){const b=t.childProps,g=[],S=new Map;for(let C=0;C<d.length;C++){const E=d[C];let A=b;if(typeof b=="function")try{A=b(t,E)}catch{A=null}const M=A&&A.key||E&&E.key||`${C}`;g.push(M),S.set(M,{rawChild:E,childProps:A})}const L=new Set(g),F=c.__children.slice();for(const C of F)if(!L.has(C)){const E=t[C];E?.remove&&E.remove(),delete t[C],y&&y.push(C)}const k=t.childExtends,$=t.tag==="fragment",U=t.context?.document||globalThis.document,G=$?null:U?.createDocumentFragment();for(const C of g){const E=S.get(C),A=E.rawChild,M=t[C];if(M&&M.state){if(A&&typeof A=="object"){const O=M.state,z=O.$replace||O.replace,ht=O.$update||O.update;if(typeof z=="function")z.call(O,A);else if(typeof ht=="function"){for(const N in O)if(!(N==="__element"||N==="root"||N==="parent"||N==="update")&&!Object.prototype.hasOwnProperty.call(A,N))try{O[N]=void 0}catch{}ht.call(O,A)}else for(const N in A)O[N]=A[N]}_&&_.push(C);continue}let J=A;(typeof A=="string"||typeof A=="number")&&(J={value:A,text:A});const lt=E.childProps;let R=lt?{...lt,state:J}:{state:J};if(k&&!R.ignoreChildExtends)if(R.extends){const O=Array.isArray(R.extends)?R.extends:[R.extends],z=Array.isArray(k)?k:[k];R={...R,extends:[...z,...O]}}else R={...R,extends:k};const yt=B(R,t,C,s);!$&&yt?.node&&G&&G.appendChild(yt.node),l&&l.push(C)}if(!$&&G&&G.childNodes.length&&t.node&&t.node.appendChild(G),!$&&t.node){let C=null;for(const E of g){const A=t[E]?.node;if(!A)continue;const M=C?C.nextSibling:t.node.firstChild;A!==M&&t.node.insertBefore(A,M),C=A}}c.__children=g,p&&(l.length||y.length)&&bt(t,{added:l,removed:y,kept:_}),ut(t,!1);return}const x=p?[...c.__children]:null;for(const b of[...c.__children]){const g=t[b];g?.remove&&g.remove(),delete t[b]}c.__children=[],dt(t,d,s),ut(t,!1),p&&bt(t,{added:[...c.__children],removed:x,kept:[]})},{depth:c.path.length});c.__effects.push(a)}if(dt(t,n||r,s),n||r)return;const o=t.context?.components||{};{const i=Object.keys(t);for(let c=0;c<i.length;c++){const e=i[c];if(!e.endsWith("Extends")||typeof t[e]!="string")continue;const a=e.slice(0,-7);if(!a||a.charCodeAt(0)<65||a.charCodeAt(0)>90)continue;const d={extends:t[e]};delete t[e];for(let p=c+1;p<i.length;p++){const l=i[p],y=l.charCodeAt(0);if(y>=65&&y<=90||K.has(l)||typeof t[l]=="function"&&(l.startsWith("on")||l.startsWith(".")))break;const _=t[l];_!==void 0&&(d[l]=_,delete t[l])}t[a]&&typeof t[a]=="object"?t[a]={...d,...t[a]}:t[a]=d}}for(const i in t){if(!Object.prototype.hasOwnProperty.call(t,i)||K.has(i)||typeof t[i]!="object"||t[i]===null)continue;const c=i.charCodeAt(0);if(c<65||c>90)continue;let e=t[i];if(!e.__ref){if(!e.extends&&!e.extend){const a=o[i]||o[`smbls.${i}`];a&&(e={...e,extends:a})}if(t.childProps&&(e=X(t.childProps,e)),f&&!e.ignoreChildExtends)if(e.extends){const a=Array.isArray(e.extends)?e.extends:[e.extends],d=Array.isArray(f)?f:[f];e={...e,extends:[...d,...a]}}else e={...e,extends:f};B(e,t,i,s)}}}function pt(t,s,n){const{node:r}=t;if(!r)return;r.ref=t;const f=s?.tag==="fragment"?s.__ref?.__fragmentAnchor:null;if(f){const i=f.parentNode;if(i){if(n?.position==="before"&&n.node)i.insertBefore(r,n.node);else if(n?.position==="after"&&n.node){const c=n.node.nextSibling;i.insertBefore(r,c||f)}else i.insertBefore(r,f);return}}const o=s?.node||(s?.nodeType?s:null);if(o)if(n?.position==="before"&&n.node)o.insertBefore(r,n.node);else if(n?.position==="after"&&n.node){const i=n.node.nextSibling;i?o.insertBefore(r,i):o.appendChild(r)}else o.appendChild(r)}function D(t,s,n){const r=t.charAt(0).toLowerCase()+t.slice(1);s.context?.plugins?.length&&V(r,s,n);const f="on"+t,o=s[f];if(typeof o=="function"){const i=t==="Render"||t==="RenderRouter";if(i){if(s.__ref.__inRender)return!0;s.__ref.__inRender=!0}const c=s.context?.designSystem;c&&j(c);try{if(o(s,s.state,s.context,n)===!1)return!1}catch(e){if(s.context?.plugins?.length&&V("error",s,{hook:f,error:e})||console.error(`[DOMQL] Lifecycle "${f}" error:`,e),s.context?.strictMode)throw e}finally{c&&w(),i&&(s.__ref.__inRender=!1)}}return!0}var xo=B;export{B as create,xo as default,gt as flushMounts};
@@ -0,0 +1 @@
1
+ function o(n){const e=n&&"env"in n?n.env:typeof process<"u"&&process.env?"production":void 0;if(e&&e!=="production")return!0;const t=n&&"hostname"in n?n.hostname:typeof location<"u"?location.hostname:void 0;return typeof t=="string"&&t?t==="localhost"||t==="127.0.0.1"||t.endsWith(".localhost"):!1}export{o as isLoudDevRuntime};
@@ -1 +1 @@
1
- import{update as u}from"./update.js";import{remove as l}from"./dispose.js";import"css-in-props";import{getDB as h,getQuery as _,getRootData as a,getRootState as g,getRoot as p,getRootContext as d,getContext as y,getChildren as k,getPath as m,nextElement as w,previousElement as x,verbose as C,warn as R,error as S,variables as v,spotByPath as P}from"@symbo.ls/utils";function f(t,e,n){const o=t?.context?.analyze;if(!o||!o.emit||e==="warn"&&!o.shouldCapture("warnings")||e==="error"&&!o.shouldCapture("errors"))return;const r=n.map(s=>s?.message||(typeof s=="string"?s:null)).filter(Boolean).join(" ");o.emit({id:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,ts:Date.now(),type:e==="error"?"error":"warning",level:e,hook:e==="error"?"el.error":"el.warn",element:{key:t.key!=null?String(t.key):null,name:t.__name||null,tag:t.tag||null},message:r||null,args:n})}function b(...t){return f(this,"warn",t),R.apply(this,t)}function D(...t){return f(this,"error",t),S.apply(this,t)}const i={update:u,remove:l,getDB:h,getQuery:_,getRootData:a,getChildren:k,getPath:m,nextElement:w,previousElement:x,verbose:C,warn:b,error:D,variables:v,spotByPath:P,set(t,e){const n=this.__ref;if(n){if(n.__setLocked){n.__setQueued={content:t,options:e};return}n.__setLocked=!0}try{if(this.removeContent(),t!=null){const o=this.context?.__create;o&&o(t,this,"content",e)}this.__ref&&(this.__ref.contentManaged=!0)}finally{if(n){n.__setLocked=!1;const o=n.__setQueued;o&&(n.__setQueued=null,this.set(o.content,o.options))}}},reset(t){const e=this.context?.__create;if(!e)return this;const n=this.parent,o=this.key,r=this.parse();return this.remove(),e(r,n,o,t)},lookup(t){let e=this.parent;for(;e;){if(typeof t=="function"){if(t(e))return e}else if(typeof t=="string"){if(e.key===t)return e;if(e[t]&&e[t].__ref)return e[t]}e=e.parent}return null},lookdown(t){const e=this.__ref;if(!e?.__children)return null;for(const n of e.__children){const o=this[n];if(!o)continue;if(typeof t=="function"){if(t(o))return o}else if(typeof t=="string"&&o.key===t)return o;const r=o.lookdown?.(t);if(r)return r}return null},lookdownAll(t,e=[]){const n=this.__ref;if(!n?.__children)return e;for(const o of n.__children){const r=this[o];r&&(typeof t=="function"?t(r)&&e.push(r):typeof t=="string"&&r.key===t&&e.push(r),r.lookdownAll?.(t,e))}return e},getRef(){return this.__ref},getRoot:p,getRootState:g,getRootContext:d,getContext:y,parse(t){const e={},n=t?new Set(t):null,o=this.__ref?.__exec;for(const r in this)if(!(r==="parent"||r==="node"||r==="__ref")&&!n?.has(r)){if(o&&o[r]!==void 0){e[r]=o[r];continue}typeof this[r]!="function"&&(e[r]=this[r])}return e},parseDeep(t){const e=this.parse(t),n=this.__ref;if(n?.__children)for(const o of n.__children)this[o]?.parseDeep&&(e[o]=this[o].parseDeep(t));return e},keys(){return Object.keys(this)},log(...t){if(t.length){const e={};for(const n of t)e[n]=this[n];console.log(e)}else console.log(this)},setProps(t,e){return this.update(t,e)},setNodeStyles(t){if(this.node?.style)for(const e in t){const n=t[e];if(n==null)continue;const o=e.replace(/[A-Z]/g,s=>"-"+s.toLowerCase()),r=String(n).replace(/\s*!important\s*$/,"");this.node.style.setProperty(o,r,"important")}},call(t,...e){const n=this.context,o=n?.methods?.[t]||n?.functions?.[t]||n?.utils?.[t]||this[t];if(typeof o=="function")return o.call(this,...e)},removeContent(){const t=this.__ref;if(!t?.__children)return;const e=this.content;if(e?.remove){e.remove(),delete this.content;const n=t.__children.indexOf("content");n!==-1&&t.__children.splice(n,1)}e?.node?.parentNode&&e.node.parentNode.removeChild(e.node)}},c=new WeakMap;function O(t){if(!t)return i;let e=c.get(t);if(e)return e;e=Object.create(i);const n=t.methods;if(n)for(const o in n)e[o]=n[o];return c.set(t,e),e}function Q(t){const e=O(t.context);Object.setPrototypeOf(t,e)}export{Q as addMethods,i as elementProto};
1
+ import{update as h}from"./update.js";import{remove as _}from"./dispose.js";import{isLoudDevRuntime as d}from"./devRuntime.js";import"css-in-props";import{getDB as g,getQuery as p,getRootData as y,getRootState as k,getRoot as m,getRootContext as w,getContext as x,getChildren as C,getPath as S,nextElement as R,previousElement as v,verbose as b,warn as P,error as D,variables as $,spotByPath as j}from"@symbo.ls/utils";function i(t,e,o){const n=t?.context?.analyze;if(!n||!n.emit||e==="warn"&&!n.shouldCapture("warnings")||e==="error"&&!n.shouldCapture("errors"))return;const r=o.map(s=>s?.message||(typeof s=="string"?s:null)).filter(Boolean).join(" ");n.emit({id:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,ts:Date.now(),type:e==="error"?"error":"warning",level:e,hook:e==="error"?"el.error":"el.warn",element:{key:t.key!=null?String(t.key):null,name:t.__name||null,tag:t.tag||null},message:r||null,args:o})}const u=new Set;function A(t,e,o){const n=String(e);if(u.has(n))return;u.add(n);const r=t?.__ref?.path,s=Array.isArray(r)&&r.length?r.join("."):t?.key!=null?String(t.key):"(unknown element)",a=o!=null?`resolves to a non-function (${typeof o}) \u2014 it cannot be called`:"is not registered in context.methods, context.functions, or context.utils, and is not an element method",c=`[smbls] el.call('${n}') at <${s}>: "${n}" ${a}. Returning undefined (unchanged behavior) \u2014 check the name for typos or register the function on the project. Warned once per name; repeat misses are silent.`;i(t,"error",[c]),console.error(c)}function O(...t){return i(this,"warn",t),P.apply(this,t)}function L(...t){return i(this,"error",t),D.apply(this,t)}const f={update:h,remove:_,getDB:g,getQuery:p,getRootData:y,getChildren:C,getPath:S,nextElement:R,previousElement:v,verbose:b,warn:O,error:L,variables:$,spotByPath:j,set(t,e){const o=this.__ref;if(o){if(o.__setLocked){o.__setQueued={content:t,options:e};return}o.__setLocked=!0}try{if(this.removeContent(),t!=null){const n=this.context?.__create;n&&n(t,this,"content",e)}this.__ref&&(this.__ref.contentManaged=!0)}finally{if(o){o.__setLocked=!1;const n=o.__setQueued;n&&(o.__setQueued=null,this.set(n.content,n.options))}}},reset(t){const e=this.context?.__create;if(!e)return this;const o=this.parent,n=this.key,r=this.parse();return this.remove(),e(r,o,n,t)},lookup(t){let e=this.parent;for(;e;){if(typeof t=="function"){if(t(e))return e}else if(typeof t=="string"){if(e.key===t)return e;if(e[t]&&e[t].__ref)return e[t]}e=e.parent}return null},lookdown(t){const e=this.__ref;if(!e?.__children)return null;for(const o of e.__children){const n=this[o];if(!n)continue;if(typeof t=="function"){if(t(n))return n}else if(typeof t=="string"&&n.key===t)return n;const r=n.lookdown?.(t);if(r)return r}return null},lookdownAll(t,e=[]){const o=this.__ref;if(!o?.__children)return e;for(const n of o.__children){const r=this[n];r&&(typeof t=="function"?t(r)&&e.push(r):typeof t=="string"&&r.key===t&&e.push(r),r.lookdownAll?.(t,e))}return e},getRef(){return this.__ref},getRoot:m,getRootState:k,getRootContext:w,getContext:x,parse(t){const e={},o=t?new Set(t):null,n=this.__ref?.__exec;for(const r in this)if(!(r==="parent"||r==="node"||r==="__ref")&&!o?.has(r)){if(n&&n[r]!==void 0){e[r]=n[r];continue}typeof this[r]!="function"&&(e[r]=this[r])}return e},parseDeep(t){const e=this.parse(t),o=this.__ref;if(o?.__children)for(const n of o.__children)this[n]?.parseDeep&&(e[n]=this[n].parseDeep(t));return e},keys(){return Object.keys(this)},log(...t){if(t.length){const e={};for(const o of t)e[o]=this[o];console.log(e)}else console.log(this)},setProps(t,e){return this.update(t,e)},setNodeStyles(t){if(this.node?.style)for(const e in t){const o=t[e];if(o==null)continue;const n=e.replace(/[A-Z]/g,s=>"-"+s.toLowerCase()),r=String(o).replace(/\s*!important\s*$/,"");this.node.style.setProperty(n,r,"important")}},call(t,...e){const o=this.context,n=o?.methods?.[t]||o?.functions?.[t]||o?.utils?.[t]||this[t];if(typeof n=="function")return n.call(this,...e);d()&&A(this,t,n)},removeContent(){const t=this.__ref;if(!t?.__children)return;const e=this.content;if(e?.remove){e.remove(),delete this.content;const o=t.__children.indexOf("content");o!==-1&&t.__children.splice(o,1)}e?.node?.parentNode&&e.node.parentNode.removeChild(e.node)}},l=new WeakMap;function E(t){if(!t)return f;let e=l.get(t);if(e)return e;e=Object.create(f);const o=t.methods;if(o)for(const n in o)e[n]=o[n];return l.set(t,e),e}function T(t){const e=E(t.context);Object.setPrototypeOf(t,e)}export{T as addMethods,f as elementProto};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/element",
3
- "version": "3.14.612",
3
+ "version": "3.14.628",
4
4
  "description": "Core element creation, update, and disposal engine for smbls v3.14",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",
@@ -21,8 +21,8 @@
21
21
  }
22
22
  },
23
23
  "dependencies": {
24
- "@symbo.ls/signal": "^3.14.612",
25
- "@symbo.ls/state": "^3.14.612",
24
+ "@symbo.ls/signal": "^3.14.628",
25
+ "@symbo.ls/state": "^3.14.628",
26
26
  "@symbo.ls/utils": "^3.14.599",
27
27
  "css-in-props": "^3.14.612",
28
28
  "attrs-in-props": "^3.14.599"