@stacksjs/stx 0.2.338 → 0.2.339
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/caching.d.ts +1 -18
- package/dist/caching.js +2 -21
- package/dist/{chunk-4pcjt99d.js → chunk-09fb200s.js} +1 -1
- package/dist/chunk-0b3cqgyr.js +2 -0
- package/dist/{chunk-yj1dxdfr.js → chunk-0tky87hx.js} +1 -1
- package/dist/{chunk-1yj4xd6n.js → chunk-156j37tv.js} +3 -3
- package/dist/{chunk-gtfcw1gc.js → chunk-191bg6nt.js} +1 -1
- package/dist/{chunk-fjrkyhm7.js → chunk-1q6xc3m2.js} +1 -1
- package/dist/{chunk-9btdax2s.js → chunk-28q3vycz.js} +1 -1
- package/dist/{chunk-kawdj1j7.js → chunk-408rnn07.js} +1 -1
- package/dist/{chunk-dvafkj8w.js → chunk-48d9ey9k.js} +1 -1
- package/dist/chunk-63h3pg9g.js +2 -0
- package/dist/{chunk-zye9r15n.js → chunk-63xv0h5e.js} +1 -1
- package/dist/{chunk-3cjvqa0s.js → chunk-64qg8jes.js} +1 -1
- package/dist/{chunk-gz539gk6.js → chunk-6av24ywm.js} +1 -1
- package/dist/{chunk-46tmg3k4.js → chunk-6n1qbh78.js} +1 -1
- package/dist/{chunk-7ngnyy5k.js → chunk-6qe53wjc.js} +1 -1
- package/dist/{chunk-95t7pked.js → chunk-7157az6e.js} +1 -1
- package/dist/{chunk-fw56y3cb.js → chunk-7qawmh8w.js} +2 -2
- package/dist/{chunk-qhdp0ycf.js → chunk-a2nsmczq.js} +1 -1
- package/dist/chunk-ar0fcmpj.js +2 -0
- package/dist/{chunk-f6sejeg3.js → chunk-axqfm9b4.js} +1 -1
- package/dist/{chunk-hfzv07az.js → chunk-az4mq459.js} +1 -1
- package/dist/{chunk-7d74am4w.js → chunk-azhpwmty.js} +1 -1
- package/dist/{chunk-wakb8z5q.js → chunk-c3xmcsvd.js} +9 -9
- package/dist/{chunk-9m5sxaen.js → chunk-ca6t6nnn.js} +1 -1
- package/dist/{chunk-vm5jbgb1.js → chunk-chkbvqq2.js} +3 -3
- package/dist/{chunk-w0hzaka3.js → chunk-d6yyzpsv.js} +98 -7
- package/dist/chunk-d72ps148.js +2 -0
- package/dist/chunk-e0r2hndd.js +2 -0
- package/dist/{chunk-mnyehz4t.js → chunk-e2emz8yb.js} +1 -1
- package/dist/{chunk-meqz313r.js → chunk-e4sgv8p0.js} +1 -1
- package/dist/chunk-eb1v7f55.js +2 -0
- package/dist/{chunk-fha0nyet.js → chunk-evk1dzpg.js} +1 -1
- package/dist/{chunk-4904n5v0.js → chunk-fa2mg49t.js} +2 -2
- package/dist/{chunk-8cg15rr7.js → chunk-gz6mszbx.js} +1 -1
- package/dist/chunk-jwa2jhd8.js +2 -0
- package/dist/chunk-mjf3xmxn.js +3 -0
- package/dist/chunk-mpbbfrpk.js +2 -0
- package/dist/{chunk-9bvgzqw1.js → chunk-n6eetz4r.js} +2 -2
- package/dist/{chunk-vgfnre7b.js → chunk-nwz43t6d.js} +1 -1
- package/dist/chunk-pqtype7s.js +2 -0
- package/dist/{chunk-nhbc464j.js → chunk-pswhshrp.js} +1 -1
- package/dist/{chunk-kdwerx8e.js → chunk-pvtnhx3j.js} +1 -1
- package/dist/chunk-q1xcd8jg.js +3 -0
- package/dist/{chunk-5r7gfwpj.js → chunk-rzayq0ht.js} +1 -1
- package/dist/{chunk-m1p2n3nf.js → chunk-sntjqyqq.js} +1 -1
- package/dist/{chunk-39xtzfzf.js → chunk-tvc2xwen.js} +1 -1
- package/dist/{chunk-4np12rj1.js → chunk-tzywy1s7.js} +1 -1
- package/dist/{chunk-e3rgky2r.js → chunk-vafj091j.js} +19 -19
- package/dist/{chunk-823h67tv.js → chunk-wdq75f5k.js} +1 -1
- package/dist/chunk-wdvee4kr.js +17 -0
- package/dist/{chunk-x01sw9wy.js → chunk-wqyfz0y6.js} +1 -1
- package/dist/{chunk-3sgdth20.js → chunk-wwzzyqcg.js} +1 -1
- package/dist/chunk-x2pzekhq.js +2 -0
- package/dist/{chunk-9jc2z17q.js → chunk-xhznr05n.js} +2 -2
- package/dist/{chunk-41dfsdy9.js → chunk-xnpdkd13.js} +1 -1
- package/dist/{chunk-jkyvk4x6.js → chunk-xy4jt4ek.js} +1 -1
- package/dist/{chunk-kermxyfe.js → chunk-zfz3s2gd.js} +1 -1
- package/dist/{chunk-4cw0s9f4.js → chunk-zm8b6e9n.js} +1 -1
- package/dist/{chunk-4jj4kk18.js → chunk-zqtrg15a.js} +1 -1
- package/dist/cli.js +7 -7
- package/dist/client-script-bundler.js +10 -8
- package/dist/config.js +1 -0
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/engine-fingerprint.d.ts +17 -0
- package/dist/engine-fingerprint.js +23 -0
- package/dist/pwa.js +2 -2
- package/dist/runtime-injection.js +2 -0
- package/dist/ssg.js +2 -2
- package/dist/types/config-types.d.ts +8 -0
- package/package.json +5 -5
- package/dist/chunk-1wsewc5h.js +0 -2
- package/dist/chunk-a3m7mgjc.js +0 -2
- package/dist/chunk-aftqqqcg.js +0 -3
- package/dist/chunk-e9y48d60.js +0 -2
- package/dist/chunk-f08ttkqr.js +0 -2
- package/dist/chunk-n0a55zv2.js +0 -2
- package/dist/chunk-q3g4yf5r.js +0 -2
- package/dist/chunk-szfk6pw6.js +0 -2
- package/dist/chunk-temapbqe.js +0 -2
- package/dist/chunk-ypzm47q3.js +0 -17
- package/dist/chunk-z07knk3p.js +0 -2
- package/dist/chunk-zt4pf776.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Sr as E8,Wr as b8,es as T7,fs as k7}from"./chunk-d7zxg9bp.js";import{ks as W0,ls as mZ}from"./chunk-hrdd26r4.js";import{ns as C7,os as S7,ps as Z9,qs as J9}from"./chunk-7r79j1hs.js";import{ws as a2}from"./chunk-ay336sqb.js";import{Bs as o1,Cs as x1,Ds as S8,Es as E1,Gs as W1,Hs as CZ,Is as SZ,Js as G2,Ks as i2,Ls as R9,Ms as E2,Ns as V8,Os as J8,Ps as j1,Qs as c0,Rs as e9,Vs as P8,Ws as x9,ht as v8}from"./chunk-
|
|
2
|
+
import{Sr as E8,Wr as b8,es as T7,fs as k7}from"./chunk-d7zxg9bp.js";import{ks as W0,ls as mZ}from"./chunk-hrdd26r4.js";import{ns as C7,os as S7,ps as Z9,qs as J9}from"./chunk-7r79j1hs.js";import{ws as a2}from"./chunk-ay336sqb.js";import{Bs as o1,Cs as x1,Ds as S8,Es as E1,Gs as W1,Hs as CZ,Is as SZ,Js as G2,Ks as i2,Ls as R9,Ms as E2,Ns as V8,Os as J8,Ps as j1,Qs as c0,Rs as e9,Vs as P8,Ws as x9,ht as v8}from"./chunk-pswhshrp.js";import{it as E7,kt as b7,lt as y7,nt as B2}from"./chunk-vaggjvsm.js";import{pt as W4,qt as U4,rt as H4,ut as B4,vt as V4}from"./chunk-q9ckfwhh.js";import{At as g9}from"./chunk-zfz3s2gd.js";import{Ct as VZ,Dt as OZ,Et as _Z,Ft as LZ,Gt as FZ,It as C8}from"./chunk-k3dtvay1.js";import{Jt as g8,Kt as h8,Lt as u8,Mt as m8,Nt as P7,Ot as v7}from"./chunk-aved735s.js";import{$t as w0,Eu as I3,Fu as Z6,Gu as Q0,Hu as H0,Iu as d0,Ju as w9,Ku as X2,Lu as q0,Mu as M9,bu as N9,cu as A3,du as D9,ku as b2,nu as I8,pu as R0,tu as y2,uu as T8,wu as n0,xu as k8}from"./chunk-799s9mwc.js";import{Nu as f8,Ru as wZ,Tu as RZ}from"./chunk-7r80apc5.js";import{bv as t0}from"./chunk-2tjk867y.js";import{ev as x8}from"./chunk-t8ctvjqe.js";import{fv as T3,gv as S2,hv as yZ,iv as n1,mv as uZ,nv as W3,ov as Z8,qv as P4,tv as d4}from"./chunk-deqnt1w5.js";import{Ev as S$,Hv as h6,Ov as w$,dw as y8,fw as Gz,gw as U5,jw as W2}from"./chunk-d6yyzpsv.js";import{ow as f7}from"./chunk-wb90259a.js";import{tw as f}from"./chunk-5g6rprcy.js";import C1 from"path";import v2 from"fs";var z3=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),K3={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},oZ=new Set(["ctrl","alt","shift","meta"]),U3={left:0,middle:1,right:2};function q3($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let J of $){let X=J.toLowerCase();if(X==="prevent")Z.prevent=!0;else if(X==="stop")Z.stop=!0;else if(X==="once")Z.once=!0;else if(X==="capture")Z.capture=!0;else if(X==="self")Z.self=!0;else if(X==="passive")Z.passive=!0;else if(oZ.has(X))Z.systemKeys.push(X);else if(X in U3)Z.mouse=X;else if(X in K3||/^[a-z]$/.test(X))Z.keys.push(K3[X]||X.toUpperCase());else if(X.startsWith("debounce")){let Y=X.match(/debounce(?:\.(\d+))?/);Z.debounce=Y?.[1]?Number.parseInt(Y[1],10):300}else if(X.startsWith("throttle")){let Y=X.match(/throttle(?:\.(\d+))?/);Z.throttle=Y?.[1]?Number.parseInt(Y[1],10):300}}return Z}function H3($){let Z=[],J=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Y;while((Y=X.exec($))!==null){let[Q,G,z]=Y,K=Y.index,q=K+Q.length,W=`__stx_evt_${J++}`,U=[],H=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=H.exec(z))!==null){let[,V,L]=j,_=V.split("."),F=_[0];if(!z3.has(F))continue;U.push({attribute:`@${V}`,event:F,handler:L,modifiers:q3(_.slice(1)),elementId:W})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=B.exec(z))!==null){let[,V,L]=j,_=V.split("."),F=_[0];if(!z3.has(F))continue;U.push({attribute:`@${V}`,event:F,handler:L,modifiers:q3(_.slice(1)),elementId:W})}if(U.length>0)Z.push({originalTag:Q,elementId:W,events:U,startIndex:K,endIndex:q})}return Z}function sZ($){let Z=[],{modifiers:J}=$;if(J.self)Z.push("if ($event.target !== $el) return");for(let X of J.systemKeys)Z.push(`if (!$event.${X}Key) return`);if(J.keys.length>0){let X=J.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(J.mouse!==null){let X=U3[J.mouse];Z.push(`if ($event.button !== ${X}) return`)}if(J.prevent)Z.push("$event.preventDefault()");if(J.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function rZ($,Z){let J=$;if(Z.debounce!==null)J=`__stx_debounce(() => { ${J} }, ${Z.debounce})`;else if(Z.throttle!==null)J=`__stx_throttle(() => { ${J} }, ${Z.throttle})`;return J}function s9($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function aZ($){let{modifiers:Z}=$,J=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=sZ($),Y=rZ(s9($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z.passive)Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",z=Y.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
|
|
3
3
|
(function() {
|
|
4
4
|
var $el = document.getElementById('${J}');
|
|
5
5
|
if (!$el) return;
|
|
@@ -3167,7 +3167,7 @@ ${W}
|
|
|
3167
3167
|
customElements.define('${Z}', ${G});
|
|
3168
3168
|
`}async function A7($,Z,J,X){if(Z.length<1)return R0("WebComponent","@webcomponent directive requires at least the tag name parameter",w0.INVALID_DIRECTIVE_SYNTAX);let Y=Z[0].replace(/['"]/g,""),G=(J.__stx_options||{}).componentsDir||"components",z=g0.isAbsolute(G)?[g0.join(G,`${Y}.stx`),g0.join(g0.dirname(X),`${Y}.stx`)]:[g0.join(g0.dirname(X),G,`${Y}.stx`),g0.join(process.cwd(),G,`${Y}.stx`),g0.join(g0.dirname(X),`${Y}.stx`)],K=null;for(let U of z)if(await e(U)){K=await Bun.file(U).text();break}if(!K)return R0("WebComponent",`Component file not found: ${Y}.stx`,w0.FILE_NOT_FOUND);let q=PX(K,Y);return`<script type="module">
|
|
3169
3169
|
${vX(q)}
|
|
3170
|
-
</script>`}var A5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:E7,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:Y7,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:A7,hasEndTag:!1,description:"Include a web component in the template"},T7,k7,P7,v7,Q5,z5,K5,G5,$7,l3,O7,N5,...f7],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function xX($,Z,J){let X=Z||"pages";if($)return{root:$,pagesDir:X};let Y=J||process.cwd(),Q=S0.join(Y,"resources","views"),G=S0.join(Y,"resources","layouts");if(X9.existsSync(Q)&&X9.existsSync(G))return{root:"resources",pagesDir:"views"};let z=S0.join(Y,"resources","views","pages");if(X9.existsSync(z))return{root:"resources/views",pagesDir:X};return{root:".",pagesDir:X}}var I7=new Set,Y9=["partialsDir","componentsDir","layoutsDir"],I5=new WeakMap;function gX($,Z){let J=Z.replace(/[\\/]+$/,"");if(!J||J===".")return!0;let X=$.replace(/\\/g,"/"),Y=J.replace(/\\/g,"/");return X===Y||X.startsWith(`${Y}/`)}function hX($,Z){let J=!$.root,X=xX($.root,$.pagesDir,Z);if($.root=X.root,$.pagesDir=X.pagesDir,J&&X.root!=="."){let Y=`${Z}::${X.root}`;if(!I7.has(Y))I7.add(Y),console.warn(`[stx] No "root" in config \u2014 inferred "${X.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!I5.has($)){let Y={};for(let Q of Y9){let G=$[Q];if(typeof G==="string"&&G)Y[Q]=G}I5.set($,Y)}if($.root&&$.root!=="."){let Y=$.root;for(let Q of Y9){let G=$[Q];if(typeof G!=="string"||!G)continue;if(S0.isAbsolute(G)||gX(G,Y))continue;$[Q]=S0.join(Y,G)}}for(let Y of Y9){let Q=$[Y];if(typeof Q!=="string"||!Q||S0.isAbsolute(Q))continue;$[Y]=S0.resolve(Z,Q)}return $}function uX($,Z){let J=I5.get($);for(let X of Y9){let Y=$[X];if(typeof Y!=="string"||!Y)continue;let Q=S0.isAbsolute(Y)?Y:S0.join(Z,Y);if(X9.existsSync(Q))continue;let G=J?.[X]??Y,z=$.root,K=!!z&&z!==".";console.warn(`[stx] ${String(X)} resolves to "${Q}", which does not exist. Configured as "${G}"`+(K?`, resolved under root "${z}".`:"."))}}function mX($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function dX($){if(b7($.stateDir),$.stateDir=y7(),$.cachePath=B2($.cachePath),$.build)$.build.cacheDir=B2($.build.cacheDir);if($.media?.cache)$.media.cache.directory=B2($.media.cache.directory);if($.story)$.story.outDir=B2($.story.outDir)}var Q1=null,O1=new Map,$9=new Map,V2=null;async function T5($){let Z=$?S0.resolve($):process.cwd(),J=$9.get(Z);if(J&&J.signature!==Z9(J.graph)){let Q=O1.get(Z);if(O1.delete(Z),$9.delete(Z),!$)Q1=null,V2=null;let{clearComponentCache:G}=await import("./chunk-95t7pked.js"),{partialsCache:z}=await import("./chunk-4jj4kk18.js");if(G(),z.clear(),Q&&J.configSignature===J9(J.graph)){let K=Q.then(async(q)=>{let W={...J.graph};await S7(W,Z),$9.set(Z,{graph:W,signature:Z9(W),configSignature:J9(W)});let U={...q,_layerGraph:W};if(!$)Q1=U;return U});return O1.set(Z,K),K}}if(!$){if(Q1)return Q1;if(V2)return V2}let X=O1.get(Z);if(X)return X;let Y=(async()=>{let G=(await fX({name:"stx",alias:"ui",cwd:Z,defaultConfig:A5,verbose:!1})).config;if(G.extends!==void 0||J){let z=await C7(Z,A5);G=z.config,$9.set(Z,{graph:z.graph,signature:Z9(z.graph),configSignature:J9(z.graph)})}if(G.runtimeConfig){let{resolveRuntimeConfig:z}=await import("./chunk-x4vhn880.js");z(G.runtimeConfig,{});let{generateRuntimeConfigTypes:K}=await import("./chunk-9m5sxaen.js");await K(Z,G.runtimeConfig)}if(mX(G),dX(G),hX(G,Z),uX(G,Z),G.plugins&&G.plugins.length>0){let{pluginManager:z}=await import("./chunk-stbns4bg.js"),K=[],q=[];for(let W of G.plugins){let U=typeof W==="string"?W:W[0],H=typeof W==="string"?{}:W[1]||{};try{let j,B;try{j=await import(U),B=S0.dirname(f.resolve(U))}catch{let L=S0.resolve(Z,U);j=await import(L),B=S0.dirname(L)}let V=j.default||j;if(!z.has(V.name))await z.register(V,G);if(V.components){let L=Array.isArray(V.components)?V.components:[V.components];for(let _ of L)K.push(S0.resolve(B,_))}if(V.pages){let L=S0.resolve(B,V.pages),_=H.path||"/";q.push({dir:L,prefix:_})}if(V.setup){let L={addDirective:(_)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(_)},addRoute:(_,F)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[_]=F},addMiddleware:(_)=>{G.middleware=G.middleware||[],G.middleware.push(_)},pluginDir:B,config:G};await V.setup(H,L)}console.log(`[stx] Plugin loaded: ${V.name||U}`)}catch(j){console.warn(`[stx] Failed to load plugin ${U}:`,j.message)}}G._pluginComponentDirs=K,G._pluginPageDirs=q}return G})();if(O1.set(Z,Y),Y.catch(()=>{if(O1.get(Z)===Y)O1.delete(Z)}),!$)V2=Y,Y.then((Q)=>{Q1=Q}).catch(()=>{});return Y}var x7=new Proxy(A5,{get($,Z){if(Q1&&Z in Q1)return Q1[Z];if(!V2)T5().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return $[Z]}});function HU($){return $}function jU($){let Z=[],J=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Y}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Y}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Y}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Y}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Y}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)J.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)J.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Y,Q)=>{if(!Y.pattern||typeof Y.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Y.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Y.maxAgeSeconds!==void 0&&(typeof Y.maxAgeSeconds!=="number"||Y.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Y.maxEntries!==void 0&&(typeof Y.maxEntries!=="number"||Y.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Y)=>typeof Y!=="number"||Y<16||Y>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!X.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)J.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)J.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:J}}var E5=new Map;async function pX($,Z={}){try{if(!await e($))throw Error(`Markdown file not found: ${$}`);let X=(await lX.promises.stat($)).mtime.getTime();if(Z.cache&&E5.has($)){let U=E5.get($);if(U.updatedAt>=X)return{content:U.content,data:U.data}}let Y=await Bun.file($).text(),{data:Q,content:G}=J7(Y),z=Z.markdown||x7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=U2(G,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)q=await iX(q,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:q,data:Q||{}};if(Z.cache)E5.set($,{...W,updatedAt:X});return W}catch(J){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,J);let X=J instanceof Error?J.message:String(J);return{content:_0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}var Q9=null;async function iX($,Z,J){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!Q9)try{Q9=await cX({theme:Z||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),$}let Y=async(z,K,q,W)=>{let U=W.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),H=q||(J?"text":"");if(!H)return z;try{if(!Q9.getSupportedLanguages().includes(H))return z;return(await Q9.highlight(U,H,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${q}:`,j)}return z},Q=$,G=$.matchAll(X);for(let z of G){let[K,q,W,U]=z,H=await Y(K,q,W,U);Q=Q.replace(K,H)}return Q}async function g7($,Z,J="",X={}){return await nX($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,z,K,q)=>{try{let W=z;if(!k5.isAbsolute(z))W=k5.resolve(k5.dirname(J),z);let U={};if(K)try{try{U=JSON.parse(K)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let F=K.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let O of F){let w=O.indexOf(":");if(w>0){let N=O.substring(0,w).trim(),R=O.substring(w+1).trim(),M=R.startsWith('"')&&R.endsWith('"'),T=R.startsWith("'")&&R.endsWith("'");if(M||T)R=R.substring(1,R.length-1);U[N]=R}}}}catch(_){if(X.debug)console.error("Error parsing context in @markdown-file directive:",_)}let{content:H,data:j}=await pX(W,X),B={...Z,...j,...U},V=H,L=/\{\{([^}]+)\}\}/g;return V=V.replace(L,(_,F)=>{let O=F.trim();return B[O]!==void 0?String(B[O]):_}),V}catch(W){let U=W instanceof Error?W.message:String(W);return _0("Markdown File",`Error including markdown file: ${U}`,J,$,q,G)}})}async function nX($,Z,J){let X=[],Y;while((Y=Z.exec($))!==null){let z=Y[0],K=Y.index,q=Y;X.push(J(...q).then((W)=>({match:z,replacement:W,index:K})))}let Q=await Promise.all(X);Q.sort((z,K)=>K.index-z.index);let G=$;for(let{match:z,replacement:K}of Q)G=G.replace(z,()=>K);return G}function G1($,Z){try{let J=$.trim();if(H0(J))return q0(J,Object.keys(Z))(...Object.values(Z));else return Q0(J,Z)}catch{return!1}}class G9{source;pos=0;line=1;column=0;tokens=[];constructor($){this.source=$}tokenize(){this.tokens=[],this.pos=0,this.line=1,this.column=0;while(this.pos<this.source.length){let $=this.nextToken();if($)this.tokens.push($)}return this.tokens.push({type:"EOF",value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),this.tokens}nextToken(){if(this.pos>=this.source.length)return null;let $=this.pos,Z=this.line,J=this.column,X=this.source[this.pos];if(/\s/.test(X))return this.readWhitespace($,Z,J);if(X==="/"&&this.peek(1)==="/")return this.readLineComment($,Z,J);if(X==="/"&&this.peek(1)==="*")return this.readBlockComment($,Z,J);if(X==='"'||X==="'")return this.readString(X,$,Z,J);if(X==="`")return this.readTemplateString($,Z,J);if(/\d/.test(X)||X==="."&&/\d/.test(this.peek(1)||""))return this.readNumber($,Z,J);if(/[a-z_$]/i.test(X))return this.readIdentifier($,Z,J);if(X==="{"){if(this.peek(1)==="{"&&this.peek(2)==="{")return this.advance(3),{type:"RAW_START",value:"{{{",start:$,end:this.pos,line:Z,column:J};if(this.peek(1)==="{")return this.advance(2),{type:"EXPRESSION_START",value:"{{",start:$,end:this.pos,line:Z,column:J};if(this.peek(1)==="!"&&this.peek(2)==="!")return this.advance(3),{type:"RAW_START",value:"{!!",start:$,end:this.pos,line:Z,column:J}}if(X==="}"){if(this.peek(1)==="}"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"}}}",start:$,end:this.pos,line:Z,column:J};if(this.peek(1)==="}")return this.advance(2),{type:"EXPRESSION_END",value:"}}",start:$,end:this.pos,line:Z,column:J}}if(X==="!"&&this.peek(1)==="!"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"!!}",start:$,end:this.pos,line:Z,column:J};if(X==="@"&&/[a-z]/i.test(this.peek(1)||""))return this.readDirective($,Z,J);let Y=["===","!==","==","!=","<=",">=","&&","||","??","++","--","+=","-=","*=","/=","%=","**","=>","?.","...","<<",">>",">>>","&=","|=","^="];for(let Q of Y)if(this.source.slice(this.pos,this.pos+Q.length)===Q)return this.advance(Q.length),{type:"OPERATOR",value:Q,start:$,end:this.pos,line:Z,column:J};if(/[+\-*/%<>=!&|^~?:]/.test(X))return this.advance(),{type:"OPERATOR",value:X,start:$,end:this.pos,line:Z,column:J};if(/[()[\]{},;.]/.test(X))return this.advance(),{type:"PUNCTUATION",value:X,start:$,end:this.pos,line:Z,column:J};return this.advance(),{type:"PUNCTUATION",value:X,start:$,end:this.pos,line:Z,column:J}}readWhitespace($,Z,J){while(this.pos<this.source.length&&/\s/.test(this.source[this.pos]))this.advance();return{type:"WHITESPACE",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}readLineComment($,Z,J){this.advance(2);while(this.pos<this.source.length&&this.source[this.pos]!==`
|
|
3170
|
+
</script>`}var A5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:E7,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:Y7,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:A7,hasEndTag:!1,description:"Include a web component in the template"},T7,k7,P7,v7,Q5,z5,K5,G5,$7,l3,O7,N5,...f7],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function xX($,Z,J){let X=Z||"pages";if($)return{root:$,pagesDir:X};let Y=J||process.cwd(),Q=S0.join(Y,"resources","views"),G=S0.join(Y,"resources","layouts");if(X9.existsSync(Q)&&X9.existsSync(G))return{root:"resources",pagesDir:"views"};let z=S0.join(Y,"resources","views","pages");if(X9.existsSync(z))return{root:"resources/views",pagesDir:X};return{root:".",pagesDir:X}}var I7=new Set,Y9=["partialsDir","componentsDir","layoutsDir"],I5=new WeakMap;function gX($,Z){let J=Z.replace(/[\\/]+$/,"");if(!J||J===".")return!0;let X=$.replace(/\\/g,"/"),Y=J.replace(/\\/g,"/");return X===Y||X.startsWith(`${Y}/`)}function hX($,Z){let J=!$.root,X=xX($.root,$.pagesDir,Z);if($.root=X.root,$.pagesDir=X.pagesDir,J&&X.root!=="."){let Y=`${Z}::${X.root}`;if(!I7.has(Y))I7.add(Y),console.warn(`[stx] No "root" in config \u2014 inferred "${X.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!I5.has($)){let Y={};for(let Q of Y9){let G=$[Q];if(typeof G==="string"&&G)Y[Q]=G}I5.set($,Y)}if($.root&&$.root!=="."){let Y=$.root;for(let Q of Y9){let G=$[Q];if(typeof G!=="string"||!G)continue;if(S0.isAbsolute(G)||gX(G,Y))continue;$[Q]=S0.join(Y,G)}}for(let Y of Y9){let Q=$[Y];if(typeof Q!=="string"||!Q||S0.isAbsolute(Q))continue;$[Y]=S0.resolve(Z,Q)}return $}function uX($,Z){let J=I5.get($);for(let X of Y9){let Y=$[X];if(typeof Y!=="string"||!Y)continue;let Q=S0.isAbsolute(Y)?Y:S0.join(Z,Y);if(X9.existsSync(Q))continue;let G=J?.[X]??Y,z=$.root,K=!!z&&z!==".";console.warn(`[stx] ${String(X)} resolves to "${Q}", which does not exist. Configured as "${G}"`+(K?`, resolved under root "${z}".`:"."))}}function mX($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function dX($){if(b7($.stateDir),$.stateDir=y7(),$.cachePath=B2($.cachePath),$.build)$.build.cacheDir=B2($.build.cacheDir);if($.media?.cache)$.media.cache.directory=B2($.media.cache.directory);if($.story)$.story.outDir=B2($.story.outDir)}var Q1=null,O1=new Map,$9=new Map,V2=null;async function T5($){let Z=$?S0.resolve($):process.cwd(),J=$9.get(Z);if(J&&J.signature!==Z9(J.graph)){let Q=O1.get(Z);if(O1.delete(Z),$9.delete(Z),!$)Q1=null,V2=null;let{clearComponentCache:G}=await import("./chunk-7157az6e.js"),{partialsCache:z}=await import("./chunk-zqtrg15a.js");if(G(),z.clear(),Q&&J.configSignature===J9(J.graph)){let K=Q.then(async(q)=>{let W={...J.graph};await S7(W,Z),$9.set(Z,{graph:W,signature:Z9(W),configSignature:J9(W)});let U={...q,_layerGraph:W};if(!$)Q1=U;return U});return O1.set(Z,K),K}}if(!$){if(Q1)return Q1;if(V2)return V2}let X=O1.get(Z);if(X)return X;let Y=(async()=>{let G=(await fX({name:"stx",alias:"ui",cwd:Z,defaultConfig:A5,verbose:!1})).config;if(G.extends!==void 0||J){let z=await C7(Z,A5);G=z.config,$9.set(Z,{graph:z.graph,signature:Z9(z.graph),configSignature:J9(z.graph)})}if(G.runtimeConfig){let{resolveRuntimeConfig:z}=await import("./chunk-x4vhn880.js");z(G.runtimeConfig,{});let{generateRuntimeConfigTypes:K}=await import("./chunk-ca6t6nnn.js");await K(Z,G.runtimeConfig)}if(mX(G),dX(G),hX(G,Z),uX(G,Z),G.plugins&&G.plugins.length>0){let{pluginManager:z}=await import("./chunk-stbns4bg.js"),K=[],q=[];for(let W of G.plugins){let U=typeof W==="string"?W:W[0],H=typeof W==="string"?{}:W[1]||{};try{let j,B;try{j=await import(U),B=S0.dirname(f.resolve(U))}catch{let L=S0.resolve(Z,U);j=await import(L),B=S0.dirname(L)}let V=j.default||j;if(!z.has(V.name))await z.register(V,G);if(V.components){let L=Array.isArray(V.components)?V.components:[V.components];for(let _ of L)K.push(S0.resolve(B,_))}if(V.pages){let L=S0.resolve(B,V.pages),_=H.path||"/";q.push({dir:L,prefix:_})}if(V.setup){let L={addDirective:(_)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(_)},addRoute:(_,F)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[_]=F},addMiddleware:(_)=>{G.middleware=G.middleware||[],G.middleware.push(_)},pluginDir:B,config:G};await V.setup(H,L)}console.log(`[stx] Plugin loaded: ${V.name||U}`)}catch(j){console.warn(`[stx] Failed to load plugin ${U}:`,j.message)}}G._pluginComponentDirs=K,G._pluginPageDirs=q}return G})();if(O1.set(Z,Y),Y.catch(()=>{if(O1.get(Z)===Y)O1.delete(Z)}),!$)V2=Y,Y.then((Q)=>{Q1=Q}).catch(()=>{});return Y}var x7=new Proxy(A5,{get($,Z){if(Q1&&Z in Q1)return Q1[Z];if(!V2)T5().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return $[Z]}});function HU($){return $}function jU($){let Z=[],J=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Y}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Y}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Y}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Y}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Y}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)J.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)J.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Y,Q)=>{if(!Y.pattern||typeof Y.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Y.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Y.maxAgeSeconds!==void 0&&(typeof Y.maxAgeSeconds!=="number"||Y.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Y.maxEntries!==void 0&&(typeof Y.maxEntries!=="number"||Y.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Y)=>typeof Y!=="number"||Y<16||Y>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!X.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)J.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)J.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:J}}var E5=new Map;async function pX($,Z={}){try{if(!await e($))throw Error(`Markdown file not found: ${$}`);let X=(await lX.promises.stat($)).mtime.getTime();if(Z.cache&&E5.has($)){let U=E5.get($);if(U.updatedAt>=X)return{content:U.content,data:U.data}}let Y=await Bun.file($).text(),{data:Q,content:G}=J7(Y),z=Z.markdown||x7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=U2(G,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)q=await iX(q,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:q,data:Q||{}};if(Z.cache)E5.set($,{...W,updatedAt:X});return W}catch(J){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,J);let X=J instanceof Error?J.message:String(J);return{content:_0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}var Q9=null;async function iX($,Z,J){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!Q9)try{Q9=await cX({theme:Z||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),$}let Y=async(z,K,q,W)=>{let U=W.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),H=q||(J?"text":"");if(!H)return z;try{if(!Q9.getSupportedLanguages().includes(H))return z;return(await Q9.highlight(U,H,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${q}:`,j)}return z},Q=$,G=$.matchAll(X);for(let z of G){let[K,q,W,U]=z,H=await Y(K,q,W,U);Q=Q.replace(K,H)}return Q}async function g7($,Z,J="",X={}){return await nX($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,z,K,q)=>{try{let W=z;if(!k5.isAbsolute(z))W=k5.resolve(k5.dirname(J),z);let U={};if(K)try{try{U=JSON.parse(K)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let F=K.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let O of F){let w=O.indexOf(":");if(w>0){let N=O.substring(0,w).trim(),R=O.substring(w+1).trim(),M=R.startsWith('"')&&R.endsWith('"'),T=R.startsWith("'")&&R.endsWith("'");if(M||T)R=R.substring(1,R.length-1);U[N]=R}}}}catch(_){if(X.debug)console.error("Error parsing context in @markdown-file directive:",_)}let{content:H,data:j}=await pX(W,X),B={...Z,...j,...U},V=H,L=/\{\{([^}]+)\}\}/g;return V=V.replace(L,(_,F)=>{let O=F.trim();return B[O]!==void 0?String(B[O]):_}),V}catch(W){let U=W instanceof Error?W.message:String(W);return _0("Markdown File",`Error including markdown file: ${U}`,J,$,q,G)}})}async function nX($,Z,J){let X=[],Y;while((Y=Z.exec($))!==null){let z=Y[0],K=Y.index,q=Y;X.push(J(...q).then((W)=>({match:z,replacement:W,index:K})))}let Q=await Promise.all(X);Q.sort((z,K)=>K.index-z.index);let G=$;for(let{match:z,replacement:K}of Q)G=G.replace(z,()=>K);return G}function G1($,Z){try{let J=$.trim();if(H0(J))return q0(J,Object.keys(Z))(...Object.values(Z));else return Q0(J,Z)}catch{return!1}}class G9{source;pos=0;line=1;column=0;tokens=[];constructor($){this.source=$}tokenize(){this.tokens=[],this.pos=0,this.line=1,this.column=0;while(this.pos<this.source.length){let $=this.nextToken();if($)this.tokens.push($)}return this.tokens.push({type:"EOF",value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),this.tokens}nextToken(){if(this.pos>=this.source.length)return null;let $=this.pos,Z=this.line,J=this.column,X=this.source[this.pos];if(/\s/.test(X))return this.readWhitespace($,Z,J);if(X==="/"&&this.peek(1)==="/")return this.readLineComment($,Z,J);if(X==="/"&&this.peek(1)==="*")return this.readBlockComment($,Z,J);if(X==='"'||X==="'")return this.readString(X,$,Z,J);if(X==="`")return this.readTemplateString($,Z,J);if(/\d/.test(X)||X==="."&&/\d/.test(this.peek(1)||""))return this.readNumber($,Z,J);if(/[a-z_$]/i.test(X))return this.readIdentifier($,Z,J);if(X==="{"){if(this.peek(1)==="{"&&this.peek(2)==="{")return this.advance(3),{type:"RAW_START",value:"{{{",start:$,end:this.pos,line:Z,column:J};if(this.peek(1)==="{")return this.advance(2),{type:"EXPRESSION_START",value:"{{",start:$,end:this.pos,line:Z,column:J};if(this.peek(1)==="!"&&this.peek(2)==="!")return this.advance(3),{type:"RAW_START",value:"{!!",start:$,end:this.pos,line:Z,column:J}}if(X==="}"){if(this.peek(1)==="}"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"}}}",start:$,end:this.pos,line:Z,column:J};if(this.peek(1)==="}")return this.advance(2),{type:"EXPRESSION_END",value:"}}",start:$,end:this.pos,line:Z,column:J}}if(X==="!"&&this.peek(1)==="!"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"!!}",start:$,end:this.pos,line:Z,column:J};if(X==="@"&&/[a-z]/i.test(this.peek(1)||""))return this.readDirective($,Z,J);let Y=["===","!==","==","!=","<=",">=","&&","||","??","++","--","+=","-=","*=","/=","%=","**","=>","?.","...","<<",">>",">>>","&=","|=","^="];for(let Q of Y)if(this.source.slice(this.pos,this.pos+Q.length)===Q)return this.advance(Q.length),{type:"OPERATOR",value:Q,start:$,end:this.pos,line:Z,column:J};if(/[+\-*/%<>=!&|^~?:]/.test(X))return this.advance(),{type:"OPERATOR",value:X,start:$,end:this.pos,line:Z,column:J};if(/[()[\]{},;.]/.test(X))return this.advance(),{type:"PUNCTUATION",value:X,start:$,end:this.pos,line:Z,column:J};return this.advance(),{type:"PUNCTUATION",value:X,start:$,end:this.pos,line:Z,column:J}}readWhitespace($,Z,J){while(this.pos<this.source.length&&/\s/.test(this.source[this.pos]))this.advance();return{type:"WHITESPACE",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}readLineComment($,Z,J){this.advance(2);while(this.pos<this.source.length&&this.source[this.pos]!==`
|
|
3171
3171
|
`)this.advance();return{type:"COMMENT",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}readBlockComment($,Z,J){this.advance(2);while(this.pos<this.source.length-1){if(this.source[this.pos]==="*"&&this.source[this.pos+1]==="/"){this.advance(2);break}this.advance()}return{type:"COMMENT",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}readString($,Z,J,X){this.advance();while(this.pos<this.source.length){let Y=this.source[this.pos];if(Y==="\\"){this.advance(2);continue}if(Y===$){this.advance();break}this.advance()}return{type:"STRING",value:this.source.slice(Z,this.pos),start:Z,end:this.pos,line:J,column:X}}readTemplateString($,Z,J){this.advance();let X=0,Y=256;while(this.pos<this.source.length){let Q=this.source[this.pos];if(Q==="\\"){this.advance(2);continue}if(Q==="$"&&this.peek(1)==="{"){if(X>=Y){this.pos=this.source.length;break}this.advance(2),X++;continue}if(Q==="{"&&X>0){X++,this.advance();continue}if(Q==="}"&&X>0){X--,this.advance();continue}if(Q==="`"&&X===0){this.advance();break}this.advance()}return{type:"TEMPLATE_STRING",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}readNumber($,Z,J){if(this.source[this.pos]==="0"){let X=this.peek(1)?.toLowerCase();if(X==="x"||X==="o"||X==="b"){this.advance(2);while(this.pos<this.source.length&&/[\da-f_]/i.test(this.source[this.pos]))this.advance();return{type:"NUMBER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}}while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance();if(this.source[this.pos]==="."&&/\d/.test(this.peek(1)||"")){this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(/e/i.test(this.source[this.pos]||"")){if(this.advance(),/[+-]/.test(this.source[this.pos]||""))this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(this.source[this.pos]==="n")this.advance();return{type:"NUMBER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}readIdentifier($,Z,J){while(this.pos<this.source.length&&/[\w$]/.test(this.source[this.pos]))this.advance();return{type:"IDENTIFIER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}readDirective($,Z,J){this.advance();while(this.pos<this.source.length&&/[a-z]/i.test(this.source[this.pos]))this.advance();return{type:"DIRECTIVE",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}advance($=1){for(let Z=0;Z<$&&this.pos<this.source.length;Z++){if(this.source[this.pos]===`
|
|
3172
3172
|
`)this.line++,this.column=0;else this.column++;this.pos++}}peek($){return this.source[this.pos+$]}saveState(){return{pos:this.pos,line:this.line,column:this.column}}restoreState($){this.pos=$.pos,this.line=$.line,this.column=$.column}}function N0($,Z,J,X=0){let Y=0,Q=X,G=null,z=0,K=!1;while(Q<$.length){let q=$[Q];if(G&&K){K=!1,Q++;continue}if(G&&q==="\\"){K=!0,Q++;continue}if(K=!1,(q==='"'||q==="'"||q==="`")&&!G){G=q,Q++;continue}if(q===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&q==="$"&&$[Q+1]==="{"){z++,Q+=2;continue}if(z>0&&q==="}"){z--,Q++;continue}if(q==="`"&&G==="`"&&z===0){G=null,Q++;continue}if(G){Q++;continue}if(q===Z)Y++;else if(q===J){if(Y--,Y===0)return Q}Q++}return-1}function h7($,Z){let J=Z,X={paren:0,bracket:0,brace:0},Y=null,Q=0;while(J<$.length){let G=$[J];if((J>0?$[J-1]:"")==="\\"&&Y){J++;continue}if((G==='"'||G==="'")&&!Y){Y=G,J++;continue}if(G===Y&&Y!=="`"){Y=null,J++;continue}if(G==="`"&&!Y){Y="`",J++;continue}if(G==="`"&&Y==="`"&&Q===0){Y=null,J++;continue}if(Y==="`"&&G==="$"&&$[J+1]==="{"){Q++,J+=2;continue}if(Q>0){if(G==="{")Q++;else if(G==="}")Q--;J++;continue}if(Y){J++;continue}if(X.paren===0&&X.bracket===0&&X.brace===0){if($.slice(J,J+2)==="}}"||$.slice(J,J+3)==="!!}")break;if(G===","||G===";")break}if(G==="(")X.paren++;else if(G===")"){if(X.paren--,X.paren<0)break}else if(G==="[")X.bracket++;else if(G==="]"){if(X.bracket--,X.bracket<0)break}else if(G==="{")X.brace++;else if(G==="}"){if(X.brace--,X.brace<0)break}J++}return{expression:$.slice(Z,J),endPos:J}}function b5($){let Z=[],J="",X={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let z=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){J+=z;continue}if((z==='"'||z==="'")&&!Y){Y=z,J+=z;continue}if(z===Y&&Y!=="`"){Y=null,J+=z;continue}if(z==="`"&&!Y){Y="`",J+=z;continue}if(z==="`"&&Y==="`"&&Q===0){Y=null,J+=z;continue}if(Y==="`"&&z==="$"&&$[G+1]==="{"){Q++,J+=z+$[G+1],G++;continue}if(Q>0&&z==="{"){Q++,J+=z;continue}if(Q>0&&z==="}"){Q--,J+=z;continue}if(Y){J+=z;continue}if(z==="(")X.paren++;else if(z===")")X.paren--;else if(z==="[")X.bracket++;else if(z==="]")X.bracket--;else if(z==="{")X.brace++;else if(z==="}")X.brace--;if(z==="|"&&$[G+1]!=="|"&&(G===0||$[G-1]!=="|")&&$[G-1]!=="\\"&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(J.trim()),J="";continue}if(z==="|"&&$[G-1]==="\\"&&!Y){J=J.slice(0,-1)+z;continue}J+=z}if(J.trim())Z.push(J.trim());return Z}function z1($,Z){let J=oX($,Z);return J.ok?{expression:J.expression,endPos:J.endPos}:null}function oX($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return{ok:!1,reason:"missing-open-paren",pos:J};let X=N0($,"(",")",J);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:J};return{ok:!0,expression:$.slice(J+1,X),endPos:X+1}}function sX($,Z){let J=$.lastIndexOf("<",Z);if(J===-1)return!1;return J>$.lastIndexOf(">",Z)}function _1($,Z,J,X){let Y=1,Q=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),z=new RegExp(`@${J}(?![a-z])`,"g");while(Q<$.length&&Y>0){G.lastIndex=Q,z.lastIndex=Q;let K=G.exec($),q=z.exec($),W=K?K.index:1/0,U=q?q.index:1/0;if(W<U)Y++,Q=W+K[0].length;else if(U<1/0){if(Y--,Y===0)return U;Q=U+q[0].length}else break}return-1}function u7($,Z){let J=$.slice(Z).match(/^@if\s*/);if(!J)return null;let X=Z+J[0].length,Y=z1($,X);if(!Y)return null;let Q=Y.endPos,G=_1($,"if","endif",Q);if(G===-1)return null;let z=$.slice(Q,G),K=[],q=0,W="if",U=Y.expression,H=0,j=0;while(q<z.length){let B=z.indexOf("@",q);if(B===-1)break;q=B;let V=z.substring(B);if(sX(z,B)){q++;continue}if(/^@if\s*\(/.test(V)){j++,q++;continue}if(/^@endif(?![a-z])/.test(V)){j--,q+=6;continue}if(j===0){let L=V.match(/^@elseif\s*/);if(L){K.push({type:W,condition:U,content:z.substring(H,q),start:Q+H,end:Q+q});let _=q+L[0].length,F=z1(z,_);if(!F){q++;continue}W="elseif",U=F.expression,q=F.endPos,H=q;continue}else if(/^@else(?![a-z])/.test(V)){K.push({type:W,condition:U,content:z.substring(H,q),start:Q+H,end:Q+q}),W="else",U=void 0,q+=5,H=q;continue}}q++}return K.push({type:W,condition:U,content:z.slice(H),start:Q+H,end:Q+z.length}),{fullMatch:$.slice(Z,G+6),branches:K,start:Z,end:G+6}}function O2($){let Z=[],J=/@if\s*\(/g,X=J.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=J.exec($);continue}let Q=u7($,X.index);if(Q)Z.push(Q),J.lastIndex=Q.end;X=J.exec($)}return Z}function z9($,Z,J){let X=[],Y=new RegExp(`@${Z}\\s*\\(`,"g"),Q=Y.exec($);while(Q!==null){if(X.some((V)=>Q.index>V.start&&Q.index<V.end)){Q=Y.exec($);continue}let z=Q.index,K=z+Q[0].length-1,q=N0($,"(",")",K);if(q===-1){Q=Y.exec($);continue}let W=$.slice(K+1,q),U=q+1,H=_1($,Z,J,U);if(H===-1){Q=Y.exec($);continue}let j=$.slice(U,H),B=H+`@${J}`.length;X.push({fullMatch:$.slice(z,B),name:Z,params:W,content:j,start:z,end:B}),Y.lastIndex=B,Q=Y.exec($)}return X}function y5($,Z){let J=$.slice(Z).match(/^@switch\s*/);if(!J)return null;let X=Z+J[0].length,Y=z1($,X);if(!Y)return null;let Q=Y.endPos,G=_1($,"switch","endswitch",Q);if(G===-1)return null;let z=$.slice(Q,G),K=[],q=0,W=null,U=0;while(q<z.length){let H=z.slice(q),j=H.match(/^@switch\s*\(/),B=H.match(/^@endswitch(?![a-z])/);if(j){if(U++,W)W.content+=j[0];q+=j[0].length;continue}if(B){if(U--,W)W.content+=B[0];q+=B[0].length;continue}if(U>0){if(W)W.content+=z[q];q++;continue}let V=H.match(/^@case\s*/),L=H.match(/^@default(?![a-z])/),_=H.match(/^@break(?![a-z])/);if(V&&H.startsWith("@case")){if(W)K.push(W);let F=q+V[0].length,O=z1(z,F);if(!O){q++;continue}W={type:"case",value:O.expression,content:""},q=O.endPos}else if(L&&H.startsWith("@default")){if(W)K.push(W);W={type:"default",content:""},q+=L[0].length}else if(_&&H.startsWith("@break"))q+=_[0].length;else{if(W)W.content+=z[q];q++}}if(W)K.push(W);return{fullMatch:$.slice(Z,G+10),expression:Y.expression,cases:K,start:Z,end:G+10}}function rX($){let Z=[],J=0;while(J<$.length){let X=$.indexOf("{{",J),Y=$.indexOf("{!!",J),Q=!1,G;if(X===-1&&Y===-1)break;else if(X===-1)G=Y,Q=!0;else if(Y===-1)G=X,Q=!1;else if(Y<X)G=Y,Q=!0;else G=X,Q=!1;if(!Q&&$.slice(G,G+3)==="{{{")Q=!0;let z=Q?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",K=Q?z==="{{{"?"}}}":"!!}":"}}",q=G+z.length,W=aX($,q,K);if(W===-1){J=G+1;continue}let U=$.slice(q,W).trim(),H=W+K.length;Z.push({fullMatch:$.slice(G,H),expression:U,start:G,end:H,isRaw:Q}),J=H}return Z}function aX($,Z,J){let X=Z,Y=null,Q={paren:0,bracket:0,brace:0},G=0;while(X<$.length){let z=$[X];if((X>0?$[X-1]:"")==="\\"&&Y){X++;continue}if((z==='"'||z==="'")&&!Y){Y=z,X++;continue}if(z===Y&&Y!=="`"){Y=null,X++;continue}if(z==="`"&&!Y){Y="`",X++;continue}if(z==="`"&&Y==="`"&&G===0){Y=null,X++;continue}if(Y==="`"&&z==="$"&&$[X+1]==="{"){G++,X+=2;continue}if(G>0){if(z==="{")G++;else if(z==="}")G--;X++;continue}if(Y){X++;continue}if(z==="(")Q.paren++;else if(z===")")Q.paren--;else if(z==="[")Q.bracket++;else if(z==="]")Q.bracket--;else if(z==="{")Q.brace++;else if(z==="}")Q.brace--;if(Q.paren===0&&Q.bracket===0&&Q.brace<=0){if($.slice(X,X+J.length)===J)return X}X++}return-1}function tX($){let Z=b5($);if(Z.length===0)return{baseExpression:"",filters:[]};let J=Z[0],X=[];for(let Y=1;Y<Z.length;Y++){let Q=eX(Z[Y]);if(Q)X.push(Q)}return{baseExpression:J,filters:X}}function eX($){let Z=$.trim();if(!Z)return null;let J=Z.indexOf("(");if(J===-1)return{name:Z,args:[]};let X=Z.slice(0,J).trim(),Y=J+1,Q=N0(Z,"(",")",J);if(Q===-1)return{name:X,args:[]};let G=Z.slice(Y,Q),z=l7(G);return{name:X,args:z}}function l7($){let Z=[],J="",X={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let z=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){J+=z;continue}if((z==='"'||z==="'")&&!Y){Y=z,J+=z;continue}if(z===Y&&Y!=="`"){Y=null,J+=z;continue}if(z==="`"&&!Y){Y="`",J+=z;continue}if(z==="`"&&Y==="`"&&Q===0){Y=null,J+=z;continue}if(Y==="`"&&z==="$"&&$[G+1]==="{"){Q++,J+="${",G++;continue}if(Q>0&&z==="{"){Q++,J+=z;continue}if(Q>0&&z==="}"){Q--,J+=z;continue}if(Y){J+=z;continue}if(z==="(")X.paren++;else if(z===")")X.paren--;else if(z==="[")X.bracket++;else if(z==="]")X.bracket--;else if(z==="{")X.brace++;else if(z==="}")X.brace--;if(z===","&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(J.trim()),J="";continue}J+=z}if(J.trim())Z.push(J.trim());return Z}function $Y($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return null;let X=N0($,"(",")",J);if(X===-1)return null;return{params:$.slice(J+1,X),endPos:X+1}}function ZY($){let Z=[],X=new G9($).tokenize().filter((Q)=>Q.type!=="WHITESPACE"&&Q.type!=="COMMENT"),Y=0;while(Y<X.length){let Q=X[Y],G=!1;if(Q.type==="IDENTIFIER"&&Q.value==="export"){if(G=!0,Y++,Y>=X.length)break}let z=X[Y];if(z.type==="IDENTIFIER"&&(z.value==="const"||z.value==="let"||z.value==="var")){let K=z.value;if(Y++,Y>=X.length)break;let q=X[Y];if(q.type==="IDENTIFIER"){let W=q.value;if(Y++,Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let U=Y<X.length?X[Y].start:$.length,H=m7(X,Y,$);Y=H.nextIndex,Z.push({type:"variable",name:W,value:$.slice(U,H.endPos),exported:G,start:z.start,end:H.endPos})}}else if(q.type==="PUNCTUATION"&&(q.value==="{"||q.value==="[")){let W=q.start,U=q.value==="{"?"}":"]",H=N0($,q.value,U,W);if(H!==-1){let j=$.slice(W,H+1);if(Y=d7(X,H+1),Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let B=Y<X.length?X[Y].start:$.length,V=m7(X,Y,$);Y=V.nextIndex;let L=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:L,value:`${$.slice(B,V.endPos)}; ${K} ${j} = ${L}`,exported:G,start:z.start,end:V.endPos})}}}}else if(z.type==="IDENTIFIER"&&z.value==="function"){let K=G?X[Y-1].start:z.start;if(Y++,Y>=X.length)break;let q=X[Y];if(q.type==="IDENTIFIER"){let W=q.value;Y++;let U=-1;while(Y<X.length){if(X[Y].type==="PUNCTUATION"&&X[Y].value==="{"){U=X[Y].start;break}Y++}if(U!==-1){let H=N0($,"{","}",U);if(H!==-1)Z.push({type:"function",name:W,value:$.slice(K,H+1).replace(/^export\s+/,""),exported:G,start:K,end:H+1}),Y=d7(X,H+1)}}}else Y++}return Z}function m7($,Z,J){let X=Z,Y={paren:0,bracket:0,brace:0},Q=Z<$.length?$[Z].start:J.length;while(X<$.length){let G=$[X];if(G.type==="PUNCTUATION"){if(G.value==="(")Y.paren++;else if(G.value===")")Y.paren--;else if(G.value==="[")Y.bracket++;else if(G.value==="]")Y.bracket--;else if(G.value==="{")Y.brace++;else if(G.value==="}")Y.brace--;if(G.value===";"&&Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=G.start,X++;break}}if(G.type==="IDENTIFIER"&&(G.value==="const"||G.value==="let"||G.value==="var"||G.value==="function"||G.value==="export")){if(Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=$[X-1]?.end??G.start;break}}Q=G.end,X++}return{nextIndex:X,endPos:Q}}function d7($,Z){for(let J=0;J<$.length;J++)if($[J].start>=Z)return J;return $.length}function JY($,Z,J){let X=$,Y=!0;while(Y){Y=!1;let Q=X.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,z=y5(X,G);if(!z)break;try{let K;if(H0(z.expression))K=q0(z.expression,Object.keys(Z))(...Object.values(Z));else K=Q0(z.expression,Z);let q="",W=!1;for(let U of z.cases)if(U.type==="default"){if(!W)q=U.content.trim()}else try{let H;if(U.value&&H0(U.value))H=q0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)H=Q0(U.value,Z);if(K===H){q=U.content.trim(),W=!0;break}}catch{continue}X=X.substring(0,G)+q+X.substring(z.end),Y=!0}catch(K){let q=K instanceof Error?K.message:String(K),W=R0("Switch",`Error evaluating @switch expression: ${q}`,w0.EVALUATION_ERROR);X=X.substring(0,G)+W+X.substring(z.end);break}}return X}function XY($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(X)=>{return Z.push(X),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function YY($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(J,X)=>Z[Number(X)]??J)}function a0($,Z,J){let{masked:X,scripts:Y}=XY($);return YY(QY(X,Z,J),Y)}function QY($,Z,J){let X=$;X=JY(X,Z,J);{let Q=!0;while(Q){Q=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let z=G.index,K=z1(X,z+7);if(!K)break;let q=K.endPos,W=_1(X,"unless","endunless",q);if(W===-1){console.warn(`[stx] @unless directive at position ${z} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let U=X.slice(q,W),H=K.expression,j=-1;{let V=0,L=/@(?:if|unless)\s*\(/g,_=/@(?:endif|endunless)(?![a-z])/g,F=/@else(?![a-z])/g,O=[],w;while((w=L.exec(U))!==null)O.push({pos:w.index,type:"open"});while((w=_.exec(U))!==null)O.push({pos:w.index,type:"close"});while((w=F.exec(U))!==null)O.push({pos:w.index,type:"else"});O.sort((N,R)=>N.pos-R.pos);for(let N of O)if(N.type==="open")V++;else if(N.type==="close")V--;else if(N.type==="else"&&V===0){j=N.pos;break}}let B;if(j!==-1){let V=U.slice(0,j),L=U.slice(j+5);B=`@if (${H})${L}@else ${V}@endif`}else B=`@if (!(${H}))${U}@endif`;X=X.substring(0,z)+B+X.substring(W+10),Q=!0}}X=S5(X,Z,J),X=P5(X,Z,J),X=C5(X,Z);let Y=()=>{let Q=O2(X);if(Q.length===0)return!1;let G=Array(Q.length);for(let q=Q.length-1;q>=0;q--){let W=Q[q];try{let U="",H=!1;for(let j of W.branches){if(H)break;if(j.type==="else")U=j.content,H=!0;else try{let B;if(j.condition&&H0(j.condition))B=q0(j.condition,Object.keys(Z))(...Object.values(Z));else if(j.condition)B=Q0(j.condition,Z);if(B)U=j.content,H=!0}catch(B){U=R0(j.type==="if"?"If":"Elseif",`Error in @${j.type}(${j.condition}): ${B instanceof Error?B.message:String(B)}`,w0.EVALUATION_ERROR),H=!0}}G[q]=U}catch(U){let H=U instanceof Error?U.message:String(U);G[q]=R0("If",`Error processing @if block: ${H}`,w0.EVALUATION_ERROR)}}let z=Array(Q.length*2+1),K=0;for(let q=0;q<Q.length;q++){let W=Q[q];z[q*2]=X.slice(K,W.start),z[q*2+1]=G[q],K=W.end}return z[Q.length*2]=X.slice(K),X=z.join(""),!0};while(!0){let Q=X;if(!Y())break;if(X===Q)break}return X}function c7($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let J=$[Z];if(J!=="'"&&J!=='"')return null;Z++;let X=[];while(Z<$.length){let Y=$[Z];if(Y==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Y===J){Z++;break}X.push(Y),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function C5($,Z){let J=$;function X(z,K,q,W){let U=1,H=W,j=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${q}(?![a-z])`,"g");while(H<z.length&&U>0){j.lastIndex=H,B.lastIndex=H;let V=j.exec(z),L=B.exec(z),_=V?V.index:1/0,F=L?L.index:1/0;if(_<F)U++,H=_+V[0].length;else if(F<1/0){if(U--,U===0)return F;H=F+L[0].length}else break}return-1}function Y(z,K,q){let W=0,U=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),H=new RegExp(`@${q}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],V;while((V=U.exec(z))!==null)B.push({pos:V.index,type:"open"});while((V=H.exec(z))!==null)B.push({pos:V.index,type:"close"});while((V=j.exec(z))!==null)B.push({pos:V.index,type:"else"});B.sort((L,_)=>L.pos-_.pos);for(let L of B)if(L.type==="open")W++;else if(L.type==="close")W--;else if(L.type==="else"&&W===0)return L.pos;return-1}{let z=!0;while(z){z=!1;let K=J.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let q=K.index,W,U,H=J.slice(q+5),j=c7(H);if(j)W=j.value,U=q+5+j.consumed;else U=q+5;let B=X(J,"auth","endauth",U);if(B===-1){console.warn(`[stx] @auth directive at position ${q} has no matching @endauth \u2014 the block was skipped.`);break}let V=J.slice(U,B),L=Y(V,"auth","endauth"),_;if(!Z.auth)_=!1;else _=W?G1(`auth?.check && auth?.user?.[${W}]`,Z):G1("auth?.check",Z);let F;if(L!==-1){let O=V.slice(0,L),w=V.slice(L+5);F=_?O:w}else F=_?V:"";J=J.substring(0,q)+F+J.substring(B+8),z=!0}}{let z=!0;while(z){z=!1;let K=J.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let q=K.index,W,U,H=J.slice(q+6),j=c7(H);if(j)W=j.value,U=q+6+j.consumed;else U=q+6;let B=X(J,"guest","endguest",U);if(B===-1){console.warn(`[stx] @guest directive at position ${q} has no matching @endguest \u2014 the block was skipped.`);break}let V=J.slice(U,B),L=Y(V,"guest","endguest"),_;if(!Z.auth)_=!0;else _=W?G1(`!auth?.check || !auth?.user?.[${W}]`,Z):G1("!auth?.check",Z);let F;if(L!==-1){let O=V.slice(0,L),w=V.slice(L+5);F=_?O:w}else F=_?V:"";J=J.substring(0,q)+F+J.substring(B+9),z=!0}}function Q(z,K,q){if(Z.userCan&&typeof Z.userCan[z]==="boolean")return Z.userCan[z];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let W=[z];if(K)W.push(K);if(q){let U=G1(q,Z);W.push(U)}return Z.permissions.check(...W)}catch{return!1}return!1}function G(z){let K=z.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!K)return null;return{ability:K[1],type:K[2],id:K[3]?.trim(),paramsEnd:K[0].length}}for(let z of["can","cannot"]){let K=`end${z}`,q=z==="can"?"elsecan":"elsecannot",W=!0;while(W){W=!1;let U=J.match(new RegExp(`@${z}\\s*\\(`));if(!U||U.index===void 0)break;let H=U.index,j=J.slice(H+`@${z}`.length),B=G(j);if(!B)break;let V=H+`@${z}`.length+B.paramsEnd,L=X(J,z,K,V);if(L===-1){console.warn(`[stx] @${z} directive at position ${H} has no matching @${K} \u2014 the block was skipped.`);break}let _=J.slice(V,L),F=[],O=0,w=new RegExp(`@${z}\\s*\\(`,"g"),N=new RegExp(`@${K}(?![a-z])`,"g"),R=new RegExp(`@${q}\\s*\\(`,"g"),M=/@else(?![a-z])/g,T=[],D;while((D=w.exec(_))!==null)T.push({pos:D.index,type:"open"});while((D=N.exec(_))!==null)T.push({pos:D.index,type:"close"});while((D=R.exec(_))!==null)T.push({pos:D.index,type:"elseDirective"});while((D=M.exec(_))!==null)T.push({pos:D.index,type:"else"});T.sort((y,b)=>y.pos-b.pos);for(let y of T){if(y.type==="open"){O++;continue}if(y.type==="close"){O--;continue}if(O===0)F.push(y)}let I=[],E=0;for(let y=0;y<F.length;y++){let b=F[y];if(I.push({content:_.slice(E,b.pos),ability:void 0}),b.type==="elseDirective"){let P=_.slice(b.pos+`@${q}`.length),u=G(P);if(u){I[I.length-1]={content:_.slice(E,b.pos)},E=b.pos+`@${q}`.length+u.paramsEnd,I.push({content:"",ability:u.ability,type:u.type,id:u.id}),I.pop();let l=F[y+1],g=l?l.pos:_.length;I.push({content:_.slice(E,g),ability:u.ability,type:u.type,id:u.id}),E=g}}else E=b.pos+5}if(E<_.length){let y=I[I.length-1];if(F.length>0&&F[F.length-1].type==="else")I.push({content:_.slice(E),isFinalElse:!0});else if(I.length===0)I.push({content:_.slice(E)})}let A=Q(B.ability,B.type,B.id),k=z==="can"?A:!A,C="";if(k)C=I[0]?.content||"";else{let y=!1;for(let b=1;b<I.length;b++){let P=I[b];if(P.isFinalElse){C=P.content,y=!0;break}if(P.ability){let u=Q(P.ability,P.type,P.id);if(z==="can"?u:!u){C=P.content,y=!0;break}}}if(!y&&I.length>0){let b=I[I.length-1];if(b.isFinalElse)C=b.content}}J=J.substring(0,H)+C+J.substring(L+`@${K}`.length),W=!0}}return J}function S5($,Z,J){let X=$;function Y(Q,G,z,K,q){let W=!0;while(W){W=!1;let U=new RegExp(`@${G}\\s*\\(`),H=Q.match(U);if(!H||H.index===void 0)break;let j=H.index,B=z1(Q,j+`@${G}`.length);if(!B)break;let V=B.endPos,L=_1(Q,G,z,V);if(L===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${z} \u2014 the block was skipped.`);break}let _=Q.slice(V,L),F=B.expression,O=-1,w=0,N=0;while(N<_.length){let R=_.indexOf("@",N);if(R===-1)break;let M=_.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(M)){w++,N=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(M)){w--,N=R+1;continue}if(w===0&&/^@else(?![a-z])/.test(M)){O=R;break}N=R+1}try{let R=K(F.trim()),M;if(O!==-1){let T=_.slice(0,O),D=_.slice(O+5);M=R?T:D}else M=R?_:"";Q=Q.substring(0,j)+M+Q.substring(L+`@${z}`.length),W=!0}catch(R){let M=R instanceof Error?R.message:String(R),T=R0(q,`Error processing @${G} directive: ${M}`,w0.EVALUATION_ERROR);Q=Q.substring(0,j)+T+Q.substring(L+`@${z}`.length);break}}return Q}return X=Y(X,"isset","endisset",(Q)=>{let G=G1(Q,Z);return G!==void 0&&G!==null},"Isset"),X=Y(X,"empty","endempty",(Q)=>{let G=G1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function P5($,Z,J){let X=$,Y="development";function Q(G,z,K,q){let W=new RegExp(`@${z}(?![a-z])`,"g"),U=new RegExp(`@${K}(?![a-z])`,"g"),H=new RegExp(`^@${z}(?![a-z])`),j=new RegExp(`^@${K}(?![a-z])`),B=G,V=!0;while(V){V=!1,W.lastIndex=0;let L=W.exec(B);if(!L)break;let _=L.index,F=_+L[0].length;if(z==="env"){let A=B.substring(F).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!A)break;F+=A[0].length,q=Y===A[2]}let O=1,w=F,N=-1;while(O>0&&w<B.length){W.lastIndex=w,U.lastIndex=w;let A=W.exec(B),k=U.exec(B),C=A?A.index:1/0,y=k?k.index:1/0;if(C<y)O++,w=C+A[0].length;else if(y<1/0){if(O--,O===0){N=y;break}w=y+k[0].length}else break}if(N===-1){console.warn(`[stx] @${z} directive at position ${_} has no matching @${K} \u2014 the block was skipped.`);break}let R=B.substring(F,N),M=-1,T=0,D=0;while(D<R.length){let A=R.indexOf("@",D);if(A===-1)break;let k=R.substring(A);if(H.test(k)){T++,D=A+1;continue}if(j.test(k)){T--,D=A+1;continue}if(T===0&&/^@else(?![a-z])/.test(k)){M=A;break}D=A+1}let I;if(M!==-1){let A=R.slice(0,M),k=R.slice(M+5);I=q?A:k}else I=q?R:"";let E=`@${K}`.length;B=B.substring(0,_)+I+B.substring(N+E),V=!0}return B}return X=Q(X,"env","endenv",!1),X=Q(X,"production","endproduction",Y==="production"),X=Q(X,"development","enddevelopment",Y==="development"),X=Q(X,"staging","endstaging",Y==="staging"),X=Q(X,"testing","endtesting",Y==="testing"),X}var v5=new WeakMap;function p7($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function L1($,Z){if(!$)return Z?.nonceGenerator?.()??p7();let J=v5.get($);if(!J)J=Z?.nonceGenerator?.()??p7(),v5.set($,J);return J}function uU($){v5.delete($)}function i7($,Z){let J=[];for(let[X,Y]of Object.entries($)){if(Y===void 0||Y===null)continue;if(typeof Y==="boolean"){if(Y)J.push(X);continue}if(Array.isArray(Y)){let Q=[...Y];if(Z&&(X==="script-src"||X==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)J.push(`${X} ${Q.join(" ")}`)}}return J.join("; ")}function x5($,Z){return`<meta http-equiv="Content-Security-Policy" content="${i7($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}var GY={"default-src":["'self'"],"script-src":["'self'","'strict-dynamic'"],"style-src":["'self'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'none'"],"base-uri":["'self'"],"form-action":["'self'"],"frame-ancestors":["'self'"],"upgrade-insecure-requests":!0},f5={"default-src":["'self'"],"script-src":["'self'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'","https:"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'self'"],"base-uri":["'self'"],"form-action":["'self'"],"upgrade-insecure-requests":!0},zY={"default-src":["'self'"],"script-src":["'self'","'unsafe-inline'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:","http:"],"font-src":["'self'","https:","http:","data:"],"connect-src":["'self'","https:","http:","ws:","wss:"],"media-src":["'self'","https:","http:"],"object-src":["'none'"],"frame-src":["'self'","https:"],"base-uri":["'self'"]},KY={"default-src":["'none'"],"frame-ancestors":["'none'"]};function mU($){return{enabled:!0,directives:{strict:GY,moderate:f5,relaxed:zY,api:KY}[$]||f5,useNonce:$==="strict",addMetaTag:!0}}function dU($,Z){let J={...$};for(let[X,Y]of Object.entries(Z)){let Q=X,G=J[Q];if(Y===void 0||Y===null)continue;if(typeof Y==="boolean")J[Q]=G||Y;else if(Array.isArray(Y)){let z=Array.isArray(G)?G:[],K=[...new Set([...z,...Y])];J[Q]=K}}return J}function n7($,Z,J){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?L1(J,Z):void 0,Y=x5(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
3173
3173
|
${Y}`)}function o7($,Z){let J=$;return J=J.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(X,Y)=>{if(Y.includes("nonce="))return X;return`<script nonce="${Z}"${Y}>`}),J=J.replace(/<style([^>]*)>/gi,(X,Y)=>{if(Y.includes("nonce="))return X;return`<style nonce="${Z}"${Y}>`}),J}function s7($,Z,J,X){let Y=$,Q=X.csp;if(Y=Y.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?L1(Z,Q):void 0;return x5(Q.directives,G)}),Y=Y.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return L1(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=L1(Z,Q);return Y}var qY={name:"csp",handler:($,Z,J,X)=>{let Q=J.__stx_options?.csp;if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?L1(J,Q):void 0;return x5(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},WY={name:"cspNonce",handler:($,Z,J,X)=>{let Q=J.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return L1(J,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};function lU(){return[qY,WY]}function cU($){let Z=[];if($["script-src"]?.includes("'unsafe-inline'"))Z.push("CSP: Using unsafe-inline in script-src significantly reduces XSS protection");if($["script-src"]?.includes("'unsafe-eval'"))Z.push("CSP: Using unsafe-eval in script-src allows eval() and related functions");if(!$["default-src"])Z.push("CSP: No default-src specified. Recommend adding default-src as a fallback");if($["default-src"]?.includes("*"))Z.push("CSP: Using * in default-src provides minimal protection");if(!$["object-src"]&&!$["default-src"]?.includes("'none'"))Z.push("CSP: Consider adding object-src: none to block plugins");if(!$["base-uri"])Z.push("CSP: Consider adding base-uri to prevent base tag injection attacks");for(let[J,X]of Object.entries($))if(Array.isArray(X)&&X.includes("http:"))Z.push(`CSP: Using http: in ${J} allows insecure resources`);return Z}function UY($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function pU($,Z){if(!$.enabled)return{};let J=$.useNonce?L1(Z,$):void 0,X=i7($.directives,J);return{[UY($.reportOnly)]:X}}var iU={enabled:!1,reportOnly:!1,directives:f5,useNonce:!1,addMetaTag:!0};import HY from"crypto";var jY=40,r7="_token",g5=null;function BY($=jY){let Z=HY.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return g5=Z,Z}function VY(){if(!g5)BY();return g5}function OY($=r7){let Z=VY();return`<input type="hidden" name="${$}" value="${Z}">`}function a7($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,J,X)=>{return OY(X||r7)})}async function t7($,Z,J,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let Y=$;for(let Q of X.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)Y=await _Y(Y,Q,Z,J,X);else Y=await LY(Y,Q,Z,J,X)}return Y}async function _Y($,Z,J,X,Y){let{name:Q,handler:G}=Z,z=`@${Q}`,K=`@end${Q}`,q=$,W=x1(`${z}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${K}`,"g"),U=[],H=W.exec(q);while(H!==null){let[j,B="",V=""]=H,L=H.index||0;try{let _=B?e7(B):[],F=V.trim(),O=await G(F,_,J,X);U.push({original:j,processed:O,startIndex:L})}catch(_){let F=_ instanceof Error?_.message:String(_);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,_);U.push({original:j,processed:R0("CustomDirective",`Error in @${Q}${B?`(${B})`:""}: ${F}`,w0.EVALUATION_ERROR),startIndex:L})}H=W.exec(q)}for(let j=U.length-1;j>=0;j--){let{original:B,processed:V}=U[j];q=q.replace(B,V)}return q}async function LY($,Z,J,X,Y){let{name:Q,handler:G}=Z,z=$,K=x1(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),q=[],W=K.exec(z);while(W!==null){let[j,B=""]=W,V=W.index||0;try{let L=e7(B),_=await G("",L,J,X);q.push({original:j,processed:_,startIndex:V})}catch(L){let _=L instanceof Error?L.message:String(L);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,L);q.push({original:j,processed:R0("CustomDirective",`Error in @${Q}(${B}): ${_}`,w0.EVALUATION_ERROR),startIndex:V})}W=K.exec(z)}let U=x1(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),H=U.exec(z);while(H!==null){let[j]=H,B=H.index||0;try{let V=await G("",[],J,X);q.push({original:j,processed:V,startIndex:B})}catch(V){let L=V instanceof Error?V.message:String(V);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,V);q.push({original:j,processed:R0("CustomDirective",`Error in @${Q}: ${L}`,w0.EVALUATION_ERROR),startIndex:B})}H=U.exec(z)}for(let j=q.length-1;j>=0;j--){let{original:B,processed:V}=q[j];z=z.replace(B,V)}return z}function e7($){if(!$.trim())return[];let Z=[],J="",X=!1,Y="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!X)X=!0,Y=G;else if(G===Y)X=!1;else J+=G;else if(G===","&&!X)Z.push(J.trim()),J="";else J+=G}if(J.trim())Z.push(J.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var $4=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Z4=/^[A-Za-z_$][\w$]*$/,FY=new Set(["light","dark","system"]);function F1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function wY($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,J=Z.appearance,X=Z.colorMode;if(F1(Z.storageKey,"storageKey"),!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap appearance must be an object");if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap colorMode must be an object");if(F1(J.key,"appearance.key"),F1(J.attribute,"appearance.attribute"),F1(J.default,"appearance.default"),F1(X.key,"colorMode.key"),F1(X.attribute,"colorMode.attribute"),F1(X.default,"colorMode.default"),!Z4.test(J.key)||!Z4.test(X.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!$4.test(J.attribute)||!$4.test(X.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(J.allowed)||J.allowed.length===0||J.allowed.some((Y)=>typeof Y!=="string"||Y.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!J.allowed.includes(J.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!FY.has(X.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:J.key,attribute:J.attribute,allowed:[...new Set(J.allowed)],default:J.default},colorMode:{key:X.key,attribute:X.attribute,default:X.default}}}function RY($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function NY($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${RY($)};const root=document.documentElement;const MODES=["light","dark","system"];function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}return stored}function write(stored){try{localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();return{appearance:config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default,colorMode:MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default}}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return store(config.appearance.key,config.appearance.allowed,name)},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function DY($,Z){let J=1,X=null,Y=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(Y){Y=!1;continue}if(X){if(G==="\\")Y=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")J++;else if(G===")"&&--J===0)return Q}return-1}function J4($,Z){let J=$,X=/@appearanceBootstrap\s*\(/g,Y;while((Y=X.exec(J))!==null){let Q=Y.index+Y[0].length-1,G=DY(J,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let z=J.slice(Q+1,G).trim(),K=Q0(`(${z})`,Z),q=NY(wY(K));J=J.slice(0,Y.index)+q+J.slice(G+1),X.lastIndex=Y.index+q.length}return J}import MY from"crypto";function D0($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var u5={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function AY($){return{...u5,...$.forms?.classes}}function K9($,Z,J,X){let Y=$||Z;return J?`${Y} ${X}`:Y}function h0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function g1($,Z){if(/\bid\s*=/i.test($))return"";return` id="${D0(Z)}"`}function h5($,Z,J){if(!Z)return"";let X="";if(!/\baria-invalid\s*=/i.test(J))X+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(J))X+=` aria-describedby="${D0(`${h0($)}-error`)}"`;return X}function IY(){return MY.randomUUID()}function XH($,Z,J,X){let Y=AY(X),Q=$;return Q=kY(Q,Z),Q=F2(Q,Z),Q=m5(Q,Z,Y),Q=d5(Q,Z,Y),Q}function F2($,Z){let J=$;return J=J.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=IY();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${D0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),J=J.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Y)=>{let Q=Y.toUpperCase();if(Y&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${D0(Q)}">`;return X}),J}function m5($,Z,J=u5){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Y,Q,G,z,K,q="")=>{let W=Q||G||"POST",U=z||K||"",H=K1(q),j=W.toUpperCase(),B=["GET","POST"].includes(j)?j:"POST",V=`<form method="${D0(B)}" action="${D0(U)}"${H?` ${H}`:""}>`;if(V+=`
|
|
@@ -3405,9 +3405,9 @@ ${Y}
|
|
|
3405
3405
|
} finally {
|
|
3406
3406
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
3407
3407
|
}
|
|
3408
|
-
})();`}function LQ($,Z){if(p0($)){let Y=p0($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0,root:"body"};return{html:S1($,(Q,G)=>`<body${G} data-stx-scope="${Z}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let J=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(J){let X=J[2]+J[3],Y=J[2].slice(1),Q=X.match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1],stamped:!0,root:Y};let G=J[1],z=J[2],K=J[3];return{html:`${G}${z} data-stx-scope="${Z}"${K}${$.slice(J[0].length)}`,mergedIntoExisting:null,stamped:!0,root:Y}}return{html:$,mergedIntoExisting:null,stamped:!1,root:null}}var p4=0,B$=new Set;function zB(){B$.clear()}function i4($){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test($)}var KB=new o1(500),o4=new Set;function qB(){o4.clear()}function FQ($){if($.__onceStore instanceof Set)return $.__onceStore;return o4}async function V$($,Z,J,X,Y,Q=new Set){let G=X.partialsDir||z0.join(z0.dirname(J),"partials");if(G&&!z0.isAbsolute(G))G=z0.resolve(process.cwd(),G);let z=HQ($,"@partial","@include"),K=FQ(Z);z=z.replace(/@once([\s\S]*?)@endonce/g,(V,L,_)=>{let F=L.trim(),O=`${J}:${F}`;if(K.has(O))return"";return K.add(O),L});{let V=/@includeIf\s*\(/g,L;while((L=V.exec(z))!==null){let _=L.index,F=_+L[0].length-1,O=1,w=F+1;while(w<z.length&&O>0){if(z[w]==="(")O++;else if(z[w]===")")O--;w++}if(O!==0)break;let N=z.substring(F+1,w-1),R=N.match(/^\s*['"]([^'"]+)['"]/);if(!R){V.lastIndex=w;continue}let M=R[1],T=q(M,G,J),D="";if(T&&await Bun.file(T).exists())Y.add(T),D=`@include(${N})`;z=z.substring(0,_)+D+z.substring(w),V.lastIndex=0}}for(let[V,L]of[["@includeWhen",!1],["@includeUnless",!0]]){let _=new RegExp(`${V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=_.exec(z))!==null){let O=F.index,w=O+F[0].length-1,N=1,R=w+1;while(R<z.length&&N>0){if(z[R]==="(")N++;else if(z[R]===")")N--;R++}if(N!==0)break;let M=z.substring(w+1,R-1),T=j$(M,0);if(T===-1){_.lastIndex=R;continue}let D=M.substring(0,T).trim(),I=M.substring(T+1).trim(),E=I.match(/^\s*['"]([^'"]+)['"]/);if(!E){_.lastIndex=R;continue}let A=E[1],k=I.substring(E[0].length),C,y=j$(k,0);if(y!==-1)C=k.substring(y+1).trim();try{let b=`Boolean(${D})`,P;if(H0(b)){let g=q0(b,Object.keys(Z));P=Boolean(g(...Object.values(Z)))}else P=Boolean(Q0(b,Z));let u=L?!P:P,l="";if(u){let g=q(A,G,J);if(g&&await Bun.file(g).exists())Y.add(g);l=`@include('${A}'${C?`, ${C}`:""})`}z=z.substring(0,O)+l+z.substring(R),_.lastIndex=0}catch(b){let P=b instanceof Error?b.message:String(b),u=_0("Include",`Error evaluating ${V} condition: ${P}`,J,$,O);z=z.substring(0,O)+u+z.substring(R),_.lastIndex=0}}}{let V=/@each\s*\(/g,L;while((L=V.exec(z))!==null){let _=L.index,F=_+L[0].length-1,O=1,w=F+1;while(w<z.length&&O>0){if(z[w]==="(")O++;else if(z[w]===")"){if(O--,O===0)break}w++}if(O!==0)break;let N=z.substring(F+1,w),R=z.substring(_,w+1),M=N.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!M){V.lastIndex=0,z=z.replace(R,"");continue}let[,T,D,I,E]=M;try{let A,k=D.trim();if(H0(k))A=q0(k,Object.keys(Z))(...Object.values(Z));else A=Q0(k,Z);let C="";if(Array.isArray(A)&&A.length>0)for(let y of A){let b={...Z,[I]:y},P=await H(T,b,$,_);C+=P}else if(E)C=await H(E,{},$,_);z=z.substring(0,_)+C+z.substring(w+1),V.lastIndex=0}catch(A){let k=A instanceof Error?A.message:String(A);z=z.substring(0,_)+_0("Each",`Error in @each: ${k}`,J,$,_)+z.substring(w+1),V.lastIndex=0}}}{let V=/@includeFirst\s*\(/g,L;while((L=V.exec(z))!==null){let _=L.index,F=_+L[0].length-1,O=1,w=F+1;while(w<z.length&&O>0){if(z[w]==="(")O++;else if(z[w]===")"){if(O--,O===0)break}w++}if(O!==0)break;let N=z.substring(F+1,w),R=z.substring(_,w+1),M=N.match(/^\s*(\[[^\]]+\])/);if(!M){V.lastIndex=0,z=z.replace(R,"");continue}let T=M[1],D=N.slice(M[0].length),I,E=D.match(/^\s*,\s*\{/);if(E){D=D.slice(E[0].length-1);let C=1,y=1;while(y<D.length&&C>0){if(D[y]==="{")C++;else if(D[y]==="}"){if(C--,C===0)break}y++}I=D.substring(0,y+1),D=D.slice(y+1)}let A,k=D.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(k)A=k[1];try{let C=JSON.parse(T.replace(/'/g,'"')),y={};if(I)try{y=d0(I,Z)}catch(P){let u=P instanceof Error?P.message:String(P);if(X.debug){let l=_0("Include",`Error parsing includeFirst variables: ${u}`,J,$,_,R);z=z.replace(R,()=>l)}else z=z.replace(R,()=>A||"");continue}let b=!1;for(let P of C){let u=q(P,G,J);if(!u)continue;if(await e(u)){let l=await H(P,y,$,_);z=z.replace(R,()=>l),b=!0;break}}if(!b)if(A!==void 0)z=z.replace(R,()=>A);else if(X.debug){let P=_0("Include",`None of the includeFirst paths exist: ${T}`,J,$,_,R);z=z.replace(R,()=>P)}else z=z.replace(R,"")}catch(C){let y=C instanceof Error?C.message:String(C),b=_0("Include",`Error processing @includeFirst: ${y}`,J,$,_,R);z=z.replace(R,()=>b)}V.lastIndex=0}}function q(V,L,_){try{let F=V;if(!V.endsWith(".stx"))F=`${V}.stx`;let O=z0.resolve(L),w=z0.resolve(z0.dirname(_)),N;if(!F.startsWith("./")&&!F.startsWith("../")){for(let E of X._layerPartialDirs??[]){let A=z0.resolve(E,F);if(A.startsWith(`${z0.resolve(E)}${z0.sep}`)&&UQ(A))return A}N=z0.resolve(L,F)}else N=z0.resolve(w,F);let R=z0.normalize(N),M=R.startsWith(O+z0.sep)||R===O,T=R.startsWith(w+z0.sep)||R===w,D=!1,I=z0.dirname(w);if(R.startsWith(I+z0.sep)){if(!z0.relative(I,R).split(z0.sep).some((C)=>C.startsWith(".")&&C!=="."&&C!==".."))D=!0}if(!M&&!T&&!D)return console.error(`Security: Path traversal attempt blocked for include path: ${V}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${O}, ${w}`),null;return R}catch(F){return console.error(`Error resolving path ${V}: ${F}`),null}}let W=z0.resolve(J);Q.add(W);function U(V,L,_,F){return X.onIncludeError?.({includePath:V,templatePath:J,message:L,partialsDir:G}),_0("Include",L,J,_,F)}async function H(V,L={},_,F){let O=q(V,G,J);if(!O)return U(V,`Could not resolve path for include: ${V}`,_,F);let w=z0.resolve(O);if(Q.has(w)){let N=[...Q,w].map((R)=>z0.basename(R)).join(" -> ");return U(V,`Circular include detected: ${N}`,_,F)}try{Y.add(O);let N;if(!N)try{N=await Bun.file(O).text()}catch(c){let K0=c instanceof Error?c.message:String(c);return U(V,`Error loading include file ${V}: ${K0}`,_,F)}if(N)N=N.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(N&&N.includes("@stream")){let{processStreamDirectives:c}=await import("./chunk-
|
|
3409
|
-
`;continue}if(V0)try{let{extractVariables:m}=await import("./chunk-
|
|
3410
|
-
`}}if(E.length>0){let{interpolateScriptExpressions:c}=await import("./chunk-
|
|
3408
|
+
})();`}function LQ($,Z){if(p0($)){let Y=p0($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0,root:"body"};return{html:S1($,(Q,G)=>`<body${G} data-stx-scope="${Z}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let J=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(J){let X=J[2]+J[3],Y=J[2].slice(1),Q=X.match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1],stamped:!0,root:Y};let G=J[1],z=J[2],K=J[3];return{html:`${G}${z} data-stx-scope="${Z}"${K}${$.slice(J[0].length)}`,mergedIntoExisting:null,stamped:!0,root:Y}}return{html:$,mergedIntoExisting:null,stamped:!1,root:null}}var p4=0,B$=new Set;function zB(){B$.clear()}function i4($){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test($)}var KB=new o1(500),o4=new Set;function qB(){o4.clear()}function FQ($){if($.__onceStore instanceof Set)return $.__onceStore;return o4}async function V$($,Z,J,X,Y,Q=new Set){let G=X.partialsDir||z0.join(z0.dirname(J),"partials");if(G&&!z0.isAbsolute(G))G=z0.resolve(process.cwd(),G);let z=HQ($,"@partial","@include"),K=FQ(Z);z=z.replace(/@once([\s\S]*?)@endonce/g,(V,L,_)=>{let F=L.trim(),O=`${J}:${F}`;if(K.has(O))return"";return K.add(O),L});{let V=/@includeIf\s*\(/g,L;while((L=V.exec(z))!==null){let _=L.index,F=_+L[0].length-1,O=1,w=F+1;while(w<z.length&&O>0){if(z[w]==="(")O++;else if(z[w]===")")O--;w++}if(O!==0)break;let N=z.substring(F+1,w-1),R=N.match(/^\s*['"]([^'"]+)['"]/);if(!R){V.lastIndex=w;continue}let M=R[1],T=q(M,G,J),D="";if(T&&await Bun.file(T).exists())Y.add(T),D=`@include(${N})`;z=z.substring(0,_)+D+z.substring(w),V.lastIndex=0}}for(let[V,L]of[["@includeWhen",!1],["@includeUnless",!0]]){let _=new RegExp(`${V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=_.exec(z))!==null){let O=F.index,w=O+F[0].length-1,N=1,R=w+1;while(R<z.length&&N>0){if(z[R]==="(")N++;else if(z[R]===")")N--;R++}if(N!==0)break;let M=z.substring(w+1,R-1),T=j$(M,0);if(T===-1){_.lastIndex=R;continue}let D=M.substring(0,T).trim(),I=M.substring(T+1).trim(),E=I.match(/^\s*['"]([^'"]+)['"]/);if(!E){_.lastIndex=R;continue}let A=E[1],k=I.substring(E[0].length),C,y=j$(k,0);if(y!==-1)C=k.substring(y+1).trim();try{let b=`Boolean(${D})`,P;if(H0(b)){let g=q0(b,Object.keys(Z));P=Boolean(g(...Object.values(Z)))}else P=Boolean(Q0(b,Z));let u=L?!P:P,l="";if(u){let g=q(A,G,J);if(g&&await Bun.file(g).exists())Y.add(g);l=`@include('${A}'${C?`, ${C}`:""})`}z=z.substring(0,O)+l+z.substring(R),_.lastIndex=0}catch(b){let P=b instanceof Error?b.message:String(b),u=_0("Include",`Error evaluating ${V} condition: ${P}`,J,$,O);z=z.substring(0,O)+u+z.substring(R),_.lastIndex=0}}}{let V=/@each\s*\(/g,L;while((L=V.exec(z))!==null){let _=L.index,F=_+L[0].length-1,O=1,w=F+1;while(w<z.length&&O>0){if(z[w]==="(")O++;else if(z[w]===")"){if(O--,O===0)break}w++}if(O!==0)break;let N=z.substring(F+1,w),R=z.substring(_,w+1),M=N.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!M){V.lastIndex=0,z=z.replace(R,"");continue}let[,T,D,I,E]=M;try{let A,k=D.trim();if(H0(k))A=q0(k,Object.keys(Z))(...Object.values(Z));else A=Q0(k,Z);let C="";if(Array.isArray(A)&&A.length>0)for(let y of A){let b={...Z,[I]:y},P=await H(T,b,$,_);C+=P}else if(E)C=await H(E,{},$,_);z=z.substring(0,_)+C+z.substring(w+1),V.lastIndex=0}catch(A){let k=A instanceof Error?A.message:String(A);z=z.substring(0,_)+_0("Each",`Error in @each: ${k}`,J,$,_)+z.substring(w+1),V.lastIndex=0}}}{let V=/@includeFirst\s*\(/g,L;while((L=V.exec(z))!==null){let _=L.index,F=_+L[0].length-1,O=1,w=F+1;while(w<z.length&&O>0){if(z[w]==="(")O++;else if(z[w]===")"){if(O--,O===0)break}w++}if(O!==0)break;let N=z.substring(F+1,w),R=z.substring(_,w+1),M=N.match(/^\s*(\[[^\]]+\])/);if(!M){V.lastIndex=0,z=z.replace(R,"");continue}let T=M[1],D=N.slice(M[0].length),I,E=D.match(/^\s*,\s*\{/);if(E){D=D.slice(E[0].length-1);let C=1,y=1;while(y<D.length&&C>0){if(D[y]==="{")C++;else if(D[y]==="}"){if(C--,C===0)break}y++}I=D.substring(0,y+1),D=D.slice(y+1)}let A,k=D.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(k)A=k[1];try{let C=JSON.parse(T.replace(/'/g,'"')),y={};if(I)try{y=d0(I,Z)}catch(P){let u=P instanceof Error?P.message:String(P);if(X.debug){let l=_0("Include",`Error parsing includeFirst variables: ${u}`,J,$,_,R);z=z.replace(R,()=>l)}else z=z.replace(R,()=>A||"");continue}let b=!1;for(let P of C){let u=q(P,G,J);if(!u)continue;if(await e(u)){let l=await H(P,y,$,_);z=z.replace(R,()=>l),b=!0;break}}if(!b)if(A!==void 0)z=z.replace(R,()=>A);else if(X.debug){let P=_0("Include",`None of the includeFirst paths exist: ${T}`,J,$,_,R);z=z.replace(R,()=>P)}else z=z.replace(R,"")}catch(C){let y=C instanceof Error?C.message:String(C),b=_0("Include",`Error processing @includeFirst: ${y}`,J,$,_,R);z=z.replace(R,()=>b)}V.lastIndex=0}}function q(V,L,_){try{let F=V;if(!V.endsWith(".stx"))F=`${V}.stx`;let O=z0.resolve(L),w=z0.resolve(z0.dirname(_)),N;if(!F.startsWith("./")&&!F.startsWith("../")){for(let E of X._layerPartialDirs??[]){let A=z0.resolve(E,F);if(A.startsWith(`${z0.resolve(E)}${z0.sep}`)&&UQ(A))return A}N=z0.resolve(L,F)}else N=z0.resolve(w,F);let R=z0.normalize(N),M=R.startsWith(O+z0.sep)||R===O,T=R.startsWith(w+z0.sep)||R===w,D=!1,I=z0.dirname(w);if(R.startsWith(I+z0.sep)){if(!z0.relative(I,R).split(z0.sep).some((C)=>C.startsWith(".")&&C!=="."&&C!==".."))D=!0}if(!M&&!T&&!D)return console.error(`Security: Path traversal attempt blocked for include path: ${V}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${O}, ${w}`),null;return R}catch(F){return console.error(`Error resolving path ${V}: ${F}`),null}}let W=z0.resolve(J);Q.add(W);function U(V,L,_,F){return X.onIncludeError?.({includePath:V,templatePath:J,message:L,partialsDir:G}),_0("Include",L,J,_,F)}async function H(V,L={},_,F){let O=q(V,G,J);if(!O)return U(V,`Could not resolve path for include: ${V}`,_,F);let w=z0.resolve(O);if(Q.has(w)){let N=[...Q,w].map((R)=>z0.basename(R)).join(" -> ");return U(V,`Circular include detected: ${N}`,_,F)}try{Y.add(O);let N;if(!N)try{N=await Bun.file(O).text()}catch(c){let K0=c instanceof Error?c.message:String(c);return U(V,`Error loading include file ${V}: ${K0}`,_,F)}if(N)N=N.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(N&&N.includes("@stream")){let{processStreamDirectives:c}=await import("./chunk-evk1dzpg.js");N=c(N,Z)}if(N&&(X.debug||!N9()&&!D9()))try{let{warnUnbalancedTags:c}=await import("./chunk-vhzc08aa.js");c(N,O)}catch{}let R=N;try{let{processESImports:c}=await import("./chunk-48d9ey9k.js");await c(N,Z,O,X,Y)}catch(c){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,c instanceof Error?c.message:c)}let M=q9(R);if(M)R=M.content.trim();let D=N.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),I="";if(D)I=`<style${D[1]}>${D[2]}</style>`;let E=[];R=R.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(c,K0,r)=>{if(!i4(K0))return"";return E.push({attrs:K0,body:r}),`__STX_DATA_BLOCK_${E.length-1}__`}),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let A={...Z};A.__stx_signals_gate=J1(N,O);for(let[c,K0]of Object.entries(L))A[c]=K0;let k=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,C=[...N.matchAll(k)],y="",b=null,P=!1;for(let c of C){let K0=c[1]||"",r=c[2]||"";if(i4(K0))continue;let V0=K0.includes("server"),$1=M1(K0);if(!V0&&r.trim()){let{interpolateScriptExpressions:m}=await import("./chunk-tzywy1s7.js");r=m(r,A)}let T0="";try{let{extractAndStripCssImports:m,renderVendorStyleTags:i}=await import("./chunk-6qe53wjc.js"),j0=m(r,{filePath:O,projectRoot:process.cwd()});r=j0.code,T0=i(j0.styles)}catch(m){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,m instanceof Error?m.message:m)}if($1&&r.trim())r=A1(r);if(!V0){try{let{injectBrowserCoreAutoImports:i}=await import("./chunk-6qe53wjc.js");r=i(r).code;let{hasUserImports:j0,bundleClientScript:a}=await import("./chunk-63h3pg9g.js");if(j0(r))r=await a(r,O,{projectRoot:process.cwd()})}catch(i){if(X.debug)console.warn(`[stx] bundler skipped for ${O}:`,i instanceof Error?i.message:i)}let{stripStxRuntimeImports:m}=await import("./chunk-pvtnhx3j.js");r=m(r)}let p=jQ(r);if(p&&!V0){P=!0,b=`stx_scope_${z0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++p4}`;let m=t0(r),i=c4(m,b);y+=`${T0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${b}">${i}</script>
|
|
3409
|
+
`;continue}if(V0)try{let{extractVariables:m}=await import("./chunk-09fb200s.js");await m(r,A,O)}catch(m){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,m)}if(!V0&&!p){let m=K0.replace(/\bclient\b/i,"").trim();b=`stx_scope_${z0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++p4}`;let i=t0(r),j0=c4(i,b);y+=`${T0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${b}"${m?` ${m}`:""}>${j0}</script>
|
|
3410
|
+
`}}if(E.length>0){let{interpolateScriptExpressions:c}=await import("./chunk-tzywy1s7.js");R=R.replace(/__STX_DATA_BLOCK_(\d+)__/g,(K0,r)=>{let V0=E[Number(r)];return`<script${V0.attrs}>${c(V0.body,A)}</script>`})}if(b){let c=LQ(R,b);if(R=c.html,c.mergedIntoExisting){let r=b,V0=c.mergedIntoExisting;y=y.split(`'${r}'`).join(`'${V0}'`).split(`"${r}"`).join(`"${V0}"`),b=V0}else if(!c.stamped&&P&&!B$.has(O))B$.add(O),console.warn(`[stx] ${z0.relative(process.cwd(),O)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);let K0=c.stamped&&c.root!==null&&A2(c.root);y=OQ(y,K0?b:null)}if(R.includes("@include")||R.includes("@partial"))R=await V$(R,A,O,X,Y,Q);let{processLoops:u,reportDeferredLoopWarnings:l}=await import("./chunk-xnpdkd13.js"),g=u(R,A,O,void 0,!0);g=a0(g,A,O),g=l(g);let{processMetaDirectives:J0,processSeoDirective:X0,processStructuredData:$0}=await import("./chunk-y8vj3rtt.js");if(g=J0(g,A,O,X),g=$0(g,A,O),g=X0(g,A,O,X),g=B1(g,A,O),I)g+=`
|
|
3411
3411
|
`+I;if(y)g+=`
|
|
3412
3412
|
`+y;return g}catch(N){let R=N instanceof Error?N.message:String(N);return U(V,`Error processing include ${V}: ${R}`,_,F)}}let j=/@include\s*\(/g,B;while((B=j.exec(z))!==null){let V=B.index,L=V+B[0].length-1,_=1,F=L+1;while(F<z.length&&_>0){if(z[F]==="(")_++;else if(z[F]===")")_--;F++}if(_!==0)break;let O=z.substring(V,F),w=z.substring(L+1,F-1),N=w.match(/^\s*['"]([^'"]+)['"]/);if(!N){j.lastIndex=F;continue}let R=N[1],M,T=w.substring(N[0].length),D=j$(T,0);if(D!==-1)M=T.substring(D+1).trim();let I={};if(M)try{I=d0(M,Z)}catch(A){let k=A instanceof Error?A.message:String(A);z=z.replace(O,_0("Include",`Error parsing include variables for ${R}: ${k}`,J,$,V)),j.lastIndex=0;continue}let E=await H(R,I,$,V);z=z.substring(0,V)+E+z.substring(F),j.lastIndex=0}return z}function O$($,Z){let J=$;function X(Y,Q,G,z){let K=Y,q=!0;while(q){q=!1;let W=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),U=K.match(W);if(!U||U.index===void 0)break;let H=U.index,j=U[1],B=H+U[0].length,V=new RegExp(`@${Q}\\(`),L=new RegExp(`@${G}(?![a-z])`),_=1,F=B,O=-1;while(_>0&&F<K.length){let N=K.slice(F),R=N.match(V),M=N.match(L),T=R?F+R.index:1/0,D=M?F+M.index:1/0;if(T<D)_++,F=T+(R[0].length||1);else if(D<1/0){if(_--,_===0){O=D;break}F=D+G.length+1}else break}if(O===-1)break;let w=K.slice(B,O);if(!Z[j])Z[j]=[];if(z)Z[j].unshift(w);else Z[j].push(w);K=K.substring(0,H)+K.substring(O+`@${G}`.length),q=!0}return K}return J=X(J,"push","endpush",!1),J=X(J,"prepend","endprepend",!0),J}function _$($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(J,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
|
|
3413
3413
|
`)})}import*as L$ from"path";async function s4($,Z,J=""){if(L$.basename(J)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return a4($,Z,J,"@js","@endjs")}async function r4($,Z,J=""){if(L$.basename(J)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return a4($,Z,J,"@ts","@endts")}async function a4($,Z,J,X,Y){let Q=$,G=x1(`${X}([\\s\\S]*?)${Y}`,"g"),z=[],K;while((K=G.exec($))!==null)z.push({fullMatch:K[0],content:K[1]||"",index:K.index});for(let{fullMatch:q,content:W,index:U}of z)try{let H={...Z,global:Z},j=Object.keys(H),B=Object.values(H),V=W.trim();if(X==="@ts")V=V.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let _=(V.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=_.length>0?`return { ${_.join(", ")} };`:"return {};",O=`
|
|
@@ -3470,14 +3470,14 @@ ${$.slice(J)}`}function g6($,Z={},J={},X){if(X??C$($))return $;return BG($,Z,J)}
|
|
|
3470
3470
|
${Z}${$.slice(Y)}`;if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Z+`
|
|
3471
3471
|
`+$.slice(G)}if(p0($))return S1($,(G)=>`${G}
|
|
3472
3472
|
${Z}`);return`${Z}
|
|
3473
|
-
${$}`}async function y9($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let{getServeClientAsset:Y}=await import("./chunk-
|
|
3473
|
+
${$}`}async function y9($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let{getServeClientAsset:Y}=await import("./chunk-mpbbfrpk.js"),{url:Q}=await Y("runtime",Z.debug===!0);return P$($,`<script data-stx-runtime src="${Q}"></script>`)}if(Z.buildMode==="compile")return P$($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:J}=await import("./chunk-mpbbfrpk.js"),X=await J(Z.debug);return P$($,`<script data-stx-scoped data-stx-runtime>${X}</script>`)}function FG($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function n6($){if($.includes("data-stx-tooltip-runtime")||!FG($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${z$()}</script>`,J=$.lastIndexOf("</body>");if(J===-1)return`${$}
|
|
3474
3474
|
${Z}`;return`${$.slice(0,J)}${Z}
|
|
3475
|
-
${$.slice(J)}`}var wG=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function RG($){return wG.test($)||$.includes("__stxRouter)return")||$.includes("__stxRouter=true")}async function NG($,Z){if(!$.includes("</body>"))return $;if(RG($))return $;let J=Z?.router,X="";{let K={};if(J){if(J.container)K.container=J.container;if(J.interceptAllLinks!==void 0)K.interceptAllLinks=J.interceptAllLinks;if(J.progress!==void 0)K.progress=J.progress;if(J.viewTransitions!==void 0)K.viewTransitions=J.viewTransitions;if(J.viewTransitionDuration!==void 0)K.viewTransitionDuration=J.viewTransitionDuration;if(J.viewTransitionEasing!==void 0)K.viewTransitionEasing=J.viewTransitionEasing;if(J.scrollToTop!==void 0)K.scrollToTop=J.scrollToTop;if(J.prefetch!==void 0)K.prefetch=J.prefetch;if(J.cache!==void 0)K.cache=J.cache;if(J.progressColor!==void 0)K.progressColor=J.progressColor;if(J.progressHeight!==void 0)K.progressHeight=J.progressHeight}try{let q=await l6(Z?.pagesDir,Z?.root);if(q.length>0)K.ownedRoutes=q}catch{}if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${c6(K)};</script>
|
|
3476
|
-
`}let{getCachedRouterScript:Y,getServeClientAsset:Q}=await import("./chunk-
|
|
3475
|
+
${$.slice(J)}`}var wG=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function RG($){return wG.test($)||$.includes("__stxRouter)return")||$.includes("__stxRouter=true")}async function NG($,Z){if(!$.includes("</body>"))return $;if(RG($))return $;let J=Z?.router,X="";{let K={};if(J){if(J.container)K.container=J.container;if(J.interceptAllLinks!==void 0)K.interceptAllLinks=J.interceptAllLinks;if(J.progress!==void 0)K.progress=J.progress;if(J.viewTransitions!==void 0)K.viewTransitions=J.viewTransitions;if(J.viewTransitionDuration!==void 0)K.viewTransitionDuration=J.viewTransitionDuration;if(J.viewTransitionEasing!==void 0)K.viewTransitionEasing=J.viewTransitionEasing;if(J.scrollToTop!==void 0)K.scrollToTop=J.scrollToTop;if(J.scrollRestoration!==void 0)K.scrollRestoration=J.scrollRestoration;if(J.prefetch!==void 0)K.prefetch=J.prefetch;if(J.cache!==void 0)K.cache=J.cache;if(J.progressColor!==void 0)K.progressColor=J.progressColor;if(J.progressHeight!==void 0)K.progressHeight=J.progressHeight}try{let q=await l6(Z?.pagesDir,Z?.root);if(q.length>0)K.ownedRoutes=q}catch{}if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${c6(K)};</script>
|
|
3476
|
+
`}let{getCachedRouterScript:Y,getServeClientAsset:Q}=await import("./chunk-mpbbfrpk.js"),G=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?`<script data-stx-router src="${(await Q("router")).url}"></script>`:`<script data-stx-router>${await Y()}</script>`,z=$.lastIndexOf("</body>");return $.slice(0,z)+X+G+`
|
|
3477
3477
|
</body>`+$.slice(z+7)}var o6=Symbol.for("stx.lazy-module-promises");function DG(){let $=globalThis;return $[o6]??=new Map,$[o6]}function s($,Z){let J=DG(),X=`${import.meta.url}\x00${$}`,Y=J.get(X);if(Y)return Y;let Q=Z();return J.set(X,Q),Q.catch(()=>{if(J.get(X)===Q)J.delete(X)}),Q}var v$=`(?:"[^"]*"|'[^']*'|[^>"'])*`,X8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,MG=65536,AG=4,S9=new Map;function vV(){S9.clear()}function IG($){let Z=[];for(let J of E2($,G2)){let X=J.token.match(/^<script\b([^>]*)>/i),Y=J.token.match(/<\/script\s*>$/i);if(!X||!Y)continue;let Q=X[0].length,G=J.token.length-Y[0].length;Z.push(Object.freeze({fullMatch:J.token,attrs:X[1],body:J.token.slice(Q,G),start:J.start,end:J.end}))}return Z}function TG($,Z={}){let J=$.length>=MG,X=J?S9.get($):void 0;if(X===void 0){if(X=IG($),J)J8(S9,AG),S9.set($,X)}let Y=Z.skipAttrs;if(!Y)return X.slice();let Q=[];for(let G of X)if(Y.lastIndex=0,!Y.test(G.attrs))Q.push(G);return Q}function Y8($){let Z=$.trim(),J=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(J){let Y=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:z}=s6(Q);if(G)return{style:"as",iterable:Y,itemVar:G,indexVar:z}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let Y=X[1].trim(),Q=X[2].trim(),{itemVar:G,indexVar:z}=s6(Y);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:z}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function s6($){let Z=$.trim(),J=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(J)return{itemVar:J[2],indexVar:J[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let Y=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function g$($,Z){return Z8($,Z)}function kG($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,J=0,X;while((X=Z.exec($))!==null){let Y=X[1];if(Y.startsWith("if"))J++;else if(Y==="endif")J--;else if(J===0)return!0}return!1}function EG($){let Z=new Set,J=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],G;while((G=X.exec(Q))!==null)Z.add(G[1])}return Z}function bG($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${v$})>`,"iy"),J=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,X=E2($,(Q,G)=>{Z.lastIndex=G;let z=Z.exec(Q);if(!z||z.index!==G||!J.test(z[2]))return-1;return Z.lastIndex}),Y=[];for(let Q of X){Z.lastIndex=0;let G=Z.exec(Q.token);if(!G)continue;let z=G[2].match(J),K=Y8(z?.[1]??z?.[2]??""),q=[K.itemVar,K.indexVar].filter(Boolean);if(q.length===0)continue;let W=G[1],H=/\/\s*>$/.test(Q.token)||P9.has(W.toLowerCase())?Q.end:G8($,Q.start,W,Q.end);if(H!==-1)Y.push({start:Q.start,end:H,vars:new Set(q)})}return Y}var r6=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);function yG($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function a6($,Z,J,X){if(!$)return!1;let Y=yG($),Q=!1,G=!1,z=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(Y))!==null){let j=q[1];if(Y.slice(0,q.index).trimEnd().endsWith("."))continue;if(r6.has(j))continue;if(Z.has(j)||X?.has(j))Q=!0;else if(J&&j in J)G=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,U;while((U=W.exec(Y))!==null){let j=U[1];if(Y.slice(0,U.index).trimEnd().endsWith("."))continue;if(r6.has(j)||J&&j in J)continue;z=!0}return(Q||z)&&!G}function C9($,Z,J){let X=J===void 0?` ${Z}`:` ${Z}="${J.replace(/"/g,""")}"`,Y=$.trim(),Q=Y.match(X8);if(Q&&CG(Q[3],Q[1])){let[,G,z,K]=Q;return`<${G}${z}${X}>${K}</${G}>`}return`<template${X}>${Y}</template>`}function CG($,Z){let J=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,Y;while((Y=J.exec($))!==null)if(Y[1]){if(X--,X<0)return!1}else X++;return!0}function Q8($,Z){let J=EG($);function X(Y){let Q=Y,G=bG(Y),z=(U)=>{let H=new Set;for(let j of G)if(U>j.start&&U<j.end)for(let B of j.vars)H.add(B);return H},K=/@if\s*\(/g,q,W=[];while((q=K.exec(Q))!==null){let U=q.index,H=U+q[0].length,j=1,B=H;while(B<Q.length&&j>0){if(Q[B]==="(")j++;else if(Q[B]===")")j--;B++}if(j!==0)continue;let V=Q.substring(H,B-1).trim(),L=B,_=1,F=L,O=/@(if\s*\(|endif)/g;O.lastIndex=L;let w;while((w=O.exec(Q))!==null)if(w[1].startsWith("if"))_++;else if(w[1]==="endif"){if(_--,_===0){F=w.index+w[0].length;break}}if(_!==0)continue;let N=Q.substring(L,F-6).trim(),R;if(kG(N)){let M=O2(Q.substring(U,F));if(M.length===0)continue;let T=M[0].branches.filter((A)=>A.type!=="else"),D=z(U);if(!(T.length>0&&T.every((A)=>a6(A.condition,J,Z,D))))continue;R=M[0].branches.map((A)=>{let k=X(A.content);if(A.type==="elseif")return C9(k,"@else-if",A.condition??"");if(A.type==="else")return C9(k,"@else");return C9(k,"@if",A.condition??"")}).join(`
|
|
3478
3478
|
`)}else{if(!a6(V,J,Z,z(U)))continue;R=C9(X(N),"@if",V)}W.push({start:U,end:F,replacement:R}),K.lastIndex=F}for(let U=W.length-1;U>=0;U--){let{start:H,end:j,replacement:B}=W[U];Q=Q.substring(0,H)+B+Q.substring(j)}return Q}return X($)}function SG($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Y=Number(Z);return Y!==0&&!Number.isNaN(Y)}let J=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(J)return J[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}var P9=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),t6=/<(script|style)\b/iy,PG=/<\/script/gi,vG=/<\/style/gi;function G8($,Z,J,X){if(P9.has(J.toLowerCase()))return X;let Y=J.toLowerCase(),Q=$.length,G=1,z=X;while(z<Q){let K=$.indexOf("<",z);if(K===-1)return-1;if(z=K,$.startsWith("<!--",z)){let H=$.indexOf("-->",z+4);if(H===-1)return-1;z=H+3;continue}t6.lastIndex=z;let q=t6.exec($);if(q){let H=$.indexOf(">",z);if(H===-1)return-1;if($[H-1]==="/"){z=H+1;continue}let j=q[1].toLowerCase()==="script"?PG:vG;j.lastIndex=z;let B=j.exec($);if(B===null)return-1;let V=$.indexOf(">",B.index);if(V===-1)return-1;z=V+1;continue}if($[z+1]==="/"){let H=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(z,z+64));if(!H){z++;continue}if(H[1].toLowerCase()===Y){if(G--,z+=H[0].length,G===0)return z;continue}z+=H[0].length;continue}let W=/^<([a-z][\w-]*)\b/i.exec($.slice(z,z+64));if(!W){z++;continue}let U=$.indexOf(">",z);if(U===-1)return-1;if(W[1].toLowerCase()===Y){let H=$.slice(z,U+1);if(!(/\/\s*>$/.test(H)||P9.has(Y)))G++}z=U+1}return-1}var fG=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function xG($,Z){let J=Z,X=$.length;for(;;){while(J<X&&$[J]!=="<")J++;if(J>=X)return!1;if($.startsWith("<!--",J)){let G=$.indexOf("-->",J+4);if(G===-1)return!1;J=G+3;continue}break}if($[J+1]==="/")return!1;let Y=$.indexOf(">",J);if(Y===-1)return!1;let Q=$.slice(J,Y+1);return fG.test(Q)}function z8($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=J.exec($))!==null)Z.push([X.index,X.index+X[0].length]);let Y=(U)=>Z.some(([H,j])=>U>=H&&U<j),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],z;while((z=Q.exec($))!==null){if(Y(z.index))continue;let[U,H,j,B,V,L,_]=z,F=SG(V);if(F===void 0)continue;let O=z.index,w=O+U.length,M=!!_||/\/\s*>$/.test(U)||P9.has(H.toLowerCase())?w:G8($,O,H,w);if(M===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&xG($,M)){Q.lastIndex=w;continue}if(F===!0){let D=`<${H}${j}${L}${_}>`;G.push({start:O,end:w,replacement:D});continue}G.push({start:O,end:M,replacement:""}),Q.lastIndex=M}if(G.length===0)return $;G.sort((U,H)=>U.start-H.start);let K=[],q=-1;for(let U of G){if(U.start<q)continue;K.push(U),q=U.end}let W=$;for(let U=K.length-1;U>=0;U--){let{start:H,end:j,replacement:B}=K[U];W=W.substring(0,H)+B+W.substring(j)}return W}function h$($,Z){let J=$,X=/@(for|foreach)\s*\(/g,Y,Q=[],G=[];while((Y=X.exec(J))!==null){let z=Y[1],K=Y.index,q=K+Y[0].length,W=1,U=q;while(U<J.length&&W>0){if(J[U]==="(")W++;else if(J[U]===")")W--;U++}if(W!==0)continue;let H=J.substring(q,U-1).trim(),j=U,B=Y8(H),V=z==="for"?"@endfor":"@endforeach",L=1,_=j,F=z==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${z}\\s*\\(|end${z})`,"g");F.lastIndex=j;let O;while((O=F.exec(J))!==null)if(O[1].startsWith(z))L++;else if(L--,L===0){_=O.index+O[0].length;break}if(L!==0)continue;let w=()=>{let I=[B.itemVar,B.indexVar].filter(Boolean);if(I.length)G.push({start:K,end:_,vars:I})};if(B.iterable){let I=B.iterable.trim();if(I.startsWith("[")||I.startsWith("{")||I.startsWith("'")||I.startsWith('"')||I.startsWith("`")||/^-?\d/.test(I)){w();continue}let E=I.split(/[.[(]/)[0].trim(),A=Z?E in Z:!1,k=G.some((C)=>K>C.start&&K<C.end&&C.vars.includes(E));if(E&&(A||k)){w();continue}}if(B.style==="as")H=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let N=J.substring(j,_-V.length).trim(),R=Z?{...Z}:{};if(B.itemVar)delete R[B.itemVar];if(B.indexVar)delete R[B.indexVar];let M=h$(N,R),T=M.match(X8),D;if(T){let[,I,E,A]=T;D=`<${I}${E} @for="${H}">${A}</${I}>`}else D=`<template @for="${H}">${M}</template>`;Q.push({start:K,end:_,replacement:D}),X.lastIndex=_}for(let z=Q.length-1;z>=0;z--){let{start:K,end:q,replacement:W}=Q[z];J=J.substring(0,K)+W+J.substring(q)}return J}function gG($){let Z=new Set,J=[],X=0,Y=0,Q=$.length,G=(W)=>{let U=X+1;while(U<Q){let H=$[U];if(H==="\\"){U+=2;continue}if(H===W)return U+1;U++}return Q},z=()=>{let W=X+2;while(W<Q&&$[W]!==`
|
|
3479
3479
|
`)W++;return W},K=()=>{let W=X+2;while(W<Q-1){if($[W]==="*"&&$[W+1]==="/")return W+2;W++}return Q},q=(W)=>{let U=W,H=0;while(U<Q){let j=$[U];if(j==="/"&&$[U+1]==="/"){let B=U+2;while(B<Q&&$[B]!==`
|
|
3480
|
-
`)B++;U=B;continue}if(j==="/"&&$[U+1]==="*"){let B=U+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;U=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=U+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}U=B;continue}if(j==="("||j==="["||j==="{"){H++,U++;continue}if(j===")"||j==="]"||j==="}"){H--,U++;continue}if(j===";"&&H===0)return U+1;U++}return Q};while(X<Q){let W=$[X];if(W==="/"&&$[X+1]==="/"){let U=z();J.push($.slice(X,U)),X=U;continue}if(W==="/"&&$[X+1]==="*"){let U=K();J.push($.slice(X,U)),X=U;continue}if(W==='"'||W==="'"||W==="`"){let U=G(W);J.push($.slice(X,U)),X=U;continue}if(W==="{"){Y++,J.push(W),X++;continue}if(W==="}"){Y--,J.push(W),X++;continue}if(Y===0){let U=X>0?$[X-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let j=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],V=q(X+j[0].length);if(Z.has(B)){J.push(`/* stx: deduped const ${B} */`),X=V;continue}Z.add(B),J.push($.slice(X,V)),X=V;continue}}}J.push(W),X++}return J.join("")}var hG=new Set(["script","style","html","head","meta","link","title","!doctype"]);function f$($,Z,J){for(let X of J){if(X.start>=Z)return!1;if(X.end>$)return!0}return!1}function uG($,Z,J){let X=0;while(X<$.length){let Y=$.indexOf(Z,X);if(Y===-1)return!1;if(!f$(Y,Y+Z.length,J))return!0;X=Y+Z.length}return!1}function mG($,Z){if(uG($,"<body",Z)){let Y=new RegExp(`<body(${v$})>`,"g"),Q;while((Q=Y.exec($))!==null)if(!f$(Q.index,Q.index+Q[0].length,Z))return Q.index+Q[0].length-1;return null}let J=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${v$})>`,"gi"),X;while((X=J.exec($))!==null){if(f$(X.index,X.index+X[0].length,Z))continue;if(hG.has(X[1].toLowerCase()))continue;return X.index+X[0].length-1}return null}function dG($,Z,J,X){let Y=[],Q=` data-stx="${X}"`,G=0,z=!1,K=(q)=>{if(J!==null&&!z&&J>=G&&J<=q)Y.push($.slice(G,J),Q,$.slice(J,q)),z=!0;else Y.push($.slice(G,q))};for(let q of Z){if(q.start<G)continue;K(q.start),G=q.end}return K($.length),Y.join("")}async function lG($,Z,J){let X=TG($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useModel|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[],{hasUserImports:G,bundleClientScript:z}=await s("stx/client-script-bundler",()=>import("./chunk-
|
|
3480
|
+
`)B++;U=B;continue}if(j==="/"&&$[U+1]==="*"){let B=U+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;U=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=U+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}U=B;continue}if(j==="("||j==="["||j==="{"){H++,U++;continue}if(j===")"||j==="]"||j==="}"){H--,U++;continue}if(j===";"&&H===0)return U+1;U++}return Q};while(X<Q){let W=$[X];if(W==="/"&&$[X+1]==="/"){let U=z();J.push($.slice(X,U)),X=U;continue}if(W==="/"&&$[X+1]==="*"){let U=K();J.push($.slice(X,U)),X=U;continue}if(W==='"'||W==="'"||W==="`"){let U=G(W);J.push($.slice(X,U)),X=U;continue}if(W==="{"){Y++,J.push(W),X++;continue}if(W==="}"){Y--,J.push(W),X++;continue}if(Y===0){let U=X>0?$[X-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let j=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],V=q(X+j[0].length);if(Z.has(B)){J.push(`/* stx: deduped const ${B} */`),X=V;continue}Z.add(B),J.push($.slice(X,V)),X=V;continue}}}J.push(W),X++}return J.join("")}var hG=new Set(["script","style","html","head","meta","link","title","!doctype"]);function f$($,Z,J){for(let X of J){if(X.start>=Z)return!1;if(X.end>$)return!0}return!1}function uG($,Z,J){let X=0;while(X<$.length){let Y=$.indexOf(Z,X);if(Y===-1)return!1;if(!f$(Y,Y+Z.length,J))return!0;X=Y+Z.length}return!1}function mG($,Z){if(uG($,"<body",Z)){let Y=new RegExp(`<body(${v$})>`,"g"),Q;while((Q=Y.exec($))!==null)if(!f$(Q.index,Q.index+Q[0].length,Z))return Q.index+Q[0].length-1;return null}let J=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${v$})>`,"gi"),X;while((X=J.exec($))!==null){if(f$(X.index,X.index+X[0].length,Z))continue;if(hG.has(X[1].toLowerCase()))continue;return X.index+X[0].length-1}return null}function dG($,Z,J,X){let Y=[],Q=` data-stx="${X}"`,G=0,z=!1,K=(q)=>{if(J!==null&&!z&&J>=G&&J<=q)Y.push($.slice(G,J),Q,$.slice(J,q)),z=!0;else Y.push($.slice(G,q))};for(let q of Z){if(q.start<G)continue;K(q.start),G=q.end}return K($.length),Y.join("")}async function lG($,Z,J){let X=TG($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useModel|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[],{hasUserImports:G,bundleClientScript:z}=await s("stx/client-script-bundler",()=>import("./chunk-63h3pg9g.js"));for(let F of X){let O=F.body;if(M1(F.attrs))O=A1(O);if(Y.test(O)){Q.push({content:O,start:F.start,end:F.end});continue}if(!G(O))continue;try{let w=await z(e1(O).code,Z||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(Y.test(w))Q.push({content:O,start:F.start,end:F.end})}catch{}}if(Q.length===0)return{output:$,setupCode:null};let K=`${Z??""}\x00${Q.map((F)=>F.content).join("\x00")}`,q=`__stx_setup_${Bun.hash(K).toString(36).slice(0,10)}`,W=[];for(let F=0;F<Q.length;F++){let O=Q[F].bundled??e1(Q[F].content).code;if(!Q[F].bundled&&G(O))O=await z(O,Z||"",{projectRoot:process.cwd()});O=nG(O);let w=t0(O);W.push(`// \u2500\u2500 merged signal script #${F+1} \u2500\u2500
|
|
3481
3481
|
${w}`)}let U=W.join(`
|
|
3482
3482
|
|
|
3483
3483
|
`);U=gG(U);let H=cG(U),j=H.split(",").map((F)=>F.trim()).filter(Boolean),B=x$(U,J),V=`
|
|
@@ -3512,13 +3512,13 @@ ${K.join(`
|
|
|
3512
3512
|
Tip: prefer useRef(), navigate(), and composables for component code`;if(l$.set(Q,H),Y.failOnViolation)throw Error(H);else console.warn(H)}Gz();import p$ from"path";var Xz=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,Yz=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function Qz($,Z){if(!Z||!$.includes("/"))return $;let J=p$.dirname(Z);return $.replace(Xz,(X,Y,Q,G)=>{let z=p$.resolve(J,G);return`${Y}${Q}${z.split(p$.sep).join("/")}${Q}`})}function N8($,Z){if(!Z||!$.includes("<script"))return $;return $.replace(Yz,(J,X,Y,Q)=>`${X}${Qz(Y,Z)}${Q}`)}var b1="<!--PARENT_CONTENT_PLACEHOLDER-->";function D8($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Kz($,Z){let J=$.length,X=Z,Y=!0,Q=[],G=(z)=>z+9<=J&&$[z]==="<"&&$[z+1]==="/"&&($[z+2]==="s"||$[z+2]==="S")&&($[z+3]==="c"||$[z+3]==="C")&&($[z+4]==="r"||$[z+4]==="R")&&($[z+5]==="i"||$[z+5]==="I")&&($[z+6]==="p"||$[z+6]==="P")&&($[z+7]==="t"||$[z+7]==="T")&&($[z+8]===">"||/\s/.test($[z+8]));while(X<J){let z=$[X];if(G(X))return X;if(z==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
|
|
3513
3513
|
`,X+2),X===-1)return-1;X+=1,Y=!0;continue}if(z==="/"&&$[X+1]==="*"){let K=$.indexOf("*/",X+2);if(K===-1)return-1;X=K+2,Y=!0;continue}if(z==="/"&&Y){let K=X+1,q=!1;while(K<J){let W=$[K];if(W==="\\"){K+=2;continue}if(W==="[")q=!0;else if(W==="]")q=!1;else if(W==="/"&&!q){K++;break}else if(W===`
|
|
3514
3514
|
`){K=-1;break}K++}if(K===-1){X++,Y=!1;continue}while(K<J&&/[a-z]/.test($[K]))K++;X=K,Y=!1;continue}if(z==="'"||z==='"'){let K=z;X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]===K){X++;break}if($[X]===`
|
|
3515
|
-
`)break;X++}Y=!1;continue}if(z==="`"){X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}if(Q.length===0)Y=!1;continue}if(z==="}"&&Q.length>0){Q.pop(),X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Y=!1;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}continue}if(/\s/.test(z));else if(/[)\].\w$]/.test(z))Y=!1;else Y=!0;X++}return-1}function d8($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${J}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let Y=X.index+X[0].length,Q=$.indexOf("</script>",Y);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:X.index,end:G+1}}async function M8($,Z){try{let{registeredModuleIdsIn:J,buildModuleRegistryScript:X}=await s("stx/client-module-registry",()=>import("./chunk-
|
|
3515
|
+
`)break;X++}Y=!1;continue}if(z==="`"){X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}if(Q.length===0)Y=!1;continue}if(z==="}"&&Q.length>0){Q.pop(),X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Y=!1;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}continue}if(/\s/.test(z));else if(/[)\].\w$]/.test(z))Y=!1;else Y=!0;X++}return-1}function d8($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${J}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let Y=X.index+X[0].length,Q=$.indexOf("</script>",Y);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:X.index,end:G+1}}async function M8($,Z){try{let{registeredModuleIdsIn:J,buildModuleRegistryScript:X}=await s("stx/client-module-registry",()=>import("./chunk-gz6mszbx.js")),Y=await X(J(...$),{minify:Z.buildMode==="compile"});if(!Y)return null;return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${Y.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function qz($,Z=""){let J=d8($,"data-stx-runtime");if(!J)return $;let X=K2($);if(X===-1||X===J.start){if(!Z)return $;return $.slice(0,J.end)+Z+$.slice(J.end)}if(X<J.start)return $.slice(0,X)+$.slice(J.start,J.end)+Z+`
|
|
3516
3516
|
`+$.slice(X,J.start)+$.slice(J.end);let Y=$.slice(J.start,J.end),Q=$.slice(0,J.start)+$.slice(J.end),G=K2(Q);if(G===-1)return Y+Z+`
|
|
3517
3517
|
`+Q;return Q.slice(0,G)+Y+Z+`
|
|
3518
3518
|
`+Q.slice(G)}async function n$($,Z,J,X,Y){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=J1($,J);let Q=!Z.__stxProcessingDepth;T$(Z);for(let G of X._layerGraph?.configDependencies??[])Y.add(G);if(Q&&X.runtimeConfig)await g9(Z,J,X.runtimeConfig);if(Q)V3(Z),Z.__stx_head_injections=N$(),Z.__stx_seo_staged=!1;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!N9()&&!D9())&&J&&J.endsWith(".stx"))x8($,J);try{return await S8.timeAsync("template-processing",async()=>{let G=await Wz($,Z,J,X,Y);if(Q)G=d$(G);if(Q&&X.autoShell&&X.buildMode!=="compile"){let z=X.app?.head||{},q=(Z.__stx_runtime_head||null)??f8(),W=(Z.__stx_head_raw||"").trim(),U,H=W.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(H)U=H[1].trim(),W=W.replace(H[0],"").trim();let j=Z.__sections?.title,B=q.title||U||j,V=!q.title&&(!!U||!!j),L=q.meta||[],_=new Set(L.map((M)=>a1(M)).filter(Boolean)),F={...z,...B&&{title:B},meta:[...(z.meta||[]).filter((M)=>!_.has(a1(M))),...L],link:[...z.link||[],...q.link||[]],script:[...z.script||[],...q.script||[]],headRaw:[z.headRaw,W].filter(Boolean).join(`
|
|
3519
3519
|
`),...q.htmlAttrs&&{htmlAttrs:v6(z.htmlAttrs,q.htmlAttrs)},...q.bodyAttrs&&{bodyAttrs:{...z.bodyAttrs||{},...q.bodyAttrs}}},O=C$(G);if(G=g6(G,F,{...V&&{titleIsHtml:!0},...X.app?.colorMode&&{colorMode:X.app.colorMode}},O),O)G=x6(G,z),G=f6(G,F.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let M=w[1],T=y8(M);G=G.replace(/<head\b[^>]*>/i,(D)=>`${D}
|
|
3520
3520
|
<meta name="stx-layout" content="${D8(M)}">
|
|
3521
|
-
<meta name="stx-layout-group" content="${D8(T)}">`)}let N=G.match(/function (__stx_setup_\w+)\(/),R=N?p0(G):null;if(N&&R&&!/\bdata-stx=/.test(R.tag)){G=S1(G,(T,D)=>`<body${D} data-stx="${N[1]}">`);let M=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${N[1]}"`,"i");G=G.replace(M,"$1")}}if(Q){let z=Z.__stx_head_injections??N$(),K=b$(G);if(K!==null)z.beforeClose.push(K);let q=I$(G);if(q!==null)z.afterOpen.push(q);G=R6(G,z);let W=X.app?.colorMode;if(W)G=M6(G,W)}if(Q)if(d8(G,"data-stx-runtime")){let K=null,q=null,W=null,U=null;try{let{getStoreScript:j}=await s("stx/store-loader",()=>import("./chunk-
|
|
3521
|
+
<meta name="stx-layout-group" content="${D8(T)}">`)}let N=G.match(/function (__stx_setup_\w+)\(/),R=N?p0(G):null;if(N&&R&&!/\bdata-stx=/.test(R.tag)){G=S1(G,(T,D)=>`<body${D} data-stx="${N[1]}">`);let M=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${N[1]}"`,"i");G=G.replace(M,"$1")}}if(Q){let z=Z.__stx_head_injections??N$(),K=b$(G);if(K!==null)z.beforeClose.push(K);let q=I$(G);if(q!==null)z.afterOpen.push(q);G=R6(G,z);let W=X.app?.colorMode;if(W)G=M6(G,W)}if(Q)if(d8(G,"data-stx-runtime")){let K=null,q=null,W=null,U=null;try{let{getStoreScript:j}=await s("stx/store-loader",()=>import("./chunk-0b3cqgyr.js")),B=X.storesDir,V=await j(B);if(V)q=`<script data-stx-stores>${V}</script>`}catch{}K=await M8([G,q],X);try{let{getFrameworkComposableScript:j}=await s("stx/framework-composables",()=>import("./chunk-191bg6nt.js"));U=await j(G)}catch{}try{let{getComposableScript:j}=await s("stx/composable-loader",()=>import("./chunk-408rnn07.js")),B=X.composablesDir,V=[K,q,U].filter((_)=>_!==null),L=await j(X._layerComposableDirs??B,G,V);if(L)W=`<script data-stx-scoped data-stx-run="always" data-stx-composables>${L}</script>`}catch{}let H=[K,q,W,U].filter((j)=>j!==null).map((j)=>`
|
|
3522
3522
|
${j}`).join("");G=qz(G,H)}else{let K=await M8([G],X);if(K){let q=G.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(q!==-1)G=G.slice(0,q)+K+`
|
|
3523
3523
|
`+G.slice(q)}}if(Q)G=A6(G);if(Q&&Z.__stx_inject_css!==!1)G=await v8(G,void 0,X.buildMode==="serve",!0);else if(Q)G=P8(G);if(G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q&&Z.__stx_runtime_config)G=C8(G,Z.__stx_runtime_config);if(Q&&!Z.__stx_defer_server_data){let z=b6(Z);if(z){let K=/<head\b[^>]*>/i.exec(G),q=K?K.index+K[0].length:0;G=G.slice(0,q)+z+G.slice(q)}}return G})}catch(G){if(G instanceof I8)throw G;let z=G instanceof Error?G.message:String(G),K=new b2(`Template processing failed: ${z}`,J,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(n0.log(K,{filePath:J,context:Z}),k8.logDetailedError(K,{filePath:J,template:$.substring(0,500)}),X.debug)throw K;return T8.createFallbackContent("Template Processing",K)}}async function Wz($,Z,J,X,Y){let Q=process.cwd(),G={...X,partialsDir:X.partialsDir&&!b0.isAbsolute(X.partialsDir)?b0.resolve(Q,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!b0.isAbsolute(X.componentsDir)?b0.resolve(Q,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!b0.isAbsolute(X.layoutsDir)?b0.resolve(Q,X.layoutsDir):X.layoutsDir},z=G,K=$;await jz(J,Z),Hz(Z,z),K=await y2(()=>W6(K,Z,J,z),K,(O)=>{n0.log(O,{filePath:J,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${J}: ${O.message}`)}),K=K.replace(/\{\{--[\s\S]*?--\}\}/g,"");let q=j1(K,R9,(O,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);K=q.output;let W=q.tokens,U=(O)=>W.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,N)=>W[Number(N)]??""),H="\x00STX_ESCAPED_AT\x00";K=K.replace(/@@/g,H),K=K.replace(/@\{\{([\s\S]*?)\}\}/g,(O,w)=>{return`{{ ${w} }}`}),K=V6(K),K=await j8(K,J,Y);let j={};K=O$(K,j);let B={...Z.__sections||{}},V="",L=o3(n3($)),_=/@nolayout\b/.test(K)||L===!1;if(/@nolayout\b/.test(K))K=K.replace(/@nolayout\b\s*/g,"");let F=K.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)V=F[1],K=K.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof L==="string"){if(V=L,!/@section\s*\(/.test(K))K=`@section('content')
|
|
3524
3524
|
${K.trim()}
|
|
@@ -3527,7 +3527,7 @@ ${K.trim()}
|
|
|
3527
3527
|
@endsection`}}if(K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,w,N)=>{return B[w]=N,""}),K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,w,N)=>{if(/^(['"]).*\1$/.test(N.trim()))return O;try{let R=Q0(N.trim(),Z);if(R===void 0)return O;return B[w]=String(R??""),""}catch{return O}}),K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,w,N)=>{if(N.includes("@parent"))B[w]=N.replace("@parent",b1);else B[w]=N.trim();return""}),Z.__sections=B,K=K.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,w,N)=>{return B[w]||N||""}),!("slot"in Z)||Z.slot===void 0)K=K.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(K=_$(K,j),V){let O=[],w=c0(K),N=j1(w.output,i2,(R,M)=>`\x00STX_ORPHAN_STYLE_${M}\x00`);if(K=N.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,M,T)=>{let D=M==="SCRIPT"?Bz(w.scripts[Number(T)],J):N.tokens[Number(T)];if(D)O.push(D);return""}),O.length>0){let R=O.join(`
|
|
3528
3528
|
`);B.content=B.content?`${B.content}
|
|
3529
3529
|
${R}`:R,Z.__sections=B}}if(V)try{let O;if(b0.isAbsolute(V))O=V,Y.add(V);else O=await y2(()=>e2(V,J,G,Y),null,()=>{throw new b2(`Failed to resolve layout path: ${V}`,J,void 0,void 0,`Layout referenced from ${J}`)});if(!O){let D=(A)=>{if(!A)return[];try{let k=b0.isAbsolute(A)?A:b0.resolve(process.cwd(),A);return zz.readdirSync(k).filter((C)=>C.endsWith(".stx")).map((C)=>C.replace(/\.stx$/,""))}catch{return[]}},I=[...D(G.layoutsDir),...D(G.fallbackLayoutsDir)].filter((A,k,C)=>C.indexOf(A)===k).sort(),E=`Layout not found: ${V} (referenced from ${J})`+(I.length>0?`. Available layouts: ${I.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(n0.log(Error(E),{layoutPath:V,filePath:J,available:I},"error"),console.error(`[stx] ${E}`),G.debug)throw new b2(E,J);return K}let w=await y2(()=>Bun.file(O).text(),"",()=>{throw new b2(`Failed to read layout file: ${O}`,J,void 0,void 0,"Layout content could not be loaded")});w=N8(w,O);let N=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(N){if(G.debug)console.log(`Found nested layout: ${N[1]} in ${O}`);let D={},I=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(k,C,y)=>{return D[C]=y.trim(),""});for(let[k,C]of Object.entries(D))if(B[k]&&B[k].includes(b1)){let y=B[k].indexOf(b1);B[k]=B[k].slice(0,y)+C+B[k].slice(y+b1.length)}else if(!B[k])B[k]=C;let E={...Z,__sections:B},A=`@layout('${N[1]}')${I}`;return await n$(A,E,O,G,Y)}let R=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),M=O$(R,j),T={};return M=M.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(D,I,E)=>{return T[I]=E.trim(),`@slot('${I}')`}),M=M.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(D,I,E)=>{if(B[I]){let A=B[I];if(A.includes(b1)){let k=T[I]||"",C=A.indexOf(b1);A=A.slice(0,C)+k+A.slice(C+b1.length)}return A}return E||""}),M=Uz(M,B),M=M.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),M=_$(M,j),Z.__originalFilePath=J,K=await A8(M,Z,O,G,Y),K=`<!-- stx-layout: ${V} -->
|
|
3530
|
-
${K}`,U(K)}catch(O){return n0.log(O instanceof Error?O:Error(String(O)),{layoutPath:V,filePath:J},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return U(await A8(K,Z,J,G,Y))}function Uz($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(J,X,Y)=>{let Q=Z[X];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function Hz($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let J=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(J)&&Q!==void 0)X[Y]=Q;$.$env=X}async function jz($,Z){await y2(()=>j6($,Z),void 0,(J)=>{n0.log(J,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${J.message}`)})}var i$="data-stx-source";function Bz($,Z){if(!$)return $;let J=/^<script\b([^>]*)>/i.exec($);if(!J||!/\bserver\b/.test(J[1])||J[1].includes(i$))return $;return`<script ${i$}="${encodeURIComponent(Z)}"${$.slice(7)}`}function Vz($){let Z=new RegExp(`${i$}="([^"]*)"`).exec($);return Z?decodeURIComponent(Z[1]):void 0}async function Oz($,Z,J){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=X.exec($))!==null){let Q=Y[1],G=Y[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;let K=Vz(Q)??J;try{let{extractVariables:q}=await s("stx/variable-extractor",()=>import("./chunk-
|
|
3530
|
+
${K}`,U(K)}catch(O){return n0.log(O instanceof Error?O:Error(String(O)),{layoutPath:V,filePath:J},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return U(await A8(K,Z,J,G,Y))}function Uz($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(J,X,Y)=>{let Q=Z[X];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function Hz($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let J=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(J)&&Q!==void 0)X[Y]=Q;$.$env=X}async function jz($,Z){await y2(()=>j6($,Z),void 0,(J)=>{n0.log(J,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${J.message}`)})}var i$="data-stx-source";function Bz($,Z){if(!$)return $;let J=/^<script\b([^>]*)>/i.exec($);if(!J||!/\bserver\b/.test(J[1])||J[1].includes(i$))return $;return`<script ${i$}="${encodeURIComponent(Z)}"${$.slice(7)}`}function Vz($){let Z=new RegExp(`${i$}="([^"]*)"`).exec($);return Z?decodeURIComponent(Z[1]):void 0}async function Oz($,Z,J){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=X.exec($))!==null){let Q=Y[1],G=Y[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;let K=Vz(Q)??J;try{let{extractVariables:q}=await s("stx/variable-extractor",()=>import("./chunk-09fb200s.js"));await q(G,Z,K,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));n0.log(W,{filePath:K,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${K}: ${W.message}`)}}}async function _z($,Z,J){try{let{interpolateScriptsInTemplate:X}=await s("stx/expressions",()=>import("./chunk-tzywy1s7.js"));return X($,Z,{skipServer:!0})}catch(X){let Y=X instanceof Error?X:Error(String(X));return n0.log(Y,{filePath:J,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${J}: ${Y.message}`),$}}async function A8($,Z,J,X,Y){let Q=$,G=X;if(await Oz(Q,Z,J),Q=await _z(Q,Z,J),Q=await s4(Q,Z,J),Q=await r4(Q,Z,J),Q=await t7(Q,Z,J,G),J1(Q))Q=Q8(Q,Z),Q=h$(Q,Z);Q=z8(Q);let{processStreamDirectives:z}=await s("stx/streaming",()=>import("./chunk-evk1dzpg.js"));Q=z(Q,Z),Q=Q6(Q,Z,J,G,!0),Q=await F6(Q,Z,J,G,Y),Q=await H$(Q,Z,J,G,Y),Q=i3(Q,Z,J,G);let{processDeferDirectives:K}=await s("stx/defer",()=>import("./chunk-p1cddybx.js"));Q=K(Q,Z,J);let{processTeleportDirectives:q}=await s("stx/teleport",()=>import("./chunk-q0srntf6.js"));Q=q(Q,Z,J);let{processTransitionDirectives:W,processTransitionAttributes:U}=await s("stx/transitions",()=>import("./chunk-86v2rps7.js"));Q=W(Q,Z,J),Q=U(Q);let{processErrorBoundaryDirectives:H}=await s("stx/error-boundaries",()=>import("./chunk-kdhrk7x5.js"));Q=H(Q,Z,J);let{processSuspenseDirectives:j}=await s("stx/suspense",()=>import("./chunk-rkykwy3z.js"));Q=j(Q,Z,J);let{processAsyncDirectives:B}=await s("stx/async-components",()=>import("./chunk-tr41gn5j.js"));Q=B(Q,Z,J);let{processKeepAliveDirectives:V}=await s("stx/keep-alive",()=>import("./chunk-mys0rat0.js"));Q=V(Q,Z,J);let{processVirtualListDirectives:L,processVirtualGridDirectives:_,processInfiniteListDirectives:F}=await s("stx/virtual-scrolling",()=>import("./chunk-eq2j7w8p.js"));Q=L(Q,Z,J),Q=_(Q,Z,J),Q=F(Q,Z,J);let{processPartialHydrationDirectives:O,processStaticDirectives:w}=await s("stx/partial-hydration",()=>import("./chunk-tr1174hz.js"));Q=O(Q,Z,J),Q=w(Q);let{processComputedDirectives:N,processWatchDirectives:R}=await s("stx/computed",()=>import("./chunk-dekxwgc2.js"));Q=N(Q,Z,J),Q=R(Q,Z,J);let{processFormValidationDirectives:M}=await s("stx/forms-validation",()=>import("./chunk-h0y4mb2m.js"));Q=M(Q,Z,J);let{processHeadDirective:T,processTitleDirective:D,processMetaDirective:I,resetHead:E}=await s("stx/head",()=>import("./chunk-x48crnwa.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)E();let A=T(Q);if(Q=A.content,A.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${A.headContent}
|
|
3531
3531
|
`;if(Q=D(Q,Z),Q=I(Q,Z),Q=H6(Q),Q=C5(Q,Z),Q=a7(Q),Q=K6(Q),Q=await V$(Q,Z,J,G,Y),Q=await H$(Q,Z,J,G,Y),Z.__stxProcessingDepth===1)Q=O3(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=d$(Q),Q=a0(Q,Z,J),Q=F$(Q),Q=r3(Q,Z,{filePath:J,buildMode:G.buildMode}),Q=S5(Q,Z),Q=P5(Q,Z),Q=F2(Q,Z),Q=m5(Q,Z),Q=d5(Q,Z),Q=await g7(Q,Z,J,G),Q=await X7(Q,Z,J),Q=await E8(Q,Z,J,G),Q=b8(Q,Z,J,G),Q=g8(Q,Z,J,G),Q=h8(Q,Z,J),Q=u8(Q,Z,J,G),Q=s7(Q,Z,J,G),Q=u$(Q,Z),Q=m$(Q),Q=O8(Q),!G.skipEventDirectives)Q=j3(Q,Z,J);if(Q=e3(Q,Z,J),G.debug){let p=/\bx-data\s*=/.test(Q),m=g$($);if(p&&m)console.warn(`[stx] ${J}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
3532
3532
|
Both work on the same page, but they manage separate scopes.
|
|
3533
3533
|
Prefer signals (state/derived/effect) for new components.`)}Q=f4(Q,Z),Q=await B1(Q,Z,J),Q=w8(Q),Q=R8(Q),Q=g3(Q);let{processXElementDirectives:k}=await s("stx/x-element",()=>import("./chunk-0xgc5t3y.js"));Q=k(Q);let C=Z.__originalFilePath||J,y=v9(Z);if(Q=await K8(Q,G,C,y),Q=J4(Q,Z),Q=await U6(Q,Z,J,G),G.media?.image?.autoSiblings){let p=G.publicDir||"public",{rewriteImagesWithSiblings:m}=await s("stx/image-optimization/auto-sibling",()=>import("./chunk-fx5m9d3t.js"));Q=await m(Q,{publicDir:p})}if(G.seo?.enabled)Q=m8(Q,Z,G);let b=(p,m,i=!0)=>{if(!m)return p;let j0=m.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),a=p.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(j0&&a){if(i)p=p.replace(a[0],j0[0]);if(m=m.replace(j0[0],"").trim(),!m)return p}if(/<\/head>/i.test(p))return p.replace(/<\/head>/i,`${m}
|
|
@@ -3535,13 +3535,13 @@ ${K}`,U(K)}catch(O){return n0.log(O instanceof Error?O:Error(String(O)),{layoutP
|
|
|
3535
3535
|
${m}`);if(/<html\b[^>]*>/i.test(p))return p.replace(/(<html\b[^>]*>)/i,`$1
|
|
3536
3536
|
<head>
|
|
3537
3537
|
${m}
|
|
3538
|
-
</head>`);return p},{renderHead:P,getHead:u}=await s("stx/head",()=>import("./chunk-x48crnwa.js")),g=Z.__stx_runtime_head??u();if(g.title||g.meta?.length||g.link?.length){let p=P(g);if(p)Q=b(Q,p)}if(A.headContent)Q=b(Q,A.headContent,!g.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=n7(Q,G.csp,Z);if(G.analytics?.enabled)Q=u3(Q,G);if(G.heatmap?.enabled)Q=d3(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:p}=await s("stx/pwa/inject",()=>import("./chunk-
|
|
3538
|
+
</head>`);return p},{renderHead:P,getHead:u}=await s("stx/head",()=>import("./chunk-x48crnwa.js")),g=Z.__stx_runtime_head??u();if(g.title||g.meta?.length||g.link?.length){let p=P(g);if(p)Q=b(Q,p)}if(A.headContent)Q=b(Q,A.headContent,!g.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=n7(Q,G.csp,Z);if(G.analytics?.enabled)Q=u3(Q,G);if(G.heatmap?.enabled)Q=d3(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:p}=await s("stx/pwa/inject",()=>import("./chunk-eb1v7f55.js"));Q=p(Q,G)}let J0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),X0=/\bSTX\.\w+/.test(Q),$0=/window\.STX\s*=/.test(Q);if(J0&&X0&&!$0){let m=`<script data-stx-scoped data-stx-run="once">
|
|
3539
3539
|
${v3()}
|
|
3540
3540
|
</script>`;if(Q.includes("</head>")){let i=Q.indexOf("</head>"),a=Q.slice(0,i).indexOf("<script");if(a!==-1){let y0=Q.slice(0,a),U1=Q.slice(a);Q=y0+m+`
|
|
3541
3541
|
`+U1}else Q=Q.replace("</head>",`${m}
|
|
3542
3542
|
</head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
|
|
3543
3543
|
${m}`);else Q=m+`
|
|
3544
|
-
`+Q}{let{scanScriptTags:p}=await s("stx/signal-processing",()=>import("./chunk-
|
|
3544
|
+
`+Q}{let{scanScriptTags:p}=await s("stx/signal-processing",()=>import("./chunk-pvtnhx3j.js")),m=[];for(let i of p(Q)){if(!/\bserver\b/i.test(i.attrs))continue;let j0=i.start+i.fullMatch.indexOf(">")+1,a=Kz(Q,j0);if(a===-1)continue;let y0=a+9;while(y0<Q.length&&/\s/.test(Q[y0]))y0++;m.push({start:i.start,end:y0})}if(m.length>0){let i=Array(m.length+1),j0=0;for(let a=0;a<m.length;a++){let{start:y0,end:U1}=m[a];i[a]=Q.slice(j0,y0),j0=U1}i[m.length]=Q.slice(j0),Q=i.join("")}}let c=x9(Q,J);if(c.hasScoped)Q=c.html;let K0=Z.__stx_event_bindings||[],r=!1,V0=[],$1=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:T0}=await s("stx/signal-processing",()=>import("./chunk-pvtnhx3j.js"));for(let p of T0(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))V0.push({match:p.fullMatch,attrs:p.attrs,content:p.body});for(let{match:p,attrs:m,content:i}of V0){r=!0;let j0=i;c$(i,J,X.strict,Z.__originalFilePath);let a=await f9(i,{eventBindings:K0,attrs:m,hasColonDirectives:$1,templateContent:$,filePath:J,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:y});Q=Q.replace(p,()=>a)}if(r)Z.__stx_event_bindings=[];if(!r&&Z.__stxProcessingDepth===1){let p=Z.__stx_event_bindings||[];if(p.length>0){let m=r9(p);if(m){let i=Q.lastIndexOf("</body>");Q=i===-1?Q+m:Q.slice(0,i)+m+`
|
|
3545
3545
|
`+Q.slice(i)}Z.__stx_event_bindings=[]}}if(!p6(Q)&&i6(Q))Q=await y9(Q,G);if(Q=n6(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=o7(Q,Z.cspNonce);return Q}import JZ from"path";import s$ from"fs";import C2 from"path";function l8($,Z,J,X){let Y=0;for(let Q=Z;Q<$.length;Q++)if($[Q]===J)Y++;else if($[Q]===X&&!(X===">"&&$[Q-1]==="=")){if(--Y===0)return Q}return-1}function Lz($){let Z=W0($),J=0,X=0,Y=[];for(let Q=0;Q<Z.length;Q++)if("([{".includes(Z[Q]))J++;else if(")]}".includes(Z[Q]))J--;else if(Z[Q]===","&&J===0)Y.push($.slice(X,Q).trim()),X=Q+1;return Y.push($.slice(X).trim()),Y}function o$($,Z){let J=W0($),X=new RegExp(`\\b(?:${Z.map((Y)=>Y.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let Y of J.matchAll(X)){let Q=Y.index+Y[0].length,G="";if(J[Q]==="<"){let K=l8(J,Q,"<",">");if(K<0)continue;G=$.slice(Q+1,K),Q=K+1;while(/\s/.test(J[Q]||"")&&Q<J.length)Q++}if(J[Q]!=="(")continue;let z=l8(J,Q,"(",")");if(z>=0)return{type:G,args:Lz($.slice(Q+1,z))}}return null}var c8=`
|
|
3546
3546
|
type __StxCtor<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends ObjectConstructor ? object : T extends readonly unknown[] ? __StxCtor<T[number]> : T extends abstract new (...args: any[]) => infer V ? V : unknown;
|
|
3547
3547
|
type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
|
|
@@ -3603,11 +3603,11 @@ ${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:Q,name:G,value:
|
|
|
3603
3603
|
${Q}`,Y++}while(Y<$.length){let Q=$[Y].trim();if(Q.startsWith(".")||Q.startsWith("?."))X+=`
|
|
3604
3604
|
${$[Y]}`,Y++;else break}return{value:X,nextIndex:Y}}function BK($,Z,J){let X=J,Y=Z+1;while(Y<$.length){let Q=TZ(X);if(Q!==-1){if(N0(X,"{","}",Q)!==-1)break}let G=$[Y];X+=`
|
|
3605
3605
|
${G}`,Y++}return{functionCode:X,nextIndex:Y}}function BZ($,Z){let J=Q0($,Z)??Q0(`(${$})`,Z);if(J!==void 0)return J;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...J2.env}})},Y=Object.keys(X).filter(X2),Q=Y.map((G)=>X[G]);try{return Function(...Y,`'use strict'; return (${$});`)(...Q)}catch{try{return Function(...Y,`'use strict'; return ${$};`)(...Q)}catch{return}}}async function VK($,Z,J){let X=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of X){let[,,G,z]=Q;try{let K=z.trim().replace(/;$/,""),q=BZ(K,Z);if(q!==void 0)Z[G]=q}catch(K){console.warn(`Failed to parse export ${G} in fallback:`,K)}}let Y=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of Y){let[,,G,z]=Q;if(!(G in Z))try{let K=z.trim().replace(/;$/,""),q=BZ(K,Z);if(q!==void 0)Z[G]=q}catch{}}}function OK($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Z?Z[1]:"",X=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:J,templateWithoutScript:X}}function _K($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var P2=new o1(500),l9=new o1(1000),vZ=33554432,Z3=vZ;function LK($){let Z=$.componentRenderCacheBytes;if(typeof Z!=="number"||Z<0||Z===Z3)return;Z3=Z,c9.setMaxBytes(Z)}var c9=new o1(2000,{maxBytes:vZ,sizeOf:($)=>$.output.length});function FK($){let Z=new WeakSet;try{let J=(X)=>{if(X===void 0)return{__stxType:"undefined"};if(typeof X==="bigint")return{__stxType:"bigint",value:X.toString()};if(typeof X==="function"||typeof X==="symbol")throw TypeError("Non-serializable component input");if(X===null||typeof X!=="object")return X;if(Z.has(X))throw TypeError("Circular component input");if(Z.add(X),X instanceof Date)return{__stxType:"date",value:X.toISOString()};if(Array.isArray(X))return X.map(J);let Y={};for(let Q of Object.keys(X).sort())Y[Q]=J(X[Q]);return Y};return JSON.stringify(J($))}catch{return null}}function kZ($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function wK($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function M1($){return!wK($)}var d9=new Map;function e$($){let Z;try{Z=JSON.stringify($)}catch{return new Bun.Transpiler($)}let J=d9.get(Z);if(J)return J;if(d9.size>=16)d9.clear();let X=new Bun.Transpiler($);return d9.set(Z,X),X}var EZ=new WeakMap,RK=256;function A1($){try{let Z=e$({loader:"ts",target:"browser",define:$2()}),J=EZ.get(Z);if(!J)J=new Map,EZ.set(Z,J);let X=J.get($);if(X!==void 0)return X;let Y=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Y=Y.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Q=[];Y=Y.replace(/\{!![\s\S]*?!!\}/g,(z)=>{let K=Q.length;return Q.push(z),`"__STX_EXPR_${K}__"`}),Y=Y.replace(/\{\{\{[\s\S]*?\}\}\}/g,(z)=>{let K=Q.length;return Q.push(z),`"__STX_EXPR_${K}__"`}),Y=Y.replace(/\{\{[\s\S]*?\}\}/g,(z)=>{let K=Q.length;return Q.push(z),`"__STX_EXPR_${K}__"`});let G=Z.transformSync(Y);for(let z=0;z<Q.length;z++)G=G.replace(`"__STX_EXPR_${z}__"`,Q[z]),G=G.replace(`'__STX_EXPR_${z}__'`,Q[z]);if(J.size>=RK){let z=J.keys().next();if(!z.done)J.delete(z.value)}return J.set($,G),G}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function NK($){let Z=[],J=new Set,X=0,Y=0,Q=$.length,G=(W)=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]===W){Y++;return}Y++}},z=()=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;return}if($[Y]==="$"&&$[Y+1]==="{"){Y+=2;let W=1;while(Y<Q&&W>0)if($[Y]==="{")W++,Y++;else if($[Y]==="}")W--,Y++;else if($[Y]==="'"||$[Y]==='"')G($[Y]);else if($[Y]==="`")z();else Y++;continue}Y++}},K=()=>{if($[Y]==="/"&&$[Y+1]==="/"){while(Y<Q&&$[Y]!==`
|
|
3606
|
-
`)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},q=()=>{if(X!==0)return;let W=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(W){let B=W[2].split(",").map((V)=>{let L=V.trim().split(":");return L[L.length-1].trim()});for(let V of B)if(V&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(V)&&!J.has(V))Z.push(V),J.add(V);return}let U=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!J.has(B))Z.push(B),J.add(B);return}let H=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!J.has(B))Z.push(B),J.add(B);return}let j=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))Z.push(B),J.add(B)}};while(Y<Q){if(K())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){z();continue}if($[Y]==="{"){X++,Y++;continue}if($[Y]==="}"){X--,Y++;continue}if(X===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))q();Y++}return Z}function DK($){let Z=[],J=0,X=0,Y=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G==="\\"){Q++;continue}if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="("||G==="["||G==="{")J++;else if(G===")"||G==="]"||G==="}")J--;else if(G===","&&J===0)Z.push($.slice(X,Q)),X=Q+1}if(X<$.length)Z.push($.slice(X));return Z}function MK($){let Z=0,J=null;for(let X=0;X<$.length;X++){let Y=$[X];if(J){if(Y==="\\"){X++;continue}if(Y===J)J=null;continue}if(Y==='"'||Y==="'"||Y==="`"){J=Y;continue}if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y==="="&&Z===0){let Q=$[X-1],G=$[X+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function AK($,Z){try{let J=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!J)return;let X=J.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let Y=X,Q=0,G=-1;for(;X>=0;X--){let K=$[X];if(K==="}")Q++;else if(K==="{"){if(Q--,Q===0){G=X;break}}}if(G===-1)return;let z=$.slice(G+1,Y);for(let K of DK(z)){let q=K.trim();if(!q||q.startsWith("..."))continue;let W=MK(q);if(W===-1)continue;let U=q.slice(0,W).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let H=q.slice(W+1).trim();if(!H)continue;try{let j=Object.keys(Z).filter(X2),B=Function(...j,`"use strict"; return (${H});`);Z[U]=B(...j.map((V)=>Z[V]))}catch{}}}catch{}}async function F9($,Z,J,X,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(_)=>_.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),z=(_)=>_.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),K=J.__importedComponents;if(K){for(let _ of[Q,Q.toLowerCase(),G(Q),z(Q)])if(K.has(_))return!0}let q=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${z(Q)}.stx`])],W=typeof Y.root==="string"?x.resolve(Y.root):void 0,U=W??x.dirname(X),H=[],j=(_)=>{if(_&&!H.includes(_))H.push(_)},B=J.__originalFilePath;if(B)j(x.join(x.dirname(B),"components"));if(j(Z),j(Y._rootComponentsDir),j(x.join(x.dirname(X),"components")),j(Y.componentsDir),W)j(x.resolve(W,"resources/views/components")),j(x.resolve(W,"resources/components")),j(x.resolve(W,"src/components")),j(x.resolve(W,"components"));for(let _ of Y._layerComponentDirs??[])j(_);let V=Y._pluginComponentDirs;if(Array.isArray(V))for(let _ of V)j(typeof _==="string"?_:null);if(j(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return e(x.resolve(x.dirname(X),`${Q}.stx`));let L=bZ(x.resolve(import.meta.dir,"components"));for(let _ of H){let F=x.isAbsolute(_)?_:x.resolve(U,_);if(bZ(F)===L)continue;for(let O of q)if(await e(x.join(F,O)))return!0}return!1}function bZ($){try{return PZ.realpathSync($)}catch{return $}}function IK($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function TK($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function kK($){let Z=new Set,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let X of $){let Y;while((Y=J.exec(X))!==null)Z.add(Y[1]);J.lastIndex=0}return[...Z]}async function D1($,Z,J,X,Y,Q,G,z=new Set,K){let{extractVariables:q}=await s("stx/variable-extractor",()=>import("./chunk-
|
|
3606
|
+
`)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},q=()=>{if(X!==0)return;let W=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(W){let B=W[2].split(",").map((V)=>{let L=V.trim().split(":");return L[L.length-1].trim()});for(let V of B)if(V&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(V)&&!J.has(V))Z.push(V),J.add(V);return}let U=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!J.has(B))Z.push(B),J.add(B);return}let H=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!J.has(B))Z.push(B),J.add(B);return}let j=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))Z.push(B),J.add(B)}};while(Y<Q){if(K())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){z();continue}if($[Y]==="{"){X++,Y++;continue}if($[Y]==="}"){X--,Y++;continue}if(X===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))q();Y++}return Z}function DK($){let Z=[],J=0,X=0,Y=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G==="\\"){Q++;continue}if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="("||G==="["||G==="{")J++;else if(G===")"||G==="]"||G==="}")J--;else if(G===","&&J===0)Z.push($.slice(X,Q)),X=Q+1}if(X<$.length)Z.push($.slice(X));return Z}function MK($){let Z=0,J=null;for(let X=0;X<$.length;X++){let Y=$[X];if(J){if(Y==="\\"){X++;continue}if(Y===J)J=null;continue}if(Y==='"'||Y==="'"||Y==="`"){J=Y;continue}if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y==="="&&Z===0){let Q=$[X-1],G=$[X+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function AK($,Z){try{let J=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!J)return;let X=J.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let Y=X,Q=0,G=-1;for(;X>=0;X--){let K=$[X];if(K==="}")Q++;else if(K==="{"){if(Q--,Q===0){G=X;break}}}if(G===-1)return;let z=$.slice(G+1,Y);for(let K of DK(z)){let q=K.trim();if(!q||q.startsWith("..."))continue;let W=MK(q);if(W===-1)continue;let U=q.slice(0,W).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let H=q.slice(W+1).trim();if(!H)continue;try{let j=Object.keys(Z).filter(X2),B=Function(...j,`"use strict"; return (${H});`);Z[U]=B(...j.map((V)=>Z[V]))}catch{}}}catch{}}async function F9($,Z,J,X,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(_)=>_.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),z=(_)=>_.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),K=J.__importedComponents;if(K){for(let _ of[Q,Q.toLowerCase(),G(Q),z(Q)])if(K.has(_))return!0}let q=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${z(Q)}.stx`])],W=typeof Y.root==="string"?x.resolve(Y.root):void 0,U=W??x.dirname(X),H=[],j=(_)=>{if(_&&!H.includes(_))H.push(_)},B=J.__originalFilePath;if(B)j(x.join(x.dirname(B),"components"));if(j(Z),j(Y._rootComponentsDir),j(x.join(x.dirname(X),"components")),j(Y.componentsDir),W)j(x.resolve(W,"resources/views/components")),j(x.resolve(W,"resources/components")),j(x.resolve(W,"src/components")),j(x.resolve(W,"components"));for(let _ of Y._layerComponentDirs??[])j(_);let V=Y._pluginComponentDirs;if(Array.isArray(V))for(let _ of V)j(typeof _==="string"?_:null);if(j(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return e(x.resolve(x.dirname(X),`${Q}.stx`));let L=bZ(x.resolve(import.meta.dir,"components"));for(let _ of H){let F=x.isAbsolute(_)?_:x.resolve(U,_);if(bZ(F)===L)continue;for(let O of q)if(await e(x.join(F,O)))return!0}return!1}function bZ($){try{return PZ.realpathSync($)}catch{return $}}function IK($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function TK($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function kK($){let Z=new Set,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let X of $){let Y;while((Y=J.exec(X))!==null)Z.add(Y[1]);J.lastIndex=0}return[...Z]}async function D1($,Z,J,X,Y,Q,G,z=new Set,K){let{extractVariables:q}=await s("stx/variable-extractor",()=>import("./chunk-09fb200s.js")),W=z??new Set;if(W.has($))return`[Circular component reference: ${$}]`;let U=new Set(W);U.add($);let H=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let j=H&&H!=="load"&&IK(H)?H:"";try{let B=(h)=>h.split("-").map((d)=>d.charAt(0).toUpperCase()+d.slice(1)).join(""),V=(h)=>h.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,_=null,F=Y.__importedComponents;if(F){let h=[L,L.toLowerCase(),B(L),V(L)];for(let d of h)if(F.has(d)){_=F.get(d);break}}let O=[];if(!_){let h=[`${L}.stx`,`${B(L)}.stx`,`${V(L)}.stx`],d=[...new Set(h)],G0=Y.__originalFilePath,o=[];if(o.push(...G._layerComponentDirs??[]),G0){let A0=x.join(x.dirname(G0),"components");o.push(A0)}if(X)o.push(X);let F0=G._rootComponentsDir;if(typeof F0==="string"&&!o.includes(F0))o.push(F0);let O0=x.join(x.dirname(Q),"components");if(!o.includes(O0))o.push(O0);if(G.componentsDir&&G.componentsDir!==X&&!o.includes(G.componentsDir))o.push(G.componentsDir);let C0=typeof G.root==="string"?x.resolve(G.root):void 0,s0=C0??x.dirname(Q),v0=[];if(C0)v0.push(x.resolve(C0,"resources/views/components")),v0.push(x.resolve(C0,"resources/components")),v0.push(x.resolve(C0,"src/components")),v0.push(x.resolve(C0,"components"));v0.push(x.resolve(import.meta.dir,"components"));for(let A0 of v0)if(!o.includes(A0))o.push(A0);let t=G._pluginComponentDirs;if(Array.isArray(t)){for(let A0 of t)if(typeof A0==="string"&&!o.includes(A0))o.push(A0)}if(G.fallbackComponentsDir&&!o.includes(G.fallbackComponentsDir))o.push(G.fallbackComponentsDir);let u0=[...new Set(o.map((A0)=>{if(!A0)return A0;return x.isAbsolute(A0)?A0:x.resolve(s0,A0)}))];o.length=0,o.push(...u0);let f2=`${L}\x00${Q}\x00${u0.join("\x00")}`,i9=l9.get(f2);if(i9)if(await e(i9))_=i9;else l9.delete(f2);if(!_&&(L.startsWith("./")||L.startsWith("../")))_=x.resolve(x.dirname(Q),`${L}.stx`),O.push(_);else if(!_)for(let A0 of o){if(!A0)continue;for(let x2 of d){let g2=x.join(A0,x2);if(O.push(g2),await e(g2)){_=g2;break}}if(_)break;if(!_)try{let x2=await import("fs");if(!x2.statSync(A0,{throwIfNoEntry:!1})?.isDirectory())continue;let iZ=8,n9=[{path:A0,depth:0}];while(n9.length>0&&!_){let h2=n9.pop();if(h2.depth>=iZ)continue;let Q3;try{Q3=x2.readdirSync(h2.path,{withFileTypes:!0})}catch{continue}for(let u2 of Q3){if(!u2.isDirectory())continue;if(u2.name==="node_modules"||u2.name.startsWith("."))continue;let G3=x.join(h2.path,u2.name);for(let nZ of d){let o9=x.join(G3,nZ);if(O.push(o9),await e(o9)){_=o9;break}}if(_)break;n9.push({path:G3,depth:h2.depth+1})}}}catch{}if(_)break}if(_)l9.set(f2,_)}if(!_||!await e(_)){let h=O.length>0?`
|
|
3607
3607
|
Searched paths:
|
|
3608
3608
|
${O.map((d)=>` - ${d}`).join(`
|
|
3609
|
-
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${h}`}K.add(_);let w;if(P2.has(_))w=P2.get(_);else try{w=await Bun.file(_).text(),P2.set(_,w)}catch(h){return`[Error loading component: ${h instanceof Error?h.message:String(h)}]`}let N=new Set(["__originalFilePath","__importedComponents",m2,"__stx_client_signal_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),R={};for(let[h,d]of Object.entries(Y))if(!h.startsWith("__")||N.has(h))R[h]=d;let M=J;if(J.includes("@include")){let{processIncludes:h}=await s("stx/includes",()=>import("./chunk-
|
|
3610
|
-
`)}`}if(J&&a.includes("{{ text || slot }}"))a=a.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{applySlots:y0}=await s("stx/slots",()=>import("./chunk-
|
|
3609
|
+
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${h}`}K.add(_);let w;if(P2.has(_))w=P2.get(_);else try{w=await Bun.file(_).text(),P2.set(_,w)}catch(h){return`[Error loading component: ${h instanceof Error?h.message:String(h)}]`}let N=new Set(["__originalFilePath","__importedComponents",m2,"__stx_client_signal_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),R={};for(let[h,d]of Object.entries(Y))if(!h.startsWith("__")||N.has(h))R[h]=d;let M=J;if(J.includes("@include")){let{processIncludes:h}=await s("stx/includes",()=>import("./chunk-zqtrg15a.js"));M=await h(J,Y,Q,G,K)}let T=c0(M),D=[],I=T.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(h,d)=>{let G0=T.scripts[Number(d)]||"",o=G0.match(/^<script\b([^>]*)>/i)?.[1]||"",F0=o.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),O0=!F0||["module","text/javascript","application/javascript"].includes(F0);if(!/\bserver\b/i.test(o)&&O0)return D.push(G0),"";return G0}),{extractSlotContent:E}=await s("stx/slots",()=>import("./chunk-a2nsmczq.js")),A=E(I),k={};if(A.defaultSlot?.trim())k.default=A.defaultSlot;for(let[h,d]of A.namedSlots)k[h]=d.content;let C=Y.__stx_scope_seq??={n:0,key:Bun.hash(String(Y.__filename??Q)).toString(36).slice(0,6)},y=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++C.n}_${C.key}`,b={...R,$uid:y,...Z,props:Z,slot:I,$slots:k,__processedComponents:U,__sections:{},__stx_signals_gate:J1(w)||TK(J)};AK(w,b);let P=w,u=q9(P);if(u)P=u.content.trim();let l=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g=[...w.matchAll(l)],J0=[],X0=g.some((h)=>/\bserver\b/.test(h[1]||"")&&/\bcache\b/.test(h[1]||"")),$0=null,c=null,K0=null,r=0,V0=null;if(LK(G),X0&&Z3>0){let h=FK({props:Z,slot:J,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0,layers:G._layerGraph?.layers.map((d)=>d.configFile),uid:y});if(h!==null){$0=`${_}\x00${W1(w)}\x00${h}`;let d=c9.get($0);if(d){for(let G0 of d.dependencies)K.add(G0);if(F3(Y,d.clientFactories),C.n+=d.uidsConsumed,d.preservedClientExpressions.length>0){let G0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let o of d.preservedClientExpressions)G0.add(o);Y.__stx_preserved_client_expressions=[...G0]}return d.output}c=new Set(K),K0=_3(Y),r=C.n,V0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[])}}let $1=new Set;for(let h of g){let d=h[1]||"",G0=h[2]||"",o=d.includes("server");if(M1(d)&&G0.trim())G0=A1(G0);if(o&&G0){for(let O0 of y1(G0))$1.add(O0);try{await q(G0,b,_)}catch(O0){}}if(!o){let O0=G0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),C0=O0.includes("{{")&&O0.includes("}}"),s0=O0.includes("{!!")&&O0.includes("!!}");if(C0||s0)O0=J5(O0,b);let v0=d.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");J0.push(`<script${v0}>${O0}</script>`)}}let T0=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),p=T0?T0[1]:"",m=T0?T0[2]:"",i="",j0=p&&/\bscoped\b/i.test(p);if(T0)i=`<style${p}>${m}</style>`;let a=P;if(a=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),T0)a=a.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let h=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,d=[];if(a=a.replace(h,(G0,o)=>{let F0=o.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(F0)d.push(`<style${F0[1]}>${F0[2]}</style>`);return""}),a=a.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),d.length>0)i=`${i}${d.join(`
|
|
3610
|
+
`)}`}if(J&&a.includes("{{ text || slot }}"))a=a.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{applySlots:y0}=await s("stx/slots",()=>import("./chunk-a2nsmczq.js")),{defaultSlot:U1,namedSlots:p9}=A,Y2=J0.some((h)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(h)),S=(h)=>Y2?_8(h,y):h,v=new Map([...p9].map(([h,d])=>[h,{...d,content:S(d.content)}]));a=await y0(a,S(U1),v,b);let n=kK(J0),Y0=(Array.isArray(b.__stx_client_signal_names)?b.__stx_client_signal_names:[]).filter((h)=>!$1.has(h));if(n.length>0||Y0.length>0)b.__stx_client_signal_names=[...new Set([...Y0,...n])];else delete b.__stx_client_signal_names;let U0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:x.dirname(_),skipSignalsRuntime:!0,skipEventDirectives:Y2||J0.length===0,defaultLayout:void 0};b.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let M0=await n$(a,b,_,U0,K),Z1=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let h of M0.matchAll(/\{\{([\s\S]*?)\}\}/g))Z1.add(h[1].trim());if(Z1.size>0)Y.__stx_preserved_client_expressions=[...Z1];let H1=y,P0=M0;if(Y2){let h="";if(Object.keys(Z).length>0)try{h=` data-stx-props="${kZ(JSON.stringify(Z))}"`}catch{}let d=j?` stx-hydrate="${kZ(j)}"`:"";P0=`<div data-stx-scope="${H1}"${h}${d}>${M0}</div>`;let G0=await Promise.all(J0.map(async(o)=>{let F0=o.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!F0)return o;let[,O0,C0]=F0,{vendorStyleTags:s0,factoryBody:v0}=await yK(C0,_,G.buildMode==="compile"),t=j?null:a9(Y,v0),u0=t?`window.__stxComponentFactories[${JSON.stringify(t)}](${JSON.stringify(H1)});`:`(${v0})(${JSON.stringify(H1)});`;if(j)return`${s0}<script type="stx/island" data-stx-island="${H1}" data-stx-scoped data-stx-owner="${H1}"${O0}>${u0}</script>`;return`${s0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${H1}"${O0}>${u0}</script>`}));if(P0=P0+`
|
|
3611
3611
|
`+G0.join(`
|
|
3612
3612
|
`),i)P0+=`
|
|
3613
3613
|
`+i}else{if(i)P0+=`
|
|
@@ -3630,7 +3630,7 @@ ${Z0.yellow}${Z0.bold}Message:${Z0.reset} ${Z}
|
|
|
3630
3630
|
`,z)W+=`
|
|
3631
3631
|
${Z0.blue}${Z0.bold}Context:${Z0.reset}
|
|
3632
3632
|
${Z0.dim}${z}${Z0.reset}
|
|
3633
|
-
`;return W}function HL(){P2.clear(),l9.clear(),c9.clear()}function jL(){return{size:P2.size,maxSize:500}}var $3=E1(128);async function yK($,Z,J){let X=W1($,Z,J),Y=$3.get(X);if(Y){if(SZ(Y.deps))return Y;$3.delete(X)}let Q=X3($,{filePath:Z,projectRoot:process.cwd()}),G=Q.code,z=Y3(Q.styles);G=e1(G).code;let{hasUserImports:K,bundleClientScript:q}=await s("stx/client-script-bundler",()=>import("./chunk-
|
|
3633
|
+
`;return W}function HL(){P2.clear(),l9.clear(),c9.clear()}function jL(){return{size:P2.size,maxSize:500}}var $3=E1(128);async function yK($,Z,J){let X=W1($,Z,J),Y=$3.get(X);if(Y){if(SZ(Y.deps))return Y;$3.delete(X)}let Q=X3($,{filePath:Z,projectRoot:process.cwd()}),G=Q.code,z=Y3(Q.styles);G=e1(G).code;let{hasUserImports:K,bundleClientScript:q}=await s("stx/client-script-bundler",()=>import("./chunk-63h3pg9g.js")),W=[],U=!1;if(K(G)){let _=G;G=await q(_,Z,{projectRoot:process.cwd(),minify:J,collectInputs:W}),U=G===_}let{stripStxRuntimeImports:H}=await s("stx/signal-processing",()=>import("./chunk-pvtnhx3j.js"));G=H(G);let j=t0(G),B=NK(j),V=`function(__scopeId) {
|
|
3634
3634
|
${n1("const",[...yZ,...B],j)}
|
|
3635
3635
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
3636
3636
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
@@ -3729,7 +3729,7 @@ else {
|
|
|
3729
3729
|
// STX: auto-generated event bindings
|
|
3730
3730
|
${$.map((J,X)=>oK(J,X)).join(`
|
|
3731
3731
|
`)}`}function hZ($){let Z=[],J=new Set,X=$.replace(/^\s*import\s+.*$/gm,""),Y=0,Q=X.length,G=0;while(G<Q){let z=X[G];if(z==="'"||z==='"'||z==="`"){let K=z;if(G++,K==="`"){let q=0;while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"&&q===0){G++;break}if(X[G]==="$"&&X[G+1]==="{"){q++,G+=2;continue}if(X[G]==="}"&&q>0){q--,G++;continue}G++}}else while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]===K){G++;break}G++}continue}if(z==="/"&&X[G+1]==="/"){while(G<Q&&X[G]!==`
|
|
3732
|
-
`)G++;continue}if(z==="/"&&X[G+1]==="*"){G+=2;while(G<Q-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(z==="{"){Y++,G++;continue}if(z==="}"){Y--,G++;continue}if(Y===0){let K=X.slice(G),q=K.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(q){let H=q[1];if(!H.startsWith("_")&&!J.has(H))Z.push(H),J.add(H);G+=q[0].length;continue}let W=K.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(W){W[1].split(",").forEach((H)=>{let j=H.trim(),B=j.indexOf(":"),V=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(V&&!V.startsWith("_")&&!J.has(V))Z.push(V),J.add(V)}),G+=W[0].length;continue}let U=K.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let H=U[1];if(!H.startsWith("_")&&!J.has(H))Z.push(H),J.add(H);G+=U[0].length;continue}}G++}return Z}var rK=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function aK($){let Z=new Set,J=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(H){let j;while((j=J.exec(H))!==null){let B=j[0];if(!rK.has(B))Z.add(B)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)X(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)X(Q[1]);let z=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=z.exec($))!==null)X(Q[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=K.exec($))!==null)X(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)X(Q[1]);let W=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=W.exec($))!==null)X(Q[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=U.exec($))!==null)X(Q[1]);return Z}async function f9($,Z={}){let J=$,X="",Y=!1,Q=[],G=X3(J,{filePath:Z.filePath,projectRoot:Z.projectRoot});J=G.code;let z=Y3(G.styles),K=e1(J);J=K.code,Q=[...K.imports,...K.models];let{hasUserImports:q,bundleClientScript:W}=await s("stx/client-script-bundler",()=>import("./chunk-
|
|
3732
|
+
`)G++;continue}if(z==="/"&&X[G+1]==="*"){G+=2;while(G<Q-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(z==="{"){Y++,G++;continue}if(z==="}"){Y--,G++;continue}if(Y===0){let K=X.slice(G),q=K.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(q){let H=q[1];if(!H.startsWith("_")&&!J.has(H))Z.push(H),J.add(H);G+=q[0].length;continue}let W=K.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(W){W[1].split(",").forEach((H)=>{let j=H.trim(),B=j.indexOf(":"),V=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(V&&!V.startsWith("_")&&!J.has(V))Z.push(V),J.add(V)}),G+=W[0].length;continue}let U=K.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let H=U[1];if(!H.startsWith("_")&&!J.has(H))Z.push(H),J.add(H);G+=U[0].length;continue}}G++}return Z}var rK=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function aK($){let Z=new Set,J=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(H){let j;while((j=J.exec(H))!==null){let B=j[0];if(!rK.has(B))Z.add(B)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)X(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)X(Q[1]);let z=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=z.exec($))!==null)X(Q[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=K.exec($))!==null)X(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)X(Q[1]);let W=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=W.exec($))!==null)X(Q[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=U.exec($))!==null)X(Q[1]);return Z}async function f9($,Z={}){let J=$,X="",Y=!1,Q=[],G=X3(J,{filePath:Z.filePath,projectRoot:Z.projectRoot});J=G.code;let z=Y3(G.styles),K=e1(J);J=K.code,Q=[...K.imports,...K.models];let{hasUserImports:q,bundleClientScript:W}=await s("stx/client-script-bundler",()=>import("./chunk-63h3pg9g.js"));if(q(J))J=await W(J,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let O=lZ(J);J=O.code,X=pZ(O.stxImports,O.browserImports.filter((w)=>!Q.includes(w)))}if(X=`${x$(J,Z.serverData)}${X}`,J=t0(J),!Y&&M1(Z.attrs||""))J=A1(J);let U=sK(Z.eventBindings||[]),H=(Z.attrs||"").trim(),j=/\btype\s*=\s*["']module["']/i.test(H),B=Z.instanceId?` data-stx-instance="${Z.instanceId}"`:"";if(j){let O=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),w=`type="module" data-stx-scoped${B}${O?` ${O}`:""}`;return`${z}<script ${w}>
|
|
3733
3733
|
${t1(`${X}${J}
|
|
3734
3734
|
${U}`)}
|
|
3735
3735
|
</script>`}let V=uZ($),L=/function __stx_setup_/.test(J),_=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function F(O){let w=O.length>0?`
|