@stacksjs/stx 0.2.665 → 0.2.668

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/dist/chunk-028ee6q5.js +2 -0
  2. package/dist/{chunk-tx6p6jnk.js → chunk-02gn092e.js} +1 -1
  3. package/dist/chunk-02ymqwmj.js +2 -0
  4. package/dist/{chunk-2q50h7zv.js → chunk-060298px.js} +5 -5
  5. package/dist/{chunk-zpc06ysq.js → chunk-0hemydnd.js} +1 -1
  6. package/dist/chunk-1e79xcc8.js +2 -0
  7. package/dist/chunk-1pnp91wx.js +2 -0
  8. package/dist/{chunk-2h8ea0we.js → chunk-1sr6c0nk.js} +2 -2
  9. package/dist/chunk-280p4q7a.js +2 -0
  10. package/dist/{chunk-hb08vrbb.js → chunk-2dp7hyv7.js} +21 -21
  11. package/dist/chunk-2ecgyqam.js +2 -0
  12. package/dist/{chunk-38b3w1y4.js → chunk-2hxwds8c.js} +1 -1
  13. package/dist/{chunk-x34scshq.js → chunk-2zzc7006.js} +2 -2
  14. package/dist/{chunk-wpm58d6p.js → chunk-30nes8ne.js} +2 -2
  15. package/dist/{chunk-d3vgtr0t.js → chunk-3641xvaw.js} +1 -1
  16. package/dist/{chunk-zaaeneq6.js → chunk-365vg0eg.js} +2 -2
  17. package/dist/{chunk-2qbvsvwc.js → chunk-3850m7ab.js} +6 -6
  18. package/dist/{chunk-ewcrsyr7.js → chunk-3hxd5td3.js} +2 -2
  19. package/dist/chunk-3n9vaxnt.js +2 -0
  20. package/dist/{chunk-pxqh758g.js → chunk-3y41efsf.js} +64 -15
  21. package/dist/chunk-41cvkdcm.js +3 -0
  22. package/dist/{chunk-s3dyzxwx.js → chunk-493x6e71.js} +4 -4
  23. package/dist/{chunk-jrf01hfv.js → chunk-4c183zem.js} +1 -1
  24. package/dist/{chunk-nm8yr8a9.js → chunk-4m1hye28.js} +1 -1
  25. package/dist/{chunk-v5916r3j.js → chunk-4teqcbw0.js} +5 -5
  26. package/dist/chunk-5zgrvj4b.js +2 -0
  27. package/dist/{chunk-cg3mvq4h.js → chunk-61n06wra.js} +6 -6
  28. package/dist/{chunk-pmwb5kaf.js → chunk-65b6cy92.js} +2 -2
  29. package/dist/{chunk-zjsyw63k.js → chunk-6by8f7n9.js} +9 -9
  30. package/dist/{chunk-vjw3qrqj.js → chunk-6tngeb4b.js} +1 -1
  31. package/dist/{chunk-bgra36az.js → chunk-6z2sdfac.js} +1 -1
  32. package/dist/{chunk-yq021b3r.js → chunk-7d4z944r.js} +3 -3
  33. package/dist/{chunk-rjh2jwxx.js → chunk-7met6yva.js} +8 -8
  34. package/dist/{chunk-2jh21f1n.js → chunk-89jbdtgw.js} +1 -1
  35. package/dist/chunk-8kskjg62.js +2 -0
  36. package/dist/{chunk-q1svy1nf.js → chunk-9edksf8x.js} +1 -1
  37. package/dist/{chunk-1z1632np.js → chunk-9k2wz3k1.js} +41 -41
  38. package/dist/{chunk-577ntqeg.js → chunk-9vaz5f9j.js} +1 -1
  39. package/dist/chunk-avph47dc.js +2 -0
  40. package/dist/{chunk-mrrrngzd.js → chunk-b4pcw34n.js} +1 -1
  41. package/dist/chunk-b7e07ybq.js +3 -0
  42. package/dist/{chunk-0jhdrgpr.js → chunk-b823zxq6.js} +2 -2
  43. package/dist/{chunk-c9k40352.js → chunk-bdg0fydw.js} +1 -1
  44. package/dist/{chunk-szyqxcfj.js → chunk-bnn7pd62.js} +2 -2
  45. package/dist/chunk-c3dk9pkf.js +2 -0
  46. package/dist/chunk-c4qebqmk.js +2 -0
  47. package/dist/chunk-ca6vx6vg.js +2 -0
  48. package/dist/{chunk-dra341c0.js → chunk-cba7953e.js} +15 -15
  49. package/dist/{chunk-p2mrba1n.js → chunk-cyq1jcg2.js} +107 -107
  50. package/dist/{chunk-w2zceynt.js → chunk-dpvxe52r.js} +1 -1
  51. package/dist/{chunk-pc48mjkc.js → chunk-dtjybwtz.js} +4 -4
  52. package/dist/{chunk-nf9bykvg.js → chunk-dy5j389v.js} +5 -5
  53. package/dist/{chunk-np1k9vsr.js → chunk-e1fetwbr.js} +1 -1
  54. package/dist/chunk-e4vpr36s.js +2 -0
  55. package/dist/{chunk-11zp67ds.js → chunk-e8gcqp8w.js} +4 -4
  56. package/dist/{chunk-yh0wb4n1.js → chunk-ecqrkyg8.js} +2 -2
  57. package/dist/chunk-fb93n9ts.js +2 -0
  58. package/dist/chunk-fmkcc7g1.js +2 -0
  59. package/dist/{chunk-edvmtk21.js → chunk-fpz59dhz.js} +5 -5
  60. package/dist/{chunk-een2wqah.js → chunk-fvtwec1r.js} +1 -1
  61. package/dist/{chunk-t9mfztcs.js → chunk-fzqj1mjz.js} +3 -3
  62. package/dist/chunk-gkmpr64n.js +2 -0
  63. package/dist/chunk-heh151bn.js +2 -0
  64. package/dist/chunk-hj0raner.js +2 -0
  65. package/dist/chunk-hkqhpckf.js +2 -0
  66. package/dist/{chunk-0g4pr7ww.js → chunk-hm9jt1p9.js} +9 -9
  67. package/dist/{chunk-5w2jy5r9.js → chunk-hvf2e7pr.js} +2 -2
  68. package/dist/chunk-hx9cn2s4.js +2 -0
  69. package/dist/{chunk-2f1bk3bg.js → chunk-k5mez1vx.js} +1 -1
  70. package/dist/{chunk-r7kmsq3n.js → chunk-ka8befem.js} +1 -1
  71. package/dist/{chunk-b6xv8jh9.js → chunk-kpeep7gq.js} +1 -1
  72. package/dist/{chunk-v2x9vzgw.js → chunk-md2jn67b.js} +2 -2
  73. package/dist/chunk-n7a33e3v.js +2 -0
  74. package/dist/{chunk-d3bsfd10.js → chunk-npa7gze7.js} +2 -2
  75. package/dist/{chunk-8nryyqb5.js → chunk-p472crv1.js} +1 -1
  76. package/dist/{chunk-4yf1w261.js → chunk-pn1ehs6a.js} +2 -2
  77. package/dist/{chunk-7rta163c.js → chunk-pxdww4rb.js} +2 -2
  78. package/dist/{chunk-eqrkhc18.js → chunk-qjtpxsyx.js} +2 -2
  79. package/dist/{chunk-gf3bxnpq.js → chunk-qxmyaajq.js} +1 -1
  80. package/dist/chunk-r7cenpxp.js +2 -0
  81. package/dist/{chunk-fzxyq6k5.js → chunk-rcefnd1g.js} +61 -61
  82. package/dist/chunk-s5w3t7xw.js +2 -0
  83. package/dist/{chunk-43gr8ggc.js → chunk-sme31jbj.js} +2 -2
  84. package/dist/chunk-sz6xdz4h.js +2 -0
  85. package/dist/{chunk-f2z8s2h9.js → chunk-t01c62y5.js} +2 -2
  86. package/dist/{chunk-jh3r0qp7.js → chunk-t7jxkrbx.js} +1 -1
  87. package/dist/{chunk-jkvr7e91.js → chunk-tp4eqfxq.js} +2 -2
  88. package/dist/{chunk-7ae140wv.js → chunk-tq0bgaae.js} +1 -1
  89. package/dist/chunk-tw0wc95k.js +2 -0
  90. package/dist/chunk-v0091n1g.js +2 -0
  91. package/dist/{chunk-qzy8ypk4.js → chunk-vdjj4vrp.js} +40 -40
  92. package/dist/{chunk-gf4e5xtr.js → chunk-vfba7nz5.js} +27 -27
  93. package/dist/{chunk-awe50wee.js → chunk-vg9bz5zs.js} +1 -1
  94. package/dist/chunk-vryzt0p0.js +2 -0
  95. package/dist/{chunk-8dcemd4a.js → chunk-w6x8m0tz.js} +1 -1
  96. package/dist/chunk-wesafj4a.js +2 -0
  97. package/dist/chunk-x986xz7h.js +2 -0
  98. package/dist/{chunk-xv43szx0.js → chunk-xqp4hstk.js} +1 -1
  99. package/dist/{chunk-c1dkh0es.js → chunk-yfvm7q6t.js} +3 -3
  100. package/dist/chunk-ynh1ppa6.js +2 -0
  101. package/dist/{chunk-eecgcj41.js → chunk-yscr04dv.js} +1 -1
  102. package/dist/{chunk-a1p327a7.js → chunk-zcz97ber.js} +9 -9
  103. package/dist/chunk-zdgsj39g.js +2 -0
  104. package/dist/{chunk-5z1n02nd.js → chunk-zwkc8yge.js} +37 -37
  105. package/dist/cli.js +36 -36
  106. package/dist/client/signals-for-runtime.js +51 -2
  107. package/dist/client/signals-process-element-runtime.js +1 -1
  108. package/dist/component-renderer.js +4 -2
  109. package/dist/craft-entry.js +1 -1
  110. package/dist/craft.js +1 -1
  111. package/dist/native/compiler/headwind-to-style.js +24 -1
  112. package/dist/native/compiler/html-to-ir.js +25 -5
  113. package/dist/native/runtime/binding-tree.d.ts +1 -0
  114. package/dist/native/runtime/binding-tree.js +5 -0
  115. package/dist/native/runtime/craft-bridge.js +1 -0
  116. package/dist/native/runtime/craft.d.ts +1 -0
  117. package/dist/native/runtime/jsc-globals.d.ts +20 -0
  118. package/dist/native/runtime/jsc-globals.js +52 -0
  119. package/dist/native/testing.d.ts +0 -1
  120. package/dist/native/testing.js +31 -4
  121. package/dist/pwa.js +3 -3
  122. package/dist/signal-processing.js +1 -2
  123. package/dist/slot-scopes.js +10 -2
  124. package/dist/slots.d.ts +2 -2
  125. package/dist/slots.js +21 -5
  126. package/dist/ssg.js +5 -5
  127. package/dist/utils.js +1 -1
  128. package/package.json +5 -5
  129. package/dist/chunk-0eepx077.js +0 -2
  130. package/dist/chunk-0fhntp63.js +0 -2
  131. package/dist/chunk-2a4szpje.js +0 -3
  132. package/dist/chunk-3d39yer3.js +0 -2
  133. package/dist/chunk-4v9x7zz5.js +0 -2
  134. package/dist/chunk-5etmsv9z.js +0 -2
  135. package/dist/chunk-773frt6c.js +0 -2
  136. package/dist/chunk-8d2f2e42.js +0 -2
  137. package/dist/chunk-a2bw46t9.js +0 -2
  138. package/dist/chunk-d5pt75tp.js +0 -2
  139. package/dist/chunk-em3aepxz.js +0 -2
  140. package/dist/chunk-g53sg7e0.js +0 -2
  141. package/dist/chunk-gsw8g2ev.js +0 -2
  142. package/dist/chunk-gz90fqn8.js +0 -2
  143. package/dist/chunk-gzd7bmp5.js +0 -2
  144. package/dist/chunk-hcqyf26s.js +0 -2
  145. package/dist/chunk-hhmj9gpk.js +0 -2
  146. package/dist/chunk-k2byvram.js +0 -2
  147. package/dist/chunk-kph7cenp.js +0 -2
  148. package/dist/chunk-papqmch6.js +0 -2
  149. package/dist/chunk-qambfx8c.js +0 -2
  150. package/dist/chunk-stfqkgfv.js +0 -2
  151. package/dist/chunk-t34ds1e3.js +0 -2
  152. package/dist/chunk-t4cbrm81.js +0 -2
  153. package/dist/chunk-t60pt4gv.js +0 -2
  154. package/dist/chunk-t6yjxhn8.js +0 -2
  155. package/dist/chunk-w89mazpv.js +0 -2
  156. package/dist/chunk-wq2fq6b7.js +0 -2
  157. package/dist/chunk-wsp8sj9v.js +0 -3
  158. package/dist/chunk-x8knte1j.js +0 -2
  159. package/dist/chunk-y7xshkqn.js +0 -2
  160. package/dist/chunk-ypsym37h.js +0 -2
  161. package/dist/chunk-z58ybwsv.js +0 -2
  162. package/dist/chunk-zteaygxc.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{o}from"./chunk-1z1632np.js";import{He,Q}from"./chunk-c1dkh0es.js";import{Ki}from"./chunk-s3dyzxwx.js";import{p}from"./chunk-2a4szpje.js";import{existsSync as A,mkdirSync as x,copyFileSync as T,chmodSync as P,rmSync as ue}from"fs";import{join as c,basename as be,resolve as H}from"path";import{spawn as q}from"child_process";import{platform as ge}from"os";var Xd=`
2
+ import{o}from"./chunk-9k2wz3k1.js";import{Ve,Q}from"./chunk-yfvm7q6t.js";import{Ki}from"./chunk-493x6e71.js";import{f}from"./chunk-b7e07ybq.js";import{existsSync as A,mkdirSync as x,copyFileSync as T,chmodSync as P,rmSync as ue}from"fs";import{join as c,basename as be,resolve as H}from"path";import{spawn as q}from"child_process";import{platform as ge}from"os";var Xd=`
3
3
  <script>
