@stacksjs/bun-router 0.1.0 → 0.1.1

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 (150) hide show
  1. package/dist/chunk-03m2j6h7.js +2 -0
  2. package/dist/chunk-08cw7ejr.js +3 -0
  3. package/dist/chunk-0e4g0fyv.js +62 -0
  4. package/dist/chunk-0mmn02yw.js +2 -0
  5. package/dist/chunk-126c9qm3.js +2 -0
  6. package/dist/chunk-12p13817.js +2 -0
  7. package/dist/chunk-14v65c37.js +4 -0
  8. package/dist/{chunk-s3dn1kwx.js → chunk-1b6a7t3v.js} +2 -2
  9. package/dist/chunk-1wenkmk0.js +2 -0
  10. package/dist/chunk-2152npfd.js +2 -0
  11. package/dist/chunk-26w23krx.js +2 -0
  12. package/dist/chunk-2g8m379z.js +10 -0
  13. package/dist/{chunk-5mxby3fd.js → chunk-2rr178et.js} +2 -2
  14. package/dist/chunk-2w8f3swz.js +29 -0
  15. package/dist/chunk-3y4gaz7v.js +82 -0
  16. package/dist/chunk-4r1x4afz.js +12 -0
  17. package/dist/chunk-4wyw66zk.js +2 -0
  18. package/dist/chunk-4z5sf8ag.js +2 -0
  19. package/dist/{chunk-krkchy8v.js → chunk-58tfvayh.js} +3 -3
  20. package/dist/{chunk-ex5fkjah.js → chunk-5dp83qcx.js} +43 -43
  21. package/dist/chunk-5f0d9j9a.js +2 -0
  22. package/dist/{chunk-zhx0hxdd.js → chunk-5z52b0fc.js} +7 -7
  23. package/dist/{chunk-kc659vhx.js → chunk-5zrnk2kq.js} +3 -3
  24. package/dist/chunk-6dmqtdnq.js +2 -0
  25. package/dist/{chunk-5s1pr62n.js → chunk-6e91956t.js} +2 -2
  26. package/dist/{chunk-jrf5a2ap.js → chunk-6rv8w5jk.js} +1 -1
  27. package/dist/{chunk-5n0ckcmc.js → chunk-6x1feysm.js} +2 -2
  28. package/dist/chunk-7y72hm1x.js +2 -0
  29. package/dist/{chunk-zetqzgf3.js → chunk-8hbhfh6b.js} +6 -6
  30. package/dist/{chunk-5ncn73tp.js → chunk-8kfzygg5.js} +2 -2
  31. package/dist/chunk-8wydx2we.js +2 -0
  32. package/dist/chunk-8zjnjvv7.js +2 -0
  33. package/dist/chunk-988h4bzr.js +2 -0
  34. package/dist/chunk-9b6a58ac.js +2 -0
  35. package/dist/chunk-a8fcaywb.js +2 -0
  36. package/dist/chunk-bfjwn7yg.js +2 -0
  37. package/dist/chunk-bp2522mm.js +2 -0
  38. package/dist/chunk-bswe62q4.js +48 -0
  39. package/dist/chunk-c3v796c8.js +943 -0
  40. package/dist/chunk-ccqmwdry.js +2 -0
  41. package/dist/chunk-ck0crwnx.js +2 -0
  42. package/dist/chunk-cqgkxcb4.js +2 -0
  43. package/dist/chunk-dntnakjy.js +2 -0
  44. package/dist/{chunk-67wgad4f.js → chunk-ettdpnrw.js} +2 -2
  45. package/dist/{chunk-csfrpsp7.js → chunk-ezqwq17j.js} +10 -10
  46. package/dist/chunk-ezx3qsez.js +2 -0
  47. package/dist/{chunk-73k79n7q.js → chunk-f72nnjy4.js} +360 -360
  48. package/dist/chunk-fna5n0ey.js +246 -0
  49. package/dist/chunk-fqhckdt8.js +2 -0
  50. package/dist/chunk-fr6hbx25.js +2 -0
  51. package/dist/{chunk-vr10sbbh.js → chunk-g9cwng6w.js} +1 -1
  52. package/dist/chunk-gd3za5x0.js +2 -0
  53. package/dist/chunk-gf28608k.js +2 -0
  54. package/dist/chunk-h1dj6v8q.js +3 -0
  55. package/dist/chunk-hjxe7k2g.js +2 -0
  56. package/dist/chunk-hrkgznbn.js +2 -0
  57. package/dist/chunk-j6h5v0br.js +2 -0
  58. package/dist/{chunk-0gjq8ttx.js → chunk-mgb01qdv.js} +2 -2
  59. package/dist/chunk-n24c9whp.js +2 -0
  60. package/dist/{chunk-kxp888dn.js → chunk-n2j24b0h.js} +244 -244
  61. package/dist/{chunk-vv3gb1m5.js → chunk-nhmtg01n.js} +2 -2
  62. package/dist/chunk-p0qhpnqh.js +70 -0
  63. package/dist/chunk-p0w1x8y2.js +3 -0
  64. package/dist/{chunk-9ght4n4r.js → chunk-p3dk1w2w.js} +11 -11
  65. package/dist/{chunk-6sjvhy5f.js → chunk-q4e9pxs7.js} +2 -2
  66. package/dist/chunk-q5dv1kyy.js +2 -0
  67. package/dist/chunk-qnqgf9tq.js +2 -0
  68. package/dist/chunk-qvwy1808.js +898 -0
  69. package/dist/{chunk-5s0pnsd6.js → chunk-r18f77vc.js} +4 -4
  70. package/dist/chunk-r63za1mr.js +2 -0
  71. package/dist/{chunk-6s1kbajm.js → chunk-rft8gw92.js} +1 -1
  72. package/dist/chunk-ryvmyskt.js +4211 -0
  73. package/dist/chunk-sa6mx308.js +2 -0
  74. package/dist/chunk-va0pc7hx.js +2 -0
  75. package/dist/chunk-vcp8dnjq.js +412 -0
  76. package/dist/chunk-vg1erq1q.js +2 -0
  77. package/dist/{chunk-hmgedrmr.js → chunk-w0jv49ch.js} +3 -3
  78. package/dist/{chunk-0t5vz87j.js → chunk-wm805tte.js} +19 -19
  79. package/dist/chunk-xj9h6mc9.js +2 -0
  80. package/dist/chunk-ytvzwrq3.js +51 -0
  81. package/dist/{chunk-w4r464v5.js → chunk-zde7ebc4.js} +2 -2
  82. package/dist/chunk-zmqsv2xy.js +2 -0
  83. package/dist/cli.js +57 -66
  84. package/dist/container/index.js +1 -1
  85. package/dist/index.d.ts +1 -0
  86. package/dist/index.js +29 -29
  87. package/dist/typed/client.d.ts +89 -0
  88. package/dist/typed/contract.d.ts +34 -0
  89. package/dist/typed/endpoint.d.ts +90 -0
  90. package/dist/typed/index.d.ts +14 -0
  91. package/dist/typed/router.d.ts +141 -0
  92. package/package.json +1 -1
  93. package/dist/chunk-30rkn2ym.js +0 -2
  94. package/dist/chunk-38cmrard.js +0 -2
  95. package/dist/chunk-3qna6dwd.js +0 -2
  96. package/dist/chunk-4d5fmta0.js +0 -2
  97. package/dist/chunk-4x3b4b4q.js +0 -2
  98. package/dist/chunk-6xed4va1.js +0 -2
  99. package/dist/chunk-748n6ydj.js +0 -2
  100. package/dist/chunk-7rsf8tes.js +0 -898
  101. package/dist/chunk-8aspmtf1.js +0 -2
  102. package/dist/chunk-8yfdg595.js +0 -2
  103. package/dist/chunk-90eze7av.js +0 -3
  104. package/dist/chunk-9dvwyej7.js +0 -2
  105. package/dist/chunk-a2w45krb.js +0 -2
  106. package/dist/chunk-a547f2ab.js +0 -48
  107. package/dist/chunk-bqdycvtc.js +0 -2
  108. package/dist/chunk-cd03rk3x.js +0 -2
  109. package/dist/chunk-ct0m17q5.js +0 -2
  110. package/dist/chunk-dhbvvr5h.js +0 -2
  111. package/dist/chunk-dhptcsya.js +0 -943
  112. package/dist/chunk-dq93zag9.js +0 -2
  113. package/dist/chunk-edrtesh7.js +0 -2
  114. package/dist/chunk-ejcws37w.js +0 -2
  115. package/dist/chunk-ex890p45.js +0 -51
  116. package/dist/chunk-f69cpnhw.js +0 -2
  117. package/dist/chunk-fjf53b44.js +0 -2
  118. package/dist/chunk-fjzye4qj.js +0 -2
  119. package/dist/chunk-gfd23b6t.js +0 -2
  120. package/dist/chunk-habv0vef.js +0 -12
  121. package/dist/chunk-hz6fc788.js +0 -2
  122. package/dist/chunk-jff6j9y3.js +0 -10
  123. package/dist/chunk-jmeb7n8k.js +0 -70
  124. package/dist/chunk-jy2jhcpy.js +0 -246
  125. package/dist/chunk-m249t3je.js +0 -3
  126. package/dist/chunk-m9yabnjx.js +0 -2
  127. package/dist/chunk-mekrq9wd.js +0 -2
  128. package/dist/chunk-mmxv535f.js +0 -82
  129. package/dist/chunk-mypn7jss.js +0 -2
  130. package/dist/chunk-n18x1k3c.js +0 -2
  131. package/dist/chunk-nkddjzsa.js +0 -2
  132. package/dist/chunk-pjmhqmr9.js +0 -2
  133. package/dist/chunk-qyrnsaq1.js +0 -2
  134. package/dist/chunk-r19ff2qm.js +0 -62
  135. package/dist/chunk-r338fssq.js +0 -2
  136. package/dist/chunk-s36z58x2.js +0 -29
  137. package/dist/chunk-s79dd325.js +0 -471
  138. package/dist/chunk-ta38j9em.js +0 -2
  139. package/dist/chunk-tpfgntwj.js +0 -4211
  140. package/dist/chunk-vw8rwv6e.js +0 -2
  141. package/dist/chunk-wcrqs5z9.js +0 -2
  142. package/dist/chunk-x6d1rmwa.js +0 -2
  143. package/dist/chunk-x7ft15zz.js +0 -2
  144. package/dist/chunk-x8trwn7j.js +0 -3
  145. package/dist/chunk-xhepdj1f.js +0 -2
  146. package/dist/chunk-xv2em0q4.js +0 -4
  147. package/dist/chunk-ypw6g0te.js +0 -2
  148. package/dist/chunk-z8szsm21.js +0 -2
  149. package/dist/chunk-zfbh14qe.js +0 -2
  150. /package/dist/{chunk-a3wahyg7.js → chunk-nf3kv7kv.js} +0 -0
