efficient-shell 7.44.0 → 7.46.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 (64) hide show
  1. package/README.md +119 -1
  2. package/dist/{Browser-IVD5YDBF.js → Browser-VNDS2FSD.js} +14 -14
  3. package/dist/Calculator-YGJ7I5VT.js +29 -0
  4. package/dist/ConfirmDialog-OJLZG4QL.js +1 -0
  5. package/dist/{CurrencyConverter-QIH4GI3K.js → CurrencyConverter-PH75TBDL.js} +7 -7
  6. package/dist/{Documents-NGCQIUL2.js → Documents-KSO66MP3.js} +14 -14
  7. package/dist/Files-TGXFG2JF.js +87 -0
  8. package/dist/{Notepad-AVIOMS3W.js → Notepad-OUMZHB2S.js} +7 -7
  9. package/dist/PdfViewer-D4GRPG4G.js +1 -0
  10. package/dist/{PomodoroTimer-LMLEPMFD.js → PomodoroTimer-BUKDNFPJ.js} +63 -63
  11. package/dist/{Preview-7TEXWSNF.js → Preview-SGYKP5VY.js} +31 -31
  12. package/dist/Sidebar-A3UG662D.js +44 -0
  13. package/dist/{Spreadsheet-KNAAJ4CE.js → Spreadsheet-OVBIGF7S.js} +14 -14
  14. package/dist/{Stock-VUGVYNNI.js → Stock-FB5VIBVY.js} +3 -3
  15. package/dist/{Weather-TAJQCYIV.js → Weather-2MOP5LTK.js} +15 -15
  16. package/dist/{WorldClock-ZQ2VI2NB.js → WorldClock-KMMKBE4B.js} +6 -6
  17. package/dist/ai/index.d.ts +271 -0
  18. package/dist/ai/index.js +37 -0
  19. package/dist/ai.css +2 -0
  20. package/dist/apps/index.js +1 -1
  21. package/dist/bin/ui-check.js +1 -1
  22. package/dist/brand.css +1 -1
  23. package/dist/{chunk-TFYZB4NY.js → chunk-3RKM5ZGV.js} +2 -2
  24. package/dist/{chunk-YRLOXHKG.js → chunk-3ZZ2UPNR.js} +1 -1
  25. package/dist/{chunk-DENNF2LM.js → chunk-4FQTMGCA.js} +2 -2
  26. package/dist/{chunk-M2AM6DAA.js → chunk-4QW4I2XQ.js} +1 -1
  27. package/dist/{chunk-ZN6W2KOC.js → chunk-BFJRKFOH.js} +11 -11
  28. package/dist/{chunk-7RI5F5VX.js → chunk-BMYURA2N.js} +1 -1
  29. package/dist/chunk-CLYMUTNF.js +27 -0
  30. package/dist/{chunk-OMOQC57R.js → chunk-EZTEOTUD.js} +94 -94
  31. package/dist/{chunk-6K5EFHDQ.js → chunk-FGPEAC7B.js} +7 -7
  32. package/dist/{chunk-52ZDIQFP.js → chunk-G32MW4IF.js} +1 -1
  33. package/dist/{chunk-BY3KWWWU.js → chunk-GFWRYNPX.js} +18 -18
  34. package/dist/{chunk-JK4PTQFV.js → chunk-JFZLYYAN.js} +1 -1
  35. package/dist/{chunk-QDCMVFK5.js → chunk-JGWOY2KV.js} +5 -5
  36. package/dist/chunk-KRAJDKZC.js +1 -0
  37. package/dist/{chunk-UNA3BQJI.js → chunk-MMLU5ZHI.js} +9 -9
  38. package/dist/{chunk-G5S7NQ7B.js → chunk-RNPURBKT.js} +3 -3
  39. package/dist/chunk-RWNNFCSA.js +1 -0
  40. package/dist/chunk-UBXRSOQ6.js +47 -0
  41. package/dist/{chunk-YD4DPX4H.js → chunk-VJ6KJYRS.js} +1 -1
  42. package/dist/chunk-XGOXX466.js +1020 -0
  43. package/dist/{chunk-3G5TA3IF.js → chunk-YT4B3NSV.js} +4 -3
  44. package/dist/{chunk-22EP5XS2.js → chunk-YWJD6RUT.js} +1 -1
  45. package/dist/icons/index.js +1 -1
  46. package/dist/{index-p7sSFfAC.d.ts → index-BI54lOAz.d.ts} +95 -3
  47. package/dist/index.d.ts +2 -2
  48. package/dist/index.js +269 -269
  49. package/dist/map/index.js +2 -2
  50. package/dist/markdown/index.js +1 -1
  51. package/dist/page-tabs/index.js +5 -5
  52. package/dist/pdf/index.js +1 -1
  53. package/dist/telemetry/index.js +1 -1
  54. package/dist/ui/index.d.ts +1 -1
  55. package/dist/ui/index.js +1 -1
  56. package/package.json +21 -4
  57. package/dist/Calculator-Q3TNKTCG.js +0 -29
  58. package/dist/ConfirmDialog-QT4KJAP7.js +0 -1
  59. package/dist/Files-6NUBFLQ7.js +0 -87
  60. package/dist/PdfViewer-LGD633HY.js +0 -1
  61. package/dist/Sidebar-HT7BIMTD.js +0 -44
  62. package/dist/chunk-7D6TZW44.js +0 -27
  63. package/dist/chunk-HVJZPYA5.js +0 -1047
  64. package/dist/chunk-TVSNBASY.js +0 -1
