@symbo.ls/element 3.14.797 → 3.14.798
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/dist/cjs/src/create.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`+
|
|
1
|
+
"use strict";var rs=Object.create;var jt=Object.defineProperty;var is=Object.getOwnPropertyDescriptor;var cs=Object.getOwnPropertyNames;var fs=Object.getPrototypeOf,as=Object.prototype.hasOwnProperty;var us=(t,o)=>{for(var s in o)jt(t,s,{get:o[s],enumerable:!0})},co=(t,o,s,e)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of cs(o))!as.call(t,r)&&r!==s&&jt(t,r,{get:()=>o[r],enumerable:!(e=is(o,r))||e.enumerable});return t};var ds=(t,o,s)=>(s=t!=null?rs(fs(t)):{},co(o||!t||!t.__esModule?jt(s,"default",{value:t,enumerable:!0}):s,t)),ls=t=>co(jt({},"__esModule",{value:!0}),t);var rn={};us(rn,{BEFORE_UPDATE_MAX_CONSECUTIVE_FAILURES:()=>It,acquireBeforeUpdateGuard:()=>mo,create:()=>Q,default:()=>en,flushMounts:()=>$t,isStaticCssProp:()=>qs,recompileStaticCss:()=>Zs,reconcileAttrProp:()=>Qs,releaseBeforeUpdateGuard:()=>kt,writeElementText:()=>Ct});module.exports=ls(rn);var N=require("@symbo.ls/signal"),k=require("@symbo.ls/signal"),nt=require("./cache.js"),U=require("./registry.js"),dt=require("./delegate.js"),Zo=require("./extends.js"),Qo=require("./methods.js"),un=require("./dispose.js"),st=require("./devRuntime.js"),B=require("./mountScheduler.js"),R=require("@symbo.ls/utils"),Et=ds(require("@symbo.ls/utils"),1),z=require("@symbo.ls/utils/function.js"),ut=require("@symbo.ls/state"),C=require("css-in-props"),X=require("@symbo.ls/css"),j=require("@symbo.ls/scratch"),v=require("attrs-in-props"),Xo=require("./engineRegistry.js"),eo=require("./cssLonghands.js"),J=require("./attributeFirst.js"),Jo=require("./version.js");const fo=(0,Xo.resolveElementIdEngine)({uniqId:1,scopedStyleId:0},Jo.VERSION),ht=[],m=new Set;let Ht=!1,ao=0,it=null,yt=null;function ct(){return typeof Date<"u"&&typeof Date.now=="function"?Date.now():0}function uo(){return typeof document<"u"&&document.visibilityState==="hidden"}const ps=250,hs=1e3;function ys(){return yt&&(yt!==(typeof requestAnimationFrame=="function"?requestAnimationFrame:null)||uo())?!0:ct()-ao>=hs}function _s(){if(Ht=!0,ao=ct(),yt=null,typeof requestAnimationFrame!="function"){const t=typeof clearTimeout=="function"?clearTimeout:null,o=setTimeout($t,0);it=t?()=>t(o):null;return}if(uo()){const t=typeof clearTimeout=="function"?clearTimeout:null,o=setTimeout($t,ps);it=t?()=>t(o):null}else{const t=typeof cancelAnimationFrame=="function"?cancelAnimationFrame:null;yt=requestAnimationFrame;const o=requestAnimationFrame($t);it=t?()=>t(o):null}}function Pt(){if(Ht){if(!ys())return;const t=it;if(it=null,t)try{t()}catch{}}_s()}const lo=300,po=15e4;function $t(){if(Ht=!1,it=null,yt=null,m.size&&Js(),!ht.length)return;const t=ht.splice(0,ht.length);for(let o=0;o<t.length;o++){const s=t[o];if(s.node){if(!s.node.isConnected){const e=s.__ref||(s.__ref={});e.__mountAttempts=(e.__mountAttempts||0)+1,e.__mountFirstAttemptAt==null&&(e.__mountFirstAttemptAt=ct());const r=ct()-e.__mountFirstAttemptAt;e.__mountAttempts<=lo&&r<po?(ht.push(s),Pt()):console.warn("[DOMQL] onMounted dropped after",e.__mountAttempts,"attempts /",r,"ms \u2014 node never connected:",s.key||s.tag||s);continue}$("Mounted",s,s.__ref?.__mountOptions||{})}}}function Kt(t,o){const s=t.__ref?.__autoGrow;s&&s.active&&St(t,!0),typeof t.onMounted=="function"&&(t.__ref.__mountOptions=o,ht.push(t),Pt())}function ho(t,o){if(typeof t.onContentUpdate!="function")return;t.context?.plugins?.length&&(0,z.runPluginHook)("contentUpdate",t,o);const s=t.context?.designSystem;s&&(0,j.pushConfig)(s);try{t.onContentUpdate(t,t.state,t.context,o)}catch(e){if(t.context?.plugins?.length&&(0,z.runPluginHook)("error",t,{hook:"onContentUpdate",error:e})||console.error('[DOMQL] Lifecycle "onContentUpdate" error:',e),t.context?.strictMode)throw e}finally{s&&(0,j.popConfig)()}}function Z(t){return t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90}function gs(t){return t.charAt(2).toLowerCase()+t.slice(3)}function bs(t){return t.toLowerCase()}function Wt(t){const o=t.charCodeAt(0);return o===58||o===64||o===38||o===91}function _t(t,o){const s={...t};for(const e in o){const r=s[e],i=o[e];r&&i&&typeof r=="object"&&typeof i=="object"&&!Array.isArray(r)&&!Array.isArray(i)&&typeof r!="function"&&typeof i!="function"?s[e]=_t(r,i):s[e]=i}return s}function Tt(t){if(typeof t=="string")return t||void 0;if(typeof t=="number"||typeof t=="bigint")return String(t)}function yo(t,o,s){return Tt(t)||(o&&typeof o=="object"?Tt(o.key):void 0)||String(s)}function Q(t,o,s,e={},r){const i=(0,k.getObserver)();if(i){(0,k.setObserver)(null);try{return Q(t,o,s,e,r)}finally{(0,k.setObserver)(i)}}if(t==null||t===!1)return null;const a=Os(t);(typeof t=="string"||typeof t=="number")&&(t={text:t}),s=Tt(s);const f=Tt(t.key),n=Object.create(null);n.key=s||f||`_${fo.uniqId++}`,n.parent=o||null,n.context=t.context||o?.context||e.context||{},n.context.__create||(n.context.__create=Q);const d=n.__ref={__if:!0,__children:[],__exec:{},__effects:[],__eventCleanup:[],root:o?.__ref?.root||n,path:o?.__ref?.path?[...o.__ref.path,n.key]:[n.key],origin:t};a&&(d.__runtimeSource=a);const y=t;if(t=_o(n,t,s,f,o,e),n.if!=null){let h;if(typeof n.if=="function")try{h=n.if(n,n.state,n.context)}catch(_){if(h=!1,d.__ifError=_,typeof console<"u"&&console.warn){const c=n.key||n.tag||"?";console.warn(`[smbls] \`if:\` evaluator threw on ${c} \u2014 treating as false:`,_?.message||_)}}else h=n.if;d.__if=!!h}if(d.__if)typeof n.if=="function"&&(d.__ifInitialized=!0);else{o&&(o[n.key]=n);const h=ws(t,s,n.context?.components);return h.length&&(d.__ifLateMerge={definition:y,key:s,ownKey:f,names:h,options:e}),typeof n.if=="function"&&vo(n,d,n.if),n}n.tag||(n.tag=(0,nt.detectTag)(n)),$("Init",n,e);const p=n.node=(0,nt.cacheNode)(n);if(!p)return n;if(n.tag==="fragment"){const _=(n.context?.document||globalThis.document).createComment("");p.appendChild(_),d.__fragmentAnchor=_}$("AttachNode",n,e),p.setAttribute&&n.key&&p.setAttribute("data-key",n.key),o&&(o[n.key]=n,o.__ref?.__children&&(o.__ref.__children.includes(n.key)||o.__ref.__children.push(n.key))),p.setAttribute&&n.context?.scopeSelector&&n.context.scopeSelector!==":root"&&n.context.key&&n.key===n.context.key&&p.setAttribute("data-smbls-app",n.context.key),n.id&&p.setAttribute&&(p.id=n.id),zo(n,e),Co(n),Zt(n),Uo(n),Ko(n),sn(n);try{Yo(n,e)}catch(h){if(typeof console<"u"&&console.error){const _=n.__ref?.path?.join(".")||n.key||"<root>";console.error(`[smbls] createChildren failed at ${_}:`,h?.message||h,h?.stack?`
|
|
2
|
+
`+h.stack.split(`
|
|
3
3
|
`).slice(0,6).join(`
|
|
4
|
-
`):"")}}if(Ft(e,!0),Yo(e,s,r),typeof e.html=="function"&&e.node&&!e.node.innerHTML){const _=e.context?.designSystem;_&&(0,E.pushConfig)(_);try{const b=e.html(e,e.state,e.context);b!=null&&typeof b!="function"&&(e.node.innerHTML=b)}catch{}finally{_&&(0,E.popConfig)()}}if($("Create",e,n),$("Complete",e,n),$("Render",e,n),$("RenderRouter",e,n),Kt(e,n),typeof e.onFrame=="function"){const _=e.onFrame,b=e.context?.designSystem,w=()=>{if(e.node){if(e.node.isConnected){b&&(0,E.pushConfig)(b);try{_(e,e.state,e.context)}catch(S){console.error("[DOMQL] onFrame error:",S)}finally{b&&(0,E.popConfig)()}}requestAnimationFrame(w)}};requestAnimationFrame(w)}return e}function bs(t,s,o){const n=!s,r=o.state&&typeof o.state=="object"&&!Array.isArray(o.state)&&Object.keys(o.state).length===0,i=n&&r&&t.context?.state,a=o.state!==void 0&&!i?o.state:t.state&&!(0,N.isStore)(t.state)?t.state:void 0;if(a==null){if(s?.state)t.state=s.state,(0,ut.applyStateMethods)(t,t.state);else if(t.context?.state){const f=t.context.state,e={...f},u=t.context?.polyglot;if(u?.translations){const h=t.context,p=f.lang||u.defaultLang||"en",y=new Set,g=(d,A)=>{y.has(d)||(0,D.isPolyglotWritableKey)(h,d,e)&&(e[d]=A,y.add(d),(0,D.markPolyglotSeeded)(h,d,A))},c=u.translations[p];if(c&&typeof c=="object")for(const d in c)g(d,c[d]);const l=new Set(u.languages||[]);for(const d in u.translations)l.has(d)||g(d,u.translations[d])}t.state=(0,N.isStore)(e)?e:(0,N.createStore)(e),t.state.__element=t,t.state.root=t.state,(0,ut.applyStateMethods)(t,t.state),Et.promoteActiveRootState?.(f,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),(0,ut.applyStateMethods)(t,t.state);return}if(typeof a=="string"){if(t.state=_o(a,s),t.state&&typeof t.state=="object"&&!(0,N.isStore)(t.state)){const f=s?.state?.root||s?.state||t.state;Object.defineProperty(t.state,"root",{value:f,enumerable:!1,configurable:!0,writable:!0})}(0,ut.applyStateMethods)(t,t.state);return}if(typeof a=="function"){const f=a(t,s?.state);t.state=(0,N.isStore)(f)?f:(0,N.createStore)(f||{})}else(0,N.isStore)(a)?t.state=a:t.state=(0,N.createStore)({...a});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,ut.applyStateMethods)(t,t.state),Et.promoteActiveRootState?.(a,t.state)}function zt(t,s){if(!s)return t;const o=s.split("/");let n=t;for(const r of o){if(n==null)return{};n=n[r]}return n??{}}function _o(t,s){if(!s)return{};if(t===".")return s.state||{};if(t.startsWith("../")){const r=t.slice(3);return r?zt(s.state,r):s.state??{}}if(t.startsWith("~/")){const r=s.state?.root||s.state,i=t.slice(2);return i?zt(r,i):r??{}}if(s.state?.[t]!==void 0)return s.state[t];const o=zt(s.state,t);if(o!=null&&Object.keys(o).length>0)return o;const n=s.context?.polyglot;if(n?.translations){const r=s.state?.root?.lang||n.defaultLang||"en",i=n.translations[r];if(i?.[t]!==void 0)return i[t];if(n.translations[t]!==void 0)return n.translations[t]}return{}}const As=new Set(["s","state","ctx","context"]);function xs(t){try{const o=(typeof Et.getFunctionSource=="function"?Et.getFunctionSource(t):Function.prototype.toString.call(t)).match(/^[^(]*\(([^)]*)\)/);return o?o[1].split(",").map(n=>n.trim().split("=")[0].trim()).filter(Boolean):[]}catch{return[]}}function ws(t){if(typeof t!="function"||t.length!==2)return!1;const s=xs(t);if(s.length<2)return!1;const o=s[1].replace(/[{}[\]]/g,"").trim();return o.length>0&&!As.has(o)}function Ss(t){const s=t.__ref,o=t.tag||"div",n=t.context?.designSystem,r=[],i=Object.keys(t);for(let a=0;a<i.length;a++){const f=i[a];if(typeof t[f]!="function"||U.REGISTRY.has(f))continue;const e=f.charCodeAt(0);e>=65&&e<=90||Z(f)||k.CSS_PROPS_REGISTRY[f]||k.DEFAULT_CSS_PROPERTIES_LIST&&k.DEFAULT_CSS_PROPERTIES_LIST.has(f)||(0,v.checkAttributeByTagName)(o,f)||((0,st.isLoudDevRuntime)()&&ws(t[f])&&console.warn(`[smbls] custom prop "${f}"${t.key?` on key "${t.key}"`:""} is a function \u2014 it will be auto-invoked on read and its RETURN VALUE stored, not preserved as a callable reference. If you meant to stash a callback, use el.call('${f}', \u2026) instead of reading el.${f}(\u2026) directly (see RULES.md Rule 8).`),r.push({prop:f,fn:t[f]}))}for(let a=0;a<r.length;a++){const{prop:f,fn:e}=r[a];s.__exec[f]=e,Object.defineProperty(t,f,{get(){n&&(0,E.pushConfig)(n);try{return e(t,t.state,t.context)}catch{return}finally{n&&(0,E.popConfig)()}},set(u){delete s.__exec[f],Object.defineProperty(t,f,{value:u,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function Cs(t,s){if(!(!Array.isArray(s)||s.length===0))for(let o=0;o<s.length;o++){const n=s[o];try{typeof n=="function"?n(t,t.state,t.context):typeof n=="string"&&t.state?.[n]}catch{}}}function R(t,s,o){return!Array.isArray(s)||s.length===0?o:function(...n){return Cs(t,s),o.apply(this,n)}}function gt(t,s){if(!(!t||Array.isArray(t)||typeof t!="object"))return t[s]}function T(t,s){return()=>t.path.join(".")+"::"+s}const go=new Set;function M(t,s,o){if(!(0,st.isLoudDevRuntime)())return;const n=T(t,s)();go.has(n)||(go.add(n),console.warn(`[smbls] "${s}" effect threw on ${t.path.join(".")} \u2014 keeping previous value:`,o?.message||o))}const bo=/(['"`])((?:\\.|(?!\1)[^\\])*)\1/g,ks=(t,s)=>{let o;try{o=String(t)}catch{return}if(!o.includes("{{"))return;bo.lastIndex=0;let n;for(;(n=bo.exec(o))!==null;)n[2].includes("{{")&&s.add(n[2])},vs=(t,s)=>!Z(t)&&!(0,J.isCssProp)(s,t),Ao=(t,s,o,n,r)=>{if(typeof s=="string"){!r&&s.includes("{{")&&o.add(s);return}typeof s=="function"&&vs(t,n)&&ks(s,o)},Yt=new WeakMap,bt=(t,s)=>Object.prototype.hasOwnProperty.call(t,s),At=t=>{if(typeof t=="string"||typeof t=="number")return{text:t};if(!t||typeof t!="object"||Array.isArray(t))return null;const s=t.props;return s&&typeof s=="object"&&!Array.isArray(s)?ot(t,s):t},xt=(t,s)=>t&&s?ot(t,s):t||s||null,xo=(t,s)=>{const o=t.__ref&&t.__ref.__runtimeSource;return!!o&&bt(o,s)},ft=(t,s)=>xo(t,s)?At(t.__ref.__runtimeSource[s]):null,wt=(t,s)=>(s&&t&&typeof t=="object"&&Yt.set(t,s),t),js=t=>{if(!t||typeof t!="object")return;const s=Yt.get(t);return s&&Yt.delete(t),s},qt=(t,s,o)=>{if(typeof t=="string"){t.includes("{{")&&s.add(t);return}if(!(!t||typeof t!="object"||o.has(t))){if(o.add(t),Array.isArray(t)){for(let n=0;n<t.length;n++)qt(t[n],s,o);return}if(!t.__ref)for(const n of Object.keys(t)){if(n==="state")continue;const r=Object.getOwnPropertyDescriptor(t,n);r&&"value"in r&&qt(r.value,s,o)}}},Es=(t,s)=>{let o=null;for(const n of Object.keys(t)){if(U.REGISTRY.has(n)||s&&bt(s,n))continue;const r=Object.getOwnPropertyDescriptor(t,n),i=r&&r.value;if(!Array.isArray(i))continue;const a=new Set;qt(i,a,new Set),a.size&&(o||(o=new Map),o.set(i,a))}return o},wo=(t,s)=>{if(Array.isArray(s))for(let o=t;o;o=o.parent){const n=o.__ref&&o.__ref.__declaredArrays,r=n&&n.get(s);if(!r)continue;const i=t.__ref;i.__authoredTemplates||(i.__authoredTemplates=new Set);for(const a of r)i.__authoredTemplates.add(a);return}},Ts=["attr","aria","data","metadata"],Ps=t=>{if(Ts.includes(t))return!0;const s=t.charCodeAt(0);return s===46||s===33||s===64},Os=(t,s)=>{const o=new Set,n=t.tag||"div";for(const r of Object.keys(t)){const i=Object.getOwnPropertyDescriptor(t,r),a=i&&i.value,f=!!s&&bt(s,r);if(a&&typeof a=="object"&&!Array.isArray(a)){if(!Ps(r))continue;const e=f?s[r]:null,u=e&&typeof e=="object"?e:null;for(const h in a){const p=f&&(!u||bt(u,h));Ao(h,a[h],o,n,p)}continue}Ao(r,a,o,n,f)}return o};function So(t,s){const o=t.__ref,n=!!(s&&s.skipIfEffect),r=Os(t,o.__runtimeSource);if(o.__authoredTemplates)for(const e of r)o.__authoredTemplates.add(e);else o.__authoredTemplates=r;if(Ss(t),typeof t.text=="function"){const e=t.text,u=R(t,t.textDeps,e),h=(0,j.createEffect)(()=>{if(!o.contentManaged)try{let p=u(t,t.state,t.context);t.node&&p!=null&&typeof p!="function"&&typeof p!="object"&&(typeof p=="string"&&p.includes("{{")&&(p=D.replaceLiteralsWithObjectFields.call(t,p,t.state)),Ct(t,p))}catch(p){M(o,"text",p)}},{depth:o.path.length,label:T(o,"text")});o.__effects.push(h),o.__exec.text=e}else if(typeof t.text=="string"&&t.text.includes("{{")){const e=t.text,u=(0,j.createEffect)(()=>{if(o.contentManaged)return;const h=D.replaceLiteralsWithObjectFields.call(t,e,t.state);h!=null&&(t.text=h),t.node&&Ct(t,h??"")},{depth:o.path.length,label:T(o,"text")});o.__effects.push(u),o.__exec.text=e}const i=t.tag||"div";for(const e of Object.keys(t))if(typeof t[e]=="function"&&!U.REGISTRY.has(e)&&!Z(e)&&!o.__exec[e]&&!(0,J.isAttributeFirst)(i,e)){if(k.CSS_PROPS_REGISTRY[e]){const u=t[e],h=R(t,t[e+"Deps"],u),p=e;let y,g=null,c=null,l;const d=(0,j.createEffect)(()=>{const A=t.context?.designSystem;A&&(0,E.pushConfig)(A);try{const x=h(t,t.state,t.context);(0,k.pushStaticCssPass)();let _;try{_=k.CSS_PROPS_REGISTRY[p](x,t,t.state,t.context)}finally{(0,k.popStaticCssPass)()}if(Array.isArray(_)){const w={};for(const S of _)if(S)for(const C in S)w[C]=S[C];_=w}const b=p==="show"||p==="hide";if(_&&t.node&&Ls(_)){const w=Ot(_);if(w===null||w!==l){l=w;const S=(0,X.css)(_,null,t.context?.cssPrefix),C=S?S.split(" ").filter(Boolean):null;if(t.node.classList){if(c)for(const P of c)t.node.classList.remove(P);if(C&&C.length)for(const P of C)t.node.classList.add(P);c=C}}y=void 0,g=null}else if(_&&t.node){if(c){for(const S of c)t.node.classList.remove(S);c=null,l=void 0}const w=Ot(_);if(w===null||w!==y||!Rt(t.node,g)){y=w;const S=To(t,_);g=Lt(t.node,S)}}else t.node&&b&&(y=void 0,g=null,t.node.style.display="")}finally{A&&(0,E.popConfig)()}},{depth:o.path.length,label:T(o,p)});o.__effects.push(d),o.__exec[e]=u}else if(k.DEFAULT_CSS_PROPERTIES_LIST&&k.DEFAULT_CSS_PROPERTIES_LIST.has(e)){const u=t[e],h=R(t,t[e+"Deps"],u),p=e;let y,g=null;const c=(0,j.createEffect)(()=>{const l=t.context?.designSystem;l&&(0,E.pushConfig)(l);try{const d=h(t,t.state,t.context);if(t.node)if(d!=null){const A=p+":"+String(d);if(A!==y||!Rt(t.node,g)){y=A;const x={[p]:d},_=To(t,x);g=Lt(t.node,_)}}else y=void 0,g=null,t.node.style[p]=""}finally{l&&(0,E.popConfig)()}},{depth:o.path.length,label:T(o,p)});o.__effects.push(c),o.__exec[e]=u}}if(typeof t.html=="function"){const e=t.html,u=R(t,t.htmlDeps,e),h=(0,j.createEffect)(()=>{const p=t.context?.designSystem;p&&(0,E.pushConfig)(p);try{const y=u(t,t.state,t.context);t.node&&y!=null&&typeof y!="function"&&(t.node.innerHTML=y)}finally{p&&(0,E.popConfig)()}},{depth:o.path.length,label:T(o,"html")});o.__effects.push(h),o.__exec.html=e}if(typeof t.value=="function"){const e=t.value,u=R(t,t.valueDeps,e),h=(0,j.createEffect)(()=>{try{let p=u(t,t.state,t.context);typeof p=="string"&&p.includes("{{")&&(p=D.replaceLiteralsWithObjectFields.call(t,p,t.state)),vo(t,p)}catch(p){M(o,"value",p)}},{depth:o.path.length,label:T(o,"value")});o.__effects.push(h),o.__exec.value=e}else if(typeof t.value=="string"&&t.value.includes("{{")){const e=t.value,u=(0,j.createEffect)(()=>{try{vo(t,D.replaceLiteralsWithObjectFields.call(t,e,t.state))}catch(h){M(o,"value",h)}},{depth:o.path.length,label:T(o,"value")});o.__effects.push(u),o.__exec.value=e}if(typeof t.style=="function"){const e=t.style,u=R(t,t.styleDeps,e);let h,p=null;const y=(0,j.createEffect)(()=>{const g=u(t,t.state,t.context),c=Ot(g);(c===null||c!==h||!Rt(t.node,p))&&(h=c,Ds(t.node,p,g),tt(t.node,g),p=Lt(t.node,g))},{depth:o.path.length,label:T(o,"style")});o.__effects.push(y),o.__exec.style=e}else if(t.style&&typeof t.style=="object")for(const e in t.style){const u=t.style[e];if(typeof u!="function")continue;const h=R(t,gt(t.styleDeps,e),u);let p,y=null;const g=(0,j.createEffect)(()=>{try{const c=h(t,t.state,t.context);if(t.node){const l=e+":"+String(c);if(l!==p||!Rt(t.node,y)){p=l;const d={[e]:c};tt(t.node,d),y=Lt(t.node,d)}}}catch(c){M(o,"style."+e,c)}},{depth:o.path.length,label:T(o,"style."+e)});o.__effects.push(g)}if(t.attr&&typeof t.attr=="object"){for(const e in t.attr)if(typeof t.attr[e]=="function"){const u=R(t,gt(t.attrDeps,e),t.attr[e]),h=e,p=(0,j.createEffect)(()=>{try{let y=u(t,t.state,t.context);typeof y=="string"&&y.includes("{{")&&(y=D.replaceLiteralsWithObjectFields.call(t,y,t.state)),t.node?.setAttribute&&(y==null||y===!1&&!(0,v.isEnumeratedTrueFalseAttr)(h)?t.node.removeAttribute(h):typeof y!="function"&&typeof y!="object"&&t.node.setAttribute(h,(0,v.serializeAttrValue)(h,y)))}catch(y){M(o,"attr."+h,y)}},{depth:o.path.length,label:T(o,"attr."+h)});p._attrName=h.toLowerCase(),o.__effects.push(p)}else if(typeof t.attr[e]=="string"&&t.attr[e].includes("{{")){const u=t.attr[e],h=e,p=(0,j.createEffect)(()=>{try{const y=D.replaceLiteralsWithObjectFields.call(t,u,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(h,(0,v.serializeAttrValue)(h,y??""))}catch(y){M(o,"attr."+h,y)}},{depth:o.path.length,label:T(o,"attr."+h)});p._attrName=h.toLowerCase(),o.__effects.push(p)}}if(t.aria&&typeof t.aria=="object")for(const e in t.aria){const u=t.aria[e];if(typeof u=="string"&&u.includes("{{")){const g=u,c="aria-"+e.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),l=(0,j.createEffect)(()=>{try{const d=D.replaceLiteralsWithObjectFields.call(t,g,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(c,(0,v.serializeAttrValue)(c,d??""))}catch(d){M(o,"aria."+e,d)}},{depth:o.path.length,label:T(o,"aria."+e)});l._attrName=c,o.__effects.push(l);continue}if(typeof u!="function")continue;const h=R(t,gt(t.ariaDeps,e),t.aria[e]),p="aria-"+e.replace(/[A-Z]/g,g=>"-"+g.toLowerCase()),y=(0,j.createEffect)(()=>{try{const g=h(t,t.state,t.context);if(!t.node?.setAttribute)return;g==null?t.node.removeAttribute(p):typeof g!="function"&&typeof g!="object"&&t.node.setAttribute(p,(0,v.serializeAttrValue)(p,g))}catch(g){M(o,"aria."+e,g)}},{depth:o.path.length,label:T(o,"aria."+e)});y._attrName=p,o.__effects.push(y)}if(t.data&&typeof t.data=="object")for(const e in t.data){const u=t.data[e];if(typeof u=="string"&&u.includes("{{")){const c=u,l="data-"+e.replace(/[A-Z]/g,A=>"-"+A.toLowerCase()),d=(0,j.createEffect)(()=>{try{const A=D.replaceLiteralsWithObjectFields.call(t,c,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(l,A??"")}catch(A){M(o,"data."+e,A)}},{depth:o.path.length,label:T(o,"data."+e)});d._attrName=l,o.__effects.push(d);continue}if(typeof u!="function")continue;const h=R(t,gt(t.dataDeps,e),t.data[e]),y="data-"+e.replace(/[A-Z]/g,c=>"-"+c.toLowerCase()),g=(0,j.createEffect)(()=>{try{const c=h(t,t.state,t.context);if(!t.node?.setAttribute)return;c==null||c===!1?t.node.removeAttribute(y):typeof c!="function"&&typeof c!="object"&&t.node.setAttribute(y,c===!0?"":c)}catch(c){M(o,"data."+e,c)}},{depth:o.path.length,label:T(o,"data."+e)});g._attrName=y,o.__effects.push(g)}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 e in a){if(typeof a[e]!="function")continue;const u=R(t,gt(t.classDeps,e),a[e]),h=(0,j.createEffect)(()=>{try{const p=u(t,t.state,t.context);if(!t.node?.classList)return;typeof p=="string"?t.node.classList.add(p):p?t.node.classList.add(e):t.node.classList.remove(e)}catch(p){M(o,"class."+e,p)}},{depth:o.path.length,label:T(o,"class."+e)});o.__effects.push(h)}!n&&typeof t.if=="function"&&ko(t,o,t.if);for(const e of Object.keys(t)){if(U.REGISTRY.has(e)||typeof t[e]!="function")continue;const u=e.charCodeAt(0);if(u>=65&&u<=90||Z(e))continue;const h=t[e];o.__exec[e]=h;const p=t.tag||"div";if((0,v.checkAttributeByTagName)(p,e)&&!(0,J.isCssProp)(p,e)){const y=(0,v.camelToAttr)(e)||e,g=R(t,t[e+"Deps"],h),c=(0,j.createEffect)(()=>{try{let l=g(t,t.state,t.context);typeof l=="string"&&l.includes("{{")&&(l=D.replaceLiteralsWithObjectFields.call(t,l,t.state)),t.node?.setAttribute&&(l==null||l===!1&&!(0,v.isEnumeratedTrueFalseAttr)(y)?t.node.removeAttribute(y):typeof l!="function"&&typeof l!="object"&&(y==="src"&&"src"in t.node?t.node.src=l:t.node.setAttribute(y,(0,v.serializeAttrValue)(y,l))))}catch(l){M(o,e,l)}},{depth:o.path.length,label:T(o,e)});c._attrName=y.toLowerCase(),o.__effects.push(c)}}const f=t.tag||"div";for(const e of Object.keys(t)){if(U.REGISTRY.has(e))continue;const u=t[e];if(typeof u!="string"||!u.includes("{{"))continue;const h=e.charCodeAt(0);if(h>=65&&h<=90||Z(e)||(0,J.isCssProp)(f,e)||v.ATTR_TRANSFORMS[e]||!(0,v.checkAttributeByTagName)(f,e))continue;const p=(0,v.camelToAttr)(e)||e,y=(0,j.createEffect)(()=>{try{const g=D.replaceLiteralsWithObjectFields.call(t,u,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(p,(0,v.serializeAttrValue)(p,g??""))}catch(g){M(o,e,g)}},{depth:o.path.length,label:T(o,e)});y._attrName=p.toLowerCase(),o.__effects.push(y)}if(Is(t),Gs(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const e=t.onStateUpdate,u=t.stateDeps;let h=!1,p=[];const y=(0,j.createEffect)(()=>{const g=[];for(let A=0;A<u.length;A++){const x=u[A];try{g[A]=typeof x=="function"?x(t,t.state,t.context):t.state?.[x]}catch{g[A]=void 0}}if(!h){h=!0,p=g;return}let c=g.length!==p.length;for(let A=0;!c&&A<g.length;A++)g[A]!==p[A]&&(c=!0);const l=p;if(p=g,!c)return;const d=t.context?.designSystem;d&&(0,E.pushConfig)(d);try{e(t,t.state,t.context,{prev:l,next:g})}catch(A){if(t.context?.plugins?.length&&(0,z.runPluginHook)("error",t,{hook:"onStateUpdate",error:A})||console.error('[DOMQL] Lifecycle "onStateUpdate" error:',A),t.context?.strictMode)throw A}finally{d&&(0,E.popConfig)()}},{depth:o.path.length,label:T(o,"onStateUpdate")});o.__effects.push(y)}Bs(t)}function Co(t){const s=t.parent,o=s?.node;if(!o||!t.node){Yo(t,t.parent);return}let n=null;const r=Object.keys(s),i=r.indexOf(t.key);for(let a=i+1;a<r.length;a++){const f=s[r[a]];if(f?.node?.parentNode===o){n=f.node;break}}n?o.insertBefore(t.node,n):o.appendChild(t.node)}function ko(t,s,o){const n=R(t,t.ifDeps,o),r=(0,j.createEffect)(()=>{let i;try{i=n(t,t.state,t.context)}catch(f){if(i=!1,s.__ifError=f,typeof console<"u"&&console.warn){const e=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${e} \u2014 treating as false:`,f?.message||f)}return}const a=s.__if;if(s.__if=!!i,a&&!s.__if&&t.node){t.node.remove();try{typeof t.onRemove=="function"&&t.onRemove(t)}catch(f){console.error("[smbls] onRemove error:",f)}}else if(!a&&s.__if)if(s.__ifInitialized)t.node||(t.node=(0,et.cacheNode)(t)),t.node&&(t.node.ref=t),Co(t),Zt(t),$("Render",t,{}),Kt(t,{});else{if(s.__ifInitialized=!0,t.tag||(t.tag=(0,et.detectTag)(t)),$("Init",t,{}),t.node||(t.node=(0,et.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}$("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),Wo(t,{}),So(t,{skipIfEffect:!0}),Zt(t),Io(t),Ho(t),zo(t,{}),Co(t),$("Create",t,{}),$("Complete",t,{}),$("Render",t,{}),$("RenderRouter",t,{}),Kt(t,{})}},{depth:s.path.length,label:T(s,"if")});s.__effects.push(r)}function Ct(t,s){const o=t.node;if(!o)return;const n=s==null||typeof s=="object"?"":String(s);if(t.tag==="string"){o.nodeValue!==n&&(o.nodeValue=n);return}const r=t.__ref;let i=r?r.__textNode:null;if(i&&i.parentNode!==o&&(i=null),!i){const a=o.firstChild;a&&a.nodeType===3&&(i=a)}i?i.nodeValue!==n&&(i.nodeValue=n):o.firstChild?(i=(o.ownerDocument||t.context?.document||globalThis.document).createTextNode(n),o.insertBefore(i,o.firstChild)):(o.textContent=n,i=o.firstChild&&o.firstChild.nodeType===3?o.firstChild:null),r&&(r.__textNode=i||null)}function vo(t,s){const o=t.node;if(!o||!("value"in o))return;const n=s==null?"":String(s);if(o.value===n)return;const r=typeof document<"u"&&document.activeElement===o,i=r&&typeof o.selectionStart=="number"?o.selectionStart:null,a=r&&typeof o.selectionEnd=="number"?o.selectionEnd:null;if(o.value=n,r&&i!=null&&a!=null)try{o.setSelectionRange(i,a)}catch{}const f=t.__ref&&t.__ref.__autoGrow;f&&f.active&&f.resize()}function Zt(t){const{node:s}=t;if(s){if((typeof t.text=="string"&&!t.text.includes("{{")||typeof t.text=="number")&&Ct(t,t.text),$o(t),typeof t.html=="string"&&(s.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&!(typeof t.value=="string"&&t.value.includes("{{"))&&"value"in s){const o=String(t.value);s.value!==o&&(s.value=o)}if(t.style&&typeof t.style=="object"){let o=t.style;for(const n in t.style)if(typeof t.style[n]=="function"){o={};for(const r in t.style)typeof t.style[r]!="function"&&(o[r]=t.style[r]);break}tt(s,o)}if(t.attr&&typeof t.attr=="object")for(const o in t.attr){const n=t.attr[o];typeof n=="function"||typeof n=="object"||n!=null&&(typeof n=="string"&&n.includes("{{")||n===!1&&!(0,v.isEnumeratedTrueFalseAttr)(o)||s.setAttribute&&s.setAttribute(o,(0,v.serializeAttrValue)(o,n)))}if(typeof t.themeModifier=="string"&&t.themeModifier&&s.setAttribute&&s.setAttribute("data-theme",t.themeModifier),t.data&&typeof t.data=="object")for(const o in t.data){const n=t.data[o];typeof n=="function"||typeof n=="object"||n==null||n===!1||typeof n=="string"&&n.includes("{{")||s.dataset&&(s.dataset[o]=n===!0?"":n)}if(t.classlist||t.class){const o=t.classlist||t.class;if(typeof o=="string")o.split(" ").forEach(n=>n&&s.classList.add(n));else if(typeof o=="object")for(const n in o){const r=typeof o[n]=="function"?o[n](t,t.state,t.context):o[n];r&&s.classList.add(typeof r=="string"?r:n)}}}}function Ot(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function Ls(t){if(!t||typeof t!="object")return!1;for(const s in t){const o=t[s];if(o&&typeof o=="object"&&!Array.isArray(o))return!0}return!1}function Lt(t,s){if(!t||!t.style||!s)return null;const o=t.style,n=[];for(const r in s){if(s[r]==null||r.charAt(0)==="&")continue;const a=Dt(r);n.push(a,Qt(o,a),jo(o,a))}return n}function Qt(t,s){return typeof t.getPropertyValue=="function"?t.getPropertyValue(s):""}function jo(t,s){return typeof t.getPropertyPriority=="function"?t.getPropertyPriority(s):""}function Dt(t){return Mt(t)?t:t.replace(/[A-Z]/g,s=>"-"+s.toLowerCase())}function Ds(t,s,o){if(!t||!t.style||!s||!s.length)return;const n=t.style,r=new Set;if(o&&typeof o=="object")for(const i in o)o[i]==null||i.charAt(0)==="&"||r.add(Dt(i));for(let i=0;i<s.length;i+=3){const a=s[i];r.has(a)||Qt(n,a)===s[i+1]&&typeof n.removeProperty=="function"&&n.removeProperty(a)}}function Rt(t,s){if(!s||!t||!t.style)return!1;const o=t.style;for(let n=0;n<s.length;n+=3)if(Qt(o,s[n])!==s[n+1]||jo(o,s[n])!==s[n+2])return!1;return!0}const Mt=t=>t.charCodeAt(0)===45&&t.charCodeAt(1)===45;function Rs(t){let s=null;for(const o in t)t[o]!=null&&o.charAt(0)!=="&"&&(s||(s=new Set),s.add(Dt(o)));return s}function Ms(t,s,o,n){const r=t.__ref;if(!r)return;let i=null;if(o)for(const a of o){if(n&&n.has(a))continue;const f=s[a];if(f==null||typeof f=="object")continue;const e=Dt(a);no.CSS_LONGHAND_SHORTHANDS[e]&&(i||(i={}),i[e]=f)}r.__declaredLonghands=i}function Eo(t,s){const o=t.__ref,n=o&&o.__declaredLonghands;if(!n||!s)return null;let r=null;for(const i in n){if(s.has(i))continue;const a=no.CSS_LONGHAND_SHORTHANDS[i];let f=!1;for(let e=0;e<a.length;e++)if(s.has(a[e])){f=!0;break}f&&(r||(r={}),r[i]=n[i])}return r}function To(t,s){const o=t.node;tt(o,s);const n=Rs(s);if(!n)return s;const r=t.__ref;if(r)if(r.__inlineCssKeys)for(const a of n)r.__inlineCssKeys.add(a);else r.__inlineCssKeys=new Set(n);const i=Eo(t,n);return i?(tt(o,i),Object.assign({},s,i)):s}function Ns(t){const s=t.__ref;if(!s||!s.__inlineCssKeys||!s.__declaredLonghands)return;const o=Eo(t,s.__inlineCssKeys);o&&tt(t.node,o)}function tt(t,s){if(!t||!s||!t.style)return;let o=null;for(const n in s){const r=s[n];if(r!=null){if(n.charAt(0)==="&"&&typeof r=="object"){o||(o={}),o[n]=r;continue}try{const i=String(r),a=Mt(n)?n:n.replace(/[A-Z]/g,h=>"-"+h.toLowerCase()),f=i.trim(),e=/\s*!important\s*$/.test(f),u=f.replace(/\s*!important\s*$/,"");t.style.setProperty(a,u,e?"important":"")}catch{}}}o&&Fs(t,o)}function Fs(t,s){const o=`_ds${fo.scopedStyleId++}`;t.classList.add(o);const n=t.ownerDocument;let r=n.querySelector("style[data-smbls-scoped]");r||(r=n.createElement("style"),r.setAttribute("data-smbls-scoped",""),n.head.appendChild(r));let i="";for(const a in s){const f="."+o,e=a.replace(/&/g,f).split(",").map(h=>{const p=h.trim();return p.includes(f)?p:f+p}).join(", "),u=s[a];if(typeof u=="object"){let h="",p="";for(const y in u){const g=u[y];if(typeof g=="object"){const c=y.includes("&")?e.split(", ").map(d=>y.replace(/&/g,d)).join(", "):e.split(", ").map(d=>`${d} ${y}`).join(", ");let l="";for(const d in g)l+=`${d.replace(/[A-Z]/g,A=>"-"+A.toLowerCase())}: ${g[d]};`;p+=(0,X.wrapHoverRule)(`${c} { ${l} }`,c)+`
|
|
5
|
-
`}else
|
|
6
|
-
`),p&&(i+=p)}}i&&(r.textContent+=i)}const Po=new Set;function Oo(t){if(!Array.isArray(t))return"";const s=[];for(let o=0;o<t.length;o++)typeof t[o]=="string"&&t[o].length&&s.push(t[o]);return s.sort(),s.join("|")}function $s(t,s,o){const n=Oo(o);queueMicrotask(()=>{if(!t.__ref)return;let r;try{r=s(t,t.state,t.context)}catch{return}if(Oo(r)===n)return;const i=t.__ref.path?t.__ref.path.join("."):t.key||"?";Po.has(i)||(Po.add(i),console.warn(`[smbls] subscribeTo function at "${i}" resolved to a DIFFERENT key list one microtask after create \u2014 wired [${o.join(", ")||"(none)"}], probed [${Array.isArray(r)?r.join(", "):String(r)}]. subscribeTo's function form is resolved ONCE at element-create time (registerSubscribeToEffects, @symbo.ls/element create.js) \u2014 this element stays wired to the ORIGINAL list for its whole lifetime, so this drift is invisible to the reactive effect and any key only present in the new list will never trigger onUpdate. If the watched key genuinely is not known until later (e.g. a module config that loads after shell boot), route the write through an imperative call instead of subscribeTo \u2014 see functions/moduleOpenBridge.js's moduleOpenPage (workspace repo) for the house pattern.`))})}function Is(t){const s=t.subscribeTo,o=typeof s=="function";let n=s;if(o)try{n=s(t,t.state,t.context)}catch{n=null}if(o&&(0,st.isLoudDevRuntime)()&&$s(t,s,Array.isArray(n)?n:[]),!Array.isArray(n)||n.length===0)return;const r=t.__ref;for(let i=0;i<n.length;i++){const a=n[i];if(typeof a!="string"||a.length===0)continue;const f=a.split("."),e=f[0],u=f.slice(1),h={value:!1},p=(0,j.createEffect)(()=>{const y=t.state&&((0,N.isStore)(t.state)?t.state.root:null);if(!y||!(0,N.isStore)(y))return;let g=y;g=g[e];for(let l=0;l<u.length&&!(g==null||typeof g!="object");l++)if((0,N.isStore)(g))g=g[u[l]];else break;if(!h.value)return;let c=!1;if(typeof t.onBeforeUpdate=="function"){const l=t.context?.designSystem;l&&(0,E.pushConfig)(l);try{if(Jo(r)){const d=t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0});d&&typeof d.then=="function"?d.then(()=>kt(r,!1),A=>{kt(r,!0),t.context?.plugins?.length&&(0,z.runPluginHook)("error",t,{hook:"onBeforeUpdate",error:A})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",A)}):(kt(r,!1),d===!1&&(c=!0))}}catch(d){kt(r,!0),t.context?.plugins?.length&&(0,z.runPluginHook)("error",t,{hook:"onBeforeUpdate",error:d})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",d)}finally{l&&(0,E.popConfig)()}}if(!c&&t.node&&r.__effects)for(let l=0;l<r.__effects.length;l++){const d=r.__effects[l];d&&d!==p&&!d._disposed&&!d._isSubscribeToEffect&&typeof d._execute=="function"&&d._execute()}if(!c&&typeof t.onUpdate=="function"){const l=t.context?.designSystem;l&&(0,E.pushConfig)(l);try{t.onUpdate(t,t.state,t.context)}catch(d){t.context?.plugins?.length&&(0,z.runPluginHook)("error",t,{hook:"onUpdate",error:d})||console.error("[DOMQL] subscribeTo onUpdate error:",d)}finally{l&&(0,E.popConfig)()}}},{depth:r.path.length,label:T(r,"subscribeTo("+a+")")});h.value=!0,p._isSubscribeToEffect=!0,r.__effects.push(p)}}function Xt(t,s){return t.charCodeAt(0)===64&&t.length>1&&!t.startsWith("@media")&&!t.startsWith("@keyframes")&&!t.startsWith("@supports")&&!t.startsWith("@container")&&(t==="@dark"||t==="@light"||!s.context?.designSystem?.media?.[t.slice(1)])}function Jt(t,s){if(t.charCodeAt(0)!==64||/^@(media|supports|container|keyframes)\b/.test(t))return t;const o=s.context?.designSystem?.media?.[t.slice(1)];return o?/^@(media|supports|container)\b/.test(o)?o:`@media ${o}`:t}const Lo=new Set;function Us(t,s){const o=s?.__ref?.path?s.__ref.path.join("."):s?.key||"?",n=o+"::"+t;Lo.has(n)||(Lo.add(n),console.warn(`[smbls/css] "${t}" at ${o} 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 at(t,s,o,n){const r={},i=new Set,a=(f,e,u)=>{const h=u?new Set(Object.keys(r)):null;if(k.CSS_PROPS_REGISTRY[f]){const p=k.CSS_PROPS_REGISTRY[f](e,s,s.state,s.context);if(p){const y=Array.isArray(p)?p:[p];for(const g of y)g&&Object.assign(r,g)}}else r[f]=e;if(u)for(const p in r)h.has(p)||i.add(p)};for(const f in t){if(!Object.prototype.hasOwnProperty.call(t,f))continue;let e=t[f];if(typeof e=="function"&&(e=e(s,s.state,s.context)),e==null||typeof e=="function")continue;if(typeof e=="object"&&!Array.isArray(e)){if(f==="style"){for(const g in e){let c=e[g];if(typeof c=="function"&&(c=c(s,s.state,s.context)),c==null||typeof c=="function")continue;const l=typeof s[g]=="function"&&(k.CSS_PROPS_REGISTRY[g]||k.DEFAULT_CSS_PROPERTIES_LIST&&k.DEFAULT_CSS_PROPERTIES_LIST.has(g))||!!(n&&n.has(g));a(g,c,l)}continue}if(Xt(f,s)){const g=at(e,s,!1,n);Object.keys(g).length&&(r[`[data-theme="${f.slice(1)}"] &`]=g);continue}if(/^[A-Z][A-Za-z0-9]*$/.test(f)){(0,st.isLoudDevRuntime)()&&Us(f,s);continue}const p=Jt(f,s),y=at(e,s,!1,n);Object.keys(y).length&&(r[p]=y);continue}const u=typeof s[f]=="function"&&(k.CSS_PROPS_REGISTRY[f]||k.DEFAULT_CSS_PROPERTIES_LIST&&k.DEFAULT_CSS_PROPERTIES_LIST.has(f)),h=!!(n&&n.has(f));a(f,e,u||h)}if(o)for(const f in r)i.add(f);for(const f of i){const e=r[f];typeof e=="string"&&!e.includes("!important")&&(r[f]=e+" !important")}return r}const Nt=t=>!!t&&typeof t=="object"&&!Array.isArray(t);function Do(t,s){for(const o in s){const n=s[o];t[o]=Nt(n)?Do(Nt(t[o])?t[o]:{},n):n}return t}function Vs(t,s){if(!Nt(s))return;let o;for(const n of t.split(" ")){const r=n?s[n]:null;Nt(r)&&(o=Do(o||{},r))}return o}function mt(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 o in t)if(Object.prototype.hasOwnProperty.call(t,o)&&mt(t[o],s+1))return!0}return!1}function Ro(t,s,o){if(!s||typeof s!="object"||Array.isArray(s))return null;if(Xt(t,o)){const i=at(s,o,!1);return Object.keys(i).length?{cssProp:`[data-theme="${t.slice(1)}"] &`,block:i}:null}const n=Jt(t,o),r=at(s,o,!1);return Object.keys(r).length?{cssProp:n,block:r}:null}function Bs(t){const s=t.__ref;for(const o of Object.keys(t)){if(!Wt(o))continue;const n=t[o];if(!n||typeof n!="object"||Array.isArray(n)||!mt(n))continue;let r=null,i;const a=(0,j.createEffect)(()=>{if(!t.node)return;const f=t.context?.designSystem;f&&(0,E.pushConfig)(f);let e,u=!1;try{const h=Ro(o,n,t),p=h?Ot(h.block)+"::"+h.cssProp:null;if(p!==null&&p===i)u=!0;else if(i=p,h){const y=(0,X.css)({[h.cssProp]:h.block},null,t.context?.cssPrefix);e=y?y.split(" ").filter(Boolean):null}else e=null}finally{f&&(0,E.popConfig)()}if(!(u||!t.node.classList)){if(r)for(const h of r)t.node.classList.remove(h);if(e&&e.length)for(const h of e)t.node.classList.add(h);r=e}},{depth:s.path.length,label:T(s,"cssBlock("+o+")")});s.__effects.push(a)}}function Gs(t){const s=t.__ref;s.__conditionalRunners=[];const o=new Map;for(const n of Object.keys(t)){const r=n.charAt(0);if(r!=="."&&r!=="!")continue;const i=n.slice(1);if(!i)continue;if(/[:@\s>~+[\]]/.test(i)){if(typeof console<"u"&&console.warn){const c=i.split(/[:@\s>~+[\]]/)[0];console.warn(`[smbls] conditional \`${n}\` on ${t.key||"?"} will never match \u2014 the whole string after \`${r}\` is read as one prop name. Nest the selector inside instead: \`${r}${c}: { '${i.slice(c.length)}': {...} }\`.`)}continue}const a=t[n];if(!a||typeof a!="object")continue;const f=r==="!",e={lastMatch:!1,appliedKeys:null,appliedClasses:null},u=new Set;for(const c in a){if(!Object.prototype.hasOwnProperty.call(a,c))continue;const l=c.charAt(0),d=a[c];(l===":"||l==="@"||l==="&"||l==="[")&&d&&typeof d=="object"&&!Array.isArray(d)||u.add(c)}const h=()=>{let c;const l=t[i];if(l===void 0){const x=!!t.state&&i in t.state,_=t.state?t.state[i]:void 0;if(x||_!==void 0)c=_;else{const b=t.context?.cases?.[i];if(b===void 0)return;try{c=typeof b=="function"?b.call(t,t):b}catch(w){c=!1,s.__conditionalError=w,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${n}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,w?.message||w)}}}else if(typeof l=="function")try{c=l(t,t.state,t.context)}catch(x){c=!1,s.__conditionalError=x,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${n}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,x?.message||x)}else c=l;const d=f?!c:!!c;if(!t.node||d===e.lastMatch)return;e.lastMatch=d;const A=t.context?.designSystem;A&&(0,E.pushConfig)(A);try{if(d){const x={},_={};let b=!1;for(const S in a){if(!Object.prototype.hasOwnProperty.call(a,S))continue;const C=a[S],P=S.charAt(0);if((P===":"||P==="@"||P==="&"||P==="[")&&C&&typeof C=="object"&&!Array.isArray(C)){if(Xt(S,t)){const K=at(C,t,!1,u);Object.keys(K).length&&(_[`[data-theme="${S.slice(1)}"] &`]=K,b=!0)}else{const K=Jt(S,t),nt=at(C,t,!1,u);Object.keys(nt).length&&(_[K]=nt,b=!0)}continue}const Y=typeof C=="function"?C(t,t.state,t.context):C;if(Y!=null)if(k.CSS_PROPS_REGISTRY[S]){const K=k.CSS_PROPS_REGISTRY[S](Y,t,t.state,t.context);if(K){const nt=Array.isArray(K)?K:[K];for(const I of nt)I&&Object.assign(x,I)}}else(k.DEFAULT_CSS_PROPERTIES_LIST&&k.DEFAULT_CSS_PROPERTIES_LIST.has(S)||Mt(S))&&(x[S]=Y)}const w=Object.keys(x);if(w.length){tt(t.node,x);for(const S of w)o.set(S,n);e.appliedKeys=w}else e.appliedKeys=null;if(b){const S=(0,X.css)(_,null,t.context?.cssPrefix,{state:!0}),C=S?S.split(" ").filter(Boolean):[];if(C.length&&t.node.classList){for(const P of C)t.node.classList.add(P);e.appliedClasses=C}else e.appliedClasses=null}else if(e.appliedClasses){for(const S of e.appliedClasses)t.node.classList.remove(S);e.appliedClasses=null}}else{if(e.appliedKeys){for(const x of e.appliedKeys)o.get(x)===n&&(Mt(x)?t.node.style.removeProperty(x):t.node.style[x]="",o.delete(x));e.appliedKeys=null}if(e.appliedClasses){for(const x of e.appliedClasses)t.node.classList.remove(x);e.appliedClasses=null}}}finally{A&&(0,E.popConfig)()}};s.__conditionalRunners.push(h);const p=R(t,t[i+"Deps"],h),y=(0,j.createEffect)(p,{depth:s.path.length,label:T(s,"conditional("+n+")")}),g=s.__exec&&s.__exec[i]||t[i];y._sources.size===0&&typeof g=="function"&&(0,st.isLoudDevRuntime)()&&console.warn(`[smbls] conditional \`${n}\` on ${t.key||"?"} subscribed to nothing \u2014 its predicate tracked no reactive read on its first run, so no state write will ever re-evaluate it (only a direct element.update() on this element re-runs it). If the predicate guards its state reads (\`in\`, short-circuits, \`?.\`), declare \`${i}Deps: [...]\` (state-key strings or \`(el, s) => \u2026\` selectors) so the subscription is armed unconditionally.`),s.__effects.push(y)}}const to=new WeakSet;function Hs(t){const s=t.ownerDocument;!s||to.has(s)||(to.add(s),queueMicrotask(()=>{to.delete(s);const o=s.body||s.documentElement;o&&o.offsetWidth}))}const oo=new WeakSet;let Mo=!1;function No(t){return t.startsWith("[data-theme=")||t.startsWith("@media")&&t.includes("prefers-color-scheme")}function so(t,s){const o={...t};for(const n in s){const r=s[n],i=o[n];o[n]=r&&typeof r=="object"&&i&&typeof i=="object"?so(i,r):r}return o}function Fo(t,s){const o={};for(const n in t){const r=t[n];if(r&&typeof r=="object"){const i=Fo(r,s);Object.keys(i).length&&(o[n]=i)}else s.has(n)||(o[n]=r)}return o}function $o(t){const{node:s}=t;if(!s)return;if(Mo||(Mo=!0,(0,X.css)({display:"none"})),oo.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}oo.add(t);const o=t.context?.designSystem;o&&(0,E.pushConfig)(o),(0,k.pushStaticCssPass)();try{const n={};let r=!1,i=[],a=null,f=null,e=null;const u=(c,l)=>{if(l&&typeof l=="object"&&No(c)){f||(f={});const d=f[c];d&&(l=so(d,l)),f[c]=l}else(l===null||typeof l!="object")&&(e||(e=new Set),e.add(c));n[c]=l};if(Object.prototype.hasOwnProperty.call(t,"theme")&&typeof t.theme!="function"&&k.CSS_PROPS_REGISTRY.theme){const c=k.CSS_PROPS_REGISTRY.theme(t.theme,t,t.state,t.context);if(c){const l=d=>{for(const A in d){const x=d[A];x&&typeof x=="object"&&No(A)&&(a||(a={}),a[A]=x),n[A]=x}};if(Array.isArray(c))for(const d of c)d&&l(d);else l(c);r=!0}}const h=(c,l)=>{if(k.CSS_PROPS_REGISTRY[c]){const d=k.CSS_PROPS_REGISTRY[c](l,t,t.state,t.context);if(d){if(Array.isArray(d)){for(const A of d)if(A)for(const x in A)u(x,A[x])}else for(const A in d)u(A,d[A]);r=!0}}else if(k.DEFAULT_CSS_PROPERTIES_LIST&&k.DEFAULT_CSS_PROPERTIES_LIST.has(c))l!=null&&typeof l!="object"&&(u(c,l),r=!0);else if(c.charCodeAt(0)===45)l!=null&&typeof l!="object"&&(u(c,l),r=!0);else if((c.charAt(0)==="&"||c.charAt(0)==="@"||c.charAt(0)===":"||c.charAt(0)==="[")&&l&&typeof l=="object"&&!Array.isArray(l)){if(mt(l))return;const d=Ro(c,l,t);d&&(u(d.cssProp,d.block),r=!0)}};if(typeof t.class=="string"){const c=Vs(t.class,t.context?.designSystem?.class);if(c)for(const l in c)h(l,c[l])}const p=e?new Set(e):null,y=t.tag||"div";for(const c of Object.keys(t)){if(typeof t[c]=="function"||U.REGISTRY.has(c)||c==="theme")continue;const l=c.charCodeAt(0);l>=65&&l<=90||Z(c)||(0,J.isAttributeFirst)(y,c)||h(c,t[c])}if(a)for(const c in a){let l=e?Fo(a[c],e):a[c];f&&f[c]&&(l=so(l,f[c])),Object.keys(l).length?n[c]=l:delete n[c]}if(Ms(t,n,e,p),r){n.display&&String(n.display).includes("!important")&&(s.style.setProperty("display",String(n.display).replace(/\s*!important\s*$/,""),"important"),delete n.display);const c=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;typeof c=="string"&&c!==""&&n.display&&n.display!==c&&(n.display=c);const l=(0,X.css)(n,null,t.context?.cssPrefix);if(i=l?l.split(" ").filter(Boolean):[],l&&s.classList){const d=i;let A=!1;for(const x of d)s.classList.add(x),A||(x.charCodeAt(0)===95&&x.charCodeAt(1)===99||x.charCodeAt(0)===95&&x.indexOf("_c",1)!==-1)&&(A=!0);A&&Hs(s)}}const g=t.__ref;if(g){const c=g.__staticCssClasses;if(c&&s.classList){const l=new Set(i);for(const d of c)l.has(d)||s.classList.remove(d)}g.__staticCssClasses=i}Ns(t)}finally{(0,k.popStaticCssPass)(),o&&(0,E.popConfig)(),oo.delete(t)}}const Ks=t=>!!k.CSS_PROPS_REGISTRY[t]||!!(k.DEFAULT_CSS_PROPERTIES_LIST&&k.DEFAULT_CSS_PROPERTIES_LIST.has(t))||typeof t=="string"&&t.charCodeAt(0)===45;function Ws(t){t&&t.node&&$o(t)}function Io(t){const{node:s}=t;if(!s||!s.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const r in t.aria){const i=t.aria[r];if(typeof i=="function"||typeof i=="object"||i==null||typeof i=="string"&&i.includes("{{"))continue;const a="aria-"+r.replace(/[A-Z]/g,f=>"-"+f.toLowerCase());s.setAttribute(a,(0,v.serializeAttrValue)(a,i))}const o=(0,v.applyAttrTransforms)(t);for(const r in o){const i=o[r];i!=null&&i!==!1&&typeof i!="function"&&typeof i!="object"&&s.setAttribute(r,i===!0?"":i)}const n=t.tag||"div";for(const r of Object.keys(t)){if(typeof t[r]=="function"||U.REGISTRY.has(r)||r==="on"||o[r]!==void 0)continue;const i=r.charCodeAt(0);if(!(i>=65&&i<=90)&&!Z(r)&&!(0,J.isCssProp)(n,r)&&(0,v.checkAttributeByTagName)(n,r)){let a=t[r];if(a==null)continue;if(typeof a=="string"&&a.includes("{{")){if(!v.ATTR_TRANSFORMS[r])continue;a=D.replaceLiteralsWithObjectFields.call(t,a,t.state)}if(a==null||typeof a=="function"||typeof a=="object"||a===!1&&!(0,v.isEnumeratedTrueFalseAttr)((0,v.camelToAttr)(r)||r))continue;const f=(0,v.camelToAttr)(r)||r;s.setAttribute(f,(0,v.serializeAttrValue)(f,a))}}}function zs(t,s){const{node:o}=t;if(!o||!o.setAttribute)return;const n=s.charCodeAt(0);if(n>=65&&n<=90||Z(s))return;const r=t.tag||"div";if((0,J.isCssProp)(r,s)||!(0,v.checkAttributeByTagName)(r,s))return;const i=(0,v.camelToAttr)(s)||s,a=i.toLowerCase(),f=t.__ref&&t.__ref.__effects;let e=!1;if(f)for(let p=0;p<f.length;p++){const y=f[p];y&&y._attrName===a&&!y._disposed&&typeof y._execute=="function"&&(e=!0,y._execute())}if(e)return;let u=t[s];const h=v.ATTR_TRANSFORMS[s];if(h&&u!=null){const p=h(t);p!==void 0&&(u=p)}typeof u=="string"&&u.includes("{{")&&(u=D.replaceLiteralsWithObjectFields.call(t,u,t.state)),u==null||u===!1&&!(0,v.isEnumeratedTrueFalseAttr)(i)?o.removeAttribute(i):typeof u!="function"&&typeof u!="object"&&o.setAttribute(i,(0,v.serializeAttrValue)(i,u))}function Ys(t,s){const o=t.node,n=t.__ref;let r=n.__autoGrow;if(!s){if(r&&r.active){try{o.removeEventListener("input",r.resize)}catch{}Vo(r),m.delete(t),o.style.height="",r.appliedMax!=null&&o.style.maxHeight===r.appliedMax&&(o.style.maxHeight=""),Bo(o,r,!1),r.active=!1,r.appliedMax=null,r.lastMeasure=0}return}r||(r=n.__autoGrow={active:!1,appliedMax:null,lastMeasure:0,lastWidth:null,watch:null,awaitingLayout:!1,appliedScroll:!1,fontsHooked:!1,attachAttempts:0,firstAttemptAt:null,resize:()=>{if(!o.isConnected){St(t,!0);return}if(!(o.scrollHeight>0)){r.awaitingLayout=!0,Uo(t,r);return}r.awaitingLayout=!1;const a=o.style.height;o.style.height="0px";const f=o.scrollHeight;if(!(f>0)){o.style.height=a;return}const e=Qs(o),u=e!=null&&f>e;o.style.height=(u?e:f)+"px",Bo(o,r,u),r.lastMeasure=f,r.lastWidth=o.clientWidth,Uo(t,r)}},n.__eventCleanup||(n.__eventCleanup=[]),n.__eventCleanup.push(()=>{try{o.removeEventListener("input",r.resize)}catch{}Vo(r),m.delete(t)})),r.active||(o.addEventListener("input",r.resize),r.active=!0,Zs(t,r));const i=typeof s=="object"&&s.max!=null?String(s.max):null;i!==r.appliedMax&&(i==null?r.appliedMax!=null&&o.style.maxHeight===r.appliedMax&&(o.style.maxHeight=""):o.style.maxHeight=i,r.appliedMax=i),r.resize()}function St(t,s){const o=t.__ref?.__autoGrow;o&&(s&&(o.attachAttempts=0,o.firstAttemptAt=null),m.add(t),Tt())}function qs(){const t=Array.from(m);m.clear();for(let s=0;s<t.length;s++){const o=t[s],n=o.node,r=o.__ref?.__autoGrow;if(!(!n||!r||!r.active)){if(!n.isConnected){r.firstAttemptAt==null&&(r.firstAttemptAt=ct()),r.attachAttempts+=1,r.attachAttempts<=lo&&ct()-r.firstAttemptAt<po&&(m.add(o),Tt());continue}r.attachAttempts=0,r.firstAttemptAt=null,r.resize()}}}function Uo(t,s){if(s.watch)return;const o=t.node;if(!o)return;const n=o.ownerDocument&&o.ownerDocument.defaultView,r=n&&n.ResizeObserver||(typeof ResizeObserver=="function"?ResizeObserver:null);if(typeof r!="function")return;const i=()=>{if(!s.active||!o.isConnected||!(o.scrollHeight>0))return;if(s.awaitingLayout){s.awaitingLayout=!1,St(t,!0);return}const f=o.clientWidth;s.lastWidth!=null&&Math.abs(f-s.lastWidth)<.5||(s.lastWidth=f,St(t,!0))};let a;try{a=new r(i),a.observe(o)}catch{return}s.watch=a}function Vo(t){const s=t.watch;if(s){t.watch=null;try{s.disconnect()}catch{}}}function Zs(t,s){if(s.fontsHooked)return;s.fontsHooked=!0;const o=t.node&&t.node.ownerDocument,n=o&&o.fonts&&o.fonts.ready;!n||typeof n.then!="function"||n.then(()=>{s.active&&t.node&&St(t,!0)},()=>{})}function Qs(t){const s=t.ownerDocument&&t.ownerDocument.defaultView;let o;try{o=s&&s.getComputedStyle?s.getComputedStyle(t):null}catch{o=null}if(!o)return null;const n=h=>typeof h=="string"&&/^\s*-?\d*\.?\d+px\s*$/.test(h)?parseFloat(h):null,r=n(o.maxHeight);if(r==null||!(r>0))return null;const i=(n(o.paddingTop)||0)+(n(o.paddingBottom)||0),a=(n(o.borderTopWidth)||0)+(n(o.borderBottomWidth)||0),f=o.boxSizing==="border-box"?r-a:r+i,e=n(o.lineHeight);if(!(e>0))return f;const u=Math.floor((f-i)/e+1e-6);return u>=1?u*e+i:f}function Bo(t,s,o){o?s.appliedScroll||(t.style.overflowY="auto",s.appliedScroll=!0):s.appliedScroll&&(t.style.overflowY==="auto"&&(t.style.overflowY=""),s.appliedScroll=!1)}const Go=["srcObject","muted"],Xs=(t,s)=>t==="muted"?s===!0||s===""||s==="true"||s==="muted":s??null;function Js(t){const s=t.node,o=t.__ref;if(!(!s||!o))for(let n=0;n<Go.length;n++){const r=Go[n],i=t[r];if(i===void 0||!(r in s))continue;const a=f=>{const e=Xs(r,f);if(s[r]!==e)try{s[r]=e}catch(u){M(o,r,u)}};if(typeof i=="function"){const f=R(t,t[r+"Deps"],i),e=(0,j.createEffect)(()=>{try{a(f(t,t.state,t.context))}catch(u){M(o,r,u)}},{depth:o.path.length,label:T(o,r)});o.__effects.push(e),o.__exec[r]=i}else a(i);r==="srcObject"&&(o.__releaseMedia=()=>{try{s.srcObject!=null&&(s.srcObject=null)}catch{}})}}function Ho(t){if(!t.autoGrow)return;const s=t.node;if(!s||s.tagName!=="TEXTAREA")return;const o=t.__ref,n=t.autoGrow,r=typeof n=="function"?R(t,t.autoGrowDeps,n):null,i=(0,j.createEffect)(()=>{const a=t.autoGrow;let f=a;if(typeof a=="function")try{f=(a===n&&r?r:a)(t,t.state,t.context)}catch{f=null}Ys(t,f)},{depth:o.path.length,label:T(o,"autoGrow")});o.__effects||(o.__effects=[]),o.__effects.push(i),r&&(o.__exec.autoGrow=n)}const Ko=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function Wo(t,s){for(const o of Object.keys(t)){if(!Z(o)||Ko.has(o))continue;const n=(0,lt.globalEventKeyInfo)(o);if(n){(0,lt.registerGlobalEvent)(n,t,t[o]);continue}let r=t[o];if(typeof r=="string"&&/^[A-Za-z_$][\w$]*$/.test(r)){const a=r;r=function(e){return t.call(a,e)}}if(typeof r!="function")continue;const i=_s(o);U.LIFECYCLE_EVENTS.has(i)||(0,lt.registerEvent)(gs(i),t,r)}ms(t)}function ms(t){const s=t.node;if(!s||!s.addEventListener)return;const o={};let n=!1;for(const y of Ko){const g=t[y];typeof g=="function"&&(o[y]=g,n=!0)}if(!n)return;const r=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,i=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let a=0,f=0,e=0,u=!1;const h=y=>{const g=y.touches&&y.touches[0]||y.changedTouches&&y.changedTouches[0];g&&(a=g.clientX,f=g.clientY,e=Date.now(),u=!0)},p=y=>{if(!u)return;u=!1;const g=y.changedTouches&&y.changedTouches[0]||y.touches&&y.touches[0];if(!g)return;const c=g.clientX-a,l=g.clientY-f,d=Date.now()-e;if(d>i)return;const A=Math.abs(c),x=Math.abs(l);if(Math.max(A,x)<r)return;let _;if(A>x*1.2)_=c<0?"left":"right";else if(x>A*1.2)_=l<0?"up":"down";else return;const b="onSwipe"+_.charAt(0).toUpperCase()+_.slice(1),w=o[b],S=o.onSwipe;w&&w.call(t,y,t,t.state,t.context),S&&S.call(t,{direction:_,dx:c,dy:l,dt:d,event:y},t,t.state,t.context)};s.addEventListener("touchstart",h,{passive:!0}),s.addEventListener("touchend",p,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("touchstart",h)}catch{}try{s.removeEventListener("touchend",p)}catch{}})}function ot(t,s){const o={...t};for(const n in s){const r=o[n],i=s[n];r&&i&&typeof r=="object"&&typeof i=="object"&&!Array.isArray(r)&&!Array.isArray(i)&&typeof r!="function"&&typeof i!="function"?o[n]=ot(r,i):o[n]=i}return o}function eo(t,s,o,n,r){if(!s||!t.node)return;const i=t.childExtends,a=ft(t,"childProps");if(Array.isArray(s)){const f=t.tag==="fragment",e=t.context?.document||globalThis.document,u=f?null:e?.createDocumentFragment();if(!f&&!u)return;const h=t.childProps,p=t.childrenAs,y=x=>{let _=s[x];const b=_;(typeof _=="string"||typeof _=="number")&&(_={text:_});let w=h;if(typeof h=="function")try{w=h(t,_)}catch{w=null}let S=typeof h=="function"?At(w):a;if(r&&p!=="state"&&(S=xt(S,At(b))),p==="state"){let P=b;(typeof b=="string"||typeof b=="number")&&(P={value:b,text:b}),_=w?{...w,state:P}:{state:P}}else w&&(_=ot(w,_));if(i&&!_.ignoreChildExtends)if(_.extends){const P=Array.isArray(_.extends)?_.extends:[_.extends],Y=Array.isArray(i)?i:[i];_={..._,extends:[...Y,...P]}}else _={..._,extends:i};const C=yo(_?.key,b,x);try{return Q(wt(_,S),t,C,o)}catch(P){if(typeof console<"u"&&console.error){const Y=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${C}" failed to construct at ${Y} (initial render, skipping this row):`,P?.message||P)}return null}},g=t.__ref;if(!(n===!0&&!f&&!!g&&(o?.mountYield===!0||t.yieldChildren===!0))){for(let x=0;x<s.length;x++){const _=y(x);!f&&_?.node&&u.appendChild(_.node)}return f||t.node.appendChild(u),!0}const l=g.__childrenChunkGen=(g.__childrenChunkGen||0)+1;(0,B.openMountBudget)();let d=null;const A=x=>{if(g.__disposed||g.__childrenChunkGen!==l){d&&d.parentNode&&d.remove();return}for(let _=x;_<s.length;_++){const b=y(_);if(b?.node&&(d?t.node.insertBefore(b.node,d):u.appendChild(b.node)),_+1<s.length&&(0,B.mountBudgetExhausted)()){d||(d=e.createComment("smbls-mount"),u.appendChild(d),t.node.appendChild(u));const w=_+1;(0,B.enqueueMountWork)(()=>A(w));return}}d?(d.remove(),t.node.tagName==="SELECT"&&Ft(t,!0)):t.node.appendChild(u)};return A(0),(0,B.closeMountBudget)(),!0}if(typeof s=="string"){const f=_o(s,t);if(Array.isArray(f))return eo(t,f,o,n,!0)}if(typeof s=="object")for(const f in s){if(U.REGISTRY.has(f))continue;let e=s[f];if(e==null||e===!1)continue;const u=r?xt(a,At(e)):a;if((typeof e=="string"||typeof e=="number")&&(e={text:e}),t.childProps&&(e=ot(t.childProps,e)),i&&!e.ignoreChildExtends)if(e.extends){const h=Array.isArray(e.extends)?e.extends:[e.extends],p=Array.isArray(i)?i:[i];e={...e,extends:[...p,...h]}}else e={...e,extends:i};Q(wt(e,u),t,f,o)}}function Ft(t,s){const o=t.node;if(!o||o.tagName!=="SELECT")return;const n=o.options;if(!n||!n.length)return;const r=t.__ref,i=r&&r.__exec&&r.__exec.value,a=typeof i=="function",f=t.value!=null&&typeof t.value!="function";if(a||f){let h;if(a)try{h=i(t,t.state,t.context)}catch{return}else h=t.value,typeof h=="string"&&h.includes("{{")&&(h=D.replaceLiteralsWithObjectFields.call(t,h,t.state));const p=h==null?"":String(h);o.value!==p&&(o.value=p);return}const e=s||!(r&&r.__selectSynced);if(r&&(r.__selectSynced=!0),!e)return;let u=-1;for(let h=0;h<n.length;h++)n[h].defaultSelected&&(u=h);u>=0&&o.selectedIndex!==u&&(o.selectedIndex=u)}function zo(t,s){let{children:o,content:n}=t;const r=t.childExtends,i=typeof o=="function"||xo(t,"children");if(typeof o=="function"){const c=o;try{o=c(t,t.state,t.context)}catch(_){if(o=void 0,typeof console<"u"&&console.error){const b=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${b} (initial run, treating as empty):`,_?.message||_)}}wo(t,o),t.children=o;const l=t.__ref;let d=!1;const A=R(t,t.childrenDeps,c),x=(0,j.createEffect)(()=>{const _=d;d=!0;let b;try{b=A(t,t.state,t.context)}catch(I){if(typeof console<"u"&&console.error){const G=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${G}${_?"":" (initial tracking run)"}:`,I?.message||I)}return}if(!_||b===t.children)return;wo(t,b),t.children=b,l.__childrenChunkGen!=null&&l.__childrenChunkGen++;const w=typeof t.onContentUpdate=="function",S=w?[]:null,C=w?[]:null,P=w?[]:null;if(Array.isArray(b)&&t.childrenAs==="state"){const I=t.childProps,G=[],ro=new Map;for(let O=0;O<b.length;O++){const H=b[O];let L=I;if(typeof I=="function")try{L=I(t,H)}catch{L=null}const q=yo(L&&L.key,H,O);G.push(q),ro.set(q,{rawChild:H,childProps:L})}const mo=new Set(G),ts=l.__children.slice();for(const O of ts)if(!mo.has(O)){const H=t[O];H?.remove&&H.remove(),delete t[O],C&&C.push(O)}const dt=t.childExtends,vt=t.tag==="fragment",os=t.context?.document||globalThis.document,pt=vt?null:os?.createDocumentFragment(),Ut=new Set;for(const O of G){const H=ro.get(O),L=H.rawChild,q=t[O];if(q&&q.state){if(L&&typeof L=="object"){const F=q.state,rt=F.$replace||F.replace,io=F.$update||F.update;try{if(typeof rt=="function")rt.call(F,L);else if(typeof io=="function"){for(const V in F)if(!(V==="__element"||V==="root"||V==="parent"||V==="update")&&!Object.prototype.hasOwnProperty.call(L,V))try{F[V]=void 0}catch{}io.call(F,L)}else for(const V in L)F[V]=L[V]}catch(V){if(typeof console<"u"&&console.error){const es=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${O}" failed to patch at ${es} (reconcile, keeping its previous data for this pass):`,V?.message||V)}}}P&&P.push(O);continue}let Vt=L;(typeof L=="string"||typeof L=="number")&&(Vt={value:L,text:L});const Bt=H.childProps;let W=Bt?{...Bt,state:Vt}:{state:Vt};const ss=typeof I=="function"?At(Bt):ft(t,"childProps");if(dt&&!W.ignoreChildExtends)if(W.extends){const F=Array.isArray(W.extends)?W.extends:[W.extends],rt=Array.isArray(dt)?dt:[dt];W={...W,extends:[...rt,...F]}}else W={...W,extends:dt};let Gt;try{Gt=Q(wt(W,ss),t,O,s)}catch(F){if(typeof console<"u"&&console.error){const rt=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${O}" failed to construct at ${rt} (reconcile, skipping this row):`,F?.message||F)}Ut.add(O);continue}!vt&&Gt?.node&&pt&&pt.appendChild(Gt.node),S&&S.push(O)}if(!vt&&pt&&pt.childNodes.length&&t.node&&t.node.appendChild(pt),!vt&&t.node){let O=null;for(const H of G){const L=t[H]?.node;if(!L)continue;const q=O?O.nextSibling:t.node.firstChild;L!==q&&t.node.insertBefore(L,q),O=L}}l.__children=Ut.size?G.filter(O=>!Ut.has(O)):G,w&&(S.length||C.length)&&ho(t,{added:S,removed:C,kept:P}),Ft(t,!1);return}const nt=w?[...l.__children]:null;for(const I of[...l.__children]){const G=t[I];G?.remove&&G.remove(),delete t[I]}l.__children=[],eo(t,b,s,!1,!0),Ft(t,!1),w&&ho(t,{added:[...l.__children],removed:nt,kept:[]})},{depth:l.path.length,label:T(l,"children")});l.__effects.push(x)}const a=eo(t,o,s,!0,i);if(n!=null&&!(n&&n.__ref)){let c=n;if(typeof c=="string"||typeof c=="number"?c={text:c}:typeof c!="object"&&(c={}),t.childProps&&(c=ot(t.childProps,c)),r&&!c.ignoreChildExtends)if(c.extends){const d=Array.isArray(c.extends)?c.extends:[c.extends],A=Array.isArray(r)?r:[r];c={...c,extends:[...A,...d]}}else c={...c,extends:r};const l=xt(ft(t,"childProps"),ft(t,"content"));Q(wt(c,l),t,"content",s)}if(o&&!a)return;const f=t.context?.components||{},e=t.__ref&&t.__ref.__runtimeSource,u=e?{}:null;{const c=Object.keys(t);for(let l=0;l<c.length;l++){const d=c[l];if(!d.endsWith("Extends")||typeof t[d]!="string")continue;const A=d.slice(0,-7);if(!A||A.charCodeAt(0)<65||A.charCodeAt(0)>90)continue;const x={extends:t[d]};delete t[d];for(let _=l+1;_<c.length;_++){const b=c[_],w=b.charCodeAt(0);if(w>=65&&w<=90||U.REGISTRY.has(b)||typeof t[b]=="function"&&(b.startsWith("on")||b.startsWith(".")))break;const S=t[b];S!==void 0&&(x[b]=S,delete t[b],u&&bt(e,b)&&(u[A]||(u[A]={}),u[A][b]=e[b]))}t[A]&&typeof t[A]=="object"?t[A]={...x,...t[A]}:t[A]=x}}const h=s?.mountYield===!0||t.yieldChildren===!0,p=Object.keys(t),y=c=>{if(U.REGISTRY.has(c)||typeof t[c]!="object"||t[c]===null)return;const l=c.charCodeAt(0);if(l<65||l>90)return;let d=t[c];if(d.__ref)return;if(!d.extends&&!d.extend){const x=f[c]||f[`smbls.${c}`];x&&(d={...d,extends:x})}if(t.childProps&&(d=ot(t.childProps,d)),r&&!d.ignoreChildExtends)if(d.extends){const x=Array.isArray(d.extends)?d.extends:[d.extends],_=Array.isArray(r)?r:[r];d={...d,extends:[..._,...x]}}else d={...d,extends:r};const A=e?xt(ft(t,"childProps"),xt(u[c]||null,ft(t,c))):null;Q(wt(d,A),t,c,s)};if(!h){for(const c of p)y(c);return}(0,B.openMountBudget)();const g=c=>{for(let l=c;l<p.length;l++)if(y(p[l]),l+1<p.length&&(0,B.mountBudgetExhausted)()){const d=l+1;(0,B.enqueueMountWork)(()=>g(d));return}};g(0),(0,B.closeMountBudget)()}function Yo(t,s,o){const{node:n}=t;if(!n)return;n.ref=t;const r=s?.tag==="fragment"?s.__ref?.__fragmentAnchor:null;if(r){const a=r.parentNode;if(a){if(o?.position==="before"&&o.node)a.insertBefore(n,o.node);else if(o?.position==="after"&&o.node){const f=o.node.nextSibling;a.insertBefore(n,f||r)}else a.insertBefore(n,r);return}}const i=s?.node||(s?.nodeType?s:null);if(i)if(o?.position==="before"&&o.node)i.insertBefore(n,o.node);else if(o?.position==="after"&&o.node){const a=o.node.nextSibling;a?i.insertBefore(n,a):i.appendChild(n)}else i.appendChild(n)}const It=3;function Jo(t){return!t||t.__inBeforeUpdate||(t.__beforeUpdateFailCount||0)>=It?!1:(t.__inBeforeUpdate=!0,!0)}function kt(t,s){t&&(t.__inBeforeUpdate=!1,s?(t.__beforeUpdateFailCount=(t.__beforeUpdateFailCount||0)+1,t.__beforeUpdateFailCount===It&&typeof console<"u"&&console.error&&console.error(`[DOMQL] onBeforeUpdate failed ${It}x in a row on this element \u2014 pausing automatic retries until a future prop/state change re-arms it.`)):t.__beforeUpdateFailCount=0)}function $(t,s,o){const n=t.charAt(0).toLowerCase()+t.slice(1);s.context?.plugins?.length&&(0,z.runPluginHook)(n,s,o);const r="on"+t,i=s[r];if(typeof i=="function"){const e=t==="Render"?"__inRender":t==="RenderRouter"?"__inRenderRouter":null;if(e){if(s.__ref[e])return!0;s.__ref[e]=!0}const u=s.context?.designSystem;u&&(0,E.pushConfig)(u);let h=!!e;try{const p=i(s,s.state,s.context,o);if(p&&typeof p.then=="function"){const y=s.__ref;return p.catch(g=>{s.context?.plugins?.length&&(0,z.runPluginHook)("error",s,{hook:r,error:g})||console.error(`[DOMQL] Lifecycle "${r}" error:`,g)}).finally(()=>{e&&y&&(y[e]=!1)}),h=!1,!0}if(p===!1)return!1}catch(p){if(s.context?.plugins?.length&&(0,z.runPluginHook)("error",s,{hook:r,error:p})||console.error(`[DOMQL] Lifecycle "${r}" error:`,p),s.context?.strictMode)throw p}finally{u&&(0,E.popConfig)(),h&&s.__ref&&(s.__ref[e]=!1)}}return!0}var te=Q;
|
|
4
|
+
`):"")}}if(Ft(n,!0),qo(n,o,r),typeof n.html=="function"&&n.node&&!n.node.innerHTML){const h=n.context?.designSystem;h&&(0,j.pushConfig)(h);try{const _=n.html(n,n.state,n.context);_!=null&&typeof _!="function"&&(n.node.innerHTML=_)}catch{}finally{h&&(0,j.popConfig)()}}if($("Create",n,e),$("Complete",n,e),$("Render",n,e),$("RenderRouter",n,e),Kt(n,e),typeof n.onFrame=="function"){const h=n.onFrame,_=n.context?.designSystem,c=()=>{if(n.node){if(n.node.isConnected){_&&(0,j.pushConfig)(_);try{h(n,n.state,n.context)}catch(u){console.error("[DOMQL] onFrame error:",u)}finally{_&&(0,j.popConfig)()}}requestAnimationFrame(c)}};requestAnimationFrame(c)}return n}function _o(t,o,s,e,r,i){if(s&&!o.extends&&!o.extend){const u=s.indexOf("_"),l=s.indexOf(".");let g=u>0?u:-1;if(l>0&&(g<0||l<g)&&(g=l),g>0){const b=s.substring(0,g),A=t.context?.components;A&&(A[b]||A["smbls."+b])?o={...o,extends:b}:A&&(0,st.isLoudDevRuntime)()&&(/^[A-Z]\w*_\d+$/.test(s)||/^[A-Z]\w*\.\w+$/.test(s))&&console.warn(`[smbls] auto-extend: key "${s}" looks like an instance of "${b}" but neither "${b}" nor "smbls.${b}" is registered in context.components \u2014 element will render as a plain <div>. Register the base component or rename the key.`)}}(0,Zo.applyExtends)(t,o,i);const a=new Set(["childProps","attr","style","scope","data"]),f=t.props&&typeof t.props=="object"?t.props:null;for(const u in o){if(u==="parent"||u==="node"||u==="__ref"||u==="extends"||u==="context"||u==="props")continue;if(u==="key"){e&&(t.key=e);continue}const l=o[u],g=t[u],b=g&&l&&typeof g=="object"&&typeof l=="object"&&!Array.isArray(g)&&!Array.isArray(l)&&typeof g!="function"&&typeof l!="function";b&&u.charCodeAt(0)>=65&&u.charCodeAt(0)<=90?t[u]=_t(g,l):b&&a.has(u)?t[u]={...g,...l}:b&&Wt(u)?t[u]=_t(g,l):t[u]=l}function n(u){for(const l in u){const g=u[l],b=t[l],A=b&&g&&typeof b=="object"&&typeof g=="object"&&!Array.isArray(b)&&!Array.isArray(g)&&typeof b!="function"&&typeof g!="function";A&&l.charCodeAt(0)>=65&&l.charCodeAt(0)<=90?t[l]=_t(b,g):A&&a.has(l)?t[l]={...b,...g}:A&&Wt(l)?t[l]=_t(b,g):t[l]=g}}f&&n(f),o.props&&typeof o.props=="object"&&n(o.props),o.classlist!==void 0&&(t.classlist=o.classlist),o.text!==void 0&&(t.text=o.text),o.html!==void 0&&(t.html=o.html);const d=t.scope&&typeof t.scope=="object"?t.scope:null,y=r?.scope,p=t.context&&typeof t.context.globalScope=="object"&&t.context.globalScope||null,h=y||p||null;if(o.scope!==void 0||d){const u={};d&&Object.assign(u,d),o.scope!==void 0&&Object.assign(u,o.scope),t.scope=(0,N.createScopeStore)(u,h)}else h&&(t.scope=h);o.if!==void 0&&(t.if=o.if);const _=t.__ref,c=Ls(t,_&&_.__runtimeSource);return _&&(_.__declaredArrays=c||void 0),(0,Qo.addMethods)(t),Ss(t,r,o),o}const As=new Set(["key","parent","context","__ref"]);function xs(t,o){for(const r of Object.keys(t))As.has(r)||delete t[r];const s=(0,k.getObserver)();s&&(0,k.setObserver)(null);let e=o.definition;if(!e.extends&&!e.extend&&typeof o.key=="string"){const r=t.context?.components||{},i=r[o.key]||r["smbls."+o.key];i&&(e={...e,extends:i})}try{_o(t,e,o.key,o.ownKey,t.parent,o.options)}finally{s&&(0,k.setObserver)(s)}}function ws(t,o,s){const e=s||{},r=f=>!!(e[f]||e["smbls."+f]),i=[],a=[];if(t.extends&&a.push(...Array.isArray(t.extends)?t.extends:[t.extends]),t.extend&&a.push(...Array.isArray(t.extend)?t.extend:[t.extend]),a.length){for(const f of a){if(typeof f!="string")continue;const n=f.includes(">")?f.split(">")[0].trim():f;r(n)||i.push(n)}return i}if(typeof o=="string"&&/^[A-Z]/.test(o)){let f=-1;const n=o.indexOf("_"),d=o.indexOf(".");n>0&&(f=n),d>0&&(f<0||d<f)&&(f=d);const y=f>0?o.substring(0,f):o;r(y)||i.push(y)}return i}function Ss(t,o,s){const e=!o,r=s.state&&typeof s.state=="object"&&!Array.isArray(s.state)&&Object.keys(s.state).length===0,i=e&&r&&t.context?.state,a=s.state!==void 0&&!i?s.state:t.state&&!(0,N.isStore)(t.state)?t.state:void 0;if(a==null){if(o?.state)t.state=o.state,(0,ut.applyStateMethods)(t,t.state);else if(t.context?.state){const f=t.context.state,n={...f},d=t.context?.polyglot;if(d?.translations){const y=t.context,p=f.lang||d.defaultLang||"en",h=new Set,_=(l,g)=>{h.has(l)||(0,R.isPolyglotWritableKey)(y,l,n)&&(n[l]=g,h.add(l),(0,R.markPolyglotSeeded)(y,l,g))},c=d.translations[p];if(c&&typeof c=="object")for(const l in c)_(l,c[l]);const u=new Set(d.languages||[]);for(const l in d.translations)u.has(l)||_(l,d.translations[l])}t.state=(0,N.isStore)(n)?n:(0,N.createStore)(n),t.state.__element=t,t.state.root=t.state,(0,ut.applyStateMethods)(t,t.state),Et.promoteActiveRootState?.(f,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),(0,ut.applyStateMethods)(t,t.state);return}if(typeof a=="string"){if(t.state=go(a,o),t.state&&typeof t.state=="object"&&!(0,N.isStore)(t.state)){const f=o?.state?.root||o?.state||t.state;Object.defineProperty(t.state,"root",{value:f,enumerable:!1,configurable:!0,writable:!0})}(0,ut.applyStateMethods)(t,t.state);return}if(typeof a=="function"){const f=a(t,o?.state);t.state=(0,N.isStore)(f)?f:(0,N.createStore)(f||{})}else(0,N.isStore)(a)?t.state=a:t.state=(0,N.createStore)({...a});t.state.__element=t,o?.state?(t.state.parent=o.state,t.state.root=o.state.root||o.state):t.state.root=t.state,(0,ut.applyStateMethods)(t,t.state),Et.promoteActiveRootState?.(a,t.state)}function zt(t,o){if(!o)return t;const s=o.split("/");let e=t;for(const r of s){if(e==null)return{};e=e[r]}return e??{}}function go(t,o){if(!o)return{};if(t===".")return o.state||{};if(t.startsWith("../")){const r=t.slice(3);return r?zt(o.state,r):o.state??{}}if(t.startsWith("~/")){const r=o.state?.root||o.state,i=t.slice(2);return i?zt(r,i):r??{}}if(o.state?.[t]!==void 0)return o.state[t];const s=zt(o.state,t);if(s!=null&&Object.keys(s).length>0)return s;const e=o.context?.polyglot;if(e?.translations){const r=o.state?.root?.lang||e.defaultLang||"en",i=e.translations[r];if(i?.[t]!==void 0)return i[t];if(e.translations[t]!==void 0)return e.translations[t]}return{}}const Cs=new Set(["s","state","ctx","context"]);function ks(t){try{const s=(typeof Et.getFunctionSource=="function"?Et.getFunctionSource(t):Function.prototype.toString.call(t)).match(/^[^(]*\(([^)]*)\)/);return s?s[1].split(",").map(e=>e.trim().split("=")[0].trim()).filter(Boolean):[]}catch{return[]}}function vs(t){if(typeof t!="function"||t.length!==2)return!1;const o=ks(t);if(o.length<2)return!1;const s=o[1].replace(/[{}[\]]/g,"").trim();return s.length>0&&!Cs.has(s)}function js(t){const o=t.__ref,s=t.tag||"div",e=t.context?.designSystem,r=[],i=Object.keys(t);for(let a=0;a<i.length;a++){const f=i[a];if(typeof t[f]!="function"||U.REGISTRY.has(f))continue;const n=f.charCodeAt(0);n>=65&&n<=90||Z(f)||C.CSS_PROPS_REGISTRY[f]||C.DEFAULT_CSS_PROPERTIES_LIST&&C.DEFAULT_CSS_PROPERTIES_LIST.has(f)||(0,v.checkAttributeByTagName)(s,f)||((0,st.isLoudDevRuntime)()&&vs(t[f])&&console.warn(`[smbls] custom prop "${f}"${t.key?` on key "${t.key}"`:""} is a function \u2014 it will be auto-invoked on read and its RETURN VALUE stored, not preserved as a callable reference. If you meant to stash a callback, use el.call('${f}', \u2026) instead of reading el.${f}(\u2026) directly (see RULES.md Rule 8).`),r.push({prop:f,fn:t[f]}))}for(let a=0;a<r.length;a++){const{prop:f,fn:n}=r[a];o.__exec[f]=n,Object.defineProperty(t,f,{get(){e&&(0,j.pushConfig)(e);try{return n(t,t.state,t.context)}catch{return}finally{e&&(0,j.popConfig)()}},set(d){delete o.__exec[f],Object.defineProperty(t,f,{value:d,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function Es(t,o){if(!(!Array.isArray(o)||o.length===0))for(let s=0;s<o.length;s++){const e=o[s];try{typeof e=="function"?e(t,t.state,t.context):typeof e=="string"&&t.state?.[e]}catch{}}}function D(t,o,s){return!Array.isArray(o)||o.length===0?s:function(...e){return Es(t,o),s.apply(this,e)}}function gt(t,o){if(!(!t||Array.isArray(t)||typeof t!="object"))return t[o]}function P(t,o){return()=>t.path.join(".")+"::"+o}const bo=new Set;function M(t,o,s){if(!(0,st.isLoudDevRuntime)())return;const e=P(t,o)();bo.has(e)||(bo.add(e),console.warn(`[smbls] "${o}" effect threw on ${t.path.join(".")} \u2014 keeping previous value:`,s?.message||s))}const Ao=/(['"`])((?:\\.|(?!\1)[^\\])*)\1/g,Ps=(t,o)=>{let s;try{s=String(t)}catch{return}if(!s.includes("{{"))return;Ao.lastIndex=0;let e;for(;(e=Ao.exec(s))!==null;)e[2].includes("{{")&&o.add(e[2])},Ts=(t,o)=>!Z(t)&&!(0,J.isCssProp)(o,t),xo=(t,o,s,e,r)=>{if(typeof o=="string"){!r&&o.includes("{{")&&s.add(o);return}typeof o=="function"&&Ts(t,e)&&Ps(o,s)},Yt=new WeakMap,bt=(t,o)=>Object.prototype.hasOwnProperty.call(t,o),At=t=>{if(typeof t=="string"||typeof t=="number")return{text:t};if(!t||typeof t!="object"||Array.isArray(t))return null;const o=t.props;return o&&typeof o=="object"&&!Array.isArray(o)?ot(t,o):t},xt=(t,o)=>t&&o?ot(t,o):t||o||null,wo=(t,o)=>{const s=t.__ref&&t.__ref.__runtimeSource;return!!s&&bt(s,o)},ft=(t,o)=>wo(t,o)?At(t.__ref.__runtimeSource[o]):null,wt=(t,o)=>(o&&t&&typeof t=="object"&&Yt.set(t,o),t),Os=t=>{if(!t||typeof t!="object")return;const o=Yt.get(t);return o&&Yt.delete(t),o},qt=(t,o,s)=>{if(typeof t=="string"){t.includes("{{")&&o.add(t);return}if(!(!t||typeof t!="object"||s.has(t))){if(s.add(t),Array.isArray(t)){for(let e=0;e<t.length;e++)qt(t[e],o,s);return}if(!t.__ref)for(const e of Object.keys(t)){if(e==="state")continue;const r=Object.getOwnPropertyDescriptor(t,e);r&&"value"in r&&qt(r.value,o,s)}}},Ls=(t,o)=>{let s=null;for(const e of Object.keys(t)){if(U.REGISTRY.has(e)||o&&bt(o,e))continue;const r=Object.getOwnPropertyDescriptor(t,e),i=r&&r.value;if(!Array.isArray(i))continue;const a=new Set;qt(i,a,new Set),a.size&&(s||(s=new Map),s.set(i,a))}return s},So=(t,o)=>{if(Array.isArray(o))for(let s=t;s;s=s.parent){const e=s.__ref&&s.__ref.__declaredArrays,r=e&&e.get(o);if(!r)continue;const i=t.__ref;i.__authoredTemplates||(i.__authoredTemplates=new Set);for(const a of r)i.__authoredTemplates.add(a);return}},Ds=["attr","aria","data","metadata"],Rs=t=>{if(Ds.includes(t))return!0;const o=t.charCodeAt(0);return o===46||o===33||o===64},Ms=(t,o)=>{const s=new Set,e=t.tag||"div";for(const r of Object.keys(t)){const i=Object.getOwnPropertyDescriptor(t,r),a=i&&i.value,f=!!o&&bt(o,r);if(a&&typeof a=="object"&&!Array.isArray(a)){if(!Rs(r))continue;const n=f?o[r]:null,d=n&&typeof n=="object"?n:null;for(const y in a){const p=f&&(!d||bt(d,y));xo(y,a[y],s,e,p)}continue}xo(r,a,s,e,f)}return s};function Co(t,o){const s=t.__ref,e=!!(o&&o.skipIfEffect),r=Ms(t,s.__runtimeSource);if(s.__authoredTemplates)for(const n of r)s.__authoredTemplates.add(n);else s.__authoredTemplates=r;if(js(t),typeof t.text=="function"){const n=t.text,d=D(t,t.textDeps,n),y=(0,k.createEffect)(()=>{if(!s.contentManaged)try{let p=d(t,t.state,t.context);t.node&&p!=null&&typeof p!="function"&&typeof p!="object"&&(typeof p=="string"&&p.includes("{{")&&(p=R.replaceLiteralsWithObjectFields.call(t,p,t.state)),Ct(t,p))}catch(p){M(s,"text",p)}},{depth:s.path.length,label:P(s,"text")});s.__effects.push(y),s.__exec.text=n}else if(typeof t.text=="string"&&t.text.includes("{{")){const n=t.text,d=(0,k.createEffect)(()=>{if(s.contentManaged)return;const y=R.replaceLiteralsWithObjectFields.call(t,n,t.state);y!=null&&(t.text=y),t.node&&Ct(t,y??"")},{depth:s.path.length,label:P(s,"text")});s.__effects.push(d),s.__exec.text=n}const i=t.tag||"div";for(const n of Object.keys(t))if(typeof t[n]=="function"&&!U.REGISTRY.has(n)&&!Z(n)&&!s.__exec[n]&&!(0,J.isAttributeFirst)(i,n)){if(C.CSS_PROPS_REGISTRY[n]){const d=t[n],y=D(t,t[n+"Deps"],d),p=n;let h,_=null,c=null,u;const l=(0,k.createEffect)(()=>{const g=t.context?.designSystem;g&&(0,j.pushConfig)(g);try{const b=y(t,t.state,t.context);(0,C.pushStaticCssPass)();let A;try{A=C.CSS_PROPS_REGISTRY[p](b,t,t.state,t.context)}finally{(0,C.popStaticCssPass)()}if(Array.isArray(A)){const S={};for(const w of A)if(w)for(const E in w)S[E]=w[E];A=S}const x=p==="show"||p==="hide";if(A&&t.node&&Ns(A)){const S=Ot(A);if(S===null||S!==u){u=S;const w=(0,X.css)(A,null,t.context?.cssPrefix),E=w?w.split(" ").filter(Boolean):null;if(t.node.classList){if(c)for(const T of c)t.node.classList.remove(T);if(E&&E.length)for(const T of E)t.node.classList.add(T);c=E}}h=void 0,_=null}else if(A&&t.node){if(c){for(const w of c)t.node.classList.remove(w);c=null,u=void 0}const S=Ot(A);if(S===null||S!==h||!Rt(t.node,_)){h=S;const w=To(t,A);_=Lt(t.node,w)}}else t.node&&x&&(h=void 0,_=null,t.node.style.display="")}finally{g&&(0,j.popConfig)()}},{depth:s.path.length,label:P(s,p)});s.__effects.push(l),s.__exec[n]=d}else if(C.DEFAULT_CSS_PROPERTIES_LIST&&C.DEFAULT_CSS_PROPERTIES_LIST.has(n)){const d=t[n],y=D(t,t[n+"Deps"],d),p=n;let h,_=null;const c=(0,k.createEffect)(()=>{const u=t.context?.designSystem;u&&(0,j.pushConfig)(u);try{const l=y(t,t.state,t.context);if(t.node)if(l!=null){const g=p+":"+String(l);if(g!==h||!Rt(t.node,_)){h=g;const b={[p]:l},A=To(t,b);_=Lt(t.node,A)}}else h=void 0,_=null,t.node.style[p]=""}finally{u&&(0,j.popConfig)()}},{depth:s.path.length,label:P(s,p)});s.__effects.push(c),s.__exec[n]=d}}if(typeof t.html=="function"){const n=t.html,d=D(t,t.htmlDeps,n),y=(0,k.createEffect)(()=>{const p=t.context?.designSystem;p&&(0,j.pushConfig)(p);try{const h=d(t,t.state,t.context);t.node&&h!=null&&typeof h!="function"&&(t.node.innerHTML=h)}finally{p&&(0,j.popConfig)()}},{depth:s.path.length,label:P(s,"html")});s.__effects.push(y),s.__exec.html=n}if(typeof t.value=="function"){const n=t.value,d=D(t,t.valueDeps,n),y=(0,k.createEffect)(()=>{try{let p=d(t,t.state,t.context);typeof p=="string"&&p.includes("{{")&&(p=R.replaceLiteralsWithObjectFields.call(t,p,t.state)),jo(t,p)}catch(p){M(s,"value",p)}},{depth:s.path.length,label:P(s,"value")});s.__effects.push(y),s.__exec.value=n}else if(typeof t.value=="string"&&t.value.includes("{{")){const n=t.value,d=(0,k.createEffect)(()=>{try{jo(t,R.replaceLiteralsWithObjectFields.call(t,n,t.state))}catch(y){M(s,"value",y)}},{depth:s.path.length,label:P(s,"value")});s.__effects.push(d),s.__exec.value=n}if(typeof t.style=="function"){const n=t.style,d=D(t,t.styleDeps,n);let y,p=null;const h=(0,k.createEffect)(()=>{const _=d(t,t.state,t.context),c=Ot(_);(c===null||c!==y||!Rt(t.node,p))&&(y=c,Fs(t.node,p,_),tt(t.node,_),p=Lt(t.node,_))},{depth:s.path.length,label:P(s,"style")});s.__effects.push(h),s.__exec.style=n}else if(t.style&&typeof t.style=="object")for(const n in t.style){const d=t.style[n];if(typeof d!="function")continue;const y=D(t,gt(t.styleDeps,n),d);let p,h=null;const _=(0,k.createEffect)(()=>{try{const c=y(t,t.state,t.context);if(t.node){const u=n+":"+String(c);if(u!==p||!Rt(t.node,h)){p=u;const l={[n]:c};tt(t.node,l),h=Lt(t.node,l)}}}catch(c){M(s,"style."+n,c)}},{depth:s.path.length,label:P(s,"style."+n)});s.__effects.push(_)}if(t.attr&&typeof t.attr=="object"){for(const n in t.attr)if(typeof t.attr[n]=="function"){const d=D(t,gt(t.attrDeps,n),t.attr[n]),y=n,p=(0,k.createEffect)(()=>{try{let h=d(t,t.state,t.context);typeof h=="string"&&h.includes("{{")&&(h=R.replaceLiteralsWithObjectFields.call(t,h,t.state)),t.node?.setAttribute&&(h==null||h===!1&&!(0,v.isEnumeratedTrueFalseAttr)(y)?t.node.removeAttribute(y):typeof h!="function"&&typeof h!="object"&&t.node.setAttribute(y,(0,v.serializeAttrValue)(y,h)))}catch(h){M(s,"attr."+y,h)}},{depth:s.path.length,label:P(s,"attr."+y)});p._attrName=y.toLowerCase(),s.__effects.push(p)}else if(typeof t.attr[n]=="string"&&t.attr[n].includes("{{")){const d=t.attr[n],y=n,p=(0,k.createEffect)(()=>{try{const h=R.replaceLiteralsWithObjectFields.call(t,d,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(y,(0,v.serializeAttrValue)(y,h??""))}catch(h){M(s,"attr."+y,h)}},{depth:s.path.length,label:P(s,"attr."+y)});p._attrName=y.toLowerCase(),s.__effects.push(p)}}if(t.aria&&typeof t.aria=="object")for(const n in t.aria){const d=t.aria[n];if(typeof d=="string"&&d.includes("{{")){const _=d,c="aria-"+n.replace(/[A-Z]/g,l=>"-"+l.toLowerCase()),u=(0,k.createEffect)(()=>{try{const l=R.replaceLiteralsWithObjectFields.call(t,_,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(c,(0,v.serializeAttrValue)(c,l??""))}catch(l){M(s,"aria."+n,l)}},{depth:s.path.length,label:P(s,"aria."+n)});u._attrName=c,s.__effects.push(u);continue}if(typeof d!="function")continue;const y=D(t,gt(t.ariaDeps,n),t.aria[n]),p="aria-"+n.replace(/[A-Z]/g,_=>"-"+_.toLowerCase()),h=(0,k.createEffect)(()=>{try{const _=y(t,t.state,t.context);if(!t.node?.setAttribute)return;_==null?t.node.removeAttribute(p):typeof _!="function"&&typeof _!="object"&&t.node.setAttribute(p,(0,v.serializeAttrValue)(p,_))}catch(_){M(s,"aria."+n,_)}},{depth:s.path.length,label:P(s,"aria."+n)});h._attrName=p,s.__effects.push(h)}if(t.data&&typeof t.data=="object")for(const n in t.data){const d=t.data[n];if(typeof d=="string"&&d.includes("{{")){const c=d,u="data-"+n.replace(/[A-Z]/g,g=>"-"+g.toLowerCase()),l=(0,k.createEffect)(()=>{try{const g=R.replaceLiteralsWithObjectFields.call(t,c,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(u,g??"")}catch(g){M(s,"data."+n,g)}},{depth:s.path.length,label:P(s,"data."+n)});l._attrName=u,s.__effects.push(l);continue}if(typeof d!="function")continue;const y=D(t,gt(t.dataDeps,n),t.data[n]),h="data-"+n.replace(/[A-Z]/g,c=>"-"+c.toLowerCase()),_=(0,k.createEffect)(()=>{try{const c=y(t,t.state,t.context);if(!t.node?.setAttribute)return;c==null||c===!1?t.node.removeAttribute(h):typeof c!="function"&&typeof c!="object"&&t.node.setAttribute(h,c===!0?"":c)}catch(c){M(s,"data."+n,c)}},{depth:s.path.length,label:P(s,"data."+n)});_._attrName=h,s.__effects.push(_)}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 n in a){if(typeof a[n]!="function")continue;const d=D(t,gt(t.classDeps,n),a[n]),y=(0,k.createEffect)(()=>{try{const p=d(t,t.state,t.context);if(!t.node?.classList)return;typeof p=="string"?t.node.classList.add(p):p?t.node.classList.add(n):t.node.classList.remove(n)}catch(p){M(s,"class."+n,p)}},{depth:s.path.length,label:P(s,"class."+n)});s.__effects.push(y)}!e&&typeof t.if=="function"&&vo(t,s,t.if);for(const n of Object.keys(t)){if(U.REGISTRY.has(n)||typeof t[n]!="function")continue;const d=n.charCodeAt(0);if(d>=65&&d<=90||Z(n))continue;const y=t[n];s.__exec[n]=y;const p=t.tag||"div";if((0,v.checkAttributeByTagName)(p,n)&&!(0,J.isCssProp)(p,n)){const h=(0,v.camelToAttr)(n)||n,_=D(t,t[n+"Deps"],y),c=(0,k.createEffect)(()=>{try{let u=_(t,t.state,t.context);typeof u=="string"&&u.includes("{{")&&(u=R.replaceLiteralsWithObjectFields.call(t,u,t.state)),t.node?.setAttribute&&(u==null||u===!1&&!(0,v.isEnumeratedTrueFalseAttr)(h)?t.node.removeAttribute(h):typeof u!="function"&&typeof u!="object"&&(h==="src"&&"src"in t.node?t.node.src=u:t.node.setAttribute(h,(0,v.serializeAttrValue)(h,u))))}catch(u){M(s,n,u)}},{depth:s.path.length,label:P(s,n)});c._attrName=h.toLowerCase(),s.__effects.push(c)}}const f=t.tag||"div";for(const n of Object.keys(t)){if(U.REGISTRY.has(n))continue;const d=t[n];if(typeof d!="string"||!d.includes("{{"))continue;const y=n.charCodeAt(0);if(y>=65&&y<=90||Z(n)||(0,J.isCssProp)(f,n)||v.ATTR_TRANSFORMS[n]||!(0,v.checkAttributeByTagName)(f,n))continue;const p=(0,v.camelToAttr)(n)||n,h=(0,k.createEffect)(()=>{try{const _=R.replaceLiteralsWithObjectFields.call(t,d,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(p,(0,v.serializeAttrValue)(p,_??""))}catch(_){M(s,n,_)}},{depth:s.path.length,label:P(s,n)});h._attrName=p.toLowerCase(),s.__effects.push(h)}if(Gs(t),zs(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const n=t.onStateUpdate,d=t.stateDeps;let y=!1,p=[];const h=(0,k.createEffect)(()=>{const _=[];for(let g=0;g<d.length;g++){const b=d[g];try{_[g]=typeof b=="function"?b(t,t.state,t.context):t.state?.[b]}catch{_[g]=void 0}}if(!y){y=!0,p=_;return}let c=_.length!==p.length;for(let g=0;!c&&g<_.length;g++)_[g]!==p[g]&&(c=!0);const u=p;if(p=_,!c)return;const l=t.context?.designSystem;l&&(0,j.pushConfig)(l);try{n(t,t.state,t.context,{prev:u,next:_})}catch(g){if(t.context?.plugins?.length&&(0,z.runPluginHook)("error",t,{hook:"onStateUpdate",error:g})||console.error('[DOMQL] Lifecycle "onStateUpdate" error:',g),t.context?.strictMode)throw g}finally{l&&(0,j.popConfig)()}},{depth:s.path.length,label:P(s,"onStateUpdate")});s.__effects.push(h)}Ws(t)}function ko(t){const o=t.parent,s=o?.node;if(!s||!t.node){qo(t,t.parent);return}let e=null;const r=Object.keys(o),i=r.indexOf(t.key);for(let a=i+1;a<r.length;a++){const f=o[r[a]];if(f?.node?.parentNode===s){e=f.node;break}}e?s.insertBefore(t.node,e):s.appendChild(t.node)}function vo(t,o,s){let e=D(t,t.ifDeps,s);const r=(0,k.createEffect)(()=>{const i=!o.__ifInitialized&&o.__ifLateMerge;if(i){const n=t.context?.components||{};i.names.some(d=>n[d]||n["smbls."+d])&&(o.__ifLateMerge=null,xs(t,i),e=D(t,t.ifDeps,typeof t.if=="function"?t.if:s))}let a;try{a=e(t,t.state,t.context)}catch(n){if(a=!1,o.__ifError=n,typeof console<"u"&&console.warn){const d=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${d} \u2014 treating as false:`,n?.message||n)}return}const f=o.__if;if(o.__if=!!a,f&&!o.__if&&t.node){t.node.remove();try{typeof t.onRemove=="function"&&t.onRemove(t)}catch(n){console.error("[smbls] onRemove error:",n)}}else if(!f&&o.__if)if(o.__ifInitialized)t.node||(t.node=(0,nt.cacheNode)(t)),t.node&&(t.node.ref=t),ko(t),Zt(t),$("Render",t,{}),Kt(t,{});else{if(o.__ifInitialized=!0,o.__ifLateMerge=null,t.tag||(t.tag=(0,nt.detectTag)(t)),$("Init",t,{}),t.node||(t.node=(0,nt.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"&&!o.__fragmentAnchor){const d=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(d),o.__fragmentAnchor=d}$("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),zo(t,{}),Co(t,{skipIfEffect:!0}),Zt(t),Uo(t),Ko(t),Yo(t,{}),ko(t),$("Create",t,{}),$("Complete",t,{}),$("Render",t,{}),$("RenderRouter",t,{}),Kt(t,{})}},{depth:o.path.length,label:P(o,"if")});o.__effects.push(r)}function Ct(t,o){const s=t.node;if(!s)return;const e=o==null||typeof o=="object"?"":String(o);if(t.tag==="string"){s.nodeValue!==e&&(s.nodeValue=e);return}const r=t.__ref;let i=r?r.__textNode:null;if(i&&i.parentNode!==s&&(i=null),!i){const a=s.firstChild;a&&a.nodeType===3&&(i=a)}i?i.nodeValue!==e&&(i.nodeValue=e):s.firstChild?(i=(s.ownerDocument||t.context?.document||globalThis.document).createTextNode(e),s.insertBefore(i,s.firstChild)):(s.textContent=e,i=s.firstChild&&s.firstChild.nodeType===3?s.firstChild:null),r&&(r.__textNode=i||null)}function jo(t,o){const s=t.node;if(!s||!("value"in s))return;const e=o==null?"":String(o);if(s.value===e)return;const r=typeof document<"u"&&document.activeElement===s,i=r&&typeof s.selectionStart=="number"?s.selectionStart:null,a=r&&typeof s.selectionEnd=="number"?s.selectionEnd:null;if(s.value=e,r&&i!=null&&a!=null)try{s.setSelectionRange(i,a)}catch{}const f=t.__ref&&t.__ref.__autoGrow;f&&f.active&&f.resize()}function Zt(t){const{node:o}=t;if(o){if((typeof t.text=="string"&&!t.text.includes("{{")||typeof t.text=="number")&&Ct(t,t.text),Io(t),typeof t.html=="string"&&(o.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&!(typeof t.value=="string"&&t.value.includes("{{"))&&"value"in o){const s=String(t.value);o.value!==s&&(o.value=s)}if(t.style&&typeof t.style=="object"){let s=t.style;for(const e in t.style)if(typeof t.style[e]=="function"){s={};for(const r in t.style)typeof t.style[r]!="function"&&(s[r]=t.style[r]);break}tt(o,s)}if(t.attr&&typeof t.attr=="object")for(const s in t.attr){const e=t.attr[s];typeof e=="function"||typeof e=="object"||e!=null&&(typeof e=="string"&&e.includes("{{")||e===!1&&!(0,v.isEnumeratedTrueFalseAttr)(s)||o.setAttribute&&o.setAttribute(s,(0,v.serializeAttrValue)(s,e)))}if(typeof t.themeModifier=="string"&&t.themeModifier&&o.setAttribute&&o.setAttribute("data-theme",t.themeModifier),t.data&&typeof t.data=="object")for(const s in t.data){const e=t.data[s];typeof e=="function"||typeof e=="object"||e==null||e===!1||typeof e=="string"&&e.includes("{{")||o.dataset&&(o.dataset[s]=e===!0?"":e)}if(t.classlist||t.class){const s=t.classlist||t.class;if(typeof s=="string")s.split(" ").forEach(e=>e&&o.classList.add(e));else if(typeof s=="object")for(const e in s){const r=typeof s[e]=="function"?s[e](t,t.state,t.context):s[e];r&&o.classList.add(typeof r=="string"?r:e)}}}}function Ot(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function Ns(t){if(!t||typeof t!="object")return!1;for(const o in t){const s=t[o];if(s&&typeof s=="object"&&!Array.isArray(s))return!0}return!1}function Lt(t,o){if(!t||!t.style||!o)return null;const s=t.style,e=[];for(const r in o){if(o[r]==null||r.charAt(0)==="&")continue;const a=Dt(r);e.push(a,Qt(s,a),Eo(s,a))}return e}function Qt(t,o){return typeof t.getPropertyValue=="function"?t.getPropertyValue(o):""}function Eo(t,o){return typeof t.getPropertyPriority=="function"?t.getPropertyPriority(o):""}function Dt(t){return Mt(t)?t:t.replace(/[A-Z]/g,o=>"-"+o.toLowerCase())}function Fs(t,o,s){if(!t||!t.style||!o||!o.length)return;const e=t.style,r=new Set;if(s&&typeof s=="object")for(const i in s)s[i]==null||i.charAt(0)==="&"||r.add(Dt(i));for(let i=0;i<o.length;i+=3){const a=o[i];r.has(a)||Qt(e,a)===o[i+1]&&typeof e.removeProperty=="function"&&e.removeProperty(a)}}function Rt(t,o){if(!o||!t||!t.style)return!1;const s=t.style;for(let e=0;e<o.length;e+=3)if(Qt(s,o[e])!==o[e+1]||Eo(s,o[e])!==o[e+2])return!1;return!0}const Mt=t=>t.charCodeAt(0)===45&&t.charCodeAt(1)===45;function $s(t){let o=null;for(const s in t)t[s]!=null&&s.charAt(0)!=="&"&&(o||(o=new Set),o.add(Dt(s)));return o}function Is(t,o,s,e){const r=t.__ref;if(!r)return;let i=null;if(s)for(const a of s){if(e&&e.has(a))continue;const f=o[a];if(f==null||typeof f=="object")continue;const n=Dt(a);eo.CSS_LONGHAND_SHORTHANDS[n]&&(i||(i={}),i[n]=f)}r.__declaredLonghands=i}function Po(t,o){const s=t.__ref,e=s&&s.__declaredLonghands;if(!e||!o)return null;let r=null;for(const i in e){if(o.has(i))continue;const a=eo.CSS_LONGHAND_SHORTHANDS[i];let f=!1;for(let n=0;n<a.length;n++)if(o.has(a[n])){f=!0;break}f&&(r||(r={}),r[i]=e[i])}return r}function To(t,o){const s=t.node;tt(s,o);const e=$s(o);if(!e)return o;const r=t.__ref;if(r)if(r.__inlineCssKeys)for(const a of e)r.__inlineCssKeys.add(a);else r.__inlineCssKeys=new Set(e);const i=Po(t,e);return i?(tt(s,i),Object.assign({},o,i)):o}function Us(t){const o=t.__ref;if(!o||!o.__inlineCssKeys||!o.__declaredLonghands)return;const s=Po(t,o.__inlineCssKeys);s&&tt(t.node,s)}function tt(t,o){if(!t||!o||!t.style)return;let s=null;for(const e in o){const r=o[e];if(r!=null){if(e.charAt(0)==="&"&&typeof r=="object"){s||(s={}),s[e]=r;continue}try{const i=String(r),a=Mt(e)?e:e.replace(/[A-Z]/g,y=>"-"+y.toLowerCase()),f=i.trim(),n=/\s*!important\s*$/.test(f),d=f.replace(/\s*!important\s*$/,"");t.style.setProperty(a,d,n?"important":"")}catch{}}}s&&Vs(t,s)}function Vs(t,o){const s=`_ds${fo.scopedStyleId++}`;t.classList.add(s);const e=t.ownerDocument;let r=e.querySelector("style[data-smbls-scoped]");r||(r=e.createElement("style"),r.setAttribute("data-smbls-scoped",""),e.head.appendChild(r));let i="";for(const a in o){const f="."+s,n=a.replace(/&/g,f).split(",").map(y=>{const p=y.trim();return p.includes(f)?p:f+p}).join(", "),d=o[a];if(typeof d=="object"){let y="",p="";for(const h in d){const _=d[h];if(typeof _=="object"){const c=h.includes("&")?n.split(", ").map(l=>h.replace(/&/g,l)).join(", "):n.split(", ").map(l=>`${l} ${h}`).join(", ");let u="";for(const l in _)u+=`${l.replace(/[A-Z]/g,g=>"-"+g.toLowerCase())}: ${_[l]};`;p+=(0,X.wrapHoverRule)(`${c} { ${u} }`,c)+`
|
|
5
|
+
`}else y+=`${h.replace(/[A-Z]/g,c=>"-"+c.toLowerCase())}: ${_};`}y&&(i+=(0,X.wrapHoverRule)(`${n} { ${y} }`,n)+`
|
|
6
|
+
`),p&&(i+=p)}}i&&(r.textContent+=i)}const Oo=new Set;function Lo(t){if(!Array.isArray(t))return"";const o=[];for(let s=0;s<t.length;s++)typeof t[s]=="string"&&t[s].length&&o.push(t[s]);return o.sort(),o.join("|")}function Bs(t,o,s){const e=Lo(s);queueMicrotask(()=>{if(!t.__ref)return;let r;try{r=o(t,t.state,t.context)}catch{return}if(Lo(r)===e)return;const i=t.__ref.path?t.__ref.path.join("."):t.key||"?";Oo.has(i)||(Oo.add(i),console.warn(`[smbls] subscribeTo function at "${i}" resolved to a DIFFERENT key list one microtask after create \u2014 wired [${s.join(", ")||"(none)"}], probed [${Array.isArray(r)?r.join(", "):String(r)}]. subscribeTo's function form is resolved ONCE at element-create time (registerSubscribeToEffects, @symbo.ls/element create.js) \u2014 this element stays wired to the ORIGINAL list for its whole lifetime, so this drift is invisible to the reactive effect and any key only present in the new list will never trigger onUpdate. If the watched key genuinely is not known until later (e.g. a module config that loads after shell boot), route the write through an imperative call instead of subscribeTo \u2014 see functions/moduleOpenBridge.js's moduleOpenPage (workspace repo) for the house pattern.`))})}function Gs(t){const o=t.subscribeTo,s=typeof o=="function";let e=o;if(s)try{e=o(t,t.state,t.context)}catch{e=null}if(s&&(0,st.isLoudDevRuntime)()&&Bs(t,o,Array.isArray(e)?e:[]),!Array.isArray(e)||e.length===0)return;const r=t.__ref;for(let i=0;i<e.length;i++){const a=e[i];if(typeof a!="string"||a.length===0)continue;const f=a.split("."),n=f[0],d=f.slice(1),y={value:!1},p=(0,k.createEffect)(()=>{const h=t.state&&((0,N.isStore)(t.state)?t.state.root:null);if(!h||!(0,N.isStore)(h))return;let _=h;_=_[n];for(let u=0;u<d.length&&!(_==null||typeof _!="object");u++)if((0,N.isStore)(_))_=_[d[u]];else break;if(!y.value)return;let c=!1;if(typeof t.onBeforeUpdate=="function"){const u=t.context?.designSystem;u&&(0,j.pushConfig)(u);try{if(mo(r)){const l=t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0});l&&typeof l.then=="function"?l.then(()=>kt(r,!1),g=>{kt(r,!0),t.context?.plugins?.length&&(0,z.runPluginHook)("error",t,{hook:"onBeforeUpdate",error:g})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",g)}):(kt(r,!1),l===!1&&(c=!0))}}catch(l){kt(r,!0),t.context?.plugins?.length&&(0,z.runPluginHook)("error",t,{hook:"onBeforeUpdate",error:l})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",l)}finally{u&&(0,j.popConfig)()}}if(!c&&t.node&&r.__effects)for(let u=0;u<r.__effects.length;u++){const l=r.__effects[u];l&&l!==p&&!l._disposed&&!l._isSubscribeToEffect&&typeof l._execute=="function"&&l._execute()}if(!c&&typeof t.onUpdate=="function"){const u=t.context?.designSystem;u&&(0,j.pushConfig)(u);try{t.onUpdate(t,t.state,t.context)}catch(l){t.context?.plugins?.length&&(0,z.runPluginHook)("error",t,{hook:"onUpdate",error:l})||console.error("[DOMQL] subscribeTo onUpdate error:",l)}finally{u&&(0,j.popConfig)()}}},{depth:r.path.length,label:P(r,"subscribeTo("+a+")")});y.value=!0,p._isSubscribeToEffect=!0,r.__effects.push(p)}}function Xt(t,o){return t.charCodeAt(0)===64&&t.length>1&&!t.startsWith("@media")&&!t.startsWith("@keyframes")&&!t.startsWith("@supports")&&!t.startsWith("@container")&&(t==="@dark"||t==="@light"||!o.context?.designSystem?.media?.[t.slice(1)])}function Jt(t,o){if(t.charCodeAt(0)!==64||/^@(media|supports|container|keyframes)\b/.test(t))return t;const s=o.context?.designSystem?.media?.[t.slice(1)];return s?/^@(media|supports|container)\b/.test(s)?s:`@media ${s}`:t}const Do=new Set;function Hs(t,o){const s=o?.__ref?.path?o.__ref.path.join("."):o?.key||"?",e=s+"::"+t;Do.has(e)||(Do.add(e),console.warn(`[smbls/css] "${t}" at ${s} 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 at(t,o,s,e){const r={},i=new Set,a=(f,n,d)=>{const y=d?new Set(Object.keys(r)):null;if(C.CSS_PROPS_REGISTRY[f]){const p=C.CSS_PROPS_REGISTRY[f](n,o,o.state,o.context);if(p){const h=Array.isArray(p)?p:[p];for(const _ of h)_&&Object.assign(r,_)}}else r[f]=n;if(d)for(const p in r)y.has(p)||i.add(p)};for(const f in t){if(!Object.prototype.hasOwnProperty.call(t,f))continue;let n=t[f];if(typeof n=="function"&&(n=n(o,o.state,o.context)),n==null||typeof n=="function")continue;if(typeof n=="object"&&!Array.isArray(n)){if(f==="style"){for(const _ in n){let c=n[_];if(typeof c=="function"&&(c=c(o,o.state,o.context)),c==null||typeof c=="function")continue;const u=typeof o[_]=="function"&&(C.CSS_PROPS_REGISTRY[_]||C.DEFAULT_CSS_PROPERTIES_LIST&&C.DEFAULT_CSS_PROPERTIES_LIST.has(_))||!!(e&&e.has(_));a(_,c,u)}continue}if(Xt(f,o)){const _=at(n,o,!1,e);Object.keys(_).length&&(r[`[data-theme="${f.slice(1)}"] &`]=_);continue}if(/^[A-Z][A-Za-z0-9]*$/.test(f)){(0,st.isLoudDevRuntime)()&&Hs(f,o);continue}const p=Jt(f,o),h=at(n,o,!1,e);Object.keys(h).length&&(r[p]=h);continue}const d=typeof o[f]=="function"&&(C.CSS_PROPS_REGISTRY[f]||C.DEFAULT_CSS_PROPERTIES_LIST&&C.DEFAULT_CSS_PROPERTIES_LIST.has(f)),y=!!(e&&e.has(f));a(f,n,d||y)}if(s)for(const f in r)i.add(f);for(const f of i){const n=r[f];typeof n=="string"&&!n.includes("!important")&&(r[f]=n+" !important")}return r}const Nt=t=>!!t&&typeof t=="object"&&!Array.isArray(t);function Ro(t,o){for(const s in o){const e=o[s];t[s]=Nt(e)?Ro(Nt(t[s])?t[s]:{},e):e}return t}function Ks(t,o){if(!Nt(o))return;let s;for(const e of t.split(" ")){const r=e?o[e]:null;Nt(r)&&(s=Ro(s||{},r))}return s}function mt(t,o){if(o===void 0&&(o=0),o>8)return!1;if(typeof t=="function")return!0;if(t&&typeof t=="object"&&!Array.isArray(t)){for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&mt(t[s],o+1))return!0}return!1}function Mo(t,o,s){if(!o||typeof o!="object"||Array.isArray(o))return null;if(Xt(t,s)){const i=at(o,s,!1);return Object.keys(i).length?{cssProp:`[data-theme="${t.slice(1)}"] &`,block:i}:null}const e=Jt(t,s),r=at(o,s,!1);return Object.keys(r).length?{cssProp:e,block:r}:null}function Ws(t){const o=t.__ref;for(const s of Object.keys(t)){if(!Wt(s))continue;const e=t[s];if(!e||typeof e!="object"||Array.isArray(e)||!mt(e))continue;let r=null,i;const a=(0,k.createEffect)(()=>{if(!t.node)return;const f=t.context?.designSystem;f&&(0,j.pushConfig)(f);let n,d=!1;try{const y=Mo(s,e,t),p=y?Ot(y.block)+"::"+y.cssProp:null;if(p!==null&&p===i)d=!0;else if(i=p,y){const h=(0,X.css)({[y.cssProp]:y.block},null,t.context?.cssPrefix);n=h?h.split(" ").filter(Boolean):null}else n=null}finally{f&&(0,j.popConfig)()}if(!(d||!t.node.classList)){if(r)for(const y of r)t.node.classList.remove(y);if(n&&n.length)for(const y of n)t.node.classList.add(y);r=n}},{depth:o.path.length,label:P(o,"cssBlock("+s+")")});o.__effects.push(a)}}function zs(t){const o=t.__ref;o.__conditionalRunners=[];const s=new Map;for(const e of Object.keys(t)){const r=e.charAt(0);if(r!=="."&&r!=="!")continue;const i=e.slice(1);if(!i)continue;if(/[:@\s>~+[\]]/.test(i)){if(typeof console<"u"&&console.warn){const c=i.split(/[:@\s>~+[\]]/)[0];console.warn(`[smbls] conditional \`${e}\` on ${t.key||"?"} will never match \u2014 the whole string after \`${r}\` is read as one prop name. Nest the selector inside instead: \`${r}${c}: { '${i.slice(c.length)}': {...} }\`.`)}continue}const a=t[e];if(!a||typeof a!="object")continue;const f=r==="!",n={lastMatch:!1,appliedKeys:null,appliedClasses:null},d=new Set;for(const c in a){if(!Object.prototype.hasOwnProperty.call(a,c))continue;const u=c.charAt(0),l=a[c];(u===":"||u==="@"||u==="&"||u==="[")&&l&&typeof l=="object"&&!Array.isArray(l)||d.add(c)}const y=()=>{let c;const u=t[i];if(u===void 0){const b=!!t.state&&i in t.state,A=t.state?t.state[i]:void 0;if(b||A!==void 0)c=A;else{const x=t.context?.cases?.[i];if(x===void 0)return;try{c=typeof x=="function"?x.call(t,t):x}catch(S){c=!1,o.__conditionalError=S,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${e}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,S?.message||S)}}}else if(typeof u=="function")try{c=u(t,t.state,t.context)}catch(b){c=!1,o.__conditionalError=b,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${e}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,b?.message||b)}else c=u;const l=f?!c:!!c;if(!t.node||l===n.lastMatch)return;n.lastMatch=l;const g=t.context?.designSystem;g&&(0,j.pushConfig)(g);try{if(l){const b={},A={};let x=!1;for(const w in a){if(!Object.prototype.hasOwnProperty.call(a,w))continue;const E=a[w],T=w.charAt(0);if((T===":"||T==="@"||T==="&"||T==="[")&&E&&typeof E=="object"&&!Array.isArray(E)){if(Xt(w,t)){const K=at(E,t,!1,d);Object.keys(K).length&&(A[`[data-theme="${w.slice(1)}"] &`]=K,x=!0)}else{const K=Jt(w,t),et=at(E,t,!1,d);Object.keys(et).length&&(A[K]=et,x=!0)}continue}const Y=typeof E=="function"?E(t,t.state,t.context):E;if(Y!=null)if(C.CSS_PROPS_REGISTRY[w]){const K=C.CSS_PROPS_REGISTRY[w](Y,t,t.state,t.context);if(K){const et=Array.isArray(K)?K:[K];for(const I of et)I&&Object.assign(b,I)}}else(C.DEFAULT_CSS_PROPERTIES_LIST&&C.DEFAULT_CSS_PROPERTIES_LIST.has(w)||Mt(w))&&(b[w]=Y)}const S=Object.keys(b);if(S.length){tt(t.node,b);for(const w of S)s.set(w,e);n.appliedKeys=S}else n.appliedKeys=null;if(x){const w=(0,X.css)(A,null,t.context?.cssPrefix,{state:!0}),E=w?w.split(" ").filter(Boolean):[];if(E.length&&t.node.classList){for(const T of E)t.node.classList.add(T);n.appliedClasses=E}else n.appliedClasses=null}else if(n.appliedClasses){for(const w of n.appliedClasses)t.node.classList.remove(w);n.appliedClasses=null}}else{if(n.appliedKeys){for(const b of n.appliedKeys)s.get(b)===e&&(Mt(b)?t.node.style.removeProperty(b):t.node.style[b]="",s.delete(b));n.appliedKeys=null}if(n.appliedClasses){for(const b of n.appliedClasses)t.node.classList.remove(b);n.appliedClasses=null}}}finally{g&&(0,j.popConfig)()}};o.__conditionalRunners.push(y);const p=D(t,t[i+"Deps"],y),h=(0,k.createEffect)(p,{depth:o.path.length,label:P(o,"conditional("+e+")")}),_=o.__exec&&o.__exec[i]||t[i];h._sources.size===0&&typeof _=="function"&&(0,st.isLoudDevRuntime)()&&console.warn(`[smbls] conditional \`${e}\` on ${t.key||"?"} subscribed to nothing \u2014 its predicate tracked no reactive read on its first run, so no state write will ever re-evaluate it (only a direct element.update() on this element re-runs it). If the predicate guards its state reads (\`in\`, short-circuits, \`?.\`), declare \`${i}Deps: [...]\` (state-key strings or \`(el, s) => \u2026\` selectors) so the subscription is armed unconditionally.`),o.__effects.push(h)}}const to=new WeakSet;function Ys(t){const o=t.ownerDocument;!o||to.has(o)||(to.add(o),queueMicrotask(()=>{to.delete(o);const s=o.body||o.documentElement;s&&s.offsetWidth}))}const oo=new WeakSet;let No=!1;function Fo(t){return t.startsWith("[data-theme=")||t.startsWith("@media")&&t.includes("prefers-color-scheme")}function so(t,o){const s={...t};for(const e in o){const r=o[e],i=s[e];s[e]=r&&typeof r=="object"&&i&&typeof i=="object"?so(i,r):r}return s}function $o(t,o){const s={};for(const e in t){const r=t[e];if(r&&typeof r=="object"){const i=$o(r,o);Object.keys(i).length&&(s[e]=i)}else o.has(e)||(s[e]=r)}return s}function Io(t){const{node:o}=t;if(!o)return;if(No||(No=!0,(0,X.css)({display:"none"})),oo.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}oo.add(t);const s=t.context?.designSystem;s&&(0,j.pushConfig)(s),(0,C.pushStaticCssPass)();try{const e={};let r=!1,i=[],a=null,f=null,n=null;const d=(c,u)=>{if(u&&typeof u=="object"&&Fo(c)){f||(f={});const l=f[c];l&&(u=so(l,u)),f[c]=u}else(u===null||typeof u!="object")&&(n||(n=new Set),n.add(c));e[c]=u};if(Object.prototype.hasOwnProperty.call(t,"theme")&&typeof t.theme!="function"&&C.CSS_PROPS_REGISTRY.theme){const c=C.CSS_PROPS_REGISTRY.theme(t.theme,t,t.state,t.context);if(c){const u=l=>{for(const g in l){const b=l[g];b&&typeof b=="object"&&Fo(g)&&(a||(a={}),a[g]=b),e[g]=b}};if(Array.isArray(c))for(const l of c)l&&u(l);else u(c);r=!0}}const y=(c,u)=>{if(C.CSS_PROPS_REGISTRY[c]){const l=C.CSS_PROPS_REGISTRY[c](u,t,t.state,t.context);if(l){if(Array.isArray(l)){for(const g of l)if(g)for(const b in g)d(b,g[b])}else for(const g in l)d(g,l[g]);r=!0}}else if(C.DEFAULT_CSS_PROPERTIES_LIST&&C.DEFAULT_CSS_PROPERTIES_LIST.has(c))u!=null&&typeof u!="object"&&(d(c,u),r=!0);else if(c.charCodeAt(0)===45)u!=null&&typeof u!="object"&&(d(c,u),r=!0);else if((c.charAt(0)==="&"||c.charAt(0)==="@"||c.charAt(0)===":"||c.charAt(0)==="[")&&u&&typeof u=="object"&&!Array.isArray(u)){if(mt(u))return;const l=Mo(c,u,t);l&&(d(l.cssProp,l.block),r=!0)}};if(typeof t.class=="string"){const c=Ks(t.class,t.context?.designSystem?.class);if(c)for(const u in c)y(u,c[u])}const p=n?new Set(n):null,h=t.tag||"div";for(const c of Object.keys(t)){if(typeof t[c]=="function"||U.REGISTRY.has(c)||c==="theme")continue;const u=c.charCodeAt(0);u>=65&&u<=90||Z(c)||(0,J.isAttributeFirst)(h,c)||y(c,t[c])}if(a)for(const c in a){let u=n?$o(a[c],n):a[c];f&&f[c]&&(u=so(u,f[c])),Object.keys(u).length?e[c]=u:delete e[c]}if(Is(t,e,n,p),r){e.display&&String(e.display).includes("!important")&&(o.style.setProperty("display",String(e.display).replace(/\s*!important\s*$/,""),"important"),delete e.display);const c=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;typeof c=="string"&&c!==""&&e.display&&e.display!==c&&(e.display=c);const u=(0,X.css)(e,null,t.context?.cssPrefix);if(i=u?u.split(" ").filter(Boolean):[],u&&o.classList){const l=i;let g=!1;for(const b of l)o.classList.add(b),g||(b.charCodeAt(0)===95&&b.charCodeAt(1)===99||b.charCodeAt(0)===95&&b.indexOf("_c",1)!==-1)&&(g=!0);g&&Ys(o)}}const _=t.__ref;if(_){const c=_.__staticCssClasses;if(c&&o.classList){const u=new Set(i);for(const l of c)u.has(l)||o.classList.remove(l)}_.__staticCssClasses=i}Us(t)}finally{(0,C.popStaticCssPass)(),s&&(0,j.popConfig)(),oo.delete(t)}}const qs=t=>!!C.CSS_PROPS_REGISTRY[t]||!!(C.DEFAULT_CSS_PROPERTIES_LIST&&C.DEFAULT_CSS_PROPERTIES_LIST.has(t))||typeof t=="string"&&t.charCodeAt(0)===45;function Zs(t){t&&t.node&&Io(t)}function Uo(t){const{node:o}=t;if(!o||!o.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const r in t.aria){const i=t.aria[r];if(typeof i=="function"||typeof i=="object"||i==null||typeof i=="string"&&i.includes("{{"))continue;const a="aria-"+r.replace(/[A-Z]/g,f=>"-"+f.toLowerCase());o.setAttribute(a,(0,v.serializeAttrValue)(a,i))}const s=(0,v.applyAttrTransforms)(t);for(const r in s){const i=s[r];i!=null&&i!==!1&&typeof i!="function"&&typeof i!="object"&&o.setAttribute(r,i===!0?"":i)}const e=t.tag||"div";for(const r of Object.keys(t)){if(typeof t[r]=="function"||U.REGISTRY.has(r)||r==="on"||s[r]!==void 0)continue;const i=r.charCodeAt(0);if(!(i>=65&&i<=90)&&!Z(r)&&!(0,J.isCssProp)(e,r)&&(0,v.checkAttributeByTagName)(e,r)){let a=t[r];if(a==null)continue;if(typeof a=="string"&&a.includes("{{")){if(!v.ATTR_TRANSFORMS[r])continue;a=R.replaceLiteralsWithObjectFields.call(t,a,t.state)}if(a==null||typeof a=="function"||typeof a=="object"||a===!1&&!(0,v.isEnumeratedTrueFalseAttr)((0,v.camelToAttr)(r)||r))continue;const f=(0,v.camelToAttr)(r)||r;o.setAttribute(f,(0,v.serializeAttrValue)(f,a))}}}function Qs(t,o){const{node:s}=t;if(!s||!s.setAttribute)return;const e=o.charCodeAt(0);if(e>=65&&e<=90||Z(o))return;const r=t.tag||"div";if((0,J.isCssProp)(r,o)||!(0,v.checkAttributeByTagName)(r,o))return;const i=(0,v.camelToAttr)(o)||o,a=i.toLowerCase(),f=t.__ref&&t.__ref.__effects;let n=!1;if(f)for(let p=0;p<f.length;p++){const h=f[p];h&&h._attrName===a&&!h._disposed&&typeof h._execute=="function"&&(n=!0,h._execute())}if(n)return;let d=t[o];const y=v.ATTR_TRANSFORMS[o];if(y&&d!=null){const p=y(t);p!==void 0&&(d=p)}typeof d=="string"&&d.includes("{{")&&(d=R.replaceLiteralsWithObjectFields.call(t,d,t.state)),d==null||d===!1&&!(0,v.isEnumeratedTrueFalseAttr)(i)?s.removeAttribute(i):typeof d!="function"&&typeof d!="object"&&s.setAttribute(i,(0,v.serializeAttrValue)(i,d))}function Xs(t,o){const s=t.node,e=t.__ref;let r=e.__autoGrow;if(!o){if(r&&r.active){try{s.removeEventListener("input",r.resize)}catch{}Bo(r),m.delete(t),s.style.height="",r.appliedMax!=null&&s.style.maxHeight===r.appliedMax&&(s.style.maxHeight=""),Go(s,r,!1),r.active=!1,r.appliedMax=null,r.lastMeasure=0}return}r||(r=e.__autoGrow={active:!1,appliedMax:null,lastMeasure:0,lastWidth:null,watch:null,awaitingLayout:!1,appliedScroll:!1,fontsHooked:!1,attachAttempts:0,firstAttemptAt:null,resize:()=>{if(!s.isConnected){St(t,!0);return}if(!(s.scrollHeight>0)){r.awaitingLayout=!0,Vo(t,r);return}r.awaitingLayout=!1;const a=s.style.height;s.style.height="0px";const f=s.scrollHeight;if(!(f>0)){s.style.height=a;return}const n=tn(s),d=n!=null&&f>n;s.style.height=(d?n:f)+"px",Go(s,r,d),r.lastMeasure=f,r.lastWidth=s.clientWidth,Vo(t,r)}},e.__eventCleanup||(e.__eventCleanup=[]),e.__eventCleanup.push(()=>{try{s.removeEventListener("input",r.resize)}catch{}Bo(r),m.delete(t)})),r.active||(s.addEventListener("input",r.resize),r.active=!0,ms(t,r));const i=typeof o=="object"&&o.max!=null?String(o.max):null;i!==r.appliedMax&&(i==null?r.appliedMax!=null&&s.style.maxHeight===r.appliedMax&&(s.style.maxHeight=""):s.style.maxHeight=i,r.appliedMax=i),r.resize()}function St(t,o){const s=t.__ref?.__autoGrow;s&&(o&&(s.attachAttempts=0,s.firstAttemptAt=null),m.add(t),Pt())}function Js(){const t=Array.from(m);m.clear();for(let o=0;o<t.length;o++){const s=t[o],e=s.node,r=s.__ref?.__autoGrow;if(!(!e||!r||!r.active)){if(!e.isConnected){r.firstAttemptAt==null&&(r.firstAttemptAt=ct()),r.attachAttempts+=1,r.attachAttempts<=lo&&ct()-r.firstAttemptAt<po&&(m.add(s),Pt());continue}r.attachAttempts=0,r.firstAttemptAt=null,r.resize()}}}function Vo(t,o){if(o.watch)return;const s=t.node;if(!s)return;const e=s.ownerDocument&&s.ownerDocument.defaultView,r=e&&e.ResizeObserver||(typeof ResizeObserver=="function"?ResizeObserver:null);if(typeof r!="function")return;const i=()=>{if(!o.active||!s.isConnected||!(s.scrollHeight>0))return;if(o.awaitingLayout){o.awaitingLayout=!1,St(t,!0);return}const f=s.clientWidth;o.lastWidth!=null&&Math.abs(f-o.lastWidth)<.5||(o.lastWidth=f,St(t,!0))};let a;try{a=new r(i),a.observe(s)}catch{return}o.watch=a}function Bo(t){const o=t.watch;if(o){t.watch=null;try{o.disconnect()}catch{}}}function ms(t,o){if(o.fontsHooked)return;o.fontsHooked=!0;const s=t.node&&t.node.ownerDocument,e=s&&s.fonts&&s.fonts.ready;!e||typeof e.then!="function"||e.then(()=>{o.active&&t.node&&St(t,!0)},()=>{})}function tn(t){const o=t.ownerDocument&&t.ownerDocument.defaultView;let s;try{s=o&&o.getComputedStyle?o.getComputedStyle(t):null}catch{s=null}if(!s)return null;const e=y=>typeof y=="string"&&/^\s*-?\d*\.?\d+px\s*$/.test(y)?parseFloat(y):null,r=e(s.maxHeight);if(r==null||!(r>0))return null;const i=(e(s.paddingTop)||0)+(e(s.paddingBottom)||0),a=(e(s.borderTopWidth)||0)+(e(s.borderBottomWidth)||0),f=s.boxSizing==="border-box"?r-a:r+i,n=e(s.lineHeight);if(!(n>0))return f;const d=Math.floor((f-i)/n+1e-6);return d>=1?d*n+i:f}function Go(t,o,s){s?o.appliedScroll||(t.style.overflowY="auto",o.appliedScroll=!0):o.appliedScroll&&(t.style.overflowY==="auto"&&(t.style.overflowY=""),o.appliedScroll=!1)}const Ho=["srcObject","muted"],on=(t,o)=>t==="muted"?o===!0||o===""||o==="true"||o==="muted":o??null;function sn(t){const o=t.node,s=t.__ref;if(!(!o||!s))for(let e=0;e<Ho.length;e++){const r=Ho[e],i=t[r];if(i===void 0||!(r in o))continue;const a=f=>{const n=on(r,f);if(o[r]!==n)try{o[r]=n}catch(d){M(s,r,d)}};if(typeof i=="function"){const f=D(t,t[r+"Deps"],i),n=(0,k.createEffect)(()=>{try{a(f(t,t.state,t.context))}catch(d){M(s,r,d)}},{depth:s.path.length,label:P(s,r)});s.__effects.push(n),s.__exec[r]=i}else a(i);r==="srcObject"&&(s.__releaseMedia=()=>{try{o.srcObject!=null&&(o.srcObject=null)}catch{}})}}function Ko(t){if(!t.autoGrow)return;const o=t.node;if(!o||o.tagName!=="TEXTAREA")return;const s=t.__ref,e=t.autoGrow,r=typeof e=="function"?D(t,t.autoGrowDeps,e):null,i=(0,k.createEffect)(()=>{const a=t.autoGrow;let f=a;if(typeof a=="function")try{f=(a===e&&r?r:a)(t,t.state,t.context)}catch{f=null}Xs(t,f)},{depth:s.path.length,label:P(s,"autoGrow")});s.__effects||(s.__effects=[]),s.__effects.push(i),r&&(s.__exec.autoGrow=e)}const Wo=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function zo(t,o){for(const s of Object.keys(t)){if(!Z(s)||Wo.has(s))continue;const e=(0,dt.globalEventKeyInfo)(s);if(e){(0,dt.registerGlobalEvent)(e,t,t[s]);continue}let r=t[s];if(typeof r=="string"&&/^[A-Za-z_$][\w$]*$/.test(r)){const a=r;r=function(n){return t.call(a,n)}}if(typeof r!="function")continue;const i=gs(s);U.LIFECYCLE_EVENTS.has(i)||(0,dt.registerEvent)(bs(i),t,r)}nn(t)}function nn(t){const o=t.node;if(!o||!o.addEventListener)return;const s={};let e=!1;for(const h of Wo){const _=t[h];typeof _=="function"&&(s[h]=_,e=!0)}if(!e)return;const r=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,i=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let a=0,f=0,n=0,d=!1;const y=h=>{const _=h.touches&&h.touches[0]||h.changedTouches&&h.changedTouches[0];_&&(a=_.clientX,f=_.clientY,n=Date.now(),d=!0)},p=h=>{if(!d)return;d=!1;const _=h.changedTouches&&h.changedTouches[0]||h.touches&&h.touches[0];if(!_)return;const c=_.clientX-a,u=_.clientY-f,l=Date.now()-n;if(l>i)return;const g=Math.abs(c),b=Math.abs(u);if(Math.max(g,b)<r)return;let A;if(g>b*1.2)A=c<0?"left":"right";else if(b>g*1.2)A=u<0?"up":"down";else return;const x="onSwipe"+A.charAt(0).toUpperCase()+A.slice(1),S=s[x],w=s.onSwipe;S&&S.call(t,h,t,t.state,t.context),w&&w.call(t,{direction:A,dx:c,dy:u,dt:l,event:h},t,t.state,t.context)};o.addEventListener("touchstart",y,{passive:!0}),o.addEventListener("touchend",p,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{o.removeEventListener("touchstart",y)}catch{}try{o.removeEventListener("touchend",p)}catch{}})}function ot(t,o){const s={...t};for(const e in o){const r=s[e],i=o[e];r&&i&&typeof r=="object"&&typeof i=="object"&&!Array.isArray(r)&&!Array.isArray(i)&&typeof r!="function"&&typeof i!="function"?s[e]=ot(r,i):s[e]=i}return s}function no(t,o,s,e,r){if(!o||!t.node)return;const i=t.childExtends,a=ft(t,"childProps");if(Array.isArray(o)){const f=t.tag==="fragment",n=t.context?.document||globalThis.document,d=f?null:n?.createDocumentFragment();if(!f&&!d)return;const y=t.childProps,p=t.childrenAs,h=b=>{let A=o[b];const x=A;(typeof A=="string"||typeof A=="number")&&(A={text:A});let S=y;if(typeof y=="function")try{S=y(t,A)}catch{S=null}let w=typeof y=="function"?At(S):a;if(r&&p!=="state"&&(w=xt(w,At(x))),p==="state"){let T=x;(typeof x=="string"||typeof x=="number")&&(T={value:x,text:x}),A=S?{...S,state:T}:{state:T}}else S&&(A=ot(S,A));if(i&&!A.ignoreChildExtends)if(A.extends){const T=Array.isArray(A.extends)?A.extends:[A.extends],Y=Array.isArray(i)?i:[i];A={...A,extends:[...Y,...T]}}else A={...A,extends:i};const E=yo(A?.key,x,b);try{return Q(wt(A,w),t,E,s)}catch(T){if(typeof console<"u"&&console.error){const Y=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${E}" failed to construct at ${Y} (initial render, skipping this row):`,T?.message||T)}return null}},_=t.__ref;if(!(e===!0&&!f&&!!_&&(s?.mountYield===!0||t.yieldChildren===!0))){for(let b=0;b<o.length;b++){const A=h(b);!f&&A?.node&&d.appendChild(A.node)}return f||t.node.appendChild(d),!0}const u=_.__childrenChunkGen=(_.__childrenChunkGen||0)+1;(0,B.openMountBudget)();let l=null;const g=b=>{if(_.__disposed||_.__childrenChunkGen!==u){l&&l.parentNode&&l.remove();return}for(let A=b;A<o.length;A++){const x=h(A);if(x?.node&&(l?t.node.insertBefore(x.node,l):d.appendChild(x.node)),A+1<o.length&&(0,B.mountBudgetExhausted)()){l||(l=n.createComment("smbls-mount"),d.appendChild(l),t.node.appendChild(d));const S=A+1;(0,B.enqueueMountWork)(()=>g(S));return}}l?(l.remove(),t.node.tagName==="SELECT"&&Ft(t,!0)):t.node.appendChild(d)};return g(0),(0,B.closeMountBudget)(),!0}if(typeof o=="string"){const f=go(o,t);if(Array.isArray(f))return no(t,f,s,e,!0)}if(typeof o=="object")for(const f in o){if(U.REGISTRY.has(f))continue;let n=o[f];if(n==null||n===!1)continue;const d=r?xt(a,At(n)):a;if((typeof n=="string"||typeof n=="number")&&(n={text:n}),t.childProps&&(n=ot(t.childProps,n)),i&&!n.ignoreChildExtends)if(n.extends){const y=Array.isArray(n.extends)?n.extends:[n.extends],p=Array.isArray(i)?i:[i];n={...n,extends:[...p,...y]}}else n={...n,extends:i};Q(wt(n,d),t,f,s)}}function Ft(t,o){const s=t.node;if(!s||s.tagName!=="SELECT")return;const e=s.options;if(!e||!e.length)return;const r=t.__ref,i=r&&r.__exec&&r.__exec.value,a=typeof i=="function",f=t.value!=null&&typeof t.value!="function";if(a||f){let y;if(a)try{y=i(t,t.state,t.context)}catch{return}else y=t.value,typeof y=="string"&&y.includes("{{")&&(y=R.replaceLiteralsWithObjectFields.call(t,y,t.state));const p=y==null?"":String(y);s.value!==p&&(s.value=p);return}const n=o||!(r&&r.__selectSynced);if(r&&(r.__selectSynced=!0),!n)return;let d=-1;for(let y=0;y<e.length;y++)e[y].defaultSelected&&(d=y);d>=0&&s.selectedIndex!==d&&(s.selectedIndex=d)}function Yo(t,o){let{children:s,content:e}=t;const r=t.childExtends,i=typeof s=="function"||wo(t,"children");if(typeof s=="function"){const c=s;try{s=c(t,t.state,t.context)}catch(A){if(s=void 0,typeof console<"u"&&console.error){const x=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${x} (initial run, treating as empty):`,A?.message||A)}}So(t,s),t.children=s;const u=t.__ref;let l=!1;const g=D(t,t.childrenDeps,c),b=(0,k.createEffect)(()=>{const A=l;l=!0;let x;try{x=g(t,t.state,t.context)}catch(I){if(typeof console<"u"&&console.error){const G=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${G}${A?"":" (initial tracking run)"}:`,I?.message||I)}return}if(!A||x===t.children)return;So(t,x),t.children=x,u.__childrenChunkGen!=null&&u.__childrenChunkGen++;const S=typeof t.onContentUpdate=="function",w=S?[]:null,E=S?[]:null,T=S?[]:null;if(Array.isArray(x)&&t.childrenAs==="state"){const I=t.childProps,G=[],ro=new Map;for(let O=0;O<x.length;O++){const H=x[O];let L=I;if(typeof I=="function")try{L=I(t,H)}catch{L=null}const q=yo(L&&L.key,H,O);G.push(q),ro.set(q,{rawChild:H,childProps:L})}const ts=new Set(G),os=u.__children.slice();for(const O of os)if(!ts.has(O)){const H=t[O];H?.remove&&H.remove(),delete t[O],E&&E.push(O)}const lt=t.childExtends,vt=t.tag==="fragment",ss=t.context?.document||globalThis.document,pt=vt?null:ss?.createDocumentFragment(),Ut=new Set;for(const O of G){const H=ro.get(O),L=H.rawChild,q=t[O];if(q&&q.state){if(L&&typeof L=="object"){const F=q.state,rt=F.$replace||F.replace,io=F.$update||F.update;try{if(typeof rt=="function")rt.call(F,L);else if(typeof io=="function"){for(const V in F)if(!(V==="__element"||V==="root"||V==="parent"||V==="update")&&!Object.prototype.hasOwnProperty.call(L,V))try{F[V]=void 0}catch{}io.call(F,L)}else for(const V in L)F[V]=L[V]}catch(V){if(typeof console<"u"&&console.error){const es=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${O}" failed to patch at ${es} (reconcile, keeping its previous data for this pass):`,V?.message||V)}}}T&&T.push(O);continue}let Vt=L;(typeof L=="string"||typeof L=="number")&&(Vt={value:L,text:L});const Bt=H.childProps;let W=Bt?{...Bt,state:Vt}:{state:Vt};const ns=typeof I=="function"?At(Bt):ft(t,"childProps");if(lt&&!W.ignoreChildExtends)if(W.extends){const F=Array.isArray(W.extends)?W.extends:[W.extends],rt=Array.isArray(lt)?lt:[lt];W={...W,extends:[...rt,...F]}}else W={...W,extends:lt};let Gt;try{Gt=Q(wt(W,ns),t,O,o)}catch(F){if(typeof console<"u"&&console.error){const rt=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${O}" failed to construct at ${rt} (reconcile, skipping this row):`,F?.message||F)}Ut.add(O);continue}!vt&&Gt?.node&&pt&&pt.appendChild(Gt.node),w&&w.push(O)}if(!vt&&pt&&pt.childNodes.length&&t.node&&t.node.appendChild(pt),!vt&&t.node){let O=null;for(const H of G){const L=t[H]?.node;if(!L)continue;const q=O?O.nextSibling:t.node.firstChild;L!==q&&t.node.insertBefore(L,q),O=L}}u.__children=Ut.size?G.filter(O=>!Ut.has(O)):G,S&&(w.length||E.length)&&ho(t,{added:w,removed:E,kept:T}),Ft(t,!1);return}const et=S?[...u.__children]:null;for(const I of[...u.__children]){const G=t[I];G?.remove&&G.remove(),delete t[I]}u.__children=[],no(t,x,o,!1,!0),Ft(t,!1),S&&ho(t,{added:[...u.__children],removed:et,kept:[]})},{depth:u.path.length,label:P(u,"children")});u.__effects.push(b)}const a=no(t,s,o,!0,i);if(e!=null&&!(e&&e.__ref)){let c=e;if(typeof c=="string"||typeof c=="number"?c={text:c}:typeof c!="object"&&(c={}),t.childProps&&(c=ot(t.childProps,c)),r&&!c.ignoreChildExtends)if(c.extends){const l=Array.isArray(c.extends)?c.extends:[c.extends],g=Array.isArray(r)?r:[r];c={...c,extends:[...g,...l]}}else c={...c,extends:r};const u=xt(ft(t,"childProps"),ft(t,"content"));Q(wt(c,u),t,"content",o)}if(s&&!a)return;const f=t.context?.components||{},n=t.__ref&&t.__ref.__runtimeSource,d=n?{}:null;{const c=Object.keys(t);for(let u=0;u<c.length;u++){const l=c[u];if(!l.endsWith("Extends")||typeof t[l]!="string")continue;const g=l.slice(0,-7);if(!g||g.charCodeAt(0)<65||g.charCodeAt(0)>90)continue;const b={extends:t[l]};delete t[l];for(let A=u+1;A<c.length;A++){const x=c[A],S=x.charCodeAt(0);if(S>=65&&S<=90||U.REGISTRY.has(x)||typeof t[x]=="function"&&(x.startsWith("on")||x.startsWith(".")))break;const w=t[x];w!==void 0&&(b[x]=w,delete t[x],d&&bt(n,x)&&(d[g]||(d[g]={}),d[g][x]=n[x]))}t[g]&&typeof t[g]=="object"?t[g]={...b,...t[g]}:t[g]=b}}const y=o?.mountYield===!0||t.yieldChildren===!0,p=Object.keys(t),h=c=>{if(U.REGISTRY.has(c)||typeof t[c]!="object"||t[c]===null)return;const u=c.charCodeAt(0);if(u<65||u>90)return;let l=t[c];if(l.__ref)return;if(!l.extends&&!l.extend){const b=f[c]||f[`smbls.${c}`];b&&(l={...l,extends:b})}if(t.childProps&&(l=ot(t.childProps,l)),r&&!l.ignoreChildExtends)if(l.extends){const b=Array.isArray(l.extends)?l.extends:[l.extends],A=Array.isArray(r)?r:[r];l={...l,extends:[...A,...b]}}else l={...l,extends:r};const g=n?xt(ft(t,"childProps"),xt(d[c]||null,ft(t,c))):null;Q(wt(l,g),t,c,o)};if(!y){for(const c of p)h(c);return}(0,B.openMountBudget)();const _=c=>{for(let u=c;u<p.length;u++)if(h(p[u]),u+1<p.length&&(0,B.mountBudgetExhausted)()){const l=u+1;(0,B.enqueueMountWork)(()=>_(l));return}};_(0),(0,B.closeMountBudget)()}function qo(t,o,s){const{node:e}=t;if(!e)return;e.ref=t;const r=o?.tag==="fragment"?o.__ref?.__fragmentAnchor:null;if(r){const a=r.parentNode;if(a){if(s?.position==="before"&&s.node)a.insertBefore(e,s.node);else if(s?.position==="after"&&s.node){const f=s.node.nextSibling;a.insertBefore(e,f||r)}else a.insertBefore(e,r);return}}const i=o?.node||(o?.nodeType?o:null);if(i)if(s?.position==="before"&&s.node)i.insertBefore(e,s.node);else if(s?.position==="after"&&s.node){const a=s.node.nextSibling;a?i.insertBefore(e,a):i.appendChild(e)}else i.appendChild(e)}const It=3;function mo(t){return!t||t.__inBeforeUpdate||(t.__beforeUpdateFailCount||0)>=It?!1:(t.__inBeforeUpdate=!0,!0)}function kt(t,o){t&&(t.__inBeforeUpdate=!1,o?(t.__beforeUpdateFailCount=(t.__beforeUpdateFailCount||0)+1,t.__beforeUpdateFailCount===It&&typeof console<"u"&&console.error&&console.error(`[DOMQL] onBeforeUpdate failed ${It}x in a row on this element \u2014 pausing automatic retries until a future prop/state change re-arms it.`)):t.__beforeUpdateFailCount=0)}function $(t,o,s){const e=t.charAt(0).toLowerCase()+t.slice(1);o.context?.plugins?.length&&(0,z.runPluginHook)(e,o,s);const r="on"+t,i=o[r];if(typeof i=="function"){const n=t==="Render"?"__inRender":t==="RenderRouter"?"__inRenderRouter":null;if(n){if(o.__ref[n])return!0;o.__ref[n]=!0}const d=o.context?.designSystem;d&&(0,j.pushConfig)(d);let y=!!n;try{const p=i(o,o.state,o.context,s);if(p&&typeof p.then=="function"){const h=o.__ref;return p.catch(_=>{o.context?.plugins?.length&&(0,z.runPluginHook)("error",o,{hook:r,error:_})||console.error(`[DOMQL] Lifecycle "${r}" error:`,_)}).finally(()=>{n&&h&&(h[n]=!1)}),y=!1,!0}if(p===!1)return!1}catch(p){if(o.context?.plugins?.length&&(0,z.runPluginHook)("error",o,{hook:r,error:p})||console.error(`[DOMQL] Lifecycle "${r}" error:`,p),o.context?.strictMode)throw p}finally{d&&(0,j.popConfig)(),y&&o.__ref&&(o.__ref[n]=!1)}}return!0}var en=Q;
|
package/dist/cjs/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var n=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var E=(t,o)=>{for(var e in o)n(t,e,{get:o[e],enumerable:!0})},I=(t,o,e,p)=>{if(o&&typeof o=="object"||typeof o=="function")for(let c of s(o))!x.call(t,c)&&c!==e&&n(t,c,{get:()=>o[c],enumerable:!(p=r(o,c))||p.enumerable});return t};var N=t=>I(n({},"__esModule",{value:!0}),t);var R={};E(R,{VERSION:()=>O});module.exports=N(R);const O="3.14.
|
|
1
|
+
var n=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var E=(t,o)=>{for(var e in o)n(t,e,{get:o[e],enumerable:!0})},I=(t,o,e,p)=>{if(o&&typeof o=="object"||typeof o=="function")for(let c of s(o))!x.call(t,c)&&c!==e&&n(t,c,{get:()=>o[c],enumerable:!(p=r(o,c))||p.enumerable});return t};var N=t=>I(n({},"__esModule",{value:!0}),t);var R={};E(R,{VERSION:()=>O});module.exports=N(R);const O="3.14.798";
|
package/dist/esm/src/create.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{createStore as
|
|
2
|
-
`+
|
|
1
|
+
import{createStore as Ht,createScopeStore as hs,isStore as Q}from"@symbo.ls/signal";import{createEffect as v,getObserver as lo,setObserver as jt}from"@symbo.ls/signal";import{cacheNode as Kt,detectTag as po}from"./cache.js";import{REGISTRY as K,LIFECYCLE_EVENTS as ys}from"./registry.js";import{registerEvent as _s,registerGlobalEvent as gs,globalEventKeyInfo as bs}from"./delegate.js";import{applyExtends as As}from"./extends.js";import{addMethods as xs}from"./methods.js";import"./dispose.js";import{isLoudDevRuntime as nt}from"./devRuntime.js";import{mountBudgetExhausted as ho,openMountBudget as yo,closeMountBudget as _o,enqueueMountWork as go}from"./mountScheduler.js";import{replaceLiteralsWithObjectFields as I,isPolyglotWritableKey as ws,markPolyglotSeeded as Ss}from"@symbo.ls/utils";import*as Et from"@symbo.ls/utils";import{runPluginHook as q}from"@symbo.ls/utils/function.js";import{applyStateMethods as ut}from"@symbo.ls/state";import{CSS_PROPS_REGISTRY as D,DEFAULT_CSS_PROPERTIES_LIST as R,pushStaticCssPass as bo,popStaticCssPass as Ao}from"css-in-props";import{css as dt,wrapHoverRule as xo}from"@symbo.ls/css";import{pushConfig as M,popConfig as N}from"@symbo.ls/scratch";import{checkAttributeByTagName as lt,applyAttrTransforms as Cs,ATTR_TRANSFORMS as Wt,camelToAttr as pt,serializeAttrValue as W,isEnumeratedTrueFalseAttr as ht}from"attrs-in-props";import{resolveElementIdEngine as ks}from"./engineRegistry.js";import{CSS_LONGHAND_SHORTHANDS as wo}from"./cssLonghands.js";import{isAttributeFirst as So,isCssProp as yt}from"./attributeFirst.js";import{VERSION as vs}from"./version.js";const Co=ks({uniqId:1,scopedStyleId:0},vs),_t=[],J=new Set;let zt=!1,ko=0,et=null,gt=null;function rt(){return typeof Date<"u"&&typeof Date.now=="function"?Date.now():0}function vo(){return typeof document<"u"&&document.visibilityState==="hidden"}const js=250,Es=1e3;function Ps(){return gt&&(gt!==(typeof requestAnimationFrame=="function"?requestAnimationFrame:null)||vo())?!0:rt()-ko>=Es}function Ts(){if(zt=!0,ko=rt(),gt=null,typeof requestAnimationFrame!="function"){const t=typeof clearTimeout=="function"?clearTimeout:null,o=setTimeout(Yt,0);et=t?()=>t(o):null;return}if(vo()){const t=typeof clearTimeout=="function"?clearTimeout:null,o=setTimeout(Yt,js);et=t?()=>t(o):null}else{const t=typeof cancelAnimationFrame=="function"?cancelAnimationFrame:null;gt=requestAnimationFrame;const o=requestAnimationFrame(Yt);et=t?()=>t(o):null}}function Pt(){if(zt){if(!Ps())return;const t=et;if(et=null,t)try{t()}catch{}}Ts()}const jo=300,Eo=15e4;function Yt(){if(zt=!1,et=null,gt=null,J.size&&an(),!_t.length)return;const t=_t.splice(0,_t.length);for(let o=0;o<t.length;o++){const s=t[o];if(s.node){if(!s.node.isConnected){const e=s.__ref||(s.__ref={});e.__mountAttempts=(e.__mountAttempts||0)+1,e.__mountFirstAttemptAt==null&&(e.__mountFirstAttemptAt=rt());const r=rt()-e.__mountFirstAttemptAt;e.__mountAttempts<=jo&&r<Eo?(_t.push(s),Pt()):console.warn("[DOMQL] onMounted dropped after",e.__mountAttempts,"attempts /",r,"ms \u2014 node never connected:",s.key||s.tag||s);continue}F("Mounted",s,s.__ref?.__mountOptions||{})}}}function qt(t,o){const s=t.__ref?.__autoGrow;s&&s.active&&kt(t,!0),typeof t.onMounted=="function"&&(t.__ref.__mountOptions=o,_t.push(t),Pt())}function Po(t,o){if(typeof t.onContentUpdate!="function")return;t.context?.plugins?.length&&q("contentUpdate",t,o);const s=t.context?.designSystem;s&&M(s);try{t.onContentUpdate(t,t.state,t.context,o)}catch(e){if(t.context?.plugins?.length&&q("error",t,{hook:"onContentUpdate",error:e})||console.error('[DOMQL] Lifecycle "onContentUpdate" error:',e),t.context?.strictMode)throw e}finally{s&&N()}}function Z(t){return t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90}function Os(t){return t.charAt(2).toLowerCase()+t.slice(3)}function Ls(t){return t.toLowerCase()}function Zt(t){const o=t.charCodeAt(0);return o===58||o===64||o===38||o===91}function bt(t,o){const s={...t};for(const e in o){const r=s[e],i=o[e];r&&i&&typeof r=="object"&&typeof i=="object"&&!Array.isArray(r)&&!Array.isArray(i)&&typeof r!="function"&&typeof i!="function"?s[e]=bt(r,i):s[e]=i}return s}function Tt(t){if(typeof t=="string")return t||void 0;if(typeof t=="number"||typeof t=="bigint")return String(t)}function To(t,o,s){return Tt(t)||(o&&typeof o=="object"?Tt(o.key):void 0)||String(s)}function X(t,o,s,e={},r){const i=lo();if(i){jt(null);try{return X(t,o,s,e,r)}finally{jt(i)}}if(t==null||t===!1)return null;const a=Hs(t);(typeof t=="string"||typeof t=="number")&&(t={text:t}),s=Tt(s);const f=Tt(t.key),n=Object.create(null);n.key=s||f||`_${Co.uniqId++}`,n.parent=o||null,n.context=t.context||o?.context||e.context||{},n.context.__create||(n.context.__create=X);const d=n.__ref={__if:!0,__children:[],__exec:{},__effects:[],__eventCleanup:[],root:o?.__ref?.root||n,path:o?.__ref?.path?[...o.__ref.path,n.key]:[n.key],origin:t};a&&(d.__runtimeSource=a);const y=t;if(t=Oo(n,t,s,f,o,e),n.if!=null){let h;if(typeof n.if=="function")try{h=n.if(n,n.state,n.context)}catch(_){if(h=!1,d.__ifError=_,typeof console<"u"&&console.warn){const c=n.key||n.tag||"?";console.warn(`[smbls] \`if:\` evaluator threw on ${c} \u2014 treating as false:`,_?.message||_)}}else h=n.if;d.__if=!!h}if(d.__if)typeof n.if=="function"&&(d.__ifInitialized=!0);else{o&&(o[n.key]=n);const h=Ms(t,s,n.context?.components);return h.length&&(d.__ifLateMerge={definition:y,key:s,ownKey:f,names:h,options:e}),typeof n.if=="function"&&Uo(n,d,n.if),n}n.tag||(n.tag=po(n)),F("Init",n,e);const p=n.node=Kt(n);if(!p)return n;if(n.tag==="fragment"){const _=(n.context?.document||globalThis.document).createComment("");p.appendChild(_),d.__fragmentAnchor=_}F("AttachNode",n,e),p.setAttribute&&n.key&&p.setAttribute("data-key",n.key),o&&(o[n.key]=n,o.__ref?.__children&&(o.__ref.__children.includes(n.key)||o.__ref.__children.push(n.key))),p.setAttribute&&n.context?.scopeSelector&&n.context.scopeSelector!==":root"&&n.context.key&&n.key===n.context.key&&p.setAttribute("data-smbls-app",n.context.key),n.id&&p.setAttribute&&(p.id=n.id),is(n,e),$o(n),mt(n),mo(n),es(n),pn(n);try{cs(n,e)}catch(h){if(typeof console<"u"&&console.error){const _=n.__ref?.path?.join(".")||n.key||"<root>";console.error(`[smbls] createChildren failed at ${_}:`,h?.message||h,h?.stack?`
|
|
2
|
+
`+h.stack.split(`
|
|
3
3
|
`).slice(0,6).join(`
|
|
4
|
-
`):"")}}if(Ft(e,!0),is(e,s,r),typeof e.html=="function"&&e.node&&!e.node.innerHTML){const _=e.context?.designSystem;_&&M(_);try{const b=e.html(e,e.state,e.context);b!=null&&typeof b!="function"&&(e.node.innerHTML=b)}catch{}finally{_&&N()}}if(F("Create",e,n),F("Complete",e,n),F("Render",e,n),F("RenderRouter",e,n),Yt(e,n),typeof e.onFrame=="function"){const _=e.onFrame,b=e.context?.designSystem,w=()=>{if(e.node){if(e.node.isConnected){b&&M(b);try{_(e,e.state,e.context)}catch(S){console.error("[DOMQL] onFrame error:",S)}finally{b&&N()}}requestAnimationFrame(w)}};requestAnimationFrame(w)}return e}function Ls(t,s,o){const n=!s,r=o.state&&typeof o.state=="object"&&!Array.isArray(o.state)&&Object.keys(o.state).length===0,i=n&&r&&t.context?.state,a=o.state!==void 0&&!i?o.state:t.state&&!Q(t.state)?t.state:void 0;if(a==null){if(s?.state)t.state=s.state,ut(t,t.state);else if(t.context?.state){const f=t.context.state,e={...f},u=t.context?.polyglot;if(u?.translations){const h=t.context,p=f.lang||u.defaultLang||"en",y=new Set,g=(d,A)=>{y.has(d)||xs(h,d,e)&&(e[d]=A,y.add(d),ws(h,d,A))},c=u.translations[p];if(c&&typeof c=="object")for(const d in c)g(d,c[d]);const l=new Set(u.languages||[]);for(const d in u.translations)l.has(d)||g(d,u.translations[d])}t.state=Q(e)?e:Gt(e),t.state.__element=t,t.state.root=t.state,ut(t,t.state),jt.promoteActiveRootState?.(f,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),ut(t,t.state);return}if(typeof a=="string"){if(t.state=Po(a,s),t.state&&typeof t.state=="object"&&!Q(t.state)){const f=s?.state?.root||s?.state||t.state;Object.defineProperty(t.state,"root",{value:f,enumerable:!1,configurable:!0,writable:!0})}ut(t,t.state);return}if(typeof a=="function"){const f=a(t,s?.state);t.state=Q(f)?f:Gt(f||{})}else Q(a)?t.state=a:t.state=Gt({...a});t.state.__element=t,s?.state?(t.state.parent=s.state,t.state.root=s.state.root||s.state):t.state.root=t.state,ut(t,t.state),jt.promoteActiveRootState?.(a,t.state)}function Zt(t,s){if(!s)return t;const o=s.split("/");let n=t;for(const r of o){if(n==null)return{};n=n[r]}return n??{}}function Po(t,s){if(!s)return{};if(t===".")return s.state||{};if(t.startsWith("../")){const r=t.slice(3);return r?Zt(s.state,r):s.state??{}}if(t.startsWith("~/")){const r=s.state?.root||s.state,i=t.slice(2);return i?Zt(r,i):r??{}}if(s.state?.[t]!==void 0)return s.state[t];const o=Zt(s.state,t);if(o!=null&&Object.keys(o).length>0)return o;const n=s.context?.polyglot;if(n?.translations){const r=s.state?.root?.lang||n.defaultLang||"en",i=n.translations[r];if(i?.[t]!==void 0)return i[t];if(n.translations[t]!==void 0)return n.translations[t]}return{}}const Ds=new Set(["s","state","ctx","context"]);function Rs(t){try{const o=(typeof jt.getFunctionSource=="function"?jt.getFunctionSource(t):Function.prototype.toString.call(t)).match(/^[^(]*\(([^)]*)\)/);return o?o[1].split(",").map(n=>n.trim().split("=")[0].trim()).filter(Boolean):[]}catch{return[]}}function Ms(t){if(typeof t!="function"||t.length!==2)return!1;const s=Rs(t);if(s.length<2)return!1;const o=s[1].replace(/[{}[\]]/g,"").trim();return o.length>0&&!Ds.has(o)}function Ns(t){const s=t.__ref,o=t.tag||"div",n=t.context?.designSystem,r=[],i=Object.keys(t);for(let a=0;a<i.length;a++){const f=i[a];if(typeof t[f]!="function"||K.has(f))continue;const e=f.charCodeAt(0);e>=65&&e<=90||Z(f)||D[f]||R&&R.has(f)||dt(o,f)||(et()&&Ms(t[f])&&console.warn(`[smbls] custom prop "${f}"${t.key?` on key "${t.key}"`:""} is a function \u2014 it will be auto-invoked on read and its RETURN VALUE stored, not preserved as a callable reference. If you meant to stash a callback, use el.call('${f}', \u2026) instead of reading el.${f}(\u2026) directly (see RULES.md Rule 8).`),r.push({prop:f,fn:t[f]}))}for(let a=0;a<r.length;a++){const{prop:f,fn:e}=r[a];s.__exec[f]=e,Object.defineProperty(t,f,{get(){n&&M(n);try{return e(t,t.state,t.context)}catch{return}finally{n&&N()}},set(u){delete s.__exec[f],Object.defineProperty(t,f,{value:u,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function Fs(t,s){if(!(!Array.isArray(s)||s.length===0))for(let o=0;o<s.length;o++){const n=s[o];try{typeof n=="function"?n(t,t.state,t.context):typeof n=="string"&&t.state?.[n]}catch{}}}function P(t,s,o){return!Array.isArray(s)||s.length===0?o:function(...n){return Fs(t,s),o.apply(this,n)}}function At(t,s){if(!(!t||Array.isArray(t)||typeof t!="object"))return t[s]}function k(t,s){return()=>t.path.join(".")+"::"+s}const Oo=new Set;function O(t,s,o){if(!et())return;const n=k(t,s)();Oo.has(n)||(Oo.add(n),console.warn(`[smbls] "${s}" effect threw on ${t.path.join(".")} \u2014 keeping previous value:`,o?.message||o))}const Lo=/(['"`])((?:\\.|(?!\1)[^\\])*)\1/g,$s=(t,s)=>{let o;try{o=String(t)}catch{return}if(!o.includes("{{"))return;Lo.lastIndex=0;let n;for(;(n=Lo.exec(o))!==null;)n[2].includes("{{")&&s.add(n[2])},Is=(t,s)=>!Z(t)&&!yt(s,t),Do=(t,s,o,n,r)=>{if(typeof s=="string"){!r&&s.includes("{{")&&o.add(s);return}typeof s=="function"&&Is(t,n)&&$s(s,o)},Qt=new WeakMap,xt=(t,s)=>Object.prototype.hasOwnProperty.call(t,s),wt=t=>{if(typeof t=="string"||typeof t=="number")return{text:t};if(!t||typeof t!="object"||Array.isArray(t))return null;const s=t.props;return s&&typeof s=="object"&&!Array.isArray(s)?tt(t,s):t},St=(t,s)=>t&&s?tt(t,s):t||s||null,Ro=(t,s)=>{const o=t.__ref&&t.__ref.__runtimeSource;return!!o&&xt(o,s)},it=(t,s)=>Ro(t,s)?wt(t.__ref.__runtimeSource[s]):null,Ct=(t,s)=>(s&&t&&typeof t=="object"&&Qt.set(t,s),t),Us=t=>{if(!t||typeof t!="object")return;const s=Qt.get(t);return s&&Qt.delete(t),s},Xt=(t,s,o)=>{if(typeof t=="string"){t.includes("{{")&&s.add(t);return}if(!(!t||typeof t!="object"||o.has(t))){if(o.add(t),Array.isArray(t)){for(let n=0;n<t.length;n++)Xt(t[n],s,o);return}if(!t.__ref)for(const n of Object.keys(t)){if(n==="state")continue;const r=Object.getOwnPropertyDescriptor(t,n);r&&"value"in r&&Xt(r.value,s,o)}}},Vs=(t,s)=>{let o=null;for(const n of Object.keys(t)){if(K.has(n)||s&&xt(s,n))continue;const r=Object.getOwnPropertyDescriptor(t,n),i=r&&r.value;if(!Array.isArray(i))continue;const a=new Set;Xt(i,a,new Set),a.size&&(o||(o=new Map),o.set(i,a))}return o},Mo=(t,s)=>{if(Array.isArray(s))for(let o=t;o;o=o.parent){const n=o.__ref&&o.__ref.__declaredArrays,r=n&&n.get(s);if(!r)continue;const i=t.__ref;i.__authoredTemplates||(i.__authoredTemplates=new Set);for(const a of r)i.__authoredTemplates.add(a);return}},Bs=["attr","aria","data","metadata"],Gs=t=>{if(Bs.includes(t))return!0;const s=t.charCodeAt(0);return s===46||s===33||s===64},Hs=(t,s)=>{const o=new Set,n=t.tag||"div";for(const r of Object.keys(t)){const i=Object.getOwnPropertyDescriptor(t,r),a=i&&i.value,f=!!s&&xt(s,r);if(a&&typeof a=="object"&&!Array.isArray(a)){if(!Gs(r))continue;const e=f?s[r]:null,u=e&&typeof e=="object"?e:null;for(const h in a){const p=f&&(!u||xt(u,h));Do(h,a[h],o,n,p)}continue}Do(r,a,o,n,f)}return o};function No(t,s){const o=t.__ref,n=!!(s&&s.skipIfEffect),r=Hs(t,o.__runtimeSource);if(o.__authoredTemplates)for(const e of r)o.__authoredTemplates.add(e);else o.__authoredTemplates=r;if(Ns(t),typeof t.text=="function"){const e=t.text,u=P(t,t.textDeps,e),h=v(()=>{if(!o.contentManaged)try{let p=u(t,t.state,t.context);t.node&&p!=null&&typeof p!="function"&&typeof p!="object"&&(typeof p=="string"&&p.includes("{{")&&(p=I.call(t,p,t.state)),Pt(t,p))}catch(p){O(o,"text",p)}},{depth:o.path.length,label:k(o,"text")});o.__effects.push(h),o.__exec.text=e}else if(typeof t.text=="string"&&t.text.includes("{{")){const e=t.text,u=v(()=>{if(o.contentManaged)return;const h=I.call(t,e,t.state);h!=null&&(t.text=h),t.node&&Pt(t,h??"")},{depth:o.path.length,label:k(o,"text")});o.__effects.push(u),o.__exec.text=e}const i=t.tag||"div";for(const e of Object.keys(t))if(typeof t[e]=="function"&&!K.has(e)&&!Z(e)&&!o.__exec[e]&&!wo(i,e)){if(D[e]){const u=t[e],h=P(t,t[e+"Deps"],u),p=e;let y,g=null,c=null,l;const d=v(()=>{const A=t.context?.designSystem;A&&M(A);try{const x=h(t,t.state,t.context);go();let _;try{_=D[p](x,t,t.state,t.context)}finally{bo()}if(Array.isArray(_)){const w={};for(const S of _)if(S)for(const C in S)w[C]=S[C];_=w}const b=p==="show"||p==="hide";if(_&&t.node&&Ks(_)){const w=Ot(_);if(w===null||w!==l){l=w;const S=lt(_,null,t.context?.cssPrefix),C=S?S.split(" ").filter(Boolean):null;if(t.node.classList){if(c)for(const j of c)t.node.classList.remove(j);if(C&&C.length)for(const j of C)t.node.classList.add(j);c=C}}y=void 0,g=null}else if(_&&t.node){if(c){for(const S of c)t.node.classList.remove(S);c=null,l=void 0}const w=Ot(_);if(w===null||w!==y||!Rt(t.node,g)){y=w;const S=Bo(t,_);g=Lt(t.node,S)}}else t.node&&b&&(y=void 0,g=null,t.node.style.display="")}finally{A&&N()}},{depth:o.path.length,label:k(o,p)});o.__effects.push(d),o.__exec[e]=u}else if(R&&R.has(e)){const u=t[e],h=P(t,t[e+"Deps"],u),p=e;let y,g=null;const c=v(()=>{const l=t.context?.designSystem;l&&M(l);try{const d=h(t,t.state,t.context);if(t.node)if(d!=null){const A=p+":"+String(d);if(A!==y||!Rt(t.node,g)){y=A;const x={[p]:d},_=Bo(t,x);g=Lt(t.node,_)}}else y=void 0,g=null,t.node.style[p]=""}finally{l&&N()}},{depth:o.path.length,label:k(o,p)});o.__effects.push(c),o.__exec[e]=u}}if(typeof t.html=="function"){const e=t.html,u=P(t,t.htmlDeps,e),h=v(()=>{const p=t.context?.designSystem;p&&M(p);try{const y=u(t,t.state,t.context);t.node&&y!=null&&typeof y!="function"&&(t.node.innerHTML=y)}finally{p&&N()}},{depth:o.path.length,label:k(o,"html")});o.__effects.push(h),o.__exec.html=e}if(typeof t.value=="function"){const e=t.value,u=P(t,t.valueDeps,e),h=v(()=>{try{let p=u(t,t.state,t.context);typeof p=="string"&&p.includes("{{")&&(p=I.call(t,p,t.state)),Io(t,p)}catch(p){O(o,"value",p)}},{depth:o.path.length,label:k(o,"value")});o.__effects.push(h),o.__exec.value=e}else if(typeof t.value=="string"&&t.value.includes("{{")){const e=t.value,u=v(()=>{try{Io(t,I.call(t,e,t.state))}catch(h){O(o,"value",h)}},{depth:o.path.length,label:k(o,"value")});o.__effects.push(u),o.__exec.value=e}if(typeof t.style=="function"){const e=t.style,u=P(t,t.styleDeps,e);let h,p=null;const y=v(()=>{const g=u(t,t.state,t.context),c=Ot(g);(c===null||c!==h||!Rt(t.node,p))&&(h=c,Ws(t.node,p,g),m(t.node,g),p=Lt(t.node,g))},{depth:o.path.length,label:k(o,"style")});o.__effects.push(y),o.__exec.style=e}else if(t.style&&typeof t.style=="object")for(const e in t.style){const u=t.style[e];if(typeof u!="function")continue;const h=P(t,At(t.styleDeps,e),u);let p,y=null;const g=v(()=>{try{const c=h(t,t.state,t.context);if(t.node){const l=e+":"+String(c);if(l!==p||!Rt(t.node,y)){p=l;const d={[e]:c};m(t.node,d),y=Lt(t.node,d)}}}catch(c){O(o,"style."+e,c)}},{depth:o.path.length,label:k(o,"style."+e)});o.__effects.push(g)}if(t.attr&&typeof t.attr=="object"){for(const e in t.attr)if(typeof t.attr[e]=="function"){const u=P(t,At(t.attrDeps,e),t.attr[e]),h=e,p=v(()=>{try{let y=u(t,t.state,t.context);typeof y=="string"&&y.includes("{{")&&(y=I.call(t,y,t.state)),t.node?.setAttribute&&(y==null||y===!1&&!ht(h)?t.node.removeAttribute(h):typeof y!="function"&&typeof y!="object"&&t.node.setAttribute(h,W(h,y)))}catch(y){O(o,"attr."+h,y)}},{depth:o.path.length,label:k(o,"attr."+h)});p._attrName=h.toLowerCase(),o.__effects.push(p)}else if(typeof t.attr[e]=="string"&&t.attr[e].includes("{{")){const u=t.attr[e],h=e,p=v(()=>{try{const y=I.call(t,u,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(h,W(h,y??""))}catch(y){O(o,"attr."+h,y)}},{depth:o.path.length,label:k(o,"attr."+h)});p._attrName=h.toLowerCase(),o.__effects.push(p)}}if(t.aria&&typeof t.aria=="object")for(const e in t.aria){const u=t.aria[e];if(typeof u=="string"&&u.includes("{{")){const g=u,c="aria-"+e.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),l=v(()=>{try{const d=I.call(t,g,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(c,W(c,d??""))}catch(d){O(o,"aria."+e,d)}},{depth:o.path.length,label:k(o,"aria."+e)});l._attrName=c,o.__effects.push(l);continue}if(typeof u!="function")continue;const h=P(t,At(t.ariaDeps,e),t.aria[e]),p="aria-"+e.replace(/[A-Z]/g,g=>"-"+g.toLowerCase()),y=v(()=>{try{const g=h(t,t.state,t.context);if(!t.node?.setAttribute)return;g==null?t.node.removeAttribute(p):typeof g!="function"&&typeof g!="object"&&t.node.setAttribute(p,W(p,g))}catch(g){O(o,"aria."+e,g)}},{depth:o.path.length,label:k(o,"aria."+e)});y._attrName=p,o.__effects.push(y)}if(t.data&&typeof t.data=="object")for(const e in t.data){const u=t.data[e];if(typeof u=="string"&&u.includes("{{")){const c=u,l="data-"+e.replace(/[A-Z]/g,A=>"-"+A.toLowerCase()),d=v(()=>{try{const A=I.call(t,c,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(l,A??"")}catch(A){O(o,"data."+e,A)}},{depth:o.path.length,label:k(o,"data."+e)});d._attrName=l,o.__effects.push(d);continue}if(typeof u!="function")continue;const h=P(t,At(t.dataDeps,e),t.data[e]),y="data-"+e.replace(/[A-Z]/g,c=>"-"+c.toLowerCase()),g=v(()=>{try{const c=h(t,t.state,t.context);if(!t.node?.setAttribute)return;c==null||c===!1?t.node.removeAttribute(y):typeof c!="function"&&typeof c!="object"&&t.node.setAttribute(y,c===!0?"":c)}catch(c){O(o,"data."+e,c)}},{depth:o.path.length,label:k(o,"data."+e)});g._attrName=y,o.__effects.push(g)}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 e in a){if(typeof a[e]!="function")continue;const u=P(t,At(t.classDeps,e),a[e]),h=v(()=>{try{const p=u(t,t.state,t.context);if(!t.node?.classList)return;typeof p=="string"?t.node.classList.add(p):p?t.node.classList.add(e):t.node.classList.remove(e)}catch(p){O(o,"class."+e,p)}},{depth:o.path.length,label:k(o,"class."+e)});o.__effects.push(h)}!n&&typeof t.if=="function"&&$o(t,o,t.if);for(const e of Object.keys(t)){if(K.has(e)||typeof t[e]!="function")continue;const u=e.charCodeAt(0);if(u>=65&&u<=90||Z(e))continue;const h=t[e];o.__exec[e]=h;const p=t.tag||"div";if(dt(p,e)&&!yt(p,e)){const y=pt(e)||e,g=P(t,t[e+"Deps"],h),c=v(()=>{try{let l=g(t,t.state,t.context);typeof l=="string"&&l.includes("{{")&&(l=I.call(t,l,t.state)),t.node?.setAttribute&&(l==null||l===!1&&!ht(y)?t.node.removeAttribute(y):typeof l!="function"&&typeof l!="object"&&(y==="src"&&"src"in t.node?t.node.src=l:t.node.setAttribute(y,W(y,l))))}catch(l){O(o,e,l)}},{depth:o.path.length,label:k(o,e)});c._attrName=y.toLowerCase(),o.__effects.push(c)}}const f=t.tag||"div";for(const e of Object.keys(t)){if(K.has(e))continue;const u=t[e];if(typeof u!="string"||!u.includes("{{"))continue;const h=e.charCodeAt(0);if(h>=65&&h<=90||Z(e)||yt(f,e)||Kt[e]||!dt(f,e))continue;const p=pt(e)||e,y=v(()=>{try{const g=I.call(t,u,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(p,W(p,g??""))}catch(g){O(o,e,g)}},{depth:o.path.length,label:k(o,e)});y._attrName=p.toLowerCase(),o.__effects.push(y)}if(Xs(t),oe(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const e=t.onStateUpdate,u=t.stateDeps;let h=!1,p=[];const y=v(()=>{const g=[];for(let A=0;A<u.length;A++){const x=u[A];try{g[A]=typeof x=="function"?x(t,t.state,t.context):t.state?.[x]}catch{g[A]=void 0}}if(!h){h=!0,p=g;return}let c=g.length!==p.length;for(let A=0;!c&&A<g.length;A++)g[A]!==p[A]&&(c=!0);const l=p;if(p=g,!c)return;const d=t.context?.designSystem;d&&M(d);try{e(t,t.state,t.context,{prev:l,next:g})}catch(A){if(t.context?.plugins?.length&&q("error",t,{hook:"onStateUpdate",error:A})||console.error('[DOMQL] Lifecycle "onStateUpdate" error:',A),t.context?.strictMode)throw A}finally{d&&N()}},{depth:o.path.length,label:k(o,"onStateUpdate")});o.__effects.push(y)}te(t)}function Fo(t){const s=t.parent,o=s?.node;if(!o||!t.node){is(t,t.parent);return}let n=null;const r=Object.keys(s),i=r.indexOf(t.key);for(let a=i+1;a<r.length;a++){const f=s[r[a]];if(f?.node?.parentNode===o){n=f.node;break}}n?o.insertBefore(t.node,n):o.appendChild(t.node)}function $o(t,s,o){const n=P(t,t.ifDeps,o),r=v(()=>{let i;try{i=n(t,t.state,t.context)}catch(f){if(i=!1,s.__ifError=f,typeof console<"u"&&console.warn){const e=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${e} \u2014 treating as false:`,f?.message||f)}return}const a=s.__if;if(s.__if=!!i,a&&!s.__if&&t.node){t.node.remove();try{typeof t.onRemove=="function"&&t.onRemove(t)}catch(f){console.error("[smbls] onRemove error:",f)}}else if(!a&&s.__if)if(s.__ifInitialized)t.node||(t.node=Ht(t)),t.node&&(t.node.ref=t),Fo(t),Jt(t),F("Render",t,{}),Yt(t,{});else{if(s.__ifInitialized=!0,t.tag||(t.tag=lo(t)),F("Init",t,{}),t.node||(t.node=Ht(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}F("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),ns(t,{}),No(t,{skipIfEffect:!0}),Jt(t),Xo(t),ss(t),rs(t,{}),Fo(t),F("Create",t,{}),F("Complete",t,{}),F("Render",t,{}),F("RenderRouter",t,{}),Yt(t,{})}},{depth:s.path.length,label:k(s,"if")});s.__effects.push(r)}function Pt(t,s){const o=t.node;if(!o)return;const n=s==null||typeof s=="object"?"":String(s);if(t.tag==="string"){o.nodeValue!==n&&(o.nodeValue=n);return}const r=t.__ref;let i=r?r.__textNode:null;if(i&&i.parentNode!==o&&(i=null),!i){const a=o.firstChild;a&&a.nodeType===3&&(i=a)}i?i.nodeValue!==n&&(i.nodeValue=n):o.firstChild?(i=(o.ownerDocument||t.context?.document||globalThis.document).createTextNode(n),o.insertBefore(i,o.firstChild)):(o.textContent=n,i=o.firstChild&&o.firstChild.nodeType===3?o.firstChild:null),r&&(r.__textNode=i||null)}function Io(t,s){const o=t.node;if(!o||!("value"in o))return;const n=s==null?"":String(s);if(o.value===n)return;const r=typeof document<"u"&&document.activeElement===o,i=r&&typeof o.selectionStart=="number"?o.selectionStart:null,a=r&&typeof o.selectionEnd=="number"?o.selectionEnd:null;if(o.value=n,r&&i!=null&&a!=null)try{o.setSelectionRange(i,a)}catch{}const f=t.__ref&&t.__ref.__autoGrow;f&&f.active&&f.resize()}function Jt(t){const{node:s}=t;if(s){if((typeof t.text=="string"&&!t.text.includes("{{")||typeof t.text=="number")&&Pt(t,t.text),Qo(t),typeof t.html=="string"&&(s.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&!(typeof t.value=="string"&&t.value.includes("{{"))&&"value"in s){const o=String(t.value);s.value!==o&&(s.value=o)}if(t.style&&typeof t.style=="object"){let o=t.style;for(const n in t.style)if(typeof t.style[n]=="function"){o={};for(const r in t.style)typeof t.style[r]!="function"&&(o[r]=t.style[r]);break}m(s,o)}if(t.attr&&typeof t.attr=="object")for(const o in t.attr){const n=t.attr[o];typeof n=="function"||typeof n=="object"||n!=null&&(typeof n=="string"&&n.includes("{{")||n===!1&&!ht(o)||s.setAttribute&&s.setAttribute(o,W(o,n)))}if(typeof t.themeModifier=="string"&&t.themeModifier&&s.setAttribute&&s.setAttribute("data-theme",t.themeModifier),t.data&&typeof t.data=="object")for(const o in t.data){const n=t.data[o];typeof n=="function"||typeof n=="object"||n==null||n===!1||typeof n=="string"&&n.includes("{{")||s.dataset&&(s.dataset[o]=n===!0?"":n)}if(t.classlist||t.class){const o=t.classlist||t.class;if(typeof o=="string")o.split(" ").forEach(n=>n&&s.classList.add(n));else if(typeof o=="object")for(const n in o){const r=typeof o[n]=="function"?o[n](t,t.state,t.context):o[n];r&&s.classList.add(typeof r=="string"?r:n)}}}}function Ot(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function Ks(t){if(!t||typeof t!="object")return!1;for(const s in t){const o=t[s];if(o&&typeof o=="object"&&!Array.isArray(o))return!0}return!1}function Lt(t,s){if(!t||!t.style||!s)return null;const o=t.style,n=[];for(const r in s){if(s[r]==null||r.charAt(0)==="&")continue;const a=Dt(r);n.push(a,mt(o,a),Uo(o,a))}return n}function mt(t,s){return typeof t.getPropertyValue=="function"?t.getPropertyValue(s):""}function Uo(t,s){return typeof t.getPropertyPriority=="function"?t.getPropertyPriority(s):""}function Dt(t){return Mt(t)?t:t.replace(/[A-Z]/g,s=>"-"+s.toLowerCase())}function Ws(t,s,o){if(!t||!t.style||!s||!s.length)return;const n=t.style,r=new Set;if(o&&typeof o=="object")for(const i in o)o[i]==null||i.charAt(0)==="&"||r.add(Dt(i));for(let i=0;i<s.length;i+=3){const a=s[i];r.has(a)||mt(n,a)===s[i+1]&&typeof n.removeProperty=="function"&&n.removeProperty(a)}}function Rt(t,s){if(!s||!t||!t.style)return!1;const o=t.style;for(let n=0;n<s.length;n+=3)if(mt(o,s[n])!==s[n+1]||Uo(o,s[n])!==s[n+2])return!1;return!0}const Mt=t=>t.charCodeAt(0)===45&&t.charCodeAt(1)===45;function zs(t){let s=null;for(const o in t)t[o]!=null&&o.charAt(0)!=="&"&&(s||(s=new Set),s.add(Dt(o)));return s}function Ys(t,s,o,n){const r=t.__ref;if(!r)return;let i=null;if(o)for(const a of o){if(n&&n.has(a))continue;const f=s[a];if(f==null||typeof f=="object")continue;const e=Dt(a);xo[e]&&(i||(i={}),i[e]=f)}r.__declaredLonghands=i}function Vo(t,s){const o=t.__ref,n=o&&o.__declaredLonghands;if(!n||!s)return null;let r=null;for(const i in n){if(s.has(i))continue;const a=xo[i];let f=!1;for(let e=0;e<a.length;e++)if(s.has(a[e])){f=!0;break}f&&(r||(r={}),r[i]=n[i])}return r}function Bo(t,s){const o=t.node;m(o,s);const n=zs(s);if(!n)return s;const r=t.__ref;if(r)if(r.__inlineCssKeys)for(const a of n)r.__inlineCssKeys.add(a);else r.__inlineCssKeys=new Set(n);const i=Vo(t,n);return i?(m(o,i),Object.assign({},s,i)):s}function qs(t){const s=t.__ref;if(!s||!s.__inlineCssKeys||!s.__declaredLonghands)return;const o=Vo(t,s.__inlineCssKeys);o&&m(t.node,o)}function m(t,s){if(!t||!s||!t.style)return;let o=null;for(const n in s){const r=s[n];if(r!=null){if(n.charAt(0)==="&"&&typeof r=="object"){o||(o={}),o[n]=r;continue}try{const i=String(r),a=Mt(n)?n:n.replace(/[A-Z]/g,h=>"-"+h.toLowerCase()),f=i.trim(),e=/\s*!important\s*$/.test(f),u=f.replace(/\s*!important\s*$/,"");t.style.setProperty(a,u,e?"important":"")}catch{}}}o&&Zs(t,o)}function Zs(t,s){const o=`_ds${So.scopedStyleId++}`;t.classList.add(o);const n=t.ownerDocument;let r=n.querySelector("style[data-smbls-scoped]");r||(r=n.createElement("style"),r.setAttribute("data-smbls-scoped",""),n.head.appendChild(r));let i="";for(const a in s){const f="."+o,e=a.replace(/&/g,f).split(",").map(h=>{const p=h.trim();return p.includes(f)?p:f+p}).join(", "),u=s[a];if(typeof u=="object"){let h="",p="";for(const y in u){const g=u[y];if(typeof g=="object"){const c=y.includes("&")?e.split(", ").map(d=>y.replace(/&/g,d)).join(", "):e.split(", ").map(d=>`${d} ${y}`).join(", ");let l="";for(const d in g)l+=`${d.replace(/[A-Z]/g,A=>"-"+A.toLowerCase())}: ${g[d]};`;p+=Ao(`${c} { ${l} }`,c)+`
|
|
5
|
-
`}else
|
|
6
|
-
`),p&&(i+=p)}}i&&(r.textContent+=i)}const Go=new Set;function Ho(t){if(!Array.isArray(t))return"";const s=[];for(let o=0;o<t.length;o++)typeof t[o]=="string"&&t[o].length&&s.push(t[o]);return s.sort(),s.join("|")}function Qs(t,s,o){const n=Ho(o);queueMicrotask(()=>{if(!t.__ref)return;let r;try{r=s(t,t.state,t.context)}catch{return}if(Ho(r)===n)return;const i=t.__ref.path?t.__ref.path.join("."):t.key||"?";Go.has(i)||(Go.add(i),console.warn(`[smbls] subscribeTo function at "${i}" resolved to a DIFFERENT key list one microtask after create \u2014 wired [${o.join(", ")||"(none)"}], probed [${Array.isArray(r)?r.join(", "):String(r)}]. subscribeTo's function form is resolved ONCE at element-create time (registerSubscribeToEffects, @symbo.ls/element create.js) \u2014 this element stays wired to the ORIGINAL list for its whole lifetime, so this drift is invisible to the reactive effect and any key only present in the new list will never trigger onUpdate. If the watched key genuinely is not known until later (e.g. a module config that loads after shell boot), route the write through an imperative call instead of subscribeTo \u2014 see functions/moduleOpenBridge.js's moduleOpenPage (workspace repo) for the house pattern.`))})}function Xs(t){const s=t.subscribeTo,o=typeof s=="function";let n=s;if(o)try{n=s(t,t.state,t.context)}catch{n=null}if(o&&et()&&Qs(t,s,Array.isArray(n)?n:[]),!Array.isArray(n)||n.length===0)return;const r=t.__ref;for(let i=0;i<n.length;i++){const a=n[i];if(typeof a!="string"||a.length===0)continue;const f=a.split("."),e=f[0],u=f.slice(1),h={value:!1},p=v(()=>{const y=t.state&&(Q(t.state)?t.state.root:null);if(!y||!Q(y))return;let g=y;g=g[e];for(let l=0;l<u.length&&!(g==null||typeof g!="object");l++)if(Q(g))g=g[u[l]];else break;if(!h.value)return;let c=!1;if(typeof t.onBeforeUpdate=="function"){const l=t.context?.designSystem;l&&M(l);try{if(ue(r)){const d=t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0});d&&typeof d.then=="function"?d.then(()=>$t(r,!1),A=>{$t(r,!0),t.context?.plugins?.length&&q("error",t,{hook:"onBeforeUpdate",error:A})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",A)}):($t(r,!1),d===!1&&(c=!0))}}catch(d){$t(r,!0),t.context?.plugins?.length&&q("error",t,{hook:"onBeforeUpdate",error:d})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",d)}finally{l&&N()}}if(!c&&t.node&&r.__effects)for(let l=0;l<r.__effects.length;l++){const d=r.__effects[l];d&&d!==p&&!d._disposed&&!d._isSubscribeToEffect&&typeof d._execute=="function"&&d._execute()}if(!c&&typeof t.onUpdate=="function"){const l=t.context?.designSystem;l&&M(l);try{t.onUpdate(t,t.state,t.context)}catch(d){t.context?.plugins?.length&&q("error",t,{hook:"onUpdate",error:d})||console.error("[DOMQL] subscribeTo onUpdate error:",d)}finally{l&&N()}}},{depth:r.path.length,label:k(r,"subscribeTo("+a+")")});h.value=!0,p._isSubscribeToEffect=!0,r.__effects.push(p)}}function to(t,s){return t.charCodeAt(0)===64&&t.length>1&&!t.startsWith("@media")&&!t.startsWith("@keyframes")&&!t.startsWith("@supports")&&!t.startsWith("@container")&&(t==="@dark"||t==="@light"||!s.context?.designSystem?.media?.[t.slice(1)])}function oo(t,s){if(t.charCodeAt(0)!==64||/^@(media|supports|container|keyframes)\b/.test(t))return t;const o=s.context?.designSystem?.media?.[t.slice(1)];return o?/^@(media|supports|container)\b/.test(o)?o:`@media ${o}`:t}const Ko=new Set;function Js(t,s){const o=s?.__ref?.path?s.__ref.path.join("."):s?.key||"?",n=o+"::"+t;Ko.has(n)||(Ko.add(n),console.warn(`[smbls/css] "${t}" at ${o} 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 ct(t,s,o,n){const r={},i=new Set,a=(f,e,u)=>{const h=u?new Set(Object.keys(r)):null;if(D[f]){const p=D[f](e,s,s.state,s.context);if(p){const y=Array.isArray(p)?p:[p];for(const g of y)g&&Object.assign(r,g)}}else r[f]=e;if(u)for(const p in r)h.has(p)||i.add(p)};for(const f in t){if(!Object.prototype.hasOwnProperty.call(t,f))continue;let e=t[f];if(typeof e=="function"&&(e=e(s,s.state,s.context)),e==null||typeof e=="function")continue;if(typeof e=="object"&&!Array.isArray(e)){if(f==="style"){for(const g in e){let c=e[g];if(typeof c=="function"&&(c=c(s,s.state,s.context)),c==null||typeof c=="function")continue;const l=typeof s[g]=="function"&&(D[g]||R&&R.has(g))||!!(n&&n.has(g));a(g,c,l)}continue}if(to(f,s)){const g=ct(e,s,!1,n);Object.keys(g).length&&(r[`[data-theme="${f.slice(1)}"] &`]=g);continue}if(/^[A-Z][A-Za-z0-9]*$/.test(f)){et()&&Js(f,s);continue}const p=oo(f,s),y=ct(e,s,!1,n);Object.keys(y).length&&(r[p]=y);continue}const u=typeof s[f]=="function"&&(D[f]||R&&R.has(f)),h=!!(n&&n.has(f));a(f,e,u||h)}if(o)for(const f in r)i.add(f);for(const f of i){const e=r[f];typeof e=="string"&&!e.includes("!important")&&(r[f]=e+" !important")}return r}const Nt=t=>!!t&&typeof t=="object"&&!Array.isArray(t);function Wo(t,s){for(const o in s){const n=s[o];t[o]=Nt(n)?Wo(Nt(t[o])?t[o]:{},n):n}return t}function ms(t,s){if(!Nt(s))return;let o;for(const n of t.split(" ")){const r=n?s[n]:null;Nt(r)&&(o=Wo(o||{},r))}return o}function so(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 o in t)if(Object.prototype.hasOwnProperty.call(t,o)&&so(t[o],s+1))return!0}return!1}function zo(t,s,o){if(!s||typeof s!="object"||Array.isArray(s))return null;if(to(t,o)){const i=ct(s,o,!1);return Object.keys(i).length?{cssProp:`[data-theme="${t.slice(1)}"] &`,block:i}:null}const n=oo(t,o),r=ct(s,o,!1);return Object.keys(r).length?{cssProp:n,block:r}:null}function te(t){const s=t.__ref;for(const o of Object.keys(t)){if(!qt(o))continue;const n=t[o];if(!n||typeof n!="object"||Array.isArray(n)||!so(n))continue;let r=null,i;const a=v(()=>{if(!t.node)return;const f=t.context?.designSystem;f&&M(f);let e,u=!1;try{const h=zo(o,n,t),p=h?Ot(h.block)+"::"+h.cssProp:null;if(p!==null&&p===i)u=!0;else if(i=p,h){const y=lt({[h.cssProp]:h.block},null,t.context?.cssPrefix);e=y?y.split(" ").filter(Boolean):null}else e=null}finally{f&&N()}if(!(u||!t.node.classList)){if(r)for(const h of r)t.node.classList.remove(h);if(e&&e.length)for(const h of e)t.node.classList.add(h);r=e}},{depth:s.path.length,label:k(s,"cssBlock("+o+")")});s.__effects.push(a)}}function oe(t){const s=t.__ref;s.__conditionalRunners=[];const o=new Map;for(const n of Object.keys(t)){const r=n.charAt(0);if(r!=="."&&r!=="!")continue;const i=n.slice(1);if(!i)continue;if(/[:@\s>~+[\]]/.test(i)){if(typeof console<"u"&&console.warn){const c=i.split(/[:@\s>~+[\]]/)[0];console.warn(`[smbls] conditional \`${n}\` on ${t.key||"?"} will never match \u2014 the whole string after \`${r}\` is read as one prop name. Nest the selector inside instead: \`${r}${c}: { '${i.slice(c.length)}': {...} }\`.`)}continue}const a=t[n];if(!a||typeof a!="object")continue;const f=r==="!",e={lastMatch:!1,appliedKeys:null,appliedClasses:null},u=new Set;for(const c in a){if(!Object.prototype.hasOwnProperty.call(a,c))continue;const l=c.charAt(0),d=a[c];(l===":"||l==="@"||l==="&"||l==="[")&&d&&typeof d=="object"&&!Array.isArray(d)||u.add(c)}const h=()=>{let c;const l=t[i];if(l===void 0){const x=!!t.state&&i in t.state,_=t.state?t.state[i]:void 0;if(x||_!==void 0)c=_;else{const b=t.context?.cases?.[i];if(b===void 0)return;try{c=typeof b=="function"?b.call(t,t):b}catch(w){c=!1,s.__conditionalError=w,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${n}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,w?.message||w)}}}else if(typeof l=="function")try{c=l(t,t.state,t.context)}catch(x){c=!1,s.__conditionalError=x,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${n}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,x?.message||x)}else c=l;const d=f?!c:!!c;if(!t.node||d===e.lastMatch)return;e.lastMatch=d;const A=t.context?.designSystem;A&&M(A);try{if(d){const x={},_={};let b=!1;for(const S in a){if(!Object.prototype.hasOwnProperty.call(a,S))continue;const C=a[S],j=S.charAt(0);if((j===":"||j==="@"||j==="&"||j==="[")&&C&&typeof C=="object"&&!Array.isArray(C)){if(to(S,t)){const G=ct(C,t,!1,u);Object.keys(G).length&&(_[`[data-theme="${S.slice(1)}"] &`]=G,b=!0)}else{const G=oo(S,t),ot=ct(C,t,!1,u);Object.keys(ot).length&&(_[G]=ot,b=!0)}continue}const z=typeof C=="function"?C(t,t.state,t.context):C;if(z!=null)if(D[S]){const G=D[S](z,t,t.state,t.context);if(G){const ot=Array.isArray(G)?G:[G];for(const $ of ot)$&&Object.assign(x,$)}}else(R&&R.has(S)||Mt(S))&&(x[S]=z)}const w=Object.keys(x);if(w.length){m(t.node,x);for(const S of w)o.set(S,n);e.appliedKeys=w}else e.appliedKeys=null;if(b){const S=lt(_,null,t.context?.cssPrefix,{state:!0}),C=S?S.split(" ").filter(Boolean):[];if(C.length&&t.node.classList){for(const j of C)t.node.classList.add(j);e.appliedClasses=C}else e.appliedClasses=null}else if(e.appliedClasses){for(const S of e.appliedClasses)t.node.classList.remove(S);e.appliedClasses=null}}else{if(e.appliedKeys){for(const x of e.appliedKeys)o.get(x)===n&&(Mt(x)?t.node.style.removeProperty(x):t.node.style[x]="",o.delete(x));e.appliedKeys=null}if(e.appliedClasses){for(const x of e.appliedClasses)t.node.classList.remove(x);e.appliedClasses=null}}}finally{A&&N()}};s.__conditionalRunners.push(h);const p=P(t,t[i+"Deps"],h),y=v(p,{depth:s.path.length,label:k(s,"conditional("+n+")")}),g=s.__exec&&s.__exec[i]||t[i];y._sources.size===0&&typeof g=="function"&&et()&&console.warn(`[smbls] conditional \`${n}\` on ${t.key||"?"} subscribed to nothing \u2014 its predicate tracked no reactive read on its first run, so no state write will ever re-evaluate it (only a direct element.update() on this element re-runs it). If the predicate guards its state reads (\`in\`, short-circuits, \`?.\`), declare \`${i}Deps: [...]\` (state-key strings or \`(el, s) => \u2026\` selectors) so the subscription is armed unconditionally.`),s.__effects.push(y)}}const eo=new WeakSet;function se(t){const s=t.ownerDocument;!s||eo.has(s)||(eo.add(s),queueMicrotask(()=>{eo.delete(s);const o=s.body||s.documentElement;o&&o.offsetWidth}))}const no=new WeakSet;let Yo=!1;function qo(t){return t.startsWith("[data-theme=")||t.startsWith("@media")&&t.includes("prefers-color-scheme")}function ro(t,s){const o={...t};for(const n in s){const r=s[n],i=o[n];o[n]=r&&typeof r=="object"&&i&&typeof i=="object"?ro(i,r):r}return o}function Zo(t,s){const o={};for(const n in t){const r=t[n];if(r&&typeof r=="object"){const i=Zo(r,s);Object.keys(i).length&&(o[n]=i)}else s.has(n)||(o[n]=r)}return o}function Qo(t){const{node:s}=t;if(!s)return;if(Yo||(Yo=!0,lt({display:"none"})),no.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}no.add(t);const o=t.context?.designSystem;o&&M(o),go();try{const n={};let r=!1,i=[],a=null,f=null,e=null;const u=(c,l)=>{if(l&&typeof l=="object"&&qo(c)){f||(f={});const d=f[c];d&&(l=ro(d,l)),f[c]=l}else(l===null||typeof l!="object")&&(e||(e=new Set),e.add(c));n[c]=l};if(Object.prototype.hasOwnProperty.call(t,"theme")&&typeof t.theme!="function"&&D.theme){const c=D.theme(t.theme,t,t.state,t.context);if(c){const l=d=>{for(const A in d){const x=d[A];x&&typeof x=="object"&&qo(A)&&(a||(a={}),a[A]=x),n[A]=x}};if(Array.isArray(c))for(const d of c)d&&l(d);else l(c);r=!0}}const h=(c,l)=>{if(D[c]){const d=D[c](l,t,t.state,t.context);if(d){if(Array.isArray(d)){for(const A of d)if(A)for(const x in A)u(x,A[x])}else for(const A in d)u(A,d[A]);r=!0}}else if(R&&R.has(c))l!=null&&typeof l!="object"&&(u(c,l),r=!0);else if(c.charCodeAt(0)===45)l!=null&&typeof l!="object"&&(u(c,l),r=!0);else if((c.charAt(0)==="&"||c.charAt(0)==="@"||c.charAt(0)===":"||c.charAt(0)==="[")&&l&&typeof l=="object"&&!Array.isArray(l)){if(so(l))return;const d=zo(c,l,t);d&&(u(d.cssProp,d.block),r=!0)}};if(typeof t.class=="string"){const c=ms(t.class,t.context?.designSystem?.class);if(c)for(const l in c)h(l,c[l])}const p=e?new Set(e):null,y=t.tag||"div";for(const c of Object.keys(t)){if(typeof t[c]=="function"||K.has(c)||c==="theme")continue;const l=c.charCodeAt(0);l>=65&&l<=90||Z(c)||wo(y,c)||h(c,t[c])}if(a)for(const c in a){let l=e?Zo(a[c],e):a[c];f&&f[c]&&(l=ro(l,f[c])),Object.keys(l).length?n[c]=l:delete n[c]}if(Ys(t,n,e,p),r){n.display&&String(n.display).includes("!important")&&(s.style.setProperty("display",String(n.display).replace(/\s*!important\s*$/,""),"important"),delete n.display);const c=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;typeof c=="string"&&c!==""&&n.display&&n.display!==c&&(n.display=c);const l=lt(n,null,t.context?.cssPrefix);if(i=l?l.split(" ").filter(Boolean):[],l&&s.classList){const d=i;let A=!1;for(const x of d)s.classList.add(x),A||(x.charCodeAt(0)===95&&x.charCodeAt(1)===99||x.charCodeAt(0)===95&&x.indexOf("_c",1)!==-1)&&(A=!0);A&&se(s)}}const g=t.__ref;if(g){const c=g.__staticCssClasses;if(c&&s.classList){const l=new Set(i);for(const d of c)l.has(d)||s.classList.remove(d)}g.__staticCssClasses=i}qs(t)}finally{bo(),o&&N(),no.delete(t)}}const Fe=t=>!!D[t]||!!(R&&R.has(t))||typeof t=="string"&&t.charCodeAt(0)===45;function $e(t){t&&t.node&&Qo(t)}function Xo(t){const{node:s}=t;if(!s||!s.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const r in t.aria){const i=t.aria[r];if(typeof i=="function"||typeof i=="object"||i==null||typeof i=="string"&&i.includes("{{"))continue;const a="aria-"+r.replace(/[A-Z]/g,f=>"-"+f.toLowerCase());s.setAttribute(a,W(a,i))}const o=Ss(t);for(const r in o){const i=o[r];i!=null&&i!==!1&&typeof i!="function"&&typeof i!="object"&&s.setAttribute(r,i===!0?"":i)}const n=t.tag||"div";for(const r of Object.keys(t)){if(typeof t[r]=="function"||K.has(r)||r==="on"||o[r]!==void 0)continue;const i=r.charCodeAt(0);if(!(i>=65&&i<=90)&&!Z(r)&&!yt(n,r)&&dt(n,r)){let a=t[r];if(a==null)continue;if(typeof a=="string"&&a.includes("{{")){if(!Kt[r])continue;a=I.call(t,a,t.state)}if(a==null||typeof a=="function"||typeof a=="object"||a===!1&&!ht(pt(r)||r))continue;const f=pt(r)||r;s.setAttribute(f,W(f,a))}}}function Ie(t,s){const{node:o}=t;if(!o||!o.setAttribute)return;const n=s.charCodeAt(0);if(n>=65&&n<=90||Z(s))return;const r=t.tag||"div";if(yt(r,s)||!dt(r,s))return;const i=pt(s)||s,a=i.toLowerCase(),f=t.__ref&&t.__ref.__effects;let e=!1;if(f)for(let p=0;p<f.length;p++){const y=f[p];y&&y._attrName===a&&!y._disposed&&typeof y._execute=="function"&&(e=!0,y._execute())}if(e)return;let u=t[s];const h=Kt[s];if(h&&u!=null){const p=h(t);p!==void 0&&(u=p)}typeof u=="string"&&u.includes("{{")&&(u=I.call(t,u,t.state)),u==null||u===!1&&!ht(i)?o.removeAttribute(i):typeof u!="function"&&typeof u!="object"&&o.setAttribute(i,W(i,u))}function ee(t,s){const o=t.node,n=t.__ref;let r=n.__autoGrow;if(!s){if(r&&r.active){try{o.removeEventListener("input",r.resize)}catch{}mo(r),J.delete(t),o.style.height="",r.appliedMax!=null&&o.style.maxHeight===r.appliedMax&&(o.style.maxHeight=""),ts(o,r,!1),r.active=!1,r.appliedMax=null,r.lastMeasure=0}return}r||(r=n.__autoGrow={active:!1,appliedMax:null,lastMeasure:0,lastWidth:null,watch:null,awaitingLayout:!1,appliedScroll:!1,fontsHooked:!1,attachAttempts:0,firstAttemptAt:null,resize:()=>{if(!o.isConnected){kt(t,!0);return}if(!(o.scrollHeight>0)){r.awaitingLayout=!0,Jo(t,r);return}r.awaitingLayout=!1;const a=o.style.height;o.style.height="0px";const f=o.scrollHeight;if(!(f>0)){o.style.height=a;return}const e=ie(o),u=e!=null&&f>e;o.style.height=(u?e:f)+"px",ts(o,r,u),r.lastMeasure=f,r.lastWidth=o.clientWidth,Jo(t,r)}},n.__eventCleanup||(n.__eventCleanup=[]),n.__eventCleanup.push(()=>{try{o.removeEventListener("input",r.resize)}catch{}mo(r),J.delete(t)})),r.active||(o.addEventListener("input",r.resize),r.active=!0,re(t,r));const i=typeof s=="object"&&s.max!=null?String(s.max):null;i!==r.appliedMax&&(i==null?r.appliedMax!=null&&o.style.maxHeight===r.appliedMax&&(o.style.maxHeight=""):o.style.maxHeight=i,r.appliedMax=i),r.resize()}function kt(t,s){const o=t.__ref?.__autoGrow;o&&(s&&(o.attachAttempts=0,o.firstAttemptAt=null),J.add(t),Et())}function ne(){const t=Array.from(J);J.clear();for(let s=0;s<t.length;s++){const o=t[s],n=o.node,r=o.__ref?.__autoGrow;if(!(!n||!r||!r.active)){if(!n.isConnected){r.firstAttemptAt==null&&(r.firstAttemptAt=rt()),r.attachAttempts+=1,r.attachAttempts<=vo&&rt()-r.firstAttemptAt<jo&&(J.add(o),Et());continue}r.attachAttempts=0,r.firstAttemptAt=null,r.resize()}}}function Jo(t,s){if(s.watch)return;const o=t.node;if(!o)return;const n=o.ownerDocument&&o.ownerDocument.defaultView,r=n&&n.ResizeObserver||(typeof ResizeObserver=="function"?ResizeObserver:null);if(typeof r!="function")return;const i=()=>{if(!s.active||!o.isConnected||!(o.scrollHeight>0))return;if(s.awaitingLayout){s.awaitingLayout=!1,kt(t,!0);return}const f=o.clientWidth;s.lastWidth!=null&&Math.abs(f-s.lastWidth)<.5||(s.lastWidth=f,kt(t,!0))};let a;try{a=new r(i),a.observe(o)}catch{return}s.watch=a}function mo(t){const s=t.watch;if(s){t.watch=null;try{s.disconnect()}catch{}}}function re(t,s){if(s.fontsHooked)return;s.fontsHooked=!0;const o=t.node&&t.node.ownerDocument,n=o&&o.fonts&&o.fonts.ready;!n||typeof n.then!="function"||n.then(()=>{s.active&&t.node&&kt(t,!0)},()=>{})}function ie(t){const s=t.ownerDocument&&t.ownerDocument.defaultView;let o;try{o=s&&s.getComputedStyle?s.getComputedStyle(t):null}catch{o=null}if(!o)return null;const n=h=>typeof h=="string"&&/^\s*-?\d*\.?\d+px\s*$/.test(h)?parseFloat(h):null,r=n(o.maxHeight);if(r==null||!(r>0))return null;const i=(n(o.paddingTop)||0)+(n(o.paddingBottom)||0),a=(n(o.borderTopWidth)||0)+(n(o.borderBottomWidth)||0),f=o.boxSizing==="border-box"?r-a:r+i,e=n(o.lineHeight);if(!(e>0))return f;const u=Math.floor((f-i)/e+1e-6);return u>=1?u*e+i:f}function ts(t,s,o){o?s.appliedScroll||(t.style.overflowY="auto",s.appliedScroll=!0):s.appliedScroll&&(t.style.overflowY==="auto"&&(t.style.overflowY=""),s.appliedScroll=!1)}const os=["srcObject","muted"],ce=(t,s)=>t==="muted"?s===!0||s===""||s==="true"||s==="muted":s??null;function fe(t){const s=t.node,o=t.__ref;if(!(!s||!o))for(let n=0;n<os.length;n++){const r=os[n],i=t[r];if(i===void 0||!(r in s))continue;const a=f=>{const e=ce(r,f);if(s[r]!==e)try{s[r]=e}catch(u){O(o,r,u)}};if(typeof i=="function"){const f=P(t,t[r+"Deps"],i),e=v(()=>{try{a(f(t,t.state,t.context))}catch(u){O(o,r,u)}},{depth:o.path.length,label:k(o,r)});o.__effects.push(e),o.__exec[r]=i}else a(i);r==="srcObject"&&(o.__releaseMedia=()=>{try{s.srcObject!=null&&(s.srcObject=null)}catch{}})}}function ss(t){if(!t.autoGrow)return;const s=t.node;if(!s||s.tagName!=="TEXTAREA")return;const o=t.__ref,n=t.autoGrow,r=typeof n=="function"?P(t,t.autoGrowDeps,n):null,i=v(()=>{const a=t.autoGrow;let f=a;if(typeof a=="function")try{f=(a===n&&r?r:a)(t,t.state,t.context)}catch{f=null}ee(t,f)},{depth:o.path.length,label:k(o,"autoGrow")});o.__effects||(o.__effects=[]),o.__effects.push(i),r&&(o.__exec.autoGrow=n)}const es=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function ns(t,s){for(const o of Object.keys(t)){if(!Z(o)||es.has(o))continue;const n=gs(o);if(n){_s(n,t,t[o]);continue}let r=t[o];if(typeof r=="string"&&/^[A-Za-z_$][\w$]*$/.test(r)){const a=r;r=function(e){return t.call(a,e)}}if(typeof r!="function")continue;const i=Ps(o);hs.has(i)||ys(Os(i),t,r)}ae(t)}function ae(t){const s=t.node;if(!s||!s.addEventListener)return;const o={};let n=!1;for(const y of es){const g=t[y];typeof g=="function"&&(o[y]=g,n=!0)}if(!n)return;const r=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,i=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let a=0,f=0,e=0,u=!1;const h=y=>{const g=y.touches&&y.touches[0]||y.changedTouches&&y.changedTouches[0];g&&(a=g.clientX,f=g.clientY,e=Date.now(),u=!0)},p=y=>{if(!u)return;u=!1;const g=y.changedTouches&&y.changedTouches[0]||y.touches&&y.touches[0];if(!g)return;const c=g.clientX-a,l=g.clientY-f,d=Date.now()-e;if(d>i)return;const A=Math.abs(c),x=Math.abs(l);if(Math.max(A,x)<r)return;let _;if(A>x*1.2)_=c<0?"left":"right";else if(x>A*1.2)_=l<0?"up":"down";else return;const b="onSwipe"+_.charAt(0).toUpperCase()+_.slice(1),w=o[b],S=o.onSwipe;w&&w.call(t,y,t,t.state,t.context),S&&S.call(t,{direction:_,dx:c,dy:l,dt:d,event:y},t,t.state,t.context)};s.addEventListener("touchstart",h,{passive:!0}),s.addEventListener("touchend",p,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("touchstart",h)}catch{}try{s.removeEventListener("touchend",p)}catch{}})}function tt(t,s){const o={...t};for(const n in s){const r=o[n],i=s[n];r&&i&&typeof r=="object"&&typeof i=="object"&&!Array.isArray(r)&&!Array.isArray(i)&&typeof r!="function"&&typeof i!="function"?o[n]=tt(r,i):o[n]=i}return o}function io(t,s,o,n,r){if(!s||!t.node)return;const i=t.childExtends,a=it(t,"childProps");if(Array.isArray(s)){const f=t.tag==="fragment",e=t.context?.document||globalThis.document,u=f?null:e?.createDocumentFragment();if(!f&&!u)return;const h=t.childProps,p=t.childrenAs,y=x=>{let _=s[x];const b=_;(typeof _=="string"||typeof _=="number")&&(_={text:_});let w=h;if(typeof h=="function")try{w=h(t,_)}catch{w=null}let S=typeof h=="function"?wt(w):a;if(r&&p!=="state"&&(S=St(S,wt(b))),p==="state"){let j=b;(typeof b=="string"||typeof b=="number")&&(j={value:b,text:b}),_=w?{...w,state:j}:{state:j}}else w&&(_=tt(w,_));if(i&&!_.ignoreChildExtends)if(_.extends){const j=Array.isArray(_.extends)?_.extends:[_.extends],z=Array.isArray(i)?i:[i];_={..._,extends:[...z,...j]}}else _={..._,extends:i};const C=To(_?.key,b,x);try{return X(Ct(_,S),t,C,o)}catch(j){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} (initial render, skipping this row):`,j?.message||j)}return null}},g=t.__ref;if(!(n===!0&&!f&&!!g&&(o?.mountYield===!0||t.yieldChildren===!0))){for(let x=0;x<s.length;x++){const _=y(x);!f&&_?.node&&u.appendChild(_.node)}return f||t.node.appendChild(u),!0}const l=g.__childrenChunkGen=(g.__childrenChunkGen||0)+1;ho();let d=null;const A=x=>{if(g.__disposed||g.__childrenChunkGen!==l){d&&d.parentNode&&d.remove();return}for(let _=x;_<s.length;_++){const b=y(_);if(b?.node&&(d?t.node.insertBefore(b.node,d):u.appendChild(b.node)),_+1<s.length&&po()){d||(d=e.createComment("smbls-mount"),u.appendChild(d),t.node.appendChild(u));const w=_+1;_o(()=>A(w));return}}d?(d.remove(),t.node.tagName==="SELECT"&&Ft(t,!0)):t.node.appendChild(u)};return A(0),yo(),!0}if(typeof s=="string"){const f=Po(s,t);if(Array.isArray(f))return io(t,f,o,n,!0)}if(typeof s=="object")for(const f in s){if(K.has(f))continue;let e=s[f];if(e==null||e===!1)continue;const u=r?St(a,wt(e)):a;if((typeof e=="string"||typeof e=="number")&&(e={text:e}),t.childProps&&(e=tt(t.childProps,e)),i&&!e.ignoreChildExtends)if(e.extends){const h=Array.isArray(e.extends)?e.extends:[e.extends],p=Array.isArray(i)?i:[i];e={...e,extends:[...p,...h]}}else e={...e,extends:i};X(Ct(e,u),t,f,o)}}function Ft(t,s){const o=t.node;if(!o||o.tagName!=="SELECT")return;const n=o.options;if(!n||!n.length)return;const r=t.__ref,i=r&&r.__exec&&r.__exec.value,a=typeof i=="function",f=t.value!=null&&typeof t.value!="function";if(a||f){let h;if(a)try{h=i(t,t.state,t.context)}catch{return}else h=t.value,typeof h=="string"&&h.includes("{{")&&(h=I.call(t,h,t.state));const p=h==null?"":String(h);o.value!==p&&(o.value=p);return}const e=s||!(r&&r.__selectSynced);if(r&&(r.__selectSynced=!0),!e)return;let u=-1;for(let h=0;h<n.length;h++)n[h].defaultSelected&&(u=h);u>=0&&o.selectedIndex!==u&&(o.selectedIndex=u)}function rs(t,s){let{children:o,content:n}=t;const r=t.childExtends,i=typeof o=="function"||Ro(t,"children");if(typeof o=="function"){const c=o;try{o=c(t,t.state,t.context)}catch(_){if(o=void 0,typeof console<"u"&&console.error){const b=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${b} (initial run, treating as empty):`,_?.message||_)}}Mo(t,o),t.children=o;const l=t.__ref;let d=!1;const A=P(t,t.childrenDeps,c),x=v(()=>{const _=d;d=!0;let b;try{b=A(t,t.state,t.context)}catch($){if(typeof console<"u"&&console.error){const V=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${V}${_?"":" (initial tracking run)"}:`,$?.message||$)}return}if(!_||b===t.children)return;Mo(t,b),t.children=b,l.__childrenChunkGen!=null&&l.__childrenChunkGen++;const w=typeof t.onContentUpdate=="function",S=w?[]:null,C=w?[]:null,j=w?[]:null;if(Array.isArray(b)&&t.childrenAs==="state"){const $=t.childProps,V=[],fo=new Map;for(let E=0;E<b.length;E++){const B=b[E];let T=$;if(typeof $=="function")try{T=$(t,B)}catch{T=null}const Y=To(T&&T.key,B,E);V.push(Y),fo.set(Y,{rawChild:B,childProps:T})}const cs=new Set(V),fs=l.__children.slice();for(const E of fs)if(!cs.has(E)){const B=t[E];B?.remove&&B.remove(),delete t[E],C&&C.push(E)}const ft=t.childExtends,vt=t.tag==="fragment",as=t.context?.document||globalThis.document,at=vt?null:as?.createDocumentFragment(),It=new Set;for(const E of V){const B=fo.get(E),T=B.rawChild,Y=t[E];if(Y&&Y.state){if(T&&typeof T=="object"){const L=Y.state,st=L.$replace||L.replace,ao=L.$update||L.update;try{if(typeof st=="function")st.call(L,T);else if(typeof ao=="function"){for(const U in L)if(!(U==="__element"||U==="root"||U==="parent"||U==="update")&&!Object.prototype.hasOwnProperty.call(T,U))try{L[U]=void 0}catch{}ao.call(L,T)}else for(const U in T)L[U]=T[U]}catch(U){if(typeof console<"u"&&console.error){const ls=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${E}" failed to patch at ${ls} (reconcile, keeping its previous data for this pass):`,U?.message||U)}}}j&&j.push(E);continue}let Ut=T;(typeof T=="string"||typeof T=="number")&&(Ut={value:T,text:T});const Vt=B.childProps;let H=Vt?{...Vt,state:Ut}:{state:Ut};const us=typeof $=="function"?wt(Vt):it(t,"childProps");if(ft&&!H.ignoreChildExtends)if(H.extends){const L=Array.isArray(H.extends)?H.extends:[H.extends],st=Array.isArray(ft)?ft:[ft];H={...H,extends:[...st,...L]}}else H={...H,extends:ft};let Bt;try{Bt=X(Ct(H,us),t,E,s)}catch(L){if(typeof console<"u"&&console.error){const st=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${E}" failed to construct at ${st} (reconcile, skipping this row):`,L?.message||L)}It.add(E);continue}!vt&&Bt?.node&&at&&at.appendChild(Bt.node),S&&S.push(E)}if(!vt&&at&&at.childNodes.length&&t.node&&t.node.appendChild(at),!vt&&t.node){let E=null;for(const B of V){const T=t[B]?.node;if(!T)continue;const Y=E?E.nextSibling:t.node.firstChild;T!==Y&&t.node.insertBefore(T,Y),E=T}}l.__children=It.size?V.filter(E=>!It.has(E)):V,w&&(S.length||C.length)&&Eo(t,{added:S,removed:C,kept:j}),Ft(t,!1);return}const ot=w?[...l.__children]:null;for(const $ of[...l.__children]){const V=t[$];V?.remove&&V.remove(),delete t[$]}l.__children=[],io(t,b,s,!1,!0),Ft(t,!1),w&&Eo(t,{added:[...l.__children],removed:ot,kept:[]})},{depth:l.path.length,label:k(l,"children")});l.__effects.push(x)}const a=io(t,o,s,!0,i);if(n!=null&&!(n&&n.__ref)){let c=n;if(typeof c=="string"||typeof c=="number"?c={text:c}:typeof c!="object"&&(c={}),t.childProps&&(c=tt(t.childProps,c)),r&&!c.ignoreChildExtends)if(c.extends){const d=Array.isArray(c.extends)?c.extends:[c.extends],A=Array.isArray(r)?r:[r];c={...c,extends:[...A,...d]}}else c={...c,extends:r};const l=St(it(t,"childProps"),it(t,"content"));X(Ct(c,l),t,"content",s)}if(o&&!a)return;const f=t.context?.components||{},e=t.__ref&&t.__ref.__runtimeSource,u=e?{}:null;{const c=Object.keys(t);for(let l=0;l<c.length;l++){const d=c[l];if(!d.endsWith("Extends")||typeof t[d]!="string")continue;const A=d.slice(0,-7);if(!A||A.charCodeAt(0)<65||A.charCodeAt(0)>90)continue;const x={extends:t[d]};delete t[d];for(let _=l+1;_<c.length;_++){const b=c[_],w=b.charCodeAt(0);if(w>=65&&w<=90||K.has(b)||typeof t[b]=="function"&&(b.startsWith("on")||b.startsWith(".")))break;const S=t[b];S!==void 0&&(x[b]=S,delete t[b],u&&xt(e,b)&&(u[A]||(u[A]={}),u[A][b]=e[b]))}t[A]&&typeof t[A]=="object"?t[A]={...x,...t[A]}:t[A]=x}}const h=s?.mountYield===!0||t.yieldChildren===!0,p=Object.keys(t),y=c=>{if(K.has(c)||typeof t[c]!="object"||t[c]===null)return;const l=c.charCodeAt(0);if(l<65||l>90)return;let d=t[c];if(d.__ref)return;if(!d.extends&&!d.extend){const x=f[c]||f[`smbls.${c}`];x&&(d={...d,extends:x})}if(t.childProps&&(d=tt(t.childProps,d)),r&&!d.ignoreChildExtends)if(d.extends){const x=Array.isArray(d.extends)?d.extends:[d.extends],_=Array.isArray(r)?r:[r];d={...d,extends:[..._,...x]}}else d={...d,extends:r};const A=e?St(it(t,"childProps"),St(u[c]||null,it(t,c))):null;X(Ct(d,A),t,c,s)};if(!h){for(const c of p)y(c);return}ho();const g=c=>{for(let l=c;l<p.length;l++)if(y(p[l]),l+1<p.length&&po()){const d=l+1;_o(()=>g(d));return}};g(0),yo()}function is(t,s,o){const{node:n}=t;if(!n)return;n.ref=t;const r=s?.tag==="fragment"?s.__ref?.__fragmentAnchor:null;if(r){const a=r.parentNode;if(a){if(o?.position==="before"&&o.node)a.insertBefore(n,o.node);else if(o?.position==="after"&&o.node){const f=o.node.nextSibling;a.insertBefore(n,f||r)}else a.insertBefore(n,r);return}}const i=s?.node||(s?.nodeType?s:null);if(i)if(o?.position==="before"&&o.node)i.insertBefore(n,o.node);else if(o?.position==="after"&&o.node){const a=o.node.nextSibling;a?i.insertBefore(n,a):i.appendChild(n)}else i.appendChild(n)}const co=3;function ue(t){return!t||t.__inBeforeUpdate||(t.__beforeUpdateFailCount||0)>=co?!1:(t.__inBeforeUpdate=!0,!0)}function $t(t,s){t&&(t.__inBeforeUpdate=!1,s?(t.__beforeUpdateFailCount=(t.__beforeUpdateFailCount||0)+1,t.__beforeUpdateFailCount===co&&typeof console<"u"&&console.error&&console.error(`[DOMQL] onBeforeUpdate failed ${co}x in a row on this element \u2014 pausing automatic retries until a future prop/state change re-arms it.`)):t.__beforeUpdateFailCount=0)}function F(t,s,o){const n=t.charAt(0).toLowerCase()+t.slice(1);s.context?.plugins?.length&&q(n,s,o);const r="on"+t,i=s[r];if(typeof i=="function"){const e=t==="Render"?"__inRender":t==="RenderRouter"?"__inRenderRouter":null;if(e){if(s.__ref[e])return!0;s.__ref[e]=!0}const u=s.context?.designSystem;u&&M(u);let h=!!e;try{const p=i(s,s.state,s.context,o);if(p&&typeof p.then=="function"){const y=s.__ref;return p.catch(g=>{s.context?.plugins?.length&&q("error",s,{hook:r,error:g})||console.error(`[DOMQL] Lifecycle "${r}" error:`,g)}).finally(()=>{e&&y&&(y[e]=!1)}),h=!1,!0}if(p===!1)return!1}catch(p){if(s.context?.plugins?.length&&q("error",s,{hook:r,error:p})||console.error(`[DOMQL] Lifecycle "${r}" error:`,p),s.context?.strictMode)throw p}finally{u&&N(),h&&s.__ref&&(s.__ref[e]=!1)}}return!0}var Ue=X;export{co as BEFORE_UPDATE_MAX_CONSECUTIVE_FAILURES,ue as acquireBeforeUpdateGuard,X as create,Ue as default,zt as flushMounts,Fe as isStaticCssProp,$e as recompileStaticCss,Ie as reconcileAttrProp,$t as releaseBeforeUpdateGuard,Pt as writeElementText};
|
|
4
|
+
`):"")}}if($t(n,!0),fs(n,o,r),typeof n.html=="function"&&n.node&&!n.node.innerHTML){const h=n.context?.designSystem;h&&M(h);try{const _=n.html(n,n.state,n.context);_!=null&&typeof _!="function"&&(n.node.innerHTML=_)}catch{}finally{h&&N()}}if(F("Create",n,e),F("Complete",n,e),F("Render",n,e),F("RenderRouter",n,e),qt(n,e),typeof n.onFrame=="function"){const h=n.onFrame,_=n.context?.designSystem,c=()=>{if(n.node){if(n.node.isConnected){_&&M(_);try{h(n,n.state,n.context)}catch(u){console.error("[DOMQL] onFrame error:",u)}finally{_&&N()}}requestAnimationFrame(c)}};requestAnimationFrame(c)}return n}function Oo(t,o,s,e,r,i){if(s&&!o.extends&&!o.extend){const u=s.indexOf("_"),l=s.indexOf(".");let g=u>0?u:-1;if(l>0&&(g<0||l<g)&&(g=l),g>0){const b=s.substring(0,g),A=t.context?.components;A&&(A[b]||A["smbls."+b])?o={...o,extends:b}:A&&nt()&&(/^[A-Z]\w*_\d+$/.test(s)||/^[A-Z]\w*\.\w+$/.test(s))&&console.warn(`[smbls] auto-extend: key "${s}" looks like an instance of "${b}" but neither "${b}" nor "smbls.${b}" is registered in context.components \u2014 element will render as a plain <div>. Register the base component or rename the key.`)}}As(t,o,i);const a=new Set(["childProps","attr","style","scope","data"]),f=t.props&&typeof t.props=="object"?t.props:null;for(const u in o){if(u==="parent"||u==="node"||u==="__ref"||u==="extends"||u==="context"||u==="props")continue;if(u==="key"){e&&(t.key=e);continue}const l=o[u],g=t[u],b=g&&l&&typeof g=="object"&&typeof l=="object"&&!Array.isArray(g)&&!Array.isArray(l)&&typeof g!="function"&&typeof l!="function";b&&u.charCodeAt(0)>=65&&u.charCodeAt(0)<=90?t[u]=bt(g,l):b&&a.has(u)?t[u]={...g,...l}:b&&Zt(u)?t[u]=bt(g,l):t[u]=l}function n(u){for(const l in u){const g=u[l],b=t[l],A=b&&g&&typeof b=="object"&&typeof g=="object"&&!Array.isArray(b)&&!Array.isArray(g)&&typeof b!="function"&&typeof g!="function";A&&l.charCodeAt(0)>=65&&l.charCodeAt(0)<=90?t[l]=bt(b,g):A&&a.has(l)?t[l]={...b,...g}:A&&Zt(l)?t[l]=bt(b,g):t[l]=g}}f&&n(f),o.props&&typeof o.props=="object"&&n(o.props),o.classlist!==void 0&&(t.classlist=o.classlist),o.text!==void 0&&(t.text=o.text),o.html!==void 0&&(t.html=o.html);const d=t.scope&&typeof t.scope=="object"?t.scope:null,y=r?.scope,p=t.context&&typeof t.context.globalScope=="object"&&t.context.globalScope||null,h=y||p||null;if(o.scope!==void 0||d){const u={};d&&Object.assign(u,d),o.scope!==void 0&&Object.assign(u,o.scope),t.scope=hs(u,h)}else h&&(t.scope=h);o.if!==void 0&&(t.if=o.if);const _=t.__ref,c=Ks(t,_&&_.__runtimeSource);return _&&(_.__declaredArrays=c||void 0),xs(t),Ns(t,r,o),o}const Ds=new Set(["key","parent","context","__ref"]);function Rs(t,o){for(const r of Object.keys(t))Ds.has(r)||delete t[r];const s=lo();s&&jt(null);let e=o.definition;if(!e.extends&&!e.extend&&typeof o.key=="string"){const r=t.context?.components||{},i=r[o.key]||r["smbls."+o.key];i&&(e={...e,extends:i})}try{Oo(t,e,o.key,o.ownKey,t.parent,o.options)}finally{s&&jt(s)}}function Ms(t,o,s){const e=s||{},r=f=>!!(e[f]||e["smbls."+f]),i=[],a=[];if(t.extends&&a.push(...Array.isArray(t.extends)?t.extends:[t.extends]),t.extend&&a.push(...Array.isArray(t.extend)?t.extend:[t.extend]),a.length){for(const f of a){if(typeof f!="string")continue;const n=f.includes(">")?f.split(">")[0].trim():f;r(n)||i.push(n)}return i}if(typeof o=="string"&&/^[A-Z]/.test(o)){let f=-1;const n=o.indexOf("_"),d=o.indexOf(".");n>0&&(f=n),d>0&&(f<0||d<f)&&(f=d);const y=f>0?o.substring(0,f):o;r(y)||i.push(y)}return i}function Ns(t,o,s){const e=!o,r=s.state&&typeof s.state=="object"&&!Array.isArray(s.state)&&Object.keys(s.state).length===0,i=e&&r&&t.context?.state,a=s.state!==void 0&&!i?s.state:t.state&&!Q(t.state)?t.state:void 0;if(a==null){if(o?.state)t.state=o.state,ut(t,t.state);else if(t.context?.state){const f=t.context.state,n={...f},d=t.context?.polyglot;if(d?.translations){const y=t.context,p=f.lang||d.defaultLang||"en",h=new Set,_=(l,g)=>{h.has(l)||ws(y,l,n)&&(n[l]=g,h.add(l),Ss(y,l,g))},c=d.translations[p];if(c&&typeof c=="object")for(const l in c)_(l,c[l]);const u=new Set(d.languages||[]);for(const l in d.translations)u.has(l)||_(l,d.translations[l])}t.state=Q(n)?n:Ht(n),t.state.__element=t,t.state.root=t.state,ut(t,t.state),Et.promoteActiveRootState?.(f,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),ut(t,t.state);return}if(typeof a=="string"){if(t.state=Lo(a,o),t.state&&typeof t.state=="object"&&!Q(t.state)){const f=o?.state?.root||o?.state||t.state;Object.defineProperty(t.state,"root",{value:f,enumerable:!1,configurable:!0,writable:!0})}ut(t,t.state);return}if(typeof a=="function"){const f=a(t,o?.state);t.state=Q(f)?f:Ht(f||{})}else Q(a)?t.state=a:t.state=Ht({...a});t.state.__element=t,o?.state?(t.state.parent=o.state,t.state.root=o.state.root||o.state):t.state.root=t.state,ut(t,t.state),Et.promoteActiveRootState?.(a,t.state)}function Qt(t,o){if(!o)return t;const s=o.split("/");let e=t;for(const r of s){if(e==null)return{};e=e[r]}return e??{}}function Lo(t,o){if(!o)return{};if(t===".")return o.state||{};if(t.startsWith("../")){const r=t.slice(3);return r?Qt(o.state,r):o.state??{}}if(t.startsWith("~/")){const r=o.state?.root||o.state,i=t.slice(2);return i?Qt(r,i):r??{}}if(o.state?.[t]!==void 0)return o.state[t];const s=Qt(o.state,t);if(s!=null&&Object.keys(s).length>0)return s;const e=o.context?.polyglot;if(e?.translations){const r=o.state?.root?.lang||e.defaultLang||"en",i=e.translations[r];if(i?.[t]!==void 0)return i[t];if(e.translations[t]!==void 0)return e.translations[t]}return{}}const Fs=new Set(["s","state","ctx","context"]);function $s(t){try{const s=(typeof Et.getFunctionSource=="function"?Et.getFunctionSource(t):Function.prototype.toString.call(t)).match(/^[^(]*\(([^)]*)\)/);return s?s[1].split(",").map(e=>e.trim().split("=")[0].trim()).filter(Boolean):[]}catch{return[]}}function Is(t){if(typeof t!="function"||t.length!==2)return!1;const o=$s(t);if(o.length<2)return!1;const s=o[1].replace(/[{}[\]]/g,"").trim();return s.length>0&&!Fs.has(s)}function Us(t){const o=t.__ref,s=t.tag||"div",e=t.context?.designSystem,r=[],i=Object.keys(t);for(let a=0;a<i.length;a++){const f=i[a];if(typeof t[f]!="function"||K.has(f))continue;const n=f.charCodeAt(0);n>=65&&n<=90||Z(f)||D[f]||R&&R.has(f)||lt(s,f)||(nt()&&Is(t[f])&&console.warn(`[smbls] custom prop "${f}"${t.key?` on key "${t.key}"`:""} is a function \u2014 it will be auto-invoked on read and its RETURN VALUE stored, not preserved as a callable reference. If you meant to stash a callback, use el.call('${f}', \u2026) instead of reading el.${f}(\u2026) directly (see RULES.md Rule 8).`),r.push({prop:f,fn:t[f]}))}for(let a=0;a<r.length;a++){const{prop:f,fn:n}=r[a];o.__exec[f]=n,Object.defineProperty(t,f,{get(){e&&M(e);try{return n(t,t.state,t.context)}catch{return}finally{e&&N()}},set(d){delete o.__exec[f],Object.defineProperty(t,f,{value:d,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function Vs(t,o){if(!(!Array.isArray(o)||o.length===0))for(let s=0;s<o.length;s++){const e=o[s];try{typeof e=="function"?e(t,t.state,t.context):typeof e=="string"&&t.state?.[e]}catch{}}}function T(t,o,s){return!Array.isArray(o)||o.length===0?s:function(...e){return Vs(t,o),s.apply(this,e)}}function At(t,o){if(!(!t||Array.isArray(t)||typeof t!="object"))return t[o]}function k(t,o){return()=>t.path.join(".")+"::"+o}const Do=new Set;function O(t,o,s){if(!nt())return;const e=k(t,o)();Do.has(e)||(Do.add(e),console.warn(`[smbls] "${o}" effect threw on ${t.path.join(".")} \u2014 keeping previous value:`,s?.message||s))}const Ro=/(['"`])((?:\\.|(?!\1)[^\\])*)\1/g,Bs=(t,o)=>{let s;try{s=String(t)}catch{return}if(!s.includes("{{"))return;Ro.lastIndex=0;let e;for(;(e=Ro.exec(s))!==null;)e[2].includes("{{")&&o.add(e[2])},Gs=(t,o)=>!Z(t)&&!yt(o,t),Mo=(t,o,s,e,r)=>{if(typeof o=="string"){!r&&o.includes("{{")&&s.add(o);return}typeof o=="function"&&Gs(t,e)&&Bs(o,s)},Xt=new WeakMap,xt=(t,o)=>Object.prototype.hasOwnProperty.call(t,o),wt=t=>{if(typeof t=="string"||typeof t=="number")return{text:t};if(!t||typeof t!="object"||Array.isArray(t))return null;const o=t.props;return o&&typeof o=="object"&&!Array.isArray(o)?tt(t,o):t},St=(t,o)=>t&&o?tt(t,o):t||o||null,No=(t,o)=>{const s=t.__ref&&t.__ref.__runtimeSource;return!!s&&xt(s,o)},it=(t,o)=>No(t,o)?wt(t.__ref.__runtimeSource[o]):null,Ct=(t,o)=>(o&&t&&typeof t=="object"&&Xt.set(t,o),t),Hs=t=>{if(!t||typeof t!="object")return;const o=Xt.get(t);return o&&Xt.delete(t),o},Jt=(t,o,s)=>{if(typeof t=="string"){t.includes("{{")&&o.add(t);return}if(!(!t||typeof t!="object"||s.has(t))){if(s.add(t),Array.isArray(t)){for(let e=0;e<t.length;e++)Jt(t[e],o,s);return}if(!t.__ref)for(const e of Object.keys(t)){if(e==="state")continue;const r=Object.getOwnPropertyDescriptor(t,e);r&&"value"in r&&Jt(r.value,o,s)}}},Ks=(t,o)=>{let s=null;for(const e of Object.keys(t)){if(K.has(e)||o&&xt(o,e))continue;const r=Object.getOwnPropertyDescriptor(t,e),i=r&&r.value;if(!Array.isArray(i))continue;const a=new Set;Jt(i,a,new Set),a.size&&(s||(s=new Map),s.set(i,a))}return s},Fo=(t,o)=>{if(Array.isArray(o))for(let s=t;s;s=s.parent){const e=s.__ref&&s.__ref.__declaredArrays,r=e&&e.get(o);if(!r)continue;const i=t.__ref;i.__authoredTemplates||(i.__authoredTemplates=new Set);for(const a of r)i.__authoredTemplates.add(a);return}},Ws=["attr","aria","data","metadata"],zs=t=>{if(Ws.includes(t))return!0;const o=t.charCodeAt(0);return o===46||o===33||o===64},Ys=(t,o)=>{const s=new Set,e=t.tag||"div";for(const r of Object.keys(t)){const i=Object.getOwnPropertyDescriptor(t,r),a=i&&i.value,f=!!o&&xt(o,r);if(a&&typeof a=="object"&&!Array.isArray(a)){if(!zs(r))continue;const n=f?o[r]:null,d=n&&typeof n=="object"?n:null;for(const y in a){const p=f&&(!d||xt(d,y));Mo(y,a[y],s,e,p)}continue}Mo(r,a,s,e,f)}return s};function $o(t,o){const s=t.__ref,e=!!(o&&o.skipIfEffect),r=Ys(t,s.__runtimeSource);if(s.__authoredTemplates)for(const n of r)s.__authoredTemplates.add(n);else s.__authoredTemplates=r;if(Us(t),typeof t.text=="function"){const n=t.text,d=T(t,t.textDeps,n),y=v(()=>{if(!s.contentManaged)try{let p=d(t,t.state,t.context);t.node&&p!=null&&typeof p!="function"&&typeof p!="object"&&(typeof p=="string"&&p.includes("{{")&&(p=I.call(t,p,t.state)),Ot(t,p))}catch(p){O(s,"text",p)}},{depth:s.path.length,label:k(s,"text")});s.__effects.push(y),s.__exec.text=n}else if(typeof t.text=="string"&&t.text.includes("{{")){const n=t.text,d=v(()=>{if(s.contentManaged)return;const y=I.call(t,n,t.state);y!=null&&(t.text=y),t.node&&Ot(t,y??"")},{depth:s.path.length,label:k(s,"text")});s.__effects.push(d),s.__exec.text=n}const i=t.tag||"div";for(const n of Object.keys(t))if(typeof t[n]=="function"&&!K.has(n)&&!Z(n)&&!s.__exec[n]&&!So(i,n)){if(D[n]){const d=t[n],y=T(t,t[n+"Deps"],d),p=n;let h,_=null,c=null,u;const l=v(()=>{const g=t.context?.designSystem;g&&M(g);try{const b=y(t,t.state,t.context);bo();let A;try{A=D[p](b,t,t.state,t.context)}finally{Ao()}if(Array.isArray(A)){const S={};for(const w of A)if(w)for(const C in w)S[C]=w[C];A=S}const x=p==="show"||p==="hide";if(A&&t.node&&qs(A)){const S=Lt(A);if(S===null||S!==u){u=S;const w=dt(A,null,t.context?.cssPrefix),C=w?w.split(" ").filter(Boolean):null;if(t.node.classList){if(c)for(const j of c)t.node.classList.remove(j);if(C&&C.length)for(const j of C)t.node.classList.add(j);c=C}}h=void 0,_=null}else if(A&&t.node){if(c){for(const w of c)t.node.classList.remove(w);c=null,u=void 0}const S=Lt(A);if(S===null||S!==h||!Mt(t.node,_)){h=S;const w=Ho(t,A);_=Dt(t.node,w)}}else t.node&&x&&(h=void 0,_=null,t.node.style.display="")}finally{g&&N()}},{depth:s.path.length,label:k(s,p)});s.__effects.push(l),s.__exec[n]=d}else if(R&&R.has(n)){const d=t[n],y=T(t,t[n+"Deps"],d),p=n;let h,_=null;const c=v(()=>{const u=t.context?.designSystem;u&&M(u);try{const l=y(t,t.state,t.context);if(t.node)if(l!=null){const g=p+":"+String(l);if(g!==h||!Mt(t.node,_)){h=g;const b={[p]:l},A=Ho(t,b);_=Dt(t.node,A)}}else h=void 0,_=null,t.node.style[p]=""}finally{u&&N()}},{depth:s.path.length,label:k(s,p)});s.__effects.push(c),s.__exec[n]=d}}if(typeof t.html=="function"){const n=t.html,d=T(t,t.htmlDeps,n),y=v(()=>{const p=t.context?.designSystem;p&&M(p);try{const h=d(t,t.state,t.context);t.node&&h!=null&&typeof h!="function"&&(t.node.innerHTML=h)}finally{p&&N()}},{depth:s.path.length,label:k(s,"html")});s.__effects.push(y),s.__exec.html=n}if(typeof t.value=="function"){const n=t.value,d=T(t,t.valueDeps,n),y=v(()=>{try{let p=d(t,t.state,t.context);typeof p=="string"&&p.includes("{{")&&(p=I.call(t,p,t.state)),Vo(t,p)}catch(p){O(s,"value",p)}},{depth:s.path.length,label:k(s,"value")});s.__effects.push(y),s.__exec.value=n}else if(typeof t.value=="string"&&t.value.includes("{{")){const n=t.value,d=v(()=>{try{Vo(t,I.call(t,n,t.state))}catch(y){O(s,"value",y)}},{depth:s.path.length,label:k(s,"value")});s.__effects.push(d),s.__exec.value=n}if(typeof t.style=="function"){const n=t.style,d=T(t,t.styleDeps,n);let y,p=null;const h=v(()=>{const _=d(t,t.state,t.context),c=Lt(_);(c===null||c!==y||!Mt(t.node,p))&&(y=c,Zs(t.node,p,_),m(t.node,_),p=Dt(t.node,_))},{depth:s.path.length,label:k(s,"style")});s.__effects.push(h),s.__exec.style=n}else if(t.style&&typeof t.style=="object")for(const n in t.style){const d=t.style[n];if(typeof d!="function")continue;const y=T(t,At(t.styleDeps,n),d);let p,h=null;const _=v(()=>{try{const c=y(t,t.state,t.context);if(t.node){const u=n+":"+String(c);if(u!==p||!Mt(t.node,h)){p=u;const l={[n]:c};m(t.node,l),h=Dt(t.node,l)}}}catch(c){O(s,"style."+n,c)}},{depth:s.path.length,label:k(s,"style."+n)});s.__effects.push(_)}if(t.attr&&typeof t.attr=="object"){for(const n in t.attr)if(typeof t.attr[n]=="function"){const d=T(t,At(t.attrDeps,n),t.attr[n]),y=n,p=v(()=>{try{let h=d(t,t.state,t.context);typeof h=="string"&&h.includes("{{")&&(h=I.call(t,h,t.state)),t.node?.setAttribute&&(h==null||h===!1&&!ht(y)?t.node.removeAttribute(y):typeof h!="function"&&typeof h!="object"&&t.node.setAttribute(y,W(y,h)))}catch(h){O(s,"attr."+y,h)}},{depth:s.path.length,label:k(s,"attr."+y)});p._attrName=y.toLowerCase(),s.__effects.push(p)}else if(typeof t.attr[n]=="string"&&t.attr[n].includes("{{")){const d=t.attr[n],y=n,p=v(()=>{try{const h=I.call(t,d,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(y,W(y,h??""))}catch(h){O(s,"attr."+y,h)}},{depth:s.path.length,label:k(s,"attr."+y)});p._attrName=y.toLowerCase(),s.__effects.push(p)}}if(t.aria&&typeof t.aria=="object")for(const n in t.aria){const d=t.aria[n];if(typeof d=="string"&&d.includes("{{")){const _=d,c="aria-"+n.replace(/[A-Z]/g,l=>"-"+l.toLowerCase()),u=v(()=>{try{const l=I.call(t,_,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(c,W(c,l??""))}catch(l){O(s,"aria."+n,l)}},{depth:s.path.length,label:k(s,"aria."+n)});u._attrName=c,s.__effects.push(u);continue}if(typeof d!="function")continue;const y=T(t,At(t.ariaDeps,n),t.aria[n]),p="aria-"+n.replace(/[A-Z]/g,_=>"-"+_.toLowerCase()),h=v(()=>{try{const _=y(t,t.state,t.context);if(!t.node?.setAttribute)return;_==null?t.node.removeAttribute(p):typeof _!="function"&&typeof _!="object"&&t.node.setAttribute(p,W(p,_))}catch(_){O(s,"aria."+n,_)}},{depth:s.path.length,label:k(s,"aria."+n)});h._attrName=p,s.__effects.push(h)}if(t.data&&typeof t.data=="object")for(const n in t.data){const d=t.data[n];if(typeof d=="string"&&d.includes("{{")){const c=d,u="data-"+n.replace(/[A-Z]/g,g=>"-"+g.toLowerCase()),l=v(()=>{try{const g=I.call(t,c,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(u,g??"")}catch(g){O(s,"data."+n,g)}},{depth:s.path.length,label:k(s,"data."+n)});l._attrName=u,s.__effects.push(l);continue}if(typeof d!="function")continue;const y=T(t,At(t.dataDeps,n),t.data[n]),h="data-"+n.replace(/[A-Z]/g,c=>"-"+c.toLowerCase()),_=v(()=>{try{const c=y(t,t.state,t.context);if(!t.node?.setAttribute)return;c==null||c===!1?t.node.removeAttribute(h):typeof c!="function"&&typeof c!="object"&&t.node.setAttribute(h,c===!0?"":c)}catch(c){O(s,"data."+n,c)}},{depth:s.path.length,label:k(s,"data."+n)});_._attrName=h,s.__effects.push(_)}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 n in a){if(typeof a[n]!="function")continue;const d=T(t,At(t.classDeps,n),a[n]),y=v(()=>{try{const p=d(t,t.state,t.context);if(!t.node?.classList)return;typeof p=="string"?t.node.classList.add(p):p?t.node.classList.add(n):t.node.classList.remove(n)}catch(p){O(s,"class."+n,p)}},{depth:s.path.length,label:k(s,"class."+n)});s.__effects.push(y)}!e&&typeof t.if=="function"&&Uo(t,s,t.if);for(const n of Object.keys(t)){if(K.has(n)||typeof t[n]!="function")continue;const d=n.charCodeAt(0);if(d>=65&&d<=90||Z(n))continue;const y=t[n];s.__exec[n]=y;const p=t.tag||"div";if(lt(p,n)&&!yt(p,n)){const h=pt(n)||n,_=T(t,t[n+"Deps"],y),c=v(()=>{try{let u=_(t,t.state,t.context);typeof u=="string"&&u.includes("{{")&&(u=I.call(t,u,t.state)),t.node?.setAttribute&&(u==null||u===!1&&!ht(h)?t.node.removeAttribute(h):typeof u!="function"&&typeof u!="object"&&(h==="src"&&"src"in t.node?t.node.src=u:t.node.setAttribute(h,W(h,u))))}catch(u){O(s,n,u)}},{depth:s.path.length,label:k(s,n)});c._attrName=h.toLowerCase(),s.__effects.push(c)}}const f=t.tag||"div";for(const n of Object.keys(t)){if(K.has(n))continue;const d=t[n];if(typeof d!="string"||!d.includes("{{"))continue;const y=n.charCodeAt(0);if(y>=65&&y<=90||Z(n)||yt(f,n)||Wt[n]||!lt(f,n))continue;const p=pt(n)||n,h=v(()=>{try{const _=I.call(t,d,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(p,W(p,_??""))}catch(_){O(s,n,_)}},{depth:s.path.length,label:k(s,n)});h._attrName=p.toLowerCase(),s.__effects.push(h)}if(on(t),rn(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const n=t.onStateUpdate,d=t.stateDeps;let y=!1,p=[];const h=v(()=>{const _=[];for(let g=0;g<d.length;g++){const b=d[g];try{_[g]=typeof b=="function"?b(t,t.state,t.context):t.state?.[b]}catch{_[g]=void 0}}if(!y){y=!0,p=_;return}let c=_.length!==p.length;for(let g=0;!c&&g<_.length;g++)_[g]!==p[g]&&(c=!0);const u=p;if(p=_,!c)return;const l=t.context?.designSystem;l&&M(l);try{n(t,t.state,t.context,{prev:u,next:_})}catch(g){if(t.context?.plugins?.length&&q("error",t,{hook:"onStateUpdate",error:g})||console.error('[DOMQL] Lifecycle "onStateUpdate" error:',g),t.context?.strictMode)throw g}finally{l&&N()}},{depth:s.path.length,label:k(s,"onStateUpdate")});s.__effects.push(h)}en(t)}function Io(t){const o=t.parent,s=o?.node;if(!s||!t.node){fs(t,t.parent);return}let e=null;const r=Object.keys(o),i=r.indexOf(t.key);for(let a=i+1;a<r.length;a++){const f=o[r[a]];if(f?.node?.parentNode===s){e=f.node;break}}e?s.insertBefore(t.node,e):s.appendChild(t.node)}function Uo(t,o,s){let e=T(t,t.ifDeps,s);const r=v(()=>{const i=!o.__ifInitialized&&o.__ifLateMerge;if(i){const n=t.context?.components||{};i.names.some(d=>n[d]||n["smbls."+d])&&(o.__ifLateMerge=null,Rs(t,i),e=T(t,t.ifDeps,typeof t.if=="function"?t.if:s))}let a;try{a=e(t,t.state,t.context)}catch(n){if(a=!1,o.__ifError=n,typeof console<"u"&&console.warn){const d=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${d} \u2014 treating as false:`,n?.message||n)}return}const f=o.__if;if(o.__if=!!a,f&&!o.__if&&t.node){t.node.remove();try{typeof t.onRemove=="function"&&t.onRemove(t)}catch(n){console.error("[smbls] onRemove error:",n)}}else if(!f&&o.__if)if(o.__ifInitialized)t.node||(t.node=Kt(t)),t.node&&(t.node.ref=t),Io(t),mt(t),F("Render",t,{}),qt(t,{});else{if(o.__ifInitialized=!0,o.__ifLateMerge=null,t.tag||(t.tag=po(t)),F("Init",t,{}),t.node||(t.node=Kt(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"&&!o.__fragmentAnchor){const d=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(d),o.__fragmentAnchor=d}F("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),is(t,{}),$o(t,{skipIfEffect:!0}),mt(t),mo(t),es(t),cs(t,{}),Io(t),F("Create",t,{}),F("Complete",t,{}),F("Render",t,{}),F("RenderRouter",t,{}),qt(t,{})}},{depth:o.path.length,label:k(o,"if")});o.__effects.push(r)}function Ot(t,o){const s=t.node;if(!s)return;const e=o==null||typeof o=="object"?"":String(o);if(t.tag==="string"){s.nodeValue!==e&&(s.nodeValue=e);return}const r=t.__ref;let i=r?r.__textNode:null;if(i&&i.parentNode!==s&&(i=null),!i){const a=s.firstChild;a&&a.nodeType===3&&(i=a)}i?i.nodeValue!==e&&(i.nodeValue=e):s.firstChild?(i=(s.ownerDocument||t.context?.document||globalThis.document).createTextNode(e),s.insertBefore(i,s.firstChild)):(s.textContent=e,i=s.firstChild&&s.firstChild.nodeType===3?s.firstChild:null),r&&(r.__textNode=i||null)}function Vo(t,o){const s=t.node;if(!s||!("value"in s))return;const e=o==null?"":String(o);if(s.value===e)return;const r=typeof document<"u"&&document.activeElement===s,i=r&&typeof s.selectionStart=="number"?s.selectionStart:null,a=r&&typeof s.selectionEnd=="number"?s.selectionEnd:null;if(s.value=e,r&&i!=null&&a!=null)try{s.setSelectionRange(i,a)}catch{}const f=t.__ref&&t.__ref.__autoGrow;f&&f.active&&f.resize()}function mt(t){const{node:o}=t;if(o){if((typeof t.text=="string"&&!t.text.includes("{{")||typeof t.text=="number")&&Ot(t,t.text),Jo(t),typeof t.html=="string"&&(o.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&!(typeof t.value=="string"&&t.value.includes("{{"))&&"value"in o){const s=String(t.value);o.value!==s&&(o.value=s)}if(t.style&&typeof t.style=="object"){let s=t.style;for(const e in t.style)if(typeof t.style[e]=="function"){s={};for(const r in t.style)typeof t.style[r]!="function"&&(s[r]=t.style[r]);break}m(o,s)}if(t.attr&&typeof t.attr=="object")for(const s in t.attr){const e=t.attr[s];typeof e=="function"||typeof e=="object"||e!=null&&(typeof e=="string"&&e.includes("{{")||e===!1&&!ht(s)||o.setAttribute&&o.setAttribute(s,W(s,e)))}if(typeof t.themeModifier=="string"&&t.themeModifier&&o.setAttribute&&o.setAttribute("data-theme",t.themeModifier),t.data&&typeof t.data=="object")for(const s in t.data){const e=t.data[s];typeof e=="function"||typeof e=="object"||e==null||e===!1||typeof e=="string"&&e.includes("{{")||o.dataset&&(o.dataset[s]=e===!0?"":e)}if(t.classlist||t.class){const s=t.classlist||t.class;if(typeof s=="string")s.split(" ").forEach(e=>e&&o.classList.add(e));else if(typeof s=="object")for(const e in s){const r=typeof s[e]=="function"?s[e](t,t.state,t.context):s[e];r&&o.classList.add(typeof r=="string"?r:e)}}}}function Lt(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function qs(t){if(!t||typeof t!="object")return!1;for(const o in t){const s=t[o];if(s&&typeof s=="object"&&!Array.isArray(s))return!0}return!1}function Dt(t,o){if(!t||!t.style||!o)return null;const s=t.style,e=[];for(const r in o){if(o[r]==null||r.charAt(0)==="&")continue;const a=Rt(r);e.push(a,to(s,a),Bo(s,a))}return e}function to(t,o){return typeof t.getPropertyValue=="function"?t.getPropertyValue(o):""}function Bo(t,o){return typeof t.getPropertyPriority=="function"?t.getPropertyPriority(o):""}function Rt(t){return Nt(t)?t:t.replace(/[A-Z]/g,o=>"-"+o.toLowerCase())}function Zs(t,o,s){if(!t||!t.style||!o||!o.length)return;const e=t.style,r=new Set;if(s&&typeof s=="object")for(const i in s)s[i]==null||i.charAt(0)==="&"||r.add(Rt(i));for(let i=0;i<o.length;i+=3){const a=o[i];r.has(a)||to(e,a)===o[i+1]&&typeof e.removeProperty=="function"&&e.removeProperty(a)}}function Mt(t,o){if(!o||!t||!t.style)return!1;const s=t.style;for(let e=0;e<o.length;e+=3)if(to(s,o[e])!==o[e+1]||Bo(s,o[e])!==o[e+2])return!1;return!0}const Nt=t=>t.charCodeAt(0)===45&&t.charCodeAt(1)===45;function Qs(t){let o=null;for(const s in t)t[s]!=null&&s.charAt(0)!=="&"&&(o||(o=new Set),o.add(Rt(s)));return o}function Xs(t,o,s,e){const r=t.__ref;if(!r)return;let i=null;if(s)for(const a of s){if(e&&e.has(a))continue;const f=o[a];if(f==null||typeof f=="object")continue;const n=Rt(a);wo[n]&&(i||(i={}),i[n]=f)}r.__declaredLonghands=i}function Go(t,o){const s=t.__ref,e=s&&s.__declaredLonghands;if(!e||!o)return null;let r=null;for(const i in e){if(o.has(i))continue;const a=wo[i];let f=!1;for(let n=0;n<a.length;n++)if(o.has(a[n])){f=!0;break}f&&(r||(r={}),r[i]=e[i])}return r}function Ho(t,o){const s=t.node;m(s,o);const e=Qs(o);if(!e)return o;const r=t.__ref;if(r)if(r.__inlineCssKeys)for(const a of e)r.__inlineCssKeys.add(a);else r.__inlineCssKeys=new Set(e);const i=Go(t,e);return i?(m(s,i),Object.assign({},o,i)):o}function Js(t){const o=t.__ref;if(!o||!o.__inlineCssKeys||!o.__declaredLonghands)return;const s=Go(t,o.__inlineCssKeys);s&&m(t.node,s)}function m(t,o){if(!t||!o||!t.style)return;let s=null;for(const e in o){const r=o[e];if(r!=null){if(e.charAt(0)==="&"&&typeof r=="object"){s||(s={}),s[e]=r;continue}try{const i=String(r),a=Nt(e)?e:e.replace(/[A-Z]/g,y=>"-"+y.toLowerCase()),f=i.trim(),n=/\s*!important\s*$/.test(f),d=f.replace(/\s*!important\s*$/,"");t.style.setProperty(a,d,n?"important":"")}catch{}}}s&&ms(t,s)}function ms(t,o){const s=`_ds${Co.scopedStyleId++}`;t.classList.add(s);const e=t.ownerDocument;let r=e.querySelector("style[data-smbls-scoped]");r||(r=e.createElement("style"),r.setAttribute("data-smbls-scoped",""),e.head.appendChild(r));let i="";for(const a in o){const f="."+s,n=a.replace(/&/g,f).split(",").map(y=>{const p=y.trim();return p.includes(f)?p:f+p}).join(", "),d=o[a];if(typeof d=="object"){let y="",p="";for(const h in d){const _=d[h];if(typeof _=="object"){const c=h.includes("&")?n.split(", ").map(l=>h.replace(/&/g,l)).join(", "):n.split(", ").map(l=>`${l} ${h}`).join(", ");let u="";for(const l in _)u+=`${l.replace(/[A-Z]/g,g=>"-"+g.toLowerCase())}: ${_[l]};`;p+=xo(`${c} { ${u} }`,c)+`
|
|
5
|
+
`}else y+=`${h.replace(/[A-Z]/g,c=>"-"+c.toLowerCase())}: ${_};`}y&&(i+=xo(`${n} { ${y} }`,n)+`
|
|
6
|
+
`),p&&(i+=p)}}i&&(r.textContent+=i)}const Ko=new Set;function Wo(t){if(!Array.isArray(t))return"";const o=[];for(let s=0;s<t.length;s++)typeof t[s]=="string"&&t[s].length&&o.push(t[s]);return o.sort(),o.join("|")}function tn(t,o,s){const e=Wo(s);queueMicrotask(()=>{if(!t.__ref)return;let r;try{r=o(t,t.state,t.context)}catch{return}if(Wo(r)===e)return;const i=t.__ref.path?t.__ref.path.join("."):t.key||"?";Ko.has(i)||(Ko.add(i),console.warn(`[smbls] subscribeTo function at "${i}" resolved to a DIFFERENT key list one microtask after create \u2014 wired [${s.join(", ")||"(none)"}], probed [${Array.isArray(r)?r.join(", "):String(r)}]. subscribeTo's function form is resolved ONCE at element-create time (registerSubscribeToEffects, @symbo.ls/element create.js) \u2014 this element stays wired to the ORIGINAL list for its whole lifetime, so this drift is invisible to the reactive effect and any key only present in the new list will never trigger onUpdate. If the watched key genuinely is not known until later (e.g. a module config that loads after shell boot), route the write through an imperative call instead of subscribeTo \u2014 see functions/moduleOpenBridge.js's moduleOpenPage (workspace repo) for the house pattern.`))})}function on(t){const o=t.subscribeTo,s=typeof o=="function";let e=o;if(s)try{e=o(t,t.state,t.context)}catch{e=null}if(s&&nt()&&tn(t,o,Array.isArray(e)?e:[]),!Array.isArray(e)||e.length===0)return;const r=t.__ref;for(let i=0;i<e.length;i++){const a=e[i];if(typeof a!="string"||a.length===0)continue;const f=a.split("."),n=f[0],d=f.slice(1),y={value:!1},p=v(()=>{const h=t.state&&(Q(t.state)?t.state.root:null);if(!h||!Q(h))return;let _=h;_=_[n];for(let u=0;u<d.length&&!(_==null||typeof _!="object");u++)if(Q(_))_=_[d[u]];else break;if(!y.value)return;let c=!1;if(typeof t.onBeforeUpdate=="function"){const u=t.context?.designSystem;u&&M(u);try{if(yn(r)){const l=t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0});l&&typeof l.then=="function"?l.then(()=>It(r,!1),g=>{It(r,!0),t.context?.plugins?.length&&q("error",t,{hook:"onBeforeUpdate",error:g})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",g)}):(It(r,!1),l===!1&&(c=!0))}}catch(l){It(r,!0),t.context?.plugins?.length&&q("error",t,{hook:"onBeforeUpdate",error:l})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",l)}finally{u&&N()}}if(!c&&t.node&&r.__effects)for(let u=0;u<r.__effects.length;u++){const l=r.__effects[u];l&&l!==p&&!l._disposed&&!l._isSubscribeToEffect&&typeof l._execute=="function"&&l._execute()}if(!c&&typeof t.onUpdate=="function"){const u=t.context?.designSystem;u&&M(u);try{t.onUpdate(t,t.state,t.context)}catch(l){t.context?.plugins?.length&&q("error",t,{hook:"onUpdate",error:l})||console.error("[DOMQL] subscribeTo onUpdate error:",l)}finally{u&&N()}}},{depth:r.path.length,label:k(r,"subscribeTo("+a+")")});y.value=!0,p._isSubscribeToEffect=!0,r.__effects.push(p)}}function oo(t,o){return t.charCodeAt(0)===64&&t.length>1&&!t.startsWith("@media")&&!t.startsWith("@keyframes")&&!t.startsWith("@supports")&&!t.startsWith("@container")&&(t==="@dark"||t==="@light"||!o.context?.designSystem?.media?.[t.slice(1)])}function so(t,o){if(t.charCodeAt(0)!==64||/^@(media|supports|container|keyframes)\b/.test(t))return t;const s=o.context?.designSystem?.media?.[t.slice(1)];return s?/^@(media|supports|container)\b/.test(s)?s:`@media ${s}`:t}const zo=new Set;function sn(t,o){const s=o?.__ref?.path?o.__ref.path.join("."):o?.key||"?",e=s+"::"+t;zo.has(e)||(zo.add(e),console.warn(`[smbls/css] "${t}" at ${s} 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 ct(t,o,s,e){const r={},i=new Set,a=(f,n,d)=>{const y=d?new Set(Object.keys(r)):null;if(D[f]){const p=D[f](n,o,o.state,o.context);if(p){const h=Array.isArray(p)?p:[p];for(const _ of h)_&&Object.assign(r,_)}}else r[f]=n;if(d)for(const p in r)y.has(p)||i.add(p)};for(const f in t){if(!Object.prototype.hasOwnProperty.call(t,f))continue;let n=t[f];if(typeof n=="function"&&(n=n(o,o.state,o.context)),n==null||typeof n=="function")continue;if(typeof n=="object"&&!Array.isArray(n)){if(f==="style"){for(const _ in n){let c=n[_];if(typeof c=="function"&&(c=c(o,o.state,o.context)),c==null||typeof c=="function")continue;const u=typeof o[_]=="function"&&(D[_]||R&&R.has(_))||!!(e&&e.has(_));a(_,c,u)}continue}if(oo(f,o)){const _=ct(n,o,!1,e);Object.keys(_).length&&(r[`[data-theme="${f.slice(1)}"] &`]=_);continue}if(/^[A-Z][A-Za-z0-9]*$/.test(f)){nt()&&sn(f,o);continue}const p=so(f,o),h=ct(n,o,!1,e);Object.keys(h).length&&(r[p]=h);continue}const d=typeof o[f]=="function"&&(D[f]||R&&R.has(f)),y=!!(e&&e.has(f));a(f,n,d||y)}if(s)for(const f in r)i.add(f);for(const f of i){const n=r[f];typeof n=="string"&&!n.includes("!important")&&(r[f]=n+" !important")}return r}const Ft=t=>!!t&&typeof t=="object"&&!Array.isArray(t);function Yo(t,o){for(const s in o){const e=o[s];t[s]=Ft(e)?Yo(Ft(t[s])?t[s]:{},e):e}return t}function nn(t,o){if(!Ft(o))return;let s;for(const e of t.split(" ")){const r=e?o[e]:null;Ft(r)&&(s=Yo(s||{},r))}return s}function no(t,o){if(o===void 0&&(o=0),o>8)return!1;if(typeof t=="function")return!0;if(t&&typeof t=="object"&&!Array.isArray(t)){for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&no(t[s],o+1))return!0}return!1}function qo(t,o,s){if(!o||typeof o!="object"||Array.isArray(o))return null;if(oo(t,s)){const i=ct(o,s,!1);return Object.keys(i).length?{cssProp:`[data-theme="${t.slice(1)}"] &`,block:i}:null}const e=so(t,s),r=ct(o,s,!1);return Object.keys(r).length?{cssProp:e,block:r}:null}function en(t){const o=t.__ref;for(const s of Object.keys(t)){if(!Zt(s))continue;const e=t[s];if(!e||typeof e!="object"||Array.isArray(e)||!no(e))continue;let r=null,i;const a=v(()=>{if(!t.node)return;const f=t.context?.designSystem;f&&M(f);let n,d=!1;try{const y=qo(s,e,t),p=y?Lt(y.block)+"::"+y.cssProp:null;if(p!==null&&p===i)d=!0;else if(i=p,y){const h=dt({[y.cssProp]:y.block},null,t.context?.cssPrefix);n=h?h.split(" ").filter(Boolean):null}else n=null}finally{f&&N()}if(!(d||!t.node.classList)){if(r)for(const y of r)t.node.classList.remove(y);if(n&&n.length)for(const y of n)t.node.classList.add(y);r=n}},{depth:o.path.length,label:k(o,"cssBlock("+s+")")});o.__effects.push(a)}}function rn(t){const o=t.__ref;o.__conditionalRunners=[];const s=new Map;for(const e of Object.keys(t)){const r=e.charAt(0);if(r!=="."&&r!=="!")continue;const i=e.slice(1);if(!i)continue;if(/[:@\s>~+[\]]/.test(i)){if(typeof console<"u"&&console.warn){const c=i.split(/[:@\s>~+[\]]/)[0];console.warn(`[smbls] conditional \`${e}\` on ${t.key||"?"} will never match \u2014 the whole string after \`${r}\` is read as one prop name. Nest the selector inside instead: \`${r}${c}: { '${i.slice(c.length)}': {...} }\`.`)}continue}const a=t[e];if(!a||typeof a!="object")continue;const f=r==="!",n={lastMatch:!1,appliedKeys:null,appliedClasses:null},d=new Set;for(const c in a){if(!Object.prototype.hasOwnProperty.call(a,c))continue;const u=c.charAt(0),l=a[c];(u===":"||u==="@"||u==="&"||u==="[")&&l&&typeof l=="object"&&!Array.isArray(l)||d.add(c)}const y=()=>{let c;const u=t[i];if(u===void 0){const b=!!t.state&&i in t.state,A=t.state?t.state[i]:void 0;if(b||A!==void 0)c=A;else{const x=t.context?.cases?.[i];if(x===void 0)return;try{c=typeof x=="function"?x.call(t,t):x}catch(S){c=!1,o.__conditionalError=S,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${e}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,S?.message||S)}}}else if(typeof u=="function")try{c=u(t,t.state,t.context)}catch(b){c=!1,o.__conditionalError=b,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${e}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,b?.message||b)}else c=u;const l=f?!c:!!c;if(!t.node||l===n.lastMatch)return;n.lastMatch=l;const g=t.context?.designSystem;g&&M(g);try{if(l){const b={},A={};let x=!1;for(const w in a){if(!Object.prototype.hasOwnProperty.call(a,w))continue;const C=a[w],j=w.charAt(0);if((j===":"||j==="@"||j==="&"||j==="[")&&C&&typeof C=="object"&&!Array.isArray(C)){if(oo(w,t)){const G=ct(C,t,!1,d);Object.keys(G).length&&(A[`[data-theme="${w.slice(1)}"] &`]=G,x=!0)}else{const G=so(w,t),ot=ct(C,t,!1,d);Object.keys(ot).length&&(A[G]=ot,x=!0)}continue}const z=typeof C=="function"?C(t,t.state,t.context):C;if(z!=null)if(D[w]){const G=D[w](z,t,t.state,t.context);if(G){const ot=Array.isArray(G)?G:[G];for(const $ of ot)$&&Object.assign(b,$)}}else(R&&R.has(w)||Nt(w))&&(b[w]=z)}const S=Object.keys(b);if(S.length){m(t.node,b);for(const w of S)s.set(w,e);n.appliedKeys=S}else n.appliedKeys=null;if(x){const w=dt(A,null,t.context?.cssPrefix,{state:!0}),C=w?w.split(" ").filter(Boolean):[];if(C.length&&t.node.classList){for(const j of C)t.node.classList.add(j);n.appliedClasses=C}else n.appliedClasses=null}else if(n.appliedClasses){for(const w of n.appliedClasses)t.node.classList.remove(w);n.appliedClasses=null}}else{if(n.appliedKeys){for(const b of n.appliedKeys)s.get(b)===e&&(Nt(b)?t.node.style.removeProperty(b):t.node.style[b]="",s.delete(b));n.appliedKeys=null}if(n.appliedClasses){for(const b of n.appliedClasses)t.node.classList.remove(b);n.appliedClasses=null}}}finally{g&&N()}};o.__conditionalRunners.push(y);const p=T(t,t[i+"Deps"],y),h=v(p,{depth:o.path.length,label:k(o,"conditional("+e+")")}),_=o.__exec&&o.__exec[i]||t[i];h._sources.size===0&&typeof _=="function"&&nt()&&console.warn(`[smbls] conditional \`${e}\` on ${t.key||"?"} subscribed to nothing \u2014 its predicate tracked no reactive read on its first run, so no state write will ever re-evaluate it (only a direct element.update() on this element re-runs it). If the predicate guards its state reads (\`in\`, short-circuits, \`?.\`), declare \`${i}Deps: [...]\` (state-key strings or \`(el, s) => \u2026\` selectors) so the subscription is armed unconditionally.`),o.__effects.push(h)}}const eo=new WeakSet;function cn(t){const o=t.ownerDocument;!o||eo.has(o)||(eo.add(o),queueMicrotask(()=>{eo.delete(o);const s=o.body||o.documentElement;s&&s.offsetWidth}))}const ro=new WeakSet;let Zo=!1;function Qo(t){return t.startsWith("[data-theme=")||t.startsWith("@media")&&t.includes("prefers-color-scheme")}function io(t,o){const s={...t};for(const e in o){const r=o[e],i=s[e];s[e]=r&&typeof r=="object"&&i&&typeof i=="object"?io(i,r):r}return s}function Xo(t,o){const s={};for(const e in t){const r=t[e];if(r&&typeof r=="object"){const i=Xo(r,o);Object.keys(i).length&&(s[e]=i)}else o.has(e)||(s[e]=r)}return s}function Jo(t){const{node:o}=t;if(!o)return;if(Zo||(Zo=!0,dt({display:"none"})),ro.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}ro.add(t);const s=t.context?.designSystem;s&&M(s),bo();try{const e={};let r=!1,i=[],a=null,f=null,n=null;const d=(c,u)=>{if(u&&typeof u=="object"&&Qo(c)){f||(f={});const l=f[c];l&&(u=io(l,u)),f[c]=u}else(u===null||typeof u!="object")&&(n||(n=new Set),n.add(c));e[c]=u};if(Object.prototype.hasOwnProperty.call(t,"theme")&&typeof t.theme!="function"&&D.theme){const c=D.theme(t.theme,t,t.state,t.context);if(c){const u=l=>{for(const g in l){const b=l[g];b&&typeof b=="object"&&Qo(g)&&(a||(a={}),a[g]=b),e[g]=b}};if(Array.isArray(c))for(const l of c)l&&u(l);else u(c);r=!0}}const y=(c,u)=>{if(D[c]){const l=D[c](u,t,t.state,t.context);if(l){if(Array.isArray(l)){for(const g of l)if(g)for(const b in g)d(b,g[b])}else for(const g in l)d(g,l[g]);r=!0}}else if(R&&R.has(c))u!=null&&typeof u!="object"&&(d(c,u),r=!0);else if(c.charCodeAt(0)===45)u!=null&&typeof u!="object"&&(d(c,u),r=!0);else if((c.charAt(0)==="&"||c.charAt(0)==="@"||c.charAt(0)===":"||c.charAt(0)==="[")&&u&&typeof u=="object"&&!Array.isArray(u)){if(no(u))return;const l=qo(c,u,t);l&&(d(l.cssProp,l.block),r=!0)}};if(typeof t.class=="string"){const c=nn(t.class,t.context?.designSystem?.class);if(c)for(const u in c)y(u,c[u])}const p=n?new Set(n):null,h=t.tag||"div";for(const c of Object.keys(t)){if(typeof t[c]=="function"||K.has(c)||c==="theme")continue;const u=c.charCodeAt(0);u>=65&&u<=90||Z(c)||So(h,c)||y(c,t[c])}if(a)for(const c in a){let u=n?Xo(a[c],n):a[c];f&&f[c]&&(u=io(u,f[c])),Object.keys(u).length?e[c]=u:delete e[c]}if(Xs(t,e,n,p),r){e.display&&String(e.display).includes("!important")&&(o.style.setProperty("display",String(e.display).replace(/\s*!important\s*$/,""),"important"),delete e.display);const c=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;typeof c=="string"&&c!==""&&e.display&&e.display!==c&&(e.display=c);const u=dt(e,null,t.context?.cssPrefix);if(i=u?u.split(" ").filter(Boolean):[],u&&o.classList){const l=i;let g=!1;for(const b of l)o.classList.add(b),g||(b.charCodeAt(0)===95&&b.charCodeAt(1)===99||b.charCodeAt(0)===95&&b.indexOf("_c",1)!==-1)&&(g=!0);g&&cn(o)}}const _=t.__ref;if(_){const c=_.__staticCssClasses;if(c&&o.classList){const u=new Set(i);for(const l of c)u.has(l)||o.classList.remove(l)}_.__staticCssClasses=i}Js(t)}finally{Ao(),s&&N(),ro.delete(t)}}const Bn=t=>!!D[t]||!!(R&&R.has(t))||typeof t=="string"&&t.charCodeAt(0)===45;function Gn(t){t&&t.node&&Jo(t)}function mo(t){const{node:o}=t;if(!o||!o.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const r in t.aria){const i=t.aria[r];if(typeof i=="function"||typeof i=="object"||i==null||typeof i=="string"&&i.includes("{{"))continue;const a="aria-"+r.replace(/[A-Z]/g,f=>"-"+f.toLowerCase());o.setAttribute(a,W(a,i))}const s=Cs(t);for(const r in s){const i=s[r];i!=null&&i!==!1&&typeof i!="function"&&typeof i!="object"&&o.setAttribute(r,i===!0?"":i)}const e=t.tag||"div";for(const r of Object.keys(t)){if(typeof t[r]=="function"||K.has(r)||r==="on"||s[r]!==void 0)continue;const i=r.charCodeAt(0);if(!(i>=65&&i<=90)&&!Z(r)&&!yt(e,r)&<(e,r)){let a=t[r];if(a==null)continue;if(typeof a=="string"&&a.includes("{{")){if(!Wt[r])continue;a=I.call(t,a,t.state)}if(a==null||typeof a=="function"||typeof a=="object"||a===!1&&!ht(pt(r)||r))continue;const f=pt(r)||r;o.setAttribute(f,W(f,a))}}}function Hn(t,o){const{node:s}=t;if(!s||!s.setAttribute)return;const e=o.charCodeAt(0);if(e>=65&&e<=90||Z(o))return;const r=t.tag||"div";if(yt(r,o)||!lt(r,o))return;const i=pt(o)||o,a=i.toLowerCase(),f=t.__ref&&t.__ref.__effects;let n=!1;if(f)for(let p=0;p<f.length;p++){const h=f[p];h&&h._attrName===a&&!h._disposed&&typeof h._execute=="function"&&(n=!0,h._execute())}if(n)return;let d=t[o];const y=Wt[o];if(y&&d!=null){const p=y(t);p!==void 0&&(d=p)}typeof d=="string"&&d.includes("{{")&&(d=I.call(t,d,t.state)),d==null||d===!1&&!ht(i)?s.removeAttribute(i):typeof d!="function"&&typeof d!="object"&&s.setAttribute(i,W(i,d))}function fn(t,o){const s=t.node,e=t.__ref;let r=e.__autoGrow;if(!o){if(r&&r.active){try{s.removeEventListener("input",r.resize)}catch{}os(r),J.delete(t),s.style.height="",r.appliedMax!=null&&s.style.maxHeight===r.appliedMax&&(s.style.maxHeight=""),ss(s,r,!1),r.active=!1,r.appliedMax=null,r.lastMeasure=0}return}r||(r=e.__autoGrow={active:!1,appliedMax:null,lastMeasure:0,lastWidth:null,watch:null,awaitingLayout:!1,appliedScroll:!1,fontsHooked:!1,attachAttempts:0,firstAttemptAt:null,resize:()=>{if(!s.isConnected){kt(t,!0);return}if(!(s.scrollHeight>0)){r.awaitingLayout=!0,ts(t,r);return}r.awaitingLayout=!1;const a=s.style.height;s.style.height="0px";const f=s.scrollHeight;if(!(f>0)){s.style.height=a;return}const n=dn(s),d=n!=null&&f>n;s.style.height=(d?n:f)+"px",ss(s,r,d),r.lastMeasure=f,r.lastWidth=s.clientWidth,ts(t,r)}},e.__eventCleanup||(e.__eventCleanup=[]),e.__eventCleanup.push(()=>{try{s.removeEventListener("input",r.resize)}catch{}os(r),J.delete(t)})),r.active||(s.addEventListener("input",r.resize),r.active=!0,un(t,r));const i=typeof o=="object"&&o.max!=null?String(o.max):null;i!==r.appliedMax&&(i==null?r.appliedMax!=null&&s.style.maxHeight===r.appliedMax&&(s.style.maxHeight=""):s.style.maxHeight=i,r.appliedMax=i),r.resize()}function kt(t,o){const s=t.__ref?.__autoGrow;s&&(o&&(s.attachAttempts=0,s.firstAttemptAt=null),J.add(t),Pt())}function an(){const t=Array.from(J);J.clear();for(let o=0;o<t.length;o++){const s=t[o],e=s.node,r=s.__ref?.__autoGrow;if(!(!e||!r||!r.active)){if(!e.isConnected){r.firstAttemptAt==null&&(r.firstAttemptAt=rt()),r.attachAttempts+=1,r.attachAttempts<=jo&&rt()-r.firstAttemptAt<Eo&&(J.add(s),Pt());continue}r.attachAttempts=0,r.firstAttemptAt=null,r.resize()}}}function ts(t,o){if(o.watch)return;const s=t.node;if(!s)return;const e=s.ownerDocument&&s.ownerDocument.defaultView,r=e&&e.ResizeObserver||(typeof ResizeObserver=="function"?ResizeObserver:null);if(typeof r!="function")return;const i=()=>{if(!o.active||!s.isConnected||!(s.scrollHeight>0))return;if(o.awaitingLayout){o.awaitingLayout=!1,kt(t,!0);return}const f=s.clientWidth;o.lastWidth!=null&&Math.abs(f-o.lastWidth)<.5||(o.lastWidth=f,kt(t,!0))};let a;try{a=new r(i),a.observe(s)}catch{return}o.watch=a}function os(t){const o=t.watch;if(o){t.watch=null;try{o.disconnect()}catch{}}}function un(t,o){if(o.fontsHooked)return;o.fontsHooked=!0;const s=t.node&&t.node.ownerDocument,e=s&&s.fonts&&s.fonts.ready;!e||typeof e.then!="function"||e.then(()=>{o.active&&t.node&&kt(t,!0)},()=>{})}function dn(t){const o=t.ownerDocument&&t.ownerDocument.defaultView;let s;try{s=o&&o.getComputedStyle?o.getComputedStyle(t):null}catch{s=null}if(!s)return null;const e=y=>typeof y=="string"&&/^\s*-?\d*\.?\d+px\s*$/.test(y)?parseFloat(y):null,r=e(s.maxHeight);if(r==null||!(r>0))return null;const i=(e(s.paddingTop)||0)+(e(s.paddingBottom)||0),a=(e(s.borderTopWidth)||0)+(e(s.borderBottomWidth)||0),f=s.boxSizing==="border-box"?r-a:r+i,n=e(s.lineHeight);if(!(n>0))return f;const d=Math.floor((f-i)/n+1e-6);return d>=1?d*n+i:f}function ss(t,o,s){s?o.appliedScroll||(t.style.overflowY="auto",o.appliedScroll=!0):o.appliedScroll&&(t.style.overflowY==="auto"&&(t.style.overflowY=""),o.appliedScroll=!1)}const ns=["srcObject","muted"],ln=(t,o)=>t==="muted"?o===!0||o===""||o==="true"||o==="muted":o??null;function pn(t){const o=t.node,s=t.__ref;if(!(!o||!s))for(let e=0;e<ns.length;e++){const r=ns[e],i=t[r];if(i===void 0||!(r in o))continue;const a=f=>{const n=ln(r,f);if(o[r]!==n)try{o[r]=n}catch(d){O(s,r,d)}};if(typeof i=="function"){const f=T(t,t[r+"Deps"],i),n=v(()=>{try{a(f(t,t.state,t.context))}catch(d){O(s,r,d)}},{depth:s.path.length,label:k(s,r)});s.__effects.push(n),s.__exec[r]=i}else a(i);r==="srcObject"&&(s.__releaseMedia=()=>{try{o.srcObject!=null&&(o.srcObject=null)}catch{}})}}function es(t){if(!t.autoGrow)return;const o=t.node;if(!o||o.tagName!=="TEXTAREA")return;const s=t.__ref,e=t.autoGrow,r=typeof e=="function"?T(t,t.autoGrowDeps,e):null,i=v(()=>{const a=t.autoGrow;let f=a;if(typeof a=="function")try{f=(a===e&&r?r:a)(t,t.state,t.context)}catch{f=null}fn(t,f)},{depth:s.path.length,label:k(s,"autoGrow")});s.__effects||(s.__effects=[]),s.__effects.push(i),r&&(s.__exec.autoGrow=e)}const rs=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function is(t,o){for(const s of Object.keys(t)){if(!Z(s)||rs.has(s))continue;const e=bs(s);if(e){gs(e,t,t[s]);continue}let r=t[s];if(typeof r=="string"&&/^[A-Za-z_$][\w$]*$/.test(r)){const a=r;r=function(n){return t.call(a,n)}}if(typeof r!="function")continue;const i=Os(s);ys.has(i)||_s(Ls(i),t,r)}hn(t)}function hn(t){const o=t.node;if(!o||!o.addEventListener)return;const s={};let e=!1;for(const h of rs){const _=t[h];typeof _=="function"&&(s[h]=_,e=!0)}if(!e)return;const r=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,i=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let a=0,f=0,n=0,d=!1;const y=h=>{const _=h.touches&&h.touches[0]||h.changedTouches&&h.changedTouches[0];_&&(a=_.clientX,f=_.clientY,n=Date.now(),d=!0)},p=h=>{if(!d)return;d=!1;const _=h.changedTouches&&h.changedTouches[0]||h.touches&&h.touches[0];if(!_)return;const c=_.clientX-a,u=_.clientY-f,l=Date.now()-n;if(l>i)return;const g=Math.abs(c),b=Math.abs(u);if(Math.max(g,b)<r)return;let A;if(g>b*1.2)A=c<0?"left":"right";else if(b>g*1.2)A=u<0?"up":"down";else return;const x="onSwipe"+A.charAt(0).toUpperCase()+A.slice(1),S=s[x],w=s.onSwipe;S&&S.call(t,h,t,t.state,t.context),w&&w.call(t,{direction:A,dx:c,dy:u,dt:l,event:h},t,t.state,t.context)};o.addEventListener("touchstart",y,{passive:!0}),o.addEventListener("touchend",p,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{o.removeEventListener("touchstart",y)}catch{}try{o.removeEventListener("touchend",p)}catch{}})}function tt(t,o){const s={...t};for(const e in o){const r=s[e],i=o[e];r&&i&&typeof r=="object"&&typeof i=="object"&&!Array.isArray(r)&&!Array.isArray(i)&&typeof r!="function"&&typeof i!="function"?s[e]=tt(r,i):s[e]=i}return s}function co(t,o,s,e,r){if(!o||!t.node)return;const i=t.childExtends,a=it(t,"childProps");if(Array.isArray(o)){const f=t.tag==="fragment",n=t.context?.document||globalThis.document,d=f?null:n?.createDocumentFragment();if(!f&&!d)return;const y=t.childProps,p=t.childrenAs,h=b=>{let A=o[b];const x=A;(typeof A=="string"||typeof A=="number")&&(A={text:A});let S=y;if(typeof y=="function")try{S=y(t,A)}catch{S=null}let w=typeof y=="function"?wt(S):a;if(r&&p!=="state"&&(w=St(w,wt(x))),p==="state"){let j=x;(typeof x=="string"||typeof x=="number")&&(j={value:x,text:x}),A=S?{...S,state:j}:{state:j}}else S&&(A=tt(S,A));if(i&&!A.ignoreChildExtends)if(A.extends){const j=Array.isArray(A.extends)?A.extends:[A.extends],z=Array.isArray(i)?i:[i];A={...A,extends:[...z,...j]}}else A={...A,extends:i};const C=To(A?.key,x,b);try{return X(Ct(A,w),t,C,s)}catch(j){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} (initial render, skipping this row):`,j?.message||j)}return null}},_=t.__ref;if(!(e===!0&&!f&&!!_&&(s?.mountYield===!0||t.yieldChildren===!0))){for(let b=0;b<o.length;b++){const A=h(b);!f&&A?.node&&d.appendChild(A.node)}return f||t.node.appendChild(d),!0}const u=_.__childrenChunkGen=(_.__childrenChunkGen||0)+1;yo();let l=null;const g=b=>{if(_.__disposed||_.__childrenChunkGen!==u){l&&l.parentNode&&l.remove();return}for(let A=b;A<o.length;A++){const x=h(A);if(x?.node&&(l?t.node.insertBefore(x.node,l):d.appendChild(x.node)),A+1<o.length&&ho()){l||(l=n.createComment("smbls-mount"),d.appendChild(l),t.node.appendChild(d));const S=A+1;go(()=>g(S));return}}l?(l.remove(),t.node.tagName==="SELECT"&&$t(t,!0)):t.node.appendChild(d)};return g(0),_o(),!0}if(typeof o=="string"){const f=Lo(o,t);if(Array.isArray(f))return co(t,f,s,e,!0)}if(typeof o=="object")for(const f in o){if(K.has(f))continue;let n=o[f];if(n==null||n===!1)continue;const d=r?St(a,wt(n)):a;if((typeof n=="string"||typeof n=="number")&&(n={text:n}),t.childProps&&(n=tt(t.childProps,n)),i&&!n.ignoreChildExtends)if(n.extends){const y=Array.isArray(n.extends)?n.extends:[n.extends],p=Array.isArray(i)?i:[i];n={...n,extends:[...p,...y]}}else n={...n,extends:i};X(Ct(n,d),t,f,s)}}function $t(t,o){const s=t.node;if(!s||s.tagName!=="SELECT")return;const e=s.options;if(!e||!e.length)return;const r=t.__ref,i=r&&r.__exec&&r.__exec.value,a=typeof i=="function",f=t.value!=null&&typeof t.value!="function";if(a||f){let y;if(a)try{y=i(t,t.state,t.context)}catch{return}else y=t.value,typeof y=="string"&&y.includes("{{")&&(y=I.call(t,y,t.state));const p=y==null?"":String(y);s.value!==p&&(s.value=p);return}const n=o||!(r&&r.__selectSynced);if(r&&(r.__selectSynced=!0),!n)return;let d=-1;for(let y=0;y<e.length;y++)e[y].defaultSelected&&(d=y);d>=0&&s.selectedIndex!==d&&(s.selectedIndex=d)}function cs(t,o){let{children:s,content:e}=t;const r=t.childExtends,i=typeof s=="function"||No(t,"children");if(typeof s=="function"){const c=s;try{s=c(t,t.state,t.context)}catch(A){if(s=void 0,typeof console<"u"&&console.error){const x=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${x} (initial run, treating as empty):`,A?.message||A)}}Fo(t,s),t.children=s;const u=t.__ref;let l=!1;const g=T(t,t.childrenDeps,c),b=v(()=>{const A=l;l=!0;let x;try{x=g(t,t.state,t.context)}catch($){if(typeof console<"u"&&console.error){const V=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${V}${A?"":" (initial tracking run)"}:`,$?.message||$)}return}if(!A||x===t.children)return;Fo(t,x),t.children=x,u.__childrenChunkGen!=null&&u.__childrenChunkGen++;const S=typeof t.onContentUpdate=="function",w=S?[]:null,C=S?[]:null,j=S?[]:null;if(Array.isArray(x)&&t.childrenAs==="state"){const $=t.childProps,V=[],ao=new Map;for(let E=0;E<x.length;E++){const B=x[E];let P=$;if(typeof $=="function")try{P=$(t,B)}catch{P=null}const Y=To(P&&P.key,B,E);V.push(Y),ao.set(Y,{rawChild:B,childProps:P})}const as=new Set(V),us=u.__children.slice();for(const E of us)if(!as.has(E)){const B=t[E];B?.remove&&B.remove(),delete t[E],C&&C.push(E)}const ft=t.childExtends,vt=t.tag==="fragment",ds=t.context?.document||globalThis.document,at=vt?null:ds?.createDocumentFragment(),Ut=new Set;for(const E of V){const B=ao.get(E),P=B.rawChild,Y=t[E];if(Y&&Y.state){if(P&&typeof P=="object"){const L=Y.state,st=L.$replace||L.replace,uo=L.$update||L.update;try{if(typeof st=="function")st.call(L,P);else if(typeof uo=="function"){for(const U in L)if(!(U==="__element"||U==="root"||U==="parent"||U==="update")&&!Object.prototype.hasOwnProperty.call(P,U))try{L[U]=void 0}catch{}uo.call(L,P)}else for(const U in P)L[U]=P[U]}catch(U){if(typeof console<"u"&&console.error){const ps=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${E}" failed to patch at ${ps} (reconcile, keeping its previous data for this pass):`,U?.message||U)}}}j&&j.push(E);continue}let Vt=P;(typeof P=="string"||typeof P=="number")&&(Vt={value:P,text:P});const Bt=B.childProps;let H=Bt?{...Bt,state:Vt}:{state:Vt};const ls=typeof $=="function"?wt(Bt):it(t,"childProps");if(ft&&!H.ignoreChildExtends)if(H.extends){const L=Array.isArray(H.extends)?H.extends:[H.extends],st=Array.isArray(ft)?ft:[ft];H={...H,extends:[...st,...L]}}else H={...H,extends:ft};let Gt;try{Gt=X(Ct(H,ls),t,E,o)}catch(L){if(typeof console<"u"&&console.error){const st=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${E}" failed to construct at ${st} (reconcile, skipping this row):`,L?.message||L)}Ut.add(E);continue}!vt&&Gt?.node&&at&&at.appendChild(Gt.node),w&&w.push(E)}if(!vt&&at&&at.childNodes.length&&t.node&&t.node.appendChild(at),!vt&&t.node){let E=null;for(const B of V){const P=t[B]?.node;if(!P)continue;const Y=E?E.nextSibling:t.node.firstChild;P!==Y&&t.node.insertBefore(P,Y),E=P}}u.__children=Ut.size?V.filter(E=>!Ut.has(E)):V,S&&(w.length||C.length)&&Po(t,{added:w,removed:C,kept:j}),$t(t,!1);return}const ot=S?[...u.__children]:null;for(const $ of[...u.__children]){const V=t[$];V?.remove&&V.remove(),delete t[$]}u.__children=[],co(t,x,o,!1,!0),$t(t,!1),S&&Po(t,{added:[...u.__children],removed:ot,kept:[]})},{depth:u.path.length,label:k(u,"children")});u.__effects.push(b)}const a=co(t,s,o,!0,i);if(e!=null&&!(e&&e.__ref)){let c=e;if(typeof c=="string"||typeof c=="number"?c={text:c}:typeof c!="object"&&(c={}),t.childProps&&(c=tt(t.childProps,c)),r&&!c.ignoreChildExtends)if(c.extends){const l=Array.isArray(c.extends)?c.extends:[c.extends],g=Array.isArray(r)?r:[r];c={...c,extends:[...g,...l]}}else c={...c,extends:r};const u=St(it(t,"childProps"),it(t,"content"));X(Ct(c,u),t,"content",o)}if(s&&!a)return;const f=t.context?.components||{},n=t.__ref&&t.__ref.__runtimeSource,d=n?{}:null;{const c=Object.keys(t);for(let u=0;u<c.length;u++){const l=c[u];if(!l.endsWith("Extends")||typeof t[l]!="string")continue;const g=l.slice(0,-7);if(!g||g.charCodeAt(0)<65||g.charCodeAt(0)>90)continue;const b={extends:t[l]};delete t[l];for(let A=u+1;A<c.length;A++){const x=c[A],S=x.charCodeAt(0);if(S>=65&&S<=90||K.has(x)||typeof t[x]=="function"&&(x.startsWith("on")||x.startsWith(".")))break;const w=t[x];w!==void 0&&(b[x]=w,delete t[x],d&&xt(n,x)&&(d[g]||(d[g]={}),d[g][x]=n[x]))}t[g]&&typeof t[g]=="object"?t[g]={...b,...t[g]}:t[g]=b}}const y=o?.mountYield===!0||t.yieldChildren===!0,p=Object.keys(t),h=c=>{if(K.has(c)||typeof t[c]!="object"||t[c]===null)return;const u=c.charCodeAt(0);if(u<65||u>90)return;let l=t[c];if(l.__ref)return;if(!l.extends&&!l.extend){const b=f[c]||f[`smbls.${c}`];b&&(l={...l,extends:b})}if(t.childProps&&(l=tt(t.childProps,l)),r&&!l.ignoreChildExtends)if(l.extends){const b=Array.isArray(l.extends)?l.extends:[l.extends],A=Array.isArray(r)?r:[r];l={...l,extends:[...A,...b]}}else l={...l,extends:r};const g=n?St(it(t,"childProps"),St(d[c]||null,it(t,c))):null;X(Ct(l,g),t,c,o)};if(!y){for(const c of p)h(c);return}yo();const _=c=>{for(let u=c;u<p.length;u++)if(h(p[u]),u+1<p.length&&ho()){const l=u+1;go(()=>_(l));return}};_(0),_o()}function fs(t,o,s){const{node:e}=t;if(!e)return;e.ref=t;const r=o?.tag==="fragment"?o.__ref?.__fragmentAnchor:null;if(r){const a=r.parentNode;if(a){if(s?.position==="before"&&s.node)a.insertBefore(e,s.node);else if(s?.position==="after"&&s.node){const f=s.node.nextSibling;a.insertBefore(e,f||r)}else a.insertBefore(e,r);return}}const i=o?.node||(o?.nodeType?o:null);if(i)if(s?.position==="before"&&s.node)i.insertBefore(e,s.node);else if(s?.position==="after"&&s.node){const a=s.node.nextSibling;a?i.insertBefore(e,a):i.appendChild(e)}else i.appendChild(e)}const fo=3;function yn(t){return!t||t.__inBeforeUpdate||(t.__beforeUpdateFailCount||0)>=fo?!1:(t.__inBeforeUpdate=!0,!0)}function It(t,o){t&&(t.__inBeforeUpdate=!1,o?(t.__beforeUpdateFailCount=(t.__beforeUpdateFailCount||0)+1,t.__beforeUpdateFailCount===fo&&typeof console<"u"&&console.error&&console.error(`[DOMQL] onBeforeUpdate failed ${fo}x in a row on this element \u2014 pausing automatic retries until a future prop/state change re-arms it.`)):t.__beforeUpdateFailCount=0)}function F(t,o,s){const e=t.charAt(0).toLowerCase()+t.slice(1);o.context?.plugins?.length&&q(e,o,s);const r="on"+t,i=o[r];if(typeof i=="function"){const n=t==="Render"?"__inRender":t==="RenderRouter"?"__inRenderRouter":null;if(n){if(o.__ref[n])return!0;o.__ref[n]=!0}const d=o.context?.designSystem;d&&M(d);let y=!!n;try{const p=i(o,o.state,o.context,s);if(p&&typeof p.then=="function"){const h=o.__ref;return p.catch(_=>{o.context?.plugins?.length&&q("error",o,{hook:r,error:_})||console.error(`[DOMQL] Lifecycle "${r}" error:`,_)}).finally(()=>{n&&h&&(h[n]=!1)}),y=!1,!0}if(p===!1)return!1}catch(p){if(o.context?.plugins?.length&&q("error",o,{hook:r,error:p})||console.error(`[DOMQL] Lifecycle "${r}" error:`,p),o.context?.strictMode)throw p}finally{d&&N(),y&&o.__ref&&(o.__ref[n]=!1)}}return!0}var Kn=X;export{fo as BEFORE_UPDATE_MAX_CONSECUTIVE_FAILURES,yn as acquireBeforeUpdateGuard,X as create,Kn as default,Yt as flushMounts,Bn as isStaticCssProp,Gn as recompileStaticCss,Hn as reconcileAttrProp,It as releaseBeforeUpdateGuard,Ot as writeElementText};
|
package/dist/esm/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const o="3.14.
|
|
1
|
+
const o="3.14.798";export{o as VERSION};
|