efficient-shell 15.6.0 → 15.8.0

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 (52) hide show
  1. package/README.md +11 -5
  2. package/dist/{Browser-MBT76EKF.js → Browser-5QLDJ74Z.js} +13 -13
  3. package/dist/Calculator-6WNTZLWL.js +29 -0
  4. package/dist/{CurrencyConverter-UAZYLLHT.js → CurrencyConverter-C4KCZWUM.js} +10 -10
  5. package/dist/{Files-G5VBN3GD.js → Files-VFRXPQLV.js} +46 -46
  6. package/dist/{Notepad-23YBRLDH.js → Notepad-S5JMXH2O.js} +9 -9
  7. package/dist/PomodoroTimer-BGTCWT53.js +91 -0
  8. package/dist/{Preview-4VKAQ4TY.js → Preview-HTFTEL7K.js} +19 -19
  9. package/dist/{Stock-6YYK6VWP.js → Stock-LIOPTQG5.js} +6 -6
  10. package/dist/{Weather-2OU3LEWQ.js → Weather-K3BVAFRV.js} +18 -18
  11. package/dist/{WorldClock-PYJ4762U.js → WorldClock-RHAHXLW4.js} +6 -6
  12. package/dist/ai/index.js +8 -8
  13. package/dist/apps/ImageAnnotator.js +1 -1
  14. package/dist/apps/index.js +1 -1
  15. package/dist/bin/browser-check.js +1 -1
  16. package/dist/bin/media-host-check.js +1 -1
  17. package/dist/bin/ui-check.js +1 -1
  18. package/dist/brand.css +1 -1
  19. package/dist/chunk-3AUPCKBR.js +1 -0
  20. package/dist/chunk-6FOLK4HD.js +1 -0
  21. package/dist/{chunk-6ZNJ6JU5.js → chunk-E4WVF6AS.js} +6 -6
  22. package/dist/{chunk-OQAGCYR7.js → chunk-EA423N2F.js} +3 -3
  23. package/dist/chunk-GD5NGS6D.js +89 -0
  24. package/dist/chunk-GZ4AMXEU.js +1 -0
  25. package/dist/{chunk-N3T5BE2T.js → chunk-OHPDB4UN.js} +4 -4
  26. package/dist/{chunk-3C2VY2VF.js → chunk-RRWQBWLW.js} +1 -1
  27. package/dist/chunk-WGDVYCQX.js +69 -0
  28. package/dist/{chunk-OZNCUWYB.js → chunk-XZKVGJIB.js} +1 -1
  29. package/dist/{chunk-NICH2O4C.js → chunk-YFVQKS5U.js} +1 -1
  30. package/dist/chunk-ZLB5GRL6.js +1 -0
  31. package/dist/format/index.d.ts +15 -1
  32. package/dist/format/index.js +1 -1
  33. package/dist/forms/LinkPicker.js +1 -1
  34. package/dist/forms/MediaLibrary.js +1 -1
  35. package/dist/hooks/index.d.ts +42 -1
  36. package/dist/hooks/index.js +1 -1
  37. package/dist/icons/index.js +1 -1
  38. package/dist/index.d.ts +117 -75
  39. package/dist/index.js +662 -662
  40. package/dist/motion.css +9 -4
  41. package/dist/routine-index.json +1 -1
  42. package/dist/shell/LanguageSelect.js +1 -1
  43. package/dist/telemetry/index.js +1 -1
  44. package/dist/ui/index.js +1 -1
  45. package/dist/value-index.json +1 -1
  46. package/dist/version.js +1 -1
  47. package/package.json +1 -1
  48. package/dist/Calculator-PAMITD4N.js +0 -29
  49. package/dist/PomodoroTimer-QFF2FTAG.js +0 -91
  50. package/dist/chunk-IN36HWJK.js +0 -1
  51. package/dist/chunk-TDUOBP55.js +0 -69
  52. package/dist/chunk-XRWUNOI3.js +0 -92
@@ -1,4 +1,4 @@
1
- import{fetchCityWeather as e,getCondition as t,AVAILABLE_CITIES as a,cityClock as r,toFahrenheit as n}from"./chunk-HYHZEQMG.js";import{loadAppearance as i,WidgetSettingsModal as s}from"./chunk-3C2VY2VF.js";import{userZone as o}from"./chunk-NHKT5IH6.js";import"./chunk-36BRD5J3.js";import"./chunk-JRQMX4PK.js";import"./chunk-LF27WIN2.js";import{useWidgetSettings as l}from"./chunk-XRWUNOI3.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-PSVGB7KT.js";import"./chunk-YI4T5I5D.js";import"./chunk-TTD2M6RF.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import"./chunk-JRKD7SD3.js";import"./chunk-5RCKE4X2.js";import"./chunk-EIFNESXS.js";import"./chunk-PO2KNVCC.js";import"./chunk-CJ4OEY3T.js";import"./chunk-5QHNDAZ6.js";import"./chunk-TEQ5ZPAL.js";import"./chunk-VWGWZY7A.js";import"./chunk-DBQNYJZ6.js";import"./chunk-L2WQOJ3T.js";import"./chunk-5VJVEKVM.js";import"./chunk-YPXONNBV.js";import"./chunk-4PJFL26P.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import{useShellPrefs as c}from"./chunk-POBVGDZP.js";import"./chunk-F3ZOO23R.js";import"./chunk-NJY4HPNB.js";import"./chunk-PM6HY5BH.js";import"./chunk-DWGYC7OD.js";import"./chunk-APFDZ2HG.js";import"./chunk-ABIWAS5K.js";import"./chunk-P56YLT73.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-A4ROXNUF.js";import"./chunk-TSZPGDU3.js";import"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as m}from"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import"./chunk-FAPZFMS3.js";import"./chunk-CIZAUBWA.js";import"./chunk-PGN5ME7B.js";import"./chunk-5QRHQCRG.js";import"./chunk-62LW225J.js";import"./chunk-TAHHZGRH.js";import"./chunk-KEFNQEXZ.js";import"./chunk-PU2GJVMG.js";import"./chunk-3FININUU.js";import"./chunk-STKJA4PV.js";import"./chunk-M6UKCZHT.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useState as d,useEffect as h,useCallback as p}from"react";import{jsx as u,jsxs as f,Fragment as y}from"react/jsx-runtime";var x="weather_city",g="weather_appearance",b={useFahrenheit:!1,showLocalTime:!0,use24Hour:!1};function k(){const e="undefined"!=typeof localStorage?localStorage.getItem(x):null;if(e&&a[e])return e;try{const e=JSON.parse(localStorage.getItem("weather_cities")||"");if(Array.isArray(e)&&e[0]&&a[e[0]])return localStorage.setItem(x,e[0]),e[0]}catch{}return function(){const e=o();for(const[t,r]of Object.entries(a))if(r.tz===e)return t;return"London"}()}var w=n;function v(e,t=!1){const{time:a,ampm:n}=r(e,/* @__PURE__ */new Date,t);return n?`${a} ${n}`:a}function N(){/* @__PURE__ */
1
+ import{fetchCityWeather as e,getCondition as t,AVAILABLE_CITIES as a,cityClock as r,toFahrenheit as n}from"./chunk-HYHZEQMG.js";import{loadAppearance as i,WidgetSettingsModal as s}from"./chunk-RRWQBWLW.js";import{userZone as o}from"./chunk-NHKT5IH6.js";import"./chunk-36BRD5J3.js";import"./chunk-JRQMX4PK.js";import"./chunk-LF27WIN2.js";import{useWidgetSettings as l}from"./chunk-GD5NGS6D.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-PSVGB7KT.js";import"./chunk-YI4T5I5D.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import"./chunk-JRKD7SD3.js";import"./chunk-5RCKE4X2.js";import"./chunk-ZLB5GRL6.js";import"./chunk-EIFNESXS.js";import"./chunk-PO2KNVCC.js";import"./chunk-CJ4OEY3T.js";import"./chunk-5QHNDAZ6.js";import"./chunk-TEQ5ZPAL.js";import"./chunk-VWGWZY7A.js";import"./chunk-DBQNYJZ6.js";import"./chunk-L2WQOJ3T.js";import"./chunk-5VJVEKVM.js";import"./chunk-YPXONNBV.js";import"./chunk-4PJFL26P.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import{useShellPrefs as c}from"./chunk-POBVGDZP.js";import"./chunk-F3ZOO23R.js";import"./chunk-NJY4HPNB.js";import"./chunk-PM6HY5BH.js";import"./chunk-DWGYC7OD.js";import"./chunk-APFDZ2HG.js";import"./chunk-ABIWAS5K.js";import"./chunk-P56YLT73.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-A4ROXNUF.js";import"./chunk-TSZPGDU3.js";import"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as m}from"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import"./chunk-FAPZFMS3.js";import"./chunk-CIZAUBWA.js";import"./chunk-PGN5ME7B.js";import"./chunk-5QRHQCRG.js";import"./chunk-62LW225J.js";import"./chunk-TAHHZGRH.js";import"./chunk-KEFNQEXZ.js";import"./chunk-PU2GJVMG.js";import"./chunk-3FININUU.js";import"./chunk-STKJA4PV.js";import"./chunk-GZ4AMXEU.js";import"./chunk-M6UKCZHT.js";import"./chunk-3AUPCKBR.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useState as d,useEffect as h,useCallback as p}from"react";import{jsx as u,jsxs as f,Fragment as y}from"react/jsx-runtime";var x="weather_city",g="weather_appearance",b={useFahrenheit:!1,showLocalTime:!0,use24Hour:!1};function k(){const e="undefined"!=typeof localStorage?localStorage.getItem(x):null;if(e&&a[e])return e;try{const e=JSON.parse(localStorage.getItem("weather_cities")||"");if(Array.isArray(e)&&e[0]&&a[e[0]])return localStorage.setItem(x,e[0]),e[0]}catch{}return function(){const e=o();for(const[t,r]of Object.entries(a))if(r.tz===e)return t;return"London"}()}var w=n;function v(e,t=!1){const{time:a,ampm:n}=r(e,/* @__PURE__ */new Date,t);return n?`${a} ${n}`:a}function N(){/* @__PURE__ */
2
2
  return f("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[
3
3
  /* @__PURE__ */u("div",{className:"absolute -top-5 -right-5 w-24 h-24",style:{animation:"wx-sun-rays 70s linear infinite"},children:/* @__PURE__ */u("svg",{viewBox:"0 0 100 100",className:"w-full h-full",children:Array.from({length:12}).map((e,t)=>/* @__PURE__ */u("rect",{x:49,y:3,width:2,height:14,rx:1,fill:"rgba(255, 232, 130, 0.55)",transform:`rotate(${30*t} 50 50)`},t))})}),
4
4
  /* @__PURE__ */u("div",{className:"absolute top-1 right-1 w-10 h-10 rounded-full",style:{background:"radial-gradient(circle at 35% 35%, #fff8cc 0%, #ffd84a 55%, #ff9e2a 100%)",boxShadow:"0 0 18px 5px rgba(255, 200, 80, 0.55)",animation:"wx-sun-pulse 4.5s ease-in-out infinite"}})]})}function j(){const e=Array.from({length:16}).map((e,t)=>({left:(53*t+11)%95+"%",top:(37*t+9)%78+"%",size:1+13*t%3,delay:.41*t%4+"s",duration:2.5+7*t%5*.6+"s"}));/* @__PURE__ */
@@ -18,43 +18,43 @@ return f("div",{className:"absolute inset-0 overflow-hidden pointer-events-none"
18
18
  /* @__PURE__ */u("div",{className:"absolute",style:{top:"8%",animation:"wx-drift-cloud 42s linear infinite"},children:/* @__PURE__ */u(a,{scale:.9})}),
19
19
  /* @__PURE__ */u("div",{className:"absolute",style:{top:"40%",animation:"wx-drift-cloud 60s linear -22s infinite",opacity:.85},children:/* @__PURE__ */u(a,{scale:1.25})}),
20
20
  /* @__PURE__ */u("div",{className:"absolute",style:{top:"68%",animation:"wx-drift-cloud 78s linear -45s infinite",opacity:.7},children:/* @__PURE__ */u(a,{scale:.75})})]})}function S({heavy:e=!1}){const t=e?26:16,a=["wx-rain-a","wx-rain-b","wx-rain-c"],r=Array.from({length:t}).map((e,r)=>({left:(100*r/t+11*r%7)%100+"%",delay:.087*r%1.3+"s",height:12+r%4*5+"px",duration:.7+r%3*.18+"s",variant:a[r%a.length]}));/* @__PURE__ */
21
- return u("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:r.map((e,t)=>/* @__PURE__ */u("div",{className:"absolute",style:{left:e.left,top:"-20px",width:"1px",height:e.height,background:"linear-gradient(180deg, rgba(180,210,255,0) 0%, rgba(220,235,255,0.85) 90%, rgba(255,255,255,0.95) 100%)",transform:"rotate(8deg)",animation:`${e.variant} ${e.duration} linear ${e.delay} infinite`,transformOrigin:"top"}},t))})}function T(){const e=["wx-snow-a","wx-snow-b","wx-snow-c"],t=Array.from({length:16}).map((t,a)=>({left:(100*a/16+13*a%5)%100+"%",delay:.43*a%5+"s",duration:4.5+a%5+"s",size:3+a%4*1.4,opacity:.65+7*a%4*.08,variant:e[a%e.length]}));/* @__PURE__ */
21
+ return u("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:r.map((e,t)=>/* @__PURE__ */u("div",{className:"absolute",style:{left:e.left,top:"-20px",width:"1px",height:e.height,background:"linear-gradient(180deg, rgba(180,210,255,0) 0%, rgba(220,235,255,0.85) 90%, rgba(255,255,255,0.95) 100%)",transform:"rotate(8deg)",animation:`${e.variant} ${e.duration} linear ${e.delay} infinite`,transformOrigin:"top"}},t))})}function A(){const e=["wx-snow-a","wx-snow-b","wx-snow-c"],t=Array.from({length:16}).map((t,a)=>({left:(100*a/16+13*a%5)%100+"%",delay:.43*a%5+"s",duration:4.5+a%5+"s",size:3+a%4*1.4,opacity:.65+7*a%4*.08,variant:e[a%e.length]}));/* @__PURE__ */
22
22
  return u("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:t.map((e,t)=>/* @__PURE__ */u("div",{className:"absolute rounded-full bg-white",style:{left:e.left,top:"-12px",width:e.size,height:e.size,opacity:e.opacity,boxShadow:"0 0 4px rgba(255,255,255,0.65)",animation:`${e.variant} ${e.duration} linear ${e.delay} infinite`}},t))})}function C(){/* @__PURE__ */
23
23
  return f("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[
24
24
  /* @__PURE__ */u(S,{heavy:!0}),
25
25
  /* @__PURE__ */u("div",{className:"absolute inset-0 bg-white",style:{animation:"wx-flash 6s ease-out infinite"}}),
26
- /* @__PURE__ */u("div",{className:"absolute inset-y-0 right-1/3 flex items-center justify-center pointer-events-none",style:{animation:"wx-bolt 6s ease-out infinite"},children:/* @__PURE__ */u("svg",{viewBox:"0 0 18 60",className:"h-4/5",style:{filter:"drop-shadow(0 0 6px rgba(255, 240, 150, 0.95)) drop-shadow(0 0 14px rgba(255, 220, 90, 0.7))"},children:/* @__PURE__ */u("path",{d:"M11 0 L2 28 L8 30 L4 60 L16 24 L9 22 Z",fill:"rgba(255, 250, 200, 0.98)",stroke:"rgba(255, 255, 255, 0.9)",strokeWidth:.3})})})]})}function A(){/* @__PURE__ */
27
- return u("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:Array.from({length:4}).map((e,t)=>/* @__PURE__ */u("div",{className:"absolute left-0 right-0",style:{top:10+22*t+"%",height:"14px",background:"linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.55) 50%, rgba(255,255,255,0) 100%)",filter:"blur(2px)",animation:`wx-fog-drift ${10+3*t}s ease-in-out ${.7*t}s infinite alternate`}},t))})}function D({code:e,isDay:t}){return 0===e||1===e?/* @__PURE__ */u(t?N:j,{}):2===e?/* @__PURE__ */f(y,{children:[/* @__PURE__ */u(t?N:j,{}),
28
- /* @__PURE__ */u(H,{tone:t?"light":"dark"})]}):3===e?/* @__PURE__ */u(H,{tone:t?"light":"dark"}):45===e||48===e?/* @__PURE__ */u(A,{}):[51,53,61,80,81].includes(e)?/* @__PURE__ */u(S,{}):[55,63,65,82].includes(e)?/* @__PURE__ */u(S,{heavy:!0}):[71,73,75].includes(e)?/* @__PURE__ */u(T,{}):[95,96,99].includes(e)?/* @__PURE__ */u(C,{}):null}function F(){const[r,n]=d(k),[o,N]=d(()=>i(g)),[j,H]=d(null),[S,T]=d(!0),[,C]=d(0);h(()=>{const e=setInterval(()=>C(e=>e+1),6e4);return()=>clearInterval(e)},[]);const[A,F]=d(!1),[P,Z]=d(r),[J,L]=d(o),{prefs:R,save:B}=c(),M={...b,...R.weather_prefs??{}},[I,$]=d(M);l(p(()=>{Z(r),L({...o}),$({...M}),F(!0)},[r,o,M])),h(()=>{let t=!1;return T(!0),e(r).then(e=>{t||(H(e),T(!1))}),()=>{t=!0}},[r]);const G=e=>M.useFahrenheit?`${w(e)}°F`:`${e}°`;if(S&&!j)/* @__PURE__ */
26
+ /* @__PURE__ */u("div",{className:"absolute inset-y-0 right-1/3 flex items-center justify-center pointer-events-none",style:{animation:"wx-bolt 6s ease-out infinite"},children:/* @__PURE__ */u("svg",{viewBox:"0 0 18 60",className:"h-4/5",style:{filter:"drop-shadow(0 0 6px rgba(255, 240, 150, 0.95)) drop-shadow(0 0 14px rgba(255, 220, 90, 0.7))"},children:/* @__PURE__ */u("path",{d:"M11 0 L2 28 L8 30 L4 60 L16 24 L9 22 Z",fill:"rgba(255, 250, 200, 0.98)",stroke:"rgba(255, 255, 255, 0.9)",strokeWidth:.3})})})]})}function D(){/* @__PURE__ */
27
+ return u("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:Array.from({length:4}).map((e,t)=>/* @__PURE__ */u("div",{className:"absolute left-0 right-0",style:{top:10+22*t+"%",height:"14px",background:"linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.55) 50%, rgba(255,255,255,0) 100%)",filter:"blur(2px)",animation:`wx-fog-drift ${10+3*t}s ease-in-out ${.7*t}s infinite alternate`}},t))})}function T({code:e,isDay:t}){return 0===e||1===e?/* @__PURE__ */u(t?N:j,{}):2===e?/* @__PURE__ */f(y,{children:[/* @__PURE__ */u(t?N:j,{}),
28
+ /* @__PURE__ */u(H,{tone:t?"light":"dark"})]}):3===e?/* @__PURE__ */u(H,{tone:t?"light":"dark"}):45===e||48===e?/* @__PURE__ */u(D,{}):[51,53,61,80,81].includes(e)?/* @__PURE__ */u(S,{}):[55,63,65,82].includes(e)?/* @__PURE__ */u(S,{heavy:!0}):[71,73,75].includes(e)?/* @__PURE__ */u(A,{}):[95,96,99].includes(e)?/* @__PURE__ */u(C,{}):null}function L(){const[r,n]=d(k),[o,N]=d(()=>i(g)),[j,H]=d(null),[S,A]=d(!0),[,C]=d(0);h(()=>{const e=setInterval(()=>C(e=>e+1),6e4);return()=>clearInterval(e)},[]);const[D,L]=d(!1),[P,Z]=d(r),[B,F]=d(o),{prefs:R,save:G}=c(),J={...b,...R.weather_prefs??{}},[M,Q]=d(J);l(p(()=>{Z(r),F({...o}),Q({...J}),L(!0)},[r,o,J])),h(()=>{let t=!1;return A(!0),e(r).then(e=>{t||(H(e),A(!1))}),()=>{t=!0}},[r]);const W=e=>J.useFahrenheit?`${w(e)}°F`:`${e}°`;if(S&&!j)/* @__PURE__ */
29
29
  return u("div",{className:"flex items-center justify-center h-full bg-gradient-to-b from-sky-400 to-blue-500 rounded-lg text-on-accent/80 text-xs",style:{minHeight:110},children:/* @__PURE__ */u(m,{size:"sm",padding:"",label:"Loading"})});if(!j)/* @__PURE__ */
30
- return u("div",{className:"flex items-center justify-center h-full bg-slate-700 rounded-lg text-white/80 text-xs",style:{minHeight:110},children:"Couldn't load weather"});const[O,Q,V]=t(j.code,j.isDay);/* @__PURE__ */
30
+ return u("div",{className:"flex items-center justify-center h-full bg-slate-700 rounded-lg text-white/80 text-xs",style:{minHeight:110},children:"Couldn't load weather"});const[$,I,U]=t(j.code,j.isDay);/* @__PURE__ */
31
31
  return f(y,{children:[
32
32
  /* @__PURE__ */u("style",{children:"\n@keyframes wx-rain-a { 0% { transform: translate(0,-20px); opacity: 0; } 10% { opacity: 0.95; } 100% { transform: translate(8px,140px); opacity: 0; } }\n@keyframes wx-rain-b { 0% { transform: translate(0,-20px); opacity: 0; } 12% { opacity: 0.85; } 100% { transform: translate(12px,140px); opacity: 0; } }\n@keyframes wx-rain-c { 0% { transform: translate(0,-20px); opacity: 0; } 10% { opacity: 1; } 100% { transform: translate(5px,140px); opacity: 0; } }\n@keyframes wx-snow-a { 0% { transform: translate(0,-12px) rotate(0deg); opacity: 0; } 10% { opacity: 0.9; } 50% { transform: translate(10px,55px) rotate(180deg); } 100% { transform: translate(-4px,140px) rotate(360deg); opacity: 0; } }\n@keyframes wx-snow-b { 0% { transform: translate(0,-12px) rotate(0deg); opacity: 0; } 10% { opacity: 0.85; } 50% { transform: translate(-12px,55px) rotate(-180deg); } 100% { transform: translate(6px,140px) rotate(-360deg); opacity: 0; } }\n@keyframes wx-snow-c { 0% { transform: translate(0,-12px); opacity: 0; } 10% { opacity: 0.7; } 100% { transform: translate(2px,140px); opacity: 0; } }\n@keyframes wx-drift-cloud { 0% { transform: translateX(-40%); } 100% { transform: translateX(140%); } }\n@keyframes wx-twinkle { 0%, 100% { opacity: 0.25; transform: scale(1); } 50% { opacity: 1; transform: scale(1.6); } }\n@keyframes wx-flash { 0%, 86%, 100% { opacity: 0; } 87% { opacity: 0.95; } 88% { opacity: 0.15; } 89% { opacity: 0.85; } 90% { opacity: 0; } }\n@keyframes wx-bolt { 0%, 86%, 90%, 100% { opacity: 0; } 87% { opacity: 1; } 89% { opacity: 0.85; } }\n@keyframes wx-sun-pulse { 0%, 100% { transform: scale(1); opacity: 0.65; } 50% { transform: scale(1.12); opacity: 0.95; } }\n@keyframes wx-sun-rays { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }\n@keyframes wx-fog-drift { 0% { transform: translateX(-25%); opacity: 0.3; } 50% { opacity: 0.65; } 100% { transform: translateX(25%); opacity: 0.3; } }\n@keyframes wx-shooting-star { 0%, 95% { opacity: 0; transform: translate(0,0) scale(0); } 96% { opacity: 1; transform: translate(0,0) scale(1); } 100% { opacity: 0; transform: translate(40px,30px) scale(1); } }\n"}),
33
- /* @__PURE__ */u("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:`rgba(15, 23, 42, ${o.activeOpacity/100})`,backdropFilter:o.activeBlur>0?`blur(${o.activeBlur}px)`:void 0},children:/* @__PURE__ */f("div",{className:`relative rounded-lg overflow-hidden text-white bg-gradient-to-br ${V}`,style:{height:110},children:[
34
- /* @__PURE__ */u(D,{code:j.code,isDay:j.isDay}),
33
+ /* @__PURE__ */u("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:`rgba(15, 23, 42, ${o.activeOpacity/100})`,backdropFilter:o.activeBlur>0?`blur(${o.activeBlur}px)`:void 0},children:/* @__PURE__ */f("div",{className:`relative rounded-lg overflow-hidden text-white bg-gradient-to-br ${U}`,style:{height:110},children:[
34
+ /* @__PURE__ */u(T,{code:j.code,isDay:j.isDay}),
35
35
  /* @__PURE__ */f("div",{className:"relative z-10 px-3 py-3 flex flex-col h-full justify-between",children:[
36
36
  /* @__PURE__ */f("div",{className:"flex items-start justify-between gap-2",children:[
37
37
  /* @__PURE__ */f("div",{className:"min-w-0 flex-1",children:[
38
- /* @__PURE__ */u("div",{className:"text-base font-semibold leading-tight truncate drop-shadow-sm",children:j.city}),M.showLocalTime&&/* @__PURE__ */u("div",{className:"text-2xs opacity-90 leading-tight tabular-nums drop-shadow-sm",children:v(j.timezone,M.use24Hour)})]}),
39
- /* @__PURE__ */u("div",{className:"text-3xl font-extralight leading-none tracking-tight tabular-nums shrink-0 drop-shadow-sm",children:G(j.temp)})]}),
38
+ /* @__PURE__ */u("div",{className:"text-base font-semibold leading-tight truncate drop-shadow-sm",children:j.city}),J.showLocalTime&&/* @__PURE__ */u("div",{className:"text-2xs opacity-90 leading-tight tabular-nums drop-shadow-sm",children:v(j.timezone,J.use24Hour)})]}),
39
+ /* @__PURE__ */u("div",{className:"text-3xl font-extralight leading-none tracking-tight tabular-nums shrink-0 drop-shadow-sm",children:W(j.temp)})]}),
40
40
  /* @__PURE__ */f("div",{className:"flex items-end justify-between gap-2",children:[
41
41
  /* @__PURE__ */f("div",{className:"flex items-center gap-2 min-w-0",children:[
42
- /* @__PURE__ */u("span",{className:"text-lg leading-none drop-shadow-sm",children:Q}),
43
- /* @__PURE__ */u("span",{className:"text-2xs font-medium drop-shadow-sm truncate",children:O})]}),
44
- /* @__PURE__ */f("span",{className:"text-2xs opacity-90 tabular-nums drop-shadow-sm shrink-0",children:["H:",G(j.high)," L:",G(j.low)]})]})]})]})}),
45
- /* @__PURE__ */f(s,{open:A,onClose:()=>F(!1),title:"Weather Settings",appearance:J,onAppearanceChange:L,onSave:()=>{n(P),N(J),B({weather_prefs:I}),localStorage.setItem(x,P),localStorage.setItem(g,JSON.stringify(J)),F(!1)},children:[
42
+ /* @__PURE__ */u("span",{className:"text-lg leading-none drop-shadow-sm",children:I}),
43
+ /* @__PURE__ */u("span",{className:"text-2xs font-medium drop-shadow-sm truncate",children:$})]}),
44
+ /* @__PURE__ */f("span",{className:"text-2xs opacity-90 tabular-nums drop-shadow-sm shrink-0",children:["H:",W(j.high)," L:",W(j.low)]})]})]})]})}),
45
+ /* @__PURE__ */f(s,{open:D,onClose:()=>L(!1),title:"Weather Settings",appearance:B,onAppearanceChange:F,onSave:()=>{n(P),N(B),G({weather_prefs:M}),localStorage.setItem(x,P),localStorage.setItem(g,JSON.stringify(B)),L(!1)},children:[
46
46
  /* @__PURE__ */u("div",{className:"space-y-3",children:/* @__PURE__ */f("div",{children:[
47
47
  /* @__PURE__ */u("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Display"}),
48
48
  /* @__PURE__ */f("div",{className:"flex items-center gap-3 mb-2",children:[
49
49
  /* @__PURE__ */u("span",{className:"text-sm text-gray-600 w-24",children:"Temperature"}),
50
- /* @__PURE__ */u("div",{className:"flex gap-1",children:[{key:!1,label:"°C"},{key:!0,label:"°F"}].map(e=>/* @__PURE__ */u("button",{onClick:()=>$(t=>({...t,useFahrenheit:e.key})),className:"px-3 py-1 text-xs font-medium rounded-lg border transition-colors "+(I.useFahrenheit===e.key?"bg-blue-600 text-white border-blue-600":"bg-white text-gray-700 border-gray-300 hover:bg-gray-50"),children:e.label},String(e.key)))})]}),
50
+ /* @__PURE__ */u("div",{className:"flex gap-1",children:[{key:!1,label:"°C"},{key:!0,label:"°F"}].map(e=>/* @__PURE__ */u("button",{onClick:()=>Q(t=>({...t,useFahrenheit:e.key})),className:"px-3 py-1 text-xs font-medium rounded-lg border transition-colors "+(M.useFahrenheit===e.key?"bg-blue-600 text-white border-blue-600":"bg-white text-gray-700 border-gray-300 hover:bg-gray-50"),children:e.label},String(e.key)))})]}),
51
51
  /* @__PURE__ */f("div",{className:"flex items-center gap-3 mb-2",children:[
52
52
  /* @__PURE__ */u("span",{className:"text-sm text-gray-600 w-24",children:"Time Format"}),
53
- /* @__PURE__ */u("div",{className:"flex gap-1",children:[{key:!1,label:"AM/PM"},{key:!0,label:"24H"}].map(e=>/* @__PURE__ */u("button",{onClick:()=>$(t=>({...t,use24Hour:e.key})),className:"px-3 py-1 text-xs font-medium rounded-lg border transition-colors "+(I.use24Hour===e.key?"bg-blue-600 text-white border-blue-600":"bg-white text-gray-700 border-gray-300 hover:bg-gray-50"),children:e.label},String(e.key)))})]}),
53
+ /* @__PURE__ */u("div",{className:"flex gap-1",children:[{key:!1,label:"AM/PM"},{key:!0,label:"24H"}].map(e=>/* @__PURE__ */u("button",{onClick:()=>Q(t=>({...t,use24Hour:e.key})),className:"px-3 py-1 text-xs font-medium rounded-lg border transition-colors "+(M.use24Hour===e.key?"bg-blue-600 text-white border-blue-600":"bg-white text-gray-700 border-gray-300 hover:bg-gray-50"),children:e.label},String(e.key)))})]}),
54
54
  /* @__PURE__ */f("label",{className:"flex items-center gap-2 cursor-pointer",children:[
55
- /* @__PURE__ */u("input",{type:"checkbox",checked:I.showLocalTime,onChange:e=>$(t=>({...t,showLocalTime:e.target.checked})),className:"rounded border-gray-300 text-blue-600 h-3.5 w-3.5"}),
55
+ /* @__PURE__ */u("input",{type:"checkbox",checked:M.showLocalTime,onChange:e=>Q(t=>({...t,showLocalTime:e.target.checked})),className:"rounded border-gray-300 text-blue-600 h-3.5 w-3.5"}),
56
56
  /* @__PURE__ */u("span",{className:"text-sm text-gray-600",children:"Show local time"})]})]})}),
