@stacksjs/stx 0.2.736 → 0.2.740
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-as108kr9.js → chunk-06jys4zk.js} +4 -4
- package/dist/{chunk-2t00wxz0.js → chunk-0ckh7cy1.js} +1 -1
- package/dist/{chunk-h1rq3935.js → chunk-0yewaggn.js} +6 -6
- package/dist/{chunk-hxy0qwqs.js → chunk-13tac9ac.js} +5 -5
- package/dist/chunk-1wak0s76.js +2 -0
- package/dist/{chunk-fv4s2yjf.js → chunk-26wrcfr7.js} +1 -1
- package/dist/{chunk-ez35607j.js → chunk-27agaezn.js} +2 -2
- package/dist/{chunk-nqfpvejh.js → chunk-2hrdh72h.js} +1 -1
- package/dist/chunk-2tt2whvk.js +2 -0
- package/dist/{chunk-j8r7r1wv.js → chunk-3f25fntg.js} +2 -2
- package/dist/chunk-3f4kf3fe.js +2 -0
- package/dist/{chunk-dnqzrktd.js → chunk-3kw9m62d.js} +2 -2
- package/dist/chunk-4yz476ss.js +2 -0
- package/dist/chunk-4z7bnc9j.js +2 -0
- package/dist/{chunk-pgz6yy2m.js → chunk-55qv90h9.js} +9 -9
- package/dist/{chunk-3fwdxxh1.js → chunk-5f6x6fyp.js} +4 -4
- package/dist/chunk-67xtpw2q.js +2 -0
- package/dist/chunk-6dz075xn.js +2 -0
- package/dist/{chunk-4c86wr9a.js → chunk-6ew10ptg.js} +2 -2
- package/dist/chunk-6vajjyj8.js +2 -0
- package/dist/chunk-75wdm7kd.js +2 -0
- package/dist/{chunk-x0014jes.js → chunk-7emrpfha.js} +6 -6
- package/dist/chunk-7vt4k3jv.js +2 -0
- package/dist/chunk-840t4gws.js +2 -0
- package/dist/{chunk-74fepz6h.js → chunk-888xnaex.js} +2 -2
- package/dist/{chunk-my4m7bk0.js → chunk-88kpnrgj.js} +1 -1
- package/dist/chunk-8bw9yd5m.js +2 -0
- package/dist/chunk-8nq4879f.js +2 -0
- package/dist/chunk-8qdrv49k.js +2 -0
- package/dist/{chunk-x9wwd2ee.js → chunk-91pycazt.js} +2 -2
- package/dist/{chunk-dhy6n39n.js → chunk-9bbs9d9q.js} +2 -2
- package/dist/{chunk-qf2aa8qe.js → chunk-9v98dzxt.js} +4 -4
- package/dist/{chunk-62awa752.js → chunk-9zrbhs3p.js} +1 -1
- package/dist/chunk-a0mze6dz.js +2 -0
- package/dist/chunk-af9ptz0x.js +2 -0
- package/dist/{chunk-s7q5wrsa.js → chunk-agxvydxe.js} +1 -1
- package/dist/chunk-aj6m4pqt.js +2 -0
- package/dist/{chunk-4hv1camf.js → chunk-amsbfc3y.js} +30 -30
- package/dist/{chunk-rj4j7qcj.js → chunk-amyxgejb.js} +1 -1
- package/dist/chunk-ascwd65c.js +2 -0
- package/dist/chunk-at0k9j3q.js +3 -0
- package/dist/{chunk-narz7105.js → chunk-b107z777.js} +2 -2
- package/dist/{chunk-1t0xwfy2.js → chunk-b4ejzx20.js} +18 -18
- package/dist/{chunk-agjysd2b.js → chunk-b8ryfxay.js} +1 -1
- package/dist/{chunk-xaddgvkx.js → chunk-byaasw3f.js} +2 -2
- package/dist/{chunk-630yrhzv.js → chunk-cka9p9v5.js} +2 -2
- package/dist/chunk-cmm2mkr1.js +2 -0
- package/dist/{chunk-3e40sm05.js → chunk-crk5dzxb.js} +4 -4
- package/dist/chunk-d4ahp771.js +2 -0
- package/dist/chunk-dw7ajrvf.js +2 -0
- package/dist/chunk-e2ar36jw.js +2 -0
- package/dist/{chunk-hez09ssh.js → chunk-e43cxztn.js} +2 -2
- package/dist/chunk-ejhd435r.js +2 -0
- package/dist/{chunk-r3j4m04w.js → chunk-eks1mjr3.js} +2 -2
- package/dist/chunk-eyekxtjn.js +2 -0
- package/dist/{chunk-6pqsf6tq.js → chunk-f17tdyp3.js} +5 -5
- package/dist/{chunk-hnmqnncv.js → chunk-f2yfe5e2.js} +1 -1
- package/dist/{chunk-jpfp8f5r.js → chunk-f6bpxqj9.js} +5 -5
- package/dist/{chunk-z7ry4w8w.js → chunk-fveqk208.js} +1 -1
- package/dist/{chunk-ph2yg39f.js → chunk-gwes6c9v.js} +1 -1
- package/dist/{chunk-3dyhn59d.js → chunk-gyvaz4cb.js} +1 -1
- package/dist/{chunk-qc93ce5h.js → chunk-h2y36t58.js} +2 -2
- package/dist/chunk-h4ab99hb.js +2 -0
- package/dist/{chunk-5cr84pp2.js → chunk-h58sctng.js} +4 -4
- package/dist/{chunk-79sjdpfy.js → chunk-h6jba844.js} +1 -1
- package/dist/chunk-h75rev1h.js +2 -0
- package/dist/chunk-h9140mn0.js +2 -0
- package/dist/chunk-hjatgram.js +2 -0
- package/dist/{chunk-y6964t7z.js → chunk-hq00hf2e.js} +3 -3
- package/dist/{chunk-r3hden6p.js → chunk-j3cbj356.js} +2 -2
- package/dist/chunk-j4gxcnd5.js +2 -0
- package/dist/{chunk-m5nzpjej.js → chunk-jeh671tw.js} +1 -1
- package/dist/chunk-jka3p99a.js +2 -0
- package/dist/{chunk-g2kfmmfa.js → chunk-jydd8cdc.js} +5 -5
- package/dist/chunk-k38vsxt8.js +2 -0
- package/dist/{chunk-88rftjjk.js → chunk-k8gxa1jf.js} +4 -4
- package/dist/chunk-kgxqj66x.js +2 -0
- package/dist/{chunk-2kz9d366.js → chunk-kjh118s3.js} +7 -7
- package/dist/{chunk-3xyvc3g1.js → chunk-kp2rkczm.js} +5 -5
- package/dist/chunk-m45r8w14.js +2 -0
- package/dist/{chunk-x5dc06p5.js → chunk-md36aysy.js} +6 -6
- package/dist/{chunk-h16qbyjd.js → chunk-n8mb6510.js} +2 -2
- package/dist/{chunk-q7fh1xka.js → chunk-njdppe81.js} +6 -6
- package/dist/{chunk-vvrn688m.js → chunk-nt3hva3f.js} +4 -4
- package/dist/{chunk-f2c3t1ky.js → chunk-nybty1zx.js} +2 -2
- package/dist/{chunk-rbmt5w9v.js → chunk-nzwcbt98.js} +2 -2
- package/dist/{chunk-3cwvp8vc.js → chunk-p766mk6b.js} +8 -8
- package/dist/{chunk-00y2xpfk.js → chunk-pwt6467e.js} +1 -1
- package/dist/chunk-pzm8bc99.js +2 -0
- package/dist/{chunk-05qf3e2p.js → chunk-q1db41k8.js} +3 -3
- package/dist/chunk-qjm2q9we.js +2 -0
- package/dist/{chunk-j28r2d0q.js → chunk-r2cfezt5.js} +2 -2
- package/dist/{chunk-018149qp.js → chunk-rner9txv.js} +2 -2
- package/dist/chunk-rpe1tskt.js +2 -0
- package/dist/{chunk-1dss61y2.js → chunk-rsfs0x3d.js} +1 -1
- package/dist/{chunk-arbhrz4x.js → chunk-rthn3eq6.js} +60 -60
- package/dist/{chunk-wnt00y7f.js → chunk-sc1wkke5.js} +12 -12
- package/dist/{chunk-e25aeftz.js → chunk-sj7hm8dm.js} +2 -2
- package/dist/{chunk-755wsp41.js → chunk-smq3x9a2.js} +27 -7
- package/dist/{chunk-zkx2m308.js → chunk-sv4d9jgf.js} +10 -10
- package/dist/{chunk-r1qcq029.js → chunk-t8ap5qet.js} +6 -6
- package/dist/chunk-tbgz73ta.js +2 -0
- package/dist/chunk-tpwxvpnt.js +2 -0
- package/dist/{chunk-hnqpqtk2.js → chunk-ttsrhr95.js} +6 -6
- package/dist/{chunk-dmnncw90.js → chunk-vtmd3ssd.js} +3 -3
- package/dist/chunk-vvbszwjs.js +2 -0
- package/dist/{chunk-mwxbdpb1.js → chunk-vyv76w55.js} +2 -2
- package/dist/chunk-w07kke19.js +2 -0
- package/dist/{chunk-serrx31a.js → chunk-w1sdxmx3.js} +2 -2
- package/dist/{chunk-39nkd53v.js → chunk-w34w1hrg.js} +2 -2
- package/dist/chunk-w6dyqh92.js +2 -0
- package/dist/{chunk-2mqzpzy7.js → chunk-w9are744.js} +4 -4
- package/dist/chunk-wbcqtpkm.js +2 -0
- package/dist/chunk-wy8er1ps.js +2 -0
- package/dist/chunk-wzkjzh7w.js +2 -0
- package/dist/{chunk-d9hw6n2d.js → chunk-x0c8xq0s.js} +3 -3
- package/dist/{chunk-eqxezwg4.js → chunk-x0vws901.js} +1 -1
- package/dist/{chunk-zqnttswy.js → chunk-xa8bzf00.js} +3 -3
- package/dist/chunk-xrspzeqx.js +2 -0
- package/dist/chunk-xt786nk0.js +2 -0
- package/dist/{chunk-v402swbm.js → chunk-xzv8t0nd.js} +1 -1
- package/dist/{chunk-z8jq4qe7.js → chunk-yvwesavg.js} +9 -9
- package/dist/{chunk-e3egwyax.js → chunk-yxtqk5p8.js} +2 -2
- package/dist/{chunk-9chqvq23.js → chunk-yygtmm7t.js} +3 -3
- package/dist/{chunk-np6gcwgs.js → chunk-yz4jpwp3.js} +19 -19
- package/dist/{chunk-h0xyzp7v.js → chunk-z82a0dpd.js} +3 -3
- package/dist/chunk-zgnqyta0.js +2 -0
- package/dist/chunk-zvfr6022.js +2 -0
- package/dist/{chunk-wk50m71x.js → chunk-zzeas8x5.js} +1 -1
- package/dist/cli.js +19 -19
- package/dist/client/signals-class-runtime.js +1 -0
- package/dist/client/signals-component-props-runtime.js +1 -0
- package/dist/client/signals-expression-compiler-runtime.js +8 -0
- package/dist/client/signals-expression-runtime.js +2 -1
- package/dist/client/signals-for-runtime.js +4 -2
- package/dist/client/signals-if-chain-runtime.js +1 -0
- package/dist/client/signals-if-runtime.js +2 -1
- package/dist/client/signals-model-runtime.js +1 -0
- package/dist/client/signals-process-element-runtime.js +2 -0
- package/dist/client/signals-show-runtime.js +1 -0
- package/dist/client/signals-style-runtime.js +1 -0
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/native/runtime/binding-diagnostics.d.ts +3 -0
- package/dist/native/runtime/binding-diagnostics.js +20 -0
- package/dist/native/runtime/shared-screen.js +2 -0
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +27 -27
- package/package.json +5 -5
- package/dist/chunk-0ajbe55p.js +0 -2
- package/dist/chunk-0ee76md1.js +0 -2
- package/dist/chunk-0g9a1kks.js +0 -2
- package/dist/chunk-1pgr2n0h.js +0 -2
- package/dist/chunk-2hpt1f4r.js +0 -2
- package/dist/chunk-336t7zzz.js +0 -2
- package/dist/chunk-362sjw8c.js +0 -2
- package/dist/chunk-3j8x8mhx.js +0 -2
- package/dist/chunk-3n3vmhtd.js +0 -2
- package/dist/chunk-5wpgbwap.js +0 -2
- package/dist/chunk-5zrz59dy.js +0 -2
- package/dist/chunk-6h1qa3hw.js +0 -2
- package/dist/chunk-6jn0p1a9.js +0 -2
- package/dist/chunk-6t78kw7s.js +0 -2
- package/dist/chunk-8w1ep4w3.js +0 -2
- package/dist/chunk-918xy0ra.js +0 -2
- package/dist/chunk-9q15h90v.js +0 -2
- package/dist/chunk-a0c2qg2b.js +0 -2
- package/dist/chunk-a49at1ah.js +0 -2
- package/dist/chunk-a64crz43.js +0 -2
- package/dist/chunk-ak04tgvw.js +0 -2
- package/dist/chunk-azatpcm0.js +0 -2
- package/dist/chunk-b2x1wd97.js +0 -2
- package/dist/chunk-c1481efw.js +0 -2
- package/dist/chunk-c8yrvpr7.js +0 -2
- package/dist/chunk-e18z6ntg.js +0 -2
- package/dist/chunk-ejhvxggz.js +0 -2
- package/dist/chunk-enpchwv1.js +0 -2
- package/dist/chunk-jbryd6s7.js +0 -3
- package/dist/chunk-jkqe35rg.js +0 -2
- package/dist/chunk-jresy8fn.js +0 -2
- package/dist/chunk-m6d2bq3y.js +0 -2
- package/dist/chunk-mt789hbw.js +0 -2
- package/dist/chunk-mvbw706e.js +0 -2
- package/dist/chunk-n14zxb4g.js +0 -2
- package/dist/chunk-nfg5tjn2.js +0 -2
- package/dist/chunk-nvtp22qp.js +0 -2
- package/dist/chunk-q6tmvtqq.js +0 -2
- package/dist/chunk-rgv7rjrs.js +0 -2
- package/dist/chunk-t98sz9rb.js +0 -2
- package/dist/chunk-tdvmf3ge.js +0 -2
- package/dist/chunk-vresxjg7.js +0 -2
- package/dist/chunk-w9qxsp09.js +0 -2
- package/dist/chunk-wke3dw59.js +0 -2
- package/dist/chunk-wva9vscy.js +0 -2
- package/dist/chunk-wy2kct6z.js +0 -2
- package/dist/chunk-xbc84n7q.js +0 -2
- package/dist/chunk-ysk3rmz2.js +0 -2
- package/dist/chunk-zx5wbfxd.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{qr}from"./chunk-
|
|
2
|
+
import{qr}from"./chunk-amsbfc3y.js";import{S}from"./chunk-rthn3eq6.js";import{a}from"./chunk-yvwesavg.js";import{We,re}from"./chunk-e43cxztn.js";import{Da}from"./chunk-06jys4zk.js";import{L}from"./chunk-f4gqzg1y.js";import{g}from"./chunk-0dve54ne.js";import{existsSync as F,mkdirSync as y,copyFileSync as P,chmodSync as I,rmSync as he}from"fs";import{join as c,basename as ve,resolve as G}from"path";import{spawn as z}from"child_process";import{platform as xe}from"os";function E(e,r,i){let n=new RegExp(`</${r}\\s*>`,"iy"),s=S(e,(t,o)=>(n.lastIndex=o,n.exec(t)?n.lastIndex:-1))[0];return s?e.slice(0,s.start)+i+e.slice(s.start):null}var Yl=`
|
|
3
3
|
<script>
|
|
4
4
|
(function() {
|
|
5
5
|
'use strict';
|
|
@@ -468,9 +468,9 @@ else if (data.type === 'event' && data.method) {
|
|
|
468
468
|
}
|
|
469
469
|
})();
|
|
470
470
|
</script>
|
|
471
|
-
`;function
|
|
471
|
+
`;function ia(e={}){let{debug:r=!1,timeout:i=30000}=e;return Yl.replace("debug: false,",`debug: ${r},`).replace("timeout: 30000",`timeout: ${i}`)}function Hm(){return!1}function Vm(e,r={}){let i=/@craft(?:\(([\s\S]*?)\))?/g;return e.replace(i,(n,s)=>{let t={};if(s)try{t=JSON.parse(s.replace(/'/g,'"'))}catch{try{t=Function(`return ${s}`)()}catch{console.warn(`[stx] Invalid @craft config: ${s}`)}}return ia(t)})}function aa(e,r={}){if(e.includes("__craftBridgeInitialized"))return e;let i=ia(r),n=E(e,"head",`${i}
|
|
472
472
|
`);if(n!==null)return n;let s=L(e);if(s){let t=s.index+s.tag.length;return e.slice(0,t)+`
|
|
473
|
-
${i}`+e.slice(t)}return i+e}var
|
|
473
|
+
${i}`+e.slice(t)}return i+e}var co={button:{nativeType:"craft-button",fallbackTag:"button",fallbackClasses:"craft-button",nativeProps:["variant","size","disabled","loading"]},"text-input":{nativeType:"craft-text-input",fallbackTag:"input",fallbackClasses:"craft-text-input",nativeProps:["placeholder","value","type","disabled","readonly"]},textarea:{nativeType:"craft-textarea",fallbackTag:"textarea",fallbackClasses:"craft-textarea",nativeProps:["placeholder","value","rows","disabled","readonly"]},checkbox:{nativeType:"craft-checkbox",fallbackTag:"input",fallbackClasses:"craft-checkbox",nativeProps:["checked","disabled","label"],render:(e,r)=>{let i=e.checked?"checked":"",n=e.disabled?"disabled":"";return`<label class="craft-checkbox-wrapper">
|
|
474
474
|
<input type="checkbox" class="craft-checkbox" ${i} ${n}>
|
|
475
475
|
<span class="craft-checkbox-label">${r||e.label||""}</span>
|
|
476
476
|
</label>`}},radio:{nativeType:"craft-radio",fallbackTag:"input",fallbackClasses:"craft-radio",nativeProps:["checked","disabled","name","value","label"]},select:{nativeType:"craft-select",fallbackTag:"select",fallbackClasses:"craft-select",nativeProps:["value","disabled","options","placeholder"]},slider:{nativeType:"craft-slider",fallbackTag:"input",fallbackClasses:"craft-slider",nativeProps:["value","min","max","step","disabled"],render:(e,r)=>{let i=e.min??0,n=e.max??100,s=e.step??1,t=e.value??50,o=e.disabled?"disabled":"";return`<input type="range" class="craft-slider" min="${i}" max="${n}" step="${s}" value="${t}" ${o}>`}},label:{nativeType:"craft-label",fallbackTag:"span",fallbackClasses:"craft-label",nativeProps:["text","for"]},badge:{nativeType:"craft-badge",fallbackTag:"span",fallbackClasses:"craft-badge",nativeProps:["variant","size"]},avatar:{nativeType:"craft-avatar",fallbackTag:"div",fallbackClasses:"craft-avatar",nativeProps:["src","alt","size","fallback"],render:(e,r)=>{let i=e.size||40,n=e.src,s=String(e.alt||""),t=e.fallback||(s?s.charAt(0).toUpperCase():"?");if(n)return`<img class="craft-avatar" src="${n}" alt="${s}" style="width:${i}px;height:${i}px;border-radius:50%">`;return`<div class="craft-avatar craft-avatar-fallback" style="width:${i}px;height:${i}px;border-radius:50%;display:flex;align-items:center;justify-content:center">${t}</div>`}},progress:{nativeType:"craft-progress",fallbackTag:"div",fallbackClasses:"craft-progress",nativeProps:["value","max","variant"],render:(e,r)=>{let i=Number(e.value)||0,n=Number(e.max)||100;return`<div class="craft-progress"><div class="craft-progress-bar" style="width:${Math.min(100,Math.max(0,i/n*100))}%"></div></div>`}},spinner:{nativeType:"craft-spinner",fallbackTag:"div",fallbackClasses:"craft-spinner",nativeProps:["size"],render:(e,r)=>{let i=e.size||24;return`<div class="craft-spinner" style="width:${i}px;height:${i}px"></div>`}},card:{nativeType:"craft-card",fallbackTag:"div",fallbackClasses:"craft-card",nativeProps:["title","subtitle","variant"]},modal:{nativeType:"craft-modal",fallbackTag:"dialog",fallbackClasses:"craft-modal",nativeProps:["open","title","closable","size"],render:(e,r)=>{let i=e.open?"open":"",n=e.title||"";return`<dialog class="craft-modal" ${i}>
|
|
@@ -902,7 +902,7 @@ ${i}`+e.slice(t)}return i+e}var ao={button:{nativeType:"craft-button",fallbackTa
|
|
|
902
902
|
}
|
|
903
903
|
}
|
|
904
904
|
</style>
|
|
905
|
-
`,
|
|
905
|
+
`,ca=`
|
|
906
906
|
<script id="craft-component-runtime">
|
|
907
907
|
(function() {
|
|
908
908
|
if (window.__stxCraftComponentRuntime) return;
|
|
@@ -1006,9 +1006,9 @@ ${i}`+e.slice(t)}return i+e}var ao={button:{nativeType:"craft-button",fallbackTa
|
|
|
1006
1006
|
document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
|
|
1007
1007
|
})();
|
|
1008
1008
|
</script>
|
|
1009
|
-
`;function
|
|
1010
|
-
`)??Wr+e;if(!e.includes("craft-component-runtime"))e=E(e,"body",`${
|
|
1011
|
-
`)??e+
|
|
1009
|
+
`;function la(e,r={}){let{classPrefix:i="craft"}=r;if(!e.includes("craft-component-styles"))e=E(e,"head",`${Wr}
|
|
1010
|
+
`)??Wr+e;if(!e.includes("craft-component-runtime"))e=E(e,"body",`${ca}
|
|
1011
|
+
`)??e+ca;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(n,s,t)=>A("sidebar",s,t.trim(),r,i)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(n,s)=>A("sidebar",s,"",r,i)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(n,s,t)=>A(s,t,"",r,i)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(n,s,t,o)=>A(s,t,o.trim(),r,i)),e}function A(e,r,i,n,s){let t=n.components?.[e]||co[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${s}-unknown" data-component="${e}">${i}</div>`;let o=N(r),d=[t.fallbackClasses||`${s}-${e}`];if(o.class)d.push(o.class),delete o.class;if(t.render)return o.__fallbackClasses=d.join(" "),t.render(o,i);let f=fe(o,t,d);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${f}>`;return`<${t.fallbackTag} ${f}>${i}</${t.fallbackTag}>`}function N(e){let r={},i=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,n;while((n=i.exec(e))!==null){let[s,t,o,d]=n,f=o??d;if(s.startsWith(":"))r[t]=f;else if(s.startsWith("@"))r[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=f;else if(f===void 0)r[t]=!0;else r[t]=f}return r}function ee(e,r){let i=B(String(e.id||`craft-sidebar-${le(r||JSON.stringify(e))}`)),n=oe(e.spaces)||se(r),s=n.length?[]:de(e.sections)||U(r),t=String(e.selectedSpace||n[0]?.id||""),o=n.find((v)=>v.id===t)||n[0],d=String(e.selectedItem||e.selected||(n.length?o?.sections[0]?.items[0]?.id:s[0]?.items[0]?.id)||""),f={id:i,variant:String(e.variant||"desktop"),material:String(e.material||"sidebar"),backgroundEffect:String(e.backgroundEffect||"shimmer"),allowsVibrancy:e.allowsVibrancy!==!1&&e.allowsVibrancy!=="false",materialOpacity:Number(e.materialOpacity??0.68),materialDarkOpacity:e.materialDarkOpacity===void 0?void 0:Number(e.materialDarkOpacity),minWidth:e.minWidth===void 0?240:Number(e.minWidth),maxWidth:e.maxWidth===void 0?340:Number(e.maxWidth),canCollapse:e.canCollapse!==!1&&e.canCollapse!=="false",searchPlaceholder:e.searchPlaceholder?String(e.searchPlaceholder):void 0,selectedItem:d,sections:s,spaces:n,selectedSpace:t||void 0},u=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),l=Number(e.width||e.sidebarWidth||286),p=e.native===!1||e.native==="false"?"false":"true",b=f.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${T(f.searchPlaceholder)}"></div>`:"",m;if(n.length)m=ce(n,t,d);else if(s.length)m=s.map((v)=>j(v,d)).join("");else m=r;return`<aside class="${x(u)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${x(i)}" data-native="${p}" style="--craft-sidebar-width:${l}px">
|
|
1012
1012
|
${b}
|
|
1013
1013
|
${m}
|
|
1014
1014
|
</aside>
|
|
@@ -1029,8 +1029,8 @@ ${i}`+e.slice(t)}return i+e}var ao={button:{nativeType:"craft-button",fallbackTa
|
|
|
1029
1029
|
${e.icon?`<span class="craft-sidebar-item-icon" data-icon="${x(e.icon)}"${i}></span>`:""}
|
|
1030
1030
|
<span class="craft-sidebar-item-label">${T(e.label)}</span>
|
|
1031
1031
|
${e.badge?`<span class="craft-sidebar-item-badge">${T(e.badge)}</span>`:""}
|
|
1032
|
-
</button>`}function B(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function le(e){let r=5381;for(let i=0;i<e.length;i++)r=r*33^e.charCodeAt(i);return(r>>>0).toString(36)}function T(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function x(e){return T(e).replace(/`/g,"`")}function ue(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function fe(e,r,i){let n=[];n.push(`class="${i.join(" ")}"`),n.push(`data-craft="${r.nativeType}"`);for(let[s,t]of Object.entries(e))if(t===!0)n.push(s);else if(t!==!1&&t!==void 0&&t!==null){let o=String(t).replace(/"/g,""");n.push(`${s}="${o}"`)}return n.join(" ")}function Um(e,r){
|
|
1033
|
-
</head>`)}let d=e.name||ve(e.input,".stx"),f=e.version||"1.0.0",u=e.craftPath||
|
|
1032
|
+
</button>`}function B(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function le(e){let r=5381;for(let i=0;i<e.length;i++)r=r*33^e.charCodeAt(i);return(r>>>0).toString(36)}function T(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function x(e){return T(e).replace(/`/g,"`")}function ue(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function fe(e,r,i){let n=[];n.push(`class="${i.join(" ")}"`),n.push(`data-craft="${r.nativeType}"`);for(let[s,t]of Object.entries(e))if(t===!0)n.push(s);else if(t!==!1&&t!==void 0&&t!==null){let o=String(t).replace(/"/g,""");n.push(`${s}="${o}"`)}return n.join(" ")}function Um(e,r){co[e]=r}function Wm(){return{...co}}import{chmodSync as pe,copyFileSync as be,mkdtempSync as V,rmSync as ge,writeFileSync as J}from"fs";import{tmpdir as W}from"os";import{join as O}from"path";function me(e){let r=Bun.spawnSync(["/usr/bin/plutil","-extract","Entitlements","xml1","-o","-","-"],{stdin:e});if(r.exitCode!==0)throw Error(`Could not extract the macOS profile entitlements: ${r.stderr.toString().trim()||r.stdout.toString().trim()}`);let i=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-","-"],{stdin:r.stdout});if(i.exitCode!==0)throw Error(`Could not convert the macOS profile entitlements: ${i.stderr.toString().trim()||i.stdout.toString().trim()}`);let n=JSON.parse(i.stdout.toString());if(!n||typeof n!=="object"||Array.isArray(n))throw Error("The macOS profile entitlements must be a dictionary.");return n}function we(e,r){let i=O(r,"Contents","embedded.provisionprofile");be(e,i),pe(i,420)}async function Q(e,r=[],i={}){if(process.platform!=="darwin")return;let n=i.entitlements,s;try{if(i.provisioningProfile){if(!i.identity||i.identity==="-")throw Error("A provisioning profile requires a signing identity.");let u=Bun.spawnSync(["/usr/bin/security","cms","-D","-i",i.provisioningProfile]);if(u.exitCode!==0)throw Error("Could not decode the macOS provisioning profile.");let l=me(u.stdout),p={};if(i.entitlements){let b=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-",i.entitlements]);if(b.exitCode!==0)throw Error("Could not read the app entitlements plist.");p=JSON.parse(b.stdout.toString())}for(let b of["com.apple.application-identifier","com.apple.developer.team-identifier"])if(l[b])p[b]=l[b];if(s=V(O(W(),"stx-entitlements-")),n=O(s,"entitlements.plist"),J(n,JSON.stringify(p)),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",n]).exitCode!==0)throw Error("Could not generate the provisioned app entitlements.");we(i.provisioningProfile,e)}let t;if(r.length){let u=!1;if(n){let l=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-",n]);if(l.exitCode!==0)throw Error("Could not read native parent entitlements.");u=JSON.parse(l.stdout.toString())["com.apple.security.app-sandbox"]===!0}if(s??=V(O(W(),"stx-entitlements-")),t=O(s,"helper.entitlements.plist"),J(t,JSON.stringify({"com.apple.security.cs.allow-jit":!0,...u?{"com.apple.security.app-sandbox":!0,"com.apple.security.inherit":!0}:{}})),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",t]).exitCode!==0)throw Error("Could not generate native helper entitlements.")}for(let u of[...r,e]){let l=i.hardenedRuntime?["--options","runtime"]:[];if(u===e&&n)l.push("--entitlements",n);if(u!==e&&t)l.push("--entitlements",t);let p=i.identity&&i.identity!=="-"?"--timestamp":"--timestamp=none",b=Bun.spawn(["/usr/bin/codesign","--force","--sign",i.identity||"-",p,...l,u],{stdout:"pipe",stderr:"pipe"}),[m,v]=await Promise.all([new Response(b.stderr).text(),b.exited]);if(v!==0)throw Error(`Could not sign native bundle ${u}: ${m.trim()}`)}let o=Bun.spawn(["/usr/bin/codesign","--verify","--strict",e],{stdout:"pipe",stderr:"pipe"}),[d,f]=await Promise.all([new Response(o.stderr).text(),o.exited]);if(f!==0)throw Error(`Invalid native bundle signature: ${d.trim()}`)}finally{if(s)ge(s,{recursive:!0,force:!0})}}async function ua(e){if(e.window?.cornerRadius!==void 0&&(!Number.isFinite(e.window.cornerRadius)||e.window.cornerRadius<0||e.window.cornerRadius>128))throw Error("Native window cornerRadius must be between 0 and 128");let r=Date.now();try{if(!await Bun.file(e.input).exists())return{success:!1,target:e.target||D(),format:e.format||"app",error:`Input file not found: ${e.input}`};let i=e.target||D(),n=e.format||Be(i);if(e.backend&&i!=="macos")throw Error("Native backend bundles currently support macOS only.");if(e.backend&&!F(G(e.backend.entry)))throw Error(`Native backend not found: ${e.backend.entry}`);let s=e.output||c(process.cwd(),"dist","native");if(!F(s))y(s,{recursive:!0});let t=await a(process.cwd()),o=await Da(e.input,{context:e.context,options:{...t,isDev:!1},injectCSS:!0});if(o=aa(o,{debug:e.verbose}),o=la(o),!o.includes("craft-component-styles")){if(o.includes("</head>"))o=o.replace("</head>",`${Wr}
|
|
1033
|
+
</head>`)}let d=e.name||ve(e.input,".stx"),f=e.version||"1.0.0",u=e.craftPath||da(e.runtimeProfile);if(!u)return{success:!1,target:i,format:n,error:"Craft native binary not found on PATH. Run pantry install craft, or specify craftPath for framework development."};if(e.runtimeProfile==="webview"){if(i!=="macos")throw Error("The webview runtime profile is currently available on macOS only.");let p=Bun.spawnSync([u,"--runtime-profile"],{stdout:"pipe",stderr:"pipe",timeout:1e4});if(p.exitCode!==0||p.stdout.toString().trim()!=="webview")throw Error("The requested Craft webview runtime is unavailable. Upgrade Craft with Pantry before building.")}if(u=qr(e.craftPath,e.runtimeProfile),e.verbose)console.log(`\uD83D\uDCE6 Building native app for ${i}...`),console.log(` Input: ${e.input}`),console.log(` Output: ${s}`),console.log(` Craft: ${u}`);let l;switch(i){case"macos":l=await ye(o,d,f,s,n,e,u);break;case"windows":l=await $e(o,d,f,s,n,e,u);break;case"linux":l=await Te(o,d,f,s,n,e,u);break;case"ios":l=await Pe(o,d,f,s,e,u);break;case"android":l=await Ie(o,d,f,s,e,u);break;default:l={success:!1,target:i,format:n,error:`Unsupported target: ${i}`}}return l.duration=Date.now()-r,l}catch(i){return{success:!1,target:e.target||D(),format:e.format||"app",error:i.message,duration:Date.now()-r}}}async function ye(e,r,i,n,s,t,o){let d=t.bundleId||`com.stx.${r.toLowerCase().replace(/[^a-z0-9]/g,"")}`,f=c(n,`${r}.app`),u=c(f,"Contents"),l=c(u,"MacOS"),p=c(u,"Resources");he(f,{recursive:!0,force:!0}),y(l,{recursive:!0}),y(p,{recursive:!0});let b=c(p,"index.html");await Bun.write(b,e);let m="";if(t.sidebar?.enabled&&t.sidebar?.config)m=c(p,"sidebar-config.json"),await Bun.write(m,JSON.stringify(t.sidebar.config));let v=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",k=t.menubarOnly??t.systemTray,h=t.bundleStyle||(await Ce(o)?"executable":"launcher");if(t.backend){if(!await Se(o))throw Error("This Craft runtime does not support bundled backends. Upgrade Craft before building this app.");P(o,c(l,r)),I(c(l,r),493);let C=We("native-backend");try{let w=c(C,"launcher.ts"),M=c(import.meta.dir,"native-backend"+(import.meta.path.endsWith(".ts")?".ts":".js"));await Bun.write(w,`import { runNativeBackend } from ${JSON.stringify(M)}
|
|
1034
1034
|
import * as backend from ${JSON.stringify(G(t.backend.entry))}
|
|
1035
1035
|
await runNativeBackend({ html: ${JSON.stringify(e)}, fetch: backend.default, shutdown: Reflect.get(backend, "shutdown"),
|
|
1036
1036
|
maxRequestBodySize: ${t.backend.maxRequestBodySize??33554432} })
|
|
@@ -1076,7 +1076,7 @@ Name=${r}
|
|
|
1076
1076
|
Exec=${p}
|
|
1077
1077
|
Terminal=false
|
|
1078
1078
|
Categories=Utility;
|
|
1079
|
-
`;if(await Bun.write(c(d,`${r.toLowerCase()}.desktop`),b),s==="deb"){let m=c(n,`${r.toLowerCase()}_${i}_amd64.deb`),v=await Oe(d,m,r,i,t);if(!v.success)return{success:!1,target:"linux",format:"deb",error:v.error};return{success:!0,target:"linux",format:"deb",outputPath:m}}if(s==="appimage"){let m=c(n,`${r}-${i}-x86_64.AppImage`),v=await De(d,m,r,t);if(!v.success)return{success:!1,target:"linux",format:"appimage",error:v.error};return{success:!0,target:"linux",format:"appimage",outputPath:m}}return{success:!0,target:"linux",format:"app",outputPath:d}}async function Pe(e,r,i,n,s,t){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${r}' to create an iOS project.`}}async function Ie(e,r,i,n,s,t){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${r}' to create an Android project.`}}function
|
|
1079
|
+
`;if(await Bun.write(c(d,`${r.toLowerCase()}.desktop`),b),s==="deb"){let m=c(n,`${r.toLowerCase()}_${i}_amd64.deb`),v=await Oe(d,m,r,i,t);if(!v.success)return{success:!1,target:"linux",format:"deb",error:v.error};return{success:!0,target:"linux",format:"deb",outputPath:m}}if(s==="appimage"){let m=c(n,`${r}-${i}-x86_64.AppImage`),v=await De(d,m,r,t);if(!v.success)return{success:!1,target:"linux",format:"appimage",error:v.error};return{success:!0,target:"linux",format:"appimage",outputPath:m}}return{success:!0,target:"linux",format:"app",outputPath:d}}async function Pe(e,r,i,n,s,t){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${r}' to create an iOS project.`}}async function Ie(e,r,i,n,s,t){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${r}' to create an Android project.`}}function da(e="full"){let r=process.env.CRAFT_BIN;if(r){if(!F(r))throw Error(`CRAFT_BIN points to a missing file: ${r}`);return r}return Bun.which(e==="webview"?"craft-webview":"craft",{PATH:process.env.PATH??"",cwd:process.cwd()})}function D(){switch(xe()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function Be(e){switch(e){case"macos":return"app";case"windows":return"zip";case"linux":return"appimage";case"ios":return"ipa";case"android":return"apk";default:return"app"}}async function Re(e,r,i){return new Promise((n)=>{let s=z("hdiutil",["create","-volname",i,"-srcfolder",e,"-ov","-format","UDZO",r]);s.on("close",(t)=>{if(t===0)n({success:!0});else n({success:!1,error:`hdiutil exited with code ${t}`})}),s.on("error",(t)=>{n({success:!1,error:t.message})})})}async function Ee(e,r){return new Promise((i)=>{let n=z("zip",["-r",r,"."],{cwd:e});n.on("close",(s)=>{if(s===0)i({success:!0});else i({success:!1,error:`zip exited with code ${s}`})}),n.on("error",(s)=>{i({success:!1,error:s.message})})})}async function Oe(e,r,i,n,s){return new Promise((t)=>{let o=We("deb");try{let d=c(o,"pkg"),f=c(d,"DEBIAN"),u=c(d,"usr","bin"),l=c(d,"usr","share","applications"),p=c(d,"usr","share",i.toLowerCase());y(f,{recursive:!0}),y(u,{recursive:!0}),y(l,{recursive:!0}),y(p,{recursive:!0});let b=g("fs").readdirSync(e);for(let h of b)P(c(e,h),c(p,h));let m=`#!/bin/bash
|
|
1080
1080
|
exec /usr/share/${i.toLowerCase()}/${i.toLowerCase()} "$@"`;g("fs").writeFileSync(c(u,i.toLowerCase()),m),I(c(u,i.toLowerCase()),493);let v=`Package: ${i.toLowerCase()}
|
|
1081
1081
|
Version: ${n}
|
|
1082
1082
|
Section: utils
|
|
@@ -1097,5 +1097,5 @@ Exec=${i.toLowerCase()}
|
|
|
1097
1097
|
Terminal=false
|
|
1098
1098
|
Categories=Utility;
|
|
1099
1099
|
Icon=${i.toLowerCase()}
|
|
1100
|
-
`;g("fs").writeFileSync(c(o,`${i.toLowerCase()}.desktop`),m);let v=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(g("fs").writeFileSync(c(o,`${i.toLowerCase()}.png`),v),n.icon&&F(n.icon))P(n.icon,c(o,`${i.toLowerCase()}.png`));let k=z("appimagetool",[o,r],{env:{...process.env,ARCH:"x86_64"}});k.on("close",(h)=>{if(re(t),h===0)I(r,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${h}. Install from https://appimage.github.io/appimagetool/`})}),k.on("error",(h)=>{re(t),s({success:!1,error:`appimagetool not found: ${h.message}`})})}catch(o){re(t),s({success:!1,error:o.message})}})}function
|
|
1101
|
-
export{
|
|
1100
|
+
`;g("fs").writeFileSync(c(o,`${i.toLowerCase()}.desktop`),m);let v=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(g("fs").writeFileSync(c(o,`${i.toLowerCase()}.png`),v),n.icon&&F(n.icon))P(n.icon,c(o,`${i.toLowerCase()}.png`));let k=z("appimagetool",[o,r],{env:{...process.env,ARCH:"x86_64"}});k.on("close",(h)=>{if(re(t),h===0)I(r,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${h}. Install from https://appimage.github.io/appimagetool/`})}),k.on("error",(h)=>{re(t),s({success:!1,error:`appimagetool not found: ${h.message}`})})}catch(o){re(t),s({success:!1,error:o.message})}})}function pa(){return[D()]}function fa(e){switch(e){case"macos":return["app","dmg","pkg"];case"windows":return["app","zip","msi"];case"linux":return["app","deb","rpm","appimage"];case"ios":return["ipa"];case"android":return["apk"];default:return["app"]}}var qe={buildNative:ua,getAvailableTargets:pa,getAvailableFormats:fa,detectPlatform:D},qm=qe;
|
|
1101
|
+
export{Yl,ia,Hm,Vm,aa,co,Wr,ca,la,Um,Wm,ua,da,pa,fa,qm};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{vf,oh,ih,ah,ch,wf,xf,lh,uh,
|
|
2
|
+
import{gc,r,fe}from"./chunk-rthn3eq6.js";import{et}from"./chunk-j2mpqa4p.js";import{l}from"./chunk-h2y36t58.js";import o from"fs";import u from"path";var vf=new Map,m=new Map;async function oh(e){let n;for(let i=0;i<3;i++)try{let g=(await o.promises.stat(e)).mtime.getTime(),a=m.get(e);if(a&&a.mtime===g)return a.content;let h=await Bun.file(e).text(),w=(await o.promises.stat(e)).mtime.getTime();if(w!==g)continue;return m.set(e,{content:h,mtime:w}),h}catch(s){n=s;break}throw m.delete(e),Error(`File not found: ${e}${n?` (${n.message})`:""}`)}function ih(e){m.delete(e)}function ah(e){for(let t of m.keys())if(t.startsWith(e))m.delete(t)}var f=null,B=null,x=null;function ch(e){x=e}async function wf(e=!1){let t=x??await import("./chunk-7vt4k3jv.js");if(e)return t.generateSignalsRuntimeDev();if(f===null)f=t.generateSignalsRuntime();return f}var S=null;async function xf(){if(S===null){let{getRouterScript:e}=await import("./chunk-1wak0s76.js");S=e()}return S}var y={};async function lh(e,t=!1){let n=e==="runtime"?await wf(t):await xf(),i=e==="runtime"&&t?"runtime-debug":e,s=y[i];if(!s||s.content!==n)s={content:n,hash:Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)},y[i]=s;return{content:n,hash:s.hash,url:`/_stx/${e}.${s.hash}.js`}}var E=500,T=33554432,c=new Map,p=0;function C(e){return l(process.cwd(),"module-bundles",`${e}.js`)}function uh(e){let t=Bun.hash(e).toString(16).padStart(16,"0").slice(0,16),n=c.get(t),i=n!==void 0;if(i)c.delete(t),p-=n.length*2;c.set(t,e),p+=e.length*2;while(c.size>1&&(c.size>E||p>T)){let s=c.keys().next().value;p-=c.get(s).length*2,c.delete(s)}if(!i)try{let s=C(t);if(!o.existsSync(s))o.mkdirSync(u.dirname(s),{recursive:!0}),o.writeFileSync(s,e)}catch{}return`/_stx/modules.${t}.js`}function Do(e){if(!/^[0-9a-f]{16}$/.test(e))return;let t=c.get(e);if(t!==void 0)return t;try{return o.readFileSync(C(e),"utf8")}catch{return}}function dh(){m.clear(),fe(),gc(),f=null,B=null,S=null}function v(e){let t={debug:e.debug===!0,middleware:(e.middleware??[]).map((n)=>({name:n.name,timing:n.timing,handler:String(n.handler)})),customDirectives:(e.customDirectives??[]).map((n)=>({name:n.name,hasEndTag:n.hasEndTag===!0,rawParams:n.rawParams===!0,handler:String(n.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(t)).digest("hex")}async function ir(e,t){try{if(!t.cachePath)return null;let n=u.resolve(t.cachePath),i=u.join(n,`${ls(e)}.html`),s=u.join(n,`${ls(e)}.meta.json`);if(!await r(i)||!await r(s))return null;let g=await Bun.file(s).text(),a=JSON.parse(g);if(a.cacheVersion!==t.cacheVersion)return null;if(a.engine!==et())return null;if(a.optionsSignature!==v(t))return null;if((await o.promises.stat(e)).mtime.getTime()>a.mtime)return null;for(let d of a.dependencies)if(await r(d)){if((await o.promises.stat(d)).mtime.getTime()>a.mtime)return null}else return null;return await Bun.file(i).text()}catch(n){return console.warn(`Cache error for ${e}:`,n),null}}async function ar(e,t,n,i){try{if(!i.cachePath)return;let s=u.resolve(i.cachePath);await o.promises.mkdir(s,{recursive:!0});let g=u.join(s,`${ls(e)}.html`),a=u.join(s,`${ls(e)}.meta.json`),h=await o.promises.stat(e);await Bun.write(g,t);let d={sourcePath:e,mtime:h.mtime.getTime(),dependencies:Array.from(n),cacheVersion:i.cacheVersion,engine:et(),optionsSignature:v(i),generatedAt:Date.now()};await Bun.write(a,JSON.stringify(d,null,2)),vf.set(e,{output:t,mtime:h.mtime.getTime(),dependencies:n})}catch(s){console.warn(`Failed to cache template ${e}:`,s)}}var _=16;function ls(e){return new Bun.CryptoHasher("sha1").update(e).digest("hex").substring(0,_)}
|
|
3
|
+
export{vf,oh,ih,ah,ch,wf,xf,lh,uh,Do,dh,ir,ar,ls};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Zc,Qc,el}from"./chunk-ez35607j.js";import{le,Fn,zn,oo,Hr,Vr,Hn,Vn,io,Ur}from"./chunk-r3hden6p.js";function z(e,s,i,a,d,y){let r=!0,u=new Set,h=(p)=>a.get?a.get(p):p,o=()=>h(e());return Object.defineProperty(o,"_isSignal",{value:!0}),Object.defineProperty(o,"modifiers",{get:s}),o.set=(p)=>{if(!r)return;let f=s(),t=a.set?a.set(p,f):p;if(f.trim&&typeof t==="string")t=t.trim();if(f.number&&typeof t==="string"&&t!==""){let l=Number(t);if(!Number.isNaN(l))t=l}if(Object.is(e(),t))return;e.set(t),i(t)},o.update=(p)=>o.set(p(o())),o.input=(p)=>{if(!s().lazy)o.set(p)},o.change=(p)=>{if(s().lazy)o.set(p)},o.subscribe=(p)=>{if(!r)return()=>{};let f=e.subscribe((t,l)=>p(h(t),h(l)));return u.add(f),()=>{f(),u.delete(f)}},Object.defineProperty(o,"value",{get:o,set:o.set}),d(()=>{r=!1,u.forEach((p)=>p()),u.clear()}),y?.(()=>{r=!0}),o}function X(e,s=!0,i){if(!s||!e||typeof window>"u")return;let a=window;if(!a.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let r=JSON.parse(y?.textContent||"{}");a.__STX_DATA__=r&&typeof r==="object"&&!Array.isArray(r)?r:{}}catch{a.__STX_DATA__={}}}let d=a.__STX_DATA__;if(d&&Object.prototype.hasOwnProperty.call(d,e))try{return{data:i?i(d[e]):d[e]}}catch(y){return{data:null,error:y instanceof Error?y:Error(String(y))}}return}function Q(e){if(typeof window>"u")return;let s=window;if(e===void 0)s.__STX_DATA__={};else{if(!s.__STX_DATA__)try{let i=JSON.parse(document.querySelector("script[data-stx-server-data]")?.textContent||"{}");s.__STX_DATA__=i&&typeof i==="object"&&!Array.isArray(i)?i:{}}catch{s.__STX_DATA__={}}if(s.__STX_DATA__)delete s.__STX_DATA__[e]}}function Y(e){let s=null;try{s=typeof indexedDB<"u"?indexedDB:null}catch{s=null}if(!s)return null;let i=s,a=e||"stx-kept",d=null,y=()=>{if(!d)d=new Promise((u,h)=>{let o=i.open(a,1);o.onupgradeneeded=()=>{o.result.createObjectStore("kv")},o.onsuccess=()=>u(o.result),o.onerror=()=>h(o.error),o.onblocked=()=>h(Error("blocked"))}),d.catch(()=>{d=null});return d},r=(u,h)=>y().then((o)=>new Promise((p,f)=>{let t=o.transaction("kv",u),l=h(t.objectStore("kv"));t.oncomplete=()=>p(l?l.result:void 0),t.onerror=()=>f(t.error),t.onabort=()=>f(t.error)}));return{get:(u)=>r("readonly",(h)=>h.get(u)),set:(u,h)=>r("readwrite",(o)=>{o.put(h,u)}),remove:(u)=>r("readwrite",(h)=>{h.delete(u)}),removePrefix:(u)=>r("readwrite",(h)=>{h.delete(IDBKeyRange.bound(u,`${u}\uFFFF`))})}}function J(e,s){let i=e||{},a=null;if(i.storage!==void 0)a=i.storage;else try{a=typeof localStorage<"u"?localStorage:null}catch{a=null}let d=null,y=i.backend!==void 0;if(y)d=i.backend||null;let r=()=>{if(y)return d;y=!0;try{d=s?s():null}catch{d=null}if(d){let n=d;n.get("__stx_probe__").catch(()=>{if(d===n)d=null})}return d},u=i.limit||32768,h=i.defer||((n)=>{let c=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(c)c(n,{timeout:200});else setTimeout(n,16)}),o=new Map,p=new Set,f=new Map,t=!1,l=Promise.resolve(),g=(n)=>{try{return JSON.parse(n)}catch{return n}},m=(n,c)=>{if(!a)return!1;try{return a.setItem(n,c),!0}catch{return!1}},_=(n)=>{try{if(a)a.removeItem(n)}catch{}},k=()=>{if(t=!1,!f.size)return l;let n=Array.from(f.entries());return f.clear(),l=l.then(()=>Promise.all(n.map(([c,v])=>{if(!d){p.delete(c);try{m(c,JSON.stringify(v===void 0?null:v))}catch{}return}let x;try{return x={v},d.set(c,x).catch(()=>{let S;try{S=JSON.stringify(v)}catch{return}return d?d.set(c,{j:S}).catch(()=>{m(c,S)}):void 0})}catch{return}}))).then(()=>{}),l},N=(n,c)=>{if(f.set(n,c),p.add(n),t)return;t=!0,h(()=>{k()})},D=(n)=>{if(!n||typeof n!=="object")return;let c=n;if("v"in c)return{value:c.v};if(typeof c.j==="string")return{value:g(c.j)};return},E={peek(n){if(o.has(n))return{value:o.get(n)};let c=null;try{c=a?a.getItem(n):null}catch{c=null}if(c===null||c===void 0)return;let v=g(c);return o.set(n,v),{value:v}},load(n){let c=E.peek(n),v=c?null:r();if(c||!v)return Promise.resolve(c);return v.get(n).then((x)=>{if(o.has(n))return{value:o.get(n)};let S=D(x);if(S)o.set(n,S.value),p.add(n);return S},()=>{return})},set(n,c){if(o.set(n,c),d&&p.has(n)){N(n,c);return}let v;try{v=JSON.stringify(c===void 0?null:c)}catch{return}if(v.length<=u&&m(n,v))return;if(!r()){if(v.length>u)m(n,v);return}_(n),N(n,c)},forget(n){for(let v of Array.from(o.keys()))if(v.indexOf(n)===0)o.delete(v);for(let v of Array.from(f.keys()))if(v.indexOf(n)===0)f.delete(v);for(let v of Array.from(p))if(v.indexOf(n)===0)p.delete(v);try{if(a)for(let v=a.length-1;v>=0;v--){let x=a.key(v);if(x&&x.indexOf(n)===0)a.removeItem(x)}}catch{}let c=r();if(!c)return l;return l=l.then(()=>c.removePrefix(n)).catch(()=>{}),l},flush(){return k()}};try{if(typeof document<"u"&&document.addEventListener)document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")k()});if(typeof addEventListener==="function")addEventListener("pagehide",()=>{k()})}catch{}return E}function Z(e,s){if(!e)return!1;if(e===s.key)return!0;if(!s.url)return!1;if(e===s.url)return!0;try{let i=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",a=new URL(e,i),d=new URL(s.url,i);if(a.origin!==d.origin||a.pathname!==d.pathname)return!1;return!a.search||a.search===d.search}catch{return!1}}function ee(e){let s=e.prefix||"stx:kept:",i=e.matches||((t,l)=>t===l.key||t===l.url),a=new Set,d=new Map,y,r=(t)=>t===void 0?y:t,u=(t,l)=>{let g=r(l);if(g===!1||g===null||g==="")return null;return`${s}${g===void 0?"":`${g}:`}query:${t}`},h=(t)=>{let l=t&&t.value;if(!l||typeof l!=="object"||!("d"in l))return;return{data:l.d,at:Number(l.at)||0}},o=()=>{let t=globalThis;return t.__stx_outboxes instanceof Map?t.__stx_outboxes:null},p={setScope(t){y=t},scope:()=>y,keyFor:u,seed(t,l){let g=u(t,l);return g?h(e.kept.peek(g)):void 0},restore(t,l){let g=u(t,l);return g?e.kept.load(g).then(h):Promise.resolve(void 0)},persist(t,l,g){let m=u(t,g);if(m)e.kept.set(m,{d:l,at:Date.now()})},overlay(t,l,g){let m=o();if(!m||!m.size)return l;let _=l;return m.forEach((k)=>{try{_=k.overlay(t,_,g)}catch{}}),_},watch(t){return a.add(t),()=>{a.delete(t)}},cachedQuery(t,l){let g=d.get(t);if(g){if(l&&g.__options)g.__options(l);return g}let m=l||{},_=m.initial===void 0?null:m.initial,k=()=>typeof m.scope==="function"?m.scope():m.scope,N=()=>(typeof m.url==="function"?m.url():m.url)||null,D=()=>({key:t,url:N()}),E=k(),n=_,c=0,v=e.sharedRequest(),x=0,S=p.seed(t,E);if(S)n=S.data;let I=e.state(p.overlay(D(),n)),U=e.state(!1),q=e.state(!1),K=e.state(null),P=e.state(S?S.at:0),R=0,F=()=>{I.set(p.overlay(D(),n))},W=(b)=>{let w=R;p.restore(t,b).then((T)=>{if(!T||w!==R||c)return;n=T.data,P.set(T.at),F()})};if(!S)W(E);let _t=()=>{let b=k();if(b===E)return;E=b,R++,x=0,q.set(!1),U.set(!1),c=0;let w=p.seed(t,E);if(n=w?w.data:_,P.set(w?w.at:0),F(),!w)W(E)},xt=(b,w)=>{let T=m.timeoutMs||15000,C=typeof AbortController<"u"?new AbortController:null,O=null,V=new Promise((M,j)=>{O=setTimeout(()=>{if(C)C.abort();j(Error("The request took too long."))},T)}),A;if(m.load)A=m.load({force:b,url:w,signal:C?C.signal:void 0});else if(w){let M=m.fetch||((L,H)=>fetch(L,H)),j={method:"GET",headers:{Accept:"application/json"}};if(b)j.cache="no-cache";if(C)j.signal=C.signal;A=M(w,j).then((L)=>{if(!L.ok)return L.json().catch(()=>null).then((H)=>{throw Error(H&&(H.error||H.message)||`Request failed (${L.status})`)});return L.json()})}else return Promise.resolve(I());return Promise.race([A,V]).then((M)=>{if(O)clearTimeout(O);return m.transform?m.transform(M):M},(M)=>{if(O)clearTimeout(O);throw M})},G=(b)=>{let w=R,T=N(),C=()=>{if(w!==R)return Promise.resolve(I());if(x++,q.set(!0),c===0&&!P())U.set(!0);let V=()=>{if(w!==R)return;if(x=Math.max(0,x-1),!x)q.set(!1),U.set(!1)};return xt(b,T).then((A)=>{if(w!==R||T!==N())return V(),I();return n=A,c=Date.now(),P.set(c),K.set(null),p.persist(t,A,E),F(),V(),I()},(A)=>{if(w===R&&T===N())K.set(A&&A.message?A.message:"Could not load.");return V(),I()})},O=`${w} ${T||""}`;return b?v.fresh(O,C):v.run(O,C)},B={data:I,loading:U,isFetching:q,error:K,updatedAt:P,get key(){return t},load(b){if(_t(),!b&&c&&Date.now()-c<(m.staleTime||0))return Promise.resolve(I());return G(!!b)},refresh(){return B.load(!0)},set(b){n=typeof b==="function"?b(n):b,p.persist(t,n,E),F()},invalidate(){c=0},__options(b){m={...m,...b}}};if(a.add({target:D,updated:()=>{if(c||P())G(!1)},outbox:(b)=>{if(b)n=p.overlay(D(),n,b.id),c=0,G(!0);F()}}),d.set(t,B),m.immediate)B.load();return B}},f=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(e.listen!==!1&&f&&typeof f.addEventListener==="function")f.addEventListener("stx:updated",(t)=>{let l=t.detail||{};if(l.kind!=="api"||typeof l.url!=="string")return;a.forEach((g)=>{if(i(l.url,g.target()))g.updated()})}),f.addEventListener("stx:outbox",(t)=>{let l=t.detail||{},g=l.sent&&typeof l.sent.id==="string"?l.sent:null;a.forEach((m)=>{if(g){let _=Array.isArray(g.affects)?g.affects:[],k=m.target();if(!_.some((N)=>i(N,k)))return}m.outbox(g)})});return p}function te(e){let s=e&&e.covers||((r,u)=>Object.is(r,u)),i=[],a=[],d=0,y=(r,u)=>{let h;try{h=Promise.resolve(u())}catch(f){h=Promise.reject(f)}let o={key:r,promise:h};i.push(o);let p=()=>{let f=i.indexOf(o);if(f!==-1)i.splice(f,1)};return h.then(p,p),h};return{run(r,u){for(let h of i)if(s(h.key,r))return h.promise;for(let h of a)if(s(h.key,r))return h.promise;return y(r,u)},fresh(r,u){for(let f of a)if(s(f.key,r))return f.promise;let h=i.filter((f)=>s(f.key,r)).map((f)=>f.promise);if(!h.length)return y(r,u);let o={key:r,promise:null},p=()=>{};return o.promise=Promise.all(h.map((f)=>f.then(p,p))).then(()=>{let f=a.indexOf(o);if(f!==-1)a.splice(f,1);return y(r,u)}),a.push(o),o.promise},latest(){let r=++d;return()=>r===d},get busy(){return i.length>0||a.length>0}}}function ne(e){let s=!1,i=null,a=null,d=0;async function y(){if(s)return;i=new AbortController;try{let r=await e.request(e.endpoint,{signal:i.signal,cache:"no-store",headers:{Accept:"text/event-stream"}});if(!r.ok||!r.body||!r.headers.get("content-type")?.includes("text/event-stream"))throw Error("Broadcast stream unavailable");if(s){await r.body.cancel();return}let u=r.body.getReader(),h=new TextDecoder,o="";d=0,e.onStatus?.(!0),e.onConnected?.();try{while(!s){let{done:p,value:f}=await u.read();if(p)break;if(o+=h.decode(f,{stream:!0}).replace(/\r\n/g,`
|
|
2
|
+
import{Qc,el,tl}from"./chunk-27agaezn.js";import{le,Fn,zn,io,Hr,Vr,Hn,Vn,ao,Ur}from"./chunk-j3cbj356.js";function z(e,s,i,a,d,y){let r=!0,u=new Set,h=(p)=>a.get?a.get(p):p,o=()=>h(e());return Object.defineProperty(o,"_isSignal",{value:!0}),Object.defineProperty(o,"modifiers",{get:s}),o.set=(p)=>{if(!r)return;let f=s(),t=a.set?a.set(p,f):p;if(f.trim&&typeof t==="string")t=t.trim();if(f.number&&typeof t==="string"&&t!==""){let l=Number(t);if(!Number.isNaN(l))t=l}if(Object.is(e(),t))return;e.set(t),i(t)},o.update=(p)=>o.set(p(o())),o.input=(p)=>{if(!s().lazy)o.set(p)},o.change=(p)=>{if(s().lazy)o.set(p)},o.subscribe=(p)=>{if(!r)return()=>{};let f=e.subscribe((t,l)=>p(h(t),h(l)));return u.add(f),()=>{f(),u.delete(f)}},Object.defineProperty(o,"value",{get:o,set:o.set}),d(()=>{r=!1,u.forEach((p)=>p()),u.clear()}),y?.(()=>{r=!0}),o}function X(e,s=!0,i){if(!s||!e||typeof window>"u")return;let a=window;if(!a.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let r=JSON.parse(y?.textContent||"{}");a.__STX_DATA__=r&&typeof r==="object"&&!Array.isArray(r)?r:{}}catch{a.__STX_DATA__={}}}let d=a.__STX_DATA__;if(d&&Object.prototype.hasOwnProperty.call(d,e))try{return{data:i?i(d[e]):d[e]}}catch(y){return{data:null,error:y instanceof Error?y:Error(String(y))}}return}function Q(e){if(typeof window>"u")return;let s=window;if(e===void 0)s.__STX_DATA__={};else{if(!s.__STX_DATA__)try{let i=JSON.parse(document.querySelector("script[data-stx-server-data]")?.textContent||"{}");s.__STX_DATA__=i&&typeof i==="object"&&!Array.isArray(i)?i:{}}catch{s.__STX_DATA__={}}if(s.__STX_DATA__)delete s.__STX_DATA__[e]}}function Y(e){let s=null;try{s=typeof indexedDB<"u"?indexedDB:null}catch{s=null}if(!s)return null;let i=s,a=e||"stx-kept",d=null,y=()=>{if(!d)d=new Promise((u,h)=>{let o=i.open(a,1);o.onupgradeneeded=()=>{o.result.createObjectStore("kv")},o.onsuccess=()=>u(o.result),o.onerror=()=>h(o.error),o.onblocked=()=>h(Error("blocked"))}),d.catch(()=>{d=null});return d},r=(u,h)=>y().then((o)=>new Promise((p,f)=>{let t=o.transaction("kv",u),l=h(t.objectStore("kv"));t.oncomplete=()=>p(l?l.result:void 0),t.onerror=()=>f(t.error),t.onabort=()=>f(t.error)}));return{get:(u)=>r("readonly",(h)=>h.get(u)),set:(u,h)=>r("readwrite",(o)=>{o.put(h,u)}),remove:(u)=>r("readwrite",(h)=>{h.delete(u)}),removePrefix:(u)=>r("readwrite",(h)=>{h.delete(IDBKeyRange.bound(u,`${u}\uFFFF`))})}}function J(e,s){let i=e||{},a=null;if(i.storage!==void 0)a=i.storage;else try{a=typeof localStorage<"u"?localStorage:null}catch{a=null}let d=null,y=i.backend!==void 0;if(y)d=i.backend||null;let r=()=>{if(y)return d;y=!0;try{d=s?s():null}catch{d=null}if(d){let n=d;n.get("__stx_probe__").catch(()=>{if(d===n)d=null})}return d},u=i.limit||32768,h=i.defer||((n)=>{let c=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(c)c(n,{timeout:200});else setTimeout(n,16)}),o=new Map,p=new Set,f=new Map,t=!1,l=Promise.resolve(),g=(n)=>{try{return JSON.parse(n)}catch{return n}},m=(n,c)=>{if(!a)return!1;try{return a.setItem(n,c),!0}catch{return!1}},_=(n)=>{try{if(a)a.removeItem(n)}catch{}},k=()=>{if(t=!1,!f.size)return l;let n=Array.from(f.entries());return f.clear(),l=l.then(()=>Promise.all(n.map(([c,v])=>{if(!d){p.delete(c);try{m(c,JSON.stringify(v===void 0?null:v))}catch{}return}let x;try{return x={v},d.set(c,x).catch(()=>{let S;try{S=JSON.stringify(v)}catch{return}return d?d.set(c,{j:S}).catch(()=>{m(c,S)}):void 0})}catch{return}}))).then(()=>{}),l},N=(n,c)=>{if(f.set(n,c),p.add(n),t)return;t=!0,h(()=>{k()})},D=(n)=>{if(!n||typeof n!=="object")return;let c=n;if("v"in c)return{value:c.v};if(typeof c.j==="string")return{value:g(c.j)};return},E={peek(n){if(o.has(n))return{value:o.get(n)};let c=null;try{c=a?a.getItem(n):null}catch{c=null}if(c===null||c===void 0)return;let v=g(c);return o.set(n,v),{value:v}},load(n){let c=E.peek(n),v=c?null:r();if(c||!v)return Promise.resolve(c);return v.get(n).then((x)=>{if(o.has(n))return{value:o.get(n)};let S=D(x);if(S)o.set(n,S.value),p.add(n);return S},()=>{return})},set(n,c){if(o.set(n,c),d&&p.has(n)){N(n,c);return}let v;try{v=JSON.stringify(c===void 0?null:c)}catch{return}if(v.length<=u&&m(n,v))return;if(!r()){if(v.length>u)m(n,v);return}_(n),N(n,c)},forget(n){for(let v of Array.from(o.keys()))if(v.indexOf(n)===0)o.delete(v);for(let v of Array.from(f.keys()))if(v.indexOf(n)===0)f.delete(v);for(let v of Array.from(p))if(v.indexOf(n)===0)p.delete(v);try{if(a)for(let v=a.length-1;v>=0;v--){let x=a.key(v);if(x&&x.indexOf(n)===0)a.removeItem(x)}}catch{}let c=r();if(!c)return l;return l=l.then(()=>c.removePrefix(n)).catch(()=>{}),l},flush(){return k()}};try{if(typeof document<"u"&&document.addEventListener)document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")k()});if(typeof addEventListener==="function")addEventListener("pagehide",()=>{k()})}catch{}return E}function Z(e,s){if(!e)return!1;if(e===s.key)return!0;if(!s.url)return!1;if(e===s.url)return!0;try{let i=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",a=new URL(e,i),d=new URL(s.url,i);if(a.origin!==d.origin||a.pathname!==d.pathname)return!1;return!a.search||a.search===d.search}catch{return!1}}function ee(e){let s=e.prefix||"stx:kept:",i=e.matches||((t,l)=>t===l.key||t===l.url),a=new Set,d=new Map,y,r=(t)=>t===void 0?y:t,u=(t,l)=>{let g=r(l);if(g===!1||g===null||g==="")return null;return`${s}${g===void 0?"":`${g}:`}query:${t}`},h=(t)=>{let l=t&&t.value;if(!l||typeof l!=="object"||!("d"in l))return;return{data:l.d,at:Number(l.at)||0}},o=()=>{let t=globalThis;return t.__stx_outboxes instanceof Map?t.__stx_outboxes:null},p={setScope(t){y=t},scope:()=>y,keyFor:u,seed(t,l){let g=u(t,l);return g?h(e.kept.peek(g)):void 0},restore(t,l){let g=u(t,l);return g?e.kept.load(g).then(h):Promise.resolve(void 0)},persist(t,l,g){let m=u(t,g);if(m)e.kept.set(m,{d:l,at:Date.now()})},overlay(t,l,g){let m=o();if(!m||!m.size)return l;let _=l;return m.forEach((k)=>{try{_=k.overlay(t,_,g)}catch{}}),_},watch(t){return a.add(t),()=>{a.delete(t)}},cachedQuery(t,l){let g=d.get(t);if(g){if(l&&g.__options)g.__options(l);return g}let m=l||{},_=m.initial===void 0?null:m.initial,k=()=>typeof m.scope==="function"?m.scope():m.scope,N=()=>(typeof m.url==="function"?m.url():m.url)||null,D=()=>({key:t,url:N()}),E=k(),n=_,c=0,v=e.sharedRequest(),x=0,S=p.seed(t,E);if(S)n=S.data;let I=e.state(p.overlay(D(),n)),U=e.state(!1),q=e.state(!1),K=e.state(null),P=e.state(S?S.at:0),R=0,F=()=>{I.set(p.overlay(D(),n))},W=(b)=>{let w=R;p.restore(t,b).then((T)=>{if(!T||w!==R||c)return;n=T.data,P.set(T.at),F()})};if(!S)W(E);let _t=()=>{let b=k();if(b===E)return;E=b,R++,x=0,q.set(!1),U.set(!1),c=0;let w=p.seed(t,E);if(n=w?w.data:_,P.set(w?w.at:0),F(),!w)W(E)},xt=(b,w)=>{let T=m.timeoutMs||15000,C=typeof AbortController<"u"?new AbortController:null,O=null,V=new Promise((M,j)=>{O=setTimeout(()=>{if(C)C.abort();j(Error("The request took too long."))},T)}),A;if(m.load)A=m.load({force:b,url:w,signal:C?C.signal:void 0});else if(w){let M=m.fetch||((L,H)=>fetch(L,H)),j={method:"GET",headers:{Accept:"application/json"}};if(b)j.cache="no-cache";if(C)j.signal=C.signal;A=M(w,j).then((L)=>{if(!L.ok)return L.json().catch(()=>null).then((H)=>{throw Error(H&&(H.error||H.message)||`Request failed (${L.status})`)});return L.json()})}else return Promise.resolve(I());return Promise.race([A,V]).then((M)=>{if(O)clearTimeout(O);return m.transform?m.transform(M):M},(M)=>{if(O)clearTimeout(O);throw M})},G=(b)=>{let w=R,T=N(),C=()=>{if(w!==R)return Promise.resolve(I());if(x++,q.set(!0),c===0&&!P())U.set(!0);let V=()=>{if(w!==R)return;if(x=Math.max(0,x-1),!x)q.set(!1),U.set(!1)};return xt(b,T).then((A)=>{if(w!==R||T!==N())return V(),I();return n=A,c=Date.now(),P.set(c),K.set(null),p.persist(t,A,E),F(),V(),I()},(A)=>{if(w===R&&T===N())K.set(A&&A.message?A.message:"Could not load.");return V(),I()})},O=`${w} ${T||""}`;return b?v.fresh(O,C):v.run(O,C)},B={data:I,loading:U,isFetching:q,error:K,updatedAt:P,get key(){return t},load(b){if(_t(),!b&&c&&Date.now()-c<(m.staleTime||0))return Promise.resolve(I());return G(!!b)},refresh(){return B.load(!0)},set(b){n=typeof b==="function"?b(n):b,p.persist(t,n,E),F()},invalidate(){c=0},__options(b){m={...m,...b}}};if(a.add({target:D,updated:()=>{if(c||P())G(!1)},outbox:(b)=>{if(b)n=p.overlay(D(),n,b.id),c=0,G(!0);F()}}),d.set(t,B),m.immediate)B.load();return B}},f=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(e.listen!==!1&&f&&typeof f.addEventListener==="function")f.addEventListener("stx:updated",(t)=>{let l=t.detail||{};if(l.kind!=="api"||typeof l.url!=="string")return;a.forEach((g)=>{if(i(l.url,g.target()))g.updated()})}),f.addEventListener("stx:outbox",(t)=>{let l=t.detail||{},g=l.sent&&typeof l.sent.id==="string"?l.sent:null;a.forEach((m)=>{if(g){let _=Array.isArray(g.affects)?g.affects:[],k=m.target();if(!_.some((N)=>i(N,k)))return}m.outbox(g)})});return p}function te(e){let s=e&&e.covers||((r,u)=>Object.is(r,u)),i=[],a=[],d=0,y=(r,u)=>{let h;try{h=Promise.resolve(u())}catch(f){h=Promise.reject(f)}let o={key:r,promise:h};i.push(o);let p=()=>{let f=i.indexOf(o);if(f!==-1)i.splice(f,1)};return h.then(p,p),h};return{run(r,u){for(let h of i)if(s(h.key,r))return h.promise;for(let h of a)if(s(h.key,r))return h.promise;return y(r,u)},fresh(r,u){for(let f of a)if(s(f.key,r))return f.promise;let h=i.filter((f)=>s(f.key,r)).map((f)=>f.promise);if(!h.length)return y(r,u);let o={key:r,promise:null},p=()=>{};return o.promise=Promise.all(h.map((f)=>f.then(p,p))).then(()=>{let f=a.indexOf(o);if(f!==-1)a.splice(f,1);return y(r,u)}),a.push(o),o.promise},latest(){let r=++d;return()=>r===d},get busy(){return i.length>0||a.length>0}}}function ne(e){let s=!1,i=null,a=null,d=0;async function y(){if(s)return;i=new AbortController;try{let r=await e.request(e.endpoint,{signal:i.signal,cache:"no-store",headers:{Accept:"text/event-stream"}});if(!r.ok||!r.body||!r.headers.get("content-type")?.includes("text/event-stream"))throw Error("Broadcast stream unavailable");if(s){await r.body.cancel();return}let u=r.body.getReader(),h=new TextDecoder,o="";d=0,e.onStatus?.(!0),e.onConnected?.();try{while(!s){let{done:p,value:f}=await u.read();if(p)break;if(o+=h.decode(f,{stream:!0}).replace(/\r\n/g,`
|
|
3
3
|
`),o.length>1048576)throw Error("Broadcast frame too large");let t;while((t=o.indexOf(`
|
|
4
4
|
|
|
5
5
|
`))!==-1){let l=o.slice(0,t);o=o.slice(t+2);let g=l.split(`
|
|
@@ -713,6 +713,7 @@ console.log('[stx] entering IIFE');
|
|
|
713
713
|
try {
|
|
714
714
|
value = fn.apply(null, safeKeys.map(k => capturedScope[k]));
|
|
715
715
|
} catch (e2) {
|
|
716
|
+
reportUnknownBinding(e2, expr, capturedScope, el);
|
|
716
717
|
if (!(e2 instanceof ReferenceError) && !(e2 instanceof TypeError)) console.warn('[STX] Class expression error:', expr, e2);
|
|
717
718
|
value = '';
|
|
718
719
|
}
|
|
@@ -1025,6 +1026,7 @@ else {
|
|
|
1025
1026
|
if (value && typeof value === 'function' && (value._isSignal || value._isDerived)) value = value();
|
|
1026
1027
|
}
|
|
1027
1028
|
catch (e) {
|
|
1029
|
+
reportUnknownBinding(e, expression, scope, el);
|
|
1028
1030
|
if (!(e instanceof ReferenceError) && !(e instanceof TypeError))
|
|
1029
1031
|
console.warn('[STX] Parent component prop error:', expression, e);
|
|
1030
1032
|
value = undefined;
|
|
@@ -2472,6 +2474,14 @@ finally {
|
|
|
2472
2474
|
// conversation took seven seconds in WebKit, the window frozen meanwhile.
|
|
2473
2475
|
// A Function built this way closes over nothing, so one can be reused.
|
|
2474
2476
|
const __stxCompiled = new Map();
|
|
2477
|
+
function reportUnknownBinding(error, expression, scope, node) {
|
|
2478
|
+
// Native setup names are final by hydration. Undefined values and async
|
|
2479
|
+
// object paths are not missing identifiers; the host distinguishes them.
|
|
2480
|
+
try {
|
|
2481
|
+
if (stxHost.reportBindingError) stxHost.reportBindingError(error, expression, scope, node);
|
|
2482
|
+
}
|
|
2483
|
+
catch (diagnosticError) { /* Diagnostics must never break a binding. */ }
|
|
2484
|
+
}
|
|
2475
2485
|
function __stxCompile(params, body) {
|
|
2476
2486
|
const key = params.join(',') + '\\x01' + body;
|
|
2477
2487
|
let fn = __stxCompiled.get(key);
|
|
@@ -2573,7 +2583,7 @@ finally {
|
|
|
2573
2583
|
}
|
|
2574
2584
|
// First try component-level scope
|
|
2575
2585
|
const elementScope = findElementScope(el || currentElement);
|
|
2576
|
-
|
|
2586
|
+
var baseScope = mergeTemplateScopes(globalHelpers, componentScope, (elementScope || {}), extraScope);
|
|
2577
2587
|
|
|
2578
2588
|
// Check for pipe syntax (Feature #2)
|
|
2579
2589
|
const pipeResult = parsePipeExpression(expr, baseScope);
|
|
@@ -2604,6 +2614,7 @@ finally {
|
|
|
2604
2614
|
return (result && typeof result === 'function' && (result._isSignal || result._isDerived)) ? result() : result;
|
|
2605
2615
|
}
|
|
2606
2616
|
catch (e) {
|
|
2617
|
+
reportUnknownBinding(e, expr, baseScope || {}, el || currentElement);
|
|
2607
2618
|
if (!(e instanceof ReferenceError) && !(e instanceof TypeError)) console.warn('[STX] Expression error:', expr, e);
|
|
2608
2619
|
return '';
|
|
2609
2620
|
}
|
|
@@ -3211,7 +3222,7 @@ else {
|
|
|
3211
3222
|
return expression;
|
|
3212
3223
|
}
|
|
3213
3224
|
// Use passedScope instead of componentScope to preserve context through nested processing
|
|
3214
|
-
|
|
3225
|
+
var scope = mergeTemplateScopes(globalHelpers, passedScope, (capturedScope || {}), extraScope);
|
|
3215
3226
|
const unwrapScope = createAutoUnwrapProxy(scope, function(prop) {
|
|
3216
3227
|
if (typeof prop !== 'string') return false;
|
|
3217
3228
|
return expressionCallsSignal(expression, prop)
|
|
@@ -3221,6 +3232,7 @@ else {
|
|
|
3221
3232
|
return fn(...__stxArgs(fn, unwrapScope));
|
|
3222
3233
|
}
|
|
3223
3234
|
catch (e) {
|
|
3235
|
+
reportUnknownBinding(e, expression, scope || {}, el);
|
|
3224
3236
|
if (!(e instanceof ReferenceError) && !(e instanceof TypeError)) console.warn('[STX] Expression error:', expression, e);
|
|
3225
3237
|
return '';
|
|
3226
3238
|
}
|
|
@@ -3232,7 +3244,7 @@ catch (e) {
|
|
|
3232
3244
|
const evalLazy = (expression, extraScope = {}) => {
|
|
3233
3245
|
try {
|
|
3234
3246
|
if (/^__[A-Z_]+__$/.test(expression.trim())) return expression;
|
|
3235
|
-
|
|
3247
|
+
var scope = mergeTemplateScopes(globalHelpers, passedScope, (capturedScope || {}), extraScope);
|
|
3236
3248
|
const unwrapScope = createAutoUnwrapProxy(scope, function(prop) {
|
|
3237
3249
|
if (typeof prop !== 'string') return false;
|
|
3238
3250
|
return expressionCallsSignal(expression, prop)
|
|
@@ -3245,6 +3257,7 @@ catch (e) {
|
|
|
3245
3257
|
const fn = __stxCompileScoped(unwrapScope, [], 'return ' + expression + '');
|
|
3246
3258
|
return fn(...__stxArgs(fn, unwrapScope));
|
|
3247
3259
|
} catch (e) {
|
|
3260
|
+
reportUnknownBinding(e, expression, scope || {}, el);
|
|
3248
3261
|
if (!(e instanceof ReferenceError) && !(e instanceof TypeError)) console.warn('[STX] Expression error:', expression, e);
|
|
3249
3262
|
return '';
|
|
3250
3263
|
}
|
|
@@ -4629,6 +4642,7 @@ catch (e1) {
|
|
|
4629
4642
|
return fn2(...__stxArgs(fn2, scope));
|
|
4630
4643
|
}
|
|
4631
4644
|
catch (e2) {
|
|
4645
|
+
reportUnknownBinding(e2, expression, scope, b.el);
|
|
4632
4646
|
if (!(e2 instanceof ReferenceError) && !(e2 instanceof TypeError)) console.warn('[STX] Expression error:', expression, e2);
|
|
4633
4647
|
return '';
|
|
4634
4648
|
}
|
|
@@ -4894,7 +4908,7 @@ catch (e) { /* a disposer of its own is not this branch's problem */ }
|
|
|
4894
4908
|
return expression;
|
|
4895
4909
|
}
|
|
4896
4910
|
try {
|
|
4897
|
-
|
|
4911
|
+
var scope = mergeTemplateScopes(globalHelpers, capturedComponentScope, (capturedElementScope || {}));
|
|
4898
4912
|
const unwrapScope = createExpressionAutoUnwrapProxy(scope, expression);
|
|
4899
4913
|
const fn = __stxCompileScoped(unwrapScope, [], 'return ' + expression + '');
|
|
4900
4914
|
return fn(...__stxArgs(fn, unwrapScope));
|
|
@@ -4907,6 +4921,7 @@ catch (e1) {
|
|
|
4907
4921
|
return fn2(...__stxArgs(fn2, scope2));
|
|
4908
4922
|
}
|
|
4909
4923
|
catch (e2) {
|
|
4924
|
+
reportUnknownBinding(e2, expression, scope || {}, el);
|
|
4910
4925
|
if (!(e2 instanceof ReferenceError) && !(e2 instanceof TypeError)) console.warn('[STX] Expression error:', expression, e2);
|
|
4911
4926
|
return '';
|
|
4912
4927
|
}
|
|
@@ -5783,6 +5798,7 @@ else if (!value && isInserted) {
|
|
|
5783
5798
|
return fn(...__stxArgs(fn, unwrapScope));
|
|
5784
5799
|
}
|
|
5785
5800
|
catch (e) {
|
|
5801
|
+
reportUnknownBinding(e, expr, capturedScope, el);
|
|
5786
5802
|
if (!(e instanceof ReferenceError) && !(e instanceof TypeError)) console.warn('[STX] ' + attrName + ' get error:', expr, e);
|
|
5787
5803
|
return '';
|
|
5788
5804
|
}
|
|
@@ -7527,6 +7543,7 @@ catch (e) {
|
|
|
7527
7543
|
bindingNode.textContent = maybeUnwrapSignal(fn(...__stxArgs(fn, capturedScope)));
|
|
7528
7544
|
}
|
|
7529
7545
|
catch (e2) {
|
|
7546
|
+
reportUnknownBinding(e2, expr, capturedScope, parentEl);
|
|
7530
7547
|
if (!(e2 instanceof ReferenceError) && !(e2 instanceof TypeError)) console.warn('[STX] Expression error:', expr, e2);
|
|
7531
7548
|
bindingNode.textContent = '';
|
|
7532
7549
|
}
|
|
@@ -7667,6 +7684,7 @@ catch (e) {
|
|
|
7667
7684
|
return retried;
|
|
7668
7685
|
}
|
|
7669
7686
|
catch (e2) {
|
|
7687
|
+
reportUnknownBinding(e2, expr, activeScope, el);
|
|
7670
7688
|
if (!(e2 instanceof ReferenceError) && !(e2 instanceof TypeError)) console.warn('[STX] Attribute expression error:', expr, e2);
|
|
7671
7689
|
// ReferenceError/TypeError stay unlogged HERE on purpose: a signal
|
|
7672
7690
|
// may not exist yet on an effect's first pass, and warning on every
|
|
@@ -8635,6 +8653,7 @@ ${e}
|
|
|
8635
8653
|
var fn2 = __stxCompileScoped(capturedScope, [], 'return ' + expr);
|
|
8636
8654
|
value = fn2(...__stxArgs(fn2, capturedScope));
|
|
8637
8655
|
} catch (e2) {
|
|
8656
|
+
reportUnknownBinding(e2, expr, capturedScope, el);
|
|
8638
8657
|
// Suppress ReferenceError/TypeError during async init \u2014 a signal
|
|
8639
8658
|
// or object may not be ready yet on the first effect run, and
|
|
8640
8659
|
// the next pass will re-evaluate once data arrives.
|
|
@@ -9592,6 +9611,7 @@ catch (e1) {
|
|
|
9592
9611
|
return fn2(...__stxArgs(fn2, capturedScope));
|
|
9593
9612
|
}
|
|
9594
9613
|
catch (e2) {
|
|
9614
|
+
reportUnknownBinding(e2, expr, capturedScope, el);
|
|
9595
9615
|
if (!(e2 instanceof ReferenceError) && !(e2 instanceof TypeError)) console.warn('[STX] Style expression error:', expr, e2);
|
|
9596
9616
|
return {};
|
|
9597
9617
|
}
|
|
@@ -10562,7 +10582,7 @@ ${se}
|
|
|
10562
10582
|
${ue}
|
|
10563
10583
|
${me}
|
|
10564
10584
|
${Ke}
|
|
10565
|
-
${tt(
|
|
10585
|
+
${tt(el(),tl(),Qc())}
|
|
10566
10586
|
|
|
10567
10587
|
${ht}
|
|
10568
10588
|
${it}
|
|
@@ -10615,5 +10635,5 @@ ${lt}
|
|
|
10615
10635
|
${ct}
|
|
10616
10636
|
${at}
|
|
10617
10637
|
})();
|
|
10618
|
-
`}var Mm={state:le,derived:Fn,effect:zn,batch:
|
|
10638
|
+
`}var Mm={state:le,derived:Fn,effect:zn,batch:io,onMount:Hr,onDestroy:Vr,isSignal:Hn,isDerived:Vn,untrack:ao,peek:Ur,generateSignalsRuntime:gt,generateSignalsRuntimeDev:Bn};
|
|
10619
10639
|
export{gt,Bn,Mm};
|