@symbo.ls/element 3.14.805 → 3.14.807
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +10 -2
- package/dist/cjs/src/core.js +4 -4
- package/dist/cjs/src/hydration.js +1 -1
- package/dist/cjs/src/index.js +1 -1
- package/dist/cjs/src/inertOutside.js +1 -1
- package/dist/cjs/src/mountRecord.js +1 -1
- package/dist/cjs/src/mountScheduler.js +1 -1
- package/dist/cjs/src/mountYield.js +1 -1
- package/dist/cjs/src/version.js +1 -1
- package/dist/esm/src/core.js +4 -4
- package/dist/esm/src/hydration.js +1 -1
- package/dist/esm/src/index.js +1 -1
- package/dist/esm/src/inertOutside.js +1 -1
- package/dist/esm/src/mountRecord.js +1 -1
- package/dist/esm/src/mountScheduler.js +1 -1
- package/dist/esm/src/mountYield.js +1 -1
- package/dist/esm/src/version.js +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var o=Object.defineProperty;var
|
|
1
|
+
"use strict";var o=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var c=(n,t)=>{for(var u in t)o(n,u,{get:t[u],enumerable:!0})},d=(n,t,u,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of i(t))!a.call(n,e)&&e!==u&&o(n,e,{get:()=>t[e],enumerable:!(l=r(t,e))||l.enumerable});return n};var m=n=>d(o({},"__esModule",{value:!0}),n);var f={};c(f,{mountPendingOf:()=>_,mountRecord:()=>s});module.exports=m(f);function s(n){return n.__mount||(n.__mount={pending:0,tail:null,holder:null,waiters:null,chunkGen:0,attachLater:!1,held:!1})}function _(n){const t=n.__mount;return t?t.pending:0}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var w=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var W=Object.prototype.hasOwnProperty;var U=(e,t)=>{for(var n in t)w(e,n,{get:t[n],enumerable:!0})},Y=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of S(t))!W.call(e,r)&&r!==n&&w(e,r,{get:()=>t[r],enumerable:!(o=R(t,r))||o.enumerable});return e};var A=e=>Y(w({},"__esModule",{value:!0}),e);var
|
|
1
|
+
"use strict";var w=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var W=Object.prototype.hasOwnProperty;var U=(e,t)=>{for(var n in t)w(e,n,{get:t[n],enumerable:!0})},Y=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of S(t))!W.call(e,r)&&r!==n&&w(e,r,{get:()=>t[r],enumerable:!(o=R(t,r))||o.enumerable});return e};var A=e=>Y(w({},"__esModule",{value:!0}),e);var re={};U(re,{MOUNT_YIELD_BUDGET_MS:()=>_,__flushMountQueueSync:()=>X,__pendingMountChunks:()=>Z,__resetMountQueue:()=>$,abandonMount:()=>oe,closeMountBudget:()=>H,enqueueMountWork:()=>J,holdMount:()=>ee,mountBudgetExhausted:()=>O,mountIdle:()=>V,mountPending:()=>te,mountTick:()=>j,mountYieldBudget:()=>G,openMountBudget:()=>v,releaseMount:()=>q,settleMount:()=>q,settleMountWaiters:()=>Q,whenMountIdle:()=>K,whenMounted:()=>ne,yieldToMain:()=>N});module.exports=A(re);var E=require("./mountRecord.js");const _=50;function G(e){return e===!0?_:typeof e=="number"&&e>0?e:0}const u=[];let l=!1,i=0,s=_,a=!1,M=[];const d=typeof performance<"u"&&typeof performance.now=="function"?()=>performance.now():()=>Date.now(),x=[];let h=null;function L(e){if(!h){const t=new MessageChannel;t.port1.onmessage=()=>{const n=x.shift();!x.length&&typeof t.port1.unref=="function"&&t.port1.unref(),n&&n()},h=t}x.push(e),x.length===1&&typeof h.port1.ref=="function"&&h.port1.ref(),h.port2.postMessage(0)}function y(e){const t=typeof globalThis<"u"?globalThis.scheduler:null;if(t&&typeof t.yield=="function"){t.yield().then(e,e);return}if(typeof setImmediate=="function"){setImmediate(e);return}if(typeof MessageChannel=="function"){L(e);return}setTimeout(e,0)}function N(){return new Promise(e=>y(e))}function O(e=0,t){return!i||(t||d())-i+e<s?!1:(a=!0,!0)}let g=0,k=0,T=0,p=0;function I(){g=0,k=i,T=0,p=0}function j(){if(!i)return!1;if(g++,p>0)return p--,!1;const e=d(),t=e-i,n=t/g,o=(e-k)/(g-T),r=o>n?o:n;k=e,T=g;const B=s-t-r;return B<=0?(a=!0,!0):(p=r>0?Math.floor(B/r/2):0,!1)}let f=0;function v(e=_){f===0&&!i?(i=d(),a=!1,s=e,I()):e<s&&(s=e,p=0),f++}let c=null,b=!1;const z=typeof queueMicrotask=="function"?queueMicrotask:e=>Promise.resolve().then(e);function m(){i=0,a=!1,s=_,I()}function F(){b||(b=!0,z(()=>{b=!1,f===0&&m()}))}function H(){f>0&&f--,!(f!==0||c!==null)&&(l?F():m())}function J(e,t=_){const n={fn:e,budget:t};c?c.push(n):u.push(n),l||(l=!0,y(D))}function C(e){const t=c;c=[];try{e.fn()}catch(n){typeof console<"u"&&console.error&&console.error("[smbls] deferred mount chunk failed:",n?.message||n)}finally{const n=c;c=t,n.length&&u.unshift(...n)}}function K(){return!l&&!u.length?Promise.resolve():new Promise(e=>M.push(e))}function V(){return!l&&!u.length}function P(){if(!M.length)return;const e=M;M=[];for(let t=0;t<e.length;t++)e[t]()}function D(){for(i=d(),a=!1,s=1/0,I();u.length;){const e=u.shift();if(e.budget<s&&(s=e.budget,p=0),C(e),a||d()-i>=s)break}if(f=0,m(),u.length){y(D);return}l=!1,P()}function X(){let t=0;for(i=0;u.length&&t++<1e5;)C(u.shift());l=!1,f=0,m(),P()}function Z(){return u.length}function $(){u.length=0,c=null,l=!1,f=0,m(),P()}function ee(e){(0,E.mountRecord)(e.__ref).pending++}function q(e){const t=e&&e.__ref,n=t&&t.__mount;if(!n||!(n.pending>0)||--n.pending>0||t.__disposed)return;const o=n.tail;o&&(n.tail=null,o())}function te(e){const t=e&&e.__ref&&e.__ref.__mount;return!!(t&&t.tail)}function ne(e){const t=e&&e.__ref&&e.__ref.__mount;return!t||!t.tail?Promise.resolve(e):new Promise(n=>{(t.waiters||(t.waiters=[])).push(n)})}function Q(e,t=e&&e.__ref){const n=t&&t.__mount,o=n&&n.waiters;if(o){n.waiters=null;for(let r=0;r<o.length;r++)o[r](e)}}function oe(e,t=e&&e.__ref){const n=t&&t.__mount;if(!n||!n.tail)return;n.tail=null,n.pending=0;const o=n.holder;n.holder=null,Q(e,t),o&&q(o)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var p=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var x=(n,t)=>{for(var r in t)p(n,r,{get:t[r],enumerable:!0})},B=(n,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of R(t))!k.call(n,u)&&u!==r&&p(n,u,{get:()=>t[u],enumerable:!(o=m(t,u))||o.enumerable});return n};var E=n=>B(p({},"__esModule",{value:!0}),n);var G={};x(G,{mountYieldFeature:()=>F});module.exports=E(G);var e=require("./mountScheduler.js"),i=require("./core.js"),S=require("./mountRecord.js"),y=require("./features.js");function b(n,t){const r=t&&t.mountYield;if(!r&&!n.yieldChildren)return 0;const o=y.FEATURES.hydration!==null&&n.context?n.context.__hydration:null;if(o&&y.FEATURES.hydration.whole(o,n))return 0;const u=r?(0,e.mountYieldBudget)(r):0,f=(0,e.mountYieldBudget)(n.yieldChildren);return u&&f?u<f?u:f:u||f}function g(n,t,r,o,u){(0,e.openMountBudget)(o);try{C(n,n.__ref,0,t,r,o,u,!1)}finally{(0,e.closeMountBudget)()}}function C(n,t,r,o,u,f,c,a){try{for(let d=r;d<o;d++){const _=t.__mount,h=_?_.pending:0;if(u(d)===!1)continue;if(t.__disposed)break;const s=(0,e.mountTick)(),l=t.__mount;if(d+1<o&&(s||(l?l.pending:0)>h)){c&&c.onSuspend&&c.onSuspend(),a||(0,e.holdMount)(n);const M=d+1;(0,e.enqueueMountWork)(()=>A(n,t,M,o,u,f,c),f);return}}}catch(d){if(!a)throw d;(0,i.reportCreateChildrenError)(n,d)}a&&(0,e.settleMount)(n)}function A(n,t,r,o,u,f,c){if(t.__disposed||c&&c.isStale&&c.isStale()){(0,e.settleMount)(n);return}C(n,t,r,o,u,f,c,!0)}function N(n,t,r){(0,e.holdMount)(n),(0,e.enqueueMountWork)(()=>{try{const o=n.__ref;o&&!o.__disposed&&r()}catch(o){(0,i.reportCreateChildrenError)(n,o)}finally{(0,e.settleMount)(n)}},t)}function O(n,t,r,o){const u=n.__ref,f=(0,S.mountRecord)(u),c=++f.chunkGen,a=n.node,d=[];let _=!1;g(n,t,h=>{const s=r(h,_?(0,i.rowAttach)(n,W(a,d)):void 0),l=w(s);return l?d.push(l):s&&s.__ref.__mount&&s.__ref.__mount.held&&d.push(s),s},o,{isStale:()=>f.chunkGen!==c,onSuspend:()=>{_=!0}})}function w(n){const t=(0,i.placedRowNode)(n);if(t)return t;const r=n&&n.__ref;return r&&r.__if!==!1&&n.tag==="fragment"&&r.__fragmentAnchor||null}function W(n,t){for(let r=t.length-1;r>=0;r--){const o=t[r].__ref?w(t[r]):t[r];if(o&&o.parentNode===n)return o}return null}function Y(n,t){const r=n.__ref;try{(0,i.syncSelectValue)(n,!0),(0,i.attachWhole)(n),(0,i.completeCreate)(n,t)}finally{(0,e.settleMountWaiters)(n,r);const o=r.__mount,u=o&&o.holder;u&&(o.holder=null,(0,e.settleMount)(u))}}const F={budgetOf:b,run:g,rows:O,defer:N,hold:e.holdMount,finish:Y,abandon:e.abandonMount};
|
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.807";
|
package/dist/esm/src/core.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{createStore as
|
|
1
|
+
import{createStore as ro,createScopeStore as as,isStore as K}from"@symbo.ls/signal";import{createEffect as v,getObserver as us}from"@symbo.ls/signal";import*as ds from"@symbo.ls/signal";import{withDesignSystem as Q,untrack as $t}from"./runContext.js";import{cacheNode as eo,detectTag as $o,firstSlotAfterText as Ho}from"./cache.js";import{REGISTRY as B,LIFECYCLE_EVENTS as ls}from"./registry.js";import{registerEvent as ps,registerGlobalEvent as hs,globalEventKeyInfo as ys,isHandlerKey as W,eventNameFrom as _s,stringHandler as gs}from"./delegate.js";import{FEATURES as M}from"./features.js";import{mountBridge as bs}from"./bridge.js";import{applyExtends as As,openMergeLayer as xs,closeMergeLayer as ws,deepMergeChild as X}from"./extends.js";import{flushConnected as io}from"./connected.js";import{mountRecord as Ss,mountPendingOf as Ht}from"./mountRecord.js";import{addMethods as ks}from"./methods.js";import"./dispose.js";import{isLoudDevRuntime as rt}from"./devRuntime.js";import{replaceLiteralsWithObjectFields as $,isPolyglotWritableKey as Cs,markPolyglotSeeded as vs,polyglotSeededKeys as js}from"@symbo.ls/utils";import*as Ut from"@symbo.ls/utils";import{dispatchPluginHook as bt,hasPluginHook as Ps,reportLifecycleError as Bt}from"./pluginHooks.js";import{applyStateMethods as ft}from"@symbo.ls/state";import{CSS_PROPS_REGISTRY as H,DEFAULT_CSS_PROPERTIES_LIST as V,pushStaticCssPass as Uo,popStaticCssPass as Bo,resolveStyleBlockTokens as Es}from"css-in-props";import{css as At,wrapHoverRule as Vo}from"@symbo.ls/css";import{pushConfig as z,popConfig as q}from"@symbo.ls/scratch";import{checkAttributeByTagName as xt,applyAttrTransforms as Ts,ATTR_TRANSFORMS as co,camelToAttr as wt,serializeAttrValue as J,isEnumeratedTrueFalseAttr as Vt,extractConditionalAttrs as Os}from"attrs-in-props";import{resolveElementIdEngine as Rs}from"./engineRegistry.js";import{CSS_LONGHAND_SHORTHANDS as Kt,CSS_SHORTHAND_LONGHANDS as Ds,cssShorthandStatesLonghand as Ko,cssShorthandStatesThemeLonghand as Ls,cssPropName as Go,cssCamelName as Wo}from"./cssLonghands.js";import{isAttributeFirst as zo,isCssProp as et}from"./attributeFirst.js";import{VERSION as Ns}from"./version.js";const qo=Rs({uniqId:1,scopedStyleId:0},Ns),at=[],m=new Set;let fo=!1,Yo=0,ut=null,St=null;function dt(){return typeof Date<"u"&&typeof Date.now=="function"?Date.now():0}function Zo(){return typeof document<"u"&&document.visibilityState==="hidden"}const Ms=250,Fs=1e3;function Is(){return St&&(St!==(typeof requestAnimationFrame=="function"?requestAnimationFrame:null)||Zo())?!0:dt()-Yo>=Fs}function $s(){if(fo=!0,Yo=dt(),St=null,typeof requestAnimationFrame!="function"){const t=typeof clearTimeout=="function"?clearTimeout:null,o=setTimeout(uo,0);ut=t?()=>t(o):null;return}if(Zo()){const t=typeof clearTimeout=="function"?clearTimeout:null,o=setTimeout(uo,Ms);ut=t?()=>t(o):null}else{const t=typeof cancelAnimationFrame=="function"?cancelAnimationFrame:null;St=requestAnimationFrame;const o=requestAnimationFrame(uo);ut=t?()=>t(o):null}}function kt(){if(fo){if(!Is())return;const t=ut;if(ut=null,t)try{t()}catch{}}$s()}const Qo=300,Xo=15e4;let ao=0;function De(){ao++;let t=!1;return()=>{t||(t=!0,!(--ao>0)&&(at.length||m.size)&&kt())}}function uo(){if(fo=!1,ut=null,St=null,ao>0||(m.size&&Ur(),!at.length))return;const t=at.splice(0,at.length);for(let o=0;o<t.length;o++){const n=t[o];if(n.node){if(!n.node.isConnected){const s=n.__ref||(n.__ref={});s.__mountAttempts=(s.__mountAttempts||0)+1,s.__mountFirstAttemptAt==null&&(s.__mountFirstAttemptAt=dt());const r=dt()-s.__mountFirstAttemptAt;s.__mountAttempts<=Qo&&r<Xo?(at.push(n),kt()):console.warn("[DOMQL] onMounted dropped after",s.__mountAttempts,"attempts /",r,"ms \u2014 node never connected:",n.key||n.tag||n);continue}typeof n.onBridgeMount=="function"&&bs(n),typeof n.onMounted=="function"&&N("Mounted",n,n.__ref?.__mountOptions||{})}}}function lo(t,o){const n=t.__ref?.__autoGrow;n&&n.active&&Rt(t,!0),!(typeof t.onMounted!="function"&&typeof t.onBridgeMount!="function")&&(t.__ref.__mountOptions=o,at.push(t),kt())}function Jo(t,o){typeof t.onContentUpdate=="function"&&(bt("contentUpdate",t,o),Q(t,()=>{try{t.onContentUpdate(t,t.state,t.context,o)}catch(n){if(Bt(t,"onContentUpdate",n),t.context?.strictMode)throw n}}))}function Hs(t){return t.toLowerCase()}function mo(t){const o=t.charCodeAt(0);return o===58||o===64||o===38||o===91}function Gt(t){if(typeof t=="string")return t||void 0;if(typeof t=="number"||typeof t=="bigint")return String(t)}function tn(t,o,n,s){return Wt(s,Gt(t)||(o&&typeof o=="object"?Gt(o.key):void 0)||String(n))}function Wt(t,o){if(!t||typeof o!="string")return o;let n=o;for(;Us(t,n);)n="$"+n;return n!==o&&Bs(t,o,n),n}function Us(t,o){if(B.has(o)&&o!=="content")return!0;if(!(o in t))return!1;const n=t[o];return!(n&&typeof n=="object"&&n.__ref&&n.parent===t)}const on=new Set;function Bs(t,o,n){if(!rt())return;const s=t.__ref&&t.__ref.path&&t.__ref.path.join(".")||t.key||"<root>",r=s+"::"+o;on.has(r)||(on.add(r),console.warn(`[smbls] a child keyed "${o}" at ${s} names a property of its parent; it lives at el["${n}"] (data-key="${n}") so the parent keeps its own "${o}". Prefix the data keys to keep plain el.<key> access.`))}function tt(t,o,n,s={},r){if(us())return $t(()=>tt(t,o,n,s,r));if(t==null||t===!1)return null;const c=ur(t);(typeof t=="string"||typeof t=="number")&&(t={text:t}),n=Gt(n);const a=Gt(t.key),i=Object.create(null);i.key=n||(a&&o?Wt(o,a):a)||`_${qo.uniqId++}`,i.parent=o||null,i.context=t.context||o?.context||s.context||{},i.context.__create||(i.context.__create=tt);const e=i.__ref={__if:!0,__children:[],__exec:{},__effects:[],__eventCleanup:[],root:o?.__ref?.root||i,path:o?.__ref?.path?[...o.__ref.path,i.key]:[i.key],origin:t,__mount:null,__plainRows:null,__ifParked:null};c&&(e.__runtimeSource=c);let f=r;r&&(r.holdTail||r.deferAttach)&&(r.holdTail&&M.mount!==null&&M.mount.hold(i),r.deferAttach&&(Ss(e).attachLater=!0),f=void 0);const l=t;if(t=nn(i,t,n,a,o,s),i.if!=null){let _;if(typeof i.if=="function")try{_=i.if(i,i.state,i.context)}catch(p){if(_=!1,e.__ifError=p,typeof console<"u"&&console.warn){const y=i.key||i.tag||"?";console.warn(`[smbls] \`if:\` evaluator threw on ${y} \u2014 treating as false:`,p?.message||p)}}else _=i.if;e.__if=!!_}if(e.__if)typeof i.if=="function"&&(e.__ifInitialized=!0);else{if(o){o[i.key]=i;const p=o.__ref;p&&(p.__ifParked||(p.__ifParked=new Set)).add(i.key)}const _=Ys(t,n,i.context?.components);return _.length&&(e.__ifLateMerge={definition:l,key:n,ownKey:a,names:_,options:s}),typeof i.if=="function"&&xn(i,e,i.if),i}i.tag||(i.tag=$o(i)),N("Init",i,s);const u=M.hydration,d=i.node=u!==null&&u.adopt(i)||eo(i);if(!d)return i;if(i.tag==="fragment"){const p=(i.context?.document||globalThis.document).createComment("");d.appendChild(p),e.__fragmentAnchor=p}if(N("AttachNode",i,s),d.setAttribute&&i.key&&d.setAttribute("data-key",i.key),o){const _=o[i.key];o[i.key]=i;const p=o.__ref?.__children;p&&(_===void 0||!p.includes(i.key))&&p.push(i.key)}d.setAttribute&&i.context?.scopeSelector&&i.context.scopeSelector!==":root"&&i.context.key&&i.key===i.context.key&&d.setAttribute("data-smbls-app",i.context.key),i.id&&d.setAttribute&&(d.id=i.id),mn(i,s),gn(i),An(i);try{ss(i,s)}catch(_){Ks(i,_)}const h=e.__mount;return h!==null&&h.pending>0?(h.attachLater||(s.mountWhole===!0&&!(r&&r.holdTail)&&Vs(i,o)?h.held=!0:_t(i,o,f)),h.tail=()=>M.mount.finish(i,s),i):(to(i,!0),(h===null||!h.attachLater)&&_t(i,o,f),Gs(i,s),i)}function Le(t){const o=t&&t.__ref&&t.__ref.__mount;return!o||!o.attachLater||(o.attachLater=!1,!t.node)?!1:(_t(t,t.parent),!0)}function Vs(t,o){if(!o||o.tag==="fragment")return!1;const n=t.node;if(!n||n.nodeType===11)return!1;const s=o.node||(o.nodeType?o:null);return!!s&&n.parentNode!==s}function Ne(t){const o=t.__ref,n=o&&o.__mount;if(!n||!n.held)return;n.held=!1;const s=t.node,r=t.parent;if(!s||!r)return;const c=r.__ref;if(!c){_t(t,r);return}const a=r.node;if(!a)return;const i=c.__children,e=i?i.lastIndexOf(t.key):-1;let f;for(let l=e-1;l>=0;l--){const u=r[i[l]],d=u&&(mt(u)||(u.tag==="fragment"&&u.__ref?u.__ref.__fragmentAnchor:null));if(d&&d.parentNode===a){f=d.nextSibling;break}}f===void 0&&(f=Ho(a,c.__textNode)),_t(t,r,f?{position:"before",node:f}:void 0)}function Ks(t,o){if(typeof console<"u"&&console.error){const n=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] createChildren failed at ${n}:`,o?.message||o,o?.stack?`
|
|
2
2
|
`+o.stack.split(`
|
|
3
3
|
`).slice(0,6).join(`
|
|
4
|
-
`):"")}}function Kn(t,o){if(typeof t.html=="function"&&t.node&&!t.node.innerHTML&&Q(t,()=>{try{const s=t.html(t,t.state,t.context);s!=null&&typeof s!="function"&&(t.node.innerHTML=s)}catch{}}),N("Create",t,o),N("Complete",t,o),N("Render",t,o),N("RenderRouter",t,o),uo(t,o),typeof t.onFrame=="function"){const s=t.onFrame,n=t.context?.designSystem,r=()=>{if(t.node){if(t.node.isConnected){n&&z(n);try{s(t,t.state,t.context)}catch(c){console.error("[DOMQL] onFrame error:",c)}finally{n&&q()}}requestAnimationFrame(r)}};requestAnimationFrame(r)}}function Wt(t,o){const s=o&&o.__ref&&o.__ref.__mount;!s||!s.tail||s.holder||(s.holder=t,M.mount.hold(t))}const Gn=new Set(["childProps","attr","style","scope","data","vars"]);function os(t,o,s,n,r,c){if(s&&!o.extends&&!o.extend){const p=s.indexOf("_"),y=s.indexOf(".");let A=p>0?p:-1;if(y>0&&(A<0||y<A)&&(A=y),A>0){const S=s.substring(0,A),w=t.context?.components;w&&(w[S]||w["smbls."+S])?o={...o,extends:S}:w&&rt()&&(/^[A-Z]\w*_\d+$/.test(s)||/^[A-Z]\w*\.\w+$/.test(s))&&console.warn(`[smbls] auto-extend: key "${s}" looks like an instance of "${S}" but neither "${S}" nor "smbls.${S}" is registered in context.components \u2014 element will render as a plain <div>. Register the base component or rename the key.`)}}t.__ref&&(t.__ref.__mergeLayer=null),An(t,o,c);const a=xn(t),i=t.props&&typeof t.props=="object"?t.props:null;for(const p in o)if(!(p==="parent"||p==="node"||p==="__ref"||p==="extends"||p==="context"||p==="props")){if(p==="key"){n&&(t.key=r?Gt(r,n):n);continue}a&&a.mark(p),lo(t,p,o[p])}if(i)for(const p in i)lo(t,p,i[p]);const e=o.props;if(e&&typeof e=="object"){for(const p in e)lo(t,p,e[p]);if(a)for(const p in e)a.mark(p)}wn(t),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 f=t.scope&&typeof t.scope=="object"?t.scope:null,l=r?.scope,u=t.context&&typeof t.context.globalScope=="object"&&t.context.globalScope||null,d=l||u||null;if(o.scope!==void 0||f){const p={};f&&Object.assign(p,f),o.scope!==void 0&&Object.assign(p,o.scope),t.scope=fn(p,d)}else d&&(t.scope=d);o.if!==void 0&&(t.if=o.if);const h=t.__ref,_=ur(t,h&&h.__runtimeSource);return h&&(h.__declaredArrays=_||void 0),kn(t),Yn(t,r,o,c),o}function lo(t,o,s){const n=t[o],r=M.chains;if(r!==null&&r(t,o,n,s))return;const c=n&&s&&typeof n=="object"&&typeof s=="object"&&!Array.isArray(n)&&!Array.isArray(s);c&&o.charCodeAt(0)>=65&&o.charCodeAt(0)<=90?t[o]=X(n,s):c&&Gn.has(o)?t[o]={...n,...s}:c&&Jo(o)?t[o]=X(n,s):t[o]=s}const Wn=new Set(["key","parent","context","__ref"]);function zn(t,o){for(const n of Object.keys(t))Wn.has(n)||delete t[n];let s=o.definition;if(!s.extends&&!s.extend&&typeof o.key=="string"){const n=t.context?.components||{},r=n[o.key]||n["smbls."+o.key];r&&(s={...s,extends:r})}It(()=>os(t,s,o.key,o.ownKey,t.parent,o.options))}function qn(t,o,s){const n=s||{},r=i=>!!(n[i]||n["smbls."+i]),c=[],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 i of a){if(typeof i!="string")continue;const e=i.includes(">")?i.split(">")[0].trim():i;r(e)||c.push(e)}return c}if(typeof o=="string"&&/^[A-Z]/.test(o)){let i=-1;const e=o.indexOf("_"),f=o.indexOf(".");e>0&&(i=e),f>0&&(i<0||f<i)&&(i=f);const l=i>0?o.substring(0,i):o;r(l)||c.push(l)}return c}function po(t,o,s){if(typeof t.onStateInit!="function"&&!Pn(t,"stateInit"))return;const n=t.state;t.state=o;try{N("StateInit",t,s)}finally{t.state=n}}const ho=t=>({isDataOnlyKey:o=>jn(t).has(o)});function Yn(t,o,s,n){const r=!o,c=s.state&&typeof s.state=="object"&&!Array.isArray(s.state)&&Object.keys(s.state).length===0,a=r&&c&&t.context?.state,i=s.state!==void 0&&!a?s.state:t.state&&!K(t.state)?t.state:void 0;if(i==null){if(o?.state)t.state=o.state,ft(t,t.state);else if(t.context?.state){const e=t.context.state,f={...e},l=t.context?.polyglot;if(l?.translations){const u=t.context,d=e.lang||l.defaultLang||"en",h=new Set,_=(A,S)=>{h.has(A)||Cn(u,A,f)&&(f[A]=S,h.add(A),vn(u,A,S))},p=l.translations[d];if(p&&typeof p=="object")for(const A in p)_(A,p[A]);const y=new Set(l.languages||[]);for(const A in l.translations)y.has(A)||_(A,l.translations[A])}K(f)||po(t,f,n),t.state=K(f)?f:no(f,ho(t.context)),t.state.__element=t,t.state.root=t.state,ft(t,t.state),Ut.promoteActiveRootState?.(e,t.state),N("StateCreated",t,n)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),ft(t,t.state);return}if(typeof i=="string"){if(t.state=rs(i,o),t.state&&typeof t.state=="object"&&!K(t.state)){const e=o?.state?.root||o?.state||t.state;Object.defineProperty(t.state,"root",{value:e,enumerable:!1,configurable:!0,writable:!0})}ft(t,t.state),Qn(t,i,o),N("StateCreated",t,n);return}if(typeof i=="function"){const e=i(t,o?.state);if(K(e))t.state=e;else{const f=e||{};po(t,f,n),t.state=no(f,o?.state?void 0:ho(t.context))}}else if(K(i))t.state=i;else{const e={...i};po(t,e,n),t.state=no(e,o?.state?void 0:ho(t.context))}t.state.__element=t,o?.state?(t.state.parent=o.state,t.state.root=o.state.root||o.state):t.state.root=t.state,ft(t,t.state),Ut.promoteActiveRootState?.(i,t.state),N("StateCreated",t,n)}function ss(t,o){if(!o)return t;const s=o.split("/");let n=t;for(const r of s){if(n==null)return{};n=n[r]}return n??{}}function ns(t,o){const s=o.state;return t.startsWith("~/")?[s&&(s.root||s),t.slice(2)]:t.startsWith("../")?[s,t.slice(3)]:[s,t]}function rs(t,o){if(!o)return{};if(t===".")return o.state||{};if(t.startsWith("../")||t.startsWith("~/")){const[r,c]=ns(t,o);return c?ss(r,c):r??{}}if(o.state?.[t]!==void 0)return o.state[t];const s=ss(o.state,t);if(s!=null&&Object.keys(s).length>0)return s;const n=o.context?.polyglot;if(n?.translations){const r=o.state?.root?.lang||n.defaultLang||"en",c=n.translations[r];if(c?.[t]!==void 0)return c[t];if(n.translations[t]!==void 0)return n.translations[t]}return{}}function Zn(t,o){const[s,n]=ns(t,o);if(!n||!s||typeof s!="object")return;const r=s[n];if(r!==void 0||n.indexOf("/")===-1)return r;let c=s;for(const a of n.split("/")){if(c==null||typeof c!="object")return;c=c[a]}return c}function Qn(t,o,s){const n=t.__ref;if(!n||!s||o==="."||!K(s.state))return;n.__stateBinding&&n.__stateBinding.dispose();const r=It(()=>v(()=>{const c=Zn(o,s);!c||typeof c!="object"||c===t.state||It(()=>es(t,t.state,c,!0))},{depth:n.path?n.path.length:0,label:C(n,"state")}));r._isStateBinding=!0,n.__stateBinding=r,n.__effects&&n.__effects.push(r)}function es(t,o,s,n){const r=t.__ref;if(!r)return;if(n||t.state===o){t.state=s,n&&ft(t,s),cs(r);const a=r.__children;if(a)for(let i=0;i<a.length;i++){const e=t[a[i]];e&&e.__ref&&e.parent===t&&es(e,o,s,!1)}return}if(r.__stateBinding){r.__stateBinding._notify();return}const c=t.state;c&&typeof c=="object"&&c.parent===o&&(c.parent=s,cs(r))}function is(t,o){const s=t.__ifParked;if(!s||!s.size)return o;for(const n of s)o.includes(n)||o.push(n);return o}function cs(t){const o=t.__effects;if(o)for(let s=0;s<o.length;s++){const n=o[s];n&&!n._disposed&&!n._isStateBinding&&!n._isSubscribeToEffect&&typeof n._notify=="function"&&n._notify()}}const Xn=new Set(["s","state","ctx","context"]),yo=new WeakMap;function Jn(t){if(yo.has(t))return yo.get(t);let o=null;try{const s=typeof Ut.getFunctionSource=="function"?Ut.getFunctionSource(t):Function.prototype.toString.call(t);if(typeof s=="string"){const n=s.match(/^\s*(?:async\s+)?([A-Za-z_$][\w$]*)\s*=>/)||s.match(/^[^(]*\(([^)]*)\)/);n&&(o={params:n[1].split(",").map(r=>r.trim())})}}catch{}return yo.set(t,o),o}function mn(t){const o=Jn(t);return o?o.params.map(s=>s.split("=")[0].trim()).filter(Boolean):[]}const tr=3,or=/^(is|has)[A-Z0-9_$]/,sr=new Set(["routerOptions"]),fs=new WeakSet;function nr(t,o){if(typeof t!="function"||t.length!==2||o&&(or.test(o)||sr.has(o))||fs.has(t))return!1;const s=mn(t);if(s.length<2)return!1;const n=s[1].replace(/[{}[\]]/g,"").trim();return n.length<tr||Xn.has(n)?!1:(fs.add(t),!0)}function rr(t){const o=t.__ref,s=t.tag||"div",n=t.context?.designSystem,r=[],c=Object.keys(t);for(let a=0;a<c.length;a++){const i=c[a];if(typeof t[i]!="function"||B.has(i))continue;const e=i.charCodeAt(0);e>=65&&e<=90||W(i)||U[i]||V&&V.has(i)||e!==45&&(At(s,i)||(rt()&&nr(t[i],i)&&console.warn(`[smbls] custom prop "${i}"${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('${i}', \u2026) instead of reading el.${i}(\u2026) directly (see RULES.md Rule 8).`),r.push({prop:i,fn:t[i]})))}for(let a=0;a<r.length;a++){const{prop:i,fn:e}=r[a];o.__exec[i]=e,Object.defineProperty(t,i,{get(){n&&z(n);try{return e(t,t.state,t.context)}catch{return}finally{n&&q()}},set(f){delete o.__exec[i],Object.defineProperty(t,i,{value:f,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function er(t,o){if(!(!Array.isArray(o)||o.length===0))for(let s=0;s<o.length;s++){const n=o[s];try{typeof n=="function"?n(t,t.state,t.context):typeof n=="string"&&t.state?.[n]}catch{}}}function O(t,o,s){return!Array.isArray(o)||o.length===0?s:function(...n){return er(t,o),s.apply(this,n)}}function lt(t,o){if(!(!t||Array.isArray(t)||typeof t!="object"))return t[o]}function C(t,o){return()=>t.path.join(".")+"::"+o}const as=new Set;function F(t,o,s){if(!rt())return;const n=C(t,o)();as.has(n)||(as.add(n),console.warn(`[smbls] "${o}" effect threw on ${t.path.join(".")} \u2014 keeping previous value:`,s?.message||s))}const us=/(['"`])((?:\\.|(?!\1)[^\\])*)\1/g,ds=new WeakMap,ir=t=>{let o=ds.get(t);if(o!==void 0)return o;o=null;let s;try{s=String(t)}catch{s=""}if(s.includes("{{")){us.lastIndex=0;let n;for(;(n=us.exec(s))!==null;)n[2].includes("{{")&&(o||(o=[])).push(n[2])}return ds.set(t,o),o},cr=(t,o)=>{const s=ir(t);if(s)for(let n=0;n<s.length;n++)o.add(s[n])},fr=(t,o)=>!W(t)&&!et(o,t),_o=(t,o,s,n,r)=>{if(typeof o=="string"){!r&&o.includes("{{")&&s.add(o);return}typeof o=="function"&&fr(t,n)&&cr(o,s)},go=new WeakMap,kt=(t,o)=>Object.prototype.hasOwnProperty.call(t,o),Ct=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)?X(t,o):t},vt=(t,o)=>t&&o?X(t,o):t||o||null,ls=(t,o)=>{const s=t.__ref&&t.__ref.__runtimeSource;return!!s&&kt(s,o)},pt=(t,o)=>ls(t,o)?Ct(t.__ref.__runtimeSource[o]):null,jt=(t,o)=>(o&&t&&typeof t=="object"&&go.set(t,o),t),ar=t=>{if(!t||typeof t!="object")return;const o=go.get(t);return o&&go.delete(t),o},bo=(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 n=0;n<t.length;n++)bo(t[n],o,s);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&&bo(r.value,o,s)}}},ur=(t,o)=>{let s=null;for(const n of Object.keys(t)){if(B.has(n)||o&&kt(o,n))continue;const r=Object.getOwnPropertyDescriptor(t,n),c=r&&r.value;if(!Array.isArray(c))continue;const a=new Set;bo(c,a,new Set),a.size&&(s||(s=new Map),s.set(c,a))}return s},ps=(t,o)=>{if(Array.isArray(o))for(let s=t;s;s=s.parent){const n=s.__ref&&s.__ref.__declaredArrays,r=n&&n.get(o);if(!r)continue;const c=t.__ref;c.__authoredTemplates||(c.__authoredTemplates=new Set);for(const a of r)c.__authoredTemplates.add(a);return}},hs=["attr","aria","data","metadata"],dr=t=>{if(hs.includes(t))return!0;const o=t.charCodeAt(0);return o===46||o===33||o===64},lr=(t,o)=>{const s=new Set,n=t.tag||"div";for(const r of Object.keys(t)){const c=Object.getOwnPropertyDescriptor(t,r),a=c&&c.value,i=!!o&&kt(o,r);if(a&&typeof a=="object"&&!Array.isArray(a)){if(!dr(r))continue;const e=i?o[r]:null,f=e&&typeof e=="object"?e:null,l=r.charCodeAt(0)===46||r.charCodeAt(0)===33;for(const u in a){const d=i&&(!f||kt(f,u)),h=a[u];if(l&&h&&typeof h=="object"&&!Array.isArray(h)&&hs.includes(u)){for(const _ in h)_o(_,h[_],s,n,d);continue}_o(u,h,s,n,d)}continue}_o(r,a,s,n,i)}return s};function ys(t,o){const s=t.__ref,n=!!(o&&o.skipIfEffect),r=lr(t,s.__runtimeSource);if(s.__authoredTemplates)for(const e of r)s.__authoredTemplates.add(e);else s.__authoredTemplates=r;if(rr(t),typeof t.text=="function"){const e=t.text,f=O(t,t.textDeps,e),l=v(()=>{if(!s.contentManaged)try{let u=f(t,t.state,t.context);t.node&&u!=null&&typeof u!="function"&&typeof u!="object"&&(typeof u=="string"&&u.includes("{{")&&(u=$.call(t,u,t.state)),zt(t,u))}catch(u){F(s,"text",u)}},{depth:s.path.length,label:C(s,"text")});s.__effects.push(l),s.__exec.text=e}else if(typeof t.text=="string"&&t.text.includes("{{")){const e=t.text,f=v(()=>{if(s.contentManaged)return;const l=$.call(t,e,t.state);l!=null&&(t.text=l),t.node&&zt(t,l??"")},{depth:s.path.length,label:C(s,"text")});s.__effects.push(f),s.__exec.text=e}const c=t.tag||"div";for(const e of Object.keys(t))if(typeof t[e]=="function"&&!B.has(e)&&!W(e)&&!s.__exec[e]&&!Wo(c,e)){if(U[e]){const f=t[e],l=O(t,t[e+"Deps"],f),u=e;let d,h=null,_=null,p;const y=v(()=>{const A=t.context?.designSystem;A&&z(A);try{const S=l(t,t.state,t.context);Uo();let w;try{w=U[u](S,t,t.state,t.context)}finally{Ho()}if(Array.isArray(w)){const g={};for(const x of w)if(x)for(const k in x)g[k]=x[k];w=g}const b=u==="show"||u==="hide";if(w&&t.node&&yr(w)){const g=ht(w);if(g===null||g!==p){p=g;const x=bt(w,null,t.context?.cssPrefix),k=x?x.split(" ").filter(Boolean):null;if(t.node.classList){if(_)for(const j of _)t.node.classList.remove(j);if(k&&k.length)for(const j of k)t.node.classList.add(j);_=k}}d=void 0,h=null}else if(w&&t.node){if(_){for(const x of _)t.node.classList.remove(x);_=null,p=void 0}const g=ht(w);if(g===null||g!==d||!Et(t.node,h)){d=g;const x=js(t,w);h=Pt(t.node,x)}}else t.node&&b&&(d=void 0,h=null,t.node.style.display="")}finally{A&&q()}},{depth:s.path.length,label:C(s,u)});s.__effects.push(y),s.__exec[e]=f}else if(V&&V.has(e)){const f=t[e],l=O(t,t[e+"Deps"],f),u=e;let d,h=null;const _=v(()=>{const p=t.context?.designSystem;p&&z(p);try{const y=l(t,t.state,t.context);if(t.node)if(y!=null){const A=u+":"+String(y);if(A!==d||!Et(t.node,h)){d=A;const S={[u]:y},w=js(t,S);h=Pt(t.node,w)}}else d=void 0,h=null,t.node.style[u]=""}finally{p&&q()}},{depth:s.path.length,label:C(s,u)});s.__effects.push(_),s.__exec[e]=f}else if(e.charCodeAt(0)===45){const f=t[e];ks(t,e,f,t[e+"Deps"],e),s.__exec[e]=f}}if(_r(t),typeof t.html=="function"){const e=t.html,f=O(t,t.htmlDeps,e),l=v(()=>{Q(t,()=>{const u=f(t,t.state,t.context);t.node&&u!=null&&typeof u!="function"&&(t.node.innerHTML=u)})},{depth:s.path.length,label:C(s,"html")});s.__effects.push(l),s.__exec.html=e}if(typeof t.value=="function"){const e=t.value,f=O(t,t.valueDeps,e),l=v(()=>{try{let u=f(t,t.state,t.context);typeof u=="string"&&u.includes("{{")&&(u=$.call(t,u,t.state)),As(t,u)}catch(u){F(s,"value",u)}},{depth:s.path.length,label:C(s,"value")});s.__effects.push(l),s.__exec.value=e}else if(typeof t.value=="string"&&t.value.includes("{{")){const e=t.value,f=v(()=>{try{As(t,$.call(t,e,t.state))}catch(l){F(s,"value",l)}},{depth:s.path.length,label:C(s,"value")});s.__effects.push(f),s.__exec.value=e}if(typeof t.style=="function"){const e=t.style,f=O(t,t.styleDeps,e);let l,u=null,d,h,_,p;const y=v(()=>{const A=f(t,t.state,t.context),S=t.context&&t.context.designSystem;let w;if(A&&typeof A=="object"&&A===d&&S===_){const g=ht(A);w=g!==null&&g===h?p:Xt(t,A),h=g}else w=Xt(t,A),h=void 0;d=A,_=S,p=w;const b=ht(w);(b===null||b!==l||!Et(t.node,u))&&(l=b,xo(t.node,u,w),ot(t.node,w),u=Pt(t.node,w))},{depth:s.path.length,label:C(s,"style")});s.__effects.push(y),s.__exec.style=e}else if(t.style&&typeof t.style=="object")for(const e in t.style){const f=t.style[e];if(typeof f!="function")continue;const l=O(t,lt(t.styleDeps,e),f);let u,d=null;const h=v(()=>{try{const _=l(t,t.state,t.context);if(t.node){const p=e+":"+String(_);if(p!==u||!Et(t.node,d)){u=p;const y=Xt(t,{[e]:_});xo(t.node,d,Object.assign({},y,{[e]:""})),ot(t.node,y),d=Pt(t.node,y)}}}catch(_){F(s,"style."+e,_)}},{depth:s.path.length,label:C(s,"style."+e)});s.__effects.push(h)}if(t.attr&&typeof t.attr=="object"){for(const e in t.attr)if(typeof t.attr[e]=="function"){const f=O(t,lt(t.attrDeps,e),t.attr[e]),l=e,u=v(()=>{try{let d=f(t,t.state,t.context);typeof d=="string"&&d.includes("{{")&&(d=$.call(t,d,t.state)),t.node?.setAttribute&&qt(t.node,l,d)}catch(d){F(s,"attr."+l,d)}},{depth:s.path.length,label:C(s,"attr."+l)});u._attrName=l.toLowerCase(),s.__effects.push(u)}else if(typeof t.attr[e]=="string"&&t.attr[e].includes("{{")){const f=t.attr[e],l=e,u=v(()=>{try{const d=$.call(t,f,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(l,J(l,d??""))}catch(d){F(s,"attr."+l,d)}},{depth:s.path.length,label:C(s,"attr."+l)});u._attrName=l.toLowerCase(),s.__effects.push(u)}}if(t.aria&&typeof t.aria=="object")for(const e in t.aria){const f=t.aria[e];if(typeof f=="string"&&f.includes("{{")){const h=f,_="aria-"+e.replace(/[A-Z]/g,y=>"-"+y.toLowerCase()),p=v(()=>{try{const y=$.call(t,h,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(_,J(_,y??""))}catch(y){F(s,"aria."+e,y)}},{depth:s.path.length,label:C(s,"aria."+e)});p._attrName=_,s.__effects.push(p);continue}if(typeof f!="function")continue;const l=O(t,lt(t.ariaDeps,e),t.aria[e]),u="aria-"+e.replace(/[A-Z]/g,h=>"-"+h.toLowerCase()),d=v(()=>{try{const h=l(t,t.state,t.context);if(!t.node?.setAttribute)return;qt(t.node,u,h)}catch(h){F(s,"aria."+e,h)}},{depth:s.path.length,label:C(s,"aria."+e)});d._attrName=u,s.__effects.push(d)}if(t.data&&typeof t.data=="object")for(const e in t.data){const f=t.data[e];if(typeof f=="string"&&f.includes("{{")){const _=f,p="data-"+e.replace(/[A-Z]/g,A=>"-"+A.toLowerCase()),y=v(()=>{try{const A=$.call(t,_,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(p,A??"")}catch(A){F(s,"data."+e,A)}},{depth:s.path.length,label:C(s,"data."+e)});y._attrName=p,s.__effects.push(y);continue}if(typeof f!="function")continue;const l=O(t,lt(t.dataDeps,e),t.data[e]),d="data-"+e.replace(/[A-Z]/g,_=>"-"+_.toLowerCase()),h=v(()=>{try{const _=l(t,t.state,t.context);if(!t.node?.setAttribute)return;_==null||_===!1?t.node.removeAttribute(d):typeof _!="function"&&typeof _!="object"&&t.node.setAttribute(d,_===!0?"":_)}catch(_){F(s,"data."+e,_)}},{depth:s.path.length,label:C(s,"data."+e)});h._attrName=d,s.__effects.push(h)}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 f=O(t,lt(t.classDeps,e),a[e]),l=v(()=>{try{const u=f(t,t.state,t.context);if(!t.node?.classList)return;typeof u=="string"?t.node.classList.add(u):u?t.node.classList.add(e):t.node.classList.remove(e)}catch(u){F(s,"class."+e,u)}},{depth:s.path.length,label:C(s,"class."+e)});s.__effects.push(l)}!n&&typeof t.if=="function"&&bs(t,s,t.if);for(const e of Object.keys(t)){if(B.has(e)||typeof t[e]!="function")continue;const f=e.charCodeAt(0);if(f>=65&&f<=90||W(e))continue;const l=t[e];s.__exec[e]=l;const u=t.tag||"div";if(At(u,e)&&!et(u,e)){const d=xt(e)||e,h=O(t,t[e+"Deps"],l),_=v(()=>{try{let p=h(t,t.state,t.context);typeof p=="string"&&p.includes("{{")&&(p=$.call(t,p,t.state)),t.node?.setAttribute&&qt(t.node,d,p,!0)}catch(p){F(s,e,p)}},{depth:s.path.length,label:C(s,e)});_._attrName=d.toLowerCase(),s.__effects.push(_)}}const i=t.tag||"div";for(const e of Object.keys(t)){if(B.has(e))continue;const f=t[e];if(typeof f!="string"||!f.includes("{{"))continue;const l=e.charCodeAt(0);if(l>=65&&l<=90||W(e)||et(i,e)||io[e]||!At(i,e))continue;const u=xt(e)||e,d=v(()=>{try{const h=$.call(t,f,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(u,J(u,h??""))}catch(h){F(s,e,h)}},{depth:s.path.length,label:C(s,e)});d._attrName=u.toLowerCase(),s.__effects.push(d)}if(kr(t),Lr(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const e=t.onStateUpdate,f=t.stateDeps;let l=!1,u=[];const d=v(()=>{const h=[];for(let y=0;y<f.length;y++){const A=f[y];try{h[y]=typeof A=="function"?A(t,t.state,t.context):t.state?.[A]}catch{h[y]=void 0}}if(!l){l=!0,u=h;return}let _=h.length!==u.length;for(let y=0;!_&&y<h.length;y++)h[y]!==u[y]&&(_=!0);const p=u;u=h,_&&Q(t,()=>{try{e(t,t.state,t.context,{prev:p,next:h})}catch(y){if(Ht(t,"onStateUpdate",y),t.context?.strictMode)throw y}})},{depth:s.path.length,label:C(s,"onStateUpdate")});s.__effects.push(d)}Pr(t)}function _s(t){const o=t.parent,s=o?.node;if(!s||!t.node){mt(t,t.parent);return}let n=null;const r=Object.keys(o),c=r.indexOf(t.key);for(let a=c+1;a<r.length;a++){const i=o[r[a]];if(i?.node?.parentNode===s){n=i.node;break}}n?s.insertBefore(t.node,n):s.appendChild(t.node),eo()}function gs(t){xs(t),Ir(t),Fs(t),Zr(t),Yr(t)}function bs(t,o,s){let n=O(t,t.ifDeps,s);const r=v(()=>{const c=!o.__ifInitialized&&o.__ifLateMerge;if(c){const e=t.context?.components||{};c.names.some(f=>e[f]||e["smbls."+f])&&(o.__ifLateMerge=null,zn(t,c),n=O(t,t.ifDeps,typeof t.if=="function"?t.if:s))}let a;try{a=n(t,t.state,t.context)}catch(e){if(a=!1,o.__ifError=e,typeof console<"u"&&console.warn){const f=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${f} \u2014 treating as false:`,e?.message||e)}return}const i=o.__if;if(o.__if=!!a,i&&!o.__if&&t.node){t.node.remove();try{typeof t.onRemove=="function"&&t.onRemove(t)}catch(e){console.error("[smbls] onRemove error:",e)}}else if(!i&&o.__if)if(o.__ifInitialized)t.node||(t.node=ro(t)),t.node&&(t.node.ref=t),_s(t),xs(t),Fs(t),N("Render",t,{}),uo(t,{});else{o.__ifInitialized=!0,o.__ifLateMerge=null,t.tag||(t.tag=$o(t)),N("Init",t,{});const e=M.hydration;if(t.node||(t.node=e!==null&&e.adopt(t)||ro(t)),!t.node)return;if(t.parent?.__ref?.__children&&!t.parent.__ref.__children.includes(t.key)&&t.parent.__ref.__children.push(t.key),t.parent?.__ref?.__ifParked&&t.parent.__ref.__ifParked.delete(t.key),t.tag==="fragment"&&!o.__fragmentAnchor){const l=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(l),o.__fragmentAnchor=l}N("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),Xs(t,{}),ys(t,{skipIfEffect:!0}),gs(t),on(t,{}),_s(t),N("Create",t,{}),N("Complete",t,{}),N("Render",t,{}),N("RenderRouter",t,{}),uo(t,{})}},{depth:o.path.length,label:C(o,"if")});o.__effects.push(r)}function zt(t,o){const s=t.node;if(!s)return;const n=o==null||typeof o=="object"?"":String(o);if(t.tag==="string"){s.nodeValue!==n&&(s.nodeValue=n);return}const r=t.__ref;let c=r?r.__textNode:null;if(c&&c.parentNode!==s&&(c=null),!c){const a=s.firstChild;a&&a.nodeType===3&&(c=a)}c?c.nodeValue!==n&&(c.nodeValue=n):s.firstChild?(c=(s.ownerDocument||t.context?.document||globalThis.document).createTextNode(n),s.insertBefore(c,s.firstChild)):(s.textContent=n,c=s.firstChild&&s.firstChild.nodeType===3?s.firstChild:null),r&&(r.__textNode=c||null)}function pr(t,o){return o!=="checked"||!t||t.tagName!=="INPUT"?null:t.hasAttribute("checked")}function hr(t,o){if(o===null)return;const s=t.hasAttribute("checked");s!==o&&t.checked!==s&&(t.checked=s)}function qt(t,o,s,n){s==null||s===!1&&!Bt(o)?Yt(t,o,null):typeof s=="function"||typeof s=="object"||(n&&o==="src"&&"src"in t?t.src=s:Yt(t,o,J(o,s)))}function Yt(t,o,s){const n=pr(t,o);s==null?t.removeAttribute(o):t.setAttribute(o,s),hr(t,n)}function As(t,o){const s=t.node;if(!s||!("value"in s))return;const n=o==null?"":String(o);if(s.value===n)return;const r=typeof document<"u"&&document.activeElement===s,c=r&&typeof s.selectionStart=="number"?s.selectionStart:null,a=r&&typeof s.selectionEnd=="number"?s.selectionEnd:null;if(s.value=n,r&&c!=null&&a!=null)try{s.setSelectionRange(c,a)}catch{}const i=t.__ref&&t.__ref.__autoGrow;i&&i.active&&i.resize()}function xs(t){const{node:o}=t;if(o){if((typeof t.text=="string"&&!t.text.includes("{{")||typeof t.text=="number")&&zt(t,t.text),Ks(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 n in t.style)if(typeof t.style[n]=="function"){s={};for(const r in t.style)typeof t.style[r]!="function"&&(s[r]=t.style[r]);break}ot(o,Xt(t,s))}if(t.attr&&typeof t.attr=="object")for(const s in t.attr){const n=t.attr[s];typeof n=="function"||typeof n=="object"||n!=null&&(typeof n=="string"&&n.includes("{{")||n===!1&&!Bt(s)||o.setAttribute&&o.setAttribute(s,J(s,n)))}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 n=t.data[s];typeof n=="function"||typeof n=="object"||n==null||n===!1||typeof n=="string"&&n.includes("{{")||o.dataset&&(o.dataset[s]=n===!0?"":n)}if(t.classlist||t.class){const s=t.classlist||t.class;if(typeof s=="string")s.split(" ").forEach(n=>n&&o.classList.add(n));else if(typeof s=="object")for(const n in s){const r=typeof s[n]=="function"?s[n](t,t.state,t.context):s[n];r&&o.classList.add(typeof r=="string"?r:n)}}}}function ht(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function yr(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 Pt(t,o){if(!t||!t.style||!o)return null;const s=t.style,n=[];for(const r in o){if(o[r]==null||r.charAt(0)==="&")continue;const a=Y(r);n.push(a,Ao(s,a),ws(s,a))}return n}function Ao(t,o){return typeof t.getPropertyValue=="function"?t.getPropertyValue(o):""}function ws(t,o){return typeof t.getPropertyPriority=="function"?t.getPropertyPriority(o):""}function Y(t){return Ko(t)}function xo(t,o,s){if(!t||!t.style||!o||!o.length)return;const n=t.style,r=new Set;if(s&&typeof s=="object")for(const c in s)s[c]==null||c.charAt(0)==="&"||r.add(Y(c));for(let c=0;c<o.length;c+=3){const a=o[c];r.has(a)||Ao(n,a)===o[c+1]&&typeof n.removeProperty=="function"&&n.removeProperty(a)}}function Et(t,o){if(!o||!t||!t.style)return!1;const s=t.style;for(let n=0;n<o.length;n+=3)if(Ao(s,o[n])!==o[n+1]||ws(s,o[n])!==o[n+2])return!1;return!0}const Tt=t=>t.charCodeAt(0)===45&&t.charCodeAt(1)===45,Ss=t=>typeof t=="number"||t===!0||typeof t=="string"&&t!=="",Zt=t=>Tt(t)?t:"--"+t;function Qt(t,o){if(!st(t))return null;let s=null;for(const n of Object.keys(t)){if(!n)continue;let r=t[n];if(typeof r=="function"){if(!o)continue;r=r(o,o.state,o.context)}Ss(r)&&(s||(s={}),s[Zt(n)]=r)}return s}function ks(t,o,s,n,r){Cs(t,r,O(t,n,s),c=>Ss(c)?{[o]:c}:null)}function Cs(t,o,s,n,r){const c=t.__ref;let a,i=null;const e=v(()=>{Q(t,()=>{try{const f=n(s(t,t.state,t.context)),l=t.node;if(!l||!l.style)return;const u=ht(f);(u===null||u!==a||!Et(l,i))&&(a=u,xo(l,i,f),f&&ot(l,f),i=f?Pt(l,f):null,r&&r(f))}catch(f){F(c,o,f)}})},{depth:c.path.length,label:C(c,o)});c.__effects.push(e)}function _r(t){const o=t.__ref,s=t.vars;if(typeof s=="function"){gr(t,s),o.__exec.vars=s;return}if(st(s))for(const n of Object.keys(s)){const r=s[n];!n||typeof r!="function"||ks(t,Zt(n),r,lt(t.varsDeps,n),"vars."+n)}}function gr(t,o){const s=t.__ref;Cs(t,"vars",O(t,t.varsDeps,o),n=>Qt(n),n=>{s.__varsInline=n?new Set(Object.keys(n)):null})}function wo(t,o){if(typeof t[o]=="function"&&(et(t.tag||"div",o)||o.charCodeAt(0)===45))return!0;if(!Tt(o))return!1;const s=t.vars;if(typeof s=="function"){const n=t.__ref&&t.__ref.__varsInline;return!!(n&&n.has(o))}if(!st(s))return!1;for(const n of Object.keys(s))if(typeof s[n]=="function"&&Zt(n)===o)return!0;return!1}function br(t){let o=null;for(const s in t)t[s]!=null&&s.charAt(0)!=="&"&&(o||(o=new Set),o.add(Y(s)));return o}function Ar(t,o,s,n){const r=t.__ref;if(!r)return;let c=null;if(s)for(const a of s){if(n&&n.has(a))continue;const i=o[a];if(i==null||typeof i=="object")continue;const e=Y(a);Vt[e]&&(c||(c={}),c[e]=i)}r.__declaredLonghands=c}function vs(t,o){const s=t.__ref,n=s&&s.__declaredLonghands;if(!n||!o)return null;let r=null;for(const c in n){if(o.has(c))continue;const a=Vt[c];let i=!1;for(let e=0;e<a.length;e++)if(o.has(a[e])){i=!0;break}i&&(r||(r={}),r[c]=n[c])}return r}function js(t,o){const s=t.node;ot(s,o);const n=br(o);if(!n)return o;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 c=vs(t,n);return c?(ot(s,c),Object.assign({},o,c)):o}function xr(t){const o=t.__ref;if(!o||!o.__inlineCssKeys||!o.__declaredLonghands)return;const s=vs(t,o.__inlineCssKeys);s&&ot(t.node,s)}function Xt(t,o){return!o||typeof o!="object"?o:Q(t,()=>{try{return En(o,t)}catch{return o}})}function ot(t,o){if(!t||!o||!t.style)return;let s=null;for(const n in o){const r=o[n];if(r!=null){if(n.charAt(0)==="&"&&typeof r=="object"){s||(s={}),s[n]=r;continue}try{const c=String(r);if(typeof r=="object"&&c==="[object Object]")continue;const a=Ko(n),i=c.trim(),e=/\s*!important\s*$/.test(i),f=i.replace(/\s*!important\s*$/,"");t.style.setProperty(a,f,e?"important":"")}catch{}}}s&&wr(t,s)}function wr(t,o){const s=`_ds${zo.scopedStyleId++}`;t.classList.add(s);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 c="";for(const a in o){const i="."+s,e=a.replace(/&/g,i).split(",").map(l=>{const u=l.trim();return u.includes(i)?u:i+u}).join(", "),f=o[a];if(typeof f=="object"){let l="",u="";for(const d in f){const h=f[d];if(typeof h=="object"){const _=d.includes("&")?e.split(", ").map(y=>d.replace(/&/g,y)).join(", "):e.split(", ").map(y=>`${y} ${d}`).join(", ");let p="";for(const y in h)p+=`${Y(y)}: ${h[y]};`;u+=Bo(`${_} { ${p} }`,_)+`
|
|
5
|
-
`}else l+=`${Y(d)}: ${h};`}l&&(c+=
|
|
6
|
-
`),u&&(c+=u)}}c&&(r.textContent+=c)}const Ps=new Set;function Es(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 Sr(t,o,s){const n=Es(s);queueMicrotask(()=>{if(!t.__ref)return;let r;try{r=o(t,t.state,t.context)}catch{return}if(Es(r)===n)return;const c=t.__ref.path?t.__ref.path.join("."):t.key||"?";Ps.has(c)||(Ps.add(c),console.warn(`[smbls] subscribeTo function at "${c}" 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 core.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 kr(t){const o=t.subscribeTo,s=typeof o=="function";let n=o;if(s)try{n=o(t,t.state,t.context)}catch{n=null}if(s&&rt()&&Sr(t,o,Array.isArray(n)?n:[]),!Array.isArray(n)||n.length===0)return;const r=t.__ref;for(let c=0;c<n.length;c++){const a=n[c];if(typeof a!="string"||a.length===0)continue;const i=a.split("."),e=i[0],f=i.slice(1),l={value:!1},u=v(()=>{const d=t.state&&(K(t.state)?t.state.root:null);if(!d||!K(d))return;let h=d;h=h[e];for(let p=0;p<f.length&&!(h==null||typeof h!="object");p++)if(K(h))h=h[f[p]];else break;if(!l.value)return;let _=!1;if(typeof t.onBeforeUpdate=="function"&&Q(t,()=>{try{if(te(r)){const p=t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0});p&&typeof p.then=="function"?p.then(()=>to(r,!1),y=>{to(r,!0),gt("error",t,{hook:"onBeforeUpdate",error:y})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",y)}):(to(r,!1),p===!1&&(_=!0))}}catch(p){to(r,!0),gt("error",t,{hook:"onBeforeUpdate",error:p})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",p)}}),!_&&t.node&&r.__effects)for(let p=0;p<r.__effects.length;p++){const y=r.__effects[p];y&&y!==u&&!y._disposed&&!y._isSubscribeToEffect&&typeof y._execute=="function"&&y._execute()}!_&&typeof t.onUpdate=="function"&&Q(t,()=>{try{t.onUpdate(t,t.state,t.context)}catch(p){gt("error",t,{hook:"onUpdate",error:p})||console.error("[DOMQL] subscribeTo onUpdate error:",p)}})},{depth:r.path.length,label:C(r,"subscribeTo("+a+")")});l.value=!0,u._isSubscribeToEffect=!0,r.__effects.push(u)}}function So(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 ko(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 Ts=new Set;function Cr(t,o){const s=o?.__ref?.path?o.__ref.path.join("."):o?.key||"?",n=s+"::"+t;Ts.has(n)||(Ts.add(n),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.`))}const Os=new Map;function vr(t){let o=Os.get(t);if(o)return o;o=[];const s=n=>{if(n)for(const r of n)o.push(Go(r))};return s(Vt[t]),s(Dn[t]),Os.set(t,o),o}function Rs(t,o,s){if(wo(t,o)||s&&s.has(o))return!0;const n=vr(Y(o));for(let r=0;r<n.length;r++){const c=n[r];if(wo(t,c)||s&&s.has(c))return!0}return!1}function yt(t,o,s,n){const r={},c=new Set,a=(i,e,f)=>{const l=f?new Set(Object.keys(r)):null;if(U[i]){const u=U[i](e,o,o.state,o.context);if(u){const d=Array.isArray(u)?u:[u];for(const h of d)h&&Object.assign(r,h)}}else r[i]=e;if(f)for(const u in r)l.has(u)||c.add(u)};for(const i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;let e=t[i];if(typeof e=="function"&&(e=e(o,o.state,o.context)),!(e==null||typeof e=="function")){if(typeof e=="object"&&!Array.isArray(e)){if(i==="style"){for(const u in e){let d=e[u];typeof d=="function"&&(d=d(o,o.state,o.context)),!(d==null||typeof d=="function")&&a(u,d,Rs(o,u,n))}continue}if(i==="vars"){const u=Qt(e,o);if(u)for(const d in u)a(d,u[d],wo(o,d)||!!(n&&n.has(d)));continue}if(So(i,o)){const u=yt(e,o,!1,n);Object.keys(u).length&&(r[`[data-theme="${i.slice(1)}"] &`]=u);continue}if(/^[A-Z][A-Za-z0-9]*$/.test(i)){rt()&&Cr(i,o);continue}const f=ko(i,o),l=yt(e,o,!1,n);Object.keys(l).length&&(r[f]=l);continue}a(i,e,Rs(o,i,n))}}if(s)for(const i in r)c.add(i);for(const i of c){const e=r[i];typeof e=="string"&&!e.includes("!important")&&(r[i]=e+" !important")}return r}const st=t=>!!t&&typeof t=="object"&&!Array.isArray(t);function Ds(t,o){for(const s in o){const n=o[s];t[s]=st(n)?Ds(st(t[s])?t[s]:{},n):n}return t}function jr(t,o){if(!st(o))return;let s;for(const n of t.split(" ")){const r=n?o[n]:null;st(r)&&(s=Ds(s||{},r))}return s}function Co(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)&&Co(t[s],o+1))return!0}return!1}function Ls(t,o,s){if(!o||typeof o!="object"||Array.isArray(o))return null;if(So(t,s)){const c=yt(o,s,!1);return Object.keys(c).length?{cssProp:`[data-theme="${t.slice(1)}"] &`,block:c}:null}const n=ko(t,s),r=yt(o,s,!1);return Object.keys(r).length?{cssProp:n,block:r}:null}function Pr(t){const o=t.__ref;for(const s of Object.keys(t)){if(!Jo(s))continue;const n=t[s];if(!n||typeof n!="object"||Array.isArray(n)||!Co(n))continue;let r=null,c;const a=v(()=>{if(!t.node)return;const i=t.context?.designSystem;i&&z(i);let e,f=!1;try{const l=Ls(s,n,t),u=l?ht(l.block)+"::"+l.cssProp:null;if(u!==null&&u===c)f=!0;else if(c=u,l){const d=bt({[l.cssProp]:l.block},null,t.context?.cssPrefix);e=d?d.split(" ").filter(Boolean):null}else e=null}finally{i&&q()}if(!(f||!t.node.classList)){if(r)for(const l of r)t.node.classList.remove(l);if(e&&e.length)for(const l of e)t.node.classList.add(l);r=e}},{depth:o.path.length,label:C(o,"cssBlock("+s+")")});o.__effects.push(a)}}const Er=()=>!0,Tr=(t,o)=>{const s=t.charAt(0);return(s===":"||s==="@"||s==="&"||s==="[")&&o&&typeof o=="object"&&!Array.isArray(o)?!0:!!U[t]||!!(V&&V.has(t))||Tt(t)||t==="vars"};function Or(t,o,s){const n={};let r=!1;for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&(i!=="data"&&i!=="aria"&&(Tr(i,s[i])||B.has(i))?n[i]=!0:r=!0);if(!r)return null;const c=On({[o]:s},t.tag||"div",n,Er);let a=null;for(const i in c)/^on/i.test(i)||(a||(a={}),a[i]=c[i]);return a}function Ns(t,o,s,n,r,c){const a=t.node;let i=null;const e=f=>{(i||(i=[])).push(f)};for(const f in n){const l=o.owners.get(f),u=l===s;if(!c&&l!==void 0&&!u)continue;let d;try{d=n[f](t)}catch(_){F(t.__ref,"conditional("+s+")."+f,_),u&&e(f);continue}if(typeof d=="string"&&d.includes("{{")&&(d=$.call(t,d,t.state)),u&&a.getAttribute(f)!==o.written.get(f)){e(f);continue}if(d==null||typeof d=="object"||typeof d=="function"){u&&Ms(a,o,f);continue}const h=d===!1&&!Bt(f)?null:String(J(f,d));e(f),!(u&&h===o.written.get(f))&&(l===void 0&&o.base.set(f,a.getAttribute(f)),Yt(a,f,h),o.owners.set(f,s),o.written.set(f,h))}r.appliedAttrs=i}function Ms(t,o,s){t.getAttribute(s)===o.written.get(s)&&Yt(t,s,o.base.get(s)),o.owners.delete(s),o.base.delete(s),o.written.delete(s)}function Rr(t,o,s,n){const r=n.appliedAttrs;if(n.appliedAttrs=null,!!r)for(const c of r)o.owners.get(c)===s&&Ms(t.node,o,c)}function Fs(t){const o=t.__ref&&t.__ref.__conditionalAttrs,s=t.node;if(!(!o||!o.owners.size||!s||!s.getAttribute))for(const n of o.owners.keys()){const r=o.written.get(n),c=s.getAttribute(n);c!==r&&(o.base.set(n,c),r==null?s.removeAttribute(n):s.setAttribute(n,r))}}let vo;const Dr=()=>vo===void 0?vo=rt():vo;function Is(t,o){const s=un.countUntrackedReads;typeof s=="function"?t.untrackedReads+=s(o):o()}function Lr(t){const o=t.__ref;o.__conditionalRunners=[];let s=null;const n=new Map;for(const r of Object.keys(t)){const c=r.charAt(0);if(c!=="."&&c!=="!")continue;const a=r.slice(1);if(!a)continue;if(/[:@\s>~+[\]]/.test(a)){if(typeof console<"u"&&console.warn){const y=a.split(/[:@\s>~+[\]]/)[0];console.warn(`[smbls] conditional \`${r}\` on ${t.key||"?"} will never match \u2014 the whole string after \`${c}\` is read as one prop name. Nest the selector inside instead: \`${c}${y}: { '${a.slice(y.length)}': {...} }\`.`)}continue}const i=t[r];if(!i||typeof i!="object")continue;const e=c==="!",f={lastMatch:!1,appliedKeys:null,appliedClasses:null,appliedAttrs:null,probe:!1,untrackedReads:0},l=Or(t,r,i);l&&!s&&(s=o.__conditionalAttrs={owners:new Map,base:new Map,written:new Map});const u=new Set;for(const y in i){if(!Object.prototype.hasOwnProperty.call(i,y))continue;const A=y.charAt(0),S=i[y];if(!((A===":"||A==="@"||A==="&"||A==="[")&&S&&typeof S=="object"&&!Array.isArray(S))){if(y==="vars"&&st(S)){for(const w of Object.keys(S))w&&u.add(Zt(w));continue}u.add(y)}}const d=()=>{let y;const A=f.probe;let S;if(A?Is(f,()=>{S=t[a]}):S=t[a],S===void 0){const g=!!t.state&&a in t.state,x=t.state?t.state[a]:void 0;if(g||x!==void 0)y=x;else{const k=t.context?.cases?.[a];if(k===void 0)return;try{y=typeof k=="function"?k.call(t,t):k}catch(j){y=!1,o.__conditionalError=j,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${r}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,j?.message||j)}}}else if(typeof S=="function")try{A?Is(f,()=>{y=S(t,t.state,t.context)}):y=S(t,t.state,t.context)}catch(g){y=!1,o.__conditionalError=g,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${r}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,g?.message||g)}else y=S;A&&(f.probe=!1);const w=e?!y:!!y;if(!t.node)return;const b=t.context?.designSystem;if(w===f.lastMatch){if(w&&l&&t.node.setAttribute){b&&z(b);try{Ns(t,s,r,l,f,!1)}finally{b&&q()}}return}f.lastMatch=w,b&&z(b);try{if(w){const g={},x={};let k=!1;for(const E in i){if(!Object.prototype.hasOwnProperty.call(i,E))continue;const P=i[E],R=E.charAt(0);if((R===":"||R==="@"||R==="&"||R==="[")&&P&&typeof P=="object"&&!Array.isArray(P)){if(So(E,t)){const I=yt(P,t,!1,u);Object.keys(I).length&&(x[`[data-theme="${E.slice(1)}"] &`]=I,k=!0)}else{const I=ko(E,t),ct=yt(P,t,!1,u);Object.keys(ct).length&&(x[I]=ct,k=!0)}continue}const Z=typeof P=="function"?P(t,t.state,t.context):P;if(Z!=null){if(U[E]){const I=U[E](Z,t,t.state,t.context);if(I){const ct=Array.isArray(I)?I:[I];for(const Lt of ct)Lt&&Object.assign(g,Lt)}}else if(V&&V.has(E))g[E]=Z;else if(Tt(E))g[E]=Z;else if(E==="vars"){const I=Qt(Z,t);I&&Object.assign(g,I)}}}const j=Object.keys(g);if(j.length){ot(t.node,g);for(const E of j)n.set(E,r);f.appliedKeys=j}else f.appliedKeys=null;if(k){const E=bt(x,null,t.context?.cssPrefix,{state:!0}),P=E?E.split(" ").filter(Boolean):[];if(P.length&&t.node.classList){for(const R of P)t.node.classList.add(R);f.appliedClasses=P}else f.appliedClasses=null}else if(f.appliedClasses){for(const E of f.appliedClasses)t.node.classList.remove(E);f.appliedClasses=null}l&&t.node.setAttribute&&Ns(t,s,r,l,f,!0)}else{if(f.appliedAttrs&&Rr(t,s,r,f),f.appliedKeys){for(const g of f.appliedKeys)n.get(g)===r&&(Tt(g)?t.node.style.removeProperty(g):t.node.style[g]="",n.delete(g));f.appliedKeys=null}if(f.appliedClasses){for(const g of f.appliedClasses)t.node.classList.remove(g);f.appliedClasses=null}}}finally{b&&q()}};o.__conditionalRunners.push(d);const h=t[a+"Deps"],_=O(t,h,d);Dr()&&typeof(o.__exec&&o.__exec[a]||t[a])=="function"&&!(Array.isArray(h)&&h.length===0)&&(f.probe=!0);const p=v(_,{depth:o.path.length,label:C(o,"conditional("+r+")")});f.probe&&(f.probe=!1),f.untrackedReads>0&&p._sources.size===0&&console.warn(`[smbls] conditional \`${r}\` on ${t.key||"?"} subscribed to nothing \u2014 its predicate read state on its first run without subscribing to it (\`in\`, Object.keys, a \`__\` key, parse()), so no state write will ever re-evaluate it (only a direct element.update() on this element re-runs it). Declare \`${a}Deps: [...]\` (state-key strings or \`(el, s) => \u2026\` selectors) so the subscription is armed unconditionally, or \`${a}Deps: []\` when it is static on purpose.`),o.__effects.push(p)}}const jo=new WeakSet,Po=new WeakMap;function Nr(t){const o=Po.get(t);if(o==="painted")return!1;if(o===void 0){Po.set(t,"open");const s=t.defaultView,n=()=>{Po.set(t,"painted")};s&&typeof s.requestAnimationFrame=="function"?s.requestAnimationFrame(n):setTimeout(n,0)}return!0}function Mr(t){const o=t.ownerDocument;!o||jo.has(o)||Nr(o)||(jo.add(o),queueMicrotask(()=>{jo.delete(o);const s=o.body||o.documentElement;s&&s.offsetWidth}))}const Eo=new WeakSet;let $s=!1;function Us(t){return t.startsWith("[data-theme=")||t.startsWith("@media")&&t.includes("prefers-color-scheme")}function To(t,o){const s={...t};for(const n in o){const r=o[n],c=s[n];s[n]=r&&typeof r=="object"&&c&&typeof c=="object"?To(c,r):r}return s}function Hs(t,o){const s={};for(const n in t){const r=t[n];if(r&&typeof r=="object"){const c=Hs(r,o);Object.keys(c).length&&(s[n]=c)}else o(n)||(s[n]=r)}return s}function Bs(t,o,s){const n=Oo(t);if(!n)return!1;for(let r=0;r<n.length;r+=3){const c=n[r+1];if(!s.has(c))continue;const a=o[c];if(!(a==null||typeof a=="object")&&Ln(n[r],a,n[r+2]))return!0}return!1}function Fr(t,o,s){let n=1/0,r=-1/0;for(const a of o.values())a<n&&(n=a),a>r&&(r=a);if(s)for(const a of s.values())a>r&&(r=a);if(r<=n)return null;let c=null;for(const[a,i]of o){if(i===r)continue;const e=Oo(a);if(e)for(let f=0;f<e.length;f+=3){const l=e[f],u=e[f+1],d=e[f+2],h=t[u]!=null?o.get(u):void 0,_=s&&s.get(l),p=h!==void 0&&h>i&&Vo(l,t[u],d),y=!p&&_!==void 0&&_>i&&Vo(l,void 0,d);if(p||y){p&&delete t[a],c||(c=new Set),c.add(a);break}}}return c}const Vs=new Map;function Oo(t){let o=Vs.get(t);if(o!==void 0)return o;const s=Y(t),n=Vt[s];if(o=null,Array.isArray(n)){o=[];for(const r of n)o.push(r,Go(r),s)}return Vs.set(t,o),o}function Ks(t){const{node:o}=t;if(!o)return;if($s||($s=!0,bt({display:"none"})),Eo.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}Eo.add(t);const s=t.context?.designSystem;s&&z(s),Uo();try{const n={};let r=!1,c=[],a=null,i=null,e=null,f=null;const l=t.__ref&&t.__ref.__mergeLayer;let u,d=null,h=null;const _=(b,g)=>{if(g&&typeof g=="object"&&Us(b)){e||(e={});const x=e[b];x&&(g=To(x,g)),e[b]=g}else(g===null||typeof g!="object")&&(f||(f=new Set),f.add(b),u!==void 0&&(d||(d=new Map),d.set(b,u)));n[b]=g};if(Object.prototype.hasOwnProperty.call(t,"theme")&&typeof t.theme!="function"&&U.theme){const b=U.theme(t.theme,t,t.state,t.context);if(b){const g=x=>{for(const k in x){const j=x[k];j&&typeof j=="object"?Us(k)&&(a||(a={}),a[k]=j):Oo(k)&&(i||(i=[])).push(k),n[k]=j}};if(Array.isArray(b))for(const x of b)x&&g(x);else g(b);r=!0}}const p=(b,g)=>{if(b==="vars"){const x=Qt(g);if(x){for(const k in x)_(k,x[k]);r=!0}return}if(U[b]){const x=U[b](g,t,t.state,t.context);if(x){if(Array.isArray(x)){for(const k of x)if(k)for(const j in k)_(j,k[j])}else for(const k in x)_(k,x[k]);r=!0}}else if(V&&V.has(b))g!=null&&typeof g!="object"&&(_(b,g),r=!0);else if(b.charCodeAt(0)===45)g!=null&&typeof g!="object"&&(_(b,g),r=!0);else if((b.charAt(0)==="&"||b.charAt(0)==="@"||b.charAt(0)===":"||b.charAt(0)==="[")&&g&&typeof g=="object"&&!Array.isArray(g)){if(Co(g))return;const x=Ls(b,g,t);x&&(_(x.cssProp,x.block),r=!0)}};if(typeof t.class=="string"){const b=jr(t.class,t.context?.designSystem?.class);if(b)for(const g in b)p(g,b[g])}const y=f?new Set(f):null,A=t.tag||"div";for(const b of Object.keys(t)){if(typeof t[b]=="function"){const x=l&&l.get(b);x!==void 0&&et(A,b)&&(h||(h=new Map),h.set(Y(b),x));continue}if(u=l?l.get(b):void 0,b==="vars"){p(b,t[b]);continue}if(B.has(b)||b==="theme")continue;const g=b.charCodeAt(0);g>=65&&g<=90||W(b)||Wo(A,b)||p(b,t[b])}u=void 0;const S=d?Fr(n,d,h):null;if(i&&f)for(const b of i)f.has(b)||!(b in n)||Bs(b,n,f)&&delete n[b];if(a){const b=f?g=>f.has(g)||Bs(g,n,f):null;for(const g in a){let x=b?Hs(a[g],b):a[g];e&&e[g]&&(x=To(x,e[g])),Object.keys(x).length?n[g]=x:delete n[g]}}if(Ar(t,n,f,S?new Set([...y||[],...S]):y),r){n.display&&String(n.display).includes("!important")&&(o.style.setProperty("display",String(n.display).replace(/\s*!important\s*$/,""),"important"),delete n.display);const b=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;typeof b=="string"&&b!==""&&n.display&&n.display!==b&&(n.display=b);const g=bt(n,null,t.context?.cssPrefix);if(c=g?g.split(" ").filter(Boolean):[],g&&o.classList){const x=c;let k=!1;for(const j of x)o.classList.add(j),k||(j.charCodeAt(0)===95&&j.charCodeAt(1)===99||j.charCodeAt(0)===95&&j.indexOf("_c",1)!==-1)&&(k=!0);k&&Mr(o)}}const w=t.__ref;if(w){const b=w.__staticCssClasses;if(b&&o.classList){const g=new Set(c);for(const x of b)g.has(x)||o.classList.remove(x)}w.__staticCssClasses=c}xr(t)}finally{Ho(),s&&q(),Eo.delete(t)}}const Le=t=>!!U[t]||!!(V&&V.has(t))||typeof t=="string"&&t.charCodeAt(0)===45;function Ne(t){t&&t.node&&Ks(t)}function Ir(t){const{node:o}=t;if(!o||!o.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const r in t.aria){const c=t.aria[r];if(typeof c=="function"||typeof c=="object"||c==null||typeof c=="string"&&c.includes("{{"))continue;const a="aria-"+r.replace(/[A-Z]/g,i=>"-"+i.toLowerCase());o.setAttribute(a,J(a,c))}const s=Tn(t);for(const r in s){const c=s[r];c!=null&&c!==!1&&typeof c!="function"&&typeof c!="object"&&o.setAttribute(r,c===!0?"":c)}const n=t.tag||"div";for(const r of Object.keys(t)){if(typeof t[r]=="function"||B.has(r)||r==="on"||s[r]!==void 0)continue;const c=r.charCodeAt(0);if(!(c>=65&&c<=90)&&!W(r)&&!et(n,r)&&At(n,r)){let a=t[r];if(a==null)continue;if(typeof a=="string"&&a.includes("{{")){if(!io[r])continue;a=$.call(t,a,t.state)}if(a==null||typeof a=="function"||typeof a=="object"||a===!1&&!Bt(xt(r)||r))continue;const i=xt(r)||r;o.setAttribute(i,J(i,a))}}}function Me(t,o){const{node:s}=t;if(!s||!s.setAttribute)return;const n=o.charCodeAt(0);if(n>=65&&n<=90||W(o))return;const r=t.tag||"div";if(et(r,o)||!At(r,o))return;const c=xt(o)||o,a=c.toLowerCase(),i=t.__ref&&t.__ref.__effects;let e=!1;if(i)for(let u=0;u<i.length;u++){const d=i[u];d&&d._attrName===a&&!d._disposed&&typeof d._execute=="function"&&(e=!0,d._execute())}if(e)return;let f=t[o];const l=io[o];if(l&&f!=null){const u=l(t);u!==void 0&&(f=u)}typeof f=="string"&&f.includes("{{")&&(f=$.call(t,f,t.state)),qt(s,c,f)}function $r(t,o){const s=t.node,n=t.__ref;let r=n.__autoGrow;if(!o){if(r&&r.active){try{s.removeEventListener("input",r.resize)}catch{}Ws(r),m.delete(t),s.style.height="",r.appliedMax!=null&&s.style.maxHeight===r.appliedMax&&(s.style.maxHeight=""),Ys(s,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(!s.isConnected){Ot(t,!0);return}if(!(s.scrollHeight>0)){r.awaitingLayout=!0,Gs(t,r);return}r.awaitingLayout=!1;const a=Br(s),i=Vr(a),e=s.style.height;s.style.height="0px",i&&Do(s);const f=s.scrollHeight;if(!(f>0)){s.style.height=e,i&&Do(s);return}const l=Kr(s,a),u=l!=null&&f<l?l:f,d=zr(a),h=d!=null&&u>d;s.style.height=Wr(h?d:u,a)+"px",i&&Do(s),Ys(s,r,h),r.lastMeasure=f,r.lastWidth=s.clientWidth,Gs(t,r)}},n.__eventCleanup||(n.__eventCleanup=[]),n.__eventCleanup.push(()=>{try{s.removeEventListener("input",r.resize)}catch{}Ws(r),m.delete(t)})),r.active||(s.addEventListener("input",r.resize),r.active=!0,Hr(t,r));const c=typeof o=="object"&&o.max!=null?String(o.max):null;c!==r.appliedMax&&(c==null?r.appliedMax!=null&&s.style.maxHeight===r.appliedMax&&(s.style.maxHeight=""):s.style.maxHeight=c,r.appliedMax=c),r.resize()}function Ot(t,o){const s=t.__ref?.__autoGrow;s&&(o&&(s.attachAttempts=0,s.firstAttemptAt=null),m.add(t),St())}function Ur(){const t=Array.from(m);m.clear();for(let o=0;o<t.length;o++){const s=t[o],n=s.node,r=s.__ref?.__autoGrow;if(!(!n||!r||!r.active)){if(!n.isConnected){r.firstAttemptAt==null&&(r.firstAttemptAt=dt()),r.attachAttempts+=1,r.attachAttempts<=Zo&&dt()-r.firstAttemptAt<Qo&&(m.add(s),St());continue}r.attachAttempts=0,r.firstAttemptAt=null,r.resize()}}}function Gs(t,o){if(o.watch)return;const s=t.node;if(!s)return;const n=s.ownerDocument&&s.ownerDocument.defaultView,r=n&&n.ResizeObserver||(typeof ResizeObserver=="function"?ResizeObserver:null);if(typeof r!="function")return;const c=()=>{if(!o.active||!s.isConnected||!(s.scrollHeight>0))return;if(o.awaitingLayout){o.awaitingLayout=!1,Ot(t,!0);return}const i=s.clientWidth;o.lastWidth!=null&&Math.abs(i-o.lastWidth)<.5||(o.lastWidth=i,Ot(t,!0))};let a;try{a=new r(c),a.observe(s)}catch{return}o.watch=a}function Ws(t){const o=t.watch;if(o){t.watch=null;try{o.disconnect()}catch{}}}function Hr(t,o){if(o.fontsHooked)return;o.fontsHooked=!0;const s=t.node&&t.node.ownerDocument,n=s&&s.fonts&&s.fonts.ready;!n||typeof n.then!="function"||n.then(()=>{o.active&&t.node&&Ot(t,!0)},()=>{})}function Br(t){const o=t.ownerDocument&&t.ownerDocument.defaultView;try{return o&&o.getComputedStyle?o.getComputedStyle(t):null}catch{return null}}const it=t=>typeof t=="string"&&/^\s*-?\d*\.?\d+px\s*$/.test(t)?parseFloat(t):null,Ro=t=>(it(t.paddingTop)||0)+(it(t.paddingBottom)||0),zs=t=>(it(t.borderTopWidth)||0)+(it(t.borderBottomWidth)||0);function Vr(t){if(!t)return!1;const o=String(t.transitionProperty||"").split(","),s=String(t.transitionDuration||"0s").split(",");for(let n=0;n<o.length;n++){const r=o[n].trim();if(!(r!=="all"&&r!=="height")&&parseFloat(s[n%s.length])>0)return!0}return!1}function Do(t){if(typeof t.getAnimations!="function")return;let o;try{o=t.getAnimations()}catch{return}for(let s=0;s<o.length;s++){const n=o[s];if(n&&n.transitionProperty==="height")try{n.cancel()}catch{}}}function Kr(t,o){if(!o||!t.hasAttribute||!t.hasAttribute("rows"))return null;const s=parseInt(t.getAttribute("rows"),10);if(!(s>0))return null;const n=it(o.lineHeight)||Gr(t,o);return n>0?s*n+Ro(o):null}const Rt=["fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontFamily","lineHeight","letterSpacing"],qs=new WeakMap;function Gr(t,o){const s=t.ownerDocument,n=s&&(s.body||s.documentElement);if(!n||!s.createElement)return null;let r=qs.get(s);r||(r=new Map,qs.set(s,r));const c=Rt.map(f=>o[f]||"").join("|");if(r.has(c))return r.get(c);const a=s.createElement("textarea");a.rows=1,a.setAttribute("aria-hidden","true"),a.tabIndex=-1;const i=a.style;i.position="absolute",i.visibility="hidden",i.top="0",i.left="-9999px",i.height="auto",i.minHeight="0",i.maxHeight="none",i.padding="0",i.border="0",i.boxSizing="content-box",i.overflow="hidden";for(let f=0;f<Rt.length;f++)o[Rt[f]]&&(i[Rt[f]]=o[Rt[f]]);let e=0;try{n.appendChild(a),e=a.clientHeight}catch{e=0}finally{a.parentNode&&a.parentNode.removeChild(a)}return e>0?(r.set(c,e),e):null}function Wr(t,o){return o?o.boxSizing==="border-box"?t+zs(o):o.boxSizing==="content-box"?Math.max(0,t-Ro(o)):t:t}function zr(t){if(!t)return null;const o=it(t.maxHeight);if(o==null||!(o>0))return null;const s=Ro(t),n=zs(t),r=t.boxSizing==="border-box"?o-n:o+s,c=it(t.lineHeight);if(!(c>0))return r;const a=Math.floor((r-s)/c+1e-6);return a>=1?a*c+s:r}function Ys(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 Zs=["srcObject","muted"],qr=(t,o)=>t==="muted"?o===!0||o===""||o==="true"||o==="muted":o??null;function Yr(t){const o=t.node,s=t.__ref;if(!(!o||!s))for(let n=0;n<Zs.length;n++){const r=Zs[n],c=t[r];if(c===void 0||!(r in o))continue;const a=i=>{const e=qr(r,i);if(o[r]!==e)try{o[r]=e}catch(f){F(s,r,f)}};if(typeof c=="function"){const i=O(t,t[r+"Deps"],c),e=v(()=>{try{a(i(t,t.state,t.context))}catch(f){F(s,r,f)}},{depth:s.path.length,label:C(s,r)});s.__effects.push(e),s.__exec[r]=c}else a(c);r==="srcObject"&&(s.__releaseMedia=()=>{try{o.srcObject!=null&&(o.srcObject=null)}catch{}})}}function Zr(t){if(!t.autoGrow)return;const o=t.node;if(!o||o.tagName!=="TEXTAREA")return;const s=t.__ref,n=t.autoGrow,r=typeof n=="function"?O(t,t.autoGrowDeps,n):null,c=v(()=>{const a=t.autoGrow;let i=a;if(typeof a=="function")try{i=(a===n&&r?r:a)(t,t.state,t.context)}catch{i=null}$r(t,i)},{depth:s.path.length,label:C(s,"autoGrow")});s.__effects||(s.__effects=[]),s.__effects.push(c),r&&(s.__exec.autoGrow=n)}const Qs=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function Xs(t,o){let s=!1;for(const n of Object.keys(t)){if(!W(n)||Qs.has(n))continue;if(n==="onInView"||n==="onLeaveView"){s=!0;continue}const r=yn(n);if(r){hn(r,t,t[n]);continue}let c=t[n],a=null;if(c&&typeof c=="object"&&!Array.isArray(c)&&(a=c,c=a.handler),c=gn(t,c),typeof c!="function")continue;const i=_n(n);ln.has(i)||pn(Un(i),t,c,a)}Qr(t),s&&M.viewEvents&&M.viewEvents(t)}function Qr(t){const o=t.node;if(!o||!o.addEventListener)return;const s={};let n=!1;for(const d of Qs){const h=t[d];typeof h=="function"&&(s[d]=h,n=!0)}if(!n)return;const r=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,c=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let a=0,i=0,e=0,f=!1;const l=d=>{const h=d.touches&&d.touches[0]||d.changedTouches&&d.changedTouches[0];h&&(a=h.clientX,i=h.clientY,e=Date.now(),f=!0)},u=d=>{if(!f)return;f=!1;const h=d.changedTouches&&d.changedTouches[0]||d.touches&&d.touches[0];if(!h)return;const _=h.clientX-a,p=h.clientY-i,y=Date.now()-e;if(y>c)return;const A=Math.abs(_),S=Math.abs(p);if(Math.max(A,S)<r)return;let w;if(A>S*1.2)w=_<0?"left":"right";else if(S>A*1.2)w=p<0?"up":"down";else return;const b="onSwipe"+w.charAt(0).toUpperCase()+w.slice(1),g=s[b],x=s.onSwipe;g&&g.call(t,d,t,t.state,t.context),x&&x.call(t,{direction:w,dx:_,dy:p,dt:y,event:d},t,t.state,t.context)};o.addEventListener("touchstart",l,{passive:!0}),o.addEventListener("touchend",u,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{o.removeEventListener("touchstart",l)}catch{}try{o.removeEventListener("touchend",u)}catch{}})}function Xr(t,o,s,n,r,c,a,i){let e=o;(typeof e=="string"||typeof e=="number")&&(e={text:e});let f=n;if(typeof n=="function")try{f=n(t,e)}catch{f=null}let l=typeof n=="function"?Ct(f):r;if(i&&!a&&(l=vt(l,Ct(o))),a){let u=o;(typeof o=="string"||typeof o=="number")&&(u={value:o,text:o}),e=f?{...f,state:u}:{state:u}}else f&&(e=X(f,e));return e=Dt(e,c),{def:e,key:mo(e?.key,o,s,t),supplied:l,props:f}}function Dt(t,o){if(!o||!t||t.ignoreChildExtends)return t;if(!t.extends)return{...t,extends:o};const s=Array.isArray(t.extends)?t.extends:[t.extends],n=Array.isArray(o)?o:[o];return{...t,extends:[...n,...s]}}const Lo=t=>{const o=t&&t.__ref;if(!o||o.__if===!1)return null;const s=t.node;return s&&s.nodeType!==11?s:null},Js=(t,o)=>o?o.nextSibling:dn(t.node,t.__ref.__textNode),ms=(t,o,s)=>{const n=Js(t,s);return o!==n&&t.node.insertBefore(o,n),o},Jr=(t,o)=>{const s=Js(t,o);return s?{position:"before",node:s}:void 0};function mr(t,o,s){let n=null;for(let r=0;r<o.length;r++){if(s&&s.has(o[r]))continue;const c=Lo(t[o[r]]);c&&(n=ms(t,c,n))}}function tn(t,o,s,n){const r=M.rows,c=r!==null&&t.childrenAs!=="state"&&t.tag!=="fragment"?r.track(t):null,a=No(t,o,s,n,!0,c);return t.__ref.__plainRows=c&&(a||o==null||o===!1)?c:null,a}function No(t,o,s,n,r,c){if(!o||!t.node)return;const a=t.childExtends,i=pt(t,"childProps"),e=t.__ref,f=M.mount,l=n>0&&t.tag!=="fragment"&&e?n:0;if(Array.isArray(o)){const u=t.childProps,d=t.childrenAs==="state",h=(_,p)=>{const y=Xr(t,o[_],_,u,i,a,d,r);c&&c.add(y.key,o[_],y,u,a);try{const A=tt(jt(y.def,y.supplied),t,y.key,s,p);return!A&&c&&c.none(y.key),Wt(t,A),A}catch(A){if(c&&c.failed(y.key),typeof console<"u"&&console.error){const S=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${y.key}" failed to construct at ${S} (initial render, skipping this row):`,A?.message||A)}return null}};if(!l){for(let _=0;_<o.length&&!(e&&e.__disposed);_++)h(_);return!0}return f.rows(t,o.length,h,l),!0}if(typeof o=="string"){const u=rs(o,t);if(Array.isArray(u))return No(t,u,s,n,!0,c)}if(typeof o=="object"){const u=(h,_)=>{if(B.has(h))return!1;let p=o[h];if(p==null||p===!1)return!1;const y=r?vt(i,Ct(p)):i;(typeof p=="string"||typeof p=="number")&&(p={text:p}),t.childProps&&(p=X(t.childProps,p)),p=Dt(p,a);const A=tt(jt(p,y),t,Gt(t,h),s,_);return Wt(t,A),A};if(!l){for(const h in o)u(h);return}const d=[];for(const h in o)d.push(h);f.rows(t,d.length,(h,_)=>u(d[h],_),l)}}function Jt(t,o){const s=t.node;if(!s||s.tagName!=="SELECT")return;const n=s.options;if(!n||!n.length)return;const r=t.__ref,c=r&&r.__exec&&r.__exec.value,a=typeof c=="function",i=t.value!=null&&typeof t.value!="function";if(a||i){let l;if(a)try{l=c(t,t.state,t.context)}catch{return}else l=t.value,typeof l=="string"&&l.includes("{{")&&(l=$.call(t,l,t.state));const u=l==null?"":String(l);s.value!==u&&(s.value=u);return}const e=o||!(r&&r.__selectSynced);if(r&&(r.__selectSynced=!0),!e)return;let f=-1;for(let l=0;l<n.length;l++)n[l].defaultSelected&&(f=l);f>=0&&s.selectedIndex!==f&&(s.selectedIndex=f)}function on(t,o){let{children:s,content:n}=t;const r=t.childExtends,c=typeof s=="function",a=c||ls(t,"children");if(typeof s=="function"){const u=s,d=t.__ref;let h=!1,_;const p=O(t,t.childrenDeps,u),y=v(()=>{const A=h;h=!0;let S;try{S=p(t,t.state,t.context)}catch(P){if(typeof console<"u"&&console.error){const R=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${R}${A?"":" (initial run, treating as empty)"}:`,P?.message||P)}return}if(!A){_=S;return}if(S===t.children)return;ps(t,S),t.children=S,d.__mount&&d.__mount.chunkGen++;const w=typeof t.onContentUpdate=="function",b=w?[]:null,g=w?[]:null,x=w?[]:null;if(Array.isArray(S)&&t.childrenAs==="state"){const P=t.childProps,R=[],Z=new Map;for(let T=0;T<S.length;T++){const G=S[T];let D=P;if(typeof P=="function")try{D=P(t,G)}catch{D=null}const nt=mo(D&&D.key,G,T,t);R.push(nt),Z.set(nt,{rawChild:G,childProps:D})}const I=new Set(R),ct=is(d,d.__children.slice());for(const T of ct)if(!I.has(T)){const G=t[T];G?.remove&&G.remove(),delete t[T],g&&g.push(T)}const Lt=t.childExtends,Nt=!(t.tag==="fragment")&&!!t.node;let Mt=null;const _t=new Set;for(const T of R){const G=Z.get(T),D=G.rawChild,nt=t[T];if(nt&&nt.state){if(D&&typeof D=="object"){const L=nt.state,Ft=L.$replace||L.replace,Io=L.$update||L.update;try{if(typeof Ft=="function")Ft.call(L,D);else if(typeof Io=="function"){for(const H in L)if(!(H==="__element"||H==="root"||H==="parent"||H==="update")&&!Object.prototype.hasOwnProperty.call(D,H))try{L[H]=void 0}catch{}Io.call(L,D)}else for(const H in D)L[H]=D[H]}catch(H){if(typeof console<"u"&&console.error){const cn=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${T}" failed to patch at ${cn} (reconcile, keeping its previous data for this pass):`,H?.message||H)}}}if(x&&x.push(T),Nt){const L=Lo(nt);L&&(Mt=ms(t,L,Mt))}continue}let oo=D;(typeof D=="string"||typeof D=="number")&&(oo={value:D,text:D});const so=G.childProps,rn=Dt(so?{...so,state:oo}:{state:oo},Lt),en=typeof P=="function"?Ct(so):pt(t,"childProps");let Fo;try{Fo=tt(jt(rn,en),t,T,o,Nt?Jr(t,Mt):void 0)}catch(L){if(typeof console<"u"&&console.error){const Ft=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${T}" failed to construct at ${Ft} (reconcile, skipping this row):`,L?.message||L)}_t.add(T);continue}if(d.__disposed)return;if(Nt){const L=Lo(Fo);L&&(Mt=L)}b&&b.push(T)}Nt&&mr(t,R,_t.size?_t:null),d.__children=_t.size?R.filter(T=>!_t.has(T)):R,w&&(b.length||g.length)&&Xo(t,{added:b,removed:g,kept:x}),Jt(t,!1);return}if(t.childrenAs!=="state"&&d.__plainRows&&M.rows.reconcile(t,d,S,o,w)){Jt(t,!1);return}const E=w?[...d.__children]:null;for(const P of is(d,[...d.__children])){const R=t[P];R?.remove&&R.remove(),delete t[P]}d.__children=[],tn(t,S,o,0),Jt(t,!1),w&&Xo(t,{added:[...d.__children],removed:E,kept:[]})},{depth:d.path.length,label:C(d,"children")});d.__effects.push(y),s=_,ps(t,s),t.children=s}const i=M.mount,e=i!==null?i.budgetOf(t,o):0,f=$t(t.__ref),l=c?tn(t,s,o,e):No(t,s,o,e,a);if(e&&$t(t.__ref)>f){i.defer(t,e,()=>sn(t,o,s,n,r,l,e));return}sn(t,o,s,n,r,l,e)}function sn(t,o,s,n,r,c,a){const i=$t(t.__ref);if(n!=null&&!(n&&n.__ref)){let e=n;typeof e=="string"||typeof e=="number"?e={text:e}:typeof e!="object"&&(e={}),t.childProps&&(e=X(t.childProps,e)),e=Dt(e,r);const f=vt(pt(t,"childProps"),pt(t,"content"));Wt(t,tt(jt(e,f),t,"content",o))}if(!(s&&!c)){if(a&&$t(t.__ref)>i){M.mount.defer(t,a,()=>nn(t,o,r,a));return}nn(t,o,r,a)}}function nn(t,o,s,n){const r=t.context?.components||{},c=t.__ref&&t.__ref.__runtimeSource,a=c?{}:null;{const f=Object.keys(t);for(let l=0;l<f.length;l++){const u=f[l];if(!u.endsWith("Extends")||typeof t[u]!="string")continue;const d=u.slice(0,-7);if(!d||d.charCodeAt(0)<65||d.charCodeAt(0)>90)continue;const h={extends:t[u]};delete t[u];for(let _=l+1;_<f.length;_++){const p=f[_],y=p.charCodeAt(0);if(y>=65&&y<=90||B.has(p)||typeof t[p]=="function"&&(p.startsWith("on")||p.startsWith(".")))break;const A=t[p];A!==void 0&&(h[p]=A,delete t[p],a&&kt(c,p)&&(a[d]||(a[d]={}),a[d][p]=c[p]))}t[d]&&typeof t[d]=="object"?t[d]={...h,...t[d]}:t[d]=h}}const i=Object.keys(t),e=f=>{if(B.has(f)||typeof t[f]!="object"||t[f]===null)return!1;const l=f.charCodeAt(0);if(l<65||l>90)return!1;let u=t[f];if(u.__ref)return!1;if(!u.extends&&!u.extend){const h=r[f]||r[`smbls.${f}`];h&&(u={...u,extends:h})}t.childProps&&(u=X(t.childProps,u)),u=Dt(u,s);const d=c?vt(pt(t,"childProps"),vt(a[f]||null,pt(t,f))):null;Wt(t,tt(jt(u,d),t,f,o))};if(!n){for(const f of i)e(f);return}M.mount.run(t,i.length,f=>e(i[f]),n)}function mt(t,o,s){const{node:n}=t;if(!n)return;n.ref=t;const r=o?.tag==="fragment"?o.__ref?.__fragmentAnchor:null;if(r){const i=r.parentNode;if(i){if(s?.position==="before"&&s.node)i.insertBefore(n,s.node);else if(s?.position==="after"&&s.node){const e=s.node.nextSibling;i.insertBefore(n,e||r)}else i.insertBefore(n,r);eo();return}}const c=o?.node||(o?.nodeType?o:null);if(!c)return;if(!s&&M.hydration!==null){const i=t.context&&t.context.__hydration;if(i&&M.hydration.place(i,t,o,c,n))return}const a=s?.node;if(a&&a.parentNode!==c)c.appendChild(n);else if(s?.position==="before"&&a)c.insertBefore(n,a);else if(s?.position==="after"&&s.node){const i=s.node.nextSibling;i?c.insertBefore(n,i):c.appendChild(n)}else c.appendChild(n);eo()}const Mo=3;function te(t){return!t||t.__inBeforeUpdate||(t.__beforeUpdateFailCount||0)>=Mo?!1:(t.__inBeforeUpdate=!0,!0)}function to(t,o){t&&(t.__inBeforeUpdate=!1,o?(t.__beforeUpdateFailCount=(t.__beforeUpdateFailCount||0)+1,t.__beforeUpdateFailCount===Mo&&typeof console<"u"&&console.error&&console.error(`[DOMQL] onBeforeUpdate failed ${Mo}x in a row on this element \u2014 pausing automatic retries until a future prop/state change re-arms it.`)):t.__beforeUpdateFailCount=0)}function N(t,o,s){const n=t.charAt(0).toLowerCase()+t.slice(1);gt(n,o,s);const r="on"+t,c=o[r];if(typeof c=="function"){const e=t==="Render"?"__inRender":t==="RenderRouter"?"__inRenderRouter":null;if(e){if(o.__ref[e])return!0;o.__ref[e]=!0}const f=o.context?.designSystem;f&&z(f);let l=!!e;try{const u=c(o,o.state,o.context,s);if(u&&typeof u.then=="function"){const d=o.__ref;return u.catch(h=>{Ht(o,r,h)}).finally(()=>{e&&d&&(d[e]=!1)}),l=!1,!0}if(u===!1)return!1}catch(u){if(Ht(o,r,u),o.context?.strictMode)throw u}finally{f&&q(),l&&o.__ref&&(o.__ref[e]=!1)}}return!0}var Fe=tt;export{Mo as BEFORE_UPDATE_MAX_CONSECUTIVE_FAILURES,te as acquireBeforeUpdateGuard,Xr as arrayRowDefinition,De as attachElement,Kn as completeCreate,tt as create,Fe as default,ao as flushMounts,Re as holdMountFlush,Le as isStaticCssProp,jt as markRuntimeSupplied,ms as placeAfter,mr as placeRows,Lo as placedRowNode,Ne as recompileStaticCss,Me as reconcileAttrProp,to as releaseBeforeUpdateGuard,Vn as reportCreateChildrenError,Xt as resolveStyleBlock,Jr as rowAttach,pt as runtimeViewOf,Jt as syncSelectValue,Xo as triggerContentUpdate,qt as writeAttr,zt as writeElementText};
|
|
4
|
+
`):"")}}function Gs(t,o){if(typeof t.html=="function"&&t.node&&!t.node.innerHTML&&Q(t,()=>{try{const n=t.html(t,t.state,t.context);n!=null&&typeof n!="function"&&(t.node.innerHTML=n)}catch{}}),N("Create",t,o),N("Complete",t,o),N("Render",t,o),N("RenderRouter",t,o),lo(t,o),typeof t.onFrame=="function"){const n=t.onFrame,s=t.context?.designSystem,r=()=>{if(t.node){if(t.node.isConnected){s&&z(s);try{n(t,t.state,t.context)}catch(c){console.error("[DOMQL] onFrame error:",c)}finally{s&&q()}}requestAnimationFrame(r)}};requestAnimationFrame(r)}}function zt(t,o){const n=o&&o.__ref&&o.__ref.__mount;!n||!n.tail||n.holder||(n.holder=t,M.mount.hold(t))}const Ws=new Set(["childProps","attr","style","scope","data","vars"]);function nn(t,o,n,s,r,c){if(n&&!o.extends&&!o.extend){const p=n.indexOf("_"),y=n.indexOf(".");let A=p>0?p:-1;if(y>0&&(A<0||y<A)&&(A=y),A>0){const S=n.substring(0,A),w=t.context?.components;w&&(w[S]||w["smbls."+S])?o={...o,extends:S}:w&&rt()&&(/^[A-Z]\w*_\d+$/.test(n)||/^[A-Z]\w*\.\w+$/.test(n))&&console.warn(`[smbls] auto-extend: key "${n}" looks like an instance of "${S}" but neither "${S}" nor "smbls.${S}" is registered in context.components \u2014 element will render as a plain <div>. Register the base component or rename the key.`)}}t.__ref&&(t.__ref.__mergeLayer=null),As(t,o,c);const a=xs(t),i=t.props&&typeof t.props=="object"?t.props:null;for(const p in o)if(!(p==="parent"||p==="node"||p==="__ref"||p==="extends"||p==="context"||p==="props")){if(p==="key"){s&&(t.key=r?Wt(r,s):s);continue}a&&a.mark(p),po(t,p,o[p])}if(i)for(const p in i)po(t,p,i[p]);const e=o.props;if(e&&typeof e=="object"){for(const p in e)po(t,p,e[p]);if(a)for(const p in e)a.mark(p)}ws(t),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 f=t.scope&&typeof t.scope=="object"?t.scope:null,l=r?.scope,u=t.context&&typeof t.context.globalScope=="object"&&t.context.globalScope||null,d=l||u||null;if(o.scope!==void 0||f){const p={};f&&Object.assign(p,f),o.scope!==void 0&&Object.assign(p,o.scope),t.scope=as(p,d)}else d&&(t.scope=d);o.if!==void 0&&(t.if=o.if);const h=t.__ref,_=dr(t,h&&h.__runtimeSource);return h&&(h.__declaredArrays=_||void 0),ks(t),Zs(t,r,o,c),o}function po(t,o,n){const s=t[o],r=M.chains;if(r!==null&&r(t,o,s,n))return;const c=s&&n&&typeof s=="object"&&typeof n=="object"&&!Array.isArray(s)&&!Array.isArray(n);c&&o.charCodeAt(0)>=65&&o.charCodeAt(0)<=90?t[o]=X(s,n):c&&Ws.has(o)?t[o]={...s,...n}:c&&mo(o)?t[o]=X(s,n):t[o]=n}const zs=new Set(["key","parent","context","__ref"]);function qs(t,o){for(const s of Object.keys(t))zs.has(s)||delete t[s];let n=o.definition;if(!n.extends&&!n.extend&&typeof o.key=="string"){const s=t.context?.components||{},r=s[o.key]||s["smbls."+o.key];r&&(n={...n,extends:r})}$t(()=>nn(t,n,o.key,o.ownKey,t.parent,o.options))}function Ys(t,o,n){const s=n||{},r=i=>!!(s[i]||s["smbls."+i]),c=[],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 i of a){if(typeof i!="string")continue;const e=i.includes(">")?i.split(">")[0].trim():i;r(e)||c.push(e)}return c}if(typeof o=="string"&&/^[A-Z]/.test(o)){let i=-1;const e=o.indexOf("_"),f=o.indexOf(".");e>0&&(i=e),f>0&&(i<0||f<i)&&(i=f);const l=i>0?o.substring(0,i):o;r(l)||c.push(l)}return c}function ho(t,o,n){if(typeof t.onStateInit!="function"&&!Ps(t,"stateInit"))return;const s=t.state;t.state=o;try{N("StateInit",t,n)}finally{t.state=s}}const yo=t=>({isDataOnlyKey:o=>js(t).has(o)});function Zs(t,o,n,s){const r=!o,c=n.state&&typeof n.state=="object"&&!Array.isArray(n.state)&&Object.keys(n.state).length===0,a=r&&c&&t.context?.state,i=n.state!==void 0&&!a?n.state:t.state&&!K(t.state)?t.state:void 0;if(i==null){if(o?.state)t.state=o.state,ft(t,t.state);else if(t.context?.state){const e=t.context.state,f={...e},l=t.context?.polyglot;if(l?.translations){const u=t.context,d=e.lang||l.defaultLang||"en",h=new Set,_=(A,S)=>{h.has(A)||Cs(u,A,f)&&(f[A]=S,h.add(A),vs(u,A,S))},p=l.translations[d];if(p&&typeof p=="object")for(const A in p)_(A,p[A]);const y=new Set(l.languages||[]);for(const A in l.translations)y.has(A)||_(A,l.translations[A])}K(f)||ho(t,f,s),t.state=K(f)?f:ro(f,yo(t.context)),t.state.__element=t,t.state.root=t.state,ft(t,t.state),Ut.promoteActiveRootState?.(e,t.state),N("StateCreated",t,s)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),ft(t,t.state);return}if(typeof i=="string"){if(t.state=en(i,o),t.state&&typeof t.state=="object"&&!K(t.state)){const e=o?.state?.root||o?.state||t.state;Object.defineProperty(t.state,"root",{value:e,enumerable:!1,configurable:!0,writable:!0})}ft(t,t.state),Xs(t,i,o),N("StateCreated",t,s);return}if(typeof i=="function"){const e=i(t,o?.state);if(K(e))t.state=e;else{const f=e||{};ho(t,f,s),t.state=ro(f,o?.state?void 0:yo(t.context))}}else if(K(i))t.state=i;else{const e={...i};ho(t,e,s),t.state=ro(e,o?.state?void 0:yo(t.context))}t.state.__element=t,o?.state?(t.state.parent=o.state,t.state.root=o.state.root||o.state):t.state.root=t.state,ft(t,t.state),Ut.promoteActiveRootState?.(i,t.state),N("StateCreated",t,s)}function sn(t,o){if(!o)return t;const n=o.split("/");let s=t;for(const r of n){if(s==null)return{};s=s[r]}return s??{}}function rn(t,o){const n=o.state;return t.startsWith("~/")?[n&&(n.root||n),t.slice(2)]:t.startsWith("../")?[n,t.slice(3)]:[n,t]}function en(t,o){if(!o)return{};if(t===".")return o.state||{};if(t.startsWith("../")||t.startsWith("~/")){const[r,c]=rn(t,o);return c?sn(r,c):r??{}}if(o.state?.[t]!==void 0)return o.state[t];const n=sn(o.state,t);if(n!=null&&Object.keys(n).length>0)return n;const s=o.context?.polyglot;if(s?.translations){const r=o.state?.root?.lang||s.defaultLang||"en",c=s.translations[r];if(c?.[t]!==void 0)return c[t];if(s.translations[t]!==void 0)return s.translations[t]}return{}}function Qs(t,o){const[n,s]=rn(t,o);if(!s||!n||typeof n!="object")return;const r=n[s];if(r!==void 0||s.indexOf("/")===-1)return r;let c=n;for(const a of s.split("/")){if(c==null||typeof c!="object")return;c=c[a]}return c}function Xs(t,o,n){const s=t.__ref;if(!s||!n||o==="."||!K(n.state))return;s.__stateBinding&&s.__stateBinding.dispose();const r=$t(()=>v(()=>{const c=Qs(o,n);!c||typeof c!="object"||c===t.state||$t(()=>cn(t,t.state,c,!0))},{depth:s.path?s.path.length:0,label:C(s,"state")}));r._isStateBinding=!0,s.__stateBinding=r,s.__effects&&s.__effects.push(r)}function cn(t,o,n,s){const r=t.__ref;if(!r)return;if(s||t.state===o){t.state=n,s&&ft(t,n),an(r);const a=r.__children;if(a)for(let i=0;i<a.length;i++){const e=t[a[i]];e&&e.__ref&&e.parent===t&&cn(e,o,n,!1)}return}if(r.__stateBinding){r.__stateBinding._notify();return}const c=t.state;c&&typeof c=="object"&&c.parent===o&&(c.parent=n,an(r))}function fn(t,o){const n=t.__ifParked;if(!n||!n.size)return o;for(const s of n)o.includes(s)||o.push(s);return o}function an(t){const o=t.__effects;if(o)for(let n=0;n<o.length;n++){const s=o[n];s&&!s._disposed&&!s._isStateBinding&&!s._isSubscribeToEffect&&typeof s._notify=="function"&&s._notify()}}const Js=new Set(["s","state","ctx","context"]),_o=new WeakMap;function ms(t){if(_o.has(t))return _o.get(t);let o=null;try{const n=typeof Ut.getFunctionSource=="function"?Ut.getFunctionSource(t):Function.prototype.toString.call(t);if(typeof n=="string"){const s=n.match(/^\s*(?:async\s+)?([A-Za-z_$][\w$]*)\s*=>/)||n.match(/^[^(]*\(([^)]*)\)/);s&&(o={params:s[1].split(",").map(r=>r.trim())})}}catch{}return _o.set(t,o),o}function tr(t){const o=ms(t);return o?o.params.map(n=>n.split("=")[0].trim()).filter(Boolean):[]}const or=3,nr=/^(is|has)[A-Z0-9_$]/,sr=new Set(["routerOptions"]),un=new WeakSet;function rr(t,o){if(typeof t!="function"||t.length!==2||o&&(nr.test(o)||sr.has(o))||un.has(t))return!1;const n=tr(t);if(n.length<2)return!1;const s=n[1].replace(/[{}[\]]/g,"").trim();return s.length<or||Js.has(s)?!1:(un.add(t),!0)}function er(t){const o=t.__ref,n=t.tag||"div",s=t.context?.designSystem,r=[],c=Object.keys(t);for(let a=0;a<c.length;a++){const i=c[a];if(typeof t[i]!="function"||B.has(i))continue;const e=i.charCodeAt(0);e>=65&&e<=90||W(i)||H[i]||V&&V.has(i)||e!==45&&(xt(n,i)||(rt()&&rr(t[i],i)&&console.warn(`[smbls] custom prop "${i}"${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('${i}', \u2026) instead of reading el.${i}(\u2026) directly (see RULES.md Rule 8).`),r.push({prop:i,fn:t[i]})))}for(let a=0;a<r.length;a++){const{prop:i,fn:e}=r[a];o.__exec[i]=e,Object.defineProperty(t,i,{get(){s&&z(s);try{return e(t,t.state,t.context)}catch{return}finally{s&&q()}},set(f){delete o.__exec[i],Object.defineProperty(t,i,{value:f,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function ir(t,o){if(!(!Array.isArray(o)||o.length===0))for(let n=0;n<o.length;n++){const s=o[n];try{typeof s=="function"?s(t,t.state,t.context):typeof s=="string"&&t.state?.[s]}catch{}}}function O(t,o,n){return!Array.isArray(o)||o.length===0?n:function(...s){return ir(t,o),n.apply(this,s)}}function lt(t,o){if(!(!t||Array.isArray(t)||typeof t!="object"))return t[o]}function C(t,o){return()=>t.path.join(".")+"::"+o}const dn=new Set;function F(t,o,n){if(!rt())return;const s=C(t,o)();dn.has(s)||(dn.add(s),console.warn(`[smbls] "${o}" effect threw on ${t.path.join(".")} \u2014 keeping previous value:`,n?.message||n))}const ln=/(['"`])((?:\\.|(?!\1)[^\\])*)\1/g,pn=new WeakMap,cr=t=>{let o=pn.get(t);if(o!==void 0)return o;o=null;let n;try{n=String(t)}catch{n=""}if(n.includes("{{")){ln.lastIndex=0;let s;for(;(s=ln.exec(n))!==null;)s[2].includes("{{")&&(o||(o=[])).push(s[2])}return pn.set(t,o),o},fr=(t,o)=>{const n=cr(t);if(n)for(let s=0;s<n.length;s++)o.add(n[s])},ar=(t,o)=>!W(t)&&!et(o,t),go=(t,o,n,s,r)=>{if(typeof o=="string"){!r&&o.includes("{{")&&n.add(o);return}typeof o=="function"&&ar(t,s)&&fr(o,n)},bo=new WeakMap,Ct=(t,o)=>Object.prototype.hasOwnProperty.call(t,o),vt=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)?X(t,o):t},jt=(t,o)=>t&&o?X(t,o):t||o||null,hn=(t,o)=>{const n=t.__ref&&t.__ref.__runtimeSource;return!!n&&Ct(n,o)},pt=(t,o)=>hn(t,o)?vt(t.__ref.__runtimeSource[o]):null,Pt=(t,o)=>(o&&t&&typeof t=="object"&&bo.set(t,o),t),ur=t=>{if(!t||typeof t!="object")return;const o=bo.get(t);return o&&bo.delete(t),o},Ao=(t,o,n)=>{if(typeof t=="string"){t.includes("{{")&&o.add(t);return}if(!(!t||typeof t!="object"||n.has(t))){if(n.add(t),Array.isArray(t)){for(let s=0;s<t.length;s++)Ao(t[s],o,n);return}if(!t.__ref)for(const s of Object.keys(t)){if(s==="state")continue;const r=Object.getOwnPropertyDescriptor(t,s);r&&"value"in r&&Ao(r.value,o,n)}}},dr=(t,o)=>{let n=null;for(const s of Object.keys(t)){if(B.has(s)||o&&Ct(o,s))continue;const r=Object.getOwnPropertyDescriptor(t,s),c=r&&r.value;if(!Array.isArray(c))continue;const a=new Set;Ao(c,a,new Set),a.size&&(n||(n=new Map),n.set(c,a))}return n},yn=(t,o)=>{if(Array.isArray(o))for(let n=t;n;n=n.parent){const s=n.__ref&&n.__ref.__declaredArrays,r=s&&s.get(o);if(!r)continue;const c=t.__ref;c.__authoredTemplates||(c.__authoredTemplates=new Set);for(const a of r)c.__authoredTemplates.add(a);return}},_n=["attr","aria","data","metadata"],lr=t=>{if(_n.includes(t))return!0;const o=t.charCodeAt(0);return o===46||o===33||o===64},pr=(t,o)=>{const n=new Set,s=t.tag||"div";for(const r of Object.keys(t)){const c=Object.getOwnPropertyDescriptor(t,r),a=c&&c.value,i=!!o&&Ct(o,r);if(a&&typeof a=="object"&&!Array.isArray(a)){if(!lr(r))continue;const e=i?o[r]:null,f=e&&typeof e=="object"?e:null,l=r.charCodeAt(0)===46||r.charCodeAt(0)===33;for(const u in a){const d=i&&(!f||Ct(f,u)),h=a[u];if(l&&h&&typeof h=="object"&&!Array.isArray(h)&&_n.includes(u)){for(const _ in h)go(_,h[_],n,s,d);continue}go(u,h,n,s,d)}continue}go(r,a,n,s,i)}return n};function gn(t,o){const n=t.__ref,s=!!(o&&o.skipIfEffect),r=pr(t,n.__runtimeSource);if(n.__authoredTemplates)for(const e of r)n.__authoredTemplates.add(e);else n.__authoredTemplates=r;if(er(t),typeof t.text=="function"){const e=t.text,f=O(t,t.textDeps,e),l=v(()=>{if(!n.contentManaged)try{let u=f(t,t.state,t.context);t.node&&u!=null&&typeof u!="function"&&typeof u!="object"&&(typeof u=="string"&&u.includes("{{")&&(u=$.call(t,u,t.state)),qt(t,u))}catch(u){F(n,"text",u)}},{depth:n.path.length,label:C(n,"text")});n.__effects.push(l),n.__exec.text=e}else if(typeof t.text=="string"&&t.text.includes("{{")){const e=t.text,f=v(()=>{if(n.contentManaged)return;const l=$.call(t,e,t.state);l!=null&&(t.text=l),t.node&&qt(t,l??"")},{depth:n.path.length,label:C(n,"text")});n.__effects.push(f),n.__exec.text=e}const c=t.tag||"div";for(const e of Object.keys(t))if(typeof t[e]=="function"&&!B.has(e)&&!W(e)&&!n.__exec[e]&&!zo(c,e)){if(H[e]){const f=t[e],l=O(t,t[e+"Deps"],f),u=e;let d,h=null,_=null,p;const y=v(()=>{const A=t.context?.designSystem;A&&z(A);try{const S=l(t,t.state,t.context);Uo();let w;try{w=H[u](S,t,t.state,t.context)}finally{Bo()}if(Array.isArray(w)){const g={};for(const x of w)if(x)for(const k in x)g[k]=x[k];w=g}const b=u==="show"||u==="hide";if(w&&t.node&&_r(w)){const g=ht(w);if(g===null||g!==p){p=g;const x=At(w,null,t.context?.cssPrefix),k=x?x.split(" ").filter(Boolean):null;if(t.node.classList){if(_)for(const j of _)t.node.classList.remove(j);if(k&&k.length)for(const j of k)t.node.classList.add(j);_=k}}d=void 0,h=null}else if(w&&t.node){if(_){for(const x of _)t.node.classList.remove(x);_=null,p=void 0}const g=ht(w);if(g===null||g!==d||!Tt(t.node,h)){d=g;const x=En(t,w);h=Et(t.node,x)}}else t.node&&b&&(d=void 0,h=null,t.node.style.display="")}finally{A&&q()}},{depth:n.path.length,label:C(n,u)});n.__effects.push(y),n.__exec[e]=f}else if(V&&V.has(e)){const f=t[e],l=O(t,t[e+"Deps"],f),u=e;let d,h=null;const _=v(()=>{const p=t.context?.designSystem;p&&z(p);try{const y=l(t,t.state,t.context);if(t.node)if(y!=null){const A=u+":"+String(y);if(A!==d||!Tt(t.node,h)){d=A;const S={[u]:y},w=En(t,S);h=Et(t.node,w)}}else d=void 0,h=null,t.node.style[u]=""}finally{p&&q()}},{depth:n.path.length,label:C(n,u)});n.__effects.push(_),n.__exec[e]=f}else if(e.charCodeAt(0)===45){const f=t[e];vn(t,e,f,t[e+"Deps"],e),n.__exec[e]=f}}if(gr(t),typeof t.html=="function"){const e=t.html,f=O(t,t.htmlDeps,e),l=v(()=>{Q(t,()=>{const u=f(t,t.state,t.context);t.node&&u!=null&&typeof u!="function"&&(t.node.innerHTML=u)})},{depth:n.path.length,label:C(n,"html")});n.__effects.push(l),n.__exec.html=e}if(typeof t.value=="function"){const e=t.value,f=O(t,t.valueDeps,e),l=v(()=>{try{let u=f(t,t.state,t.context);typeof u=="string"&&u.includes("{{")&&(u=$.call(t,u,t.state)),wn(t,u)}catch(u){F(n,"value",u)}},{depth:n.path.length,label:C(n,"value")});n.__effects.push(l),n.__exec.value=e}else if(typeof t.value=="string"&&t.value.includes("{{")){const e=t.value,f=v(()=>{try{wn(t,$.call(t,e,t.state))}catch(l){F(n,"value",l)}},{depth:n.path.length,label:C(n,"value")});n.__effects.push(f),n.__exec.value=e}if(typeof t.style=="function"){const e=t.style,f=O(t,t.styleDeps,e);let l,u=null,d,h,_,p;const y=v(()=>{const A=f(t,t.state,t.context),S=t.context&&t.context.designSystem;let w;if(A&&typeof A=="object"&&A===d&&S===_){const g=ht(A);w=g!==null&&g===h?p:Jt(t,A),h=g}else w=Jt(t,A),h=void 0;d=A,_=S,p=w;const b=ht(w);(b===null||b!==l||!Tt(t.node,u))&&(l=b,wo(t.node,u,w),ot(t.node,w),u=Et(t.node,w))},{depth:n.path.length,label:C(n,"style")});n.__effects.push(y),n.__exec.style=e}else if(t.style&&typeof t.style=="object")for(const e in t.style){const f=t.style[e];if(typeof f!="function")continue;const l=O(t,lt(t.styleDeps,e),f);let u,d=null;const h=v(()=>{try{const _=l(t,t.state,t.context);if(t.node){const p=e+":"+String(_);if(p!==u||!Tt(t.node,d)){u=p;const y=Jt(t,{[e]:_});wo(t.node,d,Object.assign({},y,{[e]:""})),ot(t.node,y),d=Et(t.node,y)}}}catch(_){F(n,"style."+e,_)}},{depth:n.path.length,label:C(n,"style."+e)});n.__effects.push(h)}if(t.attr&&typeof t.attr=="object"){for(const e in t.attr)if(typeof t.attr[e]=="function"){const f=O(t,lt(t.attrDeps,e),t.attr[e]),l=e,u=v(()=>{try{let d=f(t,t.state,t.context);typeof d=="string"&&d.includes("{{")&&(d=$.call(t,d,t.state)),t.node?.setAttribute&&Yt(t.node,l,d)}catch(d){F(n,"attr."+l,d)}},{depth:n.path.length,label:C(n,"attr."+l)});u._attrName=l.toLowerCase(),n.__effects.push(u)}else if(typeof t.attr[e]=="string"&&t.attr[e].includes("{{")){const f=t.attr[e],l=e,u=v(()=>{try{const d=$.call(t,f,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(l,J(l,d??""))}catch(d){F(n,"attr."+l,d)}},{depth:n.path.length,label:C(n,"attr."+l)});u._attrName=l.toLowerCase(),n.__effects.push(u)}}if(t.aria&&typeof t.aria=="object")for(const e in t.aria){const f=t.aria[e];if(typeof f=="string"&&f.includes("{{")){const h=f,_="aria-"+e.replace(/[A-Z]/g,y=>"-"+y.toLowerCase()),p=v(()=>{try{const y=$.call(t,h,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(_,J(_,y??""))}catch(y){F(n,"aria."+e,y)}},{depth:n.path.length,label:C(n,"aria."+e)});p._attrName=_,n.__effects.push(p);continue}if(typeof f!="function")continue;const l=O(t,lt(t.ariaDeps,e),t.aria[e]),u="aria-"+e.replace(/[A-Z]/g,h=>"-"+h.toLowerCase()),d=v(()=>{try{const h=l(t,t.state,t.context);if(!t.node?.setAttribute)return;Yt(t.node,u,h)}catch(h){F(n,"aria."+e,h)}},{depth:n.path.length,label:C(n,"aria."+e)});d._attrName=u,n.__effects.push(d)}if(t.data&&typeof t.data=="object")for(const e in t.data){const f=t.data[e];if(typeof f=="string"&&f.includes("{{")){const _=f,p="data-"+e.replace(/[A-Z]/g,A=>"-"+A.toLowerCase()),y=v(()=>{try{const A=$.call(t,_,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(p,A??"")}catch(A){F(n,"data."+e,A)}},{depth:n.path.length,label:C(n,"data."+e)});y._attrName=p,n.__effects.push(y);continue}if(typeof f!="function")continue;const l=O(t,lt(t.dataDeps,e),t.data[e]),d="data-"+e.replace(/[A-Z]/g,_=>"-"+_.toLowerCase()),h=v(()=>{try{const _=l(t,t.state,t.context);if(!t.node?.setAttribute)return;_==null||_===!1?t.node.removeAttribute(d):typeof _!="function"&&typeof _!="object"&&t.node.setAttribute(d,_===!0?"":_)}catch(_){F(n,"data."+e,_)}},{depth:n.path.length,label:C(n,"data."+e)});h._attrName=d,n.__effects.push(h)}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 f=O(t,lt(t.classDeps,e),a[e]),l=v(()=>{try{const u=f(t,t.state,t.context);if(!t.node?.classList)return;typeof u=="string"?t.node.classList.add(u):u?t.node.classList.add(e):t.node.classList.remove(e)}catch(u){F(n,"class."+e,u)}},{depth:n.path.length,label:C(n,"class."+e)});n.__effects.push(l)}!s&&typeof t.if=="function"&&xn(t,n,t.if);for(const e of Object.keys(t)){if(B.has(e)||typeof t[e]!="function")continue;const f=e.charCodeAt(0);if(f>=65&&f<=90||W(e))continue;const l=t[e];n.__exec[e]=l;const u=t.tag||"div";if(xt(u,e)&&!et(u,e)){const d=wt(e)||e,h=O(t,t[e+"Deps"],l),_=v(()=>{try{let p=h(t,t.state,t.context);typeof p=="string"&&p.includes("{{")&&(p=$.call(t,p,t.state)),t.node?.setAttribute&&Yt(t.node,d,p,!0)}catch(p){F(n,e,p)}},{depth:n.path.length,label:C(n,e)});_._attrName=d.toLowerCase(),n.__effects.push(_)}}const i=t.tag||"div";for(const e of Object.keys(t)){if(B.has(e))continue;const f=t[e];if(typeof f!="string"||!f.includes("{{"))continue;const l=e.charCodeAt(0);if(l>=65&&l<=90||W(e)||et(i,e)||co[e]||!xt(i,e))continue;const u=wt(e)||e,d=v(()=>{try{const h=$.call(t,f,t.state);if(!t.node||!t.node.setAttribute)return;t.node.setAttribute(u,J(u,h??""))}catch(h){F(n,e,h)}},{depth:n.path.length,label:C(n,e)});d._attrName=u.toLowerCase(),n.__effects.push(d)}if(Cr(t),Nr(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const e=t.onStateUpdate,f=t.stateDeps;let l=!1,u=[];const d=v(()=>{const h=[];for(let y=0;y<f.length;y++){const A=f[y];try{h[y]=typeof A=="function"?A(t,t.state,t.context):t.state?.[A]}catch{h[y]=void 0}}if(!l){l=!0,u=h;return}let _=h.length!==u.length;for(let y=0;!_&&y<h.length;y++)h[y]!==u[y]&&(_=!0);const p=u;u=h,_&&Q(t,()=>{try{e(t,t.state,t.context,{prev:p,next:h})}catch(y){if(Bt(t,"onStateUpdate",y),t.context?.strictMode)throw y}})},{depth:n.path.length,label:C(n,"onStateUpdate")});n.__effects.push(d)}Er(t)}function bn(t){const o=t.parent,n=o?.node;if(!n||!t.node){_t(t,t.parent);return}let s=null;const r=Object.keys(o),c=r.indexOf(t.key);for(let a=c+1;a<r.length;a++){const i=o[r[a]];if(i?.node?.parentNode===n){s=i.node;break}}s?n.insertBefore(t.node,s):n.appendChild(t.node),io()}function An(t){Sn(t),$r(t),$n(t),Qr(t),Zr(t)}function xn(t,o,n){let s=O(t,t.ifDeps,n);const r=v(()=>{const c=!o.__ifInitialized&&o.__ifLateMerge;if(c){const e=t.context?.components||{};c.names.some(f=>e[f]||e["smbls."+f])&&(o.__ifLateMerge=null,qs(t,c),s=O(t,t.ifDeps,typeof t.if=="function"?t.if:n))}let a;try{a=s(t,t.state,t.context)}catch(e){if(a=!1,o.__ifError=e,typeof console<"u"&&console.warn){const f=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${f} \u2014 treating as false:`,e?.message||e)}return}const i=o.__if;if(o.__if=!!a,i&&!o.__if&&t.node){t.node.remove();try{typeof t.onRemove=="function"&&t.onRemove(t)}catch(e){console.error("[smbls] onRemove error:",e)}}else if(!i&&o.__if)if(o.__ifInitialized)t.node||(t.node=eo(t)),t.node&&(t.node.ref=t),bn(t),Sn(t),$n(t),N("Render",t,{}),lo(t,{});else{o.__ifInitialized=!0,o.__ifLateMerge=null,t.tag||(t.tag=$o(t)),N("Init",t,{});const e=M.hydration;if(t.node||(t.node=e!==null&&e.adopt(t)||eo(t)),!t.node)return;if(t.parent?.__ref?.__children&&!t.parent.__ref.__children.includes(t.key)&&t.parent.__ref.__children.push(t.key),t.parent?.__ref?.__ifParked&&t.parent.__ref.__ifParked.delete(t.key),t.tag==="fragment"&&!o.__fragmentAnchor){const l=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(l),o.__fragmentAnchor=l}N("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),mn(t,{}),gn(t,{skipIfEffect:!0}),An(t),ss(t,{}),bn(t),N("Create",t,{}),N("Complete",t,{}),N("Render",t,{}),N("RenderRouter",t,{}),lo(t,{})}},{depth:o.path.length,label:C(o,"if")});o.__effects.push(r)}function qt(t,o){const n=t.node;if(!n)return;const s=o==null||typeof o=="object"?"":String(o);if(t.tag==="string"){n.nodeValue!==s&&(n.nodeValue=s);return}const r=t.__ref;let c=r?r.__textNode:null;if(c&&c.parentNode!==n&&(c=null),!c){const a=n.firstChild;a&&a.nodeType===3&&(c=a)}c?c.nodeValue!==s&&(c.nodeValue=s):n.firstChild?(c=(n.ownerDocument||t.context?.document||globalThis.document).createTextNode(s),n.insertBefore(c,n.firstChild)):(n.textContent=s,c=n.firstChild&&n.firstChild.nodeType===3?n.firstChild:null),r&&(r.__textNode=c||null)}function hr(t,o){return o!=="checked"||!t||t.tagName!=="INPUT"?null:t.hasAttribute("checked")}function yr(t,o){if(o===null)return;const n=t.hasAttribute("checked");n!==o&&t.checked!==n&&(t.checked=n)}function Yt(t,o,n,s){n==null||n===!1&&!Vt(o)?Zt(t,o,null):typeof n=="function"||typeof n=="object"||(s&&o==="src"&&"src"in t?t.src=n:Zt(t,o,J(o,n)))}function Zt(t,o,n){const s=hr(t,o);n==null?t.removeAttribute(o):t.setAttribute(o,n),yr(t,s)}function wn(t,o){const n=t.node;if(!n||!("value"in n))return;const s=o==null?"":String(o);if(n.value===s)return;const r=typeof document<"u"&&document.activeElement===n,c=r&&typeof n.selectionStart=="number"?n.selectionStart:null,a=r&&typeof n.selectionEnd=="number"?n.selectionEnd:null;if(n.value=s,r&&c!=null&&a!=null)try{n.setSelectionRange(c,a)}catch{}const i=t.__ref&&t.__ref.__autoGrow;i&&i.active&&i.resize()}function Sn(t){const{node:o}=t;if(o){if((typeof t.text=="string"&&!t.text.includes("{{")||typeof t.text=="number")&&qt(t,t.text),Wn(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 n=String(t.value);o.value!==n&&(o.value=n)}if(t.style&&typeof t.style=="object"){let n=t.style;for(const s in t.style)if(typeof t.style[s]=="function"){n={};for(const r in t.style)typeof t.style[r]!="function"&&(n[r]=t.style[r]);break}ot(o,Jt(t,n))}if(t.attr&&typeof t.attr=="object")for(const n in t.attr){const s=t.attr[n];typeof s=="function"||typeof s=="object"||s!=null&&(typeof s=="string"&&s.includes("{{")||s===!1&&!Vt(n)||o.setAttribute&&o.setAttribute(n,J(n,s)))}if(typeof t.themeModifier=="string"&&t.themeModifier&&o.setAttribute&&o.setAttribute("data-theme",t.themeModifier),t.data&&typeof t.data=="object")for(const n in t.data){const s=t.data[n];typeof s=="function"||typeof s=="object"||s==null||s===!1||typeof s=="string"&&s.includes("{{")||o.dataset&&(o.dataset[n]=s===!0?"":s)}if(t.classlist||t.class){const n=t.classlist||t.class;if(typeof n=="string")n.split(" ").forEach(s=>s&&o.classList.add(s));else if(typeof n=="object")for(const s in n){const r=typeof n[s]=="function"?n[s](t,t.state,t.context):n[s];r&&o.classList.add(typeof r=="string"?r:s)}}}}function ht(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function _r(t){if(!t||typeof t!="object")return!1;for(const o in t){const n=t[o];if(n&&typeof n=="object"&&!Array.isArray(n))return!0}return!1}function Et(t,o){if(!t||!t.style||!o)return null;const n=t.style,s=[];for(const r in o){if(o[r]==null||r.charAt(0)==="&")continue;const a=Y(r);s.push(a,xo(n,a),kn(n,a))}return s}function xo(t,o){return typeof t.getPropertyValue=="function"?t.getPropertyValue(o):""}function kn(t,o){return typeof t.getPropertyPriority=="function"?t.getPropertyPriority(o):""}function Y(t){return Go(t)}function wo(t,o,n){if(!t||!t.style||!o||!o.length)return;const s=t.style,r=new Set;if(n&&typeof n=="object")for(const c in n)n[c]==null||c.charAt(0)==="&"||r.add(Y(c));for(let c=0;c<o.length;c+=3){const a=o[c];r.has(a)||xo(s,a)===o[c+1]&&typeof s.removeProperty=="function"&&s.removeProperty(a)}}function Tt(t,o){if(!o||!t||!t.style)return!1;const n=t.style;for(let s=0;s<o.length;s+=3)if(xo(n,o[s])!==o[s+1]||kn(n,o[s])!==o[s+2])return!1;return!0}const Ot=t=>t.charCodeAt(0)===45&&t.charCodeAt(1)===45,Cn=t=>typeof t=="number"||t===!0||typeof t=="string"&&t!=="",Qt=t=>Ot(t)?t:"--"+t;function Xt(t,o){if(!nt(t))return null;let n=null;for(const s of Object.keys(t)){if(!s)continue;let r=t[s];if(typeof r=="function"){if(!o)continue;r=r(o,o.state,o.context)}Cn(r)&&(n||(n={}),n[Qt(s)]=r)}return n}function vn(t,o,n,s,r){jn(t,r,O(t,s,n),c=>Cn(c)?{[o]:c}:null)}function jn(t,o,n,s,r){const c=t.__ref;let a,i=null;const e=v(()=>{Q(t,()=>{try{const f=s(n(t,t.state,t.context)),l=t.node;if(!l||!l.style)return;const u=ht(f);(u===null||u!==a||!Tt(l,i))&&(a=u,wo(l,i,f),f&&ot(l,f),i=f?Et(l,f):null,r&&r(f))}catch(f){F(c,o,f)}})},{depth:c.path.length,label:C(c,o)});c.__effects.push(e)}function gr(t){const o=t.__ref,n=t.vars;if(typeof n=="function"){br(t,n),o.__exec.vars=n;return}if(nt(n))for(const s of Object.keys(n)){const r=n[s];!s||typeof r!="function"||vn(t,Qt(s),r,lt(t.varsDeps,s),"vars."+s)}}function br(t,o){const n=t.__ref;jn(t,"vars",O(t,t.varsDeps,o),s=>Xt(s),s=>{n.__varsInline=s?new Set(Object.keys(s)):null})}function So(t,o){if(typeof t[o]=="function"&&(et(t.tag||"div",o)||o.charCodeAt(0)===45))return!0;if(!Ot(o))return!1;const n=t.vars;if(typeof n=="function"){const s=t.__ref&&t.__ref.__varsInline;return!!(s&&s.has(o))}if(!nt(n))return!1;for(const s of Object.keys(n))if(typeof n[s]=="function"&&Qt(s)===o)return!0;return!1}function Ar(t){let o=null;for(const n in t)t[n]!=null&&n.charAt(0)!=="&"&&(o||(o=new Set),o.add(Y(n)));return o}function xr(t,o,n,s){const r=t.__ref;if(!r)return;let c=null;if(n)for(const a of n){if(s&&s.has(a))continue;const i=o[a];if(i==null||typeof i=="object")continue;const e=Y(a);Kt[e]&&(c||(c={}),c[e]=i)}r.__declaredLonghands=c}function Pn(t,o){const n=t.__ref,s=n&&n.__declaredLonghands;if(!s||!o)return null;let r=null;for(const c in s){if(o.has(c))continue;const a=Kt[c];let i=!1;for(let e=0;e<a.length;e++)if(o.has(a[e])){i=!0;break}i&&(r||(r={}),r[c]=s[c])}return r}function En(t,o){const n=t.node;ot(n,o);const s=Ar(o);if(!s)return o;const r=t.__ref;if(r)if(r.__inlineCssKeys)for(const a of s)r.__inlineCssKeys.add(a);else r.__inlineCssKeys=new Set(s);const c=Pn(t,s);return c?(ot(n,c),Object.assign({},o,c)):o}function wr(t){const o=t.__ref;if(!o||!o.__inlineCssKeys||!o.__declaredLonghands)return;const n=Pn(t,o.__inlineCssKeys);n&&ot(t.node,n)}function Jt(t,o){return!o||typeof o!="object"?o:Q(t,()=>{try{return Es(o,t)}catch{return o}})}function ot(t,o){if(!t||!o||!t.style)return;let n=null;for(const s in o){const r=o[s];if(r!=null){if(s.charAt(0)==="&"&&typeof r=="object"){n||(n={}),n[s]=r;continue}try{const c=String(r);if(typeof r=="object"&&c==="[object Object]")continue;const a=Go(s),i=c.trim(),e=/\s*!important\s*$/.test(i),f=i.replace(/\s*!important\s*$/,"");t.style.setProperty(a,f,e?"important":"")}catch{}}}n&&Sr(t,n)}function Sr(t,o){const n=`_ds${qo.scopedStyleId++}`;t.classList.add(n);const s=t.ownerDocument;let r=s.querySelector("style[data-smbls-scoped]");r||(r=s.createElement("style"),r.setAttribute("data-smbls-scoped",""),s.head.appendChild(r));let c="";for(const a in o){const i="."+n,e=a.replace(/&/g,i).split(",").map(l=>{const u=l.trim();return u.includes(i)?u:i+u}).join(", "),f=o[a];if(typeof f=="object"){let l="",u="";for(const d in f){const h=f[d];if(typeof h=="object"){const _=d.includes("&")?e.split(", ").map(y=>d.replace(/&/g,y)).join(", "):e.split(", ").map(y=>`${y} ${d}`).join(", ");let p="";for(const y in h)p+=`${Y(y)}: ${h[y]};`;u+=Vo(`${_} { ${p} }`,_)+`
|
|
5
|
+
`}else l+=`${Y(d)}: ${h};`}l&&(c+=Vo(`${e} { ${l} }`,e)+`
|
|
6
|
+
`),u&&(c+=u)}}c&&(r.textContent+=c)}const Tn=new Set;function On(t){if(!Array.isArray(t))return"";const o=[];for(let n=0;n<t.length;n++)typeof t[n]=="string"&&t[n].length&&o.push(t[n]);return o.sort(),o.join("|")}function kr(t,o,n){const s=On(n);queueMicrotask(()=>{if(!t.__ref)return;let r;try{r=o(t,t.state,t.context)}catch{return}if(On(r)===s)return;const c=t.__ref.path?t.__ref.path.join("."):t.key||"?";Tn.has(c)||(Tn.add(c),console.warn(`[smbls] subscribeTo function at "${c}" resolved to a DIFFERENT key list one microtask after create \u2014 wired [${n.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 core.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 Cr(t){const o=t.subscribeTo,n=typeof o=="function";let s=o;if(n)try{s=o(t,t.state,t.context)}catch{s=null}if(n&&rt()&&kr(t,o,Array.isArray(s)?s:[]),!Array.isArray(s)||s.length===0)return;const r=t.__ref;for(let c=0;c<s.length;c++){const a=s[c];if(typeof a!="string"||a.length===0)continue;const i=a.split("."),e=i[0],f=i.slice(1),l={value:!1},u=v(()=>{const d=t.state&&(K(t.state)?t.state.root:null);if(!d||!K(d))return;let h=d;h=h[e];for(let p=0;p<f.length&&!(h==null||typeof h!="object");p++)if(K(h))h=h[f[p]];else break;if(!l.value)return;let _=!1;if(typeof t.onBeforeUpdate=="function"&&Q(t,()=>{try{if(oe(r)){const p=t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0});p&&typeof p.then=="function"?p.then(()=>oo(r,!1),y=>{oo(r,!0),bt("error",t,{hook:"onBeforeUpdate",error:y})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",y)}):(oo(r,!1),p===!1&&(_=!0))}}catch(p){oo(r,!0),bt("error",t,{hook:"onBeforeUpdate",error:p})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",p)}}),!_&&t.node&&r.__effects)for(let p=0;p<r.__effects.length;p++){const y=r.__effects[p];y&&y!==u&&!y._disposed&&!y._isSubscribeToEffect&&typeof y._execute=="function"&&y._execute()}!_&&typeof t.onUpdate=="function"&&Q(t,()=>{try{t.onUpdate(t,t.state,t.context)}catch(p){bt("error",t,{hook:"onUpdate",error:p})||console.error("[DOMQL] subscribeTo onUpdate error:",p)}})},{depth:r.path.length,label:C(r,"subscribeTo("+a+")")});l.value=!0,u._isSubscribeToEffect=!0,r.__effects.push(u)}}function ko(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 Co(t,o){if(t.charCodeAt(0)!==64||/^@(media|supports|container|keyframes)\b/.test(t))return t;const n=o.context?.designSystem?.media?.[t.slice(1)];return n?/^@(media|supports|container)\b/.test(n)?n:`@media ${n}`:t}const Rn=new Set;function vr(t,o){const n=o?.__ref?.path?o.__ref.path.join("."):o?.key||"?",s=n+"::"+t;Rn.has(s)||(Rn.add(s),console.warn(`[smbls/css] "${t}" at ${n} is a CHILD-COMPONENT key nested inside a pseudo/selector block (":hover", "@dark", etc.) \u2014 that is never a valid CSS selector fragment. The rule is DROPPED (not shipped as a dead/never-matching selector). To reveal a child on a parent state, target the child's OWN class from the parent selector instead, e.g. move the declaration onto the child element itself, or use a sibling-selector combinator in a top-level style block.`))}const Dn=new Map;function jr(t){let o=Dn.get(t);if(o)return o;o=[];const n=s=>{if(s)for(const r of s)o.push(Wo(r))};return n(Kt[t]),n(Ds[t]),Dn.set(t,o),o}function Ln(t,o,n){if(So(t,o)||n&&n.has(o))return!0;const s=jr(Y(o));for(let r=0;r<s.length;r++){const c=s[r];if(So(t,c)||n&&n.has(c))return!0}return!1}function yt(t,o,n,s){const r={},c=new Set,a=(i,e,f)=>{const l=f?new Set(Object.keys(r)):null;if(H[i]){const u=H[i](e,o,o.state,o.context);if(u){const d=Array.isArray(u)?u:[u];for(const h of d)h&&Object.assign(r,h)}}else r[i]=e;if(f)for(const u in r)l.has(u)||c.add(u)};for(const i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;let e=t[i];if(typeof e=="function"&&(e=e(o,o.state,o.context)),!(e==null||typeof e=="function")){if(typeof e=="object"&&!Array.isArray(e)){if(i==="style"){for(const u in e){let d=e[u];typeof d=="function"&&(d=d(o,o.state,o.context)),!(d==null||typeof d=="function")&&a(u,d,Ln(o,u,s))}continue}if(i==="vars"){const u=Xt(e,o);if(u)for(const d in u)a(d,u[d],So(o,d)||!!(s&&s.has(d)));continue}if(ko(i,o)){const u=yt(e,o,!1,s);Object.keys(u).length&&(r[`[data-theme="${i.slice(1)}"] &`]=u);continue}if(/^[A-Z][A-Za-z0-9]*$/.test(i)){rt()&&vr(i,o);continue}const f=Co(i,o),l=yt(e,o,!1,s);Object.keys(l).length&&(r[f]=l);continue}a(i,e,Ln(o,i,s))}}if(n)for(const i in r)c.add(i);for(const i of c){const e=r[i];typeof e=="string"&&!e.includes("!important")&&(r[i]=e+" !important")}return r}const nt=t=>!!t&&typeof t=="object"&&!Array.isArray(t);function Nn(t,o){for(const n in o){const s=o[n];t[n]=nt(s)?Nn(nt(t[n])?t[n]:{},s):s}return t}function Pr(t,o){if(!nt(o))return;let n;for(const s of t.split(" ")){const r=s?o[s]:null;nt(r)&&(n=Nn(n||{},r))}return n}function vo(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 n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&vo(t[n],o+1))return!0}return!1}function Mn(t,o,n){if(!o||typeof o!="object"||Array.isArray(o))return null;if(ko(t,n)){const c=yt(o,n,!1);return Object.keys(c).length?{cssProp:`[data-theme="${t.slice(1)}"] &`,block:c}:null}const s=Co(t,n),r=yt(o,n,!1);return Object.keys(r).length?{cssProp:s,block:r}:null}function Er(t){const o=t.__ref;for(const n of Object.keys(t)){if(!mo(n))continue;const s=t[n];if(!s||typeof s!="object"||Array.isArray(s)||!vo(s))continue;let r=null,c;const a=v(()=>{if(!t.node)return;const i=t.context?.designSystem;i&&z(i);let e,f=!1;try{const l=Mn(n,s,t),u=l?ht(l.block)+"::"+l.cssProp:null;if(u!==null&&u===c)f=!0;else if(c=u,l){const d=At({[l.cssProp]:l.block},null,t.context?.cssPrefix);e=d?d.split(" ").filter(Boolean):null}else e=null}finally{i&&q()}if(!(f||!t.node.classList)){if(r)for(const l of r)t.node.classList.remove(l);if(e&&e.length)for(const l of e)t.node.classList.add(l);r=e}},{depth:o.path.length,label:C(o,"cssBlock("+n+")")});o.__effects.push(a)}}const Tr=()=>!0,Or=(t,o)=>{const n=t.charAt(0);return(n===":"||n==="@"||n==="&"||n==="[")&&o&&typeof o=="object"&&!Array.isArray(o)?!0:!!H[t]||!!(V&&V.has(t))||Ot(t)||t==="vars"};function Rr(t,o,n){const s={};let r=!1;for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&(i!=="data"&&i!=="aria"&&(Or(i,n[i])||B.has(i))?s[i]=!0:r=!0);if(!r)return null;const c=Os({[o]:n},t.tag||"div",s,Tr);let a=null;for(const i in c)/^on/i.test(i)||(a||(a={}),a[i]=c[i]);return a}function Fn(t,o,n,s,r,c){const a=t.node;let i=null;const e=f=>{(i||(i=[])).push(f)};for(const f in s){const l=o.owners.get(f),u=l===n;if(!c&&l!==void 0&&!u)continue;let d;try{d=s[f](t)}catch(_){F(t.__ref,"conditional("+n+")."+f,_),u&&e(f);continue}if(typeof d=="string"&&d.includes("{{")&&(d=$.call(t,d,t.state)),u&&a.getAttribute(f)!==o.written.get(f)){e(f);continue}if(d==null||typeof d=="object"||typeof d=="function"){u&&In(a,o,f);continue}const h=d===!1&&!Vt(f)?null:String(J(f,d));e(f),!(u&&h===o.written.get(f))&&(l===void 0&&o.base.set(f,a.getAttribute(f)),Zt(a,f,h),o.owners.set(f,n),o.written.set(f,h))}r.appliedAttrs=i}function In(t,o,n){t.getAttribute(n)===o.written.get(n)&&Zt(t,n,o.base.get(n)),o.owners.delete(n),o.base.delete(n),o.written.delete(n)}function Dr(t,o,n,s){const r=s.appliedAttrs;if(s.appliedAttrs=null,!!r)for(const c of r)o.owners.get(c)===n&&In(t.node,o,c)}function $n(t){const o=t.__ref&&t.__ref.__conditionalAttrs,n=t.node;if(!(!o||!o.owners.size||!n||!n.getAttribute))for(const s of o.owners.keys()){const r=o.written.get(s),c=n.getAttribute(s);c!==r&&(o.base.set(s,c),r==null?n.removeAttribute(s):n.setAttribute(s,r))}}let jo;const Lr=()=>jo===void 0?jo=rt():jo;function Hn(t,o){const n=ds.countUntrackedReads;typeof n=="function"?t.untrackedReads+=n(o):o()}function Nr(t){const o=t.__ref;o.__conditionalRunners=[];let n=null;const s=new Map;for(const r of Object.keys(t)){const c=r.charAt(0);if(c!=="."&&c!=="!")continue;const a=r.slice(1);if(!a)continue;if(/[:@\s>~+[\]]/.test(a)){if(typeof console<"u"&&console.warn){const y=a.split(/[:@\s>~+[\]]/)[0];console.warn(`[smbls] conditional \`${r}\` on ${t.key||"?"} will never match \u2014 the whole string after \`${c}\` is read as one prop name. Nest the selector inside instead: \`${c}${y}: { '${a.slice(y.length)}': {...} }\`.`)}continue}const i=t[r];if(!i||typeof i!="object")continue;const e=c==="!",f={lastMatch:!1,appliedKeys:null,appliedClasses:null,appliedAttrs:null,probe:!1,untrackedReads:0},l=Rr(t,r,i);l&&!n&&(n=o.__conditionalAttrs={owners:new Map,base:new Map,written:new Map});const u=new Set;for(const y in i){if(!Object.prototype.hasOwnProperty.call(i,y))continue;const A=y.charAt(0),S=i[y];if(!((A===":"||A==="@"||A==="&"||A==="[")&&S&&typeof S=="object"&&!Array.isArray(S))){if(y==="vars"&&nt(S)){for(const w of Object.keys(S))w&&u.add(Qt(w));continue}u.add(y)}}const d=()=>{let y;const A=f.probe;let S;if(A?Hn(f,()=>{S=t[a]}):S=t[a],S===void 0){const g=!!t.state&&a in t.state,x=t.state?t.state[a]:void 0;if(g||x!==void 0)y=x;else{const k=t.context?.cases?.[a];if(k===void 0)return;try{y=typeof k=="function"?k.call(t,t):k}catch(j){y=!1,o.__conditionalError=j,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${r}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,j?.message||j)}}}else if(typeof S=="function")try{A?Hn(f,()=>{y=S(t,t.state,t.context)}):y=S(t,t.state,t.context)}catch(g){y=!1,o.__conditionalError=g,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${r}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,g?.message||g)}else y=S;A&&(f.probe=!1);const w=e?!y:!!y;if(!t.node)return;const b=t.context?.designSystem;if(w===f.lastMatch){if(w&&l&&t.node.setAttribute){b&&z(b);try{Fn(t,n,r,l,f,!1)}finally{b&&q()}}return}f.lastMatch=w,b&&z(b);try{if(w){const g={},x={};let k=!1;for(const E in i){if(!Object.prototype.hasOwnProperty.call(i,E))continue;const P=i[E],R=E.charAt(0);if((R===":"||R==="@"||R==="&"||R==="[")&&P&&typeof P=="object"&&!Array.isArray(P)){if(ko(E,t)){const I=yt(P,t,!1,u);Object.keys(I).length&&(x[`[data-theme="${E.slice(1)}"] &`]=I,k=!0)}else{const I=Co(E,t),ct=yt(P,t,!1,u);Object.keys(ct).length&&(x[I]=ct,k=!0)}continue}const Z=typeof P=="function"?P(t,t.state,t.context):P;if(Z!=null){if(H[E]){const I=H[E](Z,t,t.state,t.context);if(I){const ct=Array.isArray(I)?I:[I];for(const Nt of ct)Nt&&Object.assign(g,Nt)}}else if(V&&V.has(E))g[E]=Z;else if(Ot(E))g[E]=Z;else if(E==="vars"){const I=Xt(Z,t);I&&Object.assign(g,I)}}}const j=Object.keys(g);if(j.length){ot(t.node,g);for(const E of j)s.set(E,r);f.appliedKeys=j}else f.appliedKeys=null;if(k){const E=At(x,null,t.context?.cssPrefix,{state:!0}),P=E?E.split(" ").filter(Boolean):[];if(P.length&&t.node.classList){for(const R of P)t.node.classList.add(R);f.appliedClasses=P}else f.appliedClasses=null}else if(f.appliedClasses){for(const E of f.appliedClasses)t.node.classList.remove(E);f.appliedClasses=null}l&&t.node.setAttribute&&Fn(t,n,r,l,f,!0)}else{if(f.appliedAttrs&&Dr(t,n,r,f),f.appliedKeys){for(const g of f.appliedKeys)s.get(g)===r&&(Ot(g)?t.node.style.removeProperty(g):t.node.style[g]="",s.delete(g));f.appliedKeys=null}if(f.appliedClasses){for(const g of f.appliedClasses)t.node.classList.remove(g);f.appliedClasses=null}}}finally{b&&q()}};o.__conditionalRunners.push(d);const h=t[a+"Deps"],_=O(t,h,d);Lr()&&typeof(o.__exec&&o.__exec[a]||t[a])=="function"&&!(Array.isArray(h)&&h.length===0)&&(f.probe=!0);const p=v(_,{depth:o.path.length,label:C(o,"conditional("+r+")")});f.probe&&(f.probe=!1),f.untrackedReads>0&&p._sources.size===0&&console.warn(`[smbls] conditional \`${r}\` on ${t.key||"?"} subscribed to nothing \u2014 its predicate read state on its first run without subscribing to it (\`in\`, Object.keys, a \`__\` key, parse()), so no state write will ever re-evaluate it (only a direct element.update() on this element re-runs it). Declare \`${a}Deps: [...]\` (state-key strings or \`(el, s) => \u2026\` selectors) so the subscription is armed unconditionally, or \`${a}Deps: []\` when it is static on purpose.`),o.__effects.push(p)}}const Po=new WeakSet,Eo=new WeakMap;function Mr(t){const o=Eo.get(t);if(o==="painted")return!1;if(o===void 0){Eo.set(t,"open");const n=t.defaultView,s=()=>{Eo.set(t,"painted")};n&&typeof n.requestAnimationFrame=="function"?n.requestAnimationFrame(s):setTimeout(s,0)}return!0}function Fr(t){const o=t.ownerDocument;!o||Po.has(o)||Mr(o)||(Po.add(o),queueMicrotask(()=>{Po.delete(o);const n=o.body||o.documentElement;n&&n.offsetWidth}))}const To=new WeakSet;let Un=!1;function Bn(t){return t.startsWith("[data-theme=")||t.startsWith("@media")&&t.includes("prefers-color-scheme")}function Oo(t,o){const n={...t};for(const s in o){const r=o[s],c=n[s];n[s]=r&&typeof r=="object"&&c&&typeof c=="object"?Oo(c,r):r}return n}function Vn(t,o){const n={};for(const s in t){const r=t[s];if(r&&typeof r=="object"){const c=Vn(r,o);Object.keys(c).length&&(n[s]=c)}else o(s)||(n[s]=r)}return n}function Kn(t,o,n){const s=Ro(t);if(!s)return!1;for(let r=0;r<s.length;r+=3){const c=s[r+1];if(!n.has(c))continue;const a=o[c];if(!(a==null||typeof a=="object")&&Ls(s[r],a,s[r+2]))return!0}return!1}function Ir(t,o,n){let s=1/0,r=-1/0;for(const a of o.values())a<s&&(s=a),a>r&&(r=a);if(n)for(const a of n.values())a>r&&(r=a);if(r<=s)return null;let c=null;for(const[a,i]of o){if(i===r)continue;const e=Ro(a);if(e)for(let f=0;f<e.length;f+=3){const l=e[f],u=e[f+1],d=e[f+2],h=t[u]!=null?o.get(u):void 0,_=n&&n.get(l),p=h!==void 0&&h>i&&Ko(l,t[u],d),y=!p&&_!==void 0&&_>i&&Ko(l,void 0,d);if(p||y){p&&delete t[a],c||(c=new Set),c.add(a);break}}}return c}const Gn=new Map;function Ro(t){let o=Gn.get(t);if(o!==void 0)return o;const n=Y(t),s=Kt[n];if(o=null,Array.isArray(s)){o=[];for(const r of s)o.push(r,Wo(r),n)}return Gn.set(t,o),o}function Wn(t){const{node:o}=t;if(!o)return;if(Un||(Un=!0,At({display:"none"})),To.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}To.add(t);const n=t.context?.designSystem;n&&z(n),Uo();try{const s={};let r=!1,c=[],a=null,i=null,e=null,f=null;const l=t.__ref&&t.__ref.__mergeLayer;let u,d=null,h=null;const _=(b,g)=>{if(g&&typeof g=="object"&&Bn(b)){e||(e={});const x=e[b];x&&(g=Oo(x,g)),e[b]=g}else(g===null||typeof g!="object")&&(f||(f=new Set),f.add(b),u!==void 0&&(d||(d=new Map),d.set(b,u)));s[b]=g};if(Object.prototype.hasOwnProperty.call(t,"theme")&&typeof t.theme!="function"&&H.theme){const b=H.theme(t.theme,t,t.state,t.context);if(b){const g=x=>{for(const k in x){const j=x[k];j&&typeof j=="object"?Bn(k)&&(a||(a={}),a[k]=j):Ro(k)&&(i||(i=[])).push(k),s[k]=j}};if(Array.isArray(b))for(const x of b)x&&g(x);else g(b);r=!0}}const p=(b,g)=>{if(b==="vars"){const x=Xt(g);if(x){for(const k in x)_(k,x[k]);r=!0}return}if(H[b]){const x=H[b](g,t,t.state,t.context);if(x){if(Array.isArray(x)){for(const k of x)if(k)for(const j in k)_(j,k[j])}else for(const k in x)_(k,x[k]);r=!0}}else if(V&&V.has(b))g!=null&&typeof g!="object"&&(_(b,g),r=!0);else if(b.charCodeAt(0)===45)g!=null&&typeof g!="object"&&(_(b,g),r=!0);else if((b.charAt(0)==="&"||b.charAt(0)==="@"||b.charAt(0)===":"||b.charAt(0)==="[")&&g&&typeof g=="object"&&!Array.isArray(g)){if(vo(g))return;const x=Mn(b,g,t);x&&(_(x.cssProp,x.block),r=!0)}};if(typeof t.class=="string"){const b=Pr(t.class,t.context?.designSystem?.class);if(b)for(const g in b)p(g,b[g])}const y=f?new Set(f):null,A=t.tag||"div";for(const b of Object.keys(t)){if(typeof t[b]=="function"){const x=l&&l.get(b);x!==void 0&&et(A,b)&&(h||(h=new Map),h.set(Y(b),x));continue}if(u=l?l.get(b):void 0,b==="vars"){p(b,t[b]);continue}if(B.has(b)||b==="theme")continue;const g=b.charCodeAt(0);g>=65&&g<=90||W(b)||zo(A,b)||p(b,t[b])}u=void 0;const S=d?Ir(s,d,h):null;if(i&&f)for(const b of i)f.has(b)||!(b in s)||Kn(b,s,f)&&delete s[b];if(a){const b=f?g=>f.has(g)||Kn(g,s,f):null;for(const g in a){let x=b?Vn(a[g],b):a[g];e&&e[g]&&(x=Oo(x,e[g])),Object.keys(x).length?s[g]=x:delete s[g]}}if(xr(t,s,f,S?new Set([...y||[],...S]):y),r){s.display&&String(s.display).includes("!important")&&(o.style.setProperty("display",String(s.display).replace(/\s*!important\s*$/,""),"important"),delete s.display);const b=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;typeof b=="string"&&b!==""&&s.display&&s.display!==b&&(s.display=b);const g=At(s,null,t.context?.cssPrefix);if(c=g?g.split(" ").filter(Boolean):[],g&&o.classList){const x=c;let k=!1;for(const j of x)o.classList.add(j),k||(j.charCodeAt(0)===95&&j.charCodeAt(1)===99||j.charCodeAt(0)===95&&j.indexOf("_c",1)!==-1)&&(k=!0);k&&Fr(o)}}const w=t.__ref;if(w){const b=w.__staticCssClasses;if(b&&o.classList){const g=new Set(c);for(const x of b)g.has(x)||o.classList.remove(x)}w.__staticCssClasses=c}wr(t)}finally{Bo(),n&&q(),To.delete(t)}}const Me=t=>!!H[t]||!!(V&&V.has(t))||typeof t=="string"&&t.charCodeAt(0)===45;function Fe(t){t&&t.node&&Wn(t)}function $r(t){const{node:o}=t;if(!o||!o.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const r in t.aria){const c=t.aria[r];if(typeof c=="function"||typeof c=="object"||c==null||typeof c=="string"&&c.includes("{{"))continue;const a="aria-"+r.replace(/[A-Z]/g,i=>"-"+i.toLowerCase());o.setAttribute(a,J(a,c))}const n=Ts(t);for(const r in n){const c=n[r];c!=null&&c!==!1&&typeof c!="function"&&typeof c!="object"&&o.setAttribute(r,c===!0?"":c)}const s=t.tag||"div";for(const r of Object.keys(t)){if(typeof t[r]=="function"||B.has(r)||r==="on"||n[r]!==void 0)continue;const c=r.charCodeAt(0);if(!(c>=65&&c<=90)&&!W(r)&&!et(s,r)&&xt(s,r)){let a=t[r];if(a==null)continue;if(typeof a=="string"&&a.includes("{{")){if(!co[r])continue;a=$.call(t,a,t.state)}if(a==null||typeof a=="function"||typeof a=="object"||a===!1&&!Vt(wt(r)||r))continue;const i=wt(r)||r;o.setAttribute(i,J(i,a))}}}function Ie(t,o){const{node:n}=t;if(!n||!n.setAttribute)return;const s=o.charCodeAt(0);if(s>=65&&s<=90||W(o))return;const r=t.tag||"div";if(et(r,o)||!xt(r,o))return;const c=wt(o)||o,a=c.toLowerCase(),i=t.__ref&&t.__ref.__effects;let e=!1;if(i)for(let u=0;u<i.length;u++){const d=i[u];d&&d._attrName===a&&!d._disposed&&typeof d._execute=="function"&&(e=!0,d._execute())}if(e)return;let f=t[o];const l=co[o];if(l&&f!=null){const u=l(t);u!==void 0&&(f=u)}typeof f=="string"&&f.includes("{{")&&(f=$.call(t,f,t.state)),Yt(n,c,f)}function Hr(t,o){const n=t.node,s=t.__ref;let r=s.__autoGrow;if(!o){if(r&&r.active){try{n.removeEventListener("input",r.resize)}catch{}qn(r),m.delete(t),n.style.height="",r.appliedMax!=null&&n.style.maxHeight===r.appliedMax&&(n.style.maxHeight=""),Qn(n,r,!1),r.active=!1,r.appliedMax=null,r.lastMeasure=0}return}r||(r=s.__autoGrow={active:!1,appliedMax:null,lastMeasure:0,lastWidth:null,watch:null,awaitingLayout:!1,appliedScroll:!1,fontsHooked:!1,attachAttempts:0,firstAttemptAt:null,resize:()=>{if(!n.isConnected){Rt(t,!0);return}if(!(n.scrollHeight>0)){r.awaitingLayout=!0,zn(t,r);return}r.awaitingLayout=!1;const a=Vr(n),i=Kr(a),e=n.style.height;n.style.height="0px",i&&Lo(n);const f=n.scrollHeight;if(!(f>0)){n.style.height=e,i&&Lo(n);return}const l=Gr(n,a),u=l!=null&&f<l?l:f,d=qr(a),h=d!=null&&u>d;n.style.height=zr(h?d:u,a)+"px",i&&Lo(n),Qn(n,r,h),r.lastMeasure=f,r.lastWidth=n.clientWidth,zn(t,r)}},s.__eventCleanup||(s.__eventCleanup=[]),s.__eventCleanup.push(()=>{try{n.removeEventListener("input",r.resize)}catch{}qn(r),m.delete(t)})),r.active||(n.addEventListener("input",r.resize),r.active=!0,Br(t,r));const c=typeof o=="object"&&o.max!=null?String(o.max):null;c!==r.appliedMax&&(c==null?r.appliedMax!=null&&n.style.maxHeight===r.appliedMax&&(n.style.maxHeight=""):n.style.maxHeight=c,r.appliedMax=c),r.resize()}function Rt(t,o){const n=t.__ref?.__autoGrow;n&&(o&&(n.attachAttempts=0,n.firstAttemptAt=null),m.add(t),kt())}function Ur(){const t=Array.from(m);m.clear();for(let o=0;o<t.length;o++){const n=t[o],s=n.node,r=n.__ref?.__autoGrow;if(!(!s||!r||!r.active)){if(!s.isConnected){r.firstAttemptAt==null&&(r.firstAttemptAt=dt()),r.attachAttempts+=1,r.attachAttempts<=Qo&&dt()-r.firstAttemptAt<Xo&&(m.add(n),kt());continue}r.attachAttempts=0,r.firstAttemptAt=null,r.resize()}}}function zn(t,o){if(o.watch)return;const n=t.node;if(!n)return;const s=n.ownerDocument&&n.ownerDocument.defaultView,r=s&&s.ResizeObserver||(typeof ResizeObserver=="function"?ResizeObserver:null);if(typeof r!="function")return;const c=()=>{if(!o.active||!n.isConnected||!(n.scrollHeight>0))return;if(o.awaitingLayout){o.awaitingLayout=!1,Rt(t,!0);return}const i=n.clientWidth;o.lastWidth!=null&&Math.abs(i-o.lastWidth)<.5||(o.lastWidth=i,Rt(t,!0))};let a;try{a=new r(c),a.observe(n)}catch{return}o.watch=a}function qn(t){const o=t.watch;if(o){t.watch=null;try{o.disconnect()}catch{}}}function Br(t,o){if(o.fontsHooked)return;o.fontsHooked=!0;const n=t.node&&t.node.ownerDocument,s=n&&n.fonts&&n.fonts.ready;!s||typeof s.then!="function"||s.then(()=>{o.active&&t.node&&Rt(t,!0)},()=>{})}function Vr(t){const o=t.ownerDocument&&t.ownerDocument.defaultView;try{return o&&o.getComputedStyle?o.getComputedStyle(t):null}catch{return null}}const it=t=>typeof t=="string"&&/^\s*-?\d*\.?\d+px\s*$/.test(t)?parseFloat(t):null,Do=t=>(it(t.paddingTop)||0)+(it(t.paddingBottom)||0),Yn=t=>(it(t.borderTopWidth)||0)+(it(t.borderBottomWidth)||0);function Kr(t){if(!t)return!1;const o=String(t.transitionProperty||"").split(","),n=String(t.transitionDuration||"0s").split(",");for(let s=0;s<o.length;s++){const r=o[s].trim();if(!(r!=="all"&&r!=="height")&&parseFloat(n[s%n.length])>0)return!0}return!1}function Lo(t){if(typeof t.getAnimations!="function")return;let o;try{o=t.getAnimations()}catch{return}for(let n=0;n<o.length;n++){const s=o[n];if(s&&s.transitionProperty==="height")try{s.cancel()}catch{}}}function Gr(t,o){if(!o||!t.hasAttribute||!t.hasAttribute("rows"))return null;const n=parseInt(t.getAttribute("rows"),10);if(!(n>0))return null;const s=it(o.lineHeight)||Wr(t,o);return s>0?n*s+Do(o):null}const Dt=["fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontFamily","lineHeight","letterSpacing"],Zn=new WeakMap;function Wr(t,o){const n=t.ownerDocument,s=n&&(n.body||n.documentElement);if(!s||!n.createElement)return null;let r=Zn.get(n);r||(r=new Map,Zn.set(n,r));const c=Dt.map(f=>o[f]||"").join("|");if(r.has(c))return r.get(c);const a=n.createElement("textarea");a.rows=1,a.setAttribute("aria-hidden","true"),a.tabIndex=-1;const i=a.style;i.position="absolute",i.visibility="hidden",i.top="0",i.left="-9999px",i.height="auto",i.minHeight="0",i.maxHeight="none",i.padding="0",i.border="0",i.boxSizing="content-box",i.overflow="hidden";for(let f=0;f<Dt.length;f++)o[Dt[f]]&&(i[Dt[f]]=o[Dt[f]]);let e=0;try{s.appendChild(a),e=a.clientHeight}catch{e=0}finally{a.parentNode&&a.parentNode.removeChild(a)}return e>0?(r.set(c,e),e):null}function zr(t,o){return o?o.boxSizing==="border-box"?t+Yn(o):o.boxSizing==="content-box"?Math.max(0,t-Do(o)):t:t}function qr(t){if(!t)return null;const o=it(t.maxHeight);if(o==null||!(o>0))return null;const n=Do(t),s=Yn(t),r=t.boxSizing==="border-box"?o-s:o+n,c=it(t.lineHeight);if(!(c>0))return r;const a=Math.floor((r-n)/c+1e-6);return a>=1?a*c+n:r}function Qn(t,o,n){n?o.appliedScroll||(t.style.overflowY="auto",o.appliedScroll=!0):o.appliedScroll&&(t.style.overflowY==="auto"&&(t.style.overflowY=""),o.appliedScroll=!1)}const Xn=["srcObject","muted"],Yr=(t,o)=>t==="muted"?o===!0||o===""||o==="true"||o==="muted":o??null;function Zr(t){const o=t.node,n=t.__ref;if(!(!o||!n))for(let s=0;s<Xn.length;s++){const r=Xn[s],c=t[r];if(c===void 0||!(r in o))continue;const a=i=>{const e=Yr(r,i);if(o[r]!==e)try{o[r]=e}catch(f){F(n,r,f)}};if(typeof c=="function"){const i=O(t,t[r+"Deps"],c),e=v(()=>{try{a(i(t,t.state,t.context))}catch(f){F(n,r,f)}},{depth:n.path.length,label:C(n,r)});n.__effects.push(e),n.__exec[r]=c}else a(c);r==="srcObject"&&(n.__releaseMedia=()=>{try{o.srcObject!=null&&(o.srcObject=null)}catch{}})}}function Qr(t){if(!t.autoGrow)return;const o=t.node;if(!o||o.tagName!=="TEXTAREA")return;const n=t.__ref,s=t.autoGrow,r=typeof s=="function"?O(t,t.autoGrowDeps,s):null,c=v(()=>{const a=t.autoGrow;let i=a;if(typeof a=="function")try{i=(a===s&&r?r:a)(t,t.state,t.context)}catch{i=null}Hr(t,i)},{depth:n.path.length,label:C(n,"autoGrow")});n.__effects||(n.__effects=[]),n.__effects.push(c),r&&(n.__exec.autoGrow=s)}const Jn=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function mn(t,o){let n=!1;for(const s of Object.keys(t)){if(!W(s)||Jn.has(s))continue;if(s==="onInView"||s==="onLeaveView"){n=!0;continue}const r=ys(s);if(r){hs(r,t,t[s]);continue}let c=t[s],a=null;if(c&&typeof c=="object"&&!Array.isArray(c)&&(a=c,c=a.handler),c=gs(t,c),typeof c!="function")continue;const i=_s(s);ls.has(i)||ps(Hs(i),t,c,a)}Xr(t),n&&M.viewEvents&&M.viewEvents(t)}function Xr(t){const o=t.node;if(!o||!o.addEventListener)return;const n={};let s=!1;for(const d of Jn){const h=t[d];typeof h=="function"&&(n[d]=h,s=!0)}if(!s)return;const r=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,c=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let a=0,i=0,e=0,f=!1;const l=d=>{const h=d.touches&&d.touches[0]||d.changedTouches&&d.changedTouches[0];h&&(a=h.clientX,i=h.clientY,e=Date.now(),f=!0)},u=d=>{if(!f)return;f=!1;const h=d.changedTouches&&d.changedTouches[0]||d.touches&&d.touches[0];if(!h)return;const _=h.clientX-a,p=h.clientY-i,y=Date.now()-e;if(y>c)return;const A=Math.abs(_),S=Math.abs(p);if(Math.max(A,S)<r)return;let w;if(A>S*1.2)w=_<0?"left":"right";else if(S>A*1.2)w=p<0?"up":"down";else return;const b="onSwipe"+w.charAt(0).toUpperCase()+w.slice(1),g=n[b],x=n.onSwipe;g&&g.call(t,d,t,t.state,t.context),x&&x.call(t,{direction:w,dx:_,dy:p,dt:y,event:d},t,t.state,t.context)};o.addEventListener("touchstart",l,{passive:!0}),o.addEventListener("touchend",u,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{o.removeEventListener("touchstart",l)}catch{}try{o.removeEventListener("touchend",u)}catch{}})}function Jr(t,o,n,s,r,c,a,i){let e=o;(typeof e=="string"||typeof e=="number")&&(e={text:e});let f=s;if(typeof s=="function")try{f=s(t,e)}catch{f=null}let l=typeof s=="function"?vt(f):r;if(i&&!a&&(l=jt(l,vt(o))),a){let u=o;(typeof o=="string"||typeof o=="number")&&(u={value:o,text:o}),e=f?{...f,state:u}:{state:u}}else f&&(e=X(f,e));return e=Lt(e,c),{def:e,key:tn(e?.key,o,n,t),supplied:l,props:f}}function Lt(t,o){if(!o||!t||t.ignoreChildExtends)return t;if(!t.extends)return{...t,extends:o};const n=Array.isArray(t.extends)?t.extends:[t.extends],s=Array.isArray(o)?o:[o];return{...t,extends:[...s,...n]}}const mt=t=>{const o=t&&t.__ref;if(!o||o.__if===!1||o.__mount&&o.__mount.held)return null;const n=t.node;return n&&n.nodeType!==11?n:null},ts=(t,o)=>o?o.nextSibling:Ho(t.node,t.__ref.__textNode),os=(t,o,n)=>{const s=ts(t,n);return o!==s&&t.node.insertBefore(o,s),o},mr=(t,o)=>{const n=ts(t,o);return n?{position:"before",node:n}:void 0};function te(t,o,n){let s=null;for(let r=0;r<o.length;r++){if(n&&n.has(o[r]))continue;const c=mt(t[o[r]]);c&&(s=os(t,c,s))}}function ns(t,o,n,s){const r=M.rows,c=r!==null&&t.childrenAs!=="state"&&t.tag!=="fragment"?r.track(t):null,a=No(t,o,n,s,!0,c);return t.__ref.__plainRows=c&&(a||o==null||o===!1)?c:null,a}function No(t,o,n,s,r,c){if(!o||!t.node)return;const a=t.childExtends,i=pt(t,"childProps"),e=t.__ref,f=M.mount,l=s>0&&t.tag!=="fragment"&&e?s:0;if(Array.isArray(o)){const u=t.childProps,d=t.childrenAs==="state",h=(_,p)=>{const y=Jr(t,o[_],_,u,i,a,d,r);c&&c.add(y.key,o[_],y,u,a);try{const A=tt(Pt(y.def,y.supplied),t,y.key,n,p);return!A&&c&&c.none(y.key),zt(t,A),A}catch(A){if(c&&c.failed(y.key),typeof console<"u"&&console.error){const S=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${y.key}" failed to construct at ${S} (initial render, skipping this row):`,A?.message||A)}return null}};if(!l){for(let _=0;_<o.length&&!(e&&e.__disposed);_++)h(_);return!0}return f.rows(t,o.length,h,l),!0}if(typeof o=="string"){const u=en(o,t);if(Array.isArray(u))return No(t,u,n,s,!0,c)}if(typeof o=="object"){const u=(h,_)=>{if(B.has(h))return!1;let p=o[h];if(p==null||p===!1)return!1;const y=r?jt(i,vt(p)):i;(typeof p=="string"||typeof p=="number")&&(p={text:p}),t.childProps&&(p=X(t.childProps,p)),p=Lt(p,a);const A=tt(Pt(p,y),t,Wt(t,h),n,_);return zt(t,A),A};if(!l){for(const h in o)u(h);return}const d=[];for(const h in o)d.push(h);f.rows(t,d.length,(h,_)=>u(d[h],_),l)}}function to(t,o){const n=t.node;if(!n||n.tagName!=="SELECT")return;const s=n.options;if(!s||!s.length)return;const r=t.__ref,c=r&&r.__exec&&r.__exec.value,a=typeof c=="function",i=t.value!=null&&typeof t.value!="function";if(a||i){let l;if(a)try{l=c(t,t.state,t.context)}catch{return}else l=t.value,typeof l=="string"&&l.includes("{{")&&(l=$.call(t,l,t.state));const u=l==null?"":String(l);n.value!==u&&(n.value=u);return}const e=o||!(r&&r.__selectSynced);if(r&&(r.__selectSynced=!0),!e)return;let f=-1;for(let l=0;l<s.length;l++)s[l].defaultSelected&&(f=l);f>=0&&n.selectedIndex!==f&&(n.selectedIndex=f)}function ss(t,o){let{children:n,content:s}=t;const r=t.childExtends,c=typeof n=="function",a=c||hn(t,"children");if(typeof n=="function"){const u=n,d=t.__ref;let h=!1,_;const p=O(t,t.childrenDeps,u),y=v(()=>{const A=h;h=!0;let S;try{S=p(t,t.state,t.context)}catch(P){if(typeof console<"u"&&console.error){const R=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${R}${A?"":" (initial run, treating as empty)"}:`,P?.message||P)}return}if(!A){_=S;return}if(S===t.children)return;yn(t,S),t.children=S,d.__mount&&d.__mount.chunkGen++;const w=typeof t.onContentUpdate=="function",b=w?[]:null,g=w?[]:null,x=w?[]:null;if(Array.isArray(S)&&t.childrenAs==="state"){const P=t.childProps,R=[],Z=new Map;for(let T=0;T<S.length;T++){const G=S[T];let D=P;if(typeof P=="function")try{D=P(t,G)}catch{D=null}const st=tn(D&&D.key,G,T,t);R.push(st),Z.set(st,{rawChild:G,childProps:D})}const I=new Set(R),ct=fn(d,d.__children.slice());for(const T of ct)if(!I.has(T)){const G=t[T];G?.remove&&G.remove(),delete t[T],g&&g.push(T)}const Nt=t.childExtends,Mt=!(t.tag==="fragment")&&!!t.node;let Ft=null;const gt=new Set;for(const T of R){const G=Z.get(T),D=G.rawChild,st=t[T];if(st&&st.state){if(D&&typeof D=="object"){const L=st.state,It=L.$replace||L.replace,Io=L.$update||L.update;try{if(typeof It=="function")It.call(L,D);else if(typeof Io=="function"){for(const U in L)if(!(U==="__element"||U==="root"||U==="parent"||U==="update")&&!Object.prototype.hasOwnProperty.call(D,U))try{L[U]=void 0}catch{}Io.call(L,D)}else for(const U in D)L[U]=D[U]}catch(U){if(typeof console<"u"&&console.error){const fs=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${T}" failed to patch at ${fs} (reconcile, keeping its previous data for this pass):`,U?.message||U)}}}if(x&&x.push(T),Mt){const L=mt(st);L&&(Ft=os(t,L,Ft))}continue}let no=D;(typeof D=="string"||typeof D=="number")&&(no={value:D,text:D});const so=G.childProps,is=Lt(so?{...so,state:no}:{state:no},Nt),cs=typeof P=="function"?vt(so):pt(t,"childProps");let Fo;try{Fo=tt(Pt(is,cs),t,T,o,Mt?mr(t,Ft):void 0)}catch(L){if(typeof console<"u"&&console.error){const It=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${T}" failed to construct at ${It} (reconcile, skipping this row):`,L?.message||L)}gt.add(T);continue}if(d.__disposed)return;if(Mt){const L=mt(Fo);L&&(Ft=L)}b&&b.push(T)}Mt&&te(t,R,gt.size?gt:null),d.__children=gt.size?R.filter(T=>!gt.has(T)):R,w&&(b.length||g.length)&&Jo(t,{added:b,removed:g,kept:x}),to(t,!1);return}if(t.childrenAs!=="state"&&d.__plainRows&&M.rows.reconcile(t,d,S,o,w)){to(t,!1);return}const E=w?[...d.__children]:null;for(const P of fn(d,[...d.__children])){const R=t[P];R?.remove&&R.remove(),delete t[P]}d.__children=[],ns(t,S,o,0),to(t,!1),w&&Jo(t,{added:[...d.__children],removed:E,kept:[]})},{depth:d.path.length,label:C(d,"children")});d.__effects.push(y),n=_,yn(t,n),t.children=n}const i=M.mount,e=i!==null?i.budgetOf(t,o):0,f=Ht(t.__ref),l=c?ns(t,n,o,e):No(t,n,o,e,a);if(e&&Ht(t.__ref)>f){i.defer(t,e,()=>rs(t,o,n,s,r,l,e));return}rs(t,o,n,s,r,l,e)}function rs(t,o,n,s,r,c,a){const i=Ht(t.__ref);if(s!=null&&!(s&&s.__ref)){let e=s;typeof e=="string"||typeof e=="number"?e={text:e}:typeof e!="object"&&(e={}),t.childProps&&(e=X(t.childProps,e)),e=Lt(e,r);const f=jt(pt(t,"childProps"),pt(t,"content"));zt(t,tt(Pt(e,f),t,"content",o))}if(!(n&&!c)){if(a&&Ht(t.__ref)>i){M.mount.defer(t,a,()=>es(t,o,r,a));return}es(t,o,r,a)}}function es(t,o,n,s){const r=t.context?.components||{},c=t.__ref&&t.__ref.__runtimeSource,a=c?{}:null;{const f=Object.keys(t);for(let l=0;l<f.length;l++){const u=f[l];if(!u.endsWith("Extends")||typeof t[u]!="string")continue;const d=u.slice(0,-7);if(!d||d.charCodeAt(0)<65||d.charCodeAt(0)>90)continue;const h={extends:t[u]};delete t[u];for(let _=l+1;_<f.length;_++){const p=f[_],y=p.charCodeAt(0);if(y>=65&&y<=90||B.has(p)||typeof t[p]=="function"&&(p.startsWith("on")||p.startsWith(".")))break;const A=t[p];A!==void 0&&(h[p]=A,delete t[p],a&&Ct(c,p)&&(a[d]||(a[d]={}),a[d][p]=c[p]))}t[d]&&typeof t[d]=="object"?t[d]={...h,...t[d]}:t[d]=h}}const i=Object.keys(t),e=f=>{if(B.has(f)||typeof t[f]!="object"||t[f]===null)return!1;const l=f.charCodeAt(0);if(l<65||l>90)return!1;let u=t[f];if(u.__ref)return!1;if(!u.extends&&!u.extend){const h=r[f]||r[`smbls.${f}`];h&&(u={...u,extends:h})}t.childProps&&(u=X(t.childProps,u)),u=Lt(u,n);const d=c?jt(pt(t,"childProps"),jt(a[f]||null,pt(t,f))):null;zt(t,tt(Pt(u,d),t,f,o))};if(!s){for(const f of i)e(f);return}M.mount.run(t,i.length,f=>e(i[f]),s)}function _t(t,o,n){const{node:s}=t;if(!s)return;s.ref=t;const r=o?.tag==="fragment"?o.__ref?.__fragmentAnchor:null;if(r){const i=r.parentNode;if(i){if(n?.position==="before"&&n.node)i.insertBefore(s,n.node);else if(n?.position==="after"&&n.node){const e=n.node.nextSibling;i.insertBefore(s,e||r)}else i.insertBefore(s,r);io();return}}const c=o?.node||(o?.nodeType?o:null);if(!c)return;if(!n&&M.hydration!==null){const i=t.context&&t.context.__hydration;if(i&&M.hydration.place(i,t,o,c,s))return}const a=n?.node;if(a&&a.parentNode!==c)c.appendChild(s);else if(n?.position==="before"&&a)c.insertBefore(s,a);else if(n?.position==="after"&&n.node){const i=n.node.nextSibling;i?c.insertBefore(s,i):c.appendChild(s)}else c.appendChild(s);io()}const Mo=3;function oe(t){return!t||t.__inBeforeUpdate||(t.__beforeUpdateFailCount||0)>=Mo?!1:(t.__inBeforeUpdate=!0,!0)}function oo(t,o){t&&(t.__inBeforeUpdate=!1,o?(t.__beforeUpdateFailCount=(t.__beforeUpdateFailCount||0)+1,t.__beforeUpdateFailCount===Mo&&typeof console<"u"&&console.error&&console.error(`[DOMQL] onBeforeUpdate failed ${Mo}x in a row on this element \u2014 pausing automatic retries until a future prop/state change re-arms it.`)):t.__beforeUpdateFailCount=0)}function N(t,o,n){const s=t.charAt(0).toLowerCase()+t.slice(1);bt(s,o,n);const r="on"+t,c=o[r];if(typeof c=="function"){const e=t==="Render"?"__inRender":t==="RenderRouter"?"__inRenderRouter":null;if(e){if(o.__ref[e])return!0;o.__ref[e]=!0}const f=o.context?.designSystem;f&&z(f);let l=!!e;try{const u=c(o,o.state,o.context,n);if(u&&typeof u.then=="function"){const d=o.__ref;return u.catch(h=>{Bt(o,r,h)}).finally(()=>{e&&d&&(d[e]=!1)}),l=!1,!0}if(u===!1)return!1}catch(u){if(Bt(o,r,u),o.context?.strictMode)throw u}finally{f&&q(),l&&o.__ref&&(o.__ref[e]=!1)}}return!0}var $e=tt;export{Mo as BEFORE_UPDATE_MAX_CONSECUTIVE_FAILURES,oe as acquireBeforeUpdateGuard,Jr as arrayRowDefinition,Le as attachElement,Ne as attachWhole,Gs as completeCreate,tt as create,$e as default,uo as flushMounts,De as holdMountFlush,Me as isStaticCssProp,Pt as markRuntimeSupplied,os as placeAfter,te as placeRows,mt as placedRowNode,Fe as recompileStaticCss,Ie as reconcileAttrProp,oo as releaseBeforeUpdateGuard,Ks as reportCreateChildrenError,Jt as resolveStyleBlock,mr as rowAttach,pt as runtimeViewOf,to as syncSelectValue,Jo as triggerContentUpdate,Yt as writeAttr,qt as writeElementText};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{detectTag as
|
|
1
|
+
import{detectTag as m,isSvgTag as h,firstSlotAfterText as y,SVG_NS as p}from"./cache.js";const g=t=>{const e=t.__ref;if(e&&e.__hydrationPath!==void 0)return e.__hydrationPath;const r=t.parent,i=r&&r.__ref?g(r):null,s=i===null?"":i?i+"."+t.key:String(t.key);return e&&(e.__hydrationPath=s),s},v=new Set(["src","srcset"]);function x(t){const e=t?.context?.__hydration;if(!e)return null;const r=t.tag=m(t);if(r==="string"||r==="fragment")return null;const i=g(t),s=e.registry[i===""?"__root":i],n=s!==void 0?e.nodes[s]:null;if(!n||n.nodeType!==1||e.claimed.has(n))return s!==void 0&&e.misses++,null;const d=h(r)&&(r==="svg"||t.parent?.node?.namespaceURI===p),f=h(r)&&!d&&r!=="svg"?"div":r,c=d?n.namespaceURI===p:n.namespaceURI!==p;if(n.localName!==f||!c)return e.misses++,null;e.claimed.add(n),e.adopted++;const u=e.pending;if(u&&u.delete(n)){const o=n.parentNode,l=o?(e.pendingIn.get(o)||1)-1:0;l>0?e.pendingIn.set(o,l):o&&e.pendingIn.delete(o)}for(const o of Array.from(n.getAttributeNames?n.getAttributeNames():[]))v.has(o)||n.removeAttribute(o);if(u){let o=0,l=0;for(let a=n.firstChild;a;){const _=a.nextSibling;u.has(a)||(a.nodeType===3?o++:a.nodeType!==8&&l++,n.removeChild(a)),a=_}(l||o>(t.text!=null?1:0))&&(e.whole||(e.whole=new Set)).add(t)}else for(;n.firstChild;)n.removeChild(n.firstChild);return n.localName==="img"&&n.complete&&n.naturalWidth>0&&b(n),n}const I=500;function b(t){let e=!1,r=!1;const i=s=>{s.isTrusted&&(r?s.stopImmediatePropagation():e=!0,t.removeEventListener("load",i,!0))};t.addEventListener("load",i,!0),setTimeout(()=>{if(!e){if(!(t.complete&&t.naturalWidth>0)){t.removeEventListener("load",i,!0);return}r=!0,t.dispatchEvent(new Event("load")),setTimeout(()=>t.removeEventListener("load",i,!0),I)}},0)}function E(t,e,r,i,s){const n=t.pendingIn;if(!n||!n.has(i))return!1;if(s.parentNode===i&&t.claimed.has(s))return!0;let d;const f=r&&r.__ref,c=f&&f.__children,u=c?c.lastIndexOf(e.key):-1;for(let o=u-1;o>=0;o--){const l=r[c[o]],a=l&&l.node;if(a&&a!==s&&a.parentNode===i){d=a.nextSibling;break}}return d===void 0&&(d=y(i,f&&f.__textNode)),d===s||i.insertBefore(s,d),!0}function N(t,e){const r=t.whole;if(!r)return!1;if(r.has(e))return!0;const i=e.parent;return!i||!r.has(i)?!1:(r.add(e),!0)}const T={adopt:x,place:E,whole:N};export{x as adoptHydrationNode,N as adoptsWhole,g as elementPath,T as hydrationFeature,E as placeDuringHydration};
|
package/dist/esm/src/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{create as o,default as r,flushMounts as n,holdMountFlush as d,attachElement as a}from"./create.js";import{MOUNT_YIELD_BUDGET_MS as l,mountYieldBudget as m,
|
|
1
|
+
import{create as o,default as r,flushMounts as n,holdMountFlush as d,attachElement as a}from"./create.js";import{MOUNT_YIELD_BUDGET_MS as l,mountYieldBudget as m,mountIdle as p,mountPending as f,releaseMount as u,whenMounted as i,whenMountIdle as s,yieldToMain as x}from"./mountScheduler.js";import{update as g}from"./update.js";import{dispose as M,remove as N}from"./dispose.js";import{whenConnected as S}from"./connected.js";import{REGISTRY as _,LIFECYCLE_EVENTS as c,DELEGATED_EVENTS as G,NON_BUBBLING_EVENTS as D,MIXINS as L}from"./registry.js";import{addDelegatedEvent as V,removeDelegatedEvent as y,registerEvent as C,registerGlobalEvent as P,globalEventKeyInfo as Y}from"./delegate.js";import{cacheNode as O,detectTag as U,createHTMLNode as b,isValidTag as A,isSvgTag as F,SVG_TAGS as H}from"./cache.js";import{adoptHydrationNode as K,elementPath as X}from"./hydration.js";import{applyExtends as k}from"./extends.js";import{addMethods as z,refreshContextProto as J}from"./methods.js";import{inertOutsidePlugin as W}from"./inertOutside.js";export{G as DELEGATED_EVENTS,c as LIFECYCLE_EVENTS,L as MIXINS,l as MOUNT_YIELD_BUDGET_MS,D as NON_BUBBLING_EVENTS,_ as REGISTRY,H as SVG_TAGS,V as addDelegatedEvent,z as addMethods,K as adoptHydrationNode,k as applyExtends,a as attachElement,O as cacheNode,o as create,b as createHTMLNode,r as default,U as detectTag,M as dispose,X as elementPath,n as flushMounts,Y as globalEventKeyInfo,d as holdMountFlush,W as inertOutsidePlugin,F as isSvgTag,A as isValidTag,p as mountIdle,f as mountPending,m as mountYieldBudget,J as refreshContextProto,C as registerEvent,P as registerGlobalEvent,u as releaseMount,N as remove,y as removeDelegatedEvent,g as update,S as whenConnected,s as whenMountIdle,i as whenMounted,x as yieldToMain};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createEffect as I}from"@symbo.ls/signal";import{untrack as F}from"./runContext.js";const a="inertOutside",
|
|
1
|
+
import{createEffect as I}from"@symbo.ls/signal";import{untrack as F}from"./runContext.js";import{isElementConnected as M,whenConnected as N}from"./connected.js";const a="inertOutside",R=new Set(["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT","BASE","TITLE"]),x='a[href], button, input:not([type="hidden"]), select, textarea, summary, [tabindex], [contenteditable]:not([contenteditable="false"])',P={attributes:!0,attributeFilter:["inert"]},g=new WeakMap,w=new WeakMap,d=new Set,O=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);function u(e){try{return F(e)}catch(t){console.error("[smbls] inertOutside:",t)}}function _(e){const t=()=>u(e);typeof queueMicrotask=="function"?queueMicrotask(t):Promise.resolve().then(t)}function k(e){if(!e||!e.defaultView||!("activeElement"in e))return null;let t=g.get(e);if(t)return t;const n=e.defaultView.MutationObserver||globalThis.MutationObserver;return typeof n!="function"?null:(t={doc:e,layers:[],held:new Map,top:null,observer:null},t.observer=new n(s=>u(()=>h(t,s))),g.set(e,t),t)}function b(e,t){const n=e.element.node;return!!n&&n.nodeType===1&&n.isConnected&&n.ownerDocument===t}function L(e){const t=e.activeElement;return t&&t!==e.body&&t!==e.documentElement?t:null}const S=e=>!!(e.closest&&e.closest("[inert]"));function D(e){const t=e.ownerDocument,n=new Set,s=[];for(let r=e;r!==t.body;r=r.parentNode){const c=r.parentNode;if(!c||c.nodeType!==1||c===t.documentElement)break;s.push(c);for(let l=c.firstElementChild;l;l=l.nextElementSibling)l!==r&&!R.has(l.tagName)&&n.add(l)}return{outside:n,parents:s}}function T(e,t){for(let n=0;n<t.length;n++){const{type:s,target:r}=t[n];s==="attributes"&&e.held.has(r)&&e.held.set(r,!r.hasAttribute("inert"))}}function h(e,t){const{doc:n,held:s,observer:r}=e;t&&T(e,t),T(e,r.takeRecords());const c=e.top,l=[];for(const o of e.layers){const y=b(o,n);y&&!o.live&&(l.push(o),o.returnFocus=L(n)),o.live=y}l.length&&(e.layers=e.layers.filter(o=>!l.includes(o)).concat(l));let i=null;for(let o=e.layers.length-1;o>=0&&!i;o--)e.layers[o].live&&(i=e.layers[o]);e.top=i;const{outside:p,parents:v}=i?D(i.element.node):{outside:new Set,parents:[]};for(const[o,y]of s)p.has(o)||(y&&o.removeAttribute("inert"),s.delete(o));for(const o of p)s.has(o)||s.set(o,!1),o.hasAttribute("inert")||(o.setAttribute("inert",""),s.set(o,!0));r.takeRecords(),r.disconnect();for(const o of v)r.observe(o,{childList:!0});for(const o of s.keys())r.observe(o,P);e.layers.some(o=>!o.live)?d.add(e):d.delete(e);for(const o of e.layers)!o.live&&!o.connecting&&!M(o.element)&&(o.connecting=!0,N(o.element,()=>u(()=>{o.connecting=!1,o.declared&&!o.live&&b(o,e.doc)&&h(e)})));if(i===c)return;const f=c&&!(c.declared&&c.live)?c:null;if(i&&l.includes(i))f&&f.returnFocus&&(i.returnFocus=f.returnFocus),_(()=>m(e,i));else if(f){const o=f.returnFocus;_(()=>q(e,f,o))}f&&(f.returnFocus=null)}function m(e,t){const n=t.element.node;if(e.top!==t||!n||!n.isConnected)return;const s=e.doc,r=s.activeElement;if(r&&n.contains(r))return;const c=new Set,l=(i,p)=>{if(c.has(i)||(c.add(i),i.matches(":disabled")))return!1;const v=p&&i.getAttribute("tabindex");return v&&parseInt(v,10)<0?!1:(i.focus(),s.activeElement===i)};for(const i of n.querySelectorAll("[autofocus]"))if(l(i,!1))return;for(const i of n.querySelectorAll(x))if(l(i,!0))return;r&&r!==s.body&&typeof r.blur=="function"&&r.blur()}function q(e,t,n){if(t.declared&&t.live)return;const s=e.doc,r=s.activeElement,c=t.element.node;(!r||r===s.body||c&&c.contains(r)||S(r))&&(n&&n.isConnected&&n.ownerDocument===s&&!S(n)&&(n.focus({preventScroll:!0}),s.activeElement===n)||e.top&&m(e,e.top))}function E(e,t){if(e.declared===t)return;const n=e.manager;if(e.declared=t,e.live=!1,t)n.layers.push(e);else{const s=n.layers.indexOf(e);s!==-1&&n.layers.splice(s,1)}h(n)}function C(e){let t=e[a];if(typeof t=="function")try{t=t(e,e.state,e.context)}catch{t=!1}return!!t}function A(e){let t=w.get(e);if(t)return t;const n=e.__ref,s=e.node;if(!n||!s||s.nodeType!==1)return null;const r=k(s.ownerDocument);if(!r)return null;t={element:e,manager:r,declared:!1,live:!1,connecting:!1,returnFocus:null},w.set(e,t);const c=I(()=>{const l=C(e);u(()=>E(t,l))},{depth:n.path.length,label:()=>n.path.join(".")+"::"+a});return n.__effects||(n.__effects=[]),n.__effects.push(c),n.__eventCleanup||(n.__eventCleanup=[]),n.__eventCleanup.push(()=>u(()=>E(t,!1))),t}function W(){for(const e of d){if(!e.doc.defaultView){d.delete(e);continue}e.layers.some(t=>!t.live&&b(t,e.doc))&&h(e)}}const z={name:a,create(e){O(e,a)&&u(()=>A(e))},render(){d.size&&u(W)},update(e){O(e,a)&&u(()=>{const t=A(e);t&&E(t,C(e))})}};export{z as inertOutsidePlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function e(n){return n.__mount||(n.__mount={pending:0,tail:null,holder:null,waiters:null,chunkGen:0,attachLater:!1,held:!1})}function u(n){const t=n.__mount;return t?t.pending:0}export{u as mountPendingOf,e as mountRecord};
|