57
57
  /* @__PURE__ */f("div",{children:[
58
58
  /* @__PURE__ */u("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"City"}),
59
59
  /* @__PURE__ */u("select",{value:P,onChange:e=>Z(e.target.value),className:"w-full bg-surface-sunken border border-line rounded px-2 h-8 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:Object.keys(a).map(e=>/* @__PURE__ */u("option",{value:e,children:e},e))}),
60
- /* @__PURE__ */u("p",{className:"mt-1 text-2xs text-ink-faintest",children:"Auto-detected from your timezone; change if needed."})]})]})]})}export{F as default};
60
+ /* @__PURE__ */u("p",{className:"mt-1 text-2xs text-ink-faintest",children:"Auto-detected from your timezone; change if needed."})]})]})]})}export{L as default};
@@ -1,6 +1,6 @@
1
- import{AVAILABLE_CITIES as e,fetchCityWeather as t,cityClock as r,getCondition as n,toFahrenheit as s}from"./chunk-HYHZEQMG.js";import{loadAppearance as i,WidgetSettingsModal as a}from"./chunk-3C2VY2VF.js";import"./chunk-NHKT5IH6.js";import"./chunk-36BRD5J3.js";import"./chunk-JRQMX4PK.js";import"./chunk-LF27WIN2.js";import{useWidgetSettings as c}from"./chunk-XRWUNOI3.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-PSVGB7KT.js";import"./chunk-YI4T5I5D.js";import"./chunk-TTD2M6RF.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import"./chunk-JRKD7SD3.js";import"./chunk-5RCKE4X2.js";import"./chunk-EIFNESXS.js";import"./chunk-PO2KNVCC.js";import"./chunk-CJ4OEY3T.js";import"./chunk-5QHNDAZ6.js";import"./chunk-TEQ5ZPAL.js";import"./chunk-VWGWZY7A.js";import"./chunk-DBQNYJZ6.js";import"./chunk-L2WQOJ3T.js";import"./chunk-5VJVEKVM.js";import"./chunk-YPXONNBV.js";import"./chunk-4PJFL26P.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import{useShellPrefs as o}from"./chunk-POBVGDZP.js";import"./chunk-F3ZOO23R.js";import"./chunk-NJY4HPNB.js";import"./chunk-PM6HY5BH.js";import"./chunk-DWGYC7OD.js";import"./chunk-APFDZ2HG.js";import"./chunk-ABIWAS5K.js";import"./chunk-P56YLT73.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-A4ROXNUF.js";import"./chunk-TSZPGDU3.js";import"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as m}from"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import"./chunk-FAPZFMS3.js";import"./chunk-CIZAUBWA.js";import"./chunk-PGN5ME7B.js";import"./chunk-5QRHQCRG.js";import"./chunk-62LW225J.js";import"./chunk-TAHHZGRH.js";import"./chunk-KEFNQEXZ.js";import"./chunk-PU2GJVMG.js";import"./chunk-3FININUU.js";import"./chunk-STKJA4PV.js";import"./chunk-M6UKCZHT.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useState as h,useEffect as l,useCallback as p}from"react";import{jsxs as u,Fragment as k,jsx as d}from"react/jsx-runtime";var j="world_clock_appearance",g=["London","Shanghai","New York"];function x(){const{prefs:x,save:N}=o(),[b,f]=h(()=>i(j)),[y,v]=h(!1),[F,w]=h([]),[D,H]=h(b),P={useFahrenheit:!!x.weather_prefs?.useFahrenheit},[C,T]=h(P),[R,Z]=h(()=>/* @__PURE__ */new Date);l(()=>{const e=setInterval(()=>Z(/* @__PURE__ */new Date),3e4);return()=>clearInterval(e)},[]);const J=Object.fromEntries(Object.entries(e).map(([e,t])=>[t.tz,e])),A=x.world_clocks,Q=(()=>{if(!Array.isArray(A)||0===A.length)return g;const t=[];for(const r of A){const n=e[r]?r:J[r];n&&!t.includes(n)&&t.push(n)}return t.length?t:g})(),[S,V]=h({}),[Y,G]=h(!0);l(()=>{let e=!1;return G(!0),(async()=>{const r={};await Promise.all(Q.map(async e=>{const n=await t(e);n&&(r[e]=n)})),e||(V(r),G(!1))})(),()=>{e=!0}},[Q.join(",")]),c(p(()=>{w([...Q]),H({...b}),T({...P}),v(!0)},[Q.join(","),b,P.useFahrenheit]));const M=e=>P.useFahrenheit?`${s(e)}°`:`${e}°`;/* @__PURE__ */
1
+ import{AVAILABLE_CITIES as e,fetchCityWeather as t,cityClock as r,getCondition as n,toFahrenheit as s}from"./chunk-HYHZEQMG.js";import{loadAppearance as i,WidgetSettingsModal as a}from"./chunk-RRWQBWLW.js";import"./chunk-NHKT5IH6.js";import"./chunk-36BRD5J3.js";import"./chunk-JRQMX4PK.js";import"./chunk-LF27WIN2.js";import{useWidgetSettings as c}from"./chunk-GD5NGS6D.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-PSVGB7KT.js";import"./chunk-YI4T5I5D.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import"./chunk-JRKD7SD3.js";import"./chunk-5RCKE4X2.js";import"./chunk-ZLB5GRL6.js";import"./chunk-EIFNESXS.js";import"./chunk-PO2KNVCC.js";import"./chunk-CJ4OEY3T.js";import"./chunk-5QHNDAZ6.js";import"./chunk-TEQ5ZPAL.js";import"./chunk-VWGWZY7A.js";import"./chunk-DBQNYJZ6.js";import"./chunk-L2WQOJ3T.js";import"./chunk-5VJVEKVM.js";import"./chunk-YPXONNBV.js";import"./chunk-4PJFL26P.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import{useShellPrefs as o}from"./chunk-POBVGDZP.js";import"./chunk-F3ZOO23R.js";import"./chunk-NJY4HPNB.js";import"./chunk-PM6HY5BH.js";import"./chunk-DWGYC7OD.js";import"./chunk-APFDZ2HG.js";import"./chunk-ABIWAS5K.js";import"./chunk-P56YLT73.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-A4ROXNUF.js";import"./chunk-TSZPGDU3.js";import"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as m}from"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import"./chunk-FAPZFMS3.js";import"./chunk-CIZAUBWA.js";import"./chunk-PGN5ME7B.js";import"./chunk-5QRHQCRG.js";import"./chunk-62LW225J.js";import"./chunk-TAHHZGRH.js";import"./chunk-KEFNQEXZ.js";import"./chunk-PU2GJVMG.js";import"./chunk-3FININUU.js";import"./chunk-STKJA4PV.js";import"./chunk-GZ4AMXEU.js";import"./chunk-M6UKCZHT.js";import"./chunk-3AUPCKBR.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useState as h,useEffect as l,useCallback as p}from"react";import{jsxs as u,Fragment as k,jsx as d}from"react/jsx-runtime";var j="world_clock_appearance",g=["London","Shanghai","New York"];function x(){const{prefs:x,save:N}=o(),[b,f]=h(()=>i(j)),[y,v]=h(!1),[F,w]=h([]),[D,P]=h(b),H={useFahrenheit:!!x.weather_prefs?.useFahrenheit},[R,Z]=h(H),[C,G]=h(()=>/* @__PURE__ */new Date);l(()=>{const e=setInterval(()=>G(/* @__PURE__ */new Date),3e4);return()=>clearInterval(e)},[]);const A=Object.fromEntries(Object.entries(e).map(([e,t])=>[t.tz,e])),J=x.world_clocks,T=(()=>{if(!Array.isArray(J)||0===J.length)return g;const t=[];for(const r of J){const n=e[r]?r:A[r];n&&!t.includes(n)&&t.push(n)}return t.length?t:g})(),[B,Q]=h({}),[S,W]=h(!0);l(()=>{let e=!1;return W(!0),(async()=>{const r={};await Promise.all(T.map(async e=>{const n=await t(e);n&&(r[e]=n)})),e||(Q(r),W(!1))})(),()=>{e=!0}},[T.join(",")]),c(p(()=>{w([...T]),P({...b}),Z({...H}),v(!0)},[T.join(","),b,H.useFahrenheit]));const U=e=>H.useFahrenheit?`${s(e)}°`:`${e}°`;/* @__PURE__ */
2
2
  return u(k,{children:[
3
- /* @__PURE__ */d("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${b.activeOpacity/100})`,backdropFilter:b.activeBlur>0?`blur(${b.activeBlur}px)`:void 0},children:/* @__PURE__ */u("div",{className:"divide-y divide-gray-200",children:[Y&&Q.every(e=>!S[e])&&/* @__PURE__ */d(m,{size:"sm",padding:"py-6",label:"Loading"}),Q.map(t=>{const s=S[t],{time:i,ampm:a}=r(e[t]?.tz,R);if(!s)/* @__PURE__ */
3
+ /* @__PURE__ */d("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${b.activeOpacity/100})`,backdropFilter:b.activeBlur>0?`blur(${b.activeBlur}px)`:void 0},children:/* @__PURE__ */u("div",{className:"divide-y divide-gray-200",children:[S&&T.every(e=>!B[e])&&/* @__PURE__ */d(m,{size:"sm",padding:"py-6",label:"Loading"}),T.map(t=>{const s=B[t],{time:i,ampm:a}=r(e[t]?.tz,C);if(!s)/* @__PURE__ */
4
4
  return u("div",{className:"px-4 py-3",children:[
5
5
  /* @__PURE__ */u("div",{className:"flex items-baseline justify-between gap-2",children:[
6
6
  /* @__PURE__ */d("span",{className:"text-base font-semibold tracking-tight text-ink-strongest truncate",children:t}),
@@ -10,7 +10,7 @@ return u("div",{className:"px-4 py-3",children:[
10
10
  return u("div",{className:"px-4 py-3",children:[
11
11
  /* @__PURE__ */u("div",{className:"flex items-baseline justify-between gap-2",children:[
12
12
  /* @__PURE__ */d("span",{className:"text-base font-semibold tracking-tight text-ink-strongest truncate",children:t}),
13
- /* @__PURE__ */d("span",{className:"text-2xl font-extralight leading-none tabular-nums tracking-tight text-ink-strongest shrink-0",children:M(s.temp)})]}),
13
+ /* @__PURE__ */d("span",{className:"text-2xl font-extralight leading-none tabular-nums tracking-tight text-ink-strongest shrink-0",children:U(s.temp)})]}),
14
14
  /* @__PURE__ */u("div",{className:"flex items-center justify-between gap-2 mt-2 text-2xs",children:[
15
15
  /* @__PURE__ */u("div",{className:"flex items-center gap-2 min-w-0 text-ink-faint",children:[
16
16
  /* @__PURE__ */d("span",{className:"text-base leading-none shrink-0",children:o}),
@@ -18,13 +18,13 @@ return u("div",{className:"px-4 py-3",children:[
18
18
  /* @__PURE__ */d("span",{className:"text-3xs font-medium ml-0.5 opacity-70",children:a})]}),
19
19
  /* @__PURE__ */d("span",{className:"text-gray-300 shrink-0",children:"·"}),
20
20
  /* @__PURE__ */d("span",{className:"truncate",children:c})]}),
21
- /* @__PURE__ */u("span",{className:"tabular-nums text-gray-500 shrink-0",children:["H:",M(s.high)," L:",M(s.low)]})]})]},t)})]})}),
22
- /* @__PURE__ */u(a,{open:y,onClose:()=>v(!1),title:"World Clock Settings",appearance:D,onAppearanceChange:H,onSave:()=>{0!==F.length&&(N({world_clocks:F,weather_prefs:{...x.weather_prefs??{},useFahrenheit:C.useFahrenheit}}),f(D),localStorage.setItem(j,JSON.stringify(D)),v(!1))},children:[
21
+ /* @__PURE__ */u("span",{className:"tabular-nums text-gray-500 shrink-0",children:["H:",U(s.high)," L:",U(s.low)]})]})]},t)})]})}),
22
+ /* @__PURE__ */u(a,{open:y,onClose:()=>v(!1),title:"World Clock Settings",appearance:D,onAppearanceChange:P,onSave:()=>{0!==F.length&&(N({world_clocks:F,weather_prefs:{...x.weather_prefs??{},useFahrenheit:R.useFahrenheit}}),f(D),localStorage.setItem(j,JSON.stringify(D)),v(!1))},children:[
23
23
  /* @__PURE__ */u("div",{children:[
24
24
  /* @__PURE__ */d("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Display"}),
25
25
  /* @__PURE__ */u("div",{className:"flex items-center gap-3 mb-2",children:[
26
26
  /* @__PURE__ */d("span",{className:"text-sm text-gray-600 w-24",children:"Temperature"}),
27
- /* @__PURE__ */d("div",{className:"flex gap-1",children:[{key:!1,label:"°C"},{key:!0,label:"°F"}].map(e=>/* @__PURE__ */d("button",{onClick:()=>T(t=>({...t,useFahrenheit:e.key})),className:"px-3 py-1 text-xs font-medium rounded-lg border transition-colors "+(C.useFahrenheit===e.key?"bg-blue-600 text-white border-blue-600":"bg-white text-gray-700 border-gray-300 hover:bg-gray-50"),children:e.label},String(e.key)))})]}),
27
+ /* @__PURE__ */d("div",{className:"flex gap-1",children:[{key:!1,label:"°C"},{key:!0,label:"°F"}].map(e=>/* @__PURE__ */d("button",{onClick:()=>Z(t=>({...t,useFahrenheit:e.key})),className:"px-3 py-1 text-xs font-medium rounded-lg border transition-colors "+(R.useFahrenheit===e.key?"bg-blue-600 text-white border-blue-600":"bg-white text-gray-700 border-gray-300 hover:bg-gray-50"),children:e.label},String(e.key)))})]}),
28
28
  /* @__PURE__ */d("p",{className:"text-2xs text-ink-faintest mt-1",children:"Shared with the Weather widget."})]}),
