@ecopages/radiant 0.3.0-alpha.12 → 0.3.0-alpha.13

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.
Files changed (140) hide show
  1. package/dist/context/decorators/consume-context.js +2 -2
  2. package/dist/context/decorators/consume-context.js.map +4 -4
  3. package/dist/context/decorators/context-selector.js +2 -2
  4. package/dist/context/decorators/context-selector.js.map +5 -5
  5. package/dist/context/decorators/legacy/consume-context.js +2 -2
  6. package/dist/context/decorators/legacy/consume-context.js.map +4 -4
  7. package/dist/context/decorators/legacy/context-selector-field.js +2 -2
  8. package/dist/context/decorators/legacy/context-selector-field.js.map +4 -4
  9. package/dist/context/decorators/legacy/context-selector.js +2 -2
  10. package/dist/context/decorators/legacy/context-selector.js.map +4 -4
  11. package/dist/context/decorators/legacy/provide-context.js +2 -2
  12. package/dist/context/decorators/legacy/provide-context.js.map +4 -4
  13. package/dist/context/decorators/on-context-update.js +2 -2
  14. package/dist/context/decorators/on-context-update.js.map +4 -4
  15. package/dist/context/decorators/provide-context.js +2 -2
  16. package/dist/context/decorators/provide-context.js.map +4 -4
  17. package/dist/context/index.js +2 -2
  18. package/dist/context/index.js.map +9 -9
  19. package/dist/core/radiant-controller.d.ts +31 -4
  20. package/dist/core/radiant-controller.js +2 -2
  21. package/dist/core/radiant-controller.js.map +10 -6
  22. package/dist/core/radiant-element-ssr-host.d.ts +23 -0
  23. package/dist/core/radiant-element-ssr-host.js +3 -0
  24. package/dist/core/radiant-element-ssr-host.js.map +10 -0
  25. package/dist/core/radiant-element-ssr-registry.d.ts +45 -0
  26. package/dist/core/radiant-element-ssr-registry.js +3 -0
  27. package/dist/core/radiant-element-ssr-registry.js.map +10 -0
  28. package/dist/core/{radiant-component-ssr.d.ts → radiant-element-ssr-service.d.ts} +3 -4
  29. package/dist/core/{radiant-component-ssr.js → radiant-element-ssr-service.js} +2 -2
  30. package/dist/core/{radiant-component-ssr.js.map → radiant-element-ssr-service.js.map} +4 -4
  31. package/dist/core/radiant-element.d.ts +17 -124
  32. package/dist/core/radiant-element.js +2 -2
  33. package/dist/core/radiant-element.js.map +15 -10
  34. package/dist/core/reactive-host.d.ts +1 -1
  35. package/dist/core/reactive-host.js +2 -2
  36. package/dist/core/reactive-host.js.map +7 -4
  37. package/dist/core/reactive-jsx-value.d.ts +2 -1
  38. package/dist/core/reactive-jsx-value.js.map +2 -2
  39. package/dist/core/reactive-prop-core.d.ts +42 -0
  40. package/dist/core/reactive-prop-core.js +3 -0
  41. package/dist/core/reactive-prop-core.js.map +11 -0
  42. package/dist/core/reactive-prop-metadata.d.ts +1 -1
  43. package/dist/core/reactive-prop-metadata.js +2 -2
  44. package/dist/core/reactive-prop-metadata.js.map +2 -2
  45. package/dist/core/reactivity-adapter.d.ts +8 -0
  46. package/dist/core/reactivity-adapter.js +3 -0
  47. package/dist/core/reactivity-adapter.js.map +12 -0
  48. package/dist/core/reactivity-contract.d.ts +39 -0
  49. package/dist/core/reactivity-contract.js +2 -0
  50. package/dist/core/reactivity-contract.js.map +9 -0
  51. package/dist/core/reactivity-runtime.d.ts +18 -0
  52. package/dist/core/reactivity-runtime.js +3 -0
  53. package/dist/core/reactivity-runtime.js.map +11 -0
  54. package/dist/core/reactivity-signals.d.ts +10 -0
  55. package/dist/core/reactivity-signals.js +3 -0
  56. package/dist/core/reactivity-signals.js.map +10 -0
  57. package/dist/core/render-runtime.d.ts +29 -0
  58. package/dist/core/render-runtime.js +3 -0
  59. package/dist/core/render-runtime.js.map +16 -0
  60. package/dist/core/slot-projection-runtime.js +2 -2
  61. package/dist/core/slot-projection-runtime.js.map +3 -3
  62. package/dist/decorators/attr.js +2 -2
  63. package/dist/decorators/attr.js.map +6 -5
  64. package/dist/decorators/event.js +2 -2
  65. package/dist/decorators/event.js.map +3 -3
  66. package/dist/decorators/legacy/attr.js +2 -2
  67. package/dist/decorators/legacy/attr.js.map +6 -5
  68. package/dist/decorators/legacy/event.js +2 -2
  69. package/dist/decorators/legacy/event.js.map +3 -3
  70. package/dist/decorators/legacy/instance-initializers.d.ts +16 -0
  71. package/dist/decorators/legacy/instance-initializers.js +2 -2
  72. package/dist/decorators/legacy/instance-initializers.js.map +3 -3
  73. package/dist/decorators/legacy/on-event.js +2 -2
  74. package/dist/decorators/legacy/on-event.js.map +3 -3
  75. package/dist/decorators/legacy/on-updated.js +2 -2
  76. package/dist/decorators/legacy/on-updated.js.map +3 -3
  77. package/dist/decorators/legacy/query-slot.js +2 -2
  78. package/dist/decorators/legacy/query-slot.js.map +3 -3
  79. package/dist/decorators/legacy/query.js +2 -2
  80. package/dist/decorators/legacy/query.js.map +3 -3
  81. package/dist/decorators/legacy/reactive-field.js +2 -2
  82. package/dist/decorators/legacy/reactive-field.js.map +3 -3
  83. package/dist/decorators/legacy/reactive-prop.d.ts +1 -1
  84. package/dist/decorators/legacy/reactive-prop.js +2 -2
  85. package/dist/decorators/legacy/reactive-prop.js.map +7 -6
  86. package/dist/decorators/legacy/signal.d.ts +1 -1
  87. package/dist/decorators/legacy/signal.js +2 -2
  88. package/dist/decorators/legacy/signal.js.map +4 -4
  89. package/dist/decorators/on-event.js +2 -2
  90. package/dist/decorators/on-event.js.map +3 -3
  91. package/dist/decorators/on-updated.js +2 -2
  92. package/dist/decorators/on-updated.js.map +3 -3
  93. package/dist/decorators/prop.d.ts +1 -1
  94. package/dist/decorators/prop.js +2 -2
  95. package/dist/decorators/prop.js.map +9 -8
  96. package/dist/decorators/query-slot.js +2 -2
  97. package/dist/decorators/query-slot.js.map +3 -3
  98. package/dist/decorators/query.js +2 -2
  99. package/dist/decorators/query.js.map +3 -3
  100. package/dist/decorators/shared/reactive-attr.d.ts +1 -1
  101. package/dist/decorators/shared/reactive-attr.js +2 -2
  102. package/dist/decorators/shared/reactive-attr.js.map +5 -4
  103. package/dist/decorators/signal.js +2 -2
  104. package/dist/decorators/signal.js.map +5 -5
  105. package/dist/decorators/standard/attr.js +2 -2
  106. package/dist/decorators/standard/attr.js.map +5 -4
  107. package/dist/decorators/standard/reactive-prop.d.ts +1 -1
  108. package/dist/decorators/standard/reactive-prop.js +2 -2
  109. package/dist/decorators/standard/reactive-prop.js.map +6 -5
  110. package/dist/decorators/standard/signal.d.ts +1 -1
  111. package/dist/decorators/standard/signal.js.map +1 -1
  112. package/dist/decorators/state.js +2 -2
  113. package/dist/decorators/state.js.map +3 -3
  114. package/dist/index.js +2 -2
  115. package/dist/index.js.map +23 -18
  116. package/dist/package.json +1 -1
  117. package/dist/server/radiant-element-ssr-bridge.d.ts +21 -0
  118. package/dist/server/radiant-element-ssr-bridge.js +3 -0
  119. package/dist/server/radiant-element-ssr-bridge.js.map +19 -0
  120. package/dist/server/radiant-element-ssr-extractor.d.ts +3 -0
  121. package/dist/server/radiant-element-ssr-extractor.js +3 -0
  122. package/dist/server/radiant-element-ssr-extractor.js.map +12 -0
  123. package/dist/server/radiant-element-ssr-runtime.d.ts +1 -0
  124. package/dist/server/radiant-element-ssr-runtime.js +3 -0
  125. package/dist/server/radiant-element-ssr-runtime.js.map +19 -0
  126. package/dist/server/render-component.d.ts +2 -2
  127. package/dist/server/render-component.js +2 -2
  128. package/dist/server/render-component.js.map +11 -8
  129. package/dist/server/render-controller.js +2 -2
  130. package/dist/server/render-controller.js.map +12 -9
  131. package/dist/server/slot-projection-html.js +2 -2
  132. package/dist/server/slot-projection-html.js.map +3 -3
  133. package/package.json +1 -1
  134. package/size-budget.json +2 -2
  135. package/dist/core/radiant-component-ssr-registry.d.ts +0 -54
  136. package/dist/core/radiant-component-ssr-registry.js +0 -3
  137. package/dist/core/radiant-component-ssr-registry.js.map +0 -10
  138. package/dist/server/radiant-component-ssr-runtime.d.ts +0 -9
  139. package/dist/server/radiant-component-ssr-runtime.js +0 -3
  140. package/dist/server/radiant-component-ssr-runtime.js.map +0 -17
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- var BM=((F)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(F,{get:(M,$)=>(typeof require<"u"?require:M)[$]}):F)(function(F){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+F+'" is not supported')});var n=Symbol.for("@ecopages/radiant.legacy-instance-initializers");function Q(F,M){let H=F[n];if(Array.isArray(H)){H.push(M);return}Object.defineProperty(F,n,{value:[M],configurable:!0})}function C(F){let M=[],$=Object.getPrototypeOf(F);while($&&$!==Object.prototype)M.push($),$=Object.getPrototypeOf($);for(let H=M.length-1;H>=0;H-=1){let P=M[H][n];if(!Array.isArray(P))continue;for(let W of P)W(F)}}import{createSubscribableJsxValue as AF}from"@ecopages/jsx";import{trackDependency as j0}from"@ecopages/signals";class Z0{read;subscribers=new Set;watcherListeners=new Set;version=0;constructor(F){this.read=F}get(){return j0(this),this.read()}subscribe(F){return this.subscribers.add(F),()=>{this.subscribers.delete(F)}}addWatcher(F){return this.watcherListeners.add(F),()=>{this.watcherListeners.delete(F)}}getVersion(){return this.version}notify(F){this.version+=1;let M;try{this.notifyWatchers()}catch($){M=$}if(this.publish(F),M)throw M}publish(F){for(let M of this.subscribers)M(F)}notifyWatchers(){let F=[];for(let M of this.watcherListeners)try{M()}catch($){F.push($)}if(F.length===1)throw F[0];if(F.length>1)throw AggregateError(F,"Multiple reactive dependency notifications failed.")}}function YF(F){return typeof F==="object"&&F!==null&&typeof F.get==="function"}class k{host;access;shouldAutoBind;bindings;$;reactiveFields=new Map;reactiveDependencies=new Map;reactiveDependencyReaders=new Map;reactiveBindings=new Map;updateCallbacks=new Map;onConnectedCallbacks=[];onDisconnectedCallback=[];constructor(F,M,$){this.host=F;this.access=M;this.shouldAutoBind=$;let H=this.createReactiveBindingNamespace();this.bindings=H,this.$=H}connectHost(){for(let F of this.onConnectedCallbacks)F()}disconnectHost(){for(let F of this.onDisconnectedCallback)F()}notifyUpdate(F,M,$){if(M===$)return;this.reactiveDependencies.get(F)?.notify($);let H=this.updateCallbacks.get(F);if(H)for(let P of H)P()}registerCleanupCallback(F){this.onDisconnectedCallback.push(F)}registerConnectedCallback(F){this.onConnectedCallbacks.push(F)}registerHydrationBinding(F,M){}registerReactiveDependencyReader(F,M){this.reactiveDependencyReaders.set(F,M)}registerUpdateCallback(F,M){if(!this.updateCallbacks.has(F))this.updateCallbacks.set(F,new Set);let $=this.updateCallbacks.get(F);return $.add(M),()=>{if($.delete(M),$.size===0)this.updateCallbacks.delete(F)}}getReactiveBinding(F){let M=this.reactiveBindings.get(F);if(M)return M;let $=AF({getValue:()=>this.readReactiveBindingValue(F),subscribe:(H)=>this.registerUpdateCallback(F,()=>{H(this.readReactiveBindingValue(F))})});return this.reactiveBindings.set(F,$),$}bind(F){return this.getReactiveBinding(F)}defineReactiveBinding(F,M=!0){let $=typeof M==="string"?M:M?`$${F}`:void 0,H=this.access.getBindingTarget?.(this.host)??this.host;if(!$||this.access.hasProperty(this.host,$))return;this.access.defineProperty(H,$,{get:()=>this.getReactiveBinding(F),enumerable:!1,configurable:!0})}trackReactiveRead(F){j0(this.getReactiveDependency(F))}defineReactiveAccessor(F,M){let $=M.bind??this.shouldAutoBind();if(this.defineReactiveBinding(F,$),this.registerReactiveDependencyReader(F,M.getValue),this.access.defineProperty(this.host,F,{get:()=>{return this.trackReactiveRead(F),M.getValue()},set:(H)=>{let P=M.getValue();if(P===H)return;M.setValue(H),this.notifyUpdate(F,P,H)},enumerable:!0,configurable:!0}),M.notifyInitialValue!==void 0)this.notifyUpdate(F,void 0,M.notifyInitialValue)}createReactiveField(F,M,$={}){let H={name:F,value:M,initialValue:M};this.reactiveFields.set(F,H),this.defineReactiveAccessor(F,{bind:$.bind,getValue:()=>this.reactiveFields.get(F)?.value,setValue:(P)=>{this.reactiveFields.set(F,{...H,value:P})},notifyInitialValue:M})}createReactiveBindingNamespace(){return new Proxy(Object.create(null),{get:(F,M)=>{if(typeof M!=="string")return;return this.getReactiveBinding(M)}})}getReactiveDependency(F){let M=this.reactiveDependencies.get(F);if(M)return M;let $=new Z0(()=>this.readReactiveDependencyValue(F));return this.reactiveDependencies.set(F,$),$}readReactiveDependencyValue(F){let M=this.reactiveDependencyReaders.get(F);if(M)return M();return this.readReactiveBindingValue(F)}readReactiveBindingValue(F){let M=this.access.readProperty(this.host,F);if(YF(M))return M.get();return M}}var r=Symbol.for("@ecopages/radiant.ssr-preparation-callbacks"),X0=Symbol.for("@ecopages/radiant.ssr-preparation-running");function x0(F,M){let H=F[r];if(Array.isArray(H)){H.push(M);return}Object.defineProperty(F,r,{value:[M],configurable:!0})}function G0(F){let M=F,$=M[r];if(!Array.isArray($))return;M[X0]=!0;try{for(let H of $)H()}finally{delete M[X0]}}function B0(F){return F.replace(/&/g,"\\u0026").replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}var J="data-hydration",U0="data-hydration-type",o="data-hydration-key";function D0(F){let M=F.hydrationKey?` ${o}="${zF(F.hydrationKey)}"`:"";return`<script type="application/json" ${J} ${U0}="${F.type}"${M}>${F.serializedValue}</script>`}function q0(F){return B0(F)}function R0(F,M){let $=F.textContent;if(!$)return M;try{return JSON.parse($)}catch{if(typeof console<"u")console.warn(`[@ecopages/radiant] Failed to parse hydration payload from <script ${J}>:`,$.slice(0,120));return M}}function L0(F,M,$){let H=F.children;if(!H||H.length===0){let P=F.childNodes;if(!P||P.length===0)return null;for(let W=0;W<P.length;W+=1){let j=P[W];if(j.nodeType!==1)continue;let Z=j;if(Q0(Z,M,$))return Z}return null}for(let P=0;P<H.length;P+=1)if(Q0(H[P],M,$))return H[P];return null}function Q0(F,M,$){if(F.tagName!=="SCRIPT"||!F.hasAttribute(J)||F.getAttribute(U0)!==M)return!1;if($!==void 0)return F.getAttribute(o)===$;return!F.hasAttribute(o)}function zF(F){return F.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}import{createMarkupNodeLike as _F,isKeyedJsxValue as J0,isSlotJsxValue as TF}from"@ecopages/jsx";var z="",O="data-radiant-slot-projection";function A0(F){let M=new Map;for(let $ of Array.from(F.childNodes)){if(EF($))continue;kF(M,IF($),$)}return M}function Y0(F){let M;try{M=JSON.parse(F)}catch{if(typeof console<"u")console.warn("[@ecopages/radiant] Failed to parse slot projection payload:",F.slice(0,120));return new Map}let $=new Map;for(let[H,P]of Object.entries(M)){if(!Array.isArray(P)||P.length===0)continue;$.set(a(H),P.map((W)=>_F(W)))}return $}function z0(F){let M=Array.from(F.childNodes).filter(($)=>E0($)).map(($)=>w($)??"").filter(($)=>$!=="");return M.length>0?M.join(""):void 0}function _0(F){let M={};for(let[$,H]of F.entries()){let P=H.map((W)=>w(W)).filter((W)=>W!==void 0&&W!=="");if(P.length>0)M[$]=P}return Object.keys(M).length>0?JSON.stringify(M):void 0}function T0(F,M){let $=!1,H=(W)=>{if(TF(W))return $=!0,wF(W,M,H);if(J0(W))return KF(W,H(W.value));if(CF(W))return{_$rType$:1,rootLocalName:W.rootLocalName,strings:W.strings,values:W.values.map((j)=>H(j))};if(K0(W))return Array.from(W,(j)=>H(j));return W},P=H(F);return{containsSlots:$,value:P}}function k0(F){for(let M of Array.from(F.childNodes)){if(!I0(M))continue;let $=M.textContent??void 0;return M.parentNode?.removeChild(M),$}return}function kF(F,M,$){let H=F.get(M);if(H){H.push($);return}F.set(M,[$])}function KF(F,M){return{...F,value:M}}function IF(F){if(F instanceof Element)return a(F.getAttribute("slot"));return z}function K0(F){return typeof F!=="string"&&typeof F==="object"&&F!==null&&Symbol.iterator in F}function I0(F){return F instanceof HTMLScriptElement&&F.hasAttribute(O)}function E0(F){return F instanceof HTMLScriptElement&&F.hasAttribute(J)}function EF(F){return I0(F)||E0(F)}function CF(F){return typeof F==="object"&&F!==null&&F._$rType$===1&&Array.isArray(F.strings)&&Array.isArray(F.values)}function a(F){return F??z}function w(F){if(F===void 0||F===null||F===!1||F===!0)return;if(typeof Node<"u"&&F instanceof Node){if(F.nodeType===Node.TEXT_NODE)return F.textContent??"";return F.outerHTML??F.textContent??void 0}if(J0(F))return w(F.value);if(typeof F==="string"||typeof F==="number"||typeof F==="bigint")return String(F);if(typeof F==="object"&&F!==null&&"outerHTML"in F)return typeof F.outerHTML==="string"?F.outerHTML:F.textContent??void 0;if(K0(F))return Array.from(F,(M)=>w(M)??"").join("");return}function wF(F,M,$){let H=M.get(a(F.name));if(H&&H.length>0)return H.length===1?H[0]:H;if(F.fallback===void 0)return"";return $(F.fallback)}var t=Symbol.for("@ecopages/radiant.hydrator-installed");function kM(){globalThis[t]=!0}function KM(){delete globalThis[t]}function C0(){return globalThis[t]===!0}var w0=Symbol.for("@ecopages/radiant.component-ssr-runtime");function O0(){return globalThis[w0]}function EM(F){globalThis[w0]=F}function V0(F){switch(F){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function OF(F){switch(typeof F){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(F))return"array";if(Object.prototype.toString.call(F)==="[object Object]")return"object"}function K(F){switch(F){case Number:return 0;case String:return"";case Boolean:return!1;default:return null}}function SF(F){try{return JSON.parse(F)}catch{throw TypeError("Invalid JSON string")}}var fF={array(F){let M=SF(F);if(!Array.isArray(M))throw TypeError(`Expected an array but got a value of type "${typeof M}"`);return M},boolean(F){return!(F==="0"||String(F).toLowerCase()==="false")},number(F){return Number(F.replace(/_/g,""))},object(F){let M=JSON.parse(F);if(M===null||typeof M!=="object"||Array.isArray(M))throw TypeError(`expected value of type "object" but instead got value "${F}" of type "${OF(M)}"`);return M},string(F){return F}},S0={default:b0,array:f0,object:f0};function f0(F){return JSON.stringify(F)}function b0(F){return`${F}`}function _(F,M){let $=V0(M);if(!$)throw TypeError(`[radiant-element] Unknown type "${M}"`);return fF[$](F)}function S(F,M){let $=V0(M);if(!$)throw TypeError(`[radiant-element] Unknown type "${M}"`);return(S0[$]??S0.default??b0)(F)}function VF(F){return typeof F==="boolean"}function bF(F){return typeof F==="number"}function NF(F){return typeof F==="string"}function vF(F){return Array.isArray(F)}function hF(F){return typeof F==="object"&&!Array.isArray(F)&&F!==null}function q(F,M){switch(F){case Boolean:return VF(M);case Number:return bF(M);case String:return NF(M);case Array:return vF(M);case Object:return hF(M);default:return!1}}var N0=(F,M,$,H)=>{if(M===Boolean){let W=F.getAttribute($);if(W===null)return H;return W===""?!0:_(W,M)}let P=F.getAttribute($);return P!==null?_(P,M):H??K(M)};import{hasHydrationMarkers as gF,hydrate as uF,jsx as yF,render as mF}from"@ecopages/jsx";import{Computed as cF,subtle as dF}from"@ecopages/signals";var sF=pF();function pF(){if(typeof HTMLElement<"u")return HTMLElement;throw Error("RadiantElement requires HTMLElement. Install '@ecopages/radiant/server/light-dom-shim' before importing Radiant components in SSR.")}class V extends sF{renderRootMode="light";bindings;$;reactiveHost;reactiveProperties=new Map;contextProviders=new Map;hydrationBindings=new Map;eventSubscriptions=new Map;eventEmitters=new Map;elementReady=!1;isRendering=!1;isFirstConnectPending=!1;isRenderScheduled=!1;needsRender=!1;preUpgradePropertyValues=new Map;projectedSlotContent=new Map;renderSignal;renderWatcher=new dF.Watcher(()=>{this.requestUpdate()});slotProjectionObserver;slotProjectionVersion=0;constructor(){super();for(let F of Object.getOwnPropertyNames(this))this.preUpgradePropertyValues.set(F,this[F]);this.reactiveHost=new k(this,{defineProperty:(F,M,$)=>Object.defineProperty(F,M,$),getBindingTarget:(F)=>Object.getPrototypeOf(F)??F,hasProperty:(F,M)=>(M in F),readProperty:(F,M)=>F[M]},()=>this.shouldAutoBindReactiveMembers()),this.bindings=this.reactiveHost.bindings,this.$=this.reactiveHost.$,C(this)}connectedCallback(){let F=this.isFirstConnectPending;if(this.elementReady=!0,this.reactiveHost.connectHost(),F)return;this.isFirstConnectPending=!0,queueMicrotask(()=>{if(this.isFirstConnectPending=!1,!this.isConnected)return;if(!this.shouldRunRenderLifecycle())return;if(this.ensureSlotProjectionState(),this.observeSlotProjection(),v0(this)){if(this.needsRender=!1,this.hydrate(),this.needsRender)this.update();return}this.update()})}connectedContextCallback(F){}disconnectedCallback(){this.disconnectSlotProjectionObserver(),this.disconnectRenderWatcher(),this.removeAllSubscribedEvents(),this.reactiveHost.disconnectHost()}notifyUpdate(F,M,$){this.reactiveHost.notifyUpdate(F,M,$)}transformAttributeValue(F,M){return F!==null?M?.converter.fromAttribute(F):F}attributeChangedCallback(F,M,$){if(M===$||!this.elementReady)return;if(this.reactiveProperties.has(F)){let H=this.reactiveProperties.get(F),P=this.transformAttributeValue($,H),W=this.transformAttributeValue(M,H),j=H?H.attribute:F;this[j]=P,this.notifyUpdate(F,W,P)}}renderTemplate({target:F=this,template:M,insert:$="replace",sanitize:H}){let P=H?H(M):M;switch($){case"replace":F.innerHTML=P;break;case"beforeend":F.insertAdjacentHTML("beforeend",P);break;case"afterbegin":F.insertAdjacentHTML("afterbegin",P);break;case"beforebegin":F.insertAdjacentHTML("beforebegin",P);break;case"afterend":F.insertAdjacentHTML("afterend",P);break}}render(){return yF("slot",{})}renderToString(F={}){if(!this.shouldRunRenderLifecycle())return this.innerHTML;return this.prepareForSsr(),f().renderView(this,F)}renderHost(){return this.assertSupportsHostSsrRendering(),f().renderHost(this)}renderHostToString(F={}){return this.assertSupportsHostSsrRendering(),f().renderHostToString(this,F)}hydrate(){if(!this.shouldRunRenderLifecycle()||!this.isConnected||this.isRendering)return;let F=this.getRenderTarget();this.isRendering=!0,this.disconnectSlotProjectionObserver();try{uF(this.resolveTrackedRenderOutput().value,F)}finally{this.isRendering=!1,this.observeSlotProjection()}}requestUpdate(){if(!this.shouldRunRenderLifecycle())return;if(this.needsRender=!0,this.isRenderScheduled)return;this.isRenderScheduled=!0,queueMicrotask(()=>{if(this.isRenderScheduled=!1,!this.needsRender)return;this.update()})}update(){if(!this.shouldRunRenderLifecycle())return;let F=this.getRenderTarget();if(this.needsRender=!0,!this.isConnected||this.isRendering)return;if(this.isFirstConnectPending&&v0(this))return;while(this.needsRender&&this.isConnected){this.needsRender=!1,this.isRendering=!0,this.disconnectSlotProjectionObserver();try{mF(this.resolveTrackedRenderOutput().value,F)}finally{this.isRendering=!1,this.observeSlotProjection()}}}registerReactiveProperty(F){this.reactiveProperties.set(F.name,F)}getReactiveProperties(){return Array.from(this.reactiveProperties.values())}registerReactiveDependencyReader(F,M){this.reactiveHost.registerReactiveDependencyReader(F,M)}registerContextProvider(F,M){this.contextProviders.set(F,M),this.registerHydrationBinding(F,M)}registerHydrationBinding(F,M){this.hydrationBindings.set(F,M)}getContextProviders(){return Array.from(this.contextProviders.values())}getHydrationBindings(){return Array.from(this.hydrationBindings.values())}prepareForSsr(){G0(this)}shouldAutoBindReactiveMembers(){return!0}shouldRunRenderLifecycle(){return this.render!==V.prototype.render}getRenderTarget(){if(this.renderRootMode!=="shadow")return this;if(this.shadowRoot)return this.shadowRoot;if(typeof this.attachShadow!=="function")throw Error("RadiantElement shadow render mode requires attachShadow().");return this.attachShadow({mode:"open"})}getHostSsrAttributes(){return f().getHostAttributes(this)}resolveSsrRenderBridge(){let F={};if(this.renderHostToString===V.prototype.renderHostToString)F.renderHostToString=(M)=>this.renderHostToString(M);if(this.renderHost===V.prototype.renderHost)F.renderHost=()=>this.renderHost();return F}registerUpdateCallback(F,M){return this.reactiveHost.registerUpdateCallback(F,M)}getReactiveBinding(F){return this.reactiveHost.getReactiveBinding(F)}bind(F){return this.reactiveHost.bind(F)}defineReactiveBinding(F,M=!0){this.reactiveHost.defineReactiveBinding(F,M)}trackReactiveRead(F){this.reactiveHost.trackReactiveRead(F)}subscribeEvents(F){let M=[];for(let $ of F)M.push(this.subscribeEvent($));return M}subscribeEvent(F){let M=this.getEventSubscriptionTarget(),$=(P)=>{if(P.target&&P.target.matches(F.selector))F.listener.call(this,P)},H=`${F.type}:${F.selector}`;return M.addEventListener(F.type,$,F.options),this.eventSubscriptions.set(H,{...F,listener:$,target:M}),this.unsubscribeEvent.bind(this,H)}unsubscribeEvent(F){let M=this.eventSubscriptions.get(F);if(M)M.target.removeEventListener(M.type,M.listener,M.options),this.eventSubscriptions.delete(F)}removeAllSubscribedEvents(){for(let F of this.eventSubscriptions.values())F.target.removeEventListener(F.type,F.listener,F.options);this.eventSubscriptions.clear()}registerCleanupCallback(F){this.reactiveHost.registerCleanupCallback(F)}registerConnectedCallback(F){this.reactiveHost.registerConnectedCallback(F)}registerEventEmitter(F,M){this.eventEmitters.set(F,M)}getRef(F,M=!1){let $=`[data-ref="${F}"]`,H=this.getQueryRoot();if(M)return Array.from(H.querySelectorAll($));return H.querySelector($)??null}getSlotElement(F){return this.getSlotElements(F)[0]??null}getSlotElements(F){return this.ensureSlotProjectionState(),(this.projectedSlotContent.get(F??z)??[]).filter((M)=>typeof Node<"u"&&M instanceof Element)}createReactiveField(F,M,$={}){this.reactiveHost.createReactiveField(F,M,$)}createReactiveProp(F,M){let{type:$,attribute:H,reflect:P,defaultValue:W}=M,j=H??F,Z=this.preUpgradePropertyValues.has(F),X=Z?this.preUpgradePropertyValues.get(F):void 0;if(W!==void 0&&!q($,W))throw Error(`defaultValue does not match the expected type for ${$.name}`);let x=Z?X:N0(this,$,j,W);if(this.hasAttribute(j)&&(!P||x==null||x===""))this.removeAttribute(j);if(Z&&Object.prototype.hasOwnProperty.call(this,F))Reflect.deleteProperty(this,F);let B={type:$,name:F,value:x,initialValue:x,attribute:j,converter:{fromAttribute:(G)=>_(G,$),toAttribute:(G)=>S(G,$)}};this.registerReactiveProperty(B);let U=(G)=>{if(P)if(G==null||G===""||G===!1)this.removeAttribute(j);else{let R=B.converter.toAttribute(G);this.setAttribute(j,R)}};if(this.reactiveHost.defineReactiveAccessor(F,{bind:M.bind,getValue:()=>this.reactiveProperties.get(F)?.value,setValue:(G)=>{this.reactiveProperties.set(F,{...B,value:G}),U(G)}}),x!==void 0)queueMicrotask(()=>{let G=this.reactiveProperties.get(F)?.value;if(G===void 0)return;U(G),this.notifyUpdate(F,void 0,G)})}ensureSlotProjectionState(){if(this.projectedSlotContent.size>0)return;let F=this.isConnected?k0(this):void 0;if(typeof F==="string"&&F!==""){this.projectedSlotContent=Y0(F),this.slotProjectionVersion+=1;return}if(this.getHostChildNodeCount()>0)this.projectedSlotContent=A0(this),this.slotProjectionVersion+=1}getHostChildNodeCount(){return"childNodes"in this&&this.childNodes?this.childNodes.length:0}getSlotProjectionScriptTag(){this.ensureSlotProjectionState();let F=_0(this.projectedSlotContent);if(!F)return;return`<script type="application/json" ${O}>${iF(F)}</script>`}getAuthoredHydrationScriptMarkup(){let F=z0(this);if(F)return F;return}handleSlotProjectionMutations(F){let M=!1;for(let $ of F){for(let H of Array.from($.removedNodes))if(this.removeProjectedSlotNode(H))M=!0;for(let H of Array.from($.addedNodes)){if(H.parentNode!==this)continue;if(this.addProjectedSlotNode(H))M=!0}}if(M)this.slotProjectionVersion+=1,this.update()}addProjectedSlotNode(F){if(F instanceof HTMLScriptElement&&(F.hasAttribute(O)||F.hasAttribute(J)))return!1;let M=F instanceof Element?F.getAttribute("slot")??z:z,$=this.projectedSlotContent.get(M);if($){if($.includes(F))return!1;return $.push(F),!0}return this.projectedSlotContent.set(M,[F]),!0}removeProjectedSlotNode(F){for(let[M,$]of this.projectedSlotContent.entries()){let H=$.indexOf(F);if(H===-1)continue;if($.splice(H,1),$.length===0)this.projectedSlotContent.delete(M);return!0}return!1}observeSlotProjection(){if(typeof MutationObserver>"u"||this.slotProjectionObserver||!this.isConnected)return;this.slotProjectionObserver=new MutationObserver((F)=>this.handleSlotProjectionMutations(F)),this.slotProjectionObserver.observe(this,{childList:!0})}disconnectSlotProjectionObserver(){this.slotProjectionObserver?.disconnect(),this.slotProjectionObserver=void 0}disconnectRenderWatcher(){if(!this.renderSignal)return;this.renderWatcher.unwatch(this.renderSignal),this.renderSignal=void 0}resolveTrackedRenderOutput(){let F=new cF(()=>this.resolveRenderOutput()),M=F.get();if(!this.isConnected)return M;if(this.renderSignal)this.renderWatcher.unwatch(this.renderSignal);return this.renderSignal=F,this.renderWatcher.watch(F),M}resolveRenderOutput(){return this.ensureSlotProjectionState(),T0(this.render(),this.projectedSlotContent)}getEventSubscriptionTarget(){let F=this.getRenderTarget();return F instanceof ShadowRoot?F:this}getQueryRoot(){let F=this.getRenderTarget();return F instanceof ShadowRoot?F:this}assertSupportsHostSsrRendering(){if(this.renderRootMode==="shadow")throw Error("RadiantElement shadow render mode does not support renderHost() or renderHostToString().")}}function f(){let F=O0();if(!F)throw Error("Radiant SSR runtime is unavailable. Import `@ecopages/radiant/server/render-component` before using instance SSR methods.");return F}function v0(F){return C0()&&gF(F)}function iF(F){return F.replace(/</g,"\\u003c")}import{render as lF}from"@ecopages/jsx";import{Computed as nF,subtle as rF}from"@ecopages/signals";class h0{host;element;bindings;$;reactiveHost;connected=!1;isRendering=!1;isRenderScheduled=!1;isSsrLifecycle=!1;needsRender=!1;renderSignal;renderWatcher=new rF.Watcher(()=>{this.requestUpdate()});constructor(F){this.host=F,this.element=F,this.reactiveHost=new k(this,{defineProperty:(M,$,H)=>Object.defineProperty(M,$,H),hasProperty:(M,$)=>($ in M),readProperty:(M,$)=>M[$]},()=>this.shouldAutoBindReactiveMembers()),this.bindings=this.reactiveHost.bindings,this.$=this.reactiveHost.$,C(this)}connect(){if(this.connected=!0,this.reactiveHost.connectHost(),this.shouldRunRenderLifecycle())this.update()}connectForSsrRender(){this.isSsrLifecycle=!0;try{this.connect()}finally{this.isSsrLifecycle=!1}}disconnect(){this.connected=!1,this.disconnectRenderWatcher(),this.reactiveHost.disconnectHost()}disconnectForSsrRender(){this.disconnect()}get isConnected(){return this.connected}render(){return null}requestUpdate(){if(!this.shouldRunRenderLifecycle())return;if(this.needsRender=!0,this.isRenderScheduled)return;this.isRenderScheduled=!0,queueMicrotask(()=>{if(this.isRenderScheduled=!1,!this.needsRender)return;this.update()})}update(){if(!this.shouldRunRenderLifecycle())return;let F=this.getRenderTarget();if(!F)return;if(this.needsRender=!0,!this.connected||this.isRendering)return;while(this.needsRender){this.needsRender=!1,this.isRendering=!0;try{lF(this.resolveTrackedRenderOutput(),F)}finally{this.isRendering=!1}}}bind(F){return this.reactiveHost.bind(F)}getReactiveBinding(F){return this.reactiveHost.getReactiveBinding(F)}createReactiveField(F,M,$={}){this.reactiveHost.createReactiveField(F,M,$)}createReactiveProp(F,M){let{type:$,defaultValue:H,bind:P}=M;if(H!==void 0&&!q($,H))throw Error(`defaultValue does not match the expected type for ${$.name}`);let W=Object.getOwnPropertyDescriptor(this.host,F),j=this.host,X=j[F]??H??K($);this.reactiveHost.defineReactiveAccessor(F,{bind:P,getValue:()=>X,setValue:(x)=>{X=x},notifyInitialValue:X}),Object.defineProperty(this.host,F,{get:()=>this[F],set:(x)=>{this[F]=x},enumerable:W?.enumerable??!0,configurable:!0}),this.registerCleanupCallback(()=>{let x=this[F];if(W){if(Object.defineProperty(this.host,F,W),"value"in W&&W.writable)j[F]=x;return}delete j[F];try{j[F]=x}catch{Object.defineProperty(this.host,F,{value:x,writable:!0,enumerable:!0,configurable:!0})}})}defineReactiveBinding(F,M=!0){this.reactiveHost.defineReactiveBinding(F,M)}notifyUpdate(F,M,$){this.reactiveHost.notifyUpdate(F,M,$)}registerUpdateCallback(F,M){return this.reactiveHost.registerUpdateCallback(F,M)}connectedContextCallback(F){}registerContextProvider(F,M){}registerHydrationBinding(F,M){}registerCleanupCallback(F){this.reactiveHost.registerCleanupCallback(F)}registerConnectedCallback(F){this.reactiveHost.registerConnectedCallback(F)}registerReactiveDependencyReader(F,M){this.reactiveHost.registerReactiveDependencyReader(F,M)}trackReactiveRead(F){this.reactiveHost.trackReactiveRead(F)}addEventListener(F,M,$){this.host.addEventListener(F,M,$)}removeEventListener(F,M,$){this.host.removeEventListener(F,M,$)}dispatchEvent(F){return this.host.dispatchEvent(F)}getRef(F,M=!1){let $=`[data-ref="${F}"]`;if(M)return Array.from(this.host.querySelectorAll($));return this.host.querySelector($)??null}shouldAutoBindReactiveMembers(){return!0}shouldRunRenderLifecycle(){return!this.isSsrLifecycle&&this.render!==h0.prototype.render}getRenderTarget(){return this.host instanceof HTMLElement?this.host:null}disconnectRenderWatcher(){if(!this.renderSignal)return;this.renderWatcher.unwatch(this.renderSignal),this.renderSignal=void 0}resolveTrackedRenderOutput(){let F=new nF(()=>this.render()),M=F.get();if(!this.connected)return M;if(this.renderSignal)this.renderWatcher.unwatch(this.renderSignal);return this.renderSignal=F,this.renderWatcher.watch(F),M}}var g0=Symbol.for("@ecopages/radiant.controllerIdentifier");function e(F,M){F[g0]=M}function lM(F){return F[g0]}var N="data-controller",u0=Symbol.for("@ecopages/radiant.controller-registry-state");function oF(){let F=globalThis,M=F[u0];if(M)return M;let $={activeRuntimes:new Set,controllerRegistrationStrategy:"keep-current",controllerRegistry:new Map};return F[u0]=$,$}var v=oF(),A=v.controllerRegistry,T=v.activeRuntimes;function y0(F){let M=F.getAttribute(N);if(!M)return[];return M.split(/\s+/).map(($)=>$.trim()).filter(($)=>$.length>0)}function b(F,M){if(F instanceof Element&&F.hasAttribute(N))M(F);for(let $ of Array.from(F.querySelectorAll(`[${N}]`)))M($)}class m0{root;controllersByElement=new Map;observer;stopped=!1;constructor(F=document){this.root=F;this.start()}stop(){if(this.stopped)return;this.stopped=!0,this.observer?.disconnect(),this.observer=void 0;for(let[F,M]of this.controllersByElement)for(let[$]of M)this.disconnectController(F,$);T.delete(this)}reconcileRegisteredController(F){b(this.root,(M)=>{if(!y0(M).includes(F))return;this.connectController(M,F)})}replaceRegisteredController(F){for(let[M,$]of Array.from(this.controllersByElement.entries())){if(!$.has(F))continue;this.disconnectController(M,F)}this.reconcileRegisteredController(F)}start(){if(b(this.root,(M)=>{this.reconcileElement(M)}),typeof MutationObserver>"u"){T.add(this);return}this.observer=new MutationObserver((M)=>{for(let $ of M){if($.type==="attributes"&&$.target instanceof Element){this.reconcileElement($.target);continue}for(let H of Array.from($.removedNodes)){if(!(H instanceof Element))continue;b(H,(P)=>{this.disconnectElementControllers(P)})}for(let H of Array.from($.addedNodes)){if(!(H instanceof Element))continue;b(H,(P)=>{this.reconcileElement(P)})}}});let F=this.root instanceof Document?this.root.documentElement:this.root;this.observer.observe(F,{attributeFilter:[N],attributes:!0,childList:!0,subtree:!0}),T.add(this)}reconcileElement(F){let M=new Set(y0(F)),$=this.controllersByElement.get(F);if($){for(let H of $.keys())if(!M.has(H))this.disconnectController(F,H)}for(let H of M)this.connectController(F,H)}connectController(F,M){let $=A.get(M);if(!$)return;let H=this.controllersByElement.get(F);if(!H)H=new Map,this.controllersByElement.set(F,H);if(H.has(M))return;let P=new $(F);H.set(M,P),P.connect()}disconnectController(F,M){let $=this.controllersByElement.get(F);if(!$)return;let H=$.get(M);if(!H)return;if(H.disconnect(),$.delete(M),$.size===0)this.controllersByElement.delete(F)}disconnectElementControllers(F){let M=this.controllersByElement.get(F);if(!M)return;for(let $ of Array.from(M.keys()))this.disconnectController(F,$)}}function aF(F,M){let $=A.get(F);if($)return $;e(M,F),A.set(F,M);for(let H of Array.from(T))H.reconcileRegisteredController(F);return M}function oM(F){return A.has(F)}function aM(F){return A.get(F)}function tF(F,M){if(A.get(F)===M)return M;e(M,F),A.set(F,M);for(let H of Array.from(T))H.replaceRegisteredController(F);return M}function c0(F){v.controllerRegistrationStrategy=F}function tM(){c0("replace")}function eM(){c0("keep-current")}function d0(F,M){if(v.controllerRegistrationStrategy==="replace")return tF(F,M);return aF(F,M)}function F2(F=document){return new m0(F)}function M2(){for(let F of Array.from(T))F.stop()}function eF(F){return typeof F==="function"}function D(F,M,$,H){if(typeof H==="object")return F(void 0,H);return M($,H)}function L(F,M,$,H,P){if(typeof H==="object"){if(!eF($))throw TypeError("Standard method decorators require a method target");return F($,H)}if(!P)throw TypeError("Legacy method decorators require a property descriptor");return M($,H,P)}function F0(F){if(F instanceof Element)return F;if("host"in F)return F.host;return F.element}function FM(F){return F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/_/g,"-").toLowerCase()}function MM(F,M){if(M.converter?.fromAttribute){let $=M.converter.fromAttribute(F);if(F===null&&$===void 0&&"defaultValue"in M)return M.defaultValue;return $}if(M.type){if(F===null)return M.defaultValue??K(M.type);if(M.type===Boolean&&F==="")return!0;return _(F,M.type)}if(F===null)return M.defaultValue;return F}function Y(F,M,$){return MM(F0(F).getAttribute(M),$)}function $M(F,M,$,H){let P=H.converter?.toAttribute?H.converter.toAttribute($):H.type?S($,H.type):$==null?null:String($);if(P===null){F.removeAttribute(M);return}F.setAttribute(M,P)}function h(F,M,$={}){if($.type&&$.defaultValue!==void 0&&!q($.type,$.defaultValue))throw Error(`defaultValue does not match the expected type for ${$.type.name}`);let H=F,P=$.source??FM(M),W=Symbol(`@ecopages/radiant/attr:${M}:observer`),j=Symbol(`@ecopages/radiant/attr:${M}:last-value`),Z=$.bind??F.shouldAutoBindReactiveMembers?.()??!1;F.defineReactiveBinding(M,Z),F.registerReactiveDependencyReader(M,()=>Y(F,P,$)),H[j]=Y(F,P,$),Object.defineProperty(F,M,{get(){return F.trackReactiveRead(M),Y(this,P,$)},set(B){let U=F0(this),G=Y(this,P,$);$M(U,P,B,$);let R=Y(this,P,$);if(Object.is(G,R))return;this[j]=R,F.notifyUpdate(M,G,R)},enumerable:!0,configurable:!0});let X=()=>{H[W]?.disconnect()},x=()=>{let B=Y(F,P,$),U=H[j];if(!Object.is(U,B))H[j]=B,F.notifyUpdate(M,U,B);if(typeof MutationObserver>"u")return;let G=F0(F);X();let R=new MutationObserver(()=>{let l=Y(F,P,$),W0=H[j];if(Object.is(W0,l))return;H[j]=l,F.notifyUpdate(M,W0,l)});R.observe(G,{attributeFilter:[P],attributes:!0}),H[W]=R};x(),F.registerConnectedCallback(x),F.registerCleanupCallback(X)}function s0(F={}){return(M,$)=>{let H=Symbol(`@ecopages/radiant/attr:${$}:installed`);Q(M,(P)=>{P.registerConnectedCallback(()=>{if(P[H])return;let W=P[$],j=F.defaultValue===void 0?W:F.defaultValue;h(P,$,{...F,defaultValue:j}),P[H]=!0})})}}function p0(F={}){return function(M,$){let H=String($.name),P=Symbol(`@ecopages/radiant/attr:${H}:initializer`);return $.addInitializer(function(){let W=this[P],j=F.defaultValue===void 0?W:F.defaultValue;h(this,H,{...F,defaultValue:j})}),function(W){return this[P]=W,W}}}function D2(F={}){function M($,H){return D(p0(F),s0(F),$,H)}return M}function i0(F,M,$){let H=$.value;return{configurable:!0,get(){if(this===F.prototype||Object.prototype.hasOwnProperty.call(this,M))return H;let P=H.bind(this);return Object.defineProperty(this,M,{value:P,configurable:!0,writable:!0}),P}}}function l0(F,M){let $=String(M.name);if(M.private)throw Error(`'bound' cannot decorate private properties like ${$}.`);M.addInitializer(function(){this[$]=this[$].bind(this)})}function z2(F,M,$){return L(l0,i0,F,M,$)}function k2(F){return function(M){return d0(F,M)}}var n0=Symbol.for("@ecopages/radiant.customElementTagName");function g(F,M){F[n0]=M}function I2(F){return F[n0]}function r0(F,M){return($)=>{if(g($,F),typeof customElements<"u"&&!customElements.get(F))customElements.define(F,$,M)}}function o0(F,M){return function($,H){H.addInitializer(function(){if(g(this,F),typeof customElements<"u"&&!customElements.get(F))customElements.define(F,this,M)})}}function b2(F,M){function $(H,P){if(typeof P<"u")return o0(F,M)(H,P);return r0(F,M)(H)}return $}function u(F,M){let $=null,H=null,P,W=()=>{if($!==null)clearTimeout($),$=null},j=()=>{if(H===null)return P;let X=H;return H=null,W(),P=X(),P},Z=function(...X){H=()=>F.apply(this,X),W(),$=setTimeout(()=>{j()},M)};return Z.cancel=()=>{W(),H=null},Z.flush=()=>{if(H===null)return P;return j()},Z.pending=()=>H!==null,Z}function a0(F){return(M,$,H)=>{let P=H.value,W=new WeakMap;return H.value=function(...Z){let X=W.get(this);if(!X)X=u((...x)=>{return P.apply(this,x)},F),W.set(this,X);X(...Z)},H}}function t0(F){return(M)=>{let $=new WeakMap;return function(...H){let P=$.get(this);if(!P)P=u((...W)=>{return M.apply(this,W)},F),$.set(this,P);P(...H)}}}function s2(F){function M($,H,P){return L(t0(F),a0(F),$,H,P)}return M}class M0{host;eventConfig;constructor(F,M){this.host=F,this.eventConfig=M}emit(F){let M=new CustomEvent(this.eventConfig.name,{detail:F,bubbles:this.eventConfig.bubbles,cancelable:this.eventConfig.cancelable,composed:this.eventConfig.composed});this.host.dispatchEvent(M)}}function y(F,M){let $=new M0(F,M);return F.registerEventEmitter(M.name,$),$}function e0(F){return(M,$)=>{Q(M,(H)=>{let P=y(H,F);H.registerConnectedCallback(()=>{Object.defineProperty(H,$,{get(){return P},enumerable:!0,configurable:!0})})})}}function FF(F){return function(M,$){$.addInitializer(function(){let H=y(this,F);Object.defineProperty(this,$.name,{get(){return H},enumerable:!0,configurable:!0})})}}function H$(F){function M($,H){return D(FF(F),e0(F),$,H)}return M}function MF(F){let M=globalThis.CSS;if(typeof M?.escape==="function")return M.escape(F);let $="";for(let H=0;H<F.length;H+=1){let P=F[H]??"",W=P.codePointAt(0)??0;if(W===0){$+="�";continue}let j=W>=1&&W<=31||W===127,Z=H===0&&W>=48&&W<=57,X=H===1&&W>=48&&W<=57&&(F[0]??"")==="-",x=H===0&&P==="-"&&F.length===1;if(j||Z||X){$+=`\\${W.toString(16)} `;continue}if(W>=128||P==="-"||P==="_"||W>=48&&W<=57||W>=65&&W<=90||W>=97&&W<=122){$+=x?`\\${P}`:P;continue}$+=`\\${P}`}return $}var m=Symbol("radiant.shadowRootListenerHooks"),$F=Symbol("radiant.patchedAttachShadow");function PF(F){if(F instanceof Element)return F;if("host"in F)return F.host;return F.element}function HM(F){return!(F instanceof Element)}function HF(F,M,$,H){let P=(W)=>{if(W.target instanceof Element&&W.target.matches($))H(W)};return F.addEventListener(M.type,P,M.options),()=>{F.removeEventListener(M.type,P,M.options)}}function PM(F,M){let $=PF(F);if(!$[m])$[m]=new Set;if($[m].add(M),$[$F])return;let H=$.attachShadow;$.attachShadow=function(W){let j=H.call(this,W);for(let Z of $[m]??[])Z();return j},$[$F]=!0}function c(F,M,$){if(HM(F)&&"scope"in M&&M.scope&&M.scope!=="light")throw Error("RadiantController event listeners only support light DOM scope.");let H=PF(F),P=$.bind(F),W=null,j=null,Z=null,X=null,x=!1,B=()=>{W?.(),j?.(),Z?.(),X?.(),W=null,j=null,Z=null,X=null},U=()=>{if(x)return;if("window"in M&&!W)window.addEventListener(M.type,P,M.options),W=()=>{window.removeEventListener(M.type,P,M.options)};if("document"in M&&!j)document.addEventListener(M.type,P,M.options),j=()=>{document.removeEventListener(M.type,P,M.options)};if("selector"in M||"ref"in M){let G="selector"in M?M.selector:`[data-ref='${MF(M.ref)}']`;if(M.scope!=="shadow"&&!Z)Z=HF(H,M,G,P);if(M.scope!=="light"&&H.shadowRoot&&!X)X=HF(H.shadowRoot,M,G,P)}};if("selector"in M||"ref"in M){if(M.scope!=="light")PM(F,()=>{if(F.isConnected)U()})}if(F.registerConnectedCallback(U),F.registerCleanupCallback(B),F.isConnected)U();return()=>{x=!0,B()}}function WF(F){return(M,$,H)=>{let P=H.value;return Q(M,(W)=>{c(W,F,P.bind(W))}),H}}function jF(F){return function(M,$){$.addInitializer(function(){c(this,F,M.bind(this))})}}function R$(F){function M($,H,P){return L(jF(F),WF(F),$,H,P)}return M}function ZF(F){return(M,$)=>{let H=Symbol(`@ecopages/radiant/on-updated:${$}:cleanup`);Q(M,(P)=>{P.registerConnectedCallback(()=>{let W=P[$].bind(P),j=[];if(Array.isArray(F))for(let Z of F)j.push(P.registerUpdateCallback(Z,W));else if(typeof F==="string")j.push(P.registerUpdateCallback(F,W));P[H]=()=>{for(let Z of j)Z()}}),P.registerCleanupCallback(()=>{let W=P[H];if(typeof W==="function")W(),delete P[H]})})}}function XF(F){return function(M,$){$.addInitializer(function(){let H=M.bind(this);if(Object.defineProperty(this,$.name,{value:H,configurable:!0,writable:!0}),Array.isArray(F))for(let P of F)this.registerUpdateCallback(P,H);else if(typeof F==="string")this.registerUpdateCallback(F,H)})}}function k$(F){function M($,H,P){return L(XF(F),ZF(F),$,H,P)}return M}var $0=Symbol.for("@ecopages/radiant.reactivePropDefinitions");function d(F,M,$){let H=F.constructor,P=H[$0]??[];if(P.some((W)=>W.name===M))return;P.push({name:M,options:$}),H[$0]=P}function I$(F){return(F.constructor[$0]??[]).slice()}function xF({type:F,attribute:M,reflect:$,defaultValue:H,bind:P}){if(H!==void 0&&!q(F,H))throw Error(`defaultValue does not match the expected type for ${F.name}`);return(W,j)=>{let Z=M??j;d(W,j,{type:F,reflect:$,attribute:Z,defaultValue:H,bind:P});let X=Symbol.for(`@ecopages/radiant.ssr-prop:${j}`);Object.defineProperty(W,j,{get(){return this[X]??H},set(x){this[X]=x},configurable:!0,enumerable:!0}),Q(W,(x)=>{x.registerConnectedCallback(()=>{let B=x[j],U=H===void 0?B:H;x.createReactiveProp(j,{type:F,reflect:$,attribute:Z,defaultValue:U,bind:P})})})}}function GF({type:F,attribute:M,reflect:$,defaultValue:H,bind:P}){if(H!==void 0&&!q(F,H))throw Error(`defaultValue does not match the expected type for ${F.name}`);return function(W,j){let Z=String(j.name),X=M??Z,x=Symbol(`@ecopages/radiant/reactive-prop:${Z}:initializer`);return j.addInitializer(function(){let B=this[x],U=H===void 0?B:H;d(this,Z,{type:F,reflect:$,attribute:X,defaultValue:H,bind:P}),this.createReactiveProp(Z,{type:F,reflect:$,attribute:X,defaultValue:U,bind:P})}),function(B){return this[x]=B,B}}}function g$(F){function M($,H){return D(GF(F),xF(F),$,H)}return M}function WM(F){return!(F instanceof Element)}function jM(F){return"shadowRoot"in F?F.shadowRoot??null:null}function ZM(F){return F instanceof Element?F:F.host}function XM(F,M="light"){let $=jM(F);if(M==="shadow")return $?[$]:[];if(M==="both")return $?[F,$]:[F];return[F]}function s(F,M){if(WM(F)&&M.scope&&M.scope!=="light")throw Error("RadiantController queries only support light DOM scope.");let $=ZM(F),H="selector"in M?M.selector:`[data-ref="${M.ref}"]`,P=null,W=()=>{let j=XM($,M.scope);if(M.all)return j.flatMap((Z)=>Array.from(Z.querySelectorAll(H)));for(let Z of j){let X=Z.querySelector(H);if(X)return X}return null};return{get value(){if(M.cache){if(P===null||M.all&&Array.isArray(P)&&!P.length)P=W();return P}return W()}}}function BF({cache:F=!0,...M}){return($,H)=>{Q($,(P)=>{P.registerConnectedCallback(()=>{let W=s(P,{cache:F,...M});Object.defineProperty(P,H,{get(){return W.value},enumerable:!0,configurable:!0})})})}}function QF(F){return function(M,$){let H=String($.name);$.addInitializer(function(){let P=s(this,F);Object.defineProperty(this,H,{get(){return P.value},enumerable:!0,configurable:!0})})}}function r$(F){function M($,H){return D(QF(F),BF(F),$,H)}return M}function I(F,M={}){let $=null,H,P=()=>{if(M.all)return typeof F.getSlotElements==="function"?F.getSlotElements(M.name):[];return typeof F.getSlotElement==="function"?F.getSlotElement(M.name):null};return{get value(){if(M.cache===!1)return P();let W=F.slotProjectionVersion??0;if(H!==W)$=P(),H=W;return $}}}function UF(F={}){return(M,$)=>{let H=(j)=>{return typeof Object.getOwnPropertyDescriptor(j,$)?.get==="function"},P=(j)=>{if(H(j))return;let Z=I(j,F);Object.defineProperty(j,$,{get(){return Z.value},enumerable:!0,configurable:!0})},W=new WeakMap;Object.defineProperty(M,$,{get(){let j=W.get(this);if(!j)j=I(this,F),W.set(this,j);return j.value},enumerable:!0,configurable:!0}),Q(M,(j)=>{x0(j,()=>{P(j)}),j.registerConnectedCallback(()=>{P(j)})})}}function DF(F={}){return function(M,$){let H=String($.name);$.addInitializer(function(){let P=I(this,F);Object.defineProperty(this,H,{get(){return P.value},enumerable:!0,configurable:!0})})}}function Z1(F={}){function M($,H){return D(DF(F),UF(F),$,H)}return M}function qF(F){return D0({type:"signal",...F})}function RF(F){return q0(F)}import{createMarkupNodeLike as xM}from"@ecopages/jsx";import{state as GM}from"@ecopages/signals";function p(F){return typeof F==="object"&&F!==null&&typeof F.get==="function"&&typeof F.set==="function"&&typeof F.subscribe==="function"&&typeof F.update==="function"}class E{host;hydrate;hydrationKey;property;source;currentValue;hasAppliedHostHydration=!1;sourceUnsubscribe;constructor(F){this.host=F.host,this.hydrate=F.hydrate,this.hydrationKey=F.hydrationKey,this.property=F.property,this.source=F.source??GM(this.resolveInitialValue(F.initialValue)),this.currentValue=this.source.get()}get(){return this.source.get()}set(F){this.source.set(F)}subscribe(F){return this.source.subscribe(F)}update(F){this.set(F(this.get()))}connectToSource(){if(this.sourceUnsubscribe)return;let F=this.source.get();if(!Object.is(this.currentValue,F)){let M=this.currentValue;this.currentValue=F,this.host.notifyUpdate(this.property,M,F)}this.sourceUnsubscribe=this.source.subscribe((M)=>{this.handleSourceChange(M)})}disconnectFromSource(){this.sourceUnsubscribe?.(),this.sourceUnsubscribe=void 0}hydrateFromHost(){if(!this.hydrate||this.hasAppliedHostHydration)return;this.hasAppliedHostHydration=!0;let F=this.source.get(),M=this.resolveInitialValue(F);if(!Object.is(F,M))this.source.set(M),this.currentValue=this.source.get(),this.host.notifyUpdate(this.property,F,this.currentValue)}renderHydrationScript(){let F=this.renderHydrationScriptTag();if(!F)return;return xM(F)}renderHydrationScriptTag(){let F=this.serializeHydrationValue();if(!F)return;return qF({hydrationKey:this.hydrationKey,serializedValue:F})}findHydrationScriptElement(){if(!(this.host instanceof Element))return null;return L0(this.host,"signal",this.hydrationKey)}isObject(F){return typeof F==="object"&&!Array.isArray(F)&&F!==null}resolveInitialValue(F){if(!this.hydrate)return F;let M=this.findHydrationScriptElement();if(!M)return F;let $=R0(M,F);if(this.hydrate===Object&&this.isObject($)&&this.isObject(F))return{...F,...$};return $}serializeHydrationValue(){if(!this.hydrate)return;let F=JSON.stringify(this.get());if(typeof F!=="string")return;return RF(F)}handleSourceChange(F){let M=this.currentValue;if(this.currentValue=F,!Object.is(M,F))this.host.notifyUpdate(this.property,M,F)}}function i(F){return new E(F)}function H0(F={}){return(M,$)=>{let H=(P)=>{let W=P[$];if(W instanceof E)return W;let j=typeof F.source==="function"?F.source(P):F.source??(p(W)?W:void 0),Z=F.bind??P.shouldAutoBindReactiveMembers?.()??!1,X=j!==void 0?F.initial:W===void 0?F.initial:W;P.defineReactiveBinding($,Z);let x=i({host:P,hydrate:F.hydrate,hydrationKey:$,initialValue:X,property:$,source:j});if(P.registerConnectedCallback(()=>{x.hydrateFromHost(),x.connectToSource()}),P.registerCleanupCallback(()=>{x.disconnectFromSource()}),F.hydrate)P.registerHydrationBinding($,x);return P[$]=x,x};Q(M,(P)=>{let W=H(P);P.registerConnectedCallback(()=>{if(!(P[$]instanceof E))P[$]=W})})}}function P0(F={}){return function(M,$){let H=String($.name);return function(P){let W=typeof F.source==="function"?F.source(this):F.source??(p(P)?P:void 0),j=W!==void 0?F.initial:P===void 0?F.initial:P,Z=F.bind??this.shouldAutoBindReactiveMembers?.()??!1;this.defineReactiveBinding(H,Z);let X=i({host:this,hydrate:F.hydrate,hydrationKey:H,initialValue:j,property:H,source:W});if(this.registerConnectedCallback(()=>{X.hydrateFromHost(),X.connectToSource()}),this.registerCleanupCallback(()=>{X.disconnectFromSource()}),F.hydrate)this.registerHydrationBinding(H,X);return X}}}function T1(F,M){if(typeof M<"u"){if(typeof M==="object"){if(F!==void 0)throw TypeError("@signal standard decorators require an undefined target");return P0()(void 0,M)}if(F===void 0)throw TypeError("@signal legacy decorators require a host target");return H0()(F,M)}let $=F??{};function H(P,W){if(typeof W==="object"){if(P!==void 0)throw TypeError("@signal standard decorators require an undefined target");return P0($)(void 0,W)}if(P===void 0)throw TypeError("@signal legacy decorators require a host target");return H0($)(P,W)}return H}function LF(F,M){Q(F,($)=>{$.registerConnectedCallback(()=>{$.createReactiveField(M,$[M],{bind:$.shouldAutoBindReactiveMembers?.()??!1})})})}function JF(F,M){let $=Symbol(`__${String(M.name)}__value`),H=String(M.name);return M.addInitializer(function(){this.defineReactiveBinding(H,this.shouldAutoBindReactiveMembers?.()??!1),this.registerReactiveDependencyReader(H,()=>this[$]),Object.defineProperty(this,M.name,{get(){return this.trackReactiveRead(H),this[$]},set(P){let W=this[$];if(W!==P)this[$]=P,this.notifyUpdate(H,W,P)},enumerable:!0,configurable:!0})}),function(P){return this[$]=P,P}}function S1(F,M){return D(JF,LF,F,M)}export{b as visitControllerElements,M2 as stopControllers,S1 as state,F2 as startControllers,T1 as signal,c0 as setControllerRegistrationStrategy,aM as resolveRegisteredController,tF as replaceController,d0 as registerControllerWithConfiguredStrategy,aF as registerController,Z1 as querySlot,r$ as query,g$ as prop,y0 as parseControllerIdentifiers,k$ as onUpdated,R$ as onEvent,oM as hasRegisteredController,H$ as event,tM as enableControllerReplacementForHmr,eM as disableControllerReplacementForHmr,s2 as debounce,b2 as customElement,k2 as controller,z2 as bound,D2 as attr,V as RadiantElement,h0 as RadiantController,m0 as ControllerRegistryRuntime,u0 as CONTROLLER_REGISTRY_STATE_KEY,N as CONTROLLER_ATTRIBUTE};
1
+ var SM=((F)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(F,{get:(M,x)=>(typeof require<"u"?require:M)[x]}):F)(function(F){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+F+'" is not supported')});var A0=Symbol.for("@ecopages/radiant.legacy-instance-initializers"),G0=Symbol.for("@ecopages/radiant.legacy-post-construction-initializers"),bF=Symbol.for("@ecopages/radiant.legacy-executed-post-construction-initializers");function Q(F,M){D0(F,A0,M)}function Q0(F,M){D0(F,G0,M)}function C(F){o(F,A0)}function j(F){let M=F;o(F,G0,M[bF]??=new Set)}function D0(F,M,x){let $=F,H=Object.prototype.hasOwnProperty.call($,M)?$[M]:void 0;if(Array.isArray(H)){H.push(x);return}Object.defineProperty($,M,{value:[x]})}function o(F,M,x,$=Object.getPrototypeOf(F)){if(!$||$===Object.prototype)return;o(F,M,x,Object.getPrototypeOf($));let H=$[M];if(!Array.isArray(H))return;for(let P of H){if(x?.has(P))continue;P(F),x?.add(P)}}function q0(F){switch(F){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function NF(F){switch(typeof F){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(F))return"array";if(Object.prototype.toString.call(F)==="[object Object]")return"object"}function K(F){switch(F){case Number:return 0;case String:return"";case Boolean:return!1;default:return null}}function vF(F){try{return JSON.parse(F)}catch{throw TypeError("Invalid JSON string")}}var hF={array(F){let M=vF(F);if(!Array.isArray(M))throw TypeError(`Expected an array but got a value of type "${typeof M}"`);return M},boolean(F){return!(F==="0"||String(F).toLowerCase()==="false")},number(F){return Number(F.replace(/_/g,""))},object(F){let M=JSON.parse(F);if(M===null||typeof M!=="object"||Array.isArray(M))throw TypeError(`expected value of type "object" but instead got value "${F}" of type "${NF(M)}"`);return M},string(F){return F}},R0={default:U0,array:J0,object:J0};function J0(F){return JSON.stringify(F)}function U0(F){return`${F}`}function _(F,M){let x=q0(M);if(!x)throw TypeError(`[radiant-element] Unknown type "${M}"`);return hF[x](F)}function O(F,M){let x=q0(M);if(!x)throw TypeError(`[radiant-element] Unknown type "${M}"`);return(R0[x]??R0.default??U0)(F)}function gF(F){return typeof F==="boolean"}function uF(F){return typeof F==="number"}function yF(F){return typeof F==="string"}function mF(F){return Array.isArray(F)}function cF(F){return typeof F==="object"&&!Array.isArray(F)&&F!==null}function j0(F,M){switch(F){case Boolean:return gF(M);case Number:return uF(M);case String:return yF(M);case Array:return mF(M);case Object:return cF(M);default:return!1}}var Y0=(F,M,x,$)=>{if(M===Boolean){let P=F.getAttribute(x);if(P===null)return $;return P===""?!0:_(P,M)}let H=F.getAttribute(x);return H!==null?_(H,M):$??K(M)};function q(F,M){if(M!==void 0&&!j0(F,M))throw Error(`defaultValue does not match the expected type for ${F.name}`)}function L0(F,M,x,$){return{type:x,name:F,value:$,initialValue:$,attribute:M,converter:{fromAttribute:(H)=>_(H,x),toAttribute:(H)=>O(H,x)}}}import{Computed as dF,subtle as sF,trackDependency as pF}from"@ecopages/signals";function iF(F){return F}function T0(F){return F}var _0={trackDependency(F){pF(iF(F))},createComputed(F){return new dF(F)},createWatcher(F){let M=new sF.Watcher(F);return{watch(x){M.watch(T0(x))},unwatch(x){M.unwatch(T0(x))}}}};var z0=_0;function S(){return z0}function lF(F){z0=F}function a(F){S().trackDependency(F)}function f(F){return S().createComputed(F)}function V(F){return S().createWatcher(F)}function k0(F){return F.replace(/&/g,"\\u0026").replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}var Y="data-hydration",E0="data-hydration-type",t="data-hydration-key";function I0(F){let M=F.hydrationKey?` ${t}="${nF(F.hydrationKey)}"`:"";return`<script type="application/json" ${Y} ${E0}="${F.type}"${M}>${F.serializedValue}</script>`}function w0(F){return k0(F)}function C0(F,M){let x=F.textContent;if(!x)return M;try{return JSON.parse(x)}catch{if(typeof console<"u")console.warn(`[@ecopages/radiant] Failed to parse hydration payload from <script ${Y}>:`,x.slice(0,120));return M}}function O0(F,M,x){let $=F.children;if(!$||$.length===0){let H=F.childNodes;if(!H||H.length===0)return null;for(let P=0;P<H.length;P+=1){let W=H[P];if(W.nodeType!==1)continue;let Z=W;if(K0(Z,M,x))return Z}return null}for(let H=0;H<$.length;H+=1)if(K0($[H],M,x))return $[H];return null}function K0(F,M,x){if(F.tagName!=="SCRIPT"||!F.hasAttribute(Y)||F.getAttribute(E0)!==M)return!1;if(x!==void 0)return F.getAttribute(t)===x;return!F.hasAttribute(t)}function nF(F){return F.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}import{createMarkupNodeLike as rF,isKeyedJsxValue as S0,isSlotJsxValue as oF}from"@ecopages/jsx";var z="",N="data-radiant-slot-projection";function f0(F){let M=new Map;for(let x of Array.from(F.childNodes)){if(FM(x))continue;aF(M,eF(x),x)}return M}function V0(F){let M;try{M=JSON.parse(F)}catch{if(typeof console<"u")console.warn("[@ecopages/radiant] Failed to parse slot projection payload:",F.slice(0,120));return new Map}let x=new Map;for(let[$,H]of Object.entries(M)){if(!Array.isArray(H)||H.length===0)continue;x.set(e($),H.map((P)=>rF(P)))}return x}function b0(F){let M=Array.from(F.childNodes).filter((x)=>y0(x)).map((x)=>b(x)??"").filter((x)=>x!=="");return M.length>0?M.join(""):void 0}function N0(F){let M={};for(let[x,$]of F.entries()){let H=$.map((P)=>b(P)).filter((P)=>P!==void 0&&P!=="");if(H.length>0)M[x]=H}return Object.keys(M).length>0?JSON.stringify(M):void 0}function v0(F,M){let x=!1,$=(P)=>{if(oF(P))return x=!0,xM(P,M,$);if(S0(P))return tF(P,$(P.value));if(MM(P))return{_$rType$:1,rootLocalName:P.rootLocalName,ssrIntrinsicProps:P.ssrIntrinsicProps,strings:P.strings,values:P.values.map((W)=>$(W))};if(g0(P))return Array.from(P,(W)=>$(W));return P},H=$(F);return{containsSlots:x,value:H}}function h0(F){for(let M of Array.from(F.childNodes)){if(!u0(M))continue;let x=M.textContent??void 0;return M.parentNode?.removeChild(M),x}return}function aF(F,M,x){let $=F.get(M);if($){$.push(x);return}F.set(M,[x])}function tF(F,M){return{...F,value:M}}function eF(F){if(F instanceof Element)return e(F.getAttribute("slot"));return z}function g0(F){return typeof F!=="string"&&typeof F==="object"&&F!==null&&Symbol.iterator in F}function u0(F){return F instanceof HTMLScriptElement&&F.hasAttribute(N)}function y0(F){return F instanceof HTMLScriptElement&&F.hasAttribute(Y)}function FM(F){return u0(F)||y0(F)}function MM(F){return typeof F==="object"&&F!==null&&F._$rType$===1&&Array.isArray(F.strings)&&Array.isArray(F.values)}function e(F){return F??z}function b(F){if(F===void 0||F===null||F===!1||F===!0)return;if(typeof Node<"u"&&F instanceof Node){if(F.nodeType===Node.TEXT_NODE)return F.textContent??"";return F.outerHTML??F.textContent??void 0}if(S0(F))return b(F.value);if(typeof F==="string"||typeof F==="number"||typeof F==="bigint")return String(F);if(typeof F==="object"&&F!==null&&"outerHTML"in F)return typeof F.outerHTML==="string"?F.outerHTML:F.textContent??void 0;if(g0(F))return Array.from(F,(M)=>b(M)??"").join("");return}function xM(F,M,x){let $=M.get(e(F.name));if($&&$.length>0)return $.length===1?$[0]:$;if(F.fallback===void 0)return"";return x(F.fallback)}import{hydrate as $M,render as HM}from"@ecopages/jsx";class F0{#F;#M=new Map;#x;#H;#$;#P=0;constructor(F){this.#F=F,this.#H=V(()=>{this.#F.requestUpdate()})}get slotProjectionVersion(){return this.#P}getSlotElement(F){return this.getSlotElements(F)[0]??null}getSlotElements(F){return this.ensureSlotProjectionState(),(this.#M.get(F??z)??[]).filter((M)=>typeof Node<"u"&&M instanceof Element)}getSlotProjectionScriptTag(){this.ensureSlotProjectionState();let F=N0(this.#M);if(!F)return;return`<script type="application/json" ${N}>${PM(F)}</script>`}getAuthoredHydrationScriptMarkup(){return b0(this.#F)??void 0}hydrate(F){this.disconnectSlotProjectionObserver();try{$M(this.resolveTrackedRenderOutput().value,F)}finally{this.observeSlotProjection()}}render(F){this.disconnectSlotProjectionObserver();try{HM(this.resolveTrackedRenderOutput().value,F)}finally{this.observeSlotProjection()}}observeSlotProjection(){if(typeof MutationObserver>"u"||this.#$||!this.#F.isConnected)return;this.#$=new MutationObserver((F)=>this.handleSlotProjectionMutations(F)),this.#$.observe(this.#F,{childList:!0})}disconnectSlotProjectionObserver(){this.#$?.disconnect(),this.#$=void 0}disconnectRenderWatcher(){if(!this.#x)return;this.#H.unwatch(this.#x),this.#x=void 0}resolveTrackedRenderOutput(){let F=f(()=>this.resolveRenderOutput()),M=F.get();if(!this.#F.isConnected)return M;if(this.#x)this.#H.unwatch(this.#x);return this.#x=F,this.#H.watch(F),M}dispose(){this.disconnectSlotProjectionObserver(),this.disconnectRenderWatcher()}ensureSlotProjectionState(){if(this.#M.size>0)return;let F=this.#F.isConnected?h0(this.#F):void 0;if(typeof F==="string"&&F!==""){this.#M=V0(F),this.#P+=1;return}if(this.#F.childNodes.length>0)this.#M=f0(this.#F),this.#P+=1}handleSlotProjectionMutations(F){let M=!1;for(let x of F){for(let $ of Array.from(x.removedNodes))if(this.removeProjectedSlotNode($))M=!0;for(let $ of Array.from(x.addedNodes)){if($.parentNode!==this.#F)continue;if(this.addProjectedSlotNode($))M=!0}}if(M)this.#P+=1,this.#F.requestUpdate()}addProjectedSlotNode(F){if(F instanceof HTMLScriptElement&&(F.hasAttribute(N)||F.hasAttribute(Y)))return!1;let M=F instanceof Element?F.getAttribute("slot")??z:z,x=this.#M.get(M);if(x){if(x.includes(F))return!1;return x.push(F),!0}return this.#M.set(M,[F]),!0}removeProjectedSlotNode(F){for(let[M,x]of this.#M.entries()){let $=x.indexOf(F);if($===-1)continue;if(x.splice($,1),x.length===0)this.#M.delete(M);return!0}return!1}resolveRenderOutput(){return this.ensureSlotProjectionState(),v0(this.#F.render(),this.#M)}}function PM(F){return F.replace(/</g,"\\u003c")}import{createSubscribableJsxValue as WM}from"@ecopages/jsx";class m0{read;subscribers=new Set;watcherListeners=new Set;version=0;constructor(F){this.read=F}get(){return a(this),this.read()}subscribe(F){return this.subscribers.add(F),()=>{this.subscribers.delete(F)}}addWatcher(F){return this.watcherListeners.add(F),()=>{this.watcherListeners.delete(F)}}getVersion(){return this.version}notify(F){this.version+=1;let M;try{this.notifyWatchers()}catch(x){M=x}if(this.publish(F),M)throw M}publish(F){for(let M of this.subscribers)M(F)}notifyWatchers(){let F=[];for(let M of this.watcherListeners)try{M()}catch(x){F.push(x)}if(F.length===1)throw F[0];if(F.length>1)throw AggregateError(F,"Multiple reactive dependency notifications failed.")}}function ZM(F){return typeof F==="object"&&F!==null&&typeof F.get==="function"}class E{host;access;shouldAutoBind;bindings;$;reactiveFields=new Map;reactiveDependencies=new Map;reactiveDependencyReaders=new Map;reactiveBindings=new Map;updateCallbacks=new Map;onConnectedCallbacks=[];onDisconnectedCallback=[];constructor(F,M,x){this.host=F;this.access=M;this.shouldAutoBind=x;let $=this.createReactiveBindingNamespace();this.bindings=$,this.$=$}connectHost(){for(let F of this.onConnectedCallbacks)F()}disconnectHost(){for(let F of this.onDisconnectedCallback)F()}notifyUpdate(F,M,x){if(M===x)return;this.reactiveDependencies.get(F)?.notify(x);let $=this.updateCallbacks.get(F);if($)for(let H of $)H()}registerCleanupCallback(F){this.onDisconnectedCallback.push(F)}registerConnectedCallback(F){this.onConnectedCallbacks.push(F)}registerHydrationBinding(F,M){}registerReactiveDependencyReader(F,M){this.reactiveDependencyReaders.set(F,M)}registerUpdateCallback(F,M){if(!this.updateCallbacks.has(F))this.updateCallbacks.set(F,new Set);let x=this.updateCallbacks.get(F);return x.add(M),()=>{if(x.delete(M),x.size===0)this.updateCallbacks.delete(F)}}getReactiveBinding(F){let M=this.reactiveBindings.get(F);if(M)return M;let x=WM({getValue:()=>this.readReactiveBindingValue(F),subscribe:($)=>this.registerUpdateCallback(F,()=>{$(this.readReactiveBindingValue(F))})});return this.reactiveBindings.set(F,x),x}bind(F){return this.getReactiveBinding(F)}defineReactiveBinding(F,M=!0){let x=typeof M==="string"?M:M?`$${F}`:void 0,$=this.access.getBindingTarget?.(this.host)??this.host;if(!x||this.access.hasProperty(this.host,x))return;this.access.defineProperty($,x,{get:()=>this.getReactiveBinding(F),enumerable:!1,configurable:!0})}trackReactiveRead(F){a(this.getReactiveDependency(F))}defineReactiveAccessor(F,M){let x=M.bind??this.shouldAutoBind();if(this.defineReactiveBinding(F,x),this.registerReactiveDependencyReader(F,M.getValue),this.access.defineProperty(this.host,F,{get:()=>{return this.trackReactiveRead(F),M.getValue()},set:($)=>{let H=M.getValue();if(H===$)return;M.setValue($),this.notifyUpdate(F,H,$)},enumerable:!0,configurable:!0}),M.notifyInitialValue!==void 0)this.notifyUpdate(F,void 0,M.notifyInitialValue)}createReactiveField(F,M,x={}){let $={name:F,value:M,initialValue:M};this.reactiveFields.set(F,$),this.defineReactiveAccessor(F,{bind:x.bind,getValue:()=>this.reactiveFields.get(F)?.value,setValue:(H)=>{this.reactiveFields.set(F,{...$,value:H})},notifyInitialValue:M})}createReactiveBindingNamespace(){return new Proxy(Object.create(null),{get:(F,M)=>{if(typeof M!=="string")return;return this.getReactiveBinding(M)}})}getReactiveDependency(F){let M=this.reactiveDependencies.get(F);if(M)return M;let x=new m0(()=>this.readReactiveDependencyValue(F));return this.reactiveDependencies.set(F,x),x}readReactiveDependencyValue(F){let M=this.reactiveDependencyReaders.get(F);if(M)return M();return this.readReactiveBindingValue(F)}readReactiveBindingValue(F){let M=this.access.readProperty(this.host,F);if(ZM(M))return M.get();return M}}var M0=Symbol.for("@ecopages/radiant.ssr-preparation-callbacks"),c0=Symbol.for("@ecopages/radiant.ssr-preparation-running");function d0(F,M){let $=F[M0];if(Array.isArray($)){$.push(M);return}Object.defineProperty(F,M0,{value:[M],configurable:!0})}function s0(F){let M=F,x=M[M0];if(!Array.isArray(x))return;M[c0]=!0;try{for(let $ of x)$()}finally{delete M[c0]}}var x0=Symbol.for("@ecopages/radiant.hydrator-installed");function Px(){globalThis[x0]=!0}function Wx(){delete globalThis[x0]}function p0(){return globalThis[x0]===!0}import{getActiveSsrScopeValue as XM,withActiveSsrScopeValue as BM}from"@ecopages/jsx/server";var i0=Symbol.for("@ecopages/radiant.element-ssr-runtime");function l0(){return XM(i0)}function Bx(F,M){return BM(i0,F,M)}import{hasHydrationMarkers as AM,jsx as GM}from"@ecopages/jsx";var QM=DM();function DM(){if(typeof HTMLElement<"u")return HTMLElement;throw Error("RadiantElement requires HTMLElement. Install '@ecopages/radiant/server/light-dom-shim' before SSR imports.")}class r0 extends QM{renderRootMode="light";bindings;$;reactiveHost;reactivePropertyState;contextProviders=new Map;hydrationBindings=new Map;eventSubscriptions=new Map;eventEmitters=new Map;elementReady=!1;isRendering=!1;isFirstConnectPending=!1;isRenderScheduled=!1;needsRender=!1;renderRuntime;constructor(){super();this.reactivePropertyState=new o0(this),this.reactiveHost=new E(this,{defineProperty:(F,M,x)=>Object.defineProperty(F,M,x),getBindingTarget:(F)=>Object.getPrototypeOf(F)??F,hasProperty:(F,M)=>(M in F),readProperty:(F,M)=>F[M]},()=>this.shouldAutoBindReactiveMembers()),this.bindings=this.reactiveHost.bindings,this.$=this.reactiveHost.$,C(this)}get slotProjectionVersion(){return this.renderRuntime?.slotProjectionVersion??0}connectedCallback(){j(this);let F=this.isFirstConnectPending;if(this.elementReady=!0,this.reactiveHost.connectHost(),F)return;this.isFirstConnectPending=!0,queueMicrotask(()=>{if(this.isFirstConnectPending=!1,!this.isConnected)return;if(!this.shouldRunRenderLifecycle())return;if(this.getOrCreateRenderRuntime().observeSlotProjection(),n0(this)){if(this.needsRender=!1,this.hydrate(),this.needsRender)this.update();return}this.update()})}connectedContextCallback(F){}disconnectedCallback(){this.renderRuntime?.dispose(),this.renderRuntime=void 0,this.removeAllSubscribedEvents(),this.reactiveHost.disconnectHost()}notifyUpdate(F,M,x){this.reactiveHost.notifyUpdate(F,M,x)}attributeChangedCallback(F,M,x){if(M===x||!this.elementReady)return;this.reactivePropertyState.applyAttributeChange(F,M,x)}renderTemplate({target:F=this,template:M,insert:x="replace",sanitize:$}){let H=$?$(M):M;switch(x){case"replace":F.innerHTML=H;break;case"beforeend":F.insertAdjacentHTML("beforeend",H);break;case"afterbegin":F.insertAdjacentHTML("afterbegin",H);break;case"beforebegin":F.insertAdjacentHTML("beforebegin",H);break;case"afterend":F.insertAdjacentHTML("afterend",H);break}}render(){return GM("slot",{})}renderViewToString(F={}){if(!this.shouldRunRenderLifecycle())return this.innerHTML;return j(this),this.prepareForSsr(),RM().renderView(this,F)}hydrate(){if(!this.shouldRunRenderLifecycle()||!this.isConnected||this.isRendering)return;let{renderTarget:F}=this.resolveRenderSurface(),M=this.getOrCreateRenderRuntime();this.isRendering=!0;try{M.hydrate(F)}finally{this.isRendering=!1}}requestUpdate(){if(!this.shouldRunRenderLifecycle())return;if(this.needsRender=!0,this.isRenderScheduled)return;this.isRenderScheduled=!0,queueMicrotask(()=>{if(this.isRenderScheduled=!1,!this.needsRender)return;this.update()})}update(){if(!this.shouldRunRenderLifecycle())return;let{renderTarget:F}=this.resolveRenderSurface(),M=this.getOrCreateRenderRuntime();if(this.needsRender=!0,!this.isConnected||this.isRendering)return;if(this.isFirstConnectPending&&n0(this))return;while(this.needsRender&&this.isConnected){this.needsRender=!1,this.isRendering=!0;try{M.render(F)}finally{this.isRendering=!1}}}registerReactiveProperty(F){this.reactivePropertyState.register(F)}getReactiveProperties(){return this.reactivePropertyState.getAll()}registerReactiveDependencyReader(F,M){this.reactiveHost.registerReactiveDependencyReader(F,M)}registerContextProvider(F,M){this.contextProviders.set(F,M),this.hydrationBindings.set(F,M)}registerHydrationBinding(F,M){this.hydrationBindings.set(F,M)}getContextProviders(){return j(this),[...this.contextProviders.values()]}getHydrationBindings(){return j(this),[...this.hydrationBindings.values()]}prepareForSsr(){s0(this)}shouldAutoBindReactiveMembers(){return!0}shouldRunRenderLifecycle(){return this.render!==r0.prototype.render}getRenderTarget(){if(this.renderRootMode!=="shadow")return this;if(this.shadowRoot)return this.shadowRoot;if(typeof this.attachShadow!=="function")throw Error("RadiantElement shadow render mode requires attachShadow().");return this.attachShadow({mode:"open"})}registerUpdateCallback(F,M){return this.reactiveHost.registerUpdateCallback(F,M)}getReactiveBinding(F){return this.reactiveHost.getReactiveBinding(F)}bind(F){return this.reactiveHost.bind(F)}defineReactiveBinding(F,M=!0){this.reactiveHost.defineReactiveBinding(F,M)}trackReactiveRead(F){this.reactiveHost.trackReactiveRead(F)}subscribeEvents(F){let M=[];for(let x of F)M.push(this.subscribeEvent(x));return M}subscribeEvent(F){let{interactionTarget:M}=this.resolveRenderSurface(),x=(H)=>{if(H.target&&H.target.matches(F.selector))F.listener.call(this,H)},$=`${F.type}:${F.selector}`;return M.addEventListener(F.type,x,F.options),this.eventSubscriptions.set($,{...F,listener:x,target:M}),this.unsubscribeEvent.bind(this,$)}unsubscribeEvent(F){let M=this.eventSubscriptions.get(F);if(M)M.target.removeEventListener(M.type,M.listener,M.options),this.eventSubscriptions.delete(F)}removeAllSubscribedEvents(){for(let F of this.eventSubscriptions.values())F.target.removeEventListener(F.type,F.listener,F.options);this.eventSubscriptions.clear()}registerCleanupCallback(F){this.reactiveHost.registerCleanupCallback(F)}registerConnectedCallback(F){this.reactiveHost.registerConnectedCallback(F)}registerEventEmitter(F,M){this.eventEmitters.set(F,M)}getRef(F,M=!1){let x=`[data-ref="${F}"]`,{queryRoot:$}=this.resolveRenderSurface();if(M)return Array.from($.querySelectorAll(x));return $.querySelector(x)??null}getSlotElement(F){return this.getOrCreateRenderRuntime().getSlotElement(F)}getSlotElements(F){return this.getOrCreateRenderRuntime().getSlotElements(F)}createReactiveField(F,M,x={}){this.reactiveHost.createReactiveField(F,M,x)}createReactiveProp(F,M){this.reactivePropertyState.create(F,M,(x,$,H)=>Y0(this,x,$,H),(x,$)=>{this.reactiveHost.defineReactiveAccessor(x,$)})}getSlotProjectionScriptTag(){return this.getOrCreateRenderRuntime().getSlotProjectionScriptTag()}getAuthoredHydrationScriptMarkup(){return this.getOrCreateRenderRuntime().getAuthoredHydrationScriptMarkup()}resolveTrackedRenderOutput(){return this.getOrCreateRenderRuntime().resolveTrackedRenderOutput()}getOrCreateRenderRuntime(){if(this.renderRuntime)return this.renderRuntime;return this.renderRuntime=new F0(this),this.renderRuntime}resolveRenderSurface(){let F=this.getRenderTarget(),M=F instanceof ShadowRoot?F:this;return{interactionTarget:M,queryRoot:M,renderTarget:F}}}function RM(){let F=l0();if(!F)throw Error("Radiant SSR runtime unavailable. Import `@ecopages/radiant/server/render-component` first.");return F}function n0(F){return p0()&&AM(F)}class o0{host;properties=new Map;preUpgradePropertyValues=new Map;constructor(F){this.host=F;for(let M of Object.getOwnPropertyNames(F))this.preUpgradePropertyValues.set(M,Reflect.get(F,M))}register(F){this.properties.set(F.name,F)}getAll(){return Array.from(this.properties.values())}applyAttributeChange(F,M,x){let $=this.properties.get(F);if(!$)return;let H=this.transformAttributeValue(x,$),P=this.transformAttributeValue(M,$);Reflect.set(this.host,$.attribute,H),this.host.notifyUpdate(F,P,H)}create(F,M,x,$){let{type:H,attribute:P,reflect:W,defaultValue:Z}=M,X=P??F,B=this.preUpgradePropertyValues.has(F),A=B?this.preUpgradePropertyValues.get(F):void 0;q(H,Z);let G=B?A:x(H,X,Z);if(this.host.hasAttribute(X)&&(!W||G==null||G===""))this.host.removeAttribute(X);if(B&&Object.prototype.hasOwnProperty.call(this.host,F))Reflect.deleteProperty(this.host,F);let R=L0(F,X,H,G);if(this.register(R),$(F,{bind:M.bind,getValue:()=>this.properties.get(F)?.value,setValue:(D)=>{this.properties.set(F,{...R,value:D}),this.reflectValue(X,W,R,D)}}),G!==void 0)queueMicrotask(()=>{let D=this.properties.get(F)?.value;if(D===void 0)return;this.reflectValue(X,W,R,D),this.host.notifyUpdate(F,void 0,D)})}transformAttributeValue(F,M){return F!==null?M.converter.fromAttribute(F):F}reflectValue(F,M,x,$){if(!M)return;if($==null||$===""||$===!1){this.host.removeAttribute(F);return}let H=x.converter.toAttribute($);this.host.setAttribute(F,H)}}import{render as JM}from"@ecopages/jsx";class a0{host;element;bindings;$;reactiveHost;connected=!1;isRendering=!1;isRenderScheduled=!1;isSsrLifecycle=!1;needsRender=!1;contextProviders=new Map;hydrationBindings=new Map;renderSignal;renderWatcher=V(()=>{this.requestUpdate()});constructor(F){this.host=F,this.element=F,this.reactiveHost=new E(this,{defineProperty:(M,x,$)=>Object.defineProperty(M,x,$),hasProperty:(M,x)=>(x in M),readProperty:(M,x)=>M[x]},()=>this.shouldAutoBindReactiveMembers()),this.bindings=this.reactiveHost.bindings,this.$=this.reactiveHost.$,C(this)}connect(){if(j(this),this.connected=!0,this.reactiveHost.connectHost(),this.shouldRunRenderLifecycle())this.update()}connectForSsrRender(){this.isSsrLifecycle=!0;try{this.connect()}finally{this.isSsrLifecycle=!1}}disconnect(){this.connected=!1,this.disconnectRenderWatcher(),this.reactiveHost.disconnectHost()}disconnectForSsrRender(){this.disconnect()}get isConnected(){return this.connected}render(){return null}requestUpdate(){if(!this.shouldRunRenderLifecycle())return;if(this.needsRender=!0,this.isRenderScheduled)return;this.isRenderScheduled=!0,queueMicrotask(()=>{if(this.isRenderScheduled=!1,!this.needsRender)return;this.update()})}update(){if(!this.shouldRunRenderLifecycle())return;let F=this.getRenderTarget();if(!F)return;if(this.needsRender=!0,!this.connected||this.isRendering)return;while(this.needsRender){this.needsRender=!1,this.isRendering=!0;try{JM(this.resolveTrackedRenderOutput(),F)}finally{this.isRendering=!1}}}bind(F){return this.reactiveHost.bind(F)}getReactiveBinding(F){return this.reactiveHost.getReactiveBinding(F)}createReactiveField(F,M,x={}){this.reactiveHost.createReactiveField(F,M,x)}createReactiveProp(F,M){let{type:x,defaultValue:$,bind:H}=M;q(x,$);let P=new t0(this.host,this,F),Z=P.getInitialValue()??$??K(x);this.reactiveHost.defineReactiveAccessor(F,{bind:H,getValue:()=>Z,setValue:(X)=>{Z=X},notifyInitialValue:Z}),P.install(),this.registerCleanupCallback(()=>{P.restore()})}defineReactiveBinding(F,M=!0){this.reactiveHost.defineReactiveBinding(F,M)}notifyUpdate(F,M,x){this.reactiveHost.notifyUpdate(F,M,x)}registerUpdateCallback(F,M){return this.reactiveHost.registerUpdateCallback(F,M)}connectedContextCallback(F){}registerContextProvider(F,M){this.contextProviders.set(F,M),this.hydrationBindings.set(F,M)}registerHydrationBinding(F,M){this.hydrationBindings.set(F,M)}getSsrContextProviders(){return[...this.contextProviders.values()]}getSsrHydrationBindings(){return[...this.hydrationBindings.values()]}registerCleanupCallback(F){this.reactiveHost.registerCleanupCallback(F)}registerConnectedCallback(F){this.reactiveHost.registerConnectedCallback(F)}registerReactiveDependencyReader(F,M){this.reactiveHost.registerReactiveDependencyReader(F,M)}trackReactiveRead(F){this.reactiveHost.trackReactiveRead(F)}addEventListener(F,M,x){this.host.addEventListener(F,M,x)}removeEventListener(F,M,x){this.host.removeEventListener(F,M,x)}dispatchEvent(F){return this.host.dispatchEvent(F)}getRef(F,M=!1){let x=`[data-ref="${F}"]`;if(M)return Array.from(this.host.querySelectorAll(x));return this.host.querySelector(x)??null}shouldAutoBindReactiveMembers(){return!0}shouldRunRenderLifecycle(){return!this.isSsrLifecycle&&this.render!==a0.prototype.render}getRenderTarget(){return this.host instanceof HTMLElement?this.host:null}disconnectRenderWatcher(){if(!this.renderSignal)return;this.renderWatcher.unwatch(this.renderSignal),this.renderSignal=void 0}resolveTrackedRenderOutput(){let F=f(()=>this.render()),M=F.get();if(!this.connected)return M;if(this.renderSignal)this.renderWatcher.unwatch(this.renderSignal);return this.renderSignal=F,this.renderWatcher.watch(F),M}}class t0{host;controller;propertyName;ownDescriptor;constructor(F,M,x){this.host=F;this.controller=M;this.propertyName=x;this.ownDescriptor=Object.getOwnPropertyDescriptor(this.host,this.propertyName)}getInitialValue(){return Reflect.get(this.host,this.propertyName)}install(){Object.defineProperty(this.host,this.propertyName,{get:()=>Reflect.get(this.controller,this.propertyName),set:(F)=>{Reflect.set(this.controller,this.propertyName,F)},enumerable:this.ownDescriptor?.enumerable??!0,configurable:!0})}restore(){let F=Reflect.get(this.controller,this.propertyName);if(this.ownDescriptor){if(Object.defineProperty(this.host,this.propertyName,this.ownDescriptor),"value"in this.ownDescriptor&&this.ownDescriptor.writable)Reflect.set(this.host,this.propertyName,F);return}Reflect.deleteProperty(this.host,this.propertyName);try{Reflect.set(this.host,this.propertyName,F)}catch{Object.defineProperty(this.host,this.propertyName,{value:F,writable:!0,enumerable:!0,configurable:!0})}}}var e0=Symbol.for("@ecopages/radiant.controllerIdentifier");function $0(F,M){F[e0]=M}function wx(F){return F[e0]}var h="data-controller",FF=Symbol.for("@ecopages/radiant.controller-registry-state");function qM(){let F=globalThis,M=F[FF];if(M)return M;let x={activeRuntimes:new Set,controllerRegistrationStrategy:"keep-current",controllerRegistry:new Map};return F[FF]=x,x}var g=qM(),L=g.controllerRegistry,k=g.activeRuntimes;function MF(F){let M=F.getAttribute(h);if(!M)return[];return M.split(/\s+/).map((x)=>x.trim()).filter((x)=>x.length>0)}function v(F,M){if(F instanceof Element&&F.hasAttribute(h))M(F);for(let x of Array.from(F.querySelectorAll(`[${h}]`)))M(x)}class xF{root;controllersByElement=new Map;observer;stopped=!1;constructor(F=document){this.root=F;this.start()}stop(){if(this.stopped)return;this.stopped=!0,this.observer?.disconnect(),this.observer=void 0;for(let[F,M]of this.controllersByElement)for(let[x]of M)this.disconnectController(F,x);k.delete(this)}reconcileRegisteredController(F){v(this.root,(M)=>{if(!MF(M).includes(F))return;this.connectController(M,F)})}replaceRegisteredController(F){for(let[M,x]of Array.from(this.controllersByElement.entries())){if(!x.has(F))continue;this.disconnectController(M,F)}this.reconcileRegisteredController(F)}start(){if(v(this.root,(M)=>{this.reconcileElement(M)}),typeof MutationObserver>"u"){k.add(this);return}this.observer=new MutationObserver((M)=>{for(let x of M){if(x.type==="attributes"&&x.target instanceof Element){this.reconcileElement(x.target);continue}for(let $ of Array.from(x.removedNodes)){if(!($ instanceof Element))continue;v($,(H)=>{this.disconnectElementControllers(H)})}for(let $ of Array.from(x.addedNodes)){if(!($ instanceof Element))continue;v($,(H)=>{this.reconcileElement(H)})}}});let F=this.root instanceof Document?this.root.documentElement:this.root;this.observer.observe(F,{attributeFilter:[h],attributes:!0,childList:!0,subtree:!0}),k.add(this)}reconcileElement(F){let M=new Set(MF(F)),x=this.controllersByElement.get(F);if(x){for(let $ of x.keys())if(!M.has($))this.disconnectController(F,$)}for(let $ of M)this.connectController(F,$)}connectController(F,M){let x=L.get(M);if(!x)return;let $=this.controllersByElement.get(F);if(!$)$=new Map,this.controllersByElement.set(F,$);if($.has(M))return;let H=new x(F);$.set(M,H),H.connect()}disconnectController(F,M){let x=this.controllersByElement.get(F);if(!x)return;let $=x.get(M);if(!$)return;if($.disconnect(),x.delete(M),x.size===0)this.controllersByElement.delete(F)}disconnectElementControllers(F){let M=this.controllersByElement.get(F);if(!M)return;for(let x of Array.from(M.keys()))this.disconnectController(F,x)}}function UM(F,M){let x=L.get(F);if(x)return x;$0(M,F),L.set(F,M);for(let $ of Array.from(k))$.reconcileRegisteredController(F);return M}function Sx(F){return L.has(F)}function fx(F){return L.get(F)}function jM(F,M){if(L.get(F)===M)return M;$0(M,F),L.set(F,M);for(let $ of Array.from(k))$.replaceRegisteredController(F);return M}function $F(F){g.controllerRegistrationStrategy=F}function Vx(){$F("replace")}function bx(){$F("keep-current")}function HF(F,M){if(g.controllerRegistrationStrategy==="replace")return jM(F,M);return UM(F,M)}function Nx(F=document){return new xF(F)}function vx(){for(let F of Array.from(k))F.stop()}function YM(F){return typeof F==="function"}function J(F,M,x,$){if(typeof $==="object")return F(void 0,$);return M(x,$)}function U(F,M,x,$,H){if(typeof $==="object"){if(!YM(x))throw TypeError("Standard method decorators require a method target");return F(x,$)}if(!H)throw TypeError("Legacy method decorators require a property descriptor");return M(x,$,H)}function H0(F){if(F instanceof Element)return F;if("host"in F)return F.host;return F.element}function LM(F){return F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/_/g,"-").toLowerCase()}function TM(F,M){if(M.converter?.fromAttribute){let x=M.converter.fromAttribute(F);if(F===null&&x===void 0&&"defaultValue"in M)return M.defaultValue;return x}if(M.type){if(F===null)return M.defaultValue??K(M.type);if(M.type===Boolean&&F==="")return!0;return _(F,M.type)}if(F===null)return M.defaultValue;return F}function T(F,M,x){return TM(H0(F).getAttribute(M),x)}function _M(F,M,x,$){let H=$.converter?.toAttribute?$.converter.toAttribute(x):$.type?O(x,$.type):x==null?null:String(x);if(H===null){F.removeAttribute(M);return}F.setAttribute(M,H)}function u(F,M,x={}){if(x.type)q(x.type,x.defaultValue);let $=F,H=x.source??LM(M),P=Symbol(`@ecopages/radiant/attr:${M}:observer`),W=Symbol(`@ecopages/radiant/attr:${M}:last-value`),Z=x.bind??F.shouldAutoBindReactiveMembers?.()??!1;F.defineReactiveBinding(M,Z),F.registerReactiveDependencyReader(M,()=>T(F,H,x)),$[W]=T(F,H,x),Object.defineProperty(F,M,{get(){return F.trackReactiveRead(M),T(this,H,x)},set(A){let G=H0(this),R=T(this,H,x);_M(G,H,A,x);let D=T(this,H,x);if(Object.is(R,D))return;this[W]=D,F.notifyUpdate(M,R,D)},enumerable:!0,configurable:!0});let X=()=>{$[P]?.disconnect()},B=()=>{let A=T(F,H,x),G=$[W];if(!Object.is(G,A))$[W]=A,F.notifyUpdate(M,G,A);if(typeof MutationObserver>"u")return;let R=H0(F);X();let D=new MutationObserver(()=>{let r=T(F,H,x),B0=$[W];if(Object.is(B0,r))return;$[W]=r,F.notifyUpdate(M,B0,r)});D.observe(R,{attributeFilter:[H],attributes:!0}),$[P]=D};B(),F.registerConnectedCallback(B),F.registerCleanupCallback(X)}function PF(F={}){return(M,x)=>{let $=Symbol(`@ecopages/radiant/attr:${x}:installed`);Q(M,(H)=>{H.registerConnectedCallback(()=>{if(H[$])return;let P=H[x],W=F.defaultValue===void 0?P:F.defaultValue;u(H,x,{...F,defaultValue:W}),H[$]=!0})})}}function WF(F={}){return function(M,x){let $=String(x.name),H=Symbol(`@ecopages/radiant/attr:${$}:initializer`);return x.addInitializer(function(){let P=this[H],W=F.defaultValue===void 0?P:F.defaultValue;u(this,$,{...F,defaultValue:W})}),function(P){return this[H]=P,P}}}function ox(F={}){function M(x,$){return J(WF(F),PF(F),x,$)}return M}function ZF(F,M,x){let $=x.value;return{configurable:!0,get(){if(this===F.prototype||Object.prototype.hasOwnProperty.call(this,M))return $;let H=$.bind(this);return Object.defineProperty(this,M,{value:H,configurable:!0,writable:!0}),H}}}function XF(F,M){let x=String(M.name);if(M.private)throw Error(`'bound' cannot decorate private properties like ${x}.`);M.addInitializer(function(){this[x]=this[x].bind(this)})}function $2(F,M,x){return U(XF,ZF,F,M,x)}function W2(F){return function(M){return HF(F,M)}}var BF=Symbol.for("@ecopages/radiant.customElementTagName");function y(F,M){F[BF]=M}function X2(F){return F[BF]}function AF(F,M){return(x)=>{if(y(x,F),typeof customElements<"u"&&!customElements.get(F))customElements.define(F,x,M)}}function GF(F,M){return function(x,$){$.addInitializer(function(){if(y(this,F),typeof customElements<"u"&&!customElements.get(F))customElements.define(F,this,M)})}}function q2(F,M){function x($,H){if(typeof H<"u")return GF(F,M)($,H);return AF(F,M)($)}return x}function m(F,M){let x=null,$=null,H,P=()=>{if(x!==null)clearTimeout(x),x=null},W=()=>{if($===null)return H;let X=$;return $=null,P(),H=X(),H},Z=function(...X){$=()=>F.apply(this,X),P(),x=setTimeout(()=>{W()},M)};return Z.cancel=()=>{P(),$=null},Z.flush=()=>{if($===null)return H;return W()},Z.pending=()=>$!==null,Z}function QF(F){return(M,x,$)=>{let H=$.value,P=new WeakMap;return $.value=function(...Z){let X=P.get(this);if(!X)X=m((...B)=>{return H.apply(this,B)},F),P.set(this,X);X(...Z)},$}}function DF(F){return(M)=>{let x=new WeakMap;return function(...$){let H=x.get(this);if(!H)H=m((...P)=>{return M.apply(this,P)},F),x.set(this,H);H(...$)}}}function E2(F){function M(x,$,H){return U(DF(F),QF(F),x,$,H)}return M}class P0{host;eventConfig;constructor(F,M){this.host=F,this.eventConfig=M}emit(F){let M=new CustomEvent(this.eventConfig.name,{detail:F,bubbles:this.eventConfig.bubbles,cancelable:this.eventConfig.cancelable,composed:this.eventConfig.composed});this.host.dispatchEvent(M)}}function c(F,M){let x=new P0(F,M);return F.registerEventEmitter(M.name,x),x}function RF(F){return(M,x)=>{Q(M,($)=>{let H=c($,F);$.registerConnectedCallback(()=>{Object.defineProperty($,x,{get(){return H},enumerable:!0,configurable:!0})})})}}function JF(F){return function(M,x){x.addInitializer(function(){let $=c(this,F);Object.defineProperty(this,x.name,{get(){return $},enumerable:!0,configurable:!0})})}}function u2(F){function M(x,$){return J(JF(F),RF(F),x,$)}return M}function qF(F){let M=globalThis.CSS;if(typeof M?.escape==="function")return M.escape(F);let x="";for(let $=0;$<F.length;$+=1){let H=F[$]??"",P=H.codePointAt(0)??0;if(P===0){x+="�";continue}let W=P>=1&&P<=31||P===127,Z=$===0&&P>=48&&P<=57,X=$===1&&P>=48&&P<=57&&(F[0]??"")==="-",B=$===0&&H==="-"&&F.length===1;if(W||Z||X){x+=`\\${P.toString(16)} `;continue}if(P>=128||H==="-"||H==="_"||P>=48&&P<=57||P>=65&&P<=90||P>=97&&P<=122){x+=B?`\\${H}`:H;continue}x+=`\\${H}`}return x}var d=Symbol("radiant.shadowRootListenerHooks"),UF=Symbol("radiant.patchedAttachShadow");function YF(F){if(F instanceof Element)return F;if("host"in F)return F.host;return F.element}function zM(F){return!(F instanceof Element)}function jF(F,M,x,$){let H=(P)=>{if(P.target instanceof Element&&P.target.matches(x))$(P)};return F.addEventListener(M.type,H,M.options),()=>{F.removeEventListener(M.type,H,M.options)}}function kM(F,M){let x=YF(F);if(!x[d])x[d]=new Set;if(x[d].add(M),x[UF])return;let $=x.attachShadow;x.attachShadow=function(P){let W=$.call(this,P);for(let Z of x[d]??[])Z();return W},x[UF]=!0}function s(F,M,x){if(zM(F)&&"scope"in M&&M.scope&&M.scope!=="light")throw Error("RadiantController event listeners only support light DOM scope.");let $=YF(F),H=x.bind(F),P=null,W=null,Z=null,X=null,B=!1,A=()=>{P?.(),W?.(),Z?.(),X?.(),P=null,W=null,Z=null,X=null},G=()=>{if(B)return;if("window"in M&&!P)window.addEventListener(M.type,H,M.options),P=()=>{window.removeEventListener(M.type,H,M.options)};if("document"in M&&!W)document.addEventListener(M.type,H,M.options),W=()=>{document.removeEventListener(M.type,H,M.options)};if("selector"in M||"ref"in M){let R="selector"in M?M.selector:`[data-ref='${qF(M.ref)}']`;if(M.scope!=="shadow"&&!Z)Z=jF($,M,R,H);if(M.scope!=="light"&&$.shadowRoot&&!X)X=jF($.shadowRoot,M,R,H)}};if("selector"in M||"ref"in M){if(M.scope!=="light")kM(F,()=>{if(F.isConnected)G()})}if(F.registerConnectedCallback(G),F.registerCleanupCallback(A),F.isConnected)G();return()=>{B=!0,A()}}function LF(F){return(M,x,$)=>{let H=$.value;return Q(M,(P)=>{s(P,F,H.bind(P))}),$}}function TF(F){return function(M,x){x.addInitializer(function(){s(this,F,M.bind(this))})}}function t2(F){function M(x,$,H){return U(TF(F),LF(F),x,$,H)}return M}function _F(F){return(M,x)=>{let $=Symbol(`@ecopages/radiant/on-updated:${x}:cleanup`);Q(M,(H)=>{H.registerConnectedCallback(()=>{let P=H[x].bind(H),W=[];if(Array.isArray(F))for(let Z of F)W.push(H.registerUpdateCallback(Z,P));else if(typeof F==="string")W.push(H.registerUpdateCallback(F,P));H[$]=()=>{for(let Z of W)Z()}}),H.registerCleanupCallback(()=>{let P=H[$];if(typeof P==="function")P(),delete H[$]})})}}function zF(F){return function(M,x){x.addInitializer(function(){let $=M.bind(this);if(Object.defineProperty(this,x.name,{value:$,configurable:!0,writable:!0}),Array.isArray(F))for(let H of F)this.registerUpdateCallback(H,$);else if(typeof F==="string")this.registerUpdateCallback(F,$)})}}function W$(F){function M(x,$,H){return U(zF(F),_F(F),x,$,H)}return M}var W0=Symbol.for("@ecopages/radiant.reactivePropDefinitions");function p(F,M,x){let $=F.constructor,H=$[W0]??[];if(H.some((P)=>P.name===M))return;H.push({name:M,options:x}),$[W0]=H}function X$(F){return(F.constructor[W0]??[]).slice()}function kF({type:F,attribute:M,reflect:x,defaultValue:$,bind:H}){return q(F,$),(P,W)=>{let Z=M??W;p(P,W,{type:F,reflect:x,attribute:Z,defaultValue:$,bind:H});let X=Symbol.for(`@ecopages/radiant.ssr-prop:${W}`);Object.defineProperty(P,W,{get(){return this[X]??$},set(B){this[X]=B},configurable:!0,enumerable:!0}),Q(P,(B)=>{B.registerConnectedCallback(()=>{let A=B[W],G=$===void 0?A:$;B.createReactiveProp(W,{type:F,reflect:x,attribute:Z,defaultValue:G,bind:H})})})}}function KF({type:F,attribute:M,reflect:x,defaultValue:$,bind:H}){return q(F,$),function(P,W){let Z=String(W.name),X=M??Z,B=Symbol(`@ecopages/radiant/reactive-prop:${Z}:initializer`);return W.addInitializer(function(){let A=this[B],G=$===void 0?A:$;p(this,Z,{type:F,reflect:x,attribute:X,defaultValue:$,bind:H}),this.createReactiveProp(Z,{type:F,reflect:x,attribute:X,defaultValue:G,bind:H})}),function(A){return this[B]=A,A}}}function L$(F){function M(x,$){return J(KF(F),kF(F),x,$)}return M}function KM(F){return!(F instanceof Element)}function EM(F){return"shadowRoot"in F?F.shadowRoot??null:null}function IM(F){return F instanceof Element?F:F.host}function wM(F,M="light"){let x=EM(F);if(M==="shadow")return x?[x]:[];if(M==="both")return x?[F,x]:[F];return[F]}function i(F,M){if(KM(F)&&M.scope&&M.scope!=="light")throw Error("RadiantController queries only support light DOM scope.");let x=IM(F),$="selector"in M?M.selector:`[data-ref="${M.ref}"]`,H=null,P=()=>{let W=wM(x,M.scope);if(M.all)return W.flatMap((Z)=>Array.from(Z.querySelectorAll($)));for(let Z of W){let X=Z.querySelector($);if(X)return X}return null};return{get value(){if(M.cache){if(H===null||M.all&&Array.isArray(H)&&!H.length)H=P();return H}return P()}}}function EF({cache:F=!0,...M}){return(x,$)=>{Q(x,(H)=>{H.registerConnectedCallback(()=>{let P=i(H,{cache:F,...M});Object.defineProperty(H,$,{get(){return P.value},enumerable:!0,configurable:!0})})})}}function IF(F){return function(M,x){let $=String(x.name);x.addInitializer(function(){let H=i(this,F);Object.defineProperty(this,$,{get(){return H.value},enumerable:!0,configurable:!0})})}}function S$(F){function M(x,$){return J(IF(F),EF(F),x,$)}return M}function I(F,M={}){let x=null,$,H=()=>{if(M.all)return typeof F.getSlotElements==="function"?F.getSlotElements(M.name):[];return typeof F.getSlotElement==="function"?F.getSlotElement(M.name):null};return{get value(){if(M.cache===!1)return H();let P=F.slotProjectionVersion??0;if($!==P)x=H(),$=P;return x}}}function wF(F={}){return(M,x)=>{let $=(W)=>{return typeof Object.getOwnPropertyDescriptor(W,x)?.get==="function"},H=(W)=>{if($(W))return;let Z=I(W,F);Object.defineProperty(W,x,{get(){return Z.value},enumerable:!0,configurable:!0})},P=new WeakMap;Object.defineProperty(M,x,{get(){let W=P.get(this);if(!W)W=I(this,F),P.set(this,W);return W.value},enumerable:!0,configurable:!0}),Q(M,(W)=>{d0(W,()=>{H(W)}),W.registerConnectedCallback(()=>{H(W)})})}}function CF(F={}){return function(M,x){let $=String(x.name);x.addInitializer(function(){let H=I(this,F);Object.defineProperty(this,$,{get(){return H.value},enumerable:!0,configurable:!0})})}}function d$(F={}){function M(x,$){return J(CF(F),wF(F),x,$)}return M}function OF(F){return I0({type:"signal",...F})}function SF(F){return w0(F)}import{createMarkupNodeLike as CM}from"@ecopages/jsx";import{state as OM}from"@ecopages/signals";function l(F){return typeof F==="object"&&F!==null&&typeof F.get==="function"&&typeof F.set==="function"&&typeof F.subscribe==="function"&&typeof F.update==="function"}class w{host;hydrate;hydrationKey;property;source;currentValue;hasAppliedHostHydration=!1;sourceUnsubscribe;constructor(F){this.host=F.host,this.hydrate=F.hydrate,this.hydrationKey=F.hydrationKey,this.property=F.property,this.source=F.source??OM(this.resolveInitialValue(F.initialValue)),this.currentValue=this.source.get()}get(){return this.source.get()}set(F){this.source.set(F)}subscribe(F){return this.source.subscribe(F)}update(F){this.set(F(this.get()))}connectToSource(){if(this.sourceUnsubscribe)return;let F=this.source.get();if(!Object.is(this.currentValue,F)){let M=this.currentValue;this.currentValue=F,this.host.notifyUpdate(this.property,M,F)}this.sourceUnsubscribe=this.source.subscribe((M)=>{this.handleSourceChange(M)})}disconnectFromSource(){this.sourceUnsubscribe?.(),this.sourceUnsubscribe=void 0}hydrateFromHost(){if(!this.hydrate||this.hasAppliedHostHydration)return;this.hasAppliedHostHydration=!0;let F=this.source.get(),M=this.resolveInitialValue(F);if(!Object.is(F,M))this.source.set(M),this.currentValue=this.source.get(),this.host.notifyUpdate(this.property,F,this.currentValue)}renderHydrationScript(){let F=this.renderHydrationScriptTag();if(!F)return;return CM(F)}renderHydrationScriptTag(){let F=this.serializeHydrationValue();if(!F)return;return OF({hydrationKey:this.hydrationKey,serializedValue:F})}findHydrationScriptElement(){if(!(this.host instanceof Element))return null;return O0(this.host,"signal",this.hydrationKey)}isObject(F){return typeof F==="object"&&!Array.isArray(F)&&F!==null}resolveInitialValue(F){if(!this.hydrate)return F;let M=this.findHydrationScriptElement();if(!M)return F;let x=C0(M,F);if(this.hydrate===Object&&this.isObject(x)&&this.isObject(F))return{...F,...x};return x}serializeHydrationValue(){if(!this.hydrate)return;let F=JSON.stringify(this.get());if(typeof F!=="string")return;return SF(F)}handleSourceChange(F){let M=this.currentValue;if(this.currentValue=F,!Object.is(M,F))this.host.notifyUpdate(this.property,M,F)}}function n(F){return new w(F)}function Z0(F={}){return(M,x)=>{let $=(H)=>{let P=H[x];if(P instanceof w)return P;let W=typeof F.source==="function"?F.source(H):F.source??(l(P)?P:void 0),Z=F.bind??H.shouldAutoBindReactiveMembers?.()??!1,X=W!==void 0?F.initial:P===void 0?F.initial:P;H.defineReactiveBinding(x,Z);let B=n({host:H,hydrate:F.hydrate,hydrationKey:x,initialValue:X,property:x,source:W});if(H.registerConnectedCallback(()=>{B.hydrateFromHost(),B.connectToSource()}),H.registerCleanupCallback(()=>{B.disconnectFromSource()}),F.hydrate)H.registerHydrationBinding(x,B);return H[x]=B,B};Q0(M,(H)=>{let P=$(H);H.registerConnectedCallback(()=>{if(!(H[x]instanceof w))H[x]=P})})}}function X0(F={}){return function(M,x){let $=String(x.name);return function(H){let P=typeof F.source==="function"?F.source(this):F.source??(l(H)?H:void 0),W=P!==void 0?F.initial:H===void 0?F.initial:H,Z=F.bind??this.shouldAutoBindReactiveMembers?.()??!1;this.defineReactiveBinding($,Z);let X=n({host:this,hydrate:F.hydrate,hydrationKey:$,initialValue:W,property:$,source:P});if(this.registerConnectedCallback(()=>{X.hydrateFromHost(),X.connectToSource()}),this.registerCleanupCallback(()=>{X.disconnectFromSource()}),F.hydrate)this.registerHydrationBinding($,X);return X}}}function P1(F,M){if(typeof M<"u"){if(typeof M==="object"){if(F!==void 0)throw TypeError("@signal standard decorators require an undefined target");return X0()(void 0,M)}if(F===void 0)throw TypeError("@signal legacy decorators require a host target");return Z0()(F,M)}let x=F??{};function $(H,P){if(typeof P==="object"){if(H!==void 0)throw TypeError("@signal standard decorators require an undefined target");return X0(x)(void 0,P)}if(H===void 0)throw TypeError("@signal legacy decorators require a host target");return Z0(x)(H,P)}return $}function fF(F,M){Q(F,(x)=>{x.registerConnectedCallback(()=>{x.createReactiveField(M,x[M],{bind:x.shouldAutoBindReactiveMembers?.()??!1})})})}function VF(F,M){let x=Symbol(`__${String(M.name)}__value`),$=String(M.name);return M.addInitializer(function(){this.defineReactiveBinding($,this.shouldAutoBindReactiveMembers?.()??!1),this.registerReactiveDependencyReader($,()=>this[x]),Object.defineProperty(this,M.name,{get(){return this.trackReactiveRead($),this[x]},set(H){let P=this[x];if(P!==H)this[x]=H,this.notifyUpdate($,P,H)},enumerable:!0,configurable:!0})}),function(H){return this[x]=H,H}}function D1(F,M){return J(VF,fF,F,M)}export{v as visitControllerElements,vx as stopControllers,D1 as state,Nx as startControllers,P1 as signal,$F as setControllerRegistrationStrategy,fx as resolveRegisteredController,jM as replaceController,HF as registerControllerWithConfiguredStrategy,UM as registerController,d$ as querySlot,S$ as query,L$ as prop,MF as parseControllerIdentifiers,W$ as onUpdated,t2 as onEvent,Sx as hasRegisteredController,u2 as event,Vx as enableControllerReplacementForHmr,bx as disableControllerReplacementForHmr,E2 as debounce,q2 as customElement,W2 as controller,$2 as bound,ox as attr,r0 as RadiantElement,a0 as RadiantController,xF as ControllerRegistryRuntime,FF as CONTROLLER_REGISTRY_STATE_KEY,h as CONTROLLER_ATTRIBUTE};
2
2
 
3
- //# debugId=26E5CC492F2EEBE864756E2164756E21
3
+ //# debugId=0701F56762F0F59564756E2164756E21