4
4
  (function() {
5
5
  'use strict';
@@ -2940,7 +2940,7 @@ ${a}`);return a+e}var Us={button:{nativeType:"craft-button",fallbackTag:"button"
2940
2940
  document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
2941
2941
  })();
2942
2942
  </script>
2943
- `;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(i,n,t)=>O("sidebar",n,t.trim(),r,a)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(i,n)=>O("sidebar",n,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(i,n,t)=>O(n,t,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(i,n,t,s)=>O(n,t,s.trim(),r,a)),e}function O(e,r,a,i,n){let t=i.components?.[e]||Us[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${n}-unknown" data-component="${e}">${a}</div>`;let s=N(r),d=[t.fallbackClasses||`${n}-${e}`];if(s.class)d.push(s.class),delete s.class;if(t.render)return s.__fallbackClasses=d.join(" "),t.render(s,a);let l=se(s,t,d);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${l}>`;return`<${t.fallbackTag} ${l}>${a}</${t.fallbackTag}>`}function N(e){let r={},a=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,i;while((i=a.exec(e))!==null){let[n,t,s,d]=i,l=s??d;if(n.startsWith(":"))r[t]=l;else if(n.startsWith("@"))r[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=l;else if(l===void 0)r[t]=!0;else r[t]=l}return r}function Y(e,r){let a=I(String(e.id||`craft-sidebar-${ie(r||JSON.stringify(e))}`)),i=te(e.spaces)||ee(r),n=i.length?[]:ae(e.sections)||z(r),t=String(e.selectedSpace||i[0]?.id||""),s=i.find((w)=>w.id===t)||i[0],d=String(e.selectedItem||e.selected||(i.length?s?.sections[0]?.items[0]?.id:n[0]?.items[0]?.id)||""),l={id:a,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:n,spaces:i,selectedSpace:t||void 0},u=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),f=Number(e.width||e.sidebarWidth||286),b=e.native===!1||e.native==="false"?"false":"true",y=l.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${k(l.searchPlaceholder)}"></div>`:"",g;if(i.length)g=re(i,t,d);else if(n.length)g=n.map((w)=>M(w,d)).join("");else g=r;return`<aside class="${v(u)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${v(a)}" data-native="${b}" style="--craft-sidebar-width:${f}px">
2943
+ `;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(i,n,t)=>O("sidebar",n,t.trim(),r,a)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(i,n)=>O("sidebar",n,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(i,n,t)=>O(n,t,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(i,n,t,s)=>O(n,t,s.trim(),r,a)),e}function O(e,r,a,i,n){let t=i.components?.[e]||Us[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${n}-unknown" data-component="${e}">${a}</div>`;let s=N(r),d=[t.fallbackClasses||`${n}-${e}`];if(s.class)d.push(s.class),delete s.class;if(t.render)return s.__fallbackClasses=d.join(" "),t.render(s,a);let l=se(s,t,d);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${l}>`;return`<${t.fallbackTag} ${l}>${a}</${t.fallbackTag}>`}function N(e){let r={},a=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,i;while((i=a.exec(e))!==null){let[n,t,s,d]=i,l=s??d;if(n.startsWith(":"))r[t]=l;else if(n.startsWith("@"))r[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=l;else if(l===void 0)r[t]=!0;else r[t]=l}return r}function Y(e,r){let a=I(String(e.id||`craft-sidebar-${ie(r||JSON.stringify(e))}`)),i=te(e.spaces)||ee(r),n=i.length?[]:ae(e.sections)||z(r),t=String(e.selectedSpace||i[0]?.id||""),s=i.find((w)=>w.id===t)||i[0],d=String(e.selectedItem||e.selected||(i.length?s?.sections[0]?.items[0]?.id:n[0]?.items[0]?.id)||""),l={id:a,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:n,spaces:i,selectedSpace:t||void 0},u=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),p=Number(e.width||e.sidebarWidth||286),b=e.native===!1||e.native==="false"?"false":"true",y=l.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${k(l.searchPlaceholder)}"></div>`:"",g;if(i.length)g=re(i,t,d);else if(n.length)g=n.map((w)=>M(w,d)).join("");else g=r;return`<aside class="${v(u)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${v(a)}" data-native="${b}" style="--craft-sidebar-width:${p}px">
2944
2944
  ${y}
2945
2945
  ${g}
2946
2946
  </aside>
@@ -2961,21 +2961,21 @@ ${a}`);return a+e}var Us={button:{nativeType:"craft-button",fallbackTag:"button"
2961
2961
  ${e.icon?`<span class="craft-sidebar-item-icon" data-icon="${v(e.icon)}"${a}></span>`:""}
2962
2962
  <span class="craft-sidebar-item-label">${k(e.label)}</span>
2963
2963
  ${e.badge?`<span class="craft-sidebar-item-badge">${k(e.badge)}</span>`:""}
2964
- </button>`}function I(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function ie(e){let r=5381;for(let a=0;a<e.length;a++)r=r*33^e.charCodeAt(a);return(r>>>0).toString(36)}function k(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function v(e){return k(e).replace(/`/g,"&#96;")}function ne(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function se(e,r,a){let i=[];i.push(`class="${a.join(" ")}"`),i.push(`data-craft="${r.nativeType}"`);for(let[n,t]of Object.entries(e))if(t===!0)i.push(n);else if(t!==!1&&t!==void 0&&t!==null){let s=String(t).replace(/"/g,"&quot;");i.push(`${n}="${s}"`)}return i.join(" ")}function Qd(e,r){Us[e]=r}function ep(){return{...Us}}import{copyFileSync as oe,mkdtempSync as ce,rmSync as de,writeFileSync as le}from"fs";import{tmpdir as fe}from"os";import{join as F}from"path";function pe(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 a=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-","-"],{stdin:r.stdout});if(a.exitCode!==0)throw Error(`Could not convert the macOS profile entitlements: ${a.stderr.toString().trim()||a.stdout.toString().trim()}`);let i=JSON.parse(a.stdout.toString());if(!i||typeof i!=="object"||Array.isArray(i))throw Error("The macOS profile entitlements must be a dictionary.");return i}async function L(e,r=[],a={}){if(process.platform!=="darwin")return;let i=a.entitlements,n;try{if(a.provisioningProfile){if(!a.identity||a.identity==="-")throw Error("A provisioning profile requires a signing identity.");let l=Bun.spawnSync(["/usr/bin/security","cms","-D","-i",a.provisioningProfile]);if(l.exitCode!==0)throw Error("Could not decode the macOS provisioning profile.");let u=pe(l.stdout),f={};if(a.entitlements){let b=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-",a.entitlements]);if(b.exitCode!==0)throw Error("Could not read the app entitlements plist.");f=JSON.parse(b.stdout.toString())}for(let b of["com.apple.application-identifier","com.apple.developer.team-identifier"])if(u[b])f[b]=u[b];if(n=ce(F(fe(),"stx-entitlements-")),i=F(n,"entitlements.plist"),le(i,JSON.stringify(f)),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",i]).exitCode!==0)throw Error("Could not generate the provisioned app entitlements.");oe(a.provisioningProfile,F(e,"Contents","embedded.provisionprofile"))}for(let l of[...r,e]){let u=a.hardenedRuntime?["--options","runtime"]:[];if(l===e&&i)u.push("--entitlements",i);let f=a.identity&&a.identity!=="-"?"--timestamp":"--timestamp=none",b=Bun.spawn(["/usr/bin/codesign","--force","--sign",a.identity||"-",f,...u,l],{stdout:"pipe",stderr:"pipe"}),[y,g]=await Promise.all([new Response(b.stderr).text(),b.exited]);if(g!==0)throw Error(`Could not sign native bundle ${l}: ${y.trim()}`)}let t=Bun.spawn(["/usr/bin/codesign","--verify","--strict",e],{stdout:"pipe",stderr:"pipe"}),[s,d]=await Promise.all([new Response(t.stderr).text(),t.exited]);if(d!==0)throw Error(`Invalid native bundle signature: ${s.trim()}`)}finally{if(n)de(n,{recursive:!0,force:!0})}}async function Hi(e){let r=Date.now();try{if(!await Bun.file(e.input).exists())return{success:!1,target:e.target||R(),format:e.format||"app",error:`Input file not found: ${e.input}`};let a=e.target||R(),i=e.format||ke(a);if(e.backend&&a!=="macos")throw Error("Native backend bundles currently support macOS only.");if(e.backend&&!A(H(e.backend.entry)))throw Error(`Native backend not found: ${e.backend.entry}`);let n=e.output||c(process.cwd(),"dist","native");if(!A(n))x(n,{recursive:!0});let t=await o(process.cwd()),s=await Ki(e.input,{context:e.context,options:{...t,isDev:!1}});if(s=Bi(s,{debug:e.verbose}),s=zi(s),!s.includes("craft-component-styles")){if(s.includes("</head>"))s=s.replace("</head>",`${Fi}
2965
- </head>`)}let d=e.name||be(e.input,".stx"),l=e.version||"1.0.0",u=e.craftPath||await Vi();if(!u)return{success:!1,target:a,format:i,error:"Craft native binary not found on PATH. Run pantry install craft, or specify craftPath for framework development."};if(e.verbose)console.log(`\uD83D\uDCE6 Building native app for ${a}...`),console.log(` Input: ${e.input}`),console.log(` Output: ${n}`),console.log(` Craft: ${u}`);let f;switch(a){case"macos":f=await me(s,d,l,n,i,e,u);break;case"windows":f=await xe(s,d,l,n,i,e,u);break;case"linux":f=await ye(s,d,l,n,i,e,u);break;case"ios":f=await Se(s,d,l,n,e,u);break;case"android":f=await Ce(s,d,l,n,e,u);break;default:f={success:!1,target:a,format:i,error:`Unsupported target: ${a}`}}return f.duration=Date.now()-r,f}catch(a){return{success:!1,target:e.target||R(),format:e.format||"app",error:a.message,duration:Date.now()-r}}}async function me(e,r,a,i,n,t,s){let d=t.bundleId||`com.stx.${r.toLowerCase().replace(/[^a-z0-9]/g,"")}`,l=c(i,`${r}.app`),u=c(l,"Contents"),f=c(u,"MacOS"),b=c(u,"Resources");ue(l,{recursive:!0,force:!0}),x(f,{recursive:!0}),x(b,{recursive:!0});let y=c(b,"index.html");await Bun.write(y,e);let g="";if(t.sidebar?.enabled&&t.sidebar?.config)g=c(b,"sidebar-config.json"),await Bun.write(g,JSON.stringify(t.sidebar.config));let w=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",C=t.menubarOnly??t.systemTray,m=t.bundleStyle||(await we(s)?"executable":"launcher");if(t.backend){if(!await he(s))throw Error("This Craft runtime does not support bundled backends. Upgrade Craft before building this app.");T(s,c(f,r)),P(c(f,r),493);let S=He("native-backend");try{let h=c(S,"launcher.ts"),_=c(import.meta.dir,"native-backend"+(import.meta.path.endsWith(".ts")?".ts":".js"));await Bun.write(h,`import { runNativeBackend } from ${JSON.stringify(_)}
2964
+ </button>`}function I(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function ie(e){let r=5381;for(let a=0;a<e.length;a++)r=r*33^e.charCodeAt(a);return(r>>>0).toString(36)}function k(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function v(e){return k(e).replace(/`/g,"&#96;")}function ne(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function se(e,r,a){let i=[];i.push(`class="${a.join(" ")}"`),i.push(`data-craft="${r.nativeType}"`);for(let[n,t]of Object.entries(e))if(t===!0)i.push(n);else if(t!==!1&&t!==void 0&&t!==null){let s=String(t).replace(/"/g,"&quot;");i.push(`${n}="${s}"`)}return i.join(" ")}function Qd(e,r){Us[e]=r}function ep(){return{...Us}}import{copyFileSync as oe,mkdtempSync as ce,rmSync as de,writeFileSync as le}from"fs";import{tmpdir as fe}from"os";import{join as F}from"path";function pe(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 a=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-","-"],{stdin:r.stdout});if(a.exitCode!==0)throw Error(`Could not convert the macOS profile entitlements: ${a.stderr.toString().trim()||a.stdout.toString().trim()}`);let i=JSON.parse(a.stdout.toString());if(!i||typeof i!=="object"||Array.isArray(i))throw Error("The macOS profile entitlements must be a dictionary.");return i}async function L(e,r=[],a={}){if(process.platform!=="darwin")return;let i=a.entitlements,n;try{if(a.provisioningProfile){if(!a.identity||a.identity==="-")throw Error("A provisioning profile requires a signing identity.");let l=Bun.spawnSync(["/usr/bin/security","cms","-D","-i",a.provisioningProfile]);if(l.exitCode!==0)throw Error("Could not decode the macOS provisioning profile.");let u=pe(l.stdout),p={};if(a.entitlements){let b=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-",a.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(u[b])p[b]=u[b];if(n=ce(F(fe(),"stx-entitlements-")),i=F(n,"entitlements.plist"),le(i,JSON.stringify(p)),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",i]).exitCode!==0)throw Error("Could not generate the provisioned app entitlements.");oe(a.provisioningProfile,F(e,"Contents","embedded.provisionprofile"))}for(let l of[...r,e]){let u=a.hardenedRuntime?["--options","runtime"]:[];if(l===e&&i)u.push("--entitlements",i);let p=a.identity&&a.identity!=="-"?"--timestamp":"--timestamp=none",b=Bun.spawn(["/usr/bin/codesign","--force","--sign",a.identity||"-",p,...u,l],{stdout:"pipe",stderr:"pipe"}),[y,g]=await Promise.all([new Response(b.stderr).text(),b.exited]);if(g!==0)throw Error(`Could not sign native bundle ${l}: ${y.trim()}`)}let t=Bun.spawn(["/usr/bin/codesign","--verify","--strict",e],{stdout:"pipe",stderr:"pipe"}),[s,d]=await Promise.all([new Response(t.stderr).text(),t.exited]);if(d!==0)throw Error(`Invalid native bundle signature: ${s.trim()}`)}finally{if(n)de(n,{recursive:!0,force:!0})}}async function Hi(e){let r=Date.now();try{if(!await Bun.file(e.input).exists())return{success:!1,target:e.target||R(),format:e.format||"app",error:`Input file not found: ${e.input}`};let a=e.target||R(),i=e.format||ke(a);if(e.backend&&a!=="macos")throw Error("Native backend bundles currently support macOS only.");if(e.backend&&!A(H(e.backend.entry)))throw Error(`Native backend not found: ${e.backend.entry}`);let n=e.output||c(process.cwd(),"dist","native");if(!A(n))x(n,{recursive:!0});let t=await o(process.cwd()),s=await Ki(e.input,{context:e.context,options:{...t,isDev:!1}});if(s=Bi(s,{debug:e.verbose}),s=zi(s),!s.includes("craft-component-styles")){if(s.includes("</head>"))s=s.replace("</head>",`${Fi}
2965
+ </head>`)}let d=e.name||be(e.input,".stx"),l=e.version||"1.0.0",u=e.craftPath||await Vi();if(!u)return{success:!1,target:a,format:i,error:"Craft native binary not found on PATH. Run pantry install craft, or specify craftPath for framework development."};if(e.verbose)console.log(`\uD83D\uDCE6 Building native app for ${a}...`),console.log(` Input: ${e.input}`),console.log(` Output: ${n}`),console.log(` Craft: ${u}`);let p;switch(a){case"macos":p=await me(s,d,l,n,i,e,u);break;case"windows":p=await xe(s,d,l,n,i,e,u);break;case"linux":p=await ye(s,d,l,n,i,e,u);break;case"ios":p=await Se(s,d,l,n,e,u);break;case"android":p=await Ce(s,d,l,n,e,u);break;default:p={success:!1,target:a,format:i,error:`Unsupported target: ${a}`}}return p.duration=Date.now()-r,p}catch(a){return{success:!1,target:e.target||R(),format:e.format||"app",error:a.message,duration:Date.now()-r}}}async function me(e,r,a,i,n,t,s){let d=t.bundleId||`com.stx.${r.toLowerCase().replace(/[^a-z0-9]/g,"")}`,l=c(i,`${r}.app`),u=c(l,"Contents"),p=c(u,"MacOS"),b=c(u,"Resources");ue(l,{recursive:!0,force:!0}),x(p,{recursive:!0}),x(b,{recursive:!0});let y=c(b,"index.html");await Bun.write(y,e);let g="";if(t.sidebar?.enabled&&t.sidebar?.config)g=c(b,"sidebar-config.json"),await Bun.write(g,JSON.stringify(t.sidebar.config));let w=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",C=t.menubarOnly??t.systemTray,m=t.bundleStyle||(await we(s)?"executable":"launcher");if(t.backend){if(!await he(s))throw Error("This Craft runtime does not support bundled backends. Upgrade Craft before building this app.");T(s,c(p,r)),P(c(p,r),493);let S=Ve("native-backend");try{let h=c(S,"launcher.ts"),_=c(import.meta.dir,"native-backend"+(import.meta.path.endsWith(".ts")?".ts":".js"));await Bun.write(h,`import { runNativeBackend } from ${JSON.stringify(_)}
2966
2966
  import handler from ${JSON.stringify(H(t.backend.entry))}
2967
2967
  await runNativeBackend({ html: ${JSON.stringify(e)}, fetch: handler,
2968
2968
  maxRequestBodySize: ${t.backend.maxRequestBodySize??33554432} })
2969
- `);let B=Bun.spawn([process.execPath,"build",h,"--compile","--minify","--no-compile-autoload-bunfig","--no-compile-autoload-dotenv","--outfile",c(f,"stx-backend")],{stdout:"pipe",stderr:"pipe"}),[E,W,J]=await Promise.all([new Response(B.stdout).text(),new Response(B.stderr).text(),B.exited]);if(J!==0)throw Error(`Native backend compilation failed: ${E}
2969
+ `);let B=Bun.spawn([process.execPath,"build",h,"--compile","--minify","--no-compile-autoload-bunfig","--no-compile-autoload-dotenv","--outfile",c(p,"stx-backend")],{stdout:"pipe",stderr:"pipe"}),[E,W,J]=await Promise.all([new Response(B.stdout).text(),new Response(B.stderr).text(),B.exited]);if(J!==0)throw Error(`Native backend compilation failed: ${E}
2970
2970
  ${W}`)}finally{Q(S)}await Bun.write(c(b,"craft.json"),`${JSON.stringify({backend:{executable:"stx-backend"},title:t.window?.title||r,appName:r,width:t.window?.width||1200,height:t.window?.height||800,devTools:Boolean(t.devTools),frameless:Boolean(t.window?.frameless),transparent:Boolean(t.window?.transparent),alwaysOnTop:Boolean(t.window?.alwaysOnTop),resizable:t.window?.resizable!==!1,...t.trayPopover?{trayPopover:!0}:C?{menubarOnly:!0}:t.systemTray?{systemTray:!0}:{}},null,2)}
2971
- `)}else if(m==="executable"){let S=c(f,r);T(s,S),P(S,493);let h={html:"index.html",title:t.window?.title||r,width:t.window?.width||1200,height:t.window?.height||800,devTools:Boolean(t.devTools)};if(t.trayPopover)h.trayPopover=!0;else if(C)h.menubarOnly=!0;else if(t.systemTray)h.systemTray=!0;if(t.window?.frameless)h.frameless=!0;if(t.window?.transparent)h.transparent=!0;if(t.window?.alwaysOnTop)h.alwaysOnTop=!0;if(t.window?.resizable===!1)h.resizable=!1;await Bun.write(c(b,"craft.json"),`${JSON.stringify(h,null,2)}
2972
- `)}else{let S=c(f,"craft");T(s,S),P(S,493);let h=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",B=`#!/bin/bash
2971
+ `)}else if(m==="executable"){let S=c(p,r);T(s,S),P(S,493);let h={html:"index.html",title:t.window?.title||r,width:t.window?.width||1200,height:t.window?.height||800,devTools:Boolean(t.devTools)};if(t.trayPopover)h.trayPopover=!0;else if(C)h.menubarOnly=!0;else if(t.systemTray)h.systemTray=!0;if(t.window?.frameless)h.frameless=!0;if(t.window?.transparent)h.transparent=!0;if(t.window?.alwaysOnTop)h.alwaysOnTop=!0;if(t.window?.resizable===!1)h.resizable=!1;await Bun.write(c(b,"craft.json"),`${JSON.stringify(h,null,2)}
2972
+ `)}else{let S=c(p,"craft");T(s,S),P(S,493);let h=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",B=`#!/bin/bash
2973
2973
  set -euo pipefail
2974
2974
  DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
2975
2975
  RESOURCES="$DIR/../Resources"
2976
2976
  exec "$DIR/craft" --html-file "$RESOURCES/index.html" \\
2977
2977
  ${[`--title "${t.window?.title||r}"`,`--width ${t.window?.width||1200}`,`--height ${t.window?.height||800}`,t.trayPopover?"--tray-popover":C?"--menubar-only":t.systemTray?"--system-tray":"",t.devTools?"":"--no-devtools",t.window?.frameless?"--frameless":"",t.window?.transparent?"--transparent":"",t.window?.alwaysOnTop?"--always-on-top":"",t.window?.resizable===!1?"--no-resize":"",h].filter(Boolean).join(" \\\n ")}
2978
- `,E=c(f,r);await Bun.write(E,B),P(E,493)}let D=Boolean(t.icon&&await Bun.file(t.icon).exists());if(D)T(t.icon,c(b,"AppIcon.icns"));let V={CFBundleInfoDictionaryVersion:"6.0",CFBundleExecutable:r,CFBundleIdentifier:d,CFBundleName:r,CFBundleDisplayName:r,CFBundleShortVersionString:a,CFBundleVersion:a,CFBundlePackageType:"APPL",CFBundleSignature:"????",LSMinimumSystemVersion:t.minimumSystemVersion||"13.0",NSHighResolutionCapable:!0,NSSupportsAutomaticGraphicsSwitching:!0,LSUIElement:t.trayPopover||(t.menubarOnly??Boolean(t.systemTray)),...D?{CFBundleIconFile:"AppIcon"}:{},...t.category?{LSApplicationCategoryType:t.category}:{},...t.copyright?{NSHumanReadableCopyright:t.copyright}:{},...t.infoPlist||{}};if(await Bun.write(c(u,"Info.plist"),ve(V)),await L(l,t.backend?[c(f,"stx-backend")]:m==="launcher"?[c(f,"craft")]:[],t.macosSigning),n==="dmg"){let S=c(i,`${r}-${a}.dmg`),h=await $e(l,S,r);if(!h.success)return{success:!1,target:"macos",format:"dmg",error:h.error};return{success:!0,target:"macos",format:"dmg",outputPath:S}}return{success:!0,target:"macos",format:"app",outputPath:l}}async function he(e){let r=Bun.spawn([e,"--capabilities"],{stdout:"pipe",stderr:"pipe"}),a=setTimeout(()=>r.kill(),5000);try{let[i,n,t]=await Promise.all([new Response(r.stdout).text(),new Response(r.stderr).text(),r.exited]);if(t!==0)return!1;return JSON.parse(`${i}${n}`.trim()).bundleBackend===!0}catch{return!1}finally{clearTimeout(a)}}async function we(e){try{let r=Bun.spawn([e,"--version"],{stdout:"pipe",stderr:"pipe"}),[a,i]=await Promise.all([new Response(r.stdout).text(),new Response(r.stderr).text()]);await r.exited;let t=`${a}
2978
+ `,E=c(p,r);await Bun.write(E,B),P(E,493)}let D=Boolean(t.icon&&await Bun.file(t.icon).exists());if(D)T(t.icon,c(b,"AppIcon.icns"));let V={CFBundleInfoDictionaryVersion:"6.0",CFBundleExecutable:r,CFBundleIdentifier:d,CFBundleName:r,CFBundleDisplayName:r,CFBundleShortVersionString:a,CFBundleVersion:a,CFBundlePackageType:"APPL",CFBundleSignature:"????",LSMinimumSystemVersion:t.minimumSystemVersion||"13.0",NSHighResolutionCapable:!0,NSSupportsAutomaticGraphicsSwitching:!0,LSUIElement:t.trayPopover||(t.menubarOnly??Boolean(t.systemTray)),...D?{CFBundleIconFile:"AppIcon"}:{},...t.category?{LSApplicationCategoryType:t.category}:{},...t.copyright?{NSHumanReadableCopyright:t.copyright}:{},...t.infoPlist||{}};if(await Bun.write(c(u,"Info.plist"),ve(V)),await L(l,t.backend?[c(p,"stx-backend")]:m==="launcher"?[c(p,"craft")]:[],t.macosSigning),n==="dmg"){let S=c(i,`${r}-${a}.dmg`),h=await $e(l,S,r);if(!h.success)return{success:!1,target:"macos",format:"dmg",error:h.error};return{success:!0,target:"macos",format:"dmg",outputPath:S}}return{success:!0,target:"macos",format:"app",outputPath:l}}async function he(e){let r=Bun.spawn([e,"--capabilities"],{stdout:"pipe",stderr:"pipe"}),a=setTimeout(()=>r.kill(),5000);try{let[i,n,t]=await Promise.all([new Response(r.stdout).text(),new Response(r.stderr).text(),r.exited]);if(t!==0)return!1;return JSON.parse(`${i}${n}`.trim()).bundleBackend===!0}catch{return!1}finally{clearTimeout(a)}}async function we(e){try{let r=Bun.spawn([e,"--version"],{stdout:"pipe",stderr:"pipe"}),[a,i]=await Promise.all([new Response(r.stdout).text(),new Response(r.stderr).text()]);await r.exited;let t=`${a}
2979
2979
  ${i}`.match(/(\d+)\.(\d+)\.(\d+)/);if(!t)return!1;let[s,d,l]=t.slice(1).map(Number);if(s>0||d>0)return!0;return l>=57}catch{return!1}}function j(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ve(e){return`<?xml version="1.0" encoding="UTF-8"?>
2980
2980
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
2981
2981
  <plist version="1.0">
@@ -2993,7 +2993,7 @@ set DIR=%~dp0
2993
2993
  --height ${t.window?.height||800} ^
2994
2994
  ${t.systemTray?"--system-tray":""} ^
2995
2995
  ${t.devTools?"":"--no-devtools"}
2996
- `;if(await Bun.write(c(d,`${r}.bat`),u),n==="zip"){let f=c(i,`${r}-${a}-windows.zip`),b=await Te(d,f);if(!b.success)return{success:!1,target:"windows",format:"zip",error:b.error};return{success:!0,target:"windows",format:"zip",outputPath:f}}return{success:!0,target:"windows",format:"app",outputPath:d}}async function ye(e,r,a,i,n,t,s){let d=c(i,r);x(d,{recursive:!0});let l=c(d,"index.html");await Bun.write(l,e);let u=c(d,"craft");T(s,u),P(u,493);let f=`#!/bin/bash
2996
+ `;if(await Bun.write(c(d,`${r}.bat`),u),n==="zip"){let p=c(i,`${r}-${a}-windows.zip`),b=await Te(d,p);if(!b.success)return{success:!1,target:"windows",format:"zip",error:b.error};return{success:!0,target:"windows",format:"zip",outputPath:p}}return{success:!0,target:"windows",format:"app",outputPath:d}}async function ye(e,r,a,i,n,t,s){let d=c(i,r);x(d,{recursive:!0});let l=c(d,"index.html");await Bun.write(l,e);let u=c(d,"craft");T(s,u),P(u,493);let p=`#!/bin/bash
2997
2997
  set -euo pipefail
2998
2998
  DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
2999
2999
  exec "$DIR/craft" --html-file "$DIR/index.html" \\
@@ -3002,14 +3002,14 @@ exec "$DIR/craft" --html-file "$DIR/index.html" \\
3002
3002
  --height ${t.window?.height||800} \\
3003
3003
  ${t.systemTray?"--system-tray":""} \\
3004
3004
  ${t.devTools?"":"--no-devtools"}
3005
- `,b=c(d,r.toLowerCase());await Bun.write(b,f),P(b,493);let y=`[Desktop Entry]
3005
+ `,b=c(d,r.toLowerCase());await Bun.write(b,p),P(b,493);let y=`[Desktop Entry]
3006
3006
  Type=Application
3007
3007
  Name=${r}
3008
3008
  Exec=${b}
3009
3009
  Terminal=false
3010
3010
  Categories=Utility;
3011
- `;if(await Bun.write(c(d,`${r.toLowerCase()}.desktop`),y),n==="deb"){let g=c(i,`${r.toLowerCase()}_${a}_amd64.deb`),w=await Pe(d,g,r,a,t);if(!w.success)return{success:!1,target:"linux",format:"deb",error:w.error};return{success:!0,target:"linux",format:"deb",outputPath:g}}if(n==="appimage"){let g=c(i,`${r}-${a}-x86_64.AppImage`),w=await Ie(d,g,r,t);if(!w.success)return{success:!1,target:"linux",format:"appimage",error:w.error};return{success:!0,target:"linux",format:"appimage",outputPath:g}}return{success:!0,target:"linux",format:"app",outputPath:d}}async function Se(e,r,a,i,n,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 Ce(e,r,a,i,n,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 Vi(){let e=process.env.CRAFT_BIN;if(e){if(!A(e))throw Error(`CRAFT_BIN points to a missing file: ${e}`);return e}return Bun.which("craft",{PATH:process.env.PATH??"",cwd:process.cwd()})}function R(){switch(ge()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function ke(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 $e(e,r,a){return new Promise((i)=>{let n=q("hdiutil",["create","-volname",a,"-srcfolder",e,"-ov","-format","UDZO",r]);n.on("close",(t)=>{if(t===0)i({success:!0});else i({success:!1,error:`hdiutil exited with code ${t}`})}),n.on("error",(t)=>{i({success:!1,error:t.message})})})}async function Te(e,r){return new Promise((a)=>{let i=q("zip",["-r",r,"."],{cwd:e});i.on("close",(n)=>{if(n===0)a({success:!0});else a({success:!1,error:`zip exited with code ${n}`})}),i.on("error",(n)=>{a({success:!1,error:n.message})})})}async function Pe(e,r,a,i,n){return new Promise((t)=>{let s=He("deb");try{let d=c(s,"pkg"),l=c(d,"DEBIAN"),u=c(d,"usr","bin"),f=c(d,"usr","share","applications"),b=c(d,"usr","share",a.toLowerCase());x(l,{recursive:!0}),x(u,{recursive:!0}),x(f,{recursive:!0}),x(b,{recursive:!0});let y=p("fs").readdirSync(e);for(let m of y)T(c(e,m),c(b,m));let g=`#!/bin/bash
3012
- exec /usr/share/${a.toLowerCase()}/${a.toLowerCase()} "$@"`;p("fs").writeFileSync(c(u,a.toLowerCase()),g),P(c(u,a.toLowerCase()),493);let w=`Package: ${a.toLowerCase()}
3011
+ `;if(await Bun.write(c(d,`${r.toLowerCase()}.desktop`),y),n==="deb"){let g=c(i,`${r.toLowerCase()}_${a}_amd64.deb`),w=await Pe(d,g,r,a,t);if(!w.success)return{success:!1,target:"linux",format:"deb",error:w.error};return{success:!0,target:"linux",format:"deb",outputPath:g}}if(n==="appimage"){let g=c(i,`${r}-${a}-x86_64.AppImage`),w=await Ie(d,g,r,t);if(!w.success)return{success:!1,target:"linux",format:"appimage",error:w.error};return{success:!0,target:"linux",format:"appimage",outputPath:g}}return{success:!0,target:"linux",format:"app",outputPath:d}}async function Se(e,r,a,i,n,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 Ce(e,r,a,i,n,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 Vi(){let e=process.env.CRAFT_BIN;if(e){if(!A(e))throw Error(`CRAFT_BIN points to a missing file: ${e}`);return e}return Bun.which("craft",{PATH:process.env.PATH??"",cwd:process.cwd()})}function R(){switch(ge()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function ke(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 $e(e,r,a){return new Promise((i)=>{let n=q("hdiutil",["create","-volname",a,"-srcfolder",e,"-ov","-format","UDZO",r]);n.on("close",(t)=>{if(t===0)i({success:!0});else i({success:!1,error:`hdiutil exited with code ${t}`})}),n.on("error",(t)=>{i({success:!1,error:t.message})})})}async function Te(e,r){return new Promise((a)=>{let i=q("zip",["-r",r,"."],{cwd:e});i.on("close",(n)=>{if(n===0)a({success:!0});else a({success:!1,error:`zip exited with code ${n}`})}),i.on("error",(n)=>{a({success:!1,error:n.message})})})}async function Pe(e,r,a,i,n){return new Promise((t)=>{let s=Ve("deb");try{let d=c(s,"pkg"),l=c(d,"DEBIAN"),u=c(d,"usr","bin"),p=c(d,"usr","share","applications"),b=c(d,"usr","share",a.toLowerCase());x(l,{recursive:!0}),x(u,{recursive:!0}),x(p,{recursive:!0}),x(b,{recursive:!0});let y=f("fs").readdirSync(e);for(let m of y)T(c(e,m),c(b,m));let g=`#!/bin/bash
3012
+ exec /usr/share/${a.toLowerCase()}/${a.toLowerCase()} "$@"`;f("fs").writeFileSync(c(u,a.toLowerCase()),g),P(c(u,a.toLowerCase()),493);let w=`Package: ${a.toLowerCase()}
3013
3013
  Version: ${i}
3014
3014
  Section: utils
3015
3015
  Priority: optional
@@ -3017,17 +3017,17 @@ Architecture: amd64
3017
3017
  Depends: libgtk-3-0, libwebkit2gtk-4.0-37
3018
3018
  Maintainer: ${n.author||"Unknown"}
3019
3019
  Description: ${n.description||a}
3020
- `;p("fs").writeFileSync(c(l,"control"),w);let C=q("dpkg-deb",["--build",d,r]);C.on("close",(m)=>{if(Q(s),m===0)t({success:!0});else t({success:!1,error:`dpkg-deb exited with code ${m}`})}),C.on("error",(m)=>{Q(s),t({success:!1,error:m.message})})}catch(d){Q(s),t({success:!1,error:d.message})}})}async function Ie(e,r,a,i){return new Promise((n)=>{let t=He("appimage");try{let s=c(t,`${a}.AppDir`),d=c(s,"usr"),l=c(d,"bin"),u=c(d,"share");x(l,{recursive:!0}),x(u,{recursive:!0});let f=c(u,a.toLowerCase());x(f,{recursive:!0});let b=p("fs").readdirSync(e);for(let m of b)T(c(e,m),c(f,m));let y=`#!/bin/bash
3020
+ `;f("fs").writeFileSync(c(l,"control"),w);let C=q("dpkg-deb",["--build",d,r]);C.on("close",(m)=>{if(Q(s),m===0)t({success:!0});else t({success:!1,error:`dpkg-deb exited with code ${m}`})}),C.on("error",(m)=>{Q(s),t({success:!1,error:m.message})})}catch(d){Q(s),t({success:!1,error:d.message})}})}async function Ie(e,r,a,i){return new Promise((n)=>{let t=Ve("appimage");try{let s=c(t,`${a}.AppDir`),d=c(s,"usr"),l=c(d,"bin"),u=c(d,"share");x(l,{recursive:!0}),x(u,{recursive:!0});let p=c(u,a.toLowerCase());x(p,{recursive:!0});let b=f("fs").readdirSync(e);for(let m of b)T(c(e,m),c(p,m));let y=`#!/bin/bash
3021
3021
  SELF=$(readlink -f "$0")
3022
3022
  HERE=\${SELF%/*}
3023
3023
  export PATH="\${HERE}/usr/bin:\${PATH}"
3024
3024
  exec "\${HERE}/usr/share/${a.toLowerCase()}/${a.toLowerCase()}" "$@"
3025
- `;p("fs").writeFileSync(c(s,"AppRun"),y),P(c(s,"AppRun"),493);let g=`[Desktop Entry]
3025
+ `;f("fs").writeFileSync(c(s,"AppRun"),y),P(c(s,"AppRun"),493);let g=`[Desktop Entry]
3026
3026
  Type=Application
3027
3027
  Name=${a}
3028
3028
  Exec=${a.toLowerCase()}
3029
3029
  Terminal=false
3030
3030
  Categories=Utility;
3031
3031
  Icon=${a.toLowerCase()}
3032
- `;p("fs").writeFileSync(c(s,`${a.toLowerCase()}.desktop`),g);let w=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(p("fs").writeFileSync(c(s,`${a.toLowerCase()}.png`),w),i.icon&&A(i.icon))T(i.icon,c(s,`${a.toLowerCase()}.png`));let C=q("appimagetool",[s,r],{env:{...process.env,ARCH:"x86_64"}});C.on("close",(m)=>{if(Q(t),m===0)P(r,493),n({success:!0});else n({success:!1,error:`appimagetool exited with code ${m}. Install from https://appimage.github.io/appimagetool/`})}),C.on("error",(m)=>{Q(t),n({success:!1,error:`appimagetool not found: ${m.message}`})})}catch(s){Q(t),n({success:!1,error:s.message})}})}function Ui(){return[R()]}function Wi(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 Be={buildNative:Hi,getAvailableTargets:Ui,getAvailableFormats:Wi,detectPlatform:R},tp=Be;
3032
+ `;f("fs").writeFileSync(c(s,`${a.toLowerCase()}.desktop`),g);let w=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(f("fs").writeFileSync(c(s,`${a.toLowerCase()}.png`),w),i.icon&&A(i.icon))T(i.icon,c(s,`${a.toLowerCase()}.png`));let C=q("appimagetool",[s,r],{env:{...process.env,ARCH:"x86_64"}});C.on("close",(m)=>{if(Q(t),m===0)P(r,493),n({success:!0});else n({success:!1,error:`appimagetool exited with code ${m}. Install from https://appimage.github.io/appimagetool/`})}),C.on("error",(m)=>{Q(t),n({success:!1,error:`appimagetool not found: ${m.message}`})})}catch(s){Q(t),n({success:!1,error:s.message})}})}function Ui(){return[R()]}function Wi(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 Be={buildNative:Hi,getAvailableTargets:Ui,getAvailableFormats:Wi,detectPlatform:R},tp=Be;
3033
3033
  export{Xd,ji,Jd,Yd,Bi,Us,Fi,Zd,zi,Qd,ep,Hi,Vi,Ui,Wi,tp};