@@ -1,898 +0,0 @@
1
- // @bun
2
- import{$ as UJ,Nd as fJ,Od as vJ,aa as ZJ,ba as XZ,ca as YZ}from"./chunk-dhptcsya.js";import{Zu as g}from"./chunk-a3wahyg7.js";import MJ from"process";import I from"process";import{existsSync as MZ}from"fs";import{dirname as EZ,join as HZ}from"path";import{existsSync as QJ,mkdirSync as wZ,readFileSync as SZ,watch as BZ,writeFileSync as fZ}from"fs";import{homedir as vZ,platform as yZ}from"os";import{dirname as bZ,join as p}from"path";import{existsSync as m,mkdirSync as lJ,readFileSync as uZ,unlinkSync as dJ,writeFileSync as nJ}from"fs";import{homedir as YJ,platform as rJ}from"os";import{join as h}from"path";var QZ=import.meta.require;function zZ(){if(typeof Notification<"u"&&Notification.permission==="granted")return!0;return!1}function PJ(){return typeof window<"u"&&typeof document<"u"}async function k0(){if(typeof Notification>"u")return!1;if(Notification.permission==="granted")return!0;if(Notification.permission==="denied")return!1;return await Notification.requestPermission()==="granted"}var v=new Map;function KZ(){return`alert-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function RZ(J){switch(J){case"info":return"&#x2139;";case"success":return"&#x2714;";case"warning":return"&#x26A0;";case"error":return"&#x2716;";default:return"&#x2139;"}}function jZ(J="top-right"){if(!PJ())throw Error("Toast container requires browser environment");try{let $=document.querySelector(`.stx-toast-container[data-position="${J}"]`);if($)return $}catch{}let Z=document.createElement("div");Z.className=`stx-toast-container ${J}`,Z.dataset.position=J;try{if(document.body)document.body.appendChild(Z)}catch{}return Z}function FZ(J){let{options:Z}=J,$=RZ(Z.type),G=Z.type||"info",X=Z.duration!==0;return`
3
- <div class="stx-toast ${G}" data-alert-id="${J.id}" role="alert" aria-live="polite">
4
- <div class="stx-toast-icon">${$}</div>
5
- <div class="stx-toast-content">
6
- ${Z.title?`<div class="stx-toast-title">${kJ(Z.title)}</div>`:""}
7
- <div class="stx-toast-message">${kJ(Z.message)}</div>
8
- </div>
9
- ${X?'<button class="stx-toast-close" aria-label="Close">&times;</button>':""}
10
- </div>
11
- `}function kJ(J){return J.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function a(J){if(J.timeout)clearTimeout(J.timeout);if(v.delete(J.id),J.element&&PJ())J.element.classList.add("dismissing"),setTimeout(()=>{J.element?.remove()},200)}async function yJ(J){let Z=KZ(),$=zZ(),G=J.duration??5000,X={id:Z,options:J};if(v.set(Z,X),$&&J.type!=="error")try{let Q=new Notification(J.title||"Notification",{body:J.message,icon:J.type==="success"?"\u2713":J.type==="warning"?"\u26A0":"\u2139",tag:Z});if(Q.onclick=()=>{if(J.onClick)J.onClick();Q.close()},G>0)X.timeout=setTimeout(()=>{Q.close(),v.delete(Z)},G);return}catch{}if(PJ())try{let Q=jZ(J.position),R=document.createElement("div");R.innerHTML=FZ(X);let z=R.firstElementChild;if(!z){let K=(J.type||"info").toUpperCase();console.log(`[stx-alert] ${K}: ${J.title||""}`),console.log(`[stx-alert] ${J.message}`);return}X.element=z;try{Q.appendChild(z)}catch{let K=(J.type||"info").toUpperCase();console.log(`[stx-alert] ${K}: ${J.title||""}`),console.log(`[stx-alert] ${J.message}`);return}if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>{try{z.classList.add("visible")}catch{}});try{z.addEventListener("click",(K)=>{if(K.target.classList?.contains("stx-toast-close")){a(X);return}if(J.onClick)J.onClick()})}catch{}if(G>0)X.timeout=setTimeout(()=>{a(X)},G)}catch{let Q=(J.type||"info").toUpperCase();console.log(`[stx-alert] ${Q}: ${J.title||""}`),console.log(`[stx-alert] ${J.message}`)}else{let Q=(J.type||"info").toUpperCase();if(console.log(`[stx-alert] ${Q}: ${J.title||""}`),console.log(`[stx-alert] ${J.message}`),G>0)X.timeout=setTimeout(()=>{v.delete(Z)},G)}}async function $J(J){return yJ({...J,position:J.position||"top-right"})}async function T0(J,Z=3000){return $J({message:J,type:"info",duration:Z})}async function M0(J,Z=3000){return $J({message:J,type:"success",duration:Z})}async function E0(J,Z=3000){return $J({message:J,type:"warning",duration:Z})}async function H0(J,Z=5000){return $J({message:J,type:"error",duration:Z})}async function x0(J,Z,$="info"){return yJ({title:J,message:Z,type:$})}function A0(J){let Z=v.get(J);if(Z)a(Z)}function C0(){for(let J of v.values())a(J)}function I0(){return v.size}var w0=`
12
- .stx-toast-container {
13
- position: fixed;
14
- z-index: 10001;
15
- display: flex;
16
- flex-direction: column;
17
- gap: 8px;
18
- max-width: 400px;
19
- pointer-events: none;
20
- }
21
-
22
- .stx-toast-container.top-left { top: 16px; left: 16px; }
23
- .stx-toast-container.top-center { top: 16px; left: 50%; transform: translateX(-50%); }
24
- .stx-toast-container.top-right { top: 16px; right: 16px; }
25
- .stx-toast-container.bottom-left { bottom: 16px; left: 16px; }
26
- .stx-toast-container.bottom-center { bottom: 16px; left: 50%; transform: translateX(-50%); }
27
- .stx-toast-container.bottom-right { bottom: 16px; right: 16px; }
28
-
29
- .stx-toast {
30
- display: flex;
31
- align-items: flex-start;
32
- gap: 12px;
33
- padding: 12px 16px;
34
- background: #fff;
35
- border-radius: 8px;
36
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
37
- pointer-events: auto;
38
- cursor: pointer;
39
- opacity: 0;
40
- transform: translateY(-10px);
41
- transition: opacity 0.2s, transform 0.2s;
42
- }
43
-
44
- .stx-toast.visible {
45
- opacity: 1;
46
- transform: translateY(0);
47
- }
48
-
49
- .stx-toast.dismissing {
50
- opacity: 0;
51
- transform: translateX(100%);
52
- }
53
-
54
- @media (prefers-color-scheme: dark) {
55
- .stx-toast {
56
- background: #2d2d2d;
57
- color: #fff;
58
- }
59
- }
60
-
61
- .stx-toast-icon {
62
- font-size: 20px;
63
- flex-shrink: 0;
64
- margin-top: 2px;
65
- }
66
-
67
- .stx-toast.info .stx-toast-icon { color: #3498db; }
68
- .stx-toast.success .stx-toast-icon { color: #27ae60; }
69
- .stx-toast.warning .stx-toast-icon { color: #f39c12; }
70
- .stx-toast.error .stx-toast-icon { color: #e74c3c; }
71
-
72
- .stx-toast-content {
73
- flex: 1;
74
- min-width: 0;
75
- }
76
-
77
- .stx-toast-title {
78
- font-weight: 600;
79
- margin-bottom: 4px;
80
- }
81
-
82
- .stx-toast-message {
83
- color: #666;
84
- font-size: 14px;
85
- line-height: 1.4;
86
- }
87
-
88
- @media (prefers-color-scheme: dark) {
89
- .stx-toast-message { color: #aaa; }
90
- }
91
-
92
- .stx-toast-close {
93
- background: none;
94
- border: none;
95
- font-size: 20px;
96
- cursor: pointer;
97
- opacity: 0.5;
98
- padding: 0;
99
- line-height: 1;
100
- color: inherit;
101
- transition: opacity 0.15s;
102
- }
103
-
104
- .stx-toast-close:hover {
105
- opacity: 1;
106
- }
107
-
108
- /* Border accent for different types */
109
- .stx-toast.info { border-left: 4px solid #3498db; }
110
- .stx-toast.success { border-left: 4px solid #27ae60; }
111
- .stx-toast.warning { border-left: 4px solid #f39c12; }
112
- .stx-toast.error { border-left: 4px solid #e74c3c; }
113
- `;function L(J="stx"){return`${J}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function _(J){return J.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function D(...J){return J.filter(Boolean).join(" ")}function W(J){if(!J)return"";return Object.entries(J).map(([Z,$])=>`${Z.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${$}`).join("; ")}function S0(J){let{text:Z,variant:$="primary",size:G="medium",disabled:X=!1,loading:Q=!1,icon:R,iconPosition:z="left",id:K=L("btn"),className:j,style:O}=J,q=D("stx-button",`stx-button--${$}`,`stx-button--${G}`,X&&"stx-button--disabled",Q&&"stx-button--loading",j),F=W(O),V=R?`<span class="stx-button-icon">${R}</span>`:"",U=Q?'<span class="stx-button-spinner"></span>':"",k=z==="left"?`${V}${U}<span class="stx-button-text">${_(Z)}</span>`:`<span class="stx-button-text">${_(Z)}</span>${V}${U}`;return`<button id="${K}" class="${q}" ${X||Q?"disabled":""} ${F?`style='${F}'`:""}>${k}</button>`}function B0(J){let{value:Z="",placeholder:$="",type:G="text",disabled:X=!1,readonly:Q=!1,maxLength:R,minLength:z,pattern:K,required:j=!1,autocomplete:O,label:q,error:F,hint:V,id:U=L("input"),className:k,style:T}=J,M=D("stx-input",F&&"stx-input--error",X&&"stx-input--disabled",k),w=W(T),n=[`type="${G}"`,`id="${U}"`,`class="${M}"`,Z&&`value="${_(Z)}"`,$&&`placeholder="${_($)}"`,X&&"disabled",Q&&"readonly",j&&"required",R&&`maxlength="${R}"`,z&&`minlength="${z}"`,K&&`pattern="${_(K)}"`,O&&`autocomplete="${O}"`,w&&`style="${w}"`].filter(Boolean).join(" "),S="";if(q)S+=`<label class="stx-input-label" for="${U}">${_(q)}</label>`;if(S+=`<input ${n} />`,F)S+=`<div class="stx-input-error">${_(F)}</div>`;else if(V)S+=`<div class="stx-input-hint">${_(V)}</div>`;return`<div class="stx-input-wrapper">${S}</div>`}function f0(J){let{checked:Z=!1,label:$,disabled:G=!1,indeterminate:X=!1,id:Q=L("checkbox"),className:R,style:z}=J,K=D("stx-checkbox",G&&"stx-checkbox--disabled",R),j=W(z),O=['type="checkbox"',`id="${Q}"`,Z&&"checked",G&&"disabled",X&&'data-indeterminate="true"'].filter(Boolean).join(" ");return`
114
- <label class="${K}" ${j?`style="${j}"`:""}>
115
- <input ${O} />
116
- <span class="stx-checkbox-box"></span>
117
- ${$?`<span class="stx-checkbox-label">${_($)}</span>`:""}
118
- </label>
119
- `}function v0(J){let{value:Z=50,min:$=0,max:G=100,step:X=1,disabled:Q=!1,label:R,showValue:z=!0,id:K=L("slider"),className:j,style:O}=J,q=D("stx-slider",Q&&"stx-slider--disabled",j),F=W(O),V=['type="range"',`id="${K}"`,`value="${Z}"`,`min="${$}"`,`max="${G}"`,`step="${X}"`,Q&&"disabled"].filter(Boolean).join(" "),U="";if(R)U+=`<label class="stx-slider-label" for="${K}">${_(R)}</label>`;if(U+=`<div class="stx-slider-track"><input ${V} /></div>`,z)U+=`<span class="stx-slider-value">${Z}</span>`;return`<div class="${q}" ${F?`style='${F}'`:""}>${U}</div>`}function y0(J){let{value:Z,max:$=100,variant:G="default",size:X="medium",showLabel:Q=!1,indeterminate:R=!1,id:z=L("progress"),className:K,style:j}=J,O=Math.min(100,Math.max(0,Z/$*100)),q=D("stx-progress",`stx-progress--${G}`,`stx-progress--${X}`,R&&"stx-progress--indeterminate",K),F=W(j);return`
120
- <div id="${z}" class="${q}" role="progressbar" aria-valuenow="${Z}" aria-valuemin="0" aria-valuemax="${$}" ${F?`style="${F}"`:""}>
121
- <div class="stx-progress-bar" style="width: ${R?"100%":`${O}%`}"></div>
122
- ${Q?`<span class="stx-progress-label">${Math.round(O)}%</span>`:""}
123
- </div>
124
- `}function b0(J){let{text:Z,variant:$="default",size:G="medium",id:X=L("badge"),className:Q,style:R}=J,z=D("stx-badge",`stx-badge--${$}`,`stx-badge--${G}`,Q),K=W(R);return`<span id="${X}" class="${z}" ${K?`style='${K}'`:""}>${_(Z)}</span>`}function g0(J){let{src:Z,alt:$="",name:G,size:X="medium",shape:Q="circle",id:R=L("avatar"),className:z,style:K}=J,j=typeof X==="number"?"":`stx-avatar--${X}`,O=typeof X==="number"?`width: ${X}px; height: ${X}px;`:"",q=D("stx-avatar",j,`stx-avatar--${Q}`,z),F=[O,W(K)].filter(Boolean).join(" "),V=G?G.split(" ").map((U)=>U[0]).join("").toUpperCase().slice(0,2):"";if(Z)return`<div id="${R}" class="${q}" ${F?`style="${F}"`:""}>
125
- <img src="${_(Z)}" alt="${_($)}" class="stx-avatar-img" />
126
- </div>`;return`<div id="${R}" class="${q}" ${F?`style="${F}"`:""}>
127
- <span class="stx-avatar-initials">${V}</span>
128
- </div>`}function u0(J){let{title:Z,subtitle:$,content:G,image:X,footer:Q,variant:R="default",id:z=L("card"),className:K,style:j}=J,O=D("stx-card",`stx-card--${R}`,K),q=W(j),F="";if(X)F+=`<div class="stx-card-image"><img src="${_(X)}" alt="" /></div>`;if(F+='<div class="stx-card-body">',Z)F+=`<h3 class="stx-card-title">${_(Z)}</h3>`;if($)F+=`<p class="stx-card-subtitle">${_($)}</p>`;if(G)F+=`<div class="stx-card-content">${_(G)}</div>`;if(F+="</div>",Q)F+=`<div class="stx-card-footer">${_(Q)}</div>`;return`<div id="${z}" class="${O}" ${q?`style='${q}'`:""}>${F}</div>`}function m0(J){let{tabs:Z,activeTab:$,variant:G="default",id:X=L("tabs"),className:Q,style:R}=J,z=D("stx-tabs",`stx-tabs--${G}`,Q),K=W(R),j=Z.map((O,q)=>{let F=$?O.value===$:q===0;return`<button class="${D("stx-tab",F&&"stx-tab--active",O.disabled&&"stx-tab--disabled")}" data-value="${_(O.value)}" ${O.disabled?"disabled":""} role="tab" aria-selected="${F}">${_(O.label)}</button>`}).join("");return`<div id="${X}" class="${z}" role="tablist" ${K?`style='${K}'`:""}>${j}</div>`}function h0(J){let{options:Z,value:$,placeholder:G="Select...",disabled:X=!1,id:Q=L("dropdown"),className:R,style:z}=J,K=D("stx-dropdown",X&&"stx-dropdown--disabled",R),j=W(z),O=Z.map((F)=>{let V=F.value===$?"selected":"",U=F.disabled?"disabled":"";return`<option value="${_(F.value)}" ${V} ${U}>${_(F.label)}</option>`}).join(""),q=$?"":`<option value="" disabled selected>${_(G)}</option>`;return`<select id="${Q}" class="${K}" ${X?"disabled":""} ${j?`style='${j}'`:""}>${q}${O}</select>`}function c0(J){let{value:Z=0,max:$=5,readonly:G=!1,size:X="medium",allowHalf:Q=!1,id:R=L("rating"),className:z,style:K}=J,j=D("stx-rating",`stx-rating--${X}`,G&&"stx-rating--readonly",z),O=W(K),q="";for(let F=1;F<=$;F++){let V=F<=Z,U=Q&&F-0.5===Z;q+=`<span class="stx-star ${V?"stx-star--filled":U?"stx-star--half":""}" data-value="${F}">\u2605</span>`}return`<div id="${R}" class="${j}" role="slider" aria-valuenow="${Z}" aria-valuemin="0" aria-valuemax="${$}" ${O?`style='${O}'`:""}>${q}</div>`}function p0(J){let{value:Z,name:$,checked:G=!1,label:X,disabled:Q=!1,id:R=L("radio"),className:z,style:K}=J,j=D("stx-radio",Q&&"stx-radio--disabled",z),O=W(K),q=['type="radio"',`id="${R}"`,`name="${_($)}"`,`value="${_(Z)}"`,G&&"checked",Q&&"disabled"].filter(Boolean).join(" ");return`
129
- <label class="${j}" ${O?`style="${O}"`:""}>
130
- <input ${q} />
131
- <span class="stx-radio-circle"></span>
132
- ${X?`<span class="stx-radio-label">${_(X)}</span>`:""}
133
- </label>
134
- `}function l0(J){let{value:Z="#3498db",disabled:$=!1,label:G,presetColors:X=["#e74c3c","#f39c12","#27ae60","#3498db","#9b59b6","#1abc9c","#34495e","#000000"],id:Q=L("color"),className:R,style:z}=J,K=D("stx-color-picker",$&&"stx-color-picker--disabled",R),j=W(z),O="";if(G)O+=`<label class="stx-color-picker-label" for="${Q}">${_(G)}</label>`;if(O+=`<div class="stx-color-picker-input">
135
- <input type="color" id="${Q}" value="${_(Z)}" ${$?"disabled":""} />
136
- <span class="stx-color-picker-value">${_(Z)}</span>
137
- </div>`,X.length>0){O+='<div class="stx-color-picker-presets">';for(let q of X)O+=`<button class="stx-color-preset" style="background: ${_(q)}" data-color="${_(q)}" ${$?"disabled":""}></button>`;O+="</div>"}return`<div class="${K}" ${j?`style='${j}'`:""}>${O}</div>`}function d0(J){let{value:Z,min:$,max:G,disabled:X=!1,label:Q,placeholder:R="Select date",showClear:z=!0,id:K=L("date"),className:j,style:O}=J,q=D("stx-date-picker",X&&"stx-date-picker--disabled",j),F=W(O),V=Z instanceof Date?Z.toISOString().split("T")[0]:Z||"",U=$ instanceof Date?$.toISOString().split("T")[0]:$,k=G instanceof Date?G.toISOString().split("T")[0]:G,T=['type="date"',`id="${K}"`,V&&`value="${V}"`,U&&`min="${U}"`,k&&`max="${k}"`,X&&"disabled",`placeholder="${_(R)}"`].filter(Boolean).join(" "),M="";if(Q)M+=`<label class="stx-date-picker-label" for="${K}">${_(Q)}</label>`;return M+=`<div class="stx-date-picker-input">
138
- <input ${T} />
139
- ${z&&V?'<button class="stx-date-picker-clear" type="button">&times;</button>':""}
140
- </div>`,`<div class="${q}" ${F?`style='${F}'`:""}>${M}</div>`}function n0(J){let{value:Z="",disabled:$=!1,label:G,step:X=60,min:Q,max:R,id:z=L("time"),className:K,style:j}=J,O=D("stx-time-picker",$&&"stx-time-picker--disabled",K),q=W(j),F=['type="time"',`id="${z}"`,Z&&`value="${_(Z)}"`,`step="${X}"`,Q&&`min="${_(Q)}"`,R&&`max="${_(R)}"`,$&&"disabled"].filter(Boolean).join(" "),V="";if(G)V+=`<label class="stx-time-picker-label" for="${z}">${_(G)}</label>`;return V+=`<input ${F} class="stx-time-picker-input" />`,`<div class="${O}" ${q?`style='${q}'`:""}>${V}</div>`}function r0(J){let{options:Z,value:$="",placeholder:G="Search...",disabled:X=!1,label:Q,loading:R=!1,id:z=L("autocomplete"),className:K,style:j}=J,O=D("stx-autocomplete",X&&"stx-autocomplete--disabled",K),q=W(j),F=Z.find((k)=>k.value===$),V=F?F.label:$,U="";if(Q)U+=`<label class="stx-autocomplete-label" for="${z}">${_(Q)}</label>`;U+=`<div class="stx-autocomplete-input-wrapper">
141
- <input type="text" id="${z}" value="${_(V)}" placeholder="${_(G)}" ${X?"disabled":""} autocomplete="off" class="stx-autocomplete-input" />
142
- ${R?'<span class="stx-autocomplete-spinner"></span>':""}
143
- </div>`,U+='<ul class="stx-autocomplete-list">';for(let k of Z)U+=`<li class="stx-autocomplete-item ${k.value===$?"stx-autocomplete-item--selected":""}" data-value="${_(k.value)}">${_(k.label)}</li>`;return U+="</ul>",`<div class="${O}" ${q?`style='${q}'`:""}>${U}</div>`}function o0(J){let{text:Z,htmlFor:$,required:G=!1,size:X="medium",id:Q=L("label"),className:R,style:z}=J,K=D("stx-label",`stx-label--${X}`,R),j=W(z);return`<label id="${Q}" class="${K}" ${$?`for='${_($)}'`:""} ${j?`style='${j}'`:""}>${_(Z)}${G?'<span class="stx-label-required">*</span>':""}</label>`}function a0(J){let{src:Z,alt:$="",width:G,height:X,objectFit:Q="cover",fallback:R,loading:z="lazy",id:K=L("image"),className:j,style:O}=J,q=D("stx-image",j),F={objectFit:Q};if(G)F.width=typeof G==="number"?`${G}px`:G;if(X)F.height=typeof X==="number"?`${X}px`:X;let V=[W(F),W(O)].filter(Boolean).join("; "),U=R?`onerror="this.src='${_(R)}'"`:"";return`<img id="${K}" class="${q}" src="${_(Z)}" alt="${_($)}" loading="${z}" ${V?`style='${V}'`:""} ${U} />`}function i0(J){let{text:Z,variant:$="default",size:G="medium",removable:X=!1,icon:Q,id:R=L("chip"),className:z,style:K}=J,j=D("stx-chip",`stx-chip--${$}`,`stx-chip--${G}`,z),O=W(K),q="";if(Q)q+=`<span class="stx-chip-icon">${Q}</span>`;if(q+=`<span class="stx-chip-text">${_(Z)}</span>`,X)q+='<button class="stx-chip-remove" type="button">&times;</button>';return`<span id="${R}" class="${j}" ${O?`style='${O}'`:""}>${q}</span>`}function s0(J){let{text:Z,position:$="top",delay:G=200,children:X,id:Q=L("tooltip"),className:R,style:z}=J,K=D("stx-tooltip-wrapper",R),j=W(z);return`<div id="${Q}" class="${K}" ${j?`style="${j}"`:""} data-tooltip="${_(Z)}" data-position="${$}" data-delay="${G}">
144
- ${X}
145
- <span class="stx-tooltip stx-tooltip--${$}">${_(Z)}</span>
146
- </div>`}function t0(J){let{direction:Z="vertical",showScrollbar:$=!0,smooth:G=!0,height:X,width:Q,children:R,id:z=L("scroll"),className:K,style:j}=J,O=D("stx-scroll-view",`stx-scroll-view--${Z}`,!$&&"stx-scroll-view--hide-scrollbar",G&&"stx-scroll-view--smooth",K),q={};if(X)q.height=typeof X==="number"?`${X}px`:X;if(Q)q.width=typeof Q==="number"?`${Q}px`:Q;let F=[W(q),W(j)].filter(Boolean).join("; ");return`<div id="${z}" class="${O}" ${F?`style='${F}'`:""}>${R}</div>`}function e0(J){let{direction:Z="horizontal",sizes:$=[50,50],resizable:G=!0,children:X,id:Q=L("split"),className:R,style:z}=J,K=D("stx-split-view",`stx-split-view--${Z}`,G&&"stx-split-view--resizable",R),j=W(z),O=Z==="horizontal"?"width":"height";return`<div id="${Q}" class="${K}" ${j?`style="${j}"`:""}>
147
- <div class="stx-split-pane" style="${O}: ${$[0]}%">${X[0]}</div>
148
- ${G?'<div class="stx-split-divider"></div>':""}
149
- <div class="stx-split-pane" style="${O}: ${$[1]}%">${X[1]}</div>
150
- </div>`}function J8(J){let{items:Z,multiple:$=!1,defaultOpen:G=[],id:X=L("accordion"),className:Q,style:R}=J,z=D("stx-accordion",Q),K=W(R),j="";return Z.forEach((O,q)=>{let F=G.includes(q),V=D("stx-accordion-item",F&&"stx-accordion-item--open",O.disabled&&"stx-accordion-item--disabled");j+=`<div class="${V}" data-index="${q}">
151
- <button class="stx-accordion-header" ${O.disabled?"disabled":""} aria-expanded="${F}" data-multiple="${$}">
152
- <span class="stx-accordion-title">${_(O.title)}</span>
153
- <span class="stx-accordion-icon">\u25BC</span>
154
- </button>
155
- <div class="stx-accordion-content" ${F?"":"hidden"}>
156
- ${_(O.content)}
157
- </div>
158
- </div>`}),`<div id="${X}" class="${z}" ${K?`style='${K}'`:""}>${j}</div>`}function Z8(J){let{steps:Z,currentStep:$,orientation:G="horizontal",id:X=L("stepper"),className:Q,style:R}=J,z=D("stx-stepper",`stx-stepper--${G}`,Q),K=W(R),j="";return Z.forEach((O,q)=>{let F=D("stx-step",q<$&&"stx-step--completed",q===$&&"stx-step--active");if(j+=`<div class="${F}" data-step="${q}">
159
- <div class="stx-step-indicator">
160
- ${q<$?"\u2713":q+1}
161
- </div>
162
- <div class="stx-step-content">
163
- <div class="stx-step-label">${_(O.label)}</div>
164
- ${O.description?`<div class="stx-step-description">${_(O.description)}</div>`:""}
165
- </div>
166
- </div>`,q<Z.length-1)j+='<div class="stx-step-connector"></div>'}),`<div id="${X}" class="${z}" ${K?`style='${K}'`:""}>${j}</div>`}function $8(J){let{open:Z=!1,title:$,size:G="medium",closable:X=!0,children:Q,footer:R,id:z=L("modal"),className:K,style:j}=J,O=D("stx-modal-component",`stx-modal-component--${G}`,K),q=W(j);if(!Z)return`<div id="${z}" class="${O} stx-modal-component--hidden" ${q?`style='${q}'`:""}></div>`;let F='<div class="stx-modal-component-overlay">';if(F+='<div class="stx-modal-component-dialog">',$||X){if(F+='<div class="stx-modal-component-header">',$)F+=`<h3 class="stx-modal-component-title">${_($)}</h3>`;if(X)F+='<button class="stx-modal-component-close">&times;</button>';F+="</div>"}if(F+=`<div class="stx-modal-component-body">${Q}</div>`,R)F+=`<div class="stx-modal-component-footer">${R}</div>`;return F+="</div></div>",`<div id="${z}" class="${O}" ${q?`style='${q}'`:""}>${F}</div>`}function G8(J){let{items:Z,selectable:$=!1,multiSelect:G=!1,emptyMessage:X="No items",id:Q=L("list"),className:R,style:z}=J,K=D("stx-list-view",$&&"stx-list-view--selectable",G&&"stx-list-view--multi",R),j=W(z);if(Z.length===0)return`<div id="${Q}" class="${K}" ${j?`style="${j}"`:""}>
167
- <div class="stx-list-view-empty">${_(X)}</div>
168
- </div>`;let O='<ul class="stx-list-view-items">';for(let q of Z){let F=D("stx-list-view-item",q.selected&&"stx-list-view-item--selected");O+=`<li class="${F}" data-id="${_(q.id)}" ${$?'tabindex="0"':""}>${q.content}</li>`}return O+="</ul>",`<div id="${Q}" class="${K}" ${j?`style='${j}'`:""}>${O}</div>`}function X8(J){let{columns:Z,data:$,striped:G=!1,bordered:X=!1,hoverable:Q=!0,sortBy:R,sortOrder:z,id:K=L("table"),className:j,style:O}=J,q=D("stx-table",G&&"stx-table--striped",X&&"stx-table--bordered",Q&&"stx-table--hoverable",j),F=W(O),V="<table>";V+="<thead><tr>";for(let U of Z){let T=U.key===R?`stx-table-sorted stx-table-sorted--${z}`:"",M=U.sortable?'data-sortable="true"':"",w=U.width?`style="width: ${U.width}"`:"";V+=`<th class="${T}" ${M} ${w} data-key="${_(U.key)}">${_(U.label)}${U.sortable?'<span class="stx-table-sort-icon"></span>':""}</th>`}V+="</tr></thead>",V+="<tbody>";for(let U of $){V+="<tr>";for(let k of Z){let T=U[k.key];V+=`<td>${T!=null?_(String(T)):""}</td>`}V+="</tr>"}return V+="</tbody></table>",`<div id="${K}" class="${q}" ${F?`style='${F}'`:""}>${V}</div>`}function bJ(J,Z,$,G){let X=Z.includes(J.key),Q=$.includes(J.key),R=J.children&&J.children.length>0,K=`<div class="${D("stx-tree-node",Q&&"stx-tree-node--selected",J.disabled&&"stx-tree-node--disabled")}" data-key="${_(J.key)}">`;if(K+='<div class="stx-tree-node-content">',R)K+=`<span class="stx-tree-toggle ${X?"stx-tree-toggle--expanded":""}">\u25B6</span>`;else K+='<span class="stx-tree-toggle-placeholder"></span>';if(G)K+=`<input type="checkbox" class="stx-tree-checkbox" ${Q?"checked":""} ${J.disabled?"disabled":""} />`;if(J.icon)K+=`<span class="stx-tree-icon">${J.icon}</span>`;if(K+=`<span class="stx-tree-label">${_(J.label)}</span>`,K+="</div>",R&&X){K+='<div class="stx-tree-children">';for(let j of J.children)K+=bJ(j,Z,$,G);K+="</div>"}return K+="</div>",K}function Y8(J){let{nodes:Z,expandedKeys:$=[],selectedKeys:G=[],checkable:X=!1,id:Q=L("tree"),className:R,style:z}=J,K=D("stx-tree-view",X&&"stx-tree-view--checkable",R),j=W(z),O="";for(let q of Z)O+=bJ(q,$,G,X);return`<div id="${Q}" class="${K}" role="tree" ${j?`style='${j}'`:""}>${O}</div>`}function Q8(J){let{columns:Z,data:$,pagination:G,selectable:X=!1,id:Q=L("datagrid"),className:R,style:z}=J,K=D("stx-data-grid",X&&"stx-data-grid--selectable",R),j=W(z),O='<div class="stx-data-grid-table-wrapper">';if(O+='<table class="stx-data-grid-table">',O+="<thead><tr>",X)O+='<th class="stx-data-grid-select-all"><input type="checkbox" /></th>';for(let q of Z){let F=q.width?`style="width: ${q.width}"`:"";O+=`<th ${F}>
169
- <div class="stx-data-grid-header-cell">
170
- <span>${_(q.label)}</span>
171
- ${q.sortable?'<button class="stx-data-grid-sort">\u21C5</button>':""}
172
- ${q.filterable?'<button class="stx-data-grid-filter">\u22BB</button>':""}
173
- </div>
174
- </th>`}O+="</tr></thead>",O+="<tbody>";for(let q of $){if(O+="<tr>",X)O+='<td class="stx-data-grid-select"><input type="checkbox" /></td>';for(let F of Z){let V=q[F.key];O+=`<td>${V!=null?_(String(V)):""}</td>`}O+="</tr>"}if(O+="</tbody></table></div>",G){let q=Math.ceil(G.total/G.pageSize);O+=`<div class="stx-data-grid-pagination">
175
- <span class="stx-data-grid-page-info">Page ${G.page} of ${q} (${G.total} items)</span>
176
- <div class="stx-data-grid-page-buttons">
177
- <button class="stx-data-grid-page-btn" ${G.page<=1?"disabled":""}>\u25C0</button>
178
- <button class="stx-data-grid-page-btn" ${G.page>=q?"disabled":""}>\u25B6</button>
179
- </div>
180
- </div>`}return`<div id="${Q}" class="${K}" ${j?`style='${j}'`:""}>${O}</div>`}function z8(J){let{type:Z,data:$,options:G={},width:X="100%",height:Q=300,id:R=L("chart"),className:z,style:K}=J,j=D("stx-chart",`stx-chart--${Z}`,z),O={width:typeof X==="number"?`${X}px`:X,height:typeof Q==="number"?`${Q}px`:Q},q=[W(O),W(K)].filter(Boolean).join("; "),F=JSON.stringify({type:Z,data:$,options:G});return`<div id="${R}" class="${j}" style="${q}" data-chart='${_(F)}'>
181
- <div class="stx-chart-placeholder">
182
- ${G.title?`<div class="stx-chart-title">${_(G.title)}</div>`:""}
183
- <div class="stx-chart-type">${Z.charAt(0).toUpperCase()+Z.slice(1)} Chart</div>
184
- <div class="stx-chart-info">${$.datasets.length} dataset(s), ${$.labels.length} labels</div>
185
- </div>
186
- </div>`}function K8(J){let{value:Z="",language:$="plaintext",theme:G="dark",lineNumbers:X=!0,readOnly:Q=!1,height:R=300,tabSize:z=2,wordWrap:K=!1,id:j=L("code"),className:O,style:q}=J,F=D("stx-code-editor",`stx-code-editor--${G}`,X&&"stx-code-editor--line-numbers",Q&&"stx-code-editor--readonly",K&&"stx-code-editor--wrap",O),V={height:typeof R==="number"?`${R}px`:R},U=[W(V),W(q)].filter(Boolean).join("; "),k=Z.split(`
187
- `),T="";if(X){T+='<div class="stx-code-editor-gutter">';for(let M=1;M<=k.length;M++)T+=`<div class="stx-code-editor-line-number">${M}</div>`;T+="</div>"}return T+=`<pre class="stx-code-editor-content"><code class="language-${_($)}">${_(Z)}</code></pre>`,`<div id="${j}" class="${F}" style="${U}" data-language="${_($)}" data-tab-size="${z}">${T}</div>`}function R8(J){let{src:Z,type:$="video",poster:G,autoplay:X=!1,loop:Q=!1,muted:R=!1,controls:z=!0,width:K,height:j,id:O=L("media"),className:q,style:F}=J,V=D("stx-media-player",`stx-media-player--${$}`,q),U={};if(K)U.width=typeof K==="number"?`${K}px`:K;if(j)U.height=typeof j==="number"?`${j}px`:j;let k=[W(U),W(F)].filter(Boolean).join("; "),T=[`id="${O}-media"`,`src="${_(Z)}"`,z&&"controls",X&&"autoplay",Q&&"loop",R&&"muted",$==="video"&&G&&`poster="${_(G)}"`].filter(Boolean).join(" "),M=$==="video"?`<video ${T}>Your browser does not support the video tag.</video>`:`<audio ${T}>Your browser does not support the audio tag.</audio>`;return`<div id="${O}" class="${V}" ${k?`style='${k}'`:""}>${M}</div>`}function OZ(J){if(J===void 0)return"";let Z=["B","KB","MB","GB"],$=J,G=0;while($>=1024&&G<Z.length-1)$/=1024,G++;return`${$.toFixed(1)} ${Z[G]}`}function j8(J){let{files:Z,viewMode:$="list",showHidden:G=!1,selectable:X=!0,id:Q=L("files"),className:R,style:z}=J,K=D("stx-file-explorer",`stx-file-explorer--${$}`,R),j=W(z),O=G?Z:Z.filter((F)=>!F.name.startsWith(".")),q="";if($==="list"){q='<table class="stx-file-explorer-list"><thead><tr><th>Name</th><th>Size</th><th>Modified</th></tr></thead><tbody>';for(let F of O){let V=F.icon||(F.type==="folder"?"\uD83D\uDCC1":"\uD83D\uDCC4"),U=F.type==="file"?OZ(F.size):"",k=F.modified?F.modified.toLocaleDateString():"";q+=`<tr class="stx-file-explorer-item ${X?"stx-file-explorer-item--selectable":""}" data-path="${_(F.path)}" data-type="${F.type}">
188
- <td><span class="stx-file-explorer-icon">${V}</span>${_(F.name)}</td>
189
- <td>${U}</td>
190
- <td>${k}</td>
191
- </tr>`}q+="</tbody></table>"}else{q='<div class="stx-file-explorer-grid">';for(let F of O){let V=F.icon||(F.type==="folder"?"\uD83D\uDCC1":"\uD83D\uDCC4");q+=`<div class="stx-file-explorer-item ${X?"stx-file-explorer-item--selectable":""}" data-path="${_(F.path)}" data-type="${F.type}">
192
- <div class="stx-file-explorer-icon">${V}</div>
193
- <div class="stx-file-explorer-name">${_(F.name)}</div>
194
- </div>`}q+="</div>"}return`<div id="${Q}" class="${K}" ${j?`style='${j}'`:""}>${q}</div>`}function F8(J){let{url:Z,width:$="100%",height:G=400,sandbox:X=!0,allowScripts:Q=!0,id:R=L("webview"),className:z,style:K}=J,j=D("stx-webview",z),O={width:typeof $==="number"?`${$}px`:$,height:typeof G==="number"?`${G}px`:G},q=[W(O),W(K)].filter(Boolean).join("; "),F=[];if(X){if(F.push("allow-same-origin"),Q)F.push("allow-scripts")}let V=X?`sandbox="${F.join(" ")}"`:"";return`<iframe id="${R}" class="${j}" src="${_(Z)}" style="${q}" ${V} loading="lazy" frameborder="0"></iframe>`}var O8=["Button","TextInput","Checkbox","RadioButton","Slider","ColorPicker","DatePicker","TimePicker","Autocomplete","Label","ImageView","ProgressBar","Avatar","Badge","Chip","Card","Tooltip","Toast","ScrollView","SplitView","Accordion","Stepper","Modal","Tabs","Dropdown","ListView","Table","TreeView","DataGrid","Chart","Rating","CodeEditor","MediaPlayer","FileExplorer","WebView"],q8=`
195
- /* Button */
196
- .stx-button {
197
- display: inline-flex;
198
- align-items: center;
199
- justify-content: center;
200
- gap: 8px;
201
- padding: 8px 16px;
202
- border: none;
203
- border-radius: 6px;
204
- font-size: 14px;
205
- font-weight: 500;
206
- cursor: pointer;
207
- transition: all 0.15s;
208
- }
209
- .stx-button--primary { background: #3498db; color: #fff; }
210
- .stx-button--primary:hover { background: #2980b9; }
211
- .stx-button--secondary { background: #6c757d; color: #fff; }
212
- .stx-button--outline { background: transparent; border: 1px solid #3498db; color: #3498db; }
213
- .stx-button--ghost { background: transparent; color: #3498db; }
214
- .stx-button--destructive { background: #e74c3c; color: #fff; }
215
- .stx-button--small { padding: 4px 8px; font-size: 12px; }
216
- .stx-button--large { padding: 12px 24px; font-size: 16px; }
217
- .stx-button--disabled { opacity: 0.5; cursor: not-allowed; }
218
- .stx-button--loading { pointer-events: none; }
219
- .stx-button-spinner { width: 16px; height: 16px; border: 2px solid transparent; border-top-color: currentColor; border-radius: 50%; animation: spin 0.6s linear infinite; }
220
- @keyframes spin { to { transform: rotate(360deg); } }
221
-
222
- /* Input */
223
- .stx-input-wrapper { display: flex; flex-direction: column; gap: 4px; }
224
- .stx-input-label { font-size: 14px; font-weight: 500; color: #333; }
225
- .stx-input { padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; transition: border-color 0.15s; }
226
- .stx-input:focus { outline: none; border-color: #3498db; }
227
- .stx-input--error { border-color: #e74c3c; }
228
- .stx-input-error { font-size: 12px; color: #e74c3c; }
229
- .stx-input-hint { font-size: 12px; color: #666; }
230
-
231
- /* Checkbox */
232
- .stx-checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
233
- .stx-checkbox input { display: none; }
234
- .stx-checkbox-box { width: 18px; height: 18px; border: 2px solid #ddd; border-radius: 4px; transition: all 0.15s; }
235
- .stx-checkbox input:checked + .stx-checkbox-box { background: #3498db; border-color: #3498db; }
236
- .stx-checkbox--disabled { opacity: 0.5; cursor: not-allowed; }
237
-
238
- /* Progress */
239
- .stx-progress { height: 8px; background: #e0e0e0; border-radius: 4px; overflow: hidden; position: relative; }
240
- .stx-progress-bar { height: 100%; background: #3498db; transition: width 0.3s; }
241
- .stx-progress--success .stx-progress-bar { background: #27ae60; }
242
- .stx-progress--warning .stx-progress-bar { background: #f39c12; }
243
- .stx-progress--error .stx-progress-bar { background: #e74c3c; }
244
- .stx-progress--indeterminate .stx-progress-bar { animation: progress-indeterminate 1.5s infinite; }
245
- @keyframes progress-indeterminate { 0% { transform: translateX(-100%); } 100% { transform: translateX(200%); } }
246
-
247
- /* Badge */
248
- .stx-badge { display: inline-flex; padding: 2px 8px; border-radius: 12px; font-size: 12px; font-weight: 500; }
249
- .stx-badge--default { background: #e0e0e0; color: #333; }
250
- .stx-badge--primary { background: #3498db; color: #fff; }
251
- .stx-badge--success { background: #27ae60; color: #fff; }
252
- .stx-badge--warning { background: #f39c12; color: #fff; }
253
- .stx-badge--error { background: #e74c3c; color: #fff; }
254
-
255
- /* Avatar */
256
- .stx-avatar { display: inline-flex; align-items: center; justify-content: center; background: #3498db; color: #fff; overflow: hidden; }
257
- .stx-avatar--circle { border-radius: 50%; }
258
- .stx-avatar--square { border-radius: 0; }
259
- .stx-avatar--rounded { border-radius: 8px; }
260
- .stx-avatar--small { width: 32px; height: 32px; font-size: 12px; }
261
- .stx-avatar--medium { width: 40px; height: 40px; font-size: 14px; }
262
- .stx-avatar--large { width: 56px; height: 56px; font-size: 18px; }
263
- .stx-avatar-img { width: 100%; height: 100%; object-fit: cover; }
264
-
265
- /* Card */
266
- .stx-card { background: #fff; border-radius: 8px; overflow: hidden; }
267
- .stx-card--outlined { border: 1px solid #e0e0e0; }
268
- .stx-card--elevated { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
269
- .stx-card-image img { width: 100%; display: block; }
270
- .stx-card-body { padding: 16px; }
271
- .stx-card-title { margin: 0 0 4px; font-size: 18px; }
272
- .stx-card-subtitle { margin: 0 0 8px; color: #666; font-size: 14px; }
273
- .stx-card-footer { padding: 12px 16px; border-top: 1px solid #e0e0e0; }
274
-
275
- /* Tabs */
276
- .stx-tabs { display: flex; gap: 4px; border-bottom: 1px solid #e0e0e0; }
277
- .stx-tab { padding: 8px 16px; border: none; background: none; cursor: pointer; color: #666; border-bottom: 2px solid transparent; transition: all 0.15s; }
278
- .stx-tab:hover { color: #333; }
279
- .stx-tab--active { color: #3498db; border-bottom-color: #3498db; }
280
- .stx-tab--disabled { opacity: 0.5; cursor: not-allowed; }
281
- .stx-tabs--pills { border-bottom: none; }
282
- .stx-tabs--pills .stx-tab { border-radius: 20px; border-bottom: none; }
283
- .stx-tabs--pills .stx-tab--active { background: #3498db; color: #fff; }
284
-
285
- /* Dropdown */
286
- .stx-dropdown { padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; background: #fff; cursor: pointer; min-width: 150px; }
287
- .stx-dropdown:focus { outline: none; border-color: #3498db; }
288
- .stx-dropdown--disabled { opacity: 0.5; cursor: not-allowed; }
289
-
290
- /* Rating */
291
- .stx-rating { display: inline-flex; gap: 4px; }
292
- .stx-star { color: #ddd; cursor: pointer; transition: color 0.15s; }
293
- .stx-star--filled { color: #f1c40f; }
294
- .stx-star--half { background: linear-gradient(90deg, #f1c40f 50%, #ddd 50%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
295
- .stx-rating--readonly .stx-star { cursor: default; }
296
- .stx-rating--small .stx-star { font-size: 16px; }
297
- .stx-rating--medium .stx-star { font-size: 24px; }
298
- .stx-rating--large .stx-star { font-size: 32px; }
299
-
300
- /* Slider */
301
- .stx-slider { display: flex; align-items: center; gap: 12px; }
302
- .stx-slider-track { flex: 1; }
303
- .stx-slider input[type="range"] { width: 100%; }
304
- .stx-slider-value { min-width: 40px; text-align: right; font-size: 14px; }
305
-
306
- /* Radio Button */
307
- .stx-radio { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
308
- .stx-radio input { display: none; }
309
- .stx-radio-circle { width: 18px; height: 18px; border: 2px solid #ddd; border-radius: 50%; position: relative; transition: all 0.15s; }
310
- .stx-radio input:checked + .stx-radio-circle { border-color: #3498db; }
311
- .stx-radio input:checked + .stx-radio-circle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 8px; height: 8px; background: #3498db; border-radius: 50%; }
312
- .stx-radio--disabled { opacity: 0.5; cursor: not-allowed; }
313
-
314
- /* Color Picker */
315
- .stx-color-picker { display: flex; flex-direction: column; gap: 8px; }
316
- .stx-color-picker-input { display: flex; align-items: center; gap: 8px; }
317
- .stx-color-picker-input input[type="color"] { width: 40px; height: 40px; border: none; cursor: pointer; }
318
- .stx-color-picker-value { font-family: monospace; }
319
- .stx-color-picker-presets { display: flex; gap: 4px; flex-wrap: wrap; }
320
- .stx-color-preset { width: 24px; height: 24px; border: 2px solid transparent; border-radius: 4px; cursor: pointer; }
321
- .stx-color-preset:hover { border-color: #333; }
322
-
323
- /* Date/Time Picker */
324
- .stx-date-picker, .stx-time-picker { display: flex; flex-direction: column; gap: 4px; }
325
- .stx-date-picker-input, .stx-time-picker-input { display: flex; align-items: center; gap: 4px; }
326
- .stx-date-picker-input input, .stx-time-picker-input { padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
327
- .stx-date-picker-clear { background: none; border: none; cursor: pointer; font-size: 16px; }
328
-
329
- /* Autocomplete */
330
- .stx-autocomplete { position: relative; }
331
- .stx-autocomplete-input-wrapper { position: relative; }
332
- .stx-autocomplete-input { width: 100%; padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
333
- .stx-autocomplete-spinner { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; border: 2px solid #ddd; border-top-color: #3498db; border-radius: 50%; animation: spin 0.6s linear infinite; }
334
- .stx-autocomplete-list { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid #ddd; border-radius: 6px; max-height: 200px; overflow-y: auto; display: none; z-index: 10; }
335
- .stx-autocomplete:focus-within .stx-autocomplete-list { display: block; }
336
- .stx-autocomplete-item { padding: 8px 12px; cursor: pointer; }
337
- .stx-autocomplete-item:hover { background: #f5f5f5; }
338
- .stx-autocomplete-item--selected { background: #e8f4fc; }
339
-
340
- /* Label */
341
- .stx-label { display: inline-block; font-weight: 500; }
342
- .stx-label--small { font-size: 12px; }
343
- .stx-label--medium { font-size: 14px; }
344
- .stx-label--large { font-size: 16px; }
345
- .stx-label-required { color: #e74c3c; margin-left: 2px; }
346
-
347
- /* Image */
348
- .stx-image { display: block; max-width: 100%; }
349
-
350
- /* Chip */
351
- .stx-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 16px; font-size: 13px; }
352
- .stx-chip--default { background: #e0e0e0; color: #333; }
353
- .stx-chip--primary { background: #e8f4fc; color: #3498db; }
354
- .stx-chip--success { background: #e8f8f0; color: #27ae60; }
355
- .stx-chip--warning { background: #fef5e7; color: #f39c12; }
356
- .stx-chip--error { background: #fdebeb; color: #e74c3c; }
357
- .stx-chip--small { padding: 2px 8px; font-size: 11px; }
358
- .stx-chip--large { padding: 6px 16px; font-size: 15px; }
359
- .stx-chip-remove { background: none; border: none; cursor: pointer; opacity: 0.6; padding: 0 2px; }
360
- .stx-chip-remove:hover { opacity: 1; }
361
-
362
- /* Tooltip */
363
- .stx-tooltip-wrapper { position: relative; display: inline-block; }
364
- .stx-tooltip { position: absolute; background: #333; color: #fff; padding: 4px 8px; border-radius: 4px; font-size: 12px; white-space: nowrap; opacity: 0; visibility: hidden; transition: opacity 0.2s, visibility 0.2s; z-index: 1000; }
365
- .stx-tooltip-wrapper:hover .stx-tooltip { opacity: 1; visibility: visible; }
366
- .stx-tooltip--top { bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 8px; }
367
- .stx-tooltip--bottom { top: 100%; left: 50%; transform: translateX(-50%); margin-top: 8px; }
368
- .stx-tooltip--left { right: 100%; top: 50%; transform: translateY(-50%); margin-right: 8px; }
369
- .stx-tooltip--right { left: 100%; top: 50%; transform: translateY(-50%); margin-left: 8px; }
370
-
371
- /* Scroll View */
372
- .stx-scroll-view { overflow: auto; }
373
- .stx-scroll-view--vertical { overflow-x: hidden; overflow-y: auto; }
374
- .stx-scroll-view--horizontal { overflow-x: auto; overflow-y: hidden; }
375
- .stx-scroll-view--hide-scrollbar::-webkit-scrollbar { display: none; }
376
- .stx-scroll-view--hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
377
- .stx-scroll-view--smooth { scroll-behavior: smooth; }
378
-
379
- /* Split View */
380
- .stx-split-view { display: flex; }
381
- .stx-split-view--horizontal { flex-direction: row; }
382
- .stx-split-view--vertical { flex-direction: column; }
383
- .stx-split-pane { overflow: auto; }
384
- .stx-split-divider { background: #e0e0e0; flex-shrink: 0; }
385
- .stx-split-view--horizontal .stx-split-divider { width: 4px; cursor: col-resize; }
386
- .stx-split-view--vertical .stx-split-divider { height: 4px; cursor: row-resize; }
387
- .stx-split-divider:hover { background: #3498db; }
388
-
389
- /* Accordion */
390
- .stx-accordion { border: 1px solid #e0e0e0; border-radius: 8px; overflow: hidden; }
391
- .stx-accordion-item { border-bottom: 1px solid #e0e0e0; }
392
- .stx-accordion-item:last-child { border-bottom: none; }
393
- .stx-accordion-header { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: none; border: none; cursor: pointer; font-size: 14px; }
394
- .stx-accordion-header:hover { background: #f5f5f5; }
395
- .stx-accordion-icon { transition: transform 0.2s; }
396
- .stx-accordion-item--open .stx-accordion-icon { transform: rotate(180deg); }
397
- .stx-accordion-content { padding: 0 16px 16px; }
398
- .stx-accordion-item--disabled { opacity: 0.5; }
399
- .stx-accordion-item--disabled .stx-accordion-header { cursor: not-allowed; }
400
-
401
- /* Stepper */
402
- .stx-stepper { display: flex; }
403
- .stx-stepper--horizontal { flex-direction: row; align-items: flex-start; }
404
- .stx-stepper--vertical { flex-direction: column; }
405
- .stx-step { display: flex; align-items: center; }
406
- .stx-stepper--vertical .stx-step { flex-direction: row; }
407
- .stx-step-indicator { width: 32px; height: 32px; border-radius: 50%; background: #e0e0e0; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 500; flex-shrink: 0; }
408
- .stx-step--completed .stx-step-indicator { background: #27ae60; color: #fff; }
409
- .stx-step--active .stx-step-indicator { background: #3498db; color: #fff; }
410
- .stx-step-content { margin-left: 12px; }
411
- .stx-step-label { font-size: 14px; font-weight: 500; }
412
- .stx-step-description { font-size: 12px; color: #666; }
413
- .stx-step-connector { flex: 1; height: 2px; background: #e0e0e0; margin: 0 8px; min-width: 20px; }
414
- .stx-stepper--vertical .stx-step-connector { width: 2px; height: 20px; margin: 8px 0 8px 15px; }
415
-
416
- /* Modal Component */
417
- .stx-modal-component--hidden { display: none; }
418
- .stx-modal-component-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 10000; }
419
- .stx-modal-component-dialog { background: #fff; border-radius: 12px; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; }
420
- .stx-modal-component--small .stx-modal-component-dialog { width: 300px; }
421
- .stx-modal-component--medium .stx-modal-component-dialog { width: 500px; }
422
- .stx-modal-component--large .stx-modal-component-dialog { width: 800px; }
423
- .stx-modal-component--fullscreen .stx-modal-component-dialog { width: 100%; height: 100%; border-radius: 0; }
424
- .stx-modal-component-header { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-bottom: 1px solid #e0e0e0; }
425
- .stx-modal-component-title { margin: 0; font-size: 18px; }
426
- .stx-modal-component-close { background: none; border: none; font-size: 24px; cursor: pointer; opacity: 0.6; }
427
- .stx-modal-component-close:hover { opacity: 1; }
428
- .stx-modal-component-body { padding: 16px; overflow-y: auto; flex: 1; }
429
- .stx-modal-component-footer { padding: 16px; border-top: 1px solid #e0e0e0; display: flex; justify-content: flex-end; gap: 8px; }
430
-
431
- /* List View */
432
- .stx-list-view { border: 1px solid #e0e0e0; border-radius: 8px; overflow: hidden; }
433
- .stx-list-view-items { list-style: none; margin: 0; padding: 0; }
434
- .stx-list-view-item { padding: 12px 16px; border-bottom: 1px solid #e0e0e0; }
435
- .stx-list-view-item:last-child { border-bottom: none; }
436
- .stx-list-view--selectable .stx-list-view-item { cursor: pointer; }
437
- .stx-list-view--selectable .stx-list-view-item:hover { background: #f5f5f5; }
438
- .stx-list-view-item--selected { background: #e8f4fc; }
439
- .stx-list-view-empty { padding: 24px; text-align: center; color: #666; }
440
-
441
- /* Table */
442
- .stx-table { overflow-x: auto; }
443
- .stx-table table { width: 100%; border-collapse: collapse; }
444
- .stx-table th, .stx-table td { padding: 12px; text-align: left; }
445
- .stx-table th { font-weight: 600; background: #f5f5f5; }
446
- .stx-table--bordered th, .stx-table--bordered td { border: 1px solid #e0e0e0; }
447
- .stx-table--striped tbody tr:nth-child(even) { background: #f9f9f9; }
448
- .stx-table--hoverable tbody tr:hover { background: #f5f5f5; }
449
- .stx-table th[data-sortable] { cursor: pointer; }
450
- .stx-table-sort-icon::after { content: '\u21C5'; margin-left: 4px; opacity: 0.3; }
451
- .stx-table-sorted .stx-table-sort-icon::after { opacity: 1; }
452
- .stx-table-sorted--asc .stx-table-sort-icon::after { content: '\u2191'; }
453
- .stx-table-sorted--desc .stx-table-sort-icon::after { content: '\u2193'; }
454
-
455
- /* Tree View */
456
- .stx-tree-view { font-size: 14px; }
457
- .stx-tree-node { padding-left: 20px; }
458
- .stx-tree-node-content { display: flex; align-items: center; gap: 4px; padding: 4px; cursor: pointer; border-radius: 4px; }
459
- .stx-tree-node-content:hover { background: #f5f5f5; }
460
- .stx-tree-node--selected > .stx-tree-node-content { background: #e8f4fc; }
461
- .stx-tree-node--disabled { opacity: 0.5; }
462
- .stx-tree-toggle { width: 16px; cursor: pointer; transition: transform 0.2s; }
463
- .stx-tree-toggle--expanded { transform: rotate(90deg); }
464
- .stx-tree-toggle-placeholder { width: 16px; }
465
- .stx-tree-children { padding-left: 8px; }
466
-
467
- /* Data Grid */
468
- .stx-data-grid { border: 1px solid #e0e0e0; border-radius: 8px; overflow: hidden; }
469
- .stx-data-grid-table-wrapper { overflow-x: auto; }
470
- .stx-data-grid-table { width: 100%; border-collapse: collapse; }
471
- .stx-data-grid-table th, .stx-data-grid-table td { padding: 12px; text-align: left; border-bottom: 1px solid #e0e0e0; }
472
- .stx-data-grid-table th { background: #f5f5f5; }
473
- .stx-data-grid-header-cell { display: flex; align-items: center; gap: 8px; }
474
- .stx-data-grid-sort, .stx-data-grid-filter { background: none; border: none; cursor: pointer; opacity: 0.5; }
475
- .stx-data-grid-sort:hover, .stx-data-grid-filter:hover { opacity: 1; }
476
- .stx-data-grid-pagination { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid #e0e0e0; }
477
- .stx-data-grid-page-buttons { display: flex; gap: 4px; }
478
- .stx-data-grid-page-btn { padding: 4px 8px; border: 1px solid #e0e0e0; background: #fff; cursor: pointer; border-radius: 4px; }
479
- .stx-data-grid-page-btn:disabled { opacity: 0.5; cursor: not-allowed; }
480
-
481
- /* Chart */
482
- .stx-chart { background: #f9f9f9; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
483
- .stx-chart-placeholder { text-align: center; padding: 20px; }
484
- .stx-chart-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
485
- .stx-chart-type { font-size: 14px; color: #666; }
486
- .stx-chart-info { font-size: 12px; color: #999; margin-top: 4px; }
487
-
488
- /* Code Editor */
489
- .stx-code-editor { display: flex; font-family: 'Monaco', 'Menlo', monospace; font-size: 13px; line-height: 1.5; overflow: hidden; border-radius: 8px; }
490
- .stx-code-editor--dark { background: #1e1e1e; color: #d4d4d4; }
491
- .stx-code-editor--light { background: #fff; color: #333; border: 1px solid #e0e0e0; }
492
- .stx-code-editor-gutter { padding: 12px 8px; background: rgba(0,0,0,0.1); text-align: right; user-select: none; }
493
- .stx-code-editor-line-number { color: #858585; }
494
- .stx-code-editor-content { flex: 1; padding: 12px; overflow: auto; }
495
- .stx-code-editor-content pre { margin: 0; }
496
- .stx-code-editor--wrap .stx-code-editor-content { white-space: pre-wrap; word-wrap: break-word; }
497
-
498
- /* Media Player */
499
- .stx-media-player video, .stx-media-player audio { width: 100%; display: block; }
500
- .stx-media-player--video { background: #000; }
501
-
502
- /* File Explorer */
503
- .stx-file-explorer { border: 1px solid #e0e0e0; border-radius: 8px; overflow: hidden; }
504
- .stx-file-explorer-list { width: 100%; border-collapse: collapse; }
505
- .stx-file-explorer-list th { text-align: left; padding: 8px 12px; background: #f5f5f5; font-weight: 500; }
506
- .stx-file-explorer-list td { padding: 8px 12px; border-top: 1px solid #e0e0e0; }
507
- .stx-file-explorer-item--selectable { cursor: pointer; }
508
- .stx-file-explorer-item--selectable:hover { background: #f5f5f5; }
509
- .stx-file-explorer-icon { margin-right: 8px; }
510
- .stx-file-explorer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 16px; padding: 16px; }
511
- .stx-file-explorer--grid .stx-file-explorer-item { text-align: center; padding: 12px; border-radius: 8px; }
512
- .stx-file-explorer--grid .stx-file-explorer-icon { font-size: 32px; display: block; margin-bottom: 8px; }
513
- .stx-file-explorer--grid .stx-file-explorer-name { font-size: 12px; word-break: break-all; }
514
-
515
- /* WebView */
516
- .stx-webview { border: none; display: block; }
517
-
518
- /* Dark mode support */
519
- @media (prefers-color-scheme: dark) {
520
- .stx-input-label { color: #eee; }
521
- .stx-input { background: #333; border-color: #555; color: #fff; }
522
- .stx-card { background: #2d2d2d; color: #fff; }
523
- .stx-card-subtitle { color: #aaa; }
524
- .stx-progress { background: #444; }
525
- .stx-dropdown { background: #333; border-color: #555; color: #fff; }
526
- .stx-accordion { border-color: #444; }
527
- .stx-accordion-item { border-color: #444; }
528
- .stx-accordion-header:hover { background: #333; }
529
- .stx-list-view { border-color: #444; }
530
- .stx-list-view-item { border-color: #444; }
531
- .stx-list-view--selectable .stx-list-view-item:hover { background: #333; }
532
- .stx-table th { background: #333; }
533
- .stx-table--bordered th, .stx-table--bordered td { border-color: #444; }
534
- .stx-tree-node-content:hover { background: #333; }
535
- .stx-data-grid { border-color: #444; }
536
- .stx-data-grid-table th, .stx-data-grid-table td { border-color: #444; }
537
- .stx-data-grid-table th { background: #333; }
538
- .stx-modal-component-dialog { background: #2d2d2d; color: #fff; }
539
- .stx-modal-component-header, .stx-modal-component-footer { border-color: #444; }
540
- .stx-file-explorer { border-color: #444; }
541
- .stx-file-explorer-list th { background: #333; }
542
- .stx-file-explorer-list td { border-color: #444; }
543
- .stx-autocomplete-list { background: #333; border-color: #444; }
544
- .stx-autocomplete-item:hover { background: #444; }
545
- .stx-chip--default { background: #444; color: #eee; }
546
- .stx-chip--primary { background: #1a3a52; }
547
- .stx-chip--success { background: #1a3a2a; }
548
- .stx-chip--warning { background: #3a2a1a; }
549
- .stx-chip--error { background: #3a1a1a; }
550
- }
551
- `;function qZ(){return!1}function WJ(){return typeof window<"u"&&typeof document<"u"}var y=[];function _Z(){return`modal-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function VZ(J){switch(J){case"info":return"&#x2139;";case"warning":return"&#x26A0;";case"error":return"&#x2716;";case"success":return"&#x2714;";case"question":return"&#x2753;";default:return"&#x2139;"}}function i(J){if(J==="question")return[{label:"No",style:"default"},{label:"Yes",style:"primary"}];return[{label:"OK",style:"primary"}]}function UZ(J){let{options:Z}=J,$=VZ(Z.type),G=Z.buttons||i(Z.type),X=Z.type||"info",Q="";return G.forEach((R,z)=>{let K=R.style==="destructive"?"destructive":R.style==="primary"?"primary":"default",j=z===(Z.defaultButton??G.length-1)?"autofocus":"";Q+=`<button class="stx-modal-btn ${K}" data-index="${z}" ${j}>${R.label}</button>`}),`
552
- <div class="stx-modal-overlay" data-modal-id="${J.id}">
553
- <div class="stx-modal ${X}" role="dialog" aria-modal="true" aria-labelledby="${J.id}-title">
554
- <div class="stx-modal-icon">${$}</div>
555
- <div class="stx-modal-content">
556
- ${Z.title?`<h2 id="${J.id}-title" class="stx-modal-title">${TJ(Z.title)}</h2>`:""}
557
- <p class="stx-modal-message">${TJ(Z.message)}</p>
558
- </div>
559
- <div class="stx-modal-buttons">${Q}</div>
560
- </div>
561
- </div>
562
- `}function TJ(J){return J.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function A(J,Z,$=!1){let G=y.indexOf(J);if(G>-1)y.splice(G,1);if(J.element&&WJ())J.element.remove();let Q=(J.options.buttons||i(J.options.type))[Z];if(Q?.action)Q.action();J.resolve({buttonIndex:Z,cancelled:$})}async function d(J){let Z=qZ(),$=_Z();return new Promise((G)=>{let X={id:$,options:J,resolve:G};if(y.push(X),Z)console.log(`[stx-modal] Showing native modal: ${J.title||"Modal"}`),setTimeout(()=>{A(X,J.defaultButton??0,!1)},0);else if(WJ())try{let Q=document.createElement("div");Q.innerHTML=UZ(X);let R=Q.firstElementChild;if(!R){console.log(`[stx-modal] ${J.type?.toUpperCase()||"INFO"}: ${J.title||"Modal"}`),console.log(`[stx-modal] ${J.message}`),setTimeout(()=>{A(X,J.defaultButton??0,!1)},0);return}X.element=R;try{document.body.appendChild(R)}catch{console.log(`[stx-modal] ${J.type?.toUpperCase()||"INFO"}: ${J.title||"Modal"}`),console.log(`[stx-modal] ${J.message}`),setTimeout(()=>{A(X,J.defaultButton??0,!1)},0);return}try{R.querySelectorAll(".stx-modal-btn").forEach((z)=>{z.addEventListener("click",()=>{let K=Number.parseInt(z.dataset.index||"0",10);A(X,K,!1)})})}catch{}try{R.addEventListener("click",(z)=>{if(z.target===R){let K=J.cancelButton??0;A(X,K,!0)}})}catch{}try{let z=(K)=>{if(K.key==="Escape"){let j=J.cancelButton??0;A(X,j,!0),document.removeEventListener("keydown",z)}else if(K.key==="Enter"){let j=J.defaultButton??(J.buttons||i(J.type)).length-1;A(X,j,!1),document.removeEventListener("keydown",z)}};document.addEventListener("keydown",z)}catch{}try{let z=R.querySelector(".stx-modal-btn[autofocus]");if(z)z.focus()}catch{}if(typeof process<"u"&&process.env.BUN_TEST)setTimeout(()=>{A(X,J.defaultButton??0,!1)},0)}catch{console.log(`[stx-modal] ${J.type?.toUpperCase()||"INFO"}: ${J.title||"Modal"}`),console.log(`[stx-modal] ${J.message}`),setTimeout(()=>{A(X,J.defaultButton??0,!1)},0)}else{console.log(`[stx-modal] ${J.type?.toUpperCase()||"INFO"}: ${J.title||"Modal"}`),console.log(`[stx-modal] ${J.message}`);let Q=J.buttons||i(J.type);console.log(`[stx-modal] Buttons: ${Q.map((R)=>R.label).join(", ")}`),setTimeout(()=>{A(X,J.defaultButton??0,!1)},0)}})}async function PZ(J,Z){return d({title:J,message:Z,type:"info"})}async function _8(J,Z){return d({title:J,message:Z,type:"warning"})}async function V8(J,Z){return d({title:J,message:Z,type:"error"})}async function U8(J,Z){return d({title:J,message:Z,type:"success"})}async function WZ(J,Z){return d({title:J,message:Z,type:"question",buttons:[{label:"No",style:"default"},{label:"Yes",style:"primary"}],defaultButton:1,cancelButton:0})}async function P8(J,Z="Confirm"){return(await WZ(Z,J)).buttonIndex===1}async function W8(J,Z="Alert"){await PZ(Z,J)}async function D8(J,Z="",$="Input"){if(WJ()&&typeof window.prompt==="function")return window.prompt(J,Z);return console.log(`[stx-modal] PROMPT: ${$}`),console.log(`[stx-modal] ${J}`),console.log(`[stx-modal] Default: ${Z}`),Z}function L8(){return y.length}function N8(){while(y.length>0){let J=y[y.length-1];A(J,0,!0)}}var k8=`
563
- .stx-modal-overlay {
564
- position: fixed;
565
- inset: 0;
566
- background: rgba(0, 0, 0, 0.5);
567
- display: flex;
568
- align-items: center;
569
- justify-content: center;
570
- z-index: 10000;
571
- animation: stx-modal-fade-in 0.15s ease-out;
572
- }
573
-
574
- @keyframes stx-modal-fade-in {
575
- from { opacity: 0; }
576
- to { opacity: 1; }
577
- }
578
-
579
- .stx-modal {
580
- background: #fff;
581
- border-radius: 12px;
582
- padding: 24px;
583
- max-width: 400px;
584
- width: 90%;
585
- box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
586
- animation: stx-modal-slide-up 0.2s ease-out;
587
- }
588
-
589
- @keyframes stx-modal-slide-up {
590
- from { transform: translateY(20px); opacity: 0; }
591
- to { transform: translateY(0); opacity: 1; }
592
- }
593
-
594
- @media (prefers-color-scheme: dark) {
595
- .stx-modal {
596
- background: #2d2d2d;
597
- color: #fff;
598
- }
599
- }
600
-
601
- .stx-modal-icon {
602
- font-size: 48px;
603
- text-align: center;
604
- margin-bottom: 16px;
605
- }
606
-
607
- .stx-modal.info .stx-modal-icon { color: #3498db; }
608
- .stx-modal.warning .stx-modal-icon { color: #f39c12; }
609
- .stx-modal.error .stx-modal-icon { color: #e74c3c; }
610
- .stx-modal.success .stx-modal-icon { color: #27ae60; }
611
- .stx-modal.question .stx-modal-icon { color: #9b59b6; }
612
-
613
- .stx-modal-content {
614
- text-align: center;
615
- margin-bottom: 24px;
616
- }
617
-
618
- .stx-modal-title {
619
- margin: 0 0 8px;
620
- font-size: 20px;
621
- font-weight: 600;
622
- }
623
-
624
- .stx-modal-message {
625
- margin: 0;
626
- color: #666;
627
- line-height: 1.5;
628
- }
629
-
630
- @media (prefers-color-scheme: dark) {
631
- .stx-modal-message { color: #aaa; }
632
- }
633
-
634
- .stx-modal-buttons {
635
- display: flex;
636
- gap: 8px;
637
- justify-content: center;
638
- }
639
-
640
- .stx-modal-btn {
641
- padding: 10px 24px;
642
- border-radius: 6px;
643
- font-size: 14px;
644
- font-weight: 500;
645
- cursor: pointer;
646
- border: none;
647
- transition: background 0.15s, transform 0.1s;
648
- }
649
-
650
- .stx-modal-btn:hover {
651
- transform: translateY(-1px);
652
- }
653
-
654
- .stx-modal-btn:active {
655
- transform: translateY(0);
656
- }
657
-
658
- .stx-modal-btn.default {
659
- background: #e0e0e0;
660
- color: #333;
661
- }
662
-
663
- .stx-modal-btn.default:hover {
664
- background: #d0d0d0;
665
- }
666
-
667
- .stx-modal-btn.primary {
668
- background: #3498db;
669
- color: #fff;
670
- }
671
-
672
- .stx-modal-btn.primary:hover {
673
- background: #2980b9;
674
- }
675
-
676
- .stx-modal-btn.destructive {
677
- background: #e74c3c;
678
- color: #fff;
679
- }
680
-
681
- .stx-modal-btn.destructive:hover {
682
- background: #c0392b;
683
- }
684
-
685
- @media (prefers-color-scheme: dark) {
686
- .stx-modal-btn.default {
687
- background: #444;
688
- color: #fff;
689
- }
690
- .stx-modal-btn.default:hover {
691
- background: #555;
692
- }
693
- }
694
- `;function DZ(){if(MJ.platform)return MJ.platform;return"unknown"}function gJ(){if(typeof window<"u"&&window.craft?.tray)return!0;return!1}function uJ(J,Z){if(J.type==="separator")return{id:`sep-${Z}`,label:"",type:"separator"};let $={id:`item-${Z}-${J.label.replace(/\s+/g,"-").toLowerCase()}`,label:J.label,type:J.type||"normal",enabled:J.enabled!==!1};if(J.accelerator)$.shortcut=J.accelerator;if(J.type==="checkbox")$.checked=J.checked||!1;if(J.type==="submenu"&&J.submenu)$.submenu=J.submenu.map((G,X)=>uJ(G,X));return $}function _J(J){return J.map((Z,$)=>uJ(Z,$))}function mJ(J,Z=0){if(J.type==="separator")return'<hr class="stx-tray-separator" />';let $=" ".repeat(Z),G=J.enabled===!1?"disabled":"",X=J.checked?"\u2713 ":"",Q=J.accelerator?`<span class="accelerator">${J.accelerator}</span>`:"",R=`${$}<div class="stx-tray-item ${G}" data-action="${J.label}">`;if(R+=`<span class="label">${X}${J.label}</span>${Q}`,J.type==="submenu"&&J.submenu){R+='<span class="arrow">\u25B8</span>',R+='<div class="stx-tray-submenu">';for(let z of J.submenu)R+=mJ(z,Z+1);R+="</div>"}return R+="</div>",R}function LZ(J){let Z='<div class="stx-tray-menu">';for(let $ of J)Z+=mJ($);return Z+="</div>",Z}var f=new Map;function NZ(){return`tray-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}var EJ=!1;function kZ(){if(EJ||typeof window>"u")return;window.addEventListener("craft:tray:menu",(J)=>{let{action:Z}=J.detail;for(let $ of f.values()){let G=$.handlers.get(Z);if(G){G();break}}}),EJ=!0}async function TZ(J={}){let Z=NZ(),$=DZ(),G=gJ(),X={icon:J.icon||"",tooltip:J.tooltip||"stx Application",menu:J.menu||[],visible:!0},Q=new Map;for(let z of J.menu||[]){if(z.type!=="separator"&&z.onClick)Q.set(z.label,z.onClick);if(z.type==="submenu"&&z.submenu){for(let K of z.submenu)if(K.type!=="separator"&&K.onClick)Q.set(K.label,K.onClick)}}if(f.set(Z,{state:X,handlers:Q}),G){kZ();let z=window;try{if(X.tooltip)await z.craft.tray.setTitle({title:X.tooltip}),await z.craft.tray.setTooltip({tooltip:X.tooltip});if(X.icon)await z.craft.tray.setIcon({icon:X.icon});let K=_J(X.menu);await z.craft.tray.setMenu({items:K}),console.log(`[stx-tray] Native tray created for ${$}`)}catch(K){console.warn("[stx-tray] Failed to create native tray:",K)}}else console.log("[stx-tray] Created simulated tray (not in Craft window)"),console.log(`[stx-tray] ID: ${Z}`),console.log(`[stx-tray] Tooltip: ${X.tooltip}`),console.log(`[stx-tray] Menu items: ${X.menu.length}`);return{id:Z,setIcon:(z)=>{if(X.icon=z,G)window.craft.tray.setIcon({icon:z}).catch((j)=>{console.warn("[stx-tray] Failed to set icon:",j)});console.log(`[stx-tray:${Z}] Icon updated`)},setTooltip:(z)=>{if(X.tooltip=z,G)window.craft.tray.setTooltip({tooltip:z}).catch((j)=>{console.warn("[stx-tray] Failed to set tooltip:",j)});console.log(`[stx-tray:${Z}] Tooltip: ${z}`)},setMenu:(z)=>{X.menu=z,Q.clear();for(let K of z){if(K.type!=="separator"&&K.onClick)Q.set(K.label,K.onClick);if(K.type==="submenu"&&K.submenu){for(let j of K.submenu)if(j.type!=="separator"&&j.onClick)Q.set(j.label,j.onClick)}}if(G){let K=window,j=_J(z);K.craft.tray.setMenu({items:j}).catch((O)=>{console.warn("[stx-tray] Failed to set menu:",O)})}console.log(`[stx-tray:${Z}] Menu updated (${z.length} items)`)},destroy:()=>{if(X.visible=!1,f.delete(Z),G)window.craft.tray.destroy?.().catch((K)=>{console.warn("[stx-tray] Failed to destroy tray:",K)});console.log(`[stx-tray:${Z}] Destroyed`)}}}var M8=TZ;function E8(){return Array.from(f.keys())}function H8(J){let Z=f.get(J);if(!Z)return null;let $=gJ();return{id:J,setIcon:(G)=>{if(Z.state.icon=G,$)window.craft.tray.setIcon({icon:G}).catch(()=>{})},setTooltip:(G)=>{if(Z.state.tooltip=G,$)window.craft.tray.setTooltip({tooltip:G}).catch(()=>{})},setMenu:(G)=>{if(Z.state.menu=G,$){let X=window,Q=_J(G);X.craft.tray.setMenu({items:Q}).catch(()=>{})}},destroy:()=>{if(f.delete(J),$)window.craft.tray.destroy?.().catch(()=>{})}}}function x8(J,Z){let $=f.get(J);if(!$)return!1;let G=$.handlers.get(Z);if(G)return G(),!0;return!1}function A8(J){let Z=f.get(J);if(!Z)return null;return LZ(Z.state.menu)}function C8(){return`
695
- // STX Desktop Tray Bridge
696
- // Provides convenient wrappers around window.craft.tray APIs
697
- window.stxTray = {
698
- setTitle: (title) => window.craft?.tray?.setTitle({ title }),
699
- setTooltip: (tooltip) => window.craft?.tray?.setTooltip({ tooltip }),
700
- setIcon: (icon) => window.craft?.tray?.setIcon({ icon }),
701
- setMenu: (items) => window.craft?.tray?.setMenu({ items }),
702
- destroy: () => window.craft?.tray?.destroy(),
703
-
704
- // Check if tray is available
705
- isAvailable: () => typeof window.craft?.tray !== 'undefined',
706
- };
707
- `}var I8=`
708
- .stx-tray-menu {
709
- background: #2d2d2d;
710
- border-radius: 8px;
711
- padding: 4px 0;
712
- min-width: 200px;
713
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
714
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
715
- font-size: 13px;
716
- color: #fff;
717
- }
718
-
719
- .stx-tray-item {
720
- padding: 6px 12px;
721
- display: flex;
722
- align-items: center;
723
- justify-content: space-between;
724
- cursor: pointer;
725
- position: relative;
726
- }
727
-
728
- .stx-tray-item:hover {
729
- background: #3d3d3d;
730
- }
731
-
732
- .stx-tray-item.disabled {
733
- opacity: 0.5;
734
- cursor: not-allowed;
735
- }
736
-
737
- .stx-tray-item .label {
738
- flex: 1;
739
- }
740
-
741
- .stx-tray-item .accelerator {
742
- margin-left: 20px;
743
- opacity: 0.6;
744
- font-size: 12px;
745
- }
746
-
747
- .stx-tray-item .arrow {
748
- margin-left: 8px;
749
- font-size: 10px;
750
- }
751
-
752
- .stx-tray-separator {
753
- margin: 4px 0;
754
- border: none;
755
- border-top: 1px solid #444;
756
- }
757
-
758
- .stx-tray-submenu {
759
- position: absolute;
760
- left: 100%;
761
- top: 0;
762
- background: #2d2d2d;
763
- border-radius: 8px;
764
- padding: 4px 0;
765
- min-width: 150px;
766
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
767
- display: none;
768
- }
769
-
770
- .stx-tray-item:hover > .stx-tray-submenu {
771
- display: block;
772
- }
773
- `;function GJ(){if(typeof window<"u"&&window.craft?.dialog)return!0;return!1}async function w8(J={}){if(GJ()){let Z=window;try{return await Z.craft.dialog.showOpenDialog(J)}catch($){console.warn("[stx-dialog] Failed to show native open dialog:",$)}}return new Promise((Z)=>{if(typeof document>"u"){Z({canceled:!0,filePaths:[]});return}let $=document.createElement("input");if($.type="file",$.multiple=J.multiSelections??!1,J.filters?.length){let G=J.filters.flatMap((X)=>X.extensions.map((Q)=>`.${Q}`));$.accept=G.join(",")}if(J.canChooseDirectories&&!J.canChooseFiles)$.webkitdirectory=!0;$.onchange=()=>{let G=Array.from($.files||[]);if(G.length===0)Z({canceled:!0,filePaths:[]});else{let X=G.map((Q)=>Q.name);Z({canceled:!1,filePaths:X})}},$.oncancel=()=>{Z({canceled:!0,filePaths:[]})},$.click()})}async function S8(J={}){if(GJ()){let $=window;try{return await $.craft.dialog.showSaveDialog(J)}catch(G){console.warn("[stx-dialog] Failed to show native save dialog:",G)}}if(typeof window<"u"&&"showSaveFilePicker"in window)try{let $=J.filters?.map((X)=>({description:X.name,accept:{"*/*":X.extensions.map((Q)=>`.${Q}`)}}));return{canceled:!1,filePath:(await window.showSaveFilePicker({suggestedName:J.defaultPath,types:$})).name}}catch($){return{canceled:!0}}console.warn("[stx-dialog] Save dialog not available, using prompt fallback");let Z=prompt("Enter filename:",J.defaultPath||"file.txt");if(Z)return{canceled:!1,filePath:Z};return{canceled:!0}}async function XJ(J){if(GJ()){let G=window;try{return await G.craft.dialog.showMessageBox(J)}catch(X){console.warn("[stx-dialog] Failed to show native message box:",X)}}let Z=J.buttons||["OK"];if(Z.length===1)return alert(J.message),{response:0};if(Z.length===2&&J.type==="question")return{response:confirm(J.message)?1:0};return console.warn("[stx-dialog] Complex message box not fully supported in browser, using confirm"),{response:confirm(`${J.message}
774
-
775
- ${Z.join(" / ")}`)?Z.length-1:0}}async function B8(J={}){if(GJ()){let Z=window;try{return await Z.craft.dialog.showColorPicker(J)}catch($){console.warn("[stx-dialog] Failed to show native color picker:",$)}}return new Promise((Z)=>{if(typeof document>"u"){Z({canceled:!0});return}let $=document.createElement("input");$.type="color",$.value=J.color||"#000000",$.onchange=()=>{Z({canceled:!1,color:$.value})},$.oncancel=()=>{Z({canceled:!0})},$.click()})}async function f8(J,Z){await XJ({type:"info",title:Z||"Alert",message:J,buttons:["OK"]})}async function v8(J,Z){return(await XJ({type:"question",title:Z||"Confirm",message:J,buttons:["Cancel","OK"],defaultButton:1,cancelButton:0})).response===1}async function y8(J,Z){await XJ({type:"error",title:Z||"Error",message:J,buttons:["OK"]})}async function b8(J,Z){await XJ({type:"warning",title:Z||"Warning",message:J,buttons:["OK"]})}function g8(){return`
776
- // STX Desktop Dialog Bridge
777
- // Provides convenient wrappers around window.craft.dialog APIs
778
- window.stxDialog = {
779
- // File dialogs
780
- showOpenDialog: (options) => window.craft?.dialog?.showOpenDialog(options),
781
- showSaveDialog: (options) => window.craft?.dialog?.showSaveDialog(options),
782
-
783
- // Message dialogs
784
- showMessageBox: (options) => window.craft?.dialog?.showMessageBox(options),
785
-
786
- // Color picker
787
- showColorPicker: (options) => window.craft?.dialog?.showColorPicker(options),
788
-
789
- // Font picker
790
- showFontPicker: (options) => window.craft?.dialog?.showFontPicker(options),
791
-
792
- // Convenience functions
793
- alert: async (message, title) => {
794
- return window.craft?.dialog?.showMessageBox({
795
- type: 'info',
796
- title: title || 'Alert',
797
- message,
798
- buttons: ['OK'],
799
- });
800
- },
801
-
802
- confirm: async (message, title) => {
803
- const result = await window.craft?.dialog?.showMessageBox({
804
- type: 'question',
805
- title: title || 'Confirm',
806
- message,
807
- buttons: ['Cancel', 'OK'],
808
- });
809
- return result?.response === 1;
810
- },
811
-
812
- error: async (message, title) => {
813
- return window.craft?.dialog?.showMessageBox({
814
- type: 'error',
815
- title: title || 'Error',
816
- message,
817
- buttons: ['OK'],
818
- });
819
- },
820
-
821
- // Check if dialog is available
822
- isAvailable: () => typeof window.craft?.dialog !== 'undefined',
823
- };
824
- `}var u={};function p8(J){u={...u,...J}}function l8(){return{...u}}function d8(){u={}}function DJ(J){if(!J.sidebarConfig)return;let Z={...J.sidebarConfig};if(Z.variant==="desktop")Z.material=Z.material??"sidebar",Z.backgroundEffect=Z.backgroundEffect??"shimmer",Z.allowsVibrancy=Z.allowsVibrancy??!0;return Z}function s(){let J=[I.env.CRAFT_BINARY_PATH,u.craftBinaryPath,...u.additionalSearchPaths||[],HZ(EZ(I.execPath),"craft")];for(let Z of J)if(Z&&MZ(Z))return Z;return UJ()}var C=new Map;function n8(){return Array.from(C.keys())}function r8(J){let Z=C.get(J);if(!Z)return null;return t(J,Z.app)}function o8(){for(let[J,Z]of C)try{Z.app?.close?.()}catch($){console.warn(`Failed to close window ${J}:`,$)}C.clear()}function t(J,Z){return{id:J,show:()=>{console.log(`[stx/desktop] Window ${J} shown`)},hide:()=>{console.log("[stx/desktop] To hide window, use window.craft.window.hide() from inside the webview")},close:()=>{let $=C.get(J);if($?.app)$.app.close(),C.delete(J),console.log(`[stx/desktop] Window ${J} closed`)},focus:()=>{console.log("[stx/desktop] To focus window, use window.craft.window.focus() from inside the webview")},minimize:()=>{console.log("[stx/desktop] To minimize window, use window.craft.window.minimize() from inside the webview")},maximize:()=>{console.log("[stx/desktop] To maximize window, use window.craft.window.maximize() from inside the webview")},restore:()=>{console.log("[stx/desktop] To restore window, use window.craft.window.show() from inside the webview")},setTitle:($)=>{console.log(`[stx/desktop] To set title, use window.craft.window.setTitle({ title: "${$}" }) from inside the webview`)},loadURL:($)=>{console.log(`[stx/desktop] To navigate, use window.location.href = "${$}" from inside the webview`)},reload:()=>{console.log("[stx/desktop] To reload, use window.craft.window.reload() from inside the webview")}}}function hJ(J,Z={}){let $=["--url",J,"--title",Z.title||"stx Desktop","--width",String(Z.width??1200),"--height",String(Z.height??800)];if(Z.darkMode)$.push("--dark");if(Z.hotReload)$.push("--hot-reload");if(Z.resizable===!1)$.push("--no-resize");if(Z.frameless)$.push("--frameless");if(Z.alwaysOnTop)$.push("--always-on-top");if(Z.titlebarHidden)$.push("--titlebar-hidden");if(Z.systemTray)$.push("--system-tray");if(Z.hideDockIcon)$.push("--hide-dock-icon");if(Z.devTools===!1)$.push("--no-devtools");if(Z.nativeSidebar)$.push("--native-sidebar");if(Z.sidebarWidth!==void 0)$.push("--sidebar-width",String(Z.sidebarWidth));let G=DJ(Z);if(G)$.push("--sidebar-config",JSON.stringify(G));return $}async function a8(J,Z={}){let $=`craft-window-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,G=s();try{let{createApp:X}=await import("./chunk-vw8rwv6e.js"),Q=X({url:J,craftPath:G,window:{title:Z.title||"stx Desktop",width:Z.width??1200,height:Z.height??800,darkMode:Z.darkMode??!1,hotReload:Z.hotReload??!1,resizable:Z.resizable??!0,frameless:Z.frameless??!1,alwaysOnTop:Z.alwaysOnTop??!1,titlebarHidden:Z.titlebarHidden??!1,systemTray:Z.systemTray??!1,hideDockIcon:Z.hideDockIcon??!1,devTools:Z.devTools??!1,nativeSidebar:Z.nativeSidebar??!1,sidebarWidth:Z.sidebarWidth,sidebarConfig:DJ(Z)}});return C.set($,{app:Q,url:J,options:Z}),await Q.show(),t($,Q)}catch{try{let{spawn:X}=await import("child_process"),Q=X(G,hJ(J,Z),{stdio:"inherit"});Q.on("error",(z)=>{console.error(z.code==="ENOENT"?ZJ(G):`craft child error: ${z.message}`)});let R={close:()=>Q.kill()};return C.set($,{app:R,url:J,options:Z}),t($,R)}catch(X){return console.error("Failed to spawn craft binary:",X.message),null}}}async function i8(J,Z={}){let $=`http://localhost:${J}/`;if(I.env.NODE_ENV==="test"||I.env.BUN_TEST)return console.warn("\u26A0 Skipping native window in test environment"),console.log("(Skipping browser fallback in test environment)"),!1;try{let{createApp:X}=await import("./chunk-vw8rwv6e.js");console.log("\u26A1 Opening native window via craft-native\u2026");let Q=!Z.nativeSidebar,R=DJ(Z),z=X({url:$,craftPath:s(),window:{title:Z.title||"stx Development",width:Z.width||1400,height:Z.height||900,resizable:!0,systemTray:Q,darkMode:Z.darkMode??!0,hotReload:Z.hotReload??!0,devTools:!0,titlebarHidden:Z.titlebarHidden??!1,nativeSidebar:Z.nativeSidebar??!1,sidebarWidth:Z.sidebarWidth??260,sidebarConfig:R}}),K=`dev-window-${J}`;return C.set(K,{app:z,url:$,options:Z}),await z.show(),console.log(`\u2713 Native window opened at ${$}`),!0}catch{let X=s();try{console.log(`\u26A1 Opening native window via craft binary (${X})\u2026`);let{spawn:Q}=await import("child_process"),R=Q(X,hJ($,{title:"stx Development",width:1400,height:900,hotReload:!0,...Z}),{stdio:"inherit"});R.on("exit",()=>I.exit(0)),R.on("error",(K)=>{console.warn(K.code==="ENOENT"?ZJ(X):`craft child error: ${K.message}`)});let z=`dev-window-${J}`;return C.set(z,{app:{close:()=>R.kill()},url:$,options:Z}),console.log(`\u2713 Native window opened at ${$}`),!0}catch(Q){console.warn("\u26A0 Could not spawn craft binary:",Q.message)}if(I.env.NODE_ENV==="test"||I.env.BUN_TEST)return console.log("(Skipping browser fallback in test environment)"),!1;console.log("\uD83D\uDCF1 Opening in browser instead\u2026");try{let{spawn:Q}=await import("child_process"),R=I.platform;return Q(R==="darwin"?"open":R==="win32"?"cmd":"xdg-open",R==="win32"?["/c","start",$]:[$],{detached:!0,stdio:"ignore"}).unref(),console.log(`\u2713 Browser opened at ${$}`),!0}catch(Q){return console.error("Could not open browser:",Q),console.log(`Please open manually: ${$}`),!1}}}async function s8(J,Z={}){let{title:$="stx Desktop",width:G=1200,height:X=800,darkMode:Q=!1,hotReload:R=!1,resizable:z=!0,frameless:K=!1,alwaysOnTop:j=!1}=Z;try{let{createApp:O}=await import("./chunk-vw8rwv6e.js"),q=s(),F=O({html:J,craftPath:q,window:{title:$,width:G,height:X,darkMode:Q,hotReload:R,resizable:z,frameless:K,alwaysOnTop:j}}),V=`craft-window-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return C.set(V,{app:F,url:"html-content",options:Z}),await F.show(),t(V,F)}catch(O){return console.error("Failed to create window with HTML:",O),null}}function t8(){try{return QZ.resolve("craft-native"),!0}catch{return!1}}function e8(){return`
825
- // STX Desktop Window Bridge
826
- // Provides convenient wrappers around window.craft APIs
827
- window.stxWindow = {
828
- // Window control
829
- hide: () => window.craft?.window?.hide(),
830
- show: () => window.craft?.window?.show(),
831
- toggle: () => window.craft?.window?.toggle(),
832
- close: () => window.craft?.window?.close(),
833
- minimize: () => window.craft?.window?.minimize(),
834
- maximize: () => window.craft?.window?.maximize(),
835
- focus: () => window.craft?.window?.focus(),
836
- center: () => window.craft?.window?.center(),
837
- reload: () => window.craft?.window?.reload(),
838
- toggleFullscreen: () => window.craft?.window?.toggleFullscreen(),
839
-
840
- // Window properties
841
- setTitle: (title) => window.craft?.window?.setTitle({ title }),
842
- setSize: (width, height) => window.craft?.window?.setSize({ width, height }),
843
- setPosition: (x, y) => window.craft?.window?.setPosition({ x, y }),
844
- setAlwaysOnTop: (alwaysOnTop) => window.craft?.window?.setAlwaysOnTop({ alwaysOnTop }),
845
- setResizable: (resizable) => window.craft?.window?.setResizable({ resizable }),
846
- setOpacity: (opacity) => window.craft?.window?.setOpacity({ opacity }),
847
-
848
- // macOS-specific
849
- setVibrancy: (vibrancy) => window.craft?.window?.setVibrancy({ vibrancy }),
850
-
851
- // App control
852
- quit: () => window.craft?.app?.quit(),
853
- isDarkMode: () => window.craft?.app?.isDarkMode(),
854
- getLocale: () => window.craft?.app?.getLocale(),
855
-
856
- // Notifications
857
- notify: (options) => window.craft?.app?.notify(options),
858
-
859
- // Check if running in Craft
860
- isCraftAvailable: () => typeof window.craft !== 'undefined',
861
- };
862
-
863
- // Expose as global for backwards compatibility
864
- window.desktop = window.stxWindow;
865
- `}var xZ="update.json";function AZ(J,Z){return`https://github.com/${J}/releases/latest/download/${Z}`}function CZ(J,Z,$){return`https://github.com/${J}/releases/download/${Z}/${$}`}function G$(J){let{repository:Z,manifestAsset:$=xZ,...G}=J;return new fJ({...G,updateUrl:AZ(Z,$)})}function X$(J){let Z=J.tag??`v${J.version}`,$={};for(let[G,X]of Object.entries(J.artifacts)){if(!X)continue;$[G]={path:X,url:CZ(J.repository,Z,X.split("/").pop())}}return vJ({version:J.version,releaseNotes:J.releaseNotes,platforms:$})}var VJ=null,H=null;class cJ{_process;_startedAt;_endsAt;_options;_expireHandlers=[];_expireTimer=null;_stopped=!1;constructor(J,Z){this._process=J,this._options=Z,this._startedAt=new Date;let $=Z.duration;if($&&$>0){let G=$*60*1000;this._endsAt=new Date(this._startedAt.getTime()+G),this._expireTimer=setTimeout(()=>{this._stopped=!0;for(let X of this._expireHandlers)try{X()}catch{}},G)}else this._endsAt=null}get pid(){return this._process.pid}get startedAt(){return this._startedAt}get endsAt(){return this._endsAt}get options(){return{...this._options}}get isActive(){if(this._stopped)return!1;return this._process.exitCode===null}get remainingMs(){if(!this._endsAt)return null;let J=this._endsAt.getTime()-Date.now();return Math.max(0,J)}get elapsedMs(){return Date.now()-this._startedAt.getTime()}stop(){if(this._stopped)return;if(this._stopped=!0,this._expireTimer)clearTimeout(this._expireTimer),this._expireTimer=null;try{this._process.kill()}catch{}}onExpire(J){this._expireHandlers.push(J)}}function Y$(J={}){IZ();let{duration:Z,preventDisplaySleep:$=!0,preventIdleSleep:G=!0,preventSystemSleep:X=!0,preventDiskSleep:Q=!1,assertUserActivity:R=!0}=J,z=[];if($)z.push("-d");if(G)z.push("-i");if(X)z.push("-s");if(Q)z.push("-m");if(R)z.push("-u");let K=[...z];if(Z&&Z>0)K.push("-t",String(Z*60));let j=Bun.spawn(["/usr/bin/caffeinate",...K],{stdio:["ignore","ignore","ignore"]}),O=new cJ(j,J);return VJ=j,H=O,O}function IZ(J){if(J){if(J.stop(),H===J)VJ=null,H=null;return}if(H)H.stop();VJ=null,H=null}function Q$(){return H!==null&&H.isActive}function z$(){if(!H||!H.isActive)return{active:!1,instance:null,startedAt:null,endsAt:null,durationMinutes:null};let Z=H.options.duration;return{active:!0,instance:H,startedAt:H.startedAt,endsAt:H.endsAt,durationMinutes:Z&&Z>0?Z:-1}}function K$(J){let Z=J||H;if(!Z||!Z.isActive)return"0:00";let $=Z.remainingMs;if($===null)return"\u221E";let G=Math.ceil($/1000),X=Math.floor(G/3600),Q=Math.floor(G%3600/60),R=G%60;if(X>0)return`${X}:${String(Q).padStart(2,"0")}:${String(R).padStart(2,"0")}`;return`${Q}:${String(R).padStart(2,"0")}`}function R$(J){if(J<=0||J===-1)return"Indefinitely";if(J<60)return`${J} minutes`;if(J===60)return"1 hour";if(J%60===0)return`${J/60} hours`;let Z=Math.floor(J/60),$=J%60;return`${Z}h ${$}m`}function gZ(J){let Z=yZ(),$=vZ();switch(Z){case"darwin":return p($,"Library","Application Support",J);case"win32":return p(process.env.APPDATA||p($,"AppData","Roaming"),J);default:return p($,".config",J)}}class pJ{_defaults;_data;_path;_changeHandlers=new Map;_anyChangeHandlers=new Set;_watcher=null;_writeTimer=null;_writing=!1;constructor(J){this._defaults={...J.defaults};let Z=J.path?bZ(J.path):gZ(J.name);if(this._path=J.path||p(Z,"preferences.json"),!QJ(Z))wZ(Z,{recursive:!0});if(this._data=this._load(),J.watch!==!1)this._setupWatcher()}get path(){return this._path}get(J){if(J in this._data)return this._data[J];return this._defaults[J]}set(J,Z){let $=this.get(J);if(JSON.stringify($)===JSON.stringify(Z))return;this._data[J]=Z,this._scheduleSave(),this._notifyChange(J,Z,$)}getAll(){return{...this._defaults,...this._data}}has(J){return J in this._data}delete(J){if(!(J in this._data))return;let Z=this._data[J];delete this._data[J],this._scheduleSave(),this._notifyChange(J,this._defaults[J],Z)}reset(){let J={...this._data};this._data={},this._save();for(let Z of Object.keys(J)){let $=this._defaults[Z];this._notifyChange(Z,$,J[Z])}}onChange(J,Z){let $=J;if(!this._changeHandlers.has($))this._changeHandlers.set($,new Set);return this._changeHandlers.get($).add(Z),()=>{this._changeHandlers.get($)?.delete(Z)}}onAnyChange(J){return this._anyChangeHandlers.add(J),()=>{this._anyChangeHandlers.delete(J)}}close(){if(this._watcher)this._watcher.close(),this._watcher=null;if(this._writeTimer)clearTimeout(this._writeTimer),this._writeTimer=null,this._save()}_load(){try{if(QJ(this._path)){let J=SZ(this._path,"utf-8");return JSON.parse(J)}}catch{}return{}}_save(){this._writing=!0;try{let J=JSON.stringify({...this._defaults,...this._data},null,2);fZ(this._path,J,"utf-8")}catch(J){console.error(`Failed to save preferences to ${this._path}:`,J)}finally{setTimeout(()=>{this._writing=!1},100)}}_scheduleSave(){if(this._writeTimer)clearTimeout(this._writeTimer);this._writeTimer=setTimeout(()=>{this._writeTimer=null,this._save()},50)}_setupWatcher(){try{if(!QJ(this._path))this._save();this._watcher=BZ(this._path,()=>{if(this._writing)return;let J=this._load(),Z={...this._data};this._data=J;let $=new Set([...Object.keys(Z),...Object.keys(J)]);for(let G of $){let X=G in Z?Z[G]:this._defaults[G],Q=G in J?J[G]:this._defaults[G];if(JSON.stringify(X)!==JSON.stringify(Q))this._notifyChange(G,Q,X)}})}catch{}}_notifyChange(J,Z,$){let G=this._changeHandlers.get(J);if(G)for(let X of G)try{X(Z,$)}catch{}for(let X of this._anyChangeHandlers)try{X(J,Z,$)}catch{}}}function q$(J){return new pJ(J)}function oJ(J){let Z=J.toLowerCase().replace(/[^a-z0-9]/g,"-");return h(YJ(),"Library","LaunchAgents",`com.${Z}.plist`)}function aJ(J){let Z=process.env.XDG_CONFIG_HOME||h(YJ(),".config");return h(Z,"autostart",`${J.toLowerCase()}.desktop`)}async function mZ(J,Z){let $=Z.appName||"StxApp",G=oJ($),X=h(YJ(),"Library","LaunchAgents");if(J){let Q=Z.appPath||process.execPath,R=Z.args||[],z=[Q,...R],K=`<?xml version="1.0" encoding="UTF-8"?>
866
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
867
- <plist version="1.0">
868
- <dict>
869
- <key>Label</key>
870
- <string>com.${$.toLowerCase().replace(/[^a-z0-9]/g,"-")}</string>
871
- <key>ProgramArguments</key>
872
- <array>
873
- ${z.map((j)=>` <string>${lZ(j)}</string>`).join(`
874
- `)}
875
- </array>
876
- <key>RunAtLoad</key>
877
- <true/>
878
- <key>KeepAlive</key>
879
- <false/>
880
- ${Z.isHidden?` <key>ProcessType</key>
881
- <string>Background</string>`:""}
882
- </dict>
883
- </plist>`;if(!m(X))lJ(X,{recursive:!0});nJ(G,K,"utf-8")}else if(m(G))dJ(G)}async function hZ(J,Z){let $=Z.appName||"StxApp",G=aJ($),X=h(process.env.XDG_CONFIG_HOME||h(YJ(),".config"),"autostart");if(J){let Q=Z.appPath||process.execPath,R=Z.args||[],z=[Q,...R].join(" "),K=`[Desktop Entry]
884
- Type=Application
885
- Name=${$}
886
- Exec=${z}
887
- Terminal=false
888
- StartupNotify=false
889
- ${Z.isHidden?`X-GNOME-Autostart-enabled=true
890
- NoDisplay=true`:""}
891
- `;if(!m(X))lJ(X,{recursive:!0});nJ(G,K,"utf-8")}else if(m(G))dJ(G)}async function cZ(J){return m(oJ(J))}async function pZ(J){let Z=aJ(J);if(!m(Z))return!1;try{let $=uZ(Z,"utf-8");if($.includes("X-GNOME-Autostart-enabled=false"))return!1;if($.includes("Hidden=true"))return!1;return!0}catch{return!1}}function lZ(J){return J.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}async function P$(J,Z={}){let $=rJ();switch($){case"darwin":return mZ(J,Z);case"linux":return hZ(J,Z);default:throw Error(`Auto-launch is not yet supported on ${$}`)}}async function W$(J){let Z=J||"StxApp";switch(rJ()){case"darwin":return cZ(Z);case"linux":return pZ(Z);default:return!1}}var B=new Map,dZ=0,e=!1;function nZ(J){let Z=J.split("+").map((G)=>G.trim()),$={key:"",meta:!1,ctrl:!1,shift:!1,alt:!1};for(let G of Z){let X=G.toLowerCase();switch(X){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=X}}return $}function D$(J){let Z=[];if(J.ctrl)Z.push("\u2303");if(J.alt)Z.push("\u2325");if(J.shift)Z.push("\u21E7");if(J.meta)Z.push("\u2318");return Z.push(J.key.toUpperCase()),Z.join("")}function rZ(J,Z){if(Z.meta!==J.metaKey)return!1;if(Z.ctrl!==J.ctrlKey)return!1;if(Z.shift!==J.shiftKey)return!1;if(Z.alt!==J.altKey)return!1;return J.key.toLowerCase()===Z.key||J.code.toLowerCase()===`key${Z.key}`}function iJ(J){for(let[,Z]of B)if(rZ(J,Z.parsed)){J.preventDefault(),J.stopPropagation();try{Z.handler()}catch{}break}}function oZ(){if(e)return;if(typeof document>"u")return;document.addEventListener("keydown",iJ,!0),e=!0}function LJ(){if(!e)return;if(typeof document>"u")return;document.removeEventListener("keydown",iJ,!0),e=!1}async function aZ(J,Z){if(typeof window>"u")return!1;let $=window.craft;if(!$?.hotkeys?.register)return!1;try{return await $.hotkeys.register(J,Z),!0}catch{return!1}}async function NJ(J){if(typeof window>"u")return;let Z=window.craft;if(!Z?.hotkeys?.unregister)return;try{await Z.hotkeys.unregister(J)}catch{}}function L$(J,Z){let $=`hotkey_${++dZ}_${Date.now()}`,G=nZ(J);B.set($,{shortcut:J,handler:Z,parsed:G}),aZ($,J),oZ();let X={shortcut:J,id:$,unregister(){iZ(X)}};return X}function iZ(J){if(B.delete(J.id),NJ(J.id),B.size===0)LJ()}function N$(){for(let[J]of B)NJ(J);B.clear(),LJ()}function k$(){return Array.from(B.entries()).map(([J,Z])=>({shortcut:Z.shortcut,id:J,unregister(){if(B.delete(J),NJ(J),B.size===0)LJ()}}))}class sJ{_duration;_tickInterval;_remaining;_running=!1;_paused=!1;_complete=!1;_intervalId=null;_lastTick=0;_completionHandlers=new Set;_tickHandlers=new Set;constructor(J){if(this._duration=J.duration,this._tickInterval=J.tickInterval||1000,this._remaining=J.duration,J.onComplete)this._completionHandlers.add(J.onComplete);if(J.onTick)this._tickHandlers.add(J.onTick);if(J.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 J=Date.now()-this._lastTick;return Math.max(0,this._remaining-J)}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 J=Date.now()-this._lastTick;this._remaining=Math.max(0,this._remaining-J),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(J){return this._completionHandlers.add(J),()=>{this._completionHandlers.delete(J)}}onTick(J){return this._tickHandlers.add(J),()=>{this._tickHandlers.delete(J)}}_startInterval(){this._clearInterval(),this._intervalId=setInterval(()=>{let J=Date.now(),Z=J-this._lastTick;this._lastTick=J,this._remaining=Math.max(0,this._remaining-Z);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 tJ{_interval;_handler;_immediate;_running=!1;_intervalId=null;constructor(J){if(this._interval=J.interval,this._handler=J.handler,this._immediate=J.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 T$(J){return new sJ(J)}function M$(J){return new tJ(J)}function E$(J){return new Promise((Z)=>setTimeout(Z,J))}function H$(J){let Z=Math.ceil(J/1000),$=Math.floor(Z/3600),G=Math.floor(Z%3600/60),X=Z%60;if($>0)return`${$}:${String(G).padStart(2,"0")}:${String(X).padStart(2,"0")}`;return`${G}:${String(X).padStart(2,"0")}`}function x$(J){let Z=Math.ceil(J/1000),$=Math.floor(Z/3600),G=Math.floor(Z%3600/60),X=Z%60;if($>0){if(G>0)return`${$}h ${G}m`;return`${$}h`}if(G>0){if(X>0)return`${G}m ${X}s`;return`${G}m`}return`${X}s`}function Y(J){if(typeof window>"u")return!1;let Z=window.craft;return!!(Z&&Z[J])}function N(J){if(!Y(J))throw Error(`craft.${J} is not available \u2014 this API requires a Craft native window`);return window.craft[J]}function P(J,Z){if(typeof window>"u")return()=>{};let $=(G)=>Z(G.detail??{});return window.addEventListener(J,$),()=>window.removeEventListener(J,$)}var A$={async writeText(J){if(Y("clipboard")){await window.craft.clipboard.writeText(J);return}if(typeof navigator<"u"&&navigator.clipboard)await navigator.clipboard.writeText(J)},async readText(){if(Y("clipboard")){let J=await window.craft.clipboard.readText();return typeof J==="string"?J:""}if(typeof navigator<"u"&&navigator.clipboard?.readText)try{return await navigator.clipboard.readText()}catch{return""}return""},async writeHTML(J){if(Y("clipboard")){await window.craft.clipboard.writeHTML(J);return}if(typeof navigator<"u"&&navigator.clipboard?.write)try{let Z=new window.ClipboardItem({"text/html":new Blob([J],{type:"text/html"}),"text/plain":new Blob([sZ(J)],{type:"text/plain"})});await navigator.clipboard.write([Z])}catch{}},async readHTML(){if(Y("clipboard")){let J=await window.craft.clipboard.readHTML();return typeof J==="string"?J:""}if(typeof navigator<"u"&&navigator.clipboard?.read)try{let J=await navigator.clipboard.read();for(let Z of J)if(Z.types.includes("text/html"))return await(await Z.getType("text/html")).text()}catch{}return""},async clear(){if(Y("clipboard")){await window.craft.clipboard.clear();return}if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{await navigator.clipboard.writeText("")}catch{}},async hasText(){if(Y("clipboard"))return await window.craft.clipboard.hasText();return(await this.readText()).length>0},async hasHTML(){if(Y("clipboard"))return await window.craft.clipboard.hasHTML();return(await this.readHTML()).length>0},async hasImage(){if(Y("clipboard"))return await window.craft.clipboard.hasImage();return!1}};function sZ(J){return J.replace(/<(script|style)[^>]*>[\s\S]*?<\/\1>/gi,"").replace(/<\/?(br|p|div|li|h[1-6])\b[^>]*>/gi,`
892
- `).replace(/<[^>]+>/g,"").replace(/&nbsp;/g," ").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/\n{3,}/g,`
893
-
894
- `).trim()}var C$={async show(J){if(!J.title)throw Error("notification title is required");if(Y("notifications")){await window.craft.notifications.show(J);return}if(typeof window<"u"&&"Notification"in window){let Z=window.Notification;if(Z.permission==="granted")new Z(J.title,{body:J.body,icon:J.icon});else if(Z.permission==="default"){if(await Z.requestPermission()==="granted")new Z(J.title,{body:J.body,icon:J.icon})}}},async schedule(J){if(Y("notifications")){let G={...J};if(G.triggerAt instanceof Date)G.triggerAt=G.triggerAt.toISOString();await window.craft.notifications.schedule(G);return}let Z=tZ(J.triggerAt),$=Math.max(0,Z-Date.now());setTimeout(()=>{this.show(J).catch(()=>{})},$)},async cancel(J){if(Y("notifications"))await window.craft.notifications.cancel(J)},async cancelAll(){if(Y("notifications"))await window.craft.notifications.cancelAll()},async setBadge(J){let Z=Math.max(0,Math.round(Number.isFinite(J)?J:0));if(Y("notifications")){await window.craft.notifications.setBadge(Z);return}if(typeof navigator<"u"&&navigator.setAppBadge)try{await navigator.setAppBadge(Z)}catch{}},async clearBadge(){if(Y("notifications")){await window.craft.notifications.clearBadge();return}if(typeof navigator<"u"&&navigator.clearAppBadge)try{await navigator.clearAppBadge()}catch{}},async requestPermission(){if(Y("notifications"))return await window.craft.notifications.requestPermission();if(typeof window<"u"&&"Notification"in window){let J=window.Notification;if(J.permission==="granted")return!0;if(J.permission==="denied")return!1;return await J.requestPermission()==="granted"}return!1},async registerCategories(J){if(!Array.isArray(J)||J.length===0)return;if(Y("notifications")){let Z=window.craft.notifications.registerCategories;if(typeof Z==="function")await Z(J)}},onActionClicked(J){return P("craft:notification:actionClicked",J)},onReply(J){return P("craft:notification:reply",J)}};function tZ(J){if(J==null)return Date.now();if(J instanceof Date)return J.getTime();if(typeof J==="number")return J;let Z=Date.parse(J);return Number.isNaN(Z)?Date.now():Z}var I$={async readFile(J){let Z=await N("fs").readFile(J);return Z&&Z.data||""},async readBuffer(J){let Z=await N("fs").readFile(J),$=Z&&Z.data||"";if(Z&&Z.base64===!0)return J0($);return new TextEncoder().encode($)},async writeFile(J,Z){await N("fs").writeFile(J,Z)},async writeBuffer(J,Z){let $=eZ(Z),G=N("fs");if(typeof G.writeFileBytes==="function")await G.writeFileBytes(J,$);else await G.writeFile(J,$)},async copy(J,Z){if(J===Z)throw Error("fs.copy: source and destination must differ");await N("fs").copy(J,Z)},async move(J,Z){if(J===Z)throw Error("fs.move: source and destination must differ");await N("fs").move(J,Z)},async appendFile(J,Z){await N("fs").appendFile(J,Z)},async deleteFile(J){await N("fs").deleteFile(J)},async exists(J){return await N("fs").exists(J)},async stat(J){return Z0(await N("fs").stat(J))},async readDir(J){let Z=await N("fs").readDir(J),$=Z&&Z.entries||[],G=J.endsWith("/")?J.slice(0,-1):J;return $.map((X)=>({name:X.name,path:`${G}/${X.name}`,isDirectory:!!X.isDirectory}))},async mkdir(J,Z){await N("fs").mkdir(J,Z)},async rmdir(J,Z){await N("fs").rmdir(J,Z)},async watch(J,Z){await N("fs").watch(J,Z)},async unwatch(J){await N("fs").unwatch(J)},onChange(J){return P("craft:fs:change",J)},async watchTree(J,Z,$){let G=`watch-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,X=N("fs");await X.watch(J,G,{recursive:!!Z.recursive});let Q=Z.kinds&&Z.kinds.length>0?new Set(Z.kinds):null,R=Math.max(0,Math.floor(Z.coalesceMs??0)),z=[],K=null,j=!1,O=()=>{if(K=null,z.length===0)return;let F=z;z=[];try{$(F)}catch{}},q=P("craft:fs:change",(F)=>{if(j)return;if(F.id!==G)return;if(Q&&F.kind&&!Q.has(F.kind))return;if(z.push(F),R===0){O();return}if(K==null)K=setTimeout(O,R)});return{id:G,async stop(){if(j)return;if(j=!0,q(),K)clearTimeout(K),K=null;if(z.length>0)O();try{await X.unwatch(G)}catch{}}}},async homeDir(){return await N("fs").homeDir()},async tempDir(){return await N("fs").tempDir()},async appDataDir(){return await N("fs").appDataDir()}};function eZ(J){let Z="";for(let $=0;$<J.length;$++)Z+=String.fromCharCode(J[$]);return typeof btoa==="function"?btoa(Z):Buffer.from(J).toString("base64")}function J0(J){let Z=typeof atob==="function"?atob(J):Buffer.from(J,"base64").toString("binary"),$=new Uint8Array(Z.length);for(let G=0;G<Z.length;G++)$[G]=Z.charCodeAt(G);return $}function Z0(J){return{isFile:!!J.isFile,isDirectory:!!J.isDirectory,isSymlink:!!J.isSymlink,size:Number(J.size)||0,modifiedAt:J.modifiedAt!=null?J.modifiedAt<1000000000000?J.modifiedAt*1000:J.modifiedAt:0}}var l=new Set,HJ=!1;function $0(){if(HJ)return;if(typeof window>"u"||typeof window.addEventListener!=="function")return;window.addEventListener("craft:shell:exit",(J)=>{let Z=J.detail;if(Z?.id)l.delete(Z.id)}),HJ=!0}var G0=new Set(["javascript:","data:","file:","vbscript:"]),w$={async openExternal(J){let Z=J.trim().toLowerCase();for(let $ of G0)if(Z.startsWith($))throw Error(`shell.openExternal: ${$} URLs are blocked for safety`);if(Y("shell")){await window.craft.shell.openExternal(J);return}if(typeof window<"u"&&typeof window.open==="function")window.open(J,"_blank","noopener,noreferrer")},async openPath(J){await N("shell").openPath(J)},async showInFinder(J){await N("shell").showInFinder(J)},async spawn(J,Z,$=[],G={}){if($0(),!J||typeof J!=="string")throw Error("shell.spawn: id must be a non-empty string");if(!Z||typeof Z!=="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 X of $)if(typeof X!=="string")throw Error("shell.spawn: args entries must be strings");if(l.has(J))throw Error(`shell.spawn: id "${J}" is already in use \u2014 call kill(id) first or pick a different id`);l.add(J);try{await N("shell").spawn(J,Z,$,G)}catch(X){throw l.delete(J),X}},async kill(J){await N("shell").kill(J),l.delete(J)},async getEnv(J){if(Y("shell")){let Z=await window.craft.shell.getEnv(J);return Z==null?void 0:String(Z)}return},async setEnv(J,Z){await N("shell").setEnv(J,Z)},onStdout(J){return P("craft:shell:stdout",J)},onStderr(J){return P("craft:shell:stderr",J)},onExit(J){return P("craft:shell:exit",J)}},S$={async register(J,Z,$){if(!Y("shortcuts"))return;await window.craft.shortcuts.register(J,Z,$)},async unregister(J){if(!Y("shortcuts"))return;await window.craft.shortcuts.unregister(J)},async unregisterAll(){if(!Y("shortcuts"))return;await window.craft.shortcuts.unregisterAll()},async enable(J){if(!Y("shortcuts"))return;await window.craft.shortcuts.enable(J)},async disable(J){if(!Y("shortcuts"))return;await window.craft.shortcuts.disable(J)},async isRegistered(J){if(!Y("shortcuts"))return!1;return await window.craft.shortcuts.isRegistered(J)},async list(){if(!Y("shortcuts"))return[];return await window.craft.shortcuts.list()},on(J){return P("craft:shortcut",J)}},B$={get(){if(Y("theme"))try{return window.craft.theme.get()}catch{}return{appearance:X0()}},onChange(J){if(J(this.get()),Y("theme"))return P("craft:theme",J);if(typeof window<"u"&&window.matchMedia){let Z=window.matchMedia("(prefers-color-scheme: dark)"),$=()=>J({appearance:Z.matches?"dark":"light"});return Z.addEventListener("change",$),()=>Z.removeEventListener("change",$)}return()=>{}},async current(){return this.get()}};function X0(){if(typeof window>"u"||!window.matchMedia)return"light";return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}async function f$(J,Z={}){if(!Y("dragOut"))throw Error("dragOut requires a Craft native window");let $=Array.isArray(J)?J:[J];if($.length===0)throw Error("dragOut: at least one path required");await window.craft.dragOut.start($,Z)}function v$(){return Y("dragOut")}var y$={onUrl(J){if(!Y("deepLink"))return()=>{};return P("craft:deepLink",J)},getInitialUrl(){if(typeof window>"u")return null;if(Y("deepLink"))try{return window.craft.deepLink.getInitialUrl()}catch{return null}return window.__craftPendingDeepLink||null},consumeInitialUrl(){let J=this.getInitialUrl();if(typeof window<"u")window.__craftPendingDeepLink=void 0;return J},isAvailable(){return Y("deepLink")}},b$={async isCharging(){if(Y("power"))return await window.craft.power.isCharging();let J=await r();return J?!!J.charging:!1},async isPluggedIn(){if(Y("power"))return await window.craft.power.isPluggedIn();let J=await r();return J?!!J.charging||J.level>=0.999:!1},async isLowPowerMode(){if(Y("power"))return await window.craft.power.isLowPowerMode();return!1},async level(){if(Y("power")){let Z=await window.craft.power.batteryLevel();return typeof Z==="number"?Z:null}let J=await r();return J?J.level:null},async timeRemaining(){if(Y("power")){let $=await window.craft.power.timeRemaining();return typeof $==="number"?$:null}let J=await r();if(!J)return null;let Z=J.charging?J.chargingTime:J.dischargingTime;return Number.isFinite(Z)?Math.round(Z/60):null},async thermalState(){if(Y("power"))return await window.craft.power.thermalState()||"unknown";return"unknown"},async uptimeSeconds(){if(Y("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(J="app is busy"){if(Y("power")){await window.craft.power.preventSleep(J);return}if(typeof navigator>"u"||!navigator.wakeLock)return;let Z=window;if(Z.__craftWebWakeLock?.release){try{await Z.__craftWebWakeLock.release()}catch{}Z.__craftWebWakeLock=null}try{let $=await navigator.wakeLock.request("screen");Z.__craftWebWakeLock=$}catch{}},async allowSleep(){if(Y("power")){await window.craft.power.allowSleep();return}let J=window.__craftWebWakeLock;if(J&&typeof J.release==="function"){try{await J.release()}catch{}window.__craftWebWakeLock=null}},onSleep(J){return P("craft:powerSleep",J)},onWake(J){return P("craft:powerWake",J)}};async function r(){if(typeof navigator>"u")return null;let J=navigator;if(typeof J.getBattery!=="function")return null;try{return await J.getBattery()}catch{return null}}var g$={async connectionType(){if(Y("network"))return await window.craft.network.connectionType();return xJ()},async wifiSSID(){if(Y("network"))return await window.craft.network.wifiSSID()||void 0;return},async wifiSignalStrength(){if(Y("network")){let J=await window.craft.network.wifiSignalStrength();return typeof J==="number"?J:void 0}return},async ipAddress(){if(Y("network"))return await window.craft.network.ipAddress();return""},async macAddress(){if(Y("network"))return await window.craft.network.macAddress();return""},async interfaces(){if(Y("network"))return await window.craft.network.interfaces();return[]},async isVPNConnected(){if(Y("network"))return await window.craft.network.isVPNConnected();return!1},async proxySettings(){if(Y("network"))return await window.craft.network.proxySettings()||{};return{}},async openPreferences(){if(Y("network"))await window.craft.network.openPreferences()},onChange(J){if(Y("network"))return P("craft:networkChange",J);if(typeof window>"u")return()=>{};let Z=()=>J({type:xJ(),online:!0}),$=()=>J({type:"none",online:!1});return window.addEventListener("online",Z),window.addEventListener("offline",$),()=>{window.removeEventListener("online",Z),window.removeEventListener("offline",$)}}};function xJ(){if(typeof navigator>"u")return"unknown";if(navigator.onLine===!1)return"none";let J=navigator.connection;if(!J)return"unknown";let Z=String(J.type||J.effectiveType||"unknown").toLowerCase();if(Z==="wifi"||Z==="cellular"||Z==="ethernet"||Z==="bluetooth"||Z==="none")return Z;return"unknown"}var u$={async checkForUpdates(){if(!Y("updater"))return;await window.craft.updater.checkForUpdates()},async checkInBackground(){if(!Y("updater"))return;await window.craft.updater.checkInBackground()},async setAutomaticChecks(J){if(!Y("updater"))return;await window.craft.updater.setAutomaticChecks(J)},async setCheckInterval(J){if(!Y("updater"))return;if(!Number.isFinite(J))throw Error("setCheckInterval: must be a finite number");let Z=J<=0?0:Math.max(60,Math.round(J));await window.craft.updater.setCheckInterval(Z)},async setFeedURL(J){if(!Y("updater"))return;await window.craft.updater.setFeedURL(J)},async getLastUpdateCheckDate(){if(!Y("updater"))return null;return await window.craft.updater.getLastUpdateCheckDate()||null},async getUpdateInfo(){if(!Y("updater"))return null;let J=await window.craft.updater.getUpdateInfo();if(!J||typeof J.version!=="string"||J.version.length===0)return null;return J},onAvailable(J){return P("craft:updateAvailable",J)},onDownloaded(J){return P("craft:updateDownloaded",J)},async verifySignature({payload:J,signatureB64:Z,publicKeyB64:$}){let G=AJ(J),X;try{X=await crypto.subtle.importKey("raw",o($),{name:"Ed25519"},!1,["verify"])}catch{return!1}try{return await crypto.subtle.verify("Ed25519",X,o(Z),G)}catch{return!1}},async verifyDownload({url:J,signatureB64:Z,publicKeyB64:$,fetchInit:G}){let X;try{X=await fetch(J,G)}catch{return{ok:!1,reason:"fetch-failed"}}if(!X.ok)return{ok:!1,reason:"http-error",status:X.status};let Q=new Uint8Array(await X.arrayBuffer()),R;try{R=await crypto.subtle.importKey("raw",o($),{name:"Ed25519"},!1,["verify"])}catch{return{ok:!1,reason:"bad-key"}}let z=!1;try{z=await crypto.subtle.verify("Ed25519",R,o(Z),AJ(Q))}catch{z=!1}if(!z)return{ok:!1,reason:"bad-signature"};return{ok:!0,payload:Q}}};function AJ(J){if(J instanceof ArrayBuffer)return new Uint8Array(J);let Z=new ArrayBuffer(J.byteLength),$=new Uint8Array(Z);return $.set(J),$}function o(J){if(typeof atob==="function"){let G=atob(J),X=new ArrayBuffer(G.length),Q=new Uint8Array(X);for(let R=0;R<G.length;R++)Q[R]=G.charCodeAt(R);return Q}let Z=Buffer.from(J,"base64"),$=new ArrayBuffer(Z.length);return new Uint8Array($).set(Z),new Uint8Array($)}var m$={onFocus(J){if(Y("window"))return P("craft:window:focus",()=>J());return zJ("focus",J)},onBlur(J){if(Y("window"))return P("craft:window:blur",()=>J());return zJ("blur",J)},onResize(J){if(Y("window"))return P("craft:window:resize",J);if(typeof window>"u")return()=>{};let Z=()=>J({width:window.innerWidth,height:window.innerHeight});return window.addEventListener("resize",Z),()=>window.removeEventListener("resize",Z)},onMove(J){if(Y("window"))return P("craft:window:move",J);return()=>{}},onClose(J){if(Y("window"))return P("craft:window:close",()=>J());return zJ("beforeunload",J)},onMinimize(J){if(Y("window"))return P("craft:window:minimize",()=>J());if(typeof document>"u")return()=>{};let Z=()=>{if(document.visibilityState==="hidden")J()};return document.addEventListener("visibilitychange",Z),()=>document.removeEventListener("visibilitychange",Z)},onRestore(J){if(Y("window"))return P("craft:window:restore",()=>J());if(typeof document>"u")return()=>{};let Z=()=>{if(document.visibilityState==="visible")J()};return document.addEventListener("visibilitychange",Z),()=>document.removeEventListener("visibilitychange",Z)}};function zJ(J,Z){if(typeof window>"u")return()=>{};let $=()=>Z();return window.addEventListener(J,$),()=>window.removeEventListener(J,$)}var CJ={name:"",version:"0.0.0"},h$={async hideDockIcon(){if(Y("app"))await window.craft.app.hideDockIcon()},async showDockIcon(){if(Y("app"))await window.craft.app.showDockIcon()},async quit(){if(Y("app"))await window.craft.app.quit()},async getInfo(){if(!Y("app"))return CJ;let J=await window.craft.app.getInfo();return{...CJ,...J||{}}},async notify(J){if(!J.title)throw Error("notify: title is required");if(Y("app"))await window.craft.app.notify(J)},async setBadge(J){if(Y("app"))await window.craft.app.setBadge(J)},async bounce(J="informational"){if(Y("app"))await window.craft.app.bounce(J)}},c$={async set(J){if(Y("menu"))await window.craft.menu.set(J)},async setDock(J){if(Y("menu"))await window.craft.menu.setDock(J)},async addItem(J,Z){if(Y("menu"))await window.craft.menu.addItem(J,Z)},async removeItem(J){if(Y("menu"))await window.craft.menu.removeItem(J)},async enableItem(J){if(Y("menu"))await window.craft.menu.enableItem(J)},async disableItem(J){if(Y("menu"))await window.craft.menu.disableItem(J)},async checkItem(J){if(Y("menu"))await window.craft.menu.checkItem(J)},async uncheckItem(J){if(Y("menu"))await window.craft.menu.uncheckItem(J)},async setItemLabel(J,Z){if(Y("menu"))await window.craft.menu.setItemLabel(J,Z)},async clearDock(){if(Y("menu"))await window.craft.menu.clearDock()},onAction(J){return P("craft:menu:action",J)}},p$={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 J=new Intl.DateTimeFormat([],{hour:"numeric"}).resolvedOptions();return J.hourCycle==="h23"||J.hourCycle==="h24"}catch{return!1}}),reduceMotion:()=>x("system","reduceMotion",()=>KJ("(prefers-reduced-motion: reduce)")),reduceTransparency:()=>x("system","reduceTransparency",()=>KJ("(prefers-reduced-transparency: reduce)")),increaseContrast:()=>x("system","increaseContrast",()=>KJ("(prefers-contrast: more)")),systemVersion:()=>x("system","systemVersion",()=>""),hostname:()=>x("system","hostname",()=>""),username:()=>x("system","username",()=>""),async openPreferences(){if(Y("system"))await window.craft.system.openPreferences()}};async function x(J,Z,$){if(Y(J))return await window.craft[J][Z]();return await $()}function KJ(J){if(typeof window>"u"||!window.matchMedia)return!1;return window.matchMedia(J).matches}var l$={async getDisplays(){if(Y("screen"))return await window.craft.screen.getDisplays();return IJ()},async getPrimary(){if(Y("screen")){let J=await window.craft.screen.getPrimary();return J&&typeof J.width==="number"?J:null}return IJ()[0]??null},onChange(J){if(Y("screen"))return P("craft:screen:change",()=>J());if(typeof window>"u")return()=>{};let Z=()=>J();return window.addEventListener("resize",Z),()=>window.removeEventListener("resize",Z)}};function IJ(){if(typeof window>"u"||!window.screen)return[];let J=window.screen;return[{id:0,x:J.left??0,y:J.top??0,width:J.width||0,height:J.height||0,workX:J.availLeft??0,workY:J.availTop??0,workWidth:J.availWidth??J.width??0,workHeight:J.availHeight??J.height??0,scaleFactor:window.devicePixelRatio||1}]}var d$={async set(J,Z,$){if(!J)throw Error("keychain.set: service is required");if(!Z)throw Error("keychain.set: account is required");await N("keychain").set(J,Z,$)},async get(J,Z){if(!J)throw Error("keychain.get: service is required");if(!Z)throw Error("keychain.get: account is required");let $=await N("keychain").get(J,Z);return typeof $==="string"?$:null},async delete(J,Z){if(!J)throw Error("keychain.delete: service is required");if(!Z)throw Error("keychain.delete: account is required");await N("keychain").delete(J,Z)},async has(J,Z){if(!J)throw Error("keychain.has: service is required");if(!Z)throw Error("keychain.has: account is required");return await N("keychain").has(J,Z)}},n$={async check(J){if(Y("permissions"))return await window.craft.permissions.check(J);return await eJ(J)},async request(J){if(Y("permissions"))return await window.craft.permissions.request(J);return await Y0(J)},async openSettings(J){if(Y("permissions"))await window.craft.permissions.openSettings(J)}};async function eJ(J){if(typeof navigator>"u"||!navigator.permissions?.query)return"not-supported";try{let Z=await navigator.permissions.query({name:J});return Q0(Z.state)}catch{return"not-supported"}}async function Y0(J){if(J==="notifications"&&typeof window<"u"&&"Notification"in window){let Z=await window.Notification.requestPermission();return Z==="granted"?"granted":Z==="denied"?"denied":"undetermined"}return await eJ(J)}function Q0(J){if(J==="granted")return"granted";if(J==="denied")return"denied";if(J==="prompt")return"undetermined";return"undetermined"}var r$={async print(){if(Y("printing")){await window.craft.printing.print();return}if(typeof window<"u"&&typeof window.print==="function")window.print()},async printToPDF(J){if(!J)throw Error("printToPDF: path is required");let Z=J.startsWith("/"),$=/^[a-zA-Z]:[\\/]/.test(J)||J.startsWith("\\\\");if(!Z&&!$)throw Error("printToPDF: path must be absolute");let G=await N("printing").printToPDF(J);return{ok:!!(G&&G.ok),path:G?.path}}},o$={async enable(){if(!Y("autoLaunch"))return!1;return await window.craft.autoLaunch.enable()},async disable(){if(!Y("autoLaunch"))return!1;return await window.craft.autoLaunch.disable()},async isEnabled(){if(!Y("autoLaunch"))return!1;return await window.craft.autoLaunch.isEnabled()}},a$={async addItem(J){if(Y("touchbar"))await window.craft.touchbar.addItem(J)},async removeItem(J){if(Y("touchbar"))await window.craft.touchbar.removeItem(J)},async updateItem(J,Z){if(Y("touchbar"))await window.craft.touchbar.updateItem(J,Z)},async setLabel(J,Z){if(Y("touchbar"))await window.craft.touchbar.setLabel(J,Z)},async setIcon(J,Z){if(Y("touchbar"))await window.craft.touchbar.setIcon(J,Z)},async setEnabled(J,Z){if(Y("touchbar"))await window.craft.touchbar.setEnabled(J,Z)},async setSliderValue(J,Z){if(Y("touchbar"))await window.craft.touchbar.setSliderValue(J,Z)},async clear(){if(Y("touchbar"))await window.craft.touchbar.clear()},async show(){if(Y("touchbar"))await window.craft.touchbar.show()},async hide(){if(Y("touchbar"))await window.craft.touchbar.hide()},onAction(J){return P("craft:touchbar:action",J)}},z0=/^[\da-f]*$/i;function K0(J,Z){if(typeof Z!=="string"||!z0.test(Z)||Z.length%2!==0)throw Error(`${J}: must be a hex string with even length, got ${JSON.stringify(Z)}`)}var i$={async isEnabled(){return Y("bluetooth")?await window.craft.bluetooth.isEnabled():!1},async powerState(){return Y("bluetooth")?await window.craft.bluetooth.powerState():"unknown"},async connectedDevices(){return Y("bluetooth")?await window.craft.bluetooth.connectedDevices():[]},async pairedDevices(){return Y("bluetooth")?await window.craft.bluetooth.pairedDevices():[]},async startDiscovery(){if(Y("bluetooth"))await window.craft.bluetooth.startDiscovery()},async stopDiscovery(){if(Y("bluetooth"))await window.craft.bluetooth.stopDiscovery()},async isDiscovering(){return Y("bluetooth")?await window.craft.bluetooth.isDiscovering():!1},async connect(J){if(Y("bluetooth"))await window.craft.bluetooth.connect(J)},async disconnect(J){if(Y("bluetooth"))await window.craft.bluetooth.disconnect(J)},async openPreferences(){if(Y("bluetooth"))await window.craft.bluetooth.openPreferences()},async discoverServices(J){if(!J)throw Error("bluetooth.discoverServices: deviceId is required");if(!Y("bluetooth"))return[];let Z=await window.craft.bluetooth.discoverServices(J);return Array.isArray(Z)?Z:[]},async discoverCharacteristics(J,Z){if(!J||!Z)throw Error("bluetooth.discoverCharacteristics: deviceId and serviceUuid are required");if(!Y("bluetooth"))return[];let $=await window.craft.bluetooth.discoverCharacteristics(J,Z);return Array.isArray($)?$:[]},async readCharacteristic(J,Z,$){if(!J||!Z||!$)throw Error("bluetooth.readCharacteristic: deviceId, serviceUuid, characteristicUuid are required");if(!Y("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.readCharacteristic(J,Z,$)},async writeCharacteristic(J,Z,$,G,X="with-response"){if(!J||!Z||!$)throw Error("bluetooth.writeCharacteristic: deviceId, serviceUuid, characteristicUuid are required");if(K0("bluetooth.writeCharacteristic.valueHex",G),!Y("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.writeCharacteristic(J,Z,$,G,X)},async setCharacteristicNotify(J,Z,$,G){if(!J||!Z||!$)throw Error("bluetooth.setCharacteristicNotify: deviceId, serviceUuid, characteristicUuid are required");if(!Y("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.setCharacteristicNotify(J,Z,$,G)},onDeviceFound(J){return P("craft:bluetooth:deviceFound",J)},onDeviceConnected(J){return P("craft:bluetooth:deviceConnected",J)},onDeviceDisconnected(J){return P("craft:bluetooth:deviceDisconnected",J)},onCharacteristicValue(J){return P("craft:bluetooth:characteristicValue",J)}},s$={async speak(J,Z){if(!J)throw Error("speech.speak: text is required");if(Y("speech")){await window.craft.speech.speak(J,Z);return}if(typeof window<"u"&&window.speechSynthesis){let $=new window.SpeechSynthesisUtterance(J);if(Z){if(Z.rate!=null)$.rate=Z.rate;if(Z.pitch!=null)$.pitch=Z.pitch;if(Z.volume!=null)$.volume=Z.volume;if(Z.voice){let X=window.speechSynthesis.getVoices().find((Q)=>Q.voiceURI===Z.voice||Q.name===Z.voice||Q.lang===Z.voice);if(X)$.voice=X}}window.speechSynthesis.speak($)}},async stop(){if(Y("speech")){await window.craft.speech.stop();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.cancel()},async pause(){if(Y("speech")){await window.craft.speech.pause();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.pause()},async resume(){if(Y("speech")){await window.craft.speech.resume();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.resume()},async isSpeaking(){if(Y("speech"))return await window.craft.speech.isSpeaking();if(typeof window<"u"&&window.speechSynthesis)return!!window.speechSynthesis.speaking;return!1},async getVoices(){if(Y("speech"))return await window.craft.speech.getVoices();if(typeof window<"u"&&window.speechSynthesis)return window.speechSynthesis.getVoices().map((Z)=>({id:Z.voiceURI||Z.name,name:Z.name,language:Z.lang||"",quality:"default"}));return[]}},c=[],RJ=!0,jJ,FJ,JJ={async report(J){if(Y("crashReporter")){await window.craft.crashReporter.report(J);return}if(!RJ)return;let Z=J instanceof Error?{timestamp:Date.now(),severity:"error",message:J.message,source:"js",stack:J.stack||"",userId:jJ,appVersion:FJ}:{timestamp:Date.now(),severity:J.severity||"error",message:J.message||"",source:J.source||"js",stack:J.stack||"",userId:jJ,appVersion:FJ};if(c.length>=64)c.shift();c.push(Z)},async flush(){if(Y("crashReporter"))return await window.craft.crashReporter.flush();return[...c]},async clear(){if(Y("crashReporter")){await window.craft.crashReporter.clear();return}c.length=0},async setEnabled(J){if(Y("crashReporter")){await window.craft.crashReporter.setEnabled(J);return}RJ=J},async isEnabled(){if(Y("crashReporter"))return await window.craft.crashReporter.isEnabled();return RJ},async setUser(J){if(Y("crashReporter")){await window.craft.crashReporter.setUser(J);return}jJ=J||void 0},async setAppVersion(J){if(Y("crashReporter")){await window.craft.crashReporter.setAppVersion(J);return}FJ=J||void 0},attachGlobalHandlers(){if(Y("crashReporter")&&window.craft.crashReporter.attachGlobalHandlers)return window.craft.crashReporter.attachGlobalHandlers();if(typeof window>"u")return()=>{};let J=($)=>{JJ.report({severity:"error",message:$.message,source:"js",stack:$.error?.stack||`${$.message}
895
- at ${$.filename}:${$.lineno}:${$.colno}`}).catch(()=>{})},Z=($)=>{let G=$.reason;JJ.report({severity:"error",message:G?.message||String(G),source:"js",stack:G?.stack||""}).catch(()=>{})};return window.addEventListener("error",J),window.addEventListener("unhandledrejection",Z),()=>{window.removeEventListener("error",J),window.removeEventListener("unhandledrejection",Z)}},forwardTo(J){return U0(J)}},R0="craft:crashReporter:pending",j0=/[\w.+-]+@[\w-]+\.[\w.-]+/g,F0=/\b(?:\d{1,3}\.){3}\d{1,3}\b/g,O0=/\/(?:Users|home)\/[^\s/'"`]+/g;function q0(J){let Z=($)=>$.replace(j0,"<email>").replace(F0,"<ip>").replace(O0,"/<home>");return{...J,message:Z(J.message),stack:Z(J.stack)}}async function _0(J,Z){let $=new TextEncoder,G=await crypto.subtle.importKey("raw",$.encode(J),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),X=await crypto.subtle.sign("HMAC",G,$.encode(Z));return[...new Uint8Array(X)].map((Q)=>Q.toString(16).padStart(2,"0")).join("")}function V0(J){if(!J||typeof localStorage>"u")return[];try{let Z=localStorage.getItem(J);if(!Z)return[];let $=JSON.parse(Z);return Array.isArray($)?$:[]}catch{return[]}}function wJ(J,Z){if(!J||typeof localStorage>"u")return;try{if(Z.length===0)localStorage.removeItem(J);else localStorage.setItem(J,JSON.stringify(Z))}catch{}}function U0(J){let{endpoint:Z,intervalMs:$=60000,signingSecret:G,redact:X=!0,headers:Q={},maxRetries:R=5,persistKey:z}=J,K=z===null?null:z??R0,j=V0(K),O=!1,q=null,F=null,V=typeof X==="function"?X:X===!1?(T)=>T:q0;async function U(T){let M=JSON.stringify({entries:T}),w={"Content-Type":"application/json",...Q};if(G)w["X-Craft-Signature"]=await _0(G,M);let n=0,S=1000;while(!O)try{let b=await fetch(Z,{method:"POST",headers:w,body:M});if(b.ok)return;if(b.status>=400&&b.status<500)return;throw Error(`HTTP ${b.status}`)}catch(b){if(n+=1,n>R)throw j=[...T,...j],wJ(K,j),b;await new Promise((GZ)=>{setTimeout(GZ,S)}),S=Math.min(S*2,60000)}}async function k(){if(O||F)return F??void 0;let T=await JJ.flush();if(T.length>0)await JJ.clear();if(j=[...j,...T.map((w)=>V(w))],j.length===0)return;let M=j;return j=[],wJ(K,j),F=U(M).catch(()=>{}).finally(()=>{F=null}),F}if($>0)q=setInterval(()=>{k().catch(()=>{})},$);return{async flushNow(){await k()},stop(){if(O=!0,q)clearInterval(q);q=null},pending(){return[...j]}}}var t$={async isAvailable(){if(!Y("iap"))return!1;return await window.craft.iap.isAvailable()},async getProducts(J){if(!Y("iap"))return[];let Z=Array.isArray(J)?J:[String(J)];return await window.craft.iap.getProducts(Z)},async purchase(J){if(!Y("iap"))return{queued:!1,productId:J,reason:"IAP bridge not available"};let Z=await window.craft.iap.purchase(J);return{queued:!!(Z&&Z.queued),productId:Z?.productId,reason:Z?.reason}},async restorePurchases(){if(!Y("iap"))return{ok:!1};let J=await window.craft.iap.restorePurchases();return{ok:!!(J&&J.ok)}},async finishTransaction(J){if(!Y("iap"))return;await window.craft.iap.finishTransaction(J)},async getReceiptData(){if(!Y("iap"))return null;let J=await window.craft.iap.getReceiptData();return J?String(J):null},onPurchased(J){return P("craft:iap:purchased",J)},onFailed(J){return P("craft:iap:failed",J)},onRestored(J){return P("craft:iap:restored",J)},onProductsLoaded(J){return P("craft:iap:productsLoaded",(Z)=>J(Z.products||[]))},onRefunded(J){return P("craft:iap:refunded",J)},onSubscriptionStatusChanged(J){return P("craft:iap:subscriptionStatusChanged",J)},async getActiveSubscriptions(){if(!Y("iap"))return[];let J=window.craft.iap.getActiveSubscriptions;if(typeof J!=="function")return[];let Z=await J();return Array.isArray(Z)?Z:[]},async isEligibleForIntroOffer(J){if(!Y("iap"))return!1;let Z=window.craft.iap.isEligibleForIntroOffer;if(typeof Z!=="function")return!1;return!!await Z(J)}},OJ={async startActivity(J,Z){if(!J)throw Error("handoff.startActivity: type is required");if(!Y("handoff"))return!1;let $=await window.craft.handoff.startActivity(J,Z);return typeof $==="boolean"?$:!!($&&$.ok)},async updateActivity(J){if(!Y("handoff"))return!1;let Z=await window.craft.handoff.updateActivity(J);return typeof Z==="boolean"?Z:!!(Z&&Z.ok)},async stopActivity(){if(!Y("handoff"))return;await window.craft.handoff.stopActivity()},async getCurrentActivity(){if(!Y("handoff"))return null;let J=await window.craft.handoff.getCurrentActivity();return J&&typeof J.type==="string"?J:null},onIncoming(J){return P("craft:handoff:incoming",J)}},e$={async start(J,Z){return OJ.startActivity(J,{title:Z?.title,webpageURL:Z?.webpageURL,userInfo:Z?.state})},async update(J){return OJ.updateActivity({title:J.title,webpageURL:J.webpageURL,userInfo:J.state})},async stop(){await OJ.stopActivity()}},J9={async requestPermission(J="whenInUse"){if(Y("location"))return await window.craft.location.requestPermission(J);if(typeof navigator<"u"&&navigator.geolocation)return"undetermined";return"not-supported"},async getAuthorization(){if(Y("location"))return await window.craft.location.getAuthorization();return"unknown"},async getCurrentLocation(){if(Y("location"))return await window.craft.location.getCurrentLocation();if(typeof navigator<"u"&&navigator.geolocation)return navigator.geolocation.getCurrentPosition((J)=>{window.dispatchEvent(new CustomEvent("craft:location:update",{detail:{latitude:J.coords.latitude,longitude:J.coords.longitude,altitude:J.coords.altitude,horizontalAccuracy:J.coords.accuracy,verticalAccuracy:J.coords.altitudeAccuracy,speed:J.coords.speed}}))},(J)=>{window.dispatchEvent(new CustomEvent("craft:location:error",{detail:{message:J.message||String(J)}}))}),{requested:!0};return{requested:!1}},async startWatching(J){if(Y("location"))return await window.craft.location.startWatching(J);if(typeof navigator<"u"&&navigator.geolocation){let Z=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=Z,!0}return!1},async stopWatching(){if(Y("location")){await window.craft.location.stopWatching();return}if(typeof navigator<"u"&&navigator.geolocation){let J=window.__craftWebLocationWatchId;if(J!=null)navigator.geolocation.clearWatch(J),window.__craftWebLocationWatchId=null}},onUpdate(J){return P("craft:location:update",J)},onError(J){return P("craft:location:error",J)},onAuthChanged(J){return P("craft:location:authChanged",J)}},Z9={async captureScreen(){if(!Y("screenCapture"))return null;let J=await window.craft.screenCapture.captureScreen();return J?String(J):null},async captureWindow(J){if(!Y("screenCapture"))return null;if(!Number.isFinite(J)||J<=0)throw Error("captureWindow: id must be a positive number");let Z=await window.craft.screenCapture.captureWindow(J);return Z?String(Z):null},async listWindows(){if(!Y("screenCapture"))return[];return await window.craft.screenCapture.listWindows()}},P0=250,W0=60000,JZ=2000,SJ={sharing:!1,signals:{systemScreenShare:!1,remoteSession:!1,conferenceSharing:!1,screenRecording:!1},sources:[]};function D0(){return{...SJ,signals:{...SJ.signals},sources:[]}}var qJ={async getState(){if(!Y("screenSharing"))return D0();return await window.craft.screenSharing.getState()},async watch(J=JZ){let Z=Math.min(W0,Math.max(P0,Math.round(J)));if(!Y("screenSharing"))return Z;let $=await window.craft.screenSharing.watch(Z);return $&&$.intervalMs||Z},async stop(){if(!Y("screenSharing"))return;await window.craft.screenSharing.unwatch()},onChange(J){return P("craft:screenSharing:change",J)}};async function $9(J,Z=JZ){let $=qJ.onChange(J);return await qJ.watch(Z),()=>{$(),qJ.stop()}}var L0={supported:!1,isFocused:null,authorization:"unsupported"};function BJ(){return{ok:!1,error:"Focus control is only available in a Craft window on macOS"}}var ZZ={async getStatus(){if(!Y("focus"))return{...L0};return await window.craft.focus.getStatus()},async requestAuthorization(){if(!Y("focus"))return"unsupported";return await window.craft.focus.requestAuthorization()},async setEnabled(J,Z={}){if(!Y("focus"))return BJ();if(!(J?Z.onShortcut:Z.offShortcut))return{ok:!1,error:`focus.setEnabled: no ${J?"onShortcut":"offShortcut"} configured`};return await window.craft.focus.setEnabled(J,Z)},async runShortcut(J){if(!Y("focus"))return BJ();if(!J)throw Error("focus.runShortcut: name is required");return await window.craft.focus.runShortcut(J)},async listShortcuts(){if(!Y("focus"))return[];return await window.craft.focus.listShortcuts()},async listShortcutsResult(){if(!Y("focus"))return{canList:!1,shortcuts:[]};let J=await window.craft.focus.listShortcutsResult();return{canList:Boolean(J?.canList),shortcuts:J?.shortcuts||[]}}};async function G9(...J){if(J.length===0)return!1;let Z=new Set(await ZZ.listShortcuts());return J.every(($)=>Z.has($))}async function X9(...J){if(J.length===0)return!1;let{canList:Z,shortcuts:$}=await ZZ.listShortcutsResult();if(!Z)return"unknown";let G=new Set($);return J.every((X)=>G.has(X))}var Y9={async start(J=0,Z="127.0.0.1"){if(!Y("localServer"))return{port:0,started:!1,reason:"bridge unavailable"};return await window.craft.localServer.start(J,Z)},async stop(){if(!Y("localServer"))return;await window.craft.localServer.stop()},async respond(J){if(!Y("localServer"))return;await window.craft.localServer.respond(J||{status:200,body:"OK"})},onRequest(J){return P("craft:localServer:request",J)},async awaitOAuthCallback(J={}){N("localServer");let{port:Z=0,host:$="127.0.0.1",timeoutMs:G=300000,successHTML:X}=J,Q=await this.start(Z,$);if(!Q.started)throw Error(`localServer: start failed${Q.reason?` \u2014 ${Q.reason}`:""}`);return new Promise((R,z)=>{let K=setTimeout(()=>{j(),this.stop().catch(()=>{}),z(Error("localServer: OAuth callback timed out"))},G),j=this.onRequest(({url:O})=>{clearTimeout(K),j();let q=X??`<!doctype html><meta charset="utf-8"><title>Done</title>
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
- <div><h1>You can close this tab.</h1><p>Returning to the app\u2026</p></div>
898
- <script>setTimeout(()=>window.close(),1500)</script>`;this.respond({status:200,body:q,contentType:"text/html; charset=utf-8"}).catch(()=>{}).finally(()=>this.stop().catch(()=>{})),R({url:O,port:Q.port})})})}},Q9={async isAvailable(){if(!Y("biometric"))return!1;return await window.craft.biometric.isAvailable()},async getBiometryType(){if(!Y("biometric"))return"none";return await window.craft.biometric.getBiometryType()},async evaluate(J,Z){if(!J)throw Error("biometric.evaluate: reason is required");if(!Y("biometric"))return{success:!1,errorCode:-1};return await window.craft.biometric.evaluate(J,Z)}},E=null,z9={async play(J,Z){if(Y("audio"))return await window.craft.audio.play(J,Z);if(typeof window>"u"||typeof Audio>"u")return!1;if(E)E.pause(),E=null;if(E=new Audio(J),Z?.volume!=null)E.volume=Z.volume;if(Z?.loops)E.loop=!0;try{return await E.play(),!0}catch{return!1}},async playSystemSound(J){if(Y("audio"))return await window.craft.audio.playSystemSound(J);if(typeof window>"u"||typeof Audio>"u")return!1;try{return E=new Audio(`/System/Library/Sounds/${J}.aiff`),await E.play(),!0}catch{return!1}},async stop(){if(Y("audio")){await window.craft.audio.stop();return}if(E)E.pause(),E.currentTime=0,E=null},async isPlaying(){if(Y("audio"))return await window.craft.audio.isPlaying();return!!(E&&!E.paused)},async startRecording(J,Z){if(Y("audio"))return await window.craft.audio.startRecording(J,Z);return!1},async stopRecording(){if(Y("audio"))await window.craft.audio.stopRecording()},async isRecording(){if(Y("audio"))return await window.craft.audio.isRecording();return!1}},K9={async execute(J){if(!J)throw Error("appleScript.execute: source is required");if(!Y("appleScript"))return{ok:!1};return await window.craft.appleScript.execute(J)}},R9={async getDefault(J){if(!J)throw Error("fileAssociations.getDefault: uti is required");if(!Y("fileAssociations"))return null;let Z=await window.craft.fileAssociations.getDefault(J);return Z?String(Z):null},async setDefault(J,Z){if(!J||!Z)throw Error("fileAssociations.setDefault: uti and bundleId are required");if(!Y("fileAssociations"))return!1;return await window.craft.fileAssociations.setDefault(J,Z)}},j9={async get(J){if(!J)throw Error("tags.get: path is required");if(!Y("tags"))return[];return await window.craft.tags.get(J)},async set(J,Z){if(!J)throw Error("tags.set: path is required");if(!Y("tags"))return!1;let $=Array.isArray(Z)?Z:[String(Z)];return await window.craft.tags.set(J,$)},async clear(J){if(!J)throw Error("tags.clear: path is required");if(!Y("tags"))return!1;return await window.craft.tags.clear(J)}},F9={async countPages(J){if(!J)throw Error("pdf.countPages: path is required");if(!Y("pdf"))return 0;return await window.craft.pdf.countPages(J)},async extractText(J){if(!J)throw Error("pdf.extractText: path is required");if(!Y("pdf"))return"";return await window.craft.pdf.extractText(J)}},O9={async debug(J){if(Y("log"))await window.craft.log.debug(J);else console.debug(J)},async info(J){if(Y("log"))await window.craft.log.info(J);else console.info(J)},async warn(J){if(Y("log"))await window.craft.log.warn(J);else console.warn(J)},async error(J){if(Y("log"))await window.craft.log.error(J);else console.error(J)}},q9={async browse(J){if(!Y("bonjour"))return{started:!1,reason:"bridge unavailable"};return await window.craft.bonjour.browse(J)},async stop(){if(Y("bonjour"))await window.craft.bonjour.stop()},onFound(J){return P("craft:bonjour:found",J)},onLost(J){return P("craft:bonjour:lost",J)}},_9={async index(J){if(!Y("spotlight"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.spotlight.index(J)},async remove(J){if(!Y("spotlight"))return{ok:!1};return await window.craft.spotlight.remove(J)},async removeAll(){if(!Y("spotlight"))return{ok:!1};return await window.craft.spotlight.removeAll()}},V9={async isAvailable(){if(!Y("speechRecognition"))return!1;return await window.craft.speechRecognition.isAvailable()},async start(J){if(!Y("speechRecognition"))return{started:!1,reason:"bridge unavailable"};return await window.craft.speechRecognition.start(J)},async stop(){if(Y("speechRecognition"))await window.craft.speechRecognition.stop()},onPartial(J){return P("craft:speechRecognition:partial",J)},onFinal(J){return P("craft:speechRecognition:final",J)}},U9={async recognizeText(J){if(!J)throw Error("vision.recognizeText: path is required");if(!Y("vision"))return[];return await window.craft.vision.recognizeText(J)},async detectFaces(J){if(!J)throw Error("vision.detectFaces: path is required");if(!Y("vision"))return[];return await window.craft.vision.detectFaces(J)},async detectBarcodes(J){if(!J)throw Error("vision.detectBarcodes: path is required");if(!Y("vision"))return[];return await window.craft.vision.detectBarcodes(J)}},P9={async listSources(){if(!Y("midi"))return[];return await window.craft.midi.listSources()},async listDestinations(){if(!Y("midi"))return[];return await window.craft.midi.listDestinations()},async send(J,Z){if(!Y("midi"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.midi.send(J,Z)},async subscribe(J){if(!Y("midi"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.midi.subscribe(J)},async unsubscribe(J){if(!Y("midi"))return{ok:!1};return await window.craft.midi.unsubscribe(J)},onMessage(J){return P("craft:midi:message",J)}},W9={async loadModel(J,Z){if(!J||!Z)throw Error("coreml.loadModel: id and path are required");if(!Y("coreml"))return!1;return await window.craft.coreml.loadModel(J,Z)},async unloadModel(J){if(!Y("coreml"))return;await window.craft.coreml.unloadModel(J)},async predict(J,Z){if(!J)throw Error("coreml.predict: id is required");if(!Y("coreml"))return null;return await window.craft.coreml.predict(J,Z)}},D9={async listCameras(){if(!Y("continuityCamera"))return[];return await window.craft.continuityCamera.listCameras()}},L9={async register(J){if(!J)throw Error("serviceMenu.register: name is required");if(!Y("serviceMenu"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.serviceMenu.register(J)},async unregister(J){if(!J)throw Error("serviceMenu.unregister: name is required");if(!Y("serviceMenu"))return;await window.craft.serviceMenu.unregister(J)},onInvoked(J){return P("craft:serviceMenu:invoked",J)}},N9={async list(){if(!Y("serial"))return[];return await window.craft.serial.list()},async open(J,Z=9600){if(!J)throw Error("serial.open: path is required");if(!Y("serial"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.serial.open(J,Z)},async write(J,Z){if(!J)throw Error("serial.write: id is required");if(!Y("serial"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.serial.write(J,Z)},async close(J){if(!Y("serial"))return;await window.craft.serial.close(J)},onData(J){return P("craft:serial:data",J)}},$Z=[{name:"fs",support:"native"},{name:"shell",support:"native"},{name:"system",support:"all"},{name:"clipboard",support:"all"},{name:"dialog",support:"all"},{name:"window",support:"native"},{name:"tray",support:"native"},{name:"menu",support:"native"},{name:"theme",support:"all"},{name:"screen",support:"all"},{name:"network",support:"all"},{name:"power",support:"all"},{name:"battery",support:"all"},{name:"notifications",support:"all"},{name:"globalShortcuts",support:"native"},{name:"autolaunch",support:"native"},{name:"appInfo",support:"all"},{name:"localServer",support:"native"},{name:"bluetooth",support:"native"},{name:"crashReporter",support:"all"},{name:"updater",support:"native"},{name:"iap",support:"macos"},{name:"keychain",support:"native"},{name:"log",support:"all"},{name:"biometric",support:"macos"},{name:"location",support:"macos"},{name:"audio",support:"macos"},{name:"deepLink",support:"native"},{name:"handoff",support:"macos"},{name:"liveActivities",support:"macos"},{name:"touchbar",support:"macos"},{name:"dragOut",support:"macos"},{name:"appleScript",support:"macos"},{name:"fileAssociations",support:"native"},{name:"tags",support:"macos"},{name:"pdf",support:"macos"},{name:"bonjour",support:"macos"},{name:"spotlight",support:"macos"},{name:"speechRecognition",support:"macos"},{name:"vision",support:"macos"},{name:"midi",support:"macos"},{name:"coreml",support:"macos"},{name:"continuityCamera",support:"macos"},{name:"serviceMenu",support:"macos"},{name:"serial",support:"native"}];function k9(){return $Z.map(({name:J,support:Z})=>({name:J,support:Z,available:Y(J)}))}function N0(J){let Z=$Z.find(($)=>$.name===J);if(!Z)return;return{...Z,available:Y(J)}}function T9(J){let Z=N0(J);return!!Z&&Z.available}export{m$ as windowEvents,$9 as watchScreenSharing,U9 as vision,u$ as updater,iZ as unregisterHotkey,N$ as unregisterAllHotkeys,x8 as triggerTrayAction,a$ as touchbar,B$ as theme,j9 as tags,p$ as system,_9 as spotlight,V9 as speechRecognition,s$ as speech,_0 as signPayload,E0 as showWarningToast,_8 as showWarningModal,b8 as showWarningDialog,$J as showToast,M0 as showSuccessToast,U8 as showSuccessModal,S8 as showSaveDialog,WZ as showQuestionModal,w8 as showOpenDialog,d as showModal,XJ as showMessageBox,T0 as showInfoToast,PZ as showInfoModal,H0 as showErrorToast,V8 as showErrorModal,y8 as showErrorDialog,v8 as showConfirmDialog,B8 as showColorPicker,f8 as showAlertDialog,yJ as showAlert,w$ as shell,p8 as setDesktopConfig,P$ as setAutoLaunch,L9 as serviceMenu,N9 as serial,qJ as screenSharing,Z9 as screenCapture,l$ as screen,UJ as resolveCraftBinary,d8 as resetDesktopConfig,k0 as requestNotificationPermission,L$ as registerHotkey,q0 as redactPII,D8 as prompt,r$ as printing,n$ as permissions,F9 as pdf,nZ as parseShortcut,XZ as packageApp,YZ as pack,i8 as openDevWindow,x0 as notify,C$ as notifications,g$ as network,o$ as nativeAutoLaunch,P9 as midi,c$ as menu,O9 as log,J9 as location,Y9 as localServer,e$ as liveActivities,d$ as keychain,t8 as isWebviewAvailable,v$ as isDragOutAvailable,Q$ as isCaffeinated,T9 as isAvailable,W$ as isAutoLaunchEnabled,t$ as iap,G9 as hasFocusShortcuts,OJ as handoff,S$ as globalShortcuts,CZ as githubReleaseAssetUrl,AZ as githubLatestAssetUrl,e8 as getWindowBridgeScript,r8 as getWindow,H8 as getTrayInstance,C8 as getTrayBridgeScript,A8 as getSimulatedTrayHTML,k$ as getRegisteredHotkeys,g8 as getDialogBridgeScript,l8 as getDesktopConfig,N0 as getCapability,k9 as getCapabilities,z$ as getCaffeinateStatus,n8 as getActiveWindowIds,E8 as getActiveTrayInstances,L8 as getActiveModalCount,I0 as getActiveAlertCount,vJ as generateUpdateManifest,I$ as fs,H$ as formatTime,D$ as formatShortcut,K$ as formatRemainingTime,R$ as formatDuration,x$ as formatCompact,X9 as focusShortcutsReady,ZZ as focus,R9 as fileAssociations,f$ as dragOut,C0 as dismissAllAlerts,A0 as dismissAlertById,E$ as delay,y$ as deepLinks,IZ as decaffeinate,s8 as createWindowWithHTML,a8 as createWindow,F8 as createWebView,Y8 as createTreeView,s0 as createTooltip,T$ as createTimer,n0 as createTimePicker,B0 as createTextInput,m0 as createTabs,X8 as createTable,TZ as createSystemTray,Z8 as createStepper,e0 as createSplitView,v0 as createSlider,t0 as createScrollView,c0 as createRating,p0 as createRadioButton,y0 as createProgressBar,q$ as createPreferences,$8 as createModalComponent,M8 as createMenubar,R8 as createMediaPlayer,G8 as createListView,o0 as createLabel,M$ as createInterval,a0 as createImageView,G$ as createGitHubUpdater,X$ as createGitHubUpdateManifest,j8 as createFileExplorer,h0 as createDropdown,d0 as createDatePicker,Q8 as createDataGrid,l0 as createColorPicker,K8 as createCodeEditor,i0 as createChip,f0 as createCheckbox,z8 as createChart,u0 as createCard,S0 as createButton,b0 as createBadge,g0 as createAvatar,r0 as createAutocomplete,J8 as createAccordion,JJ as crashReporter,hJ as craftWindowArguments,ZJ as craftBinaryNotFoundMessage,W9 as coreml,D9 as continuityCamera,P8 as confirm,o8 as closeAllWindows,N8 as closeAllModals,A$ as clipboard,Y$ as caffeinate,q9 as bonjour,i$ as bluetooth,Q9 as biometric,b$ as battery,z9 as audio,K9 as appleScript,h$ as appInfo,W8 as alert,xZ as UPDATE_MANIFEST_ASSET,I8 as TRAY_MENU_STYLES,w0 as TOAST_STYLES,k8 as MODAL_STYLES,P0 as MIN_WATCH_INTERVAL_MS,W0 as MAX_WATCH_INTERVAL_MS,JZ as DEFAULT_WATCH_INTERVAL_MS,q8 as COMPONENT_STYLES,fJ as AutoUpdater,O8 as AVAILABLE_COMPONENTS};