@@ -1,19 +1,19 @@
1
- import{EditableGrid as e}from"./chunk-ZELMENOO.js";import"./chunk-BR22X7E5.js";import"./chunk-AHN2BTZR.js";import{AboutApp as t}from"./chunk-G5S7NQ7B.js";import{peekSpreadsheetPreviewStage as r,claimSpreadsheetPreviewStage as n,SPREADSHEET_PREVIEW_UPDATE_EVENT as o}from"./chunk-VTVSMRFX.js";import"./chunk-TVSNBASY.js";import{WindowTitle as a}from"./chunk-OMOQC57R.js";import"./chunk-YD4DPX4H.js";import"./chunk-QDCMVFK5.js";import"./chunk-KNUR2UEG.js";import"./chunk-BY3KWWWU.js";import"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import"./chunk-UNA3BQJI.js";import"./chunk-UVBK6YSR.js";import"./chunk-G5GERM76.js";import"./chunk-3E27HV76.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-K7PQXJO7.js";import"./chunk-D65T4H6J.js";import"./chunk-3G5TA3IF.js";import"./chunk-LVCRH3K6.js";import"./chunk-C3QOHMR6.js";import"./chunk-2J6F4EE7.js";import{useRef as l,useState as s,useEffect as c,useCallback as i}from"react";import{jsxs as u,jsx as d,Fragment as h}from"react/jsx-runtime";var m="ABCDEFGHIJKLMNOPQRSTUVWXYZ",p=10,x=30;function g(e){return e<26?m[e]:m[Math.floor(e/26)-1]+m[e%26]}function y(e){return Array.from({length:e},(e,t)=>({key:`col_${t}`,title:g(t),width:100}))}function b(e,t){return Array.from({length:e},()=>Array(t).fill(""))}function f(e){return{id:crypto.randomUUID(),name:e,columns:y(p),data:b(x,p),cellStyles:{}}}function v(e){return e.split("\n").map(e=>{if(e.includes("\t"))return e.split("\t").map(e=>e.trim());const t=[];let r="",n=!1;for(const o of e)'"'!==o?","!==o||n?r+=o:(t.push(r.trim()),r=""):n=!n;return t.push(r.trim()),t}).filter(e=>e.some(e=>e.trim()))}function k(e,t){const r=v(e);if(0===r.length)return null;const n=Math.max(p,r.reduce((e,t)=>Math.max(e,t.length),0)),o=r.map(e=>{for(;e.length<n;)e.push("");return e});for(;o.length<x;)o.push(Array(n).fill(""));return{id:crypto.randomUUID(),name:t,columns:y(n),data:o,cellStyles:{}}}function w(){const m=l(null),g=l(void 0);void 0===g.current&&(g.current=r());const w=l(g.current?.data??null),N=(()=>{const e=g.current;if(!e)return null;const t=k(e.data.csv,"Sheet 1");if(!t)return null;return{sheet:t,title:e.data.filename.replace(/\.(csv|tsv|txt)$/i,"")}})(),[C,S]=s(N?[N.sheet]:[f("Sheet 1")]),[j,E]=s(0),M=l([]),U=l(C),$=l(!1);c(()=>{$.current?$.current=!1:U.current!==C&&(M.current.push(U.current),M.current.length>50&&M.current.shift()),U.current=C},[C]);const A=i(()=>{const e=M.current.pop();e&&($.current=!0,S(e))},[]);c(()=>{const e=e=>{if(!m.current?.contains(document.activeElement)&&!m.current?.matches(":focus-within"))return;(e.ctrlKey||e.metaKey)&&!e.shiftKey&&("z"===e.key||"Z"===e.key)&&(e.preventDefault(),A())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[A]);const[D,R]=s(N?.title??"Untitled"),[B,L]=s(()=>g.current?.data.onEmail),F=i(e=>{const t=k(e.csv,"Sheet 1");t&&(S([t]),E(0),R(e.filename.replace(/\.(csv|tsv|txt)$/i,"")),L(()=>e.onEmail))},[]);c(()=>{const e=g.current;null!=e&&(n(e),e.data!==w.current&&F(e.data))},[]),c(()=>{const e=g.current?.token;if(null==e)return;const t=t=>{const r=t.detail;r&&r.token===e&&F(r.data)};return window.addEventListener(o,t),()=>window.removeEventListener(o,t)},[]);const[K,I]=s(!1),[O,H]=s(null),[Q,V]=s(""),X=l(null),[G,T]=s("1"),[W,J]=s("10"),Y=C[j]||C[0],z=Y.data,P=Y.columns,Z=Y.cellStyles??{},[_,q]=s(null),[ee,te]=s(null),re=i(()=>{if(ee){const e=Math.min(ee.anchor.row,ee.end.row),t=Math.max(ee.anchor.row,ee.end.row),r=Math.min(ee.anchor.col,ee.end.col),n=Math.max(ee.anchor.col,ee.end.col),o=[];for(let a=e;a<=t;a++)for(let e=r;e<=n;e++)o.push({row:a,col:e});return o}return _?[_]:[]},[ee,_]),ne=i((e,t)=>{const r=re();0!==r.length&&S(n=>n.map((n,o)=>{if(o!==j)return n;const a={...n.cellStyles??{}},l=`${r[0].row}:${r[0].col}`,s=void 0!==t?t:!(a[l]??{})[e];for(const{row:t,col:n}of r){const r=`${t}:${n}`;a[r]={...a[r]??{},[e]:s}}return{...n,cellStyles:a}}))},[re,j]),oe=ee?{row:ee.anchor.row,col:ee.anchor.col}:_,ae=oe?Z[`${oe.row}:${oe.col}`]??{}:{},le=!!oe,se=i(e=>{S(t=>t.map((t,r)=>r===j?{...t,...e}:t))},[j]),ce=i(e=>{const t=e.reduce((e,t)=>Math.max(e,t.length),0);t!==P.length?se({data:e,columns:y(t)}):se({data:e})},[se,P.length]),ie=(e,t)=>{S(r=>r.map((r,n)=>n===e?{...r,name:t}:r)),H(null)},ue=()=>z.filter(e=>e.some(e=>e.trim())).map(e=>e.map(e=>e.includes(",")||e.includes('"')||e.includes("\n")?`"${e.replace(/"/g,'""')}"`:e).join(",")).join("\n"),de=[];z.forEach(e=>e.forEach(e=>{const t=parseFloat(e);!isNaN(t)&&e.trim()&&de.push(t)}));const he=z.reduce((e,t)=>e+t.filter(e=>e.trim()).length,0);/* @__PURE__ */
1
+ import{EditableGrid as e}from"./chunk-ZELMENOO.js";import"./chunk-BR22X7E5.js";import"./chunk-AHN2BTZR.js";import{AboutApp as t}from"./chunk-RNPURBKT.js";import{peekSpreadsheetPreviewStage as r,claimSpreadsheetPreviewStage as n,SPREADSHEET_PREVIEW_UPDATE_EVENT as o}from"./chunk-VTVSMRFX.js";import{WindowTitle as a}from"./chunk-EZTEOTUD.js";import"./chunk-VJ6KJYRS.js";import"./chunk-JGWOY2KV.js";import"./chunk-KRAJDKZC.js";import"./chunk-KNUR2UEG.js";import"./chunk-GFWRYNPX.js";import"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import"./chunk-MMLU5ZHI.js";import"./chunk-UVBK6YSR.js";import"./chunk-G5GERM76.js";import"./chunk-3E27HV76.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-K7PQXJO7.js";import"./chunk-D65T4H6J.js";import"./chunk-YT4B3NSV.js";import"./chunk-LVCRH3K6.js";import"./chunk-C3QOHMR6.js";import"./chunk-2J6F4EE7.js";import{useRef as l,useState as s,useEffect as c,useCallback as i}from"react";import{jsxs as u,jsx as d,Fragment as h}from"react/jsx-runtime";var m="ABCDEFGHIJKLMNOPQRSTUVWXYZ",p=10,x=30;function g(e){return e<26?m[e]:m[Math.floor(e/26)-1]+m[e%26]}function y(e){return Array.from({length:e},(e,t)=>({key:`col_${t}`,title:g(t),width:100}))}function b(e,t){return Array.from({length:e},()=>Array(t).fill(""))}function f(e){return{id:crypto.randomUUID(),name:e,columns:y(p),data:b(x,p),cellStyles:{}}}function v(e){return e.split("\n").map(e=>{if(e.includes("\t"))return e.split("\t").map(e=>e.trim());const t=[];let r="",n=!1;for(const o of e)'"'!==o?","!==o||n?r+=o:(t.push(r.trim()),r=""):n=!n;return t.push(r.trim()),t}).filter(e=>e.some(e=>e.trim()))}function k(e,t){const r=v(e);if(0===r.length)return null;const n=Math.max(p,r.reduce((e,t)=>Math.max(e,t.length),0)),o=r.map(e=>{for(;e.length<n;)e.push("");return e});for(;o.length<x;)o.push(Array(n).fill(""));return{id:crypto.randomUUID(),name:t,columns:y(n),data:o,cellStyles:{}}}function w(){const m=l(null),g=l(void 0);void 0===g.current&&(g.current=r());const w=l(g.current?.data??null),N=(()=>{const e=g.current;if(!e)return null;const t=k(e.data.csv,"Sheet 1");if(!t)return null;return{sheet:t,title:e.data.filename.replace(/\.(csv|tsv|txt)$/i,"")}})(),[C,j]=s(N?[N.sheet]:[f("Sheet 1")]),[S,E]=s(0),M=l([]),U=l(C),R=l(!1);c(()=>{R.current?R.current=!1:U.current!==C&&(M.current.push(U.current),M.current.length>50&&M.current.shift()),U.current=C},[C]);const $=i(()=>{const e=M.current.pop();e&&(R.current=!0,j(e))},[]);c(()=>{const e=e=>{if(!m.current?.contains(document.activeElement)&&!m.current?.matches(":focus-within"))return;(e.ctrlKey||e.metaKey)&&!e.shiftKey&&("z"===e.key||"Z"===e.key)&&(e.preventDefault(),$())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[$]);const[A,D]=s(N?.title??"Untitled"),[L,K]=s(()=>g.current?.data.onEmail),B=i(e=>{const t=k(e.csv,"Sheet 1");t&&(j([t]),E(0),D(e.filename.replace(/\.(csv|tsv|txt)$/i,"")),K(()=>e.onEmail))},[]);c(()=>{const e=g.current;null!=e&&(n(e),e.data!==w.current&&B(e.data))},[]),c(()=>{const e=g.current?.token;if(null==e)return;const t=t=>{const r=t.detail;r&&r.token===e&&B(r.data)};return window.addEventListener(o,t),()=>window.removeEventListener(o,t)},[]);const[F,O]=s(!1),[I,V]=s(null),[H,T]=s(""),J=l(null),[X,G]=s("1"),[Z,Y]=s("10"),P=C[S]||C[0],Q=P.data,W=P.columns,z=P.cellStyles??{},[_,q]=s(null),[ee,te]=s(null),re=i(()=>{if(ee){const e=Math.min(ee.anchor.row,ee.end.row),t=Math.max(ee.anchor.row,ee.end.row),r=Math.min(ee.anchor.col,ee.end.col),n=Math.max(ee.anchor.col,ee.end.col),o=[];for(let a=e;a<=t;a++)for(let e=r;e<=n;e++)o.push({row:a,col:e});return o}return _?[_]:[]},[ee,_]),ne=i((e,t)=>{const r=re();0!==r.length&&j(n=>n.map((n,o)=>{if(o!==S)return n;const a={...n.cellStyles??{}},l=`${r[0].row}:${r[0].col}`,s=void 0!==t?t:!(a[l]??{})[e];for(const{row:t,col:n}of r){const r=`${t}:${n}`;a[r]={...a[r]??{},[e]:s}}return{...n,cellStyles:a}}))},[re,S]),oe=ee?{row:ee.anchor.row,col:ee.anchor.col}:_,ae=oe?z[`${oe.row}:${oe.col}`]??{}:{},le=!!oe,se=i(e=>{j(t=>t.map((t,r)=>r===S?{...t,...e}:t))},[S]),ce=i(e=>{const t=e.reduce((e,t)=>Math.max(e,t.length),0);t!==W.length?se({data:e,columns:y(t)}):se({data:e})},[se,W.length]),ie=(e,t)=>{j(r=>r.map((r,n)=>n===e?{...r,name:t}:r)),V(null)},ue=()=>Q.filter(e=>e.some(e=>e.trim())).map(e=>e.map(e=>e.includes(",")||e.includes('"')||e.includes("\n")?`"${e.replace(/"/g,'""')}"`:e).join(",")).join("\n"),de=[];Q.forEach(e=>e.forEach(e=>{const t=parseFloat(e);!isNaN(t)&&e.trim()&&de.push(t)}));const he=Q.reduce((e,t)=>e+t.filter(e=>e.trim()).length,0);/* @__PURE__ */
2
2
  return u("div",{ref:m,className:"flex flex-col h-full",children:[
3
- /* @__PURE__ */d(a,{title:`${me=D||"Untitled",me.length>24?`${me.slice(0,23)}…`:me} - Spreadsheets`}),
3
+ /* @__PURE__ */d(a,{title:`${me=A||"Untitled",me.length>24?`${me.slice(0,23)}…`:me} - Spreadsheets`}),
4
4
  /* @__PURE__ */d(t,{app:"spreadsheet"}),
5
- /* @__PURE__ */u("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[K?/* @__PURE__ */d("input",{type:"text",value:D,onChange:e=>R(e.target.value),onBlur:()=>I(!1),onKeyDown:e=>{"Enter"===e.key&&I(!1)},autoFocus:!0,className:"text-sm font-medium text-gray-900 border border-gray-300 rounded px-2 py-0.5 w-40 focus:border-blue-500 focus:ring-blue-500"}):/* @__PURE__ */d("button",{onClick:()=>I(!0),className:"text-sm font-medium text-gray-900 hover:text-blue-600 truncate max-w-[200px]",title:"Click to rename",children:D||"Untitled"}),
5
+ /* @__PURE__ */u("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[F?/* @__PURE__ */d("input",{type:"text",value:A,onChange:e=>D(e.target.value),onBlur:()=>O(!1),onKeyDown:e=>{"Enter"===e.key&&O(!1)},autoFocus:!0,className:"text-sm font-medium text-gray-900 border border-gray-300 rounded px-2 py-0.5 w-40 focus:border-blue-500 focus:ring-blue-500"}):/* @__PURE__ */d("button",{onClick:()=>O(!0),className:"text-sm font-medium text-gray-900 hover:text-blue-600 truncate max-w-[200px]",title:"Click to rename",children:A||"Untitled"}),
6
6
  /* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300"}),
7
- /* @__PURE__ */d("input",{ref:X,type:"file",accept:".csv,.tsv,.txt,.xlsx,.xls,.ods",onChange:async e=>{const t=e.target.files?.[0];if(!t)return;const r=t.name.replace(/\.(csv|tsv|txt|xlsx|xls|ods)$/i,"");if(/\.(xlsx|xls|ods)$/i.test(t.name)){const e=new Uint8Array(await t.arrayBuffer()),n=await(import("xlsx")),o=n.read(e,{type:"array"}),a=o.SheetNames.map(e=>{const t=n.utils.sheet_to_json(o.Sheets[e],{header:1,defval:""}),r=Math.max(p,t.reduce((e,t)=>Math.max(e,t.length),0)),a=t.map(e=>{const t=e.map(e=>String(e??""));for(;t.length<r;)t.push("");return t});for(;a.length<x;)a.push(Array(r).fill(""));return{id:crypto.randomUUID(),name:e,columns:y(r),data:a}});S(a),E(0),R(r)}else{const e=v(await t.text());if(0===e.length)return;const n=Math.max(p,e.reduce((e,t)=>Math.max(e,t.length),0)),o=e.map(e=>{for(;e.length<n;)e.push("");return e});for(;o.length<x;)o.push(Array(n).fill(""));se({columns:y(n),data:o}),R(r)}X.current&&(X.current.value="")},className:"hidden"}),
8
- /* @__PURE__ */d("button",{onClick:()=>X.current?.click(),className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Open"}),
9
- /* @__PURE__ */d("button",{onClick:()=>{const e=new Blob([ue()],{type:"text/csv"}),t=URL.createObjectURL(e),r=document.createElement("a");r.href=t,r.download=`${D||"spreadsheet"}.csv`,r.click(),URL.revokeObjectURL(t)},className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Save CSV"}),B&&/* @__PURE__ */d("button",{onClick:()=>B(ue(),`${D||"spreadsheet"}.csv`),className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Email"}),
7
+ /* @__PURE__ */d("input",{ref:J,type:"file",accept:".csv,.tsv,.txt,.xlsx,.xls,.ods",onChange:async e=>{const t=e.target.files?.[0];if(!t)return;const r=t.name.replace(/\.(csv|tsv|txt|xlsx|xls|ods)$/i,"");if(/\.(xlsx|xls|ods)$/i.test(t.name)){const e=new Uint8Array(await t.arrayBuffer()),n=await(import("xlsx")),o=n.read(e,{type:"array"}),a=o.SheetNames.map(e=>{const t=n.utils.sheet_to_json(o.Sheets[e],{header:1,defval:""}),r=Math.max(p,t.reduce((e,t)=>Math.max(e,t.length),0)),a=t.map(e=>{const t=e.map(e=>String(e??""));for(;t.length<r;)t.push("");return t});for(;a.length<x;)a.push(Array(r).fill(""));return{id:crypto.randomUUID(),name:e,columns:y(r),data:a}});j(a),E(0),D(r)}else{const e=v(await t.text());if(0===e.length)return;const n=Math.max(p,e.reduce((e,t)=>Math.max(e,t.length),0)),o=e.map(e=>{for(;e.length<n;)e.push("");return e});for(;o.length<x;)o.push(Array(n).fill(""));se({columns:y(n),data:o}),D(r)}J.current&&(J.current.value="")},className:"hidden"}),
8
+ /* @__PURE__ */d("button",{onClick:()=>J.current?.click(),className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Open"}),
9
+ /* @__PURE__ */d("button",{onClick:()=>{const e=new Blob([ue()],{type:"text/csv"}),t=URL.createObjectURL(e),r=document.createElement("a");r.href=t,r.download=`${A||"spreadsheet"}.csv`,r.click(),URL.revokeObjectURL(t)},className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Save CSV"}),L&&/* @__PURE__ */d("button",{onClick:()=>L(ue(),`${A||"spreadsheet"}.csv`),className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Email"}),
10
10
  /* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300"}),
11
11
  /* @__PURE__ */u("div",{className:"flex items-center gap-1",children:[
12
- /* @__PURE__ */d("input",{type:"number",min:"1",max:"50",value:G,onChange:e=>T(e.target.value),className:"w-10 text-xs text-center border border-gray-300 rounded px-1 py-0.5 focus:border-blue-500 focus:ring-blue-500"}),
13
- /* @__PURE__ */d("button",{onClick:()=>(e=>{const t=P.length+e;se({columns:y(t),data:z.map(t=>[...t,...Array(e).fill("")])})})(parseInt(G)||1),className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"+ Col"})]}),
12
+ /* @__PURE__ */d("input",{type:"number",min:"1",max:"50",value:X,onChange:e=>G(e.target.value),className:"w-10 text-xs text-center border border-gray-300 rounded px-1 py-0.5 focus:border-blue-500 focus:ring-blue-500"}),
13
+ /* @__PURE__ */d("button",{onClick:()=>(e=>{const t=W.length+e;se({columns:y(t),data:Q.map(t=>[...t,...Array(e).fill("")])})})(parseInt(X)||1),className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"+ Col"})]}),
14
14
  /* @__PURE__ */u("div",{className:"flex items-center gap-1",children:[
15
- /* @__PURE__ */d("input",{type:"number",min:"1",max:"500",value:W,onChange:e=>J(e.target.value),className:"w-10 text-xs text-center border border-gray-300 rounded px-1 py-0.5 focus:border-blue-500 focus:ring-blue-500"}),
16
- /* @__PURE__ */d("button",{onClick:()=>{return e=parseInt(W)||10,void se({data:[...z,...Array.from({length:e},()=>Array(P.length).fill(""))]});var e},className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"+ Row"})]}),
15
+ /* @__PURE__ */d("input",{type:"number",min:"1",max:"500",value:Z,onChange:e=>Y(e.target.value),className:"w-10 text-xs text-center border border-gray-300 rounded px-1 py-0.5 focus:border-blue-500 focus:ring-blue-500"}),
16
+ /* @__PURE__ */d("button",{onClick:()=>{return e=parseInt(Z)||10,void se({data:[...Q,...Array.from({length:e},()=>Array(W.length).fill(""))]});var e},className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"+ Row"})]}),
17
17
  /* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300"}),
18
18
  /* @__PURE__ */d("button",{onClick:()=>{se({columns:y(p),data:b(x,p)})},className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Clear"}),
19
19
  /* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300"}),
@@ -26,12 +26,12 @@ return u("div",{ref:m,className:"flex flex-col h-full",children:[
26
26
  /* @__PURE__ */d("option",{value:"base",children:"S"}),
27
27
  /* @__PURE__ */d("option",{value:"lg",children:"M"}),
28
28
  /* @__PURE__ */d("option",{value:"xl",children:"L"})]})]})]}),
