@stacksjs/desktop 0.2.200 → 0.2.202

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,86 +1,86 @@
1
1
  // @bun
2
- import{$ as hZ,$a as h0,A as FZ,Aa as B0,B as jZ,Ba as F0,C as DZ,Ca as j0,D as VZ,Da as D0,E as LZ,Ea as V0,F as OZ,Fa as L0,G as zZ,Ga as O0,H as MZ,Ha as z0,I as TZ,Ia as M0,J as WZ,Ja as T0,K as PZ,Ka as W0,L as AZ,La as P0,M as NZ,Ma as A0,N as kZ,Na as N0,O as xZ,Oa as k0,P as CZ,Pa as x0,Q as IZ,Qa as C0,R as HZ,Ra as I0,S as vZ,Sa as H0,T as wZ,Ta as v0,U as fZ,Ua as w0,V as SZ,Va as f0,W as gZ,Wa as S0,X as bZ,Xa as g0,Y as m,Ya as b0,Z as uZ,Za as u0,_ as yZ,_a as y0,a as cY,aa as mZ,ab as m0,b as dY,ba as cZ,bb as c0,c as pY,ca as dZ,d as rY,da as pZ,e as nY,ea as rZ,f as oY,fa as nZ,g as lY,ga as oZ,h as aY,ha as lZ,i as iY,ia as aZ,j as sY,ja as iZ,k as tY,ka as sZ,l as eY,la as tZ,m as QZ,ma as eZ,n as YZ,na as Q0,o as ZZ,oa as Y0,p as XZ,pa as Z0,q as $Z,qa as X0,r as GZ,ra as $0,s as JZ,sa as G0,t as qZ,ta as J0,u as RZ,ua as q0,v as UZ,va as R0,w as KZ,wa as U0,x as _Z,xa as K0,y as EZ,ya as _0,z as BZ,za as E0}from"./chunk-0954hbsb.js";import{cb as N}from"./chunk-ts9f0mxv.js";function L(Y="stx"){return`${Y}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function B(Y){return Y.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function V(...Y){return Y.filter(Boolean).join(" ")}function D(Y){if(!Y)return"";return Object.entries(Y).map(([Q,Z])=>`${Q.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${Z}`).join("; ")}function UQ(Y){let{text:Q,variant:Z="primary",size:X="medium",disabled:$=!1,loading:J=!1,icon:U,iconPosition:q="left",id:G=L("btn"),className:_,style:K}=Y,E=V("stx-button",`stx-button--${Z}`,`stx-button--${X}`,$&&"stx-button--disabled",J&&"stx-button--loading",_),R=D(K),F=U?`<span class="stx-button-icon">${U}</span>`:"",j=J?'<span class="stx-button-spinner"></span>':"",O=q==="left"?`${F}${j}<span class="stx-button-text">${B(Q)}</span>`:`<span class="stx-button-text">${B(Q)}</span>${F}${j}`;return`<button id="${G}" class="${E}" ${$||J?"disabled":""} ${R?`style='${R}'`:""}>${O}</button>`}function KQ(Y){let{value:Q="",placeholder:Z="",type:X="text",disabled:$=!1,readonly:J=!1,maxLength:U,minLength:q,pattern:G,required:_=!1,autocomplete:K,label:E,error:R,hint:F,id:j=L("input"),className:O,style:z}=Y,M=V("stx-input",R&&"stx-input--error",$&&"stx-input--disabled",O),v=D(z),RQ=[`type="${X}"`,`id="${j}"`,`class="${M}"`,Q&&`value="${B(Q)}"`,Z&&`placeholder="${B(Z)}"`,$&&"disabled",J&&"readonly",_&&"required",U&&`maxlength="${U}"`,q&&`minlength="${q}"`,G&&`pattern="${B(G)}"`,K&&`autocomplete="${K}"`,v&&`style="${v}"`].filter(Boolean).join(" "),I="";if(E)I+=`<label class="stx-input-label" for="${j}">${B(E)}</label>`;if(I+=`<input ${RQ} />`,R)I+=`<div class="stx-input-error">${B(R)}</div>`;else if(F)I+=`<div class="stx-input-hint">${B(F)}</div>`;return`<div class="stx-input-wrapper">${I}</div>`}function _Q(Y){let{checked:Q=!1,label:Z,disabled:X=!1,indeterminate:$=!1,id:J=L("checkbox"),className:U,style:q}=Y,G=V("stx-checkbox",X&&"stx-checkbox--disabled",U),_=D(q),K=['type="checkbox"',`id="${J}"`,Q&&"checked",X&&"disabled",$&&'data-indeterminate="true"'].filter(Boolean).join(" ");return`
3
- <label class="${G}" ${_?`style="${_}"`:""}>
4
- <input ${K} />
2
+ import{$ as dZ,$a as d0,A as OZ,Aa as V0,B as zZ,Ba as O0,C as MZ,Ca as z0,D as TZ,Da as M0,E as LZ,Ea as T0,F as DZ,Fa as L0,G as PZ,Ga as D0,H as WZ,Ha as P0,I as AZ,Ia as W0,J as NZ,Ja as A0,K as xZ,Ka as N0,L as IZ,La as x0,M as kZ,Ma as I0,N as CZ,Na as k0,O as HZ,Oa as C0,P as vZ,Pa as H0,Q as wZ,Qa as v0,R as fZ,Ra as w0,S as SZ,Sa as f0,T as gZ,Ta as S0,U as bZ,Ua as g0,V as uZ,Va as b0,W as yZ,Wa as u0,X as hZ,Xa as y0,Y as d,Ya as h0,Z as mZ,Za as m0,_ as cZ,_a as c0,a as rY,aa as pZ,ab as p0,b as nY,ba as rZ,bb as r0,c as oY,ca as nZ,d as lY,da as oZ,e as aY,ea as lZ,f as iY,fa as aZ,g as sY,ga as iZ,h as tY,ha as sZ,i as eY,ia as tZ,j as QZ,ja as eZ,k as YZ,ka as Q0,l as ZZ,la as Y0,m as XZ,ma as Z0,n as $Z,na as X0,o as JZ,oa as $0,p as GZ,pa as J0,q as qZ,qa as G0,r as RZ,ra as q0,s as KZ,sa as R0,t as UZ,ta as K0,u as BZ,ua as U0,v as EZ,va as B0,w as _Z,wa as E0,x as FZ,xa as _0,y as jZ,ya as F0,z as VZ,za as j0}from"./chunk-0954hbsb.js";import{cb as N}from"./chunk-ts9f0mxv.js";function z(Y="stx"){return`${Y}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function _(Y){return Y.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function O(...Y){return Y.filter(Boolean).join(" ")}function V(Y){if(!Y)return"";return Object.entries(Y).map(([Q,Z])=>`${Q.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${Z}`).join("; ")}function BQ(Y){let{text:Q,variant:Z="primary",size:X="medium",disabled:$=!1,loading:G=!1,icon:K,iconPosition:q="left",id:J=z("btn"),className:B,style:U}=Y,E=O("stx-button",`stx-button--${Z}`,`stx-button--${X}`,$&&"stx-button--disabled",G&&"stx-button--loading",B),R=V(U),F=K?`<span class="stx-button-icon">${K}</span>`:"",j=G?'<span class="stx-button-spinner"></span>':"",M=q==="left"?`${F}${j}<span class="stx-button-text">${_(Q)}</span>`:`<span class="stx-button-text">${_(Q)}</span>${F}${j}`;return`<button id="${J}" class="${E}" ${$||G?"disabled":""} ${R?`style='${R}'`:""}>${M}</button>`}function EQ(Y){let{value:Q="",placeholder:Z="",type:X="text",disabled:$=!1,readonly:G=!1,maxLength:K,minLength:q,pattern:J,required:B=!1,autocomplete:U,label:E,error:R,hint:F,id:j=z("input"),className:M,style:T}=Y,L=O("stx-input",R&&"stx-input--error",$&&"stx-input--disabled",M),v=V(T),UQ=[`type="${X}"`,`id="${j}"`,`class="${L}"`,Q&&`value="${_(Q)}"`,Z&&`placeholder="${_(Z)}"`,$&&"disabled",G&&"readonly",B&&"required",K&&`maxlength="${K}"`,q&&`minlength="${q}"`,J&&`pattern="${_(J)}"`,U&&`autocomplete="${U}"`,v&&`style="${v}"`].filter(Boolean).join(" "),C="";if(E)C+=`<label class="stx-input-label" for="${j}">${_(E)}</label>`;if(C+=`<input ${UQ} />`,R)C+=`<div class="stx-input-error">${_(R)}</div>`;else if(F)C+=`<div class="stx-input-hint">${_(F)}</div>`;return`<div class="stx-input-wrapper">${C}</div>`}function _Q(Y){let{checked:Q=!1,label:Z,disabled:X=!1,indeterminate:$=!1,id:G=z("checkbox"),className:K,style:q}=Y,J=O("stx-checkbox",X&&"stx-checkbox--disabled",K),B=V(q),U=['type="checkbox"',`id="${G}"`,Q&&"checked",X&&"disabled",$&&'data-indeterminate="true"'].filter(Boolean).join(" ");return`
3
+ <label class="${J}" ${B?`style="${B}"`:""}>
4
+ <input ${U} />
5
5
  <span class="stx-checkbox-box"></span>
6
- ${Z?`<span class="stx-checkbox-label">${B(Z)}</span>`:""}
6
+ ${Z?`<span class="stx-checkbox-label">${_(Z)}</span>`:""}
7
7
  </label>
8
- `}function EQ(Y){let{value:Q=50,min:Z=0,max:X=100,step:$=1,disabled:J=!1,label:U,showValue:q=!0,id:G=L("slider"),className:_,style:K}=Y,E=V("stx-slider",J&&"stx-slider--disabled",_),R=D(K),F=['type="range"',`id="${G}"`,`value="${Q}"`,`min="${Z}"`,`max="${X}"`,`step="${$}"`,J&&"disabled"].filter(Boolean).join(" "),j="";if(U)j+=`<label class="stx-slider-label" for="${G}">${B(U)}</label>`;if(j+=`<div class="stx-slider-track"><input ${F} /></div>`,q)j+=`<span class="stx-slider-value">${Q}</span>`;return`<div class="${E}" ${R?`style='${R}'`:""}>${j}</div>`}function BQ(Y){let{value:Q,max:Z=100,variant:X="default",size:$="medium",showLabel:J=!1,indeterminate:U=!1,id:q=L("progress"),className:G,style:_}=Y,K=Math.min(100,Math.max(0,Q/Z*100)),E=V("stx-progress",`stx-progress--${X}`,`stx-progress--${$}`,U&&"stx-progress--indeterminate",G),R=D(_);return`
8
+ `}function FQ(Y){let{value:Q=50,min:Z=0,max:X=100,step:$=1,disabled:G=!1,label:K,showValue:q=!0,id:J=z("slider"),className:B,style:U}=Y,E=O("stx-slider",G&&"stx-slider--disabled",B),R=V(U),F=['type="range"',`id="${J}"`,`value="${Q}"`,`min="${Z}"`,`max="${X}"`,`step="${$}"`,G&&"disabled"].filter(Boolean).join(" "),j="";if(K)j+=`<label class="stx-slider-label" for="${J}">${_(K)}</label>`;if(j+=`<div class="stx-slider-track"><input ${F} /></div>`,q)j+=`<span class="stx-slider-value">${Q}</span>`;return`<div class="${E}" ${R?`style='${R}'`:""}>${j}</div>`}function jQ(Y){let{value:Q,max:Z=100,variant:X="default",size:$="medium",showLabel:G=!1,indeterminate:K=!1,id:q=z("progress"),className:J,style:B}=Y,U=Math.min(100,Math.max(0,Q/Z*100)),E=O("stx-progress",`stx-progress--${X}`,`stx-progress--${$}`,K&&"stx-progress--indeterminate",J),R=V(B);return`
9
9
  <div id="${q}" class="${E}" role="progressbar" aria-valuenow="${Q}" aria-valuemin="0" aria-valuemax="${Z}" ${R?`style="${R}"`:""}>
10
- <div class="stx-progress-bar" style="width: ${U?"100%":`${K}%`}"></div>
11
- ${J?`<span class="stx-progress-label">${Math.round(K)}%</span>`:""}
10
+ <div class="stx-progress-bar" style="width: ${K?"100%":`${U}%`}"></div>
11
+ ${G?`<span class="stx-progress-label">${Math.round(U)}%</span>`:""}
12
12
  </div>
13
- `}function FQ(Y){let{text:Q,variant:Z="default",size:X="medium",id:$=L("badge"),className:J,style:U}=Y,q=V("stx-badge",`stx-badge--${Z}`,`stx-badge--${X}`,J),G=D(U);return`<span id="${$}" class="${q}" ${G?`style='${G}'`:""}>${B(Q)}</span>`}function jQ(Y){let{src:Q,alt:Z="",name:X,size:$="medium",shape:J="circle",id:U=L("avatar"),className:q,style:G}=Y,_=typeof $==="number"?"":`stx-avatar--${$}`,K=typeof $==="number"?`width: ${$}px; height: ${$}px;`:"",E=V("stx-avatar",_,`stx-avatar--${J}`,q),R=[K,D(G)].filter(Boolean).join(" "),F=X?X.split(" ").map((j)=>j[0]).join("").toUpperCase().slice(0,2):"";if(Q)return`<div id="${U}" class="${E}" ${R?`style="${R}"`:""}>
14
- <img src="${B(Q)}" alt="${B(Z)}" class="stx-avatar-img" />
15
- </div>`;return`<div id="${U}" class="${E}" ${R?`style="${R}"`:""}>
13
+ `}function VQ(Y){let{text:Q,variant:Z="default",size:X="medium",id:$=z("badge"),className:G,style:K}=Y,q=O("stx-badge",`stx-badge--${Z}`,`stx-badge--${X}`,G),J=V(K);return`<span id="${$}" class="${q}" ${J?`style='${J}'`:""}>${_(Q)}</span>`}function OQ(Y){let{src:Q,alt:Z="",name:X,size:$="medium",shape:G="circle",id:K=z("avatar"),className:q,style:J}=Y,B=typeof $==="number"?"":`stx-avatar--${$}`,U=typeof $==="number"?`width: ${$}px; height: ${$}px;`:"",E=O("stx-avatar",B,`stx-avatar--${G}`,q),R=[U,V(J)].filter(Boolean).join(" "),F=X?X.split(" ").map((j)=>j[0]).join("").toUpperCase().slice(0,2):"";if(Q)return`<div id="${K}" class="${E}" ${R?`style="${R}"`:""}>
14
+ <img src="${_(Q)}" alt="${_(Z)}" class="stx-avatar-img" />
15
+ </div>`;return`<div id="${K}" class="${E}" ${R?`style="${R}"`:""}>
16
16
  <span class="stx-avatar-initials">${F}</span>
17
- </div>`}function DQ(Y){let{title:Q,subtitle:Z,content:X,image:$,footer:J,variant:U="default",id:q=L("card"),className:G,style:_}=Y,K=V("stx-card",`stx-card--${U}`,G),E=D(_),R="";if($)R+=`<div class="stx-card-image"><img src="${B($)}" alt="" /></div>`;if(R+='<div class="stx-card-body">',Q)R+=`<h3 class="stx-card-title">${B(Q)}</h3>`;if(Z)R+=`<p class="stx-card-subtitle">${B(Z)}</p>`;if(X)R+=`<div class="stx-card-content">${B(X)}</div>`;if(R+="</div>",J)R+=`<div class="stx-card-footer">${B(J)}</div>`;return`<div id="${q}" class="${K}" ${E?`style='${E}'`:""}>${R}</div>`}function VQ(Y){let{tabs:Q,activeTab:Z,variant:X="default",id:$=L("tabs"),className:J,style:U}=Y,q=V("stx-tabs",`stx-tabs--${X}`,J),G=D(U),_=Q.map((K,E)=>{let R=Z?K.value===Z:E===0;return`<button class="${V("stx-tab",R&&"stx-tab--active",K.disabled&&"stx-tab--disabled")}" data-value="${B(K.value)}" ${K.disabled?"disabled":""} role="tab" aria-selected="${R}">${B(K.label)}</button>`}).join("");return`<div id="${$}" class="${q}" role="tablist" ${G?`style='${G}'`:""}>${_}</div>`}function LQ(Y){let{options:Q,value:Z,placeholder:X="Select...",disabled:$=!1,id:J=L("dropdown"),className:U,style:q}=Y,G=V("stx-dropdown",$&&"stx-dropdown--disabled",U),_=D(q),K=Q.map((R)=>{let F=R.value===Z?"selected":"",j=R.disabled?"disabled":"";return`<option value="${B(R.value)}" ${F} ${j}>${B(R.label)}</option>`}).join(""),E=Z?"":`<option value="" disabled selected>${B(X)}</option>`;return`<select id="${J}" class="${G}" ${$?"disabled":""} ${_?`style='${_}'`:""}>${E}${K}</select>`}function OQ(Y){let{value:Q=0,max:Z=5,readonly:X=!1,size:$="medium",allowHalf:J=!1,id:U=L("rating"),className:q,style:G}=Y,_=V("stx-rating",`stx-rating--${$}`,X&&"stx-rating--readonly",q),K=D(G),E="";for(let R=1;R<=Z;R++){let F=R<=Q,j=J&&R-0.5===Q;E+=`<span class="stx-star ${F?"stx-star--filled":j?"stx-star--half":""}" data-value="${R}">\u2605</span>`}return`<div id="${U}" class="${_}" role="slider" aria-valuenow="${Q}" aria-valuemin="0" aria-valuemax="${Z}" ${K?`style='${K}'`:""}>${E}</div>`}function zQ(Y){let{value:Q,name:Z,checked:X=!1,label:$,disabled:J=!1,id:U=L("radio"),className:q,style:G}=Y,_=V("stx-radio",J&&"stx-radio--disabled",q),K=D(G),E=['type="radio"',`id="${U}"`,`name="${B(Z)}"`,`value="${B(Q)}"`,X&&"checked",J&&"disabled"].filter(Boolean).join(" ");return`
18
- <label class="${_}" ${K?`style="${K}"`:""}>
17
+ </div>`}function zQ(Y){let{title:Q,subtitle:Z,content:X,image:$,footer:G,variant:K="default",id:q=z("card"),className:J,style:B}=Y,U=O("stx-card",`stx-card--${K}`,J),E=V(B),R="";if($)R+=`<div class="stx-card-image"><img src="${_($)}" alt="" /></div>`;if(R+='<div class="stx-card-body">',Q)R+=`<h3 class="stx-card-title">${_(Q)}</h3>`;if(Z)R+=`<p class="stx-card-subtitle">${_(Z)}</p>`;if(X)R+=`<div class="stx-card-content">${_(X)}</div>`;if(R+="</div>",G)R+=`<div class="stx-card-footer">${_(G)}</div>`;return`<div id="${q}" class="${U}" ${E?`style='${E}'`:""}>${R}</div>`}function MQ(Y){let{tabs:Q,activeTab:Z,variant:X="default",id:$=z("tabs"),className:G,style:K}=Y,q=O("stx-tabs",`stx-tabs--${X}`,G),J=V(K),B=Q.map((U,E)=>{let R=Z?U.value===Z:E===0;return`<button class="${O("stx-tab",R&&"stx-tab--active",U.disabled&&"stx-tab--disabled")}" data-value="${_(U.value)}" ${U.disabled?"disabled":""} role="tab" aria-selected="${R}">${_(U.label)}</button>`}).join("");return`<div id="${$}" class="${q}" role="tablist" ${J?`style='${J}'`:""}>${B}</div>`}function TQ(Y){let{options:Q,value:Z,placeholder:X="Select...",disabled:$=!1,id:G=z("dropdown"),className:K,style:q}=Y,J=O("stx-dropdown",$&&"stx-dropdown--disabled",K),B=V(q),U=Q.map((R)=>{let F=R.value===Z?"selected":"",j=R.disabled?"disabled":"";return`<option value="${_(R.value)}" ${F} ${j}>${_(R.label)}</option>`}).join(""),E=Z?"":`<option value="" disabled selected>${_(X)}</option>`;return`<select id="${G}" class="${J}" ${$?"disabled":""} ${B?`style='${B}'`:""}>${E}${U}</select>`}function LQ(Y){let{value:Q=0,max:Z=5,readonly:X=!1,size:$="medium",allowHalf:G=!1,id:K=z("rating"),className:q,style:J}=Y,B=O("stx-rating",`stx-rating--${$}`,X&&"stx-rating--readonly",q),U=V(J),E="";for(let R=1;R<=Z;R++){let F=R<=Q,j=G&&R-0.5===Q;E+=`<span class="stx-star ${F?"stx-star--filled":j?"stx-star--half":""}" data-value="${R}">\u2605</span>`}return`<div id="${K}" class="${B}" role="slider" aria-valuenow="${Q}" aria-valuemin="0" aria-valuemax="${Z}" ${U?`style='${U}'`:""}>${E}</div>`}function DQ(Y){let{value:Q,name:Z,checked:X=!1,label:$,disabled:G=!1,id:K=z("radio"),className:q,style:J}=Y,B=O("stx-radio",G&&"stx-radio--disabled",q),U=V(J),E=['type="radio"',`id="${K}"`,`name="${_(Z)}"`,`value="${_(Q)}"`,X&&"checked",G&&"disabled"].filter(Boolean).join(" ");return`
18
+ <label class="${B}" ${U?`style="${U}"`:""}>
19
19
  <input ${E} />
20
20
  <span class="stx-radio-circle"></span>
21
- ${$?`<span class="stx-radio-label">${B($)}</span>`:""}
21
+ ${$?`<span class="stx-radio-label">${_($)}</span>`:""}
22
22
  </label>
23
- `}function MQ(Y){let{value:Q="#3498db",disabled:Z=!1,label:X,presetColors:$=["#e74c3c","#f39c12","#27ae60","#3498db","#9b59b6","#1abc9c","#34495e","#000000"],id:J=L("color"),className:U,style:q}=Y,G=V("stx-color-picker",Z&&"stx-color-picker--disabled",U),_=D(q),K="";if(X)K+=`<label class="stx-color-picker-label" for="${J}">${B(X)}</label>`;if(K+=`<div class="stx-color-picker-input">
24
- <input type="color" id="${J}" value="${B(Q)}" ${Z?"disabled":""} />
25
- <span class="stx-color-picker-value">${B(Q)}</span>
26
- </div>`,$.length>0){K+='<div class="stx-color-picker-presets">';for(let E of $)K+=`<button class="stx-color-preset" style="background: ${B(E)}" data-color="${B(E)}" ${Z?"disabled":""}></button>`;K+="</div>"}return`<div class="${G}" ${_?`style='${_}'`:""}>${K}</div>`}function TQ(Y){let{value:Q,min:Z,max:X,disabled:$=!1,label:J,placeholder:U="Select date",showClear:q=!0,id:G=L("date"),className:_,style:K}=Y,E=V("stx-date-picker",$&&"stx-date-picker--disabled",_),R=D(K),F=Q instanceof Date?Q.toISOString().split("T")[0]:Q||"",j=Z instanceof Date?Z.toISOString().split("T")[0]:Z,O=X instanceof Date?X.toISOString().split("T")[0]:X,z=['type="date"',`id="${G}"`,F&&`value="${F}"`,j&&`min="${j}"`,O&&`max="${O}"`,$&&"disabled",`placeholder="${B(U)}"`].filter(Boolean).join(" "),M="";if(J)M+=`<label class="stx-date-picker-label" for="${G}">${B(J)}</label>`;return M+=`<div class="stx-date-picker-input">
27
- <input ${z} />
23
+ `}function PQ(Y){let{value:Q="#3498db",disabled:Z=!1,label:X,presetColors:$=["#e74c3c","#f39c12","#27ae60","#3498db","#9b59b6","#1abc9c","#34495e","#000000"],id:G=z("color"),className:K,style:q}=Y,J=O("stx-color-picker",Z&&"stx-color-picker--disabled",K),B=V(q),U="";if(X)U+=`<label class="stx-color-picker-label" for="${G}">${_(X)}</label>`;if(U+=`<div class="stx-color-picker-input">
24
+ <input type="color" id="${G}" value="${_(Q)}" ${Z?"disabled":""} />
25
+ <span class="stx-color-picker-value">${_(Q)}</span>
26
+ </div>`,$.length>0){U+='<div class="stx-color-picker-presets">';for(let E of $)U+=`<button class="stx-color-preset" style="background: ${_(E)}" data-color="${_(E)}" ${Z?"disabled":""}></button>`;U+="</div>"}return`<div class="${J}" ${B?`style='${B}'`:""}>${U}</div>`}function WQ(Y){let{value:Q,min:Z,max:X,disabled:$=!1,label:G,placeholder:K="Select date",showClear:q=!0,id:J=z("date"),className:B,style:U}=Y,E=O("stx-date-picker",$&&"stx-date-picker--disabled",B),R=V(U),F=Q instanceof Date?Q.toISOString().split("T")[0]:Q||"",j=Z instanceof Date?Z.toISOString().split("T")[0]:Z,M=X instanceof Date?X.toISOString().split("T")[0]:X,T=['type="date"',`id="${J}"`,F&&`value="${F}"`,j&&`min="${j}"`,M&&`max="${M}"`,$&&"disabled",`placeholder="${_(K)}"`].filter(Boolean).join(" "),L="";if(G)L+=`<label class="stx-date-picker-label" for="${J}">${_(G)}</label>`;return L+=`<div class="stx-date-picker-input">
27
+ <input ${T} />
28
28
  ${q&&F?'<button class="stx-date-picker-clear" type="button">&times;</button>':""}
29
- </div>`,`<div class="${E}" ${R?`style='${R}'`:""}>${M}</div>`}function WQ(Y){let{value:Q="",disabled:Z=!1,label:X,step:$=60,min:J,max:U,id:q=L("time"),className:G,style:_}=Y,K=V("stx-time-picker",Z&&"stx-time-picker--disabled",G),E=D(_),R=['type="time"',`id="${q}"`,Q&&`value="${B(Q)}"`,`step="${$}"`,J&&`min="${B(J)}"`,U&&`max="${B(U)}"`,Z&&"disabled"].filter(Boolean).join(" "),F="";if(X)F+=`<label class="stx-time-picker-label" for="${q}">${B(X)}</label>`;return F+=`<input ${R} class="stx-time-picker-input" />`,`<div class="${K}" ${E?`style='${E}'`:""}>${F}</div>`}function PQ(Y){let{options:Q,value:Z="",placeholder:X="Search...",disabled:$=!1,label:J,loading:U=!1,id:q=L("autocomplete"),className:G,style:_}=Y,K=V("stx-autocomplete",$&&"stx-autocomplete--disabled",G),E=D(_),R=Q.find((O)=>O.value===Z),F=R?R.label:Z,j="";if(J)j+=`<label class="stx-autocomplete-label" for="${q}">${B(J)}</label>`;j+=`<div class="stx-autocomplete-input-wrapper">
30
- <input type="text" id="${q}" value="${B(F)}" placeholder="${B(X)}" ${$?"disabled":""} autocomplete="off" class="stx-autocomplete-input" />
31
- ${U?'<span class="stx-autocomplete-spinner"></span>':""}
32
- </div>`,j+='<ul class="stx-autocomplete-list">';for(let O of Q)j+=`<li class="stx-autocomplete-item ${O.value===Z?"stx-autocomplete-item--selected":""}" data-value="${B(O.value)}">${B(O.label)}</li>`;return j+="</ul>",`<div class="${K}" ${E?`style='${E}'`:""}>${j}</div>`}function AQ(Y){let{text:Q,htmlFor:Z,required:X=!1,size:$="medium",id:J=L("label"),className:U,style:q}=Y,G=V("stx-label",`stx-label--${$}`,U),_=D(q);return`<label id="${J}" class="${G}" ${Z?`for='${B(Z)}'`:""} ${_?`style='${_}'`:""}>${B(Q)}${X?'<span class="stx-label-required">*</span>':""}</label>`}function NQ(Y){let{src:Q,alt:Z="",width:X,height:$,objectFit:J="cover",fallback:U,loading:q="lazy",id:G=L("image"),className:_,style:K}=Y,E=V("stx-image",_),R={objectFit:J};if(X)R.width=typeof X==="number"?`${X}px`:X;if($)R.height=typeof $==="number"?`${$}px`:$;let F=[D(R),D(K)].filter(Boolean).join("; "),j=U?`onerror="this.src='${B(U)}'"`:"";return`<img id="${G}" class="${E}" src="${B(Q)}" alt="${B(Z)}" loading="${q}" ${F?`style='${F}'`:""} ${j} />`}function kQ(Y){let{text:Q,variant:Z="default",size:X="medium",removable:$=!1,icon:J,id:U=L("chip"),className:q,style:G}=Y,_=V("stx-chip",`stx-chip--${Z}`,`stx-chip--${X}`,q),K=D(G),E="";if(J)E+=`<span class="stx-chip-icon">${J}</span>`;if(E+=`<span class="stx-chip-text">${B(Q)}</span>`,$)E+='<button class="stx-chip-remove" type="button">&times;</button>';return`<span id="${U}" class="${_}" ${K?`style='${K}'`:""}>${E}</span>`}function xQ(Y){let{text:Q,position:Z="top",delay:X=200,children:$,id:J=L("tooltip"),className:U,style:q}=Y,G=V("stx-tooltip-wrapper",U),_=D(q);return`<div id="${J}" class="${G}" ${_?`style="${_}"`:""} data-tooltip="${B(Q)}" data-position="${Z}" data-delay="${X}">
29
+ </div>`,`<div class="${E}" ${R?`style='${R}'`:""}>${L}</div>`}function AQ(Y){let{value:Q="",disabled:Z=!1,label:X,step:$=60,min:G,max:K,id:q=z("time"),className:J,style:B}=Y,U=O("stx-time-picker",Z&&"stx-time-picker--disabled",J),E=V(B),R=['type="time"',`id="${q}"`,Q&&`value="${_(Q)}"`,`step="${$}"`,G&&`min="${_(G)}"`,K&&`max="${_(K)}"`,Z&&"disabled"].filter(Boolean).join(" "),F="";if(X)F+=`<label class="stx-time-picker-label" for="${q}">${_(X)}</label>`;return F+=`<input ${R} class="stx-time-picker-input" />`,`<div class="${U}" ${E?`style='${E}'`:""}>${F}</div>`}function NQ(Y){let{options:Q,value:Z="",placeholder:X="Search...",disabled:$=!1,label:G,loading:K=!1,id:q=z("autocomplete"),className:J,style:B}=Y,U=O("stx-autocomplete",$&&"stx-autocomplete--disabled",J),E=V(B),R=Q.find((M)=>M.value===Z),F=R?R.label:Z,j="";if(G)j+=`<label class="stx-autocomplete-label" for="${q}">${_(G)}</label>`;j+=`<div class="stx-autocomplete-input-wrapper">
30
+ <input type="text" id="${q}" value="${_(F)}" placeholder="${_(X)}" ${$?"disabled":""} autocomplete="off" class="stx-autocomplete-input" />
31
+ ${K?'<span class="stx-autocomplete-spinner"></span>':""}
32
+ </div>`,j+='<ul class="stx-autocomplete-list">';for(let M of Q)j+=`<li class="stx-autocomplete-item ${M.value===Z?"stx-autocomplete-item--selected":""}" data-value="${_(M.value)}">${_(M.label)}</li>`;return j+="</ul>",`<div class="${U}" ${E?`style='${E}'`:""}>${j}</div>`}function xQ(Y){let{text:Q,htmlFor:Z,required:X=!1,size:$="medium",id:G=z("label"),className:K,style:q}=Y,J=O("stx-label",`stx-label--${$}`,K),B=V(q);return`<label id="${G}" class="${J}" ${Z?`for='${_(Z)}'`:""} ${B?`style='${B}'`:""}>${_(Q)}${X?'<span class="stx-label-required">*</span>':""}</label>`}function IQ(Y){let{src:Q,alt:Z="",width:X,height:$,objectFit:G="cover",fallback:K,loading:q="lazy",id:J=z("image"),className:B,style:U}=Y,E=O("stx-image",B),R={objectFit:G};if(X)R.width=typeof X==="number"?`${X}px`:X;if($)R.height=typeof $==="number"?`${$}px`:$;let F=[V(R),V(U)].filter(Boolean).join("; "),j=K?`onerror="this.src='${_(K)}'"`:"";return`<img id="${J}" class="${E}" src="${_(Q)}" alt="${_(Z)}" loading="${q}" ${F?`style='${F}'`:""} ${j} />`}function kQ(Y){let{text:Q,variant:Z="default",size:X="medium",removable:$=!1,icon:G,id:K=z("chip"),className:q,style:J}=Y,B=O("stx-chip",`stx-chip--${Z}`,`stx-chip--${X}`,q),U=V(J),E="";if(G)E+=`<span class="stx-chip-icon">${G}</span>`;if(E+=`<span class="stx-chip-text">${_(Q)}</span>`,$)E+='<button class="stx-chip-remove" type="button">&times;</button>';return`<span id="${K}" class="${B}" ${U?`style='${U}'`:""}>${E}</span>`}function CQ(Y){let{text:Q,position:Z="top",delay:X=200,children:$,id:G=z("tooltip"),className:K,style:q}=Y,J=O("stx-tooltip-wrapper",K),B=V(q);return`<div id="${G}" class="${J}" ${B?`style="${B}"`:""} data-tooltip="${_(Q)}" data-position="${Z}" data-delay="${X}">
33
33
  ${$}
34
- <span class="stx-tooltip stx-tooltip--${Z}">${B(Q)}</span>
35
- </div>`}function CQ(Y){let{direction:Q="vertical",showScrollbar:Z=!0,smooth:X=!0,height:$,width:J,children:U,id:q=L("scroll"),className:G,style:_}=Y,K=V("stx-scroll-view",`stx-scroll-view--${Q}`,!Z&&"stx-scroll-view--hide-scrollbar",X&&"stx-scroll-view--smooth",G),E={};if($)E.height=typeof $==="number"?`${$}px`:$;if(J)E.width=typeof J==="number"?`${J}px`:J;let R=[D(E),D(_)].filter(Boolean).join("; ");return`<div id="${q}" class="${K}" ${R?`style='${R}'`:""}>${U}</div>`}function IQ(Y){let{direction:Q="horizontal",sizes:Z=[50,50],resizable:X=!0,children:$,id:J=L("split"),className:U,style:q}=Y,G=V("stx-split-view",`stx-split-view--${Q}`,X&&"stx-split-view--resizable",U),_=D(q),K=Q==="horizontal"?"width":"height";return`<div id="${J}" class="${G}" ${_?`style="${_}"`:""}>
36
- <div class="stx-split-pane" style="${K}: ${Z[0]}%">${$[0]}</div>
34
+ <span class="stx-tooltip stx-tooltip--${Z}">${_(Q)}</span>
35
+ </div>`}function HQ(Y){let{direction:Q="vertical",showScrollbar:Z=!0,smooth:X=!0,height:$,width:G,children:K,id:q=z("scroll"),className:J,style:B}=Y,U=O("stx-scroll-view",`stx-scroll-view--${Q}`,!Z&&"stx-scroll-view--hide-scrollbar",X&&"stx-scroll-view--smooth",J),E={};if($)E.height=typeof $==="number"?`${$}px`:$;if(G)E.width=typeof G==="number"?`${G}px`:G;let R=[V(E),V(B)].filter(Boolean).join("; ");return`<div id="${q}" class="${U}" ${R?`style='${R}'`:""}>${K}</div>`}function vQ(Y){let{direction:Q="horizontal",sizes:Z=[50,50],resizable:X=!0,children:$,id:G=z("split"),className:K,style:q}=Y,J=O("stx-split-view",`stx-split-view--${Q}`,X&&"stx-split-view--resizable",K),B=V(q),U=Q==="horizontal"?"width":"height";return`<div id="${G}" class="${J}" ${B?`style="${B}"`:""}>
36
+ <div class="stx-split-pane" style="${U}: ${Z[0]}%">${$[0]}</div>
37
37
  ${X?'<div class="stx-split-divider"></div>':""}
38
- <div class="stx-split-pane" style="${K}: ${Z[1]}%">${$[1]}</div>
39
- </div>`}function HQ(Y){let{items:Q,multiple:Z=!1,defaultOpen:X=[],id:$=L("accordion"),className:J,style:U}=Y,q=V("stx-accordion",J),G=D(U),_="";return Q.forEach((K,E)=>{let R=X.includes(E),F=V("stx-accordion-item",R&&"stx-accordion-item--open",K.disabled&&"stx-accordion-item--disabled");_+=`<div class="${F}" data-index="${E}">
40
- <button class="stx-accordion-header" ${K.disabled?"disabled":""} aria-expanded="${R}" data-multiple="${Z}">
41
- <span class="stx-accordion-title">${B(K.title)}</span>
38
+ <div class="stx-split-pane" style="${U}: ${Z[1]}%">${$[1]}</div>
39
+ </div>`}function wQ(Y){let{items:Q,multiple:Z=!1,defaultOpen:X=[],id:$=z("accordion"),className:G,style:K}=Y,q=O("stx-accordion",G),J=V(K),B="";return Q.forEach((U,E)=>{let R=X.includes(E),F=O("stx-accordion-item",R&&"stx-accordion-item--open",U.disabled&&"stx-accordion-item--disabled");B+=`<div class="${F}" data-index="${E}">
40
+ <button class="stx-accordion-header" ${U.disabled?"disabled":""} aria-expanded="${R}" data-multiple="${Z}">
41
+ <span class="stx-accordion-title">${_(U.title)}</span>
42
42
  <span class="stx-accordion-icon">\u25BC</span>
43
43
  </button>
44
44
  <div class="stx-accordion-content" ${R?"":"hidden"}>
45
- ${B(K.content)}
45
+ ${_(U.content)}
46
46
  </div>
47
- </div>`}),`<div id="${$}" class="${q}" ${G?`style='${G}'`:""}>${_}</div>`}function vQ(Y){let{steps:Q,currentStep:Z,orientation:X="horizontal",id:$=L("stepper"),className:J,style:U}=Y,q=V("stx-stepper",`stx-stepper--${X}`,J),G=D(U),_="";return Q.forEach((K,E)=>{let R=V("stx-step",E<Z&&"stx-step--completed",E===Z&&"stx-step--active");if(_+=`<div class="${R}" data-step="${E}">
47
+ </div>`}),`<div id="${$}" class="${q}" ${J?`style='${J}'`:""}>${B}</div>`}function fQ(Y){let{steps:Q,currentStep:Z,orientation:X="horizontal",id:$=z("stepper"),className:G,style:K}=Y,q=O("stx-stepper",`stx-stepper--${X}`,G),J=V(K),B="";return Q.forEach((U,E)=>{let R=O("stx-step",E<Z&&"stx-step--completed",E===Z&&"stx-step--active");if(B+=`<div class="${R}" data-step="${E}">
48
48
  <div class="stx-step-indicator">
49
49
  ${E<Z?"\u2713":E+1}
50
50
  </div>
51
51
  <div class="stx-step-content">
52
- <div class="stx-step-label">${B(K.label)}</div>
53
- ${K.description?`<div class="stx-step-description">${B(K.description)}</div>`:""}
52
+ <div class="stx-step-label">${_(U.label)}</div>
53
+ ${U.description?`<div class="stx-step-description">${_(U.description)}</div>`:""}
54
54
  </div>
55
- </div>`,E<Q.length-1)_+='<div class="stx-step-connector"></div>'}),`<div id="${$}" class="${q}" ${G?`style='${G}'`:""}>${_}</div>`}function wQ(Y){let{open:Q=!1,title:Z,size:X="medium",closable:$=!0,children:J,footer:U,id:q=L("modal"),className:G,style:_}=Y,K=V("stx-modal-component",`stx-modal-component--${X}`,G),E=D(_);if(!Q)return`<div id="${q}" class="${K} stx-modal-component--hidden" ${E?`style='${E}'`:""}></div>`;let R='<div class="stx-modal-component-overlay">';if(R+='<div class="stx-modal-component-dialog">',Z||$){if(R+='<div class="stx-modal-component-header">',Z)R+=`<h3 class="stx-modal-component-title">${B(Z)}</h3>`;if($)R+='<button class="stx-modal-component-close">&times;</button>';R+="</div>"}if(R+=`<div class="stx-modal-component-body">${J}</div>`,U)R+=`<div class="stx-modal-component-footer">${U}</div>`;return R+="</div></div>",`<div id="${q}" class="${K}" ${E?`style='${E}'`:""}>${R}</div>`}function fQ(Y){let{items:Q,selectable:Z=!1,multiSelect:X=!1,emptyMessage:$="No items",id:J=L("list"),className:U,style:q}=Y,G=V("stx-list-view",Z&&"stx-list-view--selectable",X&&"stx-list-view--multi",U),_=D(q);if(Q.length===0)return`<div id="${J}" class="${G}" ${_?`style="${_}"`:""}>
56
- <div class="stx-list-view-empty">${B($)}</div>
57
- </div>`;let K='<ul class="stx-list-view-items">';for(let E of Q){let R=V("stx-list-view-item",E.selected&&"stx-list-view-item--selected");K+=`<li class="${R}" data-id="${B(E.id)}" ${Z?'tabindex="0"':""}>${E.content}</li>`}return K+="</ul>",`<div id="${J}" class="${G}" ${_?`style='${_}'`:""}>${K}</div>`}function SQ(Y){let{columns:Q,data:Z,striped:X=!1,bordered:$=!1,hoverable:J=!0,sortBy:U,sortOrder:q,id:G=L("table"),className:_,style:K}=Y,E=V("stx-table",X&&"stx-table--striped",$&&"stx-table--bordered",J&&"stx-table--hoverable",_),R=D(K),F="<table>";F+="<thead><tr>";for(let j of Q){let z=j.key===U?`stx-table-sorted stx-table-sorted--${q}`:"",M=j.sortable?'data-sortable="true"':"",v=j.width?`style="width: ${j.width}"`:"";F+=`<th class="${z}" ${M} ${v} data-key="${B(j.key)}">${B(j.label)}${j.sortable?'<span class="stx-table-sort-icon"></span>':""}</th>`}F+="</tr></thead>",F+="<tbody>";for(let j of Z){F+="<tr>";for(let O of Q){let z=j[O.key];F+=`<td>${z!=null?B(String(z)):""}</td>`}F+="</tr>"}return F+="</tbody></table>",`<div id="${G}" class="${E}" ${R?`style='${R}'`:""}>${F}</div>`}function c(Y,Q,Z,X){let $=Q.includes(Y.key),J=Z.includes(Y.key),U=Y.children&&Y.children.length>0,G=`<div class="${V("stx-tree-node",J&&"stx-tree-node--selected",Y.disabled&&"stx-tree-node--disabled")}" data-key="${B(Y.key)}">`;if(G+='<div class="stx-tree-node-content">',U)G+=`<span class="stx-tree-toggle ${$?"stx-tree-toggle--expanded":""}">\u25B6</span>`;else G+='<span class="stx-tree-toggle-placeholder"></span>';if(X)G+=`<input type="checkbox" class="stx-tree-checkbox" ${J?"checked":""} ${Y.disabled?"disabled":""} />`;if(Y.icon)G+=`<span class="stx-tree-icon">${Y.icon}</span>`;if(G+=`<span class="stx-tree-label">${B(Y.label)}</span>`,G+="</div>",U&&$){G+='<div class="stx-tree-children">';for(let _ of Y.children)G+=c(_,Q,Z,X);G+="</div>"}return G+="</div>",G}function gQ(Y){let{nodes:Q,expandedKeys:Z=[],selectedKeys:X=[],checkable:$=!1,id:J=L("tree"),className:U,style:q}=Y,G=V("stx-tree-view",$&&"stx-tree-view--checkable",U),_=D(q),K="";for(let E of Q)K+=c(E,Z,X,$);return`<div id="${J}" class="${G}" role="tree" ${_?`style='${_}'`:""}>${K}</div>`}function bQ(Y){let{columns:Q,data:Z,pagination:X,selectable:$=!1,id:J=L("datagrid"),className:U,style:q}=Y,G=V("stx-data-grid",$&&"stx-data-grid--selectable",U),_=D(q),K='<div class="stx-data-grid-table-wrapper">';if(K+='<table class="stx-data-grid-table">',K+="<thead><tr>",$)K+='<th class="stx-data-grid-select-all"><input type="checkbox" /></th>';for(let E of Q){let R=E.width?`style="width: ${E.width}"`:"";K+=`<th ${R}>
55
+ </div>`,E<Q.length-1)B+='<div class="stx-step-connector"></div>'}),`<div id="${$}" class="${q}" ${J?`style='${J}'`:""}>${B}</div>`}function SQ(Y){let{open:Q=!1,title:Z,size:X="medium",closable:$=!0,children:G,footer:K,id:q=z("modal"),className:J,style:B}=Y,U=O("stx-modal-component",`stx-modal-component--${X}`,J),E=V(B);if(!Q)return`<div id="${q}" class="${U} stx-modal-component--hidden" ${E?`style='${E}'`:""}></div>`;let R='<div class="stx-modal-component-overlay">';if(R+='<div class="stx-modal-component-dialog">',Z||$){if(R+='<div class="stx-modal-component-header">',Z)R+=`<h3 class="stx-modal-component-title">${_(Z)}</h3>`;if($)R+='<button class="stx-modal-component-close">&times;</button>';R+="</div>"}if(R+=`<div class="stx-modal-component-body">${G}</div>`,K)R+=`<div class="stx-modal-component-footer">${K}</div>`;return R+="</div></div>",`<div id="${q}" class="${U}" ${E?`style='${E}'`:""}>${R}</div>`}function gQ(Y){let{items:Q,selectable:Z=!1,multiSelect:X=!1,emptyMessage:$="No items",id:G=z("list"),className:K,style:q}=Y,J=O("stx-list-view",Z&&"stx-list-view--selectable",X&&"stx-list-view--multi",K),B=V(q);if(Q.length===0)return`<div id="${G}" class="${J}" ${B?`style="${B}"`:""}>
56
+ <div class="stx-list-view-empty">${_($)}</div>
57
+ </div>`;let U='<ul class="stx-list-view-items">';for(let E of Q){let R=O("stx-list-view-item",E.selected&&"stx-list-view-item--selected");U+=`<li class="${R}" data-id="${_(E.id)}" ${Z?'tabindex="0"':""}>${E.content}</li>`}return U+="</ul>",`<div id="${G}" class="${J}" ${B?`style='${B}'`:""}>${U}</div>`}function bQ(Y){let{columns:Q,data:Z,striped:X=!1,bordered:$=!1,hoverable:G=!0,sortBy:K,sortOrder:q,id:J=z("table"),className:B,style:U}=Y,E=O("stx-table",X&&"stx-table--striped",$&&"stx-table--bordered",G&&"stx-table--hoverable",B),R=V(U),F="<table>";F+="<thead><tr>";for(let j of Q){let T=j.key===K?`stx-table-sorted stx-table-sorted--${q}`:"",L=j.sortable?'data-sortable="true"':"",v=j.width?`style="width: ${j.width}"`:"";F+=`<th class="${T}" ${L} ${v} data-key="${_(j.key)}">${_(j.label)}${j.sortable?'<span class="stx-table-sort-icon"></span>':""}</th>`}F+="</tr></thead>",F+="<tbody>";for(let j of Z){F+="<tr>";for(let M of Q){let T=j[M.key];F+=`<td>${T!=null?_(String(T)):""}</td>`}F+="</tr>"}return F+="</tbody></table>",`<div id="${J}" class="${E}" ${R?`style='${R}'`:""}>${F}</div>`}function p(Y,Q,Z,X){let $=Q.includes(Y.key),G=Z.includes(Y.key),K=Y.children&&Y.children.length>0,J=`<div class="${O("stx-tree-node",G&&"stx-tree-node--selected",Y.disabled&&"stx-tree-node--disabled")}" data-key="${_(Y.key)}">`;if(J+='<div class="stx-tree-node-content">',K)J+=`<span class="stx-tree-toggle ${$?"stx-tree-toggle--expanded":""}">\u25B6</span>`;else J+='<span class="stx-tree-toggle-placeholder"></span>';if(X)J+=`<input type="checkbox" class="stx-tree-checkbox" ${G?"checked":""} ${Y.disabled?"disabled":""} />`;if(Y.icon)J+=`<span class="stx-tree-icon">${Y.icon}</span>`;if(J+=`<span class="stx-tree-label">${_(Y.label)}</span>`,J+="</div>",K&&$){J+='<div class="stx-tree-children">';for(let B of Y.children)J+=p(B,Q,Z,X);J+="</div>"}return J+="</div>",J}function uQ(Y){let{nodes:Q,expandedKeys:Z=[],selectedKeys:X=[],checkable:$=!1,id:G=z("tree"),className:K,style:q}=Y,J=O("stx-tree-view",$&&"stx-tree-view--checkable",K),B=V(q),U="";for(let E of Q)U+=p(E,Z,X,$);return`<div id="${G}" class="${J}" role="tree" ${B?`style='${B}'`:""}>${U}</div>`}function yQ(Y){let{columns:Q,data:Z,pagination:X,selectable:$=!1,id:G=z("datagrid"),className:K,style:q}=Y,J=O("stx-data-grid",$&&"stx-data-grid--selectable",K),B=V(q),U='<div class="stx-data-grid-table-wrapper">';if(U+='<table class="stx-data-grid-table">',U+="<thead><tr>",$)U+='<th class="stx-data-grid-select-all"><input type="checkbox" /></th>';for(let E of Q){let R=E.width?`style="width: ${E.width}"`:"";U+=`<th ${R}>
58
58
  <div class="stx-data-grid-header-cell">
59
- <span>${B(E.label)}</span>
59
+ <span>${_(E.label)}</span>
60
60
  ${E.sortable?'<button class="stx-data-grid-sort">\u21C5</button>':""}
61
61
  ${E.filterable?'<button class="stx-data-grid-filter">\u22BB</button>':""}
62
62
  </div>
63
- </th>`}K+="</tr></thead>",K+="<tbody>";for(let E of Z){if(K+="<tr>",$)K+='<td class="stx-data-grid-select"><input type="checkbox" /></td>';for(let R of Q){let F=E[R.key];K+=`<td>${F!=null?B(String(F)):""}</td>`}K+="</tr>"}if(K+="</tbody></table></div>",X){let E=Math.ceil(X.total/X.pageSize);K+=`<div class="stx-data-grid-pagination">
63
+ </th>`}U+="</tr></thead>",U+="<tbody>";for(let E of Z){if(U+="<tr>",$)U+='<td class="stx-data-grid-select"><input type="checkbox" /></td>';for(let R of Q){let F=E[R.key];U+=`<td>${F!=null?_(String(F)):""}</td>`}U+="</tr>"}if(U+="</tbody></table></div>",X){let E=Math.ceil(X.total/X.pageSize);U+=`<div class="stx-data-grid-pagination">
64
64
  <span class="stx-data-grid-page-info">Page ${X.page} of ${E} (${X.total} items)</span>
65
65
  <div class="stx-data-grid-page-buttons">
66
66
  <button class="stx-data-grid-page-btn" ${X.page<=1?"disabled":""}>\u25C0</button>
67
67
  <button class="stx-data-grid-page-btn" ${X.page>=E?"disabled":""}>\u25B6</button>
68
68
  </div>
69
- </div>`}return`<div id="${J}" class="${G}" ${_?`style='${_}'`:""}>${K}</div>`}function uQ(Y){let{type:Q,data:Z,options:X={},width:$="100%",height:J=300,id:U=L("chart"),className:q,style:G}=Y,_=V("stx-chart",`stx-chart--${Q}`,q),K={width:typeof $==="number"?`${$}px`:$,height:typeof J==="number"?`${J}px`:J},E=[D(K),D(G)].filter(Boolean).join("; "),R=JSON.stringify({type:Q,data:Z,options:X});return`<div id="${U}" class="${_}" style="${E}" data-chart='${B(R)}'>
69
+ </div>`}return`<div id="${G}" class="${J}" ${B?`style='${B}'`:""}>${U}</div>`}function hQ(Y){let{type:Q,data:Z,options:X={},width:$="100%",height:G=300,id:K=z("chart"),className:q,style:J}=Y,B=O("stx-chart",`stx-chart--${Q}`,q),U={width:typeof $==="number"?`${$}px`:$,height:typeof G==="number"?`${G}px`:G},E=[V(U),V(J)].filter(Boolean).join("; "),R=JSON.stringify({type:Q,data:Z,options:X});return`<div id="${K}" class="${B}" style="${E}" data-chart='${_(R)}'>
70
70
  <div class="stx-chart-placeholder">
71
- ${X.title?`<div class="stx-chart-title">${B(X.title)}</div>`:""}
71
+ ${X.title?`<div class="stx-chart-title">${_(X.title)}</div>`:""}
72
72
  <div class="stx-chart-type">${Q.charAt(0).toUpperCase()+Q.slice(1)} Chart</div>
73
73
  <div class="stx-chart-info">${Z.datasets.length} dataset(s), ${Z.labels.length} labels</div>
74
74
  </div>
75
- </div>`}function yQ(Y){let{value:Q="",language:Z="plaintext",theme:X="dark",lineNumbers:$=!0,readOnly:J=!1,height:U=300,tabSize:q=2,wordWrap:G=!1,id:_=L("code"),className:K,style:E}=Y,R=V("stx-code-editor",`stx-code-editor--${X}`,$&&"stx-code-editor--line-numbers",J&&"stx-code-editor--readonly",G&&"stx-code-editor--wrap",K),F={height:typeof U==="number"?`${U}px`:U},j=[D(F),D(E)].filter(Boolean).join("; "),O=Q.split(`
76
- `),z="";if($){z+='<div class="stx-code-editor-gutter">';for(let M=1;M<=O.length;M++)z+=`<div class="stx-code-editor-line-number">${M}</div>`;z+="</div>"}return z+=`<pre class="stx-code-editor-content"><code class="language-${B(Z)}">${B(Q)}</code></pre>`,`<div id="${_}" class="${R}" style="${j}" data-language="${B(Z)}" data-tab-size="${q}">${z}</div>`}function hQ(Y){let{src:Q,type:Z="video",poster:X,autoplay:$=!1,loop:J=!1,muted:U=!1,controls:q=!0,width:G,height:_,id:K=L("media"),className:E,style:R}=Y,F=V("stx-media-player",`stx-media-player--${Z}`,E),j={};if(G)j.width=typeof G==="number"?`${G}px`:G;if(_)j.height=typeof _==="number"?`${_}px`:_;let O=[D(j),D(R)].filter(Boolean).join("; "),z=[`id="${K}-media"`,`src="${B(Q)}"`,q&&"controls",$&&"autoplay",J&&"loop",U&&"muted",Z==="video"&&X&&`poster="${B(X)}"`].filter(Boolean).join(" "),M=Z==="video"?`<video ${z}>Your browser does not support the video tag.</video>`:`<audio ${z}>Your browser does not support the audio tag.</audio>`;return`<div id="${K}" class="${F}" ${O?`style='${O}'`:""}>${M}</div>`}function mQ(Y){if(Y===void 0)return"";let Q=["B","KB","MB","GB"],Z=Y,X=0;while(Z>=1024&&X<Q.length-1)Z/=1024,X++;return`${Z.toFixed(1)} ${Q[X]}`}function cQ(Y){let{files:Q,viewMode:Z="list",showHidden:X=!1,selectable:$=!0,id:J=L("files"),className:U,style:q}=Y,G=V("stx-file-explorer",`stx-file-explorer--${Z}`,U),_=D(q),K=X?Q:Q.filter((R)=>!R.name.startsWith(".")),E="";if(Z==="list"){E='<table class="stx-file-explorer-list"><thead><tr><th>Name</th><th>Size</th><th>Modified</th></tr></thead><tbody>';for(let R of K){let F=R.icon||(R.type==="folder"?"\uD83D\uDCC1":"\uD83D\uDCC4"),j=R.type==="file"?mQ(R.size):"",O=R.modified?R.modified.toLocaleDateString():"";E+=`<tr class="stx-file-explorer-item ${$?"stx-file-explorer-item--selectable":""}" data-path="${B(R.path)}" data-type="${R.type}">
77
- <td><span class="stx-file-explorer-icon">${F}</span>${B(R.name)}</td>
75
+ </div>`}function mQ(Y){let{value:Q="",language:Z="plaintext",theme:X="dark",lineNumbers:$=!0,readOnly:G=!1,height:K=300,tabSize:q=2,wordWrap:J=!1,id:B=z("code"),className:U,style:E}=Y,R=O("stx-code-editor",`stx-code-editor--${X}`,$&&"stx-code-editor--line-numbers",G&&"stx-code-editor--readonly",J&&"stx-code-editor--wrap",U),F={height:typeof K==="number"?`${K}px`:K},j=[V(F),V(E)].filter(Boolean).join("; "),M=Q.split(`
76
+ `),T="";if($){T+='<div class="stx-code-editor-gutter">';for(let L=1;L<=M.length;L++)T+=`<div class="stx-code-editor-line-number">${L}</div>`;T+="</div>"}return T+=`<pre class="stx-code-editor-content"><code class="language-${_(Z)}">${_(Q)}</code></pre>`,`<div id="${B}" class="${R}" style="${j}" data-language="${_(Z)}" data-tab-size="${q}">${T}</div>`}function cQ(Y){let{src:Q,type:Z="video",poster:X,autoplay:$=!1,loop:G=!1,muted:K=!1,controls:q=!0,width:J,height:B,id:U=z("media"),className:E,style:R}=Y,F=O("stx-media-player",`stx-media-player--${Z}`,E),j={};if(J)j.width=typeof J==="number"?`${J}px`:J;if(B)j.height=typeof B==="number"?`${B}px`:B;let M=[V(j),V(R)].filter(Boolean).join("; "),T=[`id="${U}-media"`,`src="${_(Q)}"`,q&&"controls",$&&"autoplay",G&&"loop",K&&"muted",Z==="video"&&X&&`poster="${_(X)}"`].filter(Boolean).join(" "),L=Z==="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="${U}" class="${F}" ${M?`style='${M}'`:""}>${L}</div>`}function dQ(Y){if(Y===void 0)return"";let Q=["B","KB","MB","GB"],Z=Y,X=0;while(Z>=1024&&X<Q.length-1)Z/=1024,X++;return`${Z.toFixed(1)} ${Q[X]}`}function pQ(Y){let{files:Q,viewMode:Z="list",showHidden:X=!1,selectable:$=!0,id:G=z("files"),className:K,style:q}=Y,J=O("stx-file-explorer",`stx-file-explorer--${Z}`,K),B=V(q),U=X?Q:Q.filter((R)=>!R.name.startsWith(".")),E="";if(Z==="list"){E='<table class="stx-file-explorer-list"><thead><tr><th>Name</th><th>Size</th><th>Modified</th></tr></thead><tbody>';for(let R of U){let F=R.icon||(R.type==="folder"?"\uD83D\uDCC1":"\uD83D\uDCC4"),j=R.type==="file"?dQ(R.size):"",M=R.modified?R.modified.toLocaleDateString():"";E+=`<tr class="stx-file-explorer-item ${$?"stx-file-explorer-item--selectable":""}" data-path="${_(R.path)}" data-type="${R.type}">
77
+ <td><span class="stx-file-explorer-icon">${F}</span>${_(R.name)}</td>
78
78
  <td>${j}</td>
79
- <td>${O}</td>
80
- </tr>`}E+="</tbody></table>"}else{E='<div class="stx-file-explorer-grid">';for(let R of K){let F=R.icon||(R.type==="folder"?"\uD83D\uDCC1":"\uD83D\uDCC4");E+=`<div class="stx-file-explorer-item ${$?"stx-file-explorer-item--selectable":""}" data-path="${B(R.path)}" data-type="${R.type}">
79
+ <td>${M}</td>
80
+ </tr>`}E+="</tbody></table>"}else{E='<div class="stx-file-explorer-grid">';for(let R of U){let F=R.icon||(R.type==="folder"?"\uD83D\uDCC1":"\uD83D\uDCC4");E+=`<div class="stx-file-explorer-item ${$?"stx-file-explorer-item--selectable":""}" data-path="${_(R.path)}" data-type="${R.type}">
81
81
  <div class="stx-file-explorer-icon">${F}</div>
82
- <div class="stx-file-explorer-name">${B(R.name)}</div>
83
- </div>`}E+="</div>"}return`<div id="${J}" class="${G}" ${_?`style='${_}'`:""}>${E}</div>`}function dQ(Y){let{url:Q,width:Z="100%",height:X=400,sandbox:$=!0,allowScripts:J=!0,id:U=L("webview"),className:q,style:G}=Y,_=V("stx-webview",q),K={width:typeof Z==="number"?`${Z}px`:Z,height:typeof X==="number"?`${X}px`:X},E=[D(K),D(G)].filter(Boolean).join("; "),R=[];if($){if(R.push("allow-same-origin"),J)R.push("allow-scripts")}let F=$?`sandbox="${R.join(" ")}"`:"";return`<iframe id="${U}" class="${_}" src="${B(Q)}" style="${E}" ${F} loading="lazy" frameborder="0"></iframe>`}var pQ=["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"],rQ=`
82
+ <div class="stx-file-explorer-name">${_(R.name)}</div>
83
+ </div>`}E+="</div>"}return`<div id="${G}" class="${J}" ${B?`style='${B}'`:""}>${E}</div>`}function rQ(Y){let{url:Q,width:Z="100%",height:X=400,sandbox:$=!0,allowScripts:G=!0,id:K=z("webview"),className:q,style:J}=Y,B=O("stx-webview",q),U={width:typeof Z==="number"?`${Z}px`:Z,height:typeof X==="number"?`${X}px`:X},E=[V(U),V(J)].filter(Boolean).join("; "),R=[];if($){if(R.push("allow-same-origin"),G)R.push("allow-scripts")}let F=$?`sandbox="${R.join(" ")}"`:"";return`<iframe id="${K}" class="${B}" src="${_(Q)}" style="${E}" ${F} loading="lazy" frameborder="0"></iframe>`}var nQ=["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"],oQ=`
84
84
  /* Button */
85
85
  .stx-button {
86
86
  display: inline-flex;
@@ -437,7 +437,7 @@ import{$ as hZ,$a as h0,A as FZ,Aa as B0,B as jZ,Ba as F0,C as DZ,Ca as j0,D as
437
437
  .stx-chip--warning { background: #3a2a1a; }
438
438
  .stx-chip--error { background: #3a1a1a; }
439
439
  }
440
- `;import d from"process";function nQ(){if(d.platform)return d.platform;return"unknown"}function r(){if(typeof window<"u"&&window.craft?.tray)return!0;return!1}function n(Y,Q){if(Y.type==="separator")return{id:`sep-${Q}`,label:"",type:"separator"};let Z={id:`item-${Q}-${Y.label.replace(/\s+/g,"-").toLowerCase()}`,label:Y.label,type:Y.type||"normal",enabled:Y.enabled!==!1};if(Y.accelerator)Z.shortcut=Y.accelerator;if(Y.type==="checkbox")Z.checked=Y.checked||!1;if(Y.type==="submenu"&&Y.submenu)Z.submenu=Y.submenu.map((X,$)=>n(X,$));return Z}function g(Y){return Y.map((Q,Z)=>n(Q,Z))}function o(Y,Q=0){if(Y.type==="separator")return'<hr class="stx-tray-separator" />';let Z=" ".repeat(Q),X=Y.enabled===!1?"disabled":"",$=Y.checked?"\u2713 ":"",J=Y.accelerator?`<span class="accelerator">${Y.accelerator}</span>`:"",U=`${Z}<div class="stx-tray-item ${X}" data-action="${Y.label}">`;if(U+=`<span class="label">${$}${Y.label}</span>${J}`,Y.type==="submenu"&&Y.submenu){U+='<span class="arrow">\u25B8</span>',U+='<div class="stx-tray-submenu">';for(let q of Y.submenu)U+=o(q,Q+1);U+="</div>"}return U+="</div>",U}function oQ(Y){let Q='<div class="stx-tray-menu">';for(let Z of Y)Q+=o(Z);return Q+="</div>",Q}var A=new Map;function lQ(){return`tray-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}var p=!1;function aQ(){if(p||typeof window>"u")return;window.addEventListener("craft:tray:menu",(Y)=>{let{action:Q}=Y.detail;for(let Z of A.values()){let X=Z.handlers.get(Q);if(X){X();break}}}),p=!0}async function l(Y={}){let Q=lQ(),Z=nQ(),X=r(),$={icon:Y.icon||"",tooltip:Y.tooltip||"stx Application",menu:Y.menu||[],visible:!0},J=new Map;for(let q of Y.menu||[]){if(q.type!=="separator"&&q.onClick)J.set(q.label,q.onClick);if(q.type==="submenu"&&q.submenu){for(let G of q.submenu)if(G.type!=="separator"&&G.onClick)J.set(G.label,G.onClick)}}if(A.set(Q,{state:$,handlers:J}),X){aQ();let q=window;try{if($.tooltip)await q.craft.tray.setTitle({title:$.tooltip}),await q.craft.tray.setTooltip({tooltip:$.tooltip});if($.icon)await q.craft.tray.setIcon({icon:$.icon});let G=g($.menu);await q.craft.tray.setMenu({items:G}),console.log(`[stx-tray] Native tray created for ${Z}`)}catch(G){console.warn("[stx-tray] Failed to create native tray:",G)}}else console.log("[stx-tray] Created simulated tray (not in Craft window)"),console.log(`[stx-tray] ID: ${Q}`),console.log(`[stx-tray] Tooltip: ${$.tooltip}`),console.log(`[stx-tray] Menu items: ${$.menu.length}`);return{id:Q,setIcon:(q)=>{if($.icon=q,X)window.craft.tray.setIcon({icon:q}).catch((_)=>{console.warn("[stx-tray] Failed to set icon:",_)});console.log(`[stx-tray:${Q}] Icon updated`)},setTooltip:(q)=>{if($.tooltip=q,X)window.craft.tray.setTooltip({tooltip:q}).catch((_)=>{console.warn("[stx-tray] Failed to set tooltip:",_)});console.log(`[stx-tray:${Q}] Tooltip: ${q}`)},setMenu:(q)=>{$.menu=q,J.clear();for(let G of q){if(G.type!=="separator"&&G.onClick)J.set(G.label,G.onClick);if(G.type==="submenu"&&G.submenu){for(let _ of G.submenu)if(_.type!=="separator"&&_.onClick)J.set(_.label,_.onClick)}}if(X){let G=window,_=g(q);G.craft.tray.setMenu({items:_}).catch((K)=>{console.warn("[stx-tray] Failed to set menu:",K)})}console.log(`[stx-tray:${Q}] Menu updated (${q.length} items)`)},destroy:()=>{if($.visible=!1,A.delete(Q),X)window.craft.tray.destroy?.().catch((G)=>{console.warn("[stx-tray] Failed to destroy tray:",G)});console.log(`[stx-tray:${Q}] Destroyed`)}}}var iQ=l;function sQ(){return Array.from(A.keys())}function tQ(Y){let Q=A.get(Y);if(!Q)return null;let Z=r();return{id:Y,setIcon:(X)=>{if(Q.state.icon=X,Z)window.craft.tray.setIcon({icon:X}).catch(()=>{})},setTooltip:(X)=>{if(Q.state.tooltip=X,Z)window.craft.tray.setTooltip({tooltip:X}).catch(()=>{})},setMenu:(X)=>{if(Q.state.menu=X,Z){let $=window,J=g(X);$.craft.tray.setMenu({items:J}).catch(()=>{})}},destroy:()=>{if(A.delete(Y),Z)window.craft.tray.destroy?.().catch(()=>{})}}}function eQ(Y,Q){let Z=A.get(Y);if(!Z)return!1;let X=Z.handlers.get(Q);if(X)return X(),!0;return!1}function QY(Y){let Q=A.get(Y);if(!Q)return null;return oQ(Q.state.menu)}function YY(){return`
440
+ `;import r from"process";function lQ(){if(r.platform)return r.platform;return"unknown"}function o(){if(typeof window<"u"&&window.craft?.tray)return!0;return!1}function l(Y,Q){if(Y.type==="separator")return{id:`sep-${Q}`,label:"",type:"separator"};let Z={id:`item-${Q}-${Y.label.replace(/\s+/g,"-").toLowerCase()}`,label:Y.label,type:Y.type||"normal",enabled:Y.enabled!==!1};if(Y.accelerator)Z.shortcut=Y.accelerator;if(Y.type==="checkbox")Z.checked=Y.checked||!1;if(Y.type==="submenu"&&Y.submenu)Z.submenu=Y.submenu.map((X,$)=>l(X,$));return Z}function g(Y){return Y.map((Q,Z)=>l(Q,Z))}function a(Y,Q=0){if(Y.type==="separator")return'<hr class="stx-tray-separator" />';let Z=" ".repeat(Q),X=Y.enabled===!1?"disabled":"",$=Y.checked?"\u2713 ":"",G=Y.accelerator?`<span class="accelerator">${Y.accelerator}</span>`:"",K=`${Z}<div class="stx-tray-item ${X}" data-action="${Y.label}">`;if(K+=`<span class="label">${$}${Y.label}</span>${G}`,Y.type==="submenu"&&Y.submenu){K+='<span class="arrow">\u25B8</span>',K+='<div class="stx-tray-submenu">';for(let q of Y.submenu)K+=a(q,Q+1);K+="</div>"}return K+="</div>",K}function aQ(Y){let Q='<div class="stx-tray-menu">';for(let Z of Y)Q+=a(Z);return Q+="</div>",Q}var A=new Map;function iQ(){return`tray-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}var n=!1;function sQ(){if(n||typeof window>"u")return;window.addEventListener("craft:tray:menu",(Y)=>{let{action:Q}=Y.detail;for(let Z of A.values()){let X=Z.handlers.get(Q);if(X){X();break}}}),n=!0}async function i(Y={}){let Q=iQ(),Z=lQ(),X=o(),$={icon:Y.icon||"",tooltip:Y.tooltip||"stx Application",menu:Y.menu||[],visible:!0},G=new Map;for(let q of Y.menu||[]){if(q.type!=="separator"&&q.onClick)G.set(q.label,q.onClick);if(q.type==="submenu"&&q.submenu){for(let J of q.submenu)if(J.type!=="separator"&&J.onClick)G.set(J.label,J.onClick)}}if(A.set(Q,{state:$,handlers:G}),X){sQ();let q=window;try{if($.tooltip)await q.craft.tray.setTitle({title:$.tooltip}),await q.craft.tray.setTooltip({tooltip:$.tooltip});if($.icon)await q.craft.tray.setIcon({icon:$.icon});let J=g($.menu);await q.craft.tray.setMenu({items:J}),console.log(`[stx-tray] Native tray created for ${Z}`)}catch(J){console.warn("[stx-tray] Failed to create native tray:",J)}}else console.log("[stx-tray] Created simulated tray (not in Craft window)"),console.log(`[stx-tray] ID: ${Q}`),console.log(`[stx-tray] Tooltip: ${$.tooltip}`),console.log(`[stx-tray] Menu items: ${$.menu.length}`);return{id:Q,setIcon:(q)=>{if($.icon=q,X)window.craft.tray.setIcon({icon:q}).catch((B)=>{console.warn("[stx-tray] Failed to set icon:",B)});console.log(`[stx-tray:${Q}] Icon updated`)},setTooltip:(q)=>{if($.tooltip=q,X)window.craft.tray.setTooltip({tooltip:q}).catch((B)=>{console.warn("[stx-tray] Failed to set tooltip:",B)});console.log(`[stx-tray:${Q}] Tooltip: ${q}`)},setMenu:(q)=>{$.menu=q,G.clear();for(let J of q){if(J.type!=="separator"&&J.onClick)G.set(J.label,J.onClick);if(J.type==="submenu"&&J.submenu){for(let B of J.submenu)if(B.type!=="separator"&&B.onClick)G.set(B.label,B.onClick)}}if(X){let J=window,B=g(q);J.craft.tray.setMenu({items:B}).catch((U)=>{console.warn("[stx-tray] Failed to set menu:",U)})}console.log(`[stx-tray:${Q}] Menu updated (${q.length} items)`)},destroy:()=>{if($.visible=!1,A.delete(Q),X)window.craft.tray.destroy?.().catch((J)=>{console.warn("[stx-tray] Failed to destroy tray:",J)});console.log(`[stx-tray:${Q}] Destroyed`)}}}var tQ=i;function eQ(){return Array.from(A.keys())}function QY(Y){let Q=A.get(Y);if(!Q)return null;let Z=o();return{id:Y,setIcon:(X)=>{if(Q.state.icon=X,Z)window.craft.tray.setIcon({icon:X}).catch(()=>{})},setTooltip:(X)=>{if(Q.state.tooltip=X,Z)window.craft.tray.setTooltip({tooltip:X}).catch(()=>{})},setMenu:(X)=>{if(Q.state.menu=X,Z){let $=window,G=g(X);$.craft.tray.setMenu({items:G}).catch(()=>{})}},destroy:()=>{if(A.delete(Y),Z)window.craft.tray.destroy?.().catch(()=>{})}}}function YY(Y,Q){let Z=A.get(Y);if(!Z)return!1;let X=Z.handlers.get(Q);if(X)return X(),!0;return!1}function ZY(Y){let Q=A.get(Y);if(!Q)return null;return aQ(Q.state.menu)}function XY(){return`
441
441
  // STX Desktop Tray Bridge
442
442
  // Provides convenient wrappers around window.craft.tray APIs
443
443
  window.stxTray = {
@@ -450,7 +450,7 @@ window.stxTray = {
450
450
  // Check if tray is available
451
451
  isAvailable: () => typeof window.craft?.tray !== 'undefined',
452
452
  };
453
- `}var ZY=`
453
+ `}var $Y=`
454
454
  .stx-tray-menu {
455
455
  background: #2d2d2d;
456
456
  border-radius: 8px;
@@ -516,7 +516,7 @@ window.stxTray = {
516
516
  .stx-tray-item:hover > .stx-tray-submenu {
517
517
  display: block;
518
518
  }
519
- `;import P from"process";import{existsSync as XY}from"fs";import{dirname as $Y,join as GY}from"path";import{craftBinaryNotFoundMessage as a,resolveCraftBinary as JY}from"craft-native";var k={};function qY(Y){k={...k,...Y}}function RY(){return{...k}}function UY(){k={}}function b(Y){if(!Y.sidebarConfig)return;let Q={...Y.sidebarConfig};if(Q.variant==="desktop")Q.material=Q.material??"sidebar",Q.backgroundEffect=Q.backgroundEffect??"shimmer",Q.allowsVibrancy=Q.allowsVibrancy??!0;return Q}function w(){let Y=[P.env.CRAFT_BINARY_PATH,k.craftBinaryPath,...k.additionalSearchPaths||[],GY($Y(P.execPath),"craft")];for(let Q of Y)if(Q&&XY(Q))return Q;return JY()}var W=new Map;function KY(){return Array.from(W.keys())}function _Y(Y){let Q=W.get(Y);if(!Q)return null;return f(Y,Q.app)}function EY(){for(let[Y,Q]of W)try{Q.app?.close?.()}catch(Z){console.warn(`Failed to close window ${Y}:`,Z)}W.clear()}function f(Y,Q){return{id:Y,show:()=>{console.log(`[stx/desktop] Window ${Y} shown`)},hide:()=>{console.log("[stx/desktop] To hide window, use window.craft.window.hide() from inside the webview")},close:()=>{let Z=W.get(Y);if(Z?.app)Z.app.close(),W.delete(Y),console.log(`[stx/desktop] Window ${Y} 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:(Z)=>{console.log(`[stx/desktop] To set title, use window.craft.window.setTitle({ title: "${Z}" }) from inside the webview`)},loadURL:(Z)=>{console.log(`[stx/desktop] To navigate, use window.location.href = "${Z}" from inside the webview`)},reload:()=>{console.log("[stx/desktop] To reload, use window.craft.window.reload() from inside the webview")}}}function u(Y,Q={}){let Z=["--url",Y,"--title",Q.title||"stx Desktop","--width",String(Q.width??1200),"--height",String(Q.height??800)];if(Q.darkMode)Z.push("--dark");if(Q.hotReload)Z.push("--hot-reload");if(Q.resizable===!1)Z.push("--no-resize");if(Q.frameless)Z.push("--frameless");if(Q.alwaysOnTop)Z.push("--always-on-top");if(Q.titlebarHidden)Z.push("--titlebar-hidden");if(Q.systemTray)Z.push("--system-tray");if(Q.hideDockIcon)Z.push("--hide-dock-icon");if(Q.devTools===!1)Z.push("--no-devtools");if(Q.nativeSidebar)Z.push("--native-sidebar");if(Q.sidebarWidth!==void 0)Z.push("--sidebar-width",String(Q.sidebarWidth));let X=b(Q);if(X)Z.push("--sidebar-config",JSON.stringify(X));return Z}async function BY(Y,Q={}){let Z=`craft-window-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,X=w();try{let{createApp:$}=await import("craft-native"),J=$({url:Y,craftPath:X,window:{title:Q.title||"stx Desktop",width:Q.width??1200,height:Q.height??800,darkMode:Q.darkMode??!1,hotReload:Q.hotReload??!1,resizable:Q.resizable??!0,frameless:Q.frameless??!1,alwaysOnTop:Q.alwaysOnTop??!1,titlebarHidden:Q.titlebarHidden??!1,systemTray:Q.systemTray??!1,hideDockIcon:Q.hideDockIcon??!1,devTools:Q.devTools??!1,nativeSidebar:Q.nativeSidebar??!1,sidebarWidth:Q.sidebarWidth,sidebarConfig:b(Q)}});return W.set(Z,{app:J,url:Y,options:Q}),await J.show(),f(Z,J)}catch{try{let{spawn:$}=await import("child_process"),J=$(X,u(Y,Q),{stdio:"inherit"});J.on("error",(q)=>{console.error(q.code==="ENOENT"?a(X):`craft child error: ${q.message}`)});let U={close:()=>J.kill()};return W.set(Z,{app:U,url:Y,options:Q}),f(Z,U)}catch($){return console.error("Failed to spawn craft binary:",$.message),null}}}async function FY(Y,Q={}){let Z=`http://localhost:${Y}/`;if(P.env.NODE_ENV==="test"||P.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:$}=await import("craft-native");console.log("\u26A1 Opening native window via craft-native\u2026");let J=!Q.nativeSidebar,U=b(Q),q=$({url:Z,craftPath:w(),window:{title:Q.title||"stx Development",width:Q.width||1400,height:Q.height||900,resizable:!0,systemTray:J,darkMode:Q.darkMode??!0,hotReload:Q.hotReload??!0,devTools:!0,titlebarHidden:Q.titlebarHidden??!1,nativeSidebar:Q.nativeSidebar??!1,sidebarWidth:Q.sidebarWidth??260,sidebarConfig:U}}),G=`dev-window-${Y}`;return W.set(G,{app:q,url:Z,options:Q}),await q.show(),console.log(`\u2713 Native window opened at ${Z}`),!0}catch{let $=w();try{console.log(`\u26A1 Opening native window via craft binary (${$})\u2026`);let{spawn:J}=await import("child_process"),U=J($,u(Z,{title:"stx Development",width:1400,height:900,hotReload:!0,...Q}),{stdio:"inherit"});U.on("exit",()=>P.exit(0)),U.on("error",(G)=>{console.warn(G.code==="ENOENT"?a($):`craft child error: ${G.message}`)});let q=`dev-window-${Y}`;return W.set(q,{app:{close:()=>U.kill()},url:Z,options:Q}),console.log(`\u2713 Native window opened at ${Z}`),!0}catch(J){console.warn("\u26A0 Could not spawn craft binary:",J.message)}if(P.env.NODE_ENV==="test"||P.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:J}=await import("child_process"),U=P.platform;return J(U==="darwin"?"open":U==="win32"?"cmd":"xdg-open",U==="win32"?["/c","start",Z]:[Z],{detached:!0,stdio:"ignore"}).unref(),console.log(`\u2713 Browser opened at ${Z}`),!0}catch(J){return console.error("Could not open browser:",J),console.log(`Please open manually: ${Z}`),!1}}}async function jY(Y,Q={}){let{title:Z="stx Desktop",width:X=1200,height:$=800,darkMode:J=!1,hotReload:U=!1,resizable:q=!0,frameless:G=!1,alwaysOnTop:_=!1}=Q;try{let{createApp:K}=await import("craft-native"),E=w(),R=K({html:Y,craftPath:E,window:{title:Z,width:X,height:$,darkMode:J,hotReload:U,resizable:q,frameless:G,alwaysOnTop:_}}),F=`craft-window-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return W.set(F,{app:R,url:"html-content",options:Q}),await R.show(),f(F,R)}catch(K){return console.error("Failed to create window with HTML:",K),null}}function DY(){try{return N.resolve("craft-native"),!0}catch{return!1}}function VY(){return`
519
+ `;import W from"process";import{existsSync as JY}from"fs";import{dirname as GY,join as qY}from"path";import{craftBinaryNotFoundMessage as s,resolveCraftBinary as RY}from"craft-native";var x={};function KY(Y){x={...x,...Y}}function UY(){return{...x}}function BY(){x={}}function b(Y){if(!Y.sidebarConfig)return;let Q={...Y.sidebarConfig};if(Q.variant==="desktop")Q.material=Q.material??"sidebar",Q.backgroundEffect=Q.backgroundEffect??"shimmer",Q.allowsVibrancy=Q.allowsVibrancy??!0;return Q}function w(){let Y=[W.env.CRAFT_BINARY_PATH,x.craftBinaryPath,...x.additionalSearchPaths||[],qY(GY(W.execPath),"craft")];for(let Q of Y)if(Q&&JY(Q))return Q;return RY()}var D=new Map;function u(Y){let Q=D.get(Y);if(!Q||Q.closed)return;Q.closed=!0;for(let Z of Q.closeListeners??[])try{Z()}catch(X){console.warn(`[stx/desktop] window ${Y} close listener threw:`,X)}Q.closeListeners?.clear()}var EY=50;async function y(Y,Q){let Z=Q.show().then(()=>({failed:!1}),($)=>({failed:!0,error:$})),X=await Promise.race([Z,new Promise(($)=>setTimeout(()=>$(null),EY))]);if(X?.failed)throw X.error;Z.then(()=>u(Y))}function _Y(){return Array.from(D.keys())}function FY(Y){let Q=D.get(Y);if(!Q)return null;return f(Y,Q.app)}function jY(){for(let[Y,Q]of D)try{Q.app?.close?.()}catch(Z){console.warn(`Failed to close window ${Y}:`,Z)}D.clear()}function f(Y,Q){return{id:Y,show:()=>{console.log(`[stx/desktop] Window ${Y} shown`)},hide:()=>{console.log("[stx/desktop] To hide window, use window.craft.window.hide() from inside the webview")},close:()=>{let Z=D.get(Y);if(Z?.app)Z.app.close(),u(Y),D.delete(Y),console.log(`[stx/desktop] Window ${Y} closed`)},onClosed:(Z)=>{let X=D.get(Y);if(!X||X.closed)return queueMicrotask(Z),()=>{};return X.closeListeners??=new Set,X.closeListeners.add(Z),()=>X.closeListeners?.delete(Z)},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:(Z)=>{console.log(`[stx/desktop] To set title, use window.craft.window.setTitle({ title: "${Z}" }) from inside the webview`)},loadURL:(Z)=>{console.log(`[stx/desktop] To navigate, use window.location.href = "${Z}" from inside the webview`)},reload:()=>{console.log("[stx/desktop] To reload, use window.craft.window.reload() from inside the webview")}}}function h(Y,Q={}){let Z=["--url",Y,"--title",Q.title||"stx Desktop","--width",String(Q.width??1200),"--height",String(Q.height??800)];if(Q.darkMode)Z.push("--dark");if(Q.hotReload)Z.push("--hot-reload");if(Q.resizable===!1)Z.push("--no-resize");if(Q.frameless)Z.push("--frameless");if(Q.alwaysOnTop)Z.push("--always-on-top");if(Q.titlebarHidden)Z.push("--titlebar-hidden");if(Q.systemTray)Z.push("--system-tray");if(Q.hideDockIcon)Z.push("--hide-dock-icon");if(Q.devTools===!1)Z.push("--no-devtools");if(Q.nativeSidebar)Z.push("--native-sidebar");if(Q.sidebarWidth!==void 0)Z.push("--sidebar-width",String(Q.sidebarWidth));let X=b(Q);if(X)Z.push("--sidebar-config",JSON.stringify(X));return Z}async function VY(Y,Q={}){let Z=`craft-window-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,X=w();try{let{createApp:$}=await import("craft-native"),G=$({url:Y,craftPath:X,window:{title:Q.title||"stx Desktop",width:Q.width??1200,height:Q.height??800,darkMode:Q.darkMode??!1,hotReload:Q.hotReload??!1,resizable:Q.resizable??!0,frameless:Q.frameless??!1,alwaysOnTop:Q.alwaysOnTop??!1,titlebarHidden:Q.titlebarHidden??!1,systemTray:Q.systemTray??!1,hideDockIcon:Q.hideDockIcon??!1,devTools:Q.devTools??!1,nativeSidebar:Q.nativeSidebar??!1,sidebarWidth:Q.sidebarWidth,sidebarConfig:b(Q)}});return D.set(Z,{app:G,url:Y,options:Q}),await y(Z,G),f(Z,G)}catch{try{let{spawn:$}=await import("child_process"),G=$(X,h(Y,Q),{stdio:"inherit"});G.on("error",(q)=>{console.error(q.code==="ENOENT"?s(X):`craft child error: ${q.message}`)});let K={close:()=>G.kill()};return D.set(Z,{app:K,url:Y,options:Q}),G.on("exit",()=>u(Z)),f(Z,K)}catch($){return console.error("Failed to spawn craft binary:",$.message),null}}}async function OY(Y,Q={}){let Z=`http://localhost:${Y}/`;if(W.env.NODE_ENV==="test"||W.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:$}=await import("craft-native");console.log("\u26A1 Opening native window via craft-native\u2026");let G=!Q.nativeSidebar,K=b(Q),q=$({url:Z,craftPath:w(),window:{title:Q.title||"stx Development",width:Q.width||1400,height:Q.height||900,resizable:!0,systemTray:G,darkMode:Q.darkMode??!0,hotReload:Q.hotReload??!0,devTools:!0,titlebarHidden:Q.titlebarHidden??!1,nativeSidebar:Q.nativeSidebar??!1,sidebarWidth:Q.sidebarWidth??260,sidebarConfig:K}}),J=`dev-window-${Y}`;return D.set(J,{app:q,url:Z,options:Q}),await y(J,q),console.log(`\u2713 Native window opened at ${Z}`),!0}catch{let $=w();try{console.log(`\u26A1 Opening native window via craft binary (${$})\u2026`);let{spawn:G}=await import("child_process"),K=G($,h(Z,{title:"stx Development",width:1400,height:900,hotReload:!0,...Q}),{stdio:"inherit"});K.on("exit",()=>W.exit(0)),K.on("error",(J)=>{console.warn(J.code==="ENOENT"?s($):`craft child error: ${J.message}`)});let q=`dev-window-${Y}`;return D.set(q,{app:{close:()=>K.kill()},url:Z,options:Q}),console.log(`\u2713 Native window opened at ${Z}`),!0}catch(G){console.warn("\u26A0 Could not spawn craft binary:",G.message)}if(W.env.NODE_ENV==="test"||W.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:G}=await import("child_process"),K=W.platform;return G(K==="darwin"?"open":K==="win32"?"cmd":"xdg-open",K==="win32"?["/c","start",Z]:[Z],{detached:!0,stdio:"ignore"}).unref(),console.log(`\u2713 Browser opened at ${Z}`),!0}catch(G){return console.error("Could not open browser:",G),console.log(`Please open manually: ${Z}`),!1}}}async function zY(Y,Q={}){let{title:Z="stx Desktop",width:X=1200,height:$=800,darkMode:G=!1,hotReload:K=!1,resizable:q=!0,frameless:J=!1,alwaysOnTop:B=!1}=Q;try{let{createApp:U}=await import("craft-native"),E=w(),R=U({html:Y,craftPath:E,window:{title:Z,width:X,height:$,darkMode:G,hotReload:K,resizable:q,frameless:J,alwaysOnTop:B}}),F=`craft-window-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return D.set(F,{app:R,url:"html-content",options:Q}),await y(F,R),f(F,R)}catch(U){return console.error("Failed to create window with HTML:",U),null}}function MY(){try{return N.resolve("craft-native"),!0}catch{return!1}}function TY(){return`
520
520
  // STX Desktop Window Bridge
521
521
  // Provides convenient wrappers around window.craft APIs
522
522
  window.stxWindow = {
@@ -557,7 +557,7 @@ window.stxWindow = {
557
557
 
558
558
  // Expose as global for backwards compatibility
559
559
  window.desktop = window.stxWindow;
560
- `}import{pack as LY,packageApp as OY}from"craft-native";import{craftBinaryNotFoundMessage as zY,resolveCraftBinary as MY}from"craft-native";import{AutoUpdater as i,generateUpdateManifest as s}from"craft-native";var t="update.json";function e(Y,Q){return`https://github.com/${Y}/releases/latest/download/${Q}`}function QQ(Y,Q,Z){return`https://github.com/${Y}/releases/download/${Q}/${Z}`}function TY(Y){let{repository:Q,manifestAsset:Z=t,...X}=Y;return new i({...X,updateUrl:e(Q,Z)})}function WY(Y){let Q=Y.tag??`v${Y.version}`,Z={};for(let[X,$]of Object.entries(Y.artifacts)){if(!$)continue;Z[X]={path:$,url:QQ(Y.repository,Q,$.split("/").pop())}}return s({version:Y.version,releaseNotes:Y.releaseNotes,platforms:Z})}import{existsSync as y,mkdirSync as PY,readFileSync as AY,watch as NY,writeFileSync as kY}from"fs";import{homedir as xY,platform as CY}from"os";import{dirname as IY,join as H}from"path";function HY(Y){let Q=CY(),Z=xY();switch(Q){case"darwin":return H(Z,"Library","Application Support",Y);case"win32":return H(process.env.APPDATA||H(Z,"AppData","Roaming"),Y);default:return H(Z,".config",Y)}}class YQ{_defaults;_data;_path;_changeHandlers=new Map;_anyChangeHandlers=new Set;_watcher=null;_writeTimer=null;_writing=!1;constructor(Y){this._defaults={...Y.defaults};let Q=Y.path?IY(Y.path):HY(Y.name);if(this._path=Y.path||H(Q,"preferences.json"),!y(Q))PY(Q,{recursive:!0});if(this._data=this._load(),Y.watch!==!1)this._setupWatcher()}get path(){return this._path}get(Y){if(Y in this._data)return this._data[Y];return this._defaults[Y]}set(Y,Q){let Z=this.get(Y);if(JSON.stringify(Z)===JSON.stringify(Q))return;this._data[Y]=Q,this._scheduleSave(),this._notifyChange(Y,Q,Z)}getAll(){return{...this._defaults,...this._data}}has(Y){return Y in this._data}delete(Y){if(!(Y in this._data))return;let Q=this._data[Y];delete this._data[Y],this._scheduleSave(),this._notifyChange(Y,this._defaults[Y],Q)}reset(){let Y={...this._data};this._data={},this._save();for(let Q of Object.keys(Y)){let Z=this._defaults[Q];this._notifyChange(Q,Z,Y[Q])}}onChange(Y,Q){let Z=Y;if(!this._changeHandlers.has(Z))this._changeHandlers.set(Z,new Set);return this._changeHandlers.get(Z).add(Q),()=>{this._changeHandlers.get(Z)?.delete(Q)}}onAnyChange(Y){return this._anyChangeHandlers.add(Y),()=>{this._anyChangeHandlers.delete(Y)}}close(){if(this._watcher)this._watcher.close(),this._watcher=null;if(this._writeTimer)clearTimeout(this._writeTimer),this._writeTimer=null,this._save()}_load(){try{if(y(this._path)){let Y=AY(this._path,"utf-8");return JSON.parse(Y)}}catch{}return{}}_save(){this._writing=!0;try{let Y=JSON.stringify({...this._defaults,...this._data},null,2);kY(this._path,Y,"utf-8")}catch(Y){console.error(`Failed to save preferences to ${this._path}:`,Y)}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(!y(this._path))this._save();this._watcher=NY(this._path,()=>{if(this._writing)return;let Y=this._load(),Q={...this._data};this._data=Y;let Z=new Set([...Object.keys(Q),...Object.keys(Y)]);for(let X of Z){let $=X in Q?Q[X]:this._defaults[X],J=X in Y?Y[X]:this._defaults[X];if(JSON.stringify($)!==JSON.stringify(J))this._notifyChange(X,J,$)}})}catch{}}_notifyChange(Y,Q,Z){let X=this._changeHandlers.get(Y);if(X)for(let $ of X)try{$(Q,Z)}catch{}for(let $ of this._anyChangeHandlers)try{$(Y,Q,Z)}catch{}}}function vY(Y){return new YQ(Y)}import{existsSync as x,mkdirSync as ZQ,readFileSync as wY,unlinkSync as XQ,writeFileSync as $Q}from"fs";import{homedir as S,platform as GQ}from"os";import{join as C}from"path";function JQ(Y){let Q=Y.toLowerCase().replace(/[^a-z0-9]/g,"-");return C(S(),"Library","LaunchAgents",`com.${Q}.plist`)}function qQ(Y){let Q=process.env.XDG_CONFIG_HOME||C(S(),".config");return C(Q,"autostart",`${Y.toLowerCase()}.desktop`)}async function fY(Y,Q){let Z=Q.appName||"StxApp",X=JQ(Z),$=C(S(),"Library","LaunchAgents");if(Y){let J=Q.appPath||process.execPath,U=Q.args||[],q=[J,...U],G=`<?xml version="1.0" encoding="UTF-8"?>
560
+ `}import{pack as LY,packageApp as DY}from"craft-native";import{craftBinaryNotFoundMessage as PY,resolveCraftBinary as WY}from"craft-native";import{AutoUpdater as t,generateUpdateManifest as e}from"craft-native";var QQ="update.json";function YQ(Y,Q){return`https://github.com/${Y}/releases/latest/download/${Q}`}function ZQ(Y,Q,Z){return`https://github.com/${Y}/releases/download/${Q}/${Z}`}function AY(Y){let{repository:Q,manifestAsset:Z=QQ,...X}=Y;return new t({...X,updateUrl:YQ(Q,Z)})}function NY(Y){let Q=Y.tag??`v${Y.version}`,Z={};for(let[X,$]of Object.entries(Y.artifacts)){if(!$)continue;Z[X]={path:$,url:ZQ(Y.repository,Q,$.split("/").pop())}}return e({version:Y.version,releaseNotes:Y.releaseNotes,platforms:Z})}import{existsSync as m,mkdirSync as xY,readFileSync as IY,watch as kY,writeFileSync as CY}from"fs";import{homedir as HY,platform as vY}from"os";import{dirname as wY,join as H}from"path";function fY(Y){let Q=vY(),Z=HY();switch(Q){case"darwin":return H(Z,"Library","Application Support",Y);case"win32":return H(process.env.APPDATA||H(Z,"AppData","Roaming"),Y);default:return H(Z,".config",Y)}}class XQ{_defaults;_data;_path;_changeHandlers=new Map;_anyChangeHandlers=new Set;_watcher=null;_writeTimer=null;_writing=!1;constructor(Y){this._defaults={...Y.defaults};let Q=Y.path?wY(Y.path):fY(Y.name);if(this._path=Y.path||H(Q,"preferences.json"),!m(Q))xY(Q,{recursive:!0});if(this._data=this._load(),Y.watch!==!1)this._setupWatcher()}get path(){return this._path}get(Y){if(Y in this._data)return this._data[Y];return this._defaults[Y]}set(Y,Q){let Z=this.get(Y);if(JSON.stringify(Z)===JSON.stringify(Q))return;this._data[Y]=Q,this._scheduleSave(),this._notifyChange(Y,Q,Z)}getAll(){return{...this._defaults,...this._data}}has(Y){return Y in this._data}delete(Y){if(!(Y in this._data))return;let Q=this._data[Y];delete this._data[Y],this._scheduleSave(),this._notifyChange(Y,this._defaults[Y],Q)}reset(){let Y={...this._data};this._data={},this._save();for(let Q of Object.keys(Y)){let Z=this._defaults[Q];this._notifyChange(Q,Z,Y[Q])}}onChange(Y,Q){let Z=Y;if(!this._changeHandlers.has(Z))this._changeHandlers.set(Z,new Set);return this._changeHandlers.get(Z).add(Q),()=>{this._changeHandlers.get(Z)?.delete(Q)}}onAnyChange(Y){return this._anyChangeHandlers.add(Y),()=>{this._anyChangeHandlers.delete(Y)}}close(){if(this._watcher)this._watcher.close(),this._watcher=null;if(this._writeTimer)clearTimeout(this._writeTimer),this._writeTimer=null,this._save()}_load(){try{if(m(this._path)){let Y=IY(this._path,"utf-8");return JSON.parse(Y)}}catch{}return{}}_save(){this._writing=!0;try{let Y=JSON.stringify({...this._defaults,...this._data},null,2);CY(this._path,Y,"utf-8")}catch(Y){console.error(`Failed to save preferences to ${this._path}:`,Y)}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(!m(this._path))this._save();this._watcher=kY(this._path,()=>{if(this._writing)return;let Y=this._load(),Q={...this._data};this._data=Y;let Z=new Set([...Object.keys(Q),...Object.keys(Y)]);for(let X of Z){let $=X in Q?Q[X]:this._defaults[X],G=X in Y?Y[X]:this._defaults[X];if(JSON.stringify($)!==JSON.stringify(G))this._notifyChange(X,G,$)}})}catch{}}_notifyChange(Y,Q,Z){let X=this._changeHandlers.get(Y);if(X)for(let $ of X)try{$(Q,Z)}catch{}for(let $ of this._anyChangeHandlers)try{$(Y,Q,Z)}catch{}}}function SY(Y){return new XQ(Y)}import{existsSync as I,mkdirSync as $Q,readFileSync as gY,unlinkSync as JQ,writeFileSync as GQ}from"fs";import{homedir as S,platform as qQ}from"os";import{join as k}from"path";function RQ(Y){let Q=Y.toLowerCase().replace(/[^a-z0-9]/g,"-");return k(S(),"Library","LaunchAgents",`com.${Q}.plist`)}function KQ(Y){let Q=process.env.XDG_CONFIG_HOME||k(S(),".config");return k(Q,"autostart",`${Y.toLowerCase()}.desktop`)}async function bY(Y,Q){let Z=Q.appName||"StxApp",X=RQ(Z),$=k(S(),"Library","LaunchAgents");if(Y){let G=Q.appPath||process.execPath,K=Q.args||[],q=[G,...K],J=`<?xml version="1.0" encoding="UTF-8"?>
561
561
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
562
562
  <plist version="1.0">
563
563
  <dict>
@@ -565,7 +565,7 @@ window.desktop = window.stxWindow;
565
565
  <string>com.${Z.toLowerCase().replace(/[^a-z0-9]/g,"-")}</string>
566
566
  <key>ProgramArguments</key>
567
567
  <array>
568
- ${q.map((_)=>` <string>${uY(_)}</string>`).join(`
568
+ ${q.map((B)=>` <string>${mY(B)}</string>`).join(`
569
569
  `)}
570
570
  </array>
571
571
  <key>RunAtLoad</key>
@@ -575,7 +575,7 @@ ${q.map((_)=>` <string>${uY(_)}</string>`).join(`
575
575
  ${Q.isHidden?` <key>ProcessType</key>
576
576
  <string>Background</string>`:""}
577
577
  </dict>
578
- </plist>`;if(!x($))ZQ($,{recursive:!0});$Q(X,G,"utf-8")}else if(x(X))XQ(X)}async function SY(Y,Q){let Z=Q.appName||"StxApp",X=qQ(Z),$=C(process.env.XDG_CONFIG_HOME||C(S(),".config"),"autostart");if(Y){let J=Q.appPath||process.execPath,U=Q.args||[],q=[J,...U].join(" "),G=`[Desktop Entry]
578
+ </plist>`;if(!I($))$Q($,{recursive:!0});GQ(X,J,"utf-8")}else if(I(X))JQ(X)}async function uY(Y,Q){let Z=Q.appName||"StxApp",X=KQ(Z),$=k(process.env.XDG_CONFIG_HOME||k(S(),".config"),"autostart");if(Y){let G=Q.appPath||process.execPath,K=Q.args||[],q=[G,...K].join(" "),J=`[Desktop Entry]
579
579
  Type=Application
580
580
  Name=${Z}
581
581
  Exec=${q}
@@ -583,4 +583,4 @@ Terminal=false
583
583
  StartupNotify=false
584
584
  ${Q.isHidden?`X-GNOME-Autostart-enabled=true
585
585
  NoDisplay=true`:""}
586
- `;if(!x($))ZQ($,{recursive:!0});$Q(X,G,"utf-8")}else if(x(X))XQ(X)}async function gY(Y){return x(JQ(Y))}async function bY(Y){let Q=qQ(Y);if(!x(Q))return!1;try{let Z=wY(Q,"utf-8");if(Z.includes("X-GNOME-Autostart-enabled=false"))return!1;if(Z.includes("Hidden=true"))return!1;return!0}catch{return!1}}function uY(Y){return Y.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}async function yY(Y,Q={}){let Z=GQ();switch(Z){case"darwin":return fY(Y,Q);case"linux":return SY(Y,Q);default:throw Error(`Auto-launch is not yet supported on ${Z}`)}}async function hY(Y){let Q=Y||"StxApp";switch(GQ()){case"darwin":return gY(Q);case"linux":return bY(Q);default:return!1}}var mY={accentColor:()=>T("system","accentColor",()=>""),highlightColor:()=>T("system","highlightColor",()=>""),language:()=>T("system","language",()=>{if(typeof navigator>"u")return"";return navigator.language?.split("-")[0]||""}),locale:()=>T("system","locale",()=>{if(typeof navigator>"u")return"";return navigator.language||""}),timezone:()=>T("system","timezone",()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch{return""}}),is24HourTime:()=>T("system","is24HourTime",()=>{try{let Y=new Intl.DateTimeFormat([],{hour:"numeric"}).resolvedOptions();return Y.hourCycle==="h23"||Y.hourCycle==="h24"}catch{return!1}}),reduceMotion:()=>T("system","reduceMotion",()=>h("(prefers-reduced-motion: reduce)")),reduceTransparency:()=>T("system","reduceTransparency",()=>h("(prefers-reduced-transparency: reduce)")),increaseContrast:()=>T("system","increaseContrast",()=>h("(prefers-contrast: more)")),systemVersion:()=>T("system","systemVersion",()=>""),hostname:()=>T("system","hostname",()=>""),username:()=>T("system","username",()=>""),async openPreferences(){if(m("system"))await window.craft.system.openPreferences()}};async function T(Y,Q,Z){if(m(Y))return await window.craft[Y][Q]();return await Z()}function h(Y){if(typeof window>"u"||!window.matchMedia)return!1;return window.matchMedia(Y).matches}export{iZ as windowEvents,O0 as watchScreenSharing,f0 as vision,aZ as updater,IZ as unregisterHotkey,HZ as unregisterAllHotkeys,eQ as triggerTrayAction,$0 as touchbar,dZ as theme,x0 as tags,mY as system,v0 as spotlight,w0 as speechRecognition,J0 as speech,U0 as signPayload,oY as showWarningToast,ZZ as showWarningModal,OZ as showWarningDialog,pY as showToast,nY as showSuccessToast,$Z as showSuccessModal,BZ as showSaveDialog,GZ as showQuestionModal,EZ as showOpenDialog,QZ as showModal,FZ as showMessageBox,rY as showInfoToast,YZ as showInfoModal,lY as showErrorToast,XZ as showErrorModal,LZ as showErrorDialog,VZ as showConfirmDialog,jZ as showColorPicker,DZ as showAlertDialog,dY as showAlert,mZ as shell,qY as setDesktopConfig,yY as setAutoLaunch,u0 as serviceMenu,y0 as serial,L0 as screenSharing,F0 as screenCapture,eZ as screen,MY as resolveCraftBinary,UY as resetDesktopConfig,cY as requestNotificationPermission,CZ as registerHotkey,R0 as redactPII,RZ as prompt,Z0 as printing,Y0 as permissions,C0 as pdf,kZ as parseShortcut,OY as packageApp,LY as pack,FY as openDevWindow,aY as notify,yZ as notifications,lZ as network,X0 as nativeAutoLaunch,S0 as midi,tZ as menu,I0 as log,B0 as location,W0 as localServer,E0 as liveActivities,Q0 as keychain,DY as isWebviewAvailable,rZ as isDragOutAvailable,WZ as isCaffeinated,c0 as isAvailable,hY as isAutoLaunchEnabled,K0 as iap,M0 as hasFocusShortcuts,_0 as handoff,cZ as globalShortcuts,QQ as githubReleaseAssetUrl,e as githubLatestAssetUrl,VY as getWindowBridgeScript,_Y as getWindow,tQ as getTrayInstance,YY as getTrayBridgeScript,QY as getSimulatedTrayHTML,vZ as getRegisteredHotkeys,zZ as getDialogBridgeScript,RY as getDesktopConfig,m0 as getCapability,h0 as getCapabilities,PZ as getCaffeinateStatus,KY as getActiveWindowIds,sQ as getActiveTrayInstances,UZ as getActiveModalCount,tY as getActiveAlertCount,s as generateUpdateManifest,hZ as fs,gZ as formatTime,xZ as formatShortcut,AZ as formatRemainingTime,NZ as formatDuration,bZ as formatCompact,T0 as focusShortcutsReady,z0 as focus,k0 as fileAssociations,pZ as dragOut,sY as dismissAllAlerts,iY as dismissAlertById,SZ as delay,nZ as deepLinks,TZ as decaffeinate,jY as createWindowWithHTML,BY as createWindow,dQ as createWebView,gQ as createTreeView,xQ as createTooltip,wZ as createTimer,WQ as createTimePicker,KQ as createTextInput,VQ as createTabs,SQ as createTable,l as createSystemTray,vQ as createStepper,IQ as createSplitView,EQ as createSlider,CQ as createScrollView,OQ as createRating,zQ as createRadioButton,BQ as createProgressBar,vY as createPreferences,wQ as createModalComponent,iQ as createMenubar,hQ as createMediaPlayer,fQ as createListView,AQ as createLabel,fZ as createInterval,NQ as createImageView,TY as createGitHubUpdater,WY as createGitHubUpdateManifest,cQ as createFileExplorer,LQ as createDropdown,TQ as createDatePicker,bQ as createDataGrid,MQ as createColorPicker,yQ as createCodeEditor,kQ as createChip,_Q as createCheckbox,uQ as createChart,DQ as createCard,UQ as createButton,FQ as createBadge,jQ as createAvatar,PQ as createAutocomplete,HQ as createAccordion,q0 as crashReporter,u as craftWindowArguments,zY as craftBinaryNotFoundMessage,g0 as coreml,b0 as continuityCamera,JZ as confirm,EY as closeAllWindows,KZ as closeAllModals,uZ as clipboard,MZ as caffeinate,H0 as bonjour,G0 as bluetooth,P0 as biometric,oZ as battery,A0 as audio,N0 as appleScript,sZ as appInfo,qZ as alert,t as UPDATE_MANIFEST_ASSET,ZY as TRAY_MENU_STYLES,eY as TOAST_STYLES,_Z as MODAL_STYLES,j0 as MIN_WATCH_INTERVAL_MS,D0 as MAX_WATCH_INTERVAL_MS,V0 as DEFAULT_WATCH_INTERVAL_MS,rQ as COMPONENT_STYLES,i as AutoUpdater,pQ as AVAILABLE_COMPONENTS};
586
+ `;if(!I($))$Q($,{recursive:!0});GQ(X,J,"utf-8")}else if(I(X))JQ(X)}async function yY(Y){return I(RQ(Y))}async function hY(Y){let Q=KQ(Y);if(!I(Q))return!1;try{let Z=gY(Q,"utf-8");if(Z.includes("X-GNOME-Autostart-enabled=false"))return!1;if(Z.includes("Hidden=true"))return!1;return!0}catch{return!1}}function mY(Y){return Y.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}async function cY(Y,Q={}){let Z=qQ();switch(Z){case"darwin":return bY(Y,Q);case"linux":return uY(Y,Q);default:throw Error(`Auto-launch is not yet supported on ${Z}`)}}async function dY(Y){let Q=Y||"StxApp";switch(qQ()){case"darwin":return yY(Q);case"linux":return hY(Q);default:return!1}}var pY={accentColor:()=>P("system","accentColor",()=>""),highlightColor:()=>P("system","highlightColor",()=>""),language:()=>P("system","language",()=>{if(typeof navigator>"u")return"";return navigator.language?.split("-")[0]||""}),locale:()=>P("system","locale",()=>{if(typeof navigator>"u")return"";return navigator.language||""}),timezone:()=>P("system","timezone",()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch{return""}}),is24HourTime:()=>P("system","is24HourTime",()=>{try{let Y=new Intl.DateTimeFormat([],{hour:"numeric"}).resolvedOptions();return Y.hourCycle==="h23"||Y.hourCycle==="h24"}catch{return!1}}),reduceMotion:()=>P("system","reduceMotion",()=>c("(prefers-reduced-motion: reduce)")),reduceTransparency:()=>P("system","reduceTransparency",()=>c("(prefers-reduced-transparency: reduce)")),increaseContrast:()=>P("system","increaseContrast",()=>c("(prefers-contrast: more)")),systemVersion:()=>P("system","systemVersion",()=>""),hostname:()=>P("system","hostname",()=>""),username:()=>P("system","username",()=>""),async openPreferences(){if(d("system"))await window.craft.system.openPreferences()}};async function P(Y,Q,Z){if(d(Y))return await window.craft[Y][Q]();return await Z()}function c(Y){if(typeof window>"u"||!window.matchMedia)return!1;return window.matchMedia(Y).matches}export{eZ as windowEvents,D0 as watchScreenSharing,b0 as vision,tZ as updater,wZ as unregisterHotkey,fZ as unregisterAllHotkeys,YY as triggerTrayAction,q0 as touchbar,nZ as theme,H0 as tags,pY as system,S0 as spotlight,g0 as speechRecognition,K0 as speech,E0 as signPayload,iY as showWarningToast,JZ as showWarningModal,DZ as showWarningDialog,oY as showToast,aY as showSuccessToast,qZ as showSuccessModal,VZ as showSaveDialog,RZ as showQuestionModal,jZ as showOpenDialog,XZ as showModal,OZ as showMessageBox,lY as showInfoToast,$Z as showInfoModal,sY as showErrorToast,GZ as showErrorModal,LZ as showErrorDialog,TZ as showConfirmDialog,zZ as showColorPicker,MZ as showAlertDialog,nY as showAlert,pZ as shell,KY as setDesktopConfig,cY as setAutoLaunch,m0 as serviceMenu,c0 as serial,L0 as screenSharing,O0 as screenCapture,Z0 as screen,WY as resolveCraftBinary,BY as resetDesktopConfig,rY as requestNotificationPermission,vZ as registerHotkey,B0 as redactPII,BZ as prompt,J0 as printing,$0 as permissions,v0 as pdf,CZ as parseShortcut,DY as packageApp,LY as pack,OY as openDevWindow,tY as notify,cZ as notifications,sZ as network,G0 as nativeAutoLaunch,u0 as midi,Y0 as menu,w0 as log,V0 as location,N0 as localServer,j0 as liveActivities,X0 as keychain,MY as isWebviewAvailable,lZ as isDragOutAvailable,NZ as isCaffeinated,r0 as isAvailable,dY as isAutoLaunchEnabled,_0 as iap,W0 as hasFocusShortcuts,F0 as handoff,rZ as globalShortcuts,ZQ as githubReleaseAssetUrl,YQ as githubLatestAssetUrl,TY as getWindowBridgeScript,FY as getWindow,QY as getTrayInstance,XY as getTrayBridgeScript,ZY as getSimulatedTrayHTML,SZ as getRegisteredHotkeys,PZ as getDialogBridgeScript,UY as getDesktopConfig,p0 as getCapability,d0 as getCapabilities,xZ as getCaffeinateStatus,_Y as getActiveWindowIds,eQ as getActiveTrayInstances,EZ as getActiveModalCount,YZ as getActiveAlertCount,e as generateUpdateManifest,dZ as fs,yZ as formatTime,HZ as formatShortcut,IZ as formatRemainingTime,kZ as formatDuration,hZ as formatCompact,A0 as focusShortcutsReady,P0 as focus,C0 as fileAssociations,oZ as dragOut,QZ as dismissAllAlerts,eY as dismissAlertById,uZ as delay,aZ as deepLinks,AZ as decaffeinate,zY as createWindowWithHTML,VY as createWindow,rQ as createWebView,uQ as createTreeView,CQ as createTooltip,gZ as createTimer,AQ as createTimePicker,EQ as createTextInput,MQ as createTabs,bQ as createTable,i as createSystemTray,fQ as createStepper,vQ as createSplitView,FQ as createSlider,HQ as createScrollView,LQ as createRating,DQ as createRadioButton,jQ as createProgressBar,SY as createPreferences,SQ as createModalComponent,tQ as createMenubar,cQ as createMediaPlayer,gQ as createListView,xQ as createLabel,bZ as createInterval,IQ as createImageView,AY as createGitHubUpdater,NY as createGitHubUpdateManifest,pQ as createFileExplorer,TQ as createDropdown,WQ as createDatePicker,yQ as createDataGrid,PQ as createColorPicker,mQ as createCodeEditor,kQ as createChip,_Q as createCheckbox,hQ as createChart,zQ as createCard,BQ as createButton,VQ as createBadge,OQ as createAvatar,NQ as createAutocomplete,wQ as createAccordion,U0 as crashReporter,h as craftWindowArguments,PY as craftBinaryNotFoundMessage,y0 as coreml,h0 as continuityCamera,KZ as confirm,jY as closeAllWindows,_Z as closeAllModals,mZ as clipboard,WZ as caffeinate,f0 as bonjour,R0 as bluetooth,x0 as biometric,iZ as battery,I0 as audio,k0 as appleScript,Q0 as appInfo,UZ as alert,QQ as UPDATE_MANIFEST_ASSET,$Y as TRAY_MENU_STYLES,ZZ as TOAST_STYLES,FZ as MODAL_STYLES,z0 as MIN_WATCH_INTERVAL_MS,M0 as MAX_WATCH_INTERVAL_MS,T0 as DEFAULT_WATCH_INTERVAL_MS,oQ as COMPONENT_STYLES,t as AutoUpdater,nQ as AVAILABLE_COMPONENTS};
package/dist/types.d.ts CHANGED
@@ -129,6 +129,7 @@ export declare interface WindowInstance {
129
129
  setTitle: (title: string) => void
130
130
  loadURL: (url: string) => void
131
131
  reload: () => void
132
+ onClosed: (callback: () => void) => () => void
132
133
  }
133
134
  /**
134
135
  * System tray instance
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/desktop",
3
3
  "type": "module",
4
- "version": "0.2.200",
4
+ "version": "0.2.202",
5
5
  "description": "Native desktop application framework for stx (powered by Craft)",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",