@stacksjs/stx 0.2.296 → 0.2.297
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/{chunk-3fv1agwg.js → chunk-0dt7mxd4.js} +1 -1
- package/dist/{chunk-a9c8w6fq.js → chunk-1286mhh3.js} +1 -1
- package/dist/{chunk-76p7bnw1.js → chunk-1hgjxmev.js} +1 -1
- package/dist/{chunk-pwyjrwrc.js → chunk-21p24c6p.js} +1 -1
- package/dist/{chunk-f76qk302.js → chunk-2egqczsa.js} +1 -1
- package/dist/{chunk-1ge7rfg4.js → chunk-3qej6qse.js} +1 -1
- package/dist/{chunk-tt50t72e.js → chunk-3y3vfypn.js} +1 -1
- package/dist/{chunk-vqtbc3q4.js → chunk-412qbr7q.js} +2 -2
- package/dist/{chunk-86cmtck2.js → chunk-4e7ws3aa.js} +1 -1
- package/dist/{chunk-psbfqbkt.js → chunk-5zdxwpr4.js} +1 -1
- package/dist/{chunk-bax52sn4.js → chunk-70z62b1s.js} +1 -1
- package/dist/{chunk-85mzetge.js → chunk-75re458k.js} +1 -1
- package/dist/{chunk-e2ymkgjk.js → chunk-8x7rzbww.js} +8 -8
- package/dist/{chunk-03mc9wc9.js → chunk-9rcrgt1d.js} +1 -1
- package/dist/{chunk-zwknasm0.js → chunk-ahsj1r5g.js} +1 -1
- package/dist/{chunk-qfec1s34.js → chunk-ama74dgk.js} +1 -1
- package/dist/{chunk-pb4jjbpq.js → chunk-b6xqp9s4.js} +2 -2
- package/dist/{chunk-vt31an48.js → chunk-c3bk5y81.js} +1 -1
- package/dist/{chunk-e3ta86aa.js → chunk-cyrcdgfj.js} +1 -1
- package/dist/{chunk-31e2jrb4.js → chunk-d54zmtbs.js} +1 -1
- package/dist/{chunk-6z04mpxz.js → chunk-d93d47k0.js} +16 -16
- package/dist/{chunk-3jxt0y11.js → chunk-gt6ahj63.js} +1 -1
- package/dist/{chunk-7ncfmg13.js → chunk-hqgnxvf8.js} +1 -1
- package/dist/{chunk-sptmr6wf.js → chunk-jf0te8tr.js} +1 -1
- package/dist/{chunk-2a8q7c9z.js → chunk-jt2r1vzy.js} +1 -1
- package/dist/{chunk-44gm42cq.js → chunk-mhgpjegm.js} +1 -1
- package/dist/{chunk-yzb748mw.js → chunk-msc8zy8k.js} +1 -1
- package/dist/{chunk-224m1jrf.js → chunk-ns50qry3.js} +2 -2
- package/dist/{chunk-3rjeare9.js → chunk-p9bnsy2t.js} +1 -1
- package/dist/{chunk-24pgjzmy.js → chunk-ph3jj8j4.js} +1 -1
- package/dist/{chunk-sq24kkns.js → chunk-ps3n1bvh.js} +1 -1
- package/dist/{chunk-asn02v4q.js → chunk-pzhq87vq.js} +1 -1
- package/dist/{chunk-maq28582.js → chunk-q7b4v144.js} +1 -1
- package/dist/{chunk-zafnsr0w.js → chunk-qzrpby7b.js} +1 -1
- package/dist/{chunk-8tdj5zep.js → chunk-r6m67kjc.js} +1 -1
- package/dist/{chunk-wrm7300v.js → chunk-s5phwqxc.js} +1 -1
- package/dist/{chunk-b24chdr8.js → chunk-s7yjggwh.js} +1 -1
- package/dist/{chunk-qxmywwq5.js → chunk-s8g3n7ym.js} +1 -1
- package/dist/{chunk-e17ys98t.js → chunk-t16fgjr4.js} +1 -1
- package/dist/{chunk-7mem81az.js → chunk-v24y3hz7.js} +1 -1
- package/dist/{chunk-tqtcs1wb.js → chunk-vedg19rq.js} +1 -1
- package/dist/{chunk-my8x4p73.js → chunk-vh7jr0sc.js} +1 -1
- package/dist/{chunk-h625b8k6.js → chunk-wk8v593t.js} +1 -1
- package/dist/{chunk-6tzzh1dg.js → chunk-x4mab1rw.js} +1 -1
- package/dist/cli.js +7 -7
- package/dist/client-script-bundler.js +1 -1
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
|
@@ -11,7 +11,7 @@ catch (e) {
|
|
|
11
11
|
}
|
|
12
12
|
throw e;
|
|
13
13
|
}
|
|
14
|
-
`),Z.set(V,I)}return I(...j)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:U,context:J.slice()});return U}clear(){this.pool.length=0,this.fnCache.clear()}}var uJ=new qJ;class UJ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(Q){this.enabled=Q}isEnabled(){return this.enabled}setBudget(Q,J){this.budgets.set(Q,{warnThreshold:0.8,action:"warn",...J})}setBudgets(Q){for(let[J,Y]of Object.entries(Q))this.setBudget(J,Y)}removeBudget(Q){this.budgets.delete(Q)}getBudgets(){let Q={};for(let[J,Y]of this.budgets.entries())Q[J]=Y;return Q}onViolation(Q){this.violationHandlers.push(Q)}offViolation(Q){let J=this.violationHandlers.indexOf(Q);if(J!==-1)this.violationHandlers.splice(J,1)}time(Q,J){if(!this.enabled)return J();let Y=performance.now(),$=J(),Z=performance.now()-Y;return this.recordTime(Q,Z),this.checkBudget(Q,Z),$}async timeAsync(Q,J){if(!this.enabled)return J();let Y=performance.now(),$=await J(),Z=performance.now()-Y;return this.recordTime(Q,Z),this.checkBudget(Q,Z),$}checkBudget(Q,J){let Y=this.budgets.get(Q);if(!Y)return;let $=J/Y.maxTime*100,Z=Y.warnThreshold!==void 0?J>=Y.maxTime*Y.warnThreshold&&J<Y.maxTime:!1,q=J>=Y.maxTime;if(!Z&&!q)return;let U={label:Q,actualTime:J,budgetTime:Y.maxTime,exceedancePercent:$,timestamp:new Date,isWarning:Z};this.violations.push(U);while(this.violations.length>this.maxViolations)this.violations.shift();for(let F of this.violationHandlers)try{F(U)}catch{}let j=Z?`[Performance Warning] "${Q}" took ${J.toFixed(2)}ms (${$.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${Q}" took ${J.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${($-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(j);break;case"warn":console.warn(j);break;case"error":console.error(j);break;case"throw":if(q)throw Error(j);else console.warn(j);break}}recordTime(Q,J){let Y=this.metrics.get(Q);if(Y)Y.count++,Y.totalTime+=J,Y.maxTime=Math.max(Y.maxTime,J),Y.minTime=Math.min(Y.minTime,J);else this.metrics.set(Q,{count:1,totalTime:J,maxTime:J,minTime:J})}getStats(Q){if(Q){let Y=this.metrics.get(Q);if(!Y)return{};let $=this.budgets.get(Q);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:$?.maxTime,budgetUtilization:$?Y.totalTime/Y.count/$.maxTime*100:void 0}}let J={};for(let[Y,$]of this.metrics.entries()){let Z=this.budgets.get(Y);J[Y]={count:$.count,avgTime:$.totalTime/$.count,totalTime:$.totalTime,maxTime:$.maxTime,minTime:$.minTime,budget:Z?.maxTime,budgetUtilization:Z?$.totalTime/$.count/Z.maxTime*100:void 0}}return J}getViolations(Q){if(Q)return this.violations.filter((J)=>J.label===Q);return[...this.violations]}getViolationStats(){let Q={},J=0,Y=0;for(let $ of this.violations)if(Q[$.label]=(Q[$.label]||0)+1,$.isWarning)J++;else Y++;return{total:this.violations.length,byLabel:Q,warnings:J,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var d=null;function HJ(){if(!d)d=new UJ;return d}var dJ=new Proxy({},{get(Q,J){return HJ()[J]}});var WJ=[];function jJ(Q){let J=new h(Q);return WJ.push(J),J}function lJ(){for(let Q of WJ)Q.clear()}function i(Q,...J){return`${J.map((Y)=>String(Y??"")).join("\x00")}\x00${Q.length}\x00${Bun.hash(Q)}`}function nJ(Q){let J=[];for(let Y of new Set(Q))try{J.push({path:Y,mtimeMs:OJ.statSync(Y).mtimeMs})}catch{}return J}function oJ(Q){for(let J of Q)try{if(OJ.statSync(J.path).mtimeMs!==J.mtimeMs)return!1}catch{return!1}return!0}var N=null,l=!1,X=null,M="",w=!1,NJ=256,_=new Map,z=new Map,H=null,E=null;function x(Q){return Bun.hash(Q).toString(16).padStart(16,"0").slice(0,16)}function c(Q,J){if(_.has(Q))_.delete(Q);else if(_.size>=NJ)_.delete(_.keys().next().value);_.set(Q,J)}function TJ(Q){let J=x(Q);if(z.has(J))z.delete(J);else if(z.size>=NJ)z.delete(z.keys().next().value);return z.set(J,Q),J}function YQ(Q){let J=z.get(Q);if(J===void 0)return;return z.delete(Q),z.set(Q,J),J}async function BJ(Q){if(!H)return null;try{let J=Bun.file(O.join(H,`cw-${x(Q)}.css`));if(!await J.exists())return null;return await J.text()}catch{return null}}async function wJ(Q,J){if(!H)return;try{if(!fs.existsSync(H))fs.mkdirSync(H,{recursive:!0});await Bun.write(O.join(H,`cw-${x(Q)}.css`),J)}catch{}}async function GJ(Q){try{let J=await import(Q);if(J&&J.CSSGenerator)return{CSSGenerator:J.CSSGenerator,config:J.config,build:J.build,defaultConfig:J.defaultConfig,extractClasses:J.extractClasses}}catch{}return null}var KJ=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],RJ=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function PJ(){let Q=[],J=process.cwd();while(J!==O.dirname(J)){for(let Y of["node_modules","pantry"])for(let $ of KJ)Q.push(O.join(J,Y,...$));J=O.dirname(J)}return Q}function DJ(){let Q=[],J=process.env.HOME||process.env.USERPROFILE||"",Y=[J&&O.join(J,"Code","Tools","ts-css"),J&&O.join(J,"Code","Tools","crosswind"),J&&O.join(J,"repos","stacks-org","ts-css"),J&&O.join(J,"repos","stacks-org","crosswind"),O.join(process.cwd(),"..","ts-css"),O.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let $ of Y)Q.push(O.join($,"packages","toolkit","dist","engine","index.js")),Q.push(O.join($,"packages","toolkit","src","engine","index.ts"));if(J)Q.push(O.join(J,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return Q}async function zJ(){if(l)return N;l=!0;try{let Q=async(Z)=>{for(let q of Z){if(!await Bun.file(q).exists())continue;let U=await GJ(q);if(U){if(!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[ts-css]${W.reset} CSS engine loaded from ${O.dirname(O.dirname(q))}`);return U}}return null};if(process.env.CROSSWIND_SRC){let Z=O.resolve(process.env.CROSSWIND_SRC),q=await Q([Z]);if(!q)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${Z}`);return N=q,N}let J=await Q(PJ());if(J)return N=J,N;let Y=RJ;for(let Z of Y){let q=await GJ(Z);if(q){if(N=q,!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[ts-css]${W.reset} CSS engine loaded`);return N}}let $=await Q(DJ());if($)return N=$,N;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${W.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${W.reset}`),console.warn(`${W.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${W.reset}`),null}}function $Q(){n.clear(),N=null,l=!1,X=null,M="",_.clear(),z.clear(),E=null}var XJ=!1;async function AJ(Q){try{let J=FJ({name:"css",cwd:Q})?"css":FJ({name:"crosswind",cwd:Q})?"crosswind":null;if(!J)return null;if(J==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!XJ)XJ=!0,console.warn(`${W.yellow}[ts-css]${W.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:Y}=await import("bunfig"),$=await Y({name:J,cwd:Q,defaultConfig:{},checkEnv:!1,verbose:!1});if(!$?.path||!$.config||Object.keys($.config).length===0)return null;let Z=O.relative(Q,$.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[ts-css]${W.reset} Loaded config from ${Z||$.path}`);return $.config}catch(J){if(J instanceof Error&&J.name==="ConfigNotFoundError")return null;return console.warn(`${W.yellow}[ts-css]${W.reset} Failed to load css config:`,J instanceof Error?J.message:J),null}}async function MJ(Q){let J=null;try{let{loadStxConfig:Y}=await import("./chunk-b24chdr8.js"),$=await Y(Q);if($.css)if(typeof $.css==="string"){let Z=O.isAbsolute($.css)?$.css:O.resolve(Q,$.css);if(await Bun.file(Z).exists()){let q=await import(Z);J=q.default||q,console.log(`${W.green}[ts-css]${W.reset} Loaded config from stx.config.ts \u2192 ${$.css}`)}}else{if(J={...$.css,content:$.css.content||[],preflight:$.css.preflight??!0,minify:$.css.minify??!1},$.css.config){let Z=O.isAbsolute($.css.config)?$.css.config:O.resolve(Q,$.css.config);if(await Bun.file(Z).exists()){let q=await import(Z);J={...q.default||q,...J}}}console.log(`${W.green}[ts-css]${W.reset} Using inline CSS config from stx.config.ts`)}}catch{}return J||await AJ(Q)}function EJ(Q){try{let J=new WeakSet;return x(JSON.stringify(Q??{},(Y,$)=>{if(typeof $==="function")return`[fn]${String($)}`;if(typeof $==="object"&&$!==null){if(J.has($))return"[circular]";J.add($)}return $})??"")}catch{return"unhashable"}}async function SJ(Q){if(w)return M;w=!0;try{let J=await zJ();if(!J||!J.build)return w=!1,"";if(!X)X=await AJ(Q);if(!X)return w=!1,"";let Y=J.defaultConfig?.theme||{},$=X.theme||{},Z={...J.defaultConfig,...X,theme:{...Y,...$,extend:{...Y.extend||{},...$.extend||{}}}},q=performance.now(),U=await J.build(Z),j=performance.now()-q;if(M=U.css,console.log(`${W.cyan}[ts-css]${W.reset} Built ${U.classes.size} classes in ${j.toFixed(1)}ms`),Z.output){let F=O.isAbsolute(Z.output)?Z.output:O.join(Q,Z.output),V=O.dirname(F);if(!fs.existsSync(V))fs.mkdirSync(V,{recursive:!0});await Bun.write(F,U.css)}return w=!1,U.css}catch(J){return console.error(`${W.red}[ts-css]${W.reset} Build error:`,J),w=!1,M}}async function ZQ(Q){X=null,await SJ(Q)}function qQ(){return M}function vJ(Q){let J=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,$=Y.exec(Q);while($!==null){for(let U of $[1].split(/\s+/))if(U.trim())J.add(U.trim());$=Y.exec(Q)}let Z=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,q=Z.exec(Q);while(q!==null){let U=q[1].match(/'([^']+)'/g);if(U){for(let j of U)for(let F of j.slice(1,-1).split(/\s+/))if(F.trim())J.add(F.trim())}q=Z.exec(Q)}return J}var n=jJ(64);async function xJ(Q,J){let Y=n.get(i(Q,J,E));if(Y!==void 0)return Y;let $=await kJ(Q,J);if($)n.set(i(Q,J,E),$);return $}async function kJ(Q,J){try{let Y=await zJ();if(!Y)return"";let $=typeof Y.extractClasses==="function"?Y.extractClasses(Q):vJ(Q);if($.size===0)return"";let Z=J?O.resolve(J):process.cwd();if(!H)H=IJ(Z,"cache");let q=[...$].sort().join(" "),U=`${E||"default"}::${q}`,j=_.get(U);if(j!==void 0)return c(U,j),j;let F=await BJ(U);if(F!==null)return c(U,F),F;if(!X)X=await MJ(Z),E=EJ(X);let V=Y.defaultConfig||Y.config,I=X||{},L=ZJ(V,I),{safelist:T,includePreflight:K,minify:k,tokenCSS:LJ}=L,o=L.config,R=new Y.CSSGenerator(o);for(let G of T)R.generate(G);for(let G of $)R.generate(G);let A=R.toCSS(K,k),r=o.shortcuts||I.shortcuts||{};for(let[G,b]of Object.entries(r)){if(!$.has(G)&&!T.includes(G))continue;let y=b.split(/\s+/).filter(Boolean);for(let D of y)R.generate(D)}A=R.toCSS(K,k);let P=A.split(`
|
|
14
|
+
`),Z.set(V,I)}return I(...j)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:U,context:J.slice()});return U}clear(){this.pool.length=0,this.fnCache.clear()}}var uJ=new qJ;class UJ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(Q){this.enabled=Q}isEnabled(){return this.enabled}setBudget(Q,J){this.budgets.set(Q,{warnThreshold:0.8,action:"warn",...J})}setBudgets(Q){for(let[J,Y]of Object.entries(Q))this.setBudget(J,Y)}removeBudget(Q){this.budgets.delete(Q)}getBudgets(){let Q={};for(let[J,Y]of this.budgets.entries())Q[J]=Y;return Q}onViolation(Q){this.violationHandlers.push(Q)}offViolation(Q){let J=this.violationHandlers.indexOf(Q);if(J!==-1)this.violationHandlers.splice(J,1)}time(Q,J){if(!this.enabled)return J();let Y=performance.now(),$=J(),Z=performance.now()-Y;return this.recordTime(Q,Z),this.checkBudget(Q,Z),$}async timeAsync(Q,J){if(!this.enabled)return J();let Y=performance.now(),$=await J(),Z=performance.now()-Y;return this.recordTime(Q,Z),this.checkBudget(Q,Z),$}checkBudget(Q,J){let Y=this.budgets.get(Q);if(!Y)return;let $=J/Y.maxTime*100,Z=Y.warnThreshold!==void 0?J>=Y.maxTime*Y.warnThreshold&&J<Y.maxTime:!1,q=J>=Y.maxTime;if(!Z&&!q)return;let U={label:Q,actualTime:J,budgetTime:Y.maxTime,exceedancePercent:$,timestamp:new Date,isWarning:Z};this.violations.push(U);while(this.violations.length>this.maxViolations)this.violations.shift();for(let F of this.violationHandlers)try{F(U)}catch{}let j=Z?`[Performance Warning] "${Q}" took ${J.toFixed(2)}ms (${$.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${Q}" took ${J.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${($-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(j);break;case"warn":console.warn(j);break;case"error":console.error(j);break;case"throw":if(q)throw Error(j);else console.warn(j);break}}recordTime(Q,J){let Y=this.metrics.get(Q);if(Y)Y.count++,Y.totalTime+=J,Y.maxTime=Math.max(Y.maxTime,J),Y.minTime=Math.min(Y.minTime,J);else this.metrics.set(Q,{count:1,totalTime:J,maxTime:J,minTime:J})}getStats(Q){if(Q){let Y=this.metrics.get(Q);if(!Y)return{};let $=this.budgets.get(Q);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:$?.maxTime,budgetUtilization:$?Y.totalTime/Y.count/$.maxTime*100:void 0}}let J={};for(let[Y,$]of this.metrics.entries()){let Z=this.budgets.get(Y);J[Y]={count:$.count,avgTime:$.totalTime/$.count,totalTime:$.totalTime,maxTime:$.maxTime,minTime:$.minTime,budget:Z?.maxTime,budgetUtilization:Z?$.totalTime/$.count/Z.maxTime*100:void 0}}return J}getViolations(Q){if(Q)return this.violations.filter((J)=>J.label===Q);return[...this.violations]}getViolationStats(){let Q={},J=0,Y=0;for(let $ of this.violations)if(Q[$.label]=(Q[$.label]||0)+1,$.isWarning)J++;else Y++;return{total:this.violations.length,byLabel:Q,warnings:J,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var d=null;function HJ(){if(!d)d=new UJ;return d}var dJ=new Proxy({},{get(Q,J){return HJ()[J]}});var WJ=[];function jJ(Q){let J=new h(Q);return WJ.push(J),J}function lJ(){for(let Q of WJ)Q.clear()}function i(Q,...J){return`${J.map((Y)=>String(Y??"")).join("\x00")}\x00${Q.length}\x00${Bun.hash(Q)}`}function nJ(Q){let J=[];for(let Y of new Set(Q))try{J.push({path:Y,mtimeMs:OJ.statSync(Y).mtimeMs})}catch{}return J}function oJ(Q){for(let J of Q)try{if(OJ.statSync(J.path).mtimeMs!==J.mtimeMs)return!1}catch{return!1}return!0}var N=null,l=!1,X=null,M="",w=!1,NJ=256,_=new Map,z=new Map,H=null,E=null;function x(Q){return Bun.hash(Q).toString(16).padStart(16,"0").slice(0,16)}function c(Q,J){if(_.has(Q))_.delete(Q);else if(_.size>=NJ)_.delete(_.keys().next().value);_.set(Q,J)}function TJ(Q){let J=x(Q);if(z.has(J))z.delete(J);else if(z.size>=NJ)z.delete(z.keys().next().value);return z.set(J,Q),J}function YQ(Q){let J=z.get(Q);if(J===void 0)return;return z.delete(Q),z.set(Q,J),J}async function BJ(Q){if(!H)return null;try{let J=Bun.file(O.join(H,`cw-${x(Q)}.css`));if(!await J.exists())return null;return await J.text()}catch{return null}}async function wJ(Q,J){if(!H)return;try{if(!fs.existsSync(H))fs.mkdirSync(H,{recursive:!0});await Bun.write(O.join(H,`cw-${x(Q)}.css`),J)}catch{}}async function GJ(Q){try{let J=await import(Q);if(J&&J.CSSGenerator)return{CSSGenerator:J.CSSGenerator,config:J.config,build:J.build,defaultConfig:J.defaultConfig,extractClasses:J.extractClasses}}catch{}return null}var KJ=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],RJ=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function PJ(){let Q=[],J=process.cwd();while(J!==O.dirname(J)){for(let Y of["node_modules","pantry"])for(let $ of KJ)Q.push(O.join(J,Y,...$));J=O.dirname(J)}return Q}function DJ(){let Q=[],J=process.env.HOME||process.env.USERPROFILE||"",Y=[J&&O.join(J,"Code","Tools","ts-css"),J&&O.join(J,"Code","Tools","crosswind"),J&&O.join(J,"repos","stacks-org","ts-css"),J&&O.join(J,"repos","stacks-org","crosswind"),O.join(process.cwd(),"..","ts-css"),O.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let $ of Y)Q.push(O.join($,"packages","toolkit","dist","engine","index.js")),Q.push(O.join($,"packages","toolkit","src","engine","index.ts"));if(J)Q.push(O.join(J,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return Q}async function zJ(){if(l)return N;l=!0;try{let Q=async(Z)=>{for(let q of Z){if(!await Bun.file(q).exists())continue;let U=await GJ(q);if(U){if(!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[ts-css]${W.reset} CSS engine loaded from ${O.dirname(O.dirname(q))}`);return U}}return null};if(process.env.CROSSWIND_SRC){let Z=O.resolve(process.env.CROSSWIND_SRC),q=await Q([Z]);if(!q)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${Z}`);return N=q,N}let J=await Q(PJ());if(J)return N=J,N;let Y=RJ;for(let Z of Y){let q=await GJ(Z);if(q){if(N=q,!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[ts-css]${W.reset} CSS engine loaded`);return N}}let $=await Q(DJ());if($)return N=$,N;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${W.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${W.reset}`),console.warn(`${W.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${W.reset}`),null}}function $Q(){n.clear(),N=null,l=!1,X=null,M="",_.clear(),z.clear(),E=null}var XJ=!1;async function AJ(Q){try{let J=FJ({name:"css",cwd:Q})?"css":FJ({name:"crosswind",cwd:Q})?"crosswind":null;if(!J)return null;if(J==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!XJ)XJ=!0,console.warn(`${W.yellow}[ts-css]${W.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:Y}=await import("bunfig"),$=await Y({name:J,cwd:Q,defaultConfig:{},checkEnv:!1,verbose:!1});if(!$?.path||!$.config||Object.keys($.config).length===0)return null;let Z=O.relative(Q,$.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[ts-css]${W.reset} Loaded config from ${Z||$.path}`);return $.config}catch(J){if(J instanceof Error&&J.name==="ConfigNotFoundError")return null;return console.warn(`${W.yellow}[ts-css]${W.reset} Failed to load css config:`,J instanceof Error?J.message:J),null}}async function MJ(Q){let J=null;try{let{loadStxConfig:Y}=await import("./chunk-s7yjggwh.js"),$=await Y(Q);if($.css)if(typeof $.css==="string"){let Z=O.isAbsolute($.css)?$.css:O.resolve(Q,$.css);if(await Bun.file(Z).exists()){let q=await import(Z);J=q.default||q,console.log(`${W.green}[ts-css]${W.reset} Loaded config from stx.config.ts \u2192 ${$.css}`)}}else{if(J={...$.css,content:$.css.content||[],preflight:$.css.preflight??!0,minify:$.css.minify??!1},$.css.config){let Z=O.isAbsolute($.css.config)?$.css.config:O.resolve(Q,$.css.config);if(await Bun.file(Z).exists()){let q=await import(Z);J={...q.default||q,...J}}}console.log(`${W.green}[ts-css]${W.reset} Using inline CSS config from stx.config.ts`)}}catch{}return J||await AJ(Q)}function EJ(Q){try{let J=new WeakSet;return x(JSON.stringify(Q??{},(Y,$)=>{if(typeof $==="function")return`[fn]${String($)}`;if(typeof $==="object"&&$!==null){if(J.has($))return"[circular]";J.add($)}return $})??"")}catch{return"unhashable"}}async function SJ(Q){if(w)return M;w=!0;try{let J=await zJ();if(!J||!J.build)return w=!1,"";if(!X)X=await AJ(Q);if(!X)return w=!1,"";let Y=J.defaultConfig?.theme||{},$=X.theme||{},Z={...J.defaultConfig,...X,theme:{...Y,...$,extend:{...Y.extend||{},...$.extend||{}}}},q=performance.now(),U=await J.build(Z),j=performance.now()-q;if(M=U.css,console.log(`${W.cyan}[ts-css]${W.reset} Built ${U.classes.size} classes in ${j.toFixed(1)}ms`),Z.output){let F=O.isAbsolute(Z.output)?Z.output:O.join(Q,Z.output),V=O.dirname(F);if(!fs.existsSync(V))fs.mkdirSync(V,{recursive:!0});await Bun.write(F,U.css)}return w=!1,U.css}catch(J){return console.error(`${W.red}[ts-css]${W.reset} Build error:`,J),w=!1,M}}async function ZQ(Q){X=null,await SJ(Q)}function qQ(){return M}function vJ(Q){let J=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,$=Y.exec(Q);while($!==null){for(let U of $[1].split(/\s+/))if(U.trim())J.add(U.trim());$=Y.exec(Q)}let Z=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,q=Z.exec(Q);while(q!==null){let U=q[1].match(/'([^']+)'/g);if(U){for(let j of U)for(let F of j.slice(1,-1).split(/\s+/))if(F.trim())J.add(F.trim())}q=Z.exec(Q)}return J}var n=jJ(64);async function xJ(Q,J){let Y=n.get(i(Q,J,E));if(Y!==void 0)return Y;let $=await kJ(Q,J);if($)n.set(i(Q,J,E),$);return $}async function kJ(Q,J){try{let Y=await zJ();if(!Y)return"";let $=typeof Y.extractClasses==="function"?Y.extractClasses(Q):vJ(Q);if($.size===0)return"";let Z=J?O.resolve(J):process.cwd();if(!H)H=IJ(Z,"cache");let q=[...$].sort().join(" "),U=`${E||"default"}::${q}`,j=_.get(U);if(j!==void 0)return c(U,j),j;let F=await BJ(U);if(F!==null)return c(U,F),F;if(!X)X=await MJ(Z),E=EJ(X);let V=Y.defaultConfig||Y.config,I=X||{},L=ZJ(V,I),{safelist:T,includePreflight:K,minify:k,tokenCSS:LJ}=L,o=L.config,R=new Y.CSSGenerator(o);for(let G of T)R.generate(G);for(let G of $)R.generate(G);let A=R.toCSS(K,k),r=o.shortcuts||I.shortcuts||{};for(let[G,b]of Object.entries(r)){if(!$.has(G)&&!T.includes(G))continue;let y=b.split(/\s+/).filter(Boolean);for(let D of y)R.generate(D)}A=R.toCSS(K,k);let P=A.split(`
|
|
15
15
|
`);for(let[G,b]of Object.entries(r)){if(!$.has(G)&&!T.includes(G))continue;let y=b.split(/\s+/).filter(Boolean),D=[],f=[];for(let C of y){let a=C.startsWith("dark:"),s=`.${(a?C.slice(5):C).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let S=0;S<P.length;S++){let t=P[S].trim();if(t===`${s} {`||t.startsWith(`${s} {`)){let v=S,e="";while(v<P.length){if(e+=P[v],P[v].includes("}"))break;v++}let p=e.match(/\{([^}]+)\}/);if(p)if(a)f.push(p[1].trim());else D.push(p[1].trim());break}}}if(D.length)A+=`
|
|
16
16
|
.${G} { ${D.join(" ")} }`;if(f.length)A+=`
|
|
17
17
|
@media (prefers-color-scheme: dark) { .dark .${G} { ${f.join(" ")} } }`}return A=LJ+A,c(U,A),wJ(U,A),A}catch(Y){return console.warn("Failed to generate Css CSS:",Y),""}}async function UQ(Q,J,Y=!1){let $=await xJ(Q,J);if(!$)return Q;let Z=Y?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${TJ($)}.css">`:`<style data-css="generated">
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Kp as k,Ml as A,Nl as D,Rm as T,Sm as y,Tn as x,bm as B,dm as F,fo as M,fr as w,xo as R}from"./chunk-
|
|
2
|
+
import{Kp as k,Ml as A,Nl as D,Rm as T,Sm as y,Tn as x,bm as B,dm as F,fo as M,fr as w,xo as R}from"./chunk-d93d47k0.js";import{nv as P}from"./chunk-vwqv8f0y.js";function b(K){return K.endsWith(".md")||K.endsWith(".markdown")}function C(K){let z=[];_(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let G=[...z];_(/<code\b[^>]*>[\s\S]*?<\/code>/gi,G);function _(J,X){let $;while(($=J.exec(K))!==null){let q=$.index,N=q+$[0].length;if(X?.some((Y)=>q>=Y.start&&N<=Y.end))continue;z.push({start:q,end:N})}}if(z.length===0)return K;z.sort((J,X)=>J.start-X.start);let U="",Q=0;for(let J of z){if(J.start<Q)continue;U+=K.slice(Q,J.start),U+=`@raw${K.slice(J.start,J.end)}@endraw`,Q=J.end}return U+=K.slice(Q),U}async function j(K,z={}){let{data:G,content:_}=A(K),Q=await(z.renderer??((J)=>D(J)))(_);return{html:C(Q),frontmatter:G??{}}}import{dirname as v,resolve as H}from"path";function f(K){let z=K,G=x(K);if(G)z=G.content.trim();let _=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,U=[],Q=[],J=[],X=(N)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(N),$;while(($=_.exec(K))!==null){let N=$[1],Y=$[2],E=$[0],Z=N.includes("server");if(X(Y))J.push(E);else if(Z)Q.push(Y);else U.push(E)}let q=z;{let N=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,Y,E=[];while((Y=N.exec(q))!==null){let Z=Y.index+Y[0].length,L=q.indexOf("</script>",Z);if(L===-1)continue;E.push({start:Y.index,end:L+9}),N.lastIndex=L+9}for(let Z=E.length-1;Z>=0;Z--)q=q.substring(0,E[Z].start)+q.substring(E[Z].end)}for(let N of U)q=q.replace(N,"");return{templateContent:q,serverScripts:Q,clientScripts:U,signalsScripts:J}}function S(K,z){return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -14,5 +14,5 @@ ${Q.join(`
|
|
|
14
14
|
`)}`}else{if(G.processClientScripts!==!1&&Q.length>0){let N=X.__stx_event_bindings||[],Y=B(X),Z=(await Promise.all(Q.map(async(V)=>{let W=V.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!W)return V;return await F(W[1],{eventBindings:N,templateContent:q,serverData:Y,filePath:z})}))).join(`
|
|
15
15
|
`);if(q.match(/(<\/body>)/i))q=q.replace(/(<\/body>)/i,`${Z}
|
|
16
16
|
$1`);else q+=`
|
|
17
|
-
${Z}`}q=await M(q)}if(G.wrapInDocument){if(!q.trim().toLowerCase().startsWith("<!doctype")&&!q.trim().toLowerCase().startsWith("<html"))q=S(q,G.title)}if(G.injectCSS)try{let{injectCss:N}=await import("./chunk-
|
|
17
|
+
${Z}`}q=await M(q)}if(G.wrapInDocument){if(!q.trim().toLowerCase().startsWith("<!doctype")&&!q.trim().toLowerCase().startsWith("<html"))q=S(q,G.title)}if(G.injectCSS)try{let{injectCss:N}=await import("./chunk-3qej6qse.js");q=await N(q)}catch{}return q}
|
|
18
18
|
export{b as rk,C as sk,j as tk,s as uk,i as vk,I as wk};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Hp as b,Ip as c,Jp as d,Kp as e,fo as a}from"./chunk-
|
|
2
|
+
import{Hp as b,Ip as c,Jp as d,Kp as e,fo as a}from"./chunk-d93d47k0.js";import"./chunk-3mbkn6vk.js";import"./chunk-dn8006f7.js";import"./chunk-vg8yh8te.js";import"./chunk-c5rehxqy.js";import"./chunk-xtwybxtw.js";import"./chunk-ama74dgk.js";import"./chunk-kgxkrnyt.js";import"./chunk-3npkbgfm.js";import"./chunk-nqwjb8k7.js";import"./chunk-nx96x8sh.js";import"./chunk-6kdb8j9d.js";import"./chunk-jmh31a2a.js";import"./chunk-d3kac3mv.js";import"./chunk-vwqv8f0y.js";export{d as validateClientScript,c as processOnceDirective,b as processJsonDirective,e as processDirectives,a as injectRouterScript};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ng as v,og as i,pg as t,sg as e,tg as HH,ug as KH,vg as QH,wg as YH,xg as ZH}from"./chunk-
|
|
2
|
+
import{ng as v,og as i,pg as t,sg as e,tg as HH,ug as KH,vg as QH,wg as YH,xg as ZH}from"./chunk-70z62b1s.js";import{_i as s}from"./chunk-ph3jj8j4.js";import{Tl as a}from"./chunk-d93d47k0.js";import{Gt as h}from"./chunk-kgxkrnyt.js";import{bu as f}from"./chunk-6kdb8j9d.js";import{existsSync as $H,readFileSync as qH}from"fs";import J from"path";function GH(K,Q="",V=""){let L=K.startLine>1?`
|
|
3
3
|
`.repeat(K.startLine-1):"",N=t(i(K.code)),X=K.kind==="client"||K.kind==="plain"?HH(Q,K.code):"";return QH(`${L+N}
|
|
4
4
|
${X}
|
|
5
5
|
export {}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$i as b,_i as a,aj as c}from"./chunk-
|
|
2
|
+
import{$i as b,_i as a,aj as c}from"./chunk-ph3jj8j4.js";import"./chunk-efr3ejqt.js";import"./chunk-d93d47k0.js";import"./chunk-3mbkn6vk.js";import"./chunk-dn8006f7.js";import"./chunk-vg8yh8te.js";import"./chunk-c5rehxqy.js";import"./chunk-xtwybxtw.js";import"./chunk-ama74dgk.js";import"./chunk-kgxkrnyt.js";import"./chunk-3npkbgfm.js";import"./chunk-nqwjb8k7.js";import"./chunk-nx96x8sh.js";import"./chunk-6kdb8j9d.js";import"./chunk-jmh31a2a.js";import"./chunk-d3kac3mv.js";import"./chunk-vwqv8f0y.js";export{a as listComposableModules,b as getComposableScript,c as clearComposableCache};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$r as q0,Ds as G8,Fr as N2,Ir as J8,Kr as G0,Ns as W7,Or as M2,Os as H7,Pr as X8,Rr as o0,Sr as Y8,Zr as b4,_r as $0,as as T0,bs as H9,cs as X2,ds as U0,es as V9,ur as Q0,wr as j9,yr as B9,zs as Q8}from"./chunk-3mbkn6vk.js";import{Us as i2}from"./chunk-dn8006f7.js";import{at as x0,bt as u8}from"./chunk-c5rehxqy.js";import{ct as i7}from"./chunk-xtwybxtw.js";import{Bt as K8,ft as o1,gt as x1,ht as q8,it as T1,kt as V1,lt as y8,mt as C8}from"./chunk-
|
|
2
|
+
import{$r as q0,Ds as G8,Fr as N2,Ir as J8,Kr as G0,Ns as W7,Or as M2,Os as H7,Pr as X8,Rr as o0,Sr as Y8,Zr as b4,_r as $0,as as T0,bs as H9,cs as X2,ds as U0,es as V9,ur as Q0,wr as j9,yr as B9,zs as Q8}from"./chunk-3mbkn6vk.js";import{Us as i2}from"./chunk-dn8006f7.js";import{at as x0,bt as u8}from"./chunk-c5rehxqy.js";import{ct as i7}from"./chunk-xtwybxtw.js";import{Bt as K8,ft as o1,gt as x1,ht as q8,it as T1,kt as V1,lt as y8,mt as C8}from"./chunk-ama74dgk.js";import{Ct as j7,Et as B7,Ft as V7,Ht as W2}from"./chunk-kgxkrnyt.js";import{It as U8,Mt as o2,Ot as R8}from"./chunk-3npkbgfm.js";import{Yt as Z1}from"./chunk-nqwjb8k7.js";import{$t as W8}from"./chunk-nx96x8sh.js";import{au as q3,bu as g8,cu as b8,du as n1,hu as h8,iu as n$,ju as y6,lu as U4,ou as _4}from"./chunk-6kdb8j9d.js";import{Cu as _6,Ju as G$,_u as z8,av as HG,bv as e9,dv as z2,zu as w$}from"./chunk-jmh31a2a.js";import{iv as L7}from"./chunk-d3kac3mv.js";import{nv as u}from"./chunk-vwqv8f0y.js";import b1 from"path";import k2 from"fs";var c$=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"]),p$={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"},i8=new Set(["ctrl","alt","shift","meta"]),o$={left:0,middle:1,right:2};function i$($){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(i8.has(X))Z.systemKeys.push(X);else if(X in o$)Z.mouse=X;else if(X in p$||/^[a-z]$/.test(X))Z.keys.push(p$[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 s$($){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,q=Y.index,K=q+Q.length,U=`__stx_evt_${J++}`,W=[],H=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=H.exec(z))!==null){let[,V,F]=j,_=V.split("."),O=_[0];if(!c$.has(O))continue;W.push({attribute:`@${V}`,event:O,handler:F,modifiers:i$(_.slice(1)),elementId:U})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=B.exec(z))!==null){let[,V,F]=j,_=V.split("."),O=_[0];if(!c$.has(O))continue;W.push({attribute:`@${V}`,event:O,handler:F,modifiers:i$(_.slice(1)),elementId:U})}if(W.length>0)Z.push({originalTag:Q,elementId:U,events:W,startIndex:q,endIndex:K})}return Z}function n8($){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=o$[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 o8($,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 v9($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function s8($){let{modifiers:Z}=$,J=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=n8($),Y=o8(v9($.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;
|
|
@@ -3453,9 +3453,9 @@ ${Y}
|
|
|
3453
3453
|
} finally {
|
|
3454
3454
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
3455
3455
|
}
|
|
3456
|
-
})();`}function FY($,Z){if(G1($)){let Y=G1($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0,root:"body"};return{html:C1($,(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],q=J[3];return{html:`${G}${z} data-stx-scope="${Z}"${q}${$.slice(J[0].length)}`,mergedIntoExisting:null,stamped:!0,root:Y}}return{html:$,mergedIntoExisting:null,stamped:!1,root:null}}var R4=0,SH=new o1(500),N4=new Set;function vH(){N4.clear()}function wY($){if($.__onceStore instanceof Set)return $.__onceStore;return N4}async function J$($,Z,J,X,Y,Q=new Set){let G=X.partialsDir||W0.join(W0.dirname(J),"partials");if(G&&!W0.isAbsolute(G))G=W0.resolve(process.cwd(),G);let z=jY($,"@partial","@include"),q=wY(Z);z=z.replace(/@once([\s\S]*?)@endonce/g,(V,F,_)=>{let O=F.trim(),L=`${J}:${O}`;if(q.has(L))return"";return q.add(L),F});{let V=/@includeIf\s*\(/g,F;while((F=V.exec(z))!==null){let _=F.index,O=_+F[0].length-1,L=1,w=O+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")")L--;w++}if(L!==0)break;let R=z.substring(O+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){V.lastIndex=w;continue}let M=D[1],I=K(M,G,J),N="";if(I&&await Bun.file(I).exists())Y.add(I),N=`@include(${R})`;z=z.substring(0,_)+N+z.substring(w),V.lastIndex=0}}for(let[V,F]of[["@includeWhen",!1],["@includeUnless",!0]]){let _=new RegExp(`${V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=_.exec(z))!==null){let L=O.index,w=L+O[0].length-1,R=1,D=w+1;while(D<z.length&&R>0){if(z[D]==="(")R++;else if(z[D]===")")R--;D++}if(R!==0)break;let M=z.substring(w+1,D-1),I=Z$(M,0);if(I===-1){_.lastIndex=D;continue}let N=M.substring(0,I).trim(),A=M.substring(I+1).trim(),T=A.match(/^\s*['"]([^'"]+)['"]/);if(!T){_.lastIndex=D;continue}let k=T[1],y=A.substring(T[0].length),E,b=Z$(y,0);if(b!==-1)E=y.substring(b+1).trim();try{let C=`Boolean(${N})`,v;if(q0(C)){let f=U0(C,Object.keys(Z));v=Boolean(f(...Object.values(Z)))}else v=Boolean($0(C,Z));let S=F?!v:v,g="";if(S){let f=K(k,G,J);if(f&&await Bun.file(f).exists())Y.add(f);g=`@include('${k}'${E?`, ${E}`:""})`}z=z.substring(0,L)+g+z.substring(D),_.lastIndex=0}catch(C){let v=C instanceof Error?C.message:String(C),S=H0("Include",`Error evaluating ${V} condition: ${v}`,J,$,L);z=z.substring(0,L)+S+z.substring(D),_.lastIndex=0}}}{let V=/@each\s*\(/g,F;while((F=V.exec(z))!==null){let _=F.index,O=_+F[0].length-1,L=1,w=O+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=z.substring(O+1,w),D=z.substring(_,w+1),M=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!M){V.lastIndex=0,z=z.replace(D,"");continue}let[,I,N,A,T]=M;try{let k,y=N.trim();if(q0(y))k=U0(y,Object.keys(Z))(...Object.values(Z));else k=$0(y,Z);let E="";if(Array.isArray(k)&&k.length>0)for(let b of k){let C={...Z,[A]:b},v=await H(I,C,$,_);E+=v}else if(T)E=await H(T,{},$,_);z=z.substring(0,_)+E+z.substring(w+1),V.lastIndex=0}catch(k){let y=k instanceof Error?k.message:String(k);z=z.substring(0,_)+H0("Each",`Error in @each: ${y}`,J,$,_)+z.substring(w+1),V.lastIndex=0}}}{let V=/@includeFirst\s*\(/g,F;while((F=V.exec(z))!==null){let _=F.index,O=_+F[0].length-1,L=1,w=O+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=z.substring(O+1,w),D=z.substring(_,w+1),M=R.match(/^\s*(\[[^\]]+\])/);if(!M){V.lastIndex=0,z=z.replace(D,"");continue}let I=M[1],N=R.slice(M[0].length),A,T=N.match(/^\s*,\s*\{/);if(T){N=N.slice(T[0].length-1);let E=1,b=1;while(b<N.length&&E>0){if(N[b]==="{")E++;else if(N[b]==="}"){if(E--,E===0)break}b++}A=N.substring(0,b+1),N=N.slice(b+1)}let k,y=N.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(y)k=y[1];try{let E=JSON.parse(I.replace(/'/g,'"')),b={};if(A)try{b=T0(A,Z)}catch(v){let S=v instanceof Error?v.message:String(v);if(X.debug){let g=H0("Include",`Error parsing includeFirst variables: ${S}`,J,$,_,D);z=z.replace(D,()=>g)}else z=z.replace(D,()=>k||"");continue}let C=!1;for(let v of E){let S=K(v,G,J);if(!S)continue;if(await s(S)){let g=await H(v,b,$,_);z=z.replace(D,()=>g),C=!0;break}}if(!C)if(k!==void 0)z=z.replace(D,()=>k);else if(X.debug){let v=H0("Include",`None of the includeFirst paths exist: ${I}`,J,$,_,D);z=z.replace(D,()=>v)}else z=z.replace(D,"")}catch(E){let b=E instanceof Error?E.message:String(E),C=H0("Include",`Error processing @includeFirst: ${b}`,J,$,_,D);z=z.replace(D,()=>C)}V.lastIndex=0}}function K(V,F,_){try{let O=V;if(!V.endsWith(".stx"))O=`${V}.stx`;let L=W0.resolve(F),w=W0.resolve(W0.dirname(_)),R;if(!O.startsWith("./")&&!O.startsWith("../"))R=W0.resolve(F,O);else R=W0.resolve(w,O);let D=W0.normalize(R),M=D.startsWith(L+W0.sep)||D===L,I=D.startsWith(w+W0.sep)||D===w,N=!1,A=W0.dirname(w);if(D.startsWith(A+W0.sep)){if(!W0.relative(A,D).split(W0.sep).some((E)=>E.startsWith(".")&&E!=="."&&E!==".."))N=!0}if(!M&&!I&&!N)return console.error(`Security: Path traversal attempt blocked for include path: ${V}`),console.error(` Resolved to: ${D}`),console.error(` Allowed dirs: ${L}, ${w}`),null;return D}catch(O){return console.error(`Error resolving path ${V}: ${O}`),null}}let U=W0.resolve(J);Q.add(U);function W(V,F,_,O){return X.onIncludeError?.({includePath:V,templatePath:J,message:F,partialsDir:G}),H0("Include",F,J,_,O)}async function H(V,F={},_,O){let L=K(V,G,J);if(!L)return W(V,`Could not resolve path for include: ${V}`,_,O);let w=W0.resolve(L);if(Q.has(w)){let R=[...Q,w].map((D)=>W0.basename(D)).join(" -> ");return W(V,`Circular include detected: ${R}`,_,O)}try{Y.add(L);let R;if(!R)try{R=await Bun.file(L).text()}catch(S){let g=S instanceof Error?S.message:String(S);return W(V,`Error loading include file ${V}: ${g}`,_,O)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:S}=await import("./chunk-
|
|
3457
|
-
`;continue}if(r)try{let{extractVariables:Z0}=await import("./chunk-
|
|
3458
|
-
`}}if(b){let S=FY(D,b);if(D=S.html,S.mergedIntoExisting){let f=b,r=S.mergedIntoExisting;E=E.split(`'${f}'`).join(`'${r}'`).split(`"${f}"`).join(`"${r}"`),b=r}else if(!S.stamped)console.warn(`[stx] ${W0.relative(process.cwd(),L)} 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 g=S.stamped&&S.root!==null&&O4(S.root);E=_Y(E,g?b:null)}if(D.includes("@include")||D.includes("@partial"))D=await J$(D,T,L,X,Y,Q);let{processLoops:C}=await import("./chunk-
|
|
3456
|
+
})();`}function FY($,Z){if(G1($)){let Y=G1($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0,root:"body"};return{html:C1($,(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],q=J[3];return{html:`${G}${z} data-stx-scope="${Z}"${q}${$.slice(J[0].length)}`,mergedIntoExisting:null,stamped:!0,root:Y}}return{html:$,mergedIntoExisting:null,stamped:!1,root:null}}var R4=0,SH=new o1(500),N4=new Set;function vH(){N4.clear()}function wY($){if($.__onceStore instanceof Set)return $.__onceStore;return N4}async function J$($,Z,J,X,Y,Q=new Set){let G=X.partialsDir||W0.join(W0.dirname(J),"partials");if(G&&!W0.isAbsolute(G))G=W0.resolve(process.cwd(),G);let z=jY($,"@partial","@include"),q=wY(Z);z=z.replace(/@once([\s\S]*?)@endonce/g,(V,F,_)=>{let O=F.trim(),L=`${J}:${O}`;if(q.has(L))return"";return q.add(L),F});{let V=/@includeIf\s*\(/g,F;while((F=V.exec(z))!==null){let _=F.index,O=_+F[0].length-1,L=1,w=O+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")")L--;w++}if(L!==0)break;let R=z.substring(O+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){V.lastIndex=w;continue}let M=D[1],I=K(M,G,J),N="";if(I&&await Bun.file(I).exists())Y.add(I),N=`@include(${R})`;z=z.substring(0,_)+N+z.substring(w),V.lastIndex=0}}for(let[V,F]of[["@includeWhen",!1],["@includeUnless",!0]]){let _=new RegExp(`${V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=_.exec(z))!==null){let L=O.index,w=L+O[0].length-1,R=1,D=w+1;while(D<z.length&&R>0){if(z[D]==="(")R++;else if(z[D]===")")R--;D++}if(R!==0)break;let M=z.substring(w+1,D-1),I=Z$(M,0);if(I===-1){_.lastIndex=D;continue}let N=M.substring(0,I).trim(),A=M.substring(I+1).trim(),T=A.match(/^\s*['"]([^'"]+)['"]/);if(!T){_.lastIndex=D;continue}let k=T[1],y=A.substring(T[0].length),E,b=Z$(y,0);if(b!==-1)E=y.substring(b+1).trim();try{let C=`Boolean(${N})`,v;if(q0(C)){let f=U0(C,Object.keys(Z));v=Boolean(f(...Object.values(Z)))}else v=Boolean($0(C,Z));let S=F?!v:v,g="";if(S){let f=K(k,G,J);if(f&&await Bun.file(f).exists())Y.add(f);g=`@include('${k}'${E?`, ${E}`:""})`}z=z.substring(0,L)+g+z.substring(D),_.lastIndex=0}catch(C){let v=C instanceof Error?C.message:String(C),S=H0("Include",`Error evaluating ${V} condition: ${v}`,J,$,L);z=z.substring(0,L)+S+z.substring(D),_.lastIndex=0}}}{let V=/@each\s*\(/g,F;while((F=V.exec(z))!==null){let _=F.index,O=_+F[0].length-1,L=1,w=O+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=z.substring(O+1,w),D=z.substring(_,w+1),M=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!M){V.lastIndex=0,z=z.replace(D,"");continue}let[,I,N,A,T]=M;try{let k,y=N.trim();if(q0(y))k=U0(y,Object.keys(Z))(...Object.values(Z));else k=$0(y,Z);let E="";if(Array.isArray(k)&&k.length>0)for(let b of k){let C={...Z,[A]:b},v=await H(I,C,$,_);E+=v}else if(T)E=await H(T,{},$,_);z=z.substring(0,_)+E+z.substring(w+1),V.lastIndex=0}catch(k){let y=k instanceof Error?k.message:String(k);z=z.substring(0,_)+H0("Each",`Error in @each: ${y}`,J,$,_)+z.substring(w+1),V.lastIndex=0}}}{let V=/@includeFirst\s*\(/g,F;while((F=V.exec(z))!==null){let _=F.index,O=_+F[0].length-1,L=1,w=O+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=z.substring(O+1,w),D=z.substring(_,w+1),M=R.match(/^\s*(\[[^\]]+\])/);if(!M){V.lastIndex=0,z=z.replace(D,"");continue}let I=M[1],N=R.slice(M[0].length),A,T=N.match(/^\s*,\s*\{/);if(T){N=N.slice(T[0].length-1);let E=1,b=1;while(b<N.length&&E>0){if(N[b]==="{")E++;else if(N[b]==="}"){if(E--,E===0)break}b++}A=N.substring(0,b+1),N=N.slice(b+1)}let k,y=N.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(y)k=y[1];try{let E=JSON.parse(I.replace(/'/g,'"')),b={};if(A)try{b=T0(A,Z)}catch(v){let S=v instanceof Error?v.message:String(v);if(X.debug){let g=H0("Include",`Error parsing includeFirst variables: ${S}`,J,$,_,D);z=z.replace(D,()=>g)}else z=z.replace(D,()=>k||"");continue}let C=!1;for(let v of E){let S=K(v,G,J);if(!S)continue;if(await s(S)){let g=await H(v,b,$,_);z=z.replace(D,()=>g),C=!0;break}}if(!C)if(k!==void 0)z=z.replace(D,()=>k);else if(X.debug){let v=H0("Include",`None of the includeFirst paths exist: ${I}`,J,$,_,D);z=z.replace(D,()=>v)}else z=z.replace(D,"")}catch(E){let b=E instanceof Error?E.message:String(E),C=H0("Include",`Error processing @includeFirst: ${b}`,J,$,_,D);z=z.replace(D,()=>C)}V.lastIndex=0}}function K(V,F,_){try{let O=V;if(!V.endsWith(".stx"))O=`${V}.stx`;let L=W0.resolve(F),w=W0.resolve(W0.dirname(_)),R;if(!O.startsWith("./")&&!O.startsWith("../"))R=W0.resolve(F,O);else R=W0.resolve(w,O);let D=W0.normalize(R),M=D.startsWith(L+W0.sep)||D===L,I=D.startsWith(w+W0.sep)||D===w,N=!1,A=W0.dirname(w);if(D.startsWith(A+W0.sep)){if(!W0.relative(A,D).split(W0.sep).some((E)=>E.startsWith(".")&&E!=="."&&E!==".."))N=!0}if(!M&&!I&&!N)return console.error(`Security: Path traversal attempt blocked for include path: ${V}`),console.error(` Resolved to: ${D}`),console.error(` Allowed dirs: ${L}, ${w}`),null;return D}catch(O){return console.error(`Error resolving path ${V}: ${O}`),null}}let U=W0.resolve(J);Q.add(U);function W(V,F,_,O){return X.onIncludeError?.({includePath:V,templatePath:J,message:F,partialsDir:G}),H0("Include",F,J,_,O)}async function H(V,F={},_,O){let L=K(V,G,J);if(!L)return W(V,`Could not resolve path for include: ${V}`,_,O);let w=W0.resolve(L);if(Q.has(w)){let R=[...Q,w].map((D)=>W0.basename(D)).join(" -> ");return W(V,`Circular include detected: ${R}`,_,O)}try{Y.add(L);let R;if(!R)try{R=await Bun.file(L).text()}catch(S){let g=S instanceof Error?S.message:String(S);return W(V,`Error loading include file ${V}: ${g}`,_,O)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:S}=await import("./chunk-hqgnxvf8.js");R=S(R,Z)}if(R&&(X.debug||!j9()&&!B9()))try{let{warnUnbalancedTags:S}=await import("./chunk-2enzjhrh.js");S(R,L)}catch{}let D=R;try{let{processESImports:S}=await import("./chunk-2egqczsa.js");await S(R,Z,L,X,Y)}catch(S){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,S instanceof Error?S.message:S)}let M=X9(D);if(M)D=M.content.trim();let N=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),A="";if(N)A=`<style${N[1]}>${N[2]}</style>`;D=D.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),D=D.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let T={...Z};T.__stx_signals_gate=Q1(R,L);for(let[S,g]of Object.entries(F))T[S]=g;let k=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,y=[...R.matchAll(k)],E="",b=null;for(let S of y){let g=S[1]||"",f=S[2]||"",r=g.includes("server"),r0=A1(g);if(!r&&f.trim()){let{interpolateScriptExpressions:Z0}=await import("./chunk-t16fgjr4.js");f=Z0(f,T)}let A0="";try{let{extractAndStripCssImports:Z0,renderVendorStyleTags:j0}=await import("./chunk-v24y3hz7.js"),k0=Z0(f,{filePath:L,projectRoot:process.cwd()});f=k0.code,A0=j0(k0.styles)}catch(Z0){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,Z0 instanceof Error?Z0.message:Z0)}if(r0&&f.trim())f=k1(f);if(!r){try{let{injectBrowserCoreAutoImports:j0}=await import("./chunk-v24y3hz7.js");f=j0(f).code;let{hasUserImports:k0,bundleClientScript:f0}=await import("./chunk-5zdxwpr4.js");if(k0(f))f=await f0(f,L,{projectRoot:process.cwd()})}catch(j0){if(X.debug)console.warn(`[stx] bundler skipped for ${L}:`,j0 instanceof Error?j0.message:j0)}let{stripStxRuntimeImports:Z0}=await import("./chunk-ps3n1bvh.js");f=Z0(f)}let y0=BY(f);if(y0&&!r){b=`stx_scope_${W0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++R4}`;let Z0=Z1(f),j0=w4(Z0,b);E+=`${A0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${b}">${j0}</script>
|
|
3457
|
+
`;continue}if(r)try{let{extractVariables:Z0}=await import("./chunk-s5phwqxc.js");await Z0(f,T,L)}catch(Z0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,Z0)}if(!r&&!y0){let Z0=g.replace(/\bclient\b/i,"").trim();b=`stx_scope_${W0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++R4}`;let j0=Z1(f),k0=w4(j0,b);E+=`${A0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${b}"${Z0?` ${Z0}`:""}>${k0}</script>
|
|
3458
|
+
`}}if(b){let S=FY(D,b);if(D=S.html,S.mergedIntoExisting){let f=b,r=S.mergedIntoExisting;E=E.split(`'${f}'`).join(`'${r}'`).split(`"${f}"`).join(`"${r}"`),b=r}else if(!S.stamped)console.warn(`[stx] ${W0.relative(process.cwd(),L)} 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 g=S.stamped&&S.root!==null&&O4(S.root);E=_Y(E,g?b:null)}if(D.includes("@include")||D.includes("@partial"))D=await J$(D,T,L,X,Y,Q);let{processLoops:C}=await import("./chunk-1hgjxmev.js"),v=C(D,T,L);if(v=$1(v,T,L),v=_1(v,T,L),A)v+=`
|
|
3459
3459
|
`+A;if(E)v+=`
|
|
3460
3460
|
`+E;return v}catch(R){let D=R instanceof Error?R.message:String(R);return W(V,`Error processing include ${V}: ${D}`,_,O)}}let j=/@include\s*\(/g,B;while((B=j.exec(z))!==null){let V=B.index,F=V+B[0].length-1,_=1,O=F+1;while(O<z.length&&_>0){if(z[O]==="(")_++;else if(z[O]===")")_--;O++}if(_!==0)break;let L=z.substring(V,O),w=z.substring(F+1,O-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){j.lastIndex=O;continue}let D=R[1],M,I=w.substring(R[0].length),N=Z$(I,0);if(N!==-1)M=I.substring(N+1).trim();let A={};if(M)try{A=T0(M,Z)}catch(k){let y=k instanceof Error?k.message:String(k);z=z.replace(L,H0("Include",`Error parsing include variables for ${D}: ${y}`,J,$,V)),j.lastIndex=0;continue}let T=await H(D,A,$,V);z=z.substring(0,V)+T+z.substring(O),j.lastIndex=0}return z}function X$($,Z){let J=$;function X(Y,Q,G,z){let q=Y,K=!0;while(K){K=!1;let U=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),W=q.match(U);if(!W||W.index===void 0)break;let H=W.index,j=W[1],B=H+W[0].length,V=new RegExp(`@${Q}\\(`),F=new RegExp(`@${G}(?![a-z])`),_=1,O=B,L=-1;while(_>0&&O<q.length){let R=q.slice(O),D=R.match(V),M=R.match(F),I=D?O+D.index:1/0,N=M?O+M.index:1/0;if(I<N)_++,O=I+(D[0].length||1);else if(N<1/0){if(_--,_===0){L=N;break}O=N+G.length+1}else break}if(L===-1)break;let w=q.slice(B,L);if(!Z[j])Z[j]=[];if(z)Z[j].unshift(w);else Z[j].push(w);q=q.substring(0,H)+q.substring(L+`@${G}`.length),K=!0}return q}return J=X(J,"push","endpush",!1),J=X(J,"prepend","endprepend",!0),J}function Y$($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(J,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
|
|
3461
3461
|
`)})}import*as Q$ from"path";async function M4($,Z,J=""){if(Q$.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 k4($,Z,J,"@js","@endjs")}async function A4($,Z,J=""){if(Q$.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 k4($,Z,J,"@ts","@endts")}async function k4($,Z,J,X,Y){let Q=$,G=x1(`${X}([\\s\\S]*?)${Y}`,"g"),z=[],q;while((q=G.exec($))!==null)z.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:K,content:U,index:W}of z)try{let H={...Z,global:Z},j=Object.keys(H),B=Object.values(H),V=U.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((D)=>D.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),O=_.length>0?`return { ${_.join(", ")} };`:"return {};",L=`
|
|
@@ -3524,14 +3524,14 @@ ${$.slice(J)}`}function L6($,Z={},J={},X){if(X??F$($))return $;return FQ($,Z,J)}
|
|
|
3524
3524
|
${Z}${$.slice(Y)}`;if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Z+`
|
|
3525
3525
|
`+$.slice(G)}if(G1($))return C1($,(G)=>`${G}
|
|
3526
3526
|
${Z}`);return`${Z}
|
|
3527
|
-
${$}`}async function M9($,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-
|
|
3527
|
+
${$}`}async function M9($,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-r6m67kjc.js"),{url:Q}=await Y("runtime",Z.debug===!0);return R$($,`<script data-stx-runtime src="${Q}"></script>`)}if(Z.buildMode==="compile")return R$($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:J}=await import("./chunk-r6m67kjc.js"),X=await J(Z.debug);return R$($,`<script data-stx-scoped data-stx-runtime>${X}</script>`)}function MQ($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function M6($){if($.includes("data-stx-tooltip-runtime")||!MQ($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${o5()}</script>`,J=$.lastIndexOf("</body>");if(J===-1)return`${$}
|
|
3528
3528
|
${Z}`;return`${$.slice(0,J)}${Z}
|
|
3529
3529
|
${$.slice(J)}`}var AQ=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function kQ($){return AQ.test($)||$.includes("__stxRouter)return")||$.includes("__stxRouter=true")}async function IQ($,Z){if(!$.includes("</body>"))return $;if(kQ($))return $;let J=Z?.router,X="";{let q={};if(J){if(J.container)q.container=J.container;if(J.interceptAllLinks!==void 0)q.interceptAllLinks=J.interceptAllLinks;if(J.progress!==void 0)q.progress=J.progress;if(J.viewTransitions!==void 0)q.viewTransitions=J.viewTransitions;if(J.viewTransitionDuration!==void 0)q.viewTransitionDuration=J.viewTransitionDuration;if(J.viewTransitionEasing!==void 0)q.viewTransitionEasing=J.viewTransitionEasing;if(J.scrollToTop!==void 0)q.scrollToTop=J.scrollToTop;if(J.prefetch!==void 0)q.prefetch=J.prefetch;if(J.cache!==void 0)q.cache=J.cache;if(J.progressColor!==void 0)q.progressColor=J.progressColor;if(J.progressHeight!==void 0)q.progressHeight=J.progressHeight}try{let K=await w6(Z?.pagesDir);if(K.length>0)q.ownedRoutes=K}catch{}if(Object.keys(q).length>0)X=`<script>window.__stxRouterConfig=${R6(q)};</script>
|
|
3530
|
-
`}let{getCachedRouterScript:Y,getServeClientAsset:Q}=await import("./chunk-
|
|
3530
|
+
`}let{getCachedRouterScript:Y,getServeClientAsset:Q}=await import("./chunk-r6m67kjc.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+`
|
|
3531
3531
|
</body>`+$.slice(z+7)}var A6=Symbol.for("stx.lazy-module-promises");function TQ(){let $=globalThis;return $[A6]??=new Map,$[A6]}function n($,Z){let J=TQ(),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 N$=`(?:"[^"]*"|'[^']*'|[^>"'])*`,C6=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,EQ=65536,bQ=4,k9=new Map;function GB(){k9.clear()}function yQ($){let Z=[];for(let J of h2($,Y1)){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 CQ($,Z={}){let J=$.length>=EQ,X=J?k9.get($):void 0;if(X===void 0){if(X=yQ($),J)u2(k9,bQ),k9.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 P6($){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}=k6(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}=k6(Y);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:z}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function k6($){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 k$($,Z){return y6($,Z)}function PQ($){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 SQ($){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)\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 vQ($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${N$})>`,"iy"),J=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,X=h2($,(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),q=P6(z?.[1]??z?.[2]??""),K=[q.itemVar,q.indexVar].filter(Boolean);if(K.length===0)continue;let U=G[1],H=/\/\s*>$/.test(Q.token)||I9.has(U.toLowerCase())?Q.end:v6($,Q.start,U,Q.end);if(H!==-1)Y.push({start:Q.start,end:H,vars:new Set(K)})}return Y}var I6=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 fQ($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function T6($,Z,J,X){if(!$)return!1;let Y=fQ($),Q=!1,G=!1,z=!1,q=/([a-zA-Z_$][\w$]*)/g,K;while((K=q.exec(Y))!==null){let j=K[1];if(Y.slice(0,K.index).trimEnd().endsWith("."))continue;if(I6.has(j))continue;if(Z.has(j)||X?.has(j))Q=!0;else if(J&&j in J)G=!0}let U=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,W;while((W=U.exec(Y))!==null){let j=W[1];if(Y.slice(0,W.index).trimEnd().endsWith("."))continue;if(I6.has(j)||J&&j in J)continue;z=!0}return(Q||z)&&!G}function A9($,Z,J){let X=J===void 0?` ${Z}`:` ${Z}="${J.replace(/"/g,""")}"`,Y=$.trim(),Q=Y.match(C6);if(Q&&xQ(Q[3],Q[1])){let[,G,z,q]=Q;return`<${G}${z}${X}>${q}</${G}>`}return`<template${X}>${Y}</template>`}function xQ($,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 S6($,Z){let J=SQ($);function X(Y){let Q=Y,G=vQ(Y),z=(W)=>{let H=new Set;for(let j of G)if(W>j.start&&W<j.end)for(let B of j.vars)H.add(B);return H},q=/@if\s*\(/g,K,U=[];while((K=q.exec(Q))!==null){let W=K.index,H=W+K[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(),F=B,_=1,O=F,L=/@(if\s*\(|endif)/g;L.lastIndex=F;let w;while((w=L.exec(Q))!==null)if(w[1].startsWith("if"))_++;else if(w[1]==="endif"){if(_--,_===0){O=w.index+w[0].length;break}}if(_!==0)continue;let R=Q.substring(F,O-6).trim(),D;if(PQ(R)){let M=H2(Q.substring(W,O));if(M.length===0)continue;let I=M[0].branches.filter((k)=>k.type!=="else"),N=z(W);if(!(I.length>0&&I.every((k)=>T6(k.condition,J,Z,N))))continue;D=M[0].branches.map((k)=>{let y=X(k.content);if(k.type==="elseif")return A9(y,"@else-if",k.condition??"");if(k.type==="else")return A9(y,"@else");return A9(y,"@if",k.condition??"")}).join(`
|
|
3532
3532
|
`)}else{if(!T6(V,J,Z,z(W)))continue;D=A9(X(R),"@if",V)}U.push({start:W,end:O,replacement:D}),q.lastIndex=O}for(let W=U.length-1;W>=0;W--){let{start:H,end:j,replacement:B}=U[W];Q=Q.substring(0,H)+B+Q.substring(j)}return Q}return X($)}function gQ($){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 I9=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),E6=/<(script|style)\b/iy,hQ=/<\/script/gi,uQ=/<\/style/gi;function v6($,Z,J,X){if(I9.has(J.toLowerCase()))return X;let Y=J.toLowerCase(),Q=$.length,G=1,z=X;while(z<Q){let q=$.indexOf("<",z);if(q===-1)return-1;if(z=q,$.startsWith("<!--",z)){let H=$.indexOf("-->",z+4);if(H===-1)return-1;z=H+3;continue}E6.lastIndex=z;let K=E6.exec($);if(K){let H=$.indexOf(">",z);if(H===-1)return-1;if($[H-1]==="/"){z=H+1;continue}let j=K[1].toLowerCase()==="script"?hQ:uQ;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 U=/^<([a-z][\w-]*)\b/i.exec($.slice(z,z+64));if(!U){z++;continue}let W=$.indexOf(">",z);if(W===-1)return-1;if(U[1].toLowerCase()===Y){let H=$.slice(z,W+1);if(!(/\/\s*>$/.test(H)||I9.has(Y)))G++}z=W+1}return-1}var dQ=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function mQ($,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 dQ.test(Q)}function f6($){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=(W)=>Z.some(([H,j])=>W>=H&&W<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[W,H,j,B,V,F,_]=z,O=gQ(V);if(O===void 0)continue;let L=z.index,w=L+W.length,M=!!_||/\/\s*>$/.test(W)||I9.has(H.toLowerCase())?w:v6($,L,H,w);if(M===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&mQ($,M)){Q.lastIndex=w;continue}if(O===!0){let N=`<${H}${j}${F}${_}>`;G.push({start:L,end:w,replacement:N});continue}G.push({start:L,end:M,replacement:""}),Q.lastIndex=M}if(G.length===0)return $;G.sort((W,H)=>W.start-H.start);let q=[],K=-1;for(let W of G){if(W.start<K)continue;q.push(W),K=W.end}let U=$;for(let W=q.length-1;W>=0;W--){let{start:H,end:j,replacement:B}=q[W];U=U.substring(0,H)+B+U.substring(j)}return U}function I$($,Z){let J=$,X=/@(for|foreach)\s*\(/g,Y,Q=[],G=[];while((Y=X.exec(J))!==null){let z=Y[1],q=Y.index,K=q+Y[0].length,U=1,W=K;while(W<J.length&&U>0){if(J[W]==="(")U++;else if(J[W]===")")U--;W++}if(U!==0)continue;let H=J.substring(K,W-1).trim(),j=W,B=P6(H),V=z==="for"?"@endfor":"@endforeach",F=1,_=j,O=z==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${z}\\s*\\(|end${z})`,"g");O.lastIndex=j;let L;while((L=O.exec(J))!==null)if(L[1].startsWith(z))F++;else if(F--,F===0){_=L.index+L[0].length;break}if(F!==0)continue;let w=()=>{let A=[B.itemVar,B.indexVar].filter(Boolean);if(A.length)G.push({start:q,end:_,vars:A})};if(B.iterable){let A=B.iterable.trim();if(A.startsWith("[")||A.startsWith("{")||A.startsWith("'")||A.startsWith('"')||A.startsWith("`")||/^-?\d/.test(A)){w();continue}let T=A.split(/[.[(]/)[0].trim(),k=Z?T in Z:!1,y=G.some((E)=>q>E.start&&q<E.end&&E.vars.includes(T));if(T&&(k||y)){w();continue}}if(B.style==="as")H=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let R=J.substring(j,_-V.length).trim(),D=Z?{...Z}:{};if(B.itemVar)delete D[B.itemVar];if(B.indexVar)delete D[B.indexVar];let M=I$(R,D),I=M.match(C6),N;if(I){let[,A,T,k]=I;N=`<${A}${T} @for="${H}">${k}</${A}>`}else N=`<template @for="${H}">${M}</template>`;Q.push({start:q,end:_,replacement:N}),X.lastIndex=_}for(let z=Q.length-1;z>=0;z--){let{start:q,end:K,replacement:U}=Q[z];J=J.substring(0,q)+U+J.substring(K)}return J}function lQ($){let Z=new Set,J=[],X=0,Y=0,Q=$.length,G=(U)=>{let W=X+1;while(W<Q){let H=$[W];if(H==="\\"){W+=2;continue}if(H===U)return W+1;W++}return Q},z=()=>{let U=X+2;while(U<Q&&$[U]!==`
|
|
3533
3533
|
`)U++;return U},q=()=>{let U=X+2;while(U<Q-1){if($[U]==="*"&&$[U+1]==="/")return U+2;U++}return Q},K=(U)=>{let W=U,H=0;while(W<Q){let j=$[W];if(j==="/"&&$[W+1]==="/"){let B=W+2;while(B<Q&&$[B]!==`
|
|
3534
|
-
`)B++;W=B;continue}if(j==="/"&&$[W+1]==="*"){let B=W+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;W=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=W+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}W=B;continue}if(j==="("||j==="["||j==="{"){H++,W++;continue}if(j===")"||j==="]"||j==="}"){H--,W++;continue}if(j===";"&&H===0)return W+1;W++}return Q};while(X<Q){let U=$[X];if(U==="/"&&$[X+1]==="/"){let W=z();J.push($.slice(X,W)),X=W;continue}if(U==="/"&&$[X+1]==="*"){let W=q();J.push($.slice(X,W)),X=W;continue}if(U==='"'||U==="'"||U==="`"){let W=G(U);J.push($.slice(X,W)),X=W;continue}if(U==="{"){Y++,J.push(U),X++;continue}if(U==="}"){Y--,J.push(U),X++;continue}if(Y===0){let W=X>0?$[X-1]:"";if(W===""||/\s/.test(W)||W===";"||W==="}"||W==="{"){let j=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],V=K(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(U),X++}return J.join("")}var cQ=new Set(["script","style","html","head","meta","link","title","!doctype"]);function M$($,Z,J){for(let X of J){if(X.start>=Z)return!1;if(X.end>$)return!0}return!1}function pQ($,Z,J){let X=0;while(X<$.length){let Y=$.indexOf(Z,X);if(Y===-1)return!1;if(!M$(Y,Y+Z.length,J))return!0;X=Y+Z.length}return!1}function iQ($,Z){if(pQ($,"<body",Z)){let Y=new RegExp(`<body(${N$})>`,"g"),Q;while((Q=Y.exec($))!==null)if(!M$(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(${N$})>`,"gi"),X;while((X=J.exec($))!==null){if(M$(X.index,X.index+X[0].length,Z))continue;if(cQ.has(X[1].toLowerCase()))continue;return X.index+X[0].length-1}return null}function nQ($,Z,J,X){let Y=[],Q=` data-stx="${X}"`,G=0,z=!1,q=(K)=>{if(J!==null&&!z&&J>=G&&J<=K)Y.push($.slice(G,J),Q,$.slice(J,K)),z=!0;else Y.push($.slice(G,K))};for(let K of Z){if(K.start<G)continue;q(K.start),G=K.end}return q($.length),Y.join("")}async function oQ($,Z,J){let X=CQ($,{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|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 n("stx/client-script-bundler",()=>import("./chunk-
|
|
3534
|
+
`)B++;W=B;continue}if(j==="/"&&$[W+1]==="*"){let B=W+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;W=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=W+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}W=B;continue}if(j==="("||j==="["||j==="{"){H++,W++;continue}if(j===")"||j==="]"||j==="}"){H--,W++;continue}if(j===";"&&H===0)return W+1;W++}return Q};while(X<Q){let U=$[X];if(U==="/"&&$[X+1]==="/"){let W=z();J.push($.slice(X,W)),X=W;continue}if(U==="/"&&$[X+1]==="*"){let W=q();J.push($.slice(X,W)),X=W;continue}if(U==='"'||U==="'"||U==="`"){let W=G(U);J.push($.slice(X,W)),X=W;continue}if(U==="{"){Y++,J.push(U),X++;continue}if(U==="}"){Y--,J.push(U),X++;continue}if(Y===0){let W=X>0?$[X-1]:"";if(W===""||/\s/.test(W)||W===";"||W==="}"||W==="{"){let j=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],V=K(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(U),X++}return J.join("")}var cQ=new Set(["script","style","html","head","meta","link","title","!doctype"]);function M$($,Z,J){for(let X of J){if(X.start>=Z)return!1;if(X.end>$)return!0}return!1}function pQ($,Z,J){let X=0;while(X<$.length){let Y=$.indexOf(Z,X);if(Y===-1)return!1;if(!M$(Y,Y+Z.length,J))return!0;X=Y+Z.length}return!1}function iQ($,Z){if(pQ($,"<body",Z)){let Y=new RegExp(`<body(${N$})>`,"g"),Q;while((Q=Y.exec($))!==null)if(!M$(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(${N$})>`,"gi"),X;while((X=J.exec($))!==null){if(M$(X.index,X.index+X[0].length,Z))continue;if(cQ.has(X[1].toLowerCase()))continue;return X.index+X[0].length-1}return null}function nQ($,Z,J,X){let Y=[],Q=` data-stx="${X}"`,G=0,z=!1,q=(K)=>{if(J!==null&&!z&&J>=G&&J<=K)Y.push($.slice(G,J),Q,$.slice(J,K)),z=!0;else Y.push($.slice(G,K))};for(let K of Z){if(K.start<G)continue;q(K.start),G=K.end}return q($.length),Y.join("")}async function oQ($,Z,J){let X=CQ($,{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|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 n("stx/client-script-bundler",()=>import("./chunk-5zdxwpr4.js"));for(let O of X){let L=O.body;if(A1(O.attrs))L=k1(L);if(Y.test(L)){Q.push({content:L,start:O.start,end:O.end});continue}if(!G(L))continue;try{let w=await z(e1(L).code,Z||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(Y.test(w))Q.push({content:L,start:O.start,end:O.end})}catch{}}if(Q.length===0)return{output:$,setupCode:null};let q=`${Z??""}\x00${Q.map((O)=>O.content).join("\x00")}`,K=`__stx_setup_${Bun.hash(q).toString(36).slice(0,10)}`,U=[];for(let O=0;O<Q.length;O++){let L=Q[O].bundled??e1(Q[O].content).code;if(!Q[O].bundled&&G(L))L=await z(L,Z||"",{projectRoot:process.cwd()});L=tQ(L);let w=Z1(L);U.push(`// \u2500\u2500 merged signal script #${O+1} \u2500\u2500
|
|
3535
3535
|
${w}`)}let W=U.join(`
|
|
3536
3536
|
|
|
3537
3537
|
`);W=lQ(W);let H=sQ(W),j=H.split(",").map((O)=>O.trim()).filter(Boolean),B=A$(W,J),V=`
|
|
@@ -3566,13 +3566,13 @@ ${q.join(`
|
|
|
3566
3566
|
Tip: prefer useRef(), navigate(), and composables for component code`;if(y$.set(Q,H),Y.failOnViolation)throw Error(H);else console.warn(H)}HG();import P$ from"path";var KG=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,UG=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function WG($,Z){if(!Z||!$.includes("/"))return $;let J=P$.dirname(Z);return $.replace(KG,(X,Y,Q,G)=>{let z=P$.resolve(J,G);return`${Y}${Q}${z.split(P$.sep).join("/")}${Q}`})}function o6($,Z){if(!Z||!$.includes("<script"))return $;return $.replace(UG,(J,X,Y,Q)=>`${X}${WG(Y,Z)}${Q}`)}var E1="<!--PARENT_CONTENT_PLACEHOLDER-->";function s6($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function BG($,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(`
|
|
3567
3567
|
`,X+2),X===-1)return-1;X+=1,Y=!0;continue}if(z==="/"&&$[X+1]==="*"){let q=$.indexOf("*/",X+2);if(q===-1)return-1;X=q+2,Y=!0;continue}if(z==="/"&&Y){let q=X+1,K=!1;while(q<J){let U=$[q];if(U==="\\"){q+=2;continue}if(U==="[")K=!0;else if(U==="]")K=!1;else if(U==="/"&&!K){q++;break}else if(U===`
|
|
3568
3568
|
`){q=-1;break}q++}if(q===-1){X++,Y=!1;continue}while(q<J&&/[a-z]/.test($[q]))q++;X=q,Y=!1;continue}if(z==="'"||z==='"'){let q=z;X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]===q){X++;break}if($[X]===`
|
|
3569
|
-
`)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 H8($,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}}var r6=/<style\b[^>]*>/iy,a6=/<\/style>/gi,t6=/<script\b[^>]*>/iy;function e6($){let Z=0;while(Z<$.length){let J=$.indexOf("<",Z);if(J===-1)return-1;if($.startsWith("<!--",J)){let Y=$.indexOf("-->",J+4);Z=Y===-1?$.length:Y+3;continue}r6.lastIndex=J;let X=r6.exec($);if(X){a6.lastIndex=J+X[0].length;let Y=a6.exec($);Z=Y===null?$.length:Y.index+8;continue}if(t6.lastIndex=J,t6.test($))return J;Z=J+1}return-1}async function $8($,Z){try{let{registeredModuleIdsIn:J,buildModuleRegistryScript:X}=await n("stx/client-module-registry",()=>import("./chunk-
|
|
3569
|
+
`)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 H8($,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}}var r6=/<style\b[^>]*>/iy,a6=/<\/style>/gi,t6=/<script\b[^>]*>/iy;function e6($){let Z=0;while(Z<$.length){let J=$.indexOf("<",Z);if(J===-1)return-1;if($.startsWith("<!--",J)){let Y=$.indexOf("-->",J+4);Z=Y===-1?$.length:Y+3;continue}r6.lastIndex=J;let X=r6.exec($);if(X){a6.lastIndex=J+X[0].length;let Y=a6.exec($);Z=Y===null?$.length:Y.index+8;continue}if(t6.lastIndex=J,t6.test($))return J;Z=J+1}return-1}async function $8($,Z){try{let{registeredModuleIdsIn:J,buildModuleRegistryScript:X}=await n("stx/client-module-registry",()=>import("./chunk-wk8v593t.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 VG($){let Z=H8($,"data-stx-runtime");if(!Z)return $;let J=e6($);if(J===-1||J===Z.start)return $;if(J<Z.start)return $.slice(0,J)+$.slice(Z.start,Z.end)+`
|
|
3570
3570
|
`+$.slice(J,Z.start)+$.slice(Z.end);let X=$.slice(Z.start,Z.end),Y=$.slice(0,Z.start)+$.slice(Z.end),Q=e6(Y);if(Q===-1)return X+`
|
|
3571
3571
|
`+Y;return Y.slice(0,Q)+X+`
|
|
3572
3572
|
`+Y.slice(Q)}async function S$($,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=Q1($,J);let Q=!Z.__stxProcessingDepth;if(Q)a$(Z),Z.__stx_head_injections=U$(),Z.__stx_seo_staged=!1;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!j9()&&!B9())&&J&&J.endsWith(".stx"))W8($,J);try{return await q8.timeAsync("template-processing",async()=>{let G=await LG($,Z,J,X,Y);if(Q)G=b$(G);if(Q&&X.autoShell&&X.buildMode!=="compile"){let z=X.app?.head||{},K=(Z.__stx_runtime_head||null)??U8(),U=(Z.__stx_head_raw||"").trim(),W,H=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(H)W=H[1].trim(),U=U.replace(H[0],"").trim();let j=Z.__sections?.title,B=K.title||W||j,V=!K.title&&(!!W||!!j),F=K.meta||[],_=new Set(F.map((M)=>a1(M)).filter(Boolean)),O={...z,...B&&{title:B},meta:[...(z.meta||[]).filter((M)=>!_.has(a1(M))),...F],link:[...z.link||[],...K.link||[]],script:[...z.script||[],...K.script||[]],headRaw:[z.headRaw,U].filter(Boolean).join(`
|
|
3573
3573
|
`),...K.htmlAttrs&&{htmlAttrs:j6(z.htmlAttrs,K.htmlAttrs)},...K.bodyAttrs&&{bodyAttrs:{...z.bodyAttrs||{},...K.bodyAttrs}}},L=F$(G);if(G=L6(G,O,{...V&&{titleIsHtml:!0},...X.app?.colorMode&&{colorMode:X.app.colorMode}},L),L)G=V6(G,z),G=B6(G,O.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let M=w[1],I=z8(M);G=G.replace(/<head\b[^>]*>/i,(N)=>`${N}
|
|
3574
3574
|
<meta name="stx-layout" content="${s6(M)}">
|
|
3575
|
-
<meta name="stx-layout-group" content="${s6(I)}">`)}let R=G.match(/function (__stx_setup_\w+)\(/),D=R?G1(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=C1(G,(I,N)=>`<body${N} data-stx="${R[1]}">`);let M=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(M,"$1")}}if(Q){let z=Z.__stx_head_injections??U$(),q=_$(G);if(q!==null)z.beforeClose.push(q);let K=B$(G);if(K!==null)z.afterOpen.push(K);G=X6(G,z);let U=X.app?.colorMode;if(U)G=G6(G,U);G=VG(G)}if(Q){let z=H8(G,"data-stx-runtime");if(z){let q=null,K=null,U=null,W=null;try{let{getStoreScript:j}=await n("stx/store-loader",()=>import("./chunk-
|
|
3575
|
+
<meta name="stx-layout-group" content="${s6(I)}">`)}let R=G.match(/function (__stx_setup_\w+)\(/),D=R?G1(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=C1(G,(I,N)=>`<body${N} data-stx="${R[1]}">`);let M=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(M,"$1")}}if(Q){let z=Z.__stx_head_injections??U$(),q=_$(G);if(q!==null)z.beforeClose.push(q);let K=B$(G);if(K!==null)z.afterOpen.push(K);G=X6(G,z);let U=X.app?.colorMode;if(U)G=G6(G,U);G=VG(G)}if(Q){let z=H8(G,"data-stx-runtime");if(z){let q=null,K=null,U=null,W=null;try{let{getStoreScript:j}=await n("stx/store-loader",()=>import("./chunk-1286mhh3.js")),B=X.storesDir,V=await j(B);if(V)K=`<script data-stx-stores>${V}</script>`}catch{}q=await $8([G,K],X);try{let{getFrameworkComposableScript:j}=await n("stx/framework-composables",()=>import("./chunk-jf0te8tr.js"));W=await j(G)}catch{}try{let{getComposableScript:j}=await n("stx/composable-loader",()=>import("./chunk-d54zmtbs.js")),B=X.composablesDir,V=[q,K,W].filter((_)=>_!==null),F=await j(B,G,V);if(F)U=`<script data-stx-composables>${F}</script>`}catch{}let H=[q,K,U,W].filter((j)=>j!==null).map((j)=>`
|
|
3576
3576
|
${j}`).join("");if(H)G=G.slice(0,z.end)+H+G.slice(z.end)}else{let q=await $8([G],X);if(q){let K=G.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(K!==-1)G=G.slice(0,K)+q+`
|
|
3577
3577
|
`+G.slice(K)}}}if(Q)G=z6(G);if(Q&&Z.__stx_inject_css!==!1)G=await K8(G,void 0,X.buildMode==="serve");if(Q)G=Z6(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof J8)throw G;let z=G instanceof Error?G.message:String(G),q=new N2(`Template processing failed: ${z}`,J,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(o0.log(q,{filePath:J,context:Z}),Y8.logDetailedError(q,{filePath:J,template:$.substring(0,500)}),X.debug)throw q;return X8.createFallbackContent("Template Processing",q)}}async function LG($,Z,J,X,Y){let Q=process.cwd(),G={...X,partialsDir:X.partialsDir&&!M0.isAbsolute(X.partialsDir)?M0.resolve(Q,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!M0.isAbsolute(X.componentsDir)?M0.resolve(Q,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!M0.isAbsolute(X.layoutsDir)?M0.resolve(Q,X.layoutsDir):X.layoutsDir},z=G,q=$;await FG(J,Z),OG(Z,z),q=await M2(()=>g4(q,Z,J,z),q,(L)=>{o0.log(L,{filePath:J,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${J}: ${L.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let K=p0(q,Y2,(L,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);q=K.output;let U=K.tokens,W=(L)=>U.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>U[Number(R)]??""),H="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,H),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(L,w)=>{return`{{ ${w} }}`}),q=l4(q),q=await m6(q,J,Y);let j={};q=X$(q,j);let B={...Z.__sections||{}},V="",F=k3(A3($)),_=/@nolayout\b/.test(q)||F===!1;if(/@nolayout\b/.test(q))q=q.replace(/@nolayout\b\s*/g,"");let O=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(O)V=O[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof F==="string"){if(V=F,!/@section\s*\(/.test(q))q=`@section('content')
|
|
3578
3578
|
${q.trim()}
|
|
@@ -3581,7 +3581,7 @@ ${q.trim()}
|
|
|
3581
3581
|
@endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,w,R)=>{return B[w]=R,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,w,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return L;try{let D=$0(R.trim(),Z);if(D===void 0)return L;return B[w]=String(D??""),""}catch{return L}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,w,R)=>{if(R.includes("@parent"))B[w]=R.replace("@parent",E1);else B[w]=R.trim();return""}),Z.__sections=B,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,w,R)=>{return B[w]||R||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(q=Y$(q,j),V){let L=[],w=i0(q),R=p0(w.output,y1,(D,M)=>`\x00STX_ORPHAN_STYLE_${M}\x00`);if(q=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(D,M,I)=>{let N=M==="SCRIPT"?w.scripts[Number(I)]:R.tokens[Number(I)];if(N)L.push(N);return""}),L.length>0){let D=L.join(`
|
|
3582
3582
|
`);B.content=B.content?`${B.content}
|
|
3583
3583
|
${D}`:D,Z.__sections=B}}if(V)try{let L;if(M0.isAbsolute(V))L=V,Y.add(V);else L=await M2(()=>s2(V,J,G,Y),null,()=>{throw new N2(`Failed to resolve layout path: ${V}`,J,void 0,void 0,`Layout referenced from ${J}`)});if(!L){let N=(k)=>{if(!k)return[];try{let y=M0.isAbsolute(k)?k:M0.resolve(process.cwd(),k);return jG.readdirSync(y).filter((E)=>E.endsWith(".stx")).map((E)=>E.replace(/\.stx$/,""))}catch{return[]}},A=[...N(G.layoutsDir),...N(G.fallbackLayoutsDir)].filter((k,y,E)=>E.indexOf(k)===y).sort(),T=`Layout not found: ${V} (referenced from ${J})`+(A.length>0?`. Available layouts: ${A.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(o0.log(Error(T),{layoutPath:V,filePath:J,available:A},"error"),console.error(`[stx] ${T}`),G.debug)throw new N2(T,J);return q}let w=await M2(()=>Bun.file(L).text(),"",()=>{throw new N2(`Failed to read layout file: ${L}`,J,void 0,void 0,"Layout content could not be loaded")});w=o6(w,L);let R=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${L}`);let N={},A=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(y,E,b)=>{return N[E]=b.trim(),""});for(let[y,E]of Object.entries(N))if(B[y]&&B[y].includes(E1)){let b=B[y].indexOf(E1);B[y]=B[y].slice(0,b)+E+B[y].slice(b+E1.length)}else if(!B[y])B[y]=E;let T={...Z,__sections:B},k=`@layout('${R[1]}')${A}`;return await S$(k,T,L,G,Y)}let D=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),M=X$(D,j),I={};return M=M.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(N,A,T)=>{return I[A]=T.trim(),`@slot('${A}')`}),M=M.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(N,A,T)=>{if(B[A]){let k=B[A];if(k.includes(E1)){let y=I[A]||"",E=k.indexOf(E1);k=k.slice(0,E)+y+k.slice(E+E1.length)}return k}return T||""}),M=_G(M,B),M=M.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),M=Y$(M,j),Z.__originalFilePath=J,q=await Z8(M,Z,L,G,Y),q=`<!-- stx-layout: ${V} -->
|
|
3584
|
-
${q}`,W(q)}catch(L){return o0.log(L instanceof Error?L:Error(String(L)),{layoutPath:V,filePath:J},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return W(await Z8(q,Z,J,G,Y))}function _G($,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 OG($,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 FG($,Z){await M2(()=>d4($,Z),void 0,(J)=>{o0.log(J,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${J.message}`)})}async function wG($,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;try{let{extractVariables:q}=await n("stx/variable-extractor",()=>import("./chunk-
|
|
3584
|
+
${q}`,W(q)}catch(L){return o0.log(L instanceof Error?L:Error(String(L)),{layoutPath:V,filePath:J},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return W(await Z8(q,Z,J,G,Y))}function _G($,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 OG($,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 FG($,Z){await M2(()=>d4($,Z),void 0,(J)=>{o0.log(J,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${J.message}`)})}async function wG($,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;try{let{extractVariables:q}=await n("stx/variable-extractor",()=>import("./chunk-s5phwqxc.js"));await q(G,Z,J,{preserveExisting:!0})}catch(q){let K=q instanceof Error?q:Error(String(q));o0.log(K,{filePath:J,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${J}: ${K.message}`)}}}async function RG($,Z,J){try{let{interpolateScriptsInTemplate:X}=await n("stx/expressions",()=>import("./chunk-t16fgjr4.js"));return X($,Z,{skipServer:!0})}catch(X){let Y=X instanceof Error?X:Error(String(X));return o0.log(Y,{filePath:J,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${J}: ${Y.message}`),$}}async function Z8($,Z,J,X,Y){let Q=$,G=X;if(await wG(Q,Z,J),Q=await RG(Q,Z,J),Q=await M4(Q,Z,J),Q=await A4(Q,Z,J),Q=await P7(Q,Z,J,G),Q1(Q))Q=S6(Q,Z),Q=I$(Q,Z);Q=f6(Q);let{processStreamDirectives:z}=await n("stx/streaming",()=>import("./chunk-hqgnxvf8.js"));Q=z(Q,Z),Q=P4(Q,Z,J,G),Q=await n4(Q,Z,J,G,Y),Q=await $$(Q,Z,J,G,Y),Q=M3(Q,Z,J,G);let{processDeferDirectives:q}=await n("stx/defer",()=>import("./chunk-fqggvrwy.js"));Q=q(Q,Z,J);let{processTeleportDirectives:K}=await n("stx/teleport",()=>import("./chunk-q2dmpbqf.js"));Q=K(Q,Z,J);let{processTransitionDirectives:U,processTransitionAttributes:W}=await n("stx/transitions",()=>import("./chunk-xc4b1ngp.js"));Q=U(Q,Z,J),Q=W(Q);let{processErrorBoundaryDirectives:H}=await n("stx/error-boundaries",()=>import("./chunk-ahdzc50z.js"));Q=H(Q,Z,J);let{processSuspenseDirectives:j}=await n("stx/suspense",()=>import("./chunk-pb5s3vwg.js"));Q=j(Q,Z,J);let{processAsyncDirectives:B}=await n("stx/async-components",()=>import("./chunk-nnkz36zg.js"));Q=B(Q,Z,J);let{processKeepAliveDirectives:V}=await n("stx/keep-alive",()=>import("./chunk-mx93vwmq.js"));Q=V(Q,Z,J);let{processVirtualListDirectives:F,processVirtualGridDirectives:_,processInfiniteListDirectives:O}=await n("stx/virtual-scrolling",()=>import("./chunk-0xtnepfj.js"));Q=F(Q,Z,J),Q=_(Q,Z,J),Q=O(Q,Z,J);let{processPartialHydrationDirectives:L,processStaticDirectives:w}=await n("stx/partial-hydration",()=>import("./chunk-fdnbqt4r.js"));Q=L(Q,Z,J),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:D}=await n("stx/computed",()=>import("./chunk-6tqbgd20.js"));Q=R(Q,Z,J),Q=D(Q,Z,J);let{processFormValidationDirectives:M}=await n("stx/forms-validation",()=>import("./chunk-gbewds58.js"));Q=M(Q,Z,J);let{processHeadDirective:I,processTitleDirective:N,processMetaDirective:A,resetHead:T}=await n("stx/head",()=>import("./chunk-29hfy1xw.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)T();let k=I(Q);if(Q=k.content,k.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${k.headContent}
|
|
3585
3585
|
`;if(Q=N(Q,Z),Q=A(Q,Z),Q=u4(Q),Q=R5(Q,Z),Q=C7(Q),Q=f4(Q),Q=await J$(Q,Z,J,G,Y),Q=await $$(Q,Z,J,G,Y),Z.__stxProcessingDepth===1)Q=t$(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=b$(Q),Q=$1(Q,Z,J),Q=T3(Q,Z,{filePath:J,buildMode:G.buildMode}),Q=D5(Q,Z),Q=N5(Q,Z),Q=V2(Q,Z),Q=b5(Q,Z),Q=y5(Q,Z),Q=await F7(Q,Z,J,G),Q=await v3(Q,Z,J),Q=await Q8(Q,Z,J,G),Q=G8(Q,Z,J,G),Q=Y7(Q,Z,J,G),Q=Q7(Q,Z,J),Q=G7(Q,Z,J,G),Q=b7(Q,Z,J,G),Q=T$(Q,Z),Q=E$(Q),Q=c6(Q),!G.skipEventDirectives)Q=r$(Q,Z,J);if(Q=y3(Q,Z,J),G.debug){let i=/\bx-data\s*=/.test(Q),l=k$($);if(i&&l)console.warn(`[stx] ${J}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
3586
3586
|
Both work on the same page, but they manage separate scopes.
|
|
3587
3587
|
Prefer signals (state/derived/effect) for new components.`)}Q=H4(Q,Z),Q=await _1(Q,Z,J),Q=i6(Q),Q=n6(Q),Q=L3(Q);let{processXElementDirectives:y}=await n("stx/x-element",()=>import("./chunk-psraz70k.js"));Q=y(Q);let E=Z.__originalFilePath||J,b=T9(Z);if(Q=await x6(Q,G,E,b),Q=x7(Q,Z),Q=await h4(Q,Z,J,G),G.media?.image?.autoSiblings){let i=G.publicDir||"public",{rewriteImagesWithSiblings:l}=await n("stx/image-optimization/auto-sibling",()=>import("./chunk-f57xky9r.js"));Q=await l(Q,{publicDir:i})}if(G.seo?.enabled)Q=z7(Q,Z,G);let C=(i,l,K0=!0)=>{if(!l)return i;let J0=l.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),B0=i.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(J0&&B0){if(K0)i=i.replace(B0[0],J0[0]);if(l=l.replace(J0[0],"").trim(),!l)return i}if(/<\/head>/i.test(i))return i.replace(/<\/head>/i,`${l}
|
|
@@ -3595,7 +3595,7 @@ ${j3()}
|
|
|
3595
3595
|
`+L1}else Q=Q.replace("</head>",`${l}
|
|
3596
3596
|
</head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
|
|
3597
3597
|
${l}`);else Q=l+`
|
|
3598
|
-
`+Q}{let{scanScriptTags:i}=await n("stx/signal-processing",()=>import("./chunk-
|
|
3598
|
+
`+Q}{let{scanScriptTags:i}=await n("stx/signal-processing",()=>import("./chunk-ps3n1bvh.js")),l=[];for(let K0 of i(Q)){if(!/\bserver\b/i.test(K0.attrs))continue;let J0=K0.start+K0.fullMatch.indexOf(">")+1,B0=BG(Q,J0);if(B0===-1)continue;let I0=B0+9;while(I0<Q.length&&/\s/.test(Q[I0]))I0++;l.push({start:K0.start,end:I0})}if(l.length>0){let K0=Array(l.length+1),J0=0;for(let B0=0;B0<l.length;B0++){let{start:I0,end:L1}=l[B0];K0[B0]=Q.slice(J0,I0),J0=L1}K0[l.length]=Q.slice(J0),Q=K0.join("")}}let y0=w9(Q,J);if(y0.hasScoped)Q=y0.html;let Z0=Z.__stx_event_bindings||[],j0=!1,k0=[],f0=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:d0}=await n("stx/signal-processing",()=>import("./chunk-ps3n1bvh.js"));for(let i of d0(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))k0.push({match:i.fullMatch,attrs:i.attrs,content:i.body});for(let{match:i,attrs:l,content:K0}of k0){j0=!0;let J0=K0;C$(K0,J,X.strict,Z.__originalFilePath);let B0=await E9(K0,{eventBindings:Z0,attrs:l,hasColonDirectives:f0,templateContent:$,filePath:J,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:b});Q=Q.replace(i,()=>B0)}if(j0)Z.__stx_event_bindings=[];if(!j0&&Z.__stxProcessingDepth===1){let i=Z.__stx_event_bindings||[];if(i.length>0){let l=f9(i);if(l){let K0=Q.lastIndexOf("</body>");Q=K0===-1?Q+l:Q.slice(0,K0)+l+`
|
|
3599
3599
|
`+Q.slice(K0)}Z.__stx_event_bindings=[]}}if(!D6(Q)&&N6(Q))Q=await M9(Q,G);if(Q=M6(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=E7(Q,Z.cspNonce);return Q}var DG=[{open:"@if",close:"@endif",name:"if"},{open:"@unless",close:"@endunless",name:"unless"},{open:"@foreach",close:"@endforeach",name:"foreach"},{open:"@for",close:"@endfor",name:"for"},{open:"@while",close:"@endwhile",name:"while"},{open:"@forelse",close:"@endforelse",name:"forelse"},{open:"@switch",close:"@endswitch",name:"switch"},{open:"@isset",close:"@endisset",name:"isset"},{open:"@empty",close:"@endempty",name:"empty"},{open:"@auth",close:"@endauth",name:"auth"},{open:"@guest",close:"@endguest",name:"guest"},{open:"@can",close:"@endcan",name:"can"},{open:"@cannot",close:"@endcannot",name:"cannot"},{open:"@section",close:"@endsection",name:"section",altClose:"@show"},{open:"@push",close:"@endpush",name:"push"},{open:"@prepend",close:"@endprepend",name:"prepend"},{open:"@once",close:"@endonce",name:"once"},{open:"@markdown",close:"@endmarkdown",name:"markdown"},{open:"@component",close:"@endcomponent",name:"component"}],NG=[{pattern:/@if\s*[^(]/,message:"@if directive missing parentheses",suggestion:"Use @if(condition)"},{pattern:/@foreach\s*[^(]/,message:"@foreach directive missing parentheses",suggestion:"Use @foreach(items as item)"},{pattern:/@foreach\([^)]*\)\s*[^@\n<]/,message:"@foreach may have content on same line",suggestion:"Put content on new line after @foreach()"},{pattern:/@include\s*[^(]/,message:"@include directive missing parentheses",suggestion:"Use @include('partial-name')"},{pattern:/@extends\s*[^(]/,message:"@extends directive missing parentheses",suggestion:"Use @extends('layout-name') or @layout('layout-name')"},{pattern:/@layout\s*[^(]/,message:"@layout directive missing parentheses",suggestion:"Use @layout('layout-name')"}],MG=[{pattern:/\{\{\s*constructor\s*\}\}/,message:"Attempting to access constructor property"},{pattern:/\{\{\s*__proto__\s*\}\}/,message:"Attempting to access __proto__ property"},{pattern:/\{\{\s*eval\s*\(/,message:"Attempting to use eval in expression"}];function AG($){let Z=[],J=[];return kG($,Z),IG($,Z,J),TG($,J),EG($,Z),{valid:Z.length===0,errors:Z,warnings:J}}function kG($,Z){let J=($.match(/\{\{/g)||[]).length,X=($.match(/\}\}/g)||[]).length;if(J!==X)Z.push({type:"expression",message:`Unclosed expression brackets: found ${J} opening '{{' and ${X} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function IG($,Z,J){for(let X of DG){let Y=new RegExp(`${X.open}(?:\\s|\\()`,"g"),Q=new RegExp(X.close,"g"),G=($.match(Y)||[]).length,z=($.match(Q)||[]).length;if(X.altClose){let q=new RegExp(X.altClose,"g");z+=($.match(q)||[]).length}if(G>z)Z.push({type:"directive",message:`Unclosed @${X.name} directive: found ${G} opening and ${z} closing`,suggestion:`Add ${G-z} missing ${X.close} tag(s)`});else if(z>G)J.push({type:"directive",message:`Extra ${X.close} found: ${z-G} more closing than opening`,suggestion:`Check for orphaned ${X.close} tags`})}}function TG($,Z){for(let J of NG)if(J.pattern.test($))Z.push({type:"syntax",message:J.message,suggestion:J.suggestion})}function EG($,Z){for(let J of MG)if(J.pattern.test($))Z.push({type:"expression",message:`Security warning: ${J.message}`,suggestion:"Remove dangerous code from template expressions"})}function bG($,Z){let J=$.slice(0,Z).split(`
|
|
3600
3600
|
`);return{line:J.length,column:J[J.length-1].length+1}}function yG($,Z,J){let X=[];switch($){case"if":case"elseif":case"unless":if(J.length===0)X.push({type:"syntax",message:`@${$} requires a condition`,suggestion:`Use @${$}(condition)`});break;case"foreach":if(J.length===0||!J[0].includes(" as "))X.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(J.length===0)X.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(J.length===0)X.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(J.length===0)X.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(J.length===0)X.push({type:"syntax",message:`@${$} requires a path`,suggestion:`Use @${$}('path/to/template')`});break}return X}function CG($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function PG($){let Z=$.matchAll(/@([a-z]+)/gi),J=new Set;for(let X of Z){let Y=X[1].toLowerCase();if(!Y.startsWith("end"))J.add(Y)}return Array.from(J)}import s0 from"path";import J2 from"process";var D8=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","setResponseStatus","setResponseHeader","notFound","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"],j8=new Set(D8),SG=new Set(["props","$props","defineProps"]),vG=new Set(["stx","@stacksjs/stx"]),B8=T1(128),V8=T1(64);function fG($){let Z=[],J=0,X=$.split(`
|
|
3601
3601
|
`);for(let Y of X){let Q=J,G=null,z=!1;for(let q=0;q<Y.length;q++){let K=Y[q];if(z){z=!1;continue}if(K==="\\"){z=!0;continue}if(G){if(K===G)G=null;continue}if(K==="'"||K==='"'||K==="`"){G=K;continue}if(K==="/"&&q+1<Y.length&&Y[q+1]==="/")break;if(K==="{")J++;else if(K==="}")J--}if(Q===0){let q=Y.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Y)){let K=Y.match(/(?:const|let|var)\s+(\w+)/);if(K)Z.push(K[1])}else{let K=Y.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(K){let W=K[1].slice(1,-1).split(",").map((H)=>{let j=H.split(":");return(j.length>1?j[1]:j[0]).trim()}).filter((H)=>/^\w+$/.test(H));Z.push(...W)}}}}return[...new Set(Z)]}function xG($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function J(X){if(!X.includes(":"))return X;let Y=[],Q="",G=0,z=0,q=null;for(let K=0;K<X.length;K++){let U=X[K];if(q){if(Q+=U,U===q)q=null;continue}if(U==='"'||U==="'"||U==="`"){q=U,Q+=U;continue}if(U==="<")G++;else if(U===">"&&G>0)G--;else if(U==="(")z++;else if(U===")")z--;if(U===","&&G===0&&z===0){Y.push(Q),Q="";continue}Q+=U}if(Q)Y.push(Q);return Y.map((K)=>{let U=K.trim(),W=U.startsWith("..."),H=W?U.slice(3):U,j=-1,B=0;for(let R=0;R<H.length;R++)if(H[R]==="<")B++;else if(H[R]===">")B--;else if(H[R]===":"&&B===0){j=R;break}if(j===-1)return K;let F=H.substring(0,j).trim().replace(/\?$/,""),_=H.substring(j+1),O=-1,L=0;for(let R=0;R<_.length;R++)if(_[R]==="<")L++;else if(_[R]===">")L--;else if(_[R]==="="&&L===0){O=R;break}let w=W?"...":"";if(O!==-1)return`${w}${F} = ${_.substring(O+1).trim()}`;return`${w}${F}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,Y,Q)=>{if(!Q.includes(":"))return X;return`${Y}(${J(Q)})`});{let X=/\b(function\s+\w*\s*)\(/g,Y,Q=[];while((Y=X.exec(Z))!==null){let G=Y.index+Y[0].length-1,z=1,q=G+1,K=0,U=null;while(q<Z.length&&z>0){let j=Z[q];if(U){if(j===U)U=null;q++;continue}if(j==='"'||j==="'"||j==="`"){U=j,q++;continue}if(j==="<")K++;else if(j===">"&&K>0)K--;else if(K===0){if(j==="(")z++;else if(j===")")z--}if(z>0)q++}if(z!==0)continue;let W=Z.substring(G+1,q);if(!W.includes(":"))continue;let H=J(W);Q.push({start:G+1,end:q,replacement:H})}for(let G=Q.length-1;G>=0;G--){let{start:z,end:q,replacement:K}=Q[G];Z=Z.substring(0,z)+K+Z.substring(q)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(X,Y)=>{if(!Y.includes(":"))return X;if(Y.includes("{")||Y.includes("}"))return X;return`(${Y.split(",").map((G)=>{let[z,...q]=G.split("="),K=z.split(":")[0].trim();if(q.length>0)return`${K} = ${q.join("=").trim()}`;return K}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
|
|
@@ -3617,11 +3617,11 @@ ${$[K]}`,K++;else break}return q=q.trim().replace(/;$/,""),{type:Q,name:G,value:
|
|
|
3617
3617
|
${Q}`,Y++}while(Y<$.length){let Q=$[Y].trim();if(Q.startsWith(".")||Q.startsWith("?."))X+=`
|
|
3618
3618
|
${$[Y]}`,Y++;else break}return{value:X,nextIndex:Y}}function nG($,Z,J){let X=J,Y=Z+1;while(Y<$.length){let Q=I8(X);if(Q!==-1){if(_0(X,"{","}",Q)!==-1)break}let G=$[Y];X+=`
|
|
3619
3619
|
${G}`,Y++}return{functionCode:X,nextIndex:Y}}function w8($,Z){let J=$0($,Z)??$0(`(${$})`,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 oG($,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 q=z.trim().replace(/;$/,""),K=w8(q,Z);if(K!==void 0)Z[G]=K}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}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 q=z.trim().replace(/;$/,""),K=w8(q,Z);if(K!==void 0)Z[G]=K}catch{}}}function sG($){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 rG($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var A2=new o1(500),y9=new o1(1000),P8=33554432,g$=P8;function tG($){let Z=$.componentRenderCacheBytes;if(typeof Z!=="number"||Z<0||Z===g$)return;g$=Z,C9.setMaxBytes(Z)}var C9=new o1(2000,{maxBytes:P8,sizeOf:($)=>$.output.length});function eG($){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 T8($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function $z($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function A1($){return!$z($)}var b9=new Map;function f$($){let Z;try{Z=JSON.stringify($)}catch{return new Bun.Transpiler($)}let J=b9.get(Z);if(J)return J;if(b9.size>=16)b9.clear();let X=new Bun.Transpiler($);return b9.set(Z,X),X}var E8=new WeakMap,Zz=256;function k1($){try{let Z=f$({loader:"ts",target:"browser",define:$2()}),J=E8.get(Z);if(!J)J=new Map,E8.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 q=Q.length;return Q.push(z),`"__STX_EXPR_${q}__"`}),Y=Y.replace(/\{\{\{[\s\S]*?\}\}\}/g,(z)=>{let q=Q.length;return Q.push(z),`"__STX_EXPR_${q}__"`}),Y=Y.replace(/\{\{[\s\S]*?\}\}/g,(z)=>{let q=Q.length;return Q.push(z),`"__STX_EXPR_${q}__"`});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>=Zz){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 Jz($){let Z=[],J=new Set,X=0,Y=0,Q=$.length,G=(U)=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]===U){Y++;return}Y++}},z=()=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;return}if($[Y]==="$"&&$[Y+1]==="{"){Y+=2;let U=1;while(Y<Q&&U>0)if($[Y]==="{")U++,Y++;else if($[Y]==="}")U--,Y++;else if($[Y]==="'"||$[Y]==='"')G($[Y]);else if($[Y]==="`")z();else Y++;continue}Y++}},q=()=>{if($[Y]==="/"&&$[Y+1]==="/"){while(Y<Q&&$[Y]!==`
|
|
3620
|
-
`)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},K=()=>{if(X!==0)return;let U=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let B=U[2].split(",").map((V)=>{let F=V.trim().split(":");return F[F.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 W=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(W){let B=W[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(q())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])))K();Y++}return Z}function Xz($){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 Yz($){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 Qz($,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 q=$[X];if(q==="}")Q++;else if(q==="{"){if(Q--,Q===0){G=X;break}}}if(G===-1)return;let z=$.slice(G+1,Y);for(let q of Xz(z)){let K=q.trim();if(!K||K.startsWith("..."))continue;let U=Yz(K);if(U===-1)continue;let W=K.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(W))continue;if(Z[W]!==void 0)continue;let H=K.slice(U+1).trim();if(!H)continue;try{let j=Object.keys(Z).filter(X2),B=Function(...j,`"use strict"; return (${H});`);Z[W]=B(...j.map((V)=>Z[V]))}catch{}}}catch{}}async function K9($,Z,J,X,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(F)=>F.split("-").map((_)=>_.charAt(0).toUpperCase()+_.slice(1)).join(""),z=(F)=>F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=J.__importedComponents;if(q){for(let F of[Q,Q.toLowerCase(),G(Q),z(Q)])if(q.has(F))return!0}let K=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${z(Q)}.stx`])],U=typeof Y.root==="string"?h.resolve(Y.root):void 0,W=U??h.dirname(X),H=[],j=(F)=>{if(F&&!H.includes(F))H.push(F)},B=J.__originalFilePath;if(B)j(h.join(h.dirname(B),"components"));if(j(Z),j(Y._rootComponentsDir),j(h.join(h.dirname(X),"components")),j(Y.componentsDir),U)j(h.resolve(U,"resources/views/components")),j(h.resolve(U,"resources/components")),j(h.resolve(U,"src/components")),j(h.resolve(U,"components"));let V=Y._pluginComponentDirs;if(Array.isArray(V))for(let F of V)j(typeof F==="string"?F:null);if(j(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return s(h.resolve(h.dirname(X),`${Q}.stx`));for(let F of H){let _=h.isAbsolute(F)?F:h.resolve(W,F);for(let O of K)if(await s(h.join(_,O)))return!0}return!1}function Gz($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function zz($){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 qz($){let Z=new Set,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|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 M1($,Z,J,X,Y,Q,G,z=new Set,q){let{extractVariables:K}=await n("stx/variable-extractor",()=>import("./chunk-
|
|
3620
|
+
`)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},K=()=>{if(X!==0)return;let U=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let B=U[2].split(",").map((V)=>{let F=V.trim().split(":");return F[F.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 W=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(W){let B=W[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(q())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])))K();Y++}return Z}function Xz($){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 Yz($){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 Qz($,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 q=$[X];if(q==="}")Q++;else if(q==="{"){if(Q--,Q===0){G=X;break}}}if(G===-1)return;let z=$.slice(G+1,Y);for(let q of Xz(z)){let K=q.trim();if(!K||K.startsWith("..."))continue;let U=Yz(K);if(U===-1)continue;let W=K.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(W))continue;if(Z[W]!==void 0)continue;let H=K.slice(U+1).trim();if(!H)continue;try{let j=Object.keys(Z).filter(X2),B=Function(...j,`"use strict"; return (${H});`);Z[W]=B(...j.map((V)=>Z[V]))}catch{}}}catch{}}async function K9($,Z,J,X,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(F)=>F.split("-").map((_)=>_.charAt(0).toUpperCase()+_.slice(1)).join(""),z=(F)=>F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=J.__importedComponents;if(q){for(let F of[Q,Q.toLowerCase(),G(Q),z(Q)])if(q.has(F))return!0}let K=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${z(Q)}.stx`])],U=typeof Y.root==="string"?h.resolve(Y.root):void 0,W=U??h.dirname(X),H=[],j=(F)=>{if(F&&!H.includes(F))H.push(F)},B=J.__originalFilePath;if(B)j(h.join(h.dirname(B),"components"));if(j(Z),j(Y._rootComponentsDir),j(h.join(h.dirname(X),"components")),j(Y.componentsDir),U)j(h.resolve(U,"resources/views/components")),j(h.resolve(U,"resources/components")),j(h.resolve(U,"src/components")),j(h.resolve(U,"components"));let V=Y._pluginComponentDirs;if(Array.isArray(V))for(let F of V)j(typeof F==="string"?F:null);if(j(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return s(h.resolve(h.dirname(X),`${Q}.stx`));for(let F of H){let _=h.isAbsolute(F)?F:h.resolve(W,F);for(let O of K)if(await s(h.join(_,O)))return!0}return!1}function Gz($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function zz($){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 qz($){let Z=new Set,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|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 M1($,Z,J,X,Y,Q,G,z=new Set,q){let{extractVariables:K}=await n("stx/variable-extractor",()=>import("./chunk-s5phwqxc.js")),U=z??new Set;if(U.has($))return`[Circular component reference: ${$}]`;let W=new Set(U);W.add($);let H=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let j=H&&H!=="load"&&Gz(H)?H:"";try{let B=(d)=>d.split("-").map((m)=>m.charAt(0).toUpperCase()+m.slice(1)).join(""),V=(d)=>d.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),F=$.endsWith(".stx")?$.slice(0,-4):$,_=null,O=Y.__importedComponents;if(O){let d=[F,F.toLowerCase(),B(F),V(F)];for(let m of d)if(O.has(m)){_=O.get(m);break}}let L=[];if(!_){let d=[`${F}.stx`,`${B(F)}.stx`,`${V(F)}.stx`],m=[...new Set(d)],z0=Y.__originalFilePath,o=[];if(z0){let L0=h.join(h.dirname(z0),"components");o.push(L0)}if(X)o.push(X);let V0=G._rootComponentsDir;if(typeof V0==="string"&&!o.includes(V0))o.push(V0);let w0=h.join(h.dirname(Q),"components");if(!o.includes(w0))o.push(w0);if(G.componentsDir&&G.componentsDir!==X&&!o.includes(G.componentsDir))o.push(G.componentsDir);let C0=typeof G.root==="string"?h.resolve(G.root):void 0,a0=C0??h.dirname(Q),b0=[];if(C0)b0.push(h.resolve(C0,"resources/views/components")),b0.push(h.resolve(C0,"resources/components")),b0.push(h.resolve(C0,"src/components")),b0.push(h.resolve(C0,"components"));b0.push(h.resolve(import.meta.dir,"components"));for(let L0 of b0)if(!o.includes(L0))o.push(L0);let c0=G._pluginComponentDirs;if(Array.isArray(c0)){for(let L0 of c0)if(typeof L0==="string"&&!o.includes(L0))o.push(L0)}if(G.fallbackComponentsDir&&!o.includes(G.fallbackComponentsDir))o.push(G.fallbackComponentsDir);let X1=[...new Set(o.map((L0)=>{if(!L0)return L0;return h.isAbsolute(L0)?L0:h.resolve(a0,L0)}))];o.length=0,o.push(...X1);let a=`${F}\x00${Q}\x00${X1.join("\x00")}`,t0=y9.get(a);if(t0)if(await s(t0))_=t0;else y9.delete(a);if(!_&&(F.startsWith("./")||F.startsWith("../")))_=h.resolve(h.dirname(Q),`${F}.stx`),L.push(_);else if(!_)for(let L0 of o){if(!L0)continue;for(let E2 of m){let b2=h.join(L0,E2);if(L.push(b2),await s(b2)){_=b2;break}}if(_)break;if(!_)try{let E2=await import("fs");if(!E2.statSync(L0,{throwIfNoEntry:!1})?.isDirectory())continue;let c8=8,P9=[{path:L0,depth:0}];while(P9.length>0&&!_){let y2=P9.pop();if(y2.depth>=c8)continue;let m$;try{m$=E2.readdirSync(y2.path,{withFileTypes:!0})}catch{continue}for(let C2 of m$){if(!C2.isDirectory())continue;if(C2.name==="node_modules"||C2.name.startsWith("."))continue;let l$=h.join(y2.path,C2.name);for(let p8 of m){let S9=h.join(l$,p8);if(L.push(S9),await s(S9)){_=S9;break}}if(_)break;P9.push({path:l$,depth:y2.depth+1})}}}catch{}if(_)break}if(_)y9.set(a,_)}if(!_||!await s(_)){let d=L.length>0?`
|
|
3621
3621
|
Searched paths:
|
|
3622
3622
|
${L.map((m)=>` - ${m}`).join(`
|
|
3623
|
-
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${d}`}q.add(_);let w;if(A2.has(_))w=A2.get(_);else try{w=await Bun.file(_).text(),A2.set(_,w)}catch(d){return`[Error loading component: ${d instanceof Error?d.message:String(d)}]`}let R=new Set(["__originalFilePath","__importedComponents",P2,"__stx_client_signal_names","__stxServeContext","__stx_scope_seq"]),D={};for(let[d,m]of Object.entries(Y))if(!d.startsWith("__")||R.has(d))D[d]=m;let M=J;if(J.includes("@include")){let{processIncludes:d}=await n("stx/includes",()=>import("./chunk-
|
|
3624
|
-
`)}`}if(J&&J0.includes("{{ text || slot }}"))J0=J0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{applySlots:B0}=await n("stx/slots",()=>import("./chunk-
|
|
3623
|
+
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${d}`}q.add(_);let w;if(A2.has(_))w=A2.get(_);else try{w=await Bun.file(_).text(),A2.set(_,w)}catch(d){return`[Error loading component: ${d instanceof Error?d.message:String(d)}]`}let R=new Set(["__originalFilePath","__importedComponents",P2,"__stx_client_signal_names","__stxServeContext","__stx_scope_seq"]),D={};for(let[d,m]of Object.entries(Y))if(!d.startsWith("__")||R.has(d))D[d]=m;let M=J;if(J.includes("@include")){let{processIncludes:d}=await n("stx/includes",()=>import("./chunk-vedg19rq.js"));M=await d(J,Y,Q,G,q)}let I=i0(M),N=[],A=I.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(d,m)=>{let z0=I.scripts[Number(m)]||"",o=z0.match(/^<script\b([^>]*)>/i)?.[1]||"",V0=o.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),w0=!V0||["module","text/javascript","application/javascript"].includes(V0);if(!/\bserver\b/i.test(o)&&w0)return N.push(z0),"";return z0}),{extractSlotContent:T}=await n("stx/slots",()=>import("./chunk-msc8zy8k.js")),k=T(A),y={};if(k.defaultSlot?.trim())y.default=k.defaultSlot;for(let[d,m]of k.namedSlots)y[d]=m.content;let E=Y.__stx_scope_seq??={n:0,key:Bun.hash(String(Y.__filename??Q)).toString(36).slice(0,6)},b=`stx_${F.replace(/[^a-zA-Z0-9]/g,"_")}_${++E.n}_${E.key}`,C={...D,$uid:b,...Z,props:Z,slot:A,$slots:y,__processedComponents:W,__sections:{},__stx_signals_gate:Q1(w)||zz(J)};Qz(w,C);let v=w,S=X9(v);if(S)v=S.content.trim();let g=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,f=[...w.matchAll(g)],r=[],r0=f.some((d)=>/\bserver\b/.test(d[1]||"")&&/\bcache\b/.test(d[1]||"")),A0=null,y0=null,Z0=null,j0=0,k0=null;if(tG(G),r0&&g$>0){let d=eG({props:Z,slot:J,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0,uid:b});if(d!==null){A0=`${_}\x00${V1(w)}\x00${d}`;let m=C9.get(A0);if(m){for(let z0 of m.dependencies)q.add(z0);if(Z3(Y,m.clientFactories),E.n+=m.uidsConsumed,m.preservedClientExpressions.length>0){let z0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let o of m.preservedClientExpressions)z0.add(o);Y.__stx_preserved_client_expressions=[...z0]}return m.output}y0=new Set(q),Z0=e$(Y),j0=E.n,k0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[])}}for(let d of f){let m=d[1]||"",z0=d[2]||"",o=m.includes("server");if(A1(m)&&z0.trim())z0=k1(z0);if(o&&z0)try{await K(z0,C,_)}catch(w0){}if(!o){let w0=z0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),C0=w0.includes("{{")&&w0.includes("}}"),a0=w0.includes("{!!")&&w0.includes("!!}");if(C0||a0)w0=c9(w0,C);let b0=m.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");r.push(`<script${b0}>${w0}</script>`)}}let f0=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),d0=f0?f0[1]:"",i=f0?f0[2]:"",l="",K0=d0&&/\bscoped\b/i.test(d0);if(f0)l=`<style${d0}>${i}</style>`;let J0=v;if(J0=J0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),f0)J0=J0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let d=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,m=[];if(J0=J0.replace(d,(z0,o)=>{let V0=o.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(V0)m.push(`<style${V0[1]}>${V0[2]}</style>`);return""}),J0=J0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),m.length>0)l=`${l}${m.join(`
|
|
3624
|
+
`)}`}if(J&&J0.includes("{{ text || slot }}"))J0=J0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{applySlots:B0}=await n("stx/slots",()=>import("./chunk-msc8zy8k.js")),{defaultSlot:I0,namedSlots:L1}=k;J0=await B0(J0,I0,L1,C);let I2=r.some((d)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(d)),T2=qz(r),P=Array.isArray(C.__stx_client_signal_names)?C.__stx_client_signal_names:[];if(T2.length>0||P.length>0)C.__stx_client_signal_names=[...new Set([...P,...T2])];let x={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:h.dirname(_),skipSignalsRuntime:!0,skipEventDirectives:I2||r.length===0,defaultLayout:void 0};C.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let c=await S$(J0,C,_,x,q),e=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let d of c.matchAll(/\{\{([\s\S]*?)\}\}/g))e.add(d[1].trim());if(e.size>0)Y.__stx_preserved_client_expressions=[...e];let X0=b,Y0=c;if(I2){let d="";if(Object.keys(Z).length>0)try{d=` data-stx-props="${T8(JSON.stringify(Z))}"`}catch{}let m=j?` stx-hydrate="${T8(j)}"`:"";Y0=`<div data-stx-scope="${X0}"${d}${m}>${c}</div>`;let z0=await Promise.all(r.map(async(o)=>{let V0=o.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!V0)return o;let[,w0,C0]=V0,{vendorStyleTags:a0,factoryBody:b0}=await Wz(C0,_,G.buildMode==="compile"),c0=j?null:x9(Y,b0),X1=c0?`window.__stxComponentFactories[${JSON.stringify(c0)}](${JSON.stringify(X0)});`:`(${b0})(${JSON.stringify(X0)});`;if(j)return`${a0}<script type="stx/island" data-stx-island="${X0}" data-stx-scoped data-stx-owner="${X0}"${w0}>${X1}</script>`;return`${a0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${X0}"${w0}>${X1}</script>`}));if(Y0=Y0+`
|
|
3625
3625
|
`+z0.join(`
|
|
3626
3626
|
`),l)Y0+=`
|
|
3627
3627
|
`+l}else{if(l)Y0+=`
|
|
@@ -3644,7 +3644,7 @@ ${t.yellow}${t.bold}Message:${t.reset} ${Z}
|
|
|
3644
3644
|
`,z)U+=`
|
|
3645
3645
|
${t.blue}${t.bold}Context:${t.reset}
|
|
3646
3646
|
${t.dim}${z}${t.reset}
|
|
3647
|
-
`;return U}function zL(){A2.clear(),y9.clear(),C9.clear()}function qL(){return{size:A2.size,maxSize:500}}var x$=T1(128);async function Wz($,Z,J){let X=V1($,Z,J),Y=x$.get(X);if(Y){if(C8(Y.deps))return Y;x$.delete(X)}let Q=u$($,{filePath:Z,projectRoot:process.cwd()}),G=Q.code,z=d$(Q.styles);G=e1(G).code;let{hasUserImports:q,bundleClientScript:K}=await n("stx/client-script-bundler",()=>import("./chunk-
|
|
3647
|
+
`;return U}function zL(){A2.clear(),y9.clear(),C9.clear()}function qL(){return{size:A2.size,maxSize:500}}var x$=T1(128);async function Wz($,Z,J){let X=V1($,Z,J),Y=x$.get(X);if(Y){if(C8(Y.deps))return Y;x$.delete(X)}let Q=u$($,{filePath:Z,projectRoot:process.cwd()}),G=Q.code,z=d$(Q.styles);G=e1(G).code;let{hasUserImports:q,bundleClientScript:K}=await n("stx/client-script-bundler",()=>import("./chunk-5zdxwpr4.js")),U=[],W=!1;if(q(G)){let _=G;G=await K(_,Z,{projectRoot:process.cwd(),minify:J,collectInputs:U}),W=G===_}let{stripStxRuntimeImports:H}=await n("stx/signal-processing",()=>import("./chunk-ps3n1bvh.js"));G=H(G);let j=Z1(G),B=Jz(j),V=`function(__scopeId) {
|
|
3648
3648
|
${n1("const",[...b8,...B],j)}
|
|
3649
3649
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
3650
3650
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
@@ -3743,7 +3743,7 @@ else {
|
|
|
3743
3743
|
// STX: auto-generated event bindings
|
|
3744
3744
|
${$.map((J,X)=>Tz(J,X)).join(`
|
|
3745
3745
|
`)}`}function x8($){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 q=z;if(G++,q==="`"){let K=0;while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"&&K===0){G++;break}if(X[G]==="$"&&X[G+1]==="{"){K++,G+=2;continue}if(X[G]==="}"&&K>0){K--,G++;continue}G++}}else while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]===q){G++;break}G++}continue}if(z==="/"&&X[G+1]==="/"){while(G<Q&&X[G]!==`
|
|
3746
|
-
`)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 q=X.slice(G),K=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(K){let H=K[1];if(!H.startsWith("_")&&!J.has(H))Z.push(H),J.add(H);G+=K[0].length;continue}let U=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[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+=U[0].length;continue}let W=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(W){let H=W[1];if(!H.startsWith("_")&&!J.has(H))Z.push(H),J.add(H);G+=W[0].length;continue}}G++}return Z}var bz=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 yz($){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(!bz.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 q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=q.exec($))!==null)X(Q[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)X(Q[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=U.exec($))!==null)X(Q[1]);let W=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=W.exec($))!==null)X(Q[1]);return Z}async function E9($,Z={}){let J=$,X="",Y=!1,Q=[],G=u$(J,{filePath:Z.filePath,projectRoot:Z.projectRoot});J=G.code;let z=d$(G.styles),q=e1(J);J=q.code,Q=[...q.imports,...q.models];let{hasUserImports:K,bundleClientScript:U}=await n("stx/client-script-bundler",()=>import("./chunk-
|
|
3746
|
+
`)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 q=X.slice(G),K=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(K){let H=K[1];if(!H.startsWith("_")&&!J.has(H))Z.push(H),J.add(H);G+=K[0].length;continue}let U=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[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+=U[0].length;continue}let W=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(W){let H=W[1];if(!H.startsWith("_")&&!J.has(H))Z.push(H),J.add(H);G+=W[0].length;continue}}G++}return Z}var bz=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 yz($){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(!bz.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 q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=q.exec($))!==null)X(Q[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)X(Q[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=U.exec($))!==null)X(Q[1]);let W=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=W.exec($))!==null)X(Q[1]);return Z}async function E9($,Z={}){let J=$,X="",Y=!1,Q=[],G=u$(J,{filePath:Z.filePath,projectRoot:Z.projectRoot});J=G.code;let z=d$(G.styles),q=e1(J);J=q.code,Q=[...q.imports,...q.models];let{hasUserImports:K,bundleClientScript:U}=await n("stx/client-script-bundler",()=>import("./chunk-5zdxwpr4.js"));if(K(J))J=await U(J,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let L=m8(J);J=L.code,X=l8(L.stxImports,L.browserImports.filter((w)=>!Q.includes(w)))}if(X=`${A$(J,Z.serverData)}${X}`,J=Z1(J),!Y&&A1(Z.attrs||""))J=k1(J);let W=Ez(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 L=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),w=`type="module" data-stx-scoped${B}${L?` ${L}`:""}`;return`${z}<script ${w}>
|
|
3747
3747
|
${t1(`${X}${J}
|
|
3748
3748
|
${W}`)}
|
|
3749
3749
|
</script>`}let V=h8($),F=/function __stx_setup_/.test(J),_=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function O(L){let w=L.length>0?`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{hg as a,jg as JF,kg as ZF,lg as qF}from"./chunk-
|
|
2
|
+
import{hg as a,jg as JF,kg as ZF,lg as qF}from"./chunk-3y3vfypn.js";import{rg as p}from"./chunk-70z62b1s.js";import{sj as C,tj as D}from"./chunk-kp8ec2f4.js";import{Fk as QF,Gk as XF,Hk as YF}from"./chunk-xtx53xyz.js";import{Gp as FF,Kp as c,Mm as u,co as o,em as d,fr as n,gm as l,hr as N,jp as e,yp as t}from"./chunk-d93d47k0.js";import{Bt as r}from"./chunk-ama74dgk.js";import{bv as S,dv as WF}from"./chunk-jmh31a2a.js";import G from"fs";import Z from"path";import{createHash as $F}from"crypto";WF();function g(J){return $F("sha256").update(J).digest("hex").slice(0,8)}function f(J=!1){let q=J?D():C(),z=g(q);return{content:q,filename:`runtime.${z}.js`,hash:z}}function m(){let J=S(),q=g(J);return{content:J,filename:`router.${q}.js`,hash:q}}function UF(J){return{runtimeTag:J.runtime?`<script src="/__stx/${J.runtime.filename}"></script>`:"",routerTag:J.router?`<script src="/__stx/${J.router.filename}"></script>`:"",cssTag:J.css?`<link rel="stylesheet" href="/__stx/${J.css.filename}">`:""}}import h from"path";import{createHash as GF}from"crypto";function VF(J={}){let q=new Set;return{context:new Proxy(J,{get(Q,X){if(X in Q)return Q[X];if(typeof X==="string"&&!X.startsWith("__"))q.add(X);return},has(Q,X){if(X in Q)return!0;if(typeof X==="string"&&!X.startsWith("__"))q.add(X);return!1}}),accessedKeys:q}}async function i(J,q,z={}){let Q=h.resolve(J),X=await Bun.file(Q).text(),I=GF("sha256").update(X).digest("hex").slice(0,16);d();let K={};try{K=await N()}catch{}let B=[],V=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,k;while((k=V.exec(X))!==null){let $=k[1];if(/\bserver\b/.test($))B.push(k[2])}let W=new Set(B.flatMap(($)=>p($))),{context:w}=VF({__filename:Q,__dirname:h.dirname(Q),__stx_serverDeclared:W}),E=new Set,L={...n,...K,...z,buildMode:"compile",strict:!1},_=await c(X,w,Q,L,E),U=a(_),H=l();return{route:q,sourceFile:J,html:_,fragment:U,placeholders:H,hasServerScripts:B.length>0,serverScriptContent:B,dependencies:Array.from(E),contentHash:I,status:u(X),streamTemplates:w.__streamTemplates}}var kF=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function s(J,q){let z=0,Q=0;if(!G.existsSync(J))return{copied:z,bytes:Q};G.mkdirSync(q,{recursive:!0});function X(I,K){let B=G.readdirSync(I,{withFileTypes:!0});for(let V of B){if(kF.has(V.name))continue;let k=Z.join(I,V.name),W=Z.join(K,V.name);if(V.isDirectory())G.mkdirSync(W,{recursive:!0}),X(k,W);else if(V.isFile()){if(G.existsSync(W))continue;G.copyFileSync(k,W),z++,Q+=G.statSync(W).size}}}return X(J,q),{copied:z,bytes:Q}}async function dF(J={}){let q=Date.now(),z=Z.resolve(J.root||process.cwd()),Q=Z.resolve(z,J.outputDir||".output");console.log("[stx build] Starting production build...");let X={};try{X=await N()}catch{}let I=J.componentsDir??X.componentsDir??"components",K=J.partialsDir??X.partialsDir??"partials",B=J.layoutsDir??X.layoutsDir??"layouts",V=J.publicDir??X.publicDir??"public",k=X.app?.head||{},W=X.app?.colorMode,w=X.router?.container||"main";if(G.existsSync(Q))G.rmSync(Q,{recursive:!0});let E=[Z.join(Q,"public","__stx"),Z.join(Q,"public","assets"),Z.join(Q,"server","pages"),Z.join(Q,"server","fragments")];for(let Y of E)G.mkdirSync(Y,{recursive:!0});console.log("[stx build] Discovering routes...");let L=o(z),_=["components","layouts","partials"],U=L.filter((Y)=>{return!_.some((F)=>Y.pattern.startsWith(`/${F}/`)||Y.pattern===`/${F}`)});console.log(`[stx build] Found ${U.length} page routes (${L.length-U.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let H=f(J.debug),$=m();await Bun.write(Z.join(Q,"public","__stx",H.filename),H.content),await Bun.write(Z.join(Q,"public","__stx",$.filename),$.content),console.log(`[stx build] Runtime: ${H.filename} (${(H.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${$.filename} (${($.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let O=[],j=[];for(let Y of U)try{let F=await i(Y.filePath,Y.pattern,{componentsDir:I,partialsDir:K,layoutsDir:B,debug:J.debug});if(O.push(F),F.html=F.html.replace(/runtime\.__STX_HASH__\.js/g,H.filename).replace(/router\.__STX_HASH__\.js/g,$.filename),F.html=FF(F.html,k,{bodyScripts:[`<script src="/__stx/${$.filename}"></script>`],...W&&{colorMode:W}}),W)F.html=e(F.html,W);if(k.htmlAttrs)F.html=t(F.html,k.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(F.html)){let T=F.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(T&&T[1]){let P=T[1];F.html=F.html.replace(" "+P,""),F.html=F.html.replace(/<body([^>]*)>/,`<body$1 ${P}>`)}}F.html=F.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),F.html=await r(F.html),F.fragment=JF(F.html,w);let y=Y.pattern==="/"?"index":Y.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),b=Z.join("server","pages",`${y}.compiled.json`),A=Z.join("server","fragments",`${y}.html`);await Bun.write(Z.join(Q,b),JSON.stringify(F,null,2)),await Bun.write(Z.join(Q,A),F.fragment),j.push({pattern:Y.pattern,compiledPath:b,fragmentPath:A,isDynamic:F.hasServerScripts,hasParams:Y.pattern.includes(":")||Y.pattern.includes("[")}),console.log(`[stx build] \u2713 ${Y.pattern}`)}catch(F){console.error(`[stx build] \u2717 ${Y.pattern}:`,F instanceof Error?F.message:F)}let M=Z.resolve(z,V);if(G.existsSync(M)){let{copied:Y,bytes:F}=s(M,Z.join(Q,"public"));if(Y>0)console.log(`[stx build] Copied ${Y} public asset${Y===1?"":"s"} (${(F/1024).toFixed(1)}KB) from ${V}/`)}let v=YF(z);if(v){let{copied:Y,bytes:F}=s(v,Z.join(Q,"public",XF));if(Y>0)console.log(`[stx build] Copied ${Y} asset${Y===1?"":"s"} (${(F/1024).toFixed(1)}KB) from ${QF}/`)}let R={runtime:H.filename,router:$.filename},zF=ZF(j,R,Q);qF(zF,Q);let x=Date.now()-q;return console.log(`
|
|
3
3
|
[stx build] Done in ${x}ms \u2014 ${O.length} pages compiled`),{pageCount:O.length,assets:R,outputDir:Q,duration:x}}
|
|
4
4
|
export{g as Rf,f as Sf,m as Tf,UF as Uf,i as Vf,dF as Wf};
|