29
- /* @__PURE__ */d("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */d(e,{columns:P,data:z,onChange:ce,onColumnsChange:e=>se({columns:e}),cellStyles:Z,onFocusChange:q,onSelectionChange:te,minRows:x,maxHeight:"100%"})}),
29
+ /* @__PURE__ */d("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */d(e,{columns:W,data:Q,onChange:ce,onColumnsChange:e=>se({columns:e}),cellStyles:z,onFocusChange:q,onSelectionChange:te,minRows:x,maxHeight:"100%"})}),
30
30
  /* @__PURE__ */u("div",{className:"flex items-center border-t border-gray-200 bg-gray-50 shrink-0",children:[
31
- /* @__PURE__ */u("div",{className:"flex items-center gap-0.5 px-1 py-1 overflow-x-auto flex-1 min-w-0",children:[C.map((e,t)=>/* @__PURE__ */d("button",{onClick:()=>E(t),onDoubleClick:()=>{H(t),V(e.name)},onContextMenu:e=>{e.preventDefault(),C.length>1&&(e=>{C.length<=1||(S(t=>t.filter((t,r)=>r!==e)),j>=e&&j>0&&E(j-1))})(t)},className:"px-3 py-1 text-xs font-medium rounded-b whitespace-nowrap transition-colors "+(t===j?"bg-white text-blue-700 border border-t-0 border-gray-300 -mt-px relative z-10":"text-gray-500 hover:text-gray-700 hover:bg-gray-100"),children:O===t?/* @__PURE__ */d("input",{type:"text",value:Q,onChange:e=>V(e.target.value),onBlur:()=>ie(t,Q||e.name),onKeyDown:r=>{"Enter"===r.key&&ie(t,Q||e.name),"Escape"===r.key&&H(null)},onClick:e=>e.stopPropagation(),autoFocus:!0,className:"w-20 text-xs border border-blue-400 rounded px-1 py-0 focus:ring-0 focus:outline-none"}):e.name},e.id)),
32
- /* @__PURE__ */d("button",{onClick:()=>{const e=`Sheet ${C.length+1}`;S(t=>[...t,f(e)]),E(C.length)},className:"px-2 py-1 text-xs text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded",title:"Add sheet",children:"+"})]}),
31
+ /* @__PURE__ */u("div",{className:"flex items-center gap-0.5 px-1 py-1 overflow-x-auto flex-1 min-w-0",children:[C.map((e,t)=>/* @__PURE__ */d("button",{onClick:()=>E(t),onDoubleClick:()=>{V(t),T(e.name)},onContextMenu:e=>{e.preventDefault(),C.length>1&&(e=>{C.length<=1||(j(t=>t.filter((t,r)=>r!==e)),S>=e&&S>0&&E(S-1))})(t)},className:"px-3 py-1 text-xs font-medium rounded-b whitespace-nowrap transition-colors "+(t===S?"bg-white text-blue-700 border border-t-0 border-gray-300 -mt-px relative z-10":"text-gray-500 hover:text-gray-700 hover:bg-gray-100"),children:I===t?/* @__PURE__ */d("input",{type:"text",value:H,onChange:e=>T(e.target.value),onBlur:()=>ie(t,H||e.name),onKeyDown:r=>{"Enter"===r.key&&ie(t,H||e.name),"Escape"===r.key&&V(null)},onClick:e=>e.stopPropagation(),autoFocus:!0,className:"w-20 text-xs border border-blue-400 rounded px-1 py-0 focus:ring-0 focus:outline-none"}):e.name},e.id)),
32
+ /* @__PURE__ */d("button",{onClick:()=>{const e=`Sheet ${C.length+1}`;j(t=>[...t,f(e)]),E(C.length)},className:"px-2 py-1 text-xs text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded",title:"Add sheet",children:"+"})]}),
33
33
  /* @__PURE__ */u("div",{className:"flex items-center gap-4 px-3 py-1 text-xs text-gray-500 shrink-0 border-l border-gray-200",children:[
34
34
  /* @__PURE__ */u("span",{children:[he," cells"]}),de.length>0&&/* @__PURE__ */u(h,{children:[
35
35
  /* @__PURE__ */u("span",{children:["Sum: ",de.reduce((e,t)=>e+t,0).toLocaleString(void 0,{maximumFractionDigits:2})]}),
36
36
  /* @__PURE__ */u("span",{children:["Avg: ",(de.reduce((e,t)=>e+t,0)/de.length).toLocaleString(void 0,{maximumFractionDigits:2})]})]}),
37
- /* @__PURE__ */u("span",{children:[z.length," × ",P.length]})]})]})]});var me}export{w as default};
37
+ /* @__PURE__ */u("span",{children:[Q.length," × ",W.length]})]})]})]});var me}export{w as default};
@@ -1,4 +1,4 @@
1
- import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-7RI5F5VX.js";import{useWidgetSettings as a}from"./chunk-OMOQC57R.js";import"./chunk-YD4DPX4H.js";import"./chunk-QDCMVFK5.js";import"./chunk-KNUR2UEG.js";import"./chunk-BY3KWWWU.js";import"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import"./chunk-UNA3BQJI.js";import"./chunk-UVBK6YSR.js";import"./chunk-G5GERM76.js";import"./chunk-3E27HV76.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-K7PQXJO7.js";import"./chunk-D65T4H6J.js";import"./chunk-3G5TA3IF.js";import"./chunk-LVCRH3K6.js";import"./chunk-C3QOHMR6.js";import"./chunk-2J6F4EE7.js";import{useState as r,useCallback as n}from"react";import{jsxs as c,Fragment as s,jsx as i}from"react/jsx-runtime";var o=["AAPL","MSFT","GOOGL","TSLA","NVDA"],l="stock_symbols",m="stock_appearance",h={AAPL:{price:229.87,change:1.42,changePct:.62},MSFT:{price:451.16,change:-2.31,changePct:-.51},GOOGL:{price:178.34,change:.89,changePct:.5},AMZN:{price:201.45,change:-1.08,changePct:-.53},TSLA:{price:248.92,change:6.74,changePct:2.78},NVDA:{price:134.81,change:-3.12,changePct:-2.26},META:{price:563.27,change:4.55,changePct:.81}},p=Object.keys(h);function d(){try{const e=JSON.parse(localStorage.getItem(l)||"");if(Array.isArray(e)&&e.length)return e.slice(0,8)}catch{}return o}var g=e=>`${e>=0?"+":""}${e.toFixed(2)}`;function u(){const[o,u]=r(d),[x,y]=r(()=>e(m)),[b,f]=r(!1),[N,k]=r([]),[v,j]=r(x),[A,S]=r(""),C=n(()=>{k([...o]),j({...x}),S(""),f(!0)},[o,x]);a(C);const O=()=>{const e=A.trim().toUpperCase();!e||N.includes(e)||N.length>=8||(k(t=>[...t,e]),S(""))},D=p.filter(e=>!N.includes(e));/* @__PURE__ */
1
+ import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-BMYURA2N.js";import{useWidgetSettings as a}from"./chunk-EZTEOTUD.js";import"./chunk-VJ6KJYRS.js";import"./chunk-JGWOY2KV.js";import"./chunk-KNUR2UEG.js";import"./chunk-GFWRYNPX.js";import"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import"./chunk-MMLU5ZHI.js";import"./chunk-UVBK6YSR.js";import"./chunk-G5GERM76.js";import"./chunk-3E27HV76.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-K7PQXJO7.js";import"./chunk-D65T4H6J.js";import"./chunk-YT4B3NSV.js";import"./chunk-LVCRH3K6.js";import"./chunk-C3QOHMR6.js";import"./chunk-2J6F4EE7.js";import{useState as r,useCallback as n}from"react";import{jsxs as c,Fragment as s,jsx as i}from"react/jsx-runtime";var o=["AAPL","MSFT","GOOGL","TSLA","NVDA"],l="stock_symbols",m="stock_appearance",h={AAPL:{price:229.87,change:1.42,changePct:.62},MSFT:{price:451.16,change:-2.31,changePct:-.51},GOOGL:{price:178.34,change:.89,changePct:.5},AMZN:{price:201.45,change:-1.08,changePct:-.53},TSLA:{price:248.92,change:6.74,changePct:2.78},NVDA:{price:134.81,change:-3.12,changePct:-2.26},META:{price:563.27,change:4.55,changePct:.81}},p=Object.keys(h);function d(){try{const e=JSON.parse(localStorage.getItem(l)||"");if(Array.isArray(e)&&e.length)return e.slice(0,8)}catch{}return o}var g=e=>`${e>=0?"+":""}${e.toFixed(2)}`;function u(){const[o,u]=r(d),[x,y]=r(()=>e(m)),[b,f]=r(!1),[N,k]=r([]),[v,j]=r(x),[S,A]=r(""),O=n(()=>{k([...o]),j({...x}),A(""),f(!0)},[o,x]);a(O);const C=()=>{const e=S.trim().toUpperCase();!e||N.includes(e)||N.length>=8||(k(t=>[...t,e]),A(""))},P=p.filter(e=>!N.includes(e));/* @__PURE__ */
2
2
  return c(s,{children:[
3
3
  /* @__PURE__ */i("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${x.activeOpacity/100})`,backdropFilter:x.activeBlur>0?`blur(${x.activeBlur}px)`:void 0},children:/* @__PURE__ */i("div",{className:"px-4 py-3",children:0===o.length?/* @__PURE__ */i("div",{className:"text-xs text-gray-500 text-center py-6",children:"No symbols yet — add some in settings."}):/* @__PURE__ */i("div",{className:"space-y-0.5",children:o.map(e=>{const t=h[e],a=(t?.change??0)>=0,r=t?t.change>0?"text-green-600":t.change<0?"text-red-600":"text-gray-500":"text-gray-400";/* @__PURE__ */
4
4
  return c("div",{className:"flex items-center justify-between px-2 py-2 border-b border-gray-200 last:border-0",children:[
@@ -11,6 +11,6 @@ return c("div",{className:"flex items-center justify-between px-2 py-2 border-b
11
11
  /* @__PURE__ */c("div",{className:"space-y-1 mb-2",children:[N.map((e,t)=>/* @__PURE__ */c("div",{className:"flex items-center justify-between py-1 px-2 bg-gray-50 rounded",children:[
12
12
  /* @__PURE__ */i("span",{className:"text-sm font-semibold text-gray-700",children:e}),
13
13
  /* @__PURE__ */i("button",{onClick:()=>k(e=>e.filter((e,a)=>a!==t)),className:"text-red-400 hover:text-red-600",children:"×"})]},t)),0===N.length&&/* @__PURE__ */i("p",{className:"text-2xs text-gray-400 italic",children:"No symbols — add a ticker below."})]}),N.length<8?/* @__PURE__ */c("div",{className:"flex items-center gap-2",children:[
14
- /* @__PURE__ */i("input",{value:A,onChange:e=>S(e.target.value),onKeyDown:e=>{"Enter"===e.key&&O()},placeholder:"e.g. NVDA",className:"flex-1 bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm uppercase focus:outline-none focus:ring-1 focus:ring-blue-500"}),
15
- /* @__PURE__ */i("button",{onClick:O,className:"text-sm font-medium text-blue-600 hover:text-blue-800 px-2",children:"+ Add"})]}):/* @__PURE__ */c("p",{className:"text-2xs text-gray-400 italic",children:["Max ",8," symbols — remove one to add another."]}),D.length>0&&N.length<8&&/* @__PURE__ */i("div",{className:"flex flex-wrap gap-2 mt-2",children:D.map(e=>/* @__PURE__ */i("button",{onClick:()=>k(t=>t.length<8?[...t,e]:t),className:"text-2xs font-medium text-gray-600 bg-gray-100 hover:bg-gray-200 rounded px-2 py-0.5 transition-colors",children:e},e))}),
14
+ /* @__PURE__ */i("input",{value:S,onChange:e=>A(e.target.value),onKeyDown:e=>{"Enter"===e.key&&C()},placeholder:"e.g. NVDA",className:"flex-1 bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm uppercase focus:outline-none focus:ring-1 focus:ring-blue-500"}),
15
+ /* @__PURE__ */i("button",{onClick:C,className:"text-sm font-medium text-blue-600 hover:text-blue-800 px-2",children:"+ Add"})]}):/* @__PURE__ */c("p",{className:"text-2xs text-gray-400 italic",children:["Max ",8," symbols — remove one to add another."]}),P.length>0&&N.length<8&&/* @__PURE__ */i("div",{className:"flex flex-wrap gap-2 mt-2",children:P.map(e=>/* @__PURE__ */i("button",{onClick:()=>k(t=>t.length<8?[...t,e]:t),className:"text-2xs font-medium text-gray-600 bg-gray-100 hover:bg-gray-200 rounded px-2 py-0.5 transition-colors",children:e},e))}),
16
16
  /* @__PURE__ */i("p",{className:"text-2xs text-gray-400 mt-2",children:"Demo prices — static sample data, no live feed."})]})})]})}export{u as default};
