@stacksjs/stx 0.2.358 → 0.2.360

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 (161) hide show
  1. package/dist/{chunk-wkyt4j9e.js → chunk-0dkaztpp.js} +1 -1
  2. package/dist/{chunk-jmdxn2mq.js → chunk-0p52xkk9.js} +1 -1
  3. package/dist/{chunk-3y8vvkar.js → chunk-0ppgyq8q.js} +1 -1
  4. package/dist/{chunk-0dj2gne3.js → chunk-0vrn78j5.js} +1 -1
  5. package/dist/chunk-0vvqxeq3.js +2 -0
  6. package/dist/{chunk-2gtwha4k.js → chunk-0w12p79j.js} +1 -1
  7. package/dist/chunk-11hfa3kp.js +2 -0
  8. package/dist/{chunk-19m7hed6.js → chunk-135mme4g.js} +1 -1
  9. package/dist/{chunk-ms25gb16.js → chunk-175da6nh.js} +1 -1
  10. package/dist/{chunk-hy79zwyy.js → chunk-198fr2d4.js} +1 -1
  11. package/dist/{chunk-e48050x3.js → chunk-1c2k7713.js} +1 -1
  12. package/dist/{chunk-2s3wvns6.js → chunk-1e0jj83h.js} +1 -1
  13. package/dist/{chunk-f72c62s7.js → chunk-1hvxs7rh.js} +1 -1
  14. package/dist/chunk-1tfhw9c0.js +2 -0
  15. package/dist/{chunk-q4kgqqed.js → chunk-1tz8fb87.js} +2 -2
  16. package/dist/{chunk-3ssjb8cx.js → chunk-2119txb8.js} +201 -201
  17. package/dist/{chunk-mdbj7sq8.js → chunk-2c907a77.js} +1 -1
  18. package/dist/{chunk-ez003q74.js → chunk-2xpdcr8c.js} +1 -1
  19. package/dist/{chunk-qnptmtqh.js → chunk-3v63btq1.js} +1 -1
  20. package/dist/{chunk-7v1g7prf.js → chunk-3xspzgrq.js} +1 -1
  21. package/dist/{chunk-tf16jtj4.js → chunk-4arms0am.js} +1 -1
  22. package/dist/chunk-4qhhbzx9.js +2 -0
  23. package/dist/{chunk-rydb5n5b.js → chunk-5fzgdrfy.js} +1 -1
  24. package/dist/{chunk-nybn003d.js → chunk-5j3v0p6s.js} +1 -1
  25. package/dist/{chunk-x5b8az2h.js → chunk-5mjz2qgs.js} +1 -1
  26. package/dist/chunk-6nf5g9bh.js +2 -0
  27. package/dist/chunk-6pdfvpa6.js +2 -0
  28. package/dist/chunk-71gg4a7z.js +2 -0
  29. package/dist/chunk-7k7vqrj3.js +2 -0
  30. package/dist/{chunk-0smr2xjs.js → chunk-7kfv1q2r.js} +1 -1
  31. package/dist/chunk-7ppey2yt.js +2 -0
  32. package/dist/{chunk-aa8015mk.js → chunk-7racewc5.js} +1 -1
  33. package/dist/{chunk-t23kccpz.js → chunk-7rj4h2t2.js} +2 -2
  34. package/dist/{chunk-apbr1kb1.js → chunk-7wj5je2t.js} +1 -1
  35. package/dist/{chunk-284kattb.js → chunk-83af26bs.js} +1 -1
  36. package/dist/{chunk-qrvey4wk.js → chunk-84577w4y.js} +1 -1
  37. package/dist/{chunk-9qdn9y72.js → chunk-89xwdc1d.js} +1 -1
  38. package/dist/{chunk-f2jypsax.js → chunk-8akj7f4h.js} +1 -1
  39. package/dist/chunk-8e6fgnk5.js +2 -0
  40. package/dist/chunk-93z5qt1s.js +2 -0
  41. package/dist/{chunk-94dz7hrj.js → chunk-a5cybvfv.js} +1 -1
  42. package/dist/{chunk-a4jhcbsh.js → chunk-a68y9s2j.js} +2 -2
  43. package/dist/{chunk-m0eg86q3.js → chunk-b381xgvw.js} +1 -1
  44. package/dist/{chunk-dtdwjpvf.js → chunk-bab01mkf.js} +1 -1
  45. package/dist/{chunk-79fj9zem.js → chunk-benx1c4p.js} +1 -1
  46. package/dist/chunk-bqm306xw.js +2 -0
  47. package/dist/chunk-bxkr3ts9.js +2 -0
  48. package/dist/{chunk-hcf8399w.js → chunk-ct8tvahc.js} +1 -1
  49. package/dist/chunk-d0350ak9.js +2 -0
  50. package/dist/chunk-d5gzma79.js +2 -0
  51. package/dist/{chunk-kjd9hbg4.js → chunk-dj24n5n7.js} +3 -3
  52. package/dist/{chunk-hkrzv980.js → chunk-dnard9gp.js} +2 -2
  53. package/dist/{chunk-sa6cgj9h.js → chunk-dwyad9gb.js} +1 -1
  54. package/dist/{chunk-trva71am.js → chunk-e03m4har.js} +2 -2
  55. package/dist/{chunk-c17ybabd.js → chunk-enjfp0tp.js} +1 -1
  56. package/dist/chunk-erbyg322.js +2 -0
  57. package/dist/chunk-g6av70d6.js +2 -0
  58. package/dist/{chunk-j6kec9kp.js → chunk-g8k2zj4z.js} +1 -1
  59. package/dist/chunk-gzr4mcp2.js +2 -0
  60. package/dist/{chunk-awyyskad.js → chunk-hkq7d4t2.js} +1 -1
  61. package/dist/{chunk-ykevda74.js → chunk-jc6wrxrh.js} +2 -2
  62. package/dist/{chunk-rcbt11p8.js → chunk-k11mck47.js} +1 -1
  63. package/dist/{chunk-3kd0zn9c.js → chunk-k91ej0ts.js} +1 -1
  64. package/dist/{chunk-tv04k7gq.js → chunk-karkhcja.js} +1 -1
  65. package/dist/{chunk-5270fyk7.js → chunk-kd95t585.js} +1 -1
  66. package/dist/{chunk-emjmshj8.js → chunk-m8kem5ca.js} +1 -1
  67. package/dist/{chunk-n5tpqzcb.js → chunk-m8nmsr4g.js} +1 -1
  68. package/dist/{chunk-v1qm7p7t.js → chunk-masf0yq5.js} +2 -2
  69. package/dist/{chunk-czj6nq0b.js → chunk-met6wtbk.js} +2 -2
  70. package/dist/{chunk-ep034wt0.js → chunk-mzrejx5e.js} +1 -1
  71. package/dist/chunk-n6eg071x.js +2 -0
  72. package/dist/chunk-nabannen.js +2 -0
  73. package/dist/{chunk-wz4fnsat.js → chunk-necx4e30.js} +1 -1
  74. package/dist/chunk-p1ycxzwx.js +2 -0
  75. package/dist/{chunk-7jcntsp4.js → chunk-p41s1y4v.js} +1 -1
  76. package/dist/{chunk-j8wycqve.js → chunk-pf8575bx.js} +1 -1
  77. package/dist/{chunk-b8ywrx2w.js → chunk-pt74619a.js} +1 -1
  78. package/dist/{chunk-krt45cqy.js → chunk-pwctc0m1.js} +1 -1
  79. package/dist/{chunk-degz74nv.js → chunk-qg0w5tjb.js} +1 -1
  80. package/dist/{chunk-z50ex86m.js → chunk-r55bx7r8.js} +1 -1
  81. package/dist/chunk-r6sacvqn.js +2 -0
  82. package/dist/{chunk-6yfccnr7.js → chunk-r6xmsxaz.js} +1 -1
  83. package/dist/{chunk-3kyydhzt.js → chunk-r7q89mv2.js} +1 -1
  84. package/dist/{chunk-ec8jsqgm.js → chunk-rargfb5s.js} +2 -2
  85. package/dist/chunk-s3q7k0bf.js +2 -0
  86. package/dist/{chunk-6qhatdte.js → chunk-s4jbvdx3.js} +2 -2
  87. package/dist/chunk-sd57d9bq.js +2 -0
  88. package/dist/chunk-syxe0cyd.js +2 -0
  89. package/dist/{chunk-6gsgayq3.js → chunk-t9m81dj8.js} +1 -1
  90. package/dist/{chunk-zxfejz72.js → chunk-ta6z7k4p.js} +1 -1
  91. package/dist/chunk-tfjv0567.js +2 -0
  92. package/dist/{chunk-kyyt9xhs.js → chunk-v90kxg77.js} +1 -1
  93. package/dist/{chunk-czypgdc1.js → chunk-vcdd231w.js} +1 -1
  94. package/dist/{chunk-qbz6yn8c.js → chunk-vgx5077x.js} +2 -2
  95. package/dist/{chunk-gn2qc03b.js → chunk-vj5ywxmb.js} +1 -1
  96. package/dist/chunk-vnwzzw9j.js +2 -0
  97. package/dist/{chunk-rtfwn4cm.js → chunk-vsqx756d.js} +1 -1
  98. package/dist/{chunk-cf9gt3h9.js → chunk-vyhrzsnf.js} +10 -10
  99. package/dist/{chunk-ejwfnttb.js → chunk-w1asc0zd.js} +1 -1
  100. package/dist/{chunk-f11z7q5g.js → chunk-x0c5vqss.js} +1 -1
  101. package/dist/{chunk-zxnf0c9x.js → chunk-x6c2t5dv.js} +1 -1
  102. package/dist/{chunk-h99qxgbr.js → chunk-xb23pzwa.js} +1 -1
  103. package/dist/{chunk-eg8k598q.js → chunk-xb2fcf36.js} +1 -1
  104. package/dist/{chunk-1nnza3m6.js → chunk-xk402w4a.js} +1 -1
  105. package/dist/chunk-xn226qe0.js +2 -0
  106. package/dist/{chunk-aacfyyya.js → chunk-xnbbnbtm.js} +1 -1
  107. package/dist/{chunk-n1y0hjk1.js → chunk-ypgyhr2p.js} +1 -1
  108. package/dist/{chunk-hh0aaxxy.js → chunk-z2rvc8d5.js} +2 -2
  109. package/dist/chunk-za8wxkx6.js +2 -0
  110. package/dist/{chunk-8xjasa91.js → chunk-zd172hvg.js} +1 -1
  111. package/dist/{chunk-4gtsf1xw.js → chunk-zf66zyyy.js} +1 -1
  112. package/dist/chunk-zmvgsgtd.js +2 -0
  113. package/dist/{chunk-0c49cy69.js → chunk-zxf0deg6.js} +1 -1
  114. package/dist/{chunk-mere396d.js → chunk-zxptxz2b.js} +1 -1
  115. package/dist/cli.js +14 -14
  116. package/dist/client-declarations.d.ts +24 -0
  117. package/dist/client-declarations.js +33 -0
  118. package/dist/client-script.js +2 -33
  119. package/dist/craft-entry.js +1 -1
  120. package/dist/craft.js +1 -1
  121. package/dist/database.js +1 -1
  122. package/dist/loop-binding.d.ts +23 -0
  123. package/dist/loop-binding.js +12 -0
  124. package/dist/loops.d.ts +20 -23
  125. package/dist/loops.js +9 -13
  126. package/dist/pwa.js +2 -2
  127. package/dist/ssg.js +2 -2
  128. package/dist/stx-virtual-ts.d.ts +27 -0
  129. package/dist/stx-virtual-ts.js +57 -10
  130. package/dist/visual-testing.js +1 -1
  131. package/package.json +5 -5
  132. package/dist/chunk-0chkqvs1.js +0 -2
  133. package/dist/chunk-0d6qgbks.js +0 -2
  134. package/dist/chunk-2x3zy811.js +0 -2
  135. package/dist/chunk-38mpg3kn.js +0 -2
  136. package/dist/chunk-3f782ywp.js +0 -2
  137. package/dist/chunk-4mkqzhfh.js +0 -2
  138. package/dist/chunk-54w1tgzq.js +0 -2
  139. package/dist/chunk-5x0zjm34.js +0 -2
  140. package/dist/chunk-7nf8azjh.js +0 -2
  141. package/dist/chunk-8wgsjh65.js +0 -2
  142. package/dist/chunk-a6x0czvr.js +0 -2
  143. package/dist/chunk-abtxpqna.js +0 -2
  144. package/dist/chunk-c4rpdtvw.js +0 -2
  145. package/dist/chunk-cgs5xpsn.js +0 -2
  146. package/dist/chunk-dpyc7pht.js +0 -2
  147. package/dist/chunk-e0f3qs59.js +0 -2
  148. package/dist/chunk-f3eb1f6z.js +0 -2
  149. package/dist/chunk-fzq2n865.js +0 -2
  150. package/dist/chunk-g3cmkyk2.js +0 -2
  151. package/dist/chunk-gxgrzeeh.js +0 -2
  152. package/dist/chunk-p78b80dp.js +0 -2
  153. package/dist/chunk-pr3hz3ec.js +0 -2
  154. package/dist/chunk-skdfq4hq.js +0 -2
  155. package/dist/chunk-w1a8dwgx.js +0 -2
  156. package/dist/chunk-w9gserf7.js +0 -2
  157. package/dist/chunk-x131a0jq.js +0 -2
  158. package/dist/chunk-xk782v5z.js +0 -2
  159. package/dist/chunk-xxrv2p42.js +0 -2
  160. package/dist/chunk-ynj1y0qm.js +0 -2
  161. package/dist/chunk-z8gccz1q.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Rw as y}from"./chunk-emjmshj8.js";function w4(){if(typeof Notification<"u"&&Notification.permission==="granted")return!0;return!1}function jZ(){return typeof window<"u"&&typeof document<"u"}async function B4(){if(typeof Notification>"u")return!1;if(Notification.permission==="granted")return!0;if(Notification.permission==="denied")return!1;return await Notification.requestPermission()==="granted"}var g=new Map;function f4(){return`alert-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function v4(Z){switch(Z){case"info":return"&#x2139;";case"success":return"&#x2714;";case"warning":return"&#x26A0;";case"error":return"&#x2716;";default:return"&#x2139;"}}function y4(Z="top-right"){if(!jZ())throw Error("Toast container requires browser environment");try{let $=document.querySelector(`.stx-toast-container[data-position="${Z}"]`);if($)return $}catch{}let Y=document.createElement("div");Y.className=`stx-toast-container ${Z}`,Y.dataset.position=Z;try{if(document.body)document.body.appendChild(Y)}catch{}return Y}function g4(Z){let{options:Y}=Z,$=v4(Y.type),J=Y.type||"info",Q=Y.duration!==0;return`
2
+ import{Sw as y}from"./chunk-m8kem5ca.js";function w4(){if(typeof Notification<"u"&&Notification.permission==="granted")return!0;return!1}function jZ(){return typeof window<"u"&&typeof document<"u"}async function B4(){if(typeof Notification>"u")return!1;if(Notification.permission==="granted")return!0;if(Notification.permission==="denied")return!1;return await Notification.requestPermission()==="granted"}var g=new Map;function f4(){return`alert-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function v4(Z){switch(Z){case"info":return"&#x2139;";case"success":return"&#x2714;";case"warning":return"&#x26A0;";case"error":return"&#x2716;";default:return"&#x2139;"}}function y4(Z="top-right"){if(!jZ())throw Error("Toast container requires browser environment");try{let $=document.querySelector(`.stx-toast-container[data-position="${Z}"]`);if($)return $}catch{}let Y=document.createElement("div");Y.className=`stx-toast-container ${Z}`,Y.dataset.position=Z;try{if(document.body)document.body.appendChild(Y)}catch{}return Y}function g4(Z){let{options:Y}=Z,$=v4(Y.type),J=Y.type||"info",Q=Y.duration!==0;return`
3
3
  <div class="stx-toast ${J}" data-alert-id="${Z.id}" role="alert" aria-live="polite">
4
4
  <div class="stx-toast-icon">${$}</div>
5
5
  <div class="stx-toast-content">
@@ -891,7 +891,7 @@ NoDisplay=true`:""}
891
891
  `;if(!p(Q))J4(Q,{recursive:!0});Q4(J,K,"utf-8")}else if(p(J))G4(J)}async function Z8(Z){return p(z4(Z))}async function Y8(Z){let Y=R4(Z);if(!p(Y))return!1;try{let $=s6(Y,"utf-8");if($.includes("X-GNOME-Autostart-enabled=false"))return!1;if($.includes("Hidden=true"))return!1;return!0}catch{return!1}}function $8(Z){return Z.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}async function J8(Z,Y={}){let $=X4();switch($){case"darwin":return t6(Z,Y);case"linux":return e6(Z,Y);default:throw Error(`Auto-launch is not yet supported on ${$}`)}}async function G8(Z){let Y=Z||"StxApp";switch(X4()){case"darwin":return Z8(Y);case"linux":return Y8(Y);default:return!1}}var B=new Map,Q8=0,zZ=!1;function K4(Z){let Y=Z.split("+").map((J)=>J.trim()),$={key:"",meta:!1,ctrl:!1,shift:!1,alt:!1};for(let J of Y){let Q=J.toLowerCase();switch(Q){case"cmd":case"command":case"meta":case"\u2318":$.meta=!0;break;case"ctrl":case"control":case"\u2303":$.ctrl=!0;break;case"shift":case"\u21E7":$.shift=!0;break;case"alt":case"option":case"opt":case"\u2325":$.alt=!0;break;case"cmdorctrl":case"commandorcontrol":if(typeof process<"u"&&process.platform==="darwin")$.meta=!0;else $.ctrl=!0;break;default:$.key=Q}}return $}function X8(Z){let Y=[];if(Z.ctrl)Y.push("\u2303");if(Z.alt)Y.push("\u2325");if(Z.shift)Y.push("\u21E7");if(Z.meta)Y.push("\u2318");return Y.push(Z.key.toUpperCase()),Y.join("")}function z8(Z,Y){if(Y.meta!==Z.metaKey)return!1;if(Y.ctrl!==Z.ctrlKey)return!1;if(Y.shift!==Z.shiftKey)return!1;if(Y.alt!==Z.altKey)return!1;return Z.key.toLowerCase()===Y.key||Z.code.toLowerCase()===`key${Y.key}`}function F4(Z){for(let[,Y]of B)if(z8(Z,Y.parsed)){Z.preventDefault(),Z.stopPropagation();try{Y.handler()}catch{}break}}function R8(){if(zZ)return;if(typeof document>"u")return;document.addEventListener("keydown",F4,!0),zZ=!0}function TZ(){if(!zZ)return;if(typeof document>"u")return;document.removeEventListener("keydown",F4,!0),zZ=!1}async function K8(Z,Y){if(typeof window>"u")return!1;let $=window.craft;if(!$?.hotkeys?.register)return!1;try{return await $.hotkeys.register(Z,Y),!0}catch{return!1}}async function NZ(Z){if(typeof window>"u")return;let Y=window.craft;if(!Y?.hotkeys?.unregister)return;try{await Y.hotkeys.unregister(Z)}catch{}}function F8(Z,Y){let $=`hotkey_${++Q8}_${Date.now()}`,J=K4(Z);B.set($,{shortcut:Z,handler:Y,parsed:J}),K8($,Z),R8();let Q={shortcut:Z,id:$,unregister(){j4(Q)}};return Q}function j4(Z){if(B.delete(Z.id),NZ(Z.id),B.size===0)TZ()}function j8(){for(let[Z]of B)NZ(Z);B.clear(),TZ()}function O8(){return Array.from(B.entries()).map(([Z,Y])=>({shortcut:Y.shortcut,id:Z,unregister(){if(B.delete(Z),NZ(Z),B.size===0)TZ()}}))}class O4{_duration;_tickInterval;_remaining;_running=!1;_paused=!1;_complete=!1;_intervalId=null;_lastTick=0;_completionHandlers=new Set;_tickHandlers=new Set;constructor(Z){if(this._duration=Z.duration,this._tickInterval=Z.tickInterval||1000,this._remaining=Z.duration,Z.onComplete)this._completionHandlers.add(Z.onComplete);if(Z.onTick)this._tickHandlers.add(Z.onTick);if(Z.autoStart)this.start()}get isRunning(){return this._running&&!this._paused}get isPaused(){return this._paused}get isComplete(){return this._complete}get remaining(){if(this._running&&!this._paused){let Z=Date.now()-this._lastTick;return Math.max(0,this._remaining-Z)}return Math.max(0,this._remaining)}get elapsed(){return this._duration-this.remaining}get duration(){return this._duration}get progress(){if(this._duration===0)return 1;return Math.min(1,this.elapsed/this._duration)}start(){if(this._running)return;this._running=!0,this._paused=!1,this._complete=!1,this._lastTick=Date.now(),this._startInterval()}stop(){this._clearInterval(),this._running=!1,this._paused=!1,this._remaining=this._duration}pause(){if(!this._running||this._paused)return;let Z=Date.now()-this._lastTick;this._remaining=Math.max(0,this._remaining-Z),this._clearInterval(),this._paused=!0}resume(){if(!this._paused)return;this._paused=!1,this._lastTick=Date.now(),this._startInterval()}reset(){this._clearInterval(),this._running=!1,this._paused=!1,this._complete=!1,this._remaining=this._duration}onComplete(Z){return this._completionHandlers.add(Z),()=>{this._completionHandlers.delete(Z)}}onTick(Z){return this._tickHandlers.add(Z),()=>{this._tickHandlers.delete(Z)}}_startInterval(){this._clearInterval(),this._intervalId=setInterval(()=>{let Z=Date.now(),Y=Z-this._lastTick;this._lastTick=Z,this._remaining=Math.max(0,this._remaining-Y);for(let $ of this._tickHandlers)try{$(this._remaining)}catch{}if(this._remaining<=0){this._clearInterval(),this._running=!1,this._complete=!0;for(let $ of this._completionHandlers)try{$()}catch{}}},this._tickInterval)}_clearInterval(){if(this._intervalId!==null)clearInterval(this._intervalId),this._intervalId=null}}class V4{_interval;_handler;_immediate;_running=!1;_intervalId=null;constructor(Z){if(this._interval=Z.interval,this._handler=Z.handler,this._immediate=Z.immediate!==!1,this._immediate)this.start()}get isRunning(){return this._running}start(){if(this._running)return;this._running=!0,this._intervalId=setInterval(()=>{try{this._handler()}catch{}},this._interval)}stop(){if(this._intervalId!==null)clearInterval(this._intervalId),this._intervalId=null;this._running=!1}}function V8(Z){return new O4(Z)}function q8(Z){return new V4(Z)}function U8(Z){return new Promise((Y)=>setTimeout(Y,Z))}function P8(Z){let Y=Math.ceil(Z/1000),$=Math.floor(Y/3600),J=Math.floor(Y%3600/60),Q=Y%60;if($>0)return`${$}:${String(J).padStart(2,"0")}:${String(Q).padStart(2,"0")}`;return`${J}:${String(Q).padStart(2,"0")}`}function L8(Z){let Y=Math.ceil(Z/1000),$=Math.floor(Y/3600),J=Math.floor(Y%3600/60),Q=Y%60;if($>0){if(J>0)return`${$}h ${J}m`;return`${$}h`}if(J>0){if(Q>0)return`${J}m ${Q}s`;return`${J}m`}return`${Q}s`}function G(Z){if(typeof window>"u")return!1;let Y=window.craft;return!!(Y&&Y[Z])}function M(Z){if(!G(Z))throw Error(`craft.${Z} is not available \u2014 this API requires a Craft native window`);return window.craft[Z]}function U(Z,Y){if(typeof window>"u")return()=>{};let $=(J)=>Y(J.detail??{});return window.addEventListener(Z,$),()=>window.removeEventListener(Z,$)}var W8={async writeText(Z){if(G("clipboard")){await window.craft.clipboard.writeText(Z);return}if(typeof navigator<"u"&&navigator.clipboard)await navigator.clipboard.writeText(Z)},async readText(){if(G("clipboard")){let Z=await window.craft.clipboard.readText();return typeof Z==="string"?Z:""}if(typeof navigator<"u"&&navigator.clipboard?.readText)try{return await navigator.clipboard.readText()}catch{return""}return""},async writeHTML(Z){if(G("clipboard")){await window.craft.clipboard.writeHTML(Z);return}if(typeof navigator<"u"&&navigator.clipboard?.write)try{let Y=new window.ClipboardItem({"text/html":new Blob([Z],{type:"text/html"}),"text/plain":new Blob([D8(Z)],{type:"text/plain"})});await navigator.clipboard.write([Y])}catch{}},async readHTML(){if(G("clipboard")){let Z=await window.craft.clipboard.readHTML();return typeof Z==="string"?Z:""}if(typeof navigator<"u"&&navigator.clipboard?.read)try{let Z=await navigator.clipboard.read();for(let Y of Z)if(Y.types.includes("text/html"))return await(await Y.getType("text/html")).text()}catch{}return""},async clear(){if(G("clipboard")){await window.craft.clipboard.clear();return}if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{await navigator.clipboard.writeText("")}catch{}},async hasText(){if(G("clipboard"))return await window.craft.clipboard.hasText();return(await this.readText()).length>0},async hasHTML(){if(G("clipboard"))return await window.craft.clipboard.hasHTML();return(await this.readHTML()).length>0},async hasImage(){if(G("clipboard"))return await window.craft.clipboard.hasImage();return!1}};function D8(Z){return Z.replace(/<(script|style)[^>]*>[\s\S]*?<\/\1>/gi,"").replace(/<\/?(br|p|div|li|h[1-6])\b[^>]*>/gi,`
892
892
  `).replace(/<[^>]+>/g,"").replace(/&nbsp;/g," ").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/\n{3,}/g,`
893
893
 
894
- `).trim()}var M8={async show(Z){if(!Z.title)throw Error("notification title is required");if(G("notifications")){await window.craft.notifications.show(Z);return}if(typeof window<"u"&&"Notification"in window){let Y=window.Notification;if(Y.permission==="granted")new Y(Z.title,{body:Z.body,icon:Z.icon});else if(Y.permission==="default"){if(await Y.requestPermission()==="granted")new Y(Z.title,{body:Z.body,icon:Z.icon})}}},async schedule(Z){if(G("notifications")){let J={...Z};if(J.triggerAt instanceof Date)J.triggerAt=J.triggerAt.toISOString();await window.craft.notifications.schedule(J);return}let Y=_8(Z.triggerAt),$=Math.max(0,Y-Date.now());setTimeout(()=>{this.show(Z).catch(()=>{})},$)},async cancel(Z){if(G("notifications"))await window.craft.notifications.cancel(Z)},async cancelAll(){if(G("notifications"))await window.craft.notifications.cancelAll()},async setBadge(Z){let Y=Math.max(0,Math.round(Number.isFinite(Z)?Z:0));if(G("notifications")){await window.craft.notifications.setBadge(Y);return}if(typeof navigator<"u"&&navigator.setAppBadge)try{await navigator.setAppBadge(Y)}catch{}},async clearBadge(){if(G("notifications")){await window.craft.notifications.clearBadge();return}if(typeof navigator<"u"&&navigator.clearAppBadge)try{await navigator.clearAppBadge()}catch{}},async requestPermission(){if(G("notifications"))return await window.craft.notifications.requestPermission();if(typeof window<"u"&&"Notification"in window){let Z=window.Notification;if(Z.permission==="granted")return!0;if(Z.permission==="denied")return!1;return await Z.requestPermission()==="granted"}return!1},async registerCategories(Z){if(!Array.isArray(Z)||Z.length===0)return;if(G("notifications")){let Y=window.craft.notifications.registerCategories;if(typeof Y==="function")await Y(Z)}},onActionClicked(Z){return U("craft:notification:actionClicked",Z)},onReply(Z){return U("craft:notification:reply",Z)}};function _8(Z){if(Z==null)return Date.now();if(Z instanceof Date)return Z.getTime();if(typeof Z==="number")return Z;let Y=Date.parse(Z);return Number.isNaN(Y)?Date.now():Y}var T8={async readFile(Z){let Y=await M("fs").readFile(Z);return Y&&Y.data||""},async readBuffer(Z){let Y=await M("fs").readFile(Z),$=Y&&Y.data||"";if(Y&&Y.base64===!0)return E8($);return new TextEncoder().encode($)},async writeFile(Z,Y){await M("fs").writeFile(Z,Y)},async writeBuffer(Z,Y){let $=N8(Y),J=M("fs");if(typeof J.writeFileBytes==="function")await J.writeFileBytes(Z,$);else await J.writeFile(Z,$)},async copy(Z,Y){if(Z===Y)throw Error("fs.copy: source and destination must differ");await M("fs").copy(Z,Y)},async move(Z,Y){if(Z===Y)throw Error("fs.move: source and destination must differ");await M("fs").move(Z,Y)},async appendFile(Z,Y){await M("fs").appendFile(Z,Y)},async deleteFile(Z){await M("fs").deleteFile(Z)},async exists(Z){return await M("fs").exists(Z)},async stat(Z){return A8(await M("fs").stat(Z))},async readDir(Z){let Y=await M("fs").readDir(Z),$=Y&&Y.entries||[],J=Z.endsWith("/")?Z.slice(0,-1):Z;return $.map((Q)=>({name:Q.name,path:`${J}/${Q.name}`,isDirectory:!!Q.isDirectory}))},async mkdir(Z,Y){await M("fs").mkdir(Z,Y)},async rmdir(Z,Y){await M("fs").rmdir(Z,Y)},async watch(Z,Y){await M("fs").watch(Z,Y)},async unwatch(Z){await M("fs").unwatch(Z)},onChange(Z){return U("craft:fs:change",Z)},async watchTree(Z,Y,$){let J=`watch-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,Q=M("fs");await Q.watch(Z,J,{recursive:!!Y.recursive});let X=Y.kinds&&Y.kinds.length>0?new Set(Y.kinds):null,R=Math.max(0,Math.floor(Y.coalesceMs??0)),z=[],K=null,F=!1,O=()=>{if(K=null,z.length===0)return;let j=z;z=[];try{$(j)}catch{}},V=U("craft:fs:change",(j)=>{if(F)return;if(j.id!==J)return;if(X&&j.kind&&!X.has(j.kind))return;if(z.push(j),R===0){O();return}if(K==null)K=setTimeout(O,R)});return{id:J,async stop(){if(F)return;if(F=!0,V(),K)clearTimeout(K),K=null;if(z.length>0)O();try{await Q.unwatch(J)}catch{}}}},async homeDir(){return await M("fs").homeDir()},async tempDir(){return await M("fs").tempDir()},async appDataDir(){return await M("fs").appDataDir()}};function N8(Z){let Y="";for(let $=0;$<Z.length;$++)Y+=String.fromCharCode(Z[$]);return typeof btoa==="function"?btoa(Y):Buffer.from(Z).toString("base64")}function E8(Z){let Y=typeof atob==="function"?atob(Z):Buffer.from(Z,"base64").toString("binary"),$=new Uint8Array(Y.length);for(let J=0;J<Y.length;J++)$[J]=Y.charCodeAt(J);return $}function A8(Z){return{isFile:!!Z.isFile,isDirectory:!!Z.isDirectory,isSymlink:!!Z.isSymlink,size:Number(Z.size)||0,modifiedAt:Z.modifiedAt!=null?Z.modifiedAt<1000000000000?Z.modifiedAt*1000:Z.modifiedAt:0}}var a=new Set,q4=!1;function k8(){if(q4)return;if(typeof window>"u"||typeof window.addEventListener!=="function")return;window.addEventListener("craft:shell:exit",(Z)=>{let Y=Z.detail;if(Y?.id)a.delete(Y.id)}),q4=!0}var H8=new Set(["javascript:","data:","file:","vbscript:"]),x8={async openExternal(Z){let Y=Z.trim().toLowerCase();for(let $ of H8)if(Y.startsWith($))throw Error(`shell.openExternal: ${$} URLs are blocked for safety`);if(G("shell")){await window.craft.shell.openExternal(Z);return}if(typeof window<"u"&&typeof window.open==="function")window.open(Z,"_blank","noopener,noreferrer")},async openPath(Z){await M("shell").openPath(Z)},async showInFinder(Z){await M("shell").showInFinder(Z)},async spawn(Z,Y,$=[],J={}){if(k8(),!Z||typeof Z!=="string")throw Error("shell.spawn: id must be a non-empty string");if(!Y||typeof Y!=="string")throw Error("shell.spawn: command must be a non-empty string");if(!Array.isArray($))throw Error("shell.spawn: args must be an array");for(let Q of $)if(typeof Q!=="string")throw Error("shell.spawn: args entries must be strings");if(a.has(Z))throw Error(`shell.spawn: id "${Z}" is already in use \u2014 call kill(id) first or pick a different id`);a.add(Z);try{await M("shell").spawn(Z,Y,$,J)}catch(Q){throw a.delete(Z),Q}},async kill(Z){await M("shell").kill(Z),a.delete(Z)},async getEnv(Z){if(G("shell")){let Y=await window.craft.shell.getEnv(Z);return Y==null?void 0:String(Y)}return},async setEnv(Z,Y){await M("shell").setEnv(Z,Y)},onStdout(Z){return U("craft:shell:stdout",Z)},onStderr(Z){return U("craft:shell:stderr",Z)},onExit(Z){return U("craft:shell:exit",Z)}};function u(){return window.craft.shortcuts}var C8={async register(Z,Y,$){if(!G("shortcuts"))return;await u().register(Z,Y,$)},async unregister(Z){if(!G("shortcuts"))return;await u().unregister(Z)},async unregisterAll(){if(!G("shortcuts"))return;await u().unregisterAll()},async enable(Z){if(!G("shortcuts"))return;await u().enable(Z)},async disable(Z){if(!G("shortcuts"))return;await u().disable(Z)},async isRegistered(Z){if(!G("shortcuts"))return!1;return await u().isRegistered(Z)},async list(){if(!G("shortcuts"))return[];return await u().list()},on(Z){return U("craft:shortcut",Z)}};var I8={get(){if(G("theme"))try{return window.craft.theme.get()}catch{}return{appearance:S8()}},onChange(Z){if(Z(this.get()),G("theme"))return U("craft:theme",Z);if(typeof window<"u"&&window.matchMedia){let Y=window.matchMedia("(prefers-color-scheme: dark)"),$=()=>Z({appearance:Y.matches?"dark":"light"});return Y.addEventListener("change",$),()=>Y.removeEventListener("change",$)}return()=>{}},async current(){return this.get()}};function S8(){if(typeof window>"u"||!window.matchMedia)return"light";return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}async function w8(Z,Y={}){if(!G("dragOut"))throw Error("dragOut requires a Craft native window");let $=Array.isArray(Z)?Z:[Z];if($.length===0)throw Error("dragOut: at least one path required");await window.craft.dragOut.start($,Y)}function B8(){return G("dragOut")}var f8={onUrl(Z){if(!G("deepLink"))return()=>{};return U("craft:deepLink",Z)},getInitialUrl(){if(typeof window>"u")return null;if(G("deepLink"))try{return window.craft.deepLink.getInitialUrl()}catch{return null}return window.__craftPendingDeepLink||null},consumeInitialUrl(){let Z=this.getInitialUrl();if(typeof window<"u")window.__craftPendingDeepLink=void 0;return Z},isAvailable(){return G("deepLink")}};var v8={async isCharging(){if(G("power"))return await window.craft.power.isCharging();let Z=await RZ();return Z?!!Z.charging:!1},async isPluggedIn(){if(G("power"))return await window.craft.power.isPluggedIn();let Z=await RZ();return Z?!!Z.charging||Z.level>=0.999:!1},async isLowPowerMode(){if(G("power"))return await window.craft.power.isLowPowerMode();return!1},async level(){if(G("power")){let Y=await window.craft.power.batteryLevel();return typeof Y==="number"?Y:null}let Z=await RZ();return Z?Z.level:null},async timeRemaining(){if(G("power")){let $=await window.craft.power.timeRemaining();return typeof $==="number"?$:null}let Z=await RZ();if(!Z)return null;let Y=Z.charging?Z.chargingTime:Z.dischargingTime;return Number.isFinite(Y)?Math.round(Y/60):null},async thermalState(){if(G("power"))return await window.craft.power.thermalState()||"unknown";return"unknown"},async uptimeSeconds(){if(G("power"))return await window.craft.power.uptimeSeconds();if(typeof performance<"u"&&typeof performance.now==="function")return Math.round(performance.now()/1000);return 0},async preventSleep(Z="app is busy"){if(G("power")){await window.craft.power.preventSleep(Z);return}if(typeof navigator>"u"||!navigator.wakeLock)return;let Y=window;if(Y.__craftWebWakeLock?.release){try{await Y.__craftWebWakeLock.release()}catch{}Y.__craftWebWakeLock=null}try{let $=await navigator.wakeLock.request("screen");Y.__craftWebWakeLock=$}catch{}},async allowSleep(){if(G("power")){await window.craft.power.allowSleep();return}let Z=window.__craftWebWakeLock;if(Z&&typeof Z.release==="function"){try{await Z.release()}catch{}window.__craftWebWakeLock=null}},onSleep(Z){return U("craft:powerSleep",Z)},onWake(Z){return U("craft:powerWake",Z)}};async function RZ(){if(typeof navigator>"u")return null;let Z=navigator;if(typeof Z.getBattery!=="function")return null;try{return await Z.getBattery()}catch{return null}}var y8={async connectionType(){if(G("network"))return await window.craft.network.connectionType();return U4()},async wifiSSID(){if(G("network"))return await window.craft.network.wifiSSID()||void 0;return},async wifiSignalStrength(){if(G("network")){let Z=await window.craft.network.wifiSignalStrength();return typeof Z==="number"?Z:void 0}return},async ipAddress(){if(G("network"))return await window.craft.network.ipAddress();return""},async macAddress(){if(G("network"))return await window.craft.network.macAddress();return""},async interfaces(){if(G("network"))return await window.craft.network.interfaces();return[]},async isVPNConnected(){if(G("network"))return await window.craft.network.isVPNConnected();return!1},async proxySettings(){if(G("network"))return await window.craft.network.proxySettings()||{};return{}},async openPreferences(){if(G("network"))await window.craft.network.openPreferences()},onChange(Z){if(G("network"))return U("craft:networkChange",Z);if(typeof window>"u")return()=>{};let Y=()=>Z({type:U4(),online:!0}),$=()=>Z({type:"none",online:!1});return window.addEventListener("online",Y),window.addEventListener("offline",$),()=>{window.removeEventListener("online",Y),window.removeEventListener("offline",$)}}};function U4(){if(typeof navigator>"u")return"unknown";if(navigator.onLine===!1)return"none";let Z=navigator.connection;if(!Z)return"unknown";let Y=String(Z.type||Z.effectiveType||"unknown").toLowerCase();if(Y==="wifi"||Y==="cellular"||Y==="ethernet"||Y==="bluetooth"||Y==="none")return Y;return"unknown"}var g8={async checkForUpdates(){if(!G("updater"))return;await window.craft.updater.checkForUpdates()},async checkInBackground(){if(!G("updater"))return;await window.craft.updater.checkInBackground()},async setAutomaticChecks(Z){if(!G("updater"))return;await window.craft.updater.setAutomaticChecks(Z)},async setCheckInterval(Z){if(!G("updater"))return;if(!Number.isFinite(Z))throw Error("setCheckInterval: must be a finite number");let Y=Z<=0?0:Math.max(60,Math.round(Z));await window.craft.updater.setCheckInterval(Y)},async setFeedURL(Z){if(!G("updater"))return;await window.craft.updater.setFeedURL(Z)},async getLastUpdateCheckDate(){if(!G("updater"))return null;return await window.craft.updater.getLastUpdateCheckDate()||null},async getUpdateInfo(){if(!G("updater"))return null;let Z=await window.craft.updater.getUpdateInfo();if(!Z||typeof Z.version!=="string"||Z.version.length===0)return null;return Z},onAvailable(Z){return U("craft:updateAvailable",Z)},onDownloaded(Z){return U("craft:updateDownloaded",Z)},async verifySignature({payload:Z,signatureB64:Y,publicKeyB64:$}){let J=P4(Z),Q;try{Q=await crypto.subtle.importKey("raw",KZ($),{name:"Ed25519"},!1,["verify"])}catch{return!1}try{return await crypto.subtle.verify("Ed25519",Q,KZ(Y),J)}catch{return!1}},async verifyDownload({url:Z,signatureB64:Y,publicKeyB64:$,fetchInit:J}){let Q;try{Q=await fetch(Z,J)}catch{return{ok:!1,reason:"fetch-failed"}}if(!Q.ok)return{ok:!1,reason:"http-error",status:Q.status};let X=new Uint8Array(await Q.arrayBuffer()),R;try{R=await crypto.subtle.importKey("raw",KZ($),{name:"Ed25519"},!1,["verify"])}catch{return{ok:!1,reason:"bad-key"}}let z=!1;try{z=await crypto.subtle.verify("Ed25519",R,KZ(Y),P4(X))}catch{z=!1}if(!z)return{ok:!1,reason:"bad-signature"};return{ok:!0,payload:X}}};function P4(Z){if(Z instanceof ArrayBuffer)return new Uint8Array(Z);let Y=new ArrayBuffer(Z.byteLength),$=new Uint8Array(Y);return $.set(Z),$}function KZ(Z){if(typeof atob==="function"){let J=atob(Z),Q=new ArrayBuffer(J.length),X=new Uint8Array(Q);for(let R=0;R<J.length;R++)X[R]=J.charCodeAt(R);return X}let Y=Buffer.from(Z,"base64"),$=new ArrayBuffer(Y.length);return new Uint8Array($).set(Y),new Uint8Array($)}var b8={onFocus(Z){if(G("window"))return U("craft:window:focus",()=>Z());return EZ("focus",Z)},onBlur(Z){if(G("window"))return U("craft:window:blur",()=>Z());return EZ("blur",Z)},onResize(Z){if(G("window"))return U("craft:window:resize",Z);if(typeof window>"u")return()=>{};let Y=()=>Z({width:window.innerWidth,height:window.innerHeight});return window.addEventListener("resize",Y),()=>window.removeEventListener("resize",Y)},onMove(Z){if(G("window"))return U("craft:window:move",Z);return()=>{}},onClose(Z){if(G("window"))return U("craft:window:close",()=>Z());return EZ("beforeunload",Z)},onMinimize(Z){if(G("window"))return U("craft:window:minimize",()=>Z());if(typeof document>"u")return()=>{};let Y=()=>{if(document.visibilityState==="hidden")Z()};return document.addEventListener("visibilitychange",Y),()=>document.removeEventListener("visibilitychange",Y)},onRestore(Z){if(G("window"))return U("craft:window:restore",()=>Z());if(typeof document>"u")return()=>{};let Y=()=>{if(document.visibilityState==="visible")Z()};return document.addEventListener("visibilitychange",Y),()=>document.removeEventListener("visibilitychange",Y)}};function EZ(Z,Y){if(typeof window>"u")return()=>{};let $=()=>Y();return window.addEventListener(Z,$),()=>window.removeEventListener(Z,$)}var L4={name:"",version:"0.0.0"},u8={async hideDockIcon(){if(G("app"))await window.craft.app.hideDockIcon()},async showDockIcon(){if(G("app"))await window.craft.app.showDockIcon()},async quit(){if(G("app"))await window.craft.app.quit()},async getInfo(){if(!G("app"))return L4;let Z=await window.craft.app.getInfo();return{...L4,...Z||{}}},async notify(Z){if(!Z.title)throw Error("notify: title is required");if(G("app"))await window.craft.app.notify(Z)},async setBadge(Z){if(G("app"))await window.craft.app.setBadge(Z)},async bounce(Z="informational"){if(G("app"))await window.craft.app.bounce(Z)}};var m8={app(Z){return{label:Z,items:[{label:`About ${Z}`,role:"about"},{separator:!0},{label:`Hide ${Z}`,role:"hide",shortcut:"cmd+h"},{label:"Hide Others",role:"hideOthers",shortcut:"cmd+alt+h"},{label:"Show All",role:"showAll"},{separator:!0},{label:`Quit ${Z}`,role:"quit",shortcut:"cmd+q"}]}},edit(){return{label:"Edit",items:[{label:"Undo",role:"undo",shortcut:"cmd+z"},{label:"Redo",role:"redo",shortcut:"cmd+shift+z"},{separator:!0},{label:"Cut",role:"cut",shortcut:"cmd+x"},{label:"Copy",role:"copy",shortcut:"cmd+c"},{label:"Paste",role:"paste",shortcut:"cmd+v"},{label:"Select All",role:"selectAll",shortcut:"cmd+a"}]}},window(){return{label:"Window",items:[{label:"Minimize",role:"minimize",shortcut:"cmd+m"},{label:"Zoom",role:"zoom"},{separator:!0},{label:"Close Window",role:"close",shortcut:"cmd+w"}]}},leading(Z){return[this.app(Z),this.edit()]}},h8=0;function c8(Z){let Y=new Map;return{payload:{menus:Z.menus.map((J)=>({label:J.label,items:J.items.map((Q)=>{let{onClick:X,...R}=Q;if(R.separator)return R;let z=R.id??`stx.menu.${h8++}`;if(X)Y.set(z,X);return{...R,id:z}})}))},handlers:Y}}var AZ=null,p8={async set(Z){if(!G("menu"))return!1;let{payload:Y,handlers:$}=c8(Z);if(AZ?.(),AZ=null,$.size>0)AZ=U("craft:menu:action",(J)=>{$.get(J.id)?.()});return await window.craft.menu.set(Y),!0},async setDock(Z){if(G("menu"))await window.craft.menu.setDock(Z)},async addItem(Z,Y){if(G("menu"))await window.craft.menu.addItem(Z,Y)},async removeItem(Z){if(G("menu"))await window.craft.menu.removeItem(Z)},async enableItem(Z){if(G("menu"))await window.craft.menu.enableItem(Z)},async disableItem(Z){if(G("menu"))await window.craft.menu.disableItem(Z)},async checkItem(Z){if(G("menu"))await window.craft.menu.checkItem(Z)},async uncheckItem(Z){if(G("menu"))await window.craft.menu.uncheckItem(Z)},async setItemLabel(Z,Y){if(G("menu"))await window.craft.menu.setItemLabel(Z,Y)},async clearDock(){if(G("menu"))await window.craft.menu.clearDock()},onAction(Z){return U("craft:menu:action",Z)}};function D4(Z){if(Z.separator)return{id:Z.id||"",title:"",type:"separator"};return{id:Z.id||"",title:Z.title||"",icon:Z.icon,shortcut:Z.shortcut,enabled:Z.disabled?!1:void 0,type:Z.submenu?"submenu":void 0,submenu:Z.submenu?.map(D4)}}async function W4(Z){if(!Z.items||Z.items.length===0)throw Error("contextMenu.show requires at least one item");if(!G("nativeUI"))return null;let Y=await window.craft.nativeUI.showContextMenu({targetId:Z.targetId||"",targetType:"general",x:Math.round(Z.x),y:Math.round(Z.y),items:Z.items.map(D4)});return{id:typeof Y?.id==="string"?Y.id:null,targetId:Y?.targetId}}var l8={available(){return G("nativeUI")},async show(Z){return await W4(Z)!==null},async pick(Z){return(await W4(Z))?.id??null},onAction(Z){return U("craft:contextmenu:action",(Y)=>{if(typeof Y.id==="string")Z({id:Y.id,targetId:Y.targetId??""})})}};var d8={accentColor:()=>x("system","accentColor",()=>""),highlightColor:()=>x("system","highlightColor",()=>""),language:()=>x("system","language",()=>{if(typeof navigator>"u")return"";return navigator.language?.split("-")[0]||""}),locale:()=>x("system","locale",()=>{if(typeof navigator>"u")return"";return navigator.language||""}),timezone:()=>x("system","timezone",()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch{return""}}),is24HourTime:()=>x("system","is24HourTime",()=>{try{let Z=new Intl.DateTimeFormat([],{hour:"numeric"}).resolvedOptions();return Z.hourCycle==="h23"||Z.hourCycle==="h24"}catch{return!1}}),reduceMotion:()=>x("system","reduceMotion",()=>kZ("(prefers-reduced-motion: reduce)")),reduceTransparency:()=>x("system","reduceTransparency",()=>kZ("(prefers-reduced-transparency: reduce)")),increaseContrast:()=>x("system","increaseContrast",()=>kZ("(prefers-contrast: more)")),systemVersion:()=>x("system","systemVersion",()=>""),hostname:()=>x("system","hostname",()=>""),username:()=>x("system","username",()=>""),async openPreferences(){if(G("system"))await window.craft.system.openPreferences()}};async function x(Z,Y,$){if(G(Z))return await window.craft[Z][Y]();return await $()}function kZ(Z){if(typeof window>"u"||!window.matchMedia)return!1;return window.matchMedia(Z).matches}var r8={async getDisplays(){if(G("screen"))return await window.craft.screen.getDisplays();return M4()},async getPrimary(){if(G("screen")){let Z=await window.craft.screen.getPrimary();return Z&&typeof Z.width==="number"?Z:null}return M4()[0]??null},onChange(Z){if(G("screen"))return U("craft:screen:change",()=>Z());if(typeof window>"u")return()=>{};let Y=()=>Z();return window.addEventListener("resize",Y),()=>window.removeEventListener("resize",Y)}};function M4(){if(typeof window>"u"||!window.screen)return[];let Z=window.screen;return[{id:0,x:Z.left??0,y:Z.top??0,width:Z.width||0,height:Z.height||0,workX:Z.availLeft??0,workY:Z.availTop??0,workWidth:Z.availWidth??Z.width??0,workHeight:Z.availHeight??Z.height??0,scaleFactor:window.devicePixelRatio||1}]}var n8={async set(Z,Y,$){if(!Z)throw Error("keychain.set: service is required");if(!Y)throw Error("keychain.set: account is required");await M("keychain").set(Z,Y,$)},async get(Z,Y){if(!Z)throw Error("keychain.get: service is required");if(!Y)throw Error("keychain.get: account is required");let $=await M("keychain").get(Z,Y);return typeof $==="string"?$:null},async delete(Z,Y){if(!Z)throw Error("keychain.delete: service is required");if(!Y)throw Error("keychain.delete: account is required");await M("keychain").delete(Z,Y)},async has(Z,Y){if(!Z)throw Error("keychain.has: service is required");if(!Y)throw Error("keychain.has: account is required");return await M("keychain").has(Z,Y)}};var o8={async check(Z){if(G("permissions"))return await window.craft.permissions.check(Z);return await _4(Z)},async request(Z){if(G("permissions"))return await window.craft.permissions.request(Z);return await a8(Z)},async openSettings(Z){if(G("permissions"))await window.craft.permissions.openSettings(Z)}};async function _4(Z){if(typeof navigator>"u"||!navigator.permissions?.query)return"not-supported";try{let Y=await navigator.permissions.query({name:Z});return i8(Y.state)}catch{return"not-supported"}}async function a8(Z){if(Z==="notifications"&&typeof window<"u"&&"Notification"in window){let Y=await window.Notification.requestPermission();return Y==="granted"?"granted":Y==="denied"?"denied":"undetermined"}return await _4(Z)}function i8(Z){if(Z==="granted")return"granted";if(Z==="denied")return"denied";if(Z==="prompt")return"undetermined";return"undetermined"}var s8={async print(){if(G("printing")){await window.craft.printing.print();return}if(typeof window<"u"&&typeof window.print==="function")window.print()},async printToPDF(Z){if(!Z)throw Error("printToPDF: path is required");let Y=Z.startsWith("/"),$=/^[a-zA-Z]:[\\/]/.test(Z)||Z.startsWith("\\\\");if(!Y&&!$)throw Error("printToPDF: path must be absolute");let J=await M("printing").printToPDF(Z);return{ok:!!(J&&J.ok),path:J?.path}}};var t8={async enable(){if(!G("autoLaunch"))return!1;return await window.craft.autoLaunch.enable()},async disable(){if(!G("autoLaunch"))return!1;return await window.craft.autoLaunch.disable()},async isEnabled(){if(!G("autoLaunch"))return!1;return await window.craft.autoLaunch.isEnabled()}};function HZ(){if(!G("window"))return null;return window.craft.window}function f(Z){let Y=HZ();if(!Y)return Promise.resolve();try{return Promise.resolve(Z(Y)).then(()=>{return},()=>{return})}catch{return Promise.resolve()}}var e8={get available(){return HZ()!==null},open(Z){let Y=()=>{if(typeof window<"u"&&Z.url)window.open(Z.url,Z.name);return{name:Z.name}},$=HZ();if(!$?.open)return Promise.resolve(Y());return $.open(Z).then((J)=>({name:J?.name||Z.name})).catch(Y)},close:()=>f((Z)=>Z.close?.()),focus:()=>f((Z)=>Z.focus?.()),minimize:()=>f((Z)=>Z.minimize?.()),maximize:()=>f((Z)=>Z.maximize?.()),center:()=>f((Z)=>Z.center?.()),startDrag:()=>f((Z)=>Z.startDrag?.()),setTitle:(Z)=>f((Y)=>Y.setTitle?.(Z)),setSize:(Z,Y)=>f(($)=>$.setSize?.(Z,Y)),setAppearance:(Z)=>f((Y)=>Y.setAppearance?.(Z))};var Z9={async addItem(Z){if(G("touchbar"))await window.craft.touchbar.addItem(Z)},async removeItem(Z){if(G("touchbar"))await window.craft.touchbar.removeItem(Z)},async updateItem(Z,Y){if(G("touchbar"))await window.craft.touchbar.updateItem(Z,Y)},async setLabel(Z,Y){if(G("touchbar"))await window.craft.touchbar.setLabel(Z,Y)},async setIcon(Z,Y){if(G("touchbar"))await window.craft.touchbar.setIcon(Z,Y)},async setEnabled(Z,Y){if(G("touchbar"))await window.craft.touchbar.setEnabled(Z,Y)},async setSliderValue(Z,Y){if(G("touchbar"))await window.craft.touchbar.setSliderValue(Z,Y)},async clear(){if(G("touchbar"))await window.craft.touchbar.clear()},async show(){if(G("touchbar"))await window.craft.touchbar.show()},async hide(){if(G("touchbar"))await window.craft.touchbar.hide()},onAction(Z){return U("craft:touchbar:action",Z)}};var Y9=/^[\da-f]*$/i;function $9(Z,Y){if(typeof Y!=="string"||!Y9.test(Y)||Y.length%2!==0)throw Error(`${Z}: must be a hex string with even length, got ${JSON.stringify(Y)}`)}var J9={async isEnabled(){return G("bluetooth")?await window.craft.bluetooth.isEnabled():!1},async powerState(){return G("bluetooth")?await window.craft.bluetooth.powerState():"unknown"},async connectedDevices(){return G("bluetooth")?await window.craft.bluetooth.connectedDevices():[]},async pairedDevices(){return G("bluetooth")?await window.craft.bluetooth.pairedDevices():[]},async startDiscovery(){if(G("bluetooth"))await window.craft.bluetooth.startDiscovery()},async stopDiscovery(){if(G("bluetooth"))await window.craft.bluetooth.stopDiscovery()},async isDiscovering(){return G("bluetooth")?await window.craft.bluetooth.isDiscovering():!1},async connect(Z){if(G("bluetooth"))await window.craft.bluetooth.connect(Z)},async disconnect(Z){if(G("bluetooth"))await window.craft.bluetooth.disconnect(Z)},async openPreferences(){if(G("bluetooth"))await window.craft.bluetooth.openPreferences()},async discoverServices(Z){if(!Z)throw Error("bluetooth.discoverServices: deviceId is required");if(!G("bluetooth"))return[];let Y=await window.craft.bluetooth.discoverServices(Z);return Array.isArray(Y)?Y:[]},async discoverCharacteristics(Z,Y){if(!Z||!Y)throw Error("bluetooth.discoverCharacteristics: deviceId and serviceUuid are required");if(!G("bluetooth"))return[];let $=await window.craft.bluetooth.discoverCharacteristics(Z,Y);return Array.isArray($)?$:[]},async readCharacteristic(Z,Y,$){if(!Z||!Y||!$)throw Error("bluetooth.readCharacteristic: deviceId, serviceUuid, characteristicUuid are required");if(!G("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.readCharacteristic(Z,Y,$)},async writeCharacteristic(Z,Y,$,J,Q="with-response"){if(!Z||!Y||!$)throw Error("bluetooth.writeCharacteristic: deviceId, serviceUuid, characteristicUuid are required");if($9("bluetooth.writeCharacteristic.valueHex",J),!G("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.writeCharacteristic(Z,Y,$,J,Q)},async setCharacteristicNotify(Z,Y,$,J){if(!Z||!Y||!$)throw Error("bluetooth.setCharacteristicNotify: deviceId, serviceUuid, characteristicUuid are required");if(!G("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.setCharacteristicNotify(Z,Y,$,J)},onDeviceFound(Z){return U("craft:bluetooth:deviceFound",Z)},onDeviceConnected(Z){return U("craft:bluetooth:deviceConnected",Z)},onDeviceDisconnected(Z){return U("craft:bluetooth:deviceDisconnected",Z)},onCharacteristicValue(Z){return U("craft:bluetooth:characteristicValue",Z)}};var G9={async speak(Z,Y){if(!Z)throw Error("speech.speak: text is required");if(G("speech")){await window.craft.speech.speak(Z,Y);return}if(typeof window<"u"&&window.speechSynthesis){let $=new window.SpeechSynthesisUtterance(Z);if(Y){if(Y.rate!=null)$.rate=Y.rate;if(Y.pitch!=null)$.pitch=Y.pitch;if(Y.volume!=null)$.volume=Y.volume;if(Y.voice){let Q=window.speechSynthesis.getVoices().find((X)=>X.voiceURI===Y.voice||X.name===Y.voice||X.lang===Y.voice);if(Q)$.voice=Q}}window.speechSynthesis.speak($)}},async stop(){if(G("speech")){await window.craft.speech.stop();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.cancel()},async pause(){if(G("speech")){await window.craft.speech.pause();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.pause()},async resume(){if(G("speech")){await window.craft.speech.resume();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.resume()},async isSpeaking(){if(G("speech"))return await window.craft.speech.isSpeaking();if(typeof window<"u"&&window.speechSynthesis)return!!window.speechSynthesis.speaking;return!1},async getVoices(){if(G("speech"))return await window.craft.speech.getVoices();if(typeof window<"u"&&window.speechSynthesis)return window.speechSynthesis.getVoices().map((Y)=>({id:Y.voiceURI||Y.name,name:Y.name,language:Y.lang||"",quality:"default"}));return[]}};var i=[],xZ=!0,CZ,IZ,s={async report(Z){if(G("crashReporter")){await window.craft.crashReporter.report(Z);return}if(!xZ)return;let Y=Z instanceof Error?{timestamp:Date.now(),severity:"error",message:Z.message,source:"js",stack:Z.stack||"",userId:CZ,appVersion:IZ}:{timestamp:Date.now(),severity:Z.severity||"error",message:Z.message||"",source:Z.source||"js",stack:Z.stack||"",userId:CZ,appVersion:IZ};if(i.length>=64)i.shift();i.push(Y)},async flush(){if(G("crashReporter"))return await window.craft.crashReporter.flush();return[...i]},async clear(){if(G("crashReporter")){await window.craft.crashReporter.clear();return}i.length=0},async setEnabled(Z){if(G("crashReporter")){await window.craft.crashReporter.setEnabled(Z);return}xZ=Z},async isEnabled(){if(G("crashReporter"))return await window.craft.crashReporter.isEnabled();return xZ},async setUser(Z){if(G("crashReporter")){await window.craft.crashReporter.setUser(Z);return}CZ=Z||void 0},async setAppVersion(Z){if(G("crashReporter")){await window.craft.crashReporter.setAppVersion(Z);return}IZ=Z||void 0},attachGlobalHandlers(){if(G("crashReporter")&&window.craft.crashReporter.attachGlobalHandlers)return window.craft.crashReporter.attachGlobalHandlers();if(typeof window>"u")return()=>{};let Z=($)=>{s.report({severity:"error",message:$.message,source:"js",stack:$.error?.stack||`${$.message}
894
+ `).trim()}var M8={async show(Z){if(!Z.title)throw Error("notification title is required");if(G("notifications")){await window.craft.notifications.show(Z);return}if(typeof window<"u"&&"Notification"in window){let Y=window.Notification;if(Y.permission==="granted")new Y(Z.title,{body:Z.body,icon:Z.icon});else if(Y.permission==="default"){if(await Y.requestPermission()==="granted")new Y(Z.title,{body:Z.body,icon:Z.icon})}}},async schedule(Z){if(G("notifications")){let J={...Z};if(J.triggerAt instanceof Date)J.triggerAt=J.triggerAt.toISOString();await window.craft.notifications.schedule(J);return}let Y=_8(Z.triggerAt),$=Math.max(0,Y-Date.now());setTimeout(()=>{this.show(Z).catch(()=>{})},$)},async cancel(Z){if(G("notifications"))await window.craft.notifications.cancel(Z)},async cancelAll(){if(G("notifications"))await window.craft.notifications.cancelAll()},async setBadge(Z){let Y=Math.max(0,Math.round(Number.isFinite(Z)?Z:0));if(G("notifications")){await window.craft.notifications.setBadge(Y);return}if(typeof navigator<"u"&&navigator.setAppBadge)try{await navigator.setAppBadge(Y)}catch{}},async clearBadge(){if(G("notifications")){await window.craft.notifications.clearBadge();return}if(typeof navigator<"u"&&navigator.clearAppBadge)try{await navigator.clearAppBadge()}catch{}},async requestPermission(){if(G("notifications"))return await window.craft.notifications.requestPermission();if(typeof window<"u"&&"Notification"in window){let Z=window.Notification;if(Z.permission==="granted")return!0;if(Z.permission==="denied")return!1;return await Z.requestPermission()==="granted"}return!1},async registerCategories(Z){if(!Array.isArray(Z)||Z.length===0)return;if(G("notifications")){let Y=window.craft.notifications.registerCategories;if(typeof Y==="function")await Y(Z)}},onActionClicked(Z){return U("craft:notification:actionClicked",Z)},onReply(Z){return U("craft:notification:reply",Z)}};function _8(Z){if(Z==null)return Date.now();if(Z instanceof Date)return Z.getTime();if(typeof Z==="number")return Z;let Y=Date.parse(Z);return Number.isNaN(Y)?Date.now():Y}var T8={async readFile(Z){let Y=await M("fs").readFile(Z);return Y&&Y.data||""},async readBuffer(Z){let Y=await M("fs").readFile(Z),$=Y&&Y.data||"";if(Y&&Y.base64===!0)return E8($);return new TextEncoder().encode($)},async writeFile(Z,Y){await M("fs").writeFile(Z,Y)},async writeBuffer(Z,Y){let $=N8(Y),J=M("fs");if(typeof J.writeFileBytes==="function")await J.writeFileBytes(Z,$);else await J.writeFile(Z,$)},async copy(Z,Y){if(Z===Y)throw Error("fs.copy: source and destination must differ");await M("fs").copy(Z,Y)},async move(Z,Y){if(Z===Y)throw Error("fs.move: source and destination must differ");await M("fs").move(Z,Y)},async appendFile(Z,Y){await M("fs").appendFile(Z,Y)},async deleteFile(Z){await M("fs").deleteFile(Z)},async exists(Z){return await M("fs").exists(Z)},async stat(Z){return A8(await M("fs").stat(Z))},async readDir(Z){let Y=await M("fs").readDir(Z),$=Y&&Y.entries||[],J=Z.endsWith("/")?Z.slice(0,-1):Z;return $.map((Q)=>({name:Q.name,path:`${J}/${Q.name}`,isDirectory:!!Q.isDirectory}))},async mkdir(Z,Y){await M("fs").mkdir(Z,Y)},async rmdir(Z,Y){await M("fs").rmdir(Z,Y)},async watch(Z,Y){await M("fs").watch(Z,Y)},async unwatch(Z){await M("fs").unwatch(Z)},onChange(Z){return U("craft:fs:change",Z)},async watchTree(Z,Y,$){let J=`watch-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,Q=M("fs");await Q.watch(Z,J,{recursive:!!Y.recursive});let X=Y.kinds&&Y.kinds.length>0?new Set(Y.kinds):null,R=Math.max(0,Math.floor(Y.coalesceMs??0)),z=[],K=null,F=!1,O=()=>{if(K=null,z.length===0)return;let j=z;z=[];try{$(j)}catch{}},V=U("craft:fs:change",(j)=>{if(F)return;if(j.id!==J)return;if(X&&j.kind&&!X.has(j.kind))return;if(z.push(j),R===0){O();return}if(K==null)K=setTimeout(O,R)});return{id:J,async stop(){if(F)return;if(F=!0,V(),K)clearTimeout(K),K=null;if(z.length>0)O();try{await Q.unwatch(J)}catch{}}}},async homeDir(){return await M("fs").homeDir()},async tempDir(){return await M("fs").tempDir()},async appDataDir(){return await M("fs").appDataDir()}};function N8(Z){let Y="";for(let $=0;$<Z.length;$++)Y+=String.fromCharCode(Z[$]);return typeof btoa==="function"?btoa(Y):Buffer.from(Z).toString("base64")}function E8(Z){let Y=typeof atob==="function"?atob(Z):Buffer.from(Z,"base64").toString("binary"),$=new Uint8Array(Y.length);for(let J=0;J<Y.length;J++)$[J]=Y.charCodeAt(J);return $}function A8(Z){return{isFile:!!Z.isFile,isDirectory:!!Z.isDirectory,isSymlink:!!Z.isSymlink,size:Number(Z.size)||0,modifiedAt:Z.modifiedAt!=null?Z.modifiedAt<1000000000000?Z.modifiedAt*1000:Z.modifiedAt:0}}var a=new Set,q4=!1;function k8(){if(q4)return;if(typeof window>"u"||typeof window.addEventListener!=="function")return;window.addEventListener("craft:shell:exit",(Z)=>{let Y=Z.detail;if(Y?.id)a.delete(Y.id)}),q4=!0}var H8=new Set(["javascript:","data:","file:","vbscript:"]),x8={async openExternal(Z){let Y=Z.trim().toLowerCase();for(let $ of H8)if(Y.startsWith($))throw Error(`shell.openExternal: ${$} URLs are blocked for safety`);if(G("shell")){await window.craft.shell.openExternal(Z);return}if(typeof window<"u"&&typeof window.open==="function")window.open(Z,"_blank","noopener,noreferrer")},async openPath(Z){await M("shell").openPath(Z)},async showInFinder(Z){await M("shell").showInFinder(Z)},async spawn(Z,Y,$=[],J={}){if(k8(),!Z||typeof Z!=="string")throw Error("shell.spawn: id must be a non-empty string");if(!Y||typeof Y!=="string")throw Error("shell.spawn: command must be a non-empty string");if(!Array.isArray($))throw Error("shell.spawn: args must be an array");for(let Q of $)if(typeof Q!=="string")throw Error("shell.spawn: args entries must be strings");if(a.has(Z))throw Error(`shell.spawn: id "${Z}" is already in use \u2014 call kill(id) first or pick a different id`);a.add(Z);try{await M("shell").spawn(Z,Y,$,J)}catch(Q){throw a.delete(Z),Q}},async kill(Z){await M("shell").kill(Z),a.delete(Z)},async getEnv(Z){if(G("shell")){let Y=await window.craft.shell.getEnv(Z);return Y==null?void 0:String(Y)}return},async setEnv(Z,Y){await M("shell").setEnv(Z,Y)},onStdout(Z){return U("craft:shell:stdout",Z)},onStderr(Z){return U("craft:shell:stderr",Z)},onExit(Z){return U("craft:shell:exit",Z)}};function u(){return window.craft.shortcuts}var C8={async register(Z,Y,$){if(!G("shortcuts"))return;await u().register(Z,Y,$)},async unregister(Z){if(!G("shortcuts"))return;await u().unregister(Z)},async unregisterAll(){if(!G("shortcuts"))return;await u().unregisterAll()},async enable(Z){if(!G("shortcuts"))return;await u().enable(Z)},async disable(Z){if(!G("shortcuts"))return;await u().disable(Z)},async isRegistered(Z){if(!G("shortcuts"))return!1;return await u().isRegistered(Z)},async list(){if(!G("shortcuts"))return[];return await u().list()},on(Z){return U("craft:shortcut",Z)}};var I8={get(){if(G("theme"))try{return window.craft.theme.get()}catch{}return{appearance:S8()}},onChange(Z){if(Z(this.get()),G("theme"))return U("craft:theme",Z);if(typeof window<"u"&&window.matchMedia){let Y=window.matchMedia("(prefers-color-scheme: dark)"),$=()=>Z({appearance:Y.matches?"dark":"light"});return Y.addEventListener("change",$),()=>Y.removeEventListener("change",$)}return()=>{}},async current(){return this.get()}};function S8(){if(typeof window>"u"||!window.matchMedia)return"light";return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}async function w8(Z,Y={}){if(!G("dragOut"))throw Error("dragOut requires a Craft native window");let $=Array.isArray(Z)?Z:[Z];if($.length===0)throw Error("dragOut: at least one path required");await window.craft.dragOut.start($,Y)}function B8(){return G("dragOut")}var f8={onUrl(Z){if(!G("deepLink"))return()=>{};return U("craft:deepLink",Z)},getInitialUrl(){if(typeof window>"u")return null;if(G("deepLink"))try{return window.craft.deepLink.getInitialUrl()}catch{return null}return window.__craftPendingDeepLink||null},consumeInitialUrl(){let Z=this.getInitialUrl();if(typeof window<"u")window.__craftPendingDeepLink=void 0;return Z},isAvailable(){return G("deepLink")}};var v8={async isCharging(){if(G("power"))return await window.craft.power.isCharging();let Z=await RZ();return Z?!!Z.charging:!1},async isPluggedIn(){if(G("power"))return await window.craft.power.isPluggedIn();let Z=await RZ();return Z?!!Z.charging||Z.level>=0.999:!1},async isLowPowerMode(){if(G("power"))return await window.craft.power.isLowPowerMode();return!1},async level(){if(G("power")){let Y=await window.craft.power.batteryLevel();return typeof Y==="number"?Y:null}let Z=await RZ();return Z?Z.level:null},async timeRemaining(){if(G("power")){let $=await window.craft.power.timeRemaining();return typeof $==="number"?$:null}let Z=await RZ();if(!Z)return null;let Y=Z.charging?Z.chargingTime:Z.dischargingTime;return Number.isFinite(Y)?Math.round(Y/60):null},async thermalState(){if(G("power"))return await window.craft.power.thermalState()||"unknown";return"unknown"},async uptimeSeconds(){if(G("power"))return await window.craft.power.uptimeSeconds();if(typeof performance<"u"&&typeof performance.now==="function")return Math.round(performance.now()/1000);return 0},async preventSleep(Z="app is busy"){if(G("power")){await window.craft.power.preventSleep(Z);return}if(typeof navigator>"u"||!navigator.wakeLock)return;let Y=window;if(Y.__craftWebWakeLock?.release){try{await Y.__craftWebWakeLock.release()}catch{}Y.__craftWebWakeLock=null}try{let $=await navigator.wakeLock.request("screen");Y.__craftWebWakeLock=$}catch{}},async allowSleep(){if(G("power")){await window.craft.power.allowSleep();return}let Z=window.__craftWebWakeLock;if(Z&&typeof Z.release==="function"){try{await Z.release()}catch{}window.__craftWebWakeLock=null}},onSleep(Z){return U("craft:powerSleep",Z)},onWake(Z){return U("craft:powerWake",Z)}};async function RZ(){if(typeof navigator>"u")return null;let Z=navigator;if(typeof Z.getBattery!=="function")return null;try{return await Z.getBattery()}catch{return null}}var y8={async connectionType(){if(G("network"))return await window.craft.network.connectionType();return U4()},async wifiSSID(){if(G("network"))return await window.craft.network.wifiSSID()||void 0;return},async wifiSignalStrength(){if(G("network")){let Z=await window.craft.network.wifiSignalStrength();return typeof Z==="number"?Z:void 0}return},async ipAddress(){if(G("network"))return await window.craft.network.ipAddress();return""},async macAddress(){if(G("network"))return await window.craft.network.macAddress();return""},async interfaces(){if(G("network"))return await window.craft.network.interfaces();return[]},async isVPNConnected(){if(G("network"))return await window.craft.network.isVPNConnected();return!1},async proxySettings(){if(G("network"))return await window.craft.network.proxySettings()||{};return{}},async openPreferences(){if(G("network"))await window.craft.network.openPreferences()},onChange(Z){if(G("network"))return U("craft:networkChange",Z);if(typeof window>"u")return()=>{};let Y=()=>Z({type:U4(),online:!0}),$=()=>Z({type:"none",online:!1});return window.addEventListener("online",Y),window.addEventListener("offline",$),()=>{window.removeEventListener("online",Y),window.removeEventListener("offline",$)}}};function U4(){if(typeof navigator>"u")return"unknown";if(navigator.onLine===!1)return"none";let Z=navigator.connection;if(!Z)return"unknown";let Y=String(Z.type||Z.effectiveType||"unknown").toLowerCase();if(Y==="wifi"||Y==="cellular"||Y==="ethernet"||Y==="bluetooth"||Y==="none")return Y;return"unknown"}var g8={async checkForUpdates(){if(!G("updater"))return;await window.craft.updater.checkForUpdates()},async checkInBackground(){if(!G("updater"))return;await window.craft.updater.checkInBackground()},async setAutomaticChecks(Z){if(!G("updater"))return;await window.craft.updater.setAutomaticChecks(Z)},async setCheckInterval(Z){if(!G("updater"))return;if(!Number.isFinite(Z))throw Error("setCheckInterval: must be a finite number");let Y=Z<=0?0:Math.max(60,Math.round(Z));await window.craft.updater.setCheckInterval(Y)},async setFeedURL(Z){if(!G("updater"))return;await window.craft.updater.setFeedURL(Z)},async getLastUpdateCheckDate(){if(!G("updater"))return null;return await window.craft.updater.getLastUpdateCheckDate()||null},async getUpdateInfo(){if(!G("updater"))return null;let Z=await window.craft.updater.getUpdateInfo();if(!Z||typeof Z.version!=="string"||Z.version.length===0)return null;return Z},onAvailable(Z){return U("craft:updateAvailable",Z)},onDownloaded(Z){return U("craft:updateDownloaded",Z)},async verifySignature({payload:Z,signatureB64:Y,publicKeyB64:$}){let J=P4(Z),Q;try{Q=await crypto.subtle.importKey("raw",KZ($),{name:"Ed25519"},!1,["verify"])}catch{return!1}try{return await crypto.subtle.verify("Ed25519",Q,KZ(Y),J)}catch{return!1}},async verifyDownload({url:Z,signatureB64:Y,publicKeyB64:$,fetchInit:J}){let Q;try{Q=await fetch(Z,J)}catch{return{ok:!1,reason:"fetch-failed"}}if(!Q.ok)return{ok:!1,reason:"http-error",status:Q.status};let X=new Uint8Array(await Q.arrayBuffer()),R;try{R=await crypto.subtle.importKey("raw",KZ($),{name:"Ed25519"},!1,["verify"])}catch{return{ok:!1,reason:"bad-key"}}let z=!1;try{z=await crypto.subtle.verify("Ed25519",R,KZ(Y),P4(X))}catch{z=!1}if(!z)return{ok:!1,reason:"bad-signature"};return{ok:!0,payload:X}}};function P4(Z){if(Z instanceof ArrayBuffer)return new Uint8Array(Z);let Y=new ArrayBuffer(Z.byteLength),$=new Uint8Array(Y);return $.set(Z),$}function KZ(Z){if(typeof atob==="function"){let J=atob(Z),Q=new ArrayBuffer(J.length),X=new Uint8Array(Q);for(let R=0;R<J.length;R++)X[R]=J.charCodeAt(R);return X}let Y=Buffer.from(Z,"base64"),$=new ArrayBuffer(Y.length);return new Uint8Array($).set(Y),new Uint8Array($)}var b8={onFocus(Z){if(G("window"))return U("craft:window:focus",()=>Z());return EZ("focus",Z)},onBlur(Z){if(G("window"))return U("craft:window:blur",()=>Z());return EZ("blur",Z)},onResize(Z){if(G("window"))return U("craft:window:resize",Z);if(typeof window>"u")return()=>{};let Y=()=>Z({width:window.innerWidth,height:window.innerHeight});return window.addEventListener("resize",Y),()=>window.removeEventListener("resize",Y)},onMove(Z){if(G("window"))return U("craft:window:move",Z);return()=>{}},onClose(Z){if(G("window"))return U("craft:window:close",()=>Z());return EZ("beforeunload",Z)},onMinimize(Z){if(G("window"))return U("craft:window:minimize",()=>Z());if(typeof document>"u")return()=>{};let Y=()=>{if(document.visibilityState==="hidden")Z()};return document.addEventListener("visibilitychange",Y),()=>document.removeEventListener("visibilitychange",Y)},onRestore(Z){if(G("window"))return U("craft:window:restore",()=>Z());if(typeof document>"u")return()=>{};let Y=()=>{if(document.visibilityState==="visible")Z()};return document.addEventListener("visibilitychange",Y),()=>document.removeEventListener("visibilitychange",Y)}};function EZ(Z,Y){if(typeof window>"u")return()=>{};let $=()=>Y();return window.addEventListener(Z,$),()=>window.removeEventListener(Z,$)}var L4={name:"",version:"0.0.0"},u8={async hideDockIcon(){if(G("app"))await window.craft.app.hideDockIcon()},async showDockIcon(){if(G("app"))await window.craft.app.showDockIcon()},async quit(){if(G("app"))await window.craft.app.quit()},async getInfo(){if(!G("app"))return L4;let Z=await window.craft.app.getInfo();return{...L4,...Z||{}}},async notify(Z){if(!Z.title)throw Error("notify: title is required");if(G("app"))await window.craft.app.notify(Z)},async setBadge(Z){if(G("app"))await window.craft.app.setBadge(Z)},async bounce(Z="informational"){if(G("app"))await window.craft.app.bounce(Z)}};var m8={app(Z){return{label:Z,items:[{label:`About ${Z}`,role:"about"},{separator:!0},{label:`Hide ${Z}`,role:"hide",shortcut:"cmd+h"},{label:"Hide Others",role:"hideOthers",shortcut:"cmd+alt+h"},{label:"Show All",role:"showAll"},{separator:!0},{label:`Quit ${Z}`,role:"quit",shortcut:"cmd+q"}]}},edit(){return{label:"Edit",items:[{label:"Undo",role:"undo",shortcut:"cmd+z"},{label:"Redo",role:"redo",shortcut:"cmd+shift+z"},{separator:!0},{label:"Cut",role:"cut",shortcut:"cmd+x"},{label:"Copy",role:"copy",shortcut:"cmd+c"},{label:"Paste",role:"paste",shortcut:"cmd+v"},{label:"Select All",role:"selectAll",shortcut:"cmd+a"}]}},window(){return{label:"Window",items:[{label:"Minimize",role:"minimize",shortcut:"cmd+m"},{label:"Zoom",role:"zoom"},{separator:!0},{label:"Close Window",role:"close",shortcut:"cmd+w"}]}},leading(Z){return[this.app(Z),this.edit()]}},h8=0;function c8(Z){let Y=new Map;return{payload:{menus:Z.menus.map((J)=>({label:J.label,items:J.items.map((Q)=>{let{onClick:X,...R}=Q;if(R.separator)return R;let z=R.id??`stx.menu.${h8++}`;if(X)Y.set(z,X);return{...R,id:z}})}))},handlers:Y}}var AZ=null,p8={async set(Z){if(!G("menu"))return!1;let{payload:Y,handlers:$}=c8(Z);if(AZ?.(),AZ=null,$.size>0)AZ=U("craft:menu:action",(J)=>{$.get(J.id)?.()});return await window.craft.menu.set(Y),!0},async setDock(Z){if(G("menu"))await window.craft.menu.setDock(Z)},async addItem(Z,Y){if(G("menu"))await window.craft.menu.addItem(Z,Y)},async removeItem(Z){if(G("menu"))await window.craft.menu.removeItem(Z)},async enableItem(Z){if(G("menu"))await window.craft.menu.enableItem(Z)},async disableItem(Z){if(G("menu"))await window.craft.menu.disableItem(Z)},async checkItem(Z){if(G("menu"))await window.craft.menu.checkItem(Z)},async uncheckItem(Z){if(G("menu"))await window.craft.menu.uncheckItem(Z)},async setItemLabel(Z,Y){if(G("menu"))await window.craft.menu.setItemLabel(Z,Y)},async clearDock(){if(G("menu"))await window.craft.menu.clearDock()},onAction(Z){return U("craft:menu:action",Z)}};function D4(Z){if(Z.separator)return{id:Z.id||"",title:"",type:"separator"};return{id:Z.id||"",title:Z.title||"",icon:Z.icon,shortcut:Z.shortcut,enabled:Z.disabled?!1:void 0,checked:Z.checked?!0:void 0,type:Z.submenu?"submenu":void 0,submenu:Z.submenu?.map(D4)}}async function W4(Z){if(!Z.items||Z.items.length===0)throw Error("contextMenu.show requires at least one item");if(!G("nativeUI"))return null;let Y=await window.craft.nativeUI.showContextMenu({targetId:Z.targetId||"",targetType:"general",x:Math.round(Z.x),y:Math.round(Z.y),items:Z.items.map(D4)});return{id:typeof Y?.id==="string"?Y.id:null,targetId:Y?.targetId}}var l8={available(){return G("nativeUI")},async show(Z){return await W4(Z)!==null},async pick(Z){return(await W4(Z))?.id??null},onAction(Z){return U("craft:contextmenu:action",(Y)=>{if(typeof Y.id==="string")Z({id:Y.id,targetId:Y.targetId??""})})}};var d8={accentColor:()=>x("system","accentColor",()=>""),highlightColor:()=>x("system","highlightColor",()=>""),language:()=>x("system","language",()=>{if(typeof navigator>"u")return"";return navigator.language?.split("-")[0]||""}),locale:()=>x("system","locale",()=>{if(typeof navigator>"u")return"";return navigator.language||""}),timezone:()=>x("system","timezone",()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch{return""}}),is24HourTime:()=>x("system","is24HourTime",()=>{try{let Z=new Intl.DateTimeFormat([],{hour:"numeric"}).resolvedOptions();return Z.hourCycle==="h23"||Z.hourCycle==="h24"}catch{return!1}}),reduceMotion:()=>x("system","reduceMotion",()=>kZ("(prefers-reduced-motion: reduce)")),reduceTransparency:()=>x("system","reduceTransparency",()=>kZ("(prefers-reduced-transparency: reduce)")),increaseContrast:()=>x("system","increaseContrast",()=>kZ("(prefers-contrast: more)")),systemVersion:()=>x("system","systemVersion",()=>""),hostname:()=>x("system","hostname",()=>""),username:()=>x("system","username",()=>""),async openPreferences(){if(G("system"))await window.craft.system.openPreferences()}};async function x(Z,Y,$){if(G(Z))return await window.craft[Z][Y]();return await $()}function kZ(Z){if(typeof window>"u"||!window.matchMedia)return!1;return window.matchMedia(Z).matches}var r8={async getDisplays(){if(G("screen"))return await window.craft.screen.getDisplays();return M4()},async getPrimary(){if(G("screen")){let Z=await window.craft.screen.getPrimary();return Z&&typeof Z.width==="number"?Z:null}return M4()[0]??null},onChange(Z){if(G("screen"))return U("craft:screen:change",()=>Z());if(typeof window>"u")return()=>{};let Y=()=>Z();return window.addEventListener("resize",Y),()=>window.removeEventListener("resize",Y)}};function M4(){if(typeof window>"u"||!window.screen)return[];let Z=window.screen;return[{id:0,x:Z.left??0,y:Z.top??0,width:Z.width||0,height:Z.height||0,workX:Z.availLeft??0,workY:Z.availTop??0,workWidth:Z.availWidth??Z.width??0,workHeight:Z.availHeight??Z.height??0,scaleFactor:window.devicePixelRatio||1}]}var n8={async set(Z,Y,$){if(!Z)throw Error("keychain.set: service is required");if(!Y)throw Error("keychain.set: account is required");await M("keychain").set(Z,Y,$)},async get(Z,Y){if(!Z)throw Error("keychain.get: service is required");if(!Y)throw Error("keychain.get: account is required");let $=await M("keychain").get(Z,Y);return typeof $==="string"?$:null},async delete(Z,Y){if(!Z)throw Error("keychain.delete: service is required");if(!Y)throw Error("keychain.delete: account is required");await M("keychain").delete(Z,Y)},async has(Z,Y){if(!Z)throw Error("keychain.has: service is required");if(!Y)throw Error("keychain.has: account is required");return await M("keychain").has(Z,Y)}};var o8={async check(Z){if(G("permissions"))return await window.craft.permissions.check(Z);return await _4(Z)},async request(Z){if(G("permissions"))return await window.craft.permissions.request(Z);return await a8(Z)},async openSettings(Z){if(G("permissions"))await window.craft.permissions.openSettings(Z)}};async function _4(Z){if(typeof navigator>"u"||!navigator.permissions?.query)return"not-supported";try{let Y=await navigator.permissions.query({name:Z});return i8(Y.state)}catch{return"not-supported"}}async function a8(Z){if(Z==="notifications"&&typeof window<"u"&&"Notification"in window){let Y=await window.Notification.requestPermission();return Y==="granted"?"granted":Y==="denied"?"denied":"undetermined"}return await _4(Z)}function i8(Z){if(Z==="granted")return"granted";if(Z==="denied")return"denied";if(Z==="prompt")return"undetermined";return"undetermined"}var s8={async print(){if(G("printing")){await window.craft.printing.print();return}if(typeof window<"u"&&typeof window.print==="function")window.print()},async printToPDF(Z){if(!Z)throw Error("printToPDF: path is required");let Y=Z.startsWith("/"),$=/^[a-zA-Z]:[\\/]/.test(Z)||Z.startsWith("\\\\");if(!Y&&!$)throw Error("printToPDF: path must be absolute");let J=await M("printing").printToPDF(Z);return{ok:!!(J&&J.ok),path:J?.path}}};var t8={async enable(){if(!G("autoLaunch"))return!1;return await window.craft.autoLaunch.enable()},async disable(){if(!G("autoLaunch"))return!1;return await window.craft.autoLaunch.disable()},async isEnabled(){if(!G("autoLaunch"))return!1;return await window.craft.autoLaunch.isEnabled()}};function HZ(){if(!G("window"))return null;return window.craft.window}function f(Z){let Y=HZ();if(!Y)return Promise.resolve();try{return Promise.resolve(Z(Y)).then(()=>{return},()=>{return})}catch{return Promise.resolve()}}var e8={get available(){return HZ()!==null},open(Z){let Y=()=>{if(typeof window<"u"&&Z.url)window.open(Z.url,Z.name);return{name:Z.name}},$=HZ();if(!$?.open)return Promise.resolve(Y());return $.open(Z).then((J)=>({name:J?.name||Z.name})).catch(Y)},close:()=>f((Z)=>Z.close?.()),focus:()=>f((Z)=>Z.focus?.()),minimize:()=>f((Z)=>Z.minimize?.()),maximize:()=>f((Z)=>Z.maximize?.()),center:()=>f((Z)=>Z.center?.()),startDrag:()=>f((Z)=>Z.startDrag?.()),setTitle:(Z)=>f((Y)=>Y.setTitle?.(Z)),setSize:(Z,Y)=>f(($)=>$.setSize?.(Z,Y)),setAppearance:(Z)=>f((Y)=>Y.setAppearance?.(Z))};var Z9={async addItem(Z){if(G("touchbar"))await window.craft.touchbar.addItem(Z)},async removeItem(Z){if(G("touchbar"))await window.craft.touchbar.removeItem(Z)},async updateItem(Z,Y){if(G("touchbar"))await window.craft.touchbar.updateItem(Z,Y)},async setLabel(Z,Y){if(G("touchbar"))await window.craft.touchbar.setLabel(Z,Y)},async setIcon(Z,Y){if(G("touchbar"))await window.craft.touchbar.setIcon(Z,Y)},async setEnabled(Z,Y){if(G("touchbar"))await window.craft.touchbar.setEnabled(Z,Y)},async setSliderValue(Z,Y){if(G("touchbar"))await window.craft.touchbar.setSliderValue(Z,Y)},async clear(){if(G("touchbar"))await window.craft.touchbar.clear()},async show(){if(G("touchbar"))await window.craft.touchbar.show()},async hide(){if(G("touchbar"))await window.craft.touchbar.hide()},onAction(Z){return U("craft:touchbar:action",Z)}};var Y9=/^[\da-f]*$/i;function $9(Z,Y){if(typeof Y!=="string"||!Y9.test(Y)||Y.length%2!==0)throw Error(`${Z}: must be a hex string with even length, got ${JSON.stringify(Y)}`)}var J9={async isEnabled(){return G("bluetooth")?await window.craft.bluetooth.isEnabled():!1},async powerState(){return G("bluetooth")?await window.craft.bluetooth.powerState():"unknown"},async connectedDevices(){return G("bluetooth")?await window.craft.bluetooth.connectedDevices():[]},async pairedDevices(){return G("bluetooth")?await window.craft.bluetooth.pairedDevices():[]},async startDiscovery(){if(G("bluetooth"))await window.craft.bluetooth.startDiscovery()},async stopDiscovery(){if(G("bluetooth"))await window.craft.bluetooth.stopDiscovery()},async isDiscovering(){return G("bluetooth")?await window.craft.bluetooth.isDiscovering():!1},async connect(Z){if(G("bluetooth"))await window.craft.bluetooth.connect(Z)},async disconnect(Z){if(G("bluetooth"))await window.craft.bluetooth.disconnect(Z)},async openPreferences(){if(G("bluetooth"))await window.craft.bluetooth.openPreferences()},async discoverServices(Z){if(!Z)throw Error("bluetooth.discoverServices: deviceId is required");if(!G("bluetooth"))return[];let Y=await window.craft.bluetooth.discoverServices(Z);return Array.isArray(Y)?Y:[]},async discoverCharacteristics(Z,Y){if(!Z||!Y)throw Error("bluetooth.discoverCharacteristics: deviceId and serviceUuid are required");if(!G("bluetooth"))return[];let $=await window.craft.bluetooth.discoverCharacteristics(Z,Y);return Array.isArray($)?$:[]},async readCharacteristic(Z,Y,$){if(!Z||!Y||!$)throw Error("bluetooth.readCharacteristic: deviceId, serviceUuid, characteristicUuid are required");if(!G("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.readCharacteristic(Z,Y,$)},async writeCharacteristic(Z,Y,$,J,Q="with-response"){if(!Z||!Y||!$)throw Error("bluetooth.writeCharacteristic: deviceId, serviceUuid, characteristicUuid are required");if($9("bluetooth.writeCharacteristic.valueHex",J),!G("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.writeCharacteristic(Z,Y,$,J,Q)},async setCharacteristicNotify(Z,Y,$,J){if(!Z||!Y||!$)throw Error("bluetooth.setCharacteristicNotify: deviceId, serviceUuid, characteristicUuid are required");if(!G("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.setCharacteristicNotify(Z,Y,$,J)},onDeviceFound(Z){return U("craft:bluetooth:deviceFound",Z)},onDeviceConnected(Z){return U("craft:bluetooth:deviceConnected",Z)},onDeviceDisconnected(Z){return U("craft:bluetooth:deviceDisconnected",Z)},onCharacteristicValue(Z){return U("craft:bluetooth:characteristicValue",Z)}};var G9={async speak(Z,Y){if(!Z)throw Error("speech.speak: text is required");if(G("speech")){await window.craft.speech.speak(Z,Y);return}if(typeof window<"u"&&window.speechSynthesis){let $=new window.SpeechSynthesisUtterance(Z);if(Y){if(Y.rate!=null)$.rate=Y.rate;if(Y.pitch!=null)$.pitch=Y.pitch;if(Y.volume!=null)$.volume=Y.volume;if(Y.voice){let Q=window.speechSynthesis.getVoices().find((X)=>X.voiceURI===Y.voice||X.name===Y.voice||X.lang===Y.voice);if(Q)$.voice=Q}}window.speechSynthesis.speak($)}},async stop(){if(G("speech")){await window.craft.speech.stop();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.cancel()},async pause(){if(G("speech")){await window.craft.speech.pause();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.pause()},async resume(){if(G("speech")){await window.craft.speech.resume();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.resume()},async isSpeaking(){if(G("speech"))return await window.craft.speech.isSpeaking();if(typeof window<"u"&&window.speechSynthesis)return!!window.speechSynthesis.speaking;return!1},async getVoices(){if(G("speech"))return await window.craft.speech.getVoices();if(typeof window<"u"&&window.speechSynthesis)return window.speechSynthesis.getVoices().map((Y)=>({id:Y.voiceURI||Y.name,name:Y.name,language:Y.lang||"",quality:"default"}));return[]}};var i=[],xZ=!0,CZ,IZ,s={async report(Z){if(G("crashReporter")){await window.craft.crashReporter.report(Z);return}if(!xZ)return;let Y=Z instanceof Error?{timestamp:Date.now(),severity:"error",message:Z.message,source:"js",stack:Z.stack||"",userId:CZ,appVersion:IZ}:{timestamp:Date.now(),severity:Z.severity||"error",message:Z.message||"",source:Z.source||"js",stack:Z.stack||"",userId:CZ,appVersion:IZ};if(i.length>=64)i.shift();i.push(Y)},async flush(){if(G("crashReporter"))return await window.craft.crashReporter.flush();return[...i]},async clear(){if(G("crashReporter")){await window.craft.crashReporter.clear();return}i.length=0},async setEnabled(Z){if(G("crashReporter")){await window.craft.crashReporter.setEnabled(Z);return}xZ=Z},async isEnabled(){if(G("crashReporter"))return await window.craft.crashReporter.isEnabled();return xZ},async setUser(Z){if(G("crashReporter")){await window.craft.crashReporter.setUser(Z);return}CZ=Z||void 0},async setAppVersion(Z){if(G("crashReporter")){await window.craft.crashReporter.setAppVersion(Z);return}IZ=Z||void 0},attachGlobalHandlers(){if(G("crashReporter")&&window.craft.crashReporter.attachGlobalHandlers)return window.craft.crashReporter.attachGlobalHandlers();if(typeof window>"u")return()=>{};let Z=($)=>{s.report({severity:"error",message:$.message,source:"js",stack:$.error?.stack||`${$.message}
895
895
  at ${$.filename}:${$.lineno}:${$.colno}`}).catch(()=>{})},Y=($)=>{let J=$.reason;s.report({severity:"error",message:J?.message||String(J),source:"js",stack:J?.stack||""}).catch(()=>{})};return window.addEventListener("error",Z),window.addEventListener("unhandledrejection",Y),()=>{window.removeEventListener("error",Z),window.removeEventListener("unhandledrejection",Y)}},forwardTo(Z){return F9(Z)}},Q9="craft:crashReporter:pending",X9=/[\w.+-]+@[\w-]+\.[\w.-]+/g,z9=/\b(?:\d{1,3}\.){3}\d{1,3}\b/g,R9=/\/(?:Users|home)\/[^\s/'"`]+/g;function N4(Z){let Y=($)=>$.replace(X9,"<email>").replace(z9,"<ip>").replace(R9,"/<home>");return{...Z,message:Y(Z.message),stack:Y(Z.stack)}}async function E4(Z,Y){let $=new TextEncoder,J=await crypto.subtle.importKey("raw",$.encode(Z),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),Q=await crypto.subtle.sign("HMAC",J,$.encode(Y));return[...new Uint8Array(Q)].map((X)=>X.toString(16).padStart(2,"0")).join("")}function K9(Z){if(!Z||typeof localStorage>"u")return[];try{let Y=localStorage.getItem(Z);if(!Y)return[];let $=JSON.parse(Y);return Array.isArray($)?$:[]}catch{return[]}}function T4(Z,Y){if(!Z||typeof localStorage>"u")return;try{if(Y.length===0)localStorage.removeItem(Z);else localStorage.setItem(Z,JSON.stringify(Y))}catch{}}function F9(Z){let{endpoint:Y,intervalMs:$=60000,signingSecret:J,redact:Q=!0,headers:X={},maxRetries:R=5,persistKey:z}=Z,K=z===null?null:z??Q9,F=K9(K),O=!1,V=null,j=null,P=typeof Q==="function"?Q:Q===!1?(N)=>N:N4;async function L(N){let E=JSON.stringify({entries:N}),S={"Content-Type":"application/json",...X};if(J)S["X-Craft-Signature"]=await E4(J,E);let e=0,w=1000;while(!O)try{let m=await fetch(Y,{method:"POST",headers:S,body:E});if(m.ok)return;if(m.status>=400&&m.status<500)return;throw Error(`HTTP ${m.status}`)}catch(m){if(e+=1,e>R)throw F=[...N,...F],T4(K,F),m;await new Promise((S4)=>{setTimeout(S4,w)}),w=Math.min(w*2,60000)}}async function T(){if(O||j)return j??void 0;let N=await s.flush();if(N.length>0)await s.clear();if(F=[...F,...N.map((S)=>P(S))],F.length===0)return;let E=F;return F=[],T4(K,F),j=L(E).catch(()=>{}).finally(()=>{j=null}),j}if($>0)V=setInterval(()=>{T().catch(()=>{})},$);return{async flushNow(){await T()},stop(){if(O=!0,V)clearInterval(V);V=null},pending(){return[...F]}}}var j9={async isAvailable(){if(!G("iap"))return!1;return await window.craft.iap.isAvailable()},async getProducts(Z){if(!G("iap"))return[];let Y=Array.isArray(Z)?Z:[String(Z)];return await window.craft.iap.getProducts(Y)},async purchase(Z){if(!G("iap"))return{queued:!1,productId:Z,reason:"IAP bridge not available"};let Y=await window.craft.iap.purchase(Z);return{queued:!!(Y&&Y.queued),productId:Y?.productId,reason:Y?.reason}},async restorePurchases(){if(!G("iap"))return{ok:!1};let Z=await window.craft.iap.restorePurchases();return{ok:!!(Z&&Z.ok)}},async finishTransaction(Z){if(!G("iap"))return;await window.craft.iap.finishTransaction(Z)},async getReceiptData(){if(!G("iap"))return null;let Z=await window.craft.iap.getReceiptData();return Z?String(Z):null},onPurchased(Z){return U("craft:iap:purchased",Z)},onFailed(Z){return U("craft:iap:failed",Z)},onRestored(Z){return U("craft:iap:restored",Z)},onProductsLoaded(Z){return U("craft:iap:productsLoaded",(Y)=>Z(Y.products||[]))},onRefunded(Z){return U("craft:iap:refunded",Z)},onSubscriptionStatusChanged(Z){return U("craft:iap:subscriptionStatusChanged",Z)},async getActiveSubscriptions(){if(!G("iap"))return[];let Z=window.craft.iap.getActiveSubscriptions;if(typeof Z!=="function")return[];let Y=await Z();return Array.isArray(Y)?Y:[]},async isEligibleForIntroOffer(Z){if(!G("iap"))return!1;let Y=window.craft.iap.isEligibleForIntroOffer;if(typeof Y!=="function")return!1;return!!await Y(Z)}};var t={async startActivity(Z,Y){if(!Z)throw Error("handoff.startActivity: type is required");if(!G("handoff"))return!1;let $=await window.craft.handoff.startActivity(Z,Y);return typeof $==="boolean"?$:!!($&&$.ok)},async updateActivity(Z){if(!G("handoff"))return!1;let Y=await window.craft.handoff.updateActivity(Z);return typeof Y==="boolean"?Y:!!(Y&&Y.ok)},async stopActivity(){if(!G("handoff"))return;await window.craft.handoff.stopActivity()},async getCurrentActivity(){if(!G("handoff"))return null;let Z=await window.craft.handoff.getCurrentActivity();return Z&&typeof Z.type==="string"?Z:null},onIncoming(Z){return U("craft:handoff:incoming",Z)}};var O9={async start(Z,Y){return t.startActivity(Z,{title:Y?.title,webpageURL:Y?.webpageURL,userInfo:Y?.state})},async update(Z){return t.updateActivity({title:Z.title,webpageURL:Z.webpageURL,userInfo:Z.state})},async stop(){await t.stopActivity()}};var V9={async requestPermission(Z="whenInUse"){if(G("location"))return await window.craft.location.requestPermission(Z);if(typeof navigator<"u"&&navigator.geolocation)return"undetermined";return"not-supported"},async getAuthorization(){if(G("location"))return await window.craft.location.getAuthorization();return"unknown"},async getCurrentLocation(){if(G("location"))return await window.craft.location.getCurrentLocation();if(typeof navigator<"u"&&navigator.geolocation)return navigator.geolocation.getCurrentPosition((Z)=>{window.dispatchEvent(new CustomEvent("craft:location:update",{detail:{latitude:Z.coords.latitude,longitude:Z.coords.longitude,altitude:Z.coords.altitude,horizontalAccuracy:Z.coords.accuracy,verticalAccuracy:Z.coords.altitudeAccuracy,speed:Z.coords.speed}}))},(Z)=>{window.dispatchEvent(new CustomEvent("craft:location:error",{detail:{message:Z.message||String(Z)}}))}),{requested:!0};return{requested:!1}},async startWatching(Z){if(G("location"))return await window.craft.location.startWatching(Z);if(typeof navigator<"u"&&navigator.geolocation){let Y=navigator.geolocation.watchPosition(($)=>{window.dispatchEvent(new CustomEvent("craft:location:update",{detail:{latitude:$.coords.latitude,longitude:$.coords.longitude,altitude:$.coords.altitude,horizontalAccuracy:$.coords.accuracy,verticalAccuracy:$.coords.altitudeAccuracy,speed:$.coords.speed}}))});return window.__craftWebLocationWatchId=Y,!0}return!1},async stopWatching(){if(G("location")){await window.craft.location.stopWatching();return}if(typeof navigator<"u"&&navigator.geolocation){let Z=window.__craftWebLocationWatchId;if(Z!=null)navigator.geolocation.clearWatch(Z),window.__craftWebLocationWatchId=null}},onUpdate(Z){return U("craft:location:update",Z)},onError(Z){return U("craft:location:error",Z)},onAuthChanged(Z){return U("craft:location:authChanged",Z)}};var q9={async captureScreen(){if(!G("screenCapture"))return null;let Z=await window.craft.screenCapture.captureScreen();return Z?String(Z):null},async captureWindow(Z){if(!G("screenCapture"))return null;if(!Number.isFinite(Z)||Z<=0)throw Error("captureWindow: id must be a positive number");let Y=await window.craft.screenCapture.captureWindow(Z);return Y?String(Y):null},async listWindows(){if(!G("screenCapture"))return[];return await window.craft.screenCapture.listWindows()}};var k4=250,H4=60000,SZ=2000,A4={sharing:!1,signals:{systemScreenShare:!1,remoteSession:!1,conferenceSharing:!1,screenRecording:!1},sources:[]};function U9(){return{...A4,signals:{...A4.signals},sources:[]}}var FZ={async getState(){if(!G("screenSharing"))return U9();return await window.craft.screenSharing.getState()},async watch(Z=SZ){let Y=Math.min(H4,Math.max(k4,Math.round(Z)));if(!G("screenSharing"))return Y;let $=await window.craft.screenSharing.watch(Y);return $&&$.intervalMs||Y},async stop(){if(!G("screenSharing"))return;await window.craft.screenSharing.unwatch()},onChange(Z){return U("craft:screenSharing:change",Z)}};async function P9(Z,Y=SZ){let $=FZ.onChange(Z);return await FZ.watch(Y),()=>{$(),FZ.stop()}}var L9={supported:!1,isFocused:null,authorization:"unsupported"};function x4(){return{ok:!1,error:"Focus control is only available in a Craft window on macOS"}}var wZ={async getStatus(){if(!G("focus"))return{...L9};return await window.craft.focus.getStatus()},async requestAuthorization(){if(!G("focus"))return"unsupported";return await window.craft.focus.requestAuthorization()},async setEnabled(Z,Y={}){if(!G("focus"))return x4();if(!(Z?Y.onShortcut:Y.offShortcut))return{ok:!1,error:`focus.setEnabled: no ${Z?"onShortcut":"offShortcut"} configured`};return await window.craft.focus.setEnabled(Z,Y)},async runShortcut(Z){if(!G("focus"))return x4();if(!Z)throw Error("focus.runShortcut: name is required");return await window.craft.focus.runShortcut(Z)},async listShortcuts(){if(!G("focus"))return[];return await window.craft.focus.listShortcuts()},async listShortcutsResult(){if(!G("focus"))return{canList:!1,shortcuts:[]};let Y=await window.craft.focus.listShortcutsResult?.();return{canList:Boolean(Y?.canList),shortcuts:Y?.shortcuts??[]}}};async function W9(...Z){if(Z.length===0)return!1;let Y=new Set(await wZ.listShortcuts());return Z.every(($)=>Y.has($))}async function D9(...Z){if(Z.length===0)return!1;let{canList:Y,shortcuts:$}=await wZ.listShortcutsResult();if(!Y)return"unknown";let J=new Set($);return Z.every((Q)=>J.has(Q))}var M9={async start(Z=0,Y="127.0.0.1"){if(!G("localServer"))return{port:0,started:!1,reason:"bridge unavailable"};return await window.craft.localServer.start(Z,Y)},async stop(){if(!G("localServer"))return;await window.craft.localServer.stop()},async respond(Z){if(!G("localServer"))return;await window.craft.localServer.respond(Z||{status:200,body:"OK"})},onRequest(Z){return U("craft:localServer:request",Z)},async awaitOAuthCallback(Z={}){M("localServer");let{port:Y=0,host:$="127.0.0.1",timeoutMs:J=300000,successHTML:Q}=Z,X=await this.start(Y,$);if(!X.started)throw Error(`localServer: start failed${X.reason?` \u2014 ${X.reason}`:""}`);return new Promise((R,z)=>{let K=setTimeout(()=>{F(),this.stop().catch(()=>{}),z(Error("localServer: OAuth callback timed out"))},J),F=this.onRequest(({url:O})=>{clearTimeout(K),F();let V=Q??`<!doctype html><meta charset="utf-8"><title>Done</title>
896
896
  <style>body{font-family:-apple-system,BlinkMacSystemFont,sans-serif;display:flex;align-items:center;justify-content:center;height:100vh;margin:0;background:#f5f5f7}</style>
897
897
  <div><h1>You can close this tab.</h1><p>Returning to the app\u2026</p></div>
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Xf as a}from"./chunk-3xspzgrq.js";import"./chunk-a68y9s2j.js";import"./chunk-0knxnyq6.js";import"./chunk-pwctc0m1.js";import"./chunk-0t1yyn1d.js";import"./chunk-frp9fc7j.js";import"./chunk-7rj4h2t2.js";import"./chunk-2119txb8.js";import"./chunk-jc6wrxrh.js";import"./chunk-2xpdcr8c.js";import"./chunk-v90kxg77.js";import"./chunk-4arms0am.js";import"./chunk-135mme4g.js";import"./chunk-dj24n5n7.js";import"./chunk-w1asc0zd.js";import"./chunk-kd95t585.js";import"./chunk-1tz8fb87.js";import"./chunk-xk402w4a.js";import"./chunk-dnard9gp.js";import"./chunk-vgx5077x.js";import"./chunk-met6wtbk.js";import"./chunk-ta6z7k4p.js";import"./chunk-zxptxz2b.js";import"./chunk-7racewc5.js";import"./chunk-e03m4har.js";import"./chunk-vsqx756d.js";import"./chunk-m8kem5ca.js";export{a as buildForProduction};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ht as a,It as b,Jt as c,Kt as d,Lt as e,Mt as f,Nt as g}from"./chunk-1nnza3m6.js";import"./chunk-emjmshj8.js";export{a as withRuntimeConfig,c as useServerRuntimeConfig,d as useRuntimeConfig,f as runtimeConfigTag,e as resolveRuntimeConfig,g as injectRuntimeConfig,b as currentRuntimeConfig};
2
+ import{It as a,Jt as b,Kt as c,Lt as d,Mt as e,Nt as f,Ot as g}from"./chunk-xk402w4a.js";import"./chunk-m8kem5ca.js";export{a as withRuntimeConfig,c as useServerRuntimeConfig,d as useRuntimeConfig,f as runtimeConfigTag,e as resolveRuntimeConfig,g as injectRuntimeConfig,b as currentRuntimeConfig};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Bf as a,Cf as b,Df as c,Ef as d,Ff as e,Gf as f,Hf as g,If as h,Jf as i,Kf as j,Lf as k,Mf as l,Nf as m,Of as n,Pf as o,Qf as p,Rf as q}from"./chunk-hy79zwyy.js";import"./chunk-emjmshj8.js";export{h as resizeAndConvert,f as processImage,d as isSharpAvailable,m as isImageFile,e as isImageBackendAvailable,l as groupVariantsByFormat,o as getTotalSize,n as getMimeType,g as getImageMetadata,k as getFallbackVariant,i as generateSrcSet,j as generateSizes,p as formatSize,q as ImageProcessingError,a as DEFAULT_WIDTHS,c as DEFAULT_QUALITY,b as DEFAULT_FORMATS};
2
+ import{Bf as a,Cf as b,Df as c,Ef as d,Ff as e,Gf as f,Hf as g,If as h,Jf as i,Kf as j,Lf as k,Mf as l,Nf as m,Of as n,Pf as o,Qf as p,Rf as q}from"./chunk-198fr2d4.js";import"./chunk-m8kem5ca.js";export{h as resizeAndConvert,f as processImage,d as isSharpAvailable,m as isImageFile,e as isImageBackendAvailable,l as groupVariantsByFormat,o as getTotalSize,n as getMimeType,g as getImageMetadata,k as getFallbackVariant,i as generateSrcSet,j as generateSizes,p as formatSize,q as ImageProcessingError,a as DEFAULT_WIDTHS,c as DEFAULT_QUALITY,b as DEFAULT_FORMATS};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ii as a,Ji as b}from"./chunk-bab01mkf.js";import"./chunk-ra1s4s6b.js";import"./chunk-qg0w5tjb.js";import"./chunk-7rj4h2t2.js";import"./chunk-qjvny3wf.js";import"./chunk-2119txb8.js";import"./chunk-jc6wrxrh.js";import"./chunk-2xpdcr8c.js";import"./chunk-v90kxg77.js";import"./chunk-4arms0am.js";import"./chunk-135mme4g.js";import"./chunk-dj24n5n7.js";import"./chunk-w1asc0zd.js";import"./chunk-kd95t585.js";import"./chunk-1tz8fb87.js";import"./chunk-xk402w4a.js";import"./chunk-dnard9gp.js";import"./chunk-vgx5077x.js";import"./chunk-met6wtbk.js";import"./chunk-ta6z7k4p.js";import"./chunk-zxptxz2b.js";import"./chunk-7racewc5.js";import"./chunk-e03m4har.js";import"./chunk-vsqx756d.js";import"./chunk-m8kem5ca.js";export{a as getStoreScript,b as clearStoreCache};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ji as a,ki as b}from"./chunk-ya5m5vbn.js";import"./chunk-emjmshj8.js";export{a as processTeleportDirectives,b as ensureTeleportTargets};
2
+ import{ji as a,ki as b}from"./chunk-ya5m5vbn.js";import"./chunk-m8kem5ca.js";export{a as processTeleportDirectives,b as ensureTeleportTargets};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
2
  var E=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),N=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);function X(Q){return Q.replace(/[^\n]/g," ")}function R(Q){let H=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,X).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,X).replace(/<!--[\s\S]*?-->/g,X).replace(/\{\{\{[\s\S]*?\}\}\}/g,X).replace(/\{\{[\s\S]*?\}\}/g,X).replace(/\{!![\s\S]*?!!\}/g,X),F=new Map,J=new Map,Y=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,z;while((z=Y.exec(H))!==null){let j=z[1]==="/",q=z[2],W=z[3]==="/";if(E.has(q.toLowerCase()))continue;if(W)continue;if(j)J.set(q,(J.get(q)??0)+1);else{let Z=F.get(q);if(Z)Z.count++;else{let B=H.slice(0,z.index).split(`
3
3
  `).length;F.set(q,{count:1,firstLine:B})}}}let M=[];for(let j of new Set([...F.keys(),...J.keys()])){if(N.has(j.toLowerCase()))continue;let q=F.get(j)?.count??0,W=J.get(j)??0;if(q!==W)M.push({tag:j,opened:q,closed:W,firstOpenLine:F.get(j)?.firstLine??0})}return M}var $=new Set;function U(Q,H){let F;try{F=R(Q)}catch{return}if(F.length===0)return;let J=`${H}:${Q.length}`;if($.has(J))return;$.add(J);let Y=H?H.split(/[/\\]/).pop()||H:"template";for(let{tag:z,opened:M,closed:j,firstOpenLine:q}of F)if(M>j){let W=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${Y}: <${z}> ${M} opened, ${j} closed \u2014 an unclosed <${z}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${Y}: <${z}> ${M} opened, ${j} closed \u2014 ${j-M} stray </${z}>.`)}
4
- export{R as wv,U as xv};
4
+ export{R as xv,U as yv};
package/dist/cli.js CHANGED
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- import{Ha as a,He as F,Je as v,Ke as P,Va as r,de as s,ee as t,nb as n,o as m,oa as l,ob as p,qb as i,wb as e}from"./chunk-cf9gt3h9.js";import"./chunk-m0eg86q3.js";import"./chunk-7hb89n3z.js";import"./chunk-0smr2xjs.js";import"./chunk-f2jypsax.js";import"./chunk-f72c62s7.js";import"./chunk-n0d7nwhd.js";import"./chunk-qrvey4wk.js";import"./chunk-nybn003d.js";import"./chunk-hy79zwyy.js";import"./chunk-7v1g7prf.js";import"./chunk-a4jhcbsh.js";import"./chunk-0knxnyq6.js";import"./chunk-634gaa9d.js";import"./chunk-6yfccnr7.js";import"./chunk-tv04k7gq.js";import"./chunk-n1y0hjk1.js";import"./chunk-bcpjhcpn.js";import"./chunk-y4zddt5r.js";import"./chunk-g7bpkpd4.js";import"./chunk-k33778kc.js";import"./chunk-yg0qm73a.js";import"./chunk-g1vxsvqv.js";import"./chunk-3y8vvkar.js";import"./chunk-fqq5k9ve.js";import"./chunk-ya5m5vbn.js";import"./chunk-y4nzmkea.js";import"./chunk-7kw3grq5.js";import"./chunk-c79nfdyj.js";import"./chunk-ej8mv2k6.js";import"./chunk-dtdwjpvf.js";import"./chunk-ra1s4s6b.js";import"./chunk-79fj9zem.js";import"./chunk-krt45cqy.js";import"./chunk-0t1yyn1d.js";import"./chunk-3kd0zn9c.js";import"./chunk-ec8jsqgm.js";import"./chunk-wz4fnsat.js";import"./chunk-frp9fc7j.js";import{bl as u,cl as c}from"./chunk-degz74nv.js";import"./chunk-t23kccpz.js";import"./chunk-qjvny3wf.js";import"./chunk-3ssjb8cx.js";import{es as f}from"./chunk-ykevda74.js";import"./chunk-ez003q74.js";import"./chunk-kyyt9xhs.js";import"./chunk-tf16jtj4.js";import"./chunk-19m7hed6.js";import{Is as A}from"./chunk-kjd9hbg4.js";import"./chunk-ejwfnttb.js";import"./chunk-5270fyk7.js";import"./chunk-q4kgqqed.js";import"./chunk-1nnza3m6.js";import"./chunk-hkrzv980.js";import"./chunk-qbz6yn8c.js";import"./chunk-czj6nq0b.js";import"./chunk-zxfejz72.js";import"./chunk-mere396d.js";import"./chunk-aa8015mk.js";import"./chunk-trva71am.js";import"./chunk-rtfwn4cm.js";import{Rw as B}from"./chunk-emjmshj8.js";import{spawn as o}from"child_process";import L from"fs";import zb from"os";import $ from"path";import w from"process";import{CLI as wb}from"@stacksjs/clapp";var N="0.2.358";var __dirname="/home/runner/work/stx/stx/packages/stx/bin",E=new wb("stx");function h(J){let Z=typeof J==="string"?Number.parseInt(J,10):J;if(Number.isNaN(Z))return{isValid:!1,error:"Port must be a valid number",suggestion:"Try using a number between 1024 and 65535"};if(Z<1024||Z>65535)return{isValid:!1,error:"Port must be between 1024 and 65535",suggestion:"Try using a port between 1024 and 65535"};return{isValid:!0}}function d(J){try{if(!L.existsSync(J)){let K=$.dirname(J),x=$.basename(J);if(L.existsSync(K)){let z=L.readdirSync(K).filter((j)=>j.toLowerCase().includes(x.toLowerCase().substring(0,3))||j.endsWith(".stx")||j.endsWith(".md")),k=z.length>0?`File not found. Similar files in ${K}: ${z.slice(0,3).join(", ")}`:`File not found. Directory ${K} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${J}`,suggestion:k}}return{isValid:!1,error:`File does not exist: ${J}`,suggestion:"Check the file path and try again"}}if(L.statSync(J).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${J}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(Z){return{isValid:!1,error:`Cannot access file: ${J}`,suggestion:"Check file permissions and path"}}}function y(J){let Z=typeof J==="string"?Number.parseInt(J,10):J;if(Number.isNaN(Z))return{isValid:!1,error:"Timeout must be a valid number",suggestion:"Specify timeout in milliseconds (e.g., 5000 for 5 seconds)"};if(Z<100)return{isValid:!1,error:"Timeout too short (minimum 100ms)",suggestion:"Use a timeout of at least 100ms"};if(Z>300000)return{isValid:!1,error:"Timeout too long (maximum 5 minutes)",suggestion:"Use a timeout of less than 300000ms (5 minutes)"};return{isValid:!0}}var V=(J)=>J.includes("*")||J.includes("?")||J.includes("{")||J.includes("["),jb=(J)=>J.endsWith(".stx")||J.endsWith(".md");function S(J,Z=1){if(console.error(`\u274C ${J.error}`),J.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${J.suggestion}`);w.exit(Z)}function kb(J){if(!J)return;let Z;try{Z=JSON.parse(J)}catch(K){console.error(`\u274C --info-plist is not valid JSON: ${K.message}`),w.exit(1)}if(typeof Z!=="object"||Z===null||Array.isArray(Z))console.error(`\u274C --info-plist must be a JSON object, e.g. '{"NSFocusStatusUsageDescription":"\u2026"}'`),w.exit(1);for(let[K,x]of Object.entries(Z))if(typeof x!=="string"&&typeof x!=="number"&&typeof x!=="boolean")console.error(`\u274C --info-plist value for "${K}" must be a string, number or boolean`),w.exit(1);return Z}async function Hb(J,Z){try{let K=["test"],x=[];if(J&&J.length>0)for(let W of J)if(V(W))try{let H=await Array.fromAsync(new Bun.Glob(W).scan({onlyFiles:!0,absolute:!0}));if(H.length===0)console.warn(`Warning: No files found matching pattern: ${W}`);else if(x.push(...H),Z.verbose)console.log(`Found ${H.length} file(s) matching pattern: ${W}`)}catch(H){return console.error(`Error expanding glob pattern ${W}:`,H),!1}else x.push(W);if(x.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(K.push(...x),Z.filter)K.push("--pattern",Z.filter);if(Z.timeout)K.push("--timeout",Z.timeout.toString());if(Z.reporter&&Z.reporter!=="default")if(Z.reporter==="junit"){let W=$.join(zb.tmpdir(),`stx-test-report-${Date.now()}.xml`);K.push("--reporter",Z.reporter),K.push("--reporter-outfile",W)}else console.warn(`Warning: Reporter '${Z.reporter}' is not supported. Using default reporter.`);if(Z.coverage)K.push("--coverage");if(Z.watch)K.push("--watch");K.push("--preload",$.join(__dirname,"../../../test-utils/happy-dom.ts"));let b={...w.env,STX_TEST_MODE:"true",STX_TEST_UI:Z.ui?"true":"false",STX_TEST_VERBOSE:Z.verbose?"true":"false"},z="bun";if(Z.verbose)console.log(`Running: ${z} ${K.join(" ")}`);let k=performance.now(),j=o(z,K,{stdio:"inherit",shell:!1,env:b});return new Promise((W)=>{j.on("close",(H)=>{let Y=((performance.now()-k)/1000).toFixed(2);if(H===0)W(!0);else W(!1)}),w.on("SIGINT",()=>{console.log(`
4
- Test run interrupted`),j.kill("SIGINT"),w.exit(1)})})}catch(K){return console.error("Error running tests:",K instanceof Error?K.message:String(K)),!1}}var Qb=w.argv.length>=3&&(jb(w.argv[2])&&L.existsSync(w.argv[2])||V(w.argv[2]));if(Qb){let J=w.argv[2],Z={port:3000,watch:!0,cache:!0,markdown:{syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}}};for(let K=3;K<w.argv.length;K++){let x=w.argv[K];if(x==="--port"&&K+1<w.argv.length){let b=h(w.argv[++K]);if(!b.isValid)S(b);Z.port=Number.parseInt(w.argv[K],10)}else if(x==="--no-watch")Z.watch=!1;else if(x==="--highlight-theme"&&K+1<w.argv.length){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.defaultTheme=w.argv[++K]}else if(x==="--no-highlight"){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.enabled=!1}else if(x==="--no-highlight-unknown"){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.highlightUnknownLanguages=!1}else if(x==="--no-cache")Z.cache=!1;else if(x==="--native")Z.native=!0}if(V(J))try{let K=await Array.fromAsync(new Bun.Glob(J).scan({onlyFiles:!0,absolute:!0})),x=J.endsWith(".stx")?K.filter((j)=>j.endsWith(".stx")):J.endsWith(".md")?K.filter((j)=>j.endsWith(".md")):K.filter((j)=>j.endsWith(".stx")||j.endsWith(".md")),b=J.split("*")[0].replace(/\/$/,"")||".",z=$.resolve(b);try{let j=new Bun.Glob("**/*.stx"),H=(await Array.fromAsync(j.scan({cwd:z,onlyFiles:!0,absolute:!0}))).filter((U)=>/\[.+\]/.test($.basename(U)));for(let U of H)if(!x.includes(U))x.push(U)}catch{}if(x.length===0)console.error(`Error: No STX or Markdown files found matching pattern: ${J}`),w.exit(1);if(!await v(x,Z))w.exit(1)}catch(K){console.error("Failed to process files:",K),w.exit(1)}else F(J,Z).catch((K)=>{console.error("Failed to start dev server:",K),w.exit(1)})}else{let J=function(x,b){let z=[];for(let k=0;k<=b.length;k++)z[k]=[k];for(let k=0;k<=x.length;k++)z[0][k]=k;for(let k=1;k<=b.length;k++)for(let j=1;j<=x.length;j++)if(b.charAt(k-1)===x.charAt(j-1))z[k][j]=z[k-1][j-1];else z[k][j]=Math.min(z[k-1][j-1]+1,z[k][j-1]+1,z[k-1][j]+1);return z[b.length][x.length]};E.command("docs","Generate documentation for components, templates, and directives").option("--output <dir>","Output directory for documentation",{default:"docs"}).option("--format <format>","Documentation format (markdown, html, json)",{default:"markdown"}).option("--components-dir <dir>","Components directory",{default:"components"}).option("--templates-dir <dir>","Templates directory",{default:"."}).option("--no-components","Disable components documentation").option("--no-templates","Disable templates documentation").option("--no-directives","Disable directives documentation").option("--extra-content <content>","Extra content to include in documentation").example("stx docs --output docs --format html").action(async(x)=>{try{if(await r(x))console.log("Documentation generated successfully."),w.exit(0);else console.error("Documentation generation failed."),w.exit(1)}catch(b){console.error("Error generating documentation:",b),w.exit(1)}}),E.command("iconify <command>","Generate Iconify icon packages").option("--output <dir>","Output directory for generated packages",{default:"packages"}).option("--icons <icons>","Comma-separated list of specific icons to generate").example("stx iconify list").example("stx iconify generate mdi").example("stx iconify generate lucide --icons home,settings,user").action(async(x,b)=>{try{let{fetchCollections:z,generatePackage:k}=await import("./chunk-7jcntsp4.js");if(x==="list"){console.log(`
3
+ import{Ha as a,He as F,Je as v,Ke as P,Va as r,de as s,ee as t,nb as n,o as m,oa as l,ob as p,qb as i,wb as e}from"./chunk-vyhrzsnf.js";import"./chunk-b381xgvw.js";import"./chunk-7hb89n3z.js";import"./chunk-7kfv1q2r.js";import"./chunk-8akj7f4h.js";import"./chunk-1hvxs7rh.js";import"./chunk-n0d7nwhd.js";import"./chunk-84577w4y.js";import"./chunk-5j3v0p6s.js";import"./chunk-198fr2d4.js";import"./chunk-3xspzgrq.js";import"./chunk-a68y9s2j.js";import"./chunk-0knxnyq6.js";import"./chunk-634gaa9d.js";import"./chunk-r6xmsxaz.js";import"./chunk-karkhcja.js";import"./chunk-ypgyhr2p.js";import"./chunk-bcpjhcpn.js";import"./chunk-y4zddt5r.js";import"./chunk-g7bpkpd4.js";import"./chunk-k33778kc.js";import"./chunk-yg0qm73a.js";import"./chunk-g1vxsvqv.js";import"./chunk-0ppgyq8q.js";import"./chunk-fqq5k9ve.js";import"./chunk-ya5m5vbn.js";import"./chunk-y4nzmkea.js";import"./chunk-7kw3grq5.js";import"./chunk-c79nfdyj.js";import"./chunk-ej8mv2k6.js";import"./chunk-bab01mkf.js";import"./chunk-ra1s4s6b.js";import"./chunk-benx1c4p.js";import"./chunk-pwctc0m1.js";import"./chunk-0t1yyn1d.js";import"./chunk-k91ej0ts.js";import"./chunk-rargfb5s.js";import"./chunk-necx4e30.js";import"./chunk-frp9fc7j.js";import{bl as u,cl as c}from"./chunk-qg0w5tjb.js";import"./chunk-7rj4h2t2.js";import"./chunk-qjvny3wf.js";import"./chunk-2119txb8.js";import{fs as f}from"./chunk-jc6wrxrh.js";import"./chunk-2xpdcr8c.js";import"./chunk-v90kxg77.js";import"./chunk-4arms0am.js";import"./chunk-135mme4g.js";import{Js as A}from"./chunk-dj24n5n7.js";import"./chunk-w1asc0zd.js";import"./chunk-kd95t585.js";import"./chunk-1tz8fb87.js";import"./chunk-xk402w4a.js";import"./chunk-dnard9gp.js";import"./chunk-vgx5077x.js";import"./chunk-met6wtbk.js";import"./chunk-ta6z7k4p.js";import"./chunk-zxptxz2b.js";import"./chunk-7racewc5.js";import"./chunk-e03m4har.js";import"./chunk-vsqx756d.js";import{Sw as B}from"./chunk-m8kem5ca.js";import{spawn as o}from"child_process";import L from"fs";import zb from"os";import $ from"path";import w from"process";import{CLI as wb}from"@stacksjs/clapp";var N="0.2.360";var __dirname="/home/runner/work/stx/stx/packages/stx/bin",E=new wb("stx");function h(J){let Z=typeof J==="string"?Number.parseInt(J,10):J;if(Number.isNaN(Z))return{isValid:!1,error:"Port must be a valid number",suggestion:"Try using a number between 1024 and 65535"};if(Z<1024||Z>65535)return{isValid:!1,error:"Port must be between 1024 and 65535",suggestion:"Try using a port between 1024 and 65535"};return{isValid:!0}}function d(J){try{if(!L.existsSync(J)){let K=$.dirname(J),x=$.basename(J);if(L.existsSync(K)){let z=L.readdirSync(K).filter((j)=>j.toLowerCase().includes(x.toLowerCase().substring(0,3))||j.endsWith(".stx")||j.endsWith(".md")),k=z.length>0?`File not found. Similar files in ${K}: ${z.slice(0,3).join(", ")}`:`File not found. Directory ${K} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${J}`,suggestion:k}}return{isValid:!1,error:`File does not exist: ${J}`,suggestion:"Check the file path and try again"}}if(L.statSync(J).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${J}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(Z){return{isValid:!1,error:`Cannot access file: ${J}`,suggestion:"Check file permissions and path"}}}function y(J){let Z=typeof J==="string"?Number.parseInt(J,10):J;if(Number.isNaN(Z))return{isValid:!1,error:"Timeout must be a valid number",suggestion:"Specify timeout in milliseconds (e.g., 5000 for 5 seconds)"};if(Z<100)return{isValid:!1,error:"Timeout too short (minimum 100ms)",suggestion:"Use a timeout of at least 100ms"};if(Z>300000)return{isValid:!1,error:"Timeout too long (maximum 5 minutes)",suggestion:"Use a timeout of less than 300000ms (5 minutes)"};return{isValid:!0}}var V=(J)=>J.includes("*")||J.includes("?")||J.includes("{")||J.includes("["),jb=(J)=>J.endsWith(".stx")||J.endsWith(".md");function S(J,Z=1){if(console.error(`\u274C ${J.error}`),J.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${J.suggestion}`);w.exit(Z)}function kb(J){if(!J)return;let Z;try{Z=JSON.parse(J)}catch(K){console.error(`\u274C --info-plist is not valid JSON: ${K.message}`),w.exit(1)}if(typeof Z!=="object"||Z===null||Array.isArray(Z))console.error(`\u274C --info-plist must be a JSON object, e.g. '{"NSFocusStatusUsageDescription":"\u2026"}'`),w.exit(1);for(let[K,x]of Object.entries(Z))if(typeof x!=="string"&&typeof x!=="number"&&typeof x!=="boolean")console.error(`\u274C --info-plist value for "${K}" must be a string, number or boolean`),w.exit(1);return Z}async function Hb(J,Z){try{let K=["test"],x=[];if(J&&J.length>0)for(let W of J)if(V(W))try{let H=await Array.fromAsync(new Bun.Glob(W).scan({onlyFiles:!0,absolute:!0}));if(H.length===0)console.warn(`Warning: No files found matching pattern: ${W}`);else if(x.push(...H),Z.verbose)console.log(`Found ${H.length} file(s) matching pattern: ${W}`)}catch(H){return console.error(`Error expanding glob pattern ${W}:`,H),!1}else x.push(W);if(x.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(K.push(...x),Z.filter)K.push("--pattern",Z.filter);if(Z.timeout)K.push("--timeout",Z.timeout.toString());if(Z.reporter&&Z.reporter!=="default")if(Z.reporter==="junit"){let W=$.join(zb.tmpdir(),`stx-test-report-${Date.now()}.xml`);K.push("--reporter",Z.reporter),K.push("--reporter-outfile",W)}else console.warn(`Warning: Reporter '${Z.reporter}' is not supported. Using default reporter.`);if(Z.coverage)K.push("--coverage");if(Z.watch)K.push("--watch");K.push("--preload",$.join(__dirname,"../../../test-utils/happy-dom.ts"));let b={...w.env,STX_TEST_MODE:"true",STX_TEST_UI:Z.ui?"true":"false",STX_TEST_VERBOSE:Z.verbose?"true":"false"},z="bun";if(Z.verbose)console.log(`Running: ${z} ${K.join(" ")}`);let k=performance.now(),j=o(z,K,{stdio:"inherit",shell:!1,env:b});return new Promise((W)=>{j.on("close",(H)=>{let Y=((performance.now()-k)/1000).toFixed(2);if(H===0)W(!0);else W(!1)}),w.on("SIGINT",()=>{console.log(`
4
+ Test run interrupted`),j.kill("SIGINT"),w.exit(1)})})}catch(K){return console.error("Error running tests:",K instanceof Error?K.message:String(K)),!1}}var Qb=w.argv.length>=3&&(jb(w.argv[2])&&L.existsSync(w.argv[2])||V(w.argv[2]));if(Qb){let J=w.argv[2],Z={port:3000,watch:!0,cache:!0,markdown:{syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}}};for(let K=3;K<w.argv.length;K++){let x=w.argv[K];if(x==="--port"&&K+1<w.argv.length){let b=h(w.argv[++K]);if(!b.isValid)S(b);Z.port=Number.parseInt(w.argv[K],10)}else if(x==="--no-watch")Z.watch=!1;else if(x==="--highlight-theme"&&K+1<w.argv.length){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.defaultTheme=w.argv[++K]}else if(x==="--no-highlight"){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.enabled=!1}else if(x==="--no-highlight-unknown"){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.highlightUnknownLanguages=!1}else if(x==="--no-cache")Z.cache=!1;else if(x==="--native")Z.native=!0}if(V(J))try{let K=await Array.fromAsync(new Bun.Glob(J).scan({onlyFiles:!0,absolute:!0})),x=J.endsWith(".stx")?K.filter((j)=>j.endsWith(".stx")):J.endsWith(".md")?K.filter((j)=>j.endsWith(".md")):K.filter((j)=>j.endsWith(".stx")||j.endsWith(".md")),b=J.split("*")[0].replace(/\/$/,"")||".",z=$.resolve(b);try{let j=new Bun.Glob("**/*.stx"),H=(await Array.fromAsync(j.scan({cwd:z,onlyFiles:!0,absolute:!0}))).filter((U)=>/\[.+\]/.test($.basename(U)));for(let U of H)if(!x.includes(U))x.push(U)}catch{}if(x.length===0)console.error(`Error: No STX or Markdown files found matching pattern: ${J}`),w.exit(1);if(!await v(x,Z))w.exit(1)}catch(K){console.error("Failed to process files:",K),w.exit(1)}else F(J,Z).catch((K)=>{console.error("Failed to start dev server:",K),w.exit(1)})}else{let J=function(x,b){let z=[];for(let k=0;k<=b.length;k++)z[k]=[k];for(let k=0;k<=x.length;k++)z[0][k]=k;for(let k=1;k<=b.length;k++)for(let j=1;j<=x.length;j++)if(b.charAt(k-1)===x.charAt(j-1))z[k][j]=z[k-1][j-1];else z[k][j]=Math.min(z[k-1][j-1]+1,z[k][j-1]+1,z[k-1][j]+1);return z[b.length][x.length]};E.command("docs","Generate documentation for components, templates, and directives").option("--output <dir>","Output directory for documentation",{default:"docs"}).option("--format <format>","Documentation format (markdown, html, json)",{default:"markdown"}).option("--components-dir <dir>","Components directory",{default:"components"}).option("--templates-dir <dir>","Templates directory",{default:"."}).option("--no-components","Disable components documentation").option("--no-templates","Disable templates documentation").option("--no-directives","Disable directives documentation").option("--extra-content <content>","Extra content to include in documentation").example("stx docs --output docs --format html").action(async(x)=>{try{if(await r(x))console.log("Documentation generated successfully."),w.exit(0);else console.error("Documentation generation failed."),w.exit(1)}catch(b){console.error("Error generating documentation:",b),w.exit(1)}}),E.command("iconify <command>","Generate Iconify icon packages").option("--output <dir>","Output directory for generated packages",{default:"packages"}).option("--icons <icons>","Comma-separated list of specific icons to generate").example("stx iconify list").example("stx iconify generate mdi").example("stx iconify generate lucide --icons home,settings,user").action(async(x,b)=>{try{let{fetchCollections:z,generatePackage:k}=await import("./chunk-p41s1y4v.js");if(x==="list"){console.log(`
5
5
  \uD83D\uDCDA Fetching available icon collections...
6
6
  `);let j=await z(),W=Object.entries(j).sort((H,U)=>U[1].total-H[1].total);console.log(`Available collections:
7
7
  `);for(let[H,U]of W){let Y=U;console.log(` ${H.padEnd(30)} ${Y.name} (${Y.total} icons)`)}console.log(`
8
8
  Total: ${W.length} collections`)}else if(x.startsWith("generate")){let j=x==="generate"?"":x.replace("generate:","").replace("generate-","").replace("generate","").trim();if(!j)console.error("Error: Please specify a collection prefix"),console.error("Usage: stx iconify generate <prefix> [--icons icon1,icon2,...]"),w.exit(1);let W=b.output||$.join(w.cwd(),"packages/collections"),H=b.icons?b.icons.split(",").map((U)=>U.trim()):void 0;await k(j,W,H),console.log(`
9
9
  \u2713 Package generated successfully!`),console.log(`
10
- To use the package:`),console.log(` 1. cd packages/collections/iconify-${j}`),console.log(" 2. bun install"),console.log(" 3. bun run build")}else console.error(`Unknown iconify command: ${x}`),console.error("Available commands: list, generate"),w.exit(1)}catch(z){console.error("Error:",z instanceof Error?z.message:String(z)),w.exit(1)}}),E.command("pwa <command>","PWA tools - audit configuration and build output").option("--output <dir>","Build output directory to audit",{default:"dist"}).example("stx pwa audit").example("stx pwa audit --output build").action(async(x,b)=>{try{if(x==="audit"){let{runPwaAudit:z,formatAuditResult:k}=await import("./chunk-sa6cgj9h.js"),{loadConfig:j}=await import("./chunk-c4rpdtvw.js");console.log(`
10
+ To use the package:`),console.log(` 1. cd packages/collections/iconify-${j}`),console.log(" 2. bun install"),console.log(" 3. bun run build")}else console.error(`Unknown iconify command: ${x}`),console.error("Available commands: list, generate"),w.exit(1)}catch(z){console.error("Error:",z instanceof Error?z.message:String(z)),w.exit(1)}}),E.command("pwa <command>","PWA tools - audit configuration and build output").option("--output <dir>","Build output directory to audit",{default:"dist"}).example("stx pwa audit").example("stx pwa audit --output build").action(async(x,b)=>{try{if(x==="audit"){let{runPwaAudit:z,formatAuditResult:k}=await import("./chunk-dwyad9gb.js"),{loadConfig:j}=await import("./chunk-nabannen.js");console.log(`
11
11
  \uD83D\uDD0D Running PWA audit...
12
12
  `);let W=await j(),H=b.output||"dist",U=z(W,H);if(console.log(k(U)),U.failed>0)w.exit(1)}else console.error(`Unknown pwa command: ${x}`),console.error("Available commands: audit"),w.exit(1)}catch(z){console.error("Error:",z instanceof Error?z.message:String(z)),w.exit(1)}}),E.command("dev [file]","Start a development server for an STX app or file").option("--port <port>","Port to use for the dev server",{default:3000}).option("--pages <dir>",'Directory containing page templates (default: pagesDir from stx.config.ts, else "pages")').option("--no-watch","Disable file watching and auto-reload").option("--native","Open in a native desktop window using Zyte").option("--titlebar-hidden","Hide the native titlebar but keep the traffic-light buttons (web content draws under a transparent full-size titlebar). Implies --native.").option("--highlight-theme <theme>","Syntax highlighting theme for Markdown code blocks",{default:"github-dark"}).option("--no-highlight","Disable syntax highlighting for Markdown code blocks").option("--no-highlight-unknown","Disable syntax highlighting for unknown languages in Markdown").option("--no-cache","Disable caching of parsed files").option("--no-hmr","Disable HMR / live-reload script injection (useful for clean network traces)").option("--profile","Print per-directive timing for every page render via performanceMonitor").option("--debug-directives","Log directive ordering and intermediate template state during rendering").example("stx dev").example("stx dev --port 8080").example("stx dev --pages src/pages").example("stx dev template.stx").example("stx dev components/hero.stx --port 8080").example("stx dev **/*.stx").example("stx dev docs/guide.md").example("stx dev template.stx --native").action(async(x,b)=>{try{if(b.port!==void 0){let k=h(b.port);if(!k.isValid)S(k);b.port=Number.parseInt(String(b.port),10)}if(b.timeout!==void 0){let k=y(b.timeout);if(!k.isValid)S(k)}let z={syntaxHighlighting:{enabled:b.highlight!==!1,serverSide:!0,defaultTheme:b.highlightTheme||"github-dark",highlightUnknownLanguages:b.highlightUnknown!==!1}};if(!x){if(!await P(".",{port:b.port,watch:b.watch!==!1,native:b.native||b.titlebarHidden||!1,titlebarHidden:b.titlebarHidden===!0,cache:b.cache!==!1,hotReload:b.hmr!==!1,profile:b.profile===!0,debugDirectives:b.debugDirectives===!0,...b.pages&&{pagesDir:b.pages}}))w.exit(1);return}if(!V(x))try{let k=await import("fs");if(k.existsSync(x)&&k.statSync(x).isDirectory()){if(!await P(x,{port:b.port,watch:b.watch!==!1,native:b.native||b.titlebarHidden||!1,titlebarHidden:b.titlebarHidden===!0,cache:b.cache!==!1,hotReload:b.hmr!==!1,profile:b.profile===!0,debugDirectives:b.debugDirectives===!0,...b.pages&&{pagesDir:b.pages}}))w.exit(1);return}}catch{}if(V(x)){console.log(`Expanding glob pattern: ${x}`);let k=await A.timeAsync("glob-expansion",async()=>{return Array.fromAsync(new Bun.Glob(x).scan({onlyFiles:!0,absolute:!0}))}),j=x.endsWith(".stx")?k.filter((Y)=>Y.endsWith(".stx")):x.endsWith(".md")?k.filter((Y)=>Y.endsWith(".md")):k.filter((Y)=>Y.endsWith(".stx")||Y.endsWith(".md"));if(j.length===0)console.error(`No STX or Markdown files found matching pattern: ${x}`),console.error("Try using patterns like '*.stx' or 'components/**/*.stx'"),w.exit(1);let W=x.split("*")[0].replace(/\/$/,"")||".",H=$.resolve(W);try{let Y=new Bun.Glob("**/*.stx"),X=(await Array.fromAsync(Y.scan({cwd:H,onlyFiles:!0,absolute:!0}))).filter((_)=>/\[.+\]/.test($.basename(_)));for(let _ of X)if(!j.includes(_))j.push(_)}catch{}if(console.log(`Found ${j.length} ${j.length===1?"file":"files"} matching ${x}`),!await v(j,{port:b.port,watch:b.watch!==!1,native:b.native||b.titlebarHidden||!1,titlebarHidden:b.titlebarHidden===!0,markdown:z,cache:b.cache!==!1}))w.exit(1)}else{if(!V(x)){let j=d(x);if(!j.isValid)S(j)}if(!await F(x,{port:b.port,watch:b.watch!==!1,native:b.native||b.titlebarHidden||!1,titlebarHidden:b.titlebarHidden===!0,markdown:z,cache:b.cache!==!1}))w.exit(1)}}catch(z){console.error("Error starting dev server:",z),w.exit(1)}}),E.command("a11y [target]","Scan .stx files for accessibility issues (directory, file, or glob)").option("--no-recursive","Disable recursive scanning of directories").option("--ignore <paths>","Comma-separated paths to ignore",{default:""}).option("--json","Output results as JSON").option("--output <file>","Write results to a file instead of stdout").option("--fix","Automatically fix common accessibility issues").example("stx a11y ./templates").example('stx a11y "resources/**/*.stx"').example("stx a11y resources/emails/welcome.stx").example("stx a11y --json --output a11y-report.json").action(async(x=".",b)=>{try{console.log(`Scanning ${x} for accessibility issues...`);let z=b.ignore?b.ignore.split(",").map((U)=>U.trim()):[],{results:k,scannedFiles:j}=await f(x,{recursive:b.recursive!==!1,ignorePaths:z});if(j.length===0)console.log(`
13
13
  No .stx files matched ${x}
@@ -69,7 +69,7 @@ Total: ${H} issues in ${W} files`),b.output){let U=`
69
69
  File not found: ${x}`),w.exit(1);if(!x.endsWith(".stx"))console.error(`
70
70
  File must have .stx extension: ${x}`),w.exit(1)}let k=$.resolve(b.pages),j=$.resolve(b.out);if(!x&&!L.existsSync(k))console.error(`
71
71
  Pages directory not found: ${k}`),console.log(`
72
- Create a 'pages' directory with .stx files, or use --pages to specify a different directory.`),w.exit(1);let{buildApp:W}=await import("./chunk-54w1tgzq.js");c();let H=await W({root:x?$.dirname(x):void 0,debug:b.verbose,ssg:{pagesDir:b.pages,outputDir:b.out,domain:b.domain,baseUrl:b.base,sitemap:b.sitemap,rss:b.rss,minify:b.minify,cache:b.cache!==!1,cleanOutput:b.clean,concurrency:Number.parseInt(b.concurrency,10)||10,publicDir:b.public,trailingSlash:b.trailingSlash,generate404:!0,hooks:b.verbose?{onPageStart:(Y)=>console.log(` Generating: ${Y}`),onPageEnd:(Y,Q)=>console.log(` Generated: ${Y} (${Q.length} bytes)`),onError:(Y,Q)=>console.error(` Error in ${Q}: ${Y.message}`)}:void 0},ssr:{outputDir:b.out==="dist"?".output":b.out,debug:b.verbose}}),U=((performance.now()-z)/1000).toFixed(2);if(H.mode==="ssr"&&H.ssr)console.log(`
72
+ Create a 'pages' directory with .stx files, or use --pages to specify a different directory.`),w.exit(1);let{buildApp:W}=await import("./chunk-bxkr3ts9.js");c();let H=await W({root:x?$.dirname(x):void 0,debug:b.verbose,ssg:{pagesDir:b.pages,outputDir:b.out,domain:b.domain,baseUrl:b.base,sitemap:b.sitemap,rss:b.rss,minify:b.minify,cache:b.cache!==!1,cleanOutput:b.clean,concurrency:Number.parseInt(b.concurrency,10)||10,publicDir:b.public,trailingSlash:b.trailingSlash,generate404:!0,hooks:b.verbose?{onPageStart:(Y)=>console.log(` Generating: ${Y}`),onPageEnd:(Y,Q)=>console.log(` Generated: ${Y} (${Q.length} bytes)`),onError:(Y,Q)=>console.error(` Error in ${Q}: ${Y.message}`)}:void 0},ssr:{outputDir:b.out==="dist"?".output":b.out,debug:b.verbose}}),U=((performance.now()-z)/1000).toFixed(2);if(H.mode==="ssr"&&H.ssr)console.log(`
73
73
  Build complete! (SSR)
74
74
  `),console.log(` Pages compiled: ${H.ssr.pageCount}`),console.log(` Output: ${H.ssr.outputDir}`),console.log(` Duration: ${U}s
75
75
  `);else if(H.ssg){if(console.log(`
@@ -84,8 +84,8 @@ Total: ${H} issues in ${W} files`),b.output){let U=`
84
84
  Build completed with ${H.ssg.failedCount} error(s). Fix the issues above and try again.
85
85
  `),w.exit(1);console.log(" To preview locally:"),console.log(` cd ${b.out||"dist"} && npx serve
86
86
  `)}}catch(z){console.error(`
87
- Build failed:`,z instanceof Error?z.message:String(z)),w.exit(1)}}),E.command("start","Start the production server (serves pre-built .output/)").option("--port <number>","Server port",{default:"3000"}).option("--output <dir>","Output directory from stx build",{default:".output"}).example("stx start").example("stx start --port 8080").action(async(x)=>{try{let b=$.resolve(x.output);if(!L.existsSync($.join(b,"manifest.json")))console.error("\n No production build found. Run `stx build --out .output` first.\n"),w.exit(1);let{startProductionServer:z}=await import("./chunk-xxrv2p42.js");await z({outputDir:b,port:Number.parseInt(x.port,10)||3000})}catch(b){console.error(`
88
- Failed to start production server:`,b instanceof Error?b.message:String(b)),w.exit(1)}}),E.command("deploy [directory]","Deploy built site to Netlify").option("--site-id <id>","Netlify site ID (or set NETLIFY_SITE_ID env var)").option("--token <token>","Auth token (or set NETLIFY_AUTH_TOKEN env var)").option("--production","Deploy to production (default: draft preview)").option("--message <msg>","Deploy message/title").option("--no-build","Skip build step before deploy").option("--open","Open deployed URL in browser").option("--dry-run","Preview deployment without uploading").option("--init","Initialize Netlify configuration for this project").example("stx deploy").example("stx deploy --production").example("stx deploy dist --site-id my-site-abc123").example("stx deploy --init").example("stx deploy --dry-run").action(async(x,b)=>{try{let{deploy:z,initNetlify:k,DeployError:j}=await import("./chunk-9qdn9y72.js");if(console.log(`\x1B[1mstx deploy\x1B[0m \x1B[2mv${N}\x1B[0m`),b.init){console.log(`
87
+ Build failed:`,z instanceof Error?z.message:String(z)),w.exit(1)}}),E.command("start","Start the production server (serves pre-built .output/)").option("--port <number>","Server port",{default:"3000"}).option("--output <dir>","Output directory from stx build",{default:".output"}).example("stx start").example("stx start --port 8080").action(async(x)=>{try{let b=$.resolve(x.output);if(!L.existsSync($.join(b,"manifest.json")))console.error("\n No production build found. Run `stx build --out .output` first.\n"),w.exit(1);let{startProductionServer:z}=await import("./chunk-d5gzma79.js");await z({outputDir:b,port:Number.parseInt(x.port,10)||3000})}catch(b){console.error(`
88
+ Failed to start production server:`,b instanceof Error?b.message:String(b)),w.exit(1)}}),E.command("deploy [directory]","Deploy built site to Netlify").option("--site-id <id>","Netlify site ID (or set NETLIFY_SITE_ID env var)").option("--token <token>","Auth token (or set NETLIFY_AUTH_TOKEN env var)").option("--production","Deploy to production (default: draft preview)").option("--message <msg>","Deploy message/title").option("--no-build","Skip build step before deploy").option("--open","Open deployed URL in browser").option("--dry-run","Preview deployment without uploading").option("--init","Initialize Netlify configuration for this project").example("stx deploy").example("stx deploy --production").example("stx deploy dist --site-id my-site-abc123").example("stx deploy --init").example("stx deploy --dry-run").action(async(x,b)=>{try{let{deploy:z,initNetlify:k,DeployError:j}=await import("./chunk-89xwdc1d.js");if(console.log(`\x1B[1mstx deploy\x1B[0m \x1B[2mv${N}\x1B[0m`),b.init){console.log(`
89
89
  \uD83D\uDCDD Initializing Netlify configuration...
90
90
  `);let H=await k({directory:x||w.cwd(),siteId:b.siteId});if(console.log(`\u2713 Created ${H.configPath}`),H.siteId)console.log("\u2713 Saved site ID to .env.local");console.log(`
91
91
  You can now deploy with: stx deploy`);return}if(b.build!==!1){if(console.log(`
@@ -97,7 +97,7 @@ You can now deploy with: stx deploy`);return}if(b.build!==!1){if(console.log(`
97
97
  `),console.log(` ${b.dryRun?"Would deploy":"Draft URL"}: ${W.url}`),W.siteUrl)console.log(` Site URL: ${W.siteUrl}`);if(!b.dryRun)console.log(`
98
98
  Deploy ID: ${W.deployId}`),console.log(` Duration: ${(W.duration/1000).toFixed(1)}s`),console.log(` Files: ${W.filesUploaded}`)}}catch(z){if(z instanceof Error&&z.name==="DeployError")console.error(`
99
99
  \u274C ${z.message}`),w.exit(1);console.error(`
100
- \u274C Deploy failed:`,z instanceof Error?z.message:String(z)),w.exit(1)}}),E.command("images <input>","Optimize images for production").option("-o, --output <dir>","Output directory",{default:"dist/images"}).option("-w, --widths <sizes>","Output widths (comma-separated)",{default:"320,640,768,1024,1280,1536,1920"}).option("-f, --formats <types>","Output formats (comma-separated)",{default:"webp,jpeg"}).option("-q, --quality <n>","Output quality (1-100)",{default:"80"}).option("--placeholder <type>","Placeholder type: blur, dominant-color, none",{default:"none"}).option("--dry-run","Preview without processing").option("--verbose","Show detailed output").example("stx images public/images").example("stx images public/images -o dist/images").example("stx images public/images --widths 640,1024,1920").example("stx images public/images --formats webp,avif").example("stx images public/images --quality 85").example("stx images public/images --dry-run").action(async(x,b)=>{try{let{optimizeDirectory:z,isSharpAvailable:k,formatSize:j}=await import("./chunk-wkyt4j9e.js"),W=await import("fs"),H=await import("path");if(console.log(`\x1B[1mstx images\x1B[0m \x1B[2mv${N}\x1B[0m`),!await k())console.error(`
100
+ \u274C Deploy failed:`,z instanceof Error?z.message:String(z)),w.exit(1)}}),E.command("images <input>","Optimize images for production").option("-o, --output <dir>","Output directory",{default:"dist/images"}).option("-w, --widths <sizes>","Output widths (comma-separated)",{default:"320,640,768,1024,1280,1536,1920"}).option("-f, --formats <types>","Output formats (comma-separated)",{default:"webp,jpeg"}).option("-q, --quality <n>","Output quality (1-100)",{default:"80"}).option("--placeholder <type>","Placeholder type: blur, dominant-color, none",{default:"none"}).option("--dry-run","Preview without processing").option("--verbose","Show detailed output").example("stx images public/images").example("stx images public/images -o dist/images").example("stx images public/images --widths 640,1024,1920").example("stx images public/images --formats webp,avif").example("stx images public/images --quality 85").example("stx images public/images --dry-run").action(async(x,b)=>{try{let{optimizeDirectory:z,isSharpAvailable:k,formatSize:j}=await import("./chunk-0dkaztpp.js"),W=await import("fs"),H=await import("path");if(console.log(`\x1B[1mstx images\x1B[0m \x1B[2mv${N}\x1B[0m`),!await k())console.error(`
101
101
  \u274C sharp is required for image optimization.`),console.log(`
102
102
  Install sharp with:`),console.log(" bun add sharp"),w.exit(1);let Y=b.widths.split(",").map((G)=>Number.parseInt(G.trim(),10)).filter((G)=>!Number.isNaN(G)),Q=b.formats.split(",").map((G)=>G.trim().toLowerCase()),X=Number.parseInt(b.quality,10)||80,_=b.placeholder,q=H.resolve(x);if(!W.existsSync(q))console.error(`
103
103
  \u274C Input directory not found: ${q}`),w.exit(1);if(!W.statSync(q).isDirectory())console.error(`
@@ -110,7 +110,7 @@ Would generate ~${bb} image variants`);return}console.log(`
110
110
  `);let M=await z(q,b.output,{widths:Y,formats:Q,quality:X,placeholder:_,verbose:b.verbose});if(console.log(`
111
111
  \u2713 Optimization complete!
112
112
  `),console.log(` Images processed: ${M.stats.optimizedImages}/${M.stats.totalImages}`),console.log(` Variants created: ${M.stats.variants}`),M.stats.savedBytes>0)console.log(` Estimated savings: ~${j(M.stats.savedBytes)}`)}catch(z){console.error(`
113
- \u274C Image optimization failed:`,z instanceof Error?z.message:String(z)),w.exit(1)}}),E.command("bundle [directory]","Analyze bundle size and composition").option("-o, --output <file>","Output file path").option("--json","Output as JSON").option("--text","Output as text summary").option("--markdown","Output as Markdown").option("--no-open","Do not open HTML report in browser").option("--no-gzip","Do not show gzip sizes").option("--threshold <size>","Fail if total size exceeds threshold (e.g., 500KB, 1MB)").option("--top <n>","Number of top modules to show",{default:"20"}).example("stx bundle").example("stx bundle dist/").example("stx bundle dist/ --json").example("stx bundle dist/ --text").example("stx bundle dist/ --threshold 500KB").example("stx bundle dist/ --no-open").action(async(x,b)=>{try{let{analyze:z,formatBytes:k,parseSize:j}=await import("./chunk-f11z7q5g.js"),W=await import("path");console.log(`\x1B[1mstx bundle\x1B[0m \x1B[2mv${N}\x1B[0m`);let H=x||"dist",U=W.resolve(H);if(!(await import("fs")).existsSync(U))console.error(`
113
+ \u274C Image optimization failed:`,z instanceof Error?z.message:String(z)),w.exit(1)}}),E.command("bundle [directory]","Analyze bundle size and composition").option("-o, --output <file>","Output file path").option("--json","Output as JSON").option("--text","Output as text summary").option("--markdown","Output as Markdown").option("--no-open","Do not open HTML report in browser").option("--no-gzip","Do not show gzip sizes").option("--threshold <size>","Fail if total size exceeds threshold (e.g., 500KB, 1MB)").option("--top <n>","Number of top modules to show",{default:"20"}).example("stx bundle").example("stx bundle dist/").example("stx bundle dist/ --json").example("stx bundle dist/ --text").example("stx bundle dist/ --threshold 500KB").example("stx bundle dist/ --no-open").action(async(x,b)=>{try{let{analyze:z,formatBytes:k,parseSize:j}=await import("./chunk-x0c5vqss.js"),W=await import("path");console.log(`\x1B[1mstx bundle\x1B[0m \x1B[2mv${N}\x1B[0m`);let H=x||"dist",U=W.resolve(H);if(!(await import("fs")).existsSync(U))console.error(`
114
114
  \u274C Directory not found: ${U}`),console.log("\nRun `stx build` first to generate build output."),w.exit(1);let Q="html";if(b.json)Q="json";else if(b.text)Q="text";else if(b.markdown)Q="markdown";console.log(`
115
115
  \uD83D\uDCE6 Analyzing: ${U}`);let X=await z({directory:U,output:b.output,format:Q,open:b.open!==!1&&Q==="html",gzip:b.gzip!==!1,threshold:b.threshold,topModules:Number.parseInt(b.top||"20",10),recommendations:!0});if(Q==="html"){if(console.log(`
116
116
  \u2713 Report generated: ${X.outputPath}`),b.open!==!1)console.log(" Opening in browser...")}else console.log(X.report);if(X.exceedsThreshold){let _=b.threshold;console.error(`
@@ -124,7 +124,7 @@ To view it in the development server:`),console.log(` stx dev ${x}
124
124
  \uD83D\uDCDD ${$.relative(w.cwd(),Q)}:`),console.log("--- Original"),console.log("+++ Formatted"),console.log(`@@ Changes in ${$.basename(Q)} @@`),console.log("+ Formatted content would be applied");else await Bun.write(Q,q),console.log(`\u2705 Formatted ${$.relative(w.cwd(),Q)}`),U++}catch(X){console.error(`\u274C Error formatting ${$.relative(w.cwd(),Q)}:`,X),Y++}if(b.check&&Y>0)console.log(`
125
125
  ${Y} files need formatting. Run 'stx format' to fix.`),w.exit(1);else if(!b.check&&!b.diff)console.log(`\u2728 Formatted ${U} files successfully`)}catch(z){console.error("Error formatting files:",z),w.exit(1)}}),E.command("perf [command...]","Show performance statistics for STX operations").option("--clear","Clear performance statistics").option("--json","Output as JSON").example("stx perf").example("stx perf --clear").example("stx perf --json").action(async(x,b)=>{try{if(b.clear){A.clear(),console.log("\u2705 Performance statistics cleared");return}let z=A.getStats();if(Object.keys(z).length===0){if(b.json){console.log(JSON.stringify({},null,2));return}console.log("No performance data available. Run some STX commands first.");return}if(b.json)console.log(JSON.stringify(z,null,2));else{console.log(`
126
126
  \uD83D\uDCCA STX Performance Statistics
127
- `);for(let[k,j]of Object.entries(z))console.log(`\uD83D\uDD27 ${k}:`),console.log(` Count: ${j.count}`),console.log(` Average: ${j.avgTime.toFixed(2)}ms`),console.log(` Total: ${j.totalTime.toFixed(2)}ms`),console.log(` Min: ${j.minTime.toFixed(2)}ms`),console.log(` Max: ${j.maxTime.toFixed(2)}ms`),console.log("")}}catch(z){console.error("Error showing performance stats:",z),w.exit(1)}}),E.command("typecheck [patterns...]","Type-check the TypeScript inside .stx script blocks").option("--no-client","Skip <script client> and bare <script> blocks").option("--no-server","Skip <script server> blocks").option("--no-templates","Skip {{ }} and directive expressions in the markup").option("--lib <path>","Extra ambient declaration file (repeatable)").example("stx typecheck").example('stx typecheck "resources/views/**/*.stx"').action(async(x,b)=>{let{formatTypecheckDiagnostics:z,typecheckStxFiles:k}=await import("./chunk-5x0zjm34.js"),{resolveStxTargets:j}=await import("./chunk-dpyc7pht.js"),W=Array.isArray(x)?x:x?[x]:[],H=W.length?W:["**/*.stx"],U=await j(H);if(U.length===0){console.log(`
127
+ `);for(let[k,j]of Object.entries(z))console.log(`\uD83D\uDD27 ${k}:`),console.log(` Count: ${j.count}`),console.log(` Average: ${j.avgTime.toFixed(2)}ms`),console.log(` Total: ${j.totalTime.toFixed(2)}ms`),console.log(` Min: ${j.minTime.toFixed(2)}ms`),console.log(` Max: ${j.maxTime.toFixed(2)}ms`),console.log("")}}catch(z){console.error("Error showing performance stats:",z),w.exit(1)}}),E.command("typecheck [patterns...]","Type-check the TypeScript inside .stx script blocks").option("--no-client","Skip <script client> and bare <script> blocks").option("--no-server","Skip <script server> blocks").option("--no-templates","Skip {{ }} and directive expressions in the markup").option("--lib <path>","Extra ambient declaration file (repeatable)").example("stx typecheck").example('stx typecheck "resources/views/**/*.stx"').action(async(x,b)=>{let{formatTypecheckDiagnostics:z,typecheckStxFiles:k}=await import("./chunk-0vvqxeq3.js"),{resolveStxTargets:j}=await import("./chunk-erbyg322.js"),W=Array.isArray(x)?x:x?[x]:[],H=W.length?W:["**/*.stx"],U=await j(H);if(U.length===0){console.log(`
128
128
  No .stx files matched ${H.join(", ")}
129
129
  `);return}let Y=m(w.argv,"--lib"),Q=Y.length>0?Y:b.lib?Array.isArray(b.lib)?b.lib:[b.lib]:[],X=await k(U,{client:b.client!==!1,server:b.server!==!1,templates:b.templates!==!1,extraLibs:Q});if(X.failure)console.error(`
130
130
  Type-check did not run.
@@ -135,8 +135,8 @@ ${Y} files need formatting. Run 'stx format' to fix.`),w.exit(1);else if(!b.chec
135
135
  `),w.exit(2);let _=X.diagnostics.filter((q)=>q.category==="error");if(X.diagnostics.length>0)console.error(`
136
136
  ${z(X.diagnostics)}
137
137
  `);if(console.log(` Checked ${X.blockCount} script block(s) and ${X.expressionCount} template expression(s) in ${X.checkedFiles.length} file(s) \u2014 `+`${_.length} error(s), ${X.diagnostics.length-_.length} warning(s)
138
- `),_.length>0)w.exit(1)}),E.command("codemod [patterns...]","Find hand-rolled code that an stx primitive already covers").option("--fix","Write the safe rewrites (default is report-only)").option("--rule <rule>","Run one rule only: confirm | tooltip (rewritable) \xB7 alert | route-params | search-params | navigate | "+"fetch | polling | debounce | click-outside | focus | clipboard | watch (report-only)").example("stx codemod").example("stx codemod --rule route-params").example('stx codemod --fix "resources/views/**/*.stx"').action(async(x,b)=>{let{codemodSource:z,formatCodemodFindings:k}=await import("./chunk-h99qxgbr.js"),j=globalThis.Bun.Glob,W=Array.isArray(x)?x:x?[x]:[],H=W.length?W:["**/*.stx","**/*.ts"],U=b.rule?[b.rule]:void 0;if(b.rule&&b.rule!=="confirm"&&b.rule!=="tooltip")console.error(`Unknown rule "${b.rule}". Expected: confirm | tooltip`),w.exit(1);let Y=new Set,Q=[],X=0,_=new Set;try{let q=Bun.spawnSync(["git","ls-files","--others","--ignored","--exclude-standard","-z"],{cwd:w.cwd(),stdout:"pipe",stderr:"pipe"});for(let O of new TextDecoder().decode(q.stdout).split("\x00"))if(O)_.add($.resolve(w.cwd(),O))}catch{}for(let q of H)for await(let O of new j(q).scan({cwd:w.cwd(),absolute:!0})){if(O.includes("/node_modules/")||O.includes("/dist/")||Y.has(O)||_.has(O))continue;Y.add(O);let M=await Bun.file(O).text(),G=z(M,{file:O,rules:U});if(Q.push(...G.findings),b.fix&&G.code!==M)await Bun.write(O,G.code),X++}if(console.error(k(Q,Boolean(b.fix))),b.fix)console.error(`
139
- ${X} file(s) written.`)}),E.command("doctor","Diagnose the stx framework-runtime resolution + staleness chain").option("--json","Output the report as JSON").example("stx doctor").example("stx doctor --json").action(async(x)=>{try{let b;try{b=(await import("./chunk-2s3wvns6.js")).generateSignalsRuntime}catch{b=void 0}let z=await s({generateRuntime:b});if(x.json)console.log(JSON.stringify(z,null,2));else console.log(t(z));if(!z.ok)w.exit(1)}catch(b){console.error("Error running doctor:",b),w.exit(1)}}),E.command("debug <file>","Debug STX template processing step by step").option("--step","Step through processing stages interactively").option("--verbose","Show detailed processing information").option("--context <data>","JSON string of context data to use").option("--save-report <file>","Save debug report to file").example("stx debug template.stx").example("stx debug template.stx --step").example(`stx debug template.stx --context '{"name": "John", "items": [1,2,3]}'`).action(async(x,b)=>{try{let z=d(x);if(!z.isValid)S(z);console.log(`\uD83D\uDD0D Debugging stx template: ${x}
138
+ `),_.length>0)w.exit(1)}),E.command("codemod [patterns...]","Find hand-rolled code that an stx primitive already covers").option("--fix","Write the safe rewrites (default is report-only)").option("--rule <rule>","Run one rule only: confirm | tooltip (rewritable) \xB7 alert | route-params | search-params | navigate | "+"fetch | polling | debounce | click-outside | focus | clipboard | watch (report-only)").example("stx codemod").example("stx codemod --rule route-params").example('stx codemod --fix "resources/views/**/*.stx"').action(async(x,b)=>{let{codemodSource:z,formatCodemodFindings:k}=await import("./chunk-xb23pzwa.js"),j=globalThis.Bun.Glob,W=Array.isArray(x)?x:x?[x]:[],H=W.length?W:["**/*.stx","**/*.ts"],U=b.rule?[b.rule]:void 0;if(b.rule&&b.rule!=="confirm"&&b.rule!=="tooltip")console.error(`Unknown rule "${b.rule}". Expected: confirm | tooltip`),w.exit(1);let Y=new Set,Q=[],X=0,_=new Set;try{let q=Bun.spawnSync(["git","ls-files","--others","--ignored","--exclude-standard","-z"],{cwd:w.cwd(),stdout:"pipe",stderr:"pipe"});for(let O of new TextDecoder().decode(q.stdout).split("\x00"))if(O)_.add($.resolve(w.cwd(),O))}catch{}for(let q of H)for await(let O of new j(q).scan({cwd:w.cwd(),absolute:!0})){if(O.includes("/node_modules/")||O.includes("/dist/")||Y.has(O)||_.has(O))continue;Y.add(O);let M=await Bun.file(O).text(),G=z(M,{file:O,rules:U});if(Q.push(...G.findings),b.fix&&G.code!==M)await Bun.write(O,G.code),X++}if(console.error(k(Q,Boolean(b.fix))),b.fix)console.error(`
139
+ ${X} file(s) written.`)}),E.command("doctor","Diagnose the stx framework-runtime resolution + staleness chain").option("--json","Output the report as JSON").example("stx doctor").example("stx doctor --json").action(async(x)=>{try{let b;try{b=(await import("./chunk-1e0jj83h.js")).generateSignalsRuntime}catch{b=void 0}let z=await s({generateRuntime:b});if(x.json)console.log(JSON.stringify(z,null,2));else console.log(t(z));if(!z.ok)w.exit(1)}catch(b){console.error("Error running doctor:",b),w.exit(1)}}),E.command("debug <file>","Debug STX template processing step by step").option("--step","Step through processing stages interactively").option("--verbose","Show detailed processing information").option("--context <data>","JSON string of context data to use").option("--save-report <file>","Save debug report to file").example("stx debug template.stx").example("stx debug template.stx --step").example(`stx debug template.stx --context '{"name": "John", "items": [1,2,3]}'`).action(async(x,b)=>{try{let z=d(x);if(!z.isValid)S(z);console.log(`\uD83D\uDD0D Debugging stx template: ${x}
140
140
  `);let k={};if(b.context)try{k=JSON.parse(b.context)}catch(H){console.error("\u274C Invalid JSON in --context option"),w.exit(1)}let j=await Bun.file(x).text();console.log(`\uD83D\uDCC4 Template Content (${j.length} chars):`),console.log("\u2500".repeat(50)),console.log(j.substring(0,500)+(j.length>500?`
141
141
  ...
142
142
  `:"")),console.log("\u2500".repeat(50));let W=j.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(W)console.log(`
@@ -159,12 +159,12 @@ Press Ctrl+C to stop watching...
159
159
  \uD83D\uDCDD ${$.relative(w.cwd(),Q.file)}`),console.log(` Lines: ${Q.metrics.lines} | Complexity: ${Q.metrics.complexity}/10 | Estimated render: ${Q.performance.estimatedRenderTime}ms`),Q.issues.length>0){let X=Q.issues.filter((_)=>j[_.type]>=W);if(X.length>0)console.log(` Issues (${X.length}):`),X.forEach((_)=>{let q=_.type==="error"?"\u274C":_.type==="warning"?"\u26A0\uFE0F":"\u2139\uFE0F";if(console.log(` ${q} ${_.message}`),_.suggestion)console.log(` \uD83D\uDCA1 ${_.suggestion}`)})}if(Q.suggestions.length>0)console.log(` Suggestions (${Q.suggestions.length}):`),Q.suggestions.forEach((X)=>{let _=X.impact==="high"?"\uD83D\uDD25":X.impact==="medium"?"\u26A1":"\uD83D\uDCAB";console.log(` ${_} ${X.message} (${X.impact} impact, ${X.effort} effort)`)})}}else if(Y.length>0&&!b.onlyIssues)console.log(`
160
160
  \uD83D\uDCC4 Files with issues:`),Y.forEach((Q)=>{let X=Q.issues.filter((_)=>j[_.type]>=W).length;if(X>0)console.log(` ${$.relative(w.cwd(),Q.file)} (${X} issues)`)});if(b.saveReport){let Q={summary:U,results:Y,generatedAt:new Date().toISOString(),commandOptions:b};await Bun.write(b.saveReport,JSON.stringify(Q,null,2)),console.log(`
161
161
  \uD83D\uDCCB Analysis report saved to: ${b.saveReport}`)}console.log(`
162
- \u2728 Analysis complete! Use --detailed for more information.`)}catch(z){console.error("Error analyzing templates:",z),w.exit(1)}}),E.command("screenshot [input]","Capture PNG screenshot(s) of page(s) via Bun WebView \u2014 a file, URL, or dist directory").option("--out <dir>","Output directory",{default:"screenshots"}).option("--width <px>","Viewport width",{default:"1440"}).option("--height <px>","Viewport height",{default:"2200"}).option("--wait <ms>","Settle time after navigation before capture",{default:"800"}).option("--timeout <ms>","Hard cap on waiting for navigation",{default:"15000"}).option("--full-page","Capture the entire scrollable page, not just the viewport").option("--wait-selector <sel>","Wait until a CSS selector exists before capturing").option("--format <fmt>","Image format: png | jpeg | webp",{default:"png"}).option("--backend <name>","WebView backend: webkit (macOS, default) | chrome").action(async(x,b)=>{let{captureScreenshots:z}=await import("./chunk-rydb5n5b.js"),k=x||"dist";try{let j=await z(k,b.out,{width:Number.parseInt(b.width,10),height:Number.parseInt(b.height,10),waitMs:Number.parseInt(b.wait,10),timeoutMs:Number.parseInt(b.timeout,10),fullPage:Boolean(b.fullPage),waitSelector:b.waitSelector,format:b.format,backend:b.backend});for(let W of j)console.log(`\uD83D\uDCF8 ${W.output} (${(W.bytes/1024).toFixed(0)} KB)`);console.log(`
163
- \u2728 Captured ${j.length} screenshot(s) to ${b.out}/ via Bun WebView`)}catch(j){console.error(`Screenshot failed: ${j.message}`),w.exit(1)}}),E.command("version","Show the version of the CLI").action(()=>{console.log(N)}),E.command("interactive","Start interactive REPL mode for template development").alias("i").option("--context <file>","Load initial context from JSON file").option("--cwd <directory>","Set working directory").option("--verbose","Show verbose output").action(async(x)=>{let{startInteractive:b}=await import("./chunk-z8gccz1q.js"),z={};if(x.context){let k=$.resolve(x.context);if(L.existsSync(k))try{let j=L.readFileSync(k,"utf-8");z=JSON.parse(j)}catch(j){console.error("Error loading context file:",j),w.exit(1)}else console.error(`Context file not found: ${k}`),w.exit(1)}await b({context:z,cwd:x.cwd?$.resolve(x.cwd):w.cwd(),verbose:x.verbose})}),E.command("build:native <input>","Build stx template into a native desktop/mobile app").option("--output <dir>","Output directory",{default:"dist/native"}).option("--target <platform>","Target platform: macos, windows, linux, ios, android").option("--format <format>","Output format: app, dmg, pkg, msi, zip, deb, rpm, appimage, ipa, apk").option("--name <name>","Application name (defaults to filename)").option("--version <version>","Application version",{default:"1.0.0"}).option("--description <desc>","Application description").option("--author <author>","Author/Maintainer name").option("--bundle-id <id>","Bundle identifier (macOS/iOS)").option("--icon <path>","Path to application icon").option("--width <width>","Window width",{default:"1200"}).option("--height <height>","Window height",{default:"800"}).option("--title <title>","Window title").option("--system-tray","Enable system tray/menubar mode").option("--menubar-only","Run without a dock icon (implied by --system-tray)").option("--category <type>","LSApplicationCategoryType (macOS)").option("--copyright <text>","NSHumanReadableCopyright (macOS)").option("--min-system-version <v>","LSMinimumSystemVersion (macOS)").option("--info-plist <json>","Extra Info.plist keys as a JSON object (macOS)").option("--dev-tools","Enable developer tools").option("--frameless","Create frameless window").option("--always-on-top","Keep window always on top").option("--craft-path <path>","Path to Craft binary").option("--verbose","Show verbose output").example("stx build:native app.stx --target macos").example("stx build:native app.stx --target macos --format dmg").example("stx build:native app.stx --target linux --format appimage").example('stx build:native app.stx --name "My App" --icon icon.png').action(async(x,b)=>{try{let{buildNative:z,getAvailableTargets:k,getAvailableFormats:j}=await import("./chunk-skdfq4hq.js"),W=$.resolve(x);if(!L.existsSync(W))console.error(`\u274C Input file not found: ${x}`),w.exit(1);let H=k();if(b.target&&!["macos","windows","linux","ios","android"].includes(b.target))console.error(`\u274C Invalid target: ${b.target}`),console.error("\uD83D\uDCA1 Available targets: macos, windows, linux, ios, android"),console.error(`\uD83D\uDCA1 Targets available on this machine: ${H.join(", ")}`),w.exit(1);let U=b.target||H[0],Y=j(U);if(b.format&&!Y.includes(b.format))console.error(`\u274C Invalid format for ${U}: ${b.format}`),console.error(`\uD83D\uDCA1 Available formats: ${Y.join(", ")}`),w.exit(1);console.log(`
162
+ \u2728 Analysis complete! Use --detailed for more information.`)}catch(z){console.error("Error analyzing templates:",z),w.exit(1)}}),E.command("screenshot [input]","Capture PNG screenshot(s) of page(s) via Bun WebView \u2014 a file, URL, or dist directory").option("--out <dir>","Output directory",{default:"screenshots"}).option("--width <px>","Viewport width",{default:"1440"}).option("--height <px>","Viewport height",{default:"2200"}).option("--wait <ms>","Settle time after navigation before capture",{default:"800"}).option("--timeout <ms>","Hard cap on waiting for navigation",{default:"15000"}).option("--full-page","Capture the entire scrollable page, not just the viewport").option("--wait-selector <sel>","Wait until a CSS selector exists before capturing").option("--format <fmt>","Image format: png | jpeg | webp",{default:"png"}).option("--backend <name>","WebView backend: webkit (macOS, default) | chrome").action(async(x,b)=>{let{captureScreenshots:z}=await import("./chunk-5fzgdrfy.js"),k=x||"dist";try{let j=await z(k,b.out,{width:Number.parseInt(b.width,10),height:Number.parseInt(b.height,10),waitMs:Number.parseInt(b.wait,10),timeoutMs:Number.parseInt(b.timeout,10),fullPage:Boolean(b.fullPage),waitSelector:b.waitSelector,format:b.format,backend:b.backend});for(let W of j)console.log(`\uD83D\uDCF8 ${W.output} (${(W.bytes/1024).toFixed(0)} KB)`);console.log(`
163
+ \u2728 Captured ${j.length} screenshot(s) to ${b.out}/ via Bun WebView`)}catch(j){console.error(`Screenshot failed: ${j.message}`),w.exit(1)}}),E.command("version","Show the version of the CLI").action(()=>{console.log(N)}),E.command("interactive","Start interactive REPL mode for template development").alias("i").option("--context <file>","Load initial context from JSON file").option("--cwd <directory>","Set working directory").option("--verbose","Show verbose output").action(async(x)=>{let{startInteractive:b}=await import("./chunk-d0350ak9.js"),z={};if(x.context){let k=$.resolve(x.context);if(L.existsSync(k))try{let j=L.readFileSync(k,"utf-8");z=JSON.parse(j)}catch(j){console.error("Error loading context file:",j),w.exit(1)}else console.error(`Context file not found: ${k}`),w.exit(1)}await b({context:z,cwd:x.cwd?$.resolve(x.cwd):w.cwd(),verbose:x.verbose})}),E.command("build:native <input>","Build stx template into a native desktop/mobile app").option("--output <dir>","Output directory",{default:"dist/native"}).option("--target <platform>","Target platform: macos, windows, linux, ios, android").option("--format <format>","Output format: app, dmg, pkg, msi, zip, deb, rpm, appimage, ipa, apk").option("--name <name>","Application name (defaults to filename)").option("--version <version>","Application version",{default:"1.0.0"}).option("--description <desc>","Application description").option("--author <author>","Author/Maintainer name").option("--bundle-id <id>","Bundle identifier (macOS/iOS)").option("--icon <path>","Path to application icon").option("--width <width>","Window width",{default:"1200"}).option("--height <height>","Window height",{default:"800"}).option("--title <title>","Window title").option("--system-tray","Enable system tray/menubar mode").option("--menubar-only","Run without a dock icon (implied by --system-tray)").option("--category <type>","LSApplicationCategoryType (macOS)").option("--copyright <text>","NSHumanReadableCopyright (macOS)").option("--min-system-version <v>","LSMinimumSystemVersion (macOS)").option("--info-plist <json>","Extra Info.plist keys as a JSON object (macOS)").option("--dev-tools","Enable developer tools").option("--frameless","Create frameless window").option("--always-on-top","Keep window always on top").option("--craft-path <path>","Path to Craft binary").option("--verbose","Show verbose output").example("stx build:native app.stx --target macos").example("stx build:native app.stx --target macos --format dmg").example("stx build:native app.stx --target linux --format appimage").example('stx build:native app.stx --name "My App" --icon icon.png').action(async(x,b)=>{try{let{buildNative:z,getAvailableTargets:k,getAvailableFormats:j}=await import("./chunk-n6eg071x.js"),W=$.resolve(x);if(!L.existsSync(W))console.error(`\u274C Input file not found: ${x}`),w.exit(1);let H=k();if(b.target&&!["macos","windows","linux","ios","android"].includes(b.target))console.error(`\u274C Invalid target: ${b.target}`),console.error("\uD83D\uDCA1 Available targets: macos, windows, linux, ios, android"),console.error(`\uD83D\uDCA1 Targets available on this machine: ${H.join(", ")}`),w.exit(1);let U=b.target||H[0],Y=j(U);if(b.format&&!Y.includes(b.format))console.error(`\u274C Invalid format for ${U}: ${b.format}`),console.error(`\uD83D\uDCA1 Available formats: ${Y.join(", ")}`),w.exit(1);console.log(`
164
164
  \uD83D\uDD28 Building native app...`),console.log(` Input: ${x}`),console.log(` Target: ${U}`),console.log(` Format: ${b.format||"default"}`),console.log(` Output: ${b.output}
165
165
  `);let Q=await z({input:W,output:$.resolve(b.output),target:U,format:b.format,name:b.name,version:b.version,description:b.description,author:b.author,bundleId:b.bundleId,icon:b.icon?$.resolve(b.icon):void 0,window:{title:b.title,width:Number.parseInt(b.width,10),height:Number.parseInt(b.height,10),frameless:b.frameless,alwaysOnTop:b.alwaysOnTop},systemTray:b.systemTray,menubarOnly:b.menubarOnly,category:b.category,copyright:b.copyright,minimumSystemVersion:b.minSystemVersion,infoPlist:kb(b.infoPlist),devTools:b.devTools,craftPath:b.craftPath,verbose:b.verbose});if(Q.success){if(console.log("\u2705 Build successful!"),console.log(` Output: ${Q.outputPath}`),Q.duration)console.log(` Duration: ${(Q.duration/1000).toFixed(2)}s`);if(U==="macos"&&Q.format==="app")console.log(`
166
166
  \uD83D\uDCA1 To run: open "${Q.outputPath}"`);else if(U==="linux"&&Q.format==="appimage")console.log(`
167
- \uD83D\uDCA1 To run: chmod +x "${Q.outputPath}" && "${Q.outputPath}"`)}else console.error(`\u274C Build failed: ${Q.error}`),w.exit(1)}catch(z){console.error(`\u274C Build error: ${z.message}`),w.exit(1)}}),E.command("story","Start component showcase and testing server").option("-p, --port <port>","Server port",{default:"6006"}).option("-o, --open","Open browser automatically",{default:!1}).option("--host <host>","Host to bind to",{default:"localhost"}).example("stx story").example("stx story --port 3000 --open").action(async(x)=>{try{let{devCommand:b}=await import("./chunk-v1qm7p7t.js");await b({port:x.port?Number.parseInt(x.port,10):6006,open:x.open,host:x.host})}catch(b){console.error(`\u274C Story error: ${b.message}`),w.exit(1)}}),E.command("story:build","Build static story site").option("-o, --outDir <dir>","Output directory",{default:".stx/dist/story"}).example("stx story:build").example("stx story:build --outDir ./docs/components").action(async(x)=>{try{let{buildCommand:b}=await import("./chunk-c17ybabd.js");await b({outDir:x.outDir})}catch(b){console.error(`\u274C Story build error: ${b.message}`),w.exit(1)}}),E.command("story:test","Run visual regression tests").option("-u, --update","Update snapshots",{default:!1}).option("-f, --filter <name>","Filter components by name").example("stx story:test").example("stx story:test --update").example("stx story:test --filter Button").action(async(x)=>{try{let{createContext:b}=await import("./chunk-ep034wt0.js"),{runVisualTests:z,updateSnapshots:k,formatTestResults:j}=await import("./chunk-awyyskad.js"),W=await b({mode:"build"});if(x.update){let H=await k(W,{filter:x.filter?[x.filter]:void 0});console.log(`Updated ${H} snapshots`)}else{let H=await z(W,{filter:x.filter?[x.filter]:void 0});if(console.log(j(H)),H.failed>0)w.exit(1)}}catch(b){console.error(`\u274C Story test error: ${b.message}`),w.exit(1)}}),E.command("compile <input>","Compile stx template to native Craft component code").option("--target <platform>","Target platform: macos, windows, linux, ios, android, universal",{default:"universal"}).option("--format <format>","Output format: zig, typescript, json",{default:"zig"}).option("--output <path>","Output directory for compiled files",{default:"./dist"}).option("--optimize","Enable optimizations",{default:!0}).option("--tree-shake","Enable tree shaking",{default:!0}).option("--hot-reload","Enable hot reload support",{default:!1}).option("--sourcemaps","Generate source maps",{default:!1}).option("--bundle","Bundle all dependencies",{default:!0}).option("--minify","Minify output",{default:!1}).option("--verbose","Show detailed output",{default:!1}).example("stx compile app.stx").example("stx compile app.stx --target macos --format zig").example("stx compile app.stx --format typescript --output ./native").example("stx compile app.stx --optimize --tree-shake --minify").action(async(x,b)=>{try{let{compileToNative:z}=await import("./chunk-j6kec9kp.js"),k=$.resolve(x);if(!L.existsSync(k))console.error(`\u274C Input file not found: ${x}`),w.exit(1);let j=["macos","windows","linux","ios","android","universal"];if(!j.includes(b.target))console.error(`\u274C Invalid target: ${b.target}`),console.error(`\uD83D\uDCA1 Available targets: ${j.join(", ")}`),w.exit(1);let W=["zig","typescript","json"];if(!W.includes(b.format))console.error(`\u274C Invalid format: ${b.format}`),console.error(`\uD83D\uDCA1 Available formats: ${W.join(", ")}`),w.exit(1);console.log(`
167
+ \uD83D\uDCA1 To run: chmod +x "${Q.outputPath}" && "${Q.outputPath}"`)}else console.error(`\u274C Build failed: ${Q.error}`),w.exit(1)}catch(z){console.error(`\u274C Build error: ${z.message}`),w.exit(1)}}),E.command("story","Start component showcase and testing server").option("-p, --port <port>","Server port",{default:"6006"}).option("-o, --open","Open browser automatically",{default:!1}).option("--host <host>","Host to bind to",{default:"localhost"}).example("stx story").example("stx story --port 3000 --open").action(async(x)=>{try{let{devCommand:b}=await import("./chunk-masf0yq5.js");await b({port:x.port?Number.parseInt(x.port,10):6006,open:x.open,host:x.host})}catch(b){console.error(`\u274C Story error: ${b.message}`),w.exit(1)}}),E.command("story:build","Build static story site").option("-o, --outDir <dir>","Output directory",{default:".stx/dist/story"}).example("stx story:build").example("stx story:build --outDir ./docs/components").action(async(x)=>{try{let{buildCommand:b}=await import("./chunk-enjfp0tp.js");await b({outDir:x.outDir})}catch(b){console.error(`\u274C Story build error: ${b.message}`),w.exit(1)}}),E.command("story:test","Run visual regression tests").option("-u, --update","Update snapshots",{default:!1}).option("-f, --filter <name>","Filter components by name").example("stx story:test").example("stx story:test --update").example("stx story:test --filter Button").action(async(x)=>{try{let{createContext:b}=await import("./chunk-mzrejx5e.js"),{runVisualTests:z,updateSnapshots:k,formatTestResults:j}=await import("./chunk-hkq7d4t2.js"),W=await b({mode:"build"});if(x.update){let H=await k(W,{filter:x.filter?[x.filter]:void 0});console.log(`Updated ${H} snapshots`)}else{let H=await z(W,{filter:x.filter?[x.filter]:void 0});if(console.log(j(H)),H.failed>0)w.exit(1)}}catch(b){console.error(`\u274C Story test error: ${b.message}`),w.exit(1)}}),E.command("compile <input>","Compile stx template to native Craft component code").option("--target <platform>","Target platform: macos, windows, linux, ios, android, universal",{default:"universal"}).option("--format <format>","Output format: zig, typescript, json",{default:"zig"}).option("--output <path>","Output directory for compiled files",{default:"./dist"}).option("--optimize","Enable optimizations",{default:!0}).option("--tree-shake","Enable tree shaking",{default:!0}).option("--hot-reload","Enable hot reload support",{default:!1}).option("--sourcemaps","Generate source maps",{default:!1}).option("--bundle","Bundle all dependencies",{default:!0}).option("--minify","Minify output",{default:!1}).option("--verbose","Show detailed output",{default:!1}).example("stx compile app.stx").example("stx compile app.stx --target macos --format zig").example("stx compile app.stx --format typescript --output ./native").example("stx compile app.stx --optimize --tree-shake --minify").action(async(x,b)=>{try{let{compileToNative:z}=await import("./chunk-g8k2zj4z.js"),k=$.resolve(x);if(!L.existsSync(k))console.error(`\u274C Input file not found: ${x}`),w.exit(1);let j=["macos","windows","linux","ios","android","universal"];if(!j.includes(b.target))console.error(`\u274C Invalid target: ${b.target}`),console.error(`\uD83D\uDCA1 Available targets: ${j.join(", ")}`),w.exit(1);let W=["zig","typescript","json"];if(!W.includes(b.format))console.error(`\u274C Invalid format: ${b.format}`),console.error(`\uD83D\uDCA1 Available formats: ${W.join(", ")}`),w.exit(1);console.log(`
168
168
  \uD83D\uDD27 Compiling stx template to native code...`),console.log(` Input: ${x}`),console.log(` Target: ${b.target}`),console.log(` Format: ${b.format}`),console.log(` Output: ${b.output}
169
169
  `);let H=L.readFileSync(k,"utf-8"),U=await z(H,{target:b.target,format:b.format,optimize:b.optimize,treeShake:b.treeShake,hotReload:b.hotReload,debug:b.verbose,sourceMaps:b.sourcemaps,bundle:b.bundle,minify:b.minify}),Y=$.resolve(b.output);if(!L.existsSync(Y))L.mkdirSync(Y,{recursive:!0});let Q=$.basename(x,$.extname(x)),X=b.format==="typescript"?"ts":b.format==="json"?"json":"zig",_=$.join(Y,`${Q}.${X}`);L.writeFileSync(_,U.code);let q=$.join(Y,`${Q}.manifest.json`);if(L.writeFileSync(q,JSON.stringify(U.manifest,null,2)),b.sourcemaps&&U.sourceMaps){let O=$.join(Y,`${Q}.${X}.map`);L.writeFileSync(O,U.sourceMaps)}if(b.target==="universal"&&U.platformCode.size>0)for(let[O,M]of U.platformCode){let G=$.join(Y,`${Q}.${O}.${X}`);L.writeFileSync(G,M)}if(console.log("\u2705 Compilation successful!"),console.log(` Output: ${_}`),console.log(` Manifest: ${q}`),console.log(`
170
170
  \uD83D\uDCCA Statistics:`),console.log(` Compilation time: ${U.stats.compilationTime.toFixed(2)}ms`),console.log(` Total components: ${U.stats.totalComponents}`),console.log(` Native components: ${U.stats.nativeComponents}`),console.log(` Web fallback components: ${U.stats.webComponents}`),console.log(` Bundle size: ${(U.stats.bundleSize/1024).toFixed(2)}KB`),U.stats.warnings.length>0){console.log(`
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Detect whether client code already owns an identifier.
3
+ *
4
+ * Direct declarations were always handled, but Vue-style prop declarations
5
+ * are normally destructured. Without this check the bridge emitted
6
+ * `var title = ...` immediately before
7
+ * `const { title } = defineProps()`, which is a parse-time error.
8
+ */
9
+ /**
10
+ * Does the client block declare `name` AT THE TOP LEVEL, so the bridge would
11
+ * clobber it?
12
+ *
13
+ * Only a depth-0 declaration counts (stacksjs/stx#1953). Emitting `var range`
14
+ * beside a top-level `const range` is a duplicate-binding SyntaxError, so that
15
+ * name is left alone. A declaration nested in a function, an `else if`, or a
16
+ * loop head merely SHADOWS the bridge's binding inside its own scope, and
17
+ * withholding the value there is what broke the page: a declared payload name
18
+ * silently never arrived and the first top-level use threw
19
+ * `ReferenceError: range is not defined`, with nothing at build time.
20
+ *
21
+ * Comments and string/template literals are stripped first, so the word
22
+ * `const` inside a message cannot claim ownership of anything.
23
+ */
24
+ export declare function declaresClientIdentifier(code: string, name: string): boolean;