29
29
  /* @__PURE__ */u("div",{children:[
30
30
  /* @__PURE__ */d("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Cities"}),
package/dist/ai/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import{StepChainItem as e,StepChain as t}from"../chunk-Z2Z653OO.js";import{Markdown as n}from"../chunk-3AVXNZY5.js";import{Divider as a}from"../chunk-DFOFEBYX.js";import{Avatar as r}from"../chunk-SCNQK5NF.js";import"../chunk-UJUTS6LJ.js";import"../chunk-Z5TE3MEG.js";import{useContextMenu as s,ContextMenu as o}from"../chunk-MF7OELXP.js";import{Banner as i}from"../chunk-OSMRYND3.js";import{Input_default as l}from"../chunk-D7MRZZVV.js";import"../chunk-AYZY3YNC.js";import{AttachmentDropZone as c}from"../chunk-UYM7562M.js";import{CloseGlyph as d}from"../chunk-TAIH2VIW.js";import"../chunk-TAB3K2WF.js";import{useFileIntake as u,humanSize as p,FileIntakeAlert as m}from"../chunk-TNGIXSTM.js";import{parseChartSpec as h}from"../chunk-CR7T435F.js";import{SpecChart as f}from"../chunk-CMEPDSYB.js";import{formatBytes as g}from"../chunk-OJI4ROSD.js";import{formatTime as x}from"../chunk-NHKT5IH6.js";import"../chunk-36BRD5J3.js";import"../chunk-JRQMX4PK.js";import"../chunk-LF27WIN2.js";import"../chunk-P5TSGXL4.js";import{FlowChart as b}from"../chunk-LFUXWZV7.js";import{parseFlowSpec as v}from"../chunk-FAERBT6Y.js";import"../chunk-SAMPXZF3.js";import"../chunk-CK2YOGUS.js";import"../chunk-A6TOHNJY.js";import"../chunk-VFC6QUEN.js";import"../chunk-AQVPWUJ3.js";import"../chunk-465RRWBY.js";import{ChartSkeleton as y}from"../chunk-MEFB2KGF.js";import"../chunk-CNYAHYE6.js";import"../chunk-NJY4HPNB.js";import"../chunk-PM6HY5BH.js";import"../chunk-DWGYC7OD.js";import{IconButton_default as w}from"../chunk-APFDZ2HG.js";import"../chunk-ABIWAS5K.js";import"../chunk-P56YLT73.js";import"../chunk-URHGHXDN.js";import"../chunk-5QFPTDQF.js";import{Button_default as k}from"../chunk-A4ROXNUF.js";import"../chunk-TSZPGDU3.js";import{Icon as N}from"../chunk-ISVODSRP.js";import"../chunk-J75ZT2JQ.js";import{SpinnerRing as A}from"../chunk-R2VKEMZH.js";import"../chunk-BWJZTHZ6.js";import"../chunk-FAPZFMS3.js";import"../chunk-CIZAUBWA.js";import"../chunk-PGN5ME7B.js";import{createShellPortal as C}from"../chunk-5QRHQCRG.js";import"../chunk-62LW225J.js";import"../chunk-TAHHZGRH.js";import"../chunk-KEFNQEXZ.js";import"../chunk-PU2GJVMG.js";import"../chunk-3FININUU.js";import"../chunk-UQYNPYF4.js";import"../chunk-MRJKZWWV.js";import"../chunk-S4RD6UJU.js";import"../chunk-LLSGIMLG.js";import"../chunk-2JWPNR2U.js";import"../chunk-WDQI3FV6.js";import"../chunk-TZFACUMR.js";import{registerModalEscapeInterceptor as T}from"../chunk-TWVUQUUD.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-MAFUXCPZ.js";import{useShellStrings as j}from"../chunk-NRHG4R2Q.js";import"../chunk-C3QOHMR6.js";import{useRef as S,useEffect as $,useState as R,Fragment as _,useId as O,useLayoutEffect as D,useCallback as M,useMemo as I}from"react";import{isToolUIPart as P,getToolName as F,DefaultChatTransport as z,lastAssistantMessageIsCompleteWithApprovalResponses as L}from"ai";import{jsx as B,jsxs as E,Fragment as U}from"react/jsx-runtime";import{useChat as q}from"@ai-sdk/react";function H(e){if(!P(e))return null;const t=e;return{toolName:F(e),toolCallId:t.toolCallId,state:t.state,input:t.input,output:t.output,errorText:t.errorText,approvalId:t.approval?.id,approved:t.approval?.approved}}function W(e){const t=/* @__PURE__ */new Map;for(const n of e.parts){if("data-tool-summary"!==n.type)continue;const e=n.data;e&&"string"==typeof e.tool_call_id&&Array.isArray(e.rows)&&e.rows.length>0&&t.set(e.tool_call_id,e)}return t}function Y(e){const t=/* @__PURE__ */new Map;for(const n of e.parts){if("data-file"!==n.type)continue;const e=n.data;e&&"string"==typeof e.id&&"string"==typeof e.filename&&t.set(e.id,e)}return[...t.values()]}function Q(e){return e.parts.map(e=>"text"===e.type?e.text:"").join("")}var J="efficient-attachment:";function Z(e){return{type:"file",mediaType:e.content_type,filename:e.filename,url:`${J}${e.id}`,providerMetadata:{efficient:{size:e.size}}}}function G(e){const t=[];for(const n of e.parts){if("file"!==n.type||!n.url.startsWith(J))continue;const e=n.providerMetadata?.efficient?.size;t.push({id:n.url.slice(21),filename:n.filename??"",content_type:n.mediaType,size:"number"==typeof e?e:0})}return t}var K=/* @__PURE__ */new Set(["data-conversation","data-plan","data-followups","data-choices","data-tool-summary","data-error","data-file","data-approval","data-busy"]);function V(e,t){const n=e[e.length-1];if(!n)throw new Error("assistant chat: no message to send");if("user"===n.role){const e=Q(n).trim();if(!e)throw new Error("assistant chat: empty message");const a=G(n).map(e=>e.id),r=n.metadata?.replyTo?.id;return{conversation_id:t,text:e,approvals:[],...a.length>0?{attachments:a}:{},...r?{reply_to:r}:{}}}const a=function(e){const t=[];for(const n of e.parts){if(!P(n))continue;const e=n;if("approval-responded"!==e.state||!e.approval||"boolean"!=typeof e.approval.approved)continue;const a={approval_id:e.approval.id,approved:e.approval.approved};e.approval.reason&&(a.reason=e.approval.reason),t.push(a)}return t}(n);if(0===a.length)throw new Error("assistant chat: no approval decision to send");return{conversation_id:t,text:null,approvals:a}}var X=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function ee(e,t,n=""){const a=[t.trim(),n.trim()].filter(Boolean).map(X);return 0!==a.length&&new RegExp(`(^|[^\\p{L}\\p{N}_@])(?:${a.join("|")})(?![\\p{L}\\p{N}_@])`,"iu").test(e)}function te(e,t){const n=("string"==typeof t?[t]:[...t]).map(e=>e.trim()).filter(Boolean).sort((e,t)=>t.length-e.length);if(!n.length||!e)return e?[{text:e,mention:!1}]:[];const a=[];let r=0;const s=new RegExp(`(^|[^\\p{L}\\p{N}_@])(${n.map(X).join("|")})(?![\\p{L}\\p{N}_@])`,"giu");for(const t of e.matchAll(s)){const n=(t.index??0)+t[1].length;n>r&&a.push({text:e.slice(r,n),mention:!1}),a.push({text:t[2],mention:!0}),r=n+t[2].length}return r<e.length&&a.push({text:e.slice(r),mention:!1}),a}function ne(e,t){return ee(e,t)?e:`${t.trim()} ${e.trimStart()}`}function ae(e){const t=e.map(e=>e.name).filter(Boolean);return t.length<=1?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}var re=/* @__PURE__ */new Set(["proposed","approved","running"]);function se(e){return re.has(e.status)}function oe(e){const t=[];for(const n of e.parts)"data-plan"===n.type&&t.push(n.data);return t}function ie(e){const t=/* @__PURE__ */new Map;for(const n of e)for(const e of oe(n))t.delete(e.id),t.set(e.id,e);return t}function le(e){const t=[...ie(e).values()],n=t[t.length-1];if(!n)return null;if(se(n))return n;const a=e[e.length-1];return a&&"assistant"===a.role&&oe(a).some(e=>e.id===n.id)?n:null}function ce(e){const t={};return e.source&&e.source!==e.role&&(t.source=e.source),e.author&&(t.author=e.author),e.asked_by&&(t.askedBy=e.asked_by),e.created_at&&(t.createdAt=e.created_at),e.reply_to&&(t.replyTo=e.reply_to),"assistant"===e.role&&e.run_id&&(t.run_id=e.run_id,t.rating=e.rating??null),Object.keys(t).length>0?{metadata:t}:{}}function de(e,t){const n=/* @__PURE__ */new Map;for(const a of e.parts){if("data-approval"!==a.type)continue;const e=a.data,r=e?.[t];"string"==typeof e?.approval_id&&"string"==typeof r&&r&&n.set(e.approval_id,r)}return n}function ue(e){const t=e.messages.filter(e=>e.text).map(e=>({id:e.id,role:e.role,parts:[...(e.attachments??[]).map(Z),{type:"text",text:e.text},...(e.files??[]).map(e=>({type:"data-file",id:`file-${e.id}`,data:e})),...e.update?[{type:"data-update",id:`update-${e.update.id}`,data:e.update}]:[]],...ce(e)})),n=(e.plans??[]).filter(se);return(e.pending_approvals.length>0||n.length>0)&&t.push({id:`pending-approvals-${e.id}`,role:"assistant",parts:[...n.map(e=>({type:"data-plan",id:e.id,data:e})),...e.pending_approvals.map(e=>({type:`tool-${e.tool_name}`,toolCallId:e.tool_call_id??e.approval_id,state:"approval-requested",input:e.input,approval:{id:e.approval_id}})),...e.pending_approvals.filter(e=>e.expires_at||e.notice).map(e=>({type:"data-approval",id:e.approval_id,data:{approval_id:e.approval_id,expires_at:e.expires_at,...e.notice?{notice:e.notice}:{}}}))]}),t}function pe(e,t){const n=e?.message?.trim();if(!n)return t;if(n.startsWith("{")){try{const e=JSON.parse(n);for(const t of["detail","errorText","message","title","error"]){const n=e[t];if("string"==typeof n&&n.trim())return n.trim()}for(const t of Object.values(e)){const e=Array.isArray(t)?t[0]:void 0;if("string"==typeof e&&e.trim()&&e.length<=400)return e.trim()}}catch{return t}return t}return n.startsWith("<")||n.length>400?t:n}var me=/^(load failed|failed to fetch|network ?error( when attempting to fetch resource)?|(the )?network connection was lost|error in input stream|terminated)\.?$/i;function he(e){return!(!e||"AbortError"===e.name)&&me.test(e.message?.trim()??"")}var fe=/* @__PURE__ */new Set(["budget_reached","not_permitted"]);function ge(e,t,n){return he(e)?{text:n.connectionDropped,retryable:!0}:{text:pe(e,n.genericError),retryable:!(t&&fe.has(t))}}function xe(e){const t=e[e.length-1];if(!t)return!1;if("user"===t.role)return""!==Q(t).trim();const n=e[e.length-2];return!(!n||"user"!==n.role||!Q(n).trim())&&!t.parts.some(e=>void 0!==H(e)?.approvalId)}var be=["👍","✅","👀"],ve=["👍","👎","❤️","😂","😮","😢","🙏","🎉","✅","❌","👀","🔥","💯","🚀","👏","🙌","😀","😅","🤔","😬","🤝","💪","📦","🚚","📅","⏰","💰","📈","⚠️","❓","➕","👌"];function ye(e,t,n="You"){const a=e.names.map(a=>t&&a===t&&e.mine?n:a),r=e.mine?[n,...a.filter(e=>e!==n)]:a;return r.length<=1?r[0]??"":`${r.slice(0,-1).join(", ")} and ${r[r.length-1]}`}function we({onPick:e,onClose:t,label:n="Add reaction"}){const a=S(null);$(()=>{const e=e=>{a.current&&!a.current.contains(e.target)&&t()};return document.addEventListener("mousedown",e),a.current?.querySelector("button")?.focus(),()=>document.removeEventListener("mousedown",e)},[t]);/* @__PURE__ */
2
+ import{StepChainItem as e,StepChain as t}from"../chunk-Z2Z653OO.js";import{Markdown as n}from"../chunk-3AVXNZY5.js";import{Divider as a}from"../chunk-DFOFEBYX.js";import{Avatar as r}from"../chunk-SCNQK5NF.js";import{useContextMenu as s,ContextMenu as o}from"../chunk-MF7OELXP.js";import{Banner as i}from"../chunk-OSMRYND3.js";import"../chunk-UJUTS6LJ.js";import"../chunk-Z5TE3MEG.js";import{AttachmentDropZone as l}from"../chunk-UYM7562M.js";import{Input_default as c}from"../chunk-D7MRZZVV.js";import{CloseGlyph as d}from"../chunk-TAIH2VIW.js";import"../chunk-TAB3K2WF.js";import"../chunk-AYZY3YNC.js";import{useFileIntake as u,humanSize as p,FileIntakeAlert as m}from"../chunk-TNGIXSTM.js";import{parseChartSpec as h}from"../chunk-CR7T435F.js";import{SpecChart as f}from"../chunk-CMEPDSYB.js";import{formatBytes as g}from"../chunk-OJI4ROSD.js";import{formatTime as x}from"../chunk-NHKT5IH6.js";import"../chunk-36BRD5J3.js";import"../chunk-JRQMX4PK.js";import"../chunk-LF27WIN2.js";import"../chunk-P5TSGXL4.js";import{FlowChart as b}from"../chunk-LFUXWZV7.js";import{parseFlowSpec as v}from"../chunk-FAERBT6Y.js";import"../chunk-SAMPXZF3.js";import"../chunk-CK2YOGUS.js";import"../chunk-A6TOHNJY.js";import"../chunk-VFC6QUEN.js";import"../chunk-AQVPWUJ3.js";import"../chunk-465RRWBY.js";import{ChartSkeleton as y}from"../chunk-MEFB2KGF.js";import"../chunk-CNYAHYE6.js";import"../chunk-NJY4HPNB.js";import"../chunk-PM6HY5BH.js";import"../chunk-DWGYC7OD.js";import{IconButton_default as w}from"../chunk-APFDZ2HG.js";import"../chunk-ABIWAS5K.js";import"../chunk-P56YLT73.js";import"../chunk-URHGHXDN.js";import"../chunk-5QFPTDQF.js";import{Button_default as k}from"../chunk-A4ROXNUF.js";import"../chunk-TSZPGDU3.js";import{Icon as N}from"../chunk-ISVODSRP.js";import"../chunk-J75ZT2JQ.js";import{SpinnerRing as A}from"../chunk-R2VKEMZH.js";import"../chunk-BWJZTHZ6.js";import"../chunk-FAPZFMS3.js";import"../chunk-CIZAUBWA.js";import"../chunk-PGN5ME7B.js";import{createShellPortal as C}from"../chunk-5QRHQCRG.js";import"../chunk-62LW225J.js";import"../chunk-TAHHZGRH.js";import"../chunk-KEFNQEXZ.js";import"../chunk-PU2GJVMG.js";import"../chunk-3FININUU.js";import"../chunk-UQYNPYF4.js";import"../chunk-MRJKZWWV.js";import"../chunk-S4RD6UJU.js";import"../chunk-LLSGIMLG.js";import"../chunk-2JWPNR2U.js";import"../chunk-WDQI3FV6.js";import"../chunk-TZFACUMR.js";import{registerModalEscapeInterceptor as T}from"../chunk-TWVUQUUD.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-MAFUXCPZ.js";import{useShellStrings as j}from"../chunk-NRHG4R2Q.js";import"../chunk-C3QOHMR6.js";import{useRef as S,useEffect as $,useState as R,Fragment as _,useId as O,useLayoutEffect as D,useCallback as M,useMemo as I}from"react";import{isToolUIPart as P,getToolName as F,DefaultChatTransport as z,lastAssistantMessageIsCompleteWithApprovalResponses as L}from"ai";import{jsx as B,jsxs as E,Fragment as U}from"react/jsx-runtime";import{useChat as q}from"@ai-sdk/react";function H(e){if(!P(e))return null;const t=e;return{toolName:F(e),toolCallId:t.toolCallId,state:t.state,input:t.input,output:t.output,errorText:t.errorText,approvalId:t.approval?.id,approved:t.approval?.approved}}function W(e){const t=/* @__PURE__ */new Map;for(const n of e.parts){if("data-tool-summary"!==n.type)continue;const e=n.data;e&&"string"==typeof e.tool_call_id&&Array.isArray(e.rows)&&e.rows.length>0&&t.set(e.tool_call_id,e)}return t}function Y(e){const t=/* @__PURE__ */new Map;for(const n of e.parts){if("data-file"!==n.type)continue;const e=n.data;e&&"string"==typeof e.id&&"string"==typeof e.filename&&t.set(e.id,e)}return[...t.values()]}function Q(e){return e.parts.map(e=>"text"===e.type?e.text:"").join("")}var J="efficient-attachment:";function Z(e){return{type:"file",mediaType:e.content_type,filename:e.filename,url:`${J}${e.id}`,providerMetadata:{efficient:{size:e.size}}}}function G(e){const t=[];for(const n of e.parts){if("file"!==n.type||!n.url.startsWith(J))continue;const e=n.providerMetadata?.efficient?.size;t.push({id:n.url.slice(21),filename:n.filename??"",content_type:n.mediaType,size:"number"==typeof e?e:0})}return t}var K=/* @__PURE__ */new Set(["data-conversation","data-plan","data-followups","data-choices","data-tool-summary","data-error","data-file","data-approval","data-busy"]);function V(e,t){const n=e[e.length-1];if(!n)throw new Error("assistant chat: no message to send");if("user"===n.role){const e=Q(n).trim();if(!e)throw new Error("assistant chat: empty message");const a=G(n).map(e=>e.id),r=n.metadata?.replyTo?.id;return{conversation_id:t,text:e,approvals:[],...a.length>0?{attachments:a}:{},...r?{reply_to:r}:{}}}const a=function(e){const t=[];for(const n of e.parts){if(!P(n))continue;const e=n;if("approval-responded"!==e.state||!e.approval||"boolean"!=typeof e.approval.approved)continue;const a={approval_id:e.approval.id,approved:e.approval.approved};e.approval.reason&&(a.reason=e.approval.reason),t.push(a)}return t}(n);if(0===a.length)throw new Error("assistant chat: no approval decision to send");return{conversation_id:t,text:null,approvals:a}}var X=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function ee(e,t,n=""){const a=[t.trim(),n.trim()].filter(Boolean).map(X);return 0!==a.length&&new RegExp(`(^|[^\\p{L}\\p{N}_@])(?:${a.join("|")})(?![\\p{L}\\p{N}_@])`,"iu").test(e)}function te(e,t){const n=("string"==typeof t?[t]:[...t]).map(e=>e.trim()).filter(Boolean).sort((e,t)=>t.length-e.length);if(!n.length||!e)return e?[{text:e,mention:!1}]:[];const a=[];let r=0;const s=new RegExp(`(^|[^\\p{L}\\p{N}_@])(${n.map(X).join("|")})(?![\\p{L}\\p{N}_@])`,"giu");for(const t of e.matchAll(s)){const n=(t.index??0)+t[1].length;n>r&&a.push({text:e.slice(r,n),mention:!1}),a.push({text:t[2],mention:!0}),r=n+t[2].length}return r<e.length&&a.push({text:e.slice(r),mention:!1}),a}function ne(e,t){return ee(e,t)?e:`${t.trim()} ${e.trimStart()}`}function ae(e){const t=e.map(e=>e.name).filter(Boolean);return t.length<=1?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}var re=/* @__PURE__ */new Set(["proposed","approved","running"]);function se(e){return re.has(e.status)}function oe(e){const t=[];for(const n of e.parts)"data-plan"===n.type&&t.push(n.data);return t}function ie(e){const t=/* @__PURE__ */new Map;for(const n of e)for(const e of oe(n))t.delete(e.id),t.set(e.id,e);return t}function le(e){const t=[...ie(e).values()],n=t[t.length-1];if(!n)return null;if(se(n))return n;const a=e[e.length-1];return a&&"assistant"===a.role&&oe(a).some(e=>e.id===n.id)?n:null}function ce(e){const t={};return e.source&&e.source!==e.role&&(t.source=e.source),e.author&&(t.author=e.author),e.asked_by&&(t.askedBy=e.asked_by),e.created_at&&(t.createdAt=e.created_at),e.reply_to&&(t.replyTo=e.reply_to),"assistant"===e.role&&e.run_id&&(t.run_id=e.run_id,t.rating=e.rating??null),Object.keys(t).length>0?{metadata:t}:{}}function de(e,t){const n=/* @__PURE__ */new Map;for(const a of e.parts){if("data-approval"!==a.type)continue;const e=a.data,r=e?.[t];"string"==typeof e?.approval_id&&"string"==typeof r&&r&&n.set(e.approval_id,r)}return n}function ue(e){const t=e.messages.filter(e=>e.text).map(e=>({id:e.id,role:e.role,parts:[...(e.attachments??[]).map(Z),{type:"text",text:e.text},...(e.files??[]).map(e=>({type:"data-file",id:`file-${e.id}`,data:e})),...e.update?[{type:"data-update",id:`update-${e.update.id}`,data:e.update}]:[]],...ce(e)})),n=(e.plans??[]).filter(se);return(e.pending_approvals.length>0||n.length>0)&&t.push({id:`pending-approvals-${e.id}`,role:"assistant",parts:[...n.map(e=>({type:"data-plan",id:e.id,data:e})),...e.pending_approvals.map(e=>({type:`tool-${e.tool_name}`,toolCallId:e.tool_call_id??e.approval_id,state:"approval-requested",input:e.input,approval:{id:e.approval_id}})),...e.pending_approvals.filter(e=>e.expires_at||e.notice).map(e=>({type:"data-approval",id:e.approval_id,data:{approval_id:e.approval_id,expires_at:e.expires_at,...e.notice?{notice:e.notice}:{}}}))]}),t}function pe(e,t){const n=e?.message?.trim();if(!n)return t;if(n.startsWith("{")){try{const e=JSON.parse(n);for(const t of["detail","errorText","message","title","error"]){const n=e[t];if("string"==typeof n&&n.trim())return n.trim()}for(const t of Object.values(e)){const e=Array.isArray(t)?t[0]:void 0;if("string"==typeof e&&e.trim()&&e.length<=400)return e.trim()}}catch{return t}return t}return n.startsWith("<")||n.length>400?t:n}var me=/^(load failed|failed to fetch|network ?error( when attempting to fetch resource)?|(the )?network connection was lost|error in input stream|terminated)\.?$/i;function he(e){return!(!e||"AbortError"===e.name)&&me.test(e.message?.trim()??"")}var fe=/* @__PURE__ */new Set(["budget_reached","not_permitted"]);function ge(e,t,n){return he(e)?{text:n.connectionDropped,retryable:!0}:{text:pe(e,n.genericError),retryable:!(t&&fe.has(t))}}function xe(e){const t=e[e.length-1];if(!t)return!1;if("user"===t.role)return""!==Q(t).trim();const n=e[e.length-2];return!(!n||"user"!==n.role||!Q(n).trim())&&!t.parts.some(e=>void 0!==H(e)?.approvalId)}var be=["👍","✅","👀"],ve=["👍","👎","❤️","😂","😮","😢","🙏","🎉","✅","❌","👀","🔥","💯","🚀","👏","🙌","😀","😅","🤔","😬","🤝","💪","📦","🚚","📅","⏰","💰","📈","⚠️","❓","➕","👌"];function ye(e,t,n="You"){const a=e.names.map(a=>t&&a===t&&e.mine?n:a),r=e.mine?[n,...a.filter(e=>e!==n)]:a;return r.length<=1?r[0]??"":`${r.slice(0,-1).join(", ")} and ${r[r.length-1]}`}function we({onPick:e,onClose:t,label:n="Add reaction"}){const a=S(null);$(()=>{const e=e=>{a.current&&!a.current.contains(e.target)&&t()};return document.addEventListener("mousedown",e),a.current?.querySelector("button")?.focus(),()=>document.removeEventListener("mousedown",e)},[t]);/* @__PURE__ */
3
3
  return B("div",{ref:a,role:"dialog","aria-label":n,className:"absolute z-20 mt-1 grid w-max grid-cols-8 gap-0.5 rounded-md border border-line bg-surface p-1 shadow-lg","data-emoji-picker":"",onKeyDown:e=>{"Escape"===e.key&&(e.stopPropagation(),t())},children:ve.map(n=>/* @__PURE__ */B("button",{type:"button",className:"flex h-7 w-7 items-center justify-center rounded text-base hover:bg-surface-sunken focus-visible:bg-surface-sunken","aria-label":n,onClick:()=>{e(n),t()},children:n},n))})}function ke({onReact:e,label:t="Add reaction"}){const[n,a]=R(!1);/* @__PURE__ */
4
4
  return E("span",{className:"relative flex items-center gap-0.5","data-reaction-bar":"",children:[be.map(t=>/* @__PURE__ */B("button",{type:"button",className:"flex h-6 w-6 items-center justify-center rounded text-sm hover:bg-surface-sunken","aria-label":`React ${t}`,title:`React ${t}`,onClick:()=>e(t),children:t},t)),
5
5
  /* @__PURE__ */B(w,{size:"sm",variant:"ghost","aria-label":t,title:t,"aria-haspopup":"dialog",onClick:()=>a(e=>!e),children:/* @__PURE__ */B(N,{name:"face-smile",className:"h-3.5 w-3.5"})}),n&&/* @__PURE__ */B("span",{className:"absolute right-0 top-full",children:/* @__PURE__ */B(we,{label:t,onPick:e,onClose:()=>a(!1)})})]})}function Ne({reactions:e,onToggle:t,selfName:n,label:a="Add reaction"}){const[r,s]=R(!1);return e.length?/* @__PURE__ */E("div",{className:"relative mt-1 flex flex-wrap items-center gap-1","data-reactions":"",children:[e.map(e=>{const a=ye(e,n),r="inline-flex h-6 items-center gap-1 rounded-full border px-2 text-xs tabular-nums "+(e.mine?"border-accent-border bg-accent-tint text-accent-text":"border-line bg-surface text-ink");/* @__PURE__ */
@@ -49,12 +49,12 @@ return E("div",{className:"flex items-center gap-2 text-sm text-ink-faint","data
49
49
  /* @__PURE__ */B("span",{className:"sr-only",children:r}),
50
50
  /* @__PURE__ */B(Ke,{}),
51
51
  /* @__PURE__ */B("span",{"aria-hidden":"true",className:"min-w-0 truncate",children:`${l}…`}),
52
- /* @__PURE__ */B("span",{"aria-hidden":"true",className:"shrink-0 text-xs tabular-nums",children:a.replace("{seconds}",String(i))})]})}function Xe({labels:e,placeholder:t,busy:n,focusWhen:a,onSend:r,onStop:s,onNewChat:o,actions:i,attachments:l,people:h,assistantDecides:f,deciding:g,quiet:x,onAskToReply:b,quote:v,onClearQuote:y}){const[C,T]=R(""),[_,O]=R(!1),D=S(null),I=function(e){const[t,n]=R([]),a=S(0),r=S(!0);$(()=>()=>{r.current=!1},[]);const s=e?.upload,o=M(e=>{if(s)for(const t of e){const e=a.current++;n(n=>[...n,{key:e,name:t.name,size:t.size}]),s(t).then(t=>{r.current&&n(n=>n.map(n=>n.key===e?{...n,attachment:t}:n))},t=>{const a=t instanceof Error&&t.message?t.message:String(t);r.current&&n(t=>t.map(t=>t.key===e?{...t,error:a}:t))})}},[s]),i=t.some(e=>!e.attachment&&!e.error),l=t.flatMap(e=>e.attachment?[e.attachment]:[]);return{pending:t,add:o,remove:e=>n(t=>t.filter(t=>t.key!==e)),clear:()=>n([]),uploading:i,ready:l}}(l),P=j().files,F=u({accept:l?.accept,maxSizeBytes:l?.maxSizeBytes,maxFiles:l?.maxFiles??5,acceptHint:l?.acceptHint,currentCount:I.pending.length,disabled:!l,onAccept:I.add});$(()=>{a&&D.current?.focus()},[a]);const z=v?.id;$(()=>{z&&D.current?.focus()},[z]);const L=()=>{const e=D.current;e&&(e.value&&0!==e.clientWidth?(e.style.height="auto",e.style.height=`${e.scrollHeight}px`):e.style.height="")};$(L,[C]),$(()=>{const e=D.current;if(!e||"undefined"==typeof ResizeObserver)return;let t=e.clientWidth;const n=new ResizeObserver(()=>{e.clientWidth!==t&&(t=e.clientWidth,L())});return n.observe(e),()=>n.disconnect()},[]);const U=n||g||I.uploading||!C.trim(),q=()=>{U||(r(C,I.ready,{peopleOnly:!!f&&_,...v?{reply_to:v.id}:{}}),T(""),I.clear(),F.clearRejections(),v&&y?.())},H=!!h&&(ee(C,e.assistantMention,e.assistantName)||I.pending.length>0),W=!!f&&!_,Y=H?e.toAssistant:W?e.assistantDecides:e.toPeople.replace("{names}",h??""),Q=H||g?null:f?{label:W?e.peopleOnly:e.letAssistantDecide,onClick:()=>O(W)}:{label:e.askAssistant,onClick:()=>T(t=>ne(t,e.assistantMention))},J=h?/* @__PURE__ */E("div",{className:"flex items-center gap-2 px-3 pt-1 text-xs",children:[
53
- /* @__PURE__ */B("span",{role:"status",className:"min-w-0 flex-1 truncate "+(H?"text-accent-text":"text-ink-faint"),children:Y}),Q&&/* @__PURE__ */B(k,{type:"button",size:"sm",variant:"ghost",onClick:()=>{Q.onClick(),D.current?.focus()},children:Q.label})]}):null,Z=/* @__PURE__ */E("form",{className:"flex items-end gap-1 p-1",onSubmit:e=>{e.preventDefault(),q()},children:[o&&/* @__PURE__ */B(w,{type:"button",variant:"ghost","aria-label":e.newChat,title:e.newChat,onClick:o,children:/* @__PURE__ */B(N,{name:"compose"})}),l&&/* @__PURE__ */B(w,{type:"button",variant:"ghost","aria-label":e.attach,title:e.attach,onClick:F.open,disabled:n,children:/* @__PURE__ */B(N,{name:"add"})}),
54
- /* @__PURE__ */B("textarea",{ref:D,"aria-label":e.inputLabel,placeholder:t,rows:1,value:C,onChange:e=>T(e.target.value),onInput:L,onKeyDown:e=>{if("Enter"===e.key&&!e.shiftKey&&!e.nativeEvent.isComposing)return e.preventDefault(),void q();"Escape"===e.key&&v&&y&&(e.preventDefault(),y())},className:"block max-h-48 min-w-0 flex-1 resize-none overflow-y-auto bg-transparent py-1 text-sm leading-6 text-ink-strong outline-none placeholder:text-[color:var(--ink-placeholder)] "+(o||l?"px-1":"px-2")}),i?.map(e=>e.icon?/* @__PURE__ */B(w,{type:"button",variant:"ghost","aria-label":e.label,title:e.label,disabled:!C.trim(),onClick:()=>e.onSelect(C.trim()),children:/* @__PURE__ */B(N,{name:e.icon})},e.key):/* @__PURE__ */B(k,{type:"button",variant:"ghost",disabled:!C.trim(),onClick:()=>e.onSelect(C.trim()),children:e.label},e.key)),/* @__PURE__ */B(w,n?{type:"button",variant:"ghost","aria-label":e.stop,title:e.stop,onClick:s,children:/* @__PURE__ */B(N,{name:"stop-circle"})}:{type:"submit",variant:"ghost","aria-label":e.send,title:e.send,disabled:U,children:/* @__PURE__ */B(N,{name:"enter"})})]}),G=h&&g?/* @__PURE__ */B("div",{className:"px-1 pb-1",children:/* @__PURE__ */B(Ve,{label:e.deciding,words:[],secondsLabel:e.waitingSeconds,steadyLabel:e.deciding})}):h&&x&&b?/* @__PURE__ */E("div",{className:"flex items-center gap-2 px-1 pb-1 text-xs text-ink-faint",children:[
52
+ /* @__PURE__ */B("span",{"aria-hidden":"true",className:"shrink-0 text-xs tabular-nums",children:a.replace("{seconds}",String(i))})]})}function Xe({labels:e,placeholder:t,busy:n,focusWhen:a,onSend:r,onStop:s,onNewChat:o,actions:i,attachments:c,people:h,assistantDecides:f,deciding:g,quiet:x,onAskToReply:b,quote:v,onClearQuote:y}){const[C,T]=R(""),[_,O]=R(!1),D=S(null),I=function(e){const[t,n]=R([]),a=S(0),r=S(!0);$(()=>()=>{r.current=!1},[]);const s=e?.upload,o=M(e=>{if(s)for(const t of e){const e=a.current++;n(n=>[...n,{key:e,name:t.name,size:t.size}]),s(t).then(t=>{r.current&&n(n=>n.map(n=>n.key===e?{...n,attachment:t}:n))},t=>{const a=t instanceof Error&&t.message?t.message:String(t);r.current&&n(t=>t.map(t=>t.key===e?{...t,error:a}:t))})}},[s]),i=t.some(e=>!e.attachment&&!e.error),l=t.flatMap(e=>e.attachment?[e.attachment]:[]);return{pending:t,add:o,remove:e=>n(t=>t.filter(t=>t.key!==e)),clear:()=>n([]),uploading:i,ready:l}}(c),P=j().files,F=u({accept:c?.accept,maxSizeBytes:c?.maxSizeBytes,maxFiles:c?.maxFiles??5,acceptHint:c?.acceptHint,currentCount:I.pending.length,disabled:!c,onAccept:I.add});$(()=>{a&&D.current?.focus()},[a]);const z=v?.id;$(()=>{z&&D.current?.focus()},[z]);const L=()=>{const e=D.current;e&&(e.value&&0!==e.clientWidth?(e.style.height="auto",e.style.height=`${e.scrollHeight}px`):e.style.height="")};$(L,[C]),$(()=>{const e=D.current;if(!e||"undefined"==typeof ResizeObserver)return;let t=e.clientWidth;const n=new ResizeObserver(()=>{e.clientWidth!==t&&(t=e.clientWidth,L())});return n.observe(e),()=>n.disconnect()},[]);const U=n||g||I.uploading||!C.trim(),q=()=>{U||(r(C,I.ready,{peopleOnly:!!f&&_,...v?{reply_to:v.id}:{}}),T(""),I.clear(),F.clearRejections(),v&&y?.())},H=!!h&&(ee(C,e.assistantMention,e.assistantName)||I.pending.length>0),W=!!f&&!_,Y=H?e.toAssistant:W?e.assistantDecides:e.toPeople.replace("{names}",h??""),Q=H||g?null:f?{label:W?e.peopleOnly:e.letAssistantDecide,onClick:()=>O(W)}:{label:e.askAssistant,onClick:()=>T(t=>ne(t,e.assistantMention))},J=h?/* @__PURE__ */E("div",{className:"flex items-center gap-2 px-3 pt-1 text-xs",children:[
53
+ /* @__PURE__ */B("span",{role:"status",className:"min-w-0 flex-1 truncate "+(H?"text-accent-text":"text-ink-faint"),children:Y}),Q&&/* @__PURE__ */B(k,{type:"button",size:"sm",variant:"ghost",onClick:()=>{Q.onClick(),D.current?.focus()},children:Q.label})]}):null,Z=/* @__PURE__ */E("form",{className:"flex items-end gap-1 p-1",onSubmit:e=>{e.preventDefault(),q()},children:[o&&/* @__PURE__ */B(w,{type:"button",variant:"ghost","aria-label":e.newChat,title:e.newChat,onClick:o,children:/* @__PURE__ */B(N,{name:"compose"})}),c&&/* @__PURE__ */B(w,{type:"button",variant:"ghost","aria-label":e.attach,title:e.attach,onClick:F.open,disabled:n,children:/* @__PURE__ */B(N,{name:"add"})}),
54
+ /* @__PURE__ */B("textarea",{ref:D,"aria-label":e.inputLabel,placeholder:t,rows:1,value:C,onChange:e=>T(e.target.value),onInput:L,onKeyDown:e=>{if("Enter"===e.key&&!e.shiftKey&&!e.nativeEvent.isComposing)return e.preventDefault(),void q();"Escape"===e.key&&v&&y&&(e.preventDefault(),y())},className:"block max-h-48 min-w-0 flex-1 resize-none overflow-y-auto bg-transparent py-1 text-sm leading-6 text-ink-strong outline-none placeholder:text-[color:var(--ink-placeholder)] "+(o||c?"px-1":"px-2")}),i?.map(e=>e.icon?/* @__PURE__ */B(w,{type:"button",variant:"ghost","aria-label":e.label,title:e.label,disabled:!C.trim(),onClick:()=>e.onSelect(C.trim()),children:/* @__PURE__ */B(N,{name:e.icon})},e.key):/* @__PURE__ */B(k,{type:"button",variant:"ghost",disabled:!C.trim(),onClick:()=>e.onSelect(C.trim()),children:e.label},e.key)),/* @__PURE__ */B(w,n?{type:"button",variant:"ghost","aria-label":e.stop,title:e.stop,onClick:s,children:/* @__PURE__ */B(N,{name:"stop-circle"})}:{type:"submit",variant:"ghost","aria-label":e.send,title:e.send,disabled:U,children:/* @__PURE__ */B(N,{name:"enter"})})]}),G=h&&g?/* @__PURE__ */B("div",{className:"px-1 pb-1",children:/* @__PURE__ */B(Ve,{label:e.deciding,words:[],secondsLabel:e.waitingSeconds,steadyLabel:e.deciding})}):h&&x&&b?/* @__PURE__ */E("div",{className:"flex items-center gap-2 px-1 pb-1 text-xs text-ink-faint",children:[
55
55
  /* @__PURE__ */B(Ke,{resting:!0}),
56
56
  /* @__PURE__ */B("span",{role:"status",className:"min-w-0 flex-1 truncate",children:e.notReplied}),
57
- /* @__PURE__ */B(k,{type:"button",size:"sm",variant:"secondary",onClick:b,children:e.askToReply})]}):null,K=v?/* @__PURE__ */B(We,{quote:v,labels:e,onClear:y?()=>{y(),D.current?.focus()}:void 0}):null,V="rounded-2xl border border-line bg-surface shadow-sm transition-colors focus-within:border-line-strong";return l?/* @__PURE__ */E(c,{intake:F,className:"px-3 pt-2 pb-3",children:[G,
57
+ /* @__PURE__ */B(k,{type:"button",size:"sm",variant:"secondary",onClick:b,children:e.askToReply})]}):null,K=v?/* @__PURE__ */B(We,{quote:v,labels:e,onClear:y?()=>{y(),D.current?.focus()}:void 0}):null,V="rounded-2xl border border-line bg-surface shadow-sm transition-colors focus-within:border-line-strong";return c?/* @__PURE__ */E(l,{intake:F,className:"px-3 pt-2 pb-3",children:[G,
58
58
  /* @__PURE__ */E("div",{className:V,children:[I.pending.length>0&&/* @__PURE__ */B("ul",{className:"flex flex-wrap gap-2 px-3 pt-3",children:I.pending.map(t=>/* @__PURE__ */E("li",{className:"flex max-w-full items-center gap-2 rounded-md border py-1 pl-2 pr-1 text-xs "+(t.error?"border-red-200 bg-red-50 text-red-700":"border-gray-200 bg-gray-50 text-gray-700"),children:[t.attachment||t.error?/* @__PURE__ */B(N,{name:"page",size:14,"aria-hidden":"true"}):/* @__PURE__ */B("span",{role:"status","aria-label":e.attaching,className:"inline-flex",children:/* @__PURE__ */B(A,{className:"h-3 w-3"})}),
59
59
  /* @__PURE__ */B("span",{className:"min-w-0 truncate",title:t.error??t.name,children:t.name}),
60
60
  /* @__PURE__ */B("span",{className:"shrink-0 tabular-nums text-gray-400",children:p(t.size,P)}),
@@ -97,11 +97,11 @@ return E("li",{children:[
97
97
  /* @__PURE__ */B("div",{className:"font-medium text-gray-900",children:Dt(e,r)}),e.title&&/* @__PURE__ */B("div",{className:"text-xs text-gray-600",children:e.title}),t.length>0&&/* @__PURE__ */B("dl",{className:"mt-1 grid grid-cols-[max-content_1fr] gap-x-3 gap-y-1 text-xs",children:t.map(e=>/* @__PURE__ */E("div",{className:"contents",children:[
98
98
  /* @__PURE__ */B("dt",{className:"text-gray-500",children:e.label}),
99
99
  /* @__PURE__ */B("dd",{className:"min-w-0 break-words text-gray-800",children:e.value})]},e.label))})]},e.key)})}),
100
- /* @__PURE__ */B(Tt,{approvalId:e,expiresAt:o,expired:"expired"===t?.status,approveLabel:a.approvePlan,labels:a,onApprove:s})]})}function zt({choices:e,label:t,onAnswer:n}){return 0===e.length?null:/* @__PURE__ */B("div",{role:"group","aria-label":t,className:"flex flex-col items-start gap-2 pl-1",children:e.map(e=>/* @__PURE__ */B(k,{size:"sm",variant:"secondary",onClick:()=>n(e),children:e},e))})}function Lt({questions:e,label:t,onAsk:n}){return 0===e.length?null:/* @__PURE__ */B("div",{role:"group","aria-label":t,className:"flex flex-wrap gap-2 pl-1",children:e.map(e=>/* @__PURE__ */B(k,{size:"sm",variant:"secondary",onClick:()=>n(e),children:e},e))})}function Bt({initial:e,labels:t,onRate:n}){const[a,r]=R(e??null),[s,o]=R(!1),[i,c]=R(""),[d,u]=R(!1),[p,m]=R(!1),[h,f]=R(!1),g=async e=>{const t=a;r(e),m(!1),f(!0);try{return await n(e),!0}catch{return r(t),m(!0),!1}finally{f(!1)}},x=e=>{const n="up"===e?t.rateUp:t.rateDown;/* @__PURE__ */
101
- return B(w,{size:"sm","aria-label":n,title:n,"aria-pressed":a?.verdict===e,disabled:h,onClick:()=>{(async e=>{if(u(!1),a?.verdict===e)return o(!1),void await g(null);const t=await g({verdict:e,note:""});o(t&&"down"===e),c("")})(e)},children:/* @__PURE__ */B(N,{name:"hand-thumb-up",className:"down"===e?"h-3.5 w-3.5 rotate-180":"h-3.5 w-3.5"})})};/* @__PURE__ */
100
+ /* @__PURE__ */B(Tt,{approvalId:e,expiresAt:o,expired:"expired"===t?.status,approveLabel:a.approvePlan,labels:a,onApprove:s})]})}function zt({choices:e,label:t,onAnswer:n}){return 0===e.length?null:/* @__PURE__ */B("div",{role:"group","aria-label":t,className:"flex flex-col items-start gap-2 pl-1",children:e.map(e=>/* @__PURE__ */B(k,{size:"sm",variant:"secondary",onClick:()=>n(e),children:e},e))})}function Lt({questions:e,label:t,onAsk:n}){return 0===e.length?null:/* @__PURE__ */B("div",{role:"group","aria-label":t,className:"flex flex-wrap gap-2 pl-1",children:e.map(e=>/* @__PURE__ */B(k,{size:"sm",variant:"secondary",onClick:()=>n(e),children:e},e))})}function Bt({initial:e,labels:t,onRate:n}){const[a,r]=R(e??null),[s,o]=R(!1),[i,l]=R(""),[d,u]=R(!1),[p,m]=R(!1),[h,f]=R(!1),g=async e=>{const t=a;r(e),m(!1),f(!0);try{return await n(e),!0}catch{return r(t),m(!0),!1}finally{f(!1)}},x=e=>{const n="up"===e?t.rateUp:t.rateDown;/* @__PURE__ */
101
+ return B(w,{size:"sm","aria-label":n,title:n,"aria-pressed":a?.verdict===e,disabled:h,onClick:()=>{(async e=>{if(u(!1),a?.verdict===e)return o(!1),void await g(null);const t=await g({verdict:e,note:""});o(t&&"down"===e),l("")})(e)},children:/* @__PURE__ */B(N,{name:"hand-thumb-up",className:"down"===e?"h-3.5 w-3.5 rotate-180":"h-3.5 w-3.5"})})};/* @__PURE__ */
102
102
  return E("div",{role:"group","aria-label":t.rateAnswer,className:"flex min-w-0 flex-1 flex-col gap-1",children:[
103
103
  /* @__PURE__ */E("div",{className:"flex items-center gap-1",children:[x("up"),x("down"),d&&/* @__PURE__ */B("span",{role:"status",className:"px-1 text-xs text-gray-500",children:t.rateThanks}),p&&/* @__PURE__ */B("span",{role:"alert",className:"px-1 text-xs text-red-600",children:t.rateFailed})]}),s&&/* @__PURE__ */E("form",{className:"flex items-center gap-2",onSubmit:e=>{(async e=>{e.preventDefault();const t=i.trim();t&&!await g({verdict:"down",note:t})||(o(!1),u(Boolean(t)))})(e)},children:[
104
- /* @__PURE__ */B("div",{className:"min-w-0 flex-1",children:/* @__PURE__ */B(l,{size:"sm","aria-label":t.rateNote,placeholder:t.rateNote,maxLength:500,value:i,onChange:e=>c(e.target.value),autoFocus:!0})}),
104
+ /* @__PURE__ */B("div",{className:"min-w-0 flex-1",children:/* @__PURE__ */B(c,{size:"sm","aria-label":t.rateNote,placeholder:t.rateNote,maxLength:500,value:i,onChange:e=>l(e.target.value),autoFocus:!0})}),
105
105
  /* @__PURE__ */B(k,{type:"submit",size:"sm",variant:"secondary",disabled:h||!i.trim(),children:t.rateNoteSend}),
106
106
  /* @__PURE__ */B(k,{type:"button",size:"sm",variant:"ghost",onClick:()=>o(!1),children:t.rateNoteSkip})]})]})}function Et(e,t){return n=>{if("chart"===n.lang){if(!n.closed)/* @__PURE__ */return B(y,{height:200});const e=h(n.code);return e?/* @__PURE__ */B(f,{spec:e}):null}if("flow"===n.lang){if(!n.closed)/* @__PURE__ */return B(y,{height:200});const a=v(n.code);return a?/* @__PURE__ */B(b,{spec:a,labels:{downloadPng:e.flowDownloadPng,downloadSvg:e.flowDownloadSvg,toPdf:e.flowToPdf},onToPdf:t?()=>t(e.flowToPdfText):void 0}):null}return null}}function Ut(e,t){return"approval-responded"===e.state&&t.some(t=>{return t.toolName===e.toolName&&"approval-requested"!==t.state&&(t.toolCallId===e.toolCallId||(n=t.input,a=e.input,JSON.stringify(n)===JSON.stringify(a)));var n,a})}function qt(e,t,n,a){const r=e.flatMap(e=>"tool"===e.kind?[$t(e.tool,n,a)]:[]);if(t){const e=r.find(e=>"running"===e.kind);return e?e.base:a.working}const s=[...new Set(r.map(e=>e.base))];return s.length>0?s.join(" · "):a.reasoning}function Ht({message:e,live:t,labels:n}){const a=Q(e),r=a.length>0,s=S(null),[o,i]=R(0);$(()=>{if(!t)return;null===s.current&&(s.current=performance.now());const e=setInterval(()=>i(performance.now()-(s.current??performance.now())),500);return()=>clearInterval(e)},[t]);const l=e.metadata?.usage;let c=null;return t?c=r?bt(a,o,n):null:l&&(c=xt(l,n)),c?/* @__PURE__ */B("div",{className:"px-1 text-xs leading-6 tabular-nums text-gray-500",children:c}):null}function Wt({files:e,labels:t,onOpen:n,start:a}){const r="flex max-w-full items-center gap-2 rounded-md border border-gray-200 bg-white px-2 py-1 text-xs text-gray-700";/* @__PURE__ */
107
107
  return B("ul",{className:a?"mt-1 flex flex-wrap gap-2":"flex max-w-[85%] flex-wrap justify-end gap-2",children:e.map(e=>{const a=/* @__PURE__ */E(U,{children:[
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export{ImageAnnotator_default as default}from"../chunk-TDUOBP55.js";import"../chunk-M6UKCZHT.js";import"../chunk-I2NVBDKH.js";import"../chunk-UQYNPYF4.js";import"../chunk-MRJKZWWV.js";import"../chunk-MAFUXCPZ.js";import"../chunk-NRHG4R2Q.js";import"../chunk-C3QOHMR6.js";
2
+ export{ImageAnnotator_default as default}from"../chunk-WGDVYCQX.js";import"../chunk-GZ4AMXEU.js";import"../chunk-M6UKCZHT.js";import"../chunk-3AUPCKBR.js";import"../chunk-I2NVBDKH.js";import"../chunk-UQYNPYF4.js";import"../chunk-MRJKZWWV.js";import"../chunk-MAFUXCPZ.js";import"../chunk-NRHG4R2Q.js";import"../chunk-C3QOHMR6.js";
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export{FILES_ROUTE,chooseInFiles,openFilesInTrashMode,setFilesDemoTree,withdrawFilesChoice}from"../chunk-CUNYWXUT.js";export{setBrowserStartUrl}from"../chunk-LWLCNQY7.js";export{BUILTIN_APP_INFO}from"../chunk-OQAGCYR7.js";import{setSpreadsheetPreview as e}from"../chunk-KGRJSTPM.js";export{FILES_OFFICE_EXTENSIONS,FILES_ROLE_LABELS,FilesQuotaError,SPREADSHEET_PREVIEW_UPDATE_EVENT,claimSpreadsheetPreviewStage,createFileServerStore,filesRoleWrites,peekSpreadsheetPreviewStage,setFilesStore,setSpreadsheetPreview}from"../chunk-KGRJSTPM.js";import{setPdfPreview as t}from"../chunk-I4RJAMLJ.js";export{setPdfPreview}from"../chunk-I4RJAMLJ.js";import"../chunk-XRWUNOI3.js";import"../chunk-4LXCCZDM.js";import"../chunk-KNUR2UEG.js";import"../chunk-JDCM2VHG.js";import"../chunk-PSVGB7KT.js";import"../chunk-YI4T5I5D.js";import"../chunk-TTD2M6RF.js";import"../chunk-5A7MWTXX.js";import"../chunk-TJ5YMXVB.js";import"../chunk-JRKD7SD3.js";import"../chunk-5RCKE4X2.js";import"../chunk-EIFNESXS.js";import"../chunk-PO2KNVCC.js";import"../chunk-CJ4OEY3T.js";import"../chunk-5QHNDAZ6.js";import"../chunk-TEQ5ZPAL.js";import"../chunk-VWGWZY7A.js";import"../chunk-DBQNYJZ6.js";import"../chunk-L2WQOJ3T.js";import"../chunk-5VJVEKVM.js";import"../chunk-YPXONNBV.js";import"../chunk-4PJFL26P.js";import"../chunk-2QY5BJLA.js";import"../chunk-UGTRSRIW.js";import"../chunk-POBVGDZP.js";import"../chunk-F3ZOO23R.js";import"../chunk-IN36HWJK.js";import"../chunk-NJY4HPNB.js";import"../chunk-PM6HY5BH.js";import"../chunk-DWGYC7OD.js";import"../chunk-APFDZ2HG.js";import"../chunk-ABIWAS5K.js";import"../chunk-P56YLT73.js";import"../chunk-URHGHXDN.js";import"../chunk-5QFPTDQF.js";import"../chunk-A4ROXNUF.js";import"../chunk-TSZPGDU3.js";import"../chunk-ISVODSRP.js";import"../chunk-J75ZT2JQ.js";import"../chunk-R2VKEMZH.js";import"../chunk-BWJZTHZ6.js";import"../chunk-FAPZFMS3.js";import"../chunk-CIZAUBWA.js";import"../chunk-PGN5ME7B.js";import"../chunk-5QRHQCRG.js";import"../chunk-62LW225J.js";import"../chunk-TAHHZGRH.js";import"../chunk-KEFNQEXZ.js";import"../chunk-PU2GJVMG.js";import"../chunk-3FININUU.js";import"../chunk-STKJA4PV.js";import"../chunk-M6UKCZHT.js";import{toast_default as o}from"../chunk-I2NVBDKH.js";import"../chunk-UQYNPYF4.js";import"../chunk-MRJKZWWV.js";import"../chunk-TWVUQUUD.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-MAFUXCPZ.js";import{currentShellStrings as n}from"../chunk-NRHG4R2Q.js";import"../chunk-C3QOHMR6.js";import{lazy as i}from"react";function r(e){const t=/\.([a-z0-9]+)(?:[?#].*)?$/i.exec((e||"").trim());return t?t[1].toLowerCase():""}var s=/* @__PURE__ */new Set(["csv","tsv"]),c=/* @__PURE__ */new Set(["xlsx","xls","xlsm","ods"]),m=/* @__PURE__ */new Set(["png","jpg","jpeg","gif","webp","bmp","svg","avif"]),a=/* @__PURE__ */new Set(["step","stp","stl","obj","gltf","glb","3mf","iges","igs"]);function u(e){const t=r(e);return"pdf"===t?"pdf":"dxf"===t?"dxf":s.has(t)?"csv":m.has(t)?"image":a.has(t)?"3d":null}function p(e){window.open(e,"_blank","noopener,noreferrer")}async function l(e,t,o){if(t.fetchBlob)return(await t.fetchBlob(o)).text();const n=await fetch(e);if(!n.ok)throw new Error(`fetch failed: ${n.status}`);return n.text()}function h(e,t){return(e instanceof Error?e.message:"")||t}async function k(i,s,m={}){const a=n().attachment,k=i?.url||"",j=i?.filename||a.fallbackName;if(!k&&!m.fetchBlob)return void o.error(a.noLink);const f=u(j)??u(k);if("csv"===f){try{e({csv:await l(k,m,i),filename:j}),s("/spreadsheet")}catch{o.error(a.spreadsheetFailed),k&&p(k)}return}if(c.has(r(j)||r(k)))return o.error(a.workbookUnavailable),void(k&&p(k));if(!f)return k?(o.info(a.noViewer),void p(k)):void o.error(a.noLink);if(!m.fetchBlob)return t({url:k,filename:j,kind:f}),void s("/preview");const d=t({filename:j,kind:f,converting:!0,convertingMessage:m.loadingMessage||a.loading});s("/preview");try{const e=await m.fetchBlob(i);d.update({url:URL.createObjectURL(e),filename:j,kind:f})}catch(e){d.update({filename:j,kind:f,converting:!1,convertingMessage:h(e,a.loadFailed)})}}function j(e,t,o={}){const i=n().attachment,s=[];let m=-1;return e.forEach((e,n)=>{const a=e?.url||"";if(!a&&!o.fetchBlob)return;const p=e?.filename||i.fallbackName;if(c.has(r(p)||r(a)))return;const l=u(p)??u(a);l&&"csv"!==l&&(n===t&&(m=s.length),s.push({att:e,sourceIndex:n,filename:p,url:a,kind:l}))}),{items:s,start:m}}async function f(e,o,i,r={}){const{items:s,start:c}=j(e,o,r);if(c<0||s.length<2){const t=e[o];return void(t&&await k(t,i,r))}const m=n().attachment,a=s.length;let u=null,p=-1;const l=e=>({position:{index:e,count:a},onPrevious:e>0?()=>{d(e-1)}:void 0,onNext:e<a-1?()=>{d(e+1)}:void 0}),f=e=>{u?u.update(e):(u=t(e),i("/preview"))};async function d(e){p=e;const{att:t,filename:o,url:n,kind:i}=s[e];if(r.fetchBlob){f({filename:o,kind:i,converting:!0,convertingMessage:r.loadingMessage||m.loading,...l(e)});try{const n=await r.fetchBlob(t),s=URL.createObjectURL(n);if(p!==e)return void URL.revokeObjectURL(s);f({url:s,filename:o,kind:i,...l(e)})}catch(t){if(p!==e)return;f({filename:o,kind:i,converting:!1,convertingMessage:h(t,m.loadFailed),...l(e)})}}else f({url:n,filename:o,kind:i,...l(e)})}await d(c)}var d=i(()=>import("../Calculator-PAMITD4N.js")),w=i(()=>import("../Weather-2OU3LEWQ.js")),g=i(()=>import("../CurrencyConverter-UAZYLLHT.js")),P=i(()=>import("../PomodoroTimer-QFF2FTAG.js")),v=i(()=>import("../Notepad-23YBRLDH.js")),T=i(()=>import("../WorldClock-PYJ4762U.js")),S=i(()=>import("../Stock-6YYK6VWP.js")),F=i(()=>import("../Preview-4VKAQ4TY.js")),N=i(()=>import("../PdfViewer-AIAVQYZ6.js")),R=i(()=>import("../Files-G5VBN3GD.js")),E=i(()=>import("../Browser-MBT76EKF.js")),U={"/calculator":{component:d,label:"Calculator",size:"sm",allowPinOnTop:!0,utility:!0,widget:!0,dimensions:[280,420]},"/notepad":{component:v,label:"Notepad",size:"lg",allowPinOnTop:!0,flushBody:!0},"/weather":{component:w,label:"Weather",size:"sm",utility:!0,widget:!0,autoHeight:!0,dimensions:[320,400]},"/currency":{component:g,label:"Currency Converter",size:"sm",utility:!0,widget:!0,autoHeight:!0,dimensions:[320,480]},"/pomodoro":{component:P,label:"Pomodoro Timer",size:"sm",utility:!0,widget:!0,dimensions:[320,600]},"/world-clock":{component:T,label:"World Clock",size:"sm",utility:!0,widget:!0,autoHeight:!0,dimensions:[320,480]},"/stock":{component:S,label:"Stocks",size:"sm",utility:!0,widget:!0,autoHeight:!0,dimensions:[320,360]}},L={"/preview":{component:F,label:"Preview",size:"2xl",appStyle:!0,multiInstance:!0},"/files":{component:R,label:"Files",size:"xl",appStyle:!0}},b={"/browser":{component:E,label:"Browser",size:"2xl",appStyle:!0,multiInstance:!0}},B={...U,...L,...b};export{E as Browser,d as Calculator,g as CurrencyConverter,R as Files,v as Notepad,N as PdfViewer,P as PomodoroTimer,F as Preview,S as Stock,w as Weather,T as WorldClock,u as attachmentKind,B as bundledApps,L as documentApps,k as openAttachment,f as openAttachments,U as utilityApps,j as viewableAttachments,b as webApps};
2
+ export{FILES_ROUTE,chooseInFiles,openFilesInTrashMode,setFilesDemoTree,withdrawFilesChoice}from"../chunk-CUNYWXUT.js";export{setBrowserStartUrl}from"../chunk-LWLCNQY7.js";export{BUILTIN_APP_INFO}from"../chunk-EA423N2F.js";import{setSpreadsheetPreview as e}from"../chunk-KGRJSTPM.js";export{FILES_OFFICE_EXTENSIONS,FILES_ROLE_LABELS,FilesQuotaError,SPREADSHEET_PREVIEW_UPDATE_EVENT,claimSpreadsheetPreviewStage,createFileServerStore,filesRoleWrites,peekSpreadsheetPreviewStage,setFilesStore,setSpreadsheetPreview}from"../chunk-KGRJSTPM.js";import{setPdfPreview as t}from"../chunk-I4RJAMLJ.js";export{setPdfPreview}from"../chunk-I4RJAMLJ.js";import"../chunk-GD5NGS6D.js";import"../chunk-4LXCCZDM.js";import"../chunk-KNUR2UEG.js";import"../chunk-JDCM2VHG.js";import"../chunk-PSVGB7KT.js";import"../chunk-YI4T5I5D.js";import"../chunk-5A7MWTXX.js";import"../chunk-TJ5YMXVB.js";import"../chunk-JRKD7SD3.js";import"../chunk-5RCKE4X2.js";import"../chunk-ZLB5GRL6.js";import"../chunk-EIFNESXS.js";import"../chunk-PO2KNVCC.js";import"../chunk-CJ4OEY3T.js";import"../chunk-5QHNDAZ6.js";import"../chunk-TEQ5ZPAL.js";import"../chunk-VWGWZY7A.js";import"../chunk-DBQNYJZ6.js";import"../chunk-L2WQOJ3T.js";import"../chunk-5VJVEKVM.js";import"../chunk-YPXONNBV.js";import"../chunk-4PJFL26P.js";import"../chunk-2QY5BJLA.js";import"../chunk-UGTRSRIW.js";import"../chunk-POBVGDZP.js";import"../chunk-F3ZOO23R.js";import"../chunk-6FOLK4HD.js";import"../chunk-NJY4HPNB.js";import"../chunk-PM6HY5BH.js";import"../chunk-DWGYC7OD.js";import"../chunk-APFDZ2HG.js";import"../chunk-ABIWAS5K.js";import"../chunk-P56YLT73.js";import"../chunk-URHGHXDN.js";import"../chunk-5QFPTDQF.js";import"../chunk-A4ROXNUF.js";import"../chunk-TSZPGDU3.js";import"../chunk-ISVODSRP.js";import"../chunk-J75ZT2JQ.js";import"../chunk-R2VKEMZH.js";import"../chunk-BWJZTHZ6.js";import"../chunk-FAPZFMS3.js";import"../chunk-CIZAUBWA.js";import"../chunk-PGN5ME7B.js";import"../chunk-5QRHQCRG.js";import"../chunk-62LW225J.js";import"../chunk-TAHHZGRH.js";import"../chunk-KEFNQEXZ.js";import"../chunk-PU2GJVMG.js";import"../chunk-3FININUU.js";import"../chunk-STKJA4PV.js";import"../chunk-GZ4AMXEU.js";import"../chunk-M6UKCZHT.js";import"../chunk-3AUPCKBR.js";import{toast_default as o}from"../chunk-I2NVBDKH.js";import"../chunk-UQYNPYF4.js";import"../chunk-MRJKZWWV.js";import"../chunk-TWVUQUUD.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-MAFUXCPZ.js";import{currentShellStrings as n}from"../chunk-NRHG4R2Q.js";import"../chunk-C3QOHMR6.js";import{lazy as i}from"react";function r(e){const t=/\.([a-z0-9]+)(?:[?#].*)?$/i.exec((e||"").trim());return t?t[1].toLowerCase():""}var s=/* @__PURE__ */new Set(["csv","tsv"]),c=/* @__PURE__ */new Set(["xlsx","xls","xlsm","ods"]),m=/* @__PURE__ */new Set(["png","jpg","jpeg","gif","webp","bmp","svg","avif"]),a=/* @__PURE__ */new Set(["step","stp","stl","obj","gltf","glb","3mf","iges","igs"]);function u(e){const t=r(e);return"pdf"===t?"pdf":"dxf"===t?"dxf":s.has(t)?"csv":m.has(t)?"image":a.has(t)?"3d":null}function p(e){window.open(e,"_blank","noopener,noreferrer")}async function l(e,t,o){if(t.fetchBlob)return(await t.fetchBlob(o)).text();const n=await fetch(e);if(!n.ok)throw new Error(`fetch failed: ${n.status}`);return n.text()}function h(e,t){return(e instanceof Error?e.message:"")||t}async function k(i,s,m={}){const a=n().attachment,k=i?.url||"",j=i?.filename||a.fallbackName;if(!k&&!m.fetchBlob)return void o.error(a.noLink);const f=u(j)??u(k);if("csv"===f){try{e({csv:await l(k,m,i),filename:j}),s("/spreadsheet")}catch{o.error(a.spreadsheetFailed),k&&p(k)}return}if(c.has(r(j)||r(k)))return o.error(a.workbookUnavailable),void(k&&p(k));if(!f)return k?(o.info(a.noViewer),void p(k)):void o.error(a.noLink);if(!m.fetchBlob)return t({url:k,filename:j,kind:f}),void s("/preview");const d=t({filename:j,kind:f,converting:!0,convertingMessage:m.loadingMessage||a.loading});s("/preview");try{const e=await m.fetchBlob(i);d.update({url:URL.createObjectURL(e),filename:j,kind:f})}catch(e){d.update({filename:j,kind:f,converting:!1,convertingMessage:h(e,a.loadFailed)})}}function j(e,t,o={}){const i=n().attachment,s=[];let m=-1;return e.forEach((e,n)=>{const a=e?.url||"";if(!a&&!o.fetchBlob)return;const p=e?.filename||i.fallbackName;if(c.has(r(p)||r(a)))return;const l=u(p)??u(a);l&&"csv"!==l&&(n===t&&(m=s.length),s.push({att:e,sourceIndex:n,filename:p,url:a,kind:l}))}),{items:s,start:m}}async function f(e,o,i,r={}){const{items:s,start:c}=j(e,o,r);if(c<0||s.length<2){const t=e[o];return void(t&&await k(t,i,r))}const m=n().attachment,a=s.length;let u=null,p=-1;const l=e=>({position:{index:e,count:a},onPrevious:e>0?()=>{d(e-1)}:void 0,onNext:e<a-1?()=>{d(e+1)}:void 0}),f=e=>{u?u.update(e):(u=t(e),i("/preview"))};async function d(e){p=e;const{att:t,filename:o,url:n,kind:i}=s[e];if(r.fetchBlob){f({filename:o,kind:i,converting:!0,convertingMessage:r.loadingMessage||m.loading,...l(e)});try{const n=await r.fetchBlob(t),s=URL.createObjectURL(n);if(p!==e)return void URL.revokeObjectURL(s);f({url:s,filename:o,kind:i,...l(e)})}catch(t){if(p!==e)return;f({filename:o,kind:i,converting:!1,convertingMessage:h(t,m.loadFailed),...l(e)})}}else f({url:n,filename:o,kind:i,...l(e)})}await d(c)}var d=i(()=>import("../Calculator-6WNTZLWL.js")),w=i(()=>import("../Weather-K3BVAFRV.js")),g=i(()=>import("../CurrencyConverter-C4KCZWUM.js")),P=i(()=>import("../PomodoroTimer-BGTCWT53.js")),v=i(()=>import("../Notepad-S5JMXH2O.js")),S=i(()=>import("../WorldClock-RHAHXLW4.js")),T=i(()=>import("../Stock-LIOPTQG5.js")),L=i(()=>import("../Preview-HTFTEL7K.js")),F=i(()=>import("../PdfViewer-AIAVQYZ6.js")),R=i(()=>import("../Files-VFRXPQLV.js")),E=i(()=>import("../Browser-5QLDJ74Z.js")),N={"/calculator":{component:d,label:"Calculator",size:"sm",allowPinOnTop:!0,utility:!0,widget:!0,dimensions:[280,420]},"/notepad":{component:v,label:"Notepad",size:"lg",allowPinOnTop:!0,flushBody:!0},"/weather":{component:w,label:"Weather",size:"sm",utility:!0,widget:!0,autoHeight:!0,dimensions:[320,400]},"/currency":{component:g,label:"Currency Converter",size:"sm",utility:!0,widget:!0,autoHeight:!0,dimensions:[320,480]},"/pomodoro":{component:P,label:"Pomodoro Timer",size:"sm",utility:!0,widget:!0,dimensions:[320,600]},"/world-clock":{component:S,label:"World Clock",size:"sm",utility:!0,widget:!0,autoHeight:!0,dimensions:[320,480]},"/stock":{component:T,label:"Stocks",size:"sm",utility:!0,widget:!0,autoHeight:!0,dimensions:[320,360]}},B={"/preview":{component:L,label:"Preview",size:"2xl",appStyle:!0,multiInstance:!0},"/files":{component:R,label:"Files",size:"xl",appStyle:!0}},U={"/browser":{component:E,label:"Browser",size:"2xl",appStyle:!0,multiInstance:!0}},b={...N,...B,...U};export{E as Browser,d as Calculator,g as CurrencyConverter,R as Files,v as Notepad,F as PdfViewer,P as PomodoroTimer,L as Preview,T as Stock,w as Weather,S as WorldClock,u as attachmentKind,b as bundledApps,B as documentApps,k as openAttachment,f as openAttachments,N as utilityApps,j as viewableAttachments,U as webApps};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as e}from"module";import{extname as t,isAbsolute as r,join as s,resolve as n}from"path";import{readFileSync as i,existsSync as o,statSync as c,readdirSync as a,mkdtempSync as l,rmSync as d}from"fs";import{execFileSync as h}from"child_process";import{tmpdir as f}from"os";import u from"assert/strict";import{createServer as w}from"http";import{pathToFileURL as p}from"url";function m(t,r){for(const n of[s(process.cwd(),"package.json"),r])try{return e(n)(t)}catch{}throw new Error(`${t} is not installed; add it to this repository's devDependencies`)}var g=class extends Error{};var y="efficient-shell-browser-check",v=`${y}: run real-browser checks, one <name>.entry.tsx page and one <name>.check.mjs check per scenario.\n\n ${y} [--dir tests/browser] [--css <file>]... [--tailwind <entry.css>]... [--serve <urlPath>=<file>]... [--define KEY=JSON]...\n\n --dir <folder> the scenario folder (default tests/browser)\n --css <file> a stylesheet every page links, in the order given\n --tailwind <entry.css> a Tailwind entry, compiled with this repository's @tailwindcss/cli,\n linked like a --css sheet, in the order given\n --serve <urlPath>=<file> a file the page can fetch at urlPath (starts with /)\n --define KEY=JSON replace KEY in the bundle with the JSON value\n --version, --help\n\nesbuild and playwright come from this repository's devDependencies.\nBROWSER_SHARD=<i>/<n> runs one shard. Exits 1 when a check fails.`,b={".js":"text/javascript; charset=utf-8",".mjs":"text/javascript; charset=utf-8",".css":"text/css; charset=utf-8",".html":"text/html; charset=utf-8",".json":"application/json; charset=utf-8",".svg":"image/svg+xml",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".webp":"image/webp",".pdf":"application/pdf",".wasm":"application/wasm",".woff2":"font/woff2",".glb":"model/gltf-binary"},$=class extends Error{};function x(e,t,n){const i=r(t)?t:s(e,t);if(!o(i)||!c(i).isFile())throw new $(`${n} ${t}: no such file`);return i}function E(e,t,r){return i(x(e,t,r))}async function j(e){const{dir:t,root:r=process.cwd(),esbuild:i,chromium:o,stylesheets:c=[],serve:l={},define:d={},shard:h,reactDir:f,out:m=e=>console.log(e),err:g=(...e)=>console.error(...e)}=e,y=a(t).filter(e=>e.endsWith(".entry.tsx")).map(e=>e.replace(/\.entry\.tsx$/,"")).sort();if(0===y.length)throw new Error(`no *.entry.tsx found in ${t}`);const v=function(e,t){if(!t)return e;const r=/^(\d+)\/(\d+)$/.exec(t);if(!r)throw new Error(`BROWSER_SHARD must look like 1/3, got ${JSON.stringify(t)}`);const[s,n]=[Number(r[1]),Number(r[2])];if(!(n>=1&&s>=1&&s<=n))throw new Error(`BROWSER_SHARD ${t} is out of range`);return e.filter((e,t)=>t%n===s-1)}(y,h);h&&m(`shard ${h}: ${v.length} of ${y.length} scenarios`);const b=c.map((e,t)=>`/styles-${t+1}.css`),$=new Map(Object.entries(l));c.forEach((e,t)=>$.set(b[t],{contentType:"text/css; charset=utf-8",body:e}));const x=await o.launch({headless:!0});let E=!1;try{for(const e of v){const{default:o,describe:c,viewport:a}=await(import(p(s(t,`${e}.check.mjs`)).href)),l=await i.build({entryPoints:[s(t,`${e}.entry.tsx`)],bundle:!0,write:!1,outdir:s(r,"node_modules",".cache","efficient-shell-browser"),entryNames:"bundle",format:"esm",platform:"browser",target:"chrome120",jsx:"automatic",define:d,logLevel:"warning",...f&&{alias:{react:s(n(f),"react"),"react-dom":s(n(f),"react-dom")}}}),h=l.outputFiles.find(e=>e.path.endsWith(".js")).text,y=l.outputFiles.find(e=>e.path.endsWith(".css"))?.text??null,v=w((e,t)=>{const r=e.url??"/";if("/bundle.js"===r)return t.writeHead(200,{"content-type":"text/javascript; charset=utf-8"}),void t.end(h);if("/bundle.css"===r&&null!==y)return t.writeHead(200,{"content-type":"text/css; charset=utf-8"}),void t.end(y);const s=$.get(r);if(s)return t.writeHead(200,{"content-type":s.contentType}),void t.end(s.body);t.writeHead(200,{"content-type":"text/html; charset=utf-8"}),t.end("<!doctype html><html><head>"+b.map(e=>`<link rel="stylesheet" href="${e}">`).join("")+(null!==y?'<link rel="stylesheet" href="/bundle.css">':"")+'</head><body><div id="root"></div><script type="module" src="/bundle.js"><\/script></body></html>')});await new Promise((e,t)=>{v.once("error",t),v.listen(0,"127.0.0.1",e)});const j=v.address();u.ok(j&&"object"==typeof j);const R=`http://127.0.0.1:${j.port}`,S=await x.newPage({viewport:a??{width:1280,height:720}}),k=(e="")=>S.goto(`${R}/${e}`,{waitUntil:"networkidle"});S.setDefaultTimeout(15e3);const O=[];S.on("pageerror",e=>O.push(e));try{await k(),await o(S,{pageErrors:O,baseUrl:R,open:k}),m(`✔ ${c??e}`)}catch(t){E=!0,g(`✖ ${c??e}`),g(t);for(const e of O)g(" page error:",e.message)}finally{await S.close(),await new Promise(e=>v.close(e))}}}finally{await x.close()}return!E}var R=import.meta.url;process.exitCode=await async function(e,n){let i;try{i=function(e,n,i){let o="tests/browser";const c=[],a={},l={};for(let r=0;r<e.length;r++){const s=e[r];if("--help"===s||"-h"===s)return"help";if("--version"===s||"-v"===s)return"version";const d=s.indexOf("="),h=s.startsWith("--")&&d>0?s.slice(0,d):s;if(!["--dir","--css","--tailwind","--serve","--define"].includes(h))throw new $(`unknown argument "${s}"`);let f;if(h!==s)f=s.slice(d+1);else{if(r+1>=e.length)throw new $(`${h} needs a value`);f=e[++r]}if("--dir"===h)o=f;else if("--css"===h)c.push(E(n,f,h).toString("utf8"));else if("--tailwind"===h){const e=x(n,f,h);try{c.push(i(e))}catch(e){if(e instanceof g)throw new $(e.message);throw e}}else if("--serve"===h){const e=f.indexOf("=");if(e<=0)throw new $(`--serve ${f}: expected <urlPath>=<file>`);const r=f.slice(0,e);if(!r.startsWith("/"))throw new $(`--serve ${f}: the URL path must start with /`);const s=f.slice(e+1);a[r]={contentType:b[t(s).toLowerCase()]??"application/octet-stream",body:E(n,s,h)}}else{const e=f.indexOf("=");if(e<=0)throw new $(`--define ${f}: expected KEY=JSON`);const t=f.slice(0,e),r=f.slice(e+1);try{JSON.parse(r)}catch{throw new $(`--define ${t}: ${JSON.stringify(r)} is not JSON (a string needs its quotes: KEY='"text"')`)}l[t]=r}}return{dir:r(o)?o:s(n,o),stylesheets:c,serve:a,define:l}}(e,n.cwd,n.compileTailwind)}catch(e){if(!(e instanceof $))throw e;return n.err(`${y}: ${e.message}\n\n${v}`),1}if("help"===i)return n.out(v),0;if("version"===i)return n.out(n.version),0;n.env.BROWSER_SHARD&&(i.shard=n.env.BROWSER_SHARD),n.env.REACT_DIR&&(i.reactDir=n.env.REACT_DIR),i.root=n.cwd;try{return await n.runLane(i)?0:1}catch(e){return n.err(`${y}: ${e instanceof Error?e.message:String(e)}`),1}}(process.argv.slice(2),{cwd:process.cwd(),env:process.env,out:e=>console.log(e),err:e=>console.error(e),version:"15.6.0",compileTailwind:e=>function(e,t){if(!o(e)||!c(e).isFile())throw new g(`--tailwind ${e}: no such file`);const r=s(t,"node_modules",".bin","tailwindcss");if(!o(r))throw new g("--tailwind needs the Tailwind CLI: add @tailwindcss/cli to this repository's devDependencies");const n=l(s(f(),"browser-check-css-"));try{const o=s(n,"styles.css");return h(r,["-i",e,"-o",o],{cwd:t,stdio:["ignore","ignore","inherit"]}),i(o,"utf8")}finally{d(n,{recursive:!0,force:!0})}}(e,process.cwd()),runLane:e=>j({...e,esbuild:m("esbuild",R),chromium:m("playwright",R).chromium})});
2
+ import{createRequire as e}from"module";import{extname as t,isAbsolute as r,join as s,resolve as n}from"path";import{readFileSync as i,existsSync as o,statSync as c,readdirSync as a,mkdtempSync as l,rmSync as d}from"fs";import{execFileSync as h}from"child_process";import{tmpdir as f}from"os";import u from"assert/strict";import{createServer as w}from"http";import{pathToFileURL as p}from"url";function m(t,r){for(const n of[s(process.cwd(),"package.json"),r])try{return e(n)(t)}catch{}throw new Error(`${t} is not installed; add it to this repository's devDependencies`)}var g=class extends Error{};var y="efficient-shell-browser-check",v=`${y}: run real-browser checks, one <name>.entry.tsx page and one <name>.check.mjs check per scenario.\n\n ${y} [--dir tests/browser] [--css <file>]... [--tailwind <entry.css>]... [--serve <urlPath>=<file>]... [--define KEY=JSON]...\n\n --dir <folder> the scenario folder (default tests/browser)\n --css <file> a stylesheet every page links, in the order given\n --tailwind <entry.css> a Tailwind entry, compiled with this repository's @tailwindcss/cli,\n linked like a --css sheet, in the order given\n --serve <urlPath>=<file> a file the page can fetch at urlPath (starts with /)\n --define KEY=JSON replace KEY in the bundle with the JSON value\n --version, --help\n\nesbuild and playwright come from this repository's devDependencies.\nBROWSER_SHARD=<i>/<n> runs one shard. Exits 1 when a check fails.`,b={".js":"text/javascript; charset=utf-8",".mjs":"text/javascript; charset=utf-8",".css":"text/css; charset=utf-8",".html":"text/html; charset=utf-8",".json":"application/json; charset=utf-8",".svg":"image/svg+xml",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".webp":"image/webp",".pdf":"application/pdf",".wasm":"application/wasm",".woff2":"font/woff2",".glb":"model/gltf-binary"},$=class extends Error{};function x(e,t,n){const i=r(t)?t:s(e,t);if(!o(i)||!c(i).isFile())throw new $(`${n} ${t}: no such file`);return i}function E(e,t,r){return i(x(e,t,r))}async function j(e){const{dir:t,root:r=process.cwd(),esbuild:i,chromium:o,stylesheets:c=[],serve:l={},define:d={},shard:h,reactDir:f,out:m=e=>console.log(e),err:g=(...e)=>console.error(...e)}=e,y=a(t).filter(e=>e.endsWith(".entry.tsx")).map(e=>e.replace(/\.entry\.tsx$/,"")).sort();if(0===y.length)throw new Error(`no *.entry.tsx found in ${t}`);const v=function(e,t){if(!t)return e;const r=/^(\d+)\/(\d+)$/.exec(t);if(!r)throw new Error(`BROWSER_SHARD must look like 1/3, got ${JSON.stringify(t)}`);const[s,n]=[Number(r[1]),Number(r[2])];if(!(n>=1&&s>=1&&s<=n))throw new Error(`BROWSER_SHARD ${t} is out of range`);return e.filter((e,t)=>t%n===s-1)}(y,h);h&&m(`shard ${h}: ${v.length} of ${y.length} scenarios`);const b=c.map((e,t)=>`/styles-${t+1}.css`),$=new Map(Object.entries(l));c.forEach((e,t)=>$.set(b[t],{contentType:"text/css; charset=utf-8",body:e}));const x=await o.launch({headless:!0});let E=!1;try{for(const e of v){const{default:o,describe:c,viewport:a}=await(import(p(s(t,`${e}.check.mjs`)).href)),l=await i.build({entryPoints:[s(t,`${e}.entry.tsx`)],bundle:!0,write:!1,outdir:s(r,"node_modules",".cache","efficient-shell-browser"),entryNames:"bundle",format:"esm",platform:"browser",target:"chrome120",jsx:"automatic",define:d,logLevel:"warning",...f&&{alias:{react:s(n(f),"react"),"react-dom":s(n(f),"react-dom")}}}),h=l.outputFiles.find(e=>e.path.endsWith(".js")).text,y=l.outputFiles.find(e=>e.path.endsWith(".css"))?.text??null,v=w((e,t)=>{const r=e.url??"/";if("/bundle.js"===r)return t.writeHead(200,{"content-type":"text/javascript; charset=utf-8"}),void t.end(h);if("/bundle.css"===r&&null!==y)return t.writeHead(200,{"content-type":"text/css; charset=utf-8"}),void t.end(y);const s=$.get(r);if(s)return t.writeHead(200,{"content-type":s.contentType}),void t.end(s.body);t.writeHead(200,{"content-type":"text/html; charset=utf-8"}),t.end("<!doctype html><html><head>"+b.map(e=>`<link rel="stylesheet" href="${e}">`).join("")+(null!==y?'<link rel="stylesheet" href="/bundle.css">':"")+'</head><body><div id="root"></div><script type="module" src="/bundle.js"><\/script></body></html>')});await new Promise((e,t)=>{v.once("error",t),v.listen(0,"127.0.0.1",e)});const j=v.address();u.ok(j&&"object"==typeof j);const R=`http://127.0.0.1:${j.port}`,S=await x.newPage({viewport:a??{width:1280,height:720}}),k=(e="")=>S.goto(`${R}/${e}`,{waitUntil:"networkidle"});S.setDefaultTimeout(15e3);const O=[];S.on("pageerror",e=>O.push(e));try{await k(),await o(S,{pageErrors:O,baseUrl:R,open:k}),m(`✔ ${c??e}`)}catch(t){E=!0,g(`✖ ${c??e}`),g(t);for(const e of O)g(" page error:",e.message)}finally{await S.close(),await new Promise(e=>v.close(e))}}}finally{await x.close()}return!E}var R=import.meta.url;process.exitCode=await async function(e,n){let i;try{i=function(e,n,i){let o="tests/browser";const c=[],a={},l={};for(let r=0;r<e.length;r++){const s=e[r];if("--help"===s||"-h"===s)return"help";if("--version"===s||"-v"===s)return"version";const d=s.indexOf("="),h=s.startsWith("--")&&d>0?s.slice(0,d):s;if(!["--dir","--css","--tailwind","--serve","--define"].includes(h))throw new $(`unknown argument "${s}"`);let f;if(h!==s)f=s.slice(d+1);else{if(r+1>=e.length)throw new $(`${h} needs a value`);f=e[++r]}if("--dir"===h)o=f;else if("--css"===h)c.push(E(n,f,h).toString("utf8"));else if("--tailwind"===h){const e=x(n,f,h);try{c.push(i(e))}catch(e){if(e instanceof g)throw new $(e.message);throw e}}else if("--serve"===h){const e=f.indexOf("=");if(e<=0)throw new $(`--serve ${f}: expected <urlPath>=<file>`);const r=f.slice(0,e);if(!r.startsWith("/"))throw new $(`--serve ${f}: the URL path must start with /`);const s=f.slice(e+1);a[r]={contentType:b[t(s).toLowerCase()]??"application/octet-stream",body:E(n,s,h)}}else{const e=f.indexOf("=");if(e<=0)throw new $(`--define ${f}: expected KEY=JSON`);const t=f.slice(0,e),r=f.slice(e+1);try{JSON.parse(r)}catch{throw new $(`--define ${t}: ${JSON.stringify(r)} is not JSON (a string needs its quotes: KEY='"text"')`)}l[t]=r}}return{dir:r(o)?o:s(n,o),stylesheets:c,serve:a,define:l}}(e,n.cwd,n.compileTailwind)}catch(e){if(!(e instanceof $))throw e;return n.err(`${y}: ${e.message}\n\n${v}`),1}if("help"===i)return n.out(v),0;if("version"===i)return n.out(n.version),0;n.env.BROWSER_SHARD&&(i.shard=n.env.BROWSER_SHARD),n.env.REACT_DIR&&(i.reactDir=n.env.REACT_DIR),i.root=n.cwd;try{return await n.runLane(i)?0:1}catch(e){return n.err(`${y}: ${e instanceof Error?e.message:String(e)}`),1}}(process.argv.slice(2),{cwd:process.cwd(),env:process.env,out:e=>console.log(e),err:e=>console.error(e),version:"15.8.0",compileTailwind:e=>function(e,t){if(!o(e)||!c(e).isFile())throw new g(`--tailwind ${e}: no such file`);const r=s(t,"node_modules",".bin","tailwindcss");if(!o(r))throw new g("--tailwind needs the Tailwind CLI: add @tailwindcss/cli to this repository's devDependencies");const n=l(s(f(),"browser-check-css-"));try{const o=s(n,"styles.css");return h(r,["-i",e,"-o",o],{cwd:t,stdio:["ignore","ignore","inherit"]}),i(o,"utf8")}finally{d(n,{recursive:!0,force:!0})}}(e,process.cwd()),runLane:e=>j({...e,esbuild:m("esbuild",R),chromium:m("playwright",R).chromium})});
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as e}from"module";import{join as n}from"path";import{existsSync as t,readFileSync as i,readdirSync as r}from"fs";function o(t){return function(t,i){for(const r of[n(process.cwd(),"package.json"),i])try{return e(r)(t)}catch{}throw new Error(`${t} is not installed; add it to this repository's devDependencies`)}("typescript",t)}var s=/[.+^$()|[\]\\]/g;function a(e){let n="",t=0;for(let i=0;i<e.length;i++){const r=e[i];"*"===r?"*"===e[i+1]?"/"===e[i+2]?(n+="(?:[^/]+/)*",i+=2):(n+=".*",i+=1):n+="[^/]*":"?"===r?n+="[^/]":"{"===r?(n+="(?:",t+=1):"}"===r&&t>0?(n+=")",t-=1):n+=","===r&&t>0?"|":r.replace(s,"\\$&")}if(0!==t)throw new Error(`unbalanced { in glob "${e}"`);return new RegExp(`^${n}$`)}function g(e){const n=e.map(a);return e=>n.some(n=>n.test(e))}var c=new Set(["node_modules",".git"]),l=new Set(["dist","coverage",".next",".turbo"]);function d(e){const n=e.search(/[*?{]/),t=-1===n?e:e.slice(0,n),i=t.lastIndexOf("/");return-1===i?"":t.slice(0,i)}function h(e,t){const i=g(t),o=[...new Set(t.map(d))].sort(),s=o.filter(e=>!o.some(n=>n!==e&&(""===n||e.startsWith(`${n}/`)))),a=new Set,h=t=>{let o;try{o=r(n(e,t),{withFileTypes:!0})}catch{return}for(const e of o){const n=t?`${t}/${e.name}`:e.name;e.isDirectory()?c.has(e.name)||""===t&&l.has(e.name)||h(n):e.isFile()&&i(n)&&a.add(n)}};for(const e of s)h(e);return[...a].sort(u)}var u=(e,n)=>e<n?-1:e>n?1:0;Object.keys({fast:120,base:160}).map(e=>`--motion-${e}`).join(", "),Object.keys({body:400,control:500,heading:600,figure:700}).map(e=>`--weight-${e}`).join(", "),Object.keys({hairline:1,strong:2,accent:4}).map(e=>`--border-${e}`).join(", "),[2,4,8,12,16,20,24,32,40,48].join("/");var p=(...e)=>["origin",...e].join("-");new RegExp(["(?:transformOrigin|transform-origin)\\s*[:=]\\s*[\"'`]?\\s*(?:top left|left top|0 0|0% 0%|0px 0px)(?![\\w%-])",`(?<![\\w-])!?${p("top","left")}(?![\\w-])`,`(?<![\\w-])!?${p("\\[0_0\\]")}`].join("|"));var f=(...e)=>e.join(""),m="3xs|2xs|xs|sm|base|lg|xl|[2-9]xl";new RegExp(`(?<![\\w-])!?(?:${f("te","xt-")}(?:(?:${m})(?:\\/[\\w.()-]+)?|\\[(?:length:)?[\\d.]+(?:px|rem|em)\\])|${f("fo","nt-")}(?:thin|extralight|light|normal|medium|semibold|bold|extrabold|black|\\[\\d+\\]))(?![\\w-])`),new RegExp(`(?<![\\w-])${f("round","ed")}(?:-(?:full|sm|md|lg|xl|[23]xl|[trblse]|tl|tr|br|bl|\\([^)]*\\)|\\[[^\\]]*\\]))*(?![\\w-])`);new RegExp(`(?<![\\w-])${f("b","g-")}(?!(?:none|transparent|current|inherit|cover|contain|auto|fixed|local|scroll|center|top|bottom|left|right|repeat|no-repeat|clip|origin|blend|linear|radial|conic|gradient|position|size|image)(?![\\w]))[\\w\\[(#][^\\s'"\`]*`);var w=`${m}|left|center|right|justify|start|end|wrap|nowrap|balance|pretty|ellipsis|clip|transparent|current|inherit|shadow`;new RegExp(`(?<![\\w-])${f("te","xt-")}(?!(?:${w})(?![\\w]))(?!\\[[\\d.]+(?:px|rem|em)\\])(?!\\[length:)[\\w\\[(#][^\\s'"\`]*`),new RegExp(`(?<![\\w-])${f("p","[xs]?-")}(?:\\d|\\[|\\()`),new RegExp(`(?<![\\w-])${f("p","y-")}(?:0|px|0\\.5|\\[[0-3](?:\\.\\d+)?px\\])(?![\\w.-])`),new RegExp(`(?<![\\w-])${f("round","ed-full")}(?![\\w-])`),new RegExp(`(?<![\\w-])${f("te","xt-")}(?:xs|2xs|3xs|\\[(?:9|10|11|12)px\\])(?![\\w-])`),new RegExp(`(?<![\\w-])${f("p","y-")}`),new RegExp(`(?<![\\w-])!?(?:${f("dura","tion-")}|${f("del","ay-")})(?:\\d+|\\[[^\\]]+\\])(?![\\w-])|(?<![\\w-])!?${f("fo","nt-")}\\[\\d+\\](?![\\w-])|(?<![\\w-])!?${f("bor","der")}(?:-[xytrblse])?-\\[[\\d.]+px\\](?![\\w-])`,"g");var $={busy:{words:["Accepting","Adding","Applying","Approving","Arranging","Asking","Assigning","Booking","Building","Calculating","Cancelling","Capturing","Changing","Checking","Choosing","Closing","Combining","Comparing","Completing","Confirming","Connecting","Converting","Copying","Correcting","Counting","Creating","Deleting","Detaching","Downloading","Drawing","Duplicating","Emailing","Ending","Exporting","Fetching","Filing","Finding","Flushing","Generating","Grouping","Importing","Linking","Loading","Locating","Looking","Making","Marking","Matching","Measuring","Merging","Moving","Opening","Ordering","Paying","Pending","Posting","Preparing","Previewing","Pricing","Processing","Provisioning","Publishing","Purging","Pushing","Queued","Queuing","Quoting","Re-booking","Re-importing","Re-opening","Reading","Rebooting","Rebuilding","Receiving","Reconciling","Reconnecting","Recording","Refreshing","Refunding","Regenerating","Registering","Reinstating","Rejecting","Removing","Reopening","Requesting","Resending","Resetting","Resolving","Restarting","Restoring","Resuming","Retrying","Reversing","Reverting","Running","Saving","Searching","Sending","Setting","Settling","Sharing","Signing","Splitting","Starting","Submitting","Suggesting","Switching","Syncing","Taking","Testing","Transferring","Typing","Updating","Uploading","Verifying","Waiting","Withdrawing","Working"]}};new Set(($.busy?.words??[]).map(e=>e.toLowerCase()));var x=(...e)=>e.join("-");x("p[xytrblse]?",""),x("max","[wh]",""),x("h",""),x("w",""),x("[wh]",""),x("min","h","");var y=class extends Error{},b=new Set(["$schema","schema","include","exclude","allow"]),R=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),S=e=>"string"==typeof e&&""!==e.trim();var v="d3as2htf4hwbtr.cloudfront.net",k={dealer:{bucket:"inovit-dealer-portal-assets",hosts:["d201q0i87q901p.cloudfront.net"],key_pattern:"^marketing/"},media:{bucket:"regis-media-production",hosts:["media.regis.design","d21nnr9ivf9hcc.cloudfront.net"],key_pattern:"^[a-z0-9_]+/storefront/(?!uploads/thumbs/)"},site:{bucket:"inovit-ecommerce-media",hosts:["cdn.inovit.com","dhxlibd8r3td0.cloudfront.net"],key_pattern:"^images/"}},j=Object.values(k),C=Object.freeze([...new Set([...j.flatMap(e=>e.hosts),v,...j.map(e=>e.bucket)])].sort()),A=new RegExp([...C.map(e=>{return`(?<![\\w-])${n=e,n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w-])`;var n}),"(?<![\\w-])[a-z0-9]+\\.cloudfront\\.net(?![\\w-])","(?<![\\w-])(?:[a-z0-9-]+\\.)*s3(?:[.-][a-z0-9-]+)*\\.amazonaws\\.com(?![\\w-])","s3://"].join("|"),"gi");function E(e,n,t){const i=e.createSourceFile(n,t,e.ScriptTarget.Latest,!0,function(e,n){return n.endsWith(".tsx")?e.ScriptKind.TSX:n.endsWith(".jsx")?e.ScriptKind.JSX:/\.[cm]?js$/.test(n)?e.ScriptKind.JS:e.ScriptKind.TS}(e,n)),r=[],o=(e,n)=>{const t=i.getLineAndCharacterOfPosition(e.getStart(i)).line+1;for(const e of function(e){return[...e.matchAll(A)].map(e=>({match:e[0],index:e.index??0}))}(n)){const i=n.slice(0,e.index);r.push({line:t+(i.match(/\n/g)?.length??0),match:e.match})}},s=n=>{e.isStringLiteral(n)||e.isNoSubstitutionTemplateLiteral(n)||e.isTemplateHead(n)||e.isTemplateMiddle(n)||e.isTemplateTail(n)?o(n,n.text):e.isRegularExpressionLiteral(n)&&o(n,n.text.replace(/\\(.)/g,"$1")),e.forEachChild(n,s)};return s(i),r}var O="media-host-check.config.json",T="efficient-shell-media-host-check",P=`${T}: no code writes a media origin; files are reached through the storage backend, the API's URL, media() or imageCopyUrl() (harness API-15, SSOT-2).\n\n ${T} check this repository; exits 1 on a finding\n ${T} --json print the result as JSON\n\nRefused in any string, template or regular expression: every host and bucket in\nthe image-copies contract, any *.cloudfront.net host, any S3 endpoint, and s3://.\nReads ${O} in the current directory.`;function L(e,t,r){const o=[],s=g(r.exclude);for(const e of r.include)0===h(t,[e]).length&&o.push(`include "${e}" matches no file; delete it`);const a=h(t,r.include).filter(e=>(e=>/\.(?:[cm]?[jt]s|[jt]sx)$/.test(e)&&!e.endsWith(".d.ts"))(e)&&!s(e)),c=[];for(const r of a)for(const o of E(e,r,i(n(t,r),"utf8")))c.push({file:r,...o});const l=(e,n)=>e.toLowerCase()===n.toLowerCase();for(const e of r.allow)c.some(n=>n.file===e.file&&l(e.match,n.match))||o.push(`allow ${e.file} "${e.match}" matches nothing any more; delete it`);return{files:a.length,findings:c.filter(e=>!(e=>r.allow.some(n=>n.file===e.file&&l(n.match,e.match)))(e)),problems:o}}process.exitCode=function(e,r){let o=!1;for(const n of e){if("--help"===n||"-h"===n)return r.out(P),0;if("--version"===n||"-v"===n)return r.out(r.version),0;if("--json"!==n)return r.err(`${T}: unknown argument "${n}"\n\n${P}`),2;o=!0}const s=n(r.cwd,O);if(!t(s))return r.err(`${T}: no ${O} in ${r.cwd}. Run it from the repository root.`),2;let a;try{const e=function(e,n="media-host-check.config.json"){const t=[];if(!R(e))throw new y(`${n}: expected an object`);for(const n of Object.keys(e))b.has(n)||t.push(`unknown key "${n}"`);1!==e.schema&&t.push('"schema" must be 1');const i=(n,i)=>{const r=e[n];return void 0!==r||i?!Array.isArray(r)||!r.every(S)||i&&0===r.length?(t.push(`"${n}" must be ${i?"a non-empty":"an"} array of globs`),[]):r:[]},r=i("include",!0),o=i("exclude",!1),s=[];void 0===e.allow||Array.isArray(e.allow)||t.push('"allow" must be an array');for(const[n,i]of(Array.isArray(e.allow)?e.allow:[]).entries()){if(!(R(i)&&S(i.file)&&S(i.match)&&S(i.reason))){t.push(`allow[${n}] needs "file", "match" and "reason", each a non-empty string`);continue}const e=Object.keys(i).filter(e=>!["file","match","reason"].includes(e));e.length&&t.push(`allow[${n}] has unknown keys: ${e.join(", ")}`),s.push({file:i.file,match:i.match,reason:i.reason})}if(t.length)throw new y(`${n}:\n ${t.join("\n ")}`);return{schema:1,include:r,exclude:o,allow:s}}(JSON.parse(i(s,"utf8")),O);a=L(r.loadTypeScript(),r.cwd,e)}catch(e){return r.err(`${T}: ${e instanceof y||e instanceof SyntaxError?e.message:String(e)}`),2}const g=a.findings.length>0||a.problems.length>0;if(o)return r.out(JSON.stringify({ok:!g,...a},null,2)),g?1:0;if(!g)return r.out(`${T}: ${a.files} files, no media origin written in code (harness API-15, SSOT-2).`),0;for(const e of a.findings)r.err(`${e.file}:${e.line} "${e.match}" is a media origin written in code.`);for(const e of a.problems)r.err(`${O}: ${e}`);return a.findings.length&&r.err(`\nReach the file through the storage backend, the URL the API returns, media() or imageCopyUrl() (harness API-15, SSOT-2). An origin that must stay goes in "allow" in ${O}, with its reason.`),1}(process.argv.slice(2),{cwd:process.cwd(),out:e=>console.log(e),err:e=>console.error(e),loadTypeScript:()=>o(import.meta.url),version:"15.6.0"});
2
+ import{createRequire as e}from"module";import{join as n}from"path";import{existsSync as t,readFileSync as i,readdirSync as r}from"fs";function o(t){return function(t,i){for(const r of[n(process.cwd(),"package.json"),i])try{return e(r)(t)}catch{}throw new Error(`${t} is not installed; add it to this repository's devDependencies`)}("typescript",t)}var s=/[.+^$()|[\]\\]/g;function a(e){let n="",t=0;for(let i=0;i<e.length;i++){const r=e[i];"*"===r?"*"===e[i+1]?"/"===e[i+2]?(n+="(?:[^/]+/)*",i+=2):(n+=".*",i+=1):n+="[^/]*":"?"===r?n+="[^/]":"{"===r?(n+="(?:",t+=1):"}"===r&&t>0?(n+=")",t-=1):n+=","===r&&t>0?"|":r.replace(s,"\\$&")}if(0!==t)throw new Error(`unbalanced { in glob "${e}"`);return new RegExp(`^${n}$`)}function g(e){const n=e.map(a);return e=>n.some(n=>n.test(e))}var c=new Set(["node_modules",".git"]),l=new Set(["dist","coverage",".next",".turbo"]);function d(e){const n=e.search(/[*?{]/),t=-1===n?e:e.slice(0,n),i=t.lastIndexOf("/");return-1===i?"":t.slice(0,i)}function h(e,t){const i=g(t),o=[...new Set(t.map(d))].sort(),s=o.filter(e=>!o.some(n=>n!==e&&(""===n||e.startsWith(`${n}/`)))),a=new Set,h=t=>{let o;try{o=r(n(e,t),{withFileTypes:!0})}catch{return}for(const e of o){const n=t?`${t}/${e.name}`:e.name;e.isDirectory()?c.has(e.name)||""===t&&l.has(e.name)||h(n):e.isFile()&&i(n)&&a.add(n)}};for(const e of s)h(e);return[...a].sort(u)}var u=(e,n)=>e<n?-1:e>n?1:0;Object.keys({fast:120,base:160}).map(e=>`--motion-${e}`).join(", "),Object.keys({body:400,control:500,heading:600,figure:700}).map(e=>`--weight-${e}`).join(", "),Object.keys({hairline:1,strong:2,accent:4}).map(e=>`--border-${e}`).join(", "),[2,4,8,12,16,20,24,32,40,48].join("/");var p=(...e)=>["origin",...e].join("-");new RegExp(["(?:transformOrigin|transform-origin)\\s*[:=]\\s*[\"'`]?\\s*(?:top left|left top|0 0|0% 0%|0px 0px)(?![\\w%-])",`(?<![\\w-])!?${p("top","left")}(?![\\w-])`,`(?<![\\w-])!?${p("\\[0_0\\]")}`].join("|"));var f=(...e)=>e.join(""),m="3xs|2xs|xs|sm|base|lg|xl|[2-9]xl";new RegExp(`(?<![\\w-])!?(?:${f("te","xt-")}(?:(?:${m})(?:\\/[\\w.()-]+)?|\\[(?:length:)?[\\d.]+(?:px|rem|em)\\])|${f("fo","nt-")}(?:thin|extralight|light|normal|medium|semibold|bold|extrabold|black|\\[\\d+\\]))(?![\\w-])`),new RegExp(`(?<![\\w-])${f("round","ed")}(?:-(?:full|sm|md|lg|xl|[23]xl|[trblse]|tl|tr|br|bl|\\([^)]*\\)|\\[[^\\]]*\\]))*(?![\\w-])`);new RegExp(`(?<![\\w-])${f("b","g-")}(?!(?:none|transparent|current|inherit|cover|contain|auto|fixed|local|scroll|center|top|bottom|left|right|repeat|no-repeat|clip|origin|blend|linear|radial|conic|gradient|position|size|image)(?![\\w]))[\\w\\[(#][^\\s'"\`]*`);var w=`${m}|left|center|right|justify|start|end|wrap|nowrap|balance|pretty|ellipsis|clip|transparent|current|inherit|shadow`;new RegExp(`(?<![\\w-])${f("te","xt-")}(?!(?:${w})(?![\\w]))(?!\\[[\\d.]+(?:px|rem|em)\\])(?!\\[length:)[\\w\\[(#][^\\s'"\`]*`),new RegExp(`(?<![\\w-])${f("p","[xs]?-")}(?:\\d|\\[|\\()`),new RegExp(`(?<![\\w-])${f("p","y-")}(?:0|px|0\\.5|\\[[0-3](?:\\.\\d+)?px\\])(?![\\w.-])`),new RegExp(`(?<![\\w-])${f("round","ed-full")}(?![\\w-])`),new RegExp(`(?<![\\w-])${f("te","xt-")}(?:xs|2xs|3xs|\\[(?:9|10|11|12)px\\])(?![\\w-])`),new RegExp(`(?<![\\w-])${f("p","y-")}`),new RegExp(`(?<![\\w-])!?(?:${f("dura","tion-")}|${f("del","ay-")})(?:\\d+|\\[[^\\]]+\\])(?![\\w-])|(?<![\\w-])!?${f("fo","nt-")}\\[\\d+\\](?![\\w-])|(?<![\\w-])!?${f("bor","der")}(?:-[xytrblse])?-\\[[\\d.]+px\\](?![\\w-])`,"g");var $={busy:{words:["Accepting","Adding","Applying","Approving","Arranging","Asking","Assigning","Booking","Building","Calculating","Cancelling","Capturing","Changing","Checking","Choosing","Closing","Combining","Comparing","Completing","Confirming","Connecting","Converting","Copying","Correcting","Counting","Creating","Deleting","Detaching","Downloading","Drawing","Duplicating","Emailing","Ending","Exporting","Fetching","Filing","Finding","Flushing","Generating","Grouping","Importing","Linking","Loading","Locating","Looking","Making","Marking","Matching","Measuring","Merging","Moving","Opening","Ordering","Paying","Pending","Posting","Preparing","Previewing","Pricing","Processing","Provisioning","Publishing","Purging","Pushing","Queued","Queuing","Quoting","Re-booking","Re-importing","Re-opening","Reading","Rebooting","Rebuilding","Receiving","Reconciling","Reconnecting","Recording","Refreshing","Refunding","Regenerating","Registering","Reinstating","Rejecting","Removing","Reopening","Requesting","Resending","Resetting","Resolving","Restarting","Restoring","Resuming","Retrying","Reversing","Reverting","Running","Saving","Searching","Sending","Setting","Settling","Sharing","Signing","Splitting","Starting","Submitting","Suggesting","Switching","Syncing","Taking","Testing","Transferring","Typing","Updating","Uploading","Verifying","Waiting","Withdrawing","Working"]}};new Set(($.busy?.words??[]).map(e=>e.toLowerCase()));var x=(...e)=>e.join("-");x("p[xytrblse]?",""),x("max","[wh]",""),x("h",""),x("w",""),x("[wh]",""),x("min","h","");var y=class extends Error{},b=new Set(["$schema","schema","include","exclude","allow"]),R=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),S=e=>"string"==typeof e&&""!==e.trim();var v="d3as2htf4hwbtr.cloudfront.net",k={dealer:{bucket:"inovit-dealer-portal-assets",hosts:["d201q0i87q901p.cloudfront.net"],key_pattern:"^marketing/"},media:{bucket:"regis-media-production",hosts:["media.regis.design","d21nnr9ivf9hcc.cloudfront.net"],key_pattern:"^[a-z0-9_]+/storefront/(?!uploads/thumbs/)"},site:{bucket:"inovit-ecommerce-media",hosts:["cdn.inovit.com","dhxlibd8r3td0.cloudfront.net"],key_pattern:"^images/"}},j=Object.values(k),C=Object.freeze([...new Set([...j.flatMap(e=>e.hosts),v,...j.map(e=>e.bucket)])].sort()),A=new RegExp([...C.map(e=>{return`(?<![\\w-])${n=e,n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w-])`;var n}),"(?<![\\w-])[a-z0-9]+\\.cloudfront\\.net(?![\\w-])","(?<![\\w-])(?:[a-z0-9-]+\\.)*s3(?:[.-][a-z0-9-]+)*\\.amazonaws\\.com(?![\\w-])","s3://"].join("|"),"gi");function E(e,n,t){const i=e.createSourceFile(n,t,e.ScriptTarget.Latest,!0,function(e,n){return n.endsWith(".tsx")?e.ScriptKind.TSX:n.endsWith(".jsx")?e.ScriptKind.JSX:/\.[cm]?js$/.test(n)?e.ScriptKind.JS:e.ScriptKind.TS}(e,n)),r=[],o=(e,n)=>{const t=i.getLineAndCharacterOfPosition(e.getStart(i)).line+1;for(const e of function(e){return[...e.matchAll(A)].map(e=>({match:e[0],index:e.index??0}))}(n)){const i=n.slice(0,e.index);r.push({line:t+(i.match(/\n/g)?.length??0),match:e.match})}},s=n=>{e.isStringLiteral(n)||e.isNoSubstitutionTemplateLiteral(n)||e.isTemplateHead(n)||e.isTemplateMiddle(n)||e.isTemplateTail(n)?o(n,n.text):e.isRegularExpressionLiteral(n)&&o(n,n.text.replace(/\\(.)/g,"$1")),e.forEachChild(n,s)};return s(i),r}var O="media-host-check.config.json",T="efficient-shell-media-host-check",P=`${T}: no code writes a media origin; files are reached through the storage backend, the API's URL, media() or imageCopyUrl() (harness API-15, SSOT-2).\n\n ${T} check this repository; exits 1 on a finding\n ${T} --json print the result as JSON\n\nRefused in any string, template or regular expression: every host and bucket in\nthe image-copies contract, any *.cloudfront.net host, any S3 endpoint, and s3://.\nReads ${O} in the current directory.`;function L(e,t,r){const o=[],s=g(r.exclude);for(const e of r.include)0===h(t,[e]).length&&o.push(`include "${e}" matches no file; delete it`);const a=h(t,r.include).filter(e=>(e=>/\.(?:[cm]?[jt]s|[jt]sx)$/.test(e)&&!e.endsWith(".d.ts"))(e)&&!s(e)),c=[];for(const r of a)for(const o of E(e,r,i(n(t,r),"utf8")))c.push({file:r,...o});const l=(e,n)=>e.toLowerCase()===n.toLowerCase();for(const e of r.allow)c.some(n=>n.file===e.file&&l(e.match,n.match))||o.push(`allow ${e.file} "${e.match}" matches nothing any more; delete it`);return{files:a.length,findings:c.filter(e=>!(e=>r.allow.some(n=>n.file===e.file&&l(n.match,e.match)))(e)),problems:o}}process.exitCode=function(e,r){let o=!1;for(const n of e){if("--help"===n||"-h"===n)return r.out(P),0;if("--version"===n||"-v"===n)return r.out(r.version),0;if("--json"!==n)return r.err(`${T}: unknown argument "${n}"\n\n${P}`),2;o=!0}const s=n(r.cwd,O);if(!t(s))return r.err(`${T}: no ${O} in ${r.cwd}. Run it from the repository root.`),2;let a;try{const e=function(e,n="media-host-check.config.json"){const t=[];if(!R(e))throw new y(`${n}: expected an object`);for(const n of Object.keys(e))b.has(n)||t.push(`unknown key "${n}"`);1!==e.schema&&t.push('"schema" must be 1');const i=(n,i)=>{const r=e[n];return void 0!==r||i?!Array.isArray(r)||!r.every(S)||i&&0===r.length?(t.push(`"${n}" must be ${i?"a non-empty":"an"} array of globs`),[]):r:[]},r=i("include",!0),o=i("exclude",!1),s=[];void 0===e.allow||Array.isArray(e.allow)||t.push('"allow" must be an array');for(const[n,i]of(Array.isArray(e.allow)?e.allow:[]).entries()){if(!(R(i)&&S(i.file)&&S(i.match)&&S(i.reason))){t.push(`allow[${n}] needs "file", "match" and "reason", each a non-empty string`);continue}const e=Object.keys(i).filter(e=>!["file","match","reason"].includes(e));e.length&&t.push(`allow[${n}] has unknown keys: ${e.join(", ")}`),s.push({file:i.file,match:i.match,reason:i.reason})}if(t.length)throw new y(`${n}:\n ${t.join("\n ")}`);return{schema:1,include:r,exclude:o,allow:s}}(JSON.parse(i(s,"utf8")),O);a=L(r.loadTypeScript(),r.cwd,e)}catch(e){return r.err(`${T}: ${e instanceof y||e instanceof SyntaxError?e.message:String(e)}`),2}const g=a.findings.length>0||a.problems.length>0;if(o)return r.out(JSON.stringify({ok:!g,...a},null,2)),g?1:0;if(!g)return r.out(`${T}: ${a.files} files, no media origin written in code (harness API-15, SSOT-2).`),0;for(const e of a.findings)r.err(`${e.file}:${e.line} "${e.match}" is a media origin written in code.`);for(const e of a.problems)r.err(`${O}: ${e}`);return a.findings.length&&r.err(`\nReach the file through the storage backend, the URL the API returns, media() or imageCopyUrl() (harness API-15, SSOT-2). An origin that must stay goes in "allow" in ${O}, with its reason.`),1}(process.argv.slice(2),{cwd:process.cwd(),out:e=>console.log(e),err:e=>console.error(e),loadTypeScript:()=>o(import.meta.url),version:"15.8.0"});