@@ -1,4 +1,4 @@
1
- import{fetchCityWeather as e,getCondition as t,AVAILABLE_CITIES as a,toFahrenheit as r}from"./chunk-FBDZGO3V.js";import{loadAppearance as n,WidgetSettingsModal as i}from"./chunk-7RI5F5VX.js";import{useWidgetSettings as s}from"./chunk-OMOQC57R.js";import"./chunk-YD4DPX4H.js";import{useShellPrefs as o}from"./chunk-QDCMVFK5.js";import"./chunk-KNUR2UEG.js";import"./chunk-BY3KWWWU.js";import"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import"./chunk-UNA3BQJI.js";import"./chunk-UVBK6YSR.js";import"./chunk-G5GERM76.js";import"./chunk-3E27HV76.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-K7PQXJO7.js";import"./chunk-D65T4H6J.js";import"./chunk-3G5TA3IF.js";import"./chunk-LVCRH3K6.js";import"./chunk-C3QOHMR6.js";import{LoadingSpinner as l}from"./chunk-2J6F4EE7.js";import{useState as c,useEffect as d,useCallback as m}from"react";import{jsx as h,jsxs as p,Fragment as u}from"react/jsx-runtime";var f="weather_city",y="weather_appearance",g={useFahrenheit:!1,showLocalTime:!0,use24Hour:!1};function x(){const e="undefined"!=typeof localStorage?localStorage.getItem(f):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(f,e[0]),e[0]}catch{}return function(){try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone;for(const[t,r]of Object.entries(a))if(r.tz===e)return t}catch{}return"London"}()}var b=r;function w(e,t=!1){try{if(t){const t=new Intl.DateTimeFormat("en-US",{timeZone:e,hour:"numeric",minute:"2-digit",hour12:!1}).formatToParts(/* @__PURE__ */new Date),a=parseInt(t.find(e=>"hour"===e.type)?.value||"0"),r=parseInt(t.find(e=>"minute"===e.type)?.value||"0");return`${String(a).padStart(2,"0")}:${String(r).padStart(2,"0")}`}const a=new Intl.DateTimeFormat("en-US",{timeZone:e,hour:"numeric",minute:"2-digit",hour12:!0}).formatToParts(/* @__PURE__ */new Date),r=parseInt(a.find(e=>"hour"===e.type)?.value||"12"),n=parseInt(a.find(e=>"minute"===e.type)?.value||"0"),i=a.find(e=>"dayPeriod"===e.type)?.value||"";return`${r}:${String(n).padStart(2,"0")} ${i}`}catch{return""}}function v(){/* @__PURE__ */
1
+ import{fetchCityWeather as e,getCondition as t,AVAILABLE_CITIES as a,toFahrenheit as r}from"./chunk-FBDZGO3V.js";import{loadAppearance as n,WidgetSettingsModal as i}from"./chunk-BMYURA2N.js";import{useWidgetSettings as s}from"./chunk-EZTEOTUD.js";import"./chunk-VJ6KJYRS.js";import{useShellPrefs as o}from"./chunk-JGWOY2KV.js";import"./chunk-KNUR2UEG.js";import"./chunk-GFWRYNPX.js";import"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import"./chunk-MMLU5ZHI.js";import"./chunk-UVBK6YSR.js";import"./chunk-G5GERM76.js";import"./chunk-3E27HV76.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-K7PQXJO7.js";import"./chunk-D65T4H6J.js";import"./chunk-YT4B3NSV.js";import"./chunk-LVCRH3K6.js";import"./chunk-C3QOHMR6.js";import{LoadingSpinner as l}from"./chunk-2J6F4EE7.js";import{useState as c,useEffect as d,useCallback as m}from"react";import{jsx as h,jsxs as p,Fragment as u}from"react/jsx-runtime";var f="weather_city",y="weather_appearance",g={useFahrenheit:!1,showLocalTime:!0,use24Hour:!1};function x(){const e="undefined"!=typeof localStorage?localStorage.getItem(f):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(f,e[0]),e[0]}catch{}return function(){try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone;for(const[t,r]of Object.entries(a))if(r.tz===e)return t}catch{}return"London"}()}var b=r;function w(e,t=!1){try{if(t){const t=new Intl.DateTimeFormat("en-US",{timeZone:e,hour:"numeric",minute:"2-digit",hour12:!1}).formatToParts(/* @__PURE__ */new Date),a=parseInt(t.find(e=>"hour"===e.type)?.value||"0"),r=parseInt(t.find(e=>"minute"===e.type)?.value||"0");return`${String(a).padStart(2,"0")}:${String(r).padStart(2,"0")}`}const a=new Intl.DateTimeFormat("en-US",{timeZone:e,hour:"numeric",minute:"2-digit",hour12:!0}).formatToParts(/* @__PURE__ */new Date),r=parseInt(a.find(e=>"hour"===e.type)?.value||"12"),n=parseInt(a.find(e=>"minute"===e.type)?.value||"0"),i=a.find(e=>"dayPeriod"===e.type)?.value||"";return`${r}:${String(n).padStart(2,"0")} ${i}`}catch{return""}}function v(){/* @__PURE__ */
2
2
  return p("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[
3
3
  /* @__PURE__ */h("div",{className:"absolute -top-5 -right-5 w-24 h-24",style:{animation:"wx-sun-rays 70s linear infinite"},children:/* @__PURE__ */h("svg",{viewBox:"0 0 100 100",className:"w-full h-full",children:Array.from({length:12}).map((e,t)=>/* @__PURE__ */h("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__ */h("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 k(){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__ */
@@ -24,37 +24,37 @@ return p("div",{className:"absolute inset-0 overflow-hidden pointer-events-none"
24
24
  /* @__PURE__ */h(j,{heavy:!0}),
25
25
  /* @__PURE__ */h("div",{className:"absolute inset-0 bg-white",style:{animation:"wx-flash 6s ease-out infinite"}}),
26
26
  /* @__PURE__ */h("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__ */h("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__ */h("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 I(){/* @__PURE__ */
27
- return h("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:Array.from({length:4}).map((e,t)=>/* @__PURE__ */h("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 C({code:e,isDay:t}){return 0===e||1===e?/* @__PURE__ */h(t?v:k,{}):2===e?/* @__PURE__ */p(u,{children:[/* @__PURE__ */h(t?v:k,{}),
28
- /* @__PURE__ */h(N,{tone:t?"light":"dark"})]}):3===e?/* @__PURE__ */h(N,{tone:t?"light":"dark"}):45===e||48===e?/* @__PURE__ */h(I,{}):[51,53,61,80,81].includes(e)?/* @__PURE__ */h(j,{}):[55,63,65,82].includes(e)?/* @__PURE__ */h(j,{heavy:!0}):[71,73,75].includes(e)?/* @__PURE__ */h(S,{}):[95,96,99].includes(e)?/* @__PURE__ */h($,{}):null}function D(){const[r,v]=c(x),[k,N]=c(()=>n(y)),[j,S]=c(null),[$,I]=c(!0),[,D]=c(0);d(()=>{const e=setInterval(()=>D(e=>e+1),6e4);return()=>clearInterval(e)},[]);const[F,A]=c(!1),[H,L]=c(r),[T,O]=c(k),{prefs:B,save:z}=o(),X={...g,...B.weather_prefs??{}},[M,G]=c(X);s(m(()=>{L(r),O({...k}),G({...X}),A(!0)},[r,k,X])),d(()=>{let t=!1;return I(!0),e(r).then(e=>{t||(S(e),I(!1))}),()=>{t=!0}},[r]);const Q=e=>X.useFahrenheit?`${b(e)}°F`:`${e}°`;if($&&!j)/* @__PURE__ */
27
+ return h("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:Array.from({length:4}).map((e,t)=>/* @__PURE__ */h("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__ */h(t?v:k,{}):2===e?/* @__PURE__ */p(u,{children:[/* @__PURE__ */h(t?v:k,{}),
28
+ /* @__PURE__ */h(N,{tone:t?"light":"dark"})]}):3===e?/* @__PURE__ */h(N,{tone:t?"light":"dark"}):45===e||48===e?/* @__PURE__ */h(I,{}):[51,53,61,80,81].includes(e)?/* @__PURE__ */h(j,{}):[55,63,65,82].includes(e)?/* @__PURE__ */h(j,{heavy:!0}):[71,73,75].includes(e)?/* @__PURE__ */h(S,{}):[95,96,99].includes(e)?/* @__PURE__ */h($,{}):null}function C(){const[r,v]=c(x),[k,N]=c(()=>n(y)),[j,S]=c(null),[$,I]=c(!0),[,C]=c(0);d(()=>{const e=setInterval(()=>C(e=>e+1),6e4);return()=>clearInterval(e)},[]);const[D,F]=c(!1),[L,H]=c(r),[A,O]=c(k),{prefs:B,save:z}=o(),M={...g,...B.weather_prefs??{}},[E,G]=c(M);s(m(()=>{H(r),O({...k}),G({...M}),F(!0)},[r,k,M])),d(()=>{let t=!1;return I(!0),e(r).then(e=>{t||(S(e),I(!1))}),()=>{t=!0}},[r]);const J=e=>M.useFahrenheit?`${b(e)}°F`:`${e}°`;if($&&!j)/* @__PURE__ */
29
29
  return h("div",{className:"flex items-center justify-center h-full bg-gradient-to-b from-sky-400 to-blue-500 rounded-lg text-white/80 text-xs",style:{minHeight:110},children:/* @__PURE__ */h(l,{size:"sm",padding:"",label:"Loading"})});if(!j)/* @__PURE__ */
30
- return h("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[R,U,W]=t(j.code,j.isDay);/* @__PURE__ */
30
+ return h("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[R,U,X]=t(j.code,j.isDay);/* @__PURE__ */
31
31
  return p(u,{children:[
32
32
  /* @__PURE__ */h("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__ */h("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:`rgba(15, 23, 42, ${k.activeOpacity/100})`,backdropFilter:k.activeBlur>0?`blur(${k.activeBlur}px)`:void 0},children:/* @__PURE__ */p("div",{className:`relative rounded-lg overflow-hidden text-white bg-gradient-to-br ${W}`,style:{height:110},children:[
34
- /* @__PURE__ */h(C,{code:j.code,isDay:j.isDay}),
33
+ /* @__PURE__ */h("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:`rgba(15, 23, 42, ${k.activeOpacity/100})`,backdropFilter:k.activeBlur>0?`blur(${k.activeBlur}px)`:void 0},children:/* @__PURE__ */p("div",{className:`relative rounded-lg overflow-hidden text-white bg-gradient-to-br ${X}`,style:{height:110},children:[
34
+ /* @__PURE__ */h(T,{code:j.code,isDay:j.isDay}),
35
35
  /* @__PURE__ */p("div",{className:"relative z-10 px-3 py-3 flex flex-col h-full justify-between",children:[
36
36
  /* @__PURE__ */p("div",{className:"flex items-start justify-between gap-2",children:[
37
37
  /* @__PURE__ */p("div",{className:"min-w-0 flex-1",children:[
38
- /* @__PURE__ */h("div",{className:"text-base font-semibold leading-tight truncate drop-shadow-sm",children:j.city}),X.showLocalTime&&/* @__PURE__ */h("div",{className:"text-2xs opacity-90 leading-tight tabular-nums drop-shadow-sm",children:w(j.timezone,X.use24Hour)})]}),
39
- /* @__PURE__ */h("div",{className:"text-3xl font-extralight leading-none tracking-tight tabular-nums shrink-0 drop-shadow-sm",children:Q(j.temp)})]}),
38
+ /* @__PURE__ */h("div",{className:"text-base font-semibold leading-tight truncate drop-shadow-sm",children:j.city}),M.showLocalTime&&/* @__PURE__ */h("div",{className:"text-2xs opacity-90 leading-tight tabular-nums drop-shadow-sm",children:w(j.timezone,M.use24Hour)})]}),
39
+ /* @__PURE__ */h("div",{className:"text-3xl font-extralight leading-none tracking-tight tabular-nums shrink-0 drop-shadow-sm",children:J(j.temp)})]}),
40
40
  /* @__PURE__ */p("div",{className:"flex items-end justify-between gap-2",children:[
41
41
  /* @__PURE__ */p("div",{className:"flex items-center gap-2 min-w-0",children:[
42
42
  /* @__PURE__ */h("span",{className:"text-lg leading-none drop-shadow-sm",children:U}),
43
43
  /* @__PURE__ */h("span",{className:"text-2xs font-medium drop-shadow-sm truncate",children:R})]}),
44
- /* @__PURE__ */p("span",{className:"text-2xs opacity-90 tabular-nums drop-shadow-sm shrink-0",children:["H:",Q(j.high)," L:",Q(j.low)]})]})]})]})}),
45
- /* @__PURE__ */p(i,{open:F,onClose:()=>A(!1),title:"Weather Settings",appearance:T,onAppearanceChange:O,onSave:()=>{v(H),N(T),z({weather_prefs:M}),localStorage.setItem(f,H),localStorage.setItem(y,JSON.stringify(T)),A(!1)},children:[
44
+ /* @__PURE__ */p("span",{className:"text-2xs opacity-90 tabular-nums drop-shadow-sm shrink-0",children:["H:",J(j.high)," L:",J(j.low)]})]})]})]})}),
45
+ /* @__PURE__ */p(i,{open:D,onClose:()=>F(!1),title:"Weather Settings",appearance:A,onAppearanceChange:O,onSave:()=>{v(L),N(A),z({weather_prefs:E}),localStorage.setItem(f,L),localStorage.setItem(y,JSON.stringify(A)),F(!1)},children:[
46
46
  /* @__PURE__ */h("div",{className:"space-y-3",children:/* @__PURE__ */p("div",{children:[
47
47
  /* @__PURE__ */h("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Display"}),
48
48
  /* @__PURE__ */p("div",{className:"flex items-center gap-3 mb-2",children:[
49
49
  /* @__PURE__ */h("span",{className:"text-sm text-gray-600 w-24",children:"Temperature"}),
50
- /* @__PURE__ */h("div",{className:"flex gap-1",children:[{key:!1,label:"°C"},{key:!0,label:"°F"}].map(e=>/* @__PURE__ */h("button",{onClick:()=>G(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)))})]}),
50
+ /* @__PURE__ */h("div",{className:"flex gap-1",children:[{key:!1,label:"°C"},{key:!0,label:"°F"}].map(e=>/* @__PURE__ */h("button",{onClick:()=>G(t=>({...t,useFahrenheit:e.key})),className:"px-3 py-1 text-xs font-medium rounded-lg border transition-colors "+(E.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__ */p("div",{className:"flex items-center gap-3 mb-2",children:[
52
52
  /* @__PURE__ */h("span",{className:"text-sm text-gray-600 w-24",children:"Time Format"}),
53
- /* @__PURE__ */h("div",{className:"flex gap-1",children:[{key:!1,label:"AM/PM"},{key:!0,label:"24H"}].map(e=>/* @__PURE__ */h("button",{onClick:()=>G(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)))})]}),
53
+ /* @__PURE__ */h("div",{className:"flex gap-1",children:[{key:!1,label:"AM/PM"},{key:!0,label:"24H"}].map(e=>/* @__PURE__ */h("button",{onClick:()=>G(t=>({...t,use24Hour:e.key})),className:"px-3 py-1 text-xs font-medium rounded-lg border transition-colors "+(E.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__ */p("label",{className:"flex items-center gap-2 cursor-pointer",children:[
55
- /* @__PURE__ */h("input",{type:"checkbox",checked:M.showLocalTime,onChange:e=>G(t=>({...t,showLocalTime:e.target.checked})),className:"rounded border-gray-300 text-blue-600 h-3.5 w-3.5"}),
55
+ /* @__PURE__ */h("input",{type:"checkbox",checked:E.showLocalTime,onChange:e=>G(t=>({...t,showLocalTime:e.target.checked})),className:"rounded border-gray-300 text-blue-600 h-3.5 w-3.5"}),
56
56
  /* @__PURE__ */h("span",{className:"text-sm text-gray-600",children:"Show local time"})]})]})}),
57
57
  /* @__PURE__ */p("div",{children:[
58
58
  /* @__PURE__ */h("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"City"}),
59
- /* @__PURE__ */h("select",{value:H,onChange:e=>L(e.target.value),className:"w-full bg-gray-50 border border-gray-200 rounded px-2 h-8 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:Object.keys(a).map(e=>/* @__PURE__ */h("option",{value:e,children:e},e))}),
60
- /* @__PURE__ */h("p",{className:"mt-1 text-2xs text-gray-400",children:"Auto-detected from your timezone; change if needed."})]})]})]})}export{D as default};
59
+ /* @__PURE__ */h("select",{value:L,onChange:e=>H(e.target.value),className:"w-full bg-gray-50 border border-gray-200 rounded px-2 h-8 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:Object.keys(a).map(e=>/* @__PURE__ */h("option",{value:e,children:e},e))}),
60
+ /* @__PURE__ */h("p",{className:"mt-1 text-2xs text-gray-400",children:"Auto-detected from your timezone; change if needed."})]})]})]})}export{C as default};
@@ -1,6 +1,6 @@
1
- import{AVAILABLE_CITIES as e,fetchCityWeather as t,getCondition as r,toFahrenheit as a}from"./chunk-FBDZGO3V.js";import{loadAppearance as n,WidgetSettingsModal as s}from"./chunk-7RI5F5VX.js";import{useWidgetSettings as i}from"./chunk-OMOQC57R.js";import"./chunk-YD4DPX4H.js";import{useShellPrefs as c}from"./chunk-QDCMVFK5.js";import"./chunk-KNUR2UEG.js";import"./chunk-BY3KWWWU.js";import"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import"./chunk-UNA3BQJI.js";import"./chunk-UVBK6YSR.js";import"./chunk-G5GERM76.js";import"./chunk-3E27HV76.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-K7PQXJO7.js";import"./chunk-D65T4H6J.js";import"./chunk-3G5TA3IF.js";import"./chunk-LVCRH3K6.js";import"./chunk-C3QOHMR6.js";import{LoadingSpinner as l}from"./chunk-2J6F4EE7.js";import{useState as o,useEffect as m,useCallback as h}from"react";import{jsxs as d,Fragment as p,jsx as u}from"react/jsx-runtime";var g="world_clock_appearance",x=["London","Shanghai","New York"];function y(){const{prefs:y,save:b}=c(),[f,k]=o(()=>n(g)),[v,N]=o(!1),[j,w]=o([]),[F,C]=o(f),D={useFahrenheit:!!y.weather_prefs?.useFahrenheit},[O,S]=o(D),[I,B]=o(()=>/* @__PURE__ */new Date);m(()=>{const e=setInterval(()=>B(/* @__PURE__ */new Date),3e4);return()=>clearInterval(e)},[]);const U=Object.fromEntries(Object.entries(e).map(([e,t])=>[t.tz,e])),A=y.world_clocks,E=(()=>{if(!Array.isArray(A)||0===A.length)return x;const t=[];for(const r of A){const a=e[r]?r:U[r];a&&!t.includes(a)&&t.push(a)}return t.length?t:x})(),[H,Q]=o({}),[R,T]=o(!0);m(()=>{let e=!1;return T(!0),(async()=>{const r={};await Promise.all(E.map(async e=>{const a=await t(e);a&&(r[e]=a)})),e||(Q(r),T(!1))})(),()=>{e=!0}},[E.join(",")]),i(h(()=>{w([...E]),C({...f}),S({...D}),N(!0)},[E.join(","),f,D.useFahrenheit]));const W=e=>D.useFahrenheit?`${a(e)}°`:`${e}°`;/* @__PURE__ */
1
+ import{AVAILABLE_CITIES as e,fetchCityWeather as t,getCondition as r,toFahrenheit as a}from"./chunk-FBDZGO3V.js";import{loadAppearance as n,WidgetSettingsModal as s}from"./chunk-BMYURA2N.js";import{useWidgetSettings as i}from"./chunk-EZTEOTUD.js";import"./chunk-VJ6KJYRS.js";import{useShellPrefs as c}from"./chunk-JGWOY2KV.js";import"./chunk-KNUR2UEG.js";import"./chunk-GFWRYNPX.js";import"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import"./chunk-MMLU5ZHI.js";import"./chunk-UVBK6YSR.js";import"./chunk-G5GERM76.js";import"./chunk-3E27HV76.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-K7PQXJO7.js";import"./chunk-D65T4H6J.js";import"./chunk-YT4B3NSV.js";import"./chunk-LVCRH3K6.js";import"./chunk-C3QOHMR6.js";import{LoadingSpinner as l}from"./chunk-2J6F4EE7.js";import{useState as o,useEffect as m,useCallback as h}from"react";import{jsxs as d,Fragment as p,jsx as u}from"react/jsx-runtime";var g="world_clock_appearance",x=["London","Shanghai","New York"];function y(){const{prefs:y,save:b}=c(),[f,k]=o(()=>n(g)),[N,v]=o(!1),[j,w]=o([]),[F,C]=o(f),S={useFahrenheit:!!y.weather_prefs?.useFahrenheit},[O,D]=o(S),[E,T]=o(()=>/* @__PURE__ */new Date);m(()=>{const e=setInterval(()=>T(/* @__PURE__ */new Date),3e4);return()=>clearInterval(e)},[]);const U=Object.fromEntries(Object.entries(e).map(([e,t])=>[t.tz,e])),B=y.world_clocks,R=(()=>{if(!Array.isArray(B)||0===B.length)return x;const t=[];for(const r of B){const a=e[r]?r:U[r];a&&!t.includes(a)&&t.push(a)}return t.length?t:x})(),[G,H]=o({}),[I,J]=o(!0);m(()=>{let e=!1;return J(!0),(async()=>{const r={};await Promise.all(R.map(async e=>{const a=await t(e);a&&(r[e]=a)})),e||(H(r),J(!1))})(),()=>{e=!0}},[R.join(",")]),i(h(()=>{w([...R]),C({...f}),D({...S}),v(!0)},[R.join(","),f,S.useFahrenheit]));const L=e=>S.useFahrenheit?`${a(e)}°`:`${e}°`;/* @__PURE__ */
2
2
  return d(p,{children:[
3
- /* @__PURE__ */u("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${f.activeOpacity/100})`,backdropFilter:f.activeBlur>0?`blur(${f.activeBlur}px)`:void 0},children:/* @__PURE__ */d("div",{className:"divide-y divide-gray-200",children:[R&&E.every(e=>!H[e])&&/* @__PURE__ */u(l,{size:"sm",padding:"py-6",label:"Loading"}),E.map(t=>{const a=H[t],n=e[t]?.tz??"UTC",{time:s,ampm:i}=function(e,t){try{const r=new Intl.DateTimeFormat("en-US",{timeZone:e,hour:"numeric",minute:"2-digit",hour12:!0}).formatToParts(t),a=r.find(e=>"hour"===e.type)?.value||"12";return{time:`${a}:${r.find(e=>"minute"===e.type)?.value||"00"}`,ampm:(r.find(e=>"dayPeriod"===e.type)?.value||"").toUpperCase()}}catch{return{time:"",ampm:""}}}(n,I);if(!a)/* @__PURE__ */
3
+ /* @__PURE__ */u("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${f.activeOpacity/100})`,backdropFilter:f.activeBlur>0?`blur(${f.activeBlur}px)`:void 0},children:/* @__PURE__ */d("div",{className:"divide-y divide-gray-200",children:[I&&R.every(e=>!G[e])&&/* @__PURE__ */u(l,{size:"sm",padding:"py-6",label:"Loading"}),R.map(t=>{const a=G[t],n=e[t]?.tz??"UTC",{time:s,ampm:i}=function(e,t){try{const r=new Intl.DateTimeFormat("en-US",{timeZone:e,hour:"numeric",minute:"2-digit",hour12:!0}).formatToParts(t),a=r.find(e=>"hour"===e.type)?.value||"12";return{time:`${a}:${r.find(e=>"minute"===e.type)?.value||"00"}`,ampm:(r.find(e=>"dayPeriod"===e.type)?.value||"").toUpperCase()}}catch{return{time:"",ampm:""}}}(n,E);if(!a)/* @__PURE__ */
4
4
  return d("div",{className:"px-4 py-3",children:[
5
5
  /* @__PURE__ */d("div",{className:"flex items-baseline justify-between gap-2",children:[
6
6
  /* @__PURE__ */u("span",{className:"text-base font-semibold tracking-tight text-gray-900 truncate",children:t}),
@@ -10,7 +10,7 @@ return d("div",{className:"px-4 py-3",children:[
10
10
  return d("div",{className:"px-4 py-3",children:[
11
11
  /* @__PURE__ */d("div",{className:"flex items-baseline justify-between gap-2",children:[
12
12
  /* @__PURE__ */u("span",{className:"text-base font-semibold tracking-tight text-gray-900 truncate",children:t}),
13
- /* @__PURE__ */u("span",{className:"text-2xl font-extralight leading-none tabular-nums tracking-tight text-gray-900 shrink-0",children:W(a.temp)})]}),
13
+ /* @__PURE__ */u("span",{className:"text-2xl font-extralight leading-none tabular-nums tracking-tight text-gray-900 shrink-0",children:L(a.temp)})]}),
14
14
  /* @__PURE__ */d("div",{className:"flex items-center justify-between gap-2 mt-2 text-2xs",children:[
15
15
  /* @__PURE__ */d("div",{className:"flex items-center gap-2 min-w-0 text-gray-500",children:[
16
16
  /* @__PURE__ */u("span",{className:"text-base leading-none shrink-0",children:o}),
@@ -18,13 +18,13 @@ return d("div",{className:"px-4 py-3",children:[
18
18
  /* @__PURE__ */u("span",{className:"text-3xs font-medium ml-0.5 opacity-70",children:i})]}),
19
19
  /* @__PURE__ */u("span",{className:"text-gray-300 shrink-0",children:"·"}),
20
20
  /* @__PURE__ */u("span",{className:"truncate",children:c})]}),
21
- /* @__PURE__ */d("span",{className:"tabular-nums text-gray-500 shrink-0",children:["H:",W(a.high)," L:",W(a.low)]})]})]},t)})]})}),
22
- /* @__PURE__ */d(s,{open:v,onClose:()=>N(!1),title:"World Clock Settings",appearance:F,onAppearanceChange:C,onSave:()=>{0!==j.length&&(b({world_clocks:j,weather_prefs:{...y.weather_prefs??{},useFahrenheit:O.useFahrenheit}}),k(F),localStorage.setItem(g,JSON.stringify(F)),N(!1))},children:[
21
+ /* @__PURE__ */d("span",{className:"tabular-nums text-gray-500 shrink-0",children:["H:",L(a.high)," L:",L(a.low)]})]})]},t)})]})}),
22
+ /* @__PURE__ */d(s,{open:N,onClose:()=>v(!1),title:"World Clock Settings",appearance:F,onAppearanceChange:C,onSave:()=>{0!==j.length&&(b({world_clocks:j,weather_prefs:{...y.weather_prefs??{},useFahrenheit:O.useFahrenheit}}),k(F),localStorage.setItem(g,JSON.stringify(F)),v(!1))},children:[
23
23
  /* @__PURE__ */d("div",{children:[
24
24
  /* @__PURE__ */u("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Display"}),
25
25
  /* @__PURE__ */d("div",{className:"flex items-center gap-3 mb-2",children:[
26
26
  /* @__PURE__ */u("span",{className:"text-sm text-gray-600 w-24",children:"Temperature"}),
27
- /* @__PURE__ */u("div",{className:"flex gap-1",children:[{key:!1,label:"°C"},{key:!0,label:"°F"}].map(e=>/* @__PURE__ */u("button",{onClick:()=>S(t=>({...t,useFahrenheit:e.key})),className:"px-3 py-1 text-xs font-medium rounded-lg border transition-colors "+(O.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__ */u("div",{className:"flex gap-1",children:[{key:!1,label:"°C"},{key:!0,label:"°F"}].map(e=>/* @__PURE__ */u("button",{onClick:()=>D(t=>({...t,useFahrenheit:e.key})),className:"px-3 py-1 text-xs font-medium rounded-lg border transition-colors "+(O.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__ */u("p",{className:"text-2xs text-gray-400 mt-1",children:"Shared with the Weather widget."})]}),
29
29
  /* @__PURE__ */d("div",{children:[
30
30
  /* @__PURE__ */u("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Cities"}),
@@ -0,0 +1,271 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { UIMessage } from 'ai';
3
+
4
+ /** The conversation the server keeps for this chat. `guestToken` is set for an
5
+ * anonymous (storefront) visitor and is sent back by the host's `getHeaders`. */
6
+ interface AssistantConversation {
7
+ id: string;
8
+ guestToken?: string;
9
+ }
10
+ /** The one transient data part the server sends right after `start`. */
11
+ interface ConversationDataPart {
12
+ id: string;
13
+ guest_token?: string;
14
+ }
15
+ /** Who wrote a restored message. `staff` is a teammate who took the thread over;
16
+ * `system` is a notice the server wrote. Streamed messages carry no source. */
17
+ type MessageSource = 'user' | 'assistant' | 'staff' | 'system';
18
+ interface AssistantMessageMetadata {
19
+ source?: MessageSource;
20
+ }
21
+ /** A step of a server-run plan. `status` is the server's record of what ran. */
22
+ interface PlanStepData {
23
+ id: string;
24
+ position: number;
25
+ title: string;
26
+ status: 'pending' | 'running' | 'done' | 'failed' | 'skipped';
27
+ result_summary: string;
28
+ tool_name: string;
29
+ /** Exactly what the step runs with. */
30
+ input: Record<string, unknown>;
31
+ }
32
+ type PlanStatus = 'proposed' | 'approved' | 'denied' | 'running' | 'completed' | 'failed' | 'expired';
33
+ /** A `data-plan` part: a multi-step write the person approves once. The server
34
+ * sends it whole on every change, with the plan id as the part id, so the
35
+ * latest one replaces the last. */
36
+ interface PlanDataPart {
37
+ id: string;
38
+ approval_id: string;
39
+ status: PlanStatus;
40
+ steps: PlanStepData[];
41
+ }
42
+ type AssistantUIMessage = UIMessage<AssistantMessageMetadata, {
43
+ conversation: ConversationDataPart;
44
+ plan: PlanDataPart;
45
+ }>;
46
+ /** How a tool is named and narrated to the person using the chat. */
47
+ interface ToolLabelSpec {
48
+ /** What the tool does, as a short action ("Check stock"). Used as the title
49
+ * of an approval card and as the fallback for the lines below. */
50
+ label: string;
51
+ /** The status line while the tool runs ("Checking stock"). */
52
+ running?: string;
53
+ /** The status line once it has finished ("Checked stock"). */
54
+ done?: string;
55
+ /** A phrase from the tool's input, appended to the status line and shown on
56
+ * the approval card header ("for PN-1042"). Return `undefined` for none. */
57
+ describe?: (input: Record<string, unknown>) => string | undefined;
58
+ }
59
+ type ToolLabel = string | ToolLabelSpec;
60
+ /** Friendly names by tool name. A tool with no entry gets its name, humanised. */
61
+ type ToolLabels = Record<string, ToolLabel>;
62
+ /** Every word the chat shows. Pass a partial object to translate or reword. */
63
+ interface AssistantChatLabels {
64
+ title: string;
65
+ placeholder: string;
66
+ inputLabel: string;
67
+ send: string;
68
+ stop: string;
69
+ newChat: string;
70
+ open: string;
71
+ close: string;
72
+ thinking: string;
73
+ loadingHistory: string;
74
+ historyFailed: string;
75
+ emptyState: string;
76
+ approvalNeeded: string;
77
+ approve: string;
78
+ deny: string;
79
+ approved: string;
80
+ declined: string;
81
+ toolFailed: string;
82
+ toolDeclined: string;
83
+ details: string;
84
+ reasoning: string;
85
+ genericError: string;
86
+ /** Name on a teammate's message bubble. */
87
+ working: string;
88
+ steps: string;
89
+ teamName: string;
90
+ /** The notice shown once a person has taken the conversation over. */
91
+ teamJoined: string;
92
+ /** Names the pinned plan checklist for assistive technology. */
93
+ plan: string;
94
+ /** The checklist's one line: "{done}" and "{total}" are filled in. */
95
+ planSummary: string;
96
+ planProposed: string;
97
+ planApproved: string;
98
+ planRunning: string;
99
+ planCompleted: string;
100
+ planFailed: string;
101
+ planDenied: string;
102
+ planExpired: string;
103
+ /** The plan approval card's heading; "{count}" is the number of steps. */
104
+ planApprovalHeading: string;
105
+ approvePlan: string;
106
+ }
107
+ type AssistantChatVariant = 'panel' | 'window' | 'bubble';
108
+ interface AssistantChatProps {
109
+ /** Base URL of the API, without the trailing `assistant/chat/` ("/api/v1"). */
110
+ apiBase: string;
111
+ /** Request headers for every call — `Authorization`, `X-Portal-Audience`, or
112
+ * the guest `X-Chat-Token`. Called per request, so a refreshed token is used. */
113
+ getHeaders?: () => Promise<Record<string, string>> | Record<string, string>;
114
+ /** Fetch credentials mode. Left to the browser's default (same-origin) when omitted. */
115
+ credentials?: RequestCredentials;
116
+ /** The conversation to restore on mount; `null`/`undefined` starts a new one. */
117
+ conversationId?: string | null;
118
+ /** Called when the server names the conversation (and again for a new guest
119
+ * token), and with `null` when the person starts a new chat. Persist it. */
120
+ onConversation?: (conversation: AssistantConversation | null) => void;
121
+ title?: string;
122
+ placeholder?: string;
123
+ /** `panel`: docked side panel. `window`: fills its container (a shell
124
+ * window). `bubble`: a floating launcher that opens a panel. Default `panel`. */
125
+ variant?: AssistantChatVariant;
126
+ toolLabels?: ToolLabels;
127
+ /** Reword or translate the chat's own text. */
128
+ labels?: Partial<AssistantChatLabels>;
129
+ /** Draw the component's own header (title, New chat, close). Default: yes,
130
+ * except in `window`, whose shell window already has a title bar. Without
131
+ * the header, "New chat" is an icon button beside the composer and the
132
+ * section keeps its accessible name from `title`. */
133
+ showHeader?: boolean;
134
+ /** Show the model's reasoning as a collapsed step in the chain. Only `window`
135
+ * (staff) ever honours it; `panel` and `bubble` never show reasoning. */
136
+ showReasoning?: boolean;
137
+ /** Bubble only: start open. */
138
+ defaultOpen?: boolean;
139
+ /** Bubble only: told when the panel opens or closes. */
140
+ onOpenChange?: (open: boolean) => void;
141
+ /** Live updates for a conversation a person can take over. Called once the
142
+ * conversation exists (and again if its guest token changes); the host opens
143
+ * whatever channel it has (a socket, a poll) and calls `refresh()` when
144
+ * something new may have arrived. Return a function that closes it. The chat
145
+ * then adds the staff and system messages it is missing, never replaces a
146
+ * turn it is streaming, and, because the host says when, does not ask the
147
+ * server after each turn. */
148
+ subscribe?: (conversation: AssistantConversation, refresh: () => void) => (() => void) | void;
149
+ /** Replaces `fetch`, for hosts that need to wrap requests. */
150
+ fetch?: typeof fetch;
151
+ className?: string;
152
+ }
153
+
154
+ declare function AssistantChat(props: AssistantChatProps): react_jsx_runtime.JSX.Element;
155
+
156
+ interface MessageProps {
157
+ message: AssistantUIMessage;
158
+ toolLabels: ToolLabels | undefined;
159
+ labels: AssistantChatLabels;
160
+ showReasoning: boolean;
161
+ showToolOutput: boolean;
162
+ /** This message is the one being written right now. */
163
+ live: boolean;
164
+ onApprove: (approvalId: string, approved: boolean) => void;
165
+ /** Plans by approval id, for a plan's approval card. */
166
+ plans?: Map<string, PlanDataPart>;
167
+ }
168
+ declare function Message({ message, toolLabels, labels, showReasoning, showToolOutput, live, onApprove, plans }: MessageProps): react_jsx_runtime.JSX.Element | null;
169
+
170
+ interface ApprovalDecision {
171
+ approval_id: string;
172
+ approved: boolean;
173
+ reason?: string;
174
+ }
175
+ interface AssistantChatRequestBody {
176
+ conversation_id: string | null;
177
+ text: string | null;
178
+ approvals: ApprovalDecision[];
179
+ }
180
+ /** The tool-part fields the chat reads, whatever the tool is called. */
181
+ interface ToolPartView {
182
+ toolName: string;
183
+ toolCallId: string;
184
+ state: string;
185
+ input: unknown;
186
+ output: unknown;
187
+ errorText: string | undefined;
188
+ approvalId: string | undefined;
189
+ approved: boolean | undefined;
190
+ }
191
+ /** The request body for the next turn. Throws when there is nothing to send,
192
+ * so a bug cannot become an empty request the server has to reject. */
193
+ declare function buildRequestBody(messages: AssistantUIMessage[], conversationId: string | null): AssistantChatRequestBody;
194
+ interface HistoryMessage {
195
+ id: string;
196
+ role: 'user' | 'assistant';
197
+ /** Absent on older servers; `staff` and `system` render differently. */
198
+ source?: MessageSource;
199
+ text: string;
200
+ created_at?: string;
201
+ }
202
+ interface HistoryApproval {
203
+ approval_id: string;
204
+ /** The tool call the approval belongs to. The continuation stream reuses it,
205
+ * so the answered card and its result are ONE part. */
206
+ tool_call_id?: string;
207
+ tool_name: string;
208
+ input: unknown;
209
+ requested_at?: string;
210
+ expires_at?: string;
211
+ /** Set when the approval decides a whole plan. */
212
+ plan_id?: string | null;
213
+ }
214
+ interface ConversationHistory {
215
+ id: string;
216
+ /** True once a person has taken the conversation over from the assistant. */
217
+ handed_over?: boolean;
218
+ messages: HistoryMessage[];
219
+ pending_approvals: HistoryApproval[];
220
+ /** Every plan of the conversation, oldest first (servers before plans omit it). */
221
+ plans?: PlanDataPart[];
222
+ }
223
+ /** The latest state of every plan in the thread, by plan id. A later part for
224
+ * the same plan (the server re-sends it on every change) wins. */
225
+ declare function plansOf(messages: AssistantUIMessage[]): Map<string, PlanDataPart>;
226
+ /** The plan to pin above the composer: the most recently updated one while it
227
+ * is active, and — once it has finished — until the person sends another
228
+ * message, so its outcome stays in view (folded). */
229
+ declare function pinnedPlan(messages: AssistantUIMessage[]): PlanDataPart | null;
230
+ /** Rebuild the thread from `GET <apiBase>/assistant/chat/<id>/`. Pending
231
+ * approvals come back as one trailing assistant message of tool parts in
232
+ * `approval-requested`, so the same card and the same continuation apply.
233
+ * A plan still waiting or running rides in that message as its `data-plan`
234
+ * part, so the checklist is pinned again and the continuation's updates
235
+ * replace it in place. A finished plan is already told in the thread by the
236
+ * server's own summary message. */
237
+ declare function messagesFromHistory(history: ConversationHistory): AssistantUIMessage[];
238
+
239
+ interface ToolCallProps {
240
+ tool: ToolPartView;
241
+ toolLabels: ToolLabels | undefined;
242
+ labels: AssistantChatLabels;
243
+ /** Show what the tool returned. Internal surfaces only. */
244
+ showOutput: boolean;
245
+ onApprove: (approvalId: string, approved: boolean) => void;
246
+ }
247
+ declare function ApprovalCard({ tool, toolLabels, labels, onApprove }: Omit<ToolCallProps, 'showOutput'>): react_jsx_runtime.JSX.Element;
248
+ declare function ToolStep({ tool, toolLabels, labels, showOutput }: Omit<ToolCallProps, 'onApprove'>): react_jsx_runtime.JSX.Element;
249
+
250
+ interface ChecklistProps {
251
+ plan: PlanDataPart;
252
+ labels: AssistantChatLabels;
253
+ }
254
+ declare function PlanChecklist({ plan, labels }: ChecklistProps): react_jsx_runtime.JSX.Element;
255
+ interface ApprovalProps {
256
+ approvalId: string;
257
+ /** The server's plan when it has arrived; otherwise the call's own input. */
258
+ plan: PlanDataPart | undefined;
259
+ input: unknown;
260
+ labels: AssistantChatLabels;
261
+ toolLabels: ToolLabels | undefined;
262
+ onApprove: (approvalId: string, approved: boolean) => void;
263
+ }
264
+ /** One decision for the whole plan: every step, by its friendly name and
265
+ * inputs, then Approve or Deny. */
266
+ declare function PlanApprovalCard({ approvalId, plan, input, labels, toolLabels, onApprove }: ApprovalProps): react_jsx_runtime.JSX.Element;
267
+
268
+ /** The chat's own words, English. Hosts translate through the `labels` prop. */
269
+ declare const DEFAULT_ASSISTANT_CHAT_LABELS: AssistantChatLabels;
270
+
271
+ export { ApprovalCard, type ApprovalDecision, AssistantChat, type AssistantChatLabels, type AssistantChatProps, type AssistantChatRequestBody, type AssistantChatVariant, type AssistantConversation, Message as AssistantMessage, type AssistantMessageMetadata, type AssistantUIMessage, type ConversationHistory, DEFAULT_ASSISTANT_CHAT_LABELS, type MessageSource, PlanApprovalCard, PlanChecklist, type PlanDataPart, type PlanStatus, type PlanStepData, type ToolLabel, type ToolLabelSpec, type ToolLabels, ToolStep, buildRequestBody, messagesFromHistory, pinnedPlan, plansOf };