@stacksjs/ts-cloud 0.5.11 → 0.5.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.
@@ -1,4 +1,4 @@
1
- <!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>stx App</title><style data-crosswind="generated"> /* ! Tailwind CSS Preflight | MIT License | https://tailwindcss.com */ *, ::before, ::after { box-sizing: border-box; border-width: 0; border-style: solid; border-color: var(--border-color, currentColor); } ::before, ::after { --hw-content: ''; } html, :host { line-height: 1.5; -webkit-text-size-adjust: 100%; -moz-tab-size: 4; tab-size: 4; font-family: ui-sans-serif, system-ui, sans-serif; font-feature-settings: normal; font-variation-settings: normal; -webkit-tap-highlight-color: transparent; } body { margin: 0; line-height: inherit; } hr { height: 0; color: inherit; border-top-width: 1px; } abbr:where([title]) { text-decoration: underline dotted; } h1, h2, h3, h4, h5, h6 { font-size: inherit; font-weight: inherit; } a { color: inherit; text-decoration: inherit; } b, strong { font-weight: bolder; } code, kbd, samp, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-feature-settings: normal; font-variation-settings: normal; font-size: 1em; } small { font-size: 80%; } sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; } sub { bottom: -0.25em; } sup { top: -0.5em; } table { text-indent: 0; border-color: var(--border-color, inherit); border-collapse: collapse; } button, input, optgroup, select, textarea { font-family: inherit; font-feature-settings: inherit; font-variation-settings: inherit; font-size: 100%; font-weight: inherit; line-height: inherit; letter-spacing: inherit; color: inherit; margin: 0; padding: 0; } button, select { text-transform: none; } button, input:where([type='button']), input:where([type='reset']), input:where([type='submit']) { -webkit-appearance: button; background-color: transparent; background-image: none; } :-moz-focusring { outline: auto; } :-moz-ui-invalid { box-shadow: none; } progress { vertical-align: baseline; } ::-webkit-inner-spin-button, ::-webkit-outer-spin-button { height: auto; } [type='search'] { -webkit-appearance: textfield; outline-offset: -2px; } ::-webkit-search-decoration { -webkit-appearance: none; } ::-webkit-file-upload-button { -webkit-appearance: button; font: inherit; } summary { display: list-item; } blockquote, dl, dd, h1, h2, h3, h4, h5, h6, hr, figure, p, pre { margin: 0; } fieldset { margin: 0; padding: 0; } legend { padding: 0; } ol, ul, menu { list-style: none; margin: 0; padding: 0; } dialog { padding: 0; } textarea { resize: vertical; } input::placeholder, textarea::placeholder { opacity: 1; color: #9ca3af; } button, [role="button"] { cursor: pointer; } :disabled { cursor: default; } img, svg, video, canvas, audio, iframe, embed, object { display: block; vertical-align: middle; } img, video { max-width: 100%; height: auto; } [hidden] { display: none; } .row-actions { grid-row: actions; } </style></head><body> <script data-stx-scoped>console.log("[stx] signals runtime loading");if(!window.__stx_early_mounts)window.__stx_early_mounts=[];if(!window.__stx_early_destroys)window.__stx_early_destroys=[];if(!window.onMount)window.onMount=function(fn){window.__stx_early_mounts.push(fn)};if(!window.onDestroy)window.onDestroy=function(fn){window.__stx_early_destroys.push(fn)};console.log("[stx] entering IIFE");(function(){var cloakStyle=document.createElement("style");cloakStyle.textContent="[x-cloak] { display: none !important; }";document.head.appendChild(cloakStyle);let activeEffect=null;const effectStack=[];const pendingEffects=new Set;let isBatching=false;let activeDisposers=null;const targetMap=new WeakMap;const globalHelpers={fmt(n){if(n==null)return"0";n=Number(n);if(n>=1e6)return(n/1e6).toFixed(1)+"M";if(n>=1000)return(n/1000).toFixed(1)+"K";return String(n)},formatDate(date,format="YYYY-MM-DD"){if(!date)return"";const d=date instanceof Date?date:new Date(date);if(isNaN(d.getTime()))return"";const year=d.getFullYear();const month=String(d.getMonth()+1).padStart(2,"0");const day=String(d.getDate()).padStart(2,"0");const hours=String(d.getHours()).padStart(2,"0");const minutes=String(d.getMinutes()).padStart(2,"0");const seconds=String(d.getSeconds()).padStart(2,"0");return format.replace("YYYY",year).replace("MM",month).replace("DD",day).replace("HH",hours).replace("mm",minutes).replace("ss",seconds)},timeAgo(date){if(!date)return"";const d=date instanceof Date?date:new Date(date);const now=new Date;const seconds=Math.floor((now-d)/1000);if(seconds<60)return"just now";if(seconds<3600)return Math.floor(seconds/60)+"m ago";if(seconds<86400)return Math.floor(seconds/3600)+"h ago";if(seconds<604800)return Math.floor(seconds/86400)+"d ago";return d.toLocaleDateString()},debounce(fn,delay=300){let timeout;return function(...args){clearTimeout(timeout);timeout=setTimeout(()=>fn.apply(this,args),delay)}},throttle(fn,limit=300){let inThrottle;return function(...args){if(!inThrottle){fn.apply(this,args);inThrottle=true;setTimeout(()=>inThrottle=false,limit)}}},capitalize(str){if(!str)return"";return str.charAt(0).toUpperCase()+str.slice(1)},truncate(str,length=50,suffix="..."){if(!str||str.length<=length)return str||"";return str.slice(0,length)+suffix},json(value,indent=2){try{return JSON.stringify(value,null,indent)}catch(e){return String(value)}},pluralize(count,singular,plural){const p=plural||singular+"s";return count===1?singular:p},clamp(value,min,max){return Math.min(Math.max(value,min),max)},currency(value,symbol="$",decimals=2){if(value==null)return symbol+"0.00";return symbol+Number(value).toFixed(decimals).replace(/\B(?=(\d{3})+(?!\d))/g,",")},percent(value,decimals=0){if(value==null)return"0%";return(Number(value)*100).toFixed(decimals)+"%"}};function track(target,key){if(!activeEffect)return;let depsMap=targetMap.get(target);if(!depsMap)targetMap.set(target,depsMap=new Map);let deps=depsMap.get(key);if(!deps)depsMap.set(key,deps=new Set);deps.add(activeEffect)};function trigger(target,key){const depsMap=targetMap.get(target);if(!depsMap)return;const deps=depsMap.get(key);if(deps){if(isBatching){deps.forEach((effect)=>pendingEffects.add(effect))}else{deps.forEach((effect)=>effect())}}};function createAutoUnwrapProxy(scope){return new Proxy(scope,{get(target,prop){const val=target[prop];if(val&&typeof val==="function"&&(val._isSignal||val._isDerived)){return val()}if(val&&typeof val==="object"&&val._isStxStore){return createAutoUnwrapProxy(val)}return val},set(target,prop,value){const cur=target[prop];if(cur&&typeof cur==="function"&&cur._isSignal&&typeof cur.set==="function"){cur.set(value);return true}target[prop]=value;return true}})};function parsePipeExpression(expr,scope){let pipeIndex=-1;let inString=false;let stringChar="";let depth=0;for(let i=0;i<expr.length;i++){const char=expr[i];const prevChar=i>0?expr[i-1]:"";const nextChar=i<expr.length-1?expr[i+1]:"";if((char==='"'||char==="'"||char==="`")&&prevChar!=="\\"){if(!inString){inString=true;stringChar=char}else if(char===stringChar){inString=false}continue}if(inString)continue;if(char==="("||char==="["||char==="{")depth++;if(char===")"||char==="]"||char==="}")depth--;if(depth!==0)continue;if(char==="|"){if(nextChar==="|"){i++;continue}if(prevChar==="|")continue;if(prevChar==="?")continue;pipeIndex=i;break}}if(pipeIndex===-1)return null;const valueExpr=expr.slice(0,pipeIndex).trim();const pipeChain=expr.slice(pipeIndex+1).trim();const pipes=[];let currentPipe="";inString=false;stringChar="";depth=0;for(let i=0;i<pipeChain.length;i++){const char=pipeChain[i];const prevChar=i>0?pipeChain[i-1]:"";const nextChar=i<pipeChain.length-1?pipeChain[i+1]:"";if((char==='"'||char==="'"||char==="`")&&prevChar!=="\\"){if(!inString){inString=true;stringChar=char}else if(char===stringChar){inString=false}currentPipe+=char;continue}if(inString){currentPipe+=char;continue}if(char==="("||char==="["||char==="{")depth++;if(char===")"||char==="]"||char==="}")depth--;if(depth===0&&char==="|"&&nextChar!=="|"&&prevChar!=="|"&&prevChar!=="?"){if(currentPipe.trim()){const parts=currentPipe.trim().split(":");pipes.push({name:parts[0].trim(),args:parts.slice(1).map((a)=>a.trim())})}currentPipe=""}else{currentPipe+=char}}if(currentPipe.trim()){const parts=currentPipe.trim().split(":");pipes.push({name:parts[0].trim(),args:parts.slice(1).map((a)=>a.trim())})}if(pipes.length===0)return null;return{valueExpr,pipes}};function executePipeExpression(valueExpr,pipes,scope){let value;try{const fn=new Function(...Object.keys(scope),"return "+valueExpr);value=fn(...Object.values(scope))}catch(e){if(!(e instanceof ReferenceError)&&!(e instanceof TypeError))console.warn("[STX] Pipe base expression error:",valueExpr,e);return""}for(const pipe of pipes){const filterFn=scope[pipe.name]||globalHelpers[pipe.name];if(typeof filterFn==="function"){try{const parsedArgs=pipe.args.map((arg)=>{if(/^-?\d+(\.\d+)?$/.test(arg))return Number(arg);if(/^['"].*['"]$/.test(arg))return arg.slice(1,-1);try{const fn=new Function(...Object.keys(scope),"return "+arg);return fn(...Object.values(scope))}catch(e){return arg}});value=filterFn(value,...parsedArgs)}catch(e){if(!(e instanceof ReferenceError)&&!(e instanceof TypeError))console.warn("[STX] Pipe filter error:",pipe.name,e)}}else{console.warn("[STX] Unknown pipe/filter:",pipe.name)}}return value};function state(initialValue){let value=initialValue;const subscribers=new Set;const effects=new Set;const signal=()=>{if(activeEffect){effects.add(activeEffect)}return value};signal.set=(newValue)=>{console.log("[stx] signal.set:",value,"->",newValue,"effects:",effects.size);if(!Object.is(newValue,value)){const prev=value;value=newValue;subscribers.forEach((cb)=>cb(value,prev));if(isBatching){effects.forEach((effect)=>pendingEffects.add(effect))}else{effects.forEach((effect)=>effect())}}};signal.update=(fn)=>signal.set(fn(value));signal.subscribe=(cb)=>{subscribers.add(cb);return()=>subscribers.delete(cb)};signal._isSignal=true;Object.defineProperty(signal,"value",{get(){return signal()},set(v){signal.set(v)},configurable:true});return signal};function derived(compute){let cached;let isDirty=true;const effects=new Set;const markDirty=()=>{if(!isDirty){isDirty=true;if(isBatching){effects.forEach((e)=>pendingEffects.add(e))}else{effects.forEach((e)=>e())}}};const signal=()=>{if(activeEffect)effects.add(activeEffect);if(isDirty){const prev=activeEffect;activeEffect=markDirty;effectStack.push(markDirty);try{cached=compute()}finally{effectStack.pop();activeEffect=prev}isDirty=false}return cached};signal._isDerived=true;Object.defineProperty(signal,"value",{get(){return signal()},configurable:true});return signal};function effect(fn,options={}){let cleanup;let isDisposed=false;const runEffect=()=>{if(isDisposed)return;if(cleanup){cleanup();cleanup=undefined};const prev=activeEffect;activeEffect=runEffect;effectStack.push(runEffect);try{cleanup=fn()}catch(e){isDisposed=true;if(e instanceof ReferenceError){}else{throw e}}finally{effectStack.pop();activeEffect=prev}};if(options.immediate!==false)runEffect();const dispose=()=>{isDisposed=true;if(cleanup)cleanup()};if(activeDisposers)activeDisposers.push(dispose);return dispose};function trackEffects(fn){var parentDisposers=activeDisposers;var disposers=[];activeDisposers=disposers;try{fn()}finally{activeDisposers=parentDisposers;if(parentDisposers){disposers.forEach(function(d){parentDisposers.push(d)})}}return function disposeAll(){disposers.forEach(function(d){try{d()}catch(e){console.warn("[stx] dispose error:",e)}});disposers.length=0}};function batch(fn){if(isBatching){fn();return}isBatching=true;fn();isBatching=false;pendingEffects.forEach((e)=>e());pendingEffects.clear()};function isSignal(v){return typeof v==="function"&&v._isSignal===true};function untrack(v){return isSignal(v)||typeof v==="function"&&v._isDerived?v():v};function peek(fn){const prev=activeEffect;activeEffect=null;try{return fn()}finally{activeEffect=prev}};const mountCallbacks=[];const destroyCallbacks=[];function onMount(fn){mountCallbacks.push(fn)};function onDestroy(fn){destroyCallbacks.push(fn)}if(window.__stx_early_mounts){window.__stx_early_mounts.forEach(function(fn){mountCallbacks.push(fn)});window.__stx_early_mounts=null}if(window.__stx_early_destroys){window.__stx_early_destroys.forEach(function(fn){destroyCallbacks.push(fn)});window.__stx_early_destroys=null};function useWebSocket(url,options){options=options||{};var ws=state(null);var status=state("CLOSED");var lastMessage=state(null);var error=state(null);var reconnectAttempts=0;var maxReconnects=options.reconnect===false?0:options.maxReconnects||10;var reconnectDelay=options.reconnectDelay||1000;var reconnectTimer=null;var manualClose=false;var listeners={};function connect(){if(ws()&&ws().readyState<=1)return;manualClose=false;status.set("CONNECTING");error.set(null);var socket=new WebSocket(url);socket.onopen=function(){status.set("OPEN");reconnectAttempts=0;if(options.onOpen)options.onOpen(socket)};socket.onmessage=function(event){var data=event.data;try{data=JSON.parse(data)}catch(e){}lastMessage.set(data);if(options.onMessage)options.onMessage(data,event);if(data&&data.channel&&data.event){var key=data.channel+":"+data.event;var fns=listeners[key];if(fns){for(var i=0;i<fns.length;i++){fns[i](data.data)}}}};socket.onerror=function(event){error.set(event);if(options.onError)options.onError(event)};socket.onclose=function(event){status.set("CLOSED");ws.set(null);if(options.onClose)options.onClose(event);if(!manualClose&&reconnectAttempts<maxReconnects){reconnectAttempts++;var delay=reconnectDelay*Math.min(reconnectAttempts,5);reconnectTimer=setTimeout(connect,delay)}};ws.set(socket)};function send(data){var socket=ws();if(socket&&socket.readyState===WebSocket.OPEN){socket.send(typeof data==="string"?data:JSON.stringify(data))}};function close(){manualClose=true;if(reconnectTimer){clearTimeout(reconnectTimer);reconnectTimer=null};var socket=ws();if(socket)socket.close()};function subscribe(channel){send({type:"subscribe",channel});return{listen:function(event,handler){var key=channel+":"+event;if(!listeners[key])listeners[key]=[];listeners[key].push(handler);return this},leave:function(){send({type:"unsubscribe",channel});var prefix=channel+":";for(var key in listeners){if(key.indexOf(prefix)===0){delete listeners[key]}}}}}if(options.immediate!==false){connect()}onDestroy(function(){close();listeners={}});return{ws,status,lastMessage,error,send,close,connect,subscribe}};function useFetch(urlOrFn,options={}){const data=state(options.initialData??null);const loading=state(true);const error=state(null);const fetchData=async()=>{loading.set(true);error.set(null);try{const url=typeof urlOrFn==="function"?urlOrFn():urlOrFn;if(!url){loading.set(false);return};const fetchOptions={method:options.method||"GET",headers:{"Content-Type":"application/json",...options.headers||{}}};if(options.body){fetchOptions.body=typeof options.body==="string"?options.body:JSON.stringify(options.body)};const response=await fetch(url,fetchOptions);if(!response.ok){throw new Error(`HTTP ${response.status}: ${response.statusText}`)};const result=await response.json();const transformed=options.transform?options.transform(result):result;data.set(transformed)}catch(e){console.error("[STX] useFetch error:",e);error.set(e.message||"Fetch failed");if(options.onError)options.onError(e)}finally{loading.set(false)}};if(options.immediate!==false){onMount(fetchData)}if(typeof urlOrFn==="function"){effect(()=>{const url=urlOrFn();if(url&&options.immediate!==false){fetchData()}})}return{data,loading,error,refetch:fetchData,get isLoading(){return loading()},get hasError(){return!!error()},get isEmpty(){return!loading()&&!data()}}};function useRef(name){return{get current(){return componentScope.$refs?componentScope.$refs[name]:null},get value(){return this.current}}};function navigate(url,forceReload){if(forceReload){window.location.href=url;return}if(window.stxRouter&&typeof window.stxRouter.navigate==="function"){window.stxRouter.navigate(url)}else{window.location.href=url}};function goBack(){window.history.back()};function goForward(){window.history.forward()};var _routeParams=state({});function setRouteParams(params){_routeParams.set(params||{})}window.addEventListener("stx:navigate",function(e){if(e.detail&&e.detail.params){_routeParams.set(e.detail.params)}});if(window.stx&&window.stx._rp||window.__stx_rp){_routeParams.set(window.stx?._rp||window.__stx_rp)};function useRoute(){return{get path(){return window.location.pathname},get fullPath(){return window.location.pathname+window.location.search+window.location.hash},get hash(){return window.location.hash},get query(){var params={};new URLSearchParams(window.location.search).forEach(function(v,k){params[k]=v});return params},get params(){return _routeParams()}}};function useSearchParams(){var params=state(Object.fromEntries(new URLSearchParams(window.location.search)));var syncFromUrl=function(){params.set(Object.fromEntries(new URLSearchParams(window.location.search)))};window.addEventListener("popstate",syncFromUrl);window.addEventListener("stx:navigate",syncFromUrl);return{data:params,get:function(key){return params()[key]},set:function(key,value){var url=new URL(window.location.href);url.searchParams.set(key,value);window.history.pushState({},"",url);syncFromUrl()},setAll:function(obj){var url=new URL(window.location.href);Object.keys(obj).forEach(function(k){url.searchParams.set(k,obj[k])});window.history.pushState({},"",url);syncFromUrl()}}};var _queryCache={};function useQuery(url,options){options=options||{};var staleTime=options.staleTime||0;var cacheTime=options.cacheTime||300000;var cacheKey=options.cacheKey||(typeof url==="function"?null:url);var data=state(options.initialData||null);var loading=state(true);var error=state(null);var isStale=state(false);var fetchData=async function(){var resolvedUrl=typeof url==="function"?url():url;if(!resolvedUrl){loading.set(false);return};var key=cacheKey||resolvedUrl;var cached=_queryCache[key];if(cached&&Date.now()-cached.timestamp<staleTime){data.set(cached.data);loading.set(false);isStale.set(false);if(options.onSuccess)options.onSuccess(cached.data);return}if(cached){data.set(cached.data);isStale.set(true)}loading.set(true);error.set(null);try{var fetchOpts={method:"GET",headers:{"Content-Type":"application/json",...options.headers||{}}};var response=await fetch(resolvedUrl,fetchOpts);if(!response.ok)throw new Error("HTTP "+response.status+": "+response.statusText);var result=await response.json();var transformed=options.transform?options.transform(result):result;data.set(transformed);isStale.set(false);_queryCache[key]={data:transformed,timestamp:Date.now()};if(options.onSuccess)options.onSuccess(transformed);setTimeout(function(){delete _queryCache[key]},cacheTime)}catch(e){error.set(e.message||"Query failed");if(options.onError)options.onError(e)}finally{loading.set(false)}};if(options.immediate!==false){onMount(fetchData)}if(options.refetchOnFocus){document.addEventListener("visibilitychange",function(){if(!document.hidden)fetchData()})}if(options.refetchInterval){var intervalId=setInterval(fetchData,options.refetchInterval);onDestroy(function(){clearInterval(intervalId)})}return{data,loading,error,isStale,refetch:fetchData,invalidate:function(){var key=cacheKey||(typeof url==="function"?url():url);delete _queryCache[key];return fetchData()}}};function useMutation(url,options){options=options||{};var data=state(null);var loading=state(false);var error=state(null);var mutate=async function(body){loading.set(true);error.set(null);var previousData=data();if(options.optimisticData){var optimistic=typeof options.optimisticData==="function"?options.optimisticData(body):options.optimisticData;data.set(optimistic)}try{var resolvedUrl=typeof url==="function"?url():url;var fetchOpts={method:options.method||"POST",headers:{"Content-Type":"application/json",...options.headers||{}},body:typeof body==="string"?body:JSON.stringify(body)};var response=await fetch(resolvedUrl,fetchOpts);if(!response.ok)throw new Error("HTTP "+response.status+": "+response.statusText);var result=await response.json();var transformed=options.transform?options.transform(result):result;data.set(transformed);if(options.onSuccess)options.onSuccess(transformed);if(options.invalidateQueries){options.invalidateQueries.forEach(function(key){delete _queryCache[key]})}return transformed}catch(e){error.set(e.message||"Mutation failed");if(options.optimisticData)data.set(previousData);if(options.onError)options.onError(e);throw e}finally{loading.set(false)}};return{data,loading,error,mutate,reset:function(){data.set(null);error.set(null);loading.set(false)}}};let componentScope={$refs:{}};let currentElement=null;function findElementScope(el){let current=el;while(current&&current!==document){if(current.__stx_scope){return current.__stx_scope}if(current.hasAttribute&&current.hasAttribute("data-stx-scope")){const scopeId=current.getAttribute("data-stx-scope");if(window.stx._scopes&&window.stx._scopes[scopeId]){return window.stx._scopes[scopeId]}}current=current.parentElement||current.parentNode}return null};function toValue(expr,el,enableAutoUnwrap=true){try{if(/^__[A-Z_]+__$/.test(expr.trim())){return expr};const elementScope=findElementScope(el||currentElement);const baseScope={...componentScope,...elementScope||{},...globalHelpers};const pipeResult=parsePipeExpression(expr,baseScope);if(pipeResult){const unwrapScope=enableAutoUnwrap?createAutoUnwrapProxy(baseScope):baseScope;const piped=executePipeExpression(pipeResult.valueExpr,pipeResult.pipes,unwrapScope);return piped&&typeof piped==="function"&&(piped._isSignal||piped._isDerived)?piped():piped};const scope=enableAutoUnwrap?createAutoUnwrapProxy(baseScope):baseScope;const fn=new Function(...Object.keys(baseScope),"return "+expr);const result=fn(...Object.values(scope));return result&&typeof result==="function"&&(result._isSignal||result._isDerived)?result():result}catch(e){if(!(e instanceof ReferenceError)&&!(e instanceof TypeError))console.warn("[STX] Expression error:",expr,e);return""}};function parseEventShorthand(expr,scope){const trimmed=expr.trim();if(/^!\w+$/.test(trimmed)){const varName=trimmed.slice(1);const signal=scope[varName];if(signal&&signal._isSignal){return()=>signal.set(!signal())}return null}if(/^\w+\+\+$/.test(trimmed)){const varName=trimmed.slice(0,-2);const signal=scope[varName];if(signal&&signal._isSignal){return()=>signal.update((n)=>n+1)}return null}if(/^\w+--$/.test(trimmed)){const varName=trimmed.slice(0,-2);const signal=scope[varName];if(signal&&signal._isSignal){return()=>signal.update((n)=>n-1)}return null};const assignMatch=trimmed.match(/^(\w+)\s*([+\-*\/])=\s*(.+)$/);if(assignMatch){const[,varName,op,valueExpr]=assignMatch;const signal=scope[varName];if(signal&&signal._isSignal){return()=>{const addValue=toValue(valueExpr,null,true);signal.update((n)=>{switch(op){case"+":return n+addValue;case"-":return n-addValue;case"*":return n*addValue;case"/":return n/addValue;default:return n}})}}return null};const simpleAssignMatch=trimmed.match(/^(\w+)\s*=\s*(.+)$/);if(simpleAssignMatch&&!trimmed.includes("==")&&!trimmed.includes("=>")){const[,varName,valueExpr]=simpleAssignMatch;const signal=scope[varName];if(signal&&signal._isSignal){return()=>{const newValue=toValue(valueExpr,null,true);signal.set(newValue)}}return null}return null};function executeHandler(expr,event,el){try{if(/^__[A-Z_]+__$/.test(expr.trim())){return};const elementScope=findElementScope(el||currentElement);const scope={...componentScope,...elementScope||{},...globalHelpers};const shorthandFn=parseEventShorthand(expr,scope);if(shorthandFn){shorthandFn();return};const fn=new Function(...Object.keys(scope),"$event",expr);fn(...Object.values(scope),event)}catch(e){if(!(e instanceof ReferenceError)&&!(e instanceof TypeError))console.warn("[STX] Handler error:",expr,e)}};function deferHydration(el,trigger,scope){if(el.__stx_hydration_scheduled)return;el.__stx_hydration_scheduled=true;var run=function(){if(el.__stx_hydrated)return;el.__stx_hydrated=true;el.removeAttribute("stx-hydrate");Array.from(el.children).forEach(function(child){processElement(child,scope)});processAttributesOnly(el,scope);window.dispatchEvent(new CustomEvent("stx:hydrated",{detail:{el,trigger}}))};if(trigger==="idle"){if(typeof requestIdleCallback==="function")requestIdleCallback(run,{timeout:2000});else setTimeout(run,200)}else if(trigger==="visible"){if(typeof IntersectionObserver==="function"){var io=new IntersectionObserver(function(entries){entries.forEach(function(e){if(e.isIntersecting){io.disconnect();run()}})},{rootMargin:"50px"});io.observe(el)}else{run()}}else if(trigger==="interaction"){var events=["mouseenter","click","focusin","touchstart"];var handler=function(){events.forEach(function(ev){el.removeEventListener(ev,handler)});run()};events.forEach(function(ev){el.addEventListener(ev,handler,{once:true,passive:true})})}else if(trigger&&trigger.indexOf("media:")===0){var query=trigger.slice(6);var mql=window.matchMedia(query);if(mql.matches)run();else{var mqHandler=function(e){if(e.matches){mql.removeEventListener("change",mqHandler);run()}};mql.addEventListener("change",mqHandler)}}else{run()}};function processAttributesOnly(el,scope){el.__stx_hydrated=true;processElement(el,scope)};function processElement(el,scope=componentScope){if(el.nodeType===Node.ELEMENT_NODE&&el.hasAttribute){if(el.hasAttribute("x-class")||el.hasAttribute("@click")){console.log("[stx] processElement:",el.tagName,"x-class:",el.hasAttribute("x-class"),"@click:",el.hasAttribute("@click"))}}if(el.nodeType===Node.ELEMENT_NODE&&el.hasAttribute&&el.hasAttribute("stx-hydrate")&&!el.__stx_hydrated){var trigger=el.getAttribute("stx-hydrate")||"idle";deferHydration(el,trigger,scope);return}if(el.nodeType===Node.ELEMENT_NODE&&el.tagName==="BUTTON"&&el.hasAttribute&&el.hasAttribute("@click")){}if(el.nodeType===Node.ELEMENT_NODE&&el.hasAttribute){if(el.hasAttribute("x-data")||el.hasAttribute("data-stx-xdata")||el.__stx_scope){var xdScope=el.__stx_scope||(findElementScope(el)||{});if(xdScope&&Object.keys(xdScope).length>0){scope={...scope,...xdScope}}}if(el.hasAttribute("data-stx-memo")){var memoExpr=el.getAttribute("data-stx-memo");try{var memoScope={...scope,...findElementScope(el)||{},...globalHelpers};var memoFn=new Function(...Object.keys(memoScope),"return "+memoExpr);var memoVals=JSON.stringify(memoFn(...Object.values(memoScope)));if(el.__stx_memo_prev===memoVals){return}el.__stx_memo_prev=memoVals}catch(e){}}}if(el.nodeType===Node.TEXT_NODE){const text=el.textContent;if(text&&text.includes("{{")){const parts=text.split(/(\{\{[^}]+\}\})/g);if(parts.length>1){const fragment=document.createDocumentFragment();const parentEl=el.parentNode;const capturedScope={...scope,...findElementScope(parentEl)||{},...globalHelpers};parts.forEach((part)=>{const match=part.match(/^\{\{\s*(.+?)\s*\}\}$/);if(match){const expr=match[1];if(/^__[A-Z_]+__$/.test(expr.trim())){fragment.appendChild(document.createTextNode(part));return};const span=document.createElement("span");fragment.appendChild(span);effect(()=>{try{const pipeResult=parsePipeExpression(expr,capturedScope);if(pipeResult){const unwrapScope=createAutoUnwrapProxy(capturedScope);span.textContent=executePipeExpression(pipeResult.valueExpr,pipeResult.pipes,unwrapScope)}else{const unwrapScope=createAutoUnwrapProxy(capturedScope);const fn=new Function(...Object.keys(capturedScope),"return "+expr);span.textContent=fn(...Object.values(unwrapScope))}}catch(e){try{const fn=new Function(...Object.keys(capturedScope),"return "+expr);span.textContent=fn(...Object.values(capturedScope))}catch(e2){if(!(e2 instanceof ReferenceError)&&!(e2 instanceof TypeError))console.warn("[STX] Expression error:",expr,e2);span.textContent=""}}})}else if(part){fragment.appendChild(document.createTextNode(part))}});el.replaceWith(fragment)}}return}if(el.nodeType!==Node.ELEMENT_NODE)return;if(el.hasAttribute("@for")||el.hasAttribute(":for")||el.hasAttribute("x-for")){var forAttr=el.hasAttribute(":for")?":for":el.hasAttribute("x-for")?"x-for":"@for";bindFor(el,scope,forAttr);return}if(el.hasAttribute("@if")||el.hasAttribute(":if")||el.hasAttribute("x-if")){var ifAttr=el.hasAttribute(":if")?":if":el.hasAttribute("x-if")?"x-if":"@if";bindIf(el,scope,ifAttr);return}if(el.hasAttribute("@show")||el.hasAttribute(":show")||el.hasAttribute("x-show")){var showAttr=el.hasAttribute(":show")?":show":el.hasAttribute("x-show")?"x-show":"@show";bindShow(el,el.getAttribute(showAttr),scope,showAttr)}if(el.hasAttribute("@model")||el.hasAttribute(":model")||el.hasAttribute("x-model")){var modelAttr=el.hasAttribute(":model")?":model":el.hasAttribute("x-model")?"x-model":"@model";bindModel(el,el.getAttribute(modelAttr),scope,modelAttr)};const attrCapturedScope={...scope,...findElementScope(el)||{},...globalHelpers};const maybeUnwrapSignal=(v)=>{if(v&&typeof v==="function"&&(v._isSignal||v._isDerived))return v();return v};const evalAttrExpr=(rawExpr)=>{var expr=rawExpr.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&#x27;/g,"'");try{if(/^__[A-Z_]+__$/.test(expr.trim()))return expr;const pipeResult=parsePipeExpression(expr,attrCapturedScope);if(pipeResult){const unwrapScope=createAutoUnwrapProxy(attrCapturedScope);return maybeUnwrapSignal(executePipeExpression(pipeResult.valueExpr,pipeResult.pipes,unwrapScope))};const unwrapScope=createAutoUnwrapProxy(attrCapturedScope);const fn=new Function(...Object.keys(attrCapturedScope),"return "+expr);return maybeUnwrapSignal(fn(...Object.values(unwrapScope)))}catch(e){try{const fn=new Function(...Object.keys(attrCapturedScope),"return "+expr);return maybeUnwrapSignal(fn(...Object.values(attrCapturedScope)))}catch(e2){if(!(e2 instanceof ReferenceError)&&!(e2 instanceof TypeError))console.warn("[STX] Attribute expression error:",expr,e2);return""}}};var DIRECTIVE_NAMES={class:1,style:1,text:1,html:1,show:1,model:1,if:1,for:1,ref:1};var EVENT_RE=/^(click|dblclick|mousedown|mouseup|mousemove|mouseenter|mouseleave|keydown|keyup|keypress|input|change|submit|focus|blur|scroll|resize|touchstart|touchend|touchmove|contextmenu|wheel|pointerdown|pointerup|pointermove)/;var KEY_MAP={enter:"Enter",tab:"Tab",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",delete:"Delete",backspace:"Backspace"};if(el.hasAttribute&&(el.hasAttribute("x-class")||el.hasAttribute("@click"))){console.log("[stx] attr loop entry:",el.tagName,"attrs:",Array.from(el.attributes).map((a)=>a.name).join(", "))}Array.from(el.attributes).forEach((attr)=>{const name=attr.name;const value=attr.value;if(el.hasAttribute&&(el.hasAttribute("x-class")||el.hasAttribute("@click"))){console.log("[stx] attr iter:",el.tagName,"name:",name)};var X_HANDLED={"x-text":1,"x-html":1,"x-model":1,"x-show":1,"x-if":1,"x-for":1,"x-cloak":1,"x-ref":1,"x-data":1,"x-bind":1,"x-class":1,"x-style":1};if(name.startsWith("@bind:")||name.startsWith("x-bind:")||name.startsWith(":")&&!name.startsWith("::")&&!DIRECTIVE_NAMES[name.slice(1).split(".")[0]]&&!EVENT_RE.test(name.slice(1))||name.startsWith("x-")&&!X_HANDLED[name.split(".")[0]]&&!X_HANDLED[name]){const attrName=name.startsWith("@bind:")?name.slice(6):name.startsWith("x-bind:")?name.slice(7):name.startsWith("x-")?name.slice(2):name.slice(1);effect(()=>{const v=evalAttrExpr(value);if(v===false||v===null||v===undefined){el.removeAttribute(attrName)}else if(v===true){el.setAttribute(attrName,"")}else{el.setAttribute(attrName,v)}});el.removeAttribute(name)}else if(name==="@class"||name===":class"||name==="x-class"){console.log("[stx] HIT x-class handler:",el.tagName);bindClass(el,value,scope);el.removeAttribute(name)}else if(name==="@style"||name===":style"||name==="x-style"){bindStyle(el,value,scope);el.removeAttribute(name)}else if(name==="@text"||name===":text"||name==="x-text"){effect(()=>{el.textContent=evalAttrExpr(value)});el.removeAttribute(name)}else if(name==="@html"||name===":html"||name==="x-html"){effect(()=>{el.innerHTML=evalAttrExpr(value)});el.removeAttribute(name)}else if(name==="ref"||name===":ref"||name==="x-ref"||name==="data-stx-ref"){if(scope.$refs)scope.$refs[value]=el;if(componentScope.$refs)componentScope.$refs[value]=el}else if(name.startsWith("@")||name.startsWith(":")){const parts=name.slice(1).split(".");const eventName=parts[0];const modifiers=parts.slice(1);if(["if","for","show","model","class","style","text","html","ref"].includes(eventName)){return};var eventKey="__stx_evt_"+eventName+"_"+value.substring(0,20);if(el[eventKey]){el.removeAttribute(name);return}el[eventKey]=true;const eventCapturedScope={...scope,...findElementScope(el)||{},...globalHelpers};console.log("[stx] binding event:",eventName,"on",el.tagName,"expr:",value.substring(0,40));el.addEventListener(eventName,(event)=>{console.log("[stx] event fired:",eventName,"on",el.tagName);if(eventName==="click"){var ancestor=el;while(ancestor){if(ancestor.__stx_shown_at&&performance.now()-ancestor.__stx_shown_at<50)return;ancestor=ancestor.parentElement}}if(modifiers.includes("self")&&event.target!==el)return;if(modifiers.includes("ctrl")&&!event.ctrlKey)return;if(modifiers.includes("alt")&&!event.altKey)return;if(modifiers.includes("shift")&&!event.shiftKey)return;if(modifiers.includes("meta")&&!event.metaKey)return;for(var mi=0;mi<modifiers.length;mi++){if(KEY_MAP[modifiers[mi]]&&event.key!==KEY_MAP[modifiers[mi]])return}if(modifiers.includes("prevent"))event.preventDefault();if(modifiers.includes("stop"))event.stopPropagation();try{if(!value||/^__[A-Z_]+__$/.test(value.trim()))return;var shorthandFn=parseEventShorthand(value,eventCapturedScope);if(shorthandFn){shorthandFn();return};var hasSignals=Object.values(eventCapturedScope).some(function(v){return v&&typeof v==="function"&&v._isSignal});var isDirectAssignment=hasSignals&&/^[a-zA-Z_$]w*s*=/.test(value.trim())&&!value.trim().startsWith("==");if(isDirectAssignment){var getVars=Object.keys(eventCapturedScope).map(function(k){return"var "+k+' = __s["'+k+'"] && typeof __s["'+k+'"] === "function" && __s["'+k+'"]._isSignal ? __s["'+k+'"]() : __s["'+k+'"]'}).join(";");var setVars=Object.keys(eventCapturedScope).filter(function(k){var v=eventCapturedScope[k];return v&&typeof v==="function"&&v._isSignal}).map(function(k){return"if("+k+' !== __s["'+k+'"]()) __s["'+k+'"].set('+k+")"}).join(";");var body=getVars+";"+value+";"+setVars;var fn2=new Function("__s","$event",body);fn2(eventCapturedScope,event)}else if(hasSignals){var unwrapVars=Object.keys(eventCapturedScope).map(function(k){var v=eventCapturedScope[k];if(v&&typeof v==="function"&&v._isSignal&&value.includes(k+".set(")){return"var "+k+' = __s["'+k+'"]'}return"var "+k+' = __s["'+k+'"] && typeof __s["'+k+'"] === "function" && __s["'+k+'"]._isSignal ? __s["'+k+'"]() : __s["'+k+'"]'}).join(";");var fn3=new Function("__s","$event",unwrapVars+";"+value);fn3(eventCapturedScope,event)}else{var fn=new Function(...Object.keys(eventCapturedScope),"$event",value);fn(...Object.values(eventCapturedScope),event)}}catch(e){if(!(e instanceof ReferenceError)&&!(e instanceof TypeError))console.warn("[STX] Handler error:",value,e)}},{capture:modifiers.includes("capture"),passive:modifiers.includes("passive"),once:modifiers.includes("once")});el.removeAttribute(name)}});if(el.tagName!=="SCRIPT"&&el.tagName!=="STYLE"){var children=Array.from(el.childNodes);children.forEach(function(child){if(child.nodeType!==Node.ELEMENT_NODE){processElement(child,scope);return}if(child.tagName==="SCRIPT")return;if(child.__stx_scope){console.log("[processElement] skip __stx_scope:",child.tagName);return}if(child.hasAttribute&&child.hasAttribute("data-stx-scope"))return;processElement(child,scope)})}};function bindShow(el,expr,passedScope=componentScope,attrName="@show"){if(el.__stx_show_bound)return;el.__stx_show_bound=true;const currentDisplay=el.style.display;const originalDisplay=currentDisplay&&currentDisplay!=="none"?currentDisplay:"";const capturedScope={...passedScope,...findElementScope(el)||{},...globalHelpers};const directSignal=capturedScope[expr];if(directSignal&&directSignal._isSignal){effect(()=>{const value=directSignal();el.style.display=value?originalDisplay:"none"})}else{effect(()=>{var value;try{var unwrapScope=createAutoUnwrapProxy(capturedScope);var fn=new Function(...Object.keys(capturedScope),"return "+expr);value=fn(...Object.values(unwrapScope))}catch(e1){try{var fn2=new Function(...Object.keys(capturedScope),"return "+expr);value=fn2(...Object.values(capturedScope))}catch(e2){if(!(e2 instanceof ReferenceError)&&!(e2 instanceof TypeError))console.warn("[STX] Show expression error:",expr,e2);el.style.display="none";return}};var wasHidden=el.style.display==="none";el.style.display=value?originalDisplay:"none";if(value&&wasHidden){el.__stx_shown_at=performance.now()}})}el.removeAttribute(attrName)};function bindModel(el,expr,passedScope=componentScope,attrName="@model"){if(el.__stx_model_bound)return;el.__stx_model_bound=true;const tag=el.tagName.toLowerCase();const type=el.type;const getValue=()=>toValue(expr,el);const setValue=(val)=>{try{const elementScope=findElementScope(el);const scope={...passedScope,...elementScope||{}};if(scope[expr]&&scope[expr]._isSignal){scope[expr].set(val)}else{const fn=new Function(...Object.keys(scope),"v",expr+" = v");fn(...Object.values(scope),val)}}catch(e){if(!(e instanceof ReferenceError)&&!(e instanceof TypeError))console.warn("[STX] "+attrName+" set error:",expr,e)}};if(tag==="input"&&(type==="checkbox"||type==="radio")){effect(()=>{el.checked=getValue()});el.addEventListener("change",()=>setValue(el.checked))}else if(tag==="select"){effect(()=>{el.value=getValue()});el.addEventListener("change",()=>setValue(el.value))}else{effect(()=>{el.value=getValue()??""});el.addEventListener("input",()=>setValue(el.value))}el.removeAttribute(attrName)};function bindClass(el,expr,passedScope=componentScope){const originalClasses=el.className;const capturedScope={...passedScope,...findElementScope(el)||{},...globalHelpers};const keys=Object.keys(capturedScope);const safeKeys=keys.filter((k)=>/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(k));let fn;try{fn=new Function(...safeKeys,"return "+expr)}catch(e){console.warn("[STX] bindClass compile error:",expr,e);return}effect(()=>{for(let i=0;i<safeKeys.length;i++){const v=capturedScope[safeKeys[i]];if(v&&typeof v==="function"&&(v._isSignal||v._isDerived)){v()}};let value;try{const unwrapScope=createAutoUnwrapProxy(capturedScope);value=fn.apply(null,safeKeys.map((k)=>unwrapScope[k]))}catch(e1){try{value=fn.apply(null,safeKeys.map((k)=>capturedScope[k]))}catch(e2){if(!(e2 instanceof ReferenceError)&&!(e2 instanceof TypeError))console.warn("[STX] Class expression error:",expr,e2);value=""}}if(typeof value==="object"&&value!==null&&!Array.isArray(value)){Object.keys(value).forEach((cls)=>{const tokens=cls.split(/\s+/).filter(Boolean);if(value[cls])tokens.forEach((t)=>el.classList.add(t));else tokens.forEach((t)=>el.classList.remove(t))})}else if(Array.isArray(value)){el.className=originalClasses+" "+value.filter(Boolean).join(" ")}else{el.className=originalClasses+(value?" "+value:"")}})};function bindStyle(el,expr,passedScope=componentScope){const capturedScope={...passedScope,...findElementScope(el)||{},...globalHelpers};const evalExpr=()=>{try{const unwrapScope=createAutoUnwrapProxy(capturedScope);const fn=new Function(...Object.keys(capturedScope),"return "+expr);return fn(...Object.values(unwrapScope))}catch(e1){try{const fn2=new Function(...Object.keys(capturedScope),"return "+expr);return fn2(...Object.values(capturedScope))}catch(e2){if(!(e2 instanceof ReferenceError)&&!(e2 instanceof TypeError))console.warn("[STX] Style expression error:",expr,e2);return{}}}};effect(()=>{const value=evalExpr();if(typeof value==="object"&&value!==null){Object.assign(el.style,value)}else if(typeof value==="string"){el.style.cssText=value}})};function bindFor(el,passedScope=componentScope,attrName="@for"){if(el.__stx_for_bound)return;el.__stx_for_bound=true;const expr=el.getAttribute(attrName);const match=expr.match(/^\s*\(?\s*(\w+)(?:\s*,\s*(\w+))?\s*\)?\s+(?:in|of)\s+(.+)\s*$/);if(!match){console.warn("[STX] Invalid "+attrName+":",expr);return}const[,itemName,indexName,listExpr]=match;const parent=el.parentNode;if(!parent){console.warn("[STX] bindFor: element has no parent, skipping");return};const placeholder=document.createComment("stx-for");const isTemplate=el.tagName==="TEMPLATE";const ifExpr=el.getAttribute("@if")||el.getAttribute(":if");const loadingExpr=el.getAttribute("@loading");const emptyExpr=el.getAttribute("@empty");let loadingTemplate=null;let emptyTemplate=null;let sibling=el.nextElementSibling;while(sibling){if(sibling.hasAttribute("@for-loading")){loadingTemplate=sibling.cloneNode(true);loadingTemplate.removeAttribute("@for-loading");sibling.remove();sibling=el.nextElementSibling;continue}if(sibling.hasAttribute("@for-empty")){emptyTemplate=sibling.cloneNode(true);emptyTemplate.removeAttribute("@for-empty");sibling.remove();sibling=el.nextElementSibling;continue}break};const capturedScope=findElementScope(el)||findElementScope(parent);parent.insertBefore(placeholder,el);parent.removeChild(el);const keyExpr=el.getAttribute(":key")||el.getAttribute("x-bind:key");let templateContent;if(isTemplate){templateContent=el.content}else{const wrapper=el.cloneNode(true);wrapper.removeAttribute("@for");wrapper.removeAttribute(":for");wrapper.removeAttribute("x-for");wrapper.removeAttribute("@loading");wrapper.removeAttribute("@empty");wrapper.removeAttribute(":key");wrapper.removeAttribute("x-bind:key");if(ifExpr){wrapper.removeAttribute("@if");wrapper.removeAttribute(":if");wrapper.removeAttribute("x-if")}templateContent=wrapper};let currentElements=[];let currentKeys=[];let loadingElement=null;let emptyElement=null;const evalExpr=(expression,extraScope={})=>{try{if(/^__[A-Z_]+__$/.test(expression.trim())){return expression};const scope={...passedScope,...capturedScope||{},...globalHelpers,...extraScope};const unwrapScope=createAutoUnwrapProxy(scope);const fn=new Function(...Object.keys(scope),"return "+expression);return fn(...Object.values(unwrapScope))}catch(e){if(!(e instanceof ReferenceError)&&!(e instanceof TypeError))console.warn("[STX] Expression error:",expression,e);return""}};const evalLazy=(expression,extraScope={})=>{try{if(/^__[A-Z_]+__$/.test(expression.trim()))return expression;const scope={...passedScope,...capturedScope||{},...globalHelpers,...extraScope};const unwrapScope=createAutoUnwrapProxy(scope);const fn=new Function("__scope__","with(__scope__) { return "+expression+" }");return fn(unwrapScope)}catch(e){if(!(e instanceof ReferenceError)&&!(e instanceof TypeError))console.warn("[STX] Expression error:",expression,e);return""}};const showLoading=()=>{hideLoading();hideEmpty();if(loadingTemplate){loadingElement=loadingTemplate.cloneNode(true);parent.insertBefore(loadingElement,placeholder)}};const hideLoading=()=>{if(loadingElement){loadingElement.remove();loadingElement=null}};const showEmpty=()=>{hideLoading();hideEmpty();if(emptyTemplate){emptyElement=emptyTemplate.cloneNode(true);parent.insertBefore(emptyElement,placeholder);processElement(emptyElement)}};const hideEmpty=()=>{if(emptyElement){emptyElement.remove();emptyElement=null}};const itemSignalMap=new Map;const createItemElements=(item,index,key)=>{const itemSignal=state(item);const indexSignal=state(index);if(key)itemSignalMap.set(key,{item:itemSignal,index:indexSignal});const itemScope={...passedScope,...capturedScope||{},...globalHelpers};itemScope[itemName]=itemSignal;if(indexName)itemScope[indexName]=indexSignal;const elements=[];if(isTemplate){Array.from(templateContent.childNodes).forEach((node)=>{const clone=node.cloneNode(true);if(clone.nodeType===1){processElement(clone,itemScope);clone.removeAttribute("x-cloak");clone.querySelectorAll("[x-cloak]").forEach((c)=>c.removeAttribute("x-cloak"))}elements.push(clone)})}else{const clone=templateContent.cloneNode(true);processElement(clone,itemScope);clone.removeAttribute("x-cloak");clone.querySelectorAll("[x-cloak]").forEach((c)=>c.removeAttribute("x-cloak"));elements.push(clone)}return elements};const getItemKey=(item,index)=>{if(!keyExpr)return String(index);try{const scope={[itemName]:item};if(indexName)scope[indexName]=index;const fn=new Function(itemName,indexName||"_idx","return "+keyExpr);return String(fn(item,index))}catch(e){return String(index)}};effect(()=>{if(loadingExpr){const isLoading=evalLazy(loadingExpr);if(isLoading){currentElements.forEach((e)=>e.remove());currentElements=[];currentKeys=[];showLoading();return}}hideLoading();const list=evalLazy(listExpr);if(ifExpr){const ifValue=evalLazy(ifExpr);if(!ifValue){currentElements.forEach((e)=>e.remove());currentElements=[];currentKeys=[];hideEmpty();return}}if(!Array.isArray(list))return;if(list.length===0){currentElements.forEach((e)=>e.remove());currentElements=[];currentKeys=[];if(emptyExpr){const emptyContent=evalLazy(emptyExpr);if(emptyContent&&typeof emptyContent==="string"){const textNode=document.createTextNode(emptyContent);parent.insertBefore(textNode,placeholder);currentElements.push(textNode)}}else if(emptyTemplate){showEmpty()}return}hideEmpty();const newKeys=list.map((item,i)=>getItemKey(item,i));const oldKeyMap=new Map;for(let i=0;i<currentKeys.length;i++){const k=currentKeys[i];if(!oldKeyMap.has(k))oldKeyMap.set(k,[]);oldKeyMap.get(k).push(currentElements[i])};const newElements=[];const usedKeys=new Set;for(let i=0;i<list.length;i++){const key=newKeys[i];const existing=oldKeyMap.get(key);if(existing&&existing.length>0&&!usedKeys.has(key)){const el=existing.shift();parent.insertBefore(el,placeholder);newElements.push(el);usedKeys.add(key);const signals=itemSignalMap.get(key);if(signals){signals.item.set(list[i]);signals.index.set(i)}}else{const elements=createItemElements(list[i],i,key);elements.forEach((el)=>parent.insertBefore(el,placeholder));newElements.push(...elements)}}for(const[key,elements]of oldKeyMap){if(!usedKeys.has(key)){elements.forEach((el)=>el.remove());itemSignalMap.delete(key)}}currentElements=newElements;currentKeys=newKeys})};var __bindIfCounter=0;function bindIf(el,passedScope=componentScope,attrName="@if"){if(el.__stx_if_bound){console.log("[stx] bindIf SKIPPED (already bound):",el.getAttribute(attrName)||"(attr removed)","on",el.tagName);return}el.__stx_if_bound=true;const expr=el.getAttribute(attrName);const parent=el.parentNode;if(!parent){console.warn("[STX] bindIf: element has no parent, skipping");return};const placeholder=document.createComment("stx-if");let isInserted=true;let currentNodes=[];const isTemplate=el.tagName==="TEMPLATE";const capturedElementScope=findElementScope(el);const capturedComponentScope={...passedScope};parent.insertBefore(placeholder,el);el.removeAttribute(attrName);if(isTemplate){const content=el.content;currentNodes=Array.from(content.childNodes).map((n)=>n.cloneNode(true));currentNodes.forEach((node)=>parent.insertBefore(node,placeholder.nextSibling));el.remove()};const evalExpr=(expression)=>{try{if(/^__[A-Z_]+__$/.test(expression.trim())){return expression};const scope={...capturedComponentScope,...capturedElementScope||{},...globalHelpers};const unwrapScope=createAutoUnwrapProxy(scope);const fn=new Function(...Object.keys(scope),"return "+expression);return fn(...Object.values(unwrapScope))}catch(e){if(!(e instanceof ReferenceError)&&!(e instanceof TypeError))console.warn("[STX] Expression error:",expression,e);return""}};let childrenProcessed=false;const processChildrenWithScope=()=>{const childScope={...capturedComponentScope,...capturedElementScope||{},...globalHelpers};Array.from(el.childNodes).forEach((child)=>processElement(child,childScope));childrenProcessed=true};const fullScope={...capturedComponentScope,...capturedElementScope||{},...globalHelpers};const directSignal=fullScope[expr];if(directSignal){console.log("[stx] bindIf direct signal for :if="+expr,"signal identity:",directSignal===componentScope[expr]?"SAME":"DIFFERENT","signal():",directSignal())}effect(()=>{var value;if(directSignal&&(directSignal._isSignal||directSignal._isDerived)){value=directSignal();console.log("[stx] bindIf effect (direct):",expr,"→",value,"isInserted:",isInserted)}else{for(var sk in fullScope){var sv=fullScope[sk];if(sv&&typeof sv==="function"&&(sv._isSignal||sv._isDerived))sv()}value=evalExpr(expr)}if(isTemplate){if(value&&!isInserted){currentNodes=Array.from(el.content.childNodes).map((n)=>n.cloneNode(true));currentNodes.forEach((node)=>parent.insertBefore(node,placeholder.nextSibling));const childScope={...componentScope,...capturedElementScope||{}};currentNodes.forEach((node)=>{if(node.nodeType===1){processElement(node,childScope);node.removeAttribute("x-cloak");node.querySelectorAll("[x-cloak]").forEach((c)=>c.removeAttribute("x-cloak"))}});currentNodes.forEach(function(n){if(n.nodeType===1)n.__stx_shown_at=performance.now()});isInserted=true}else if(!value&&isInserted){currentNodes.forEach((node)=>node.remove());currentNodes=[];isInserted=false}}else{if(value&&!isInserted){console.log("[stx] bindIf INSERTING element for :if="+expr);parent.insertBefore(el,placeholder.nextSibling);el.__stx_shown_at=performance.now();isInserted=true}else if(!value&&isInserted){console.log("[stx] bindIf REMOVING element for :if="+expr,"el.isConnected:",el.isConnected,"parent:",parent.tagName);el.remove();isInserted=false;console.log("[stx] bindIf REMOVED, el.isConnected:",el.isConnected)}if(value&&isInserted&&!childrenProcessed){childrenProcessed=true;setTimeout(function(){var childScope={...capturedComponentScope,...capturedElementScope||{},...globalHelpers};processElement(el,childScope);el.removeAttribute("x-cloak");el.querySelectorAll("[x-cloak]").forEach(function(c){c.removeAttribute("x-cloak")})},0)}}})};function $computed(fn){return derived(fn)};function $watch(deps,fn){effect(()=>{const values=Array.isArray(deps)?deps.map((d)=>{if(typeof d==="function"&&(d._isSignal||d._isDerived))return d();return d}):typeof deps==="function"&&(deps._isSignal||deps._isDerived)?[deps()]:[deps];fn(...values)})};function provide(name,value){window[name]=value};function useDebounce(fn,delay){delay=delay||250;var timer=null;var lastArgs=null;var debounced=function(){lastArgs=Array.prototype.slice.call(arguments);if(timer!==null)clearTimeout(timer);var args=lastArgs;timer=setTimeout(function(){timer=null;lastArgs=null;fn.apply(null,args)},delay)};debounced.cancel=function(){if(timer!==null){clearTimeout(timer);timer=null;lastArgs=null}};debounced.flush=function(){if(timer!==null&&lastArgs!==null){clearTimeout(timer);timer=null;var args=lastArgs;lastArgs=null;fn.apply(null,args)}};debounced.pending=function(){return timer!==null};onDestroy(debounced.cancel);return debounced};function useDebouncedValue(getter,delay){delay=delay||250;var current=getter();var listeners=[];var timer=null;function schedule(){if(timer!==null)clearTimeout(timer);timer=setTimeout(function(){timer=null;var next=getter();if(next!==current){current=next;listeners.forEach(function(fn){fn(current)})}},delay)}schedule();onDestroy(function(){if(timer!==null)clearTimeout(timer);listeners=[]});return{get value(){return current},subscribe:function(fn){listeners.push(fn);return function(){listeners=listeners.filter(function(f){return f!==fn})}}}};function useThrottle(fn,limit){limit=limit||250;var timer=null;var lastRan=0;var throttled=function(){var args=Array.prototype.slice.call(arguments);var now=Date.now();var remaining=limit-(now-lastRan);if(remaining<=0){if(timer!==null){clearTimeout(timer);timer=null}lastRan=now;fn.apply(null,args)}else if(timer===null){timer=setTimeout(function(){lastRan=Date.now();timer=null;fn.apply(null,args)},remaining)}};throttled.cancel=function(){if(timer!==null){clearTimeout(timer);timer=null}};onDestroy(throttled.cancel);return throttled};function useInterval(interval,options){interval=interval||1000;options=options||{};var count=0;var id=null;var running=false;var listeners=[];function tick(){count++;listeners.forEach(function(fn){fn(count)})};function resume(){if(running)return;running=true;id=setInterval(tick,interval);if(options.immediate)tick()};function pause(){if(!running)return;running=false;if(id!==null){clearInterval(id);id=null}};function reset(){pause();count=0;listeners.forEach(function(fn){fn(count)});resume()}resume();onDestroy(function(){pause();listeners=[]});return{get counter(){return count},pause,resume,reset,subscribe:function(fn){listeners.push(fn);return function(){listeners=listeners.filter(function(f){return f!==fn})}}}};function useTimeout(callback,delay){delay=delay||1000;var timer=null;var pending=false;var listeners=[];function setPending(v){if(v!==pending){pending=v;listeners.forEach(function(fn){fn(pending)})}};function start(){stop();setPending(true);timer=setTimeout(function(){timer=null;setPending(false);callback()},delay)};function stop(){if(timer!==null){clearTimeout(timer);timer=null}setPending(false)}start();onDestroy(stop);return{get isPending(){return pending},start,stop,subscribe:function(fn){listeners.push(fn);return function(){listeners=listeners.filter(function(f){return f!==fn})}}}};function useToggle(initial){var current=!!initial;var listeners=[];function notify(){listeners.forEach(function(fn){fn(current)})};function toggle(){current=!current;notify()};function set(v){v=!!v;if(v!==current){current=v;notify()}};var ref={get value(){return current},subscribe:function(fn){listeners.push(fn);return function(){listeners=listeners.filter(function(f){return f!==fn})}}};return[ref,toggle,set]};function useCounter(initial,options){initial=initial||0;options=options||{};var min=options.min!=null?options.min:-1/0;var max=options.max!=null?options.max:1/0;function clamp(v){return Math.min(max,Math.max(min,v))};var current=clamp(initial);var listeners=[];function notify(){listeners.forEach(function(fn){fn(current)})}return{get count(){return current},inc:function(step){current=clamp(current+(step||1));notify()},dec:function(step){current=clamp(current-(step||1));notify()},set:function(v){current=clamp(v);notify()},reset:function(){current=clamp(initial);notify()},subscribe:function(fn){listeners.push(fn);return function(){listeners=listeners.filter(function(f){return f!==fn})}}}};function useClickOutside(target,handler){function listener(event){var el=typeof target==="string"?document.querySelector(target):target;if(!el)return;if(el===event.target||el.contains(event.target))return;handler(event)}document.addEventListener("pointerdown",listener,true);function remove(){document.removeEventListener("pointerdown",listener,true)}onDestroy(remove);return{remove}};function useFocus(target){var focused=false;var listeners=[];function resolve(){return typeof target==="string"?document.querySelector(target):target};function setFocused(v){if(v!==focused){focused=v;listeners.forEach(function(fn){fn(focused)})}};var onFocusIn=function(){setFocused(true)};var onBlurOut=function(){setFocused(false)};var el=resolve();if(el){el.addEventListener("focus",onFocusIn);el.addEventListener("blur",onBlurOut);focused=document.activeElement===el}onDestroy(function(){var el=resolve();if(el){el.removeEventListener("focus",onFocusIn);el.removeEventListener("blur",onBlurOut)}listeners=[]});return{get isFocused(){return focused},focus:function(){var el=resolve();if(el&&el.focus)el.focus()},blur:function(){var el=resolve();if(el&&el.blur)el.blur()},subscribe:function(fn){listeners.push(fn);return function(){listeners=listeners.filter(function(f){return f!==fn})}}}};function useAsync(fn,options){options=options||{};var asyncState="idle";var data=null;var error=null;var listeners=[];function notify(){var snap={state:asyncState,data,error};listeners.forEach(function(fn){fn(snap)})};function execute(){var args=Array.prototype.slice.call(arguments);asyncState="loading";error=null;notify();return fn.apply(null,args).then(function(result){data=result;asyncState="success";notify();return data}).catch(function(e){error=e instanceof Error?e:new Error(String(e));asyncState="error";notify();return null})}if(options.immediate)execute();return{get state(){return asyncState},get isLoading(){return asyncState==="loading"},get error(){return error},get data(){return data},execute,subscribe:function(fn){listeners.push(fn);return function(){listeners=listeners.filter(function(f){return f!==fn})}}}};function useColorMode(options){options=options||{};var storageKey=options.storageKey||"stx-color-mode";var initialMode=options.initialMode||"auto";var darkClass=options.darkClass||"dark";var attribute=options.attribute||null;var disableTransitions=options.disableTransitions!==false;var preference=initialMode;var resolved="light";var listeners=[];var cleanups=[];function getSystem(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"};function resolve(pref){return pref==="auto"?getSystem():pref};function applyDOM(mode){var el=document.documentElement;if(disableTransitions)el.style.setProperty("transition","none","important");if(attribute){el.setAttribute(attribute,mode)}else{if(mode==="dark")el.classList.add(darkClass);else el.classList.remove(darkClass)}if(disableTransitions){el.offsetHeight;el.style.removeProperty("transition")}};function persist(pref){try{localStorage.setItem(storageKey,pref)}catch(e){}};function readPersisted(){try{var v=localStorage.getItem(storageKey);if(v==="light"||v==="dark"||v==="auto")return v}catch(e){}return null};function update(pref){preference=pref;resolved=resolve(pref);applyDOM(resolved);persist(pref);listeners.forEach(function(fn){fn(resolved,preference)})};var persisted=readPersisted();update(persisted||initialMode);var mql=window.matchMedia("(prefers-color-scheme: dark)");var onSystemChange=function(){if(preference==="auto"){resolved=getSystem();applyDOM(resolved);listeners.forEach(function(fn){fn(resolved,preference)})}};mql.addEventListener("change",onSystemChange);cleanups.push(function(){mql.removeEventListener("change",onSystemChange)});var onStorage=function(e){if(e.key!==storageKey)return;var v=e.newValue;if(v==="light"||v==="dark"||v==="auto"){preference=v;resolved=resolve(v);applyDOM(resolved);listeners.forEach(function(fn){fn(resolved,preference)})}};window.addEventListener("storage",onStorage);cleanups.push(function(){window.removeEventListener("storage",onStorage)});onDestroy(function(){cleanups.forEach(function(fn){fn()});listeners=[]});return{get mode(){return resolved},get preference(){return preference},get isDark(){return resolved==="dark"},set:function(mode){update(mode)},toggle:function(){update(resolved==="dark"?"light":"dark")},subscribe:function(fn){listeners.push(fn);return function(){listeners=listeners.filter(function(f){return f!==fn})}}}};function useDark(options){var cm=useColorMode(options);return{get isDark(){return cm.isDark},toggle:function(){cm.toggle()},set:function(dark){cm.set(dark?"dark":"light")},subscribe:function(fn){return cm.subscribe(function(mode){fn(mode==="dark")})}}};var ref=state;var reactive=state;var computed=derived;var watch=$watch;var watchEffect=function(fn){return effect(fn)};function useLocalStorage(key,defaultValue){var stored=localStorage.getItem(key);var initial=stored!==null?JSON.parse(stored):defaultValue;var s=state(initial);effect(function(){localStorage.setItem(key,JSON.stringify(s()))});var handler=function(e){if(e.key===key)s.set(e.newValue!==null?JSON.parse(e.newValue):defaultValue)};window.addEventListener("storage",handler);onDestroy(function(){window.removeEventListener("storage",handler)});return s};function useEventListener(event,handler,options){var target=options&&options.target||window;if(typeof target==="string")target=document.querySelector(target);if(!target)return;var opts={capture:options&&options.capture,passive:options&&options.passive,once:options&&options.once};target.addEventListener(event,handler,opts);onDestroy(function(){target.removeEventListener(event,handler,opts)})};function useHead(config){function apply(){if(config.title)document.title=config.title;var metas=config.meta||[];for(var i=0;i<metas.length;i++){var m=metas[i];if(!m.name&&!m.property)continue;var selector=m.name?'meta[name="'+m.name+'"]':'meta[property="'+m.property+'"]';var el=document.querySelector(selector);if(el){el.setAttribute("content",m.content||"")}else{el=document.createElement("meta");if(m.name)el.setAttribute("name",m.name);if(m.property)el.setAttribute("property",m.property);el.setAttribute("content",m.content||"");document.head.appendChild(el)}};var links=config.link||config.links||[];for(var j=0;j<links.length;j++){var l=links[j];if(!l.rel||!l.href)continue;var linkSel='link[rel="'+l.rel+'"][href="'+l.href+'"]';if(!document.querySelector(linkSel)){var le=document.createElement("link");for(var k in l){if(l.hasOwnProperty(k))le.setAttribute(k,l[k])}document.head.appendChild(le)}};var scripts=config.script||config.scripts||[];for(var si=0;si<scripts.length;si++){var s=scripts[si];var se=document.createElement("script");if(s.src)se.src=s.src;if(s.innerHTML)se.innerHTML=s.innerHTML;if(s.async)se.async=true;if(s.defer)se.defer=true;document.head.appendChild(se)}if(config.bodyAttrs&&config.bodyAttrs.class){config.bodyAttrs.class.split(" ").forEach(function(cls){if(cls)document.body.classList.add(cls)})}if(config.htmlAttrs&&config.htmlAttrs.lang){document.documentElement.setAttribute("lang",config.htmlAttrs.lang)}}if(document.readyState!=="loading"){apply()}else{onMount(apply)}};function useSeoMeta(config){var meta=[];if(config.title)meta.push({name:"title",content:config.title});if(config.description)meta.push({name:"description",content:config.description});if(config.ogTitle)meta.push({property:"og:title",content:config.ogTitle});if(config.ogDescription)meta.push({property:"og:description",content:config.ogDescription});if(config.ogImage)meta.push({property:"og:image",content:config.ogImage});if(config.ogType)meta.push({property:"og:type",content:config.ogType});if(config.ogUrl)meta.push({property:"og:url",content:config.ogUrl});if(config.twitterCard)meta.push({name:"twitter:card",content:config.twitterCard});if(config.twitterTitle)meta.push({name:"twitter:title",content:config.twitterTitle});if(config.twitterDescription)meta.push({name:"twitter:description",content:config.twitterDescription});if(config.twitterImage)meta.push({name:"twitter:image",content:config.twitterImage});if(config.robots)meta.push({name:"robots",content:config.robots});if(config.canonical)meta.push({property:"og:url",content:config.canonical});useHead({title:config.title||config.ogTitle,meta})};var _toastId=0;var _toastIcons={success:'<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#16a34a" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M9 12l2 2 4-4"/></svg>',error:'<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#dc2626" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="15" y1="9" x2="9" y2="15"/><line x1="9" y1="9" x2="15" y2="15"/></svg>',info:'<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#2563eb" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>',warning:'<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#d97706" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>'};var _toastColors={success:"#16a34a",error:"#dc2626",info:"#2563eb",warning:"#d97706"};function _getToastContainer(){return document.getElementById("stx-toast-container")};function _getToastAnimClass(container){if(!container)return{inAnim:"stx-toast-in",outAnim:"stx-toast-out"};var pos=container.getAttribute("data-stx-toast-position")||"top-right";if(pos.indexOf("left")!==-1)return{inAnim:"stx-toast-in-left",outAnim:"stx-toast-out-left"};if(pos.indexOf("center")!==-1)return{inAnim:"stx-toast-in-center",outAnim:"stx-toast-out-center"};return{inAnim:"stx-toast-in",outAnim:"stx-toast-out"}};function removeToast(id){var el=document.getElementById("stx-toast-"+id);if(!el)return;var container=_getToastContainer();var anims=_getToastAnimClass(container);el.style.animation=anims.outAnim+" 0.3s ease forwards";setTimeout(function(){if(el.parentNode)el.parentNode.removeChild(el)},300)};function addToast(type,message,options){var container=_getToastContainer();if(!container){console.warn("[stx:toast] No <StxToast /> container found. Add <StxToast /> to your layout.");return-1};var opts=options||{};var duration=opts.duration!==undefined?opts.duration:3000;var id=++_toastId;var maxToasts=parseInt(container.getAttribute("data-stx-toast-max")||"5",10);var existing=container.querySelectorAll("[data-stx-toast]");while(existing.length>=maxToasts&&existing.length>0){var oldId=existing[0].getAttribute("data-stx-toast");removeToast(oldId);existing=container.querySelectorAll("[data-stx-toast]")};var anims=_getToastAnimClass(container);var borderColor=_toastColors[type]||_toastColors.info;var icon=_toastIcons[type]||_toastIcons.info;var isDark=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches;var bg=isDark?"#1f2937":"#ffffff";var textColor=isDark?"#f3f4f6":"#1f2937";var shadow=isDark?"0 4px 12px rgba(0,0,0,0.4)":"0 4px 12px rgba(0,0,0,0.15)";var el=document.createElement("div");el.id="stx-toast-"+id;el.setAttribute("data-stx-toast",String(id));el.setAttribute("role","alert");el.setAttribute("aria-live","assertive");el.style.cssText="pointer-events:auto;display:flex;align-items:flex-start;gap:0.75rem;padding:0.875rem 1rem;border-radius:0.5rem;border-left:4px solid "+borderColor+";background:"+bg+";color:"+textColor+";box-shadow:"+shadow+";animation:"+anims.inAnim+" 0.3s ease;font-family:system-ui,-apple-system,sans-serif;font-size:0.875rem;line-height:1.4;max-width:100%";var iconSpan=document.createElement("span");iconSpan.style.cssText="flex-shrink:0;display:flex;align-items:center;margin-top:1px";iconSpan.innerHTML=icon;var msgSpan=document.createElement("span");msgSpan.style.cssText="flex:1;word-wrap:break-word";msgSpan.textContent=message;var closeBtn=document.createElement("button");closeBtn.type="button";closeBtn.setAttribute("aria-label","Dismiss notification");closeBtn.style.cssText="flex-shrink:0;background:none;border:none;cursor:pointer;padding:0;color:"+(isDark?"#9ca3af":"#6b7280")+";font-size:1.125rem;line-height:1;display:flex;align-items:center";closeBtn.innerHTML='<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor"><path d="M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"/></svg>';closeBtn.onclick=function(){removeToast(id)};el.appendChild(iconSpan);el.appendChild(msgSpan);el.appendChild(closeBtn);container.appendChild(el);if(duration>0){setTimeout(function(){removeToast(id)},duration)}return id};var toast={success:function(message,options){return addToast("success",message,options)},error:function(message,options){return addToast("error",message,options)},info:function(message,options){return addToast("info",message,options)},warning:function(message,options){return addToast("warning",message,options)},dismiss:function(id){if(id!==undefined){removeToast(id);return};var container=_getToastContainer();if(!container)return;var all=container.querySelectorAll("[data-stx-toast]");for(var i=0;i<all.length;i++){var tid=all[i].getAttribute("data-stx-toast");removeToast(tid)}}};var modal={open:function(id){var el=document.querySelector('[data-stx-modal="'+id+'"]');if(!el){console.warn('[stx:modal] Modal "'+id+'" not found');return}el.style.display="flex";el.offsetHeight;el.setAttribute("data-stx-modal-open","");document.body.style.overflow="hidden";if(el.getAttribute("data-close-escape")!=="false"){var escHandler=function(e){if(e.key==="Escape"){modal.close(id);document.removeEventListener("keydown",escHandler)}};document.addEventListener("keydown",escHandler);el._stxEscHandler=escHandler}if(el.getAttribute("data-close-backdrop")!=="false"){el.onclick=function(e){if(e.target===el)modal.close(id)}}},close:function(id){var el=document.querySelector('[data-stx-modal="'+id+'"]');if(!el)return;el.removeAttribute("data-stx-modal-open");if(el._stxEscHandler){document.removeEventListener("keydown",el._stxEscHandler);el._stxEscHandler=null}el.onclick=null;setTimeout(function(){el.style.display="none";if(!document.querySelector("[data-stx-modal-open]"))document.body.style.overflow=""},200)},toggle:function(id){var el=document.querySelector('[data-stx-modal="'+id+'"]');if(el&&el.hasAttribute("data-stx-modal-open"))modal.close(id);else modal.open(id)}};var _dialogId=0;var _dialogIcons={info:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#2563eb" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>',warning:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#d97706" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>',error:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#dc2626" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="15" y1="9" x2="9" y2="15"/><line x1="9" y1="9" x2="15" y2="15"/></svg>',success:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#16a34a" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M9 12l2 2 4-4"/></svg>',question:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#6366f1" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 015.83 1c0 2-3 3-3 3"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>'};function _createDialog(message,options,isConfirm){var opts=options||{};var type=opts.type||(isConfirm?"question":"info");var title=opts.title||"";var confirmText=opts.confirmText||"OK";var cancelText=opts.cancelText||"Cancel";var id="stx-dialog-"+ ++_dialogId;var isDark=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches;var bg=isDark?"#1f2937":"#ffffff";var textColor=isDark?"#f3f4f6":"#1f2937";var subColor=isDark?"#9ca3af":"#6b7280";var icon=_dialogIcons[type]||_dialogIcons.info;return new Promise(function(resolve){var backdrop=document.createElement("div");backdrop.id=id;backdrop.style.cssText="position:fixed;inset:0;z-index:999999;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease;font-family:system-ui,-apple-system,sans-serif";backdrop.setAttribute("role","alertdialog");backdrop.setAttribute("aria-modal","true");var panel=document.createElement("div");panel.style.cssText="max-width:24rem;width:calc(100% - 2rem);border-radius:0.75rem;padding:1.5rem;background:"+bg+";color:"+textColor+";box-shadow:0 20px 60px rgba(0,0,0,0.3);transform:scale(0.95);transition:transform 0.2s ease;text-align:center";var iconDiv=document.createElement("div");iconDiv.style.cssText="display:flex;justify-content:center;margin-bottom:1rem";iconDiv.innerHTML=icon;panel.appendChild(iconDiv);if(title){var titleEl=document.createElement("h3");titleEl.style.cssText="margin:0 0 0.5rem;font-size:1.125rem;font-weight:600";titleEl.textContent=title;panel.appendChild(titleEl)};var msgEl=document.createElement("p");msgEl.style.cssText="margin:0 0 1.25rem;font-size:0.875rem;line-height:1.5;color:"+subColor;msgEl.textContent=message;panel.appendChild(msgEl);var btnRow=document.createElement("div");btnRow.style.cssText="display:flex;gap:0.75rem;justify-content:center";function cleanup(result){backdrop.style.opacity="0";panel.style.transform="scale(0.95)";setTimeout(function(){backdrop.remove()},200);resolve(result)}if(isConfirm){var cancelBtn=document.createElement("button");cancelBtn.textContent=cancelText;cancelBtn.style.cssText="padding:0.5rem 1.25rem;border-radius:0.5rem;font-size:0.875rem;font-weight:500;cursor:pointer;border:1px solid "+(isDark?"#374151":"#d1d5db")+";background:transparent;color:"+textColor+";transition:background 0.15s";cancelBtn.onmouseover=function(){this.style.background=isDark?"#374151":"#f3f4f6"};cancelBtn.onmouseout=function(){this.style.background="transparent"};cancelBtn.onclick=function(){cleanup(false)};btnRow.appendChild(cancelBtn)};var okBtn=document.createElement("button");okBtn.textContent=confirmText;var btnColor=type==="error"?"#dc2626":type==="warning"?"#d97706":"#5672cd";okBtn.style.cssText="padding:0.5rem 1.25rem;border-radius:0.5rem;font-size:0.875rem;font-weight:500;cursor:pointer;border:none;background:"+btnColor+";color:#fff;transition:opacity 0.15s";okBtn.onmouseover=function(){this.style.opacity="0.9"};okBtn.onmouseout=function(){this.style.opacity="1"};okBtn.onclick=function(){cleanup(isConfirm?true:undefined)};btnRow.appendChild(okBtn);panel.appendChild(btnRow);backdrop.appendChild(panel);document.body.appendChild(backdrop);backdrop.offsetHeight;backdrop.style.opacity="1";panel.style.transform="scale(1)";var escHandler=function(e){if(e.key==="Escape"){cleanup(isConfirm?false:undefined);document.removeEventListener("keydown",escHandler)}};document.addEventListener("keydown",escHandler);okBtn.focus()})};function stxAlert(message,options){return _createDialog(message,options,false)};function stxConfirm(message,options){return _createDialog(message,options,true)};var drawer={open:function(id){var el=document.querySelector('[data-stx-drawer="'+id+'"]');if(!el){console.warn('[stx:drawer] Drawer "'+id+'" not found');return}el.style.display="flex";el.offsetHeight;el.setAttribute("data-stx-drawer-open","");document.body.style.overflow="hidden";if(el.getAttribute("data-close-escape")!=="false"){var escHandler=function(e){if(e.key==="Escape"){drawer.close(id);document.removeEventListener("keydown",escHandler)}};document.addEventListener("keydown",escHandler);el._stxEscHandler=escHandler}if(el.getAttribute("data-close-backdrop")!=="false"){el.onclick=function(e){if(e.target===el)drawer.close(id)}}},close:function(id){var el=document.querySelector('[data-stx-drawer="'+id+'"]');if(!el)return;el.removeAttribute("data-stx-drawer-open");if(el._stxEscHandler){document.removeEventListener("keydown",el._stxEscHandler);el._stxEscHandler=null}el.onclick=null;setTimeout(function(){el.style.display="none";if(!document.querySelector("[data-stx-drawer-open]")&&!document.querySelector("[data-stx-modal-open]"))document.body.style.overflow=""},300)},toggle:function(id){var el=document.querySelector('[data-stx-drawer="'+id+'"]');if(el&&el.hasAttribute("data-stx-drawer-open"))drawer.close(id);else drawer.open(id)}};(function(){var tip=null;function createTip(){tip=document.createElement("div");tip.id="stx-tooltip";tip.style.cssText="position:absolute;z-index:999999;pointer-events:none;background:#1f2937;color:#fff;font-size:12px;line-height:1.4;padding:6px 10px;border-radius:6px;max-width:250px;word-wrap:break-word;opacity:0;transition:opacity 0.15s ease;white-space:pre-wrap;box-shadow:0 2px 8px rgba(0,0,0,0.2)";document.body.appendChild(tip)};function show(el){if(!tip)createTip();var text=el.getAttribute("x-tooltip");if(!text)return;tip.textContent=text;tip.style.display="block";tip.style.opacity="0";var pos=el.getAttribute("x-tooltip-position")||"top";var rect=el.getBoundingClientRect();var tw=tip.offsetWidth;var th=tip.offsetHeight;var sx=window.scrollX;var sy=window.scrollY;var left,top;if(pos==="bottom"){left=rect.left+rect.width/2-tw/2;top=rect.bottom+8}else if(pos==="left"){left=rect.left-tw-8;top=rect.top+rect.height/2-th/2}else if(pos==="right"){left=rect.right+8;top=rect.top+rect.height/2-th/2}else{left=rect.left+rect.width/2-tw/2;top=rect.top-th-8;if(top<0){top=rect.bottom+8}}if(left<4)left=4;if(left+tw>window.innerWidth-4)left=window.innerWidth-tw-4;tip.style.left=left+sx+"px";tip.style.top=top+sy+"px";tip.style.opacity="1"};function hide(){if(tip){tip.style.opacity="0";setTimeout(function(){if(tip)tip.style.display="none"},150)}}document.addEventListener("mouseover",function(e){var el=e.target.closest("[x-tooltip]");if(el)show(el)});document.addEventListener("mouseout",function(e){var el=e.target.closest("[x-tooltip]");if(el)hide()});document.addEventListener("focusin",function(e){var el=e.target.closest("[x-tooltip]");if(el)show(el)});document.addEventListener("focusout",function(e){var el=e.target.closest("[x-tooltip]");if(el)hide()})})();var mountQueue=[];window.stx={state,derived,effect,batch,isSignal,untrack,peek,onMount,onDestroy,useFetch,useRef,navigate,goBack,goForward,useRoute,setRouteParams,useSearchParams,useQuery,useMutation,provide,$computed,$watch,ref,reactive,computed,watch,watchEffect,useDebounce,useDebouncedValue,useThrottle,useInterval,useTimeout,useToggle,useCounter,useClickOutside,useFocus,useAsync,useLocalStorage,useEventListener,useWebSocket,useColorMode,useDark,useHead,useSeoMeta,toast,modal,drawer,alert:stxAlert,confirm:stxConfirm,helpers:globalHelpers,defineProps:function(definitions){var props=window.__STX_CURRENT_PROPS__||{};if(!definitions)return props;var result=Object.assign({},props);for(var key in definitions){if(!definitions.hasOwnProperty(key))continue;var def=definitions[key];var opts=typeof def==="function"||Array.isArray(def)?{type:def}:def||{};if(result[key]===undefined&&opts["default"]!==undefined){result[key]=typeof opts["default"]==="function"?opts["default"]():opts["default"]}}return result},withDefaults:function(props,defaults){var result=Object.assign({},props);for(var key in defaults){if(!defaults.hasOwnProperty(key))continue;if(result[key]===undefined){result[key]=typeof defaults[key]==="function"?defaults[key]():defaults[key]}}return result},defineEmits:function(){var el=window.__STX_CURRENT_ELEMENT__||null;return function(event,payload){var target=el||document.body;target.dispatchEvent(new CustomEvent(event,{detail:payload,bubbles:true,cancelable:true}))}},defineExpose:function(exposed){var el=window.__STX_CURRENT_ELEMENT__;if(el)el.__stx_exposed=exposed},_mountCallbacks:mountCallbacks,_destroyCallbacks:destroyCallbacks,_cleanupContainer:cleanupContainer,_scopes:{},_scopeCounter:0,_latestSetup:null,_stores:new Map,defineStore:function(id,setupOrOptions,storeOptions){console.log("[stx:store] defineStore called:",id,"type:",typeof setupOrOptions==="function"?"setup":"options","persist:",!!(storeOptions&&storeOptions.persist));if(window.stx._stores.has(id)){console.log("[stx:store] returning existing store:",id);return window.stx._stores.get(id)};var setupFn;if(typeof setupOrOptions==="function"){setupFn=setupOrOptions}else{var opts=setupOrOptions;setupFn=function(){var result={};var initialState=typeof opts.state==="function"?opts.state():opts.state||{};var stateSignals={};for(var key in initialState){stateSignals[key]=state(initialState[key]);result[key]=stateSignals[key]}if(opts.getters){for(var gKey in opts.getters){(function(getterKey,getterFn){result[getterKey]=derived(function(){var snapshot={};for(var sk in stateSignals){snapshot[sk]=stateSignals[sk]()}return getterFn(snapshot)})})(gKey,opts.getters[gKey])}}if(opts.actions){for(var aKey in opts.actions){(function(actionKey,actionFn){result[actionKey]=function(){var proxy=new Proxy({},{get:function(_,p){if(result[p]&&result[p]._isSignal)return result[p]();if(result[p])return result[p];return},set:function(_,p,v){if(result[p]&&result[p]._isSignal){result[p].set(v);return true}return false}});return actionFn.apply(proxy,arguments)}})(aKey,opts.actions[aKey])}}return result}};var prevDisposers=activeDisposers;activeDisposers=null;var result;try{result=setupFn()}finally{activeDisposers=prevDisposers};var signalKeys=[];var actionKeys=[];for(var dk in result){if(result[dk]&&result[dk]._isSignal)signalKeys.push(dk);else if(typeof result[dk]==="function")actionKeys.push(dk)}console.log("[stx:store] setup complete:",id,"signals:",signalKeys,"actions:",actionKeys);var _initialValues={};for(var k in result){if(result[k]&&result[k]._isSignal){_initialValues[k]=result[k]()}}result.$id=id;result.$reset=function(){batch(function(){for(var rk in _initialValues){if(result[rk]&&result[rk]._isSignal)result[rk].set(_initialValues[rk])}})};result.$patch=function(partial){batch(function(){for(var pk in partial){if(result[pk]&&result[pk]._isSignal)result[pk].set(partial[pk])}})};result.$subscribe=function(cb){var unsubs=[];for(var sk in result){if(result[sk]&&result[sk]._isSignal&&result[sk].subscribe){unsubs.push(result[sk].subscribe(function(){var snapshot={};for(var ssk in result){if(result[ssk]&&result[ssk]._isSignal)snapshot[ssk]=result[ssk]()}cb(snapshot)}))}}return function(){unsubs.forEach(function(u){u()})}};result.$dispose=function(){window.stx._stores.delete(id);if(window.__STX_STORES__)delete window.__STX_STORES__[id]};var hydrationData=window.__STX_STORE_STATE__&&window.__STX_STORE_STATE__[id];if(hydrationData){console.log("[stx:store] hydrating from SSR:",id,Object.keys(hydrationData));batch(function(){for(var hk in hydrationData){if(result[hk]&&result[hk]._isSignal)result[hk].set(hydrationData[hk])}})};var persistCfg=storeOptions&&storeOptions.persist;if(persistCfg){var pOpts=persistCfg===true?{}:persistCfg;var storageKey=pOpts.key||"stx-store-"+id;var storageType=pOpts.storage==="sessionStorage"?sessionStorage:localStorage;var pick=pOpts.pick||null;try{var saved=storageType.getItem(storageKey);if(saved){var parsed=JSON.parse(saved);console.log("[stx:store] restoring persisted state:",id,"key:",storageKey,Object.keys(parsed));batch(function(){for(var pk in parsed){if(result[pk]&&result[pk]._isSignal&&(!pick||pick.indexOf(pk)!==-1)){result[pk].set(parsed[pk])}}})}else{console.log("[stx:store] no persisted state found:",id,"key:",storageKey)}}catch(e){console.warn("[stx:store] persistence read error:",id,e)};var writeTimer=null;var prevPersistDisposers=activeDisposers;activeDisposers=null;effect(function(){var snapshot={};for(var wk in result){if(result[wk]&&result[wk]._isSignal&&(!pick||pick.indexOf(wk)!==-1)){snapshot[wk]=result[wk]()}}if(writeTimer)clearTimeout(writeTimer);writeTimer=setTimeout(function(){console.log("[stx:store] persisting:",id,"key:",storageKey,Object.keys(snapshot));try{storageType.setItem(storageKey,JSON.stringify(snapshot))}catch(e){console.warn("[stx:store] persist write error:",id,e)}},100)});activeDisposers=prevPersistDisposers}result._isStxStore=true;window.stx._stores.set(id,result);window.__STX_STORES__=window.__STX_STORES__||{};window.__STX_STORES__[id]=result;console.log("[stx:store] registered:",id,"total stores:",window.stx._stores.size);return result},useStore:function(id){var store=window.stx._stores.get(id);if(!store&&window.__STX_STORES__){store=window.__STX_STORES__[id]}if(!store){console.error("[stx:store] Store not found:",id,"available:",Array.from(window.stx._stores.keys()));throw new Error('[stx] Store "'+id+'" not found. Define it with defineStore() first.')}console.log("[stx:store] useStore:",id);return store},mountEl:function(selector,setupFn){function doMount(){var root=document.querySelector(selector);if(!root){console.warn("[stx] mountEl: element not found:",selector);return};var prevProps=window.__STX_CURRENT_PROPS__;var prevEl=window.__STX_CURRENT_ELEMENT__;var propsAttr=root.getAttribute&&root.getAttribute("data-stx-props");window.__STX_CURRENT_PROPS__=root.__stx_props||(propsAttr?JSON.parse(propsAttr):{});window.__STX_CURRENT_ELEMENT__=root;var mountStart=mountCallbacks.length;var destroyStart=destroyCallbacks.length;var scope=setupFn();window.__STX_CURRENT_PROPS__=prevProps;window.__STX_CURRENT_ELEMENT__=prevEl;var localMountHooks=mountCallbacks.splice(mountStart);var localDestroyHooks=destroyCallbacks.splice(destroyStart);if(typeof scope==="object"&&scope!==null){scope.$el=root;scope.$refs=scope.$refs||{};root.__stx_scope=scope};var disposeEffects=trackEffects(function(){processElement(root,scope||componentScope)});root.__stx_disposers=disposeEffects;root.removeAttribute("x-cloak");root.querySelectorAll("[x-cloak]").forEach(function(el){el.removeAttribute("x-cloak")});localMountHooks.forEach(function(fn){try{var cleanup=fn();if(typeof cleanup==="function")localDestroyHooks.push(cleanup)}catch(e){console.error("[stx] onMount error:",e)}});root.__stx_destroy=localDestroyHooks}if(document.readyState==="loading"){mountQueue.push(doMount)}else{doMount()}},mount:function(setupFn){console.log("[mount] called");var scriptEl=document.currentScript;function doMount(){var root=scriptEl?scriptEl.nextElementSibling:null;if(!root&&scriptEl)root=scriptEl.previousElementSibling||scriptEl.parentElement;var needsFallback=!root||root===document.body||root&&root.tagName==="SCRIPT";if(needsFallback){var routerOpts=window.STX_ROUTER_OPTIONS||window.__stxRouterConfig||{};var container=document.querySelector("[data-stx-content]")||document.querySelector("[data-stx-router-container]")||(routerOpts.container?document.querySelector(routerOpts.container):null)||document.querySelector("main")||document.querySelector("#content");if(container){root=container;var hasMount=false;var children=container.children;for(var ci=0;ci<children.length;ci++){if(children[ci].__stx_scope){hasMount=true;break}}if(hasMount)for(var ci=0;ci<children.length;ci++){if(!children[ci].__stx_scope&&children[ci].tagName!=="SCRIPT"){root=children[ci];break}}}}if(!root){console.warn("[stx] mount: no root element found");return};var prevProps=window.__STX_CURRENT_PROPS__;var prevEl=window.__STX_CURRENT_ELEMENT__;var propsAttr=root.getAttribute&&root.getAttribute("data-stx-props");window.__STX_CURRENT_PROPS__=root.__stx_props||(propsAttr?JSON.parse(propsAttr):{});window.__STX_CURRENT_ELEMENT__=root;var mountStart=mountCallbacks.length;var destroyStart=destroyCallbacks.length;var scope=setupFn();console.log("[mount] root:",root.tagName,"scope keys:",scope?Object.keys(scope).slice(0,10):"null");window.__STX_CURRENT_PROPS__=prevProps;window.__STX_CURRENT_ELEMENT__=prevEl;var localMountHooks=mountCallbacks.splice(mountStart);var localDestroyHooks=destroyCallbacks.splice(destroyStart);if(typeof scope==="object"&&scope!==null){scope.$el=root;scope.$refs=scope.$refs||{};root.__stx_scope=scope;Object.assign(componentScope,scope)};var disposeEffects=trackEffects(function(){processElement(root,scope||componentScope)});root.__stx_disposers=disposeEffects;root.removeAttribute("x-cloak");root.querySelectorAll("[x-cloak]").forEach(function(el){el.removeAttribute("x-cloak")});localMountHooks.forEach(function(fn){try{var cleanup=fn();if(typeof cleanup==="function")localDestroyHooks.push(cleanup)}catch(e){console.error("[stx] onMount error:",e)}});root.__stx_destroy=localDestroyHooks}if(document.readyState==="loading"){mountQueue.push(doMount)}else{doMount()}}};window.state=state;window.derived=derived;window.effect=effect;window.batch=batch;window.onMount=onMount;window.onDestroy=onDestroy;window.useFetch=useFetch;window.useRef=useRef;window.navigate=navigate;window.goBack=goBack;window.goForward=goForward;window.useRoute=useRoute;window.useSearchParams=useSearchParams;window.useQuery=useQuery;window.useMutation=useMutation;window.provide=provide;window.$computed=$computed;window.$watch=$watch;window.useDebounce=useDebounce;window.useDebouncedValue=useDebouncedValue;window.useThrottle=useThrottle;window.useInterval=useInterval;window.useTimeout=useTimeout;window.useToggle=useToggle;window.useCounter=useCounter;window.useClickOutside=useClickOutside;window.useFocus=useFocus;window.useAsync=useAsync;window.useLocalStorage=useLocalStorage;window.useEventListener=useEventListener;window.useWebSocket=useWebSocket;window.useColorMode=useColorMode;window.useDark=useDark;window.useHead=useHead;window.useSeoMeta=useSeoMeta;window.toast=toast;window.modal=modal;window.drawer=drawer;window.stxAlert=stxAlert;window.stxConfirm=stxConfirm;window.defineStore=window.stx.defineStore;window.useStore=window.stx.useStore;window.ref=state;window.reactive=state;window.computed=derived;window.watch=$watch;window.watchEffect=function(fn){return effect(fn)};console.log("[stx] registering DOMContentLoaded handler");document.addEventListener("DOMContentLoaded",()=>{console.log("[stx] DOMContentLoaded fired — processing scopes");mountQueue.forEach(function(fn){fn()});mountQueue=[];const processedScopes=new Set;document.querySelectorAll("[data-stx]").forEach((el)=>{const setupName=el.getAttribute("data-stx");console.log("[DOMContentLoaded] data-stx:",setupName,"el:",el.tagName,"fn exists:",!!(setupName&&window[setupName]));if(setupName&&window[setupName]){const result=window[setupName]();console.log("[DOMContentLoaded] setup returned:",result?Object.keys(result).slice(0,10):"null");if(typeof result==="object"){Object.assign(componentScope,result)}}console.log("[DOMContentLoaded] processElement on:",el.tagName,"scope keys:",Object.keys(componentScope).slice(0,10));var disposeEffects=trackEffects(function(){processElement(el)});el.__stx_disposers=disposeEffects;el.removeAttribute("x-cloak");el.querySelectorAll("[x-cloak]").forEach(function(c){c.removeAttribute("x-cloak")});mountCallbacks.forEach((fn)=>fn())});var allScopes=document.querySelectorAll("[data-stx-scope]");console.log("[stx] found",allScopes.length,"data-stx-scope elements");allScopes.forEach((el)=>{const scopeId=el.getAttribute("data-stx-scope");console.log("[stx] scope:",scopeId,"registered:",!!(window.stx._scopes&&window.stx._scopes[scopeId]),"el:",el.tagName);processedScopes.add(el);const scopeVars=window.stx._scopes&&window.stx._scopes[scopeId];if(!scopeVars)return;if(scopeVars){componentScope={...componentScope,...scopeVars}}console.log("[stx] calling processElement on scope:",scopeId,"componentScope total keys:",Object.keys(componentScope).length,"has openEventModal:","openEventModal"in componentScope,"scopeVars keys:",Object.keys(scopeVars).length);var disposeEffects=trackEffects(function(){processElement(el)});el.__stx_disposers=disposeEffects;console.log("[stx] scope processed OK:",scopeId);el.removeAttribute("x-cloak");el.querySelectorAll("[x-cloak]").forEach(function(c){c.removeAttribute("x-cloak")});if(scopeVars&&scopeVars.__mountCallbacks){scopeVars.__mountCallbacks.forEach((fn)=>fn())}});console.log("[stx] running global mountCallbacks:",mountCallbacks.length);mountCallbacks.forEach(function(fn){try{fn()}catch(e){console.error("[stx] onMount error:",e)}});mountCallbacks.length=0;document.querySelectorAll("[data-stx-auto]").forEach((el)=>{processElementSkipScopes(el,processedScopes);el.removeAttribute("x-cloak");el.querySelectorAll("[x-cloak]").forEach(function(c){c.removeAttribute("x-cloak")})});const headElements=document.querySelectorAll("head title, head meta[content]");headElements.forEach((el)=>{if(el.tagName==="TITLE"){const text=el.textContent;if(text&&text.includes("{{")){effect(()=>{try{let result=text;const matches=text.match(/{{s*(.+?)s*}}/g);if(matches){matches.forEach((match)=>{const expr=match.replace(/^{{s*|s*}}$/g,"");const fn=new Function(...Object.keys(componentScope),"return "+expr);const value=fn(...Object.values(componentScope));result=result.replace(match,value!=null?value:"")})}el.textContent=result}catch(e){if(!(e instanceof ReferenceError)&&!(e instanceof TypeError))console.warn("[STX] Title expression error:",e)}})}}else if(el.tagName==="META"){const content=el.getAttribute("content");if(content&&content.includes("{{")){const hasOnlyPlaceholders=!content.replace(/{{s*__[A-Z_]+__s*}}/g,"").includes("{{");if(hasOnlyPlaceholders)return;effect(()=>{try{let result=content;const matches=content.match(/{{s*(.+?)s*}}/g);if(matches){matches.forEach((match)=>{const expr=match.replace(/^{{s*|s*}}$/g,"");if(/^__[A-Z_]+__$/.test(expr.trim()))return;const fn=new Function(...Object.keys(componentScope),"return "+expr);const value=fn(...Object.values(componentScope));result=result.replace(match,value!=null?value:"")})}el.setAttribute("content",result)}catch(e){if(!(e instanceof ReferenceError)&&!(e instanceof TypeError))console.warn("[STX] Meta expression error:",e)}})}}})});function cleanupContainer(container){if(!container)return;mountCallbacks.length=0;var preservedRefs=componentScope.$refs||{};componentScope={$refs:preservedRefs};var shellElements=document.querySelectorAll("[data-stx-content] ~ *");document.querySelectorAll("body > *").forEach(function(el){if(el===container)return;if(el.tagName==="SCRIPT"||el.tagName==="STYLE")return;if(el.__stx_scope)Object.assign(componentScope,el.__stx_scope)});container.querySelectorAll("*").forEach(function(el){if(el.__stx_destroy&&Array.isArray(el.__stx_destroy)){el.__stx_destroy.forEach(function(fn){try{fn()}catch(e){console.warn("[stx] destroy hook error:",e)}});el.__stx_destroy=null}if(el.__stx_disposers&&typeof el.__stx_disposers==="function"){el.__stx_disposers();el.__stx_disposers=null}});if(container.__stx_destroy){container.__stx_destroy.forEach(function(fn){try{fn()}catch(e){console.warn("[stx] destroy hook error:",e)}});container.__stx_destroy=null}if(container.__stx_disposers){container.__stx_disposers();container.__stx_disposers=null}container.__stx_scope=null;container.querySelectorAll("[data-stx-scope]").forEach(function(el){var scopeId=el.getAttribute("data-stx-scope");if(scopeId&&window.stx._scopes&&window.stx._scopes[scopeId]){var scopeVars=window.stx._scopes[scopeId];if(scopeVars.__destroyCallbacks&&Array.isArray(scopeVars.__destroyCallbacks)){scopeVars.__destroyCallbacks.forEach(function(fn){try{fn()}catch(e){console.warn("[stx] scope destroy error:",e)}})}delete window.stx._scopes[scopeId]}})};var _stxLoadTimer=null;window.addEventListener("stx:load",function(){if(_stxLoadTimer){clearTimeout(_stxLoadTimer)}_stxLoadTimer=setTimeout(_handleStxLoad,5)});function _handleStxLoad(){_stxLoadTimer=null;console.log("[stx:load] START. mountQueue:",mountQueue.length,"_latestSetup:",!!window.stx._latestSetup);destroyCallbacks.forEach(function(fn){try{fn()}catch(e){console.warn("[stx] destroy callback error:",e)}});destroyCallbacks.length=0;mountQueue.forEach(function(fn){fn()});mountQueue=[];var routerOpts=window.STX_ROUTER_OPTIONS||window.__stxRouterConfig||{};var container=document.querySelector("[data-stx-content]")||(routerOpts.container?document.querySelector(routerOpts.container):null)||document.querySelector("#main-content")||document.body;var usedLatestSetup=false;if(window.stx._latestSetup&&typeof window.stx._latestSetup==="function"){try{var setupResult=window.stx._latestSetup();usedLatestSetup=true;if(typeof setupResult==="object"&&setupResult!==null){console.log("[stx:load] _latestSetup keys:",Object.keys(setupResult).slice(0,10));Object.assign(componentScope,setupResult)}}catch(e){console.error("[stx:load] _latestSetup error:",e);usedLatestSetup=true}}console.log("[stx:load] usedLatestSetup:",usedLatestSetup,"scope keys:",Object.keys(componentScope).slice(0,10));if(!usedLatestSetup){document.querySelectorAll("[data-stx]").forEach(function(el){var setupName=el.getAttribute("data-stx");if(setupName&&window[setupName]){var result=window[setupName]();if(typeof result==="object")Object.assign(componentScope,result)}})}if(window.__stx_reactive&&window.__stx_reactive.initScope){container.querySelectorAll("[data-stx-xdata]").forEach(function(el){var scopeId=el.getAttribute("data-stx-scope");if(scopeId&&window.stx._scopes&&window.stx._scopes[scopeId])return;var xdata=el.getAttribute("data-stx-xdata");if(!xdata)return;if(!scopeId){scopeId="__stx_scope_spa_"+ ++window.stx._scopeCounter;el.setAttribute("data-stx-scope",scopeId)}console.log("[stx:load] initializing x-data scope:",scopeId,xdata.substring(0,40));window.__stx_reactive.initScope(el,xdata,[],{},null)})}container.querySelectorAll("[data-stx-scope]").forEach(function(el){var scopeId=el.getAttribute("data-stx-scope");var scopeVars=window.stx._scopes&&window.stx._scopes[scopeId];if(!scopeVars)return;Object.assign(componentScope,scopeVars);var disposeEffects=trackEffects(function(){processElement(el,componentScope)});el.__stx_disposers=disposeEffects});console.log("[stx:load] container:",container.tagName,"__stx_scope:",!!container.__stx_scope,"scope keys:",Object.keys(componentScope).slice(0,10));if(!container.__stx_scope){if(container.__stx_disposers&&typeof container.__stx_disposers==="function"){container.__stx_disposers()}console.log("[stx:load] processElement on container");var disposeEffects=trackEffects(function(){processElement(container,componentScope)});container.__stx_disposers=disposeEffects}else{console.log("[stx:load] SKIPPED processElement — container has __stx_scope")}container.removeAttribute("x-cloak");container.querySelectorAll("[x-cloak]").forEach(function(c){c.removeAttribute("x-cloak")});container.querySelectorAll("[data-stx-scope]").forEach(function(el){var scopeId=el.getAttribute("data-stx-scope");var scopeVars=window.stx._scopes&&window.stx._scopes[scopeId];if(scopeVars&&scopeVars.__mountCallbacks){scopeVars.__mountCallbacks.forEach(function(fn){fn()})}});mountCallbacks.forEach(function(fn){try{fn()}catch(e){console.warn("[stx] mount callback error:",e)}});mountCallbacks.length=0};function processElementSkipScopes(el,processedScopes){if(processedScopes.has(el))return;if(el.nodeType===Node.TEXT_NODE){processElement(el);return}if(el.nodeType!==Node.ELEMENT_NODE)return;if(el.hasAttribute&&el.hasAttribute("data-stx-scope"))return;const hasFor=el.hasAttribute&&(el.hasAttribute("@for")||el.hasAttribute(":for")||el.hasAttribute("x-for"));const hasIf=el.hasAttribute&&(el.hasAttribute("@if")||el.hasAttribute(":if")||el.hasAttribute("x-if"));if(hasFor){var fa=el.hasAttribute(":for")?":for":el.hasAttribute("x-for")?"x-for":"@for";bindFor(el,componentScope,fa);return}if(hasIf){var ia=el.hasAttribute(":if")?":if":el.hasAttribute("x-if")?"x-if":"@if";bindIf(el,componentScope,ia);return}if(el.hasAttribute&&(el.hasAttribute("@show")||el.hasAttribute(":show")||el.hasAttribute("x-show"))){var sa=el.hasAttribute(":show")?":show":el.hasAttribute("x-show")?"x-show":"@show";bindShow(el,el.getAttribute(sa),componentScope,sa)}if(el.hasAttribute&&(el.hasAttribute("@model")||el.hasAttribute(":model")||el.hasAttribute("x-model"))){var ma=el.hasAttribute(":model")?":model":el.hasAttribute("x-model")?"x-model":"@model";bindModel(el,el.getAttribute(ma),componentScope,ma)}if(el.tagName!=="SCRIPT"&&el.tagName!=="STYLE"){Array.from(el.childNodes).forEach((child)=>processElementSkipScopes(child,processedScopes))}}})();</script> <!DOCTYPE html><html lang="en" data-theme="dark"><head><meta name="title" content="stx Project"><meta name="description" content="A website built with stx templating engine"><meta property="og:title" content="stx Project"><meta property="og:description" content="A website built with stx templating engine"><meta property="og:type" content="website"><meta name="twitter:card" content="summary_large_image"><meta name="twitter:title" content="stx Project"><meta name="twitter:description" content="A website built with stx templating engine"><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>ts-cloud — Secrets</title><link rel="preconnect" href="https://fonts.googleapis.com"><link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet"><style> :root { --bg: #0b1020; --bg2: #0f1730; --panel: rgba(255,255,255,0.04); --panel-br: rgba(255,255,255,0.08); --txt: #e8edf7; --txt2: #9fb0cc; --txt3: #64748b; --accent: #5b8cff; --ok: #34d399; --okbg: rgba(52,211,153,0.12); --bad: #f87171; --badbg: rgba(248,113,113,0.12); --warn: #fbbf24; --warnbg: rgba(251,191,36,0.12); } * { box-sizing: border-box; margin: 0; padding: 0; } body { font-family: 'Inter', system-ui, sans-serif; color: var(--txt); min-height: 100vh; background: radial-gradient(1200px 600px at 80% -10%, rgba(91,140,255,0.12), transparent 60%), linear-gradient(160deg, var(--bg), var(--bg2)); -webkit-font-smoothing: antialiased; } a { color: inherit; text-decoration: none; } .wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px 64px; } nav { display: flex; align-items: center; gap: 16px; padding: 18px 24px; position: sticky; top: 0; z-index: 10; background: rgba(11,16,32,0.7); backdrop-filter: blur(14px); border-bottom: 1px solid var(--panel-br); } .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -0.02em; } .brand .dot { width: 22px; height: 22px; border-radius: 7px; background: linear-gradient(135deg, var(--accent), #8b5cf6); box-shadow: 0 0 18px rgba(91,140,255,0.6); } .tabs { display: flex; gap: 4px; margin-left: 18px; } .tabs a { padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--txt2); } .tabs a.active { background: rgba(91,140,255,0.14); color: var(--accent); } .nav-meta { margin-left: auto; display: flex; align-items: center; gap: 14px; color: var(--txt2); font-size: 13px; } .env { padding: 4px 10px; border-radius: 999px; background: var(--okbg); color: var(--ok); font-weight: 600; font-size: 12px; } header.page { padding: 30px 0 22px; display: flex; align-items: flex-start; gap: 20px; flex-wrap: wrap; } header.page h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; } header.page p { color: var(--txt2); margin-top: 4px; font-size: 14px; } .server-line { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; color: var(--txt2); font-size: 13px; } .server-line b { color: var(--txt); font-weight: 600; } .header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; } /* Breadcrumb / back link for drill-down pages */ .crumbs { display: flex; align-items: center; gap: 8px; padding-top: 26px; font-size: 13px; color: var(--txt3); } .crumbs a { color: var(--txt2); } .crumbs a:hover { color: var(--accent); } .crumbs .sep { color: var(--txt3); } .grid { display: grid; gap: 16px; } .cards { grid-template-columns: repeat(4, 1fr); } .cards-3 { grid-template-columns: repeat(3, 1fr); } .cards-2 { grid-template-columns: repeat(2, 1fr); } @media (max-width: 880px) { .cards, .cards-3, .cards-2 { grid-template-columns: repeat(2, 1fr); } } .panel { background: var(--panel); border: 1px solid var(--panel-br); border-radius: 16px; padding: 18px; backdrop-filter: blur(6px); } a.panel { display: block; transition: border-color .15s, transform .15s; } a.panel:hover { border-color: rgba(91,140,255,0.5); transform: translateY(-1px); } .panel h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--txt3); font-weight: 700; } .stat { font-size: 28px; font-weight: 800; margin-top: 8px; letter-spacing: -0.02em; } .stat small { font-size: 14px; color: var(--txt2); font-weight: 500; } .bar { height: 7px; border-radius: 999px; background: rgba(255,255,255,0.07); margin-top: 12px; overflow: hidden; } .bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), #8b5cf6); } .section { margin-top: 30px; } .section > h2 { font-size: 15px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; } .section > h2 .more { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--accent); } .cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; } @media (max-width: 880px) { .cols { grid-template-columns: 1fr; } } table { width: 100%; border-collapse: collapse; font-size: 14px; } th { text-align: left; color: var(--txt3); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; padding: 0 12px 10px; } td { padding: 12px; border-top: 1px solid rgba(255,255,255,0.05); } tr:hover td { background: rgba(255,255,255,0.02); } .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: var(--txt2); } .pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; } .pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; } .pill.ok { background: var(--okbg); color: var(--ok); } .pill.bad { background: var(--badbg); color: var(--bad); } .pill.warn { background: var(--warnbg); color: var(--warn); } .tag { padding: 2px 8px; border-radius: 6px; background: rgba(91,140,255,0.12); color: var(--accent); font-size: 12px; font-weight: 600; } .kv { display: flex; justify-content: space-between; padding: 9px 0; border-top: 1px solid rgba(255,255,255,0.05); font-size: 14px; gap: 16px; } .kv:first-of-type { border-top: 0; } .kv > span { color: var(--txt2); white-space: nowrap; } .kv > b { text-align: right; word-break: break-all; } .deploy { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid rgba(255,255,255,0.05); font-size: 14px; } .deploy:first-of-type { border-top: 0; } .deploy .when { margin-left: auto; color: var(--txt3); font-size: 12px; } .btn { background: linear-gradient(135deg, var(--accent), #8b5cf6); color: #fff; border: 0; border-radius: 10px; padding: 10px 18px; font-weight: 700; font-size: 14px; cursor: pointer; font-family: inherit; white-space: nowrap; } .btn:hover { filter: brightness(1.08); } .btn.ghost { background: rgba(255,255,255,0.05); border: 1px solid var(--panel-br); color: var(--txt); } .btn.danger { background: var(--badbg); color: var(--bad); } .btn.sm { padding: 6px 12px; font-size: 12px; } .data-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid rgba(255,255,255,0.05); font-size: 14px; } .data-item:first-of-type { border-top: 0; } .data-item .detail { color: var(--txt3); font-size: 12px; } .data-item .st { margin-left: auto; } .secret { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid rgba(255,255,255,0.05); font-size: 14px; } .secret:first-of-type { border-top: 0; } .secret .val { margin-left: auto; color: var(--txt3); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; letter-spacing: 2px; } /* Drill-down extras */ .spark { display: flex; align-items: flex-end; gap: 3px; height: 48px; margin-top: 12px; } .spark > i { flex: 1; background: linear-gradient(180deg, var(--accent), rgba(91,140,255,0.25)); border-radius: 3px 3px 0 0; min-height: 2px; } .logs { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.7; color: var(--txt2); max-height: 360px; overflow: auto; } .logs .ts { color: var(--txt3); } .logs .err { color: var(--bad); } .note { color: var(--txt3); font-size: 12px; margin-top: 10px; } .row-actions { display: flex; gap: 8px; } .field { display: flex; gap: 8px; margin-top: 12px; } .field input { flex: 1; background: rgba(255,255,255,0.05); border: 1px solid var(--panel-br); border-radius: 10px; padding: 9px 12px; color: var(--txt); font-family: inherit; font-size: 14px; } .field input:focus { outline: none; border-color: var(--accent); } </style></head><body data-stx-auto><nav><div class="brand"><span class="dot"></span> ts-cloud</div><div class="tabs"><a href="/">Server</a><a href="/serverless" class="active">Serverless</a></div><div class="nav-meta"><span>acme</span><span class="env">production</span></div></nav><div class="wrap"><div class="crumbs"><a href="/serverless">Serverless</a><span class="sep">/</span> Secrets</div><header class="page"><div><h1>Secrets</h1><p>Stored in AWS Secrets Manager and injected into the functions at deploy. Values are never displayed.</p></div></header><div class="section"><div class="panel"><table><thead><tr><th>Key</th><th>Secret source</th><th>Value</th><th>Updated</th><th></th></tr></thead><tbody><tr><td class="mono"><b>APP_KEY</b></td><td class="mono" style="color:var(--txt3)">acme/production/app-key</td><td class="mono" style="letter-spacing:2px;color:var(--txt3)">••••••••</td><td style="color:var(--txt3)">14d ago</td><td class="row-actions"><form method="post" action="/api/serverless/secrets/rotate"><button class="btn ghost sm" type="submit">Rotate</button></form><form method="post" action="/api/serverless/secrets/delete"><button class="btn danger sm" type="submit">Delete</button></form></td></tr><tr><td class="mono"><b>DB_PASSWORD</b></td><td class="mono" style="color:var(--txt3)">acme/production/db</td><td class="mono" style="letter-spacing:2px;color:var(--txt3)">••••••••</td><td style="color:var(--txt3)">14d ago</td><td class="row-actions"><form method="post" action="/api/serverless/secrets/rotate"><button class="btn ghost sm" type="submit">Rotate</button></form><form method="post" action="/api/serverless/secrets/delete"><button class="btn danger sm" type="submit">Delete</button></form></td></tr><tr><td class="mono"><b>STRIPE_SECRET</b></td><td class="mono" style="color:var(--txt3)">acme/production/stripe</td><td class="mono" style="letter-spacing:2px;color:var(--txt3)">••••••••</td><td style="color:var(--txt3)">3d ago</td><td class="row-actions"><form method="post" action="/api/serverless/secrets/rotate"><button class="btn ghost sm" type="submit">Rotate</button></form><form method="post" action="/api/serverless/secrets/delete"><button class="btn danger sm" type="submit">Delete</button></form></td></tr><tr><td class="mono"><b>MAIL_PASSWORD</b></td><td class="mono" style="color:var(--txt3)">acme/production/mail</td><td class="mono" style="letter-spacing:2px;color:var(--txt3)">••••••••</td><td style="color:var(--txt3)">21d ago</td><td class="row-actions"><form method="post" action="/api/serverless/secrets/rotate"><button class="btn ghost sm" type="submit">Rotate</button></form><form method="post" action="/api/serverless/secrets/delete"><button class="btn danger sm" type="submit">Delete</button></form></td></tr></tbody></table><form method="post" action="/api/serverless/secrets/set" class="field"><input name="key" placeholder="KEY" aria-label="Secret key"><input name="value" placeholder="value" aria-label="Secret value" type="password"><button class="btn sm" type="submit">Set secret</button></form><p class="note">CLI: <span class="mono">cloud secrets:set KEY value</span> · <span class="mono">cloud secrets:list</span> · pull all env with <span class="mono">cloud env:pull</span></p></div></div></div> <script data-stx-scoped>
1
+ <!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>stx App</title><style data-crosswind="generated"> /* ! Tailwind CSS Preflight | MIT License | https://tailwindcss.com */ *, ::before, ::after { box-sizing: border-box; border-width: 0; border-style: solid; border-color: var(--border-color, currentColor); } ::before, ::after { --hw-content: ''; } html, :host { line-height: 1.5; -webkit-text-size-adjust: 100%; -moz-tab-size: 4; tab-size: 4; font-family: ui-sans-serif, system-ui, sans-serif; font-feature-settings: normal; font-variation-settings: normal; -webkit-tap-highlight-color: transparent; } body { margin: 0; line-height: inherit; } hr { height: 0; color: inherit; border-top-width: 1px; } abbr:where([title]) { text-decoration: underline dotted; } h1, h2, h3, h4, h5, h6 { font-size: inherit; font-weight: inherit; } a { color: inherit; text-decoration: inherit; } b, strong { font-weight: bolder; } code, kbd, samp, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-feature-settings: normal; font-variation-settings: normal; font-size: 1em; } small { font-size: 80%; } sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; } sub { bottom: -0.25em; } sup { top: -0.5em; } table { text-indent: 0; border-color: var(--border-color, inherit); border-collapse: collapse; } button, input, optgroup, select, textarea { font-family: inherit; font-feature-settings: inherit; font-variation-settings: inherit; font-size: 100%; font-weight: inherit; line-height: inherit; letter-spacing: inherit; color: inherit; margin: 0; padding: 0; } button, select { text-transform: none; } button, input:where([type='button']), input:where([type='reset']), input:where([type='submit']) { -webkit-appearance: button; background-color: transparent; background-image: none; } :-moz-focusring { outline: auto; } :-moz-ui-invalid { box-shadow: none; } progress { vertical-align: baseline; } ::-webkit-inner-spin-button, ::-webkit-outer-spin-button { height: auto; } [type='search'] { -webkit-appearance: textfield; outline-offset: -2px; } ::-webkit-search-decoration { -webkit-appearance: none; } ::-webkit-file-upload-button { -webkit-appearance: button; font: inherit; } summary { display: list-item; } blockquote, dl, dd, h1, h2, h3, h4, h5, h6, hr, figure, p, pre { margin: 0; } fieldset { margin: 0; padding: 0; } legend { padding: 0; } ol, ul, menu { list-style: none; margin: 0; padding: 0; } dialog { padding: 0; } textarea { resize: vertical; } input::placeholder, textarea::placeholder { opacity: 1; color: #9ca3af; } button, [role="button"] { cursor: pointer; } :disabled { cursor: default; } img, svg, video, canvas, audio, iframe, embed, object { display: block; vertical-align: middle; } img, video { max-width: 100%; height: auto; } [hidden] { display: none; } </style></head><body> <script data-stx-scoped>console.log("[stx] signals runtime loading");if(!window.__stx_early_mounts)window.__stx_early_mounts=[];if(!window.__stx_early_destroys)window.__stx_early_destroys=[];if(!window.onMount)window.onMount=function(fn){window.__stx_early_mounts.push(fn)};if(!window.onDestroy)window.onDestroy=function(fn){window.__stx_early_destroys.push(fn)};console.log("[stx] entering IIFE");(function(){var cloakStyle=document.createElement("style");cloakStyle.textContent="[x-cloak] { display: none !important; }";document.head.appendChild(cloakStyle);let activeEffect=null;const effectStack=[];const pendingEffects=new Set;let isBatching=false;let activeDisposers=null;const targetMap=new WeakMap;const globalHelpers={fmt(n){if(n==null)return"0";n=Number(n);if(n>=1e6)return(n/1e6).toFixed(1)+"M";if(n>=1000)return(n/1000).toFixed(1)+"K";return String(n)},formatDate(date,format="YYYY-MM-DD"){if(!date)return"";const d=date instanceof Date?date:new Date(date);if(isNaN(d.getTime()))return"";const year=d.getFullYear();const month=String(d.getMonth()+1).padStart(2,"0");const day=String(d.getDate()).padStart(2,"0");const hours=String(d.getHours()).padStart(2,"0");const minutes=String(d.getMinutes()).padStart(2,"0");const seconds=String(d.getSeconds()).padStart(2,"0");return format.replace("YYYY",year).replace("MM",month).replace("DD",day).replace("HH",hours).replace("mm",minutes).replace("ss",seconds)},timeAgo(date){if(!date)return"";const d=date instanceof Date?date:new Date(date);const now=new Date;const seconds=Math.floor((now-d)/1000);if(seconds<60)return"just now";if(seconds<3600)return Math.floor(seconds/60)+"m ago";if(seconds<86400)return Math.floor(seconds/3600)+"h ago";if(seconds<604800)return Math.floor(seconds/86400)+"d ago";return d.toLocaleDateString()},debounce(fn,delay=300){let timeout;return function(...args){clearTimeout(timeout);timeout=setTimeout(()=>fn.apply(this,args),delay)}},throttle(fn,limit=300){let inThrottle;return function(...args){if(!inThrottle){fn.apply(this,args);inThrottle=true;setTimeout(()=>inThrottle=false,limit)}}},capitalize(str){if(!str)return"";return str.charAt(0).toUpperCase()+str.slice(1)},truncate(str,length=50,suffix="..."){if(!str||str.length<=length)return str||"";return str.slice(0,length)+suffix},json(value,indent=2){try{return JSON.stringify(value,null,indent)}catch(e){return String(value)}},pluralize(count,singular,plural){const p=plural||singular+"s";return count===1?singular:p},clamp(value,min,max){return Math.min(Math.max(value,min),max)},currency(value,symbol="$",decimals=2){if(value==null)return symbol+"0.00";return symbol+Number(value).toFixed(decimals).replace(/\B(?=(\d{3})+(?!\d))/g,",")},percent(value,decimals=0){if(value==null)return"0%";return(Number(value)*100).toFixed(decimals)+"%"}};function track(target,key){if(!activeEffect)return;let depsMap=targetMap.get(target);if(!depsMap)targetMap.set(target,depsMap=new Map);let deps=depsMap.get(key);if(!deps)depsMap.set(key,deps=new Set);deps.add(activeEffect)};function trigger(target,key){const depsMap=targetMap.get(target);if(!depsMap)return;const deps=depsMap.get(key);if(deps){if(isBatching){deps.forEach((effect)=>pendingEffects.add(effect))}else{deps.forEach((effect)=>effect())}}};function createAutoUnwrapProxy(scope){return new Proxy(scope,{get(target,prop){const val=target[prop];if(val&&typeof val==="function"&&(val._isSignal||val._isDerived)){return val()}if(val&&typeof val==="object"&&val._isStxStore){return createAutoUnwrapProxy(val)}return val},set(target,prop,value){const cur=target[prop];if(cur&&typeof cur==="function"&&cur._isSignal&&typeof cur.set==="function"){cur.set(value);return true}target[prop]=value;return true}})};function parsePipeExpression(expr,scope){let pipeIndex=-1;let inString=false;let stringChar="";let depth=0;for(let i=0;i<expr.length;i++){const char=expr[i];const prevChar=i>0?expr[i-1]:"";const nextChar=i<expr.length-1?expr[i+1]:"";if((char==='"'||char==="'"||char==="`")&&prevChar!=="\\"){if(!inString){inString=true;stringChar=char}else if(char===stringChar){inString=false}continue}if(inString)continue;if(char==="("||char==="["||char==="{")depth++;if(char===")"||char==="]"||char==="}")depth--;if(depth!==0)continue;if(char==="|"){if(nextChar==="|"){i++;continue}if(prevChar==="|")continue;if(prevChar==="?")continue;pipeIndex=i;break}}if(pipeIndex===-1)return null;const valueExpr=expr.slice(0,pipeIndex).trim();const pipeChain=expr.slice(pipeIndex+1).trim();const pipes=[];let currentPipe="";inString=false;stringChar="";depth=0;for(let i=0;i<pipeChain.length;i++){const char=pipeChain[i];const prevChar=i>0?pipeChain[i-1]:"";const nextChar=i<pipeChain.length-1?pipeChain[i+1]:"";if((char==='"'||char==="'"||char==="`")&&prevChar!=="\\"){if(!inString){inString=true;stringChar=char}else if(char===stringChar){inString=false}currentPipe+=char;continue}if(inString){currentPipe+=char;continue}if(char==="("||char==="["||char==="{")depth++;if(char===")"||char==="]"||char==="}")depth--;if(depth===0&&char==="|"&&nextChar!=="|"&&prevChar!=="|"&&prevChar!=="?"){if(currentPipe.trim()){const parts=currentPipe.trim().split(":");pipes.push({name:parts[0].trim(),args:parts.slice(1).map((a)=>a.trim())})}currentPipe=""}else{currentPipe+=char}}if(currentPipe.trim()){const parts=currentPipe.trim().split(":");pipes.push({name:parts[0].trim(),args:parts.slice(1).map((a)=>a.trim())})}if(pipes.length===0)return null;return{valueExpr,pipes}};function executePipeExpression(valueExpr,pipes,scope){let value;try{const fn=new Function(...Object.keys(scope),"return "+valueExpr);value=fn(...Object.values(scope))}catch(e){if(!(e instanceof ReferenceError)&&!(e instanceof TypeError))console.warn("[STX] Pipe base expression error:",valueExpr,e);return""}for(const pipe of pipes){const filterFn=scope[pipe.name]||globalHelpers[pipe.name];if(typeof filterFn==="function"){try{const parsedArgs=pipe.args.map((arg)=>{if(/^-?\d+(\.\d+)?$/.test(arg))return Number(arg);if(/^['"].*['"]$/.test(arg))return arg.slice(1,-1);try{const fn=new Function(...Object.keys(scope),"return "+arg);return fn(...Object.values(scope))}catch(e){return arg}});value=filterFn(value,...parsedArgs)}catch(e){if(!(e instanceof ReferenceError)&&!(e instanceof TypeError))console.warn("[STX] Pipe filter error:",pipe.name,e)}}else{console.warn("[STX] Unknown pipe/filter:",pipe.name)}}return value};function state(initialValue){let value=initialValue;const subscribers=new Set;const effects=new Set;const signal=()=>{if(activeEffect){effects.add(activeEffect)}return value};signal.set=(newValue)=>{console.log("[stx] signal.set:",value,"->",newValue,"effects:",effects.size);if(!Object.is(newValue,value)){const prev=value;value=newValue;subscribers.forEach((cb)=>cb(value,prev));if(isBatching){effects.forEach((effect)=>pendingEffects.add(effect))}else{effects.forEach((effect)=>effect())}}};signal.update=(fn)=>signal.set(fn(value));signal.subscribe=(cb)=>{subscribers.add(cb);return()=>subscribers.delete(cb)};signal._isSignal=true;Object.defineProperty(signal,"value",{get(){return signal()},set(v){signal.set(v)},configurable:true});return signal};function derived(compute){let cached;let isDirty=true;const effects=new Set;const markDirty=()=>{if(!isDirty){isDirty=true;if(isBatching){effects.forEach((e)=>pendingEffects.add(e))}else{effects.forEach((e)=>e())}}};const signal=()=>{if(activeEffect)effects.add(activeEffect);if(isDirty){const prev=activeEffect;activeEffect=markDirty;effectStack.push(markDirty);try{cached=compute()}finally{effectStack.pop();activeEffect=prev}isDirty=false}return cached};signal._isDerived=true;Object.defineProperty(signal,"value",{get(){return signal()},configurable:true});return signal};function effect(fn,options={}){let cleanup;let isDisposed=false;const runEffect=()=>{if(isDisposed)return;if(cleanup){cleanup();cleanup=undefined};const prev=activeEffect;activeEffect=runEffect;effectStack.push(runEffect);try{cleanup=fn()}catch(e){isDisposed=true;if(e instanceof ReferenceError){}else{throw e}}finally{effectStack.pop();activeEffect=prev}};if(options.immediate!==false)runEffect();const dispose=()=>{isDisposed=true;if(cleanup)cleanup()};if(activeDisposers)activeDisposers.push(dispose);return dispose};function trackEffects(fn){var parentDisposers=activeDisposers;var disposers=[];activeDisposers=disposers;try{fn()}finally{activeDisposers=parentDisposers;if(parentDisposers){disposers.forEach(function(d){parentDisposers.push(d)})}}return function disposeAll(){disposers.forEach(function(d){try{d()}catch(e){console.warn("[stx] dispose error:",e)}});disposers.length=0}};function batch(fn){if(isBatching){fn();return}isBatching=true;fn();isBatching=false;pendingEffects.forEach((e)=>e());pendingEffects.clear()};function isSignal(v){return typeof v==="function"&&v._isSignal===true};function untrack(v){return isSignal(v)||typeof v==="function"&&v._isDerived?v():v};function peek(fn){const prev=activeEffect;activeEffect=null;try{return fn()}finally{activeEffect=prev}};const mountCallbacks=[];const destroyCallbacks=[];function onMount(fn){mountCallbacks.push(fn)};function onDestroy(fn){destroyCallbacks.push(fn)}if(window.__stx_early_mounts){window.__stx_early_mounts.forEach(function(fn){mountCallbacks.push(fn)});window.__stx_early_mounts=null}if(window.__stx_early_destroys){window.__stx_early_destroys.forEach(function(fn){destroyCallbacks.push(fn)});window.__stx_early_destroys=null};function useWebSocket(url,options){options=options||{};var ws=state(null);var status=state("CLOSED");var lastMessage=state(null);var error=state(null);var reconnectAttempts=0;var maxReconnects=options.reconnect===false?0:options.maxReconnects||10;var reconnectDelay=options.reconnectDelay||1000;var reconnectTimer=null;var manualClose=false;var listeners={};function connect(){if(ws()&&ws().readyState<=1)return;manualClose=false;status.set("CONNECTING");error.set(null);var socket=new WebSocket(url);socket.onopen=function(){status.set("OPEN");reconnectAttempts=0;if(options.onOpen)options.onOpen(socket)};socket.onmessage=function(event){var data=event.data;try{data=JSON.parse(data)}catch(e){}lastMessage.set(data);if(options.onMessage)options.onMessage(data,event);if(data&&data.channel&&data.event){var key=data.channel+":"+data.event;var fns=listeners[key];if(fns){for(var i=0;i<fns.length;i++){fns[i](data.data)}}}};socket.onerror=function(event){error.set(event);if(options.onError)options.onError(event)};socket.onclose=function(event){status.set("CLOSED");ws.set(null);if(options.onClose)options.onClose(event);if(!manualClose&&reconnectAttempts<maxReconnects){reconnectAttempts++;var delay=reconnectDelay*Math.min(reconnectAttempts,5);reconnectTimer=setTimeout(connect,delay)}};ws.set(socket)};function send(data){var socket=ws();if(socket&&socket.readyState===WebSocket.OPEN){socket.send(typeof data==="string"?data:JSON.stringify(data))}};function close(){manualClose=true;if(reconnectTimer){clearTimeout(reconnectTimer);reconnectTimer=null};var socket=ws();if(socket)socket.close()};function subscribe(channel){send({type:"subscribe",channel});return{listen:function(event,handler){var key=channel+":"+event;if(!listeners[key])listeners[key]=[];listeners[key].push(handler);return this},leave:function(){send({type:"unsubscribe",channel});var prefix=channel+":";for(var key in listeners){if(key.indexOf(prefix)===0){delete listeners[key]}}}}}if(options.immediate!==false){connect()}onDestroy(function(){close();listeners={}});return{ws,status,lastMessage,error,send,close,connect,subscribe}};function useFetch(urlOrFn,options={}){const data=state(options.initialData??null);const loading=state(true);const error=state(null);const fetchData=async()=>{loading.set(true);error.set(null);try{const url=typeof urlOrFn==="function"?urlOrFn():urlOrFn;if(!url){loading.set(false);return};const fetchOptions={method:options.method||"GET",headers:{"Content-Type":"application/json",...options.headers||{}}};if(options.body){fetchOptions.body=typeof options.body==="string"?options.body:JSON.stringify(options.body)};const response=await fetch(url,fetchOptions);if(!response.ok){throw new Error(`HTTP ${response.status}: ${response.statusText}`)};const result=await response.json();const transformed=options.transform?options.transform(result):result;data.set(transformed)}catch(e){console.error("[STX] useFetch error:",e);error.set(e.message||"Fetch failed");if(options.onError)options.onError(e)}finally{loading.set(false)}};if(options.immediate!==false){onMount(fetchData)}if(typeof urlOrFn==="function"){effect(()=>{const url=urlOrFn();if(url&&options.immediate!==false){fetchData()}})}return{data,loading,error,refetch:fetchData,get isLoading(){return loading()},get hasError(){return!!error()},get isEmpty(){return!loading()&&!data()}}};function useRef(name){return{get current(){return componentScope.$refs?componentScope.$refs[name]:null},get value(){return this.current}}};function navigate(url,forceReload){if(forceReload){window.location.href=url;return}if(window.stxRouter&&typeof window.stxRouter.navigate==="function"){window.stxRouter.navigate(url)}else{window.location.href=url}};function goBack(){window.history.back()};function goForward(){window.history.forward()};var _routeParams=state({});function setRouteParams(params){_routeParams.set(params||{})}window.addEventListener("stx:navigate",function(e){if(e.detail&&e.detail.params){_routeParams.set(e.detail.params)}});if(window.stx&&window.stx._rp||window.__stx_rp){_routeParams.set(window.stx?._rp||window.__stx_rp)};function useRoute(){return{get path(){return window.location.pathname},get fullPath(){return window.location.pathname+window.location.search+window.location.hash},get hash(){return window.location.hash},get query(){var params={};new URLSearchParams(window.location.search).forEach(function(v,k){params[k]=v});return params},get params(){return _routeParams()}}};function useSearchParams(){var params=state(Object.fromEntries(new URLSearchParams(window.location.search)));var syncFromUrl=function(){params.set(Object.fromEntries(new URLSearchParams(window.location.search)))};window.addEventListener("popstate",syncFromUrl);window.addEventListener("stx:navigate",syncFromUrl);return{data:params,get:function(key){return params()[key]},set:function(key,value){var url=new URL(window.location.href);url.searchParams.set(key,value);window.history.pushState({},"",url);syncFromUrl()},setAll:function(obj){var url=new URL(window.location.href);Object.keys(obj).forEach(function(k){url.searchParams.set(k,obj[k])});window.history.pushState({},"",url);syncFromUrl()}}};var _queryCache={};function useQuery(url,options){options=options||{};var staleTime=options.staleTime||0;var cacheTime=options.cacheTime||300000;var cacheKey=options.cacheKey||(typeof url==="function"?null:url);var data=state(options.initialData||null);var loading=state(true);var error=state(null);var isStale=state(false);var fetchData=async function(){var resolvedUrl=typeof url==="function"?url():url;if(!resolvedUrl){loading.set(false);return};var key=cacheKey||resolvedUrl;var cached=_queryCache[key];if(cached&&Date.now()-cached.timestamp<staleTime){data.set(cached.data);loading.set(false);isStale.set(false);if(options.onSuccess)options.onSuccess(cached.data);return}if(cached){data.set(cached.data);isStale.set(true)}loading.set(true);error.set(null);try{var fetchOpts={method:"GET",headers:{"Content-Type":"application/json",...options.headers||{}}};var response=await fetch(resolvedUrl,fetchOpts);if(!response.ok)throw new Error("HTTP "+response.status+": "+response.statusText);var result=await response.json();var transformed=options.transform?options.transform(result):result;data.set(transformed);isStale.set(false);_queryCache[key]={data:transformed,timestamp:Date.now()};if(options.onSuccess)options.onSuccess(transformed);setTimeout(function(){delete _queryCache[key]},cacheTime)}catch(e){error.set(e.message||"Query failed");if(options.onError)options.onError(e)}finally{loading.set(false)}};if(options.immediate!==false){onMount(fetchData)}if(options.refetchOnFocus){document.addEventListener("visibilitychange",function(){if(!document.hidden)fetchData()})}if(options.refetchInterval){var intervalId=setInterval(fetchData,options.refetchInterval);onDestroy(function(){clearInterval(intervalId)})}return{data,loading,error,isStale,refetch:fetchData,invalidate:function(){var key=cacheKey||(typeof url==="function"?url():url);delete _queryCache[key];return fetchData()}}};function useMutation(url,options){options=options||{};var data=state(null);var loading=state(false);var error=state(null);var mutate=async function(body){loading.set(true);error.set(null);var previousData=data();if(options.optimisticData){var optimistic=typeof options.optimisticData==="function"?options.optimisticData(body):options.optimisticData;data.set(optimistic)}try{var resolvedUrl=typeof url==="function"?url():url;var fetchOpts={method:options.method||"POST",headers:{"Content-Type":"application/json",...options.headers||{}},body:typeof body==="string"?body:JSON.stringify(body)};var response=await fetch(resolvedUrl,fetchOpts);if(!response.ok)throw new Error("HTTP "+response.status+": "+response.statusText);var result=await response.json();var transformed=options.transform?options.transform(result):result;data.set(transformed);if(options.onSuccess)options.onSuccess(transformed);if(options.invalidateQueries){options.invalidateQueries.forEach(function(key){delete _queryCache[key]})}return transformed}catch(e){error.set(e.message||"Mutation failed");if(options.optimisticData)data.set(previousData);if(options.onError)options.onError(e);throw e}finally{loading.set(false)}};return{data,loading,error,mutate,reset:function(){data.set(null);error.set(null);loading.set(false)}}};let componentScope={$refs:{}};let currentElement=null;function findElementScope(el){let current=el;while(current&&current!==document){if(current.__stx_scope){return current.__stx_scope}if(current.hasAttribute&&current.hasAttribute("data-stx-scope")){const scopeId=current.getAttribute("data-stx-scope");if(window.stx._scopes&&window.stx._scopes[scopeId]){return window.stx._scopes[scopeId]}}current=current.parentElement||current.parentNode}return null};function toValue(expr,el,enableAutoUnwrap=true){try{if(/^__[A-Z_]+__$/.test(expr.trim())){return expr};const elementScope=findElementScope(el||currentElement);const baseScope={...componentScope,...elementScope||{},...globalHelpers};const pipeResult=parsePipeExpression(expr,baseScope);if(pipeResult){const unwrapScope=enableAutoUnwrap?createAutoUnwrapProxy(baseScope):baseScope;const piped=executePipeExpression(pipeResult.valueExpr,pipeResult.pipes,unwrapScope);return piped&&typeof piped==="function"&&(piped._isSignal||piped._isDerived)?piped():piped};const scope=enableAutoUnwrap?createAutoUnwrapProxy(baseScope):baseScope;const fn=new Function(...Object.keys(baseScope),"return "+expr);const result=fn(...Object.values(scope));return result&&typeof result==="function"&&(result._isSignal||result._isDerived)?result():result}catch(e){if(!(e instanceof ReferenceError)&&!(e instanceof TypeError))console.warn("[STX] Expression error:",expr,e);return""}};function parseEventShorthand(expr,scope){const trimmed=expr.trim();if(/^!\w+$/.test(trimmed)){const varName=trimmed.slice(1);const signal=scope[varName];if(signal&&signal._isSignal){return()=>signal.set(!signal())}return null}if(/^\w+\+\+$/.test(trimmed)){const varName=trimmed.slice(0,-2);const signal=scope[varName];if(signal&&signal._isSignal){return()=>signal.update((n)=>n+1)}return null}if(/^\w+--$/.test(trimmed)){const varName=trimmed.slice(0,-2);const signal=scope[varName];if(signal&&signal._isSignal){return()=>signal.update((n)=>n-1)}return null};const assignMatch=trimmed.match(/^(\w+)\s*([+\-*\/])=\s*(.+)$/);if(assignMatch){const[,varName,op,valueExpr]=assignMatch;const signal=scope[varName];if(signal&&signal._isSignal){return()=>{const addValue=toValue(valueExpr,null,true);signal.update((n)=>{switch(op){case"+":return n+addValue;case"-":return n-addValue;case"*":return n*addValue;case"/":return n/addValue;default:return n}})}}return null};const simpleAssignMatch=trimmed.match(/^(\w+)\s*=\s*(.+)$/);if(simpleAssignMatch&&!trimmed.includes("==")&&!trimmed.includes("=>")){const[,varName,valueExpr]=simpleAssignMatch;const signal=scope[varName];if(signal&&signal._isSignal){return()=>{const newValue=toValue(valueExpr,null,true);signal.set(newValue)}}return null}return null};function executeHandler(expr,event,el){try{if(/^__[A-Z_]+__$/.test(expr.trim())){return};const elementScope=findElementScope(el||currentElement);const scope={...componentScope,...elementScope||{},...globalHelpers};const shorthandFn=parseEventShorthand(expr,scope);if(shorthandFn){shorthandFn();return};const fn=new Function(...Object.keys(scope),"$event",expr);fn(...Object.values(scope),event)}catch(e){if(!(e instanceof ReferenceError)&&!(e instanceof TypeError))console.warn("[STX] Handler error:",expr,e)}};function deferHydration(el,trigger,scope){if(el.__stx_hydration_scheduled)return;el.__stx_hydration_scheduled=true;var run=function(){if(el.__stx_hydrated)return;el.__stx_hydrated=true;el.removeAttribute("stx-hydrate");Array.from(el.children).forEach(function(child){processElement(child,scope)});processAttributesOnly(el,scope);window.dispatchEvent(new CustomEvent("stx:hydrated",{detail:{el,trigger}}))};if(trigger==="idle"){if(typeof requestIdleCallback==="function")requestIdleCallback(run,{timeout:2000});else setTimeout(run,200)}else if(trigger==="visible"){if(typeof IntersectionObserver==="function"){var io=new IntersectionObserver(function(entries){entries.forEach(function(e){if(e.isIntersecting){io.disconnect();run()}})},{rootMargin:"50px"});io.observe(el)}else{run()}}else if(trigger==="interaction"){var events=["mouseenter","click","focusin","touchstart"];var handler=function(){events.forEach(function(ev){el.removeEventListener(ev,handler)});run()};events.forEach(function(ev){el.addEventListener(ev,handler,{once:true,passive:true})})}else if(trigger&&trigger.indexOf("media:")===0){var query=trigger.slice(6);var mql=window.matchMedia(query);if(mql.matches)run();else{var mqHandler=function(e){if(e.matches){mql.removeEventListener("change",mqHandler);run()}};mql.addEventListener("change",mqHandler)}}else{run()}};function processAttributesOnly(el,scope){el.__stx_hydrated=true;processElement(el,scope)};function processElement(el,scope=componentScope){if(el.nodeType===Node.ELEMENT_NODE&&el.hasAttribute){if(el.hasAttribute("x-class")||el.hasAttribute("@click")){console.log("[stx] processElement:",el.tagName,"x-class:",el.hasAttribute("x-class"),"@click:",el.hasAttribute("@click"))}}if(el.nodeType===Node.ELEMENT_NODE&&el.hasAttribute&&el.hasAttribute("stx-hydrate")&&!el.__stx_hydrated){var trigger=el.getAttribute("stx-hydrate")||"idle";deferHydration(el,trigger,scope);return}if(el.nodeType===Node.ELEMENT_NODE&&el.tagName==="BUTTON"&&el.hasAttribute&&el.hasAttribute("@click")){}if(el.nodeType===Node.ELEMENT_NODE&&el.hasAttribute){if(el.hasAttribute("x-data")||el.hasAttribute("data-stx-xdata")||el.__stx_scope){var xdScope=el.__stx_scope||(findElementScope(el)||{});if(xdScope&&Object.keys(xdScope).length>0){scope={...scope,...xdScope}}}if(el.hasAttribute("data-stx-memo")){var memoExpr=el.getAttribute("data-stx-memo");try{var memoScope={...scope,...findElementScope(el)||{},...globalHelpers};var memoFn=new Function(...Object.keys(memoScope),"return "+memoExpr);var memoVals=JSON.stringify(memoFn(...Object.values(memoScope)));if(el.__stx_memo_prev===memoVals){return}el.__stx_memo_prev=memoVals}catch(e){}}}if(el.nodeType===Node.TEXT_NODE){const text=el.textContent;if(text&&text.includes("{{")){const parts=text.split(/(\{\{[^}]+\}\})/g);if(parts.length>1){const fragment=document.createDocumentFragment();const parentEl=el.parentNode;const capturedScope={...scope,...findElementScope(parentEl)||{},...globalHelpers};parts.forEach((part)=>{const match=part.match(/^\{\{\s*(.+?)\s*\}\}$/);if(match){const expr=match[1];if(/^__[A-Z_]+__$/.test(expr.trim())){fragment.appendChild(document.createTextNode(part));return};const span=document.createElement("span");fragment.appendChild(span);effect(()=>{try{const pipeResult=parsePipeExpression(expr,capturedScope);if(pipeResult){const unwrapScope=createAutoUnwrapProxy(capturedScope);span.textContent=executePipeExpression(pipeResult.valueExpr,pipeResult.pipes,unwrapScope)}else{const unwrapScope=createAutoUnwrapProxy(capturedScope);const fn=new Function(...Object.keys(capturedScope),"return "+expr);span.textContent=fn(...Object.values(unwrapScope))}}catch(e){try{const fn=new Function(...Object.keys(capturedScope),"return "+expr);span.textContent=fn(...Object.values(capturedScope))}catch(e2){if(!(e2 instanceof ReferenceError)&&!(e2 instanceof TypeError))console.warn("[STX] Expression error:",expr,e2);span.textContent=""}}})}else if(part){fragment.appendChild(document.createTextNode(part))}});el.replaceWith(fragment)}}return}if(el.nodeType!==Node.ELEMENT_NODE)return;if(el.hasAttribute("@for")||el.hasAttribute(":for")||el.hasAttribute("x-for")){var forAttr=el.hasAttribute(":for")?":for":el.hasAttribute("x-for")?"x-for":"@for";bindFor(el,scope,forAttr);return}if(el.hasAttribute("@if")||el.hasAttribute(":if")||el.hasAttribute("x-if")){var ifAttr=el.hasAttribute(":if")?":if":el.hasAttribute("x-if")?"x-if":"@if";bindIf(el,scope,ifAttr);return}if(el.hasAttribute("@show")||el.hasAttribute(":show")||el.hasAttribute("x-show")){var showAttr=el.hasAttribute(":show")?":show":el.hasAttribute("x-show")?"x-show":"@show";bindShow(el,el.getAttribute(showAttr),scope,showAttr)}if(el.hasAttribute("@model")||el.hasAttribute(":model")||el.hasAttribute("x-model")){var modelAttr=el.hasAttribute(":model")?":model":el.hasAttribute("x-model")?"x-model":"@model";bindModel(el,el.getAttribute(modelAttr),scope,modelAttr)};const attrCapturedScope={...scope,...findElementScope(el)||{},...globalHelpers};const maybeUnwrapSignal=(v)=>{if(v&&typeof v==="function"&&(v._isSignal||v._isDerived))return v();return v};const evalAttrExpr=(rawExpr)=>{var expr=rawExpr.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&#x27;/g,"'");try{if(/^__[A-Z_]+__$/.test(expr.trim()))return expr;const pipeResult=parsePipeExpression(expr,attrCapturedScope);if(pipeResult){const unwrapScope=createAutoUnwrapProxy(attrCapturedScope);return maybeUnwrapSignal(executePipeExpression(pipeResult.valueExpr,pipeResult.pipes,unwrapScope))};const unwrapScope=createAutoUnwrapProxy(attrCapturedScope);const fn=new Function(...Object.keys(attrCapturedScope),"return "+expr);return maybeUnwrapSignal(fn(...Object.values(unwrapScope)))}catch(e){try{const fn=new Function(...Object.keys(attrCapturedScope),"return "+expr);return maybeUnwrapSignal(fn(...Object.values(attrCapturedScope)))}catch(e2){if(!(e2 instanceof ReferenceError)&&!(e2 instanceof TypeError))console.warn("[STX] Attribute expression error:",expr,e2);return""}}};var DIRECTIVE_NAMES={class:1,style:1,text:1,html:1,show:1,model:1,if:1,for:1,ref:1};var EVENT_RE=/^(click|dblclick|mousedown|mouseup|mousemove|mouseenter|mouseleave|keydown|keyup|keypress|input|change|submit|focus|blur|scroll|resize|touchstart|touchend|touchmove|contextmenu|wheel|pointerdown|pointerup|pointermove)/;var KEY_MAP={enter:"Enter",tab:"Tab",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",delete:"Delete",backspace:"Backspace"};if(el.hasAttribute&&(el.hasAttribute("x-class")||el.hasAttribute("@click"))){console.log("[stx] attr loop entry:",el.tagName,"attrs:",Array.from(el.attributes).map((a)=>a.name).join(", "))}Array.from(el.attributes).forEach((attr)=>{const name=attr.name;const value=attr.value;if(el.hasAttribute&&(el.hasAttribute("x-class")||el.hasAttribute("@click"))){console.log("[stx] attr iter:",el.tagName,"name:",name)};var X_HANDLED={"x-text":1,"x-html":1,"x-model":1,"x-show":1,"x-if":1,"x-for":1,"x-cloak":1,"x-ref":1,"x-data":1,"x-bind":1,"x-class":1,"x-style":1};if(name.startsWith("@bind:")||name.startsWith("x-bind:")||name.startsWith(":")&&!name.startsWith("::")&&!DIRECTIVE_NAMES[name.slice(1).split(".")[0]]&&!EVENT_RE.test(name.slice(1))||name.startsWith("x-")&&!X_HANDLED[name.split(".")[0]]&&!X_HANDLED[name]){const attrName=name.startsWith("@bind:")?name.slice(6):name.startsWith("x-bind:")?name.slice(7):name.startsWith("x-")?name.slice(2):name.slice(1);effect(()=>{const v=evalAttrExpr(value);if(v===false||v===null||v===undefined){el.removeAttribute(attrName)}else if(v===true){el.setAttribute(attrName,"")}else{el.setAttribute(attrName,v)}});el.removeAttribute(name)}else if(name==="@class"||name===":class"||name==="x-class"){console.log("[stx] HIT x-class handler:",el.tagName);bindClass(el,value,scope);el.removeAttribute(name)}else if(name==="@style"||name===":style"||name==="x-style"){bindStyle(el,value,scope);el.removeAttribute(name)}else if(name==="@text"||name===":text"||name==="x-text"){effect(()=>{el.textContent=evalAttrExpr(value)});el.removeAttribute(name)}else if(name==="@html"||name===":html"||name==="x-html"){effect(()=>{el.innerHTML=evalAttrExpr(value)});el.removeAttribute(name)}else if(name==="ref"||name===":ref"||name==="x-ref"||name==="data-stx-ref"){if(scope.$refs)scope.$refs[value]=el;if(componentScope.$refs)componentScope.$refs[value]=el}else if(name.startsWith("@")||name.startsWith(":")){const parts=name.slice(1).split(".");const eventName=parts[0];const modifiers=parts.slice(1);if(["if","for","show","model","class","style","text","html","ref"].includes(eventName)){return};var eventKey="__stx_evt_"+eventName+"_"+value.substring(0,20);if(el[eventKey]){el.removeAttribute(name);return}el[eventKey]=true;const eventCapturedScope={...scope,...findElementScope(el)||{},...globalHelpers};console.log("[stx] binding event:",eventName,"on",el.tagName,"expr:",value.substring(0,40));el.addEventListener(eventName,(event)=>{console.log("[stx] event fired:",eventName,"on",el.tagName);if(eventName==="click"){var ancestor=el;while(ancestor){if(ancestor.__stx_shown_at&&performance.now()-ancestor.__stx_shown_at<50)return;ancestor=ancestor.parentElement}}if(modifiers.includes("self")&&event.target!==el)return;if(modifiers.includes("ctrl")&&!event.ctrlKey)return;if(modifiers.includes("alt")&&!event.altKey)return;if(modifiers.includes("shift")&&!event.shiftKey)return;if(modifiers.includes("meta")&&!event.metaKey)return;for(var mi=0;mi<modifiers.length;mi++){if(KEY_MAP[modifiers[mi]]&&event.key!==KEY_MAP[modifiers[mi]])return}if(modifiers.includes("prevent"))event.preventDefault();if(modifiers.includes("stop"))event.stopPropagation();try{if(!value||/^__[A-Z_]+__$/.test(value.trim()))return;var shorthandFn=parseEventShorthand(value,eventCapturedScope);if(shorthandFn){shorthandFn();return};var hasSignals=Object.values(eventCapturedScope).some(function(v){return v&&typeof v==="function"&&v._isSignal});var isDirectAssignment=hasSignals&&/^[a-zA-Z_$]w*s*=/.test(value.trim())&&!value.trim().startsWith("==");if(isDirectAssignment){var getVars=Object.keys(eventCapturedScope).map(function(k){return"var "+k+' = __s["'+k+'"] && typeof __s["'+k+'"] === "function" && __s["'+k+'"]._isSignal ? __s["'+k+'"]() : __s["'+k+'"]'}).join(";");var setVars=Object.keys(eventCapturedScope).filter(function(k){var v=eventCapturedScope[k];return v&&typeof v==="function"&&v._isSignal}).map(function(k){return"if("+k+' !== __s["'+k+'"]()) __s["'+k+'"].set('+k+")"}).join(";");var body=getVars+";"+value+";"+setVars;var fn2=new Function("__s","$event",body);fn2(eventCapturedScope,event)}else if(hasSignals){var unwrapVars=Object.keys(eventCapturedScope).map(function(k){var v=eventCapturedScope[k];if(v&&typeof v==="function"&&v._isSignal&&value.includes(k+".set(")){return"var "+k+' = __s["'+k+'"]'}return"var "+k+' = __s["'+k+'"] && typeof __s["'+k+'"] === "function" && __s["'+k+'"]._isSignal ? __s["'+k+'"]() : __s["'+k+'"]'}).join(";");var fn3=new Function("__s","$event",unwrapVars+";"+value);fn3(eventCapturedScope,event)}else{var fn=new Function(...Object.keys(eventCapturedScope),"$event",value);fn(...Object.values(eventCapturedScope),event)}}catch(e){if(!(e instanceof ReferenceError)&&!(e instanceof TypeError))console.warn("[STX] Handler error:",value,e)}},{capture:modifiers.includes("capture"),passive:modifiers.includes("passive"),once:modifiers.includes("once")});el.removeAttribute(name)}});if(el.tagName!=="SCRIPT"&&el.tagName!=="STYLE"){var children=Array.from(el.childNodes);children.forEach(function(child){if(child.nodeType!==Node.ELEMENT_NODE){processElement(child,scope);return}if(child.tagName==="SCRIPT")return;if(child.__stx_scope){console.log("[processElement] skip __stx_scope:",child.tagName);return}if(child.hasAttribute&&child.hasAttribute("data-stx-scope"))return;processElement(child,scope)})}};function bindShow(el,expr,passedScope=componentScope,attrName="@show"){if(el.__stx_show_bound)return;el.__stx_show_bound=true;const currentDisplay=el.style.display;const originalDisplay=currentDisplay&&currentDisplay!=="none"?currentDisplay:"";const capturedScope={...passedScope,...findElementScope(el)||{},...globalHelpers};const directSignal=capturedScope[expr];if(directSignal&&directSignal._isSignal){effect(()=>{const value=directSignal();el.style.display=value?originalDisplay:"none"})}else{effect(()=>{var value;try{var unwrapScope=createAutoUnwrapProxy(capturedScope);var fn=new Function(...Object.keys(capturedScope),"return "+expr);value=fn(...Object.values(unwrapScope))}catch(e1){try{var fn2=new Function(...Object.keys(capturedScope),"return "+expr);value=fn2(...Object.values(capturedScope))}catch(e2){if(!(e2 instanceof ReferenceError)&&!(e2 instanceof TypeError))console.warn("[STX] Show expression error:",expr,e2);el.style.display="none";return}};var wasHidden=el.style.display==="none";el.style.display=value?originalDisplay:"none";if(value&&wasHidden){el.__stx_shown_at=performance.now()}})}el.removeAttribute(attrName)};function bindModel(el,expr,passedScope=componentScope,attrName="@model"){if(el.__stx_model_bound)return;el.__stx_model_bound=true;const tag=el.tagName.toLowerCase();const type=el.type;const getValue=()=>toValue(expr,el);const setValue=(val)=>{try{const elementScope=findElementScope(el);const scope={...passedScope,...elementScope||{}};if(scope[expr]&&scope[expr]._isSignal){scope[expr].set(val)}else{const fn=new Function(...Object.keys(scope),"v",expr+" = v");fn(...Object.values(scope),val)}}catch(e){if(!(e instanceof ReferenceError)&&!(e instanceof TypeError))console.warn("[STX] "+attrName+" set error:",expr,e)}};if(tag==="input"&&(type==="checkbox"||type==="radio")){effect(()=>{el.checked=getValue()});el.addEventListener("change",()=>setValue(el.checked))}else if(tag==="select"){effect(()=>{el.value=getValue()});el.addEventListener("change",()=>setValue(el.value))}else{effect(()=>{el.value=getValue()??""});el.addEventListener("input",()=>setValue(el.value))}el.removeAttribute(attrName)};function bindClass(el,expr,passedScope=componentScope){const originalClasses=el.className;const capturedScope={...passedScope,...findElementScope(el)||{},...globalHelpers};const keys=Object.keys(capturedScope);const safeKeys=keys.filter((k)=>/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(k));let fn;try{fn=new Function(...safeKeys,"return "+expr)}catch(e){console.warn("[STX] bindClass compile error:",expr,e);return}effect(()=>{for(let i=0;i<safeKeys.length;i++){const v=capturedScope[safeKeys[i]];if(v&&typeof v==="function"&&(v._isSignal||v._isDerived)){v()}};let value;try{const unwrapScope=createAutoUnwrapProxy(capturedScope);value=fn.apply(null,safeKeys.map((k)=>unwrapScope[k]))}catch(e1){try{value=fn.apply(null,safeKeys.map((k)=>capturedScope[k]))}catch(e2){if(!(e2 instanceof ReferenceError)&&!(e2 instanceof TypeError))console.warn("[STX] Class expression error:",expr,e2);value=""}}if(typeof value==="object"&&value!==null&&!Array.isArray(value)){Object.keys(value).forEach((cls)=>{const tokens=cls.split(/\s+/).filter(Boolean);if(value[cls])tokens.forEach((t)=>el.classList.add(t));else tokens.forEach((t)=>el.classList.remove(t))})}else if(Array.isArray(value)){el.className=originalClasses+" "+value.filter(Boolean).join(" ")}else{el.className=originalClasses+(value?" "+value:"")}})};function bindStyle(el,expr,passedScope=componentScope){const capturedScope={...passedScope,...findElementScope(el)||{},...globalHelpers};const evalExpr=()=>{try{const unwrapScope=createAutoUnwrapProxy(capturedScope);const fn=new Function(...Object.keys(capturedScope),"return "+expr);return fn(...Object.values(unwrapScope))}catch(e1){try{const fn2=new Function(...Object.keys(capturedScope),"return "+expr);return fn2(...Object.values(capturedScope))}catch(e2){if(!(e2 instanceof ReferenceError)&&!(e2 instanceof TypeError))console.warn("[STX] Style expression error:",expr,e2);return{}}}};effect(()=>{const value=evalExpr();if(typeof value==="object"&&value!==null){Object.assign(el.style,value)}else if(typeof value==="string"){el.style.cssText=value}})};function bindFor(el,passedScope=componentScope,attrName="@for"){if(el.__stx_for_bound)return;el.__stx_for_bound=true;const expr=el.getAttribute(attrName);const match=expr.match(/^\s*\(?\s*(\w+)(?:\s*,\s*(\w+))?\s*\)?\s+(?:in|of)\s+(.+)\s*$/);if(!match){console.warn("[STX] Invalid "+attrName+":",expr);return}const[,itemName,indexName,listExpr]=match;const parent=el.parentNode;if(!parent){console.warn("[STX] bindFor: element has no parent, skipping");return};const placeholder=document.createComment("stx-for");const isTemplate=el.tagName==="TEMPLATE";const ifExpr=el.getAttribute("@if")||el.getAttribute(":if");const loadingExpr=el.getAttribute("@loading");const emptyExpr=el.getAttribute("@empty");let loadingTemplate=null;let emptyTemplate=null;let sibling=el.nextElementSibling;while(sibling){if(sibling.hasAttribute("@for-loading")){loadingTemplate=sibling.cloneNode(true);loadingTemplate.removeAttribute("@for-loading");sibling.remove();sibling=el.nextElementSibling;continue}if(sibling.hasAttribute("@for-empty")){emptyTemplate=sibling.cloneNode(true);emptyTemplate.removeAttribute("@for-empty");sibling.remove();sibling=el.nextElementSibling;continue}break};const capturedScope=findElementScope(el)||findElementScope(parent);parent.insertBefore(placeholder,el);parent.removeChild(el);const keyExpr=el.getAttribute(":key")||el.getAttribute("x-bind:key");let templateContent;if(isTemplate){templateContent=el.content}else{const wrapper=el.cloneNode(true);wrapper.removeAttribute("@for");wrapper.removeAttribute(":for");wrapper.removeAttribute("x-for");wrapper.removeAttribute("@loading");wrapper.removeAttribute("@empty");wrapper.removeAttribute(":key");wrapper.removeAttribute("x-bind:key");if(ifExpr){wrapper.removeAttribute("@if");wrapper.removeAttribute(":if");wrapper.removeAttribute("x-if")}templateContent=wrapper};let currentElements=[];let currentKeys=[];let loadingElement=null;let emptyElement=null;const evalExpr=(expression,extraScope={})=>{try{if(/^__[A-Z_]+__$/.test(expression.trim())){return expression};const scope={...passedScope,...capturedScope||{},...globalHelpers,...extraScope};const unwrapScope=createAutoUnwrapProxy(scope);const fn=new Function(...Object.keys(scope),"return "+expression);return fn(...Object.values(unwrapScope))}catch(e){if(!(e instanceof ReferenceError)&&!(e instanceof TypeError))console.warn("[STX] Expression error:",expression,e);return""}};const evalLazy=(expression,extraScope={})=>{try{if(/^__[A-Z_]+__$/.test(expression.trim()))return expression;const scope={...passedScope,...capturedScope||{},...globalHelpers,...extraScope};const unwrapScope=createAutoUnwrapProxy(scope);const fn=new Function("__scope__","with(__scope__) { return "+expression+" }");return fn(unwrapScope)}catch(e){if(!(e instanceof ReferenceError)&&!(e instanceof TypeError))console.warn("[STX] Expression error:",expression,e);return""}};const showLoading=()=>{hideLoading();hideEmpty();if(loadingTemplate){loadingElement=loadingTemplate.cloneNode(true);parent.insertBefore(loadingElement,placeholder)}};const hideLoading=()=>{if(loadingElement){loadingElement.remove();loadingElement=null}};const showEmpty=()=>{hideLoading();hideEmpty();if(emptyTemplate){emptyElement=emptyTemplate.cloneNode(true);parent.insertBefore(emptyElement,placeholder);processElement(emptyElement)}};const hideEmpty=()=>{if(emptyElement){emptyElement.remove();emptyElement=null}};const itemSignalMap=new Map;const createItemElements=(item,index,key)=>{const itemSignal=state(item);const indexSignal=state(index);if(key)itemSignalMap.set(key,{item:itemSignal,index:indexSignal});const itemScope={...passedScope,...capturedScope||{},...globalHelpers};itemScope[itemName]=itemSignal;if(indexName)itemScope[indexName]=indexSignal;const elements=[];if(isTemplate){Array.from(templateContent.childNodes).forEach((node)=>{const clone=node.cloneNode(true);if(clone.nodeType===1){processElement(clone,itemScope);clone.removeAttribute("x-cloak");clone.querySelectorAll("[x-cloak]").forEach((c)=>c.removeAttribute("x-cloak"))}elements.push(clone)})}else{const clone=templateContent.cloneNode(true);processElement(clone,itemScope);clone.removeAttribute("x-cloak");clone.querySelectorAll("[x-cloak]").forEach((c)=>c.removeAttribute("x-cloak"));elements.push(clone)}return elements};const getItemKey=(item,index)=>{if(!keyExpr)return String(index);try{const scope={[itemName]:item};if(indexName)scope[indexName]=index;const fn=new Function(itemName,indexName||"_idx","return "+keyExpr);return String(fn(item,index))}catch(e){return String(index)}};effect(()=>{if(loadingExpr){const isLoading=evalLazy(loadingExpr);if(isLoading){currentElements.forEach((e)=>e.remove());currentElements=[];currentKeys=[];showLoading();return}}hideLoading();const list=evalLazy(listExpr);if(ifExpr){const ifValue=evalLazy(ifExpr);if(!ifValue){currentElements.forEach((e)=>e.remove());currentElements=[];currentKeys=[];hideEmpty();return}}if(!Array.isArray(list))return;if(list.length===0){currentElements.forEach((e)=>e.remove());currentElements=[];currentKeys=[];if(emptyExpr){const emptyContent=evalLazy(emptyExpr);if(emptyContent&&typeof emptyContent==="string"){const textNode=document.createTextNode(emptyContent);parent.insertBefore(textNode,placeholder);currentElements.push(textNode)}}else if(emptyTemplate){showEmpty()}return}hideEmpty();const newKeys=list.map((item,i)=>getItemKey(item,i));const oldKeyMap=new Map;for(let i=0;i<currentKeys.length;i++){const k=currentKeys[i];if(!oldKeyMap.has(k))oldKeyMap.set(k,[]);oldKeyMap.get(k).push(currentElements[i])};const newElements=[];const usedKeys=new Set;for(let i=0;i<list.length;i++){const key=newKeys[i];const existing=oldKeyMap.get(key);if(existing&&existing.length>0&&!usedKeys.has(key)){const el=existing.shift();parent.insertBefore(el,placeholder);newElements.push(el);usedKeys.add(key);const signals=itemSignalMap.get(key);if(signals){signals.item.set(list[i]);signals.index.set(i)}}else{const elements=createItemElements(list[i],i,key);elements.forEach((el)=>parent.insertBefore(el,placeholder));newElements.push(...elements)}}for(const[key,elements]of oldKeyMap){if(!usedKeys.has(key)){elements.forEach((el)=>el.remove());itemSignalMap.delete(key)}}currentElements=newElements;currentKeys=newKeys})};var __bindIfCounter=0;function bindIf(el,passedScope=componentScope,attrName="@if"){if(el.__stx_if_bound){console.log("[stx] bindIf SKIPPED (already bound):",el.getAttribute(attrName)||"(attr removed)","on",el.tagName);return}el.__stx_if_bound=true;const expr=el.getAttribute(attrName);const parent=el.parentNode;if(!parent){console.warn("[STX] bindIf: element has no parent, skipping");return};const placeholder=document.createComment("stx-if");let isInserted=true;let currentNodes=[];const isTemplate=el.tagName==="TEMPLATE";const capturedElementScope=findElementScope(el);const capturedComponentScope={...passedScope};parent.insertBefore(placeholder,el);el.removeAttribute(attrName);if(isTemplate){const content=el.content;currentNodes=Array.from(content.childNodes).map((n)=>n.cloneNode(true));currentNodes.forEach((node)=>parent.insertBefore(node,placeholder.nextSibling));el.remove()};const evalExpr=(expression)=>{try{if(/^__[A-Z_]+__$/.test(expression.trim())){return expression};const scope={...capturedComponentScope,...capturedElementScope||{},...globalHelpers};const unwrapScope=createAutoUnwrapProxy(scope);const fn=new Function(...Object.keys(scope),"return "+expression);return fn(...Object.values(unwrapScope))}catch(e){if(!(e instanceof ReferenceError)&&!(e instanceof TypeError))console.warn("[STX] Expression error:",expression,e);return""}};let childrenProcessed=false;const processChildrenWithScope=()=>{const childScope={...capturedComponentScope,...capturedElementScope||{},...globalHelpers};Array.from(el.childNodes).forEach((child)=>processElement(child,childScope));childrenProcessed=true};const fullScope={...capturedComponentScope,...capturedElementScope||{},...globalHelpers};const directSignal=fullScope[expr];if(directSignal){console.log("[stx] bindIf direct signal for :if="+expr,"signal identity:",directSignal===componentScope[expr]?"SAME":"DIFFERENT","signal():",directSignal())}effect(()=>{var value;if(directSignal&&(directSignal._isSignal||directSignal._isDerived)){value=directSignal();console.log("[stx] bindIf effect (direct):",expr,"→",value,"isInserted:",isInserted)}else{for(var sk in fullScope){var sv=fullScope[sk];if(sv&&typeof sv==="function"&&(sv._isSignal||sv._isDerived))sv()}value=evalExpr(expr)}if(isTemplate){if(value&&!isInserted){currentNodes=Array.from(el.content.childNodes).map((n)=>n.cloneNode(true));currentNodes.forEach((node)=>parent.insertBefore(node,placeholder.nextSibling));const childScope={...componentScope,...capturedElementScope||{}};currentNodes.forEach((node)=>{if(node.nodeType===1){processElement(node,childScope);node.removeAttribute("x-cloak");node.querySelectorAll("[x-cloak]").forEach((c)=>c.removeAttribute("x-cloak"))}});currentNodes.forEach(function(n){if(n.nodeType===1)n.__stx_shown_at=performance.now()});isInserted=true}else if(!value&&isInserted){currentNodes.forEach((node)=>node.remove());currentNodes=[];isInserted=false}}else{if(value&&!isInserted){console.log("[stx] bindIf INSERTING element for :if="+expr);parent.insertBefore(el,placeholder.nextSibling);el.__stx_shown_at=performance.now();isInserted=true}else if(!value&&isInserted){console.log("[stx] bindIf REMOVING element for :if="+expr,"el.isConnected:",el.isConnected,"parent:",parent.tagName);el.remove();isInserted=false;console.log("[stx] bindIf REMOVED, el.isConnected:",el.isConnected)}if(value&&isInserted&&!childrenProcessed){childrenProcessed=true;setTimeout(function(){var childScope={...capturedComponentScope,...capturedElementScope||{},...globalHelpers};processElement(el,childScope);el.removeAttribute("x-cloak");el.querySelectorAll("[x-cloak]").forEach(function(c){c.removeAttribute("x-cloak")})},0)}}})};function $computed(fn){return derived(fn)};function $watch(deps,fn){effect(()=>{const values=Array.isArray(deps)?deps.map((d)=>{if(typeof d==="function"&&(d._isSignal||d._isDerived))return d();return d}):typeof deps==="function"&&(deps._isSignal||deps._isDerived)?[deps()]:[deps];fn(...values)})};function provide(name,value){window[name]=value};function useDebounce(fn,delay){delay=delay||250;var timer=null;var lastArgs=null;var debounced=function(){lastArgs=Array.prototype.slice.call(arguments);if(timer!==null)clearTimeout(timer);var args=lastArgs;timer=setTimeout(function(){timer=null;lastArgs=null;fn.apply(null,args)},delay)};debounced.cancel=function(){if(timer!==null){clearTimeout(timer);timer=null;lastArgs=null}};debounced.flush=function(){if(timer!==null&&lastArgs!==null){clearTimeout(timer);timer=null;var args=lastArgs;lastArgs=null;fn.apply(null,args)}};debounced.pending=function(){return timer!==null};onDestroy(debounced.cancel);return debounced};function useDebouncedValue(getter,delay){delay=delay||250;var current=getter();var listeners=[];var timer=null;function schedule(){if(timer!==null)clearTimeout(timer);timer=setTimeout(function(){timer=null;var next=getter();if(next!==current){current=next;listeners.forEach(function(fn){fn(current)})}},delay)}schedule();onDestroy(function(){if(timer!==null)clearTimeout(timer);listeners=[]});return{get value(){return current},subscribe:function(fn){listeners.push(fn);return function(){listeners=listeners.filter(function(f){return f!==fn})}}}};function useThrottle(fn,limit){limit=limit||250;var timer=null;var lastRan=0;var throttled=function(){var args=Array.prototype.slice.call(arguments);var now=Date.now();var remaining=limit-(now-lastRan);if(remaining<=0){if(timer!==null){clearTimeout(timer);timer=null}lastRan=now;fn.apply(null,args)}else if(timer===null){timer=setTimeout(function(){lastRan=Date.now();timer=null;fn.apply(null,args)},remaining)}};throttled.cancel=function(){if(timer!==null){clearTimeout(timer);timer=null}};onDestroy(throttled.cancel);return throttled};function useInterval(interval,options){interval=interval||1000;options=options||{};var count=0;var id=null;var running=false;var listeners=[];function tick(){count++;listeners.forEach(function(fn){fn(count)})};function resume(){if(running)return;running=true;id=setInterval(tick,interval);if(options.immediate)tick()};function pause(){if(!running)return;running=false;if(id!==null){clearInterval(id);id=null}};function reset(){pause();count=0;listeners.forEach(function(fn){fn(count)});resume()}resume();onDestroy(function(){pause();listeners=[]});return{get counter(){return count},pause,resume,reset,subscribe:function(fn){listeners.push(fn);return function(){listeners=listeners.filter(function(f){return f!==fn})}}}};function useTimeout(callback,delay){delay=delay||1000;var timer=null;var pending=false;var listeners=[];function setPending(v){if(v!==pending){pending=v;listeners.forEach(function(fn){fn(pending)})}};function start(){stop();setPending(true);timer=setTimeout(function(){timer=null;setPending(false);callback()},delay)};function stop(){if(timer!==null){clearTimeout(timer);timer=null}setPending(false)}start();onDestroy(stop);return{get isPending(){return pending},start,stop,subscribe:function(fn){listeners.push(fn);return function(){listeners=listeners.filter(function(f){return f!==fn})}}}};function useToggle(initial){var current=!!initial;var listeners=[];function notify(){listeners.forEach(function(fn){fn(current)})};function toggle(){current=!current;notify()};function set(v){v=!!v;if(v!==current){current=v;notify()}};var ref={get value(){return current},subscribe:function(fn){listeners.push(fn);return function(){listeners=listeners.filter(function(f){return f!==fn})}}};return[ref,toggle,set]};function useCounter(initial,options){initial=initial||0;options=options||{};var min=options.min!=null?options.min:-1/0;var max=options.max!=null?options.max:1/0;function clamp(v){return Math.min(max,Math.max(min,v))};var current=clamp(initial);var listeners=[];function notify(){listeners.forEach(function(fn){fn(current)})}return{get count(){return current},inc:function(step){current=clamp(current+(step||1));notify()},dec:function(step){current=clamp(current-(step||1));notify()},set:function(v){current=clamp(v);notify()},reset:function(){current=clamp(initial);notify()},subscribe:function(fn){listeners.push(fn);return function(){listeners=listeners.filter(function(f){return f!==fn})}}}};function useClickOutside(target,handler){function listener(event){var el=typeof target==="string"?document.querySelector(target):target;if(!el)return;if(el===event.target||el.contains(event.target))return;handler(event)}document.addEventListener("pointerdown",listener,true);function remove(){document.removeEventListener("pointerdown",listener,true)}onDestroy(remove);return{remove}};function useFocus(target){var focused=false;var listeners=[];function resolve(){return typeof target==="string"?document.querySelector(target):target};function setFocused(v){if(v!==focused){focused=v;listeners.forEach(function(fn){fn(focused)})}};var onFocusIn=function(){setFocused(true)};var onBlurOut=function(){setFocused(false)};var el=resolve();if(el){el.addEventListener("focus",onFocusIn);el.addEventListener("blur",onBlurOut);focused=document.activeElement===el}onDestroy(function(){var el=resolve();if(el){el.removeEventListener("focus",onFocusIn);el.removeEventListener("blur",onBlurOut)}listeners=[]});return{get isFocused(){return focused},focus:function(){var el=resolve();if(el&&el.focus)el.focus()},blur:function(){var el=resolve();if(el&&el.blur)el.blur()},subscribe:function(fn){listeners.push(fn);return function(){listeners=listeners.filter(function(f){return f!==fn})}}}};function useAsync(fn,options){options=options||{};var asyncState="idle";var data=null;var error=null;var listeners=[];function notify(){var snap={state:asyncState,data,error};listeners.forEach(function(fn){fn(snap)})};function execute(){var args=Array.prototype.slice.call(arguments);asyncState="loading";error=null;notify();return fn.apply(null,args).then(function(result){data=result;asyncState="success";notify();return data}).catch(function(e){error=e instanceof Error?e:new Error(String(e));asyncState="error";notify();return null})}if(options.immediate)execute();return{get state(){return asyncState},get isLoading(){return asyncState==="loading"},get error(){return error},get data(){return data},execute,subscribe:function(fn){listeners.push(fn);return function(){listeners=listeners.filter(function(f){return f!==fn})}}}};function useColorMode(options){options=options||{};var storageKey=options.storageKey||"stx-color-mode";var initialMode=options.initialMode||"auto";var darkClass=options.darkClass||"dark";var attribute=options.attribute||null;var disableTransitions=options.disableTransitions!==false;var preference=initialMode;var resolved="light";var listeners=[];var cleanups=[];function getSystem(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"};function resolve(pref){return pref==="auto"?getSystem():pref};function applyDOM(mode){var el=document.documentElement;if(disableTransitions)el.style.setProperty("transition","none","important");if(attribute){el.setAttribute(attribute,mode)}else{if(mode==="dark")el.classList.add(darkClass);else el.classList.remove(darkClass)}if(disableTransitions){el.offsetHeight;el.style.removeProperty("transition")}};function persist(pref){try{localStorage.setItem(storageKey,pref)}catch(e){}};function readPersisted(){try{var v=localStorage.getItem(storageKey);if(v==="light"||v==="dark"||v==="auto")return v}catch(e){}return null};function update(pref){preference=pref;resolved=resolve(pref);applyDOM(resolved);persist(pref);listeners.forEach(function(fn){fn(resolved,preference)})};var persisted=readPersisted();update(persisted||initialMode);var mql=window.matchMedia("(prefers-color-scheme: dark)");var onSystemChange=function(){if(preference==="auto"){resolved=getSystem();applyDOM(resolved);listeners.forEach(function(fn){fn(resolved,preference)})}};mql.addEventListener("change",onSystemChange);cleanups.push(function(){mql.removeEventListener("change",onSystemChange)});var onStorage=function(e){if(e.key!==storageKey)return;var v=e.newValue;if(v==="light"||v==="dark"||v==="auto"){preference=v;resolved=resolve(v);applyDOM(resolved);listeners.forEach(function(fn){fn(resolved,preference)})}};window.addEventListener("storage",onStorage);cleanups.push(function(){window.removeEventListener("storage",onStorage)});onDestroy(function(){cleanups.forEach(function(fn){fn()});listeners=[]});return{get mode(){return resolved},get preference(){return preference},get isDark(){return resolved==="dark"},set:function(mode){update(mode)},toggle:function(){update(resolved==="dark"?"light":"dark")},subscribe:function(fn){listeners.push(fn);return function(){listeners=listeners.filter(function(f){return f!==fn})}}}};function useDark(options){var cm=useColorMode(options);return{get isDark(){return cm.isDark},toggle:function(){cm.toggle()},set:function(dark){cm.set(dark?"dark":"light")},subscribe:function(fn){return cm.subscribe(function(mode){fn(mode==="dark")})}}};var ref=state;var reactive=state;var computed=derived;var watch=$watch;var watchEffect=function(fn){return effect(fn)};function useLocalStorage(key,defaultValue){var stored=localStorage.getItem(key);var initial=stored!==null?JSON.parse(stored):defaultValue;var s=state(initial);effect(function(){localStorage.setItem(key,JSON.stringify(s()))});var handler=function(e){if(e.key===key)s.set(e.newValue!==null?JSON.parse(e.newValue):defaultValue)};window.addEventListener("storage",handler);onDestroy(function(){window.removeEventListener("storage",handler)});return s};function useEventListener(event,handler,options){var target=options&&options.target||window;if(typeof target==="string")target=document.querySelector(target);if(!target)return;var opts={capture:options&&options.capture,passive:options&&options.passive,once:options&&options.once};target.addEventListener(event,handler,opts);onDestroy(function(){target.removeEventListener(event,handler,opts)})};function useHead(config){function apply(){if(config.title)document.title=config.title;var metas=config.meta||[];for(var i=0;i<metas.length;i++){var m=metas[i];if(!m.name&&!m.property)continue;var selector=m.name?'meta[name="'+m.name+'"]':'meta[property="'+m.property+'"]';var el=document.querySelector(selector);if(el){el.setAttribute("content",m.content||"")}else{el=document.createElement("meta");if(m.name)el.setAttribute("name",m.name);if(m.property)el.setAttribute("property",m.property);el.setAttribute("content",m.content||"");document.head.appendChild(el)}};var links=config.link||config.links||[];for(var j=0;j<links.length;j++){var l=links[j];if(!l.rel||!l.href)continue;var linkSel='link[rel="'+l.rel+'"][href="'+l.href+'"]';if(!document.querySelector(linkSel)){var le=document.createElement("link");for(var k in l){if(l.hasOwnProperty(k))le.setAttribute(k,l[k])}document.head.appendChild(le)}};var scripts=config.script||config.scripts||[];for(var si=0;si<scripts.length;si++){var s=scripts[si];var se=document.createElement("script");if(s.src)se.src=s.src;if(s.innerHTML)se.innerHTML=s.innerHTML;if(s.async)se.async=true;if(s.defer)se.defer=true;document.head.appendChild(se)}if(config.bodyAttrs&&config.bodyAttrs.class){config.bodyAttrs.class.split(" ").forEach(function(cls){if(cls)document.body.classList.add(cls)})}if(config.htmlAttrs&&config.htmlAttrs.lang){document.documentElement.setAttribute("lang",config.htmlAttrs.lang)}}if(document.readyState!=="loading"){apply()}else{onMount(apply)}};function useSeoMeta(config){var meta=[];if(config.title)meta.push({name:"title",content:config.title});if(config.description)meta.push({name:"description",content:config.description});if(config.ogTitle)meta.push({property:"og:title",content:config.ogTitle});if(config.ogDescription)meta.push({property:"og:description",content:config.ogDescription});if(config.ogImage)meta.push({property:"og:image",content:config.ogImage});if(config.ogType)meta.push({property:"og:type",content:config.ogType});if(config.ogUrl)meta.push({property:"og:url",content:config.ogUrl});if(config.twitterCard)meta.push({name:"twitter:card",content:config.twitterCard});if(config.twitterTitle)meta.push({name:"twitter:title",content:config.twitterTitle});if(config.twitterDescription)meta.push({name:"twitter:description",content:config.twitterDescription});if(config.twitterImage)meta.push({name:"twitter:image",content:config.twitterImage});if(config.robots)meta.push({name:"robots",content:config.robots});if(config.canonical)meta.push({property:"og:url",content:config.canonical});useHead({title:config.title||config.ogTitle,meta})};var _toastId=0;var _toastIcons={success:'<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#16a34a" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M9 12l2 2 4-4"/></svg>',error:'<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#dc2626" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="15" y1="9" x2="9" y2="15"/><line x1="9" y1="9" x2="15" y2="15"/></svg>',info:'<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#2563eb" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>',warning:'<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#d97706" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>'};var _toastColors={success:"#16a34a",error:"#dc2626",info:"#2563eb",warning:"#d97706"};function _getToastContainer(){return document.getElementById("stx-toast-container")};function _getToastAnimClass(container){if(!container)return{inAnim:"stx-toast-in",outAnim:"stx-toast-out"};var pos=container.getAttribute("data-stx-toast-position")||"top-right";if(pos.indexOf("left")!==-1)return{inAnim:"stx-toast-in-left",outAnim:"stx-toast-out-left"};if(pos.indexOf("center")!==-1)return{inAnim:"stx-toast-in-center",outAnim:"stx-toast-out-center"};return{inAnim:"stx-toast-in",outAnim:"stx-toast-out"}};function removeToast(id){var el=document.getElementById("stx-toast-"+id);if(!el)return;var container=_getToastContainer();var anims=_getToastAnimClass(container);el.style.animation=anims.outAnim+" 0.3s ease forwards";setTimeout(function(){if(el.parentNode)el.parentNode.removeChild(el)},300)};function addToast(type,message,options){var container=_getToastContainer();if(!container){console.warn("[stx:toast] No <StxToast /> container found. Add <StxToast /> to your layout.");return-1};var opts=options||{};var duration=opts.duration!==undefined?opts.duration:3000;var id=++_toastId;var maxToasts=parseInt(container.getAttribute("data-stx-toast-max")||"5",10);var existing=container.querySelectorAll("[data-stx-toast]");while(existing.length>=maxToasts&&existing.length>0){var oldId=existing[0].getAttribute("data-stx-toast");removeToast(oldId);existing=container.querySelectorAll("[data-stx-toast]")};var anims=_getToastAnimClass(container);var borderColor=_toastColors[type]||_toastColors.info;var icon=_toastIcons[type]||_toastIcons.info;var isDark=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches;var bg=isDark?"#1f2937":"#ffffff";var textColor=isDark?"#f3f4f6":"#1f2937";var shadow=isDark?"0 4px 12px rgba(0,0,0,0.4)":"0 4px 12px rgba(0,0,0,0.15)";var el=document.createElement("div");el.id="stx-toast-"+id;el.setAttribute("data-stx-toast",String(id));el.setAttribute("role","alert");el.setAttribute("aria-live","assertive");el.style.cssText="pointer-events:auto;display:flex;align-items:flex-start;gap:0.75rem;padding:0.875rem 1rem;border-radius:0.5rem;border-left:4px solid "+borderColor+";background:"+bg+";color:"+textColor+";box-shadow:"+shadow+";animation:"+anims.inAnim+" 0.3s ease;font-family:system-ui,-apple-system,sans-serif;font-size:0.875rem;line-height:1.4;max-width:100%";var iconSpan=document.createElement("span");iconSpan.style.cssText="flex-shrink:0;display:flex;align-items:center;margin-top:1px";iconSpan.innerHTML=icon;var msgSpan=document.createElement("span");msgSpan.style.cssText="flex:1;word-wrap:break-word";msgSpan.textContent=message;var closeBtn=document.createElement("button");closeBtn.type="button";closeBtn.setAttribute("aria-label","Dismiss notification");closeBtn.style.cssText="flex-shrink:0;background:none;border:none;cursor:pointer;padding:0;color:"+(isDark?"#9ca3af":"#6b7280")+";font-size:1.125rem;line-height:1;display:flex;align-items:center";closeBtn.innerHTML='<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor"><path d="M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"/></svg>';closeBtn.onclick=function(){removeToast(id)};el.appendChild(iconSpan);el.appendChild(msgSpan);el.appendChild(closeBtn);container.appendChild(el);if(duration>0){setTimeout(function(){removeToast(id)},duration)}return id};var toast={success:function(message,options){return addToast("success",message,options)},error:function(message,options){return addToast("error",message,options)},info:function(message,options){return addToast("info",message,options)},warning:function(message,options){return addToast("warning",message,options)},dismiss:function(id){if(id!==undefined){removeToast(id);return};var container=_getToastContainer();if(!container)return;var all=container.querySelectorAll("[data-stx-toast]");for(var i=0;i<all.length;i++){var tid=all[i].getAttribute("data-stx-toast");removeToast(tid)}}};var modal={open:function(id){var el=document.querySelector('[data-stx-modal="'+id+'"]');if(!el){console.warn('[stx:modal] Modal "'+id+'" not found');return}el.style.display="flex";el.offsetHeight;el.setAttribute("data-stx-modal-open","");document.body.style.overflow="hidden";if(el.getAttribute("data-close-escape")!=="false"){var escHandler=function(e){if(e.key==="Escape"){modal.close(id);document.removeEventListener("keydown",escHandler)}};document.addEventListener("keydown",escHandler);el._stxEscHandler=escHandler}if(el.getAttribute("data-close-backdrop")!=="false"){el.onclick=function(e){if(e.target===el)modal.close(id)}}},close:function(id){var el=document.querySelector('[data-stx-modal="'+id+'"]');if(!el)return;el.removeAttribute("data-stx-modal-open");if(el._stxEscHandler){document.removeEventListener("keydown",el._stxEscHandler);el._stxEscHandler=null}el.onclick=null;setTimeout(function(){el.style.display="none";if(!document.querySelector("[data-stx-modal-open]"))document.body.style.overflow=""},200)},toggle:function(id){var el=document.querySelector('[data-stx-modal="'+id+'"]');if(el&&el.hasAttribute("data-stx-modal-open"))modal.close(id);else modal.open(id)}};var _dialogId=0;var _dialogIcons={info:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#2563eb" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>',warning:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#d97706" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>',error:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#dc2626" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="15" y1="9" x2="9" y2="15"/><line x1="9" y1="9" x2="15" y2="15"/></svg>',success:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#16a34a" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M9 12l2 2 4-4"/></svg>',question:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#6366f1" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 015.83 1c0 2-3 3-3 3"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>'};function _createDialog(message,options,isConfirm){var opts=options||{};var type=opts.type||(isConfirm?"question":"info");var title=opts.title||"";var confirmText=opts.confirmText||"OK";var cancelText=opts.cancelText||"Cancel";var id="stx-dialog-"+ ++_dialogId;var isDark=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches;var bg=isDark?"#1f2937":"#ffffff";var textColor=isDark?"#f3f4f6":"#1f2937";var subColor=isDark?"#9ca3af":"#6b7280";var icon=_dialogIcons[type]||_dialogIcons.info;return new Promise(function(resolve){var backdrop=document.createElement("div");backdrop.id=id;backdrop.style.cssText="position:fixed;inset:0;z-index:999999;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease;font-family:system-ui,-apple-system,sans-serif";backdrop.setAttribute("role","alertdialog");backdrop.setAttribute("aria-modal","true");var panel=document.createElement("div");panel.style.cssText="max-width:24rem;width:calc(100% - 2rem);border-radius:0.75rem;padding:1.5rem;background:"+bg+";color:"+textColor+";box-shadow:0 20px 60px rgba(0,0,0,0.3);transform:scale(0.95);transition:transform 0.2s ease;text-align:center";var iconDiv=document.createElement("div");iconDiv.style.cssText="display:flex;justify-content:center;margin-bottom:1rem";iconDiv.innerHTML=icon;panel.appendChild(iconDiv);if(title){var titleEl=document.createElement("h3");titleEl.style.cssText="margin:0 0 0.5rem;font-size:1.125rem;font-weight:600";titleEl.textContent=title;panel.appendChild(titleEl)};var msgEl=document.createElement("p");msgEl.style.cssText="margin:0 0 1.25rem;font-size:0.875rem;line-height:1.5;color:"+subColor;msgEl.textContent=message;panel.appendChild(msgEl);var btnRow=document.createElement("div");btnRow.style.cssText="display:flex;gap:0.75rem;justify-content:center";function cleanup(result){backdrop.style.opacity="0";panel.style.transform="scale(0.95)";setTimeout(function(){backdrop.remove()},200);resolve(result)}if(isConfirm){var cancelBtn=document.createElement("button");cancelBtn.textContent=cancelText;cancelBtn.style.cssText="padding:0.5rem 1.25rem;border-radius:0.5rem;font-size:0.875rem;font-weight:500;cursor:pointer;border:1px solid "+(isDark?"#374151":"#d1d5db")+";background:transparent;color:"+textColor+";transition:background 0.15s";cancelBtn.onmouseover=function(){this.style.background=isDark?"#374151":"#f3f4f6"};cancelBtn.onmouseout=function(){this.style.background="transparent"};cancelBtn.onclick=function(){cleanup(false)};btnRow.appendChild(cancelBtn)};var okBtn=document.createElement("button");okBtn.textContent=confirmText;var btnColor=type==="error"?"#dc2626":type==="warning"?"#d97706":"#5672cd";okBtn.style.cssText="padding:0.5rem 1.25rem;border-radius:0.5rem;font-size:0.875rem;font-weight:500;cursor:pointer;border:none;background:"+btnColor+";color:#fff;transition:opacity 0.15s";okBtn.onmouseover=function(){this.style.opacity="0.9"};okBtn.onmouseout=function(){this.style.opacity="1"};okBtn.onclick=function(){cleanup(isConfirm?true:undefined)};btnRow.appendChild(okBtn);panel.appendChild(btnRow);backdrop.appendChild(panel);document.body.appendChild(backdrop);backdrop.offsetHeight;backdrop.style.opacity="1";panel.style.transform="scale(1)";var escHandler=function(e){if(e.key==="Escape"){cleanup(isConfirm?false:undefined);document.removeEventListener("keydown",escHandler)}};document.addEventListener("keydown",escHandler);okBtn.focus()})};function stxAlert(message,options){return _createDialog(message,options,false)};function stxConfirm(message,options){return _createDialog(message,options,true)};var drawer={open:function(id){var el=document.querySelector('[data-stx-drawer="'+id+'"]');if(!el){console.warn('[stx:drawer] Drawer "'+id+'" not found');return}el.style.display="flex";el.offsetHeight;el.setAttribute("data-stx-drawer-open","");document.body.style.overflow="hidden";if(el.getAttribute("data-close-escape")!=="false"){var escHandler=function(e){if(e.key==="Escape"){drawer.close(id);document.removeEventListener("keydown",escHandler)}};document.addEventListener("keydown",escHandler);el._stxEscHandler=escHandler}if(el.getAttribute("data-close-backdrop")!=="false"){el.onclick=function(e){if(e.target===el)drawer.close(id)}}},close:function(id){var el=document.querySelector('[data-stx-drawer="'+id+'"]');if(!el)return;el.removeAttribute("data-stx-drawer-open");if(el._stxEscHandler){document.removeEventListener("keydown",el._stxEscHandler);el._stxEscHandler=null}el.onclick=null;setTimeout(function(){el.style.display="none";if(!document.querySelector("[data-stx-drawer-open]")&&!document.querySelector("[data-stx-modal-open]"))document.body.style.overflow=""},300)},toggle:function(id){var el=document.querySelector('[data-stx-drawer="'+id+'"]');if(el&&el.hasAttribute("data-stx-drawer-open"))drawer.close(id);else drawer.open(id)}};(function(){var tip=null;function createTip(){tip=document.createElement("div");tip.id="stx-tooltip";tip.style.cssText="position:absolute;z-index:999999;pointer-events:none;background:#1f2937;color:#fff;font-size:12px;line-height:1.4;padding:6px 10px;border-radius:6px;max-width:250px;word-wrap:break-word;opacity:0;transition:opacity 0.15s ease;white-space:pre-wrap;box-shadow:0 2px 8px rgba(0,0,0,0.2)";document.body.appendChild(tip)};function show(el){if(!tip)createTip();var text=el.getAttribute("x-tooltip");if(!text)return;tip.textContent=text;tip.style.display="block";tip.style.opacity="0";var pos=el.getAttribute("x-tooltip-position")||"top";var rect=el.getBoundingClientRect();var tw=tip.offsetWidth;var th=tip.offsetHeight;var sx=window.scrollX;var sy=window.scrollY;var left,top;if(pos==="bottom"){left=rect.left+rect.width/2-tw/2;top=rect.bottom+8}else if(pos==="left"){left=rect.left-tw-8;top=rect.top+rect.height/2-th/2}else if(pos==="right"){left=rect.right+8;top=rect.top+rect.height/2-th/2}else{left=rect.left+rect.width/2-tw/2;top=rect.top-th-8;if(top<0){top=rect.bottom+8}}if(left<4)left=4;if(left+tw>window.innerWidth-4)left=window.innerWidth-tw-4;tip.style.left=left+sx+"px";tip.style.top=top+sy+"px";tip.style.opacity="1"};function hide(){if(tip){tip.style.opacity="0";setTimeout(function(){if(tip)tip.style.display="none"},150)}}document.addEventListener("mouseover",function(e){var el=e.target.closest("[x-tooltip]");if(el)show(el)});document.addEventListener("mouseout",function(e){var el=e.target.closest("[x-tooltip]");if(el)hide()});document.addEventListener("focusin",function(e){var el=e.target.closest("[x-tooltip]");if(el)show(el)});document.addEventListener("focusout",function(e){var el=e.target.closest("[x-tooltip]");if(el)hide()})})();var mountQueue=[];window.stx={state,derived,effect,batch,isSignal,untrack,peek,onMount,onDestroy,useFetch,useRef,navigate,goBack,goForward,useRoute,setRouteParams,useSearchParams,useQuery,useMutation,provide,$computed,$watch,ref,reactive,computed,watch,watchEffect,useDebounce,useDebouncedValue,useThrottle,useInterval,useTimeout,useToggle,useCounter,useClickOutside,useFocus,useAsync,useLocalStorage,useEventListener,useWebSocket,useColorMode,useDark,useHead,useSeoMeta,toast,modal,drawer,alert:stxAlert,confirm:stxConfirm,helpers:globalHelpers,defineProps:function(definitions){var props=window.__STX_CURRENT_PROPS__||{};if(!definitions)return props;var result=Object.assign({},props);for(var key in definitions){if(!definitions.hasOwnProperty(key))continue;var def=definitions[key];var opts=typeof def==="function"||Array.isArray(def)?{type:def}:def||{};if(result[key]===undefined&&opts["default"]!==undefined){result[key]=typeof opts["default"]==="function"?opts["default"]():opts["default"]}}return result},withDefaults:function(props,defaults){var result=Object.assign({},props);for(var key in defaults){if(!defaults.hasOwnProperty(key))continue;if(result[key]===undefined){result[key]=typeof defaults[key]==="function"?defaults[key]():defaults[key]}}return result},defineEmits:function(){var el=window.__STX_CURRENT_ELEMENT__||null;return function(event,payload){var target=el||document.body;target.dispatchEvent(new CustomEvent(event,{detail:payload,bubbles:true,cancelable:true}))}},defineExpose:function(exposed){var el=window.__STX_CURRENT_ELEMENT__;if(el)el.__stx_exposed=exposed},_mountCallbacks:mountCallbacks,_destroyCallbacks:destroyCallbacks,_cleanupContainer:cleanupContainer,_scopes:{},_scopeCounter:0,_latestSetup:null,_stores:new Map,defineStore:function(id,setupOrOptions,storeOptions){console.log("[stx:store] defineStore called:",id,"type:",typeof setupOrOptions==="function"?"setup":"options","persist:",!!(storeOptions&&storeOptions.persist));if(window.stx._stores.has(id)){console.log("[stx:store] returning existing store:",id);return window.stx._stores.get(id)};var setupFn;if(typeof setupOrOptions==="function"){setupFn=setupOrOptions}else{var opts=setupOrOptions;setupFn=function(){var result={};var initialState=typeof opts.state==="function"?opts.state():opts.state||{};var stateSignals={};for(var key in initialState){stateSignals[key]=state(initialState[key]);result[key]=stateSignals[key]}if(opts.getters){for(var gKey in opts.getters){(function(getterKey,getterFn){result[getterKey]=derived(function(){var snapshot={};for(var sk in stateSignals){snapshot[sk]=stateSignals[sk]()}return getterFn(snapshot)})})(gKey,opts.getters[gKey])}}if(opts.actions){for(var aKey in opts.actions){(function(actionKey,actionFn){result[actionKey]=function(){var proxy=new Proxy({},{get:function(_,p){if(result[p]&&result[p]._isSignal)return result[p]();if(result[p])return result[p];return},set:function(_,p,v){if(result[p]&&result[p]._isSignal){result[p].set(v);return true}return false}});return actionFn.apply(proxy,arguments)}})(aKey,opts.actions[aKey])}}return result}};var prevDisposers=activeDisposers;activeDisposers=null;var result;try{result=setupFn()}finally{activeDisposers=prevDisposers};var signalKeys=[];var actionKeys=[];for(var dk in result){if(result[dk]&&result[dk]._isSignal)signalKeys.push(dk);else if(typeof result[dk]==="function")actionKeys.push(dk)}console.log("[stx:store] setup complete:",id,"signals:",signalKeys,"actions:",actionKeys);var _initialValues={};for(var k in result){if(result[k]&&result[k]._isSignal){_initialValues[k]=result[k]()}}result.$id=id;result.$reset=function(){batch(function(){for(var rk in _initialValues){if(result[rk]&&result[rk]._isSignal)result[rk].set(_initialValues[rk])}})};result.$patch=function(partial){batch(function(){for(var pk in partial){if(result[pk]&&result[pk]._isSignal)result[pk].set(partial[pk])}})};result.$subscribe=function(cb){var unsubs=[];for(var sk in result){if(result[sk]&&result[sk]._isSignal&&result[sk].subscribe){unsubs.push(result[sk].subscribe(function(){var snapshot={};for(var ssk in result){if(result[ssk]&&result[ssk]._isSignal)snapshot[ssk]=result[ssk]()}cb(snapshot)}))}}return function(){unsubs.forEach(function(u){u()})}};result.$dispose=function(){window.stx._stores.delete(id);if(window.__STX_STORES__)delete window.__STX_STORES__[id]};var hydrationData=window.__STX_STORE_STATE__&&window.__STX_STORE_STATE__[id];if(hydrationData){console.log("[stx:store] hydrating from SSR:",id,Object.keys(hydrationData));batch(function(){for(var hk in hydrationData){if(result[hk]&&result[hk]._isSignal)result[hk].set(hydrationData[hk])}})};var persistCfg=storeOptions&&storeOptions.persist;if(persistCfg){var pOpts=persistCfg===true?{}:persistCfg;var storageKey=pOpts.key||"stx-store-"+id;var storageType=pOpts.storage==="sessionStorage"?sessionStorage:localStorage;var pick=pOpts.pick||null;try{var saved=storageType.getItem(storageKey);if(saved){var parsed=JSON.parse(saved);console.log("[stx:store] restoring persisted state:",id,"key:",storageKey,Object.keys(parsed));batch(function(){for(var pk in parsed){if(result[pk]&&result[pk]._isSignal&&(!pick||pick.indexOf(pk)!==-1)){result[pk].set(parsed[pk])}}})}else{console.log("[stx:store] no persisted state found:",id,"key:",storageKey)}}catch(e){console.warn("[stx:store] persistence read error:",id,e)};var writeTimer=null;var prevPersistDisposers=activeDisposers;activeDisposers=null;effect(function(){var snapshot={};for(var wk in result){if(result[wk]&&result[wk]._isSignal&&(!pick||pick.indexOf(wk)!==-1)){snapshot[wk]=result[wk]()}}if(writeTimer)clearTimeout(writeTimer);writeTimer=setTimeout(function(){console.log("[stx:store] persisting:",id,"key:",storageKey,Object.keys(snapshot));try{storageType.setItem(storageKey,JSON.stringify(snapshot))}catch(e){console.warn("[stx:store] persist write error:",id,e)}},100)});activeDisposers=prevPersistDisposers}result._isStxStore=true;window.stx._stores.set(id,result);window.__STX_STORES__=window.__STX_STORES__||{};window.__STX_STORES__[id]=result;console.log("[stx:store] registered:",id,"total stores:",window.stx._stores.size);return result},useStore:function(id){var store=window.stx._stores.get(id);if(!store&&window.__STX_STORES__){store=window.__STX_STORES__[id]}if(!store){console.error("[stx:store] Store not found:",id,"available:",Array.from(window.stx._stores.keys()));throw new Error('[stx] Store "'+id+'" not found. Define it with defineStore() first.')}console.log("[stx:store] useStore:",id);return store},mountEl:function(selector,setupFn){function doMount(){var root=document.querySelector(selector);if(!root){console.warn("[stx] mountEl: element not found:",selector);return};var prevProps=window.__STX_CURRENT_PROPS__;var prevEl=window.__STX_CURRENT_ELEMENT__;var propsAttr=root.getAttribute&&root.getAttribute("data-stx-props");window.__STX_CURRENT_PROPS__=root.__stx_props||(propsAttr?JSON.parse(propsAttr):{});window.__STX_CURRENT_ELEMENT__=root;var mountStart=mountCallbacks.length;var destroyStart=destroyCallbacks.length;var scope=setupFn();window.__STX_CURRENT_PROPS__=prevProps;window.__STX_CURRENT_ELEMENT__=prevEl;var localMountHooks=mountCallbacks.splice(mountStart);var localDestroyHooks=destroyCallbacks.splice(destroyStart);if(typeof scope==="object"&&scope!==null){scope.$el=root;scope.$refs=scope.$refs||{};root.__stx_scope=scope};var disposeEffects=trackEffects(function(){processElement(root,scope||componentScope)});root.__stx_disposers=disposeEffects;root.removeAttribute("x-cloak");root.querySelectorAll("[x-cloak]").forEach(function(el){el.removeAttribute("x-cloak")});localMountHooks.forEach(function(fn){try{var cleanup=fn();if(typeof cleanup==="function")localDestroyHooks.push(cleanup)}catch(e){console.error("[stx] onMount error:",e)}});root.__stx_destroy=localDestroyHooks}if(document.readyState==="loading"){mountQueue.push(doMount)}else{doMount()}},mount:function(setupFn){console.log("[mount] called");var scriptEl=document.currentScript;function doMount(){var root=scriptEl?scriptEl.nextElementSibling:null;if(!root&&scriptEl)root=scriptEl.previousElementSibling||scriptEl.parentElement;var needsFallback=!root||root===document.body||root&&root.tagName==="SCRIPT";if(needsFallback){var routerOpts=window.STX_ROUTER_OPTIONS||window.__stxRouterConfig||{};var container=document.querySelector("[data-stx-content]")||document.querySelector("[data-stx-router-container]")||(routerOpts.container?document.querySelector(routerOpts.container):null)||document.querySelector("main")||document.querySelector("#content");if(container){root=container;var hasMount=false;var children=container.children;for(var ci=0;ci<children.length;ci++){if(children[ci].__stx_scope){hasMount=true;break}}if(hasMount)for(var ci=0;ci<children.length;ci++){if(!children[ci].__stx_scope&&children[ci].tagName!=="SCRIPT"){root=children[ci];break}}}}if(!root){console.warn("[stx] mount: no root element found");return};var prevProps=window.__STX_CURRENT_PROPS__;var prevEl=window.__STX_CURRENT_ELEMENT__;var propsAttr=root.getAttribute&&root.getAttribute("data-stx-props");window.__STX_CURRENT_PROPS__=root.__stx_props||(propsAttr?JSON.parse(propsAttr):{});window.__STX_CURRENT_ELEMENT__=root;var mountStart=mountCallbacks.length;var destroyStart=destroyCallbacks.length;var scope=setupFn();console.log("[mount] root:",root.tagName,"scope keys:",scope?Object.keys(scope).slice(0,10):"null");window.__STX_CURRENT_PROPS__=prevProps;window.__STX_CURRENT_ELEMENT__=prevEl;var localMountHooks=mountCallbacks.splice(mountStart);var localDestroyHooks=destroyCallbacks.splice(destroyStart);if(typeof scope==="object"&&scope!==null){scope.$el=root;scope.$refs=scope.$refs||{};root.__stx_scope=scope;Object.assign(componentScope,scope)};var disposeEffects=trackEffects(function(){processElement(root,scope||componentScope)});root.__stx_disposers=disposeEffects;root.removeAttribute("x-cloak");root.querySelectorAll("[x-cloak]").forEach(function(el){el.removeAttribute("x-cloak")});localMountHooks.forEach(function(fn){try{var cleanup=fn();if(typeof cleanup==="function")localDestroyHooks.push(cleanup)}catch(e){console.error("[stx] onMount error:",e)}});root.__stx_destroy=localDestroyHooks}if(document.readyState==="loading"){mountQueue.push(doMount)}else{doMount()}}};window.state=state;window.derived=derived;window.effect=effect;window.batch=batch;window.onMount=onMount;window.onDestroy=onDestroy;window.useFetch=useFetch;window.useRef=useRef;window.navigate=navigate;window.goBack=goBack;window.goForward=goForward;window.useRoute=useRoute;window.useSearchParams=useSearchParams;window.useQuery=useQuery;window.useMutation=useMutation;window.provide=provide;window.$computed=$computed;window.$watch=$watch;window.useDebounce=useDebounce;window.useDebouncedValue=useDebouncedValue;window.useThrottle=useThrottle;window.useInterval=useInterval;window.useTimeout=useTimeout;window.useToggle=useToggle;window.useCounter=useCounter;window.useClickOutside=useClickOutside;window.useFocus=useFocus;window.useAsync=useAsync;window.useLocalStorage=useLocalStorage;window.useEventListener=useEventListener;window.useWebSocket=useWebSocket;window.useColorMode=useColorMode;window.useDark=useDark;window.useHead=useHead;window.useSeoMeta=useSeoMeta;window.toast=toast;window.modal=modal;window.drawer=drawer;window.stxAlert=stxAlert;window.stxConfirm=stxConfirm;window.defineStore=window.stx.defineStore;window.useStore=window.stx.useStore;window.ref=state;window.reactive=state;window.computed=derived;window.watch=$watch;window.watchEffect=function(fn){return effect(fn)};console.log("[stx] registering DOMContentLoaded handler");document.addEventListener("DOMContentLoaded",()=>{console.log("[stx] DOMContentLoaded fired — processing scopes");mountQueue.forEach(function(fn){fn()});mountQueue=[];const processedScopes=new Set;document.querySelectorAll("[data-stx]").forEach((el)=>{const setupName=el.getAttribute("data-stx");console.log("[DOMContentLoaded] data-stx:",setupName,"el:",el.tagName,"fn exists:",!!(setupName&&window[setupName]));if(setupName&&window[setupName]){const result=window[setupName]();console.log("[DOMContentLoaded] setup returned:",result?Object.keys(result).slice(0,10):"null");if(typeof result==="object"){Object.assign(componentScope,result)}}console.log("[DOMContentLoaded] processElement on:",el.tagName,"scope keys:",Object.keys(componentScope).slice(0,10));var disposeEffects=trackEffects(function(){processElement(el)});el.__stx_disposers=disposeEffects;el.removeAttribute("x-cloak");el.querySelectorAll("[x-cloak]").forEach(function(c){c.removeAttribute("x-cloak")});mountCallbacks.forEach((fn)=>fn())});var allScopes=document.querySelectorAll("[data-stx-scope]");console.log("[stx] found",allScopes.length,"data-stx-scope elements");allScopes.forEach((el)=>{const scopeId=el.getAttribute("data-stx-scope");console.log("[stx] scope:",scopeId,"registered:",!!(window.stx._scopes&&window.stx._scopes[scopeId]),"el:",el.tagName);processedScopes.add(el);const scopeVars=window.stx._scopes&&window.stx._scopes[scopeId];if(!scopeVars)return;if(scopeVars){componentScope={...componentScope,...scopeVars}}console.log("[stx] calling processElement on scope:",scopeId,"componentScope total keys:",Object.keys(componentScope).length,"has openEventModal:","openEventModal"in componentScope,"scopeVars keys:",Object.keys(scopeVars).length);var disposeEffects=trackEffects(function(){processElement(el)});el.__stx_disposers=disposeEffects;console.log("[stx] scope processed OK:",scopeId);el.removeAttribute("x-cloak");el.querySelectorAll("[x-cloak]").forEach(function(c){c.removeAttribute("x-cloak")});if(scopeVars&&scopeVars.__mountCallbacks){scopeVars.__mountCallbacks.forEach((fn)=>fn())}});console.log("[stx] running global mountCallbacks:",mountCallbacks.length);mountCallbacks.forEach(function(fn){try{fn()}catch(e){console.error("[stx] onMount error:",e)}});mountCallbacks.length=0;document.querySelectorAll("[data-stx-auto]").forEach((el)=>{processElementSkipScopes(el,processedScopes);el.removeAttribute("x-cloak");el.querySelectorAll("[x-cloak]").forEach(function(c){c.removeAttribute("x-cloak")})});const headElements=document.querySelectorAll("head title, head meta[content]");headElements.forEach((el)=>{if(el.tagName==="TITLE"){const text=el.textContent;if(text&&text.includes("{{")){effect(()=>{try{let result=text;const matches=text.match(/{{s*(.+?)s*}}/g);if(matches){matches.forEach((match)=>{const expr=match.replace(/^{{s*|s*}}$/g,"");const fn=new Function(...Object.keys(componentScope),"return "+expr);const value=fn(...Object.values(componentScope));result=result.replace(match,value!=null?value:"")})}el.textContent=result}catch(e){if(!(e instanceof ReferenceError)&&!(e instanceof TypeError))console.warn("[STX] Title expression error:",e)}})}}else if(el.tagName==="META"){const content=el.getAttribute("content");if(content&&content.includes("{{")){const hasOnlyPlaceholders=!content.replace(/{{s*__[A-Z_]+__s*}}/g,"").includes("{{");if(hasOnlyPlaceholders)return;effect(()=>{try{let result=content;const matches=content.match(/{{s*(.+?)s*}}/g);if(matches){matches.forEach((match)=>{const expr=match.replace(/^{{s*|s*}}$/g,"");if(/^__[A-Z_]+__$/.test(expr.trim()))return;const fn=new Function(...Object.keys(componentScope),"return "+expr);const value=fn(...Object.values(componentScope));result=result.replace(match,value!=null?value:"")})}el.setAttribute("content",result)}catch(e){if(!(e instanceof ReferenceError)&&!(e instanceof TypeError))console.warn("[STX] Meta expression error:",e)}})}}})});function cleanupContainer(container){if(!container)return;mountCallbacks.length=0;var preservedRefs=componentScope.$refs||{};componentScope={$refs:preservedRefs};var shellElements=document.querySelectorAll("[data-stx-content] ~ *");document.querySelectorAll("body > *").forEach(function(el){if(el===container)return;if(el.tagName==="SCRIPT"||el.tagName==="STYLE")return;if(el.__stx_scope)Object.assign(componentScope,el.__stx_scope)});container.querySelectorAll("*").forEach(function(el){if(el.__stx_destroy&&Array.isArray(el.__stx_destroy)){el.__stx_destroy.forEach(function(fn){try{fn()}catch(e){console.warn("[stx] destroy hook error:",e)}});el.__stx_destroy=null}if(el.__stx_disposers&&typeof el.__stx_disposers==="function"){el.__stx_disposers();el.__stx_disposers=null}});if(container.__stx_destroy){container.__stx_destroy.forEach(function(fn){try{fn()}catch(e){console.warn("[stx] destroy hook error:",e)}});container.__stx_destroy=null}if(container.__stx_disposers){container.__stx_disposers();container.__stx_disposers=null}container.__stx_scope=null;container.querySelectorAll("[data-stx-scope]").forEach(function(el){var scopeId=el.getAttribute("data-stx-scope");if(scopeId&&window.stx._scopes&&window.stx._scopes[scopeId]){var scopeVars=window.stx._scopes[scopeId];if(scopeVars.__destroyCallbacks&&Array.isArray(scopeVars.__destroyCallbacks)){scopeVars.__destroyCallbacks.forEach(function(fn){try{fn()}catch(e){console.warn("[stx] scope destroy error:",e)}})}delete window.stx._scopes[scopeId]}})};var _stxLoadTimer=null;window.addEventListener("stx:load",function(){if(_stxLoadTimer){clearTimeout(_stxLoadTimer)}_stxLoadTimer=setTimeout(_handleStxLoad,5)});function _handleStxLoad(){_stxLoadTimer=null;console.log("[stx:load] START. mountQueue:",mountQueue.length,"_latestSetup:",!!window.stx._latestSetup);destroyCallbacks.forEach(function(fn){try{fn()}catch(e){console.warn("[stx] destroy callback error:",e)}});destroyCallbacks.length=0;mountQueue.forEach(function(fn){fn()});mountQueue=[];var routerOpts=window.STX_ROUTER_OPTIONS||window.__stxRouterConfig||{};var container=document.querySelector("[data-stx-content]")||(routerOpts.container?document.querySelector(routerOpts.container):null)||document.querySelector("#main-content")||document.body;var usedLatestSetup=false;if(window.stx._latestSetup&&typeof window.stx._latestSetup==="function"){try{var setupResult=window.stx._latestSetup();usedLatestSetup=true;if(typeof setupResult==="object"&&setupResult!==null){console.log("[stx:load] _latestSetup keys:",Object.keys(setupResult).slice(0,10));Object.assign(componentScope,setupResult)}}catch(e){console.error("[stx:load] _latestSetup error:",e);usedLatestSetup=true}}console.log("[stx:load] usedLatestSetup:",usedLatestSetup,"scope keys:",Object.keys(componentScope).slice(0,10));if(!usedLatestSetup){document.querySelectorAll("[data-stx]").forEach(function(el){var setupName=el.getAttribute("data-stx");if(setupName&&window[setupName]){var result=window[setupName]();if(typeof result==="object")Object.assign(componentScope,result)}})}if(window.__stx_reactive&&window.__stx_reactive.initScope){container.querySelectorAll("[data-stx-xdata]").forEach(function(el){var scopeId=el.getAttribute("data-stx-scope");if(scopeId&&window.stx._scopes&&window.stx._scopes[scopeId])return;var xdata=el.getAttribute("data-stx-xdata");if(!xdata)return;if(!scopeId){scopeId="__stx_scope_spa_"+ ++window.stx._scopeCounter;el.setAttribute("data-stx-scope",scopeId)}console.log("[stx:load] initializing x-data scope:",scopeId,xdata.substring(0,40));window.__stx_reactive.initScope(el,xdata,[],{},null)})}container.querySelectorAll("[data-stx-scope]").forEach(function(el){var scopeId=el.getAttribute("data-stx-scope");var scopeVars=window.stx._scopes&&window.stx._scopes[scopeId];if(!scopeVars)return;Object.assign(componentScope,scopeVars);var disposeEffects=trackEffects(function(){processElement(el,componentScope)});el.__stx_disposers=disposeEffects});console.log("[stx:load] container:",container.tagName,"__stx_scope:",!!container.__stx_scope,"scope keys:",Object.keys(componentScope).slice(0,10));if(!container.__stx_scope){if(container.__stx_disposers&&typeof container.__stx_disposers==="function"){container.__stx_disposers()}console.log("[stx:load] processElement on container");var disposeEffects=trackEffects(function(){processElement(container,componentScope)});container.__stx_disposers=disposeEffects}else{console.log("[stx:load] SKIPPED processElement — container has __stx_scope")}container.removeAttribute("x-cloak");container.querySelectorAll("[x-cloak]").forEach(function(c){c.removeAttribute("x-cloak")});container.querySelectorAll("[data-stx-scope]").forEach(function(el){var scopeId=el.getAttribute("data-stx-scope");var scopeVars=window.stx._scopes&&window.stx._scopes[scopeId];if(scopeVars&&scopeVars.__mountCallbacks){scopeVars.__mountCallbacks.forEach(function(fn){fn()})}});mountCallbacks.forEach(function(fn){try{fn()}catch(e){console.warn("[stx] mount callback error:",e)}});mountCallbacks.length=0};function processElementSkipScopes(el,processedScopes){if(processedScopes.has(el))return;if(el.nodeType===Node.TEXT_NODE){processElement(el);return}if(el.nodeType!==Node.ELEMENT_NODE)return;if(el.hasAttribute&&el.hasAttribute("data-stx-scope"))return;const hasFor=el.hasAttribute&&(el.hasAttribute("@for")||el.hasAttribute(":for")||el.hasAttribute("x-for"));const hasIf=el.hasAttribute&&(el.hasAttribute("@if")||el.hasAttribute(":if")||el.hasAttribute("x-if"));if(hasFor){var fa=el.hasAttribute(":for")?":for":el.hasAttribute("x-for")?"x-for":"@for";bindFor(el,componentScope,fa);return}if(hasIf){var ia=el.hasAttribute(":if")?":if":el.hasAttribute("x-if")?"x-if":"@if";bindIf(el,componentScope,ia);return}if(el.hasAttribute&&(el.hasAttribute("@show")||el.hasAttribute(":show")||el.hasAttribute("x-show"))){var sa=el.hasAttribute(":show")?":show":el.hasAttribute("x-show")?"x-show":"@show";bindShow(el,el.getAttribute(sa),componentScope,sa)}if(el.hasAttribute&&(el.hasAttribute("@model")||el.hasAttribute(":model")||el.hasAttribute("x-model"))){var ma=el.hasAttribute(":model")?":model":el.hasAttribute("x-model")?"x-model":"@model";bindModel(el,el.getAttribute(ma),componentScope,ma)}if(el.tagName!=="SCRIPT"&&el.tagName!=="STYLE"){Array.from(el.childNodes).forEach((child)=>processElementSkipScopes(child,processedScopes))}}})();</script> <!DOCTYPE html><html lang="en" data-theme="dark"><head><meta name="title" content="stx Project"><meta name="description" content="A website built with stx templating engine"><meta property="og:title" content="stx Project"><meta property="og:description" content="A website built with stx templating engine"><meta property="og:type" content="website"><meta name="twitter:card" content="summary_large_image"><meta name="twitter:title" content="stx Project"><meta name="twitter:description" content="A website built with stx templating engine"><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>ts-cloud — Secrets</title><link rel="preconnect" href="https://fonts.googleapis.com"><link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet"><style> :root { --bg: #0b1020; --bg2: #0f1730; --panel: rgba(255,255,255,0.04); --panel-br: rgba(255,255,255,0.08); --txt: #e8edf7; --txt2: #9fb0cc; --txt3: #64748b; --accent: #5b8cff; --ok: #34d399; --okbg: rgba(52,211,153,0.12); --bad: #f87171; --badbg: rgba(248,113,113,0.12); --warn: #fbbf24; --warnbg: rgba(251,191,36,0.12); } * { box-sizing: border-box; margin: 0; padding: 0; } body { font-family: 'Inter', system-ui, sans-serif; color: var(--txt); min-height: 100vh; background: radial-gradient(1200px 600px at 80% -10%, rgba(91,140,255,0.12), transparent 60%), linear-gradient(160deg, var(--bg), var(--bg2)); -webkit-font-smoothing: antialiased; } a { color: inherit; text-decoration: none; } .wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px 64px; } nav { display: flex; align-items: center; gap: 16px; padding: 18px 24px; position: sticky; top: 0; z-index: 10; background: rgba(11,16,32,0.7); backdrop-filter: blur(14px); border-bottom: 1px solid var(--panel-br); } .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -0.02em; } .brand .dot { width: 22px; height: 22px; border-radius: 7px; background: linear-gradient(135deg, var(--accent), #8b5cf6); box-shadow: 0 0 18px rgba(91,140,255,0.6); } .tabs { display: flex; gap: 4px; margin-left: 18px; } .tabs a { padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--txt2); } .tabs a.active { background: rgba(91,140,255,0.14); color: var(--accent); } .nav-meta { margin-left: auto; display: flex; align-items: center; gap: 14px; color: var(--txt2); font-size: 13px; } .env { padding: 4px 10px; border-radius: 999px; background: var(--okbg); color: var(--ok); font-weight: 600; font-size: 12px; } header.page { padding: 30px 0 22px; display: flex; align-items: flex-start; gap: 20px; flex-wrap: wrap; } header.page h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; } header.page p { color: var(--txt2); margin-top: 4px; font-size: 14px; } .server-line { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; color: var(--txt2); font-size: 13px; } .server-line b { color: var(--txt); font-weight: 600; } .header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; } /* Breadcrumb / back link for drill-down pages */ .crumbs { display: flex; align-items: center; gap: 8px; padding-top: 26px; font-size: 13px; color: var(--txt3); } .crumbs a { color: var(--txt2); } .crumbs a:hover { color: var(--accent); } .crumbs .sep { color: var(--txt3); } .grid { display: grid; gap: 16px; } .cards { grid-template-columns: repeat(4, 1fr); } .cards-3 { grid-template-columns: repeat(3, 1fr); } .cards-2 { grid-template-columns: repeat(2, 1fr); } @media (max-width: 880px) { .cards, .cards-3, .cards-2 { grid-template-columns: repeat(2, 1fr); } } .panel { background: var(--panel); border: 1px solid var(--panel-br); border-radius: 16px; padding: 18px; backdrop-filter: blur(6px); } a.panel { display: block; transition: border-color .15s, transform .15s; } a.panel:hover { border-color: rgba(91,140,255,0.5); transform: translateY(-1px); } .panel h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--txt3); font-weight: 700; } .stat { font-size: 28px; font-weight: 800; margin-top: 8px; letter-spacing: -0.02em; } .stat small { font-size: 14px; color: var(--txt2); font-weight: 500; } .bar { height: 7px; border-radius: 999px; background: rgba(255,255,255,0.07); margin-top: 12px; overflow: hidden; } .bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), #8b5cf6); } .section { margin-top: 30px; } .section > h2 { font-size: 15px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; } .section > h2 .more { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--accent); } .cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; } @media (max-width: 880px) { .cols { grid-template-columns: 1fr; } } table { width: 100%; border-collapse: collapse; font-size: 14px; } th { text-align: left; color: var(--txt3); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; padding: 0 12px 10px; } td { padding: 12px; border-top: 1px solid rgba(255,255,255,0.05); } tr:hover td { background: rgba(255,255,255,0.02); } .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: var(--txt2); } .pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; } .pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; } .pill.ok { background: var(--okbg); color: var(--ok); } .pill.bad { background: var(--badbg); color: var(--bad); } .pill.warn { background: var(--warnbg); color: var(--warn); } .tag { padding: 2px 8px; border-radius: 6px; background: rgba(91,140,255,0.12); color: var(--accent); font-size: 12px; font-weight: 600; } .kv { display: flex; justify-content: space-between; padding: 9px 0; border-top: 1px solid rgba(255,255,255,0.05); font-size: 14px; gap: 16px; } .kv:first-of-type { border-top: 0; } .kv > span { color: var(--txt2); white-space: nowrap; } .kv > b { text-align: right; word-break: break-all; } .deploy { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid rgba(255,255,255,0.05); font-size: 14px; } .deploy:first-of-type { border-top: 0; } .deploy .when { margin-left: auto; color: var(--txt3); font-size: 12px; } .btn { background: linear-gradient(135deg, var(--accent), #8b5cf6); color: #fff; border: 0; border-radius: 10px; padding: 10px 18px; font-weight: 700; font-size: 14px; cursor: pointer; font-family: inherit; white-space: nowrap; } .btn:hover { filter: brightness(1.08); } .btn.ghost { background: rgba(255,255,255,0.05); border: 1px solid var(--panel-br); color: var(--txt); } .btn.danger { background: var(--badbg); color: var(--bad); } .btn.sm { padding: 6px 12px; font-size: 12px; } .data-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid rgba(255,255,255,0.05); font-size: 14px; } .data-item:first-of-type { border-top: 0; } .data-item .detail { color: var(--txt3); font-size: 12px; } .data-item .st { margin-left: auto; } .secret { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid rgba(255,255,255,0.05); font-size: 14px; } .secret:first-of-type { border-top: 0; } .secret .val { margin-left: auto; color: var(--txt3); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; letter-spacing: 2px; } /* Drill-down extras */ .spark { display: flex; align-items: flex-end; gap: 3px; height: 48px; margin-top: 12px; } .spark > i { flex: 1; background: linear-gradient(180deg, var(--accent), rgba(91,140,255,0.25)); border-radius: 3px 3px 0 0; min-height: 2px; } .logs { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.7; color: var(--txt2); max-height: 360px; overflow: auto; } .logs .ts { color: var(--txt3); } .logs .err { color: var(--bad); } .note { color: var(--txt3); font-size: 12px; margin-top: 10px; } .row-actions { display: flex; gap: 8px; } .field { display: flex; gap: 8px; margin-top: 12px; } .field input { flex: 1; background: rgba(255,255,255,0.05); border: 1px solid var(--panel-br); border-radius: 10px; padding: 9px 12px; color: var(--txt); font-family: inherit; font-size: 14px; } .field input:focus { outline: none; border-color: var(--accent); } /* Honest action affordance: a copyable CLI command (static dashboard has no backend — the buttons would POST nowhere, so we show the exact command). */ .cmd { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 10px; background: rgba(255,255,255,0.05); border: 1px solid var(--panel-br); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; color: var(--txt); white-space: nowrap; } .cmd::before { content: '$'; color: var(--txt3); } .cmd.accent { border-color: rgba(91,140,255,0.4); color: var(--accent); } .cmds { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; } </style></head><body data-stx-auto><nav><div class="brand"><span class="dot"></span> ts-cloud</div><div class="tabs"><a href="/">Server</a><a href="/serverless" class="active">Serverless</a></div><div class="nav-meta"><span>acme</span><span class="env">production</span></div></nav><div class="wrap"><div class="crumbs"><a href="/serverless">Serverless</a><span class="sep">/</span> Secrets</div><header class="page"><div><h1>Secrets</h1><p>Stored in AWS Secrets Manager and injected into the functions at deploy. Values are never displayed.</p></div></header><div class="section"><div class="panel"><table><thead><tr><th>Key</th><th>Secret source</th><th>Value</th><th>Updated</th><th></th></tr></thead><tbody><tr><td class="mono"><b>APP_KEY</b></td><td class="mono" style="color:var(--txt3)">acme/production/app-key</td><td class="mono" style="letter-spacing:2px;color:var(--txt3)">••••••••</td><td style="color:var(--txt3)">14d ago</td><td><span class="cmd">cloud secrets:set APP_KEY &lt;value&gt;</span></td></tr><tr><td class="mono"><b>DB_PASSWORD</b></td><td class="mono" style="color:var(--txt3)">acme/production/db</td><td class="mono" style="letter-spacing:2px;color:var(--txt3)">••••••••</td><td style="color:var(--txt3)">14d ago</td><td><span class="cmd">cloud secrets:set DB_PASSWORD &lt;value&gt;</span></td></tr><tr><td class="mono"><b>STRIPE_SECRET</b></td><td class="mono" style="color:var(--txt3)">acme/production/stripe</td><td class="mono" style="letter-spacing:2px;color:var(--txt3)">••••••••</td><td style="color:var(--txt3)">3d ago</td><td><span class="cmd">cloud secrets:set STRIPE_SECRET &lt;value&gt;</span></td></tr><tr><td class="mono"><b>MAIL_PASSWORD</b></td><td class="mono" style="color:var(--txt3)">acme/production/mail</td><td class="mono" style="letter-spacing:2px;color:var(--txt3)">••••••••</td><td style="color:var(--txt3)">21d ago</td><td><span class="cmd">cloud secrets:set MAIL_PASSWORD &lt;value&gt;</span></td></tr></tbody></table><div class="cmds" style="margin-top:14px;"><span class="accent cmd">cloud secrets:set KEY value</span><span class="cmd">cloud secrets:list</span><span class="cmd">cloud env:pull</span></div><p class="note">Secrets are set from the CLI (the dashboard is a read-only static site). Rotate by re-setting; remove with <span class="mono">cloud secrets:delete KEY</span>.</p></div></div></div> <script data-stx-scoped>
2
2
  (function() {
3
3
  'use strict';
4
4