@symbo.ls/element 3.14.785 → 3.14.787
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/src/create.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`+
|
|
1
|
+
"use strict";var St=Object.defineProperty;var go=Object.getOwnPropertyDescriptor;var bo=Object.getOwnPropertyNames;var xo=Object.prototype.hasOwnProperty;var Ao=(t,o)=>{for(var s in o)St(t,s,{get:o[s],enumerable:!0})},Co=(t,o,s,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of bo(o))!xo.call(t,e)&&e!==s&&St(t,e,{get:()=>o[e],enumerable:!(i=go(o,e))||i.enumerable});return t};var So=t=>Co(St({},"__esModule",{value:!0}),t);var Zo={};Ao(Zo,{BEFORE_UPDATE_MAX_CONSECUTIVE_FAILURES:()=>bt,acquireBeforeUpdateGuard:()=>lo,create:()=>W,default:()=>qo,flushMounts:()=>gt,reconcileAttrProp:()=>Ho,releaseBeforeUpdateGuard:()=>ut,writeElementText:()=>at});module.exports=So(Zo);var R=require("@symbo.ls/signal"),E=require("@symbo.ls/signal"),q=require("./cache.js"),U=require("./registry.js"),ot=require("./delegate.js"),co=require("./extends.js"),fo=require("./methods.js"),mo=require("./dispose.js"),m=require("./devRuntime.js"),F=require("./mountScheduler.js"),H=require("@symbo.ls/utils"),K=require("@symbo.ls/utils/function.js"),tt=require("@symbo.ls/state"),A=require("css-in-props"),G=require("@symbo.ls/css"),k=require("@symbo.ls/scratch"),v=require("attrs-in-props"),ao=require("./engineRegistry.js"),uo=require("./version.js");const It=(0,ao.resolveElementIdEngine)({uniqId:1,scopedStyleId:0},uo.VERSION),rt=[];let kt=!1;function Ut(){return typeof Date<"u"&&typeof Date.now=="function"?Date.now():0}function ko(){return typeof document<"u"&&document.visibilityState==="hidden"}const vo=250;function Bt(){if(!kt){if(kt=!0,typeof requestAnimationFrame!="function"){setTimeout(gt,0);return}ko()?setTimeout(gt,vo):requestAnimationFrame(gt)}}const wo=300,jo=15e4;function gt(){if(kt=!1,!rt.length)return;const t=rt.splice(0,rt.length);for(let o=0;o<t.length;o++){const s=t[o];if(s.node){if(!s.node.isConnected){const i=s.__ref||(s.__ref={});i.__mountAttempts=(i.__mountAttempts||0)+1,i.__mountFirstAttemptAt==null&&(i.__mountFirstAttemptAt=Ut());const e=Ut()-i.__mountFirstAttemptAt;i.__mountAttempts<=wo&&e<jo?(rt.push(s),Bt()):console.warn("[DOMQL] onMounted dropped after",i.__mountAttempts,"attempts /",e,"ms \u2014 node never connected:",s.key||s.tag||s);continue}N("Mounted",s,s.__ref?.__mountOptions||{})}}}function vt(t,o){typeof t.onMounted=="function"&&(t.__ref.__mountOptions=o,rt.push(t),Bt())}function Kt(t,o){if(typeof t.onContentUpdate!="function")return;t.context?.plugins?.length&&(0,K.runPluginHook)("contentUpdate",t,o);const s=t.context?.designSystem;s&&(0,k.pushConfig)(s);try{t.onContentUpdate(t,t.state,t.context,o)}catch(i){if(t.context?.plugins?.length&&(0,K.runPluginHook)("error",t,{hook:"onContentUpdate",error:i})||console.error('[DOMQL] Lifecycle "onContentUpdate" error:',i),t.context?.strictMode)throw i}finally{s&&(0,k.popConfig)()}}function Y(t){return t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90}function Eo(t){return t.charAt(2).toLowerCase()+t.slice(3)}function Po(t){return t.toLowerCase()}function wt(t){const o=t.charCodeAt(0);return o===58||o===64||o===38||o===91}function it(t,o){const s={...t};for(const i in o){const e=s[i],r=o[i];e&&r&&typeof e=="object"&&typeof r=="object"&&!Array.isArray(e)&&!Array.isArray(r)&&typeof e!="function"&&typeof r!="function"?s[i]=it(e,r):s[i]=r}return s}function lt(t){if(typeof t=="string")return t||void 0;if(typeof t=="number"||typeof t=="bigint")return String(t)}function Vt(t,o,s){return lt(t)||(o&&typeof o=="object"?lt(o.key):void 0)||String(s)}function W(t,o,s,i={},e){if(t==null||t===!1)return null;(typeof t=="string"||typeof t=="number")&&(t={text:t}),s=lt(s);const r=lt(t.key),n=Object.create(null);n.key=s||r||`_${It.uniqId++}`,n.parent=o||null,n.context=t.context||o?.context||i.context||{},n.context.__create||(n.context.__create=W);const c=n.__ref={__if:!0,__children:[],__exec:{},__effects:[],__eventCleanup:[],root:o?.__ref?.root||n,path:o?.__ref?.path?[...o.__ref.path,n.key]:[n.key],origin:t};if(s&&!t.extends&&!t.extend){const y=s.indexOf("_"),p=s.indexOf(".");let g=y>0?y:-1;if(p>0&&(g<0||p<g)&&(g=p),g>0){const b=s.substring(0,g),S=n.context?.components;S&&(S[b]||S["smbls."+b])?t={...t,extends:b}:S&&(0,m.isLoudDevRuntime)()&&(/^[A-Z]\w*_\d+$/.test(s)||/^[A-Z]\w*\.\w+$/.test(s))&&console.warn(`[smbls] auto-extend: key "${s}" looks like an instance of "${b}" but neither "${b}" nor "smbls.${b}" is registered in context.components \u2014 element will render as a plain <div>. Register the base component or rename the key.`)}}(0,co.applyExtends)(n,t,i);const a=new Set(["childProps","attr","style","scope","data"]),u=n.props&&typeof n.props=="object"?n.props:null;for(const y in t){if(y==="parent"||y==="node"||y==="__ref"||y==="extends"||y==="context"||y==="props")continue;if(y==="key"){r&&(n.key=r);continue}const p=t[y],g=n[y],b=g&&p&&typeof g=="object"&&typeof p=="object"&&!Array.isArray(g)&&!Array.isArray(p)&&typeof g!="function"&&typeof p!="function";b&&y.charCodeAt(0)>=65&&y.charCodeAt(0)<=90?n[y]=it(g,p):b&&a.has(y)?n[y]={...g,...p}:b&&wt(y)?n[y]=it(g,p):n[y]=p}function d(y){for(const p in y){const g=y[p],b=n[p],S=b&&g&&typeof b=="object"&&typeof g=="object"&&!Array.isArray(b)&&!Array.isArray(g)&&typeof b!="function"&&typeof g!="function";S&&p.charCodeAt(0)>=65&&p.charCodeAt(0)<=90?n[p]=it(b,g):S&&a.has(p)?n[p]={...b,...g}:S&&wt(p)?n[p]=it(b,g):n[p]=g}}u&&d(u),t.props&&typeof t.props=="object"&&d(t.props),t.data!==void 0&&(n.data=t.data),t.classlist!==void 0&&(n.classlist=t.classlist),t.text!==void 0&&(n.text=t.text),t.html!==void 0&&(n.html=t.html);const f=n.scope&&typeof n.scope=="object"?n.scope:null,l=o?.scope,h=n.context&&typeof n.context.globalScope=="object"&&n.context.globalScope||null,_=l||h||null;if(t.scope!==void 0||f){const y={};f&&Object.assign(y,f),t.scope!==void 0&&Object.assign(y,t.scope),n.scope=(0,R.createScopeStore)(y,_)}else _&&(n.scope=_);if(t.if!==void 0&&(n.if=t.if),(0,fo.addMethods)(n),To(n,o,t),n.if!=null){let y;if(typeof n.if=="function")try{y=n.if(n,n.state,n.context)}catch(p){if(y=!1,c.__ifError=p,typeof console<"u"&&console.warn){const g=n.key||n.tag||"?";console.warn(`[smbls] \`if:\` evaluator threw on ${g} \u2014 treating as false:`,p?.message||p)}}else y=n.if;c.__if=!!y}if(c.__if)typeof n.if=="function"&&(c.__ifInitialized=!0);else return o&&(o[n.key]=n),typeof n.if=="function"&&zt(n,c,n.if),n;n.tag||(n.tag=(0,q.detectTag)(n)),N("Init",n,i);const x=n.node=(0,q.cacheNode)(n);if(!x)return n;if(n.tag==="fragment"){const p=(n.context?.document||globalThis.document).createComment("");x.appendChild(p),c.__fragmentAnchor=p}N("AttachNode",n,i),x.setAttribute&&n.key&&x.setAttribute("data-key",n.key),o&&(o[n.key]=n,o.__ref?.__children&&(o.__ref.__children.includes(n.key)||o.__ref.__children.push(n.key))),x.setAttribute&&n.context?.scopeSelector&&n.context.scopeSelector!==":root"&&n.context.key&&n.key===n.context.key&&x.setAttribute("data-smbls-app",n.context.key),n.id&&x.setAttribute&&(x.id=n.id),eo(n,i),Ht(n),Et(n),so(n),zo(n);try{ro(n,i)}catch(y){if(typeof console<"u"&&console.error){const p=n.__ref?.path?.join(".")||n.key||"<root>";console.error(`[smbls] createChildren failed at ${p}:`,y?.message||y,y?.stack?`
|
|
2
|
+
`+y.stack.split(`
|
|
3
3
|
`).slice(0,6).join(`
|
|
4
|
-
`):"")}}if(ht(o,!0),oo(o,e,n),typeof o.html=="function"&&o.node&&!o.node.innerHTML){const _=o.context?.designSystem;_&&(0,k.pushConfig)(_);try{const p=o.html(o,o.state,o.context);p!=null&&typeof p!="function"&&(o.node.innerHTML=p)}catch{}finally{_&&(0,k.popConfig)()}}if($("Create",o,r),$("Complete",o,r),$("Render",o,r),$("RenderRouter",o,r),St(o,r),typeof o.onFrame=="function"){const _=o.onFrame,p=o.context?.designSystem,h=()=>{if(o.node){if(o.node.isConnected){p&&(0,k.pushConfig)(p);try{_(o,o.state,o.context)}catch(b){console.error("[DOMQL] onFrame error:",b)}finally{p&&(0,k.popConfig)()}}requestAnimationFrame(h)}};requestAnimationFrame(h)}return o}function vo(t,e,s){const r=!e,n=s.state&&typeof s.state=="object"&&!Array.isArray(s.state)&&Object.keys(s.state).length===0,o=r&&n&&t.context?.state,i=s.state!==void 0&&!o?s.state:t.state&&!(0,R.isStore)(t.state)?t.state:void 0;if(i==null){if(e?.state)t.state=e.state,(0,m.applyStateMethods)(t,t.state);else if(t.context?.state){const a=t.context.state,c={...a},u=t.context?.polyglot;if(u?.translations){const d=t.context,f=a.lang||u.defaultLang||"en",l=new Set,y=(p,h)=>{l.has(p)||(0,H.isPolyglotWritableKey)(d,p,c)&&(c[p]=h,l.add(p),(0,H.markPolyglotSeeded)(d,p))},g=u.translations[f];if(g&&typeof g=="object")for(const p in g)y(p,g[p]);const _=new Set(u.languages||[]);for(const p in u.translations)_.has(p)||y(p,u.translations[p])}t.state=(0,R.isStore)(c)?c:(0,R.createStore)(c),t.state.__element=t,t.state.root=t.state,(0,m.applyStateMethods)(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),(0,m.applyStateMethods)(t,t.state);return}if(typeof i=="string"){if(t.state=Bt(i,e),t.state&&typeof t.state=="object"&&!(0,R.isStore)(t.state)){const a=e?.state?.root||e?.state||t.state;Object.defineProperty(t.state,"root",{value:a,enumerable:!1,configurable:!0,writable:!0})}(0,m.applyStateMethods)(t,t.state);return}if(typeof i=="function"){const a=i(t,e?.state);t.state=(0,R.isStore)(a)?a:(0,R.createStore)(a||{})}else(0,R.isStore)(i)?t.state=i:t.state=(0,R.createStore)({...i});t.state.__element=t,e?.state?(t.state.parent=e.state,t.state.root=e.state.root||e.state):t.state.root=t.state,(0,m.applyStateMethods)(t,t.state)}function wt(t,e){if(!e)return t;const s=e.split("/");let r=t;for(const n of s){if(r==null)return{};r=r[n]}return r??{}}function Bt(t,e){if(!e)return{};if(t===".")return e.state||{};if(t.startsWith("../")){const n=t.slice(3);return n?wt(e.state,n):e.state??{}}if(t.startsWith("~/")){const n=e.state?.root||e.state,o=t.slice(2);return o?wt(n,o):n??{}}if(e.state?.[t]!==void 0)return e.state[t];const s=wt(e.state,t);if(s!=null&&Object.keys(s).length>0)return s;const r=e.context?.polyglot;if(r?.translations){const n=e.state?.root?.lang||r.defaultLang||"en",o=r.translations[n];if(o?.[t]!==void 0)return o[t];if(r.translations[t]!==void 0)return r.translations[t]}return{}}const wo=new Set(["s","state","ctx","context"]);function jo(t){try{const s=Function.prototype.toString.call(t).match(/^[^(]*\(([^)]*)\)/);return s?s[1].split(",").map(r=>r.trim().split("=")[0].trim()).filter(Boolean):[]}catch{return[]}}function Eo(t){if(typeof t!="function"||t.length!==2)return!1;const e=jo(t);if(e.length<2)return!1;const s=e[1].replace(/[{}[\]]/g,"").trim();return s.length>0&&!wo.has(s)}function Po(t){const e=t.__ref,s=t.tag||"div",r=t.context?.designSystem,n=[],o=Object.keys(t);for(let i=0;i<o.length;i++){const a=o[i];if(typeof t[a]!="function"||U.REGISTRY.has(a))continue;const c=a.charCodeAt(0);c>=65&&c<=90||Y(a)||A.CSS_PROPS_REGISTRY[a]||A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(a)||(0,S.checkAttributeByTagName)(s,a)||((0,J.isLoudDevRuntime)()&&Eo(t[a])&&console.warn(`[smbls] custom prop "${a}"${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('${a}', \u2026) instead of reading el.${a}(\u2026) directly (see RULES.md Rule 8).`),n.push({prop:a,fn:t[a]}))}for(let i=0;i<n.length;i++){const{prop:a,fn:c}=n[i];e.__exec[a]=c,Object.defineProperty(t,a,{get(){r&&(0,k.pushConfig)(r);try{return c(t,t.state,t.context)}catch{return}finally{r&&(0,k.popConfig)()}},set(u){delete e.__exec[a],Object.defineProperty(t,a,{value:u,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function To(t,e){if(!(!Array.isArray(e)||e.length===0))for(let s=0;s<e.length;s++){const r=e[s];try{typeof r=="function"?r(t,t.state,t.context):typeof r=="string"&&t.state?.[r]}catch{}}}function O(t,e,s){return!Array.isArray(e)||e.length===0?s:function(...r){return To(t,e),s.apply(this,r)}}function ct(t,e){if(!(!t||Array.isArray(t)||typeof t!="object"))return t[e]}function T(t,e){return()=>t.path.join(".")+"::"+e}function Kt(t,e){const s=t.__ref,r=!!(e&&e.skipIfEffect);if(Po(t),typeof t.text=="function"){const o=t.text,i=O(t,t.textDeps,o),a=(0,E.createEffect)(()=>{if(!s.contentManaged)try{let c=i(t,t.state,t.context);t.node&&c!=null&&typeof c!="function"&&typeof c!="object"&&(typeof c=="string"&&c.includes("{{")&&(c=H.replaceLiteralsWithObjectFields.call(t,c,t.state)),at(t,c))}catch{}},{depth:s.path.length,label:T(s,"text")});s.__effects.push(a),s.__exec.text=o}else if(typeof t.text=="string"&&t.text.includes("{{")){const o=t.text,i=(0,E.createEffect)(()=>{if(s.contentManaged)return;const a=H.replaceLiteralsWithObjectFields.call(t,o,t.state);a!=null&&(t.text=a),t.node&&at(t,a??"")},{depth:s.path.length,label:T(s,"text")});s.__effects.push(i),s.__exec.text=o}for(const o of Object.keys(t))if(typeof t[o]=="function"&&!U.REGISTRY.has(o)&&!Y(o)&&!s.__exec[o]){if(A.CSS_PROPS_REGISTRY[o]){const i=t[o],a=O(t,t[o+"Deps"],i),c=o;let u,d=null,f=null,l;const y=(0,E.createEffect)(()=>{const g=t.context?.designSystem;g&&(0,k.pushConfig)(g);try{const _=a(t,t.state,t.context);(0,A.pushStaticCssPass)();let p;try{p=A.CSS_PROPS_REGISTRY[c](_,t,t.state,t.context)}finally{(0,A.popStaticCssPass)()}if(Array.isArray(p)){const b={};for(const x of p)if(x)for(const v in x)b[v]=x[v];p=b}const h=c==="show"||c==="hide";if(p&&t.node&&Do(p)){const b=lt(p);if(b===null||b!==l){l=b;const x=(0,G.css)(p,null,t.context?.cssPrefix),v=x?x.split(" ").filter(Boolean):null;if(t.node.classList){if(f)for(const C of f)t.node.classList.remove(C);if(v&&v.length)for(const C of v)t.node.classList.add(C);f=v}}u=void 0,d=null}else if(p&&t.node){if(f){for(const x of f)t.node.classList.remove(x);f=null,l=void 0}const b=lt(p);(b===null||b!==u||!yt(t.node,d))&&(u=b,Q(t.node,p),d=pt(t.node,p))}else if(t.node&&h){u=void 0,d=null;const b=s.__explicitDisplay;t.node.style.display=typeof b=="string"?b:""}}finally{g&&(0,k.popConfig)()}},{depth:s.path.length,label:T(s,c)});s.__effects.push(y),s.__exec[o]=i}else if(A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(o)){const i=t[o],a=O(t,t[o+"Deps"],i),c=o;let u,d=null;const f=(0,E.createEffect)(()=>{const l=t.context?.designSystem;l&&(0,k.pushConfig)(l);try{const y=a(t,t.state,t.context);if(t.node)if(y!=null){const g=c+":"+String(y);if(g!==u||!yt(t.node,d)){u=g;const _={[c]:y};Q(t.node,_),d=pt(t.node,_)}}else u=void 0,d=null,t.node.style[c]=""}finally{l&&(0,k.popConfig)()}},{depth:s.path.length,label:T(s,c)});s.__effects.push(f),s.__exec[o]=i}}if(typeof t.html=="function"){const o=t.html,i=O(t,t.htmlDeps,o),a=(0,E.createEffect)(()=>{const c=t.context?.designSystem;c&&(0,k.pushConfig)(c);try{const u=i(t,t.state,t.context);t.node&&u!=null&&typeof u!="function"&&(t.node.innerHTML=u)}finally{c&&(0,k.popConfig)()}},{depth:s.path.length,label:T(s,"html")});s.__effects.push(a),s.__exec.html=o}if(typeof t.value=="function"){const o=t.value,i=O(t,t.valueDeps,o),a=(0,E.createEffect)(()=>{try{const c=i(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const u=c==null?"":String(c);if(t.node.value===u)return;const d=typeof document<"u"&&document.activeElement===t.node,f=d&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,l=d&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=u,d&&f!=null&&l!=null)try{t.node.setSelectionRange(f,l)}catch{}}catch{}},{depth:s.path.length,label:T(s,"value")});s.__effects.push(a),s.__exec.value=o}if(typeof t.style=="function"){const o=t.style,i=O(t,t.styleDeps,o);let a,c=null;const u=(0,E.createEffect)(()=>{const d=i(t,t.state,t.context),f=lt(d);(f===null||f!==a||!yt(t.node,c))&&(a=f,Q(t.node,d),c=pt(t.node,d))},{depth:s.path.length,label:T(s,"style")});s.__effects.push(u),s.__exec.style=o}else if(t.style&&typeof t.style=="object")for(const o in t.style){const i=t.style[o];if(typeof i!="function")continue;const a=O(t,ct(t.styleDeps,o),i);let c,u=null;const d=(0,E.createEffect)(()=>{try{const f=a(t,t.state,t.context);if(t.node){const l=o+":"+String(f);if(l!==c||!yt(t.node,u)){c=l;const y={[o]:f};Q(t.node,y),u=pt(t.node,y)}}}catch{}},{depth:s.path.length,label:T(s,"style."+o)});s.__effects.push(d)}if(t.attr&&typeof t.attr=="object"){for(const o in t.attr)if(typeof t.attr[o]=="function"){const i=O(t,ct(t.attrDeps,o),t.attr[o]),a=o,c=(0,E.createEffect)(()=>{try{const u=i(t,t.state,t.context);t.node?.setAttribute&&(u==null||u===!1&&!(0,S.isEnumeratedTrueFalseAttr)(a)?t.node.removeAttribute(a):typeof u!="function"&&typeof u!="object"&&t.node.setAttribute(a,(0,S.serializeAttrValue)(a,u)))}catch{}},{depth:s.path.length,label:T(s,"attr."+a)});c._attrName=a.toLowerCase(),s.__effects.push(c)}}if(t.aria&&typeof t.aria=="object")for(const o in t.aria){if(typeof t.aria[o]!="function")continue;const i=O(t,ct(t.ariaDeps,o),t.aria[o]),a="aria-"+o.replace(/[A-Z]/g,u=>"-"+u.toLowerCase()),c=(0,E.createEffect)(()=>{try{const u=i(t,t.state,t.context);if(!t.node?.setAttribute)return;u==null?t.node.removeAttribute(a):typeof u!="function"&&typeof u!="object"&&t.node.setAttribute(a,(0,S.serializeAttrValue)(a,u))}catch{}},{depth:s.path.length,label:T(s,"aria."+o)});c._attrName=a,s.__effects.push(c)}if(t.data&&typeof t.data=="object")for(const o in t.data){if(typeof t.data[o]!="function")continue;const i=O(t,ct(t.dataDeps,o),t.data[o]),c="data-"+o.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),u=(0,E.createEffect)(()=>{try{const d=i(t,t.state,t.context);if(!t.node?.setAttribute)return;d==null||d===!1?t.node.removeAttribute(c):typeof d!="function"&&typeof d!="object"&&t.node.setAttribute(c,d===!0?"":d)}catch{}},{depth:s.path.length,label:T(s,"data."+o)});u._attrName=c,s.__effects.push(u)}const n=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(n)for(const o in n){if(typeof n[o]!="function")continue;const i=O(t,ct(t.classDeps,o),n[o]),a=(0,E.createEffect)(()=>{try{const c=i(t,t.state,t.context);if(!t.node?.classList)return;typeof c=="string"?t.node.classList.add(c):c?t.node.classList.add(o):t.node.classList.remove(o)}catch{}},{depth:s.path.length,label:T(s,"class."+o)});s.__effects.push(a)}!r&&typeof t.if=="function"&&Gt(t,s,t.if);for(const o of Object.keys(t)){if(U.REGISTRY.has(o)||typeof t[o]!="function")continue;const i=o.charCodeAt(0);if(i>=65&&i<=90||Y(o))continue;const a=t[o];s.__exec[o]=a;const c=t.tag||"div";if((0,S.checkAttributeByTagName)(c,o)&&!A.CSS_PROPS_REGISTRY[o]&&!(A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(o))){const u=(0,S.camelToAttr)(o)||o,d=O(t,t[o+"Deps"],a),f=(0,E.createEffect)(()=>{try{const l=d(t,t.state,t.context);t.node?.setAttribute&&(l==null||l===!1&&!(0,S.isEnumeratedTrueFalseAttr)(u)?t.node.removeAttribute(u):typeof l!="function"&&typeof l!="object"&&(u==="src"&&"src"in t.node?t.node.src=l:t.node.setAttribute(u,(0,S.serializeAttrValue)(u,l))))}catch{}},{depth:s.path.length,label:T(s,o)});f._attrName=u.toLowerCase(),s.__effects.push(f)}}if(Ro(t),No(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const o=t.onStateUpdate,i=t.stateDeps;let a=!1,c=[];const u=(0,E.createEffect)(()=>{const d=[];for(let g=0;g<i.length;g++){const _=i[g];try{d[g]=typeof _=="function"?_(t,t.state,t.context):t.state?.[_]}catch{d[g]=void 0}}if(!a){a=!0,c=d;return}let f=d.length!==c.length;for(let g=0;!f&&g<d.length;g++)d[g]!==c[g]&&(f=!0);const l=c;if(c=d,!f)return;const y=t.context?.designSystem;y&&(0,k.pushConfig)(y);try{o(t,t.state,t.context,{prev:l,next:d})}catch(g){if(t.context?.plugins?.length&&(0,K.runPluginHook)("error",t,{hook:"onStateUpdate",error:g})||console.error('[DOMQL] Lifecycle "onStateUpdate" error:',g),t.context?.strictMode)throw g}finally{y&&(0,k.popConfig)()}},{depth:s.path.length,label:T(s,"onStateUpdate")});s.__effects.push(u)}$o(t)}function Vt(t){const e=t.parent,s=e?.node;if(!s||!t.node){oo(t,t.parent);return}let r=null;const n=Object.keys(e),o=n.indexOf(t.key);for(let i=o+1;i<n.length;i++){const a=e[n[i]];if(a?.node?.parentNode===s){r=a.node;break}}r?s.insertBefore(t.node,r):s.appendChild(t.node)}function Gt(t,e,s){const r=O(t,t.ifDeps,s),n=(0,E.createEffect)(()=>{let o;try{o=r(t,t.state,t.context)}catch(a){if(o=!1,e.__ifError=a,typeof console<"u"&&console.warn){const c=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${c} \u2014 treating as false:`,a?.message||a)}return}const i=e.__if;if(e.__if=!!o,i&&!e.__if&&t.node){t.node.remove();try{typeof t.onRemove=="function"&&t.onRemove(t)}catch(a){console.error("[smbls] onRemove error:",a)}}else if(!i&&e.__if)if(e.__ifInitialized)t.node||(t.node=(0,q.cacheNode)(t)),t.node&&(t.node.ref=t),Vt(t),jt(t),$("Render",t,{}),St(t,{});else{if(e.__ifInitialized=!0,t.tag||(t.tag=(0,q.detectTag)(t)),$("Init",t,{}),t.node||(t.node=(0,q.cacheNode)(t)),!t.node)return;if(t.parent?.__ref?.__children&&!t.parent.__ref.__children.includes(t.key)&&t.parent.__ref.__children.push(t.key),t.tag==="fragment"&&!e.__fragmentAnchor){const c=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(c),e.__fragmentAnchor=c}$("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),mt(t,{}),Kt(t,{skipIfEffect:!0}),jt(t),Xt(t),to(t,{}),Vt(t),$("Create",t,{}),$("Complete",t,{}),$("Render",t,{}),$("RenderRouter",t,{}),St(t,{})}},{depth:e.path.length,label:T(e,"if")});e.__effects.push(n)}function at(t,e){const s=t.node;if(!s)return;const r=e==null||typeof e=="object"?"":String(e);if(t.tag==="string"){s.nodeValue!==r&&(s.nodeValue=r);return}const n=t.__ref;let o=n?n.__textNode:null;if(o&&o.parentNode!==s&&(o=null),!o){const i=s.firstChild;i&&i.nodeType===3&&(o=i)}o?o.nodeValue!==r&&(o.nodeValue=r):s.firstChild?(o=(s.ownerDocument||t.context?.document||globalThis.document).createTextNode(r),s.insertBefore(o,s.firstChild)):(s.textContent=r,o=s.firstChild&&s.firstChild.nodeType===3?s.firstChild:null),n&&(n.__textNode=o||null)}function jt(t){const{node:e}=t;if(e){if((typeof t.text=="string"&&!t.text.includes("{{")||typeof t.text=="number")&&at(t,t.text),Io(t),typeof t.html=="string"&&(e.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&"value"in e){const s=String(t.value);e.value!==s&&(e.value=s)}if(t.style&&typeof t.style=="object"){let s=t.style;for(const r in t.style)if(typeof t.style[r]=="function"){s={};for(const n in t.style)typeof t.style[n]!="function"&&(s[n]=t.style[n]);break}Q(e,s)}if(t.attr&&typeof t.attr=="object")for(const s in t.attr){const r=t.attr[s];typeof r=="function"||typeof r=="object"||r!=null&&(r===!1&&!(0,S.isEnumeratedTrueFalseAttr)(s)||e.setAttribute&&e.setAttribute(s,(0,S.serializeAttrValue)(s,r)))}if(t.data&&typeof t.data=="object")for(const s in t.data){const r=t.data[s];typeof r=="function"||typeof r=="object"||r==null||r===!1||e.dataset&&(e.dataset[s]=r===!0?"":r)}if(t.classlist||t.class){const s=t.classlist||t.class;if(typeof s=="string")s.split(" ").forEach(r=>r&&e.classList.add(r));else if(typeof s=="object")for(const r in s){const n=typeof s[r]=="function"?s[r](t,t.state,t.context):s[r];n&&e.classList.add(typeof n=="string"?n:r)}}}}function lt(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function Do(t){if(!t||typeof t!="object")return!1;for(const e in t){const s=t[e];if(s&&typeof s=="object"&&!Array.isArray(s))return!0}return!1}function pt(t,e){if(!t||!t.style||!e)return null;const s=[];for(const r in e){if(e[r]==null||r.charAt(0)==="&")continue;const o=r.replace(/[A-Z]/g,i=>"-"+i.toLowerCase());s.push(o,t.style.getPropertyValue(o),t.style.getPropertyPriority(o))}return s}function yt(t,e){if(!e||!t||!t.style)return!1;for(let s=0;s<e.length;s+=3)if(t.style.getPropertyValue(e[s])!==e[s+1]||t.style.getPropertyPriority(e[s])!==e[s+2])return!1;return!0}function Q(t,e){if(!t||!e||!t.style)return;let s=null;for(const r in e){const n=e[r];if(n!=null){if(r.charAt(0)==="&"&&typeof n=="object"){s||(s={}),s[r]=n;continue}try{const o=String(n),i=r.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),a=o.trim(),c=/\s*!important\s*$/.test(a),u=a.replace(/\s*!important\s*$/,"");t.style.setProperty(i,u,c?"important":"")}catch{}}}s&&Lo(t,s)}function Lo(t,e){const s=`_ds${Nt.scopedStyleId++}`;t.classList.add(s);const r=t.ownerDocument;let n=r.querySelector("style[data-smbls-scoped]");n||(n=r.createElement("style"),n.setAttribute("data-smbls-scoped",""),r.head.appendChild(n));let o="";for(const i in e){const a="."+s,c=i.replace(/&/g,a).split(",").map(d=>{const f=d.trim();return f.includes(a)?f:a+f}).join(", "),u=e[i];if(typeof u=="object"){let d="",f="";for(const l in u){const y=u[l];if(typeof y=="object"){const g=l.includes("&")?c.split(", ").map(p=>l.replace(/&/g,p)).join(", "):c.split(", ").map(p=>`${p} ${l}`).join(", ");let _="";for(const p in y)_+=`${p.replace(/[A-Z]/g,h=>"-"+h.toLowerCase())}: ${y[p]};`;f+=(0,G.wrapHoverRule)(`${g} { ${_} }`,g)+`
|
|
5
|
-
`}else d+=`${l.replace(/[A-Z]/g,
|
|
6
|
-
`),f&&(o+=f)}}o&&(n.textContent+=o)}const Ht=new Set;function Wt(t){if(!Array.isArray(t))return"";const e=[];for(let s=0;s<t.length;s++)typeof t[s]=="string"&&t[s].length&&e.push(t[s]);return e.sort(),e.join("|")}function Oo(t,e,s){const r=Wt(s);queueMicrotask(()=>{if(!t.__ref)return;let n;try{n=e(t,t.state,t.context)}catch{return}if(Wt(n)===r)return;const o=t.__ref.path?t.__ref.path.join("."):t.key||"?";Ht.has(o)||(Ht.add(o),console.warn(`[smbls] subscribeTo function at "${o}" resolved to a DIFFERENT key list one microtask after create \u2014 wired [${s.join(", ")||"(none)"}], probed [${Array.isArray(n)?n.join(", "):String(n)}]. subscribeTo's function form is resolved ONCE at element-create time (registerSubscribeToEffects, @symbo.ls/element create.js) \u2014 this element stays wired to the ORIGINAL list for its whole lifetime, so this drift is invisible to the reactive effect and any key only present in the new list will never trigger onUpdate. If the watched key genuinely is not known until later (e.g. a module config that loads after shell boot), route the write through an imperative call instead of subscribeTo \u2014 see functions/moduleOpenBridge.js's moduleOpenPage (workspace repo) for the house pattern.`))})}function Ro(t){const e=t.subscribeTo,s=typeof e=="function";let r=e;if(s)try{r=e(t,t.state,t.context)}catch{r=null}if(s&&(0,J.isLoudDevRuntime)()&&Oo(t,e,Array.isArray(r)?r:[]),!Array.isArray(r)||r.length===0)return;const n=t.__ref;for(let o=0;o<r.length;o++){const i=r[o];if(typeof i!="string"||i.length===0)continue;const a=i.split("."),c=a[0],u=a.slice(1),d={value:!1},f=(0,E.createEffect)(()=>{const l=t.state&&((0,R.isStore)(t.state)?t.state.root:null);if(!l||!(0,R.isStore)(l))return;let y=l;y=y[c];for(let _=0;_<u.length&&!(y==null||typeof y!="object");_++)if((0,R.isStore)(y))y=y[u[_]];else break;if(!d.value)return;let g=!1;if(typeof t.onBeforeUpdate=="function"){const _=t.context?.designSystem;_&&(0,k.pushConfig)(_);try{if(io(n)){const p=t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0});p&&typeof p.then=="function"?p.then(()=>ut(n,!1),h=>{ut(n,!0),t.context?.plugins?.length&&(0,K.runPluginHook)("error",t,{hook:"onBeforeUpdate",error:h})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",h)}):(ut(n,!1),p===!1&&(g=!0))}}catch(p){ut(n,!0),t.context?.plugins?.length&&(0,K.runPluginHook)("error",t,{hook:"onBeforeUpdate",error:p})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",p)}finally{_&&(0,k.popConfig)()}}if(!g&&t.node&&n.__effects)for(let _=0;_<n.__effects.length;_++){const p=n.__effects[_];p&&p!==f&&!p._disposed&&!p._isSubscribeToEffect&&typeof p._execute=="function"&&p._execute()}if(!g&&typeof t.onUpdate=="function"){const _=t.context?.designSystem;_&&(0,k.pushConfig)(_);try{t.onUpdate(t,t.state,t.context)}catch(p){t.context?.plugins?.length&&(0,K.runPluginHook)("error",t,{hook:"onUpdate",error:p})||console.error("[DOMQL] subscribeTo onUpdate error:",p)}finally{_&&(0,k.popConfig)()}}},{depth:n.path.length,label:T(n,"subscribeTo("+i+")")});d.value=!0,f._isSubscribeToEffect=!0,n.__effects.push(f)}}function Et(t,e){return t.charCodeAt(0)===64&&t.length>1&&!t.startsWith("@media")&&!t.startsWith("@keyframes")&&!t.startsWith("@supports")&&!t.startsWith("@container")&&(t==="@dark"||t==="@light"||!e.context?.designSystem?.media?.[t.slice(1)])}function Pt(t,e){if(t.charCodeAt(0)!==64||/^@(media|supports|container|keyframes)\b/.test(t))return t;const s=e.context?.designSystem?.media?.[t.slice(1)];return s?/^@(media|supports|container)\b/.test(s)?s:`@media ${s}`:t}const zt=new Set;function Mo(t,e){const s=e?.__ref?.path?e.__ref.path.join("."):e?.key||"?",r=s+"::"+t;zt.has(r)||(zt.add(r),console.warn(`[smbls/css] "${t}" at ${s} is a CHILD-COMPONENT key nested inside a pseudo/selector block (":hover", "@dark", etc.) \u2014 that is never a valid CSS selector fragment. The rule is DROPPED (not shipped as a dead/never-matching selector). To reveal a child on a parent state, target the child's OWN class from the parent selector instead, e.g. move the declaration onto the child element itself, or use a sibling-selector combinator in a top-level style block.`))}function X(t,e,s){const r={},n=new Set,o=(i,a,c)=>{const u=c?new Set(Object.keys(r)):null;if(A.CSS_PROPS_REGISTRY[i]){const d=A.CSS_PROPS_REGISTRY[i](a,e,e.state,e.context);if(d){const f=Array.isArray(d)?d:[d];for(const l of f)l&&Object.assign(r,l)}}else r[i]=a;if(c)for(const d in r)u.has(d)||n.add(d)};for(const i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;let a=t[i];if(typeof a=="function"&&(a=a(e,e.state,e.context)),a==null||typeof a=="function")continue;if(typeof a=="object"&&!Array.isArray(a)){if(i==="style"){for(const f in a){let l=a[f];if(typeof l=="function"&&(l=l(e,e.state,e.context)),l==null||typeof l=="function")continue;const y=typeof e[f]=="function"&&(A.CSS_PROPS_REGISTRY[f]||A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(f));o(f,l,y)}continue}if(Et(i,e)){const f=X(a,e,!1);Object.keys(f).length&&(r[`[data-theme="${i.slice(1)}"] &`]=f);continue}if(/^[A-Z][A-Za-z0-9]*$/.test(i)){(0,J.isLoudDevRuntime)()&&Mo(i,e);continue}const u=Pt(i,e),d=X(a,e,!1);Object.keys(d).length&&(r[u]=d);continue}const c=typeof e[i]=="function"&&(A.CSS_PROPS_REGISTRY[i]||A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(i));o(i,a,c)}if(s)for(const i in r)n.add(i);for(const i of n){const a=r[i];typeof a=="string"&&!a.includes("!important")&&(r[i]=a+" !important")}return r}function Tt(t,e){if(e===void 0&&(e=0),e>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)&&Tt(t[s],e+1))return!0}return!1}function Yt(t,e,s){if(!e||typeof e!="object"||Array.isArray(e))return null;if(Et(t,s)){const o=X(e,s,!1);return Object.keys(o).length?{cssProp:`[data-theme="${t.slice(1)}"] &`,block:o}:null}const r=Pt(t,s),n=X(e,s,!1);return Object.keys(n).length?{cssProp:r,block:n}:null}function $o(t){const e=t.__ref;for(const s of Object.keys(t)){if(!vt(s))continue;const r=t[s];if(!r||typeof r!="object"||Array.isArray(r)||!Tt(r))continue;let n=null,o;const i=(0,E.createEffect)(()=>{if(!t.node)return;const a=t.context?.designSystem;a&&(0,k.pushConfig)(a);let c,u=!1;try{const d=Yt(s,r,t),f=d?lt(d.block)+"::"+d.cssProp:null;if(f!==null&&f===o)u=!0;else if(o=f,d){const l=(0,G.css)({[d.cssProp]:d.block},null,t.context?.cssPrefix);c=l?l.split(" ").filter(Boolean):null}else c=null}finally{a&&(0,k.popConfig)()}if(!(u||!t.node.classList)){if(n)for(const d of n)t.node.classList.remove(d);if(c&&c.length)for(const d of c)t.node.classList.add(d);n=c}},{depth:e.path.length,label:T(e,"cssBlock("+s+")")});e.__effects.push(i)}}function No(t){const e=t.__ref;e.__conditionalRunners=[];const s=new Map;for(const r of Object.keys(t)){const n=r.charAt(0);if(n!=="."&&n!=="!")continue;const o=r.slice(1);if(!o)continue;if(/[:@\s>~+[\]]/.test(o)){if(typeof console<"u"&&console.warn){const y=o.split(/[:@\s>~+[\]]/)[0];console.warn(`[smbls] conditional \`${r}\` on ${t.key||"?"} will never match \u2014 the whole string after \`${n}\` is read as one prop name. Nest the selector inside instead: \`${n}${y}: { '${o.slice(y.length)}': {...} }\`.`)}continue}const i=t[r];if(!i||typeof i!="object")continue;const a=n==="!",c={lastMatch:!1,appliedKeys:null,appliedClasses:null},u=()=>{let y;const g=t[o];if(g===void 0){const h=!!t.state&&o in t.state,b=t.state?t.state[o]:void 0;if(h||b!==void 0)y=b;else{const x=t.context?.cases?.[o];if(x===void 0)return;try{y=typeof x=="function"?x.call(t,t):x}catch(v){y=!1,e.__conditionalError=v,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${r}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,v?.message||v)}}}else if(typeof g=="function")try{y=g(t,t.state,t.context)}catch(h){y=!1,e.__conditionalError=h,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${r}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,h?.message||h)}else y=g;const _=a?!y:!!y;if(!t.node||_===c.lastMatch)return;c.lastMatch=_;const p=t.context?.designSystem;p&&(0,k.pushConfig)(p);try{if(_){const h={},b={};let x=!1;for(const C in i){if(!Object.prototype.hasOwnProperty.call(i,C))continue;const P=i[C],z=C.charAt(0);if((z===":"||z==="@"||z==="&"||z==="[")&&P&&typeof P=="object"&&!Array.isArray(P)){if(Et(C,t)){const D=X(P,t,!1);Object.keys(D).length&&(b[`[data-theme="${C.slice(1)}"] &`]=D,x=!0)}else{const D=Pt(C,t),L=X(P,t,!1);Object.keys(L).length&&(b[D]=L,x=!0)}continue}const ot=typeof P=="function"?P(t,t.state,t.context):P;if(ot!=null)if(A.CSS_PROPS_REGISTRY[C]){const D=A.CSS_PROPS_REGISTRY[C](ot,t,t.state,t.context);if(D){const L=Array.isArray(D)?D:[D];for(const st of L)st&&Object.assign(h,st)}}else A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(C)&&(h[C]=ot)}const v=Object.keys(h);if(v.length){Q(t.node,h);for(const C of v)s.set(C,r);c.appliedKeys=v}else c.appliedKeys=null;if(x){const C=(0,G.css)(b,null,t.context?.cssPrefix),P=C?C.split(" ").filter(Boolean):[];if(P.length&&t.node.classList){for(const z of P)t.node.classList.add(z);c.appliedClasses=P}else c.appliedClasses=null}else if(c.appliedClasses){for(const C of c.appliedClasses)t.node.classList.remove(C);c.appliedClasses=null}}else{if(c.appliedKeys){for(const h of c.appliedKeys)s.get(h)===r&&(t.node.style[h]="",s.delete(h));c.appliedKeys=null}if(c.appliedClasses){for(const h of c.appliedClasses)t.node.classList.remove(h);c.appliedClasses=null}}}finally{p&&(0,k.popConfig)()}};e.__conditionalRunners.push(u);const d=O(t,t[o+"Deps"],u),f=(0,E.createEffect)(d,{depth:e.path.length,label:T(e,"conditional("+r+")")}),l=e.__exec&&e.__exec[o]||t[o];f._sources.size===0&&typeof l=="function"&&(0,J.isLoudDevRuntime)()&&console.warn(`[smbls] conditional \`${r}\` on ${t.key||"?"} subscribed to nothing \u2014 its predicate tracked no reactive read on its first run, so no state write will ever re-evaluate it (only a direct element.update() on this element re-runs it). If the predicate guards its state reads (\`in\`, short-circuits, \`?.\`), declare \`${o}Deps: [...]\` (state-key strings or \`(el, s) => \u2026\` selectors) so the subscription is armed unconditionally.`),e.__effects.push(f)}}const Dt=new WeakSet;function Fo(t){const e=t.ownerDocument;!e||Dt.has(e)||(Dt.add(e),queueMicrotask(()=>{Dt.delete(e);const s=e.body||e.documentElement;s&&s.offsetWidth}))}const Lt=new WeakSet;let qt=!1;function Zt(t){return t.startsWith("[data-theme=")||t.startsWith("@media")&&t.includes("prefers-color-scheme")}function Ot(t,e){const s={...t};for(const r in e){const n=e[r],o=s[r];s[r]=n&&typeof n=="object"&&o&&typeof o=="object"?Ot(o,n):n}return s}function Qt(t,e){const s={};for(const r in t){const n=t[r];if(n&&typeof n=="object"){const o=Qt(n,e);Object.keys(o).length&&(s[r]=o)}else e.has(r)||(s[r]=n)}return s}function Io(t){const{node:e}=t;if(!e)return;if(qt||(qt=!0,(0,G.css)({display:"none"})),Lt.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}Lt.add(t);const s=t.context?.designSystem;s&&(0,k.pushConfig)(s),(0,A.pushStaticCssPass)();try{const r={};let n=!1,o=null,i=null,a=null;const c=(u,d)=>{if(d&&typeof d=="object"&&Zt(u)){i||(i={});const f=i[u];f&&(d=Ot(f,d)),i[u]=d}else(d===null||typeof d!="object")&&(a||(a=new Set),a.add(u));r[u]=d};if(Object.prototype.hasOwnProperty.call(t,"theme")&&typeof t.theme!="function"&&A.CSS_PROPS_REGISTRY.theme){const u=A.CSS_PROPS_REGISTRY.theme(t.theme,t,t.state,t.context);if(u){const d=f=>{for(const l in f){const y=f[l];y&&typeof y=="object"&&Zt(l)&&(o||(o={}),o[l]=y),r[l]=y}};if(Array.isArray(u))for(const f of u)f&&d(f);else d(u);n=!0}}for(const u of Object.keys(t)){if(typeof t[u]=="function"||U.REGISTRY.has(u)||u==="theme")continue;const d=u.charCodeAt(0);if(!(d>=65&&d<=90)&&!Y(u)){if(A.CSS_PROPS_REGISTRY[u]){const f=t[u],l=A.CSS_PROPS_REGISTRY[u](f,t,t.state,t.context);if(l){if(Array.isArray(l)){for(const y of l)if(y)for(const g in y)c(g,y[g])}else for(const y in l)c(y,l[y]);n=!0}}else if(A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(u)){const f=t[u];f!=null&&typeof f!="object"&&(c(u,f),n=!0)}else if(u.charCodeAt(0)===45){const f=t[u];f!=null&&typeof f!="object"&&(c(u,f),n=!0)}else if(u.charAt(0)==="&"||u.charAt(0)==="@"||u.charAt(0)===":"||u.charAt(0)==="["){const f=t[u];if(f&&typeof f=="object"&&!Array.isArray(f)){if(Tt(f))continue;const l=Yt(u,f,t);l&&(c(l.cssProp,l.block),n=!0)}}}}if(o)for(const u in o){let d=a?Qt(o[u],a):o[u];i&&i[u]&&(d=Ot(d,i[u])),Object.keys(d).length?r[u]=d:delete r[u]}if(n){r.display&&String(r.display).includes("!important")&&(e.style.setProperty("display",String(r.display).replace(/\s*!important\s*$/,""),"important"),delete r.display);const u=(0,G.css)(r,null,t.context?.cssPrefix);if(u&&e.classList){const f=u.split(" ").filter(Boolean);let l=!1;for(const y of f)e.classList.add(y),l||(y.charCodeAt(0)===95&&y.charCodeAt(1)===99||y.charCodeAt(0)===95&&y.indexOf("_c",1)!==-1)&&(l=!0);l&&Fo(e)}const d=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(d!=null){const f=r.display;if(f&&f!==d)if(d==="none"){const l=[];for(const y of e.classList)y.startsWith("_d-")&&y!=="_d-none"&&l.push(y);for(const y of l)e.classList.remove(y);e.classList.add("_d-none")}else e.style.display==="none"&&(typeof t.hide=="function"||typeof t.show=="function")||(e.style.display=t.display),t.__ref&&(t.__ref.__explicitDisplay=t.display)}}}finally{(0,A.popStaticCssPass)(),s&&(0,k.popConfig)(),Lt.delete(t)}}function Xt(t){const{node:e}=t;if(!e||!e.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const n in t.aria){const o=t.aria[n];if(typeof o=="function"||typeof o=="object"||o==null)continue;const i="aria-"+n.replace(/[A-Z]/g,a=>"-"+a.toLowerCase());e.setAttribute(i,(0,S.serializeAttrValue)(i,o))}const s=(0,S.applyAttrTransforms)(t);for(const n in s){const o=s[n];o!=null&&o!==!1&&typeof o!="function"&&typeof o!="object"&&e.setAttribute(n,o===!0?"":o)}const r=t.tag||"div";for(const n of Object.keys(t)){if(typeof t[n]=="function"||U.REGISTRY.has(n)||n==="on"||s[n]!==void 0)continue;const o=n.charCodeAt(0);if(!(o>=65&&o<=90)&&!Y(n)&&!(A.CSS_PROPS_REGISTRY[n]||A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(n))&&(0,S.checkAttributeByTagName)(r,n)){let i=t[n];if(i==null||(typeof i=="string"&&i.includes("{{")&&(i=(0,H.replaceLiteralsWithObjectFields)(i,t,t.state,t.context),t[n]=i),i==null||typeof i=="function"||typeof i=="object")||i===!1&&!(0,S.isEnumeratedTrueFalseAttr)((0,S.camelToAttr)(n)||n))continue;const a=(0,S.camelToAttr)(n)||n;e.setAttribute(a,(0,S.serializeAttrValue)(a,i))}}}function Uo(t,e){const{node:s}=t;if(!s||!s.setAttribute)return;const r=e.charCodeAt(0);if(r>=65&&r<=90||Y(e)||A.CSS_PROPS_REGISTRY[e]||A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(e)||!(0,S.checkAttributeByTagName)(t.tag||"div",e))return;const n=(0,S.camelToAttr)(e)||e,o=n.toLowerCase(),i=t.__ref&&t.__ref.__effects;let a=!1;if(i)for(let d=0;d<i.length;d++){const f=i[d];f&&f._attrName===o&&!f._disposed&&typeof f._execute=="function"&&(a=!0,f._execute())}if(a)return;let c=t[e];const u=S.ATTR_TRANSFORMS[e];if(u&&c!=null){const d=u(t);d!==void 0&&(c=d)}typeof c=="string"&&c.includes("{{")&&(c=(0,H.replaceLiteralsWithObjectFields)(c,t,t.state,t.context)),c==null||c===!1&&!(0,S.isEnumeratedTrueFalseAttr)(n)?s.removeAttribute(n):typeof c!="function"&&typeof c!="object"&&s.setAttribute(n,(0,S.serializeAttrValue)(n,c))}function Bo(t,e){const s=t.node,r=t.__ref;let n=r.__autoGrow;if(!e){if(n&&n.active){try{s.removeEventListener("input",n.resize)}catch{}s.style.height="",n.appliedMax!=null&&s.style.maxHeight===n.appliedMax&&(s.style.maxHeight=""),n.active=!1,n.appliedMax=null,n.lastMeasure=0}return}n||(n=r.__autoGrow={active:!1,appliedMax:null,lastMeasure:0,resize:()=>{if(s.scrollHeight===0&&n.lastMeasure>0)return;s.style.height="auto";const i=s.scrollHeight;s.style.height=i+"px",i>0&&(n.lastMeasure=i)}},r.__eventCleanup||(r.__eventCleanup=[]),r.__eventCleanup.push(()=>{try{s.removeEventListener("input",n.resize)}catch{}})),n.active||(s.addEventListener("input",n.resize),n.active=!0);const o=typeof e=="object"&&e.max!=null?String(e.max):null;o!==n.appliedMax&&(o==null?n.appliedMax!=null&&s.style.maxHeight===n.appliedMax&&(s.style.maxHeight=""):s.style.maxHeight=o,n.appliedMax=o),n.resize()}function Ko(t){if(!t.autoGrow)return;const e=t.node;if(!e||e.tagName!=="TEXTAREA")return;const s=t.__ref,r=t.autoGrow,n=typeof r=="function"?O(t,t.autoGrowDeps,r):null,o=(0,E.createEffect)(()=>{const i=t.autoGrow;let a=i;if(typeof i=="function")try{a=(i===r&&n?n:i)(t,t.state,t.context)}catch{a=null}Bo(t,a)},{depth:s.path.length,label:T(s,"autoGrow")});s.__effects||(s.__effects=[]),s.__effects.push(o),n&&(s.__exec.autoGrow=r)}const Jt=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function mt(t,e){for(const s of Object.keys(t)){if(!Y(s)||Jt.has(s))continue;const r=(0,tt.globalEventKeyInfo)(s);if(r){(0,tt.registerGlobalEvent)(r,t,t[s]);continue}let n=t[s];if(typeof n=="string"&&/^[A-Za-z_$][\w$]*$/.test(n)){const i=n;n=function(c){return t.call(i,c)}}if(typeof n!="function")continue;const o=ko(s);U.LIFECYCLE_EVENTS.has(o)||(0,tt.registerEvent)(So(o),t,n)}Vo(t)}function Vo(t){const e=t.node;if(!e||!e.addEventListener)return;const s={};let r=!1;for(const l of Jt){const y=t[l];typeof y=="function"&&(s[l]=y,r=!0)}if(!r)return;const n=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,o=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let i=0,a=0,c=0,u=!1;const d=l=>{const y=l.touches&&l.touches[0]||l.changedTouches&&l.changedTouches[0];y&&(i=y.clientX,a=y.clientY,c=Date.now(),u=!0)},f=l=>{if(!u)return;u=!1;const y=l.changedTouches&&l.changedTouches[0]||l.touches&&l.touches[0];if(!y)return;const g=y.clientX-i,_=y.clientY-a,p=Date.now()-c;if(p>o)return;const h=Math.abs(g),b=Math.abs(_);if(Math.max(h,b)<n)return;let x;if(h>b*1.2)x=g<0?"left":"right";else if(b>h*1.2)x=_<0?"up":"down";else return;const v="onSwipe"+x.charAt(0).toUpperCase()+x.slice(1),C=s[v],P=s.onSwipe;C&&C.call(t,l,t,t.state,t.context),P&&P.call(t,{direction:x,dx:g,dy:_,dt:p,event:l},t,t.state,t.context)};e.addEventListener("touchstart",d,{passive:!0}),e.addEventListener("touchend",f,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{e.removeEventListener("touchstart",d)}catch{}try{e.removeEventListener("touchend",f)}catch{}})}function ft(t,e){const s={...t};for(const r in e){const n=s[r],o=e[r];n&&o&&typeof n=="object"&&typeof o=="object"&&!Array.isArray(n)&&!Array.isArray(o)&&typeof n!="function"&&typeof o!="function"?s[r]=ft(n,o):s[r]=o}return s}function Rt(t,e,s,r){if(!e||!t.node)return;const n=t.childExtends;if(Array.isArray(e)){const o=t.tag==="fragment",i=t.context?.document||globalThis.document,a=o?null:i?.createDocumentFragment();if(!o&&!a)return;const c=t.childProps,u=t.childrenAs,d=p=>{let h=e[p];const b=h;(typeof h=="string"||typeof h=="number")&&(h={text:h});let x=c;if(typeof c=="function")try{x=c(t,h)}catch{x=null}if(u==="state"){let C=b;(typeof b=="string"||typeof b=="number")&&(C={value:b,text:b}),h=x?{...x,state:C}:{state:C}}else x&&(h=ft(x,h));if(n&&!h.ignoreChildExtends)if(h.extends){const C=Array.isArray(h.extends)?h.extends:[h.extends],P=Array.isArray(n)?n:[n];h={...h,extends:[...P,...C]}}else h={...h,extends:n};const v=h?.key||b&&typeof b=="object"&&b.key||`${p}`;try{return W(h,t,v,s)}catch(C){if(typeof console<"u"&&console.error){const P=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${v}" failed to construct at ${P} (initial render, skipping this row):`,C?.message||C)}return null}},f=t.__ref;if(!(r===!0&&!o&&!!f&&(s?.mountYield===!0||t.yieldChildren===!0))){for(let p=0;p<e.length;p++){const h=d(p);!o&&h?.node&&a.appendChild(h.node)}return o||t.node.appendChild(a),!0}const y=f.__childrenChunkGen=(f.__childrenChunkGen||0)+1;(0,I.openMountBudget)();let g=null;const _=p=>{if(f.__disposed||f.__childrenChunkGen!==y){g&&g.parentNode&&g.remove();return}for(let h=p;h<e.length;h++){const b=d(h);if(b?.node&&(g?t.node.insertBefore(b.node,g):a.appendChild(b.node)),h+1<e.length&&(0,I.mountBudgetExhausted)()){g||(g=i.createComment("smbls-mount"),a.appendChild(g),t.node.appendChild(a));const x=h+1;(0,I.enqueueMountWork)(()=>_(x));return}}g?(g.remove(),t.node.tagName==="SELECT"&&ht(t,!0)):t.node.appendChild(a)};return _(0),(0,I.closeMountBudget)(),!0}if(typeof e=="string"){const o=Bt(e,t);if(Array.isArray(o))return Rt(t,o,s,r)}if(typeof e=="object")for(const o in e){if(U.REGISTRY.has(o))continue;let i=e[o];if(!(i==null||i===!1)){if((typeof i=="string"||typeof i=="number")&&(i={text:i}),t.childProps&&(i=ft(t.childProps,i)),n&&!i.ignoreChildExtends)if(i.extends){const a=Array.isArray(i.extends)?i.extends:[i.extends],c=Array.isArray(n)?n:[n];i={...i,extends:[...c,...a]}}else i={...i,extends:n};W(i,t,o,s)}}}function ht(t,e){const s=t.node;if(!s||s.tagName!=="SELECT")return;const r=s.options;if(!r||!r.length)return;const n=t.__ref,o=n&&n.__exec&&n.__exec.value,i=typeof o=="function",a=t.value!=null&&typeof t.value!="function";if(i||a){let d;if(i)try{d=o(t,t.state,t.context)}catch{return}else d=t.value;const f=d==null?"":String(d);s.value!==f&&(s.value=f);return}const c=e||!(n&&n.__selectSynced);if(n&&(n.__selectSynced=!0),!c)return;let u=-1;for(let d=0;d<r.length;d++)r[d].defaultSelected&&(u=d);u>=0&&s.selectedIndex!==u&&(s.selectedIndex=u)}function to(t,e){let{children:s,content:r}=t;const n=t.childExtends;if(typeof s=="function"){const f=s;try{s=f(t,t.state,t.context)}catch(p){if(s=void 0,typeof console<"u"&&console.error){const h=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${h} (initial run, treating as empty):`,p?.message||p)}}t.children=s;const l=t.__ref;let y=!1;const g=O(t,t.childrenDeps,f),_=(0,E.createEffect)(()=>{const p=y;y=!0;let h;try{h=g(t,t.state,t.context)}catch(D){if(typeof console<"u"&&console.error){const L=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${L}${p?"":" (initial tracking run)"}:`,D?.message||D)}return}if(!p||h===t.children)return;t.children=h,l.__childrenChunkGen!=null&&l.__childrenChunkGen++;const b=typeof t.onContentUpdate=="function",x=b?[]:null,v=b?[]:null,C=b?[]:null;if(Array.isArray(h)&&t.childrenAs==="state"){const D=t.childProps,L=[],st=new Map;for(let w=0;w<h.length;w++){const N=h[w];let j=D;if(typeof D=="function")try{j=D(t,N)}catch{j=null}const V=j&&j.key||N&&N.key||`${w}`;L.push(V),st.set(V,{rawChild:N,childProps:j})}const co=new Set(L),fo=l.__children.slice();for(const w of fo)if(!co.has(w)){const N=t[w];N?.remove&&N.remove(),delete t[w],v&&v.push(w)}const et=t.childExtends,dt=t.tag==="fragment",ao=t.context?.document||globalThis.document,nt=dt?null:ao?.createDocumentFragment(),bt=new Set;for(const w of L){const N=st.get(w),j=N.rawChild,V=t[w];if(V&&V.state){if(j&&typeof j=="object"){const M=V.state,Z=M.$replace||M.replace,$t=M.$update||M.update;try{if(typeof Z=="function")Z.call(M,j);else if(typeof $t=="function"){for(const F in M)if(!(F==="__element"||F==="root"||F==="parent"||F==="update")&&!Object.prototype.hasOwnProperty.call(j,F))try{M[F]=void 0}catch{}$t.call(M,j)}else for(const F in j)M[F]=j[F]}catch(F){if(typeof console<"u"&&console.error){const uo=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${w}" failed to patch at ${uo} (reconcile, keeping its previous data for this pass):`,F?.message||F)}}}C&&C.push(w);continue}let xt=j;(typeof j=="string"||typeof j=="number")&&(xt={value:j,text:j});const Mt=N.childProps;let B=Mt?{...Mt,state:xt}:{state:xt};if(et&&!B.ignoreChildExtends)if(B.extends){const M=Array.isArray(B.extends)?B.extends:[B.extends],Z=Array.isArray(et)?et:[et];B={...B,extends:[...Z,...M]}}else B={...B,extends:et};let At;try{At=W(B,t,w,e)}catch(M){if(typeof console<"u"&&console.error){const Z=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${w}" failed to construct at ${Z} (reconcile, skipping this row):`,M?.message||M)}bt.add(w);continue}!dt&&At?.node&&nt&&nt.appendChild(At.node),x&&x.push(w)}if(!dt&&nt&&nt.childNodes.length&&t.node&&t.node.appendChild(nt),!dt&&t.node){let w=null;for(const N of L){const j=t[N]?.node;if(!j)continue;const V=w?w.nextSibling:t.node.firstChild;j!==V&&t.node.insertBefore(j,V),w=j}}l.__children=bt.size?L.filter(w=>!bt.has(w)):L,b&&(x.length||v.length)&&Ut(t,{added:x,removed:v,kept:C}),ht(t,!1);return}const ot=b?[...l.__children]:null;for(const D of[...l.__children]){const L=t[D];L?.remove&&L.remove(),delete t[D]}l.__children=[],Rt(t,h,e),ht(t,!1),b&&Ut(t,{added:[...l.__children],removed:ot,kept:[]})},{depth:l.path.length,label:T(l,"children")});l.__effects.push(_)}const o=Rt(t,s,e,!0);if(r!=null&&!(r&&r.__ref)){let f=r;if(typeof f=="string"||typeof f=="number"?f={text:f}:typeof f!="object"&&(f={}),t.childProps&&(f=ft(t.childProps,f)),n&&!f.ignoreChildExtends)if(f.extends){const l=Array.isArray(f.extends)?f.extends:[f.extends],y=Array.isArray(n)?n:[n];f={...f,extends:[...y,...l]}}else f={...f,extends:n};W(f,t,"content",e)}if(s&&!o)return;const i=t.context?.components||{};{const f=Object.keys(t);for(let l=0;l<f.length;l++){const y=f[l];if(!y.endsWith("Extends")||typeof t[y]!="string")continue;const g=y.slice(0,-7);if(!g||g.charCodeAt(0)<65||g.charCodeAt(0)>90)continue;const _={extends:t[y]};delete t[y];for(let p=l+1;p<f.length;p++){const h=f[p],b=h.charCodeAt(0);if(b>=65&&b<=90||U.REGISTRY.has(h)||typeof t[h]=="function"&&(h.startsWith("on")||h.startsWith(".")))break;const x=t[h];x!==void 0&&(_[h]=x,delete t[h])}t[g]&&typeof t[g]=="object"?t[g]={..._,...t[g]}:t[g]=_}}const a=e?.mountYield===!0||t.yieldChildren===!0,c=Object.keys(t),u=f=>{if(U.REGISTRY.has(f)||typeof t[f]!="object"||t[f]===null)return;const l=f.charCodeAt(0);if(l<65||l>90)return;let y=t[f];if(!y.__ref){if(!y.extends&&!y.extend){const g=i[f]||i[`smbls.${f}`];g&&(y={...y,extends:g})}if(t.childProps&&(y=ft(t.childProps,y)),n&&!y.ignoreChildExtends)if(y.extends){const g=Array.isArray(y.extends)?y.extends:[y.extends],_=Array.isArray(n)?n:[n];y={...y,extends:[..._,...g]}}else y={...y,extends:n};W(y,t,f,e)}};if(!a){for(const f of c)u(f);return}(0,I.openMountBudget)();const d=f=>{for(let l=f;l<c.length;l++)if(u(c[l]),l+1<c.length&&(0,I.mountBudgetExhausted)()){const y=l+1;(0,I.enqueueMountWork)(()=>d(y));return}};d(0),(0,I.closeMountBudget)()}function oo(t,e,s){const{node:r}=t;if(!r)return;r.ref=t;const n=e?.tag==="fragment"?e.__ref?.__fragmentAnchor:null;if(n){const i=n.parentNode;if(i){if(s?.position==="before"&&s.node)i.insertBefore(r,s.node);else if(s?.position==="after"&&s.node){const a=s.node.nextSibling;i.insertBefore(r,a||n)}else i.insertBefore(r,n);return}}const o=e?.node||(e?.nodeType?e:null);if(o)if(s?.position==="before"&&s.node)o.insertBefore(r,s.node);else if(s?.position==="after"&&s.node){const i=s.node.nextSibling;i?o.insertBefore(r,i):o.appendChild(r)}else o.appendChild(r)}const gt=3;function io(t){return!t||t.__inBeforeUpdate||(t.__beforeUpdateFailCount||0)>=gt?!1:(t.__inBeforeUpdate=!0,!0)}function ut(t,e){t&&(t.__inBeforeUpdate=!1,e?(t.__beforeUpdateFailCount=(t.__beforeUpdateFailCount||0)+1,t.__beforeUpdateFailCount===gt&&typeof console<"u"&&console.error&&console.error(`[DOMQL] onBeforeUpdate failed ${gt}x in a row on this element \u2014 pausing automatic retries until a future prop/state change re-arms it.`)):t.__beforeUpdateFailCount=0)}function $(t,e,s){const r=t.charAt(0).toLowerCase()+t.slice(1);e.context?.plugins?.length&&(0,K.runPluginHook)(r,e,s);const n="on"+t,o=e[n];if(typeof o=="function"){const c=t==="Render"?"__inRender":t==="RenderRouter"?"__inRenderRouter":null;if(c){if(e.__ref[c])return!0;e.__ref[c]=!0}const u=e.context?.designSystem;u&&(0,k.pushConfig)(u);let d=!!c;try{const f=o(e,e.state,e.context,s);if(f&&typeof f.then=="function"){const l=e.__ref;return f.catch(y=>{e.context?.plugins?.length&&(0,K.runPluginHook)("error",e,{hook:n,error:y})||console.error(`[DOMQL] Lifecycle "${n}" error:`,y)}).finally(()=>{c&&l&&(l[c]=!1)}),d=!1,!0}if(f===!1)return!1}catch(f){if(e.context?.plugins?.length&&(0,K.runPluginHook)("error",e,{hook:n,error:f})||console.error(`[DOMQL] Lifecycle "${n}" error:`,f),e.context?.strictMode)throw f}finally{u&&(0,k.popConfig)(),d&&e.__ref&&(e.__ref[c]=!1)}}return!0}var Go=W;
|
|
4
|
+
`):"")}}if(_t(n,!0),io(n,o,e),typeof n.html=="function"&&n.node&&!n.node.innerHTML){const y=n.context?.designSystem;y&&(0,k.pushConfig)(y);try{const p=n.html(n,n.state,n.context);p!=null&&typeof p!="function"&&(n.node.innerHTML=p)}catch{}finally{y&&(0,k.popConfig)()}}if(N("Create",n,i),N("Complete",n,i),N("Render",n,i),N("RenderRouter",n,i),vt(n,i),typeof n.onFrame=="function"){const y=n.onFrame,p=n.context?.designSystem,g=()=>{if(n.node){if(n.node.isConnected){p&&(0,k.pushConfig)(p);try{y(n,n.state,n.context)}catch(b){console.error("[DOMQL] onFrame error:",b)}finally{p&&(0,k.popConfig)()}}requestAnimationFrame(g)}};requestAnimationFrame(g)}return n}function To(t,o,s){const i=!o,e=s.state&&typeof s.state=="object"&&!Array.isArray(s.state)&&Object.keys(s.state).length===0,r=i&&e&&t.context?.state,n=s.state!==void 0&&!r?s.state:t.state&&!(0,R.isStore)(t.state)?t.state:void 0;if(n==null){if(o?.state)t.state=o.state,(0,tt.applyStateMethods)(t,t.state);else if(t.context?.state){const c=t.context.state,a={...c},u=t.context?.polyglot;if(u?.translations){const d=t.context,f=c.lang||u.defaultLang||"en",l=new Set,h=(y,p)=>{l.has(y)||(0,H.isPolyglotWritableKey)(d,y,a)&&(a[y]=p,l.add(y),(0,H.markPolyglotSeeded)(d,y))},_=u.translations[f];if(_&&typeof _=="object")for(const y in _)h(y,_[y]);const x=new Set(u.languages||[]);for(const y in u.translations)x.has(y)||h(y,u.translations[y])}t.state=(0,R.isStore)(a)?a:(0,R.createStore)(a),t.state.__element=t,t.state.root=t.state,(0,tt.applyStateMethods)(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),(0,tt.applyStateMethods)(t,t.state);return}if(typeof n=="string"){if(t.state=Gt(n,o),t.state&&typeof t.state=="object"&&!(0,R.isStore)(t.state)){const c=o?.state?.root||o?.state||t.state;Object.defineProperty(t.state,"root",{value:c,enumerable:!1,configurable:!0,writable:!0})}(0,tt.applyStateMethods)(t,t.state);return}if(typeof n=="function"){const c=n(t,o?.state);t.state=(0,R.isStore)(c)?c:(0,R.createStore)(c||{})}else(0,R.isStore)(n)?t.state=n:t.state=(0,R.createStore)({...n});t.state.__element=t,o?.state?(t.state.parent=o.state,t.state.root=o.state.root||o.state):t.state.root=t.state,(0,tt.applyStateMethods)(t,t.state)}function jt(t,o){if(!o)return t;const s=o.split("/");let i=t;for(const e of s){if(i==null)return{};i=i[e]}return i??{}}function Gt(t,o){if(!o)return{};if(t===".")return o.state||{};if(t.startsWith("../")){const e=t.slice(3);return e?jt(o.state,e):o.state??{}}if(t.startsWith("~/")){const e=o.state?.root||o.state,r=t.slice(2);return r?jt(e,r):e??{}}if(o.state?.[t]!==void 0)return o.state[t];const s=jt(o.state,t);if(s!=null&&Object.keys(s).length>0)return s;const i=o.context?.polyglot;if(i?.translations){const e=o.state?.root?.lang||i.defaultLang||"en",r=i.translations[e];if(r?.[t]!==void 0)return r[t];if(i.translations[t]!==void 0)return i.translations[t]}return{}}const Do=new Set(["s","state","ctx","context"]);function Lo(t){try{const s=Function.prototype.toString.call(t).match(/^[^(]*\(([^)]*)\)/);return s?s[1].split(",").map(i=>i.trim().split("=")[0].trim()).filter(Boolean):[]}catch{return[]}}function Oo(t){if(typeof t!="function"||t.length!==2)return!1;const o=Lo(t);if(o.length<2)return!1;const s=o[1].replace(/[{}[\]]/g,"").trim();return s.length>0&&!Do.has(s)}function Ro(t){const o=t.__ref,s=t.tag||"div",i=t.context?.designSystem,e=[],r=Object.keys(t);for(let n=0;n<r.length;n++){const c=r[n];if(typeof t[c]!="function"||U.REGISTRY.has(c))continue;const a=c.charCodeAt(0);a>=65&&a<=90||Y(c)||A.CSS_PROPS_REGISTRY[c]||A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(c)||(0,v.checkAttributeByTagName)(s,c)||((0,m.isLoudDevRuntime)()&&Oo(t[c])&&console.warn(`[smbls] custom prop "${c}"${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('${c}', \u2026) instead of reading el.${c}(\u2026) directly (see RULES.md Rule 8).`),e.push({prop:c,fn:t[c]}))}for(let n=0;n<e.length;n++){const{prop:c,fn:a}=e[n];o.__exec[c]=a,Object.defineProperty(t,c,{get(){i&&(0,k.pushConfig)(i);try{return a(t,t.state,t.context)}catch{return}finally{i&&(0,k.popConfig)()}},set(u){delete o.__exec[c],Object.defineProperty(t,c,{value:u,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function Mo(t,o){if(!(!Array.isArray(o)||o.length===0))for(let s=0;s<o.length;s++){const i=o[s];try{typeof i=="function"?i(t,t.state,t.context):typeof i=="string"&&t.state?.[i]}catch{}}}function O(t,o,s){return!Array.isArray(o)||o.length===0?s:function(...i){return Mo(t,o),s.apply(this,i)}}function ct(t,o){if(!(!t||Array.isArray(t)||typeof t!="object"))return t[o]}function T(t,o){return()=>t.path.join(".")+"::"+o}function Ht(t,o){const s=t.__ref,i=!!(o&&o.skipIfEffect);if(Ro(t),typeof t.text=="function"){const r=t.text,n=O(t,t.textDeps,r),c=(0,E.createEffect)(()=>{if(!s.contentManaged)try{let a=n(t,t.state,t.context);t.node&&a!=null&&typeof a!="function"&&typeof a!="object"&&(typeof a=="string"&&a.includes("{{")&&(a=H.replaceLiteralsWithObjectFields.call(t,a,t.state)),at(t,a))}catch{}},{depth:s.path.length,label:T(s,"text")});s.__effects.push(c),s.__exec.text=r}else if(typeof t.text=="string"&&t.text.includes("{{")){const r=t.text,n=(0,E.createEffect)(()=>{if(s.contentManaged)return;const c=H.replaceLiteralsWithObjectFields.call(t,r,t.state);c!=null&&(t.text=c),t.node&&at(t,c??"")},{depth:s.path.length,label:T(s,"text")});s.__effects.push(n),s.__exec.text=r}for(const r of Object.keys(t))if(typeof t[r]=="function"&&!U.REGISTRY.has(r)&&!Y(r)&&!s.__exec[r]){if(A.CSS_PROPS_REGISTRY[r]){const n=t[r],c=O(t,t[r+"Deps"],n),a=r;let u,d=null,f=null,l;const h=(0,E.createEffect)(()=>{const _=t.context?.designSystem;_&&(0,k.pushConfig)(_);try{const x=c(t,t.state,t.context);(0,A.pushStaticCssPass)();let y;try{y=A.CSS_PROPS_REGISTRY[a](x,t,t.state,t.context)}finally{(0,A.popStaticCssPass)()}if(Array.isArray(y)){const g={};for(const b of y)if(b)for(const S in b)g[S]=b[S];y=g}const p=a==="show"||a==="hide";if(y&&t.node&&No(y)){const g=pt(y);if(g===null||g!==l){l=g;const b=(0,G.css)(y,null,t.context?.cssPrefix),S=b?b.split(" ").filter(Boolean):null;if(t.node.classList){if(f)for(const C of f)t.node.classList.remove(C);if(S&&S.length)for(const C of S)t.node.classList.add(C);f=S}}u=void 0,d=null}else if(y&&t.node){if(f){for(const b of f)t.node.classList.remove(b);f=null,l=void 0}const g=pt(y);(g===null||g!==u||!ht(t.node,d))&&(u=g,X(t.node,y),d=yt(t.node,y))}else if(t.node&&p){u=void 0,d=null;const g=s.__explicitDisplay;t.node.style.display=typeof g=="string"?g:""}}finally{_&&(0,k.popConfig)()}},{depth:s.path.length,label:T(s,a)});s.__effects.push(h),s.__exec[r]=n}else if(A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(r)){const n=t[r],c=O(t,t[r+"Deps"],n),a=r;let u,d=null;const f=(0,E.createEffect)(()=>{const l=t.context?.designSystem;l&&(0,k.pushConfig)(l);try{const h=c(t,t.state,t.context);if(t.node)if(h!=null){const _=a+":"+String(h);if(_!==u||!ht(t.node,d)){u=_;const x={[a]:h};X(t.node,x),d=yt(t.node,x)}}else u=void 0,d=null,t.node.style[a]=""}finally{l&&(0,k.popConfig)()}},{depth:s.path.length,label:T(s,a)});s.__effects.push(f),s.__exec[r]=n}}if(typeof t.html=="function"){const r=t.html,n=O(t,t.htmlDeps,r),c=(0,E.createEffect)(()=>{const a=t.context?.designSystem;a&&(0,k.pushConfig)(a);try{const u=n(t,t.state,t.context);t.node&&u!=null&&typeof u!="function"&&(t.node.innerHTML=u)}finally{a&&(0,k.popConfig)()}},{depth:s.path.length,label:T(s,"html")});s.__effects.push(c),s.__exec.html=r}if(typeof t.value=="function"){const r=t.value,n=O(t,t.valueDeps,r),c=(0,E.createEffect)(()=>{try{const a=n(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const u=a==null?"":String(a);if(t.node.value===u)return;const d=typeof document<"u"&&document.activeElement===t.node,f=d&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,l=d&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=u,d&&f!=null&&l!=null)try{t.node.setSelectionRange(f,l)}catch{}}catch{}},{depth:s.path.length,label:T(s,"value")});s.__effects.push(c),s.__exec.value=r}if(typeof t.style=="function"){const r=t.style,n=O(t,t.styleDeps,r);let c,a=null;const u=(0,E.createEffect)(()=>{const d=n(t,t.state,t.context),f=pt(d);(f===null||f!==c||!ht(t.node,a))&&(c=f,X(t.node,d),a=yt(t.node,d))},{depth:s.path.length,label:T(s,"style")});s.__effects.push(u),s.__exec.style=r}else if(t.style&&typeof t.style=="object")for(const r in t.style){const n=t.style[r];if(typeof n!="function")continue;const c=O(t,ct(t.styleDeps,r),n);let a,u=null;const d=(0,E.createEffect)(()=>{try{const f=c(t,t.state,t.context);if(t.node){const l=r+":"+String(f);if(l!==a||!ht(t.node,u)){a=l;const h={[r]:f};X(t.node,h),u=yt(t.node,h)}}}catch{}},{depth:s.path.length,label:T(s,"style."+r)});s.__effects.push(d)}if(t.attr&&typeof t.attr=="object"){for(const r in t.attr)if(typeof t.attr[r]=="function"){const n=O(t,ct(t.attrDeps,r),t.attr[r]),c=r,a=(0,E.createEffect)(()=>{try{const u=n(t,t.state,t.context);t.node?.setAttribute&&(u==null||u===!1&&!(0,v.isEnumeratedTrueFalseAttr)(c)?t.node.removeAttribute(c):typeof u!="function"&&typeof u!="object"&&t.node.setAttribute(c,(0,v.serializeAttrValue)(c,u)))}catch{}},{depth:s.path.length,label:T(s,"attr."+c)});a._attrName=c.toLowerCase(),s.__effects.push(a)}}if(t.aria&&typeof t.aria=="object")for(const r in t.aria){if(typeof t.aria[r]!="function")continue;const n=O(t,ct(t.ariaDeps,r),t.aria[r]),c="aria-"+r.replace(/[A-Z]/g,u=>"-"+u.toLowerCase()),a=(0,E.createEffect)(()=>{try{const u=n(t,t.state,t.context);if(!t.node?.setAttribute)return;u==null?t.node.removeAttribute(c):typeof u!="function"&&typeof u!="object"&&t.node.setAttribute(c,(0,v.serializeAttrValue)(c,u))}catch{}},{depth:s.path.length,label:T(s,"aria."+r)});a._attrName=c,s.__effects.push(a)}if(t.data&&typeof t.data=="object")for(const r in t.data){if(typeof t.data[r]!="function")continue;const n=O(t,ct(t.dataDeps,r),t.data[r]),a="data-"+r.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),u=(0,E.createEffect)(()=>{try{const d=n(t,t.state,t.context);if(!t.node?.setAttribute)return;d==null||d===!1?t.node.removeAttribute(a):typeof d!="function"&&typeof d!="object"&&t.node.setAttribute(a,d===!0?"":d)}catch{}},{depth:s.path.length,label:T(s,"data."+r)});u._attrName=a,s.__effects.push(u)}const e=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(e)for(const r in e){if(typeof e[r]!="function")continue;const n=O(t,ct(t.classDeps,r),e[r]),c=(0,E.createEffect)(()=>{try{const a=n(t,t.state,t.context);if(!t.node?.classList)return;typeof a=="string"?t.node.classList.add(a):a?t.node.classList.add(r):t.node.classList.remove(r)}catch{}},{depth:s.path.length,label:T(s,"class."+r)});s.__effects.push(c)}!i&&typeof t.if=="function"&&zt(t,s,t.if);for(const r of Object.keys(t)){if(U.REGISTRY.has(r)||typeof t[r]!="function")continue;const n=r.charCodeAt(0);if(n>=65&&n<=90||Y(r))continue;const c=t[r];s.__exec[r]=c;const a=t.tag||"div";if((0,v.checkAttributeByTagName)(a,r)&&!A.CSS_PROPS_REGISTRY[r]&&!(A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(r))){const u=(0,v.camelToAttr)(r)||r,d=O(t,t[r+"Deps"],c),f=(0,E.createEffect)(()=>{try{const l=d(t,t.state,t.context);t.node?.setAttribute&&(l==null||l===!1&&!(0,v.isEnumeratedTrueFalseAttr)(u)?t.node.removeAttribute(u):typeof l!="function"&&typeof l!="object"&&(u==="src"&&"src"in t.node?t.node.src=l:t.node.setAttribute(u,(0,v.serializeAttrValue)(u,l))))}catch{}},{depth:s.path.length,label:T(s,r)});f._attrName=u.toLowerCase(),s.__effects.push(f)}}if(Io(t),Ko(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const r=t.onStateUpdate,n=t.stateDeps;let c=!1,a=[];const u=(0,E.createEffect)(()=>{const d=[];for(let _=0;_<n.length;_++){const x=n[_];try{d[_]=typeof x=="function"?x(t,t.state,t.context):t.state?.[x]}catch{d[_]=void 0}}if(!c){c=!0,a=d;return}let f=d.length!==a.length;for(let _=0;!f&&_<d.length;_++)d[_]!==a[_]&&(f=!0);const l=a;if(a=d,!f)return;const h=t.context?.designSystem;h&&(0,k.pushConfig)(h);try{r(t,t.state,t.context,{prev:l,next:d})}catch(_){if(t.context?.plugins?.length&&(0,K.runPluginHook)("error",t,{hook:"onStateUpdate",error:_})||console.error('[DOMQL] Lifecycle "onStateUpdate" error:',_),t.context?.strictMode)throw _}finally{h&&(0,k.popConfig)()}},{depth:s.path.length,label:T(s,"onStateUpdate")});s.__effects.push(u)}Bo(t)}function Wt(t){const o=t.parent,s=o?.node;if(!s||!t.node){io(t,t.parent);return}let i=null;const e=Object.keys(o),r=e.indexOf(t.key);for(let n=r+1;n<e.length;n++){const c=o[e[n]];if(c?.node?.parentNode===s){i=c.node;break}}i?s.insertBefore(t.node,i):s.appendChild(t.node)}function zt(t,o,s){const i=O(t,t.ifDeps,s),e=(0,E.createEffect)(()=>{let r;try{r=i(t,t.state,t.context)}catch(c){if(r=!1,o.__ifError=c,typeof console<"u"&&console.warn){const a=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${a} \u2014 treating as false:`,c?.message||c)}return}const n=o.__if;if(o.__if=!!r,n&&!o.__if&&t.node){t.node.remove();try{typeof t.onRemove=="function"&&t.onRemove(t)}catch(c){console.error("[smbls] onRemove error:",c)}}else if(!n&&o.__if)if(o.__ifInitialized)t.node||(t.node=(0,q.cacheNode)(t)),t.node&&(t.node.ref=t),Wt(t),Et(t),N("Render",t,{}),vt(t,{});else{if(o.__ifInitialized=!0,t.tag||(t.tag=(0,q.detectTag)(t)),N("Init",t,{}),t.node||(t.node=(0,q.cacheNode)(t)),!t.node)return;if(t.parent?.__ref?.__children&&!t.parent.__ref.__children.includes(t.key)&&t.parent.__ref.__children.push(t.key),t.tag==="fragment"&&!o.__fragmentAnchor){const a=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(a),o.__fragmentAnchor=a}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),eo(t,{}),Ht(t,{skipIfEffect:!0}),Et(t),so(t),ro(t,{}),Wt(t),N("Create",t,{}),N("Complete",t,{}),N("Render",t,{}),N("RenderRouter",t,{}),vt(t,{})}},{depth:o.path.length,label:T(o,"if")});o.__effects.push(e)}function at(t,o){const s=t.node;if(!s)return;const i=o==null||typeof o=="object"?"":String(o);if(t.tag==="string"){s.nodeValue!==i&&(s.nodeValue=i);return}const e=t.__ref;let r=e?e.__textNode:null;if(r&&r.parentNode!==s&&(r=null),!r){const n=s.firstChild;n&&n.nodeType===3&&(r=n)}r?r.nodeValue!==i&&(r.nodeValue=i):s.firstChild?(r=(s.ownerDocument||t.context?.document||globalThis.document).createTextNode(i),s.insertBefore(r,s.firstChild)):(s.textContent=i,r=s.firstChild&&s.firstChild.nodeType===3?s.firstChild:null),e&&(e.__textNode=r||null)}function Et(t){const{node:o}=t;if(o){if((typeof t.text=="string"&&!t.text.includes("{{")||typeof t.text=="number")&&at(t,t.text),Go(t),typeof t.html=="string"&&(o.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&"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 i in t.style)if(typeof t.style[i]=="function"){s={};for(const e in t.style)typeof t.style[e]!="function"&&(s[e]=t.style[e]);break}X(o,s)}if(t.attr&&typeof t.attr=="object")for(const s in t.attr){const i=t.attr[s];typeof i=="function"||typeof i=="object"||i!=null&&(i===!1&&!(0,v.isEnumeratedTrueFalseAttr)(s)||o.setAttribute&&o.setAttribute(s,(0,v.serializeAttrValue)(s,i)))}if(t.data&&typeof t.data=="object")for(const s in t.data){const i=t.data[s];typeof i=="function"||typeof i=="object"||i==null||i===!1||o.dataset&&(o.dataset[s]=i===!0?"":i)}if(t.classlist||t.class){const s=t.classlist||t.class;if(typeof s=="string")s.split(" ").forEach(i=>i&&o.classList.add(i));else if(typeof s=="object")for(const i in s){const e=typeof s[i]=="function"?s[i](t,t.state,t.context):s[i];e&&o.classList.add(typeof e=="string"?e:i)}}}}function pt(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function No(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 yt(t,o){if(!t||!t.style||!o)return null;const s=t.style,i=[];for(const e in o){if(o[e]==null||e.charAt(0)==="&")continue;const n=e.replace(/[A-Z]/g,c=>"-"+c.toLowerCase());i.push(n,Yt(s,n),qt(s,n))}return i}function Yt(t,o){return typeof t.getPropertyValue=="function"?t.getPropertyValue(o):""}function qt(t,o){return typeof t.getPropertyPriority=="function"?t.getPropertyPriority(o):""}function ht(t,o){if(!o||!t||!t.style)return!1;const s=t.style;for(let i=0;i<o.length;i+=3)if(Yt(s,o[i])!==o[i+1]||qt(s,o[i])!==o[i+2])return!1;return!0}const Pt=t=>t.charCodeAt(0)===45&&t.charCodeAt(1)===45;function X(t,o){if(!t||!o||!t.style)return;let s=null;for(const i in o){const e=o[i];if(e!=null){if(i.charAt(0)==="&"&&typeof e=="object"){s||(s={}),s[i]=e;continue}try{const r=String(e),n=Pt(i)?i:i.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),c=r.trim(),a=/\s*!important\s*$/.test(c),u=c.replace(/\s*!important\s*$/,"");t.style.setProperty(n,u,a?"important":"")}catch{}}}s&&$o(t,s)}function $o(t,o){const s=`_ds${It.scopedStyleId++}`;t.classList.add(s);const i=t.ownerDocument;let e=i.querySelector("style[data-smbls-scoped]");e||(e=i.createElement("style"),e.setAttribute("data-smbls-scoped",""),i.head.appendChild(e));let r="";for(const n in o){const c="."+s,a=n.replace(/&/g,c).split(",").map(d=>{const f=d.trim();return f.includes(c)?f:c+f}).join(", "),u=o[n];if(typeof u=="object"){let d="",f="";for(const l in u){const h=u[l];if(typeof h=="object"){const _=l.includes("&")?a.split(", ").map(y=>l.replace(/&/g,y)).join(", "):a.split(", ").map(y=>`${y} ${l}`).join(", ");let x="";for(const y in h)x+=`${y.replace(/[A-Z]/g,p=>"-"+p.toLowerCase())}: ${h[y]};`;f+=(0,G.wrapHoverRule)(`${_} { ${x} }`,_)+`
|
|
5
|
+
`}else d+=`${l.replace(/[A-Z]/g,_=>"-"+_.toLowerCase())}: ${h};`}d&&(r+=(0,G.wrapHoverRule)(`${a} { ${d} }`,a)+`
|
|
6
|
+
`),f&&(r+=f)}}r&&(e.textContent+=r)}const Zt=new Set;function Qt(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 Fo(t,o,s){const i=Qt(s);queueMicrotask(()=>{if(!t.__ref)return;let e;try{e=o(t,t.state,t.context)}catch{return}if(Qt(e)===i)return;const r=t.__ref.path?t.__ref.path.join("."):t.key||"?";Zt.has(r)||(Zt.add(r),console.warn(`[smbls] subscribeTo function at "${r}" resolved to a DIFFERENT key list one microtask after create \u2014 wired [${s.join(", ")||"(none)"}], probed [${Array.isArray(e)?e.join(", "):String(e)}]. subscribeTo's function form is resolved ONCE at element-create time (registerSubscribeToEffects, @symbo.ls/element create.js) \u2014 this element stays wired to the ORIGINAL list for its whole lifetime, so this drift is invisible to the reactive effect and any key only present in the new list will never trigger onUpdate. If the watched key genuinely is not known until later (e.g. a module config that loads after shell boot), route the write through an imperative call instead of subscribeTo \u2014 see functions/moduleOpenBridge.js's moduleOpenPage (workspace repo) for the house pattern.`))})}function Io(t){const o=t.subscribeTo,s=typeof o=="function";let i=o;if(s)try{i=o(t,t.state,t.context)}catch{i=null}if(s&&(0,m.isLoudDevRuntime)()&&Fo(t,o,Array.isArray(i)?i:[]),!Array.isArray(i)||i.length===0)return;const e=t.__ref;for(let r=0;r<i.length;r++){const n=i[r];if(typeof n!="string"||n.length===0)continue;const c=n.split("."),a=c[0],u=c.slice(1),d={value:!1},f=(0,E.createEffect)(()=>{const l=t.state&&((0,R.isStore)(t.state)?t.state.root:null);if(!l||!(0,R.isStore)(l))return;let h=l;h=h[a];for(let x=0;x<u.length&&!(h==null||typeof h!="object");x++)if((0,R.isStore)(h))h=h[u[x]];else break;if(!d.value)return;let _=!1;if(typeof t.onBeforeUpdate=="function"){const x=t.context?.designSystem;x&&(0,k.pushConfig)(x);try{if(lo(e)){const y=t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0});y&&typeof y.then=="function"?y.then(()=>ut(e,!1),p=>{ut(e,!0),t.context?.plugins?.length&&(0,K.runPluginHook)("error",t,{hook:"onBeforeUpdate",error:p})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",p)}):(ut(e,!1),y===!1&&(_=!0))}}catch(y){ut(e,!0),t.context?.plugins?.length&&(0,K.runPluginHook)("error",t,{hook:"onBeforeUpdate",error:y})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",y)}finally{x&&(0,k.popConfig)()}}if(!_&&t.node&&e.__effects)for(let x=0;x<e.__effects.length;x++){const y=e.__effects[x];y&&y!==f&&!y._disposed&&!y._isSubscribeToEffect&&typeof y._execute=="function"&&y._execute()}if(!_&&typeof t.onUpdate=="function"){const x=t.context?.designSystem;x&&(0,k.pushConfig)(x);try{t.onUpdate(t,t.state,t.context)}catch(y){t.context?.plugins?.length&&(0,K.runPluginHook)("error",t,{hook:"onUpdate",error:y})||console.error("[DOMQL] subscribeTo onUpdate error:",y)}finally{x&&(0,k.popConfig)()}}},{depth:e.path.length,label:T(e,"subscribeTo("+n+")")});d.value=!0,f._isSubscribeToEffect=!0,e.__effects.push(f)}}function Tt(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 Dt(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 Xt=new Set;function Uo(t,o){const s=o?.__ref?.path?o.__ref.path.join("."):o?.key||"?",i=s+"::"+t;Xt.has(i)||(Xt.add(i),console.warn(`[smbls/css] "${t}" at ${s} is a CHILD-COMPONENT key nested inside a pseudo/selector block (":hover", "@dark", etc.) \u2014 that is never a valid CSS selector fragment. The rule is DROPPED (not shipped as a dead/never-matching selector). To reveal a child on a parent state, target the child's OWN class from the parent selector instead, e.g. move the declaration onto the child element itself, or use a sibling-selector combinator in a top-level style block.`))}function J(t,o,s){const i={},e=new Set,r=(n,c,a)=>{const u=a?new Set(Object.keys(i)):null;if(A.CSS_PROPS_REGISTRY[n]){const d=A.CSS_PROPS_REGISTRY[n](c,o,o.state,o.context);if(d){const f=Array.isArray(d)?d:[d];for(const l of f)l&&Object.assign(i,l)}}else i[n]=c;if(a)for(const d in i)u.has(d)||e.add(d)};for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;let c=t[n];if(typeof c=="function"&&(c=c(o,o.state,o.context)),c==null||typeof c=="function")continue;if(typeof c=="object"&&!Array.isArray(c)){if(n==="style"){for(const f in c){let l=c[f];if(typeof l=="function"&&(l=l(o,o.state,o.context)),l==null||typeof l=="function")continue;const h=typeof o[f]=="function"&&(A.CSS_PROPS_REGISTRY[f]||A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(f));r(f,l,h)}continue}if(Tt(n,o)){const f=J(c,o,!1);Object.keys(f).length&&(i[`[data-theme="${n.slice(1)}"] &`]=f);continue}if(/^[A-Z][A-Za-z0-9]*$/.test(n)){(0,m.isLoudDevRuntime)()&&Uo(n,o);continue}const u=Dt(n,o),d=J(c,o,!1);Object.keys(d).length&&(i[u]=d);continue}const a=typeof o[n]=="function"&&(A.CSS_PROPS_REGISTRY[n]||A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(n));r(n,c,a)}if(s)for(const n in i)e.add(n);for(const n of e){const c=i[n];typeof c=="string"&&!c.includes("!important")&&(i[n]=c+" !important")}return i}function Lt(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)&&Lt(t[s],o+1))return!0}return!1}function Jt(t,o,s){if(!o||typeof o!="object"||Array.isArray(o))return null;if(Tt(t,s)){const r=J(o,s,!1);return Object.keys(r).length?{cssProp:`[data-theme="${t.slice(1)}"] &`,block:r}:null}const i=Dt(t,s),e=J(o,s,!1);return Object.keys(e).length?{cssProp:i,block:e}:null}function Bo(t){const o=t.__ref;for(const s of Object.keys(t)){if(!wt(s))continue;const i=t[s];if(!i||typeof i!="object"||Array.isArray(i)||!Lt(i))continue;let e=null,r;const n=(0,E.createEffect)(()=>{if(!t.node)return;const c=t.context?.designSystem;c&&(0,k.pushConfig)(c);let a,u=!1;try{const d=Jt(s,i,t),f=d?pt(d.block)+"::"+d.cssProp:null;if(f!==null&&f===r)u=!0;else if(r=f,d){const l=(0,G.css)({[d.cssProp]:d.block},null,t.context?.cssPrefix);a=l?l.split(" ").filter(Boolean):null}else a=null}finally{c&&(0,k.popConfig)()}if(!(u||!t.node.classList)){if(e)for(const d of e)t.node.classList.remove(d);if(a&&a.length)for(const d of a)t.node.classList.add(d);e=a}},{depth:o.path.length,label:T(o,"cssBlock("+s+")")});o.__effects.push(n)}}function Ko(t){const o=t.__ref;o.__conditionalRunners=[];const s=new Map;for(const i of Object.keys(t)){const e=i.charAt(0);if(e!=="."&&e!=="!")continue;const r=i.slice(1);if(!r)continue;if(/[:@\s>~+[\]]/.test(r)){if(typeof console<"u"&&console.warn){const h=r.split(/[:@\s>~+[\]]/)[0];console.warn(`[smbls] conditional \`${i}\` on ${t.key||"?"} will never match \u2014 the whole string after \`${e}\` is read as one prop name. Nest the selector inside instead: \`${e}${h}: { '${r.slice(h.length)}': {...} }\`.`)}continue}const n=t[i];if(!n||typeof n!="object")continue;const c=e==="!",a={lastMatch:!1,appliedKeys:null,appliedClasses:null},u=()=>{let h;const _=t[r];if(_===void 0){const p=!!t.state&&r in t.state,g=t.state?t.state[r]:void 0;if(p||g!==void 0)h=g;else{const b=t.context?.cases?.[r];if(b===void 0)return;try{h=typeof b=="function"?b.call(t,t):b}catch(S){h=!1,o.__conditionalError=S,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${i}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,S?.message||S)}}}else if(typeof _=="function")try{h=_(t,t.state,t.context)}catch(p){h=!1,o.__conditionalError=p,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${i}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,p?.message||p)}else h=_;const x=c?!h:!!h;if(!t.node||x===a.lastMatch)return;a.lastMatch=x;const y=t.context?.designSystem;y&&(0,k.pushConfig)(y);try{if(x){const p={},g={};let b=!1;for(const C in n){if(!Object.prototype.hasOwnProperty.call(n,C))continue;const P=n[C],z=C.charAt(0);if((z===":"||z==="@"||z==="&"||z==="[")&&P&&typeof P=="object"&&!Array.isArray(P)){if(Tt(C,t)){const D=J(P,t,!1);Object.keys(D).length&&(g[`[data-theme="${C.slice(1)}"] &`]=D,b=!0)}else{const D=Dt(C,t),L=J(P,t,!1);Object.keys(L).length&&(g[D]=L,b=!0)}continue}const Z=typeof P=="function"?P(t,t.state,t.context):P;if(Z!=null)if(A.CSS_PROPS_REGISTRY[C]){const D=A.CSS_PROPS_REGISTRY[C](Z,t,t.state,t.context);if(D){const L=Array.isArray(D)?D:[D];for(const st of L)st&&Object.assign(p,st)}}else(A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(C)||Pt(C))&&(p[C]=Z)}const S=Object.keys(p);if(S.length){X(t.node,p);for(const C of S)s.set(C,i);a.appliedKeys=S}else a.appliedKeys=null;if(b){const C=(0,G.css)(g,null,t.context?.cssPrefix),P=C?C.split(" ").filter(Boolean):[];if(P.length&&t.node.classList){for(const z of P)t.node.classList.add(z);a.appliedClasses=P}else a.appliedClasses=null}else if(a.appliedClasses){for(const C of a.appliedClasses)t.node.classList.remove(C);a.appliedClasses=null}}else{if(a.appliedKeys){for(const p of a.appliedKeys)s.get(p)===i&&(Pt(p)?t.node.style.removeProperty(p):t.node.style[p]="",s.delete(p));a.appliedKeys=null}if(a.appliedClasses){for(const p of a.appliedClasses)t.node.classList.remove(p);a.appliedClasses=null}}}finally{y&&(0,k.popConfig)()}};o.__conditionalRunners.push(u);const d=O(t,t[r+"Deps"],u),f=(0,E.createEffect)(d,{depth:o.path.length,label:T(o,"conditional("+i+")")}),l=o.__exec&&o.__exec[r]||t[r];f._sources.size===0&&typeof l=="function"&&(0,m.isLoudDevRuntime)()&&console.warn(`[smbls] conditional \`${i}\` on ${t.key||"?"} subscribed to nothing \u2014 its predicate tracked no reactive read on its first run, so no state write will ever re-evaluate it (only a direct element.update() on this element re-runs it). If the predicate guards its state reads (\`in\`, short-circuits, \`?.\`), declare \`${r}Deps: [...]\` (state-key strings or \`(el, s) => \u2026\` selectors) so the subscription is armed unconditionally.`),o.__effects.push(f)}}const Ot=new WeakSet;function Vo(t){const o=t.ownerDocument;!o||Ot.has(o)||(Ot.add(o),queueMicrotask(()=>{Ot.delete(o);const s=o.body||o.documentElement;s&&s.offsetWidth}))}const Rt=new WeakSet;let mt=!1;function to(t){return t.startsWith("[data-theme=")||t.startsWith("@media")&&t.includes("prefers-color-scheme")}function Mt(t,o){const s={...t};for(const i in o){const e=o[i],r=s[i];s[i]=e&&typeof e=="object"&&r&&typeof r=="object"?Mt(r,e):e}return s}function oo(t,o){const s={};for(const i in t){const e=t[i];if(e&&typeof e=="object"){const r=oo(e,o);Object.keys(r).length&&(s[i]=r)}else o.has(i)||(s[i]=e)}return s}function Go(t){const{node:o}=t;if(!o)return;if(mt||(mt=!0,(0,G.css)({display:"none"})),Rt.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}Rt.add(t);const s=t.context?.designSystem;s&&(0,k.pushConfig)(s),(0,A.pushStaticCssPass)();try{const i={};let e=!1,r=null,n=null,c=null;const a=(u,d)=>{if(d&&typeof d=="object"&&to(u)){n||(n={});const f=n[u];f&&(d=Mt(f,d)),n[u]=d}else(d===null||typeof d!="object")&&(c||(c=new Set),c.add(u));i[u]=d};if(Object.prototype.hasOwnProperty.call(t,"theme")&&typeof t.theme!="function"&&A.CSS_PROPS_REGISTRY.theme){const u=A.CSS_PROPS_REGISTRY.theme(t.theme,t,t.state,t.context);if(u){const d=f=>{for(const l in f){const h=f[l];h&&typeof h=="object"&&to(l)&&(r||(r={}),r[l]=h),i[l]=h}};if(Array.isArray(u))for(const f of u)f&&d(f);else d(u);e=!0}}for(const u of Object.keys(t)){if(typeof t[u]=="function"||U.REGISTRY.has(u)||u==="theme")continue;const d=u.charCodeAt(0);if(!(d>=65&&d<=90)&&!Y(u)){if(A.CSS_PROPS_REGISTRY[u]){const f=t[u],l=A.CSS_PROPS_REGISTRY[u](f,t,t.state,t.context);if(l){if(Array.isArray(l)){for(const h of l)if(h)for(const _ in h)a(_,h[_])}else for(const h in l)a(h,l[h]);e=!0}}else if(A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(u)){const f=t[u];f!=null&&typeof f!="object"&&(a(u,f),e=!0)}else if(u.charCodeAt(0)===45){const f=t[u];f!=null&&typeof f!="object"&&(a(u,f),e=!0)}else if(u.charAt(0)==="&"||u.charAt(0)==="@"||u.charAt(0)===":"||u.charAt(0)==="["){const f=t[u];if(f&&typeof f=="object"&&!Array.isArray(f)){if(Lt(f))continue;const l=Jt(u,f,t);l&&(a(l.cssProp,l.block),e=!0)}}}}if(r)for(const u in r){let d=c?oo(r[u],c):r[u];n&&n[u]&&(d=Mt(d,n[u])),Object.keys(d).length?i[u]=d:delete i[u]}if(e){i.display&&String(i.display).includes("!important")&&(o.style.setProperty("display",String(i.display).replace(/\s*!important\s*$/,""),"important"),delete i.display);const u=(0,G.css)(i,null,t.context?.cssPrefix);if(u&&o.classList){const f=u.split(" ").filter(Boolean);let l=!1;for(const h of f)o.classList.add(h),l||(h.charCodeAt(0)===95&&h.charCodeAt(1)===99||h.charCodeAt(0)===95&&h.indexOf("_c",1)!==-1)&&(l=!0);l&&Vo(o)}const d=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(d!=null){const f=i.display;if(f&&f!==d)if(d==="none"){const l=[];for(const h of o.classList)h.startsWith("_d-")&&h!=="_d-none"&&l.push(h);for(const h of l)o.classList.remove(h);o.classList.add("_d-none")}else o.style.display==="none"&&(typeof t.hide=="function"||typeof t.show=="function")||(o.style.display=t.display),t.__ref&&(t.__ref.__explicitDisplay=t.display)}}}finally{(0,A.popStaticCssPass)(),s&&(0,k.popConfig)(),Rt.delete(t)}}function so(t){const{node:o}=t;if(!o||!o.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const e in t.aria){const r=t.aria[e];if(typeof r=="function"||typeof r=="object"||r==null)continue;const n="aria-"+e.replace(/[A-Z]/g,c=>"-"+c.toLowerCase());o.setAttribute(n,(0,v.serializeAttrValue)(n,r))}const s=(0,v.applyAttrTransforms)(t);for(const e in s){const r=s[e];r!=null&&r!==!1&&typeof r!="function"&&typeof r!="object"&&o.setAttribute(e,r===!0?"":r)}const i=t.tag||"div";for(const e of Object.keys(t)){if(typeof t[e]=="function"||U.REGISTRY.has(e)||e==="on"||s[e]!==void 0)continue;const r=e.charCodeAt(0);if(!(r>=65&&r<=90)&&!Y(e)&&!(A.CSS_PROPS_REGISTRY[e]||A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(e))&&(0,v.checkAttributeByTagName)(i,e)){let n=t[e];if(n==null||(typeof n=="string"&&n.includes("{{")&&(n=(0,H.replaceLiteralsWithObjectFields)(n,t,t.state,t.context),t[e]=n),n==null||typeof n=="function"||typeof n=="object")||n===!1&&!(0,v.isEnumeratedTrueFalseAttr)((0,v.camelToAttr)(e)||e))continue;const c=(0,v.camelToAttr)(e)||e;o.setAttribute(c,(0,v.serializeAttrValue)(c,n))}}}function Ho(t,o){const{node:s}=t;if(!s||!s.setAttribute)return;const i=o.charCodeAt(0);if(i>=65&&i<=90||Y(o)||A.CSS_PROPS_REGISTRY[o]||A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(o)||!(0,v.checkAttributeByTagName)(t.tag||"div",o))return;const e=(0,v.camelToAttr)(o)||o,r=e.toLowerCase(),n=t.__ref&&t.__ref.__effects;let c=!1;if(n)for(let d=0;d<n.length;d++){const f=n[d];f&&f._attrName===r&&!f._disposed&&typeof f._execute=="function"&&(c=!0,f._execute())}if(c)return;let a=t[o];const u=v.ATTR_TRANSFORMS[o];if(u&&a!=null){const d=u(t);d!==void 0&&(a=d)}typeof a=="string"&&a.includes("{{")&&(a=(0,H.replaceLiteralsWithObjectFields)(a,t,t.state,t.context)),a==null||a===!1&&!(0,v.isEnumeratedTrueFalseAttr)(e)?s.removeAttribute(e):typeof a!="function"&&typeof a!="object"&&s.setAttribute(e,(0,v.serializeAttrValue)(e,a))}function Wo(t,o){const s=t.node,i=t.__ref;let e=i.__autoGrow;if(!o){if(e&&e.active){try{s.removeEventListener("input",e.resize)}catch{}s.style.height="",e.appliedMax!=null&&s.style.maxHeight===e.appliedMax&&(s.style.maxHeight=""),e.active=!1,e.appliedMax=null,e.lastMeasure=0}return}e||(e=i.__autoGrow={active:!1,appliedMax:null,lastMeasure:0,resize:()=>{if(s.scrollHeight===0&&e.lastMeasure>0)return;s.style.height="auto";const n=s.scrollHeight;s.style.height=n+"px",n>0&&(e.lastMeasure=n)}},i.__eventCleanup||(i.__eventCleanup=[]),i.__eventCleanup.push(()=>{try{s.removeEventListener("input",e.resize)}catch{}})),e.active||(s.addEventListener("input",e.resize),e.active=!0);const r=typeof o=="object"&&o.max!=null?String(o.max):null;r!==e.appliedMax&&(r==null?e.appliedMax!=null&&s.style.maxHeight===e.appliedMax&&(s.style.maxHeight=""):s.style.maxHeight=r,e.appliedMax=r),e.resize()}function zo(t){if(!t.autoGrow)return;const o=t.node;if(!o||o.tagName!=="TEXTAREA")return;const s=t.__ref,i=t.autoGrow,e=typeof i=="function"?O(t,t.autoGrowDeps,i):null,r=(0,E.createEffect)(()=>{const n=t.autoGrow;let c=n;if(typeof n=="function")try{c=(n===i&&e?e:n)(t,t.state,t.context)}catch{c=null}Wo(t,c)},{depth:s.path.length,label:T(s,"autoGrow")});s.__effects||(s.__effects=[]),s.__effects.push(r),e&&(s.__exec.autoGrow=i)}const no=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function eo(t,o){for(const s of Object.keys(t)){if(!Y(s)||no.has(s))continue;const i=(0,ot.globalEventKeyInfo)(s);if(i){(0,ot.registerGlobalEvent)(i,t,t[s]);continue}let e=t[s];if(typeof e=="string"&&/^[A-Za-z_$][\w$]*$/.test(e)){const n=e;e=function(a){return t.call(n,a)}}if(typeof e!="function")continue;const r=Eo(s);U.LIFECYCLE_EVENTS.has(r)||(0,ot.registerEvent)(Po(r),t,e)}Yo(t)}function Yo(t){const o=t.node;if(!o||!o.addEventListener)return;const s={};let i=!1;for(const l of no){const h=t[l];typeof h=="function"&&(s[l]=h,i=!0)}if(!i)return;const e=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,r=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let n=0,c=0,a=0,u=!1;const d=l=>{const h=l.touches&&l.touches[0]||l.changedTouches&&l.changedTouches[0];h&&(n=h.clientX,c=h.clientY,a=Date.now(),u=!0)},f=l=>{if(!u)return;u=!1;const h=l.changedTouches&&l.changedTouches[0]||l.touches&&l.touches[0];if(!h)return;const _=h.clientX-n,x=h.clientY-c,y=Date.now()-a;if(y>r)return;const p=Math.abs(_),g=Math.abs(x);if(Math.max(p,g)<e)return;let b;if(p>g*1.2)b=_<0?"left":"right";else if(g>p*1.2)b=x<0?"up":"down";else return;const S="onSwipe"+b.charAt(0).toUpperCase()+b.slice(1),C=s[S],P=s.onSwipe;C&&C.call(t,l,t,t.state,t.context),P&&P.call(t,{direction:b,dx:_,dy:x,dt:y,event:l},t,t.state,t.context)};o.addEventListener("touchstart",d,{passive:!0}),o.addEventListener("touchend",f,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{o.removeEventListener("touchstart",d)}catch{}try{o.removeEventListener("touchend",f)}catch{}})}function ft(t,o){const s={...t};for(const i in o){const e=s[i],r=o[i];e&&r&&typeof e=="object"&&typeof r=="object"&&!Array.isArray(e)&&!Array.isArray(r)&&typeof e!="function"&&typeof r!="function"?s[i]=ft(e,r):s[i]=r}return s}function Nt(t,o,s,i){if(!o||!t.node)return;const e=t.childExtends;if(Array.isArray(o)){const r=t.tag==="fragment",n=t.context?.document||globalThis.document,c=r?null:n?.createDocumentFragment();if(!r&&!c)return;const a=t.childProps,u=t.childrenAs,d=y=>{let p=o[y];const g=p;(typeof p=="string"||typeof p=="number")&&(p={text:p});let b=a;if(typeof a=="function")try{b=a(t,p)}catch{b=null}if(u==="state"){let C=g;(typeof g=="string"||typeof g=="number")&&(C={value:g,text:g}),p=b?{...b,state:C}:{state:C}}else b&&(p=ft(b,p));if(e&&!p.ignoreChildExtends)if(p.extends){const C=Array.isArray(p.extends)?p.extends:[p.extends],P=Array.isArray(e)?e:[e];p={...p,extends:[...P,...C]}}else p={...p,extends:e};const S=Vt(p?.key,g,y);try{return W(p,t,S,s)}catch(C){if(typeof console<"u"&&console.error){const P=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${S}" failed to construct at ${P} (initial render, skipping this row):`,C?.message||C)}return null}},f=t.__ref;if(!(i===!0&&!r&&!!f&&(s?.mountYield===!0||t.yieldChildren===!0))){for(let y=0;y<o.length;y++){const p=d(y);!r&&p?.node&&c.appendChild(p.node)}return r||t.node.appendChild(c),!0}const h=f.__childrenChunkGen=(f.__childrenChunkGen||0)+1;(0,F.openMountBudget)();let _=null;const x=y=>{if(f.__disposed||f.__childrenChunkGen!==h){_&&_.parentNode&&_.remove();return}for(let p=y;p<o.length;p++){const g=d(p);if(g?.node&&(_?t.node.insertBefore(g.node,_):c.appendChild(g.node)),p+1<o.length&&(0,F.mountBudgetExhausted)()){_||(_=n.createComment("smbls-mount"),c.appendChild(_),t.node.appendChild(c));const b=p+1;(0,F.enqueueMountWork)(()=>x(b));return}}_?(_.remove(),t.node.tagName==="SELECT"&&_t(t,!0)):t.node.appendChild(c)};return x(0),(0,F.closeMountBudget)(),!0}if(typeof o=="string"){const r=Gt(o,t);if(Array.isArray(r))return Nt(t,r,s,i)}if(typeof o=="object")for(const r in o){if(U.REGISTRY.has(r))continue;let n=o[r];if(!(n==null||n===!1)){if((typeof n=="string"||typeof n=="number")&&(n={text:n}),t.childProps&&(n=ft(t.childProps,n)),e&&!n.ignoreChildExtends)if(n.extends){const c=Array.isArray(n.extends)?n.extends:[n.extends],a=Array.isArray(e)?e:[e];n={...n,extends:[...a,...c]}}else n={...n,extends:e};W(n,t,r,s)}}}function _t(t,o){const s=t.node;if(!s||s.tagName!=="SELECT")return;const i=s.options;if(!i||!i.length)return;const e=t.__ref,r=e&&e.__exec&&e.__exec.value,n=typeof r=="function",c=t.value!=null&&typeof t.value!="function";if(n||c){let d;if(n)try{d=r(t,t.state,t.context)}catch{return}else d=t.value;const f=d==null?"":String(d);s.value!==f&&(s.value=f);return}const a=o||!(e&&e.__selectSynced);if(e&&(e.__selectSynced=!0),!a)return;let u=-1;for(let d=0;d<i.length;d++)i[d].defaultSelected&&(u=d);u>=0&&s.selectedIndex!==u&&(s.selectedIndex=u)}function ro(t,o){let{children:s,content:i}=t;const e=t.childExtends;if(typeof s=="function"){const f=s;try{s=f(t,t.state,t.context)}catch(y){if(s=void 0,typeof console<"u"&&console.error){const p=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${p} (initial run, treating as empty):`,y?.message||y)}}t.children=s;const l=t.__ref;let h=!1;const _=O(t,t.childrenDeps,f),x=(0,E.createEffect)(()=>{const y=h;h=!0;let p;try{p=_(t,t.state,t.context)}catch(D){if(typeof console<"u"&&console.error){const L=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${L}${y?"":" (initial tracking run)"}:`,D?.message||D)}return}if(!y||p===t.children)return;t.children=p,l.__childrenChunkGen!=null&&l.__childrenChunkGen++;const g=typeof t.onContentUpdate=="function",b=g?[]:null,S=g?[]:null,C=g?[]:null;if(Array.isArray(p)&&t.childrenAs==="state"){const D=t.childProps,L=[],st=new Map;for(let w=0;w<p.length;w++){const I=p[w];let j=D;if(typeof D=="function")try{j=D(t,I)}catch{j=null}const V=Vt(j&&j.key,I,w);L.push(V),st.set(V,{rawChild:I,childProps:j})}const po=new Set(L),yo=l.__children.slice();for(const w of yo)if(!po.has(w)){const I=t[w];I?.remove&&I.remove(),delete t[w],S&&S.push(w)}const nt=t.childExtends,dt=t.tag==="fragment",ho=t.context?.document||globalThis.document,et=dt?null:ho?.createDocumentFragment(),xt=new Set;for(const w of L){const I=st.get(w),j=I.rawChild,V=t[w];if(V&&V.state){if(j&&typeof j=="object"){const M=V.state,Q=M.$replace||M.replace,Ft=M.$update||M.update;try{if(typeof Q=="function")Q.call(M,j);else if(typeof Ft=="function"){for(const $ in M)if(!($==="__element"||$==="root"||$==="parent"||$==="update")&&!Object.prototype.hasOwnProperty.call(j,$))try{M[$]=void 0}catch{}Ft.call(M,j)}else for(const $ in j)M[$]=j[$]}catch($){if(typeof console<"u"&&console.error){const _o=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${w}" failed to patch at ${_o} (reconcile, keeping its previous data for this pass):`,$?.message||$)}}}C&&C.push(w);continue}let At=j;(typeof j=="string"||typeof j=="number")&&(At={value:j,text:j});const $t=I.childProps;let B=$t?{...$t,state:At}:{state:At};if(nt&&!B.ignoreChildExtends)if(B.extends){const M=Array.isArray(B.extends)?B.extends:[B.extends],Q=Array.isArray(nt)?nt:[nt];B={...B,extends:[...Q,...M]}}else B={...B,extends:nt};let Ct;try{Ct=W(B,t,w,o)}catch(M){if(typeof console<"u"&&console.error){const Q=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${w}" failed to construct at ${Q} (reconcile, skipping this row):`,M?.message||M)}xt.add(w);continue}!dt&&Ct?.node&&et&&et.appendChild(Ct.node),b&&b.push(w)}if(!dt&&et&&et.childNodes.length&&t.node&&t.node.appendChild(et),!dt&&t.node){let w=null;for(const I of L){const j=t[I]?.node;if(!j)continue;const V=w?w.nextSibling:t.node.firstChild;j!==V&&t.node.insertBefore(j,V),w=j}}l.__children=xt.size?L.filter(w=>!xt.has(w)):L,g&&(b.length||S.length)&&Kt(t,{added:b,removed:S,kept:C}),_t(t,!1);return}const Z=g?[...l.__children]:null;for(const D of[...l.__children]){const L=t[D];L?.remove&&L.remove(),delete t[D]}l.__children=[],Nt(t,p,o),_t(t,!1),g&&Kt(t,{added:[...l.__children],removed:Z,kept:[]})},{depth:l.path.length,label:T(l,"children")});l.__effects.push(x)}const r=Nt(t,s,o,!0);if(i!=null&&!(i&&i.__ref)){let f=i;if(typeof f=="string"||typeof f=="number"?f={text:f}:typeof f!="object"&&(f={}),t.childProps&&(f=ft(t.childProps,f)),e&&!f.ignoreChildExtends)if(f.extends){const l=Array.isArray(f.extends)?f.extends:[f.extends],h=Array.isArray(e)?e:[e];f={...f,extends:[...h,...l]}}else f={...f,extends:e};W(f,t,"content",o)}if(s&&!r)return;const n=t.context?.components||{};{const f=Object.keys(t);for(let l=0;l<f.length;l++){const h=f[l];if(!h.endsWith("Extends")||typeof t[h]!="string")continue;const _=h.slice(0,-7);if(!_||_.charCodeAt(0)<65||_.charCodeAt(0)>90)continue;const x={extends:t[h]};delete t[h];for(let y=l+1;y<f.length;y++){const p=f[y],g=p.charCodeAt(0);if(g>=65&&g<=90||U.REGISTRY.has(p)||typeof t[p]=="function"&&(p.startsWith("on")||p.startsWith(".")))break;const b=t[p];b!==void 0&&(x[p]=b,delete t[p])}t[_]&&typeof t[_]=="object"?t[_]={...x,...t[_]}:t[_]=x}}const c=o?.mountYield===!0||t.yieldChildren===!0,a=Object.keys(t),u=f=>{if(U.REGISTRY.has(f)||typeof t[f]!="object"||t[f]===null)return;const l=f.charCodeAt(0);if(l<65||l>90)return;let h=t[f];if(!h.__ref){if(!h.extends&&!h.extend){const _=n[f]||n[`smbls.${f}`];_&&(h={...h,extends:_})}if(t.childProps&&(h=ft(t.childProps,h)),e&&!h.ignoreChildExtends)if(h.extends){const _=Array.isArray(h.extends)?h.extends:[h.extends],x=Array.isArray(e)?e:[e];h={...h,extends:[...x,..._]}}else h={...h,extends:e};W(h,t,f,o)}};if(!c){for(const f of a)u(f);return}(0,F.openMountBudget)();const d=f=>{for(let l=f;l<a.length;l++)if(u(a[l]),l+1<a.length&&(0,F.mountBudgetExhausted)()){const h=l+1;(0,F.enqueueMountWork)(()=>d(h));return}};d(0),(0,F.closeMountBudget)()}function io(t,o,s){const{node:i}=t;if(!i)return;i.ref=t;const e=o?.tag==="fragment"?o.__ref?.__fragmentAnchor:null;if(e){const n=e.parentNode;if(n){if(s?.position==="before"&&s.node)n.insertBefore(i,s.node);else if(s?.position==="after"&&s.node){const c=s.node.nextSibling;n.insertBefore(i,c||e)}else n.insertBefore(i,e);return}}const r=o?.node||(o?.nodeType?o:null);if(r)if(s?.position==="before"&&s.node)r.insertBefore(i,s.node);else if(s?.position==="after"&&s.node){const n=s.node.nextSibling;n?r.insertBefore(i,n):r.appendChild(i)}else r.appendChild(i)}const bt=3;function lo(t){return!t||t.__inBeforeUpdate||(t.__beforeUpdateFailCount||0)>=bt?!1:(t.__inBeforeUpdate=!0,!0)}function ut(t,o){t&&(t.__inBeforeUpdate=!1,o?(t.__beforeUpdateFailCount=(t.__beforeUpdateFailCount||0)+1,t.__beforeUpdateFailCount===bt&&typeof console<"u"&&console.error&&console.error(`[DOMQL] onBeforeUpdate failed ${bt}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 i=t.charAt(0).toLowerCase()+t.slice(1);o.context?.plugins?.length&&(0,K.runPluginHook)(i,o,s);const e="on"+t,r=o[e];if(typeof r=="function"){const a=t==="Render"?"__inRender":t==="RenderRouter"?"__inRenderRouter":null;if(a){if(o.__ref[a])return!0;o.__ref[a]=!0}const u=o.context?.designSystem;u&&(0,k.pushConfig)(u);let d=!!a;try{const f=r(o,o.state,o.context,s);if(f&&typeof f.then=="function"){const l=o.__ref;return f.catch(h=>{o.context?.plugins?.length&&(0,K.runPluginHook)("error",o,{hook:e,error:h})||console.error(`[DOMQL] Lifecycle "${e}" error:`,h)}).finally(()=>{a&&l&&(l[a]=!1)}),d=!1,!0}if(f===!1)return!1}catch(f){if(o.context?.plugins?.length&&(0,K.runPluginHook)("error",o,{hook:e,error:f})||console.error(`[DOMQL] Lifecycle "${e}" error:`,f),o.context?.strictMode)throw f}finally{u&&(0,k.popConfig)(),d&&o.__ref&&(o.__ref[a]=!1)}}return!0}var qo=W;
|
package/dist/cjs/src/methods.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var c=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var w=(t,e)=>{for(var n in e)c(t,n,{get:e[n],enumerable:!0})},x=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of m(e))!k.call(t,r)&&r!==n&&c(t,r,{get:()=>e[r],enumerable:!(o=y(e,r))||o.enumerable});return t};var C=t=>x(c({},"__esModule",{value:!0}),t);var
|
|
1
|
+
"use strict";var c=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var w=(t,e)=>{for(var n in e)c(t,n,{get:e[n],enumerable:!0})},x=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of m(e))!k.call(t,r)&&r!==n&&c(t,r,{get:()=>e[r],enumerable:!(o=y(e,r))||o.enumerable});return t};var C=t=>x(c({},"__esModule",{value:!0}),t);var D={};w(D,{addMethods:()=>P,elementProto:()=>f,refreshContextProto:()=>A});module.exports=C(D);var _=require("./update.js"),d=require("./dispose.js"),p=require("./devRuntime.js"),j=require("css-in-props"),s=require("@symbo.ls/utils");function u(t,e,n){const o=t?.context?.analyze;if(!o||!o.emit||e==="warn"&&!o.shouldCapture("warnings")||e==="error"&&!o.shouldCapture("errors"))return;const r=n.map(i=>i?.message||(typeof i=="string"?i:null)).filter(Boolean).join(" ");o.emit({id:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,ts:Date.now(),type:e==="error"?"error":"warning",level:e,hook:e==="error"?"el.error":"el.warn",element:{key:t.key!=null?String(t.key):null,name:t.__name||null,tag:t.tag||null},message:r||null,args:n})}const h=new Set;function S(t,e,n){const o=String(e);if(h.has(o))return;h.add(o);const r=t?.__ref?.path,i=Array.isArray(r)&&r.length?r.join("."):t?.key!=null?String(t.key):"(unknown element)",g=n!=null?`resolves to a non-function (${typeof n}) \u2014 it cannot be called`:"is not registered in context.methods, context.functions, or context.utils, and is not an element method",a=`[smbls] el.call('${o}') at <${i}>: "${o}" ${g}. Returning undefined (unchanged behavior) \u2014 check the name for typos or register the function on the project. Warned once per name; repeat misses are silent.`;u(t,"error",[a]),console.error(a)}function R(...t){return u(this,"warn",t),s.warn.apply(this,t)}function v(...t){return u(this,"error",t),s.error.apply(this,t)}const f={update:_.update,remove:d.remove,getDB:s.getDB,getQuery:s.getQuery,getRootData:s.getRootData,getPath:s.getPath,nextElement:s.nextElement,previousElement:s.previousElement,verbose:s.verbose,warn:R,error:v,variables:s.variables,spotByPath:s.spotByPath,set(t,e){const n=this.__ref;if(n){if(n.__setLocked){n.__setQueued={content:t,options:e};return}n.__setLocked=!0}try{if(this.removeContent(),t!=null){const o=this.context?.__create;o&&o(t,this,"content",e)}this.__ref&&(this.__ref.contentManaged=!0)}finally{if(n){n.__setLocked=!1;const o=n.__setQueued;o&&(n.__setQueued=null,this.set(o.content,o.options))}}},reset(t){const e=this.context?.__create;if(!e)return this;const n=this.parent,o=this.key,r=this.parse();return this.remove(),e(r,n,o,t)},lookup(t){let e=this.parent;for(;e;){if(typeof t=="function"){if(t(e))return e}else if(typeof t=="string"){if(e.key===t)return e;if(e[t]&&e[t].__ref)return e[t]}e=e.parent}return null},lookdown(t){const e=this.__ref;if(!e?.__children)return null;for(const n of e.__children){const o=this[n];if(!o)continue;if(typeof t=="function"){if(t(o))return o}else if(typeof t=="string"&&o.key===t)return o;const r=o.lookdown?.(t);if(r)return r}return null},lookdownAll(t,e=[]){const n=this.__ref;if(!n?.__children)return e;for(const o of n.__children){const r=this[o];r&&(typeof t=="function"?t(r)&&e.push(r):typeof t=="string"&&r.key===t&&e.push(r),r.lookdownAll?.(t,e))}return e},getRef(t){return t?this.__ref&&this.__ref[t]:this.__ref},getChildren(){const t=this.__ref&&this.__ref.__children;return Array.isArray(t)?t.map(e=>this[e]):[]},getRoot:s.getRoot,getRootState:s.getRootState,getRootContext:s.getRootContext,getContext:s.getContext,parse(t){const e={},n=t?new Set(t):null,o=this.__ref?.__exec;for(const r in this)if(!(r==="parent"||r==="node"||r==="__ref")&&!n?.has(r)){if(o&&o[r]!==void 0){e[r]=o[r];continue}typeof this[r]!="function"&&(e[r]=this[r])}return e},parseDeep(t){const e=this.parse(t),n=this.__ref;if(n?.__children)for(const o of n.__children)this[o]?.parseDeep&&(e[o]=this[o].parseDeep(t));return e},keys(){return Object.keys(this)},log(...t){if(t.length){const e={};for(const n of t)e[n]=this[n];console.log(e)}else console.log(this)},setProps(t,e){return this.update(t,e)},setNodeStyles(t){if(this.node?.style)for(const e in t){const n=t[e];if(n==null)continue;const o=e.replace(/[A-Z]/g,i=>"-"+i.toLowerCase()),r=String(n).replace(/\s*!important\s*$/,"");this.node.style.setProperty(o,r,"important")}},call(t,...e){const n=this.context,o=n?.methods?.[t]||n?.functions?.[t]||n?.utils?.[t]||this[t];if(typeof o=="function")return o.call(this,...e);(0,p.isLoudDevRuntime)()&&S(this,t,o)},removeContent(){const t=this.__ref;if(!t?.__children)return;const e=this.content;if(e?.remove){e.remove(),delete this.content;const n=t.__children.indexOf("content");n!==-1&&t.__children.splice(n,1)}e?.node?.parentNode&&e.node.parentNode.removeChild(e.node)}},l=new WeakMap;function b(t){if(!t)return f;let e=l.get(t);if(e)return e;e=Object.create(f);const n=t.methods;if(n)for(const o in n)e[o]=n[o];return l.set(t,e),e}function P(t){const e=b(t.context);Object.setPrototypeOf(t,e)}function A(t){if(!t)return!1;const e=l.get(t);if(!e)return!1;const n=t.methods;if(!n)return!1;for(const o in n)e[o]=n[o];return!0}
|
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.787";
|
package/dist/esm/src/create.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{createStore as
|
|
2
|
-
`+
|
|
1
|
+
import{createStore as St,createScopeStore as ko,isStore as K}from"@symbo.ls/signal";import{createEffect as w}from"@symbo.ls/signal";import{cacheNode as kt,detectTag as Kt}from"./cache.js";import{REGISTRY as V,LIFECYCLE_EVENTS as vo}from"./registry.js";import{registerEvent as wo,registerGlobalEvent as jo,globalEventKeyInfo as Eo}from"./delegate.js";import{applyExtends as Po}from"./extends.js";import{addMethods as To}from"./methods.js";import"./dispose.js";import{isLoudDevRuntime as tt}from"./devRuntime.js";import{mountBudgetExhausted as Vt,openMountBudget as Gt,closeMountBudget as Ht,enqueueMountWork as Wt}from"./mountScheduler.js";import{replaceLiteralsWithObjectFields as at,isPolyglotWritableKey as Do,markPolyglotSeeded as Lo}from"@symbo.ls/utils";import{runPluginHook as B}from"@symbo.ls/utils/function.js";import{applyStateMethods as ot}from"@symbo.ls/state";import{CSS_PROPS_REGISTRY as D,DEFAULT_CSS_PROPERTIES_LIST as P,pushStaticCssPass as zt,popStaticCssPass as Yt}from"css-in-props";import{css as st,wrapHoverRule as qt}from"@symbo.ls/css";import{pushConfig as R,popConfig as M}from"@symbo.ls/scratch";import{checkAttributeByTagName as ut,applyAttrTransforms as Oo,ATTR_TRANSFORMS as Ro,camelToAttr as dt,serializeAttrValue as H,isEnumeratedTrueFalseAttr as nt}from"attrs-in-props";import{resolveElementIdEngine as Mo}from"./engineRegistry.js";import{VERSION as No}from"./version.js";const Zt=Mo({uniqId:1,scopedStyleId:0},No),et=[];let vt=!1;function Qt(){return typeof Date<"u"&&typeof Date.now=="function"?Date.now():0}function $o(){return typeof document<"u"&&document.visibilityState==="hidden"}const Fo=250;function Xt(){if(!vt){if(vt=!0,typeof requestAnimationFrame!="function"){setTimeout(wt,0);return}$o()?setTimeout(wt,Fo):requestAnimationFrame(wt)}}const Io=300,Uo=15e4;function wt(){if(vt=!1,!et.length)return;const t=et.splice(0,et.length);for(let s=0;s<t.length;s++){const o=t[s];if(o.node){if(!o.node.isConnected){const r=o.__ref||(o.__ref={});r.__mountAttempts=(r.__mountAttempts||0)+1,r.__mountFirstAttemptAt==null&&(r.__mountFirstAttemptAt=Qt());const i=Qt()-r.__mountFirstAttemptAt;r.__mountAttempts<=Io&&i<Uo?(et.push(o),Xt()):console.warn("[DOMQL] onMounted dropped after",r.__mountAttempts,"attempts /",i,"ms \u2014 node never connected:",o.key||o.tag||o);continue}N("Mounted",o,o.__ref?.__mountOptions||{})}}}function jt(t,s){typeof t.onMounted=="function"&&(t.__ref.__mountOptions=s,et.push(t),Xt())}function Jt(t,s){if(typeof t.onContentUpdate!="function")return;t.context?.plugins?.length&&B("contentUpdate",t,s);const o=t.context?.designSystem;o&&R(o);try{t.onContentUpdate(t,t.state,t.context,s)}catch(r){if(t.context?.plugins?.length&&B("error",t,{hook:"onContentUpdate",error:r})||console.error('[DOMQL] Lifecycle "onContentUpdate" error:',r),t.context?.strictMode)throw r}finally{o&&M()}}function W(t){return t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90}function Bo(t){return t.charAt(2).toLowerCase()+t.slice(3)}function Ko(t){return t.toLowerCase()}function Et(t){const s=t.charCodeAt(0);return s===58||s===64||s===38||s===91}function rt(t,s){const o={...t};for(const r in s){const i=o[r],e=s[r];i&&e&&typeof i=="object"&&typeof e=="object"&&!Array.isArray(i)&&!Array.isArray(e)&&typeof i!="function"&&typeof e!="function"?o[r]=rt(i,e):o[r]=e}return o}function lt(t){if(typeof t=="string")return t||void 0;if(typeof t=="number"||typeof t=="bigint")return String(t)}function mt(t,s,o){return lt(t)||(s&&typeof s=="object"?lt(s.key):void 0)||String(o)}function z(t,s,o,r={},i){if(t==null||t===!1)return null;(typeof t=="string"||typeof t=="number")&&(t={text:t}),o=lt(o);const e=lt(t.key),n=Object.create(null);n.key=o||e||`_${Zt.uniqId++}`,n.parent=s||null,n.context=t.context||s?.context||r.context||{},n.context.__create||(n.context.__create=z);const c=n.__ref={__if:!0,__children:[],__exec:{},__effects:[],__eventCleanup:[],root:s?.__ref?.root||n,path:s?.__ref?.path?[...s.__ref.path,n.key]:[n.key],origin:t};if(o&&!t.extends&&!t.extend){const y=o.indexOf("_"),p=o.indexOf(".");let g=y>0?y:-1;if(p>0&&(g<0||p<g)&&(g=p),g>0){const b=o.substring(0,g),C=n.context?.components;C&&(C[b]||C["smbls."+b])?t={...t,extends:b}:C&&tt()&&(/^[A-Z]\w*_\d+$/.test(o)||/^[A-Z]\w*\.\w+$/.test(o))&&console.warn(`[smbls] auto-extend: key "${o}" looks like an instance of "${b}" but neither "${b}" nor "smbls.${b}" is registered in context.components \u2014 element will render as a plain <div>. Register the base component or rename the key.`)}}Po(n,t,r);const a=new Set(["childProps","attr","style","scope","data"]),u=n.props&&typeof n.props=="object"?n.props:null;for(const y in t){if(y==="parent"||y==="node"||y==="__ref"||y==="extends"||y==="context"||y==="props")continue;if(y==="key"){e&&(n.key=e);continue}const p=t[y],g=n[y],b=g&&p&&typeof g=="object"&&typeof p=="object"&&!Array.isArray(g)&&!Array.isArray(p)&&typeof g!="function"&&typeof p!="function";b&&y.charCodeAt(0)>=65&&y.charCodeAt(0)<=90?n[y]=rt(g,p):b&&a.has(y)?n[y]={...g,...p}:b&&Et(y)?n[y]=rt(g,p):n[y]=p}function d(y){for(const p in y){const g=y[p],b=n[p],C=b&&g&&typeof b=="object"&&typeof g=="object"&&!Array.isArray(b)&&!Array.isArray(g)&&typeof b!="function"&&typeof g!="function";C&&p.charCodeAt(0)>=65&&p.charCodeAt(0)<=90?n[p]=rt(b,g):C&&a.has(p)?n[p]={...b,...g}:C&&Et(p)?n[p]=rt(b,g):n[p]=g}}u&&d(u),t.props&&typeof t.props=="object"&&d(t.props),t.data!==void 0&&(n.data=t.data),t.classlist!==void 0&&(n.classlist=t.classlist),t.text!==void 0&&(n.text=t.text),t.html!==void 0&&(n.html=t.html);const f=n.scope&&typeof n.scope=="object"?n.scope:null,l=s?.scope,h=n.context&&typeof n.context.globalScope=="object"&&n.context.globalScope||null,_=l||h||null;if(t.scope!==void 0||f){const y={};f&&Object.assign(y,f),t.scope!==void 0&&Object.assign(y,t.scope),n.scope=ko(y,_)}else _&&(n.scope=_);if(t.if!==void 0&&(n.if=t.if),To(n),Vo(n,s,t),n.if!=null){let y;if(typeof n.if=="function")try{y=n.if(n,n.state,n.context)}catch(p){if(y=!1,c.__ifError=p,typeof console<"u"&&console.warn){const g=n.key||n.tag||"?";console.warn(`[smbls] \`if:\` evaluator threw on ${g} \u2014 treating as false:`,p?.message||p)}}else y=n.if;c.__if=!!y}if(c.__if)typeof n.if=="function"&&(c.__ifInitialized=!0);else return s&&(s[n.key]=n),typeof n.if=="function"&&no(n,c,n.if),n;n.tag||(n.tag=Kt(n)),N("Init",n,r);const x=n.node=kt(n);if(!x)return n;if(n.tag==="fragment"){const p=(n.context?.document||globalThis.document).createComment("");x.appendChild(p),c.__fragmentAnchor=p}N("AttachNode",n,r),x.setAttribute&&n.key&&x.setAttribute("data-key",n.key),s&&(s[n.key]=n,s.__ref?.__children&&(s.__ref.__children.includes(n.key)||s.__ref.__children.push(n.key))),x.setAttribute&&n.context?.scopeSelector&&n.context.scopeSelector!==":root"&&n.context.key&&n.key===n.context.key&&x.setAttribute("data-smbls-app",n.context.key),n.id&&x.setAttribute&&(x.id=n.id),_o(n,r),oo(n),Tt(n),yo(n),es(n);try{go(n,r)}catch(y){if(typeof console<"u"&&console.error){const p=n.__ref?.path?.join(".")||n.key||"<root>";console.error(`[smbls] createChildren failed at ${p}:`,y?.message||y,y?.stack?`
|
|
2
|
+
`+y.stack.split(`
|
|
3
3
|
`).slice(0,6).join(`
|
|
4
|
-
`):"")}}if(_t(o,!0),po(o,e,n),typeof o.html=="function"&&o.node&&!o.node.innerHTML){const _=o.context?.designSystem;_&&R(_);try{const p=o.html(o,o.state,o.context);p!=null&&typeof p!="function"&&(o.node.innerHTML=p)}catch{}finally{_&&M()}}if($("Create",o,r),$("Complete",o,r),$("Render",o,r),$("RenderRouter",o,r),wt(o,r),typeof o.onFrame=="function"){const _=o.onFrame,p=o.context?.designSystem,h=()=>{if(o.node){if(o.node.isConnected){p&&R(p);try{_(o,o.state,o.context)}catch(b){console.error("[DOMQL] onFrame error:",b)}finally{p&&M()}}requestAnimationFrame(h)}};requestAnimationFrame(h)}return o}function Fo(t,e,s){const r=!e,n=s.state&&typeof s.state=="object"&&!Array.isArray(s.state)&&Object.keys(s.state).length===0,o=r&&n&&t.context?.state,i=s.state!==void 0&&!o?s.state:t.state&&!K(t.state)?t.state:void 0;if(i==null){if(e?.state)t.state=e.state,ot(t,t.state);else if(t.context?.state){const a=t.context.state,c={...a},u=t.context?.polyglot;if(u?.translations){const d=t.context,f=a.lang||u.defaultLang||"en",l=new Set,y=(p,h)=>{l.has(p)||wo(d,p,c)&&(c[p]=h,l.add(p),jo(d,p))},g=u.translations[f];if(g&&typeof g=="object")for(const p in g)y(p,g[p]);const _=new Set(u.languages||[]);for(const p in u.translations)_.has(p)||y(p,u.translations[p])}t.state=K(c)?c:Ct(c),t.state.__element=t,t.state.root=t.state,ot(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),ot(t,t.state);return}if(typeof i=="string"){if(t.state=Xt(i,e),t.state&&typeof t.state=="object"&&!K(t.state)){const a=e?.state?.root||e?.state||t.state;Object.defineProperty(t.state,"root",{value:a,enumerable:!1,configurable:!0,writable:!0})}ot(t,t.state);return}if(typeof i=="function"){const a=i(t,e?.state);t.state=K(a)?a:Ct(a||{})}else K(i)?t.state=i:t.state=Ct({...i});t.state.__element=t,e?.state?(t.state.parent=e.state,t.state.root=e.state.root||e.state):t.state.root=t.state,ot(t,t.state)}function Et(t,e){if(!e)return t;const s=e.split("/");let r=t;for(const n of s){if(r==null)return{};r=r[n]}return r??{}}function Xt(t,e){if(!e)return{};if(t===".")return e.state||{};if(t.startsWith("../")){const n=t.slice(3);return n?Et(e.state,n):e.state??{}}if(t.startsWith("~/")){const n=e.state?.root||e.state,o=t.slice(2);return o?Et(n,o):n??{}}if(e.state?.[t]!==void 0)return e.state[t];const s=Et(e.state,t);if(s!=null&&Object.keys(s).length>0)return s;const r=e.context?.polyglot;if(r?.translations){const n=e.state?.root?.lang||r.defaultLang||"en",o=r.translations[n];if(o?.[t]!==void 0)return o[t];if(r.translations[t]!==void 0)return r.translations[t]}return{}}const Io=new Set(["s","state","ctx","context"]);function Uo(t){try{const s=Function.prototype.toString.call(t).match(/^[^(]*\(([^)]*)\)/);return s?s[1].split(",").map(r=>r.trim().split("=")[0].trim()).filter(Boolean):[]}catch{return[]}}function Bo(t){if(typeof t!="function"||t.length!==2)return!1;const e=Uo(t);if(e.length<2)return!1;const s=e[1].replace(/[{}[\]]/g,"").trim();return s.length>0&&!Io.has(s)}function Ko(t){const e=t.__ref,s=t.tag||"div",r=t.context?.designSystem,n=[],o=Object.keys(t);for(let i=0;i<o.length;i++){const a=o[i];if(typeof t[a]!="function"||V.has(a))continue;const c=a.charCodeAt(0);c>=65&&c<=90||W(a)||D[a]||P&&P.has(a)||ut(s,a)||(tt()&&Bo(t[a])&&console.warn(`[smbls] custom prop "${a}"${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('${a}', \u2026) instead of reading el.${a}(\u2026) directly (see RULES.md Rule 8).`),n.push({prop:a,fn:t[a]}))}for(let i=0;i<n.length;i++){const{prop:a,fn:c}=n[i];e.__exec[a]=c,Object.defineProperty(t,a,{get(){r&&R(r);try{return c(t,t.state,t.context)}catch{return}finally{r&&M()}},set(u){delete e.__exec[a],Object.defineProperty(t,a,{value:u,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function Vo(t,e){if(!(!Array.isArray(e)||e.length===0))for(let s=0;s<e.length;s++){const r=e[s];try{typeof r=="function"?r(t,t.state,t.context):typeof r=="string"&&t.state?.[r]}catch{}}}function L(t,e,s){return!Array.isArray(e)||e.length===0?s:function(...r){return Vo(t,e),s.apply(this,r)}}function it(t,e){if(!(!t||Array.isArray(t)||typeof t!="object"))return t[e]}function j(t,e){return()=>t.path.join(".")+"::"+e}function Jt(t,e){const s=t.__ref,r=!!(e&&e.skipIfEffect);if(Ko(t),typeof t.text=="function"){const o=t.text,i=L(t,t.textDeps,o),a=w(()=>{if(!s.contentManaged)try{let c=i(t,t.state,t.context);t.node&&c!=null&&typeof c!="function"&&typeof c!="object"&&(typeof c=="string"&&c.includes("{{")&&(c=at.call(t,c,t.state)),lt(t,c))}catch{}},{depth:s.path.length,label:j(s,"text")});s.__effects.push(a),s.__exec.text=o}else if(typeof t.text=="string"&&t.text.includes("{{")){const o=t.text,i=w(()=>{if(s.contentManaged)return;const a=at.call(t,o,t.state);a!=null&&(t.text=a),t.node&<(t,a??"")},{depth:s.path.length,label:j(s,"text")});s.__effects.push(i),s.__exec.text=o}for(const o of Object.keys(t))if(typeof t[o]=="function"&&!V.has(o)&&!W(o)&&!s.__exec[o]){if(D[o]){const i=t[o],a=L(t,t[o+"Deps"],i),c=o;let u,d=null,f=null,l;const y=w(()=>{const g=t.context?.designSystem;g&&R(g);try{const _=a(t,t.state,t.context);Ht();let p;try{p=D[c](_,t,t.state,t.context)}finally{Wt()}if(Array.isArray(p)){const b={};for(const x of p)if(x)for(const C in x)b[C]=x[C];p=b}const h=c==="show"||c==="hide";if(p&&t.node&&Go(p)){const b=pt(p);if(b===null||b!==l){l=b;const x=st(p,null,t.context?.cssPrefix),C=x?x.split(" ").filter(Boolean):null;if(t.node.classList){if(f)for(const A of f)t.node.classList.remove(A);if(C&&C.length)for(const A of C)t.node.classList.add(A);f=C}}u=void 0,d=null}else if(p&&t.node){if(f){for(const x of f)t.node.classList.remove(x);f=null,l=void 0}const b=pt(p);(b===null||b!==u||!ht(t.node,d))&&(u=b,q(t.node,p),d=yt(t.node,p))}else if(t.node&&h){u=void 0,d=null;const b=s.__explicitDisplay;t.node.style.display=typeof b=="string"?b:""}}finally{g&&M()}},{depth:s.path.length,label:j(s,c)});s.__effects.push(y),s.__exec[o]=i}else if(P&&P.has(o)){const i=t[o],a=L(t,t[o+"Deps"],i),c=o;let u,d=null;const f=w(()=>{const l=t.context?.designSystem;l&&R(l);try{const y=a(t,t.state,t.context);if(t.node)if(y!=null){const g=c+":"+String(y);if(g!==u||!ht(t.node,d)){u=g;const _={[c]:y};q(t.node,_),d=yt(t.node,_)}}else u=void 0,d=null,t.node.style[c]=""}finally{l&&M()}},{depth:s.path.length,label:j(s,c)});s.__effects.push(f),s.__exec[o]=i}}if(typeof t.html=="function"){const o=t.html,i=L(t,t.htmlDeps,o),a=w(()=>{const c=t.context?.designSystem;c&&R(c);try{const u=i(t,t.state,t.context);t.node&&u!=null&&typeof u!="function"&&(t.node.innerHTML=u)}finally{c&&M()}},{depth:s.path.length,label:j(s,"html")});s.__effects.push(a),s.__exec.html=o}if(typeof t.value=="function"){const o=t.value,i=L(t,t.valueDeps,o),a=w(()=>{try{const c=i(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const u=c==null?"":String(c);if(t.node.value===u)return;const d=typeof document<"u"&&document.activeElement===t.node,f=d&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,l=d&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=u,d&&f!=null&&l!=null)try{t.node.setSelectionRange(f,l)}catch{}}catch{}},{depth:s.path.length,label:j(s,"value")});s.__effects.push(a),s.__exec.value=o}if(typeof t.style=="function"){const o=t.style,i=L(t,t.styleDeps,o);let a,c=null;const u=w(()=>{const d=i(t,t.state,t.context),f=pt(d);(f===null||f!==a||!ht(t.node,c))&&(a=f,q(t.node,d),c=yt(t.node,d))},{depth:s.path.length,label:j(s,"style")});s.__effects.push(u),s.__exec.style=o}else if(t.style&&typeof t.style=="object")for(const o in t.style){const i=t.style[o];if(typeof i!="function")continue;const a=L(t,it(t.styleDeps,o),i);let c,u=null;const d=w(()=>{try{const f=a(t,t.state,t.context);if(t.node){const l=o+":"+String(f);if(l!==c||!ht(t.node,u)){c=l;const y={[o]:f};q(t.node,y),u=yt(t.node,y)}}}catch{}},{depth:s.path.length,label:j(s,"style."+o)});s.__effects.push(d)}if(t.attr&&typeof t.attr=="object"){for(const o in t.attr)if(typeof t.attr[o]=="function"){const i=L(t,it(t.attrDeps,o),t.attr[o]),a=o,c=w(()=>{try{const u=i(t,t.state,t.context);t.node?.setAttribute&&(u==null||u===!1&&!et(a)?t.node.removeAttribute(a):typeof u!="function"&&typeof u!="object"&&t.node.setAttribute(a,H(a,u)))}catch{}},{depth:s.path.length,label:j(s,"attr."+a)});c._attrName=a.toLowerCase(),s.__effects.push(c)}}if(t.aria&&typeof t.aria=="object")for(const o in t.aria){if(typeof t.aria[o]!="function")continue;const i=L(t,it(t.ariaDeps,o),t.aria[o]),a="aria-"+o.replace(/[A-Z]/g,u=>"-"+u.toLowerCase()),c=w(()=>{try{const u=i(t,t.state,t.context);if(!t.node?.setAttribute)return;u==null?t.node.removeAttribute(a):typeof u!="function"&&typeof u!="object"&&t.node.setAttribute(a,H(a,u))}catch{}},{depth:s.path.length,label:j(s,"aria."+o)});c._attrName=a,s.__effects.push(c)}if(t.data&&typeof t.data=="object")for(const o in t.data){if(typeof t.data[o]!="function")continue;const i=L(t,it(t.dataDeps,o),t.data[o]),c="data-"+o.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),u=w(()=>{try{const d=i(t,t.state,t.context);if(!t.node?.setAttribute)return;d==null||d===!1?t.node.removeAttribute(c):typeof d!="function"&&typeof d!="object"&&t.node.setAttribute(c,d===!0?"":d)}catch{}},{depth:s.path.length,label:j(s,"data."+o)});u._attrName=c,s.__effects.push(u)}const n=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(n)for(const o in n){if(typeof n[o]!="function")continue;const i=L(t,it(t.classDeps,o),n[o]),a=w(()=>{try{const c=i(t,t.state,t.context);if(!t.node?.classList)return;typeof c=="string"?t.node.classList.add(c):c?t.node.classList.add(o):t.node.classList.remove(o)}catch{}},{depth:s.path.length,label:j(s,"class."+o)});s.__effects.push(a)}!r&&typeof t.if=="function"&&to(t,s,t.if);for(const o of Object.keys(t)){if(V.has(o)||typeof t[o]!="function")continue;const i=o.charCodeAt(0);if(i>=65&&i<=90||W(o))continue;const a=t[o];s.__exec[o]=a;const c=t.tag||"div";if(ut(c,o)&&!D[o]&&!(P&&P.has(o))){const u=dt(o)||o,d=L(t,t[o+"Deps"],a),f=w(()=>{try{const l=d(t,t.state,t.context);t.node?.setAttribute&&(l==null||l===!1&&!et(u)?t.node.removeAttribute(u):typeof l!="function"&&typeof l!="object"&&(u==="src"&&"src"in t.node?t.node.src=l:t.node.setAttribute(u,H(u,l))))}catch{}},{depth:s.path.length,label:j(s,o)});f._attrName=u.toLowerCase(),s.__effects.push(f)}}if(zo(t),Zo(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const o=t.onStateUpdate,i=t.stateDeps;let a=!1,c=[];const u=w(()=>{const d=[];for(let g=0;g<i.length;g++){const _=i[g];try{d[g]=typeof _=="function"?_(t,t.state,t.context):t.state?.[_]}catch{d[g]=void 0}}if(!a){a=!0,c=d;return}let f=d.length!==c.length;for(let g=0;!f&&g<d.length;g++)d[g]!==c[g]&&(f=!0);const l=c;if(c=d,!f)return;const y=t.context?.designSystem;y&&R(y);try{o(t,t.state,t.context,{prev:l,next:d})}catch(g){if(t.context?.plugins?.length&&B("error",t,{hook:"onStateUpdate",error:g})||console.error('[DOMQL] Lifecycle "onStateUpdate" error:',g),t.context?.strictMode)throw g}finally{y&&M()}},{depth:s.path.length,label:j(s,"onStateUpdate")});s.__effects.push(u)}qo(t)}function mt(t){const e=t.parent,s=e?.node;if(!s||!t.node){po(t,t.parent);return}let r=null;const n=Object.keys(e),o=n.indexOf(t.key);for(let i=o+1;i<n.length;i++){const a=e[n[i]];if(a?.node?.parentNode===s){r=a.node;break}}r?s.insertBefore(t.node,r):s.appendChild(t.node)}function to(t,e,s){const r=L(t,t.ifDeps,s),n=w(()=>{let o;try{o=r(t,t.state,t.context)}catch(a){if(o=!1,e.__ifError=a,typeof console<"u"&&console.warn){const c=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${c} \u2014 treating as false:`,a?.message||a)}return}const i=e.__if;if(e.__if=!!o,i&&!e.__if&&t.node){t.node.remove();try{typeof t.onRemove=="function"&&t.onRemove(t)}catch(a){console.error("[smbls] onRemove error:",a)}}else if(!i&&e.__if)if(e.__ifInitialized)t.node||(t.node=kt(t)),t.node&&(t.node.ref=t),mt(t),Pt(t),$("Render",t,{}),wt(t,{});else{if(e.__ifInitialized=!0,t.tag||(t.tag=Ut(t)),$("Init",t,{}),t.node||(t.node=kt(t)),!t.node)return;if(t.parent?.__ref?.__children&&!t.parent.__ref.__children.includes(t.key)&&t.parent.__ref.__children.push(t.key),t.tag==="fragment"&&!e.__fragmentAnchor){const c=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(c),e.__fragmentAnchor=c}$("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),uo(t,{}),Jt(t,{skipIfEffect:!0}),Pt(t),fo(t),lo(t,{}),mt(t),$("Create",t,{}),$("Complete",t,{}),$("Render",t,{}),$("RenderRouter",t,{}),wt(t,{})}},{depth:e.path.length,label:j(e,"if")});e.__effects.push(n)}function lt(t,e){const s=t.node;if(!s)return;const r=e==null||typeof e=="object"?"":String(e);if(t.tag==="string"){s.nodeValue!==r&&(s.nodeValue=r);return}const n=t.__ref;let o=n?n.__textNode:null;if(o&&o.parentNode!==s&&(o=null),!o){const i=s.firstChild;i&&i.nodeType===3&&(o=i)}o?o.nodeValue!==r&&(o.nodeValue=r):s.firstChild?(o=(s.ownerDocument||t.context?.document||globalThis.document).createTextNode(r),s.insertBefore(o,s.firstChild)):(s.textContent=r,o=s.firstChild&&s.firstChild.nodeType===3?s.firstChild:null),n&&(n.__textNode=o||null)}function Pt(t){const{node:e}=t;if(e){if((typeof t.text=="string"&&!t.text.includes("{{")||typeof t.text=="number")&<(t,t.text),Xo(t),typeof t.html=="string"&&(e.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&"value"in e){const s=String(t.value);e.value!==s&&(e.value=s)}if(t.style&&typeof t.style=="object"){let s=t.style;for(const r in t.style)if(typeof t.style[r]=="function"){s={};for(const n in t.style)typeof t.style[n]!="function"&&(s[n]=t.style[n]);break}q(e,s)}if(t.attr&&typeof t.attr=="object")for(const s in t.attr){const r=t.attr[s];typeof r=="function"||typeof r=="object"||r!=null&&(r===!1&&!et(s)||e.setAttribute&&e.setAttribute(s,H(s,r)))}if(t.data&&typeof t.data=="object")for(const s in t.data){const r=t.data[s];typeof r=="function"||typeof r=="object"||r==null||r===!1||e.dataset&&(e.dataset[s]=r===!0?"":r)}if(t.classlist||t.class){const s=t.classlist||t.class;if(typeof s=="string")s.split(" ").forEach(r=>r&&e.classList.add(r));else if(typeof s=="object")for(const r in s){const n=typeof s[r]=="function"?s[r](t,t.state,t.context):s[r];n&&e.classList.add(typeof n=="string"?n:r)}}}}function pt(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function Go(t){if(!t||typeof t!="object")return!1;for(const e in t){const s=t[e];if(s&&typeof s=="object"&&!Array.isArray(s))return!0}return!1}function yt(t,e){if(!t||!t.style||!e)return null;const s=[];for(const r in e){if(e[r]==null||r.charAt(0)==="&")continue;const o=r.replace(/[A-Z]/g,i=>"-"+i.toLowerCase());s.push(o,t.style.getPropertyValue(o),t.style.getPropertyPriority(o))}return s}function ht(t,e){if(!e||!t||!t.style)return!1;for(let s=0;s<e.length;s+=3)if(t.style.getPropertyValue(e[s])!==e[s+1]||t.style.getPropertyPriority(e[s])!==e[s+2])return!1;return!0}function q(t,e){if(!t||!e||!t.style)return;let s=null;for(const r in e){const n=e[r];if(n!=null){if(r.charAt(0)==="&"&&typeof n=="object"){s||(s={}),s[r]=n;continue}try{const o=String(n),i=r.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),a=o.trim(),c=/\s*!important\s*$/.test(a),u=a.replace(/\s*!important\s*$/,"");t.style.setProperty(i,u,c?"important":"")}catch{}}}s&&Ho(t,s)}function Ho(t,e){const s=`_ds${Yt.scopedStyleId++}`;t.classList.add(s);const r=t.ownerDocument;let n=r.querySelector("style[data-smbls-scoped]");n||(n=r.createElement("style"),n.setAttribute("data-smbls-scoped",""),r.head.appendChild(n));let o="";for(const i in e){const a="."+s,c=i.replace(/&/g,a).split(",").map(d=>{const f=d.trim();return f.includes(a)?f:a+f}).join(", "),u=e[i];if(typeof u=="object"){let d="",f="";for(const l in u){const y=u[l];if(typeof y=="object"){const g=l.includes("&")?c.split(", ").map(p=>l.replace(/&/g,p)).join(", "):c.split(", ").map(p=>`${p} ${l}`).join(", ");let _="";for(const p in y)_+=`${p.replace(/[A-Z]/g,h=>"-"+h.toLowerCase())}: ${y[p]};`;f+=zt(`${g} { ${_} }`,g)+`
|
|
5
|
-
`}else d+=`${l.replace(/[A-Z]/g,
|
|
6
|
-
`),f&&(o+=f)}}o&&(n.textContent+=o)}const oo=new Set;function so(t){if(!Array.isArray(t))return"";const e=[];for(let s=0;s<t.length;s++)typeof t[s]=="string"&&t[s].length&&e.push(t[s]);return e.sort(),e.join("|")}function Wo(t,e,s){const r=so(s);queueMicrotask(()=>{if(!t.__ref)return;let n;try{n=e(t,t.state,t.context)}catch{return}if(so(n)===r)return;const o=t.__ref.path?t.__ref.path.join("."):t.key||"?";oo.has(o)||(oo.add(o),console.warn(`[smbls] subscribeTo function at "${o}" resolved to a DIFFERENT key list one microtask after create \u2014 wired [${s.join(", ")||"(none)"}], probed [${Array.isArray(n)?n.join(", "):String(n)}]. subscribeTo's function form is resolved ONCE at element-create time (registerSubscribeToEffects, @symbo.ls/element create.js) \u2014 this element stays wired to the ORIGINAL list for its whole lifetime, so this drift is invisible to the reactive effect and any key only present in the new list will never trigger onUpdate. If the watched key genuinely is not known until later (e.g. a module config that loads after shell boot), route the write through an imperative call instead of subscribeTo \u2014 see functions/moduleOpenBridge.js's moduleOpenPage (workspace repo) for the house pattern.`))})}function zo(t){const e=t.subscribeTo,s=typeof e=="function";let r=e;if(s)try{r=e(t,t.state,t.context)}catch{r=null}if(s&&tt()&&Wo(t,e,Array.isArray(r)?r:[]),!Array.isArray(r)||r.length===0)return;const n=t.__ref;for(let o=0;o<r.length;o++){const i=r[o];if(typeof i!="string"||i.length===0)continue;const a=i.split("."),c=a[0],u=a.slice(1),d={value:!1},f=w(()=>{const l=t.state&&(K(t.state)?t.state.root:null);if(!l||!K(l))return;let y=l;y=y[c];for(let _=0;_<u.length&&!(y==null||typeof y!="object");_++)if(K(y))y=y[u[_]];else break;if(!d.value)return;let g=!1;if(typeof t.onBeforeUpdate=="function"){const _=t.context?.designSystem;_&&R(_);try{if(os(n)){const p=t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0});p&&typeof p.then=="function"?p.then(()=>gt(n,!1),h=>{gt(n,!0),t.context?.plugins?.length&&B("error",t,{hook:"onBeforeUpdate",error:h})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",h)}):(gt(n,!1),p===!1&&(g=!0))}}catch(p){gt(n,!0),t.context?.plugins?.length&&B("error",t,{hook:"onBeforeUpdate",error:p})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",p)}finally{_&&M()}}if(!g&&t.node&&n.__effects)for(let _=0;_<n.__effects.length;_++){const p=n.__effects[_];p&&p!==f&&!p._disposed&&!p._isSubscribeToEffect&&typeof p._execute=="function"&&p._execute()}if(!g&&typeof t.onUpdate=="function"){const _=t.context?.designSystem;_&&R(_);try{t.onUpdate(t,t.state,t.context)}catch(p){t.context?.plugins?.length&&B("error",t,{hook:"onUpdate",error:p})||console.error("[DOMQL] subscribeTo onUpdate error:",p)}finally{_&&M()}}},{depth:n.path.length,label:j(n,"subscribeTo("+i+")")});d.value=!0,f._isSubscribeToEffect=!0,n.__effects.push(f)}}function Tt(t,e){return t.charCodeAt(0)===64&&t.length>1&&!t.startsWith("@media")&&!t.startsWith("@keyframes")&&!t.startsWith("@supports")&&!t.startsWith("@container")&&(t==="@dark"||t==="@light"||!e.context?.designSystem?.media?.[t.slice(1)])}function Dt(t,e){if(t.charCodeAt(0)!==64||/^@(media|supports|container|keyframes)\b/.test(t))return t;const s=e.context?.designSystem?.media?.[t.slice(1)];return s?/^@(media|supports|container)\b/.test(s)?s:`@media ${s}`:t}const eo=new Set;function Yo(t,e){const s=e?.__ref?.path?e.__ref.path.join("."):e?.key||"?",r=s+"::"+t;eo.has(r)||(eo.add(r),console.warn(`[smbls/css] "${t}" at ${s} is a CHILD-COMPONENT key nested inside a pseudo/selector block (":hover", "@dark", etc.) \u2014 that is never a valid CSS selector fragment. The rule is DROPPED (not shipped as a dead/never-matching selector). To reveal a child on a parent state, target the child's OWN class from the parent selector instead, e.g. move the declaration onto the child element itself, or use a sibling-selector combinator in a top-level style block.`))}function Z(t,e,s){const r={},n=new Set,o=(i,a,c)=>{const u=c?new Set(Object.keys(r)):null;if(D[i]){const d=D[i](a,e,e.state,e.context);if(d){const f=Array.isArray(d)?d:[d];for(const l of f)l&&Object.assign(r,l)}}else r[i]=a;if(c)for(const d in r)u.has(d)||n.add(d)};for(const i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;let a=t[i];if(typeof a=="function"&&(a=a(e,e.state,e.context)),a==null||typeof a=="function")continue;if(typeof a=="object"&&!Array.isArray(a)){if(i==="style"){for(const f in a){let l=a[f];if(typeof l=="function"&&(l=l(e,e.state,e.context)),l==null||typeof l=="function")continue;const y=typeof e[f]=="function"&&(D[f]||P&&P.has(f));o(f,l,y)}continue}if(Tt(i,e)){const f=Z(a,e,!1);Object.keys(f).length&&(r[`[data-theme="${i.slice(1)}"] &`]=f);continue}if(/^[A-Z][A-Za-z0-9]*$/.test(i)){tt()&&Yo(i,e);continue}const u=Dt(i,e),d=Z(a,e,!1);Object.keys(d).length&&(r[u]=d);continue}const c=typeof e[i]=="function"&&(D[i]||P&&P.has(i));o(i,a,c)}if(s)for(const i in r)n.add(i);for(const i of n){const a=r[i];typeof a=="string"&&!a.includes("!important")&&(r[i]=a+" !important")}return r}function Lt(t,e){if(e===void 0&&(e=0),e>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)&&Lt(t[s],e+1))return!0}return!1}function no(t,e,s){if(!e||typeof e!="object"||Array.isArray(e))return null;if(Tt(t,s)){const o=Z(e,s,!1);return Object.keys(o).length?{cssProp:`[data-theme="${t.slice(1)}"] &`,block:o}:null}const r=Dt(t,s),n=Z(e,s,!1);return Object.keys(n).length?{cssProp:r,block:n}:null}function qo(t){const e=t.__ref;for(const s of Object.keys(t)){if(!jt(s))continue;const r=t[s];if(!r||typeof r!="object"||Array.isArray(r)||!Lt(r))continue;let n=null,o;const i=w(()=>{if(!t.node)return;const a=t.context?.designSystem;a&&R(a);let c,u=!1;try{const d=no(s,r,t),f=d?pt(d.block)+"::"+d.cssProp:null;if(f!==null&&f===o)u=!0;else if(o=f,d){const l=st({[d.cssProp]:d.block},null,t.context?.cssPrefix);c=l?l.split(" ").filter(Boolean):null}else c=null}finally{a&&M()}if(!(u||!t.node.classList)){if(n)for(const d of n)t.node.classList.remove(d);if(c&&c.length)for(const d of c)t.node.classList.add(d);n=c}},{depth:e.path.length,label:j(e,"cssBlock("+s+")")});e.__effects.push(i)}}function Zo(t){const e=t.__ref;e.__conditionalRunners=[];const s=new Map;for(const r of Object.keys(t)){const n=r.charAt(0);if(n!=="."&&n!=="!")continue;const o=r.slice(1);if(!o)continue;if(/[:@\s>~+[\]]/.test(o)){if(typeof console<"u"&&console.warn){const y=o.split(/[:@\s>~+[\]]/)[0];console.warn(`[smbls] conditional \`${r}\` on ${t.key||"?"} will never match \u2014 the whole string after \`${n}\` is read as one prop name. Nest the selector inside instead: \`${n}${y}: { '${o.slice(y.length)}': {...} }\`.`)}continue}const i=t[r];if(!i||typeof i!="object")continue;const a=n==="!",c={lastMatch:!1,appliedKeys:null,appliedClasses:null},u=()=>{let y;const g=t[o];if(g===void 0){const h=!!t.state&&o in t.state,b=t.state?t.state[o]:void 0;if(h||b!==void 0)y=b;else{const x=t.context?.cases?.[o];if(x===void 0)return;try{y=typeof x=="function"?x.call(t,t):x}catch(C){y=!1,e.__conditionalError=C,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${r}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,C?.message||C)}}}else if(typeof g=="function")try{y=g(t,t.state,t.context)}catch(h){y=!1,e.__conditionalError=h,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${r}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,h?.message||h)}else y=g;const _=a?!y:!!y;if(!t.node||_===c.lastMatch)return;c.lastMatch=_;const p=t.context?.designSystem;p&&R(p);try{if(_){const h={},b={};let x=!1;for(const A in i){if(!Object.prototype.hasOwnProperty.call(i,A))continue;const v=i[A],G=A.charAt(0);if((G===":"||G==="@"||G==="&"||G==="[")&&v&&typeof v=="object"&&!Array.isArray(v)){if(Tt(A,t)){const E=Z(v,t,!1);Object.keys(E).length&&(b[`[data-theme="${A.slice(1)}"] &`]=E,x=!0)}else{const E=Dt(A,t),T=Z(v,t,!1);Object.keys(T).length&&(b[E]=T,x=!0)}continue}const Q=typeof v=="function"?v(t,t.state,t.context):v;if(Q!=null)if(D[A]){const E=D[A](Q,t,t.state,t.context);if(E){const T=Array.isArray(E)?E:[E];for(const X of T)X&&Object.assign(h,X)}}else P&&P.has(A)&&(h[A]=Q)}const C=Object.keys(h);if(C.length){q(t.node,h);for(const A of C)s.set(A,r);c.appliedKeys=C}else c.appliedKeys=null;if(x){const A=st(b,null,t.context?.cssPrefix),v=A?A.split(" ").filter(Boolean):[];if(v.length&&t.node.classList){for(const G of v)t.node.classList.add(G);c.appliedClasses=v}else c.appliedClasses=null}else if(c.appliedClasses){for(const A of c.appliedClasses)t.node.classList.remove(A);c.appliedClasses=null}}else{if(c.appliedKeys){for(const h of c.appliedKeys)s.get(h)===r&&(t.node.style[h]="",s.delete(h));c.appliedKeys=null}if(c.appliedClasses){for(const h of c.appliedClasses)t.node.classList.remove(h);c.appliedClasses=null}}}finally{p&&M()}};e.__conditionalRunners.push(u);const d=L(t,t[o+"Deps"],u),f=w(d,{depth:e.path.length,label:j(e,"conditional("+r+")")}),l=e.__exec&&e.__exec[o]||t[o];f._sources.size===0&&typeof l=="function"&&tt()&&console.warn(`[smbls] conditional \`${r}\` on ${t.key||"?"} subscribed to nothing \u2014 its predicate tracked no reactive read on its first run, so no state write will ever re-evaluate it (only a direct element.update() on this element re-runs it). If the predicate guards its state reads (\`in\`, short-circuits, \`?.\`), declare \`${o}Deps: [...]\` (state-key strings or \`(el, s) => \u2026\` selectors) so the subscription is armed unconditionally.`),e.__effects.push(f)}}const Ot=new WeakSet;function Qo(t){const e=t.ownerDocument;!e||Ot.has(e)||(Ot.add(e),queueMicrotask(()=>{Ot.delete(e);const s=e.body||e.documentElement;s&&s.offsetWidth}))}const Rt=new WeakSet;let ro=!1;function io(t){return t.startsWith("[data-theme=")||t.startsWith("@media")&&t.includes("prefers-color-scheme")}function Mt(t,e){const s={...t};for(const r in e){const n=e[r],o=s[r];s[r]=n&&typeof n=="object"&&o&&typeof o=="object"?Mt(o,n):n}return s}function co(t,e){const s={};for(const r in t){const n=t[r];if(n&&typeof n=="object"){const o=co(n,e);Object.keys(o).length&&(s[r]=o)}else e.has(r)||(s[r]=n)}return s}function Xo(t){const{node:e}=t;if(!e)return;if(ro||(ro=!0,st({display:"none"})),Rt.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}Rt.add(t);const s=t.context?.designSystem;s&&R(s),Ht();try{const r={};let n=!1,o=null,i=null,a=null;const c=(u,d)=>{if(d&&typeof d=="object"&&io(u)){i||(i={});const f=i[u];f&&(d=Mt(f,d)),i[u]=d}else(d===null||typeof d!="object")&&(a||(a=new Set),a.add(u));r[u]=d};if(Object.prototype.hasOwnProperty.call(t,"theme")&&typeof t.theme!="function"&&D.theme){const u=D.theme(t.theme,t,t.state,t.context);if(u){const d=f=>{for(const l in f){const y=f[l];y&&typeof y=="object"&&io(l)&&(o||(o={}),o[l]=y),r[l]=y}};if(Array.isArray(u))for(const f of u)f&&d(f);else d(u);n=!0}}for(const u of Object.keys(t)){if(typeof t[u]=="function"||V.has(u)||u==="theme")continue;const d=u.charCodeAt(0);if(!(d>=65&&d<=90)&&!W(u)){if(D[u]){const f=t[u],l=D[u](f,t,t.state,t.context);if(l){if(Array.isArray(l)){for(const y of l)if(y)for(const g in y)c(g,y[g])}else for(const y in l)c(y,l[y]);n=!0}}else if(P&&P.has(u)){const f=t[u];f!=null&&typeof f!="object"&&(c(u,f),n=!0)}else if(u.charCodeAt(0)===45){const f=t[u];f!=null&&typeof f!="object"&&(c(u,f),n=!0)}else if(u.charAt(0)==="&"||u.charAt(0)==="@"||u.charAt(0)===":"||u.charAt(0)==="["){const f=t[u];if(f&&typeof f=="object"&&!Array.isArray(f)){if(Lt(f))continue;const l=no(u,f,t);l&&(c(l.cssProp,l.block),n=!0)}}}}if(o)for(const u in o){let d=a?co(o[u],a):o[u];i&&i[u]&&(d=Mt(d,i[u])),Object.keys(d).length?r[u]=d:delete r[u]}if(n){r.display&&String(r.display).includes("!important")&&(e.style.setProperty("display",String(r.display).replace(/\s*!important\s*$/,""),"important"),delete r.display);const u=st(r,null,t.context?.cssPrefix);if(u&&e.classList){const f=u.split(" ").filter(Boolean);let l=!1;for(const y of f)e.classList.add(y),l||(y.charCodeAt(0)===95&&y.charCodeAt(1)===99||y.charCodeAt(0)===95&&y.indexOf("_c",1)!==-1)&&(l=!0);l&&Qo(e)}const d=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(d!=null){const f=r.display;if(f&&f!==d)if(d==="none"){const l=[];for(const y of e.classList)y.startsWith("_d-")&&y!=="_d-none"&&l.push(y);for(const y of l)e.classList.remove(y);e.classList.add("_d-none")}else e.style.display==="none"&&(typeof t.hide=="function"||typeof t.show=="function")||(e.style.display=t.display),t.__ref&&(t.__ref.__explicitDisplay=t.display)}}}finally{Wt(),s&&M(),Rt.delete(t)}}function fo(t){const{node:e}=t;if(!e||!e.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const n in t.aria){const o=t.aria[n];if(typeof o=="function"||typeof o=="object"||o==null)continue;const i="aria-"+n.replace(/[A-Z]/g,a=>"-"+a.toLowerCase());e.setAttribute(i,H(i,o))}const s=Eo(t);for(const n in s){const o=s[n];o!=null&&o!==!1&&typeof o!="function"&&typeof o!="object"&&e.setAttribute(n,o===!0?"":o)}const r=t.tag||"div";for(const n of Object.keys(t)){if(typeof t[n]=="function"||V.has(n)||n==="on"||s[n]!==void 0)continue;const o=n.charCodeAt(0);if(!(o>=65&&o<=90)&&!W(n)&&!(D[n]||P&&P.has(n))&&ut(r,n)){let i=t[n];if(i==null||(typeof i=="string"&&i.includes("{{")&&(i=at(i,t,t.state,t.context),t[n]=i),i==null||typeof i=="function"||typeof i=="object")||i===!1&&!et(dt(n)||n))continue;const a=dt(n)||n;e.setAttribute(a,H(a,i))}}}function ws(t,e){const{node:s}=t;if(!s||!s.setAttribute)return;const r=e.charCodeAt(0);if(r>=65&&r<=90||W(e)||D[e]||P&&P.has(e)||!ut(t.tag||"div",e))return;const n=dt(e)||e,o=n.toLowerCase(),i=t.__ref&&t.__ref.__effects;let a=!1;if(i)for(let d=0;d<i.length;d++){const f=i[d];f&&f._attrName===o&&!f._disposed&&typeof f._execute=="function"&&(a=!0,f._execute())}if(a)return;let c=t[e];const u=Po[e];if(u&&c!=null){const d=u(t);d!==void 0&&(c=d)}typeof c=="string"&&c.includes("{{")&&(c=at(c,t,t.state,t.context)),c==null||c===!1&&!et(n)?s.removeAttribute(n):typeof c!="function"&&typeof c!="object"&&s.setAttribute(n,H(n,c))}function Jo(t,e){const s=t.node,r=t.__ref;let n=r.__autoGrow;if(!e){if(n&&n.active){try{s.removeEventListener("input",n.resize)}catch{}s.style.height="",n.appliedMax!=null&&s.style.maxHeight===n.appliedMax&&(s.style.maxHeight=""),n.active=!1,n.appliedMax=null,n.lastMeasure=0}return}n||(n=r.__autoGrow={active:!1,appliedMax:null,lastMeasure:0,resize:()=>{if(s.scrollHeight===0&&n.lastMeasure>0)return;s.style.height="auto";const i=s.scrollHeight;s.style.height=i+"px",i>0&&(n.lastMeasure=i)}},r.__eventCleanup||(r.__eventCleanup=[]),r.__eventCleanup.push(()=>{try{s.removeEventListener("input",n.resize)}catch{}})),n.active||(s.addEventListener("input",n.resize),n.active=!0);const o=typeof e=="object"&&e.max!=null?String(e.max):null;o!==n.appliedMax&&(o==null?n.appliedMax!=null&&s.style.maxHeight===n.appliedMax&&(s.style.maxHeight=""):s.style.maxHeight=o,n.appliedMax=o),n.resize()}function mo(t){if(!t.autoGrow)return;const e=t.node;if(!e||e.tagName!=="TEXTAREA")return;const s=t.__ref,r=t.autoGrow,n=typeof r=="function"?L(t,t.autoGrowDeps,r):null,o=w(()=>{const i=t.autoGrow;let a=i;if(typeof i=="function")try{a=(i===r&&n?n:i)(t,t.state,t.context)}catch{a=null}Jo(t,a)},{depth:s.path.length,label:j(s,"autoGrow")});s.__effects||(s.__effects=[]),s.__effects.push(o),n&&(s.__exec.autoGrow=r)}const ao=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function uo(t,e){for(const s of Object.keys(t)){if(!W(s)||ao.has(s))continue;const r=ko(s);if(r){Co(r,t,t[s]);continue}let n=t[s];if(typeof n=="string"&&/^[A-Za-z_$][\w$]*$/.test(n)){const i=n;n=function(c){return t.call(i,c)}}if(typeof n!="function")continue;const o=$o(s);xo.has(o)||Ao(No(o),t,n)}ts(t)}function ts(t){const e=t.node;if(!e||!e.addEventListener)return;const s={};let r=!1;for(const l of ao){const y=t[l];typeof y=="function"&&(s[l]=y,r=!0)}if(!r)return;const n=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,o=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let i=0,a=0,c=0,u=!1;const d=l=>{const y=l.touches&&l.touches[0]||l.changedTouches&&l.changedTouches[0];y&&(i=y.clientX,a=y.clientY,c=Date.now(),u=!0)},f=l=>{if(!u)return;u=!1;const y=l.changedTouches&&l.changedTouches[0]||l.touches&&l.touches[0];if(!y)return;const g=y.clientX-i,_=y.clientY-a,p=Date.now()-c;if(p>o)return;const h=Math.abs(g),b=Math.abs(_);if(Math.max(h,b)<n)return;let x;if(h>b*1.2)x=g<0?"left":"right";else if(b>h*1.2)x=_<0?"up":"down";else return;const C="onSwipe"+x.charAt(0).toUpperCase()+x.slice(1),A=s[C],v=s.onSwipe;A&&A.call(t,l,t,t.state,t.context),v&&v.call(t,{direction:x,dx:g,dy:_,dt:p,event:l},t,t.state,t.context)};e.addEventListener("touchstart",d,{passive:!0}),e.addEventListener("touchend",f,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{e.removeEventListener("touchstart",d)}catch{}try{e.removeEventListener("touchend",f)}catch{}})}function ct(t,e){const s={...t};for(const r in e){const n=s[r],o=e[r];n&&o&&typeof n=="object"&&typeof o=="object"&&!Array.isArray(n)&&!Array.isArray(o)&&typeof n!="function"&&typeof o!="function"?s[r]=ct(n,o):s[r]=o}return s}function $t(t,e,s,r){if(!e||!t.node)return;const n=t.childExtends;if(Array.isArray(e)){const o=t.tag==="fragment",i=t.context?.document||globalThis.document,a=o?null:i?.createDocumentFragment();if(!o&&!a)return;const c=t.childProps,u=t.childrenAs,d=p=>{let h=e[p];const b=h;(typeof h=="string"||typeof h=="number")&&(h={text:h});let x=c;if(typeof c=="function")try{x=c(t,h)}catch{x=null}if(u==="state"){let A=b;(typeof b=="string"||typeof b=="number")&&(A={value:b,text:b}),h=x?{...x,state:A}:{state:A}}else x&&(h=ct(x,h));if(n&&!h.ignoreChildExtends)if(h.extends){const A=Array.isArray(h.extends)?h.extends:[h.extends],v=Array.isArray(n)?n:[n];h={...h,extends:[...v,...A]}}else h={...h,extends:n};const C=h?.key||b&&typeof b=="object"&&b.key||`${p}`;try{return z(h,t,C,s)}catch(A){if(typeof console<"u"&&console.error){const v=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${C}" failed to construct at ${v} (initial render, skipping this row):`,A?.message||A)}return null}},f=t.__ref;if(!(r===!0&&!o&&!!f&&(s?.mountYield===!0||t.yieldChildren===!0))){for(let p=0;p<e.length;p++){const h=d(p);!o&&h?.node&&a.appendChild(h.node)}return o||t.node.appendChild(a),!0}const y=f.__childrenChunkGen=(f.__childrenChunkGen||0)+1;Kt();let g=null;const _=p=>{if(f.__disposed||f.__childrenChunkGen!==y){g&&g.parentNode&&g.remove();return}for(let h=p;h<e.length;h++){const b=d(h);if(b?.node&&(g?t.node.insertBefore(b.node,g):a.appendChild(b.node)),h+1<e.length&&Bt()){g||(g=i.createComment("smbls-mount"),a.appendChild(g),t.node.appendChild(a));const x=h+1;Gt(()=>_(x));return}}g?(g.remove(),t.node.tagName==="SELECT"&&_t(t,!0)):t.node.appendChild(a)};return _(0),Vt(),!0}if(typeof e=="string"){const o=Xt(e,t);if(Array.isArray(o))return $t(t,o,s,r)}if(typeof e=="object")for(const o in e){if(V.has(o))continue;let i=e[o];if(!(i==null||i===!1)){if((typeof i=="string"||typeof i=="number")&&(i={text:i}),t.childProps&&(i=ct(t.childProps,i)),n&&!i.ignoreChildExtends)if(i.extends){const a=Array.isArray(i.extends)?i.extends:[i.extends],c=Array.isArray(n)?n:[n];i={...i,extends:[...c,...a]}}else i={...i,extends:n};z(i,t,o,s)}}}function _t(t,e){const s=t.node;if(!s||s.tagName!=="SELECT")return;const r=s.options;if(!r||!r.length)return;const n=t.__ref,o=n&&n.__exec&&n.__exec.value,i=typeof o=="function",a=t.value!=null&&typeof t.value!="function";if(i||a){let d;if(i)try{d=o(t,t.state,t.context)}catch{return}else d=t.value;const f=d==null?"":String(d);s.value!==f&&(s.value=f);return}const c=e||!(n&&n.__selectSynced);if(n&&(n.__selectSynced=!0),!c)return;let u=-1;for(let d=0;d<r.length;d++)r[d].defaultSelected&&(u=d);u>=0&&s.selectedIndex!==u&&(s.selectedIndex=u)}function lo(t,e){let{children:s,content:r}=t;const n=t.childExtends;if(typeof s=="function"){const f=s;try{s=f(t,t.state,t.context)}catch(p){if(s=void 0,typeof console<"u"&&console.error){const h=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${h} (initial run, treating as empty):`,p?.message||p)}}t.children=s;const l=t.__ref;let y=!1;const g=L(t,t.childrenDeps,f),_=w(()=>{const p=y;y=!0;let h;try{h=g(t,t.state,t.context)}catch(E){if(typeof console<"u"&&console.error){const T=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${T}${p?"":" (initial tracking run)"}:`,E?.message||E)}return}if(!p||h===t.children)return;t.children=h,l.__childrenChunkGen!=null&&l.__childrenChunkGen++;const b=typeof t.onContentUpdate=="function",x=b?[]:null,C=b?[]:null,A=b?[]:null;if(Array.isArray(h)&&t.childrenAs==="state"){const E=t.childProps,T=[],X=new Map;for(let k=0;k<h.length;k++){const N=h[k];let S=E;if(typeof E=="function")try{S=E(t,N)}catch{S=null}const U=S&&S.key||N&&N.key||`${k}`;T.push(U),X.set(U,{rawChild:N,childProps:S})}const yo=new Set(T),ho=l.__children.slice();for(const k of ho)if(!yo.has(k)){const N=t[k];N?.remove&&N.remove(),delete t[k],C&&C.push(k)}const J=t.childExtends,ft=t.tag==="fragment",_o=t.context?.document||globalThis.document,m=ft?null:_o?.createDocumentFragment(),bt=new Set;for(const k of T){const N=X.get(k),S=N.rawChild,U=t[k];if(U&&U.state){if(S&&typeof S=="object"){const O=U.state,Y=O.$replace||O.replace,It=O.$update||O.update;try{if(typeof Y=="function")Y.call(O,S);else if(typeof It=="function"){for(const F in O)if(!(F==="__element"||F==="root"||F==="parent"||F==="update")&&!Object.prototype.hasOwnProperty.call(S,F))try{O[F]=void 0}catch{}It.call(O,S)}else for(const F in S)O[F]=S[F]}catch(F){if(typeof console<"u"&&console.error){const go=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${k}" failed to patch at ${go} (reconcile, keeping its previous data for this pass):`,F?.message||F)}}}A&&A.push(k);continue}let xt=S;(typeof S=="string"||typeof S=="number")&&(xt={value:S,text:S});const Ft=N.childProps;let I=Ft?{...Ft,state:xt}:{state:xt};if(J&&!I.ignoreChildExtends)if(I.extends){const O=Array.isArray(I.extends)?I.extends:[I.extends],Y=Array.isArray(J)?J:[J];I={...I,extends:[...Y,...O]}}else I={...I,extends:J};let At;try{At=z(I,t,k,e)}catch(O){if(typeof console<"u"&&console.error){const Y=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${k}" failed to construct at ${Y} (reconcile, skipping this row):`,O?.message||O)}bt.add(k);continue}!ft&&At?.node&&m&&m.appendChild(At.node),x&&x.push(k)}if(!ft&&m&&m.childNodes.length&&t.node&&t.node.appendChild(m),!ft&&t.node){let k=null;for(const N of T){const S=t[N]?.node;if(!S)continue;const U=k?k.nextSibling:t.node.firstChild;S!==U&&t.node.insertBefore(S,U),k=S}}l.__children=bt.size?T.filter(k=>!bt.has(k)):T,b&&(x.length||C.length)&&Qt(t,{added:x,removed:C,kept:A}),_t(t,!1);return}const Q=b?[...l.__children]:null;for(const E of[...l.__children]){const T=t[E];T?.remove&&T.remove(),delete t[E]}l.__children=[],$t(t,h,e),_t(t,!1),b&&Qt(t,{added:[...l.__children],removed:Q,kept:[]})},{depth:l.path.length,label:j(l,"children")});l.__effects.push(_)}const o=$t(t,s,e,!0);if(r!=null&&!(r&&r.__ref)){let f=r;if(typeof f=="string"||typeof f=="number"?f={text:f}:typeof f!="object"&&(f={}),t.childProps&&(f=ct(t.childProps,f)),n&&!f.ignoreChildExtends)if(f.extends){const l=Array.isArray(f.extends)?f.extends:[f.extends],y=Array.isArray(n)?n:[n];f={...f,extends:[...y,...l]}}else f={...f,extends:n};z(f,t,"content",e)}if(s&&!o)return;const i=t.context?.components||{};{const f=Object.keys(t);for(let l=0;l<f.length;l++){const y=f[l];if(!y.endsWith("Extends")||typeof t[y]!="string")continue;const g=y.slice(0,-7);if(!g||g.charCodeAt(0)<65||g.charCodeAt(0)>90)continue;const _={extends:t[y]};delete t[y];for(let p=l+1;p<f.length;p++){const h=f[p],b=h.charCodeAt(0);if(b>=65&&b<=90||V.has(h)||typeof t[h]=="function"&&(h.startsWith("on")||h.startsWith(".")))break;const x=t[h];x!==void 0&&(_[h]=x,delete t[h])}t[g]&&typeof t[g]=="object"?t[g]={..._,...t[g]}:t[g]=_}}const a=e?.mountYield===!0||t.yieldChildren===!0,c=Object.keys(t),u=f=>{if(V.has(f)||typeof t[f]!="object"||t[f]===null)return;const l=f.charCodeAt(0);if(l<65||l>90)return;let y=t[f];if(!y.__ref){if(!y.extends&&!y.extend){const g=i[f]||i[`smbls.${f}`];g&&(y={...y,extends:g})}if(t.childProps&&(y=ct(t.childProps,y)),n&&!y.ignoreChildExtends)if(y.extends){const g=Array.isArray(y.extends)?y.extends:[y.extends],_=Array.isArray(n)?n:[n];y={...y,extends:[..._,...g]}}else y={...y,extends:n};z(y,t,f,e)}};if(!a){for(const f of c)u(f);return}Kt();const d=f=>{for(let l=f;l<c.length;l++)if(u(c[l]),l+1<c.length&&Bt()){const y=l+1;Gt(()=>d(y));return}};d(0),Vt()}function po(t,e,s){const{node:r}=t;if(!r)return;r.ref=t;const n=e?.tag==="fragment"?e.__ref?.__fragmentAnchor:null;if(n){const i=n.parentNode;if(i){if(s?.position==="before"&&s.node)i.insertBefore(r,s.node);else if(s?.position==="after"&&s.node){const a=s.node.nextSibling;i.insertBefore(r,a||n)}else i.insertBefore(r,n);return}}const o=e?.node||(e?.nodeType?e:null);if(o)if(s?.position==="before"&&s.node)o.insertBefore(r,s.node);else if(s?.position==="after"&&s.node){const i=s.node.nextSibling;i?o.insertBefore(r,i):o.appendChild(r)}else o.appendChild(r)}const Nt=3;function os(t){return!t||t.__inBeforeUpdate||(t.__beforeUpdateFailCount||0)>=Nt?!1:(t.__inBeforeUpdate=!0,!0)}function gt(t,e){t&&(t.__inBeforeUpdate=!1,e?(t.__beforeUpdateFailCount=(t.__beforeUpdateFailCount||0)+1,t.__beforeUpdateFailCount===Nt&&typeof console<"u"&&console.error&&console.error(`[DOMQL] onBeforeUpdate failed ${Nt}x in a row on this element \u2014 pausing automatic retries until a future prop/state change re-arms it.`)):t.__beforeUpdateFailCount=0)}function $(t,e,s){const r=t.charAt(0).toLowerCase()+t.slice(1);e.context?.plugins?.length&&B(r,e,s);const n="on"+t,o=e[n];if(typeof o=="function"){const c=t==="Render"?"__inRender":t==="RenderRouter"?"__inRenderRouter":null;if(c){if(e.__ref[c])return!0;e.__ref[c]=!0}const u=e.context?.designSystem;u&&R(u);let d=!!c;try{const f=o(e,e.state,e.context,s);if(f&&typeof f.then=="function"){const l=e.__ref;return f.catch(y=>{e.context?.plugins?.length&&B("error",e,{hook:n,error:y})||console.error(`[DOMQL] Lifecycle "${n}" error:`,y)}).finally(()=>{c&&l&&(l[c]=!1)}),d=!1,!0}if(f===!1)return!1}catch(f){if(e.context?.plugins?.length&&B("error",e,{hook:n,error:f})||console.error(`[DOMQL] Lifecycle "${n}" error:`,f),e.context?.strictMode)throw f}finally{u&&M(),d&&e.__ref&&(e.__ref[c]=!1)}}return!0}var js=z;export{Nt as BEFORE_UPDATE_MAX_CONSECUTIVE_FAILURES,os as acquireBeforeUpdateGuard,z as create,js as default,vt as flushMounts,ws as reconcileAttrProp,gt as releaseBeforeUpdateGuard,lt as writeElementText};
|
|
4
|
+
`):"")}}if(gt(n,!0),bo(n,s,i),typeof n.html=="function"&&n.node&&!n.node.innerHTML){const y=n.context?.designSystem;y&&R(y);try{const p=n.html(n,n.state,n.context);p!=null&&typeof p!="function"&&(n.node.innerHTML=p)}catch{}finally{y&&M()}}if(N("Create",n,r),N("Complete",n,r),N("Render",n,r),N("RenderRouter",n,r),jt(n,r),typeof n.onFrame=="function"){const y=n.onFrame,p=n.context?.designSystem,g=()=>{if(n.node){if(n.node.isConnected){p&&R(p);try{y(n,n.state,n.context)}catch(b){console.error("[DOMQL] onFrame error:",b)}finally{p&&M()}}requestAnimationFrame(g)}};requestAnimationFrame(g)}return n}function Vo(t,s,o){const r=!s,i=o.state&&typeof o.state=="object"&&!Array.isArray(o.state)&&Object.keys(o.state).length===0,e=r&&i&&t.context?.state,n=o.state!==void 0&&!e?o.state:t.state&&!K(t.state)?t.state:void 0;if(n==null){if(s?.state)t.state=s.state,ot(t,t.state);else if(t.context?.state){const c=t.context.state,a={...c},u=t.context?.polyglot;if(u?.translations){const d=t.context,f=c.lang||u.defaultLang||"en",l=new Set,h=(y,p)=>{l.has(y)||Do(d,y,a)&&(a[y]=p,l.add(y),Lo(d,y))},_=u.translations[f];if(_&&typeof _=="object")for(const y in _)h(y,_[y]);const x=new Set(u.languages||[]);for(const y in u.translations)x.has(y)||h(y,u.translations[y])}t.state=K(a)?a:St(a),t.state.__element=t,t.state.root=t.state,ot(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),ot(t,t.state);return}if(typeof n=="string"){if(t.state=to(n,s),t.state&&typeof t.state=="object"&&!K(t.state)){const c=s?.state?.root||s?.state||t.state;Object.defineProperty(t.state,"root",{value:c,enumerable:!1,configurable:!0,writable:!0})}ot(t,t.state);return}if(typeof n=="function"){const c=n(t,s?.state);t.state=K(c)?c:St(c||{})}else K(n)?t.state=n:t.state=St({...n});t.state.__element=t,s?.state?(t.state.parent=s.state,t.state.root=s.state.root||s.state):t.state.root=t.state,ot(t,t.state)}function Pt(t,s){if(!s)return t;const o=s.split("/");let r=t;for(const i of o){if(r==null)return{};r=r[i]}return r??{}}function to(t,s){if(!s)return{};if(t===".")return s.state||{};if(t.startsWith("../")){const i=t.slice(3);return i?Pt(s.state,i):s.state??{}}if(t.startsWith("~/")){const i=s.state?.root||s.state,e=t.slice(2);return e?Pt(i,e):i??{}}if(s.state?.[t]!==void 0)return s.state[t];const o=Pt(s.state,t);if(o!=null&&Object.keys(o).length>0)return o;const r=s.context?.polyglot;if(r?.translations){const i=s.state?.root?.lang||r.defaultLang||"en",e=r.translations[i];if(e?.[t]!==void 0)return e[t];if(r.translations[t]!==void 0)return r.translations[t]}return{}}const Go=new Set(["s","state","ctx","context"]);function Ho(t){try{const o=Function.prototype.toString.call(t).match(/^[^(]*\(([^)]*)\)/);return o?o[1].split(",").map(r=>r.trim().split("=")[0].trim()).filter(Boolean):[]}catch{return[]}}function Wo(t){if(typeof t!="function"||t.length!==2)return!1;const s=Ho(t);if(s.length<2)return!1;const o=s[1].replace(/[{}[\]]/g,"").trim();return o.length>0&&!Go.has(o)}function zo(t){const s=t.__ref,o=t.tag||"div",r=t.context?.designSystem,i=[],e=Object.keys(t);for(let n=0;n<e.length;n++){const c=e[n];if(typeof t[c]!="function"||V.has(c))continue;const a=c.charCodeAt(0);a>=65&&a<=90||W(c)||D[c]||P&&P.has(c)||ut(o,c)||(tt()&&Wo(t[c])&&console.warn(`[smbls] custom prop "${c}"${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('${c}', \u2026) instead of reading el.${c}(\u2026) directly (see RULES.md Rule 8).`),i.push({prop:c,fn:t[c]}))}for(let n=0;n<i.length;n++){const{prop:c,fn:a}=i[n];s.__exec[c]=a,Object.defineProperty(t,c,{get(){r&&R(r);try{return a(t,t.state,t.context)}catch{return}finally{r&&M()}},set(u){delete s.__exec[c],Object.defineProperty(t,c,{value:u,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function Yo(t,s){if(!(!Array.isArray(s)||s.length===0))for(let o=0;o<s.length;o++){const r=s[o];try{typeof r=="function"?r(t,t.state,t.context):typeof r=="string"&&t.state?.[r]}catch{}}}function L(t,s,o){return!Array.isArray(s)||s.length===0?o:function(...r){return Yo(t,s),o.apply(this,r)}}function it(t,s){if(!(!t||Array.isArray(t)||typeof t!="object"))return t[s]}function j(t,s){return()=>t.path.join(".")+"::"+s}function oo(t,s){const o=t.__ref,r=!!(s&&s.skipIfEffect);if(zo(t),typeof t.text=="function"){const e=t.text,n=L(t,t.textDeps,e),c=w(()=>{if(!o.contentManaged)try{let a=n(t,t.state,t.context);t.node&&a!=null&&typeof a!="function"&&typeof a!="object"&&(typeof a=="string"&&a.includes("{{")&&(a=at.call(t,a,t.state)),pt(t,a))}catch{}},{depth:o.path.length,label:j(o,"text")});o.__effects.push(c),o.__exec.text=e}else if(typeof t.text=="string"&&t.text.includes("{{")){const e=t.text,n=w(()=>{if(o.contentManaged)return;const c=at.call(t,e,t.state);c!=null&&(t.text=c),t.node&&pt(t,c??"")},{depth:o.path.length,label:j(o,"text")});o.__effects.push(n),o.__exec.text=e}for(const e of Object.keys(t))if(typeof t[e]=="function"&&!V.has(e)&&!W(e)&&!o.__exec[e]){if(D[e]){const n=t[e],c=L(t,t[e+"Deps"],n),a=e;let u,d=null,f=null,l;const h=w(()=>{const _=t.context?.designSystem;_&&R(_);try{const x=c(t,t.state,t.context);zt();let y;try{y=D[a](x,t,t.state,t.context)}finally{Yt()}if(Array.isArray(y)){const g={};for(const b of y)if(b)for(const C in b)g[C]=b[C];y=g}const p=a==="show"||a==="hide";if(y&&t.node&&qo(y)){const g=yt(y);if(g===null||g!==l){l=g;const b=st(y,null,t.context?.cssPrefix),C=b?b.split(" ").filter(Boolean):null;if(t.node.classList){if(f)for(const A of f)t.node.classList.remove(A);if(C&&C.length)for(const A of C)t.node.classList.add(A);f=C}}u=void 0,d=null}else if(y&&t.node){if(f){for(const b of f)t.node.classList.remove(b);f=null,l=void 0}const g=yt(y);(g===null||g!==u||!_t(t.node,d))&&(u=g,Z(t.node,y),d=ht(t.node,y))}else if(t.node&&p){u=void 0,d=null;const g=o.__explicitDisplay;t.node.style.display=typeof g=="string"?g:""}}finally{_&&M()}},{depth:o.path.length,label:j(o,a)});o.__effects.push(h),o.__exec[e]=n}else if(P&&P.has(e)){const n=t[e],c=L(t,t[e+"Deps"],n),a=e;let u,d=null;const f=w(()=>{const l=t.context?.designSystem;l&&R(l);try{const h=c(t,t.state,t.context);if(t.node)if(h!=null){const _=a+":"+String(h);if(_!==u||!_t(t.node,d)){u=_;const x={[a]:h};Z(t.node,x),d=ht(t.node,x)}}else u=void 0,d=null,t.node.style[a]=""}finally{l&&M()}},{depth:o.path.length,label:j(o,a)});o.__effects.push(f),o.__exec[e]=n}}if(typeof t.html=="function"){const e=t.html,n=L(t,t.htmlDeps,e),c=w(()=>{const a=t.context?.designSystem;a&&R(a);try{const u=n(t,t.state,t.context);t.node&&u!=null&&typeof u!="function"&&(t.node.innerHTML=u)}finally{a&&M()}},{depth:o.path.length,label:j(o,"html")});o.__effects.push(c),o.__exec.html=e}if(typeof t.value=="function"){const e=t.value,n=L(t,t.valueDeps,e),c=w(()=>{try{const a=n(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const u=a==null?"":String(a);if(t.node.value===u)return;const d=typeof document<"u"&&document.activeElement===t.node,f=d&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,l=d&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=u,d&&f!=null&&l!=null)try{t.node.setSelectionRange(f,l)}catch{}}catch{}},{depth:o.path.length,label:j(o,"value")});o.__effects.push(c),o.__exec.value=e}if(typeof t.style=="function"){const e=t.style,n=L(t,t.styleDeps,e);let c,a=null;const u=w(()=>{const d=n(t,t.state,t.context),f=yt(d);(f===null||f!==c||!_t(t.node,a))&&(c=f,Z(t.node,d),a=ht(t.node,d))},{depth:o.path.length,label:j(o,"style")});o.__effects.push(u),o.__exec.style=e}else if(t.style&&typeof t.style=="object")for(const e in t.style){const n=t.style[e];if(typeof n!="function")continue;const c=L(t,it(t.styleDeps,e),n);let a,u=null;const d=w(()=>{try{const f=c(t,t.state,t.context);if(t.node){const l=e+":"+String(f);if(l!==a||!_t(t.node,u)){a=l;const h={[e]:f};Z(t.node,h),u=ht(t.node,h)}}}catch{}},{depth:o.path.length,label:j(o,"style."+e)});o.__effects.push(d)}if(t.attr&&typeof t.attr=="object"){for(const e in t.attr)if(typeof t.attr[e]=="function"){const n=L(t,it(t.attrDeps,e),t.attr[e]),c=e,a=w(()=>{try{const u=n(t,t.state,t.context);t.node?.setAttribute&&(u==null||u===!1&&!nt(c)?t.node.removeAttribute(c):typeof u!="function"&&typeof u!="object"&&t.node.setAttribute(c,H(c,u)))}catch{}},{depth:o.path.length,label:j(o,"attr."+c)});a._attrName=c.toLowerCase(),o.__effects.push(a)}}if(t.aria&&typeof t.aria=="object")for(const e in t.aria){if(typeof t.aria[e]!="function")continue;const n=L(t,it(t.ariaDeps,e),t.aria[e]),c="aria-"+e.replace(/[A-Z]/g,u=>"-"+u.toLowerCase()),a=w(()=>{try{const u=n(t,t.state,t.context);if(!t.node?.setAttribute)return;u==null?t.node.removeAttribute(c):typeof u!="function"&&typeof u!="object"&&t.node.setAttribute(c,H(c,u))}catch{}},{depth:o.path.length,label:j(o,"aria."+e)});a._attrName=c,o.__effects.push(a)}if(t.data&&typeof t.data=="object")for(const e in t.data){if(typeof t.data[e]!="function")continue;const n=L(t,it(t.dataDeps,e),t.data[e]),a="data-"+e.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),u=w(()=>{try{const d=n(t,t.state,t.context);if(!t.node?.setAttribute)return;d==null||d===!1?t.node.removeAttribute(a):typeof d!="function"&&typeof d!="object"&&t.node.setAttribute(a,d===!0?"":d)}catch{}},{depth:o.path.length,label:j(o,"data."+e)});u._attrName=a,o.__effects.push(u)}const i=t.classlist&&typeof t.classlist=="object"&&!Array.isArray(t.classlist)?t.classlist:t.class&&typeof t.class=="object"&&!Array.isArray(t.class)?t.class:null;if(i)for(const e in i){if(typeof i[e]!="function")continue;const n=L(t,it(t.classDeps,e),i[e]),c=w(()=>{try{const a=n(t,t.state,t.context);if(!t.node?.classList)return;typeof a=="string"?t.node.classList.add(a):a?t.node.classList.add(e):t.node.classList.remove(e)}catch{}},{depth:o.path.length,label:j(o,"class."+e)});o.__effects.push(c)}!r&&typeof t.if=="function"&&no(t,o,t.if);for(const e of Object.keys(t)){if(V.has(e)||typeof t[e]!="function")continue;const n=e.charCodeAt(0);if(n>=65&&n<=90||W(e))continue;const c=t[e];o.__exec[e]=c;const a=t.tag||"div";if(ut(a,e)&&!D[e]&&!(P&&P.has(e))){const u=dt(e)||e,d=L(t,t[e+"Deps"],c),f=w(()=>{try{const l=d(t,t.state,t.context);t.node?.setAttribute&&(l==null||l===!1&&!nt(u)?t.node.removeAttribute(u):typeof l!="function"&&typeof l!="object"&&(u==="src"&&"src"in t.node?t.node.src=l:t.node.setAttribute(u,H(u,l))))}catch{}},{depth:o.path.length,label:j(o,e)});f._attrName=u.toLowerCase(),o.__effects.push(f)}}if(Xo(t),ts(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const e=t.onStateUpdate,n=t.stateDeps;let c=!1,a=[];const u=w(()=>{const d=[];for(let _=0;_<n.length;_++){const x=n[_];try{d[_]=typeof x=="function"?x(t,t.state,t.context):t.state?.[x]}catch{d[_]=void 0}}if(!c){c=!0,a=d;return}let f=d.length!==a.length;for(let _=0;!f&&_<d.length;_++)d[_]!==a[_]&&(f=!0);const l=a;if(a=d,!f)return;const h=t.context?.designSystem;h&&R(h);try{e(t,t.state,t.context,{prev:l,next:d})}catch(_){if(t.context?.plugins?.length&&B("error",t,{hook:"onStateUpdate",error:_})||console.error('[DOMQL] Lifecycle "onStateUpdate" error:',_),t.context?.strictMode)throw _}finally{h&&M()}},{depth:o.path.length,label:j(o,"onStateUpdate")});o.__effects.push(u)}mo(t)}function so(t){const s=t.parent,o=s?.node;if(!o||!t.node){bo(t,t.parent);return}let r=null;const i=Object.keys(s),e=i.indexOf(t.key);for(let n=e+1;n<i.length;n++){const c=s[i[n]];if(c?.node?.parentNode===o){r=c.node;break}}r?o.insertBefore(t.node,r):o.appendChild(t.node)}function no(t,s,o){const r=L(t,t.ifDeps,o),i=w(()=>{let e;try{e=r(t,t.state,t.context)}catch(c){if(e=!1,s.__ifError=c,typeof console<"u"&&console.warn){const a=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${a} \u2014 treating as false:`,c?.message||c)}return}const n=s.__if;if(s.__if=!!e,n&&!s.__if&&t.node){t.node.remove();try{typeof t.onRemove=="function"&&t.onRemove(t)}catch(c){console.error("[smbls] onRemove error:",c)}}else if(!n&&s.__if)if(s.__ifInitialized)t.node||(t.node=kt(t)),t.node&&(t.node.ref=t),so(t),Tt(t),N("Render",t,{}),jt(t,{});else{if(s.__ifInitialized=!0,t.tag||(t.tag=Kt(t)),N("Init",t,{}),t.node||(t.node=kt(t)),!t.node)return;if(t.parent?.__ref?.__children&&!t.parent.__ref.__children.includes(t.key)&&t.parent.__ref.__children.push(t.key),t.tag==="fragment"&&!s.__fragmentAnchor){const a=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(a),s.__fragmentAnchor=a}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),_o(t,{}),oo(t,{skipIfEffect:!0}),Tt(t),yo(t),go(t,{}),so(t),N("Create",t,{}),N("Complete",t,{}),N("Render",t,{}),N("RenderRouter",t,{}),jt(t,{})}},{depth:s.path.length,label:j(s,"if")});s.__effects.push(i)}function pt(t,s){const o=t.node;if(!o)return;const r=s==null||typeof s=="object"?"":String(s);if(t.tag==="string"){o.nodeValue!==r&&(o.nodeValue=r);return}const i=t.__ref;let e=i?i.__textNode:null;if(e&&e.parentNode!==o&&(e=null),!e){const n=o.firstChild;n&&n.nodeType===3&&(e=n)}e?e.nodeValue!==r&&(e.nodeValue=r):o.firstChild?(e=(o.ownerDocument||t.context?.document||globalThis.document).createTextNode(r),o.insertBefore(e,o.firstChild)):(o.textContent=r,e=o.firstChild&&o.firstChild.nodeType===3?o.firstChild:null),i&&(i.__textNode=e||null)}function Tt(t){const{node:s}=t;if(s){if((typeof t.text=="string"&&!t.text.includes("{{")||typeof t.text=="number")&&pt(t,t.text),ss(t),typeof t.html=="string"&&(s.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&"value"in s){const o=String(t.value);s.value!==o&&(s.value=o)}if(t.style&&typeof t.style=="object"){let o=t.style;for(const r in t.style)if(typeof t.style[r]=="function"){o={};for(const i in t.style)typeof t.style[i]!="function"&&(o[i]=t.style[i]);break}Z(s,o)}if(t.attr&&typeof t.attr=="object")for(const o in t.attr){const r=t.attr[o];typeof r=="function"||typeof r=="object"||r!=null&&(r===!1&&!nt(o)||s.setAttribute&&s.setAttribute(o,H(o,r)))}if(t.data&&typeof t.data=="object")for(const o in t.data){const r=t.data[o];typeof r=="function"||typeof r=="object"||r==null||r===!1||s.dataset&&(s.dataset[o]=r===!0?"":r)}if(t.classlist||t.class){const o=t.classlist||t.class;if(typeof o=="string")o.split(" ").forEach(r=>r&&s.classList.add(r));else if(typeof o=="object")for(const r in o){const i=typeof o[r]=="function"?o[r](t,t.state,t.context):o[r];i&&s.classList.add(typeof i=="string"?i:r)}}}}function yt(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function qo(t){if(!t||typeof t!="object")return!1;for(const s in t){const o=t[s];if(o&&typeof o=="object"&&!Array.isArray(o))return!0}return!1}function ht(t,s){if(!t||!t.style||!s)return null;const o=t.style,r=[];for(const i in s){if(s[i]==null||i.charAt(0)==="&")continue;const n=i.replace(/[A-Z]/g,c=>"-"+c.toLowerCase());r.push(n,eo(o,n),ro(o,n))}return r}function eo(t,s){return typeof t.getPropertyValue=="function"?t.getPropertyValue(s):""}function ro(t,s){return typeof t.getPropertyPriority=="function"?t.getPropertyPriority(s):""}function _t(t,s){if(!s||!t||!t.style)return!1;const o=t.style;for(let r=0;r<s.length;r+=3)if(eo(o,s[r])!==s[r+1]||ro(o,s[r])!==s[r+2])return!1;return!0}const Dt=t=>t.charCodeAt(0)===45&&t.charCodeAt(1)===45;function Z(t,s){if(!t||!s||!t.style)return;let o=null;for(const r in s){const i=s[r];if(i!=null){if(r.charAt(0)==="&"&&typeof i=="object"){o||(o={}),o[r]=i;continue}try{const e=String(i),n=Dt(r)?r:r.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),c=e.trim(),a=/\s*!important\s*$/.test(c),u=c.replace(/\s*!important\s*$/,"");t.style.setProperty(n,u,a?"important":"")}catch{}}}o&&Zo(t,o)}function Zo(t,s){const o=`_ds${Zt.scopedStyleId++}`;t.classList.add(o);const r=t.ownerDocument;let i=r.querySelector("style[data-smbls-scoped]");i||(i=r.createElement("style"),i.setAttribute("data-smbls-scoped",""),r.head.appendChild(i));let e="";for(const n in s){const c="."+o,a=n.replace(/&/g,c).split(",").map(d=>{const f=d.trim();return f.includes(c)?f:c+f}).join(", "),u=s[n];if(typeof u=="object"){let d="",f="";for(const l in u){const h=u[l];if(typeof h=="object"){const _=l.includes("&")?a.split(", ").map(y=>l.replace(/&/g,y)).join(", "):a.split(", ").map(y=>`${y} ${l}`).join(", ");let x="";for(const y in h)x+=`${y.replace(/[A-Z]/g,p=>"-"+p.toLowerCase())}: ${h[y]};`;f+=qt(`${_} { ${x} }`,_)+`
|
|
5
|
+
`}else d+=`${l.replace(/[A-Z]/g,_=>"-"+_.toLowerCase())}: ${h};`}d&&(e+=qt(`${a} { ${d} }`,a)+`
|
|
6
|
+
`),f&&(e+=f)}}e&&(i.textContent+=e)}const io=new Set;function co(t){if(!Array.isArray(t))return"";const s=[];for(let o=0;o<t.length;o++)typeof t[o]=="string"&&t[o].length&&s.push(t[o]);return s.sort(),s.join("|")}function Qo(t,s,o){const r=co(o);queueMicrotask(()=>{if(!t.__ref)return;let i;try{i=s(t,t.state,t.context)}catch{return}if(co(i)===r)return;const e=t.__ref.path?t.__ref.path.join("."):t.key||"?";io.has(e)||(io.add(e),console.warn(`[smbls] subscribeTo function at "${e}" resolved to a DIFFERENT key list one microtask after create \u2014 wired [${o.join(", ")||"(none)"}], probed [${Array.isArray(i)?i.join(", "):String(i)}]. subscribeTo's function form is resolved ONCE at element-create time (registerSubscribeToEffects, @symbo.ls/element create.js) \u2014 this element stays wired to the ORIGINAL list for its whole lifetime, so this drift is invisible to the reactive effect and any key only present in the new list will never trigger onUpdate. If the watched key genuinely is not known until later (e.g. a module config that loads after shell boot), route the write through an imperative call instead of subscribeTo \u2014 see functions/moduleOpenBridge.js's moduleOpenPage (workspace repo) for the house pattern.`))})}function Xo(t){const s=t.subscribeTo,o=typeof s=="function";let r=s;if(o)try{r=s(t,t.state,t.context)}catch{r=null}if(o&&tt()&&Qo(t,s,Array.isArray(r)?r:[]),!Array.isArray(r)||r.length===0)return;const i=t.__ref;for(let e=0;e<r.length;e++){const n=r[e];if(typeof n!="string"||n.length===0)continue;const c=n.split("."),a=c[0],u=c.slice(1),d={value:!1},f=w(()=>{const l=t.state&&(K(t.state)?t.state.root:null);if(!l||!K(l))return;let h=l;h=h[a];for(let x=0;x<u.length&&!(h==null||typeof h!="object");x++)if(K(h))h=h[u[x]];else break;if(!d.value)return;let _=!1;if(typeof t.onBeforeUpdate=="function"){const x=t.context?.designSystem;x&&R(x);try{if(is(i)){const y=t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0});y&&typeof y.then=="function"?y.then(()=>bt(i,!1),p=>{bt(i,!0),t.context?.plugins?.length&&B("error",t,{hook:"onBeforeUpdate",error:p})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",p)}):(bt(i,!1),y===!1&&(_=!0))}}catch(y){bt(i,!0),t.context?.plugins?.length&&B("error",t,{hook:"onBeforeUpdate",error:y})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",y)}finally{x&&M()}}if(!_&&t.node&&i.__effects)for(let x=0;x<i.__effects.length;x++){const y=i.__effects[x];y&&y!==f&&!y._disposed&&!y._isSubscribeToEffect&&typeof y._execute=="function"&&y._execute()}if(!_&&typeof t.onUpdate=="function"){const x=t.context?.designSystem;x&&R(x);try{t.onUpdate(t,t.state,t.context)}catch(y){t.context?.plugins?.length&&B("error",t,{hook:"onUpdate",error:y})||console.error("[DOMQL] subscribeTo onUpdate error:",y)}finally{x&&M()}}},{depth:i.path.length,label:j(i,"subscribeTo("+n+")")});d.value=!0,f._isSubscribeToEffect=!0,i.__effects.push(f)}}function Lt(t,s){return t.charCodeAt(0)===64&&t.length>1&&!t.startsWith("@media")&&!t.startsWith("@keyframes")&&!t.startsWith("@supports")&&!t.startsWith("@container")&&(t==="@dark"||t==="@light"||!s.context?.designSystem?.media?.[t.slice(1)])}function Ot(t,s){if(t.charCodeAt(0)!==64||/^@(media|supports|container|keyframes)\b/.test(t))return t;const o=s.context?.designSystem?.media?.[t.slice(1)];return o?/^@(media|supports|container)\b/.test(o)?o:`@media ${o}`:t}const fo=new Set;function Jo(t,s){const o=s?.__ref?.path?s.__ref.path.join("."):s?.key||"?",r=o+"::"+t;fo.has(r)||(fo.add(r),console.warn(`[smbls/css] "${t}" at ${o} is a CHILD-COMPONENT key nested inside a pseudo/selector block (":hover", "@dark", etc.) \u2014 that is never a valid CSS selector fragment. The rule is DROPPED (not shipped as a dead/never-matching selector). To reveal a child on a parent state, target the child's OWN class from the parent selector instead, e.g. move the declaration onto the child element itself, or use a sibling-selector combinator in a top-level style block.`))}function Q(t,s,o){const r={},i=new Set,e=(n,c,a)=>{const u=a?new Set(Object.keys(r)):null;if(D[n]){const d=D[n](c,s,s.state,s.context);if(d){const f=Array.isArray(d)?d:[d];for(const l of f)l&&Object.assign(r,l)}}else r[n]=c;if(a)for(const d in r)u.has(d)||i.add(d)};for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;let c=t[n];if(typeof c=="function"&&(c=c(s,s.state,s.context)),c==null||typeof c=="function")continue;if(typeof c=="object"&&!Array.isArray(c)){if(n==="style"){for(const f in c){let l=c[f];if(typeof l=="function"&&(l=l(s,s.state,s.context)),l==null||typeof l=="function")continue;const h=typeof s[f]=="function"&&(D[f]||P&&P.has(f));e(f,l,h)}continue}if(Lt(n,s)){const f=Q(c,s,!1);Object.keys(f).length&&(r[`[data-theme="${n.slice(1)}"] &`]=f);continue}if(/^[A-Z][A-Za-z0-9]*$/.test(n)){tt()&&Jo(n,s);continue}const u=Ot(n,s),d=Q(c,s,!1);Object.keys(d).length&&(r[u]=d);continue}const a=typeof s[n]=="function"&&(D[n]||P&&P.has(n));e(n,c,a)}if(o)for(const n in r)i.add(n);for(const n of i){const c=r[n];typeof c=="string"&&!c.includes("!important")&&(r[n]=c+" !important")}return r}function Rt(t,s){if(s===void 0&&(s=0),s>8)return!1;if(typeof t=="function")return!0;if(t&&typeof t=="object"&&!Array.isArray(t)){for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)&&Rt(t[o],s+1))return!0}return!1}function ao(t,s,o){if(!s||typeof s!="object"||Array.isArray(s))return null;if(Lt(t,o)){const e=Q(s,o,!1);return Object.keys(e).length?{cssProp:`[data-theme="${t.slice(1)}"] &`,block:e}:null}const r=Ot(t,o),i=Q(s,o,!1);return Object.keys(i).length?{cssProp:r,block:i}:null}function mo(t){const s=t.__ref;for(const o of Object.keys(t)){if(!Et(o))continue;const r=t[o];if(!r||typeof r!="object"||Array.isArray(r)||!Rt(r))continue;let i=null,e;const n=w(()=>{if(!t.node)return;const c=t.context?.designSystem;c&&R(c);let a,u=!1;try{const d=ao(o,r,t),f=d?yt(d.block)+"::"+d.cssProp:null;if(f!==null&&f===e)u=!0;else if(e=f,d){const l=st({[d.cssProp]:d.block},null,t.context?.cssPrefix);a=l?l.split(" ").filter(Boolean):null}else a=null}finally{c&&M()}if(!(u||!t.node.classList)){if(i)for(const d of i)t.node.classList.remove(d);if(a&&a.length)for(const d of a)t.node.classList.add(d);i=a}},{depth:s.path.length,label:j(s,"cssBlock("+o+")")});s.__effects.push(n)}}function ts(t){const s=t.__ref;s.__conditionalRunners=[];const o=new Map;for(const r of Object.keys(t)){const i=r.charAt(0);if(i!=="."&&i!=="!")continue;const e=r.slice(1);if(!e)continue;if(/[:@\s>~+[\]]/.test(e)){if(typeof console<"u"&&console.warn){const h=e.split(/[:@\s>~+[\]]/)[0];console.warn(`[smbls] conditional \`${r}\` on ${t.key||"?"} will never match \u2014 the whole string after \`${i}\` is read as one prop name. Nest the selector inside instead: \`${i}${h}: { '${e.slice(h.length)}': {...} }\`.`)}continue}const n=t[r];if(!n||typeof n!="object")continue;const c=i==="!",a={lastMatch:!1,appliedKeys:null,appliedClasses:null},u=()=>{let h;const _=t[e];if(_===void 0){const p=!!t.state&&e in t.state,g=t.state?t.state[e]:void 0;if(p||g!==void 0)h=g;else{const b=t.context?.cases?.[e];if(b===void 0)return;try{h=typeof b=="function"?b.call(t,t):b}catch(C){h=!1,s.__conditionalError=C,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${r}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,C?.message||C)}}}else if(typeof _=="function")try{h=_(t,t.state,t.context)}catch(p){h=!1,s.__conditionalError=p,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${r}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,p?.message||p)}else h=_;const x=c?!h:!!h;if(!t.node||x===a.lastMatch)return;a.lastMatch=x;const y=t.context?.designSystem;y&&R(y);try{if(x){const p={},g={};let b=!1;for(const A in n){if(!Object.prototype.hasOwnProperty.call(n,A))continue;const v=n[A],G=A.charAt(0);if((G===":"||G==="@"||G==="&"||G==="[")&&v&&typeof v=="object"&&!Array.isArray(v)){if(Lt(A,t)){const E=Q(v,t,!1);Object.keys(E).length&&(g[`[data-theme="${A.slice(1)}"] &`]=E,b=!0)}else{const E=Ot(A,t),T=Q(v,t,!1);Object.keys(T).length&&(g[E]=T,b=!0)}continue}const Y=typeof v=="function"?v(t,t.state,t.context):v;if(Y!=null)if(D[A]){const E=D[A](Y,t,t.state,t.context);if(E){const T=Array.isArray(E)?E:[E];for(const X of T)X&&Object.assign(p,X)}}else(P&&P.has(A)||Dt(A))&&(p[A]=Y)}const C=Object.keys(p);if(C.length){Z(t.node,p);for(const A of C)o.set(A,r);a.appliedKeys=C}else a.appliedKeys=null;if(b){const A=st(g,null,t.context?.cssPrefix),v=A?A.split(" ").filter(Boolean):[];if(v.length&&t.node.classList){for(const G of v)t.node.classList.add(G);a.appliedClasses=v}else a.appliedClasses=null}else if(a.appliedClasses){for(const A of a.appliedClasses)t.node.classList.remove(A);a.appliedClasses=null}}else{if(a.appliedKeys){for(const p of a.appliedKeys)o.get(p)===r&&(Dt(p)?t.node.style.removeProperty(p):t.node.style[p]="",o.delete(p));a.appliedKeys=null}if(a.appliedClasses){for(const p of a.appliedClasses)t.node.classList.remove(p);a.appliedClasses=null}}}finally{y&&M()}};s.__conditionalRunners.push(u);const d=L(t,t[e+"Deps"],u),f=w(d,{depth:s.path.length,label:j(s,"conditional("+r+")")}),l=s.__exec&&s.__exec[e]||t[e];f._sources.size===0&&typeof l=="function"&&tt()&&console.warn(`[smbls] conditional \`${r}\` on ${t.key||"?"} subscribed to nothing \u2014 its predicate tracked no reactive read on its first run, so no state write will ever re-evaluate it (only a direct element.update() on this element re-runs it). If the predicate guards its state reads (\`in\`, short-circuits, \`?.\`), declare \`${e}Deps: [...]\` (state-key strings or \`(el, s) => \u2026\` selectors) so the subscription is armed unconditionally.`),s.__effects.push(f)}}const Mt=new WeakSet;function os(t){const s=t.ownerDocument;!s||Mt.has(s)||(Mt.add(s),queueMicrotask(()=>{Mt.delete(s);const o=s.body||s.documentElement;o&&o.offsetWidth}))}const Nt=new WeakSet;let uo=!1;function lo(t){return t.startsWith("[data-theme=")||t.startsWith("@media")&&t.includes("prefers-color-scheme")}function $t(t,s){const o={...t};for(const r in s){const i=s[r],e=o[r];o[r]=i&&typeof i=="object"&&e&&typeof e=="object"?$t(e,i):i}return o}function po(t,s){const o={};for(const r in t){const i=t[r];if(i&&typeof i=="object"){const e=po(i,s);Object.keys(e).length&&(o[r]=e)}else s.has(r)||(o[r]=i)}return o}function ss(t){const{node:s}=t;if(!s)return;if(uo||(uo=!0,st({display:"none"})),Nt.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}Nt.add(t);const o=t.context?.designSystem;o&&R(o),zt();try{const r={};let i=!1,e=null,n=null,c=null;const a=(u,d)=>{if(d&&typeof d=="object"&&lo(u)){n||(n={});const f=n[u];f&&(d=$t(f,d)),n[u]=d}else(d===null||typeof d!="object")&&(c||(c=new Set),c.add(u));r[u]=d};if(Object.prototype.hasOwnProperty.call(t,"theme")&&typeof t.theme!="function"&&D.theme){const u=D.theme(t.theme,t,t.state,t.context);if(u){const d=f=>{for(const l in f){const h=f[l];h&&typeof h=="object"&&lo(l)&&(e||(e={}),e[l]=h),r[l]=h}};if(Array.isArray(u))for(const f of u)f&&d(f);else d(u);i=!0}}for(const u of Object.keys(t)){if(typeof t[u]=="function"||V.has(u)||u==="theme")continue;const d=u.charCodeAt(0);if(!(d>=65&&d<=90)&&!W(u)){if(D[u]){const f=t[u],l=D[u](f,t,t.state,t.context);if(l){if(Array.isArray(l)){for(const h of l)if(h)for(const _ in h)a(_,h[_])}else for(const h in l)a(h,l[h]);i=!0}}else if(P&&P.has(u)){const f=t[u];f!=null&&typeof f!="object"&&(a(u,f),i=!0)}else if(u.charCodeAt(0)===45){const f=t[u];f!=null&&typeof f!="object"&&(a(u,f),i=!0)}else if(u.charAt(0)==="&"||u.charAt(0)==="@"||u.charAt(0)===":"||u.charAt(0)==="["){const f=t[u];if(f&&typeof f=="object"&&!Array.isArray(f)){if(Rt(f))continue;const l=ao(u,f,t);l&&(a(l.cssProp,l.block),i=!0)}}}}if(e)for(const u in e){let d=c?po(e[u],c):e[u];n&&n[u]&&(d=$t(d,n[u])),Object.keys(d).length?r[u]=d:delete r[u]}if(i){r.display&&String(r.display).includes("!important")&&(s.style.setProperty("display",String(r.display).replace(/\s*!important\s*$/,""),"important"),delete r.display);const u=st(r,null,t.context?.cssPrefix);if(u&&s.classList){const f=u.split(" ").filter(Boolean);let l=!1;for(const h of f)s.classList.add(h),l||(h.charCodeAt(0)===95&&h.charCodeAt(1)===99||h.charCodeAt(0)===95&&h.indexOf("_c",1)!==-1)&&(l=!0);l&&os(s)}const d=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(d!=null){const f=r.display;if(f&&f!==d)if(d==="none"){const l=[];for(const h of s.classList)h.startsWith("_d-")&&h!=="_d-none"&&l.push(h);for(const h of l)s.classList.remove(h);s.classList.add("_d-none")}else s.style.display==="none"&&(typeof t.hide=="function"||typeof t.show=="function")||(s.style.display=t.display),t.__ref&&(t.__ref.__explicitDisplay=t.display)}}}finally{Yt(),o&&M(),Nt.delete(t)}}function yo(t){const{node:s}=t;if(!s||!s.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const i in t.aria){const e=t.aria[i];if(typeof e=="function"||typeof e=="object"||e==null)continue;const n="aria-"+i.replace(/[A-Z]/g,c=>"-"+c.toLowerCase());s.setAttribute(n,H(n,e))}const o=Oo(t);for(const i in o){const e=o[i];e!=null&&e!==!1&&typeof e!="function"&&typeof e!="object"&&s.setAttribute(i,e===!0?"":e)}const r=t.tag||"div";for(const i of Object.keys(t)){if(typeof t[i]=="function"||V.has(i)||i==="on"||o[i]!==void 0)continue;const e=i.charCodeAt(0);if(!(e>=65&&e<=90)&&!W(i)&&!(D[i]||P&&P.has(i))&&ut(r,i)){let n=t[i];if(n==null||(typeof n=="string"&&n.includes("{{")&&(n=at(n,t,t.state,t.context),t[i]=n),n==null||typeof n=="function"||typeof n=="object")||n===!1&&!nt(dt(i)||i))continue;const c=dt(i)||i;s.setAttribute(c,H(c,n))}}}function Ds(t,s){const{node:o}=t;if(!o||!o.setAttribute)return;const r=s.charCodeAt(0);if(r>=65&&r<=90||W(s)||D[s]||P&&P.has(s)||!ut(t.tag||"div",s))return;const i=dt(s)||s,e=i.toLowerCase(),n=t.__ref&&t.__ref.__effects;let c=!1;if(n)for(let d=0;d<n.length;d++){const f=n[d];f&&f._attrName===e&&!f._disposed&&typeof f._execute=="function"&&(c=!0,f._execute())}if(c)return;let a=t[s];const u=Ro[s];if(u&&a!=null){const d=u(t);d!==void 0&&(a=d)}typeof a=="string"&&a.includes("{{")&&(a=at(a,t,t.state,t.context)),a==null||a===!1&&!nt(i)?o.removeAttribute(i):typeof a!="function"&&typeof a!="object"&&o.setAttribute(i,H(i,a))}function ns(t,s){const o=t.node,r=t.__ref;let i=r.__autoGrow;if(!s){if(i&&i.active){try{o.removeEventListener("input",i.resize)}catch{}o.style.height="",i.appliedMax!=null&&o.style.maxHeight===i.appliedMax&&(o.style.maxHeight=""),i.active=!1,i.appliedMax=null,i.lastMeasure=0}return}i||(i=r.__autoGrow={active:!1,appliedMax:null,lastMeasure:0,resize:()=>{if(o.scrollHeight===0&&i.lastMeasure>0)return;o.style.height="auto";const n=o.scrollHeight;o.style.height=n+"px",n>0&&(i.lastMeasure=n)}},r.__eventCleanup||(r.__eventCleanup=[]),r.__eventCleanup.push(()=>{try{o.removeEventListener("input",i.resize)}catch{}})),i.active||(o.addEventListener("input",i.resize),i.active=!0);const e=typeof s=="object"&&s.max!=null?String(s.max):null;e!==i.appliedMax&&(e==null?i.appliedMax!=null&&o.style.maxHeight===i.appliedMax&&(o.style.maxHeight=""):o.style.maxHeight=e,i.appliedMax=e),i.resize()}function es(t){if(!t.autoGrow)return;const s=t.node;if(!s||s.tagName!=="TEXTAREA")return;const o=t.__ref,r=t.autoGrow,i=typeof r=="function"?L(t,t.autoGrowDeps,r):null,e=w(()=>{const n=t.autoGrow;let c=n;if(typeof n=="function")try{c=(n===r&&i?i:n)(t,t.state,t.context)}catch{c=null}ns(t,c)},{depth:o.path.length,label:j(o,"autoGrow")});o.__effects||(o.__effects=[]),o.__effects.push(e),i&&(o.__exec.autoGrow=r)}const ho=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function _o(t,s){for(const o of Object.keys(t)){if(!W(o)||ho.has(o))continue;const r=Eo(o);if(r){jo(r,t,t[o]);continue}let i=t[o];if(typeof i=="string"&&/^[A-Za-z_$][\w$]*$/.test(i)){const n=i;i=function(a){return t.call(n,a)}}if(typeof i!="function")continue;const e=Bo(o);vo.has(e)||wo(Ko(e),t,i)}rs(t)}function rs(t){const s=t.node;if(!s||!s.addEventListener)return;const o={};let r=!1;for(const l of ho){const h=t[l];typeof h=="function"&&(o[l]=h,r=!0)}if(!r)return;const i=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,e=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let n=0,c=0,a=0,u=!1;const d=l=>{const h=l.touches&&l.touches[0]||l.changedTouches&&l.changedTouches[0];h&&(n=h.clientX,c=h.clientY,a=Date.now(),u=!0)},f=l=>{if(!u)return;u=!1;const h=l.changedTouches&&l.changedTouches[0]||l.touches&&l.touches[0];if(!h)return;const _=h.clientX-n,x=h.clientY-c,y=Date.now()-a;if(y>e)return;const p=Math.abs(_),g=Math.abs(x);if(Math.max(p,g)<i)return;let b;if(p>g*1.2)b=_<0?"left":"right";else if(g>p*1.2)b=x<0?"up":"down";else return;const C="onSwipe"+b.charAt(0).toUpperCase()+b.slice(1),A=o[C],v=o.onSwipe;A&&A.call(t,l,t,t.state,t.context),v&&v.call(t,{direction:b,dx:_,dy:x,dt:y,event:l},t,t.state,t.context)};s.addEventListener("touchstart",d,{passive:!0}),s.addEventListener("touchend",f,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("touchstart",d)}catch{}try{s.removeEventListener("touchend",f)}catch{}})}function ct(t,s){const o={...t};for(const r in s){const i=o[r],e=s[r];i&&e&&typeof i=="object"&&typeof e=="object"&&!Array.isArray(i)&&!Array.isArray(e)&&typeof i!="function"&&typeof e!="function"?o[r]=ct(i,e):o[r]=e}return o}function Ft(t,s,o,r){if(!s||!t.node)return;const i=t.childExtends;if(Array.isArray(s)){const e=t.tag==="fragment",n=t.context?.document||globalThis.document,c=e?null:n?.createDocumentFragment();if(!e&&!c)return;const a=t.childProps,u=t.childrenAs,d=y=>{let p=s[y];const g=p;(typeof p=="string"||typeof p=="number")&&(p={text:p});let b=a;if(typeof a=="function")try{b=a(t,p)}catch{b=null}if(u==="state"){let A=g;(typeof g=="string"||typeof g=="number")&&(A={value:g,text:g}),p=b?{...b,state:A}:{state:A}}else b&&(p=ct(b,p));if(i&&!p.ignoreChildExtends)if(p.extends){const A=Array.isArray(p.extends)?p.extends:[p.extends],v=Array.isArray(i)?i:[i];p={...p,extends:[...v,...A]}}else p={...p,extends:i};const C=mt(p?.key,g,y);try{return z(p,t,C,o)}catch(A){if(typeof console<"u"&&console.error){const v=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${C}" failed to construct at ${v} (initial render, skipping this row):`,A?.message||A)}return null}},f=t.__ref;if(!(r===!0&&!e&&!!f&&(o?.mountYield===!0||t.yieldChildren===!0))){for(let y=0;y<s.length;y++){const p=d(y);!e&&p?.node&&c.appendChild(p.node)}return e||t.node.appendChild(c),!0}const h=f.__childrenChunkGen=(f.__childrenChunkGen||0)+1;Gt();let _=null;const x=y=>{if(f.__disposed||f.__childrenChunkGen!==h){_&&_.parentNode&&_.remove();return}for(let p=y;p<s.length;p++){const g=d(p);if(g?.node&&(_?t.node.insertBefore(g.node,_):c.appendChild(g.node)),p+1<s.length&&Vt()){_||(_=n.createComment("smbls-mount"),c.appendChild(_),t.node.appendChild(c));const b=p+1;Wt(()=>x(b));return}}_?(_.remove(),t.node.tagName==="SELECT"&>(t,!0)):t.node.appendChild(c)};return x(0),Ht(),!0}if(typeof s=="string"){const e=to(s,t);if(Array.isArray(e))return Ft(t,e,o,r)}if(typeof s=="object")for(const e in s){if(V.has(e))continue;let n=s[e];if(!(n==null||n===!1)){if((typeof n=="string"||typeof n=="number")&&(n={text:n}),t.childProps&&(n=ct(t.childProps,n)),i&&!n.ignoreChildExtends)if(n.extends){const c=Array.isArray(n.extends)?n.extends:[n.extends],a=Array.isArray(i)?i:[i];n={...n,extends:[...a,...c]}}else n={...n,extends:i};z(n,t,e,o)}}}function gt(t,s){const o=t.node;if(!o||o.tagName!=="SELECT")return;const r=o.options;if(!r||!r.length)return;const i=t.__ref,e=i&&i.__exec&&i.__exec.value,n=typeof e=="function",c=t.value!=null&&typeof t.value!="function";if(n||c){let d;if(n)try{d=e(t,t.state,t.context)}catch{return}else d=t.value;const f=d==null?"":String(d);o.value!==f&&(o.value=f);return}const a=s||!(i&&i.__selectSynced);if(i&&(i.__selectSynced=!0),!a)return;let u=-1;for(let d=0;d<r.length;d++)r[d].defaultSelected&&(u=d);u>=0&&o.selectedIndex!==u&&(o.selectedIndex=u)}function go(t,s){let{children:o,content:r}=t;const i=t.childExtends;if(typeof o=="function"){const f=o;try{o=f(t,t.state,t.context)}catch(y){if(o=void 0,typeof console<"u"&&console.error){const p=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${p} (initial run, treating as empty):`,y?.message||y)}}t.children=o;const l=t.__ref;let h=!1;const _=L(t,t.childrenDeps,f),x=w(()=>{const y=h;h=!0;let p;try{p=_(t,t.state,t.context)}catch(E){if(typeof console<"u"&&console.error){const T=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${T}${y?"":" (initial tracking run)"}:`,E?.message||E)}return}if(!y||p===t.children)return;t.children=p,l.__childrenChunkGen!=null&&l.__childrenChunkGen++;const g=typeof t.onContentUpdate=="function",b=g?[]:null,C=g?[]:null,A=g?[]:null;if(Array.isArray(p)&&t.childrenAs==="state"){const E=t.childProps,T=[],X=new Map;for(let S=0;S<p.length;S++){const F=p[S];let k=E;if(typeof E=="function")try{k=E(t,F)}catch{k=null}const U=mt(k&&k.key,F,S);T.push(U),X.set(U,{rawChild:F,childProps:k})}const xo=new Set(T),Ao=l.__children.slice();for(const S of Ao)if(!xo.has(S)){const F=t[S];F?.remove&&F.remove(),delete t[S],C&&C.push(S)}const J=t.childExtends,ft=t.tag==="fragment",Co=t.context?.document||globalThis.document,m=ft?null:Co?.createDocumentFragment(),xt=new Set;for(const S of T){const F=X.get(S),k=F.rawChild,U=t[S];if(U&&U.state){if(k&&typeof k=="object"){const O=U.state,q=O.$replace||O.replace,Bt=O.$update||O.update;try{if(typeof q=="function")q.call(O,k);else if(typeof Bt=="function"){for(const $ in O)if(!($==="__element"||$==="root"||$==="parent"||$==="update")&&!Object.prototype.hasOwnProperty.call(k,$))try{O[$]=void 0}catch{}Bt.call(O,k)}else for(const $ in k)O[$]=k[$]}catch($){if(typeof console<"u"&&console.error){const So=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${S}" failed to patch at ${So} (reconcile, keeping its previous data for this pass):`,$?.message||$)}}}A&&A.push(S);continue}let At=k;(typeof k=="string"||typeof k=="number")&&(At={value:k,text:k});const Ut=F.childProps;let I=Ut?{...Ut,state:At}:{state:At};if(J&&!I.ignoreChildExtends)if(I.extends){const O=Array.isArray(I.extends)?I.extends:[I.extends],q=Array.isArray(J)?J:[J];I={...I,extends:[...q,...O]}}else I={...I,extends:J};let Ct;try{Ct=z(I,t,S,s)}catch(O){if(typeof console<"u"&&console.error){const q=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${S}" failed to construct at ${q} (reconcile, skipping this row):`,O?.message||O)}xt.add(S);continue}!ft&&Ct?.node&&m&&m.appendChild(Ct.node),b&&b.push(S)}if(!ft&&m&&m.childNodes.length&&t.node&&t.node.appendChild(m),!ft&&t.node){let S=null;for(const F of T){const k=t[F]?.node;if(!k)continue;const U=S?S.nextSibling:t.node.firstChild;k!==U&&t.node.insertBefore(k,U),S=k}}l.__children=xt.size?T.filter(S=>!xt.has(S)):T,g&&(b.length||C.length)&&Jt(t,{added:b,removed:C,kept:A}),gt(t,!1);return}const Y=g?[...l.__children]:null;for(const E of[...l.__children]){const T=t[E];T?.remove&&T.remove(),delete t[E]}l.__children=[],Ft(t,p,s),gt(t,!1),g&&Jt(t,{added:[...l.__children],removed:Y,kept:[]})},{depth:l.path.length,label:j(l,"children")});l.__effects.push(x)}const e=Ft(t,o,s,!0);if(r!=null&&!(r&&r.__ref)){let f=r;if(typeof f=="string"||typeof f=="number"?f={text:f}:typeof f!="object"&&(f={}),t.childProps&&(f=ct(t.childProps,f)),i&&!f.ignoreChildExtends)if(f.extends){const l=Array.isArray(f.extends)?f.extends:[f.extends],h=Array.isArray(i)?i:[i];f={...f,extends:[...h,...l]}}else f={...f,extends:i};z(f,t,"content",s)}if(o&&!e)return;const n=t.context?.components||{};{const f=Object.keys(t);for(let l=0;l<f.length;l++){const h=f[l];if(!h.endsWith("Extends")||typeof t[h]!="string")continue;const _=h.slice(0,-7);if(!_||_.charCodeAt(0)<65||_.charCodeAt(0)>90)continue;const x={extends:t[h]};delete t[h];for(let y=l+1;y<f.length;y++){const p=f[y],g=p.charCodeAt(0);if(g>=65&&g<=90||V.has(p)||typeof t[p]=="function"&&(p.startsWith("on")||p.startsWith(".")))break;const b=t[p];b!==void 0&&(x[p]=b,delete t[p])}t[_]&&typeof t[_]=="object"?t[_]={...x,...t[_]}:t[_]=x}}const c=s?.mountYield===!0||t.yieldChildren===!0,a=Object.keys(t),u=f=>{if(V.has(f)||typeof t[f]!="object"||t[f]===null)return;const l=f.charCodeAt(0);if(l<65||l>90)return;let h=t[f];if(!h.__ref){if(!h.extends&&!h.extend){const _=n[f]||n[`smbls.${f}`];_&&(h={...h,extends:_})}if(t.childProps&&(h=ct(t.childProps,h)),i&&!h.ignoreChildExtends)if(h.extends){const _=Array.isArray(h.extends)?h.extends:[h.extends],x=Array.isArray(i)?i:[i];h={...h,extends:[...x,..._]}}else h={...h,extends:i};z(h,t,f,s)}};if(!c){for(const f of a)u(f);return}Gt();const d=f=>{for(let l=f;l<a.length;l++)if(u(a[l]),l+1<a.length&&Vt()){const h=l+1;Wt(()=>d(h));return}};d(0),Ht()}function bo(t,s,o){const{node:r}=t;if(!r)return;r.ref=t;const i=s?.tag==="fragment"?s.__ref?.__fragmentAnchor:null;if(i){const n=i.parentNode;if(n){if(o?.position==="before"&&o.node)n.insertBefore(r,o.node);else if(o?.position==="after"&&o.node){const c=o.node.nextSibling;n.insertBefore(r,c||i)}else n.insertBefore(r,i);return}}const e=s?.node||(s?.nodeType?s:null);if(e)if(o?.position==="before"&&o.node)e.insertBefore(r,o.node);else if(o?.position==="after"&&o.node){const n=o.node.nextSibling;n?e.insertBefore(r,n):e.appendChild(r)}else e.appendChild(r)}const It=3;function is(t){return!t||t.__inBeforeUpdate||(t.__beforeUpdateFailCount||0)>=It?!1:(t.__inBeforeUpdate=!0,!0)}function bt(t,s){t&&(t.__inBeforeUpdate=!1,s?(t.__beforeUpdateFailCount=(t.__beforeUpdateFailCount||0)+1,t.__beforeUpdateFailCount===It&&typeof console<"u"&&console.error&&console.error(`[DOMQL] onBeforeUpdate failed ${It}x in a row on this element \u2014 pausing automatic retries until a future prop/state change re-arms it.`)):t.__beforeUpdateFailCount=0)}function N(t,s,o){const r=t.charAt(0).toLowerCase()+t.slice(1);s.context?.plugins?.length&&B(r,s,o);const i="on"+t,e=s[i];if(typeof e=="function"){const a=t==="Render"?"__inRender":t==="RenderRouter"?"__inRenderRouter":null;if(a){if(s.__ref[a])return!0;s.__ref[a]=!0}const u=s.context?.designSystem;u&&R(u);let d=!!a;try{const f=e(s,s.state,s.context,o);if(f&&typeof f.then=="function"){const l=s.__ref;return f.catch(h=>{s.context?.plugins?.length&&B("error",s,{hook:i,error:h})||console.error(`[DOMQL] Lifecycle "${i}" error:`,h)}).finally(()=>{a&&l&&(l[a]=!1)}),d=!1,!0}if(f===!1)return!1}catch(f){if(s.context?.plugins?.length&&B("error",s,{hook:i,error:f})||console.error(`[DOMQL] Lifecycle "${i}" error:`,f),s.context?.strictMode)throw f}finally{u&&M(),d&&s.__ref&&(s.__ref[a]=!1)}}return!0}var Ls=z;export{It as BEFORE_UPDATE_MAX_CONSECUTIVE_FAILURES,is as acquireBeforeUpdateGuard,z as create,Ls as default,wt as flushMounts,Ds as reconcileAttrProp,bt as releaseBeforeUpdateGuard,pt as writeElementText};
|
package/dist/esm/src/methods.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{update as h}from"./update.js";import{remove as _}from"./dispose.js";import{isLoudDevRuntime as d}from"./devRuntime.js";import"css-in-props";import{getDB as
|
|
1
|
+
import{update as h}from"./update.js";import{remove as _}from"./dispose.js";import{isLoudDevRuntime as d}from"./devRuntime.js";import"css-in-props";import{getDB as p,getQuery as g,getRootData as y,getRootState as m,getRoot as k,getRootContext as w,getContext as x,getPath as C,nextElement as S,previousElement as R,verbose as v,warn as b,error as P,variables as A,spotByPath as D}from"@symbo.ls/utils";function i(t,e,n){const o=t?.context?.analyze;if(!o||!o.emit||e==="warn"&&!o.shouldCapture("warnings")||e==="error"&&!o.shouldCapture("errors"))return;const r=n.map(s=>s?.message||(typeof s=="string"?s:null)).filter(Boolean).join(" ");o.emit({id:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,ts:Date.now(),type:e==="error"?"error":"warning",level:e,hook:e==="error"?"el.error":"el.warn",element:{key:t.key!=null?String(t.key):null,name:t.__name||null,tag:t.tag||null},message:r||null,args:n})}const l=new Set;function $(t,e,n){const o=String(e);if(l.has(o))return;l.add(o);const r=t?.__ref?.path,s=Array.isArray(r)&&r.length?r.join("."):t?.key!=null?String(t.key):"(unknown element)",a=n!=null?`resolves to a non-function (${typeof n}) \u2014 it cannot be called`:"is not registered in context.methods, context.functions, or context.utils, and is not an element method",u=`[smbls] el.call('${o}') at <${s}>: "${o}" ${a}. Returning undefined (unchanged behavior) \u2014 check the name for typos or register the function on the project. Warned once per name; repeat misses are silent.`;i(t,"error",[u]),console.error(u)}function j(...t){return i(this,"warn",t),b.apply(this,t)}function O(...t){return i(this,"error",t),P.apply(this,t)}const f={update:h,remove:_,getDB:p,getQuery:g,getRootData:y,getPath:C,nextElement:S,previousElement:R,verbose:v,warn:j,error:O,variables:A,spotByPath:D,set(t,e){const n=this.__ref;if(n){if(n.__setLocked){n.__setQueued={content:t,options:e};return}n.__setLocked=!0}try{if(this.removeContent(),t!=null){const o=this.context?.__create;o&&o(t,this,"content",e)}this.__ref&&(this.__ref.contentManaged=!0)}finally{if(n){n.__setLocked=!1;const o=n.__setQueued;o&&(n.__setQueued=null,this.set(o.content,o.options))}}},reset(t){const e=this.context?.__create;if(!e)return this;const n=this.parent,o=this.key,r=this.parse();return this.remove(),e(r,n,o,t)},lookup(t){let e=this.parent;for(;e;){if(typeof t=="function"){if(t(e))return e}else if(typeof t=="string"){if(e.key===t)return e;if(e[t]&&e[t].__ref)return e[t]}e=e.parent}return null},lookdown(t){const e=this.__ref;if(!e?.__children)return null;for(const n of e.__children){const o=this[n];if(!o)continue;if(typeof t=="function"){if(t(o))return o}else if(typeof t=="string"&&o.key===t)return o;const r=o.lookdown?.(t);if(r)return r}return null},lookdownAll(t,e=[]){const n=this.__ref;if(!n?.__children)return e;for(const o of n.__children){const r=this[o];r&&(typeof t=="function"?t(r)&&e.push(r):typeof t=="string"&&r.key===t&&e.push(r),r.lookdownAll?.(t,e))}return e},getRef(t){return t?this.__ref&&this.__ref[t]:this.__ref},getChildren(){const t=this.__ref&&this.__ref.__children;return Array.isArray(t)?t.map(e=>this[e]):[]},getRoot:k,getRootState:m,getRootContext:w,getContext:x,parse(t){const e={},n=t?new Set(t):null,o=this.__ref?.__exec;for(const r in this)if(!(r==="parent"||r==="node"||r==="__ref")&&!n?.has(r)){if(o&&o[r]!==void 0){e[r]=o[r];continue}typeof this[r]!="function"&&(e[r]=this[r])}return e},parseDeep(t){const e=this.parse(t),n=this.__ref;if(n?.__children)for(const o of n.__children)this[o]?.parseDeep&&(e[o]=this[o].parseDeep(t));return e},keys(){return Object.keys(this)},log(...t){if(t.length){const e={};for(const n of t)e[n]=this[n];console.log(e)}else console.log(this)},setProps(t,e){return this.update(t,e)},setNodeStyles(t){if(this.node?.style)for(const e in t){const n=t[e];if(n==null)continue;const o=e.replace(/[A-Z]/g,s=>"-"+s.toLowerCase()),r=String(n).replace(/\s*!important\s*$/,"");this.node.style.setProperty(o,r,"important")}},call(t,...e){const n=this.context,o=n?.methods?.[t]||n?.functions?.[t]||n?.utils?.[t]||this[t];if(typeof o=="function")return o.call(this,...e);d()&&$(this,t,o)},removeContent(){const t=this.__ref;if(!t?.__children)return;const e=this.content;if(e?.remove){e.remove(),delete this.content;const n=t.__children.indexOf("content");n!==-1&&t.__children.splice(n,1)}e?.node?.parentNode&&e.node.parentNode.removeChild(e.node)}},c=new WeakMap;function L(t){if(!t)return f;let e=c.get(t);if(e)return e;e=Object.create(f);const n=t.methods;if(n)for(const o in n)e[o]=n[o];return c.set(t,e),e}function F(t){const e=L(t.context);Object.setPrototypeOf(t,e)}function T(t){if(!t)return!1;const e=c.get(t);if(!e)return!1;const n=t.methods;if(!n)return!1;for(const o in n)e[o]=n[o];return!0}export{F as addMethods,f as elementProto,T as refreshContextProto};
|
package/dist/esm/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const o="3.14.
|
|
1
|
+
const o="3.14.787";export{o as VERSION};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/element",
|
|
3
|
-
"version": "3.14.
|
|
3
|
+
"version": "3.14.787",
|
|
4
4
|
"description": "Core element creation, update, and disposal engine for smbls v3.14",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -20,9 +20,11 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
+
"@symbo.ls/css": "^3.14.707",
|
|
24
|
+
"@symbo.ls/scratch": "^3.14.778",
|
|
23
25
|
"@symbo.ls/signal": "^3.14.779",
|
|
24
26
|
"@symbo.ls/state": "^3.14.678",
|
|
25
|
-
"@symbo.ls/utils": "^3.14.
|
|
27
|
+
"@symbo.ls/utils": "^3.14.770",
|
|
26
28
|
"css-in-props": "^3.14.753",
|
|
27
29
|
"attrs-in-props": "^3.14.692"
|
|
28
30
|
},
|