@symbo.ls/element 3.14.743 → 3.14.747

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,13 @@
1
1
  # @symbo.ls/element
2
2
 
3
+ ## 3.14.747
4
+
5
+ ### Patch Changes
6
+
7
+ - Auto-generated cross-repo patch release.
8
+ - Updated dependencies
9
+ - css-in-props@3.14.747
10
+
3
11
  ## 3.14.743
4
12
 
5
13
  ### Patch Changes
@@ -1,6 +1,6 @@
1
- "use strict";var et=Object.defineProperty;var Kt=Object.getOwnPropertyDescriptor;var Ut=Object.getOwnPropertyNames;var Vt=Object.prototype.hasOwnProperty;var Wt=(t,s)=>{for(var n in s)et(t,n,{get:s[n],enumerable:!0})},Bt=(t,s,n,c)=>{if(s&&typeof s=="object"||typeof s=="function")for(let i of Ut(s))!Vt.call(t,i)&&i!==n&&et(t,i,{get:()=>s[i],enumerable:!(c=Kt(s,i))||c.enumerable});return t};var Ht=t=>Bt(et({},"__esModule",{value:!0}),t);var ao={};Wt(ao,{create:()=>V,default:()=>eo,flushMounts:()=>gt});module.exports=Ht(ao);var P=require("@symbo.ls/signal"),w=require("@symbo.ls/signal"),W=require("./cache.js"),R=require("./registry.js"),Nt=require("./delegate.js"),Ft=require("./extends.js"),Mt=require("./methods.js"),lo=require("./dispose.js"),_t=require("./devRuntime.js"),nt=require("@symbo.ls/utils"),K=require("@symbo.ls/utils/function.js"),q=require("@symbo.ls/state"),b=require("css-in-props"),B=require("@symbo.ls/css"),A=require("@symbo.ls/scratch"),$=require("attrs-in-props");let zt=1;const ot=[];let at=!1;function Yt(){at||(at=!0,typeof requestAnimationFrame=="function"?requestAnimationFrame(gt):setTimeout(gt,0))}function gt(){if(at=!1,!ot.length)return;const t=ot.splice(0,ot.length);for(let s=0;s<t.length;s++){const n=t[s];!n.node||!n.node.isConnected||I("Mounted",n,n.__ref?.__mountOptions||{})}}function At(t,s){typeof t.onMounted=="function"&&(t.__ref.__mountOptions=s,ot.push(t),Yt())}function vt(t,s){if(typeof t.onContentUpdate!="function")return;t.context?.plugins?.length&&(0,K.runPluginHook)("contentUpdate",t,s);const n=t.context?.designSystem;n&&(0,A.pushConfig)(n);try{t.onContentUpdate(t,t.state,t.context,s)}catch(c){if(t.context?.plugins?.length&&(0,K.runPluginHook)("error",t,{hook:"onContentUpdate",error:c})||console.error('[DOMQL] Lifecycle "onContentUpdate" error:',c),t.context?.strictMode)throw c}finally{n&&(0,A.popConfig)()}}function Y(t){return t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90}function Gt(t){return t.charAt(2).toLowerCase()+t.slice(3)}function Zt(t){return t.toLowerCase()}function Ct(t){const s=t.charCodeAt(0);return s===58||s===64||s===38}function J(t,s){const n={...t};for(const c in s){const i=n[c],o=s[c];i&&o&&typeof i=="object"&&typeof o=="object"&&!Array.isArray(i)&&!Array.isArray(o)&&typeof i!="function"&&typeof o!="function"?n[c]=J(i,o):n[c]=o}return n}function V(t,s,n,c={},i){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||`_${zt++}`,o.parent=s||null,o.context=t.context||s?.context||c.context||{},o.context.__create||(o.context.__create=V);const e=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),g=o.context?.components;g&&(g[h]||g["smbls."+h])?t={...t,extends:h}:g&&(0,_t.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,Ft.applyExtends)(o,t,c);const r=new Set(["childProps","attr","style","scope","data"]),a=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],g=o[u],v=g&&h&&typeof g=="object"&&typeof h=="object"&&!Array.isArray(g)&&!Array.isArray(h)&&typeof g!="function"&&typeof h!="function";v&&u.charCodeAt(0)>=65&&u.charCodeAt(0)<=90?o[u]=J(g,h):v&&r.has(u)?o[u]={...g,...h}:v&&Ct(u)?o[u]=J(g,h):o[u]=h}function f(u){for(const h in u){const g=u[h],v=o[h],x=v&&g&&typeof v=="object"&&typeof g=="object"&&!Array.isArray(v)&&!Array.isArray(g)&&typeof v!="function"&&typeof g!="function";x&&h.charCodeAt(0)>=65&&h.charCodeAt(0)<=90?o[h]=J(v,g):x&&r.has(h)?o[h]={...v,...g}:x&&Ct(h)?o[h]=J(v,g):o[h]=g}}a&&f(a),t.props&&typeof t.props=="object"&&f(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,y=o.context&&typeof o.context.globalScope=="object"&&o.context.globalScope||null,l=p||y||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,P.createScopeStore)(u,l)}else l&&(o.scope=l);if(t.if!==void 0&&(o.if=t.if),(0,Mt.addMethods)(o),qt(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,e.__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 u=o.if;e.__if=!!u}if(e.__if)typeof o.if=="function"&&(e.__ifInitialized=!0);else return s&&(s[o.key]=o),typeof o.if=="function"&&jt(o,e,o.if),o;o.tag||(o.tag=(0,W.detectTag)(o)),I("Init",o,c);const _=o.node=(0,W.cacheNode)(o);if(!_)return o;if(o.tag==="fragment"){const h=(o.context?.document||globalThis.document).createComment("");_.appendChild(h),e.__fragmentAnchor=h}I("AttachNode",o,c),_.setAttribute&&o.key&&_.setAttribute("data-key",o.key),s&&(s[o.key]=o,s.__ref?.__children&&(s.__ref.__children.includes(o.key)||s.__ref.__children.push(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),Dt(o,c),kt(o),dt(o),Lt(o),ro(o);try{Tt(o,c)}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(`
1
+ "use strict";var et=Object.defineProperty;var Vt=Object.getOwnPropertyDescriptor;var Bt=Object.getOwnPropertyNames;var Wt=Object.prototype.hasOwnProperty;var Ht=(t,s)=>{for(var n in s)et(t,n,{get:s[n],enumerable:!0})},zt=(t,s,n,c)=>{if(s&&typeof s=="object"||typeof s=="function")for(let i of Bt(s))!Wt.call(t,i)&&i!==n&&et(t,i,{get:()=>s[i],enumerable:!(c=Vt(s,i))||c.enumerable});return t};var Yt=t=>zt(et({},"__esModule",{value:!0}),t);var lo={};Ht(lo,{create:()=>B,default:()=>uo,flushMounts:()=>At});module.exports=Yt(lo);var P=require("@symbo.ls/signal"),v=require("@symbo.ls/signal"),W=require("./cache.js"),R=require("./registry.js"),Mt=require("./delegate.js"),It=require("./extends.js"),Kt=require("./methods.js"),_o=require("./dispose.js"),xt=require("./devRuntime.js"),nt=require("@symbo.ls/utils"),K=require("@symbo.ls/utils/function.js"),q=require("@symbo.ls/state"),b=require("css-in-props"),U=require("@symbo.ls/css"),A=require("@symbo.ls/scratch"),D=require("attrs-in-props");let Gt=1;const ot=[];let ft=!1;function Zt(){ft||(ft=!0,typeof requestAnimationFrame=="function"?requestAnimationFrame(At):setTimeout(At,0))}function At(){if(ft=!1,!ot.length)return;const t=ot.splice(0,ot.length);for(let s=0;s<t.length;s++){const n=t[s];!n.node||!n.node.isConnected||I("Mounted",n,n.__ref?.__mountOptions||{})}}function St(t,s){typeof t.onMounted=="function"&&(t.__ref.__mountOptions=s,ot.push(t),Zt())}function vt(t,s){if(typeof t.onContentUpdate!="function")return;t.context?.plugins?.length&&(0,K.runPluginHook)("contentUpdate",t,s);const n=t.context?.designSystem;n&&(0,A.pushConfig)(n);try{t.onContentUpdate(t,t.state,t.context,s)}catch(c){if(t.context?.plugins?.length&&(0,K.runPluginHook)("error",t,{hook:"onContentUpdate",error:c})||console.error('[DOMQL] Lifecycle "onContentUpdate" error:',c),t.context?.strictMode)throw c}finally{n&&(0,A.popConfig)()}}function Y(t){return t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90}function qt(t){return t.charAt(2).toLowerCase()+t.slice(3)}function Qt(t){return t.toLowerCase()}function at(t){const s=t.charCodeAt(0);return s===58||s===64||s===38}function J(t,s){const n={...t};for(const c in s){const i=n[c],o=s[c];i&&o&&typeof i=="object"&&typeof o=="object"&&!Array.isArray(i)&&!Array.isArray(o)&&typeof i!="function"&&typeof o!="function"?n[c]=J(i,o):n[c]=o}return n}function B(t,s,n,c={},i){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||`_${Gt++}`,o.parent=s||null,o.context=t.context||s?.context||c.context||{},o.context.__create||(o.context.__create=B);const f=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 l=n.indexOf("_");if(l>0){const h=n.substring(0,l),g=o.context?.components;g&&(g[h]||g["smbls."+h])?t={...t,extends:h}:g&&(0,xt.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,It.applyExtends)(o,t,c);const r=new Set(["childProps","attr","style","scope","data"]),e=o.props&&typeof o.props=="object"?o.props:null;for(const l in t){if(l==="parent"||l==="node"||l==="__ref"||l==="extends"||l==="context"||l==="props")continue;const h=t[l],g=o[l],C=g&&h&&typeof g=="object"&&typeof h=="object"&&!Array.isArray(g)&&!Array.isArray(h)&&typeof g!="function"&&typeof h!="function";C&&l.charCodeAt(0)>=65&&l.charCodeAt(0)<=90?o[l]=J(g,h):C&&r.has(l)?o[l]={...g,...h}:C&&at(l)?o[l]=J(g,h):o[l]=h}function a(l){for(const h in l){const g=l[h],C=o[h],x=C&&g&&typeof C=="object"&&typeof g=="object"&&!Array.isArray(C)&&!Array.isArray(g)&&typeof C!="function"&&typeof g!="function";x&&h.charCodeAt(0)>=65&&h.charCodeAt(0)<=90?o[h]=J(C,g):x&&r.has(h)?o[h]={...C,...g}:x&&at(h)?o[h]=J(C,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,d=s?.scope,p=o.context&&typeof o.context.globalScope=="object"&&o.context.globalScope||null,y=d||p||null;if(t.scope!==void 0||u){const l={};u&&Object.assign(l,u),t.scope!==void 0&&Object.assign(l,t.scope),o.scope=(0,P.createScopeStore)(l,y)}else y&&(o.scope=y);if(t.if!==void 0&&(o.if=t.if),(0,Kt.addMethods)(o),Xt(o,s,t),o.if!=null){let l;if(typeof o.if=="function")try{l=o.if(o,o.state,o.context)}catch(h){if(l=!1,f.__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 l=o.if;f.__if=!!l}if(f.__if)typeof o.if=="function"&&(f.__ifInitialized=!0);else return s&&(s[o.key]=o),typeof o.if=="function"&&Pt(o,f,o.if),o;o.tag||(o.tag=(0,W.detectTag)(o)),I("Init",o,c);const _=o.node=(0,W.cacheNode)(o);if(!_)return o;if(o.tag==="fragment"){const h=(o.context?.document||globalThis.document).createComment("");_.appendChild(h),f.__fragmentAnchor=h}I("AttachNode",o,c),_.setAttribute&&o.key&&_.setAttribute("data-key",o.key),s&&(s[o.key]=o,s.__ref?.__children&&(s.__ref.__children.includes(o.key)||s.__ref.__children.push(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),Rt(o,c),jt(o),dt(o),$t(o),fo(o);try{Nt(o,c)}catch(l){if(typeof console<"u"&&console.error){const h=o.__ref?.path?.join(".")||o.key||"<root>";console.error(`[smbls] createChildren failed at ${h}:`,l?.message||l,l?.stack?`
2
+ `+l.stack.split(`
3
3
  `).slice(0,6).join(`
4
- `):"")}}if(ht(o,!0),Rt(o,s,i),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(I("Create",o,c),I("Complete",o,c),I("Render",o,c),I("RenderRouter",o,c),At(o,c),typeof o.onFrame=="function"){const u=o.onFrame,h=o.context?.designSystem,g=()=>{if(o.node){if(o.node.isConnected){h&&(0,A.pushConfig)(h);try{u(o,o.state,o.context)}catch(v){console.error("[DOMQL] onFrame error:",v)}finally{h&&(0,A.popConfig)()}}requestAnimationFrame(g)}};requestAnimationFrame(g)}return o}function qt(t,s,n){const c=!s,i=n.state&&typeof n.state=="object"&&!Array.isArray(n.state)&&Object.keys(n.state).length===0,o=c&&i&&t.context?.state,e=n.state!==void 0&&!o?n.state:t.state&&!(0,P.isStore)(t.state)?t.state:void 0;if(e==null){if(s?.state)t.state=s.state,(0,q.applyStateMethods)(t,t.state);else if(t.context?.state){const r=t.context.state,a={...r},f=t.context?.polyglot;if(f?.translations){const d=r.lang||f.defaultLang||"en",p=f.translations[d];if(p&&typeof p=="object")for(const l in p)a[l]===void 0&&(a[l]=p[l]);const y=new Set(f.languages||[]);for(const l in f.translations)!y.has(l)&&a[l]===void 0&&(a[l]=f.translations[l])}t.state=(0,P.isStore)(a)?a:(0,P.createStore)(a),t.state.__element=t,t.state.root=t.state,(0,q.applyStateMethods)(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),(0,q.applyStateMethods)(t,t.state);return}if(typeof e=="string"){if(t.state=St(e,s),t.state&&typeof t.state=="object"&&!(0,P.isStore)(t.state)){const r=s?.state?.root||s?.state||t.state;Object.defineProperty(t.state,"root",{value:r,enumerable:!1,configurable:!0,writable:!0})}(0,q.applyStateMethods)(t,t.state);return}if(typeof e=="function"){const r=e(t,s?.state);t.state=(0,P.isStore)(r)?r:(0,P.createStore)(r||{})}else(0,P.isStore)(e)?t.state=e:t.state=(0,P.createStore)({...e});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,q.applyStateMethods)(t,t.state)}function ft(t,s){if(!s)return t;const n=s.split("/");let c=t;for(const i of n){if(c==null)return{};c=c[i]}return c??{}}function St(t,s){if(!s)return{};if(t===".")return s.state||{};if(t.startsWith("../")){const i=t.slice(3);return i?ft(s.state,i):s.state??{}}if(t.startsWith("~/")){const i=s.state?.root||s.state,o=t.slice(2);return o?ft(i,o):i??{}}if(s.state?.[t]!==void 0)return s.state[t];const n=ft(s.state,t);if(n!=null&&Object.keys(n).length>0)return n;const c=s.context?.polyglot;if(c?.translations){const i=s.state?.root?.lang||c.defaultLang||"en",o=c.translations[i];if(o?.[t]!==void 0)return o[t];if(c.translations[t]!==void 0)return c.translations[t]}return{}}function Qt(t){const s=t.__ref,n=t.tag||"div",c=t.context?.designSystem,i=[],o=Object.keys(t);for(let e=0;e<o.length;e++){const r=o[e];if(typeof t[r]!="function"||R.REGISTRY.has(r))continue;const a=r.charCodeAt(0);a>=65&&a<=90||Y(r)||b.CSS_PROPS_REGISTRY[r]||b.DEFAULT_CSS_PROPERTIES_LIST&&b.DEFAULT_CSS_PROPERTIES_LIST.has(r)||(0,$.checkAttributeByTagName)(n,r)||i.push({prop:r,fn:t[r]})}for(let e=0;e<i.length;e++){const{prop:r,fn:a}=i[e];s.__exec[r]=a,Object.defineProperty(t,r,{get(){c&&(0,A.pushConfig)(c);try{return a(t,t.state,t.context)}catch{return}finally{c&&(0,A.popConfig)()}},set(f){delete s.__exec[r],Object.defineProperty(t,r,{value:f,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function Xt(t,s){if(!(!Array.isArray(s)||s.length===0))for(let n=0;n<s.length;n++){const c=s[n];try{typeof c=="function"?c(t,t.state,t.context):typeof c=="string"&&t.state?.[c]}catch{}}}function L(t,s,n){return!Array.isArray(s)||s.length===0?n:function(...c){return Xt(t,s),n.apply(this,c)}}function m(t,s){if(!(!t||Array.isArray(t)||typeof t!="object"))return t[s]}function kt(t,s){const n=t.__ref,c=!!(s&&s.skipIfEffect);if(Qt(t),typeof t.text=="function"){const o=t.text,e=L(t,t.textDeps,o),r=(0,w.createEffect)(()=>{if(!n.contentManaged)try{let a=e(t,t.state,t.context);t.node&&a!=null&&typeof a!="function"&&typeof a!="object"&&(typeof a=="string"&&a.includes("{{")&&(a=nt.replaceLiteralsWithObjectFields.call(t,a,t.state)),t.tag==="string"?t.node.nodeValue=a:t.node.textContent=a)}catch{}},{depth:n.path.length});n.__effects.push(r),n.__exec.text=o}else if(typeof t.text=="string"&&t.text.includes("{{")){const o=t.text,e=(0,w.createEffect)(()=>{if(n.contentManaged)return;const r=nt.replaceLiteralsWithObjectFields.call(t,o,t.state);r!=null&&(t.text=r),t.node&&(t.tag==="string"?t.node.nodeValue=r??"":t.node.textContent=r??"")},{depth:n.path.length});n.__effects.push(e),n.__exec.text=o}for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)&&typeof t[o]=="function"&&!R.REGISTRY.has(o)&&!Y(o)&&!n.__exec[o]){if(b.CSS_PROPS_REGISTRY[o]){const e=t[o],r=L(t,t[o+"Deps"],e),a=o;let f;const d=(0,w.createEffect)(()=>{const p=t.context?.designSystem;p&&(0,A.pushConfig)(p);try{const y=r(t,t.state,t.context),l=b.CSS_PROPS_REGISTRY[a](y,t,t.state,t.context);if(l&&t.node){const _=Et(l);(_===null||_!==f)&&(f=_,G(t.node,l))}else t.node&&(a==="show"||a==="hide")&&(f=void 0,t.node.style.display="")}finally{p&&(0,A.popConfig)()}},{depth:n.path.length});n.__effects.push(d),n.__exec[o]=e}else if(b.DEFAULT_CSS_PROPERTIES_LIST&&b.DEFAULT_CSS_PROPERTIES_LIST.has(o)){const e=t[o],r=L(t,t[o+"Deps"],e),a=o;let f;const d=(0,w.createEffect)(()=>{const p=t.context?.designSystem;p&&(0,A.pushConfig)(p);try{const y=r(t,t.state,t.context);if(t.node)if(y!=null){const l=a+":"+String(y);l!==f&&(f=l,G(t.node,{[a]:y}))}else f=void 0,t.node.style[a]=""}finally{p&&(0,A.popConfig)()}},{depth:n.path.length});n.__effects.push(d),n.__exec[o]=e}}if(typeof t.html=="function"){const o=t.html,e=L(t,t.htmlDeps,o),r=(0,w.createEffect)(()=>{const a=t.context?.designSystem;a&&(0,A.pushConfig)(a);try{const f=e(t,t.state,t.context);t.node&&f!=null&&typeof f!="function"&&(t.node.innerHTML=f)}finally{a&&(0,A.popConfig)()}},{depth:n.path.length});n.__effects.push(r),n.__exec.html=o}if(typeof t.value=="function"){const o=t.value,e=L(t,t.valueDeps,o),r=(0,w.createEffect)(()=>{try{const a=e(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const f=a==null?"":String(a);if(t.node.value===f)return;const d=typeof document<"u"&&document.activeElement===t.node,p=d&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,y=d&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=f,d&&p!=null&&y!=null)try{t.node.setSelectionRange(p,y)}catch{}}catch{}},{depth:n.path.length});n.__effects.push(r),n.__exec.value=o}if(typeof t.style=="function"){const o=t.style,e=L(t,t.styleDeps,o);let r;const a=(0,w.createEffect)(()=>{const f=e(t,t.state,t.context),d=Et(f);(d===null||d!==r)&&(r=d,G(t.node,f))},{depth:n.path.length});n.__effects.push(a),n.__exec.style=o}else if(t.style&&typeof t.style=="object")for(const o in t.style){const e=t.style[o];if(typeof e!="function")continue;const r=L(t,m(t.styleDeps,o),e);let a;const f=(0,w.createEffect)(()=>{try{const d=r(t,t.state,t.context);if(t.node){const p=o+":"+String(d);p!==a&&(a=p,G(t.node,{[o]:d}))}}catch{}},{depth:n.path.length});n.__effects.push(f)}if(t.attr&&typeof t.attr=="object"){for(const o in t.attr)if(typeof t.attr[o]=="function"){const e=L(t,m(t.attrDeps,o),t.attr[o]),r=o,a=(0,w.createEffect)(()=>{try{const f=e(t,t.state,t.context);t.node?.setAttribute&&(f==null||f===!1?t.node.removeAttribute(r):typeof f!="function"&&typeof f!="object"&&t.node.setAttribute(r,f===!0?"":f))}catch{}},{depth:n.path.length});n.__effects.push(a)}}if(t.aria&&typeof t.aria=="object")for(const o in t.aria){if(typeof t.aria[o]!="function")continue;const e=L(t,m(t.ariaDeps,o),t.aria[o]),r="aria-"+o.replace(/[A-Z]/g,f=>"-"+f.toLowerCase()),a=(0,w.createEffect)(()=>{try{const f=e(t,t.state,t.context);if(!t.node?.setAttribute)return;f==null||f===!1?t.node.removeAttribute(r):typeof f!="function"&&typeof f!="object"&&t.node.setAttribute(r,f===!0?"":f)}catch{}},{depth:n.path.length});n.__effects.push(a)}if(t.data&&typeof t.data=="object")for(const o in t.data){if(typeof t.data[o]!="function")continue;const e=L(t,m(t.dataDeps,o),t.data[o]),a="data-"+o.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),f=(0,w.createEffect)(()=>{try{const d=e(t,t.state,t.context);if(!t.node?.setAttribute)return;d==null||d===!1?t.node.removeAttribute(a):typeof d!="function"&&typeof d!="object"&&t.node.setAttribute(a,d===!0?"":d)}catch{}},{depth:n.path.length});n.__effects.push(f)}const i=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(i)for(const o in i){if(typeof i[o]!="function")continue;const e=L(t,m(t.classDeps,o),i[o]),r=(0,w.createEffect)(()=>{try{const a=e(t,t.state,t.context);if(!t.node?.classList)return;typeof a=="string"?t.node.classList.add(a):a?t.node.classList.add(o):t.node.classList.remove(o)}catch{}},{depth:n.path.length});n.__effects.push(r)}!c&&typeof t.if=="function"&&jt(t,n,t.if);for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||R.REGISTRY.has(o)||typeof t[o]!="function")continue;const e=o.charCodeAt(0);if(e>=65&&e<=90||Y(o))continue;const r=t[o];n.__exec[o]=r;const a=t.tag||"div";if((0,$.checkAttributeByTagName)(a,o)&&!b.CSS_PROPS_REGISTRY[o]&&!(b.DEFAULT_CSS_PROPERTIES_LIST&&b.DEFAULT_CSS_PROPERTIES_LIST.has(o))){const f=(0,$.camelToAttr)(o)||o,d=L(t,t[o+"Deps"],r),p=(0,w.createEffect)(()=>{try{const y=d(t,t.state,t.context);t.node?.setAttribute&&(y==null||y===!1?t.node.removeAttribute(f):typeof y!="function"&&typeof y!="object"&&(f==="src"&&"src"in t.node?t.node.src=y:t.node.setAttribute(f,y===!0?"":y)))}catch{}},{depth:n.path.length});n.__effects.push(p)}}if(to(t),so(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const o=t.onStateUpdate,e=t.stateDeps;let r=!1,a=[];const f=(0,w.createEffect)(()=>{const d=[];for(let _=0;_<e.length;_++){const u=e[_];try{d[_]=typeof u=="function"?u(t,t.state,t.context):t.state?.[u]}catch{d[_]=void 0}}if(!r){r=!0,a=d;return}let p=d.length!==a.length;for(let _=0;!p&&_<d.length;_++)d[_]!==a[_]&&(p=!0);const y=a;if(a=d,!p)return;const l=t.context?.designSystem;l&&(0,A.pushConfig)(l);try{o(t,t.state,t.context,{prev:y,next:d})}catch(_){if(t.context?.plugins?.length&&(0,K.runPluginHook)("error",t,{hook:"onStateUpdate",error:_})||console.error('[DOMQL] Lifecycle "onStateUpdate" error:',_),t.context?.strictMode)throw _}finally{l&&(0,A.popConfig)()}},{depth:n.path.length});n.__effects.push(f)}}function wt(t){const s=t.parent,n=s?.node;if(!n||!t.node){Rt(t,t.parent);return}let c=null;const i=Object.keys(s),o=i.indexOf(t.key);for(let e=o+1;e<i.length;e++){const r=s[i[e]];if(r?.node?.parentNode===n){c=r.node;break}}c?n.insertBefore(t.node,c):n.appendChild(t.node)}function jt(t,s,n){const c=L(t,t.ifDeps,n),i=(0,w.createEffect)(()=>{let o;try{o=c(t,t.state,t.context)}catch(r){if(o=!1,s.__ifError=r,typeof console<"u"&&console.warn){const a=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${a} \u2014 treating as false:`,r?.message||r)}return}const e=s.__if;if(s.__if=!!o,e&&!s.__if&&t.node)t.node.remove();else if(!e&&s.__if)if(s.__ifInitialized)t.node||(t.node=(0,W.cacheNode)(t)),t.node&&(t.node.ref=t),wt(t),dt(t);else{if(s.__ifInitialized=!0,t.tag||(t.tag=(0,W.detectTag)(t)),I("Init",t,{}),t.node||(t.node=(0,W.cacheNode)(t)),!t.node)return;if(t.parent?.__ref?.__children&&!t.parent.__ref.__children.includes(t.key)&&t.parent.__ref.__children.push(t.key),t.tag==="fragment"&&!s.__fragmentAnchor){const a=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(a),s.__fragmentAnchor=a}I("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),Dt(t,{}),kt(t,{skipIfEffect:!0}),dt(t),Lt(t),Tt(t,{}),wt(t),At(t,{})}},{depth:s.path.length});s.__effects.push(i)}function dt(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),co(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"&&G(s,t.style),t.attr&&typeof t.attr=="object")for(const n in t.attr){const c=t.attr[n];typeof c=="function"||typeof c=="object"||c==null||c===!1||s.setAttribute&&s.setAttribute(n,c===!0?"":c)}if(t.data&&typeof t.data=="object")for(const n in t.data){const c=t.data[n];typeof c=="function"||typeof c=="object"||c==null||c===!1||s.dataset&&(s.dataset[n]=c===!0?"":c)}if(t.classlist||t.class){const n=t.classlist||t.class;if(typeof n=="string")n.split(" ").forEach(c=>c&&s.classList.add(c));else if(typeof n=="object")for(const c in n){const i=typeof n[c]=="function"?n[c](t,t.state,t.context):n[c];i&&s.classList.add(typeof i=="string"?i:c)}}}}function Et(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function G(t,s){if(!t||!s||!t.style)return;let n=null;for(const c in s){const i=s[c];if(i!=null){if(c.charAt(0)==="&"&&typeof i=="object"){n||(n={}),n[c]=i;continue}try{const o=String(i),e=c.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),r=o.trim(),a=/\s*!important\s*$/.test(r),f=r.replace(/\s*!important\s*$/,"");t.style.setProperty(e,f,a?"important":"")}catch{}}}n&&mt(t,n)}let Jt=0;function mt(t,s){const n=`_ds${Jt++}`;t.classList.add(n);const c=t.ownerDocument;let i=c.querySelector("style[data-smbls-scoped]");i||(i=c.createElement("style"),i.setAttribute("data-smbls-scoped",""),c.head.appendChild(i));let o="";for(const e in s){const r="."+n,a=e.replace(/&/g,r).split(",").map(d=>{const p=d.trim();return p.includes(r)?p:r+p}).join(", "),f=s[e];if(typeof f=="object"){let d="",p="";for(const y in f){const l=f[y];if(typeof l=="object"){const _=y.includes("&")?a.split(", ").map(h=>y.replace(/&/g,h)).join(", "):a.split(", ").map(h=>`${h} ${y}`).join(", ");let u="";for(const h in l)u+=`${h.replace(/[A-Z]/g,g=>"-"+g.toLowerCase())}: ${l[h]};`;p+=(0,B.wrapHoverRule)(`${_} { ${u} }`,_)+`
5
- `}else d+=`${y.replace(/[A-Z]/g,_=>"-"+_.toLowerCase())}: ${l};`}d&&(o+=(0,B.wrapHoverRule)(`${a} { ${d} }`,a)+`
6
- `),p&&(o+=p)}}o&&(i.textContent+=o)}function to(t){let s=t.subscribeTo;if(typeof s=="function")try{s=s(t,t.state,t.context)}catch{s=null}if(!Array.isArray(s)||s.length===0)return;const n=t.__ref;for(let c=0;c<s.length;c++){const i=s[c];if(typeof i!="string"||i.length===0)continue;const o=i.split("."),e=o[0],r=o.slice(1),a={value:!1},f=(0,w.createEffect)(()=>{const d=t.state&&((0,P.isStore)(t.state)?t.state.root:null);if(!d||!(0,P.isStore)(d))return;let p=d;p=p[e];for(let l=0;l<r.length&&!(p==null||typeof p!="object");l++)if((0,P.isStore)(p))p=p[r[l]];else break;if(!a.value)return;let y=!1;if(typeof t.onBeforeUpdate=="function"){const l=t.context?.designSystem;l&&(0,A.pushConfig)(l);try{t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0})===!1&&(y=!0)}catch(_){t.context?.plugins?.length&&(0,K.runPluginHook)("error",t,{hook:"onBeforeUpdate",error:_})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",_)}finally{l&&(0,A.popConfig)()}}if(!y&&t.node&&n.__effects)for(let l=0;l<n.__effects.length;l++){const _=n.__effects[l];_&&_!==f&&!_._disposed&&!_._isSubscribeToEffect&&typeof _._execute=="function"&&_._execute()}if(!y&&typeof t.onUpdate=="function"){const l=t.context?.designSystem;l&&(0,A.pushConfig)(l);try{t.onUpdate(t,t.state,t.context)}catch(_){t.context?.plugins?.length&&(0,K.runPluginHook)("error",t,{hook:"onUpdate",error:_})||console.error("[DOMQL] subscribeTo onUpdate error:",_)}finally{l&&(0,A.popConfig)()}}},{depth:n.path.length});a.value=!0,f._isSubscribeToEffect=!0,n.__effects.push(f)}}function ut(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)])}const Pt=new Set;function oo(t,s){const n=s?.__ref?.path?s.__ref.path.join("."):s?.key||"?",c=n+"::"+t;Pt.has(c)||(Pt.add(c),console.warn(`[smbls/css] "${t}" at ${n} is a CHILD-COMPONENT key nested inside a pseudo/selector block (":hover", "@dark", etc.) \u2014 that is never a valid CSS selector fragment. The rule is DROPPED (not shipped as a dead/never-matching selector). To reveal a child on a parent state, target the child's OWN class from the parent selector instead, e.g. move the declaration onto the child element itself, or use a sibling-selector combinator in a top-level style block.`))}function Z(t,s,n){const c={},i=new Set,o=(e,r,a)=>{const f=a?new Set(Object.keys(c)):null;if(b.CSS_PROPS_REGISTRY[e]){const d=b.CSS_PROPS_REGISTRY[e](r,s,s.state,s.context);if(d){const p=Array.isArray(d)?d:[d];for(const y of p)y&&Object.assign(c,y)}}else c[e]=r;if(a)for(const d in c)f.has(d)||i.add(d)};for(const e in t){if(!Object.prototype.hasOwnProperty.call(t,e))continue;let r=t[e];if(typeof r=="function"&&(r=r(s,s.state,s.context)),r==null||typeof r=="function")continue;if(typeof r=="object"&&!Array.isArray(r)){if(e==="style"){for(const p in r){let y=r[p];if(typeof y=="function"&&(y=y(s,s.state,s.context)),y==null||typeof y=="function")continue;const l=typeof s[p]=="function"&&(b.CSS_PROPS_REGISTRY[p]||b.DEFAULT_CSS_PROPERTIES_LIST&&b.DEFAULT_CSS_PROPERTIES_LIST.has(p));o(p,y,l)}continue}if(ut(e,s)){const p=Z(r,s,!0);Object.keys(p).length&&(c[`[data-theme="${e.slice(1)}"] &`]=p);continue}if(/^[A-Z][A-Za-z0-9]*$/.test(e)){(0,_t.isLoudDevRuntime)()&&oo(e,s);continue}let f=e;if(e.charCodeAt(0)===64&&!e.startsWith("@media")&&!e.startsWith("@keyframes")){const p=s.context?.designSystem?.media?.[e.slice(1)];p&&(f=`@media ${p}`)}const d=Z(r,s,!1);Object.keys(d).length&&(c[f]=d);continue}const a=typeof s[e]=="function"&&(b.CSS_PROPS_REGISTRY[e]||b.DEFAULT_CSS_PROPERTIES_LIST&&b.DEFAULT_CSS_PROPERTIES_LIST.has(e));o(e,r,a)}if(n)for(const e in c)i.add(e);for(const e of i){const r=c[e];typeof r=="string"&&!r.includes("!important")&&(c[e]=r+" !important")}return c}function so(t){const s=t.__ref;s.__conditionalRunners=[];const n=new Map;for(const c in t){if(!Object.prototype.hasOwnProperty.call(t,c))continue;const i=c.charAt(0);if(i!=="."&&i!=="!")continue;const o=c.slice(1);if(!o)continue;if(/[:@\s>~+[\]]/.test(o)){if(typeof console<"u"&&console.warn){const p=o.split(/[:@\s>~+[\]]/)[0];console.warn(`[smbls] conditional \`${c}\` on ${t.key||"?"} will never match \u2014 the whole string after \`${i}\` is read as one prop name. Nest the selector inside instead: \`${i}${p}: { '${o.slice(p.length)}': {...} }\`.`)}continue}const e=t[c];if(!e||typeof e!="object")continue;const r=i==="!",a={lastMatch:!1,appliedKeys:null,appliedClasses:null},f=()=>{let p;const y=t[o];if(y===void 0){const u=!!t.state&&o in t.state,h=t.state?t.state[o]:void 0;if(u||h!==void 0)p=h;else{const g=t.context?.cases?.[o];if(g===void 0)return;try{p=typeof g=="function"?g.call(t,t):g}catch(v){p=!1,s.__conditionalError=v,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${c}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,v?.message||v)}}}else if(typeof y=="function")try{p=y(t,t.state,t.context)}catch(u){p=!1,s.__conditionalError=u,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${c}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,u?.message||u)}else p=y;const l=r?!p:!!p;if(!t.node||l===a.lastMatch)return;a.lastMatch=l;const _=t.context?.designSystem;_&&(0,A.pushConfig)(_);try{if(l){const u={},h={};let g=!1;for(const x in e){if(!Object.prototype.hasOwnProperty.call(e,x))continue;const E=e[x],k=x.charAt(0);if((k===":"||k==="@"||k==="&")&&E&&typeof E=="object"&&!Array.isArray(E)){if(ut(x,t)){const D=Z(E,t,!0);Object.keys(D).length&&(h[`[data-theme="${x.slice(1)}"] &`]=D,g=!0)}else{let D=x;if(k==="@"&&!x.startsWith("@media")&&!x.startsWith("@keyframes")){const U=t.context?.designSystem?.media?.[x.slice(1)];U&&(D=`@media ${U}`)}const H=Z(E,t,!1);Object.keys(H).length&&(h[D]=H,g=!0)}continue}const j=typeof E=="function"?E(t,t.state,t.context):E;if(j!=null)if(b.CSS_PROPS_REGISTRY[x]){const D=b.CSS_PROPS_REGISTRY[x](j,t,t.state,t.context);if(D){const H=Array.isArray(D)?D:[D];for(const U of H)U&&Object.assign(u,U)}}else b.DEFAULT_CSS_PROPERTIES_LIST&&b.DEFAULT_CSS_PROPERTIES_LIST.has(x)&&(u[x]=j)}const v=Object.keys(u);if(v.length){G(t.node,u);for(const x of v)n.set(x,c);a.appliedKeys=v}else a.appliedKeys=null;if(g){const x=(0,B.css)(h,null,t.context?.cssPrefix),E=x?x.split(" ").filter(Boolean):[];if(E.length&&t.node.classList){for(const k of E)t.node.classList.add(k);a.appliedClasses=E}else a.appliedClasses=null}else if(a.appliedClasses){for(const x of a.appliedClasses)t.node.classList.remove(x);a.appliedClasses=null}}else{if(a.appliedKeys){for(const u of a.appliedKeys)n.get(u)===c&&(t.node.style[u]="",n.delete(u));a.appliedKeys=null}if(a.appliedClasses){for(const u of a.appliedClasses)t.node.classList.remove(u);a.appliedClasses=null}}}finally{_&&(0,A.popConfig)()}};s.__conditionalRunners.push(f);const d=(0,w.createEffect)(f,{depth:s.path.length});s.__effects.push(d)}}const pt=new WeakSet;function no(t){const s=t.ownerDocument;!s||pt.has(s)||(pt.add(s),queueMicrotask(()=>{pt.delete(s);const n=s.body||s.documentElement;n&&n.offsetWidth}))}const lt=new WeakSet;let Ot=!1;function co(t){const{node:s}=t;if(!s)return;if(Ot||(Ot=!0,(0,B.css)({display:"none"})),lt.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}lt.add(t);const n=t.context?.designSystem;n&&(0,A.pushConfig)(n);try{const c={};let i=!1;if(Object.prototype.hasOwnProperty.call(t,"theme")&&typeof t.theme!="function"&&b.CSS_PROPS_REGISTRY.theme){const o=b.CSS_PROPS_REGISTRY.theme(t.theme,t,t.state,t.context);if(o){if(Array.isArray(o))for(const e of o)e&&Object.assign(c,e);else Object.assign(c,o);i=!0}}for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||typeof t[o]=="function"||R.REGISTRY.has(o)||o==="theme")continue;const e=o.charCodeAt(0);if(!(e>=65&&e<=90)&&!Y(o)){if(b.CSS_PROPS_REGISTRY[o]){const r=t[o],a=b.CSS_PROPS_REGISTRY[o](r,t,t.state,t.context);if(a){if(Array.isArray(a))for(const f of a)f&&Object.assign(c,f);else Object.assign(c,a);i=!0}}else if(b.DEFAULT_CSS_PROPERTIES_LIST&&b.DEFAULT_CSS_PROPERTIES_LIST.has(o)){const r=t[o];r!=null&&typeof r!="object"&&(c[o]=r,i=!0)}else if(o.charCodeAt(0)===45){const r=t[o];r!=null&&typeof r!="object"&&(c[o]=r,i=!0)}else if(o.charAt(0)==="&"){const r=t[o];r&&typeof r=="object"&&(c[o]=r,i=!0)}else if(o.charAt(0)==="@"||o.charAt(0)===":"){const r=t[o];if(r&&typeof r=="object"){if(ut(o,t)){const a=Z(r,t,!0);Object.keys(a).length&&(c[`[data-theme="${o.slice(1)}"] &`]=a,i=!0)}else{let a=o;if(o.charAt(0)==="@"&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const d=t.context?.designSystem?.media?.[o.slice(1)];d&&(a=`@media ${d}`)}const f=Z(r,t,!1);Object.keys(f).length&&(c[a]=f,i=!0)}i=!0}}}}if(i){c.display&&String(c.display).includes("!important")&&(s.style.setProperty("display",String(c.display).replace(/\s*!important\s*$/,""),"important"),delete c.display);const o=(0,B.css)(c,null,t.context?.cssPrefix);if(o&&s.classList){const r=o.split(" ").filter(Boolean);let a=!1;for(const f of r)s.classList.add(f),a||(f.charCodeAt(0)===95&&f.charCodeAt(1)===99||f.charCodeAt(0)===95&&f.indexOf("_c",1)!==-1)&&(a=!0);a&&no(s)}const e=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(e!=null){const r=c.display;if(r&&r!==e)if(e==="none"){const a=[];for(const f of s.classList)f.startsWith("_d-")&&f!=="_d-none"&&a.push(f);for(const f of a)s.classList.remove(f);s.classList.add("_d-none")}else s.style.display=t.display}}}finally{n&&(0,A.popConfig)(),lt.delete(t)}}function Lt(t){const{node:s}=t;if(!s||!s.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const i in t.aria){const o=t.aria[i];if(typeof o=="function"||typeof o=="object"||o==null||o===!1)continue;const e="aria-"+i.replace(/[A-Z]/g,r=>"-"+r.toLowerCase());s.setAttribute(e,o===!0?"":o)}const n=(0,$.applyAttrTransforms)(t);for(const i in n){const o=n[i];o!=null&&o!==!1&&typeof o!="function"&&typeof o!="object"&&s.setAttribute(i,o===!0?"":o)}const c=t.tag||"div";for(const i in t){if(!Object.prototype.hasOwnProperty.call(t,i)||typeof t[i]=="function"||R.REGISTRY.has(i)||i==="on"||n[i]!==void 0)continue;const o=i.charCodeAt(0);if(!(o>=65&&o<=90)&&!Y(i)&&!(b.CSS_PROPS_REGISTRY[i]||b.DEFAULT_CSS_PROPERTIES_LIST&&b.DEFAULT_CSS_PROPERTIES_LIST.has(i))&&(0,$.checkAttributeByTagName)(c,i)){let e=t[i];if(e==null||(typeof e=="string"&&e.includes("{{")&&(e=(0,nt.replaceLiteralsWithObjectFields)(e,t,t.state,t.context),t[i]=e),e==null||typeof e=="function"||typeof e=="object")||e===!1&&!(0,$.isEnumeratedTrueFalseAttr)((0,$.camelToAttr)(i)||i))continue;const r=(0,$.camelToAttr)(i)||i;s.setAttribute(r,(0,$.serializeAttrValue)(r,e))}}}function ro(t){if(!t.autoGrow)return;const s=t.node;if(!s||s.tagName!=="TEXTAREA")return;const n=t.autoGrow,c=n&&typeof n=="object"&&n.max?String(n.max):null;c&&(s.style.maxHeight=c);const i=()=>{s.style.height="auto",s.style.height=s.scrollHeight+"px"};i(),s.addEventListener("input",i),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("input",i)}catch{}})}const $t=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function Dt(t,s){for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n)||!Y(n)||$t.has(n))continue;let c=t[n];if(typeof c=="string"&&/^[A-Za-z_$][\w$]*$/.test(c)){const o=c;c=function(r){return t.call(o,r)}}if(typeof c!="function")continue;const i=Gt(n);R.LIFECYCLE_EVENTS.has(i)||(0,Nt.registerEvent)(Zt(i),t,c)}io(t)}function io(t){const s=t.node;if(!s||!s.addEventListener)return;const n={};let c=!1;for(const y of $t){const l=t[y];typeof l=="function"&&(n[y]=l,c=!0)}if(!c)return;const i=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,o=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let e=0,r=0,a=0,f=!1;const d=y=>{const l=y.touches&&y.touches[0]||y.changedTouches&&y.changedTouches[0];l&&(e=l.clientX,r=l.clientY,a=Date.now(),f=!0)},p=y=>{if(!f)return;f=!1;const l=y.changedTouches&&y.changedTouches[0]||y.touches&&y.touches[0];if(!l)return;const _=l.clientX-e,u=l.clientY-r,h=Date.now()-a;if(h>o)return;const g=Math.abs(_),v=Math.abs(u);if(Math.max(g,v)<i)return;let x;if(g>v*1.2)x=_<0?"left":"right";else if(v>g*1.2)x=u<0?"up":"down";else return;const E="onSwipe"+x.charAt(0).toUpperCase()+x.slice(1),k=n[E],j=n.onSwipe;k&&k.call(t,y,t,t.state,t.context),j&&j.call(t,{direction:x,dx:_,dy:u,dt:h,event:y},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 st(t,s){const n={...t};for(const c in s){const i=n[c],o=s[c];i&&o&&typeof i=="object"&&typeof o=="object"&&!Array.isArray(i)&&!Array.isArray(o)&&typeof i!="function"&&typeof o!="function"?n[c]=st(i,o):n[c]=o}return n}function yt(t,s,n){if(!s||!t.node)return;const c=t.childExtends;if(Array.isArray(s)){const i=t.tag==="fragment",o=t.context?.document||globalThis.document,e=i?null:o?.createDocumentFragment();if(!i&&!e)return;const r=t.childProps,a=t.childrenAs;for(let f=0;f<s.length;f++){let d=s[f];const p=d;(typeof d=="string"||typeof d=="number")&&(d={text:d});let y=r;if(typeof r=="function")try{y=r(t,d)}catch{y=null}if(a==="state"){let u=p;(typeof p=="string"||typeof p=="number")&&(u={value:p,text:p}),d=y?{...y,state:u}:{state:u}}else y&&(d=st(y,d));if(c&&!d.ignoreChildExtends)if(d.extends){const u=Array.isArray(d.extends)?d.extends:[d.extends],h=Array.isArray(c)?c:[c];d={...d,extends:[...h,...u]}}else d={...d,extends:c};const l=d?.key||p&&typeof p=="object"&&p.key||`${f}`;let _;try{_=V(d,t,l,n)}catch(u){if(typeof console<"u"&&console.error){const h=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${l}" failed to construct at ${h} (initial render, skipping this row):`,u?.message||u)}continue}!i&&_?.node&&e.appendChild(_.node)}return i||t.node.appendChild(e),!0}if(typeof s=="string"){const i=St(s,t);if(Array.isArray(i))return yt(t,i,n)}if(typeof s=="object")for(const i in s){if(R.REGISTRY.has(i))continue;let o=s[i];if(!(o==null||o===!1)){if((typeof o=="string"||typeof o=="number")&&(o={text:o}),t.childProps&&(o=st(t.childProps,o)),c&&!o.ignoreChildExtends)if(o.extends){const e=Array.isArray(o.extends)?o.extends:[o.extends],r=Array.isArray(c)?c:[c];o={...o,extends:[...r,...e]}}else o={...o,extends:c};V(o,t,i,n)}}}function ht(t,s){const n=t.node;if(!n||n.tagName!=="SELECT")return;const c=n.options;if(!c||!c.length)return;const i=t.__ref,o=i&&i.__exec&&i.__exec.value,e=typeof o=="function",r=t.value!=null&&typeof t.value!="function";if(e||r){let d;if(e)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 a=s||!(i&&i.__selectSynced);if(i&&(i.__selectSynced=!0),!a)return;let f=-1;for(let d=0;d<c.length;d++)c[d].defaultSelected&&(f=d);f>=0&&n.selectedIndex!==f&&(n.selectedIndex=f)}function Tt(t,s){let{children:n,content:c}=t;const i=t.childExtends;if(typeof n=="function"){const r=n;try{n=r(t,t.state,t.context)}catch(y){if(n=void 0,typeof console<"u"&&console.error){const l=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${l} (initial run, treating as empty):`,y?.message||y)}}t.children=n;const a=t.__ref;let f=!1;const d=L(t,t.childrenDeps,r),p=(0,w.createEffect)(()=>{const y=f;f=!0;let l;try{l=d(t,t.state,t.context)}catch(k){if(typeof console<"u"&&console.error){const j=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${j}${y?"":" (initial tracking run)"}:`,k?.message||k)}return}if(!y||l===t.children)return;t.children=l;const _=typeof t.onContentUpdate=="function",u=_?[]:null,h=_?[]:null,g=_?[]:null;if(Array.isArray(l)&&t.childrenAs==="state"){const k=t.childProps,j=[],D=new Map;for(let C=0;C<l.length;C++){const T=l[C];let S=k;if(typeof k=="function")try{S=k(t,T)}catch{S=null}const F=S&&S.key||T&&T.key||`${C}`;j.push(F),D.set(F,{rawChild:T,childProps:S})}const H=new Set(j),U=a.__children.slice();for(const C of U)if(!H.has(C)){const T=t[C];T?.remove&&T.remove(),delete t[C],h&&h.push(C)}const Q=t.childExtends,tt=t.tag==="fragment",It=t.context?.document||globalThis.document,X=tt?null:It?.createDocumentFragment(),ct=new Set;for(const C of j){const T=D.get(C),S=T.rawChild,F=t[C];if(F&&F.state){if(S&&typeof S=="object"){const O=F.state,z=O.$replace||O.replace,xt=O.$update||O.update;if(typeof z=="function")z.call(O,S);else if(typeof xt=="function"){for(const M in O)if(!(M==="__element"||M==="root"||M==="parent"||M==="update")&&!Object.prototype.hasOwnProperty.call(S,M))try{O[M]=void 0}catch{}xt.call(O,S)}else for(const M in S)O[M]=S[M]}g&&g.push(C);continue}let rt=S;(typeof S=="string"||typeof S=="number")&&(rt={value:S,text:S});const bt=T.childProps;let N=bt?{...bt,state:rt}:{state:rt};if(Q&&!N.ignoreChildExtends)if(N.extends){const O=Array.isArray(N.extends)?N.extends:[N.extends],z=Array.isArray(Q)?Q:[Q];N={...N,extends:[...z,...O]}}else N={...N,extends:Q};let it;try{it=V(N,t,C,s)}catch(O){if(typeof console<"u"&&console.error){const z=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${C}" failed to construct at ${z} (reconcile, skipping this row):`,O?.message||O)}ct.add(C);continue}!tt&&it?.node&&X&&X.appendChild(it.node),u&&u.push(C)}if(!tt&&X&&X.childNodes.length&&t.node&&t.node.appendChild(X),!tt&&t.node){let C=null;for(const T of j){const S=t[T]?.node;if(!S)continue;const F=C?C.nextSibling:t.node.firstChild;S!==F&&t.node.insertBefore(S,F),C=S}}a.__children=ct.size?j.filter(C=>!ct.has(C)):j,_&&(u.length||h.length)&&vt(t,{added:u,removed:h,kept:g}),ht(t,!1);return}const E=_?[...a.__children]:null;for(const k of[...a.__children]){const j=t[k];j?.remove&&j.remove(),delete t[k]}a.__children=[],yt(t,l,s),ht(t,!1),_&&vt(t,{added:[...a.__children],removed:E,kept:[]})},{depth:a.path.length});a.__effects.push(p)}const o=yt(t,n||c,s);if((n||c)&&!o)return;const e=t.context?.components||{};{const r=Object.keys(t);for(let a=0;a<r.length;a++){const f=r[a];if(!f.endsWith("Extends")||typeof t[f]!="string")continue;const d=f.slice(0,-7);if(!d||d.charCodeAt(0)<65||d.charCodeAt(0)>90)continue;const p={extends:t[f]};delete t[f];for(let y=a+1;y<r.length;y++){const l=r[y],_=l.charCodeAt(0);if(_>=65&&_<=90||R.REGISTRY.has(l)||typeof t[l]=="function"&&(l.startsWith("on")||l.startsWith(".")))break;const u=t[l];u!==void 0&&(p[l]=u,delete t[l])}t[d]&&typeof t[d]=="object"?t[d]={...p,...t[d]}:t[d]=p}}for(const r in t){if(!Object.prototype.hasOwnProperty.call(t,r)||R.REGISTRY.has(r)||typeof t[r]!="object"||t[r]===null)continue;const a=r.charCodeAt(0);if(a<65||a>90)continue;let f=t[r];if(!f.__ref){if(!f.extends&&!f.extend){const d=e[r]||e[`smbls.${r}`];d&&(f={...f,extends:d})}if(t.childProps&&(f=st(t.childProps,f)),i&&!f.ignoreChildExtends)if(f.extends){const d=Array.isArray(f.extends)?f.extends:[f.extends],p=Array.isArray(i)?i:[i];f={...f,extends:[...p,...d]}}else f={...f,extends:i};V(f,t,r,s)}}}function Rt(t,s,n){const{node:c}=t;if(!c)return;c.ref=t;const i=s?.tag==="fragment"?s.__ref?.__fragmentAnchor:null;if(i){const e=i.parentNode;if(e){if(n?.position==="before"&&n.node)e.insertBefore(c,n.node);else if(n?.position==="after"&&n.node){const r=n.node.nextSibling;e.insertBefore(c,r||i)}else e.insertBefore(c,i);return}}const o=s?.node||(s?.nodeType?s:null);if(o)if(n?.position==="before"&&n.node)o.insertBefore(c,n.node);else if(n?.position==="after"&&n.node){const e=n.node.nextSibling;e?o.insertBefore(c,e):o.appendChild(c)}else o.appendChild(c)}function I(t,s,n){const c=t.charAt(0).toLowerCase()+t.slice(1);s.context?.plugins?.length&&(0,K.runPluginHook)(c,s,n);const i="on"+t,o=s[i];if(typeof o=="function"){const e=t==="Render"||t==="RenderRouter";if(e){if(s.__ref.__inRender)return!0;s.__ref.__inRender=!0}const r=s.context?.designSystem;r&&(0,A.pushConfig)(r);try{if(o(s,s.state,s.context,n)===!1)return!1}catch(a){if(s.context?.plugins?.length&&(0,K.runPluginHook)("error",s,{hook:i,error:a})||console.error(`[DOMQL] Lifecycle "${i}" error:`,a),s.context?.strictMode)throw a}finally{r&&(0,A.popConfig)(),e&&(s.__ref.__inRender=!1)}}return!0}var eo=V;
4
+ `):"")}}if(bt(o,!0),Ft(o,s,i),typeof o.html=="function"&&o.node&&!o.node.innerHTML){const l=o.context?.designSystem;l&&(0,A.pushConfig)(l);try{const h=o.html(o,o.state,o.context);h!=null&&typeof h!="function"&&(o.node.innerHTML=h)}catch{}finally{l&&(0,A.popConfig)()}}if(I("Create",o,c),I("Complete",o,c),I("Render",o,c),I("RenderRouter",o,c),St(o,c),typeof o.onFrame=="function"){const l=o.onFrame,h=o.context?.designSystem,g=()=>{if(o.node){if(o.node.isConnected){h&&(0,A.pushConfig)(h);try{l(o,o.state,o.context)}catch(C){console.error("[DOMQL] onFrame error:",C)}finally{h&&(0,A.popConfig)()}}requestAnimationFrame(g)}};requestAnimationFrame(g)}return o}function Xt(t,s,n){const c=!s,i=n.state&&typeof n.state=="object"&&!Array.isArray(n.state)&&Object.keys(n.state).length===0,o=c&&i&&t.context?.state,f=n.state!==void 0&&!o?n.state:t.state&&!(0,P.isStore)(t.state)?t.state:void 0;if(f==null){if(s?.state)t.state=s.state,(0,q.applyStateMethods)(t,t.state);else if(t.context?.state){const r=t.context.state,e={...r},a=t.context?.polyglot;if(a?.translations){const u=r.lang||a.defaultLang||"en",d=a.translations[u];if(d&&typeof d=="object")for(const y in d)e[y]===void 0&&(e[y]=d[y]);const p=new Set(a.languages||[]);for(const y in a.translations)!p.has(y)&&e[y]===void 0&&(e[y]=a.translations[y])}t.state=(0,P.isStore)(e)?e:(0,P.createStore)(e),t.state.__element=t,t.state.root=t.state,(0,q.applyStateMethods)(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),(0,q.applyStateMethods)(t,t.state);return}if(typeof f=="string"){if(t.state=wt(f,s),t.state&&typeof t.state=="object"&&!(0,P.isStore)(t.state)){const r=s?.state?.root||s?.state||t.state;Object.defineProperty(t.state,"root",{value:r,enumerable:!1,configurable:!0,writable:!0})}(0,q.applyStateMethods)(t,t.state);return}if(typeof f=="function"){const r=f(t,s?.state);t.state=(0,P.isStore)(r)?r:(0,P.createStore)(r||{})}else(0,P.isStore)(f)?t.state=f:t.state=(0,P.createStore)({...f});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,q.applyStateMethods)(t,t.state)}function ut(t,s){if(!s)return t;const n=s.split("/");let c=t;for(const i of n){if(c==null)return{};c=c[i]}return c??{}}function wt(t,s){if(!s)return{};if(t===".")return s.state||{};if(t.startsWith("../")){const i=t.slice(3);return i?ut(s.state,i):s.state??{}}if(t.startsWith("~/")){const i=s.state?.root||s.state,o=t.slice(2);return o?ut(i,o):i??{}}if(s.state?.[t]!==void 0)return s.state[t];const n=ut(s.state,t);if(n!=null&&Object.keys(n).length>0)return n;const c=s.context?.polyglot;if(c?.translations){const i=s.state?.root?.lang||c.defaultLang||"en",o=c.translations[i];if(o?.[t]!==void 0)return o[t];if(c.translations[t]!==void 0)return c.translations[t]}return{}}function Jt(t){const s=t.__ref,n=t.tag||"div",c=t.context?.designSystem,i=[],o=Object.keys(t);for(let f=0;f<o.length;f++){const r=o[f];if(typeof t[r]!="function"||R.REGISTRY.has(r))continue;const e=r.charCodeAt(0);e>=65&&e<=90||Y(r)||b.CSS_PROPS_REGISTRY[r]||b.DEFAULT_CSS_PROPERTIES_LIST&&b.DEFAULT_CSS_PROPERTIES_LIST.has(r)||(0,D.checkAttributeByTagName)(n,r)||i.push({prop:r,fn:t[r]})}for(let f=0;f<i.length;f++){const{prop:r,fn:e}=i[f];s.__exec[r]=e,Object.defineProperty(t,r,{get(){c&&(0,A.pushConfig)(c);try{return e(t,t.state,t.context)}catch{return}finally{c&&(0,A.popConfig)()}},set(a){delete s.__exec[r],Object.defineProperty(t,r,{value:a,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function mt(t,s){if(!(!Array.isArray(s)||s.length===0))for(let n=0;n<s.length;n++){const c=s[n];try{typeof c=="function"?c(t,t.state,t.context):typeof c=="string"&&t.state?.[c]}catch{}}}function L(t,s,n){return!Array.isArray(s)||s.length===0?n:function(...c){return mt(t,s),n.apply(this,c)}}function m(t,s){if(!(!t||Array.isArray(t)||typeof t!="object"))return t[s]}function jt(t,s){const n=t.__ref,c=!!(s&&s.skipIfEffect);if(Jt(t),typeof t.text=="function"){const o=t.text,f=L(t,t.textDeps,o),r=(0,v.createEffect)(()=>{if(!n.contentManaged)try{let e=f(t,t.state,t.context);t.node&&e!=null&&typeof e!="function"&&typeof e!="object"&&(typeof e=="string"&&e.includes("{{")&&(e=nt.replaceLiteralsWithObjectFields.call(t,e,t.state)),t.tag==="string"?t.node.nodeValue=e:t.node.textContent=e)}catch{}},{depth:n.path.length});n.__effects.push(r),n.__exec.text=o}else if(typeof t.text=="string"&&t.text.includes("{{")){const o=t.text,f=(0,v.createEffect)(()=>{if(n.contentManaged)return;const r=nt.replaceLiteralsWithObjectFields.call(t,o,t.state);r!=null&&(t.text=r),t.node&&(t.tag==="string"?t.node.nodeValue=r??"":t.node.textContent=r??"")},{depth:n.path.length});n.__effects.push(f),n.__exec.text=o}for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)&&typeof t[o]=="function"&&!R.REGISTRY.has(o)&&!Y(o)&&!n.__exec[o]){if(b.CSS_PROPS_REGISTRY[o]){const f=t[o],r=L(t,t[o+"Deps"],f),e=o;let a;const u=(0,v.createEffect)(()=>{const d=t.context?.designSystem;d&&(0,A.pushConfig)(d);try{const p=r(t,t.state,t.context),y=b.CSS_PROPS_REGISTRY[e](p,t,t.state,t.context);if(y&&t.node){const _=lt(y);(_===null||_!==a)&&(a=_,G(t.node,y))}else t.node&&(e==="show"||e==="hide")&&(a=void 0,t.node.style.display="")}finally{d&&(0,A.popConfig)()}},{depth:n.path.length});n.__effects.push(u),n.__exec[o]=f}else if(b.DEFAULT_CSS_PROPERTIES_LIST&&b.DEFAULT_CSS_PROPERTIES_LIST.has(o)){const f=t[o],r=L(t,t[o+"Deps"],f),e=o;let a;const u=(0,v.createEffect)(()=>{const d=t.context?.designSystem;d&&(0,A.pushConfig)(d);try{const p=r(t,t.state,t.context);if(t.node)if(p!=null){const y=e+":"+String(p);y!==a&&(a=y,G(t.node,{[e]:p}))}else a=void 0,t.node.style[e]=""}finally{d&&(0,A.popConfig)()}},{depth:n.path.length});n.__effects.push(u),n.__exec[o]=f}}if(typeof t.html=="function"){const o=t.html,f=L(t,t.htmlDeps,o),r=(0,v.createEffect)(()=>{const e=t.context?.designSystem;e&&(0,A.pushConfig)(e);try{const a=f(t,t.state,t.context);t.node&&a!=null&&typeof a!="function"&&(t.node.innerHTML=a)}finally{e&&(0,A.popConfig)()}},{depth:n.path.length});n.__effects.push(r),n.__exec.html=o}if(typeof t.value=="function"){const o=t.value,f=L(t,t.valueDeps,o),r=(0,v.createEffect)(()=>{try{const e=f(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const a=e==null?"":String(e);if(t.node.value===a)return;const u=typeof document<"u"&&document.activeElement===t.node,d=u&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,p=u&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=a,u&&d!=null&&p!=null)try{t.node.setSelectionRange(d,p)}catch{}}catch{}},{depth:n.path.length});n.__effects.push(r),n.__exec.value=o}if(typeof t.style=="function"){const o=t.style,f=L(t,t.styleDeps,o);let r;const e=(0,v.createEffect)(()=>{const a=f(t,t.state,t.context),u=lt(a);(u===null||u!==r)&&(r=u,G(t.node,a))},{depth:n.path.length});n.__effects.push(e),n.__exec.style=o}else if(t.style&&typeof t.style=="object")for(const o in t.style){const f=t.style[o];if(typeof f!="function")continue;const r=L(t,m(t.styleDeps,o),f);let e;const a=(0,v.createEffect)(()=>{try{const u=r(t,t.state,t.context);if(t.node){const d=o+":"+String(u);d!==e&&(e=d,G(t.node,{[o]:u}))}}catch{}},{depth:n.path.length});n.__effects.push(a)}if(t.attr&&typeof t.attr=="object"){for(const o in t.attr)if(typeof t.attr[o]=="function"){const f=L(t,m(t.attrDeps,o),t.attr[o]),r=o,e=(0,v.createEffect)(()=>{try{const a=f(t,t.state,t.context);t.node?.setAttribute&&(a==null||a===!1?t.node.removeAttribute(r):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(r,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){if(typeof t.aria[o]!="function")continue;const f=L(t,m(t.ariaDeps,o),t.aria[o]),r="aria-"+o.replace(/[A-Z]/g,a=>"-"+a.toLowerCase()),e=(0,v.createEffect)(()=>{try{const a=f(t,t.state,t.context);if(!t.node?.setAttribute)return;a==null||a===!1?t.node.removeAttribute(r):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(r,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){if(typeof t.data[o]!="function")continue;const f=L(t,m(t.dataDeps,o),t.data[o]),e="data-"+o.replace(/[A-Z]/g,u=>"-"+u.toLowerCase()),a=(0,v.createEffect)(()=>{try{const u=f(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 i=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(i)for(const o in i){if(typeof i[o]!="function")continue;const f=L(t,m(t.classDeps,o),i[o]),r=(0,v.createEffect)(()=>{try{const e=f(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(r)}!c&&typeof t.if=="function"&&Pt(t,n,t.if);for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||R.REGISTRY.has(o)||typeof t[o]!="function")continue;const f=o.charCodeAt(0);if(f>=65&&f<=90||Y(o))continue;const r=t[o];n.__exec[o]=r;const e=t.tag||"div";if((0,D.checkAttributeByTagName)(e,o)&&!b.CSS_PROPS_REGISTRY[o]&&!(b.DEFAULT_CSS_PROPERTIES_LIST&&b.DEFAULT_CSS_PROPERTIES_LIST.has(o))){const a=(0,D.camelToAttr)(o)||o,u=L(t,t[o+"Deps"],r),d=(0,v.createEffect)(()=>{try{const p=u(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(so(t),ro(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const o=t.onStateUpdate,f=t.stateDeps;let r=!1,e=[];const a=(0,v.createEffect)(()=>{const u=[];for(let _=0;_<f.length;_++){const l=f[_];try{u[_]=typeof l=="function"?l(t,t.state,t.context):t.state?.[l]}catch{u[_]=void 0}}if(!r){r=!0,e=u;return}let d=u.length!==e.length;for(let _=0;!d&&_<u.length;_++)u[_]!==e[_]&&(d=!0);const p=e;if(e=u,!d)return;const y=t.context?.designSystem;y&&(0,A.pushConfig)(y);try{o(t,t.state,t.context,{prev:p,next:u})}catch(_){if(t.context?.plugins?.length&&(0,K.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)}co(t)}function Et(t){const s=t.parent,n=s?.node;if(!n||!t.node){Ft(t,t.parent);return}let c=null;const i=Object.keys(s),o=i.indexOf(t.key);for(let f=o+1;f<i.length;f++){const r=s[i[f]];if(r?.node?.parentNode===n){c=r.node;break}}c?n.insertBefore(t.node,c):n.appendChild(t.node)}function Pt(t,s,n){const c=L(t,t.ifDeps,n),i=(0,v.createEffect)(()=>{let o;try{o=c(t,t.state,t.context)}catch(r){if(o=!1,s.__ifError=r,typeof console<"u"&&console.warn){const e=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${e} \u2014 treating as false:`,r?.message||r)}return}const f=s.__if;if(s.__if=!!o,f&&!s.__if&&t.node)t.node.remove();else if(!f&&s.__if)if(s.__ifInitialized)t.node||(t.node=(0,W.cacheNode)(t)),t.node&&(t.node.ref=t),Et(t),dt(t);else{if(s.__ifInitialized=!0,t.tag||(t.tag=(0,W.detectTag)(t)),I("Init",t,{}),t.node||(t.node=(0,W.cacheNode)(t)),!t.node)return;if(t.parent?.__ref?.__children&&!t.parent.__ref.__children.includes(t.key)&&t.parent.__ref.__children.push(t.key),t.tag==="fragment"&&!s.__fragmentAnchor){const e=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(e),s.__fragmentAnchor=e}I("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),Rt(t,{}),jt(t,{skipIfEffect:!0}),dt(t),$t(t),Nt(t,{}),Et(t),St(t,{})}},{depth:s.path.length});s.__effects.push(i)}function dt(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),eo(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"&&G(s,t.style),t.attr&&typeof t.attr=="object")for(const n in t.attr){const c=t.attr[n];typeof c=="function"||typeof c=="object"||c==null||c===!1||s.setAttribute&&s.setAttribute(n,c===!0?"":c)}if(t.data&&typeof t.data=="object")for(const n in t.data){const c=t.data[n];typeof c=="function"||typeof c=="object"||c==null||c===!1||s.dataset&&(s.dataset[n]=c===!0?"":c)}if(t.classlist||t.class){const n=t.classlist||t.class;if(typeof n=="string")n.split(" ").forEach(c=>c&&s.classList.add(c));else if(typeof n=="object")for(const c in n){const i=typeof n[c]=="function"?n[c](t,t.state,t.context):n[c];i&&s.classList.add(typeof i=="string"?i:c)}}}}function lt(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function G(t,s){if(!t||!s||!t.style)return;let n=null;for(const c in s){const i=s[c];if(i!=null){if(c.charAt(0)==="&"&&typeof i=="object"){n||(n={}),n[c]=i;continue}try{const o=String(i),f=c.replace(/[A-Z]/g,u=>"-"+u.toLowerCase()),r=o.trim(),e=/\s*!important\s*$/.test(r),a=r.replace(/\s*!important\s*$/,"");t.style.setProperty(f,a,e?"important":"")}catch{}}}n&&oo(t,n)}let to=0;function oo(t,s){const n=`_ds${to++}`;t.classList.add(n);const c=t.ownerDocument;let i=c.querySelector("style[data-smbls-scoped]");i||(i=c.createElement("style"),i.setAttribute("data-smbls-scoped",""),c.head.appendChild(i));let o="";for(const f in s){const r="."+n,e=f.replace(/&/g,r).split(",").map(u=>{const d=u.trim();return d.includes(r)?d:r+d}).join(", "),a=s[f];if(typeof a=="object"){let u="",d="";for(const p in a){const y=a[p];if(typeof y=="object"){const _=p.includes("&")?e.split(", ").map(h=>p.replace(/&/g,h)).join(", "):e.split(", ").map(h=>`${h} ${p}`).join(", ");let l="";for(const h in y)l+=`${h.replace(/[A-Z]/g,g=>"-"+g.toLowerCase())}: ${y[h]};`;d+=(0,U.wrapHoverRule)(`${_} { ${l} }`,_)+`
5
+ `}else u+=`${p.replace(/[A-Z]/g,_=>"-"+_.toLowerCase())}: ${y};`}u&&(o+=(0,U.wrapHoverRule)(`${e} { ${u} }`,e)+`
6
+ `),d&&(o+=d)}}o&&(i.textContent+=o)}function so(t){let s=t.subscribeTo;if(typeof s=="function")try{s=s(t,t.state,t.context)}catch{s=null}if(!Array.isArray(s)||s.length===0)return;const n=t.__ref;for(let c=0;c<s.length;c++){const i=s[c];if(typeof i!="string"||i.length===0)continue;const o=i.split("."),f=o[0],r=o.slice(1),e={value:!1},a=(0,v.createEffect)(()=>{const u=t.state&&((0,P.isStore)(t.state)?t.state.root:null);if(!u||!(0,P.isStore)(u))return;let d=u;d=d[f];for(let y=0;y<r.length&&!(d==null||typeof d!="object");y++)if((0,P.isStore)(d))d=d[r[y]];else break;if(!e.value)return;let p=!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&&(p=!0)}catch(_){t.context?.plugins?.length&&(0,K.runPluginHook)("error",t,{hook:"onBeforeUpdate",error:_})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",_)}finally{y&&(0,A.popConfig)()}}if(!p&&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(!p&&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,K.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 pt(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)])}const Ot=new Set;function no(t,s){const n=s?.__ref?.path?s.__ref.path.join("."):s?.key||"?",c=n+"::"+t;Ot.has(c)||(Ot.add(c),console.warn(`[smbls/css] "${t}" at ${n} is a CHILD-COMPONENT key nested inside a pseudo/selector block (":hover", "@dark", etc.) \u2014 that is never a valid CSS selector fragment. The rule is DROPPED (not shipped as a dead/never-matching selector). To reveal a child on a parent state, target the child's OWN class from the parent selector instead, e.g. move the declaration onto the child element itself, or use a sibling-selector combinator in a top-level style block.`))}function Z(t,s,n){const c={},i=new Set,o=(f,r,e)=>{const a=e?new Set(Object.keys(c)):null;if(b.CSS_PROPS_REGISTRY[f]){const u=b.CSS_PROPS_REGISTRY[f](r,s,s.state,s.context);if(u){const d=Array.isArray(u)?u:[u];for(const p of d)p&&Object.assign(c,p)}}else c[f]=r;if(e)for(const u in c)a.has(u)||i.add(u)};for(const f in t){if(!Object.prototype.hasOwnProperty.call(t,f))continue;let r=t[f];if(typeof r=="function"&&(r=r(s,s.state,s.context)),r==null||typeof r=="function")continue;if(typeof r=="object"&&!Array.isArray(r)){if(f==="style"){for(const d in r){let p=r[d];if(typeof p=="function"&&(p=p(s,s.state,s.context)),p==null||typeof p=="function")continue;const y=typeof s[d]=="function"&&(b.CSS_PROPS_REGISTRY[d]||b.DEFAULT_CSS_PROPERTIES_LIST&&b.DEFAULT_CSS_PROPERTIES_LIST.has(d));o(d,p,y)}continue}if(pt(f,s)){const d=Z(r,s,!0);Object.keys(d).length&&(c[`[data-theme="${f.slice(1)}"] &`]=d);continue}if(/^[A-Z][A-Za-z0-9]*$/.test(f)){(0,xt.isLoudDevRuntime)()&&no(f,s);continue}let a=f;if(f.charCodeAt(0)===64&&!f.startsWith("@media")&&!f.startsWith("@keyframes")){const d=s.context?.designSystem?.media?.[f.slice(1)];d&&(a=`@media ${d}`)}const u=Z(r,s,!1);Object.keys(u).length&&(c[a]=u);continue}const e=typeof s[f]=="function"&&(b.CSS_PROPS_REGISTRY[f]||b.DEFAULT_CSS_PROPERTIES_LIST&&b.DEFAULT_CSS_PROPERTIES_LIST.has(f));o(f,r,e)}if(n)for(const f in c)i.add(f);for(const f of i){const r=c[f];typeof r=="string"&&!r.includes("!important")&&(c[f]=r+" !important")}return c}function yt(t,s){if(s===void 0&&(s=0),s>8)return!1;if(typeof t=="function")return!0;if(t&&typeof t=="object"&&!Array.isArray(t)){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&yt(t[n],s+1))return!0}return!1}function Lt(t,s,n){if(!s||typeof s!="object"||Array.isArray(s))return null;if(pt(t,n)){const o=Z(s,n,!0);return Object.keys(o).length?{cssProp:`[data-theme="${t.slice(1)}"] &`,block:o}:null}let c=t;if(t.charAt(0)==="@"&&!t.startsWith("@media")&&!t.startsWith("@keyframes")){const o=n.context?.designSystem?.media?.[t.slice(1)];o&&(c=`@media ${o}`)}const i=Z(s,n,!1);return Object.keys(i).length?{cssProp:c,block:i}:null}function co(t){const s=t.__ref;for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n)||!at(n))continue;const c=t[n];if(!c||typeof c!="object"||Array.isArray(c)||!yt(c))continue;let i=null,o;const f=(0,v.createEffect)(()=>{if(!t.node)return;const r=t.context?.designSystem;r&&(0,A.pushConfig)(r);let e,a=!1;try{const u=Lt(n,c,t),d=u?lt(u.block)+"::"+u.cssProp:null;if(d!==null&&d===o)a=!0;else if(o=d,u){const p=(0,U.css)({[u.cssProp]:u.block},null,t.context?.cssPrefix);e=p?p.split(" ").filter(Boolean):null}else e=null}finally{r&&(0,A.popConfig)()}if(!(a||!t.node.classList)){if(i)for(const u of i)t.node.classList.remove(u);if(e&&e.length)for(const u of e)t.node.classList.add(u);i=e}},{depth:s.path.length});s.__effects.push(f)}}function ro(t){const s=t.__ref;s.__conditionalRunners=[];const n=new Map;for(const c in t){if(!Object.prototype.hasOwnProperty.call(t,c))continue;const i=c.charAt(0);if(i!=="."&&i!=="!")continue;const o=c.slice(1);if(!o)continue;if(/[:@\s>~+[\]]/.test(o)){if(typeof console<"u"&&console.warn){const d=o.split(/[:@\s>~+[\]]/)[0];console.warn(`[smbls] conditional \`${c}\` on ${t.key||"?"} will never match \u2014 the whole string after \`${i}\` is read as one prop name. Nest the selector inside instead: \`${i}${d}: { '${o.slice(d.length)}': {...} }\`.`)}continue}const f=t[c];if(!f||typeof f!="object")continue;const r=i==="!",e={lastMatch:!1,appliedKeys:null,appliedClasses:null},a=()=>{let d;const p=t[o];if(p===void 0){const l=!!t.state&&o in t.state,h=t.state?t.state[o]:void 0;if(l||h!==void 0)d=h;else{const g=t.context?.cases?.[o];if(g===void 0)return;try{d=typeof g=="function"?g.call(t,t):g}catch(C){d=!1,s.__conditionalError=C,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${c}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,C?.message||C)}}}else if(typeof p=="function")try{d=p(t,t.state,t.context)}catch(l){d=!1,s.__conditionalError=l,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${c}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,l?.message||l)}else d=p;const y=r?!d:!!d;if(!t.node||y===e.lastMatch)return;e.lastMatch=y;const _=t.context?.designSystem;_&&(0,A.pushConfig)(_);try{if(y){const l={},h={};let g=!1;for(const x in f){if(!Object.prototype.hasOwnProperty.call(f,x))continue;const E=f[x],w=x.charAt(0);if((w===":"||w==="@"||w==="&")&&E&&typeof E=="object"&&!Array.isArray(E)){if(pt(x,t)){const $=Z(E,t,!0);Object.keys($).length&&(h[`[data-theme="${x.slice(1)}"] &`]=$,g=!0)}else{let $=x;if(w==="@"&&!x.startsWith("@media")&&!x.startsWith("@keyframes")){const V=t.context?.designSystem?.media?.[x.slice(1)];V&&($=`@media ${V}`)}const H=Z(E,t,!1);Object.keys(H).length&&(h[$]=H,g=!0)}continue}const j=typeof E=="function"?E(t,t.state,t.context):E;if(j!=null)if(b.CSS_PROPS_REGISTRY[x]){const $=b.CSS_PROPS_REGISTRY[x](j,t,t.state,t.context);if($){const H=Array.isArray($)?$:[$];for(const V of H)V&&Object.assign(l,V)}}else b.DEFAULT_CSS_PROPERTIES_LIST&&b.DEFAULT_CSS_PROPERTIES_LIST.has(x)&&(l[x]=j)}const C=Object.keys(l);if(C.length){G(t.node,l);for(const x of C)n.set(x,c);e.appliedKeys=C}else e.appliedKeys=null;if(g){const x=(0,U.css)(h,null,t.context?.cssPrefix),E=x?x.split(" ").filter(Boolean):[];if(E.length&&t.node.classList){for(const w of E)t.node.classList.add(w);e.appliedClasses=E}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 l of e.appliedKeys)n.get(l)===c&&(t.node.style[l]="",n.delete(l));e.appliedKeys=null}if(e.appliedClasses){for(const l of e.appliedClasses)t.node.classList.remove(l);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 ht=new WeakSet;function io(t){const s=t.ownerDocument;!s||ht.has(s)||(ht.add(s),queueMicrotask(()=>{ht.delete(s);const n=s.body||s.documentElement;n&&n.offsetWidth}))}const _t=new WeakSet;let Dt=!1;function eo(t){const{node:s}=t;if(!s)return;if(Dt||(Dt=!0,(0,U.css)({display:"none"})),_t.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}_t.add(t);const n=t.context?.designSystem;n&&(0,A.pushConfig)(n);try{const c={};let i=!1;if(Object.prototype.hasOwnProperty.call(t,"theme")&&typeof t.theme!="function"&&b.CSS_PROPS_REGISTRY.theme){const o=b.CSS_PROPS_REGISTRY.theme(t.theme,t,t.state,t.context);if(o){if(Array.isArray(o))for(const f of o)f&&Object.assign(c,f);else Object.assign(c,o);i=!0}}for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||typeof t[o]=="function"||R.REGISTRY.has(o)||o==="theme")continue;const f=o.charCodeAt(0);if(!(f>=65&&f<=90)&&!Y(o)){if(b.CSS_PROPS_REGISTRY[o]){const r=t[o],e=b.CSS_PROPS_REGISTRY[o](r,t,t.state,t.context);if(e){if(Array.isArray(e))for(const a of e)a&&Object.assign(c,a);else Object.assign(c,e);i=!0}}else if(b.DEFAULT_CSS_PROPERTIES_LIST&&b.DEFAULT_CSS_PROPERTIES_LIST.has(o)){const r=t[o];r!=null&&typeof r!="object"&&(c[o]=r,i=!0)}else if(o.charCodeAt(0)===45){const r=t[o];r!=null&&typeof r!="object"&&(c[o]=r,i=!0)}else if(o.charAt(0)==="&"||o.charAt(0)==="@"||o.charAt(0)===":"){const r=t[o];if(r&&typeof r=="object"&&!Array.isArray(r)){if(yt(r))continue;const e=Lt(o,r,t);e&&(c[e.cssProp]=e.block,i=!0)}}}}if(i){c.display&&String(c.display).includes("!important")&&(s.style.setProperty("display",String(c.display).replace(/\s*!important\s*$/,""),"important"),delete c.display);const o=(0,U.css)(c,null,t.context?.cssPrefix);if(o&&s.classList){const r=o.split(" ").filter(Boolean);let e=!1;for(const a of r)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&&io(s)}const f=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(f!=null){const r=c.display;if(r&&r!==f)if(f==="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)(),_t.delete(t)}}function $t(t){const{node:s}=t;if(!s||!s.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const i in t.aria){const o=t.aria[i];if(typeof o=="function"||typeof o=="object"||o==null||o===!1)continue;const f="aria-"+i.replace(/[A-Z]/g,r=>"-"+r.toLowerCase());s.setAttribute(f,o===!0?"":o)}const n=(0,D.applyAttrTransforms)(t);for(const i in n){const o=n[i];o!=null&&o!==!1&&typeof o!="function"&&typeof o!="object"&&s.setAttribute(i,o===!0?"":o)}const c=t.tag||"div";for(const i in t){if(!Object.prototype.hasOwnProperty.call(t,i)||typeof t[i]=="function"||R.REGISTRY.has(i)||i==="on"||n[i]!==void 0)continue;const o=i.charCodeAt(0);if(!(o>=65&&o<=90)&&!Y(i)&&!(b.CSS_PROPS_REGISTRY[i]||b.DEFAULT_CSS_PROPERTIES_LIST&&b.DEFAULT_CSS_PROPERTIES_LIST.has(i))&&(0,D.checkAttributeByTagName)(c,i)){let f=t[i];if(f==null||(typeof f=="string"&&f.includes("{{")&&(f=(0,nt.replaceLiteralsWithObjectFields)(f,t,t.state,t.context),t[i]=f),f==null||typeof f=="function"||typeof f=="object")||f===!1&&!(0,D.isEnumeratedTrueFalseAttr)((0,D.camelToAttr)(i)||i))continue;const r=(0,D.camelToAttr)(i)||i;s.setAttribute(r,(0,D.serializeAttrValue)(r,f))}}}function fo(t){if(!t.autoGrow)return;const s=t.node;if(!s||s.tagName!=="TEXTAREA")return;const n=t.autoGrow,c=n&&typeof n=="object"&&n.max?String(n.max):null;c&&(s.style.maxHeight=c);const i=()=>{s.style.height="auto",s.style.height=s.scrollHeight+"px"};i(),s.addEventListener("input",i),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("input",i)}catch{}})}const Tt=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function Rt(t,s){for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n)||!Y(n)||Tt.has(n))continue;let c=t[n];if(typeof c=="string"&&/^[A-Za-z_$][\w$]*$/.test(c)){const o=c;c=function(r){return t.call(o,r)}}if(typeof c!="function")continue;const i=qt(n);R.LIFECYCLE_EVENTS.has(i)||(0,Mt.registerEvent)(Qt(i),t,c)}ao(t)}function ao(t){const s=t.node;if(!s||!s.addEventListener)return;const n={};let c=!1;for(const p of Tt){const y=t[p];typeof y=="function"&&(n[p]=y,c=!0)}if(!c)return;const i=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,o=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let f=0,r=0,e=0,a=!1;const u=p=>{const y=p.touches&&p.touches[0]||p.changedTouches&&p.changedTouches[0];y&&(f=y.clientX,r=y.clientY,e=Date.now(),a=!0)},d=p=>{if(!a)return;a=!1;const y=p.changedTouches&&p.changedTouches[0]||p.touches&&p.touches[0];if(!y)return;const _=y.clientX-f,l=y.clientY-r,h=Date.now()-e;if(h>o)return;const g=Math.abs(_),C=Math.abs(l);if(Math.max(g,C)<i)return;let x;if(g>C*1.2)x=_<0?"left":"right";else if(C>g*1.2)x=l<0?"up":"down";else return;const E="onSwipe"+x.charAt(0).toUpperCase()+x.slice(1),w=n[E],j=n.onSwipe;w&&w.call(t,p,t,t.state,t.context),j&&j.call(t,{direction:x,dx:_,dy:l,dt:h,event:p},t,t.state,t.context)};s.addEventListener("touchstart",u,{passive:!0}),s.addEventListener("touchend",d,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("touchstart",u)}catch{}try{s.removeEventListener("touchend",d)}catch{}})}function st(t,s){const n={...t};for(const c in s){const i=n[c],o=s[c];i&&o&&typeof i=="object"&&typeof o=="object"&&!Array.isArray(i)&&!Array.isArray(o)&&typeof i!="function"&&typeof o!="function"?n[c]=st(i,o):n[c]=o}return n}function gt(t,s,n){if(!s||!t.node)return;const c=t.childExtends;if(Array.isArray(s)){const i=t.tag==="fragment",o=t.context?.document||globalThis.document,f=i?null:o?.createDocumentFragment();if(!i&&!f)return;const r=t.childProps,e=t.childrenAs;for(let a=0;a<s.length;a++){let u=s[a];const d=u;(typeof u=="string"||typeof u=="number")&&(u={text:u});let p=r;if(typeof r=="function")try{p=r(t,u)}catch{p=null}if(e==="state"){let l=d;(typeof d=="string"||typeof d=="number")&&(l={value:d,text:d}),u=p?{...p,state:l}:{state:l}}else p&&(u=st(p,u));if(c&&!u.ignoreChildExtends)if(u.extends){const l=Array.isArray(u.extends)?u.extends:[u.extends],h=Array.isArray(c)?c:[c];u={...u,extends:[...h,...l]}}else u={...u,extends:c};const y=u?.key||d&&typeof d=="object"&&d.key||`${a}`;let _;try{_=B(u,t,y,n)}catch(l){if(typeof console<"u"&&console.error){const h=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${y}" failed to construct at ${h} (initial render, skipping this row):`,l?.message||l)}continue}!i&&_?.node&&f.appendChild(_.node)}return i||t.node.appendChild(f),!0}if(typeof s=="string"){const i=wt(s,t);if(Array.isArray(i))return gt(t,i,n)}if(typeof s=="object")for(const i in s){if(R.REGISTRY.has(i))continue;let o=s[i];if(!(o==null||o===!1)){if((typeof o=="string"||typeof o=="number")&&(o={text:o}),t.childProps&&(o=st(t.childProps,o)),c&&!o.ignoreChildExtends)if(o.extends){const f=Array.isArray(o.extends)?o.extends:[o.extends],r=Array.isArray(c)?c:[c];o={...o,extends:[...r,...f]}}else o={...o,extends:c};B(o,t,i,n)}}}function bt(t,s){const n=t.node;if(!n||n.tagName!=="SELECT")return;const c=n.options;if(!c||!c.length)return;const i=t.__ref,o=i&&i.__exec&&i.__exec.value,f=typeof o=="function",r=t.value!=null&&typeof t.value!="function";if(f||r){let u;if(f)try{u=o(t,t.state,t.context)}catch{return}else u=t.value;const d=u==null?"":String(u);n.value!==d&&(n.value=d);return}const e=s||!(i&&i.__selectSynced);if(i&&(i.__selectSynced=!0),!e)return;let a=-1;for(let u=0;u<c.length;u++)c[u].defaultSelected&&(a=u);a>=0&&n.selectedIndex!==a&&(n.selectedIndex=a)}function Nt(t,s){let{children:n,content:c}=t;const i=t.childExtends;if(typeof n=="function"){const r=n;try{n=r(t,t.state,t.context)}catch(p){if(n=void 0,typeof console<"u"&&console.error){const y=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${y} (initial run, treating as empty):`,p?.message||p)}}t.children=n;const e=t.__ref;let a=!1;const u=L(t,t.childrenDeps,r),d=(0,v.createEffect)(()=>{const p=a;a=!0;let y;try{y=u(t,t.state,t.context)}catch(w){if(typeof console<"u"&&console.error){const j=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${j}${p?"":" (initial tracking run)"}:`,w?.message||w)}return}if(!p||y===t.children)return;t.children=y;const _=typeof t.onContentUpdate=="function",l=_?[]:null,h=_?[]:null,g=_?[]:null;if(Array.isArray(y)&&t.childrenAs==="state"){const w=t.childProps,j=[],$=new Map;for(let k=0;k<y.length;k++){const T=y[k];let S=w;if(typeof w=="function")try{S=w(t,T)}catch{S=null}const F=S&&S.key||T&&T.key||`${k}`;j.push(F),$.set(F,{rawChild:T,childProps:S})}const H=new Set(j),V=e.__children.slice();for(const k of V)if(!H.has(k)){const T=t[k];T?.remove&&T.remove(),delete t[k],h&&h.push(k)}const Q=t.childExtends,tt=t.tag==="fragment",Ut=t.context?.document||globalThis.document,X=tt?null:Ut?.createDocumentFragment(),ct=new Set;for(const k of j){const T=$.get(k),S=T.rawChild,F=t[k];if(F&&F.state){if(S&&typeof S=="object"){const O=F.state,z=O.$replace||O.replace,kt=O.$update||O.update;if(typeof z=="function")z.call(O,S);else if(typeof kt=="function"){for(const M in O)if(!(M==="__element"||M==="root"||M==="parent"||M==="update")&&!Object.prototype.hasOwnProperty.call(S,M))try{O[M]=void 0}catch{}kt.call(O,S)}else for(const M in S)O[M]=S[M]}g&&g.push(k);continue}let rt=S;(typeof S=="string"||typeof S=="number")&&(rt={value:S,text:S});const Ct=T.childProps;let N=Ct?{...Ct,state:rt}:{state:rt};if(Q&&!N.ignoreChildExtends)if(N.extends){const O=Array.isArray(N.extends)?N.extends:[N.extends],z=Array.isArray(Q)?Q:[Q];N={...N,extends:[...z,...O]}}else N={...N,extends:Q};let it;try{it=B(N,t,k,s)}catch(O){if(typeof console<"u"&&console.error){const z=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${k}" failed to construct at ${z} (reconcile, skipping this row):`,O?.message||O)}ct.add(k);continue}!tt&&it?.node&&X&&X.appendChild(it.node),l&&l.push(k)}if(!tt&&X&&X.childNodes.length&&t.node&&t.node.appendChild(X),!tt&&t.node){let k=null;for(const T of j){const S=t[T]?.node;if(!S)continue;const F=k?k.nextSibling:t.node.firstChild;S!==F&&t.node.insertBefore(S,F),k=S}}e.__children=ct.size?j.filter(k=>!ct.has(k)):j,_&&(l.length||h.length)&&vt(t,{added:l,removed:h,kept:g}),bt(t,!1);return}const E=_?[...e.__children]:null;for(const w of[...e.__children]){const j=t[w];j?.remove&&j.remove(),delete t[w]}e.__children=[],gt(t,y,s),bt(t,!1),_&&vt(t,{added:[...e.__children],removed:E,kept:[]})},{depth:e.path.length});e.__effects.push(d)}const o=gt(t,n||c,s);if((n||c)&&!o)return;const f=t.context?.components||{};{const r=Object.keys(t);for(let e=0;e<r.length;e++){const a=r[e];if(!a.endsWith("Extends")||typeof t[a]!="string")continue;const u=a.slice(0,-7);if(!u||u.charCodeAt(0)<65||u.charCodeAt(0)>90)continue;const d={extends:t[a]};delete t[a];for(let p=e+1;p<r.length;p++){const y=r[p],_=y.charCodeAt(0);if(_>=65&&_<=90||R.REGISTRY.has(y)||typeof t[y]=="function"&&(y.startsWith("on")||y.startsWith(".")))break;const l=t[y];l!==void 0&&(d[y]=l,delete t[y])}t[u]&&typeof t[u]=="object"?t[u]={...d,...t[u]}:t[u]=d}}for(const r in t){if(!Object.prototype.hasOwnProperty.call(t,r)||R.REGISTRY.has(r)||typeof t[r]!="object"||t[r]===null)continue;const e=r.charCodeAt(0);if(e<65||e>90)continue;let a=t[r];if(!a.__ref){if(!a.extends&&!a.extend){const u=f[r]||f[`smbls.${r}`];u&&(a={...a,extends:u})}if(t.childProps&&(a=st(t.childProps,a)),i&&!a.ignoreChildExtends)if(a.extends){const u=Array.isArray(a.extends)?a.extends:[a.extends],d=Array.isArray(i)?i:[i];a={...a,extends:[...d,...u]}}else a={...a,extends:i};B(a,t,r,s)}}}function Ft(t,s,n){const{node:c}=t;if(!c)return;c.ref=t;const i=s?.tag==="fragment"?s.__ref?.__fragmentAnchor:null;if(i){const f=i.parentNode;if(f){if(n?.position==="before"&&n.node)f.insertBefore(c,n.node);else if(n?.position==="after"&&n.node){const r=n.node.nextSibling;f.insertBefore(c,r||i)}else f.insertBefore(c,i);return}}const o=s?.node||(s?.nodeType?s:null);if(o)if(n?.position==="before"&&n.node)o.insertBefore(c,n.node);else if(n?.position==="after"&&n.node){const f=n.node.nextSibling;f?o.insertBefore(c,f):o.appendChild(c)}else o.appendChild(c)}function I(t,s,n){const c=t.charAt(0).toLowerCase()+t.slice(1);s.context?.plugins?.length&&(0,K.runPluginHook)(c,s,n);const i="on"+t,o=s[i];if(typeof o=="function"){const f=t==="Render"||t==="RenderRouter";if(f){if(s.__ref.__inRender)return!0;s.__ref.__inRender=!0}const r=s.context?.designSystem;r&&(0,A.pushConfig)(r);try{if(o(s,s.state,s.context,n)===!1)return!1}catch(e){if(s.context?.plugins?.length&&(0,K.runPluginHook)("error",s,{hook:i,error:e})||console.error(`[DOMQL] Lifecycle "${i}" error:`,e),s.context?.strictMode)throw e}finally{r&&(0,A.popConfig)(),f&&(s.__ref.__inRender=!1)}}return!0}var uo=B;
@@ -1,6 +1,6 @@
1
- import{createStore as rt,createScopeStore as Vt,isStore as I}from"@symbo.ls/signal";import{createEffect as k}from"@symbo.ls/signal";import{cacheNode as it,detectTag as vt}from"./cache.js";import{REGISTRY as K,LIFECYCLE_EVENTS as Wt}from"./registry.js";import{registerEvent as Bt}from"./delegate.js";import{applyExtends as Ht}from"./extends.js";import{addMethods as zt}from"./methods.js";import"./dispose.js";import{isLoudDevRuntime as Ct}from"./devRuntime.js";import{replaceLiteralsWithObjectFields as et}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 E,DEFAULT_CSS_PROPERTIES_LIST as j}from"css-in-props";import{css as at,wrapHoverRule as St}from"@symbo.ls/css";import{pushConfig as $,popConfig as D}from"@symbo.ls/scratch";import{checkAttributeByTagName as ft,applyAttrTransforms as Yt,camelToAttr as dt,serializeAttrValue as Gt,isEnumeratedTrueFalseAttr as Zt}from"attrs-in-props";let qt=1;const tt=[];let ut=!1;function Qt(){ut||(ut=!0,typeof requestAnimationFrame=="function"?requestAnimationFrame(kt):setTimeout(kt,0))}function kt(){if(ut=!1,!tt.length)return;const t=tt.splice(0,tt.length);for(let s=0;s<t.length;s++){const n=t[s];!n.node||!n.node.isConnected||M("Mounted",n,n.__ref?.__mountOptions||{})}}function wt(t,s){typeof t.onMounted=="function"&&(t.__ref.__mountOptions=s,tt.push(t),Qt())}function jt(t,s){if(typeof t.onContentUpdate!="function")return;t.context?.plugins?.length&&V("contentUpdate",t,s);const n=t.context?.designSystem;n&&$(n);try{t.onContentUpdate(t,t.state,t.context,s)}catch(c){if(t.context?.plugins?.length&&V("error",t,{hook:"onContentUpdate",error:c})||console.error('[DOMQL] Lifecycle "onContentUpdate" error:',c),t.context?.strictMode)throw c}finally{n&&D()}}function H(t){return t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90}function Xt(t){return t.charAt(2).toLowerCase()+t.slice(3)}function Jt(t){return t.toLowerCase()}function Et(t){const s=t.charCodeAt(0);return s===58||s===64||s===38}function X(t,s){const n={...t};for(const c in s){const a=n[c],o=s[c];a&&o&&typeof a=="object"&&typeof o=="object"&&!Array.isArray(a)&&!Array.isArray(o)&&typeof a!="function"&&typeof o!="function"?n[c]=X(a,o):n[c]=o}return n}function z(t,s,n,c={},a){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||`_${qt++}`,o.parent=s||null,o.context=t.context||s?.context||c.context||{},o.context.__create||(o.context.__create=z);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),g=o.context?.components;g&&(g[h]||g["smbls."+h])?t={...t,extends:h}:g&&Ct()&&/^[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.`)}}Ht(o,t,c);const r=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],g=o[u],x=g&&h&&typeof g=="object"&&typeof h=="object"&&!Array.isArray(g)&&!Array.isArray(h)&&typeof g!="function"&&typeof h!="function";x&&u.charCodeAt(0)>=65&&u.charCodeAt(0)<=90?o[u]=X(g,h):x&&r.has(u)?o[u]={...g,...h}:x&&Et(u)?o[u]=X(g,h):o[u]=h}function f(u){for(const h in u){const g=u[h],x=o[h],b=x&&g&&typeof x=="object"&&typeof g=="object"&&!Array.isArray(x)&&!Array.isArray(g)&&typeof x!="function"&&typeof g!="function";b&&h.charCodeAt(0)>=65&&h.charCodeAt(0)<=90?o[h]=X(x,g):b&&r.has(h)?o[h]={...x,...g}:b&&Et(h)?o[h]=X(x,g):o[h]=g}}e&&f(e),t.props&&typeof t.props=="object"&&f(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,y=o.context&&typeof o.context.globalScope=="object"&&o.context.globalScope||null,l=p||y||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=Vt(u,l)}else l&&(o.scope=l);if(t.if!==void 0&&(o.if=t.if),zt(o),mt(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 g=o.key||o.tag||"?";console.warn(`[smbls] \`if:\` evaluator threw on ${g} \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"&&$t(o,i,o.if),o;o.tag||(o.tag=vt(o)),M("Init",o,c);const _=o.node=it(o);if(!_)return o;if(o.tag==="fragment"){const h=(o.context?.document||globalThis.document).createComment("");_.appendChild(h),i.__fragmentAnchor=h}M("AttachNode",o,c),_.setAttribute&&o.key&&_.setAttribute("data-key",o.key),s&&(s[o.key]=o,s.__ref?.__children&&(s.__ref.__children.includes(o.key)||s.__ref.__children.push(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),Mt(o,c),Ot(o),lt(o),Nt(o),fo(o);try{It(o,c)}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(`
1
+ import{createStore as it,createScopeStore as Wt,isStore as I}from"@symbo.ls/signal";import{createEffect as S}from"@symbo.ls/signal";import{cacheNode as et,detectTag as vt}from"./cache.js";import{REGISTRY as K,LIFECYCLE_EVENTS as Ht}from"./registry.js";import{registerEvent as zt}from"./delegate.js";import{applyExtends as Yt}from"./extends.js";import{addMethods as Gt}from"./methods.js";import"./dispose.js";import{isLoudDevRuntime as wt}from"./devRuntime.js";import{replaceLiteralsWithObjectFields as ft}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 E,DEFAULT_CSS_PROPERTIES_LIST as j}from"css-in-props";import{css as tt,wrapHoverRule as jt}from"@symbo.ls/css";import{pushConfig as O,popConfig as L}from"@symbo.ls/scratch";import{checkAttributeByTagName as at,applyAttrTransforms as Zt,camelToAttr as ut,serializeAttrValue as qt,isEnumeratedTrueFalseAttr as Qt}from"attrs-in-props";let Xt=1;const ot=[];let dt=!1;function Jt(){dt||(dt=!0,typeof requestAnimationFrame=="function"?requestAnimationFrame(Et):setTimeout(Et,0))}function Et(){if(dt=!1,!ot.length)return;const t=ot.splice(0,ot.length);for(let s=0;s<t.length;s++){const n=t[s];!n.node||!n.node.isConnected||M("Mounted",n,n.__ref?.__mountOptions||{})}}function Pt(t,s){typeof t.onMounted=="function"&&(t.__ref.__mountOptions=s,ot.push(t),Jt())}function Ot(t,s){if(typeof t.onContentUpdate!="function")return;t.context?.plugins?.length&&V("contentUpdate",t,s);const n=t.context?.designSystem;n&&O(n);try{t.onContentUpdate(t,t.state,t.context,s)}catch(c){if(t.context?.plugins?.length&&V("error",t,{hook:"onContentUpdate",error:c})||console.error('[DOMQL] Lifecycle "onContentUpdate" error:',c),t.context?.strictMode)throw c}finally{n&&L()}}function H(t){return t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90}function mt(t){return t.charAt(2).toLowerCase()+t.slice(3)}function to(t){return t.toLowerCase()}function lt(t){const s=t.charCodeAt(0);return s===58||s===64||s===38}function X(t,s){const n={...t};for(const c in s){const f=n[c],o=s[c];f&&o&&typeof f=="object"&&typeof o=="object"&&!Array.isArray(f)&&!Array.isArray(o)&&typeof f!="function"&&typeof o!="function"?n[c]=X(f,o):n[c]=o}return n}function z(t,s,n,c={},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||`_${Xt++}`,o.parent=s||null,o.context=t.context||s?.context||c.context||{},o.context.__create||(o.context.__create=z);const e=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 l=n.indexOf("_");if(l>0){const h=n.substring(0,l),g=o.context?.components;g&&(g[h]||g["smbls."+h])?t={...t,extends:h}:g&&wt()&&/^[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.`)}}Yt(o,t,c);const r=new Set(["childProps","attr","style","scope","data"]),i=o.props&&typeof o.props=="object"?o.props:null;for(const l in t){if(l==="parent"||l==="node"||l==="__ref"||l==="extends"||l==="context"||l==="props")continue;const h=t[l],g=o[l],x=g&&h&&typeof g=="object"&&typeof h=="object"&&!Array.isArray(g)&&!Array.isArray(h)&&typeof g!="function"&&typeof h!="function";x&&l.charCodeAt(0)>=65&&l.charCodeAt(0)<=90?o[l]=X(g,h):x&&r.has(l)?o[l]={...g,...h}:x&&lt(l)?o[l]=X(g,h):o[l]=h}function a(l){for(const h in l){const g=l[h],x=o[h],b=x&&g&&typeof x=="object"&&typeof g=="object"&&!Array.isArray(x)&&!Array.isArray(g)&&typeof x!="function"&&typeof g!="function";b&&h.charCodeAt(0)>=65&&h.charCodeAt(0)<=90?o[h]=X(x,g):b&&r.has(h)?o[h]={...x,...g}:b&&lt(h)?o[h]=X(x,g):o[h]=g}}i&&a(i),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,d=s?.scope,p=o.context&&typeof o.context.globalScope=="object"&&o.context.globalScope||null,y=d||p||null;if(t.scope!==void 0||u){const l={};u&&Object.assign(l,u),t.scope!==void 0&&Object.assign(l,t.scope),o.scope=Wt(l,y)}else y&&(o.scope=y);if(t.if!==void 0&&(o.if=t.if),Gt(o),oo(o,s,t),o.if!=null){let l;if(typeof o.if=="function")try{l=o.if(o,o.state,o.context)}catch(h){if(l=!1,e.__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 l=o.if;e.__if=!!l}if(e.__if)typeof o.if=="function"&&(e.__ifInitialized=!0);else return s&&(s[o.key]=o),typeof o.if=="function"&&Tt(o,e,o.if),o;o.tag||(o.tag=vt(o)),M("Init",o,c);const _=o.node=et(o);if(!_)return o;if(o.tag==="fragment"){const h=(o.context?.document||globalThis.document).createComment("");_.appendChild(h),e.__fragmentAnchor=h}M("AttachNode",o,c),_.setAttribute&&o.key&&_.setAttribute("data-key",o.key),s&&(s[o.key]=o,s.__ref?.__children&&(s.__ref.__children.includes(o.key)||s.__ref.__children.push(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),Kt(o,c),Dt(o),yt(o),Mt(o),po(o);try{Ut(o,c)}catch(l){if(typeof console<"u"&&console.error){const h=o.__ref?.path?.join(".")||o.key||"<root>";console.error(`[smbls] createChildren failed at ${h}:`,l?.message||l,l?.stack?`
2
+ `+l.stack.split(`
3
3
  `).slice(0,6).join(`
4
- `):"")}}if(bt(o,!0),Kt(o,s,a),typeof o.html=="function"&&o.node&&!o.node.innerHTML){const u=o.context?.designSystem;u&&$(u);try{const h=o.html(o,o.state,o.context);h!=null&&typeof h!="function"&&(o.node.innerHTML=h)}catch{}finally{u&&D()}}if(M("Create",o,c),M("Complete",o,c),M("Render",o,c),M("RenderRouter",o,c),wt(o,c),typeof o.onFrame=="function"){const u=o.onFrame,h=o.context?.designSystem,g=()=>{if(o.node){if(o.node.isConnected){h&&$(h);try{u(o,o.state,o.context)}catch(x){console.error("[DOMQL] onFrame error:",x)}finally{h&&D()}}requestAnimationFrame(g)}};requestAnimationFrame(g)}return o}function mt(t,s,n){const c=!s,a=n.state&&typeof n.state=="object"&&!Array.isArray(n.state)&&Object.keys(n.state).length===0,o=c&&a&&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 r=t.context.state,e={...r},f=t.context?.polyglot;if(f?.translations){const d=r.lang||f.defaultLang||"en",p=f.translations[d];if(p&&typeof p=="object")for(const l in p)e[l]===void 0&&(e[l]=p[l]);const y=new Set(f.languages||[]);for(const l in f.translations)!y.has(l)&&e[l]===void 0&&(e[l]=f.translations[l])}t.state=I(e)?e:rt(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=Pt(i,s),t.state&&typeof t.state=="object"&&!I(t.state)){const r=s?.state?.root||s?.state||t.state;Object.defineProperty(t.state,"root",{value:r,enumerable:!1,configurable:!0,writable:!0})}Q(t,t.state);return}if(typeof i=="function"){const r=i(t,s?.state);t.state=I(r)?r:rt(r||{})}else I(i)?t.state=i:t.state=rt({...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 pt(t,s){if(!s)return t;const n=s.split("/");let c=t;for(const a of n){if(c==null)return{};c=c[a]}return c??{}}function Pt(t,s){if(!s)return{};if(t===".")return s.state||{};if(t.startsWith("../")){const a=t.slice(3);return a?pt(s.state,a):s.state??{}}if(t.startsWith("~/")){const a=s.state?.root||s.state,o=t.slice(2);return o?pt(a,o):a??{}}if(s.state?.[t]!==void 0)return s.state[t];const n=pt(s.state,t);if(n!=null&&Object.keys(n).length>0)return n;const c=s.context?.polyglot;if(c?.translations){const a=s.state?.root?.lang||c.defaultLang||"en",o=c.translations[a];if(o?.[t]!==void 0)return o[t];if(c.translations[t]!==void 0)return c.translations[t]}return{}}function to(t){const s=t.__ref,n=t.tag||"div",c=t.context?.designSystem,a=[],o=Object.keys(t);for(let i=0;i<o.length;i++){const r=o[i];if(typeof t[r]!="function"||K.has(r))continue;const e=r.charCodeAt(0);e>=65&&e<=90||H(r)||E[r]||j&&j.has(r)||ft(n,r)||a.push({prop:r,fn:t[r]})}for(let i=0;i<a.length;i++){const{prop:r,fn:e}=a[i];s.__exec[r]=e,Object.defineProperty(t,r,{get(){c&&$(c);try{return e(t,t.state,t.context)}catch{return}finally{c&&D()}},set(f){delete s.__exec[r],Object.defineProperty(t,r,{value:f,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function oo(t,s){if(!(!Array.isArray(s)||s.length===0))for(let n=0;n<s.length;n++){const c=s[n];try{typeof c=="function"?c(t,t.state,t.context):typeof c=="string"&&t.state?.[c]}catch{}}}function O(t,s,n){return!Array.isArray(s)||s.length===0?n:function(...c){return oo(t,s),n.apply(this,c)}}function J(t,s){if(!(!t||Array.isArray(t)||typeof t!="object"))return t[s]}function Ot(t,s){const n=t.__ref,c=!!(s&&s.skipIfEffect);if(to(t),typeof t.text=="function"){const o=t.text,i=O(t,t.textDeps,o),r=k(()=>{if(!n.contentManaged)try{let e=i(t,t.state,t.context);t.node&&e!=null&&typeof e!="function"&&typeof e!="object"&&(typeof e=="string"&&e.includes("{{")&&(e=et.call(t,e,t.state)),t.tag==="string"?t.node.nodeValue=e:t.node.textContent=e)}catch{}},{depth:n.path.length});n.__effects.push(r),n.__exec.text=o}else if(typeof t.text=="string"&&t.text.includes("{{")){const o=t.text,i=k(()=>{if(n.contentManaged)return;const r=et.call(t,o,t.state);r!=null&&(t.text=r),t.node&&(t.tag==="string"?t.node.nodeValue=r??"":t.node.textContent=r??"")},{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)&&!H(o)&&!n.__exec[o]){if(E[o]){const i=t[o],r=O(t,t[o+"Deps"],i),e=o;let f;const d=k(()=>{const p=t.context?.designSystem;p&&$(p);try{const y=r(t,t.state,t.context),l=E[e](y,t,t.state,t.context);if(l&&t.node){const _=Dt(l);(_===null||_!==f)&&(f=_,Y(t.node,l))}else t.node&&(e==="show"||e==="hide")&&(f=void 0,t.node.style.display="")}finally{p&&D()}},{depth:n.path.length});n.__effects.push(d),n.__exec[o]=i}else if(j&&j.has(o)){const i=t[o],r=O(t,t[o+"Deps"],i),e=o;let f;const d=k(()=>{const p=t.context?.designSystem;p&&$(p);try{const y=r(t,t.state,t.context);if(t.node)if(y!=null){const l=e+":"+String(y);l!==f&&(f=l,Y(t.node,{[e]:y}))}else f=void 0,t.node.style[e]=""}finally{p&&D()}},{depth:n.path.length});n.__effects.push(d),n.__exec[o]=i}}if(typeof t.html=="function"){const o=t.html,i=O(t,t.htmlDeps,o),r=k(()=>{const e=t.context?.designSystem;e&&$(e);try{const f=i(t,t.state,t.context);t.node&&f!=null&&typeof f!="function"&&(t.node.innerHTML=f)}finally{e&&D()}},{depth:n.path.length});n.__effects.push(r),n.__exec.html=o}if(typeof t.value=="function"){const o=t.value,i=O(t,t.valueDeps,o),r=k(()=>{try{const e=i(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const f=e==null?"":String(e);if(t.node.value===f)return;const d=typeof document<"u"&&document.activeElement===t.node,p=d&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,y=d&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=f,d&&p!=null&&y!=null)try{t.node.setSelectionRange(p,y)}catch{}}catch{}},{depth:n.path.length});n.__effects.push(r),n.__exec.value=o}if(typeof t.style=="function"){const o=t.style,i=O(t,t.styleDeps,o);let r;const e=k(()=>{const f=i(t,t.state,t.context),d=Dt(f);(d===null||d!==r)&&(r=d,Y(t.node,f))},{depth:n.path.length});n.__effects.push(e),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;const r=O(t,J(t.styleDeps,o),i);let e;const f=k(()=>{try{const d=r(t,t.state,t.context);if(t.node){const p=o+":"+String(d);p!==e&&(e=p,Y(t.node,{[o]:d}))}}catch{}},{depth:n.path.length});n.__effects.push(f)}if(t.attr&&typeof t.attr=="object"){for(const o in t.attr)if(typeof t.attr[o]=="function"){const i=O(t,J(t.attrDeps,o),t.attr[o]),r=o,e=k(()=>{try{const f=i(t,t.state,t.context);t.node?.setAttribute&&(f==null||f===!1?t.node.removeAttribute(r):typeof f!="function"&&typeof f!="object"&&t.node.setAttribute(r,f===!0?"":f))}catch{}},{depth:n.path.length});n.__effects.push(e)}}if(t.aria&&typeof t.aria=="object")for(const o in t.aria){if(typeof t.aria[o]!="function")continue;const i=O(t,J(t.ariaDeps,o),t.aria[o]),r="aria-"+o.replace(/[A-Z]/g,f=>"-"+f.toLowerCase()),e=k(()=>{try{const f=i(t,t.state,t.context);if(!t.node?.setAttribute)return;f==null||f===!1?t.node.removeAttribute(r):typeof f!="function"&&typeof f!="object"&&t.node.setAttribute(r,f===!0?"":f)}catch{}},{depth:n.path.length});n.__effects.push(e)}if(t.data&&typeof t.data=="object")for(const o in t.data){if(typeof t.data[o]!="function")continue;const i=O(t,J(t.dataDeps,o),t.data[o]),e="data-"+o.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),f=k(()=>{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(f)}const a=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(a)for(const o in a){if(typeof a[o]!="function")continue;const i=O(t,J(t.classDeps,o),a[o]),r=k(()=>{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(r)}!c&&typeof t.if=="function"&&$t(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||H(o))continue;const r=t[o];n.__exec[o]=r;const e=t.tag||"div";if(ft(e,o)&&!E[o]&&!(j&&j.has(o))){const f=dt(o)||o,d=O(t,t[o+"Deps"],r),p=k(()=>{try{const y=d(t,t.state,t.context);t.node?.setAttribute&&(y==null||y===!1?t.node.removeAttribute(f):typeof y!="function"&&typeof y!="object"&&(f==="src"&&"src"in t.node?t.node.src=y:t.node.setAttribute(f,y===!0?"":y)))}catch{}},{depth:n.path.length});n.__effects.push(p)}}if(co(t),io(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const o=t.onStateUpdate,i=t.stateDeps;let r=!1,e=[];const f=k(()=>{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(!r){r=!0,e=d;return}let p=d.length!==e.length;for(let _=0;!p&&_<d.length;_++)d[_]!==e[_]&&(p=!0);const y=e;if(e=d,!p)return;const l=t.context?.designSystem;l&&$(l);try{o(t,t.state,t.context,{prev:y,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{l&&D()}},{depth:n.path.length});n.__effects.push(f)}}function Lt(t){const s=t.parent,n=s?.node;if(!n||!t.node){Kt(t,t.parent);return}let c=null;const a=Object.keys(s),o=a.indexOf(t.key);for(let i=o+1;i<a.length;i++){const r=s[a[i]];if(r?.node?.parentNode===n){c=r.node;break}}c?n.insertBefore(t.node,c):n.appendChild(t.node)}function $t(t,s,n){const c=O(t,t.ifDeps,n),a=k(()=>{let o;try{o=c(t,t.state,t.context)}catch(r){if(o=!1,s.__ifError=r,typeof console<"u"&&console.warn){const e=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${e} \u2014 treating as false:`,r?.message||r)}return}const i=s.__if;if(s.__if=!!o,i&&!s.__if&&t.node)t.node.remove();else if(!i&&s.__if)if(s.__ifInitialized)t.node||(t.node=it(t)),t.node&&(t.node.ref=t),Lt(t),lt(t);else{if(s.__ifInitialized=!0,t.tag||(t.tag=vt(t)),M("Init",t,{}),t.node||(t.node=it(t)),!t.node)return;if(t.parent?.__ref?.__children&&!t.parent.__ref.__children.includes(t.key)&&t.parent.__ref.__children.push(t.key),t.tag==="fragment"&&!s.__fragmentAnchor){const e=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(e),s.__fragmentAnchor=e}M("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),Mt(t,{}),Ot(t,{skipIfEffect:!0}),lt(t),Nt(t),It(t,{}),Lt(t),wt(t,{})}},{depth:s.path.length});s.__effects.push(a)}function lt(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),ao(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"&&Y(s,t.style),t.attr&&typeof t.attr=="object")for(const n in t.attr){const c=t.attr[n];typeof c=="function"||typeof c=="object"||c==null||c===!1||s.setAttribute&&s.setAttribute(n,c===!0?"":c)}if(t.data&&typeof t.data=="object")for(const n in t.data){const c=t.data[n];typeof c=="function"||typeof c=="object"||c==null||c===!1||s.dataset&&(s.dataset[n]=c===!0?"":c)}if(t.classlist||t.class){const n=t.classlist||t.class;if(typeof n=="string")n.split(" ").forEach(c=>c&&s.classList.add(c));else if(typeof n=="object")for(const c in n){const a=typeof n[c]=="function"?n[c](t,t.state,t.context):n[c];a&&s.classList.add(typeof a=="string"?a:c)}}}}function Dt(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function Y(t,s){if(!t||!s||!t.style)return;let n=null;for(const c in s){const a=s[c];if(a!=null){if(c.charAt(0)==="&"&&typeof a=="object"){n||(n={}),n[c]=a;continue}try{const o=String(a),i=c.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),r=o.trim(),e=/\s*!important\s*$/.test(r),f=r.replace(/\s*!important\s*$/,"");t.style.setProperty(i,f,e?"important":"")}catch{}}}n&&no(t,n)}let so=0;function no(t,s){const n=`_ds${so++}`;t.classList.add(n);const c=t.ownerDocument;let a=c.querySelector("style[data-smbls-scoped]");a||(a=c.createElement("style"),a.setAttribute("data-smbls-scoped",""),c.head.appendChild(a));let o="";for(const i in s){const r="."+n,e=i.replace(/&/g,r).split(",").map(d=>{const p=d.trim();return p.includes(r)?p:r+p}).join(", "),f=s[i];if(typeof f=="object"){let d="",p="";for(const y in f){const l=f[y];if(typeof l=="object"){const _=y.includes("&")?e.split(", ").map(h=>y.replace(/&/g,h)).join(", "):e.split(", ").map(h=>`${h} ${y}`).join(", ");let u="";for(const h in l)u+=`${h.replace(/[A-Z]/g,g=>"-"+g.toLowerCase())}: ${l[h]};`;p+=St(`${_} { ${u} }`,_)+`
5
- `}else d+=`${y.replace(/[A-Z]/g,_=>"-"+_.toLowerCase())}: ${l};`}d&&(o+=St(`${e} { ${d} }`,e)+`
6
- `),p&&(o+=p)}}o&&(a.textContent+=o)}function co(t){let s=t.subscribeTo;if(typeof s=="function")try{s=s(t,t.state,t.context)}catch{s=null}if(!Array.isArray(s)||s.length===0)return;const n=t.__ref;for(let c=0;c<s.length;c++){const a=s[c];if(typeof a!="string"||a.length===0)continue;const o=a.split("."),i=o[0],r=o.slice(1),e={value:!1},f=k(()=>{const d=t.state&&(I(t.state)?t.state.root:null);if(!d||!I(d))return;let p=d;p=p[i];for(let l=0;l<r.length&&!(p==null||typeof p!="object");l++)if(I(p))p=p[r[l]];else break;if(!e.value)return;let y=!1;if(typeof t.onBeforeUpdate=="function"){const l=t.context?.designSystem;l&&$(l);try{t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0})===!1&&(y=!0)}catch(_){t.context?.plugins?.length&&V("error",t,{hook:"onBeforeUpdate",error:_})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",_)}finally{l&&D()}}if(!y&&t.node&&n.__effects)for(let l=0;l<n.__effects.length;l++){const _=n.__effects[l];_&&_!==f&&!_._disposed&&!_._isSubscribeToEffect&&typeof _._execute=="function"&&_._execute()}if(!y&&typeof t.onUpdate=="function"){const l=t.context?.designSystem;l&&$(l);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{l&&D()}}},{depth:n.path.length});e.value=!0,f._isSubscribeToEffect=!0,n.__effects.push(f)}}function yt(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)])}const Tt=new Set;function ro(t,s){const n=s?.__ref?.path?s.__ref.path.join("."):s?.key||"?",c=n+"::"+t;Tt.has(c)||(Tt.add(c),console.warn(`[smbls/css] "${t}" at ${n} is a CHILD-COMPONENT key nested inside a pseudo/selector block (":hover", "@dark", etc.) \u2014 that is never a valid CSS selector fragment. The rule is DROPPED (not shipped as a dead/never-matching selector). To reveal a child on a parent state, target the child's OWN class from the parent selector instead, e.g. move the declaration onto the child element itself, or use a sibling-selector combinator in a top-level style block.`))}function G(t,s,n){const c={},a=new Set,o=(i,r,e)=>{const f=e?new Set(Object.keys(c)):null;if(E[i]){const d=E[i](r,s,s.state,s.context);if(d){const p=Array.isArray(d)?d:[d];for(const y of p)y&&Object.assign(c,y)}}else c[i]=r;if(e)for(const d in c)f.has(d)||a.add(d)};for(const i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;let r=t[i];if(typeof r=="function"&&(r=r(s,s.state,s.context)),r==null||typeof r=="function")continue;if(typeof r=="object"&&!Array.isArray(r)){if(i==="style"){for(const p in r){let y=r[p];if(typeof y=="function"&&(y=y(s,s.state,s.context)),y==null||typeof y=="function")continue;const l=typeof s[p]=="function"&&(E[p]||j&&j.has(p));o(p,y,l)}continue}if(yt(i,s)){const p=G(r,s,!0);Object.keys(p).length&&(c[`[data-theme="${i.slice(1)}"] &`]=p);continue}if(/^[A-Z][A-Za-z0-9]*$/.test(i)){Ct()&&ro(i,s);continue}let f=i;if(i.charCodeAt(0)===64&&!i.startsWith("@media")&&!i.startsWith("@keyframes")){const p=s.context?.designSystem?.media?.[i.slice(1)];p&&(f=`@media ${p}`)}const d=G(r,s,!1);Object.keys(d).length&&(c[f]=d);continue}const e=typeof s[i]=="function"&&(E[i]||j&&j.has(i));o(i,r,e)}if(n)for(const i in c)a.add(i);for(const i of a){const r=c[i];typeof r=="string"&&!r.includes("!important")&&(c[i]=r+" !important")}return c}function io(t){const s=t.__ref;s.__conditionalRunners=[];const n=new Map;for(const c in t){if(!Object.prototype.hasOwnProperty.call(t,c))continue;const a=c.charAt(0);if(a!=="."&&a!=="!")continue;const o=c.slice(1);if(!o)continue;if(/[:@\s>~+[\]]/.test(o)){if(typeof console<"u"&&console.warn){const p=o.split(/[:@\s>~+[\]]/)[0];console.warn(`[smbls] conditional \`${c}\` on ${t.key||"?"} will never match \u2014 the whole string after \`${a}\` is read as one prop name. Nest the selector inside instead: \`${a}${p}: { '${o.slice(p.length)}': {...} }\`.`)}continue}const i=t[c];if(!i||typeof i!="object")continue;const r=a==="!",e={lastMatch:!1,appliedKeys:null,appliedClasses:null},f=()=>{let p;const y=t[o];if(y===void 0){const u=!!t.state&&o in t.state,h=t.state?t.state[o]:void 0;if(u||h!==void 0)p=h;else{const g=t.context?.cases?.[o];if(g===void 0)return;try{p=typeof g=="function"?g.call(t,t):g}catch(x){p=!1,s.__conditionalError=x,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${c}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,x?.message||x)}}}else if(typeof y=="function")try{p=y(t,t.state,t.context)}catch(u){p=!1,s.__conditionalError=u,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${c}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,u?.message||u)}else p=y;const l=r?!p:!!p;if(!t.node||l===e.lastMatch)return;e.lastMatch=l;const _=t.context?.designSystem;_&&$(_);try{if(l){const u={},h={};let g=!1;for(const b in i){if(!Object.prototype.hasOwnProperty.call(i,b))continue;const w=i[b],C=b.charAt(0);if((C===":"||C==="@"||C==="&")&&w&&typeof w=="object"&&!Array.isArray(w)){if(yt(b,t)){const L=G(w,t,!0);Object.keys(L).length&&(h[`[data-theme="${b.slice(1)}"] &`]=L,g=!0)}else{let L=b;if(C==="@"&&!b.startsWith("@media")&&!b.startsWith("@keyframes")){const U=t.context?.designSystem?.media?.[b.slice(1)];U&&(L=`@media ${U}`)}const W=G(w,t,!1);Object.keys(W).length&&(h[L]=W,g=!0)}continue}const S=typeof w=="function"?w(t,t.state,t.context):w;if(S!=null)if(E[b]){const L=E[b](S,t,t.state,t.context);if(L){const W=Array.isArray(L)?L:[L];for(const U of W)U&&Object.assign(u,U)}}else j&&j.has(b)&&(u[b]=S)}const x=Object.keys(u);if(x.length){Y(t.node,u);for(const b of x)n.set(b,c);e.appliedKeys=x}else e.appliedKeys=null;if(g){const b=at(h,null,t.context?.cssPrefix),w=b?b.split(" ").filter(Boolean):[];if(w.length&&t.node.classList){for(const C of w)t.node.classList.add(C);e.appliedClasses=w}else e.appliedClasses=null}else if(e.appliedClasses){for(const b of e.appliedClasses)t.node.classList.remove(b);e.appliedClasses=null}}else{if(e.appliedKeys){for(const u of e.appliedKeys)n.get(u)===c&&(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{_&&D()}};s.__conditionalRunners.push(f);const d=k(f,{depth:s.path.length});s.__effects.push(d)}}const ht=new WeakSet;function eo(t){const s=t.ownerDocument;!s||ht.has(s)||(ht.add(s),queueMicrotask(()=>{ht.delete(s);const n=s.body||s.documentElement;n&&n.offsetWidth}))}const _t=new WeakSet;let Rt=!1;function ao(t){const{node:s}=t;if(!s)return;if(Rt||(Rt=!0,at({display:"none"})),_t.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}_t.add(t);const n=t.context?.designSystem;n&&$(n);try{const c={};let a=!1;if(Object.prototype.hasOwnProperty.call(t,"theme")&&typeof t.theme!="function"&&E.theme){const o=E.theme(t.theme,t,t.state,t.context);if(o){if(Array.isArray(o))for(const i of o)i&&Object.assign(c,i);else Object.assign(c,o);a=!0}}for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||typeof t[o]=="function"||K.has(o)||o==="theme")continue;const i=o.charCodeAt(0);if(!(i>=65&&i<=90)&&!H(o)){if(E[o]){const r=t[o],e=E[o](r,t,t.state,t.context);if(e){if(Array.isArray(e))for(const f of e)f&&Object.assign(c,f);else Object.assign(c,e);a=!0}}else if(j&&j.has(o)){const r=t[o];r!=null&&typeof r!="object"&&(c[o]=r,a=!0)}else if(o.charCodeAt(0)===45){const r=t[o];r!=null&&typeof r!="object"&&(c[o]=r,a=!0)}else if(o.charAt(0)==="&"){const r=t[o];r&&typeof r=="object"&&(c[o]=r,a=!0)}else if(o.charAt(0)==="@"||o.charAt(0)===":"){const r=t[o];if(r&&typeof r=="object"){if(yt(o,t)){const e=G(r,t,!0);Object.keys(e).length&&(c[`[data-theme="${o.slice(1)}"] &`]=e,a=!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 f=G(r,t,!1);Object.keys(f).length&&(c[e]=f,a=!0)}a=!0}}}}if(a){c.display&&String(c.display).includes("!important")&&(s.style.setProperty("display",String(c.display).replace(/\s*!important\s*$/,""),"important"),delete c.display);const o=at(c,null,t.context?.cssPrefix);if(o&&s.classList){const r=o.split(" ").filter(Boolean);let e=!1;for(const f of r)s.classList.add(f),e||(f.charCodeAt(0)===95&&f.charCodeAt(1)===99||f.charCodeAt(0)===95&&f.indexOf("_c",1)!==-1)&&(e=!0);e&&eo(s)}const i=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(i!=null){const r=c.display;if(r&&r!==i)if(i==="none"){const e=[];for(const f of s.classList)f.startsWith("_d-")&&f!=="_d-none"&&e.push(f);for(const f of e)s.classList.remove(f);s.classList.add("_d-none")}else s.style.display=t.display}}}finally{n&&D(),_t.delete(t)}}function Nt(t){const{node:s}=t;if(!s||!s.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const a in t.aria){const o=t.aria[a];if(typeof o=="function"||typeof o=="object"||o==null||o===!1)continue;const i="aria-"+a.replace(/[A-Z]/g,r=>"-"+r.toLowerCase());s.setAttribute(i,o===!0?"":o)}const n=Yt(t);for(const a in n){const o=n[a];o!=null&&o!==!1&&typeof o!="function"&&typeof o!="object"&&s.setAttribute(a,o===!0?"":o)}const c=t.tag||"div";for(const a in t){if(!Object.prototype.hasOwnProperty.call(t,a)||typeof t[a]=="function"||K.has(a)||a==="on"||n[a]!==void 0)continue;const o=a.charCodeAt(0);if(!(o>=65&&o<=90)&&!H(a)&&!(E[a]||j&&j.has(a))&&ft(c,a)){let i=t[a];if(i==null||(typeof i=="string"&&i.includes("{{")&&(i=et(i,t,t.state,t.context),t[a]=i),i==null||typeof i=="function"||typeof i=="object")||i===!1&&!Zt(dt(a)||a))continue;const r=dt(a)||a;s.setAttribute(r,Gt(r,i))}}}function fo(t){if(!t.autoGrow)return;const s=t.node;if(!s||s.tagName!=="TEXTAREA")return;const n=t.autoGrow,c=n&&typeof n=="object"&&n.max?String(n.max):null;c&&(s.style.maxHeight=c);const a=()=>{s.style.height="auto",s.style.height=s.scrollHeight+"px"};a(),s.addEventListener("input",a),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("input",a)}catch{}})}const Ft=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function Mt(t,s){for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n)||!H(n)||Ft.has(n))continue;let c=t[n];if(typeof c=="string"&&/^[A-Za-z_$][\w$]*$/.test(c)){const o=c;c=function(r){return t.call(o,r)}}if(typeof c!="function")continue;const a=Xt(n);Wt.has(a)||Bt(Jt(a),t,c)}uo(t)}function uo(t){const s=t.node;if(!s||!s.addEventListener)return;const n={};let c=!1;for(const y of Ft){const l=t[y];typeof l=="function"&&(n[y]=l,c=!0)}if(!c)return;const a=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,o=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let i=0,r=0,e=0,f=!1;const d=y=>{const l=y.touches&&y.touches[0]||y.changedTouches&&y.changedTouches[0];l&&(i=l.clientX,r=l.clientY,e=Date.now(),f=!0)},p=y=>{if(!f)return;f=!1;const l=y.changedTouches&&y.changedTouches[0]||y.touches&&y.touches[0];if(!l)return;const _=l.clientX-i,u=l.clientY-r,h=Date.now()-e;if(h>o)return;const g=Math.abs(_),x=Math.abs(u);if(Math.max(g,x)<a)return;let b;if(g>x*1.2)b=_<0?"left":"right";else if(x>g*1.2)b=u<0?"up":"down";else return;const w="onSwipe"+b.charAt(0).toUpperCase()+b.slice(1),C=n[w],S=n.onSwipe;C&&C.call(t,y,t,t.state,t.context),S&&S.call(t,{direction:b,dx:_,dy:u,dt:h,event:y},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 ot(t,s){const n={...t};for(const c in s){const a=n[c],o=s[c];a&&o&&typeof a=="object"&&typeof o=="object"&&!Array.isArray(a)&&!Array.isArray(o)&&typeof a!="function"&&typeof o!="function"?n[c]=ot(a,o):n[c]=o}return n}function gt(t,s,n){if(!s||!t.node)return;const c=t.childExtends;if(Array.isArray(s)){const a=t.tag==="fragment",o=t.context?.document||globalThis.document,i=a?null:o?.createDocumentFragment();if(!a&&!i)return;const r=t.childProps,e=t.childrenAs;for(let f=0;f<s.length;f++){let d=s[f];const p=d;(typeof d=="string"||typeof d=="number")&&(d={text:d});let y=r;if(typeof r=="function")try{y=r(t,d)}catch{y=null}if(e==="state"){let u=p;(typeof p=="string"||typeof p=="number")&&(u={value:p,text:p}),d=y?{...y,state:u}:{state:u}}else y&&(d=ot(y,d));if(c&&!d.ignoreChildExtends)if(d.extends){const u=Array.isArray(d.extends)?d.extends:[d.extends],h=Array.isArray(c)?c:[c];d={...d,extends:[...h,...u]}}else d={...d,extends:c};const l=d?.key||p&&typeof p=="object"&&p.key||`${f}`;let _;try{_=z(d,t,l,n)}catch(u){if(typeof console<"u"&&console.error){const h=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${l}" failed to construct at ${h} (initial render, skipping this row):`,u?.message||u)}continue}!a&&_?.node&&i.appendChild(_.node)}return a||t.node.appendChild(i),!0}if(typeof s=="string"){const a=Pt(s,t);if(Array.isArray(a))return gt(t,a,n)}if(typeof s=="object")for(const a in s){if(K.has(a))continue;let o=s[a];if(!(o==null||o===!1)){if((typeof o=="string"||typeof o=="number")&&(o={text:o}),t.childProps&&(o=ot(t.childProps,o)),c&&!o.ignoreChildExtends)if(o.extends){const i=Array.isArray(o.extends)?o.extends:[o.extends],r=Array.isArray(c)?c:[c];o={...o,extends:[...r,...i]}}else o={...o,extends:c};z(o,t,a,n)}}}function bt(t,s){const n=t.node;if(!n||n.tagName!=="SELECT")return;const c=n.options;if(!c||!c.length)return;const a=t.__ref,o=a&&a.__exec&&a.__exec.value,i=typeof o=="function",r=t.value!=null&&typeof t.value!="function";if(i||r){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||!(a&&a.__selectSynced);if(a&&(a.__selectSynced=!0),!e)return;let f=-1;for(let d=0;d<c.length;d++)c[d].defaultSelected&&(f=d);f>=0&&n.selectedIndex!==f&&(n.selectedIndex=f)}function It(t,s){let{children:n,content:c}=t;const a=t.childExtends;if(typeof n=="function"){const r=n;try{n=r(t,t.state,t.context)}catch(y){if(n=void 0,typeof console<"u"&&console.error){const l=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${l} (initial run, treating as empty):`,y?.message||y)}}t.children=n;const e=t.__ref;let f=!1;const d=O(t,t.childrenDeps,r),p=k(()=>{const y=f;f=!0;let l;try{l=d(t,t.state,t.context)}catch(C){if(typeof console<"u"&&console.error){const S=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${S}${y?"":" (initial tracking run)"}:`,C?.message||C)}return}if(!y||l===t.children)return;t.children=l;const _=typeof t.onContentUpdate=="function",u=_?[]:null,h=_?[]:null,g=_?[]:null;if(Array.isArray(l)&&t.childrenAs==="state"){const C=t.childProps,S=[],L=new Map;for(let A=0;A<l.length;A++){const T=l[A];let v=C;if(typeof C=="function")try{v=C(t,T)}catch{v=null}const N=v&&v.key||T&&T.key||`${A}`;S.push(N),L.set(N,{rawChild:T,childProps:v})}const W=new Set(S),U=e.__children.slice();for(const A of U)if(!W.has(A)){const T=t[A];T?.remove&&T.remove(),delete t[A],h&&h.push(A)}const Z=t.childExtends,m=t.tag==="fragment",Ut=t.context?.document||globalThis.document,q=m?null:Ut?.createDocumentFragment(),st=new Set;for(const A of S){const T=L.get(A),v=T.rawChild,N=t[A];if(N&&N.state){if(v&&typeof v=="object"){const P=N.state,B=P.$replace||P.replace,At=P.$update||P.update;if(typeof B=="function")B.call(P,v);else if(typeof At=="function"){for(const F in P)if(!(F==="__element"||F==="root"||F==="parent"||F==="update")&&!Object.prototype.hasOwnProperty.call(v,F))try{P[F]=void 0}catch{}At.call(P,v)}else for(const F in v)P[F]=v[F]}g&&g.push(A);continue}let nt=v;(typeof v=="string"||typeof v=="number")&&(nt={value:v,text:v});const xt=T.childProps;let R=xt?{...xt,state:nt}:{state:nt};if(Z&&!R.ignoreChildExtends)if(R.extends){const P=Array.isArray(R.extends)?R.extends:[R.extends],B=Array.isArray(Z)?Z:[Z];R={...R,extends:[...B,...P]}}else R={...R,extends:Z};let ct;try{ct=z(R,t,A,s)}catch(P){if(typeof console<"u"&&console.error){const B=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${A}" failed to construct at ${B} (reconcile, skipping this row):`,P?.message||P)}st.add(A);continue}!m&&ct?.node&&q&&q.appendChild(ct.node),u&&u.push(A)}if(!m&&q&&q.childNodes.length&&t.node&&t.node.appendChild(q),!m&&t.node){let A=null;for(const T of S){const v=t[T]?.node;if(!v)continue;const N=A?A.nextSibling:t.node.firstChild;v!==N&&t.node.insertBefore(v,N),A=v}}e.__children=st.size?S.filter(A=>!st.has(A)):S,_&&(u.length||h.length)&&jt(t,{added:u,removed:h,kept:g}),bt(t,!1);return}const w=_?[...e.__children]:null;for(const C of[...e.__children]){const S=t[C];S?.remove&&S.remove(),delete t[C]}e.__children=[],gt(t,l,s),bt(t,!1),_&&jt(t,{added:[...e.__children],removed:w,kept:[]})},{depth:e.path.length});e.__effects.push(p)}const o=gt(t,n||c,s);if((n||c)&&!o)return;const i=t.context?.components||{};{const r=Object.keys(t);for(let e=0;e<r.length;e++){const f=r[e];if(!f.endsWith("Extends")||typeof t[f]!="string")continue;const d=f.slice(0,-7);if(!d||d.charCodeAt(0)<65||d.charCodeAt(0)>90)continue;const p={extends:t[f]};delete t[f];for(let y=e+1;y<r.length;y++){const l=r[y],_=l.charCodeAt(0);if(_>=65&&_<=90||K.has(l)||typeof t[l]=="function"&&(l.startsWith("on")||l.startsWith(".")))break;const u=t[l];u!==void 0&&(p[l]=u,delete t[l])}t[d]&&typeof t[d]=="object"?t[d]={...p,...t[d]}:t[d]=p}}for(const r in t){if(!Object.prototype.hasOwnProperty.call(t,r)||K.has(r)||typeof t[r]!="object"||t[r]===null)continue;const e=r.charCodeAt(0);if(e<65||e>90)continue;let f=t[r];if(!f.__ref){if(!f.extends&&!f.extend){const d=i[r]||i[`smbls.${r}`];d&&(f={...f,extends:d})}if(t.childProps&&(f=ot(t.childProps,f)),a&&!f.ignoreChildExtends)if(f.extends){const d=Array.isArray(f.extends)?f.extends:[f.extends],p=Array.isArray(a)?a:[a];f={...f,extends:[...p,...d]}}else f={...f,extends:a};z(f,t,r,s)}}}function Kt(t,s,n){const{node:c}=t;if(!c)return;c.ref=t;const a=s?.tag==="fragment"?s.__ref?.__fragmentAnchor:null;if(a){const i=a.parentNode;if(i){if(n?.position==="before"&&n.node)i.insertBefore(c,n.node);else if(n?.position==="after"&&n.node){const r=n.node.nextSibling;i.insertBefore(c,r||a)}else i.insertBefore(c,a);return}}const o=s?.node||(s?.nodeType?s:null);if(o)if(n?.position==="before"&&n.node)o.insertBefore(c,n.node);else if(n?.position==="after"&&n.node){const i=n.node.nextSibling;i?o.insertBefore(c,i):o.appendChild(c)}else o.appendChild(c)}function M(t,s,n){const c=t.charAt(0).toLowerCase()+t.slice(1);s.context?.plugins?.length&&V(c,s,n);const a="on"+t,o=s[a];if(typeof o=="function"){const i=t==="Render"||t==="RenderRouter";if(i){if(s.__ref.__inRender)return!0;s.__ref.__inRender=!0}const r=s.context?.designSystem;r&&$(r);try{if(o(s,s.state,s.context,n)===!1)return!1}catch(e){if(s.context?.plugins?.length&&V("error",s,{hook:a,error:e})||console.error(`[DOMQL] Lifecycle "${a}" error:`,e),s.context?.strictMode)throw e}finally{r&&D(),i&&(s.__ref.__inRender=!1)}}return!0}var Do=z;export{z as create,Do as default,kt as flushMounts};
4
+ `):"")}}if(Ct(o,!0),Vt(o,s,f),typeof o.html=="function"&&o.node&&!o.node.innerHTML){const l=o.context?.designSystem;l&&O(l);try{const h=o.html(o,o.state,o.context);h!=null&&typeof h!="function"&&(o.node.innerHTML=h)}catch{}finally{l&&L()}}if(M("Create",o,c),M("Complete",o,c),M("Render",o,c),M("RenderRouter",o,c),Pt(o,c),typeof o.onFrame=="function"){const l=o.onFrame,h=o.context?.designSystem,g=()=>{if(o.node){if(o.node.isConnected){h&&O(h);try{l(o,o.state,o.context)}catch(x){console.error("[DOMQL] onFrame error:",x)}finally{h&&L()}}requestAnimationFrame(g)}};requestAnimationFrame(g)}return o}function oo(t,s,n){const c=!s,f=n.state&&typeof n.state=="object"&&!Array.isArray(n.state)&&Object.keys(n.state).length===0,o=c&&f&&t.context?.state,e=n.state!==void 0&&!o?n.state:t.state&&!I(t.state)?t.state:void 0;if(e==null){if(s?.state)t.state=s.state,Q(t,t.state);else if(t.context?.state){const r=t.context.state,i={...r},a=t.context?.polyglot;if(a?.translations){const u=r.lang||a.defaultLang||"en",d=a.translations[u];if(d&&typeof d=="object")for(const y in d)i[y]===void 0&&(i[y]=d[y]);const p=new Set(a.languages||[]);for(const y in a.translations)!p.has(y)&&i[y]===void 0&&(i[y]=a.translations[y])}t.state=I(i)?i:it(i),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 e=="string"){if(t.state=Lt(e,s),t.state&&typeof t.state=="object"&&!I(t.state)){const r=s?.state?.root||s?.state||t.state;Object.defineProperty(t.state,"root",{value:r,enumerable:!1,configurable:!0,writable:!0})}Q(t,t.state);return}if(typeof e=="function"){const r=e(t,s?.state);t.state=I(r)?r:it(r||{})}else I(e)?t.state=e:t.state=it({...e});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 pt(t,s){if(!s)return t;const n=s.split("/");let c=t;for(const f of n){if(c==null)return{};c=c[f]}return c??{}}function Lt(t,s){if(!s)return{};if(t===".")return s.state||{};if(t.startsWith("../")){const f=t.slice(3);return f?pt(s.state,f):s.state??{}}if(t.startsWith("~/")){const f=s.state?.root||s.state,o=t.slice(2);return o?pt(f,o):f??{}}if(s.state?.[t]!==void 0)return s.state[t];const n=pt(s.state,t);if(n!=null&&Object.keys(n).length>0)return n;const c=s.context?.polyglot;if(c?.translations){const f=s.state?.root?.lang||c.defaultLang||"en",o=c.translations[f];if(o?.[t]!==void 0)return o[t];if(c.translations[t]!==void 0)return c.translations[t]}return{}}function so(t){const s=t.__ref,n=t.tag||"div",c=t.context?.designSystem,f=[],o=Object.keys(t);for(let e=0;e<o.length;e++){const r=o[e];if(typeof t[r]!="function"||K.has(r))continue;const i=r.charCodeAt(0);i>=65&&i<=90||H(r)||E[r]||j&&j.has(r)||at(n,r)||f.push({prop:r,fn:t[r]})}for(let e=0;e<f.length;e++){const{prop:r,fn:i}=f[e];s.__exec[r]=i,Object.defineProperty(t,r,{get(){c&&O(c);try{return i(t,t.state,t.context)}catch{return}finally{c&&L()}},set(a){delete s.__exec[r],Object.defineProperty(t,r,{value:a,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function no(t,s){if(!(!Array.isArray(s)||s.length===0))for(let n=0;n<s.length;n++){const c=s[n];try{typeof c=="function"?c(t,t.state,t.context):typeof c=="string"&&t.state?.[c]}catch{}}}function D(t,s,n){return!Array.isArray(s)||s.length===0?n:function(...c){return no(t,s),n.apply(this,c)}}function J(t,s){if(!(!t||Array.isArray(t)||typeof t!="object"))return t[s]}function Dt(t,s){const n=t.__ref,c=!!(s&&s.skipIfEffect);if(so(t),typeof t.text=="function"){const o=t.text,e=D(t,t.textDeps,o),r=S(()=>{if(!n.contentManaged)try{let i=e(t,t.state,t.context);t.node&&i!=null&&typeof i!="function"&&typeof i!="object"&&(typeof i=="string"&&i.includes("{{")&&(i=ft.call(t,i,t.state)),t.tag==="string"?t.node.nodeValue=i:t.node.textContent=i)}catch{}},{depth:n.path.length});n.__effects.push(r),n.__exec.text=o}else if(typeof t.text=="string"&&t.text.includes("{{")){const o=t.text,e=S(()=>{if(n.contentManaged)return;const r=ft.call(t,o,t.state);r!=null&&(t.text=r),t.node&&(t.tag==="string"?t.node.nodeValue=r??"":t.node.textContent=r??"")},{depth:n.path.length});n.__effects.push(e),n.__exec.text=o}for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)&&typeof t[o]=="function"&&!K.has(o)&&!H(o)&&!n.__exec[o]){if(E[o]){const e=t[o],r=D(t,t[o+"Deps"],e),i=o;let a;const u=S(()=>{const d=t.context?.designSystem;d&&O(d);try{const p=r(t,t.state,t.context),y=E[i](p,t,t.state,t.context);if(y&&t.node){const _=ht(y);(_===null||_!==a)&&(a=_,Y(t.node,y))}else t.node&&(i==="show"||i==="hide")&&(a=void 0,t.node.style.display="")}finally{d&&L()}},{depth:n.path.length});n.__effects.push(u),n.__exec[o]=e}else if(j&&j.has(o)){const e=t[o],r=D(t,t[o+"Deps"],e),i=o;let a;const u=S(()=>{const d=t.context?.designSystem;d&&O(d);try{const p=r(t,t.state,t.context);if(t.node)if(p!=null){const y=i+":"+String(p);y!==a&&(a=y,Y(t.node,{[i]:p}))}else a=void 0,t.node.style[i]=""}finally{d&&L()}},{depth:n.path.length});n.__effects.push(u),n.__exec[o]=e}}if(typeof t.html=="function"){const o=t.html,e=D(t,t.htmlDeps,o),r=S(()=>{const i=t.context?.designSystem;i&&O(i);try{const a=e(t,t.state,t.context);t.node&&a!=null&&typeof a!="function"&&(t.node.innerHTML=a)}finally{i&&L()}},{depth:n.path.length});n.__effects.push(r),n.__exec.html=o}if(typeof t.value=="function"){const o=t.value,e=D(t,t.valueDeps,o),r=S(()=>{try{const i=e(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const a=i==null?"":String(i);if(t.node.value===a)return;const u=typeof document<"u"&&document.activeElement===t.node,d=u&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,p=u&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=a,u&&d!=null&&p!=null)try{t.node.setSelectionRange(d,p)}catch{}}catch{}},{depth:n.path.length});n.__effects.push(r),n.__exec.value=o}if(typeof t.style=="function"){const o=t.style,e=D(t,t.styleDeps,o);let r;const i=S(()=>{const a=e(t,t.state,t.context),u=ht(a);(u===null||u!==r)&&(r=u,Y(t.node,a))},{depth:n.path.length});n.__effects.push(i),n.__exec.style=o}else if(t.style&&typeof t.style=="object")for(const o in t.style){const e=t.style[o];if(typeof e!="function")continue;const r=D(t,J(t.styleDeps,o),e);let i;const a=S(()=>{try{const u=r(t,t.state,t.context);if(t.node){const d=o+":"+String(u);d!==i&&(i=d,Y(t.node,{[o]:u}))}}catch{}},{depth:n.path.length});n.__effects.push(a)}if(t.attr&&typeof t.attr=="object"){for(const o in t.attr)if(typeof t.attr[o]=="function"){const e=D(t,J(t.attrDeps,o),t.attr[o]),r=o,i=S(()=>{try{const a=e(t,t.state,t.context);t.node?.setAttribute&&(a==null||a===!1?t.node.removeAttribute(r):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(r,a===!0?"":a))}catch{}},{depth:n.path.length});n.__effects.push(i)}}if(t.aria&&typeof t.aria=="object")for(const o in t.aria){if(typeof t.aria[o]!="function")continue;const e=D(t,J(t.ariaDeps,o),t.aria[o]),r="aria-"+o.replace(/[A-Z]/g,a=>"-"+a.toLowerCase()),i=S(()=>{try{const a=e(t,t.state,t.context);if(!t.node?.setAttribute)return;a==null||a===!1?t.node.removeAttribute(r):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(r,a===!0?"":a)}catch{}},{depth:n.path.length});n.__effects.push(i)}if(t.data&&typeof t.data=="object")for(const o in t.data){if(typeof t.data[o]!="function")continue;const e=D(t,J(t.dataDeps,o),t.data[o]),i="data-"+o.replace(/[A-Z]/g,u=>"-"+u.toLowerCase()),a=S(()=>{try{const u=e(t,t.state,t.context);if(!t.node?.setAttribute)return;u==null||u===!1?t.node.removeAttribute(i):typeof u!="function"&&typeof u!="object"&&t.node.setAttribute(i,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){if(typeof f[o]!="function")continue;const e=D(t,J(t.classDeps,o),f[o]),r=S(()=>{try{const i=e(t,t.state,t.context);if(!t.node?.classList)return;typeof i=="string"?t.node.classList.add(i):i?t.node.classList.add(o):t.node.classList.remove(o)}catch{}},{depth:n.path.length});n.__effects.push(r)}!c&&typeof t.if=="function"&&Tt(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 e=o.charCodeAt(0);if(e>=65&&e<=90||H(o))continue;const r=t[o];n.__exec[o]=r;const i=t.tag||"div";if(at(i,o)&&!E[o]&&!(j&&j.has(o))){const a=ut(o)||o,u=D(t,t[o+"Deps"],r),d=S(()=>{try{const p=u(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(io(t),ao(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const o=t.onStateUpdate,e=t.stateDeps;let r=!1,i=[];const a=S(()=>{const u=[];for(let _=0;_<e.length;_++){const l=e[_];try{u[_]=typeof l=="function"?l(t,t.state,t.context):t.state?.[l]}catch{u[_]=void 0}}if(!r){r=!0,i=u;return}let d=u.length!==i.length;for(let _=0;!d&&_<u.length;_++)u[_]!==i[_]&&(d=!0);const p=i;if(i=u,!d)return;const y=t.context?.designSystem;y&&O(y);try{o(t,t.state,t.context,{prev:p,next:u})}catch(_){if(t.context?.plugins?.length&&V("error",t,{hook:"onStateUpdate",error:_})||console.error('[DOMQL] Lifecycle "onStateUpdate" error:',_),t.context?.strictMode)throw _}finally{y&&L()}},{depth:n.path.length});n.__effects.push(a)}fo(t)}function $t(t){const s=t.parent,n=s?.node;if(!n||!t.node){Vt(t,t.parent);return}let c=null;const f=Object.keys(s),o=f.indexOf(t.key);for(let e=o+1;e<f.length;e++){const r=s[f[e]];if(r?.node?.parentNode===n){c=r.node;break}}c?n.insertBefore(t.node,c):n.appendChild(t.node)}function Tt(t,s,n){const c=D(t,t.ifDeps,n),f=S(()=>{let o;try{o=c(t,t.state,t.context)}catch(r){if(o=!1,s.__ifError=r,typeof console<"u"&&console.warn){const i=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${i} \u2014 treating as false:`,r?.message||r)}return}const e=s.__if;if(s.__if=!!o,e&&!s.__if&&t.node)t.node.remove();else if(!e&&s.__if)if(s.__ifInitialized)t.node||(t.node=et(t)),t.node&&(t.node.ref=t),$t(t),yt(t);else{if(s.__ifInitialized=!0,t.tag||(t.tag=vt(t)),M("Init",t,{}),t.node||(t.node=et(t)),!t.node)return;if(t.parent?.__ref?.__children&&!t.parent.__ref.__children.includes(t.key)&&t.parent.__ref.__children.push(t.key),t.tag==="fragment"&&!s.__fragmentAnchor){const i=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(i),s.__fragmentAnchor=i}M("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),Kt(t,{}),Dt(t,{skipIfEffect:!0}),yt(t),Mt(t),Ut(t,{}),$t(t),Pt(t,{})}},{depth:s.path.length});s.__effects.push(f)}function yt(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),lo(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"&&Y(s,t.style),t.attr&&typeof t.attr=="object")for(const n in t.attr){const c=t.attr[n];typeof c=="function"||typeof c=="object"||c==null||c===!1||s.setAttribute&&s.setAttribute(n,c===!0?"":c)}if(t.data&&typeof t.data=="object")for(const n in t.data){const c=t.data[n];typeof c=="function"||typeof c=="object"||c==null||c===!1||s.dataset&&(s.dataset[n]=c===!0?"":c)}if(t.classlist||t.class){const n=t.classlist||t.class;if(typeof n=="string")n.split(" ").forEach(c=>c&&s.classList.add(c));else if(typeof n=="object")for(const c in n){const f=typeof n[c]=="function"?n[c](t,t.state,t.context):n[c];f&&s.classList.add(typeof f=="string"?f:c)}}}}function ht(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function Y(t,s){if(!t||!s||!t.style)return;let n=null;for(const c in s){const f=s[c];if(f!=null){if(c.charAt(0)==="&"&&typeof f=="object"){n||(n={}),n[c]=f;continue}try{const o=String(f),e=c.replace(/[A-Z]/g,u=>"-"+u.toLowerCase()),r=o.trim(),i=/\s*!important\s*$/.test(r),a=r.replace(/\s*!important\s*$/,"");t.style.setProperty(e,a,i?"important":"")}catch{}}}n&&ro(t,n)}let co=0;function ro(t,s){const n=`_ds${co++}`;t.classList.add(n);const c=t.ownerDocument;let f=c.querySelector("style[data-smbls-scoped]");f||(f=c.createElement("style"),f.setAttribute("data-smbls-scoped",""),c.head.appendChild(f));let o="";for(const e in s){const r="."+n,i=e.replace(/&/g,r).split(",").map(u=>{const d=u.trim();return d.includes(r)?d:r+d}).join(", "),a=s[e];if(typeof a=="object"){let u="",d="";for(const p in a){const y=a[p];if(typeof y=="object"){const _=p.includes("&")?i.split(", ").map(h=>p.replace(/&/g,h)).join(", "):i.split(", ").map(h=>`${h} ${p}`).join(", ");let l="";for(const h in y)l+=`${h.replace(/[A-Z]/g,g=>"-"+g.toLowerCase())}: ${y[h]};`;d+=jt(`${_} { ${l} }`,_)+`
5
+ `}else u+=`${p.replace(/[A-Z]/g,_=>"-"+_.toLowerCase())}: ${y};`}u&&(o+=jt(`${i} { ${u} }`,i)+`
6
+ `),d&&(o+=d)}}o&&(f.textContent+=o)}function io(t){let s=t.subscribeTo;if(typeof s=="function")try{s=s(t,t.state,t.context)}catch{s=null}if(!Array.isArray(s)||s.length===0)return;const n=t.__ref;for(let c=0;c<s.length;c++){const f=s[c];if(typeof f!="string"||f.length===0)continue;const o=f.split("."),e=o[0],r=o.slice(1),i={value:!1},a=S(()=>{const u=t.state&&(I(t.state)?t.state.root:null);if(!u||!I(u))return;let d=u;d=d[e];for(let y=0;y<r.length&&!(d==null||typeof d!="object");y++)if(I(d))d=d[r[y]];else break;if(!i.value)return;let p=!1;if(typeof t.onBeforeUpdate=="function"){const y=t.context?.designSystem;y&&O(y);try{t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0})===!1&&(p=!0)}catch(_){t.context?.plugins?.length&&V("error",t,{hook:"onBeforeUpdate",error:_})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",_)}finally{y&&L()}}if(!p&&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(!p&&typeof t.onUpdate=="function"){const y=t.context?.designSystem;y&&O(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&&L()}}},{depth:n.path.length});i.value=!0,a._isSubscribeToEffect=!0,n.__effects.push(a)}}function _t(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)])}const Rt=new Set;function eo(t,s){const n=s?.__ref?.path?s.__ref.path.join("."):s?.key||"?",c=n+"::"+t;Rt.has(c)||(Rt.add(c),console.warn(`[smbls/css] "${t}" at ${n} is a CHILD-COMPONENT key nested inside a pseudo/selector block (":hover", "@dark", etc.) \u2014 that is never a valid CSS selector fragment. The rule is DROPPED (not shipped as a dead/never-matching selector). To reveal a child on a parent state, target the child's OWN class from the parent selector instead, e.g. move the declaration onto the child element itself, or use a sibling-selector combinator in a top-level style block.`))}function G(t,s,n){const c={},f=new Set,o=(e,r,i)=>{const a=i?new Set(Object.keys(c)):null;if(E[e]){const u=E[e](r,s,s.state,s.context);if(u){const d=Array.isArray(u)?u:[u];for(const p of d)p&&Object.assign(c,p)}}else c[e]=r;if(i)for(const u in c)a.has(u)||f.add(u)};for(const e in t){if(!Object.prototype.hasOwnProperty.call(t,e))continue;let r=t[e];if(typeof r=="function"&&(r=r(s,s.state,s.context)),r==null||typeof r=="function")continue;if(typeof r=="object"&&!Array.isArray(r)){if(e==="style"){for(const d in r){let p=r[d];if(typeof p=="function"&&(p=p(s,s.state,s.context)),p==null||typeof p=="function")continue;const y=typeof s[d]=="function"&&(E[d]||j&&j.has(d));o(d,p,y)}continue}if(_t(e,s)){const d=G(r,s,!0);Object.keys(d).length&&(c[`[data-theme="${e.slice(1)}"] &`]=d);continue}if(/^[A-Z][A-Za-z0-9]*$/.test(e)){wt()&&eo(e,s);continue}let a=e;if(e.charCodeAt(0)===64&&!e.startsWith("@media")&&!e.startsWith("@keyframes")){const d=s.context?.designSystem?.media?.[e.slice(1)];d&&(a=`@media ${d}`)}const u=G(r,s,!1);Object.keys(u).length&&(c[a]=u);continue}const i=typeof s[e]=="function"&&(E[e]||j&&j.has(e));o(e,r,i)}if(n)for(const e in c)f.add(e);for(const e of f){const r=c[e];typeof r=="string"&&!r.includes("!important")&&(c[e]=r+" !important")}return c}function gt(t,s){if(s===void 0&&(s=0),s>8)return!1;if(typeof t=="function")return!0;if(t&&typeof t=="object"&&!Array.isArray(t)){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&gt(t[n],s+1))return!0}return!1}function Nt(t,s,n){if(!s||typeof s!="object"||Array.isArray(s))return null;if(_t(t,n)){const o=G(s,n,!0);return Object.keys(o).length?{cssProp:`[data-theme="${t.slice(1)}"] &`,block:o}:null}let c=t;if(t.charAt(0)==="@"&&!t.startsWith("@media")&&!t.startsWith("@keyframes")){const o=n.context?.designSystem?.media?.[t.slice(1)];o&&(c=`@media ${o}`)}const f=G(s,n,!1);return Object.keys(f).length?{cssProp:c,block:f}:null}function fo(t){const s=t.__ref;for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n)||!lt(n))continue;const c=t[n];if(!c||typeof c!="object"||Array.isArray(c)||!gt(c))continue;let f=null,o;const e=S(()=>{if(!t.node)return;const r=t.context?.designSystem;r&&O(r);let i,a=!1;try{const u=Nt(n,c,t),d=u?ht(u.block)+"::"+u.cssProp:null;if(d!==null&&d===o)a=!0;else if(o=d,u){const p=tt({[u.cssProp]:u.block},null,t.context?.cssPrefix);i=p?p.split(" ").filter(Boolean):null}else i=null}finally{r&&L()}if(!(a||!t.node.classList)){if(f)for(const u of f)t.node.classList.remove(u);if(i&&i.length)for(const u of i)t.node.classList.add(u);f=i}},{depth:s.path.length});s.__effects.push(e)}}function ao(t){const s=t.__ref;s.__conditionalRunners=[];const n=new Map;for(const c in t){if(!Object.prototype.hasOwnProperty.call(t,c))continue;const f=c.charAt(0);if(f!=="."&&f!=="!")continue;const o=c.slice(1);if(!o)continue;if(/[:@\s>~+[\]]/.test(o)){if(typeof console<"u"&&console.warn){const d=o.split(/[:@\s>~+[\]]/)[0];console.warn(`[smbls] conditional \`${c}\` on ${t.key||"?"} will never match \u2014 the whole string after \`${f}\` is read as one prop name. Nest the selector inside instead: \`${f}${d}: { '${o.slice(d.length)}': {...} }\`.`)}continue}const e=t[c];if(!e||typeof e!="object")continue;const r=f==="!",i={lastMatch:!1,appliedKeys:null,appliedClasses:null},a=()=>{let d;const p=t[o];if(p===void 0){const l=!!t.state&&o in t.state,h=t.state?t.state[o]:void 0;if(l||h!==void 0)d=h;else{const g=t.context?.cases?.[o];if(g===void 0)return;try{d=typeof g=="function"?g.call(t,t):g}catch(x){d=!1,s.__conditionalError=x,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${c}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,x?.message||x)}}}else if(typeof p=="function")try{d=p(t,t.state,t.context)}catch(l){d=!1,s.__conditionalError=l,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${c}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,l?.message||l)}else d=p;const y=r?!d:!!d;if(!t.node||y===i.lastMatch)return;i.lastMatch=y;const _=t.context?.designSystem;_&&O(_);try{if(y){const l={},h={};let g=!1;for(const b in e){if(!Object.prototype.hasOwnProperty.call(e,b))continue;const w=e[b],k=b.charAt(0);if((k===":"||k==="@"||k==="&")&&w&&typeof w=="object"&&!Array.isArray(w)){if(_t(b,t)){const $=G(w,t,!0);Object.keys($).length&&(h[`[data-theme="${b.slice(1)}"] &`]=$,g=!0)}else{let $=b;if(k==="@"&&!b.startsWith("@media")&&!b.startsWith("@keyframes")){const U=t.context?.designSystem?.media?.[b.slice(1)];U&&($=`@media ${U}`)}const B=G(w,t,!1);Object.keys(B).length&&(h[$]=B,g=!0)}continue}const v=typeof w=="function"?w(t,t.state,t.context):w;if(v!=null)if(E[b]){const $=E[b](v,t,t.state,t.context);if($){const B=Array.isArray($)?$:[$];for(const U of B)U&&Object.assign(l,U)}}else j&&j.has(b)&&(l[b]=v)}const x=Object.keys(l);if(x.length){Y(t.node,l);for(const b of x)n.set(b,c);i.appliedKeys=x}else i.appliedKeys=null;if(g){const b=tt(h,null,t.context?.cssPrefix),w=b?b.split(" ").filter(Boolean):[];if(w.length&&t.node.classList){for(const k of w)t.node.classList.add(k);i.appliedClasses=w}else i.appliedClasses=null}else if(i.appliedClasses){for(const b of i.appliedClasses)t.node.classList.remove(b);i.appliedClasses=null}}else{if(i.appliedKeys){for(const l of i.appliedKeys)n.get(l)===c&&(t.node.style[l]="",n.delete(l));i.appliedKeys=null}if(i.appliedClasses){for(const l of i.appliedClasses)t.node.classList.remove(l);i.appliedClasses=null}}}finally{_&&L()}};s.__conditionalRunners.push(a);const u=S(a,{depth:s.path.length});s.__effects.push(u)}}const bt=new WeakSet;function uo(t){const s=t.ownerDocument;!s||bt.has(s)||(bt.add(s),queueMicrotask(()=>{bt.delete(s);const n=s.body||s.documentElement;n&&n.offsetWidth}))}const xt=new WeakSet;let Ft=!1;function lo(t){const{node:s}=t;if(!s)return;if(Ft||(Ft=!0,tt({display:"none"})),xt.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}xt.add(t);const n=t.context?.designSystem;n&&O(n);try{const c={};let f=!1;if(Object.prototype.hasOwnProperty.call(t,"theme")&&typeof t.theme!="function"&&E.theme){const o=E.theme(t.theme,t,t.state,t.context);if(o){if(Array.isArray(o))for(const e of o)e&&Object.assign(c,e);else Object.assign(c,o);f=!0}}for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||typeof t[o]=="function"||K.has(o)||o==="theme")continue;const e=o.charCodeAt(0);if(!(e>=65&&e<=90)&&!H(o)){if(E[o]){const r=t[o],i=E[o](r,t,t.state,t.context);if(i){if(Array.isArray(i))for(const a of i)a&&Object.assign(c,a);else Object.assign(c,i);f=!0}}else if(j&&j.has(o)){const r=t[o];r!=null&&typeof r!="object"&&(c[o]=r,f=!0)}else if(o.charCodeAt(0)===45){const r=t[o];r!=null&&typeof r!="object"&&(c[o]=r,f=!0)}else if(o.charAt(0)==="&"||o.charAt(0)==="@"||o.charAt(0)===":"){const r=t[o];if(r&&typeof r=="object"&&!Array.isArray(r)){if(gt(r))continue;const i=Nt(o,r,t);i&&(c[i.cssProp]=i.block,f=!0)}}}}if(f){c.display&&String(c.display).includes("!important")&&(s.style.setProperty("display",String(c.display).replace(/\s*!important\s*$/,""),"important"),delete c.display);const o=tt(c,null,t.context?.cssPrefix);if(o&&s.classList){const r=o.split(" ").filter(Boolean);let i=!1;for(const a of r)s.classList.add(a),i||(a.charCodeAt(0)===95&&a.charCodeAt(1)===99||a.charCodeAt(0)===95&&a.indexOf("_c",1)!==-1)&&(i=!0);i&&uo(s)}const e=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(e!=null){const r=c.display;if(r&&r!==e)if(e==="none"){const i=[];for(const a of s.classList)a.startsWith("_d-")&&a!=="_d-none"&&i.push(a);for(const a of i)s.classList.remove(a);s.classList.add("_d-none")}else s.style.display=t.display}}}finally{n&&L(),xt.delete(t)}}function Mt(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 e="aria-"+f.replace(/[A-Z]/g,r=>"-"+r.toLowerCase());s.setAttribute(e,o===!0?"":o)}const n=Zt(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 c=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)&&!H(f)&&!(E[f]||j&&j.has(f))&&at(c,f)){let e=t[f];if(e==null||(typeof e=="string"&&e.includes("{{")&&(e=ft(e,t,t.state,t.context),t[f]=e),e==null||typeof e=="function"||typeof e=="object")||e===!1&&!Qt(ut(f)||f))continue;const r=ut(f)||f;s.setAttribute(r,qt(r,e))}}}function po(t){if(!t.autoGrow)return;const s=t.node;if(!s||s.tagName!=="TEXTAREA")return;const n=t.autoGrow,c=n&&typeof n=="object"&&n.max?String(n.max):null;c&&(s.style.maxHeight=c);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 It=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function Kt(t,s){for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n)||!H(n)||It.has(n))continue;let c=t[n];if(typeof c=="string"&&/^[A-Za-z_$][\w$]*$/.test(c)){const o=c;c=function(r){return t.call(o,r)}}if(typeof c!="function")continue;const f=mt(n);Ht.has(f)||zt(to(f),t,c)}yo(t)}function yo(t){const s=t.node;if(!s||!s.addEventListener)return;const n={};let c=!1;for(const p of It){const y=t[p];typeof y=="function"&&(n[p]=y,c=!0)}if(!c)return;const f=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,o=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let e=0,r=0,i=0,a=!1;const u=p=>{const y=p.touches&&p.touches[0]||p.changedTouches&&p.changedTouches[0];y&&(e=y.clientX,r=y.clientY,i=Date.now(),a=!0)},d=p=>{if(!a)return;a=!1;const y=p.changedTouches&&p.changedTouches[0]||p.touches&&p.touches[0];if(!y)return;const _=y.clientX-e,l=y.clientY-r,h=Date.now()-i;if(h>o)return;const g=Math.abs(_),x=Math.abs(l);if(Math.max(g,x)<f)return;let b;if(g>x*1.2)b=_<0?"left":"right";else if(x>g*1.2)b=l<0?"up":"down";else return;const w="onSwipe"+b.charAt(0).toUpperCase()+b.slice(1),k=n[w],v=n.onSwipe;k&&k.call(t,p,t,t.state,t.context),v&&v.call(t,{direction:b,dx:_,dy:l,dt:h,event:p},t,t.state,t.context)};s.addEventListener("touchstart",u,{passive:!0}),s.addEventListener("touchend",d,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("touchstart",u)}catch{}try{s.removeEventListener("touchend",d)}catch{}})}function st(t,s){const n={...t};for(const c in s){const f=n[c],o=s[c];f&&o&&typeof f=="object"&&typeof o=="object"&&!Array.isArray(f)&&!Array.isArray(o)&&typeof f!="function"&&typeof o!="function"?n[c]=st(f,o):n[c]=o}return n}function At(t,s,n){if(!s||!t.node)return;const c=t.childExtends;if(Array.isArray(s)){const f=t.tag==="fragment",o=t.context?.document||globalThis.document,e=f?null:o?.createDocumentFragment();if(!f&&!e)return;const r=t.childProps,i=t.childrenAs;for(let a=0;a<s.length;a++){let u=s[a];const d=u;(typeof u=="string"||typeof u=="number")&&(u={text:u});let p=r;if(typeof r=="function")try{p=r(t,u)}catch{p=null}if(i==="state"){let l=d;(typeof d=="string"||typeof d=="number")&&(l={value:d,text:d}),u=p?{...p,state:l}:{state:l}}else p&&(u=st(p,u));if(c&&!u.ignoreChildExtends)if(u.extends){const l=Array.isArray(u.extends)?u.extends:[u.extends],h=Array.isArray(c)?c:[c];u={...u,extends:[...h,...l]}}else u={...u,extends:c};const y=u?.key||d&&typeof d=="object"&&d.key||`${a}`;let _;try{_=z(u,t,y,n)}catch(l){if(typeof console<"u"&&console.error){const h=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${y}" failed to construct at ${h} (initial render, skipping this row):`,l?.message||l)}continue}!f&&_?.node&&e.appendChild(_.node)}return f||t.node.appendChild(e),!0}if(typeof s=="string"){const f=Lt(s,t);if(Array.isArray(f))return At(t,f,n)}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=st(t.childProps,o)),c&&!o.ignoreChildExtends)if(o.extends){const e=Array.isArray(o.extends)?o.extends:[o.extends],r=Array.isArray(c)?c:[c];o={...o,extends:[...r,...e]}}else o={...o,extends:c};z(o,t,f,n)}}}function Ct(t,s){const n=t.node;if(!n||n.tagName!=="SELECT")return;const c=n.options;if(!c||!c.length)return;const f=t.__ref,o=f&&f.__exec&&f.__exec.value,e=typeof o=="function",r=t.value!=null&&typeof t.value!="function";if(e||r){let u;if(e)try{u=o(t,t.state,t.context)}catch{return}else u=t.value;const d=u==null?"":String(u);n.value!==d&&(n.value=d);return}const i=s||!(f&&f.__selectSynced);if(f&&(f.__selectSynced=!0),!i)return;let a=-1;for(let u=0;u<c.length;u++)c[u].defaultSelected&&(a=u);a>=0&&n.selectedIndex!==a&&(n.selectedIndex=a)}function Ut(t,s){let{children:n,content:c}=t;const f=t.childExtends;if(typeof n=="function"){const r=n;try{n=r(t,t.state,t.context)}catch(p){if(n=void 0,typeof console<"u"&&console.error){const y=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${y} (initial run, treating as empty):`,p?.message||p)}}t.children=n;const i=t.__ref;let a=!1;const u=D(t,t.childrenDeps,r),d=S(()=>{const p=a;a=!0;let y;try{y=u(t,t.state,t.context)}catch(k){if(typeof console<"u"&&console.error){const v=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${v}${p?"":" (initial tracking run)"}:`,k?.message||k)}return}if(!p||y===t.children)return;t.children=y;const _=typeof t.onContentUpdate=="function",l=_?[]:null,h=_?[]:null,g=_?[]:null;if(Array.isArray(y)&&t.childrenAs==="state"){const k=t.childProps,v=[],$=new Map;for(let A=0;A<y.length;A++){const T=y[A];let C=k;if(typeof k=="function")try{C=k(t,T)}catch{C=null}const N=C&&C.key||T&&T.key||`${A}`;v.push(N),$.set(N,{rawChild:T,childProps:C})}const B=new Set(v),U=i.__children.slice();for(const A of U)if(!B.has(A)){const T=t[A];T?.remove&&T.remove(),delete t[A],h&&h.push(A)}const Z=t.childExtends,m=t.tag==="fragment",Bt=t.context?.document||globalThis.document,q=m?null:Bt?.createDocumentFragment(),nt=new Set;for(const A of v){const T=$.get(A),C=T.rawChild,N=t[A];if(N&&N.state){if(C&&typeof C=="object"){const P=N.state,W=P.$replace||P.replace,St=P.$update||P.update;if(typeof W=="function")W.call(P,C);else if(typeof St=="function"){for(const F in P)if(!(F==="__element"||F==="root"||F==="parent"||F==="update")&&!Object.prototype.hasOwnProperty.call(C,F))try{P[F]=void 0}catch{}St.call(P,C)}else for(const F in C)P[F]=C[F]}g&&g.push(A);continue}let ct=C;(typeof C=="string"||typeof C=="number")&&(ct={value:C,text:C});const kt=T.childProps;let R=kt?{...kt,state:ct}:{state:ct};if(Z&&!R.ignoreChildExtends)if(R.extends){const P=Array.isArray(R.extends)?R.extends:[R.extends],W=Array.isArray(Z)?Z:[Z];R={...R,extends:[...W,...P]}}else R={...R,extends:Z};let rt;try{rt=z(R,t,A,s)}catch(P){if(typeof console<"u"&&console.error){const W=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${A}" failed to construct at ${W} (reconcile, skipping this row):`,P?.message||P)}nt.add(A);continue}!m&&rt?.node&&q&&q.appendChild(rt.node),l&&l.push(A)}if(!m&&q&&q.childNodes.length&&t.node&&t.node.appendChild(q),!m&&t.node){let A=null;for(const T of v){const C=t[T]?.node;if(!C)continue;const N=A?A.nextSibling:t.node.firstChild;C!==N&&t.node.insertBefore(C,N),A=C}}i.__children=nt.size?v.filter(A=>!nt.has(A)):v,_&&(l.length||h.length)&&Ot(t,{added:l,removed:h,kept:g}),Ct(t,!1);return}const w=_?[...i.__children]:null;for(const k of[...i.__children]){const v=t[k];v?.remove&&v.remove(),delete t[k]}i.__children=[],At(t,y,s),Ct(t,!1),_&&Ot(t,{added:[...i.__children],removed:w,kept:[]})},{depth:i.path.length});i.__effects.push(d)}const o=At(t,n||c,s);if((n||c)&&!o)return;const e=t.context?.components||{};{const r=Object.keys(t);for(let i=0;i<r.length;i++){const a=r[i];if(!a.endsWith("Extends")||typeof t[a]!="string")continue;const u=a.slice(0,-7);if(!u||u.charCodeAt(0)<65||u.charCodeAt(0)>90)continue;const d={extends:t[a]};delete t[a];for(let p=i+1;p<r.length;p++){const y=r[p],_=y.charCodeAt(0);if(_>=65&&_<=90||K.has(y)||typeof t[y]=="function"&&(y.startsWith("on")||y.startsWith(".")))break;const l=t[y];l!==void 0&&(d[y]=l,delete t[y])}t[u]&&typeof t[u]=="object"?t[u]={...d,...t[u]}:t[u]=d}}for(const r in t){if(!Object.prototype.hasOwnProperty.call(t,r)||K.has(r)||typeof t[r]!="object"||t[r]===null)continue;const i=r.charCodeAt(0);if(i<65||i>90)continue;let a=t[r];if(!a.__ref){if(!a.extends&&!a.extend){const u=e[r]||e[`smbls.${r}`];u&&(a={...a,extends:u})}if(t.childProps&&(a=st(t.childProps,a)),f&&!a.ignoreChildExtends)if(a.extends){const u=Array.isArray(a.extends)?a.extends:[a.extends],d=Array.isArray(f)?f:[f];a={...a,extends:[...d,...u]}}else a={...a,extends:f};z(a,t,r,s)}}}function Vt(t,s,n){const{node:c}=t;if(!c)return;c.ref=t;const f=s?.tag==="fragment"?s.__ref?.__fragmentAnchor:null;if(f){const e=f.parentNode;if(e){if(n?.position==="before"&&n.node)e.insertBefore(c,n.node);else if(n?.position==="after"&&n.node){const r=n.node.nextSibling;e.insertBefore(c,r||f)}else e.insertBefore(c,f);return}}const o=s?.node||(s?.nodeType?s:null);if(o)if(n?.position==="before"&&n.node)o.insertBefore(c,n.node);else if(n?.position==="after"&&n.node){const e=n.node.nextSibling;e?o.insertBefore(c,e):o.appendChild(c)}else o.appendChild(c)}function M(t,s,n){const c=t.charAt(0).toLowerCase()+t.slice(1);s.context?.plugins?.length&&V(c,s,n);const f="on"+t,o=s[f];if(typeof o=="function"){const e=t==="Render"||t==="RenderRouter";if(e){if(s.__ref.__inRender)return!0;s.__ref.__inRender=!0}const r=s.context?.designSystem;r&&O(r);try{if(o(s,s.state,s.context,n)===!1)return!1}catch(i){if(s.context?.plugins?.length&&V("error",s,{hook:f,error:i})||console.error(`[DOMQL] Lifecycle "${f}" error:`,i),s.context?.strictMode)throw i}finally{r&&L(),e&&(s.__ref.__inRender=!1)}}return!0}var No=z;export{z as create,No as default,Et as flushMounts};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/element",
3
- "version": "3.14.743",
3
+ "version": "3.14.747",
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",
@@ -24,7 +24,7 @@
24
24
  "@symbo.ls/signal": "^3.14.628",
25
25
  "@symbo.ls/state": "^3.14.678",
26
26
  "@symbo.ls/utils": "^3.14.743",
27
- "css-in-props": "^3.14.707",
27
+ "css-in-props": "^3.14.747",
28
28
  "attrs-in-props": "^3.14.692"
29
29
  },
30
30
  "files": [