efficient-shell 5.0.0 → 5.2.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 (69) hide show
  1. package/README.md +98 -2
  2. package/dist/{Browser-5F5LWXYQ.js → Browser-FKZ6M2MK.js} +18 -18
  3. package/dist/Calculator-LBFBTFSD.js +29 -0
  4. package/dist/ConfirmDialog-JAEFVRJM.js +1 -0
  5. package/dist/{CurrencyConverter-QEG6RFAS.js → CurrencyConverter-OV5ZQIAJ.js} +7 -7
  6. package/dist/{Documents-6DEUZVVA.js → Documents-HGGL3AWI.js} +24 -24
  7. package/dist/Files-DAQKIF6W.js +87 -0
  8. package/dist/{Notepad-KNJRTYXR.js → Notepad-PO724TVP.js} +10 -10
  9. package/dist/PdfViewer-6ALXGVTV.js +1 -0
  10. package/dist/{PomodoroTimer-T6YAQFIE.js → PomodoroTimer-LN5MYRZO.js} +49 -49
  11. package/dist/{Preview-KEIDYSHF.js → Preview-CUOO5WQ7.js} +126 -126
  12. package/dist/Sidebar-T4ABK2WV.js +44 -0
  13. package/dist/{Spreadsheet-HKXSYD5B.js → Spreadsheet-2N2JXBCY.js} +14 -14
  14. package/dist/{Stock-BZFC2ROU.js → Stock-65WVUGLI.js} +4 -4
  15. package/dist/{Weather-S3N5OWYF.js → Weather-TXJICMJN.js} +18 -18
  16. package/dist/{WorldClock-ACC3S6OA.js → WorldClock-RIHLKZGC.js} +6 -6
  17. package/dist/apps/index.js +1 -1
  18. package/dist/bin/ui-check.js +1 -1
  19. package/dist/brand.css +1 -1
  20. package/dist/{chunk-WNEO7TSP.js → chunk-3PTA2C74.js} +1 -1
  21. package/dist/chunk-4QBLTEFU.js +1 -0
  22. package/dist/{chunk-TKUNR5KP.js → chunk-6GV4467L.js} +2 -2
  23. package/dist/chunk-AJB5G52B.js +1 -0
  24. package/dist/{chunk-2DX65GOO.js → chunk-ASSDCWKP.js} +1 -1
  25. package/dist/{chunk-MIAJQGWE.js → chunk-BFFXVA53.js} +1 -1
  26. package/dist/{chunk-R7EBJKN2.js → chunk-BFUBBDU6.js} +30 -30
  27. package/dist/{chunk-NHIGOEZF.js → chunk-H3UEYXRA.js} +1 -1
  28. package/dist/{chunk-ZDF5AR5W.js → chunk-HIAHERCD.js} +7 -7
  29. package/dist/{chunk-XUF7VW4U.js → chunk-JJIPGAXI.js} +29 -28
  30. package/dist/{chunk-T4CFSGSL.js → chunk-KHJ5XSEH.js} +8 -8
  31. package/dist/{chunk-KDRAU4XQ.js → chunk-M4OGNYOM.js} +8 -8
  32. package/dist/{chunk-P4SGJTK3.js → chunk-ML22KF7T.js} +1 -1
  33. package/dist/{chunk-ZZKIKW62.js → chunk-MTH7EAH3.js} +21 -21
  34. package/dist/{chunk-FOEVG7RT.js → chunk-OTP5WPI4.js} +8 -8
  35. package/dist/chunk-PS6PSCOR.js +1018 -0
  36. package/dist/{chunk-5IWSOLLY.js → chunk-QZNRMJE6.js} +2 -2
  37. package/dist/{chunk-VJP3R52B.js → chunk-R3622MOL.js} +1 -1
  38. package/dist/{chunk-PQLVWCUI.js → chunk-SSBOC52S.js} +4 -4
  39. package/dist/{chunk-3DGTIWZP.js → chunk-TKFAFZRY.js} +1 -1
  40. package/dist/{chunk-SBDIHKLU.js → chunk-TLTFS2D6.js} +51 -51
  41. package/dist/{chunk-GMMTTWHB.js → chunk-UAJQB45Y.js} +1 -1
  42. package/dist/{chunk-LK7V32MR.js → chunk-UG4ZPXXU.js} +1 -1
  43. package/dist/{chunk-QRV7RNQX.js → chunk-Y553QKEH.js} +14 -14
  44. package/dist/{chunk-PE4F4MJE.js → chunk-YJ6JMGMS.js} +4 -4
  45. package/dist/{chunk-LMIQV3NB.js → chunk-YQI7KXX3.js} +2 -2
  46. package/dist/file-intake/index.js +1 -1
  47. package/dist/i18n/index.d.ts +1 -1
  48. package/dist/{index-HMDUOPnX.d.ts → index-Dk5VKml6.d.ts} +401 -3
  49. package/dist/index.d.ts +3 -3
  50. package/dist/index.js +112 -112
  51. package/dist/locales/zh-Hans.d.ts +1 -1
  52. package/dist/locales/zh-Hans.js +1 -1
  53. package/dist/map/index.js +5 -5
  54. package/dist/markdown/index.js +1 -1
  55. package/dist/page-tabs/index.js +5 -5
  56. package/dist/pdf/index.js +1 -1
  57. package/dist/{strings-ZbotP_I6.d.ts → strings-aKfRDZWB.d.ts} +56 -0
  58. package/dist/ui/index.d.ts +2 -2
  59. package/dist/ui/index.js +1 -1
  60. package/dist/ui.css +63 -0
  61. package/package.json +1 -1
  62. package/dist/Calculator-4K53PFBL.js +0 -29
  63. package/dist/ConfirmDialog-X2DPOYWO.js +0 -1
  64. package/dist/Files-2VSFXA45.js +0 -87
  65. package/dist/PdfViewer-UZGDE4HD.js +0 -1
  66. package/dist/Sidebar-3NZRIL7F.js +0 -44
  67. package/dist/chunk-67PNFBCW.js +0 -993
  68. package/dist/chunk-J3LIIIHJ.js +0 -1
  69. package/dist/chunk-YKHMAGEM.js +0 -1
@@ -1,19 +1,19 @@
1
- import{escapeHtml as e}from"./chunk-BR22X7E5.js";import{useBrowserLayoutEffect as t}from"./chunk-D65T4H6J.js";import{useShellStrings as n}from"./chunk-J3LIIIHJ.js";import{useRef as r,useState as o,useEffect as l,useCallback as c,useMemo as a}from"react";import{createPortal as s}from"react-dom";import{jsxs as i,jsx as u,Fragment as d}from"react/jsx-runtime";function h(e,t){const n=e[e.length-1];return n&&!n.some(e=>e.trim())?e:[...e,Array(t).fill("")]}function w({text:t,...n}){const r=a(()=>({__html:e(t)}),[t]);/* @__PURE__ */
2
- return u("div",{...n,dangerouslySetInnerHTML:r})}function g({columns:e,data:g,onChange:m,onColumnsChange:f,fixedRows:p=!1,minRows:y=15,maxHeight:b="260px",cellStyles:v,onFocusChange:x,onSelectionChange:M}){const D=r(null),k=n().grid,[C,E]=o(null);l(()=>{x?.(C)},[C,x]);const[L,S]=o({}),$=r(null),[N,A]=o({}),z=r(null),[O,T]=o(null),[R,K]=o(null),[I,P]=o(null),[F,H]=o(null),[X,Y]=o(null),j=r(null);t(()=>{const e=j.current;if(!e||e.row!==X?.row||e.col!==X?.col)return;j.current=null;const t=D.current?.querySelector(`[data-row="${e.row}"][data-col="${e.col}"]`);if(!t)return;t.focus();const n=document.createRange();n.selectNodeContents(t),n.collapse(!1);const r=window.getSelection();r?.removeAllRanges(),r?.addRange(n)},[X]);const[q,B]=o(null),[W,J]=o(null);l(()=>{M?.(q&&W?{anchor:q,end:W}:null)},[q,W,M]);const _=r(!1),[U,V]=o(null),G=r(!1),Q=r({a:null,e:null});Q.current={a:q,e:W};const Z=q&&W&&(q.row!==W.row||q.col!==W.col),ee=[...g];if(!p)for(;ee.length<y;)ee.push(Array(e.length).fill(""));const te=c((t,n,r)=>{const o=ee.map(e=>[...e]);for(;o.length<=t;)o.push(Array(e.length).fill(""));for(;o[t].length<e.length;)o[t].push("");o[t][n]=r,m(o)},[ee,e.length,m]),ne=c((e,t,n)=>{if(0!==e.button)return;const r=document.activeElement;if(r?.dataset?.row&&r?.dataset?.col){const e=parseInt(r.dataset.row),t=parseInt(r.dataset.col),n=r.textContent||"";if(n!==(ee[e]?.[t]||"")){const r=ee.map(e=>[...e]);r[e]&&(r[e][t]=n,m(r))}}_.current=!0,e.shiftKey&&q||B({row:t,col:n}),J({row:t,col:n})},[ee,m,q]),re=c((e,t)=>{_.current&&J({row:e,col:t})},[]);l(()=>{const e=()=>{_.current=!1};return window.addEventListener("mouseup",e),()=>window.removeEventListener("mouseup",e)},[]),l(()=>{const e=e=>{if(!e.ctrlKey&&!e.metaKey||"c"!==e.key)return;if(!q||!W)return;const t=window.getSelection();if(t&&t.toString().length>0&&!Z)return;const n=Math.min(q.row,W.row),r=Math.max(q.row,W.row),o=Math.min(q.col,W.col),l=Math.max(q.col,W.col),c=[];for(let e=n;e<=r;e++){const t=[];for(let n=o;n<=l;n++)t.push(ee[e]?.[n]||"");c.push(t.join("\t"))}const a=c.join("\n");a&&(e.preventDefault(),navigator.clipboard.writeText(a))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[q,W,ee,Z]),l(()=>{const t=t=>{if(!C)return;const n=document.activeElement;if(n?.isContentEditable)return;if(!D.current?.contains(n))return;const r=t.clipboardData?.getData("text/plain");if(!r)return;t.preventDefault();const o=r.split("\n").filter(e=>e).map(e=>e.split("\t")),l=ee.map(e=>[...e]);for(let t=0;t<o.length;t++){const n=C.row+t;for(;l.length<=n;)l.push(Array(e.length).fill(""));for(;l[n].length<e.length;)l[n].push("");for(let r=0;r<o[t].length;r++){const c=C.col+r;if(c>=e.length)break;e[c].readOnly||(l[n][c]=o[t][r].trim())}}m(p?l:h(l,e.length)),B({row:C.row,col:C.col}),J({row:Math.min(C.row+o.length-1,l.length-1),col:Math.min(C.col+(o[0]?.length||1)-1,e.length-1)})};return window.addEventListener("paste",t),()=>window.removeEventListener("paste",t)},[C,ee,e,m,p]);const oe=c((t,n,r)=>{const o=t.clipboardData.getData("text/plain");if(!o)return;const l=o.split("\n").map(e=>e.split("\t"));if(l.length<=1&&l[0]?.length<=1)return;t.preventDefault();const c=ee.map(e=>[...e]);for(let t=0;t<l.length;t++){const o=n+t;for(;c.length<=o;)c.push(Array(e.length).fill(""));for(;c[o].length<e.length;)c[o].push("");for(let n=0;n<l[t].length;n++){const a=r+n;if(a>=e.length)break;e[a].readOnly||(c[o][a]=l[t][n].trim())}}m(p?c:h(c,e.length))},[ee,e,m,p]),le=c((t,n,r)=>{let o=n,l=r;if("Tab"===t.key)t.preventDefault(),l=t.shiftKey?r-1:r+1,l>=e.length&&(l=0,o=n+1),l<0&&(l=e.length-1,o=n-1);else if("Enter"===t.key)t.preventDefault(),o=t.shiftKey?n-1:n+1;else if("ArrowDown"===t.key)t.preventDefault(),o=n+1;else if("ArrowUp"===t.key)t.preventDefault(),o=n-1;else if("ArrowLeft"===t.key)t.preventDefault(),l=r-1;else{if("ArrowRight"!==t.key){if("Delete"===t.key||"Backspace"===t.key){const o=t.target;if(o.isContentEditable)return void(o.textContent&&window.getSelection()?.toString()===o.textContent&&(t.preventDefault(),te(n,r,"")));if(t.preventDefault(),q&&W){const t=Math.min(q.row,W.row),n=Math.max(q.row,W.row),r=Math.min(q.col,W.col),o=Math.max(q.col,W.col),l=ee.map(e=>[...e]);for(let c=t;c<=n;c++)for(let t=r;t<=o;t++)l[c]&&!e[t]?.readOnly&&(l[c][t]="");m(l)}else te(n,r,"");return}return}t.preventDefault(),l=r+1}for(;l>=0&&l<e.length&&e[l].readOnly;)l+="Tab"===t.key&&t.shiftKey?-1:1;if(o>=0&&o<ee.length&&l>=0&&l<e.length){const e=D.current?.querySelector(`[data-row="${o}"][data-col="${l}"]`);e&&(e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",inline:"nearest"}),E({row:o,col:l}),Y(null),B({row:o,col:l}),J({row:o,col:l}))}},[e,ee,ee.length,te,q,W,m]),ce=c(t=>{if(!p&&t>=ee.length-2){const t=ee.map(e=>[...e]);for(let n=0;n<5;n++)t.push(Array(e.length).fill(""));m(t)}},[p,ee,e.length,m]),[ae,se]=o(null);l(()=>{if(!ae)return;const e=()=>se(null);return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e)},[ae]);const ie=c(t=>{const n=ee.map(e=>[...e]);n.splice(t,0,Array(e.length).fill("")),m(n)},[ee,e.length,m]),ue=c(e=>{if(ee.length<=1)return;const t=ee.filter((t,n)=>n!==e);m(t)},[ee,m]),de=c(e=>{const t=ee.map(t=>{const n=[...t];return n.splice(e,0,""),n});m(t)},[ee,m]),he=c(t=>{if(e.length<=1)return;const n=ee.map(e=>{const n=[...e];return n.splice(t,1),n});m(n)},[ee,e.length,m]),we=c((e,t)=>{e.preventDefault(),p||se({x:e.clientX,y:e.clientY,items:[{label:k.insertRowAbove,onClick:()=>{ie(t),se(null)}},{label:k.insertRowBelow,onClick:()=>{ie(t+1),se(null)}},{label:k.deleteRow(t+1),onClick:()=>{ue(t),se(null)}}]})},[p,ie,ue,k]),ge=c((t,n)=>{t.preventDefault(),p||se({x:t.clientX,y:t.clientY,items:[{label:k.insertColumnLeft,onClick:()=>{de(n),se(null)}},{label:k.insertColumnRight,onClick:()=>{de(n+1),se(null)}},{label:k.deleteColumn(String(e[n]?.title||n+1)),onClick:()=>{he(n),se(null)}}]})},[p,e,de,he,k]),me=t=>L[t]??e[t]?.width??150;l(()=>{const t=e=>{if(!$.current)return;const t=e.clientX-$.current.startX,n=Math.max(40,$.current.startW+t);S(e=>({...e,[$.current.col]:n}))},n=()=>{if($.current&&f){const t=e.map((e,t)=>({...e,width:L[t]??e.width}));t[$.current.col]={...t[$.current.col],width:L[$.current.col]??e[$.current.col].width},f(t)}$.current=null,document.body.style.cursor=""};return window.addEventListener("mousemove",t),window.addEventListener("mouseup",n),()=>{window.removeEventListener("mousemove",t),window.removeEventListener("mouseup",n)}},[e,L,f]);const fe=e=>N[e]??28;l(()=>{const e=e=>{if(!z.current)return;const t=e.clientY-z.current.startY,n=Math.max(20,z.current.startH+t);A(e=>({...e,[z.current.row]:n}))},t=()=>{z.current=null,document.body.style.cursor=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[]);const pe=c(t=>{const n=document.createElement("canvas").getContext("2d");if(!n)return;n.font="12px ui-monospace, SFMono-Regular, Menlo, monospace";let r=0;for(const e of ee){const o=String(e[t]??"").replace(/<[^>]*>/g,""),l=n.measureText(o).width;l>r&&(r=l)}const o=n.measureText(e[t]?.title??"").width;o>r&&(r=o);const l=Math.max(40,Math.ceil(r+24));if(S(e=>({...e,[t]:l})),f){const n=e.map((e,n)=>({...e,width:n===t?l:L[n]??e.width}));f(n)}},[ee,e,L,f]),ye=c(e=>{A(t=>{const n={...t};return delete n[e],n})},[]),be=c(t=>{const{a:n,e:r}=Q.current;if(!n||!r)return;const o=Math.min(n.row,r.row),l=Math.max(n.row,r.row),c=Math.min(n.col,r.col),a=Math.max(n.col,r.col);let s=o,i=l,u=c,d=a;t.row>l?i=t.row:t.row<o&&(s=t.row),t.col>a?d=t.col:t.col<c&&(u=t.col);const h=l-o+1,w=a-c+1,g=ee.map(e=>[...e]);for(;g.length<=i;)g.push(Array(e.length).fill(""));for(const e of g)for(;e.length<=d;)e.push("");function f(e){const t=e.map(e=>parseFloat(e));if(t.length<2||t.some(e=>Number.isNaN(e)))return null;const n=t[1]-t[0];for(let e=2;e<t.length;e++)if(Math.abs(t[e]-t[e-1]-n)>1e-9)return null;return{step:n}}for(let e=s;e<=i;e++)for(let t=u;t<=d;t++){if(e>=o&&e<=l&&t>=c&&t<=a)continue;let n;if(1===w&&u===c&&d===a){const r=f(Array.from({length:h},(e,n)=>g[o+n]?.[t]??""));if(r){const c=parseFloat(g[l]?.[t]??"0"),a=parseFloat(g[o]?.[t]??"0"),s=e>l?e-l:-(o-e);n=String((e>l?c:a)+r.step*s)}else{const r=((e-o)%h+h)%h;n=g[o+r]?.[t]??""}}else if(1===h&&s===o&&i===l){const r=f(Array.from({length:w},(t,n)=>g[e]?.[c+n]??""));if(r){const o=parseFloat(g[e]?.[a]??"0"),l=parseFloat(g[e]?.[c]??"0"),s=t>a?t-a:-(c-t);n=String((t>a?o:l)+r.step*s)}else{const r=((t-c)%w+w)%w;n=g[e]?.[c+r]??""}}else{const r=((e-o)%h+h)%h,l=((t-c)%w+w)%w;n=g[o+r]?.[c+l]??""}g[e][t]=n}m(g),B({row:s,col:u}),J({row:i,col:d})},[ee,e.length,m]);l(()=>{const e=e=>{if(!G.current)return;const t=document.elementFromPoint(e.clientX,e.clientY),n=t?.closest?.("[data-row][data-col]");if(!n)return;const r=parseInt(n.dataset.row),o=parseInt(n.dataset.col);V({row:r,col:o})},t=()=>{G.current&&U&&be(U),G.current=!1,V(null),document.body.style.cursor=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[U,be]);const ve=e=>{e.preventDefault(),e.stopPropagation(),G.current=!0,document.body.style.cursor="crosshair"},xe=r(null),[Me,De]=o(0),[ke,Ce]=o(800);l(()=>{const e=xe.current;if(!e)return;const t=()=>Ce(e.clientHeight||800);t();const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);const Ee=ee.length>100,Le=Ee?Math.max(0,Math.floor(Me/28)-20):0,Se=Ee?Math.min(ee.length,Math.ceil((Me+ke)/28)+20):ee.length,$e=a(()=>ee.slice(Le,Se),[ee,Le,Se]),Ne=28*Le,Ae=28*(ee.length-Se),ze="px-2 py-1.5 text-left text-xs font-medium text-gray-500 uppercase bg-gray-100 border-b border-r border-gray-200 select-none";/* @__PURE__ */
1
+ import{escapeHtml as e}from"./chunk-BR22X7E5.js";import{useBrowserLayoutEffect as t}from"./chunk-D65T4H6J.js";import{useShellStrings as n}from"./chunk-AJB5G52B.js";import{useRef as r,useState as o,useEffect as l,useCallback as c,useMemo as a}from"react";import{createPortal as s}from"react-dom";import{jsxs as i,jsx as u,Fragment as d}from"react/jsx-runtime";function h(e,t){const n=e[e.length-1];return n&&!n.some(e=>e.trim())?e:[...e,Array(t).fill("")]}function w({text:t,...n}){const r=a(()=>({__html:e(t)}),[t]);/* @__PURE__ */
2
+ return u("div",{...n,dangerouslySetInnerHTML:r})}function g({columns:e,data:g,onChange:m,onColumnsChange:f,fixedRows:p=!1,minRows:y=15,maxHeight:b="260px",cellStyles:v,onFocusChange:x,onSelectionChange:M}){const D=r(null),k=n().grid,[C,E]=o(null);l(()=>{x?.(C)},[C,x]);const[L,S]=o({}),$=r(null),[A,N]=o({}),z=r(null),[O,T]=o(null),[R,K]=o(null),[P,F]=o(null),[I,X]=o(null),[H,Y]=o(null),j=r(null);t(()=>{const e=j.current;if(!e||e.row!==H?.row||e.col!==H?.col)return;j.current=null;const t=D.current?.querySelector(`[data-row="${e.row}"][data-col="${e.col}"]`);if(!t)return;t.focus();const n=document.createRange();n.selectNodeContents(t),n.collapse(!1);const r=window.getSelection();r?.removeAllRanges(),r?.addRange(n)},[H]);const[B,q]=o(null),[W,J]=o(null);l(()=>{M?.(B&&W?{anchor:B,end:W}:null)},[B,W,M]);const _=r(!1),[G,U]=o(null),V=r(!1),Q=r({a:null,e:null});Q.current={a:B,e:W};const Z=B&&W&&(B.row!==W.row||B.col!==W.col),ee=[...g];if(!p)for(;ee.length<y;)ee.push(Array(e.length).fill(""));const te=c((t,n,r)=>{const o=ee.map(e=>[...e]);for(;o.length<=t;)o.push(Array(e.length).fill(""));for(;o[t].length<e.length;)o[t].push("");o[t][n]=r,m(o)},[ee,e.length,m]),ne=c((e,t,n)=>{if(0!==e.button)return;const r=document.activeElement;if(r?.dataset?.row&&r?.dataset?.col){const e=parseInt(r.dataset.row),t=parseInt(r.dataset.col),n=r.textContent||"";if(n!==(ee[e]?.[t]||"")){const r=ee.map(e=>[...e]);r[e]&&(r[e][t]=n,m(r))}}_.current=!0,e.shiftKey&&B||q({row:t,col:n}),J({row:t,col:n})},[ee,m,B]),re=c((e,t)=>{_.current&&J({row:e,col:t})},[]);l(()=>{const e=()=>{_.current=!1};return window.addEventListener("mouseup",e),()=>window.removeEventListener("mouseup",e)},[]),l(()=>{const e=e=>{if(!e.ctrlKey&&!e.metaKey||"c"!==e.key)return;if(!B||!W)return;const t=window.getSelection();if(t&&t.toString().length>0&&!Z)return;const n=Math.min(B.row,W.row),r=Math.max(B.row,W.row),o=Math.min(B.col,W.col),l=Math.max(B.col,W.col),c=[];for(let e=n;e<=r;e++){const t=[];for(let n=o;n<=l;n++)t.push(ee[e]?.[n]||"");c.push(t.join("\t"))}const a=c.join("\n");a&&(e.preventDefault(),navigator.clipboard.writeText(a))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[B,W,ee,Z]),l(()=>{const t=t=>{if(!C)return;const n=document.activeElement;if(n?.isContentEditable)return;if(!D.current?.contains(n))return;const r=t.clipboardData?.getData("text/plain");if(!r)return;t.preventDefault();const o=r.split("\n").filter(e=>e).map(e=>e.split("\t")),l=ee.map(e=>[...e]);for(let t=0;t<o.length;t++){const n=C.row+t;for(;l.length<=n;)l.push(Array(e.length).fill(""));for(;l[n].length<e.length;)l[n].push("");for(let r=0;r<o[t].length;r++){const c=C.col+r;if(c>=e.length)break;e[c].readOnly||(l[n][c]=o[t][r].trim())}}m(p?l:h(l,e.length)),q({row:C.row,col:C.col}),J({row:Math.min(C.row+o.length-1,l.length-1),col:Math.min(C.col+(o[0]?.length||1)-1,e.length-1)})};return window.addEventListener("paste",t),()=>window.removeEventListener("paste",t)},[C,ee,e,m,p]);const oe=c((t,n,r)=>{const o=t.clipboardData.getData("text/plain");if(!o)return;const l=o.split("\n").map(e=>e.split("\t"));if(l.length<=1&&l[0]?.length<=1)return;t.preventDefault();const c=ee.map(e=>[...e]);for(let t=0;t<l.length;t++){const o=n+t;for(;c.length<=o;)c.push(Array(e.length).fill(""));for(;c[o].length<e.length;)c[o].push("");for(let n=0;n<l[t].length;n++){const a=r+n;if(a>=e.length)break;e[a].readOnly||(c[o][a]=l[t][n].trim())}}m(p?c:h(c,e.length))},[ee,e,m,p]),le=c((t,n,r)=>{let o=n,l=r;if("Tab"===t.key)t.preventDefault(),l=t.shiftKey?r-1:r+1,l>=e.length&&(l=0,o=n+1),l<0&&(l=e.length-1,o=n-1);else if("Enter"===t.key)t.preventDefault(),o=t.shiftKey?n-1:n+1;else if("ArrowDown"===t.key)t.preventDefault(),o=n+1;else if("ArrowUp"===t.key)t.preventDefault(),o=n-1;else if("ArrowLeft"===t.key)t.preventDefault(),l=r-1;else{if("ArrowRight"!==t.key){if("Delete"===t.key||"Backspace"===t.key){const o=t.target;if(o.isContentEditable)return void(o.textContent&&window.getSelection()?.toString()===o.textContent&&(t.preventDefault(),te(n,r,"")));if(t.preventDefault(),B&&W){const t=Math.min(B.row,W.row),n=Math.max(B.row,W.row),r=Math.min(B.col,W.col),o=Math.max(B.col,W.col),l=ee.map(e=>[...e]);for(let c=t;c<=n;c++)for(let t=r;t<=o;t++)l[c]&&!e[t]?.readOnly&&(l[c][t]="");m(l)}else te(n,r,"");return}return}t.preventDefault(),l=r+1}for(;l>=0&&l<e.length&&e[l].readOnly;)l+="Tab"===t.key&&t.shiftKey?-1:1;if(o>=0&&o<ee.length&&l>=0&&l<e.length){const e=D.current?.querySelector(`[data-row="${o}"][data-col="${l}"]`);e&&(e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",inline:"nearest"}),E({row:o,col:l}),Y(null),q({row:o,col:l}),J({row:o,col:l}))}},[e,ee,ee.length,te,B,W,m]),ce=c(t=>{if(!p&&t>=ee.length-2){const t=ee.map(e=>[...e]);for(let n=0;n<5;n++)t.push(Array(e.length).fill(""));m(t)}},[p,ee,e.length,m]),[ae,se]=o(null);l(()=>{if(!ae)return;const e=()=>se(null);return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e)},[ae]);const ie=c(t=>{const n=ee.map(e=>[...e]);n.splice(t,0,Array(e.length).fill("")),m(n)},[ee,e.length,m]),ue=c(e=>{if(ee.length<=1)return;const t=ee.filter((t,n)=>n!==e);m(t)},[ee,m]),de=c(e=>{const t=ee.map(t=>{const n=[...t];return n.splice(e,0,""),n});m(t)},[ee,m]),he=c(t=>{if(e.length<=1)return;const n=ee.map(e=>{const n=[...e];return n.splice(t,1),n});m(n)},[ee,e.length,m]),we=c((e,t)=>{e.preventDefault(),p||se({x:e.clientX,y:e.clientY,items:[{label:k.insertRowAbove,onClick:()=>{ie(t),se(null)}},{label:k.insertRowBelow,onClick:()=>{ie(t+1),se(null)}},{label:k.deleteRow(t+1),onClick:()=>{ue(t),se(null)}}]})},[p,ie,ue,k]),ge=c((t,n)=>{t.preventDefault(),p||se({x:t.clientX,y:t.clientY,items:[{label:k.insertColumnLeft,onClick:()=>{de(n),se(null)}},{label:k.insertColumnRight,onClick:()=>{de(n+1),se(null)}},{label:k.deleteColumn(String(e[n]?.title||n+1)),onClick:()=>{he(n),se(null)}}]})},[p,e,de,he,k]),me=t=>L[t]??e[t]?.width??150;l(()=>{const t=e=>{if(!$.current)return;const t=e.clientX-$.current.startX,n=Math.max(40,$.current.startW+t);S(e=>({...e,[$.current.col]:n}))},n=()=>{if($.current&&f){const t=e.map((e,t)=>({...e,width:L[t]??e.width}));t[$.current.col]={...t[$.current.col],width:L[$.current.col]??e[$.current.col].width},f(t)}$.current=null,document.body.style.cursor=""};return window.addEventListener("mousemove",t),window.addEventListener("mouseup",n),()=>{window.removeEventListener("mousemove",t),window.removeEventListener("mouseup",n)}},[e,L,f]);const fe=e=>A[e]??28;l(()=>{const e=e=>{if(!z.current)return;const t=e.clientY-z.current.startY,n=Math.max(20,z.current.startH+t);N(e=>({...e,[z.current.row]:n}))},t=()=>{z.current=null,document.body.style.cursor=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[]);const pe=c(t=>{const n=document.createElement("canvas").getContext("2d");if(!n)return;n.font="12px ui-monospace, SFMono-Regular, Menlo, monospace";let r=0;for(const e of ee){const o=String(e[t]??"").replace(/<[^>]*>/g,""),l=n.measureText(o).width;l>r&&(r=l)}const o=n.measureText(e[t]?.title??"").width;o>r&&(r=o);const l=Math.max(40,Math.ceil(r+24));if(S(e=>({...e,[t]:l})),f){const n=e.map((e,n)=>({...e,width:n===t?l:L[n]??e.width}));f(n)}},[ee,e,L,f]),ye=c(e=>{N(t=>{const n={...t};return delete n[e],n})},[]),be=c(t=>{const{a:n,e:r}=Q.current;if(!n||!r)return;const o=Math.min(n.row,r.row),l=Math.max(n.row,r.row),c=Math.min(n.col,r.col),a=Math.max(n.col,r.col);let s=o,i=l,u=c,d=a;t.row>l?i=t.row:t.row<o&&(s=t.row),t.col>a?d=t.col:t.col<c&&(u=t.col);const h=l-o+1,w=a-c+1,g=ee.map(e=>[...e]);for(;g.length<=i;)g.push(Array(e.length).fill(""));for(const e of g)for(;e.length<=d;)e.push("");function f(e){const t=e.map(e=>parseFloat(e));if(t.length<2||t.some(e=>Number.isNaN(e)))return null;const n=t[1]-t[0];for(let e=2;e<t.length;e++)if(Math.abs(t[e]-t[e-1]-n)>1e-9)return null;return{step:n}}for(let e=s;e<=i;e++)for(let t=u;t<=d;t++){if(e>=o&&e<=l&&t>=c&&t<=a)continue;let n;if(1===w&&u===c&&d===a){const r=f(Array.from({length:h},(e,n)=>g[o+n]?.[t]??""));if(r){const c=parseFloat(g[l]?.[t]??"0"),a=parseFloat(g[o]?.[t]??"0"),s=e>l?e-l:-(o-e);n=String((e>l?c:a)+r.step*s)}else{const r=((e-o)%h+h)%h;n=g[o+r]?.[t]??""}}else if(1===h&&s===o&&i===l){const r=f(Array.from({length:w},(t,n)=>g[e]?.[c+n]??""));if(r){const o=parseFloat(g[e]?.[a]??"0"),l=parseFloat(g[e]?.[c]??"0"),s=t>a?t-a:-(c-t);n=String((t>a?o:l)+r.step*s)}else{const r=((t-c)%w+w)%w;n=g[e]?.[c+r]??""}}else{const r=((e-o)%h+h)%h,l=((t-c)%w+w)%w;n=g[o+r]?.[c+l]??""}g[e][t]=n}m(g),q({row:s,col:u}),J({row:i,col:d})},[ee,e.length,m]);l(()=>{const e=e=>{if(!V.current)return;const t=document.elementFromPoint(e.clientX,e.clientY),n=t?.closest?.("[data-row][data-col]");if(!n)return;const r=parseInt(n.dataset.row),o=parseInt(n.dataset.col);U({row:r,col:o})},t=()=>{V.current&&G&&be(G),V.current=!1,U(null),document.body.style.cursor=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[G,be]);const ve=e=>{e.preventDefault(),e.stopPropagation(),V.current=!0,document.body.style.cursor="crosshair"},xe=r(null),[Me,De]=o(0),[ke,Ce]=o(800);l(()=>{const e=xe.current;if(!e)return;const t=()=>Ce(e.clientHeight||800);t();const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);const Ee=ee.length>100,Le=Ee?Math.max(0,Math.floor(Me/28)-20):0,Se=Ee?Math.min(ee.length,Math.ceil((Me+ke)/28)+20):ee.length,$e=a(()=>ee.slice(Le,Se),[ee,Le,Se]),Ae=28*Le,Ne=28*(ee.length-Se),ze="px-2 py-1.5 text-left text-xs font-medium text-gray-500 uppercase bg-gray-100 border-b border-r border-gray-200 select-none";/* @__PURE__ */
3
3
  return i("div",{ref:xe,className:"border border-gray-300 rounded overflow-scroll grid-scroll",style:{maxHeight:b,height:b},onScroll:e=>De(e.target.scrollTop),children:[
4
4
  /* @__PURE__ */i("table",{ref:D,className:"border-collapse select-none",style:{tableLayout:"fixed",minWidth:36+e.reduce((t,n)=>t+me(e.indexOf(n)),0)},children:[
5
5
  /* @__PURE__ */i("colgroup",{children:[
6
6
  /* @__PURE__ */u("col",{style:{width:36}}),e.map((e,t)=>/* @__PURE__ */u("col",{style:{width:me(t)}},e.key))]}),
7
7
  /* @__PURE__ */u("thead",{className:"sticky top-0 z-10",children:/* @__PURE__ */i("tr",{children:[
8
- /* @__PURE__ */u("th",{className:ze+" text-center w-9 cursor-pointer hover:bg-gray-200",onClick:()=>{B({row:0,col:0}),J({row:ee.length-1,col:e.length-1})},title:k.selectAll,children:"#"}),e.map((t,n)=>{const r=q&&W&&Math.min(q.col,W.col)<=n&&n<=Math.max(q.col,W.col)&&0===Math.min(q.row,W.row)&&Math.max(q.row,W.row)===ee.length-1;/* @__PURE__ */
9
- return i("th",{className:`${ze} cursor-pointer hover:bg-gray-200 relative${r?" !bg-blue-200":""}${F===n?" !bg-blue-100":""}`,style:{width:me(n)},draggable:!0,onDragStart:()=>(e=>P(e))(n),onDragOver:e=>((e,t)=>{e.preventDefault(),H(t)})(e,n),onDrop:()=>(t=>{if(null===I||I===t)return P(null),void H(null);const n=ee.map(e=>{const n=[...e],[r]=n.splice(I,1);return n.splice(t,0,r),n});if(m(n),f){const n=[...e],[r]=n.splice(I,1);n.splice(t,0,r),f(n)}P(null),H(null)})(n),onDragEnd:()=>{P(null),H(null)},onClick:e=>{e.shiftKey&&q||B({row:0,col:n}),J({row:ee.length-1,col:n})},onContextMenu:e=>ge(e,n),children:[t.title,
8
+ /* @__PURE__ */u("th",{className:ze+" text-center w-9 cursor-pointer hover:bg-gray-200",onClick:()=>{q({row:0,col:0}),J({row:ee.length-1,col:e.length-1})},title:k.selectAll,children:"#"}),e.map((t,n)=>{const r=B&&W&&Math.min(B.col,W.col)<=n&&n<=Math.max(B.col,W.col)&&0===Math.min(B.row,W.row)&&Math.max(B.row,W.row)===ee.length-1;/* @__PURE__ */
9
+ return i("th",{className:`${ze} cursor-pointer hover:bg-gray-200 relative${r?" !bg-blue-200":""}${I===n?" !bg-blue-100":""}`,style:{width:me(n)},draggable:!0,onDragStart:()=>(e=>F(e))(n),onDragOver:e=>((e,t)=>{e.preventDefault(),X(t)})(e,n),onDrop:()=>(t=>{if(null===P||P===t)return F(null),void X(null);const n=ee.map(e=>{const n=[...e],[r]=n.splice(P,1);return n.splice(t,0,r),n});if(m(n),f){const n=[...e],[r]=n.splice(P,1);n.splice(t,0,r),f(n)}F(null),X(null)})(n),onDragEnd:()=>{F(null),X(null)},onClick:e=>{e.shiftKey&&B||q({row:0,col:n}),J({row:ee.length-1,col:n})},onContextMenu:e=>ge(e,n),children:[t.title,
10
10
  /* @__PURE__ */u("div",{className:"absolute -right-1 top-0 bottom-0 w-2 cursor-col-resize z-20",onMouseDown:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),$.current={col:t,startX:e.clientX,startW:me(t)},document.body.style.cursor="col-resize"})(e,n),onDoubleClick:e=>{e.stopPropagation(),pe(n)},title:k.resize})]},t.key)})]})}),
11
- /* @__PURE__ */i("tbody",{children:[Ne>0&&/* @__PURE__ */u("tr",{style:{height:Ne}}),$e.map((t,n)=>{const r=Le+n,o=q&&W&&Math.min(q.row,W.row)<=r&&r<=Math.max(q.row,W.row)&&0===Math.min(q.col,W.col)&&Math.max(q.col,W.col)===e.length-1;/* @__PURE__ */
11
+ /* @__PURE__ */i("tbody",{children:[Ae>0&&/* @__PURE__ */u("tr",{style:{height:Ae}}),$e.map((t,n)=>{const r=Le+n,o=B&&W&&Math.min(B.row,W.row)<=r&&r<=Math.max(B.row,W.row)&&0===Math.min(B.col,W.col)&&Math.max(B.col,W.col)===e.length-1;/* @__PURE__ */
12
12
  return i("tr",{style:{height:fe(r)},children:[
13
- /* @__PURE__ */i("td",{className:`relative px-1 py-1 text-center text-[10px] text-gray-400 border-b border-r border-gray-200 bg-gray-50 select-none cursor-pointer hover:bg-gray-200${o?" !bg-blue-200 !text-gray-700":""}${R===r?" !bg-blue-100":""}`,draggable:!0,onDragStart:()=>(e=>T(e))(r),onDragOver:e=>((e,t)=>{e.preventDefault(),K(t)})(e,r),onDrop:()=>(e=>{if(null===O||O===e)return T(null),void K(null);const t=ee.map(e=>[...e]),[n]=t.splice(O,1);t.splice(e,0,n),m(t),T(null),K(null)})(r),onDragEnd:()=>{T(null),K(null)},onClick:t=>{t.shiftKey&&q||B({row:r,col:0}),J({row:r,col:e.length-1})},onContextMenu:e=>we(e,r),children:[r+1,
14
- /* @__PURE__ */u("div",{className:"absolute -bottom-1 left-0 right-0 h-2 cursor-row-resize z-20",onMouseDown:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),z.current={row:t,startY:e.clientY,startH:fe(t)},document.body.style.cursor="row-resize"})(e,r),onDoubleClick:e=>{e.stopPropagation(),ye(r)},title:k.resize})]}),e.map((e,n)=>{const o=q&&W&&function(e,t,n,r){const o=Math.min(e.row,t.row),l=Math.max(e.row,t.row),c=Math.min(e.col,t.col),a=Math.max(e.col,t.col);return n>=o&&n<=l&&r>=c&&r<=a}(q,W,r,n),l=X?.row===r&&X?.col===n&&!e.readOnly,c=C?.row===r&&C?.col===n,a=v?.[`${r}:${n}`],s=q&&W?Math.max(q.row,W.row):-1,d=q&&W?Math.max(q.col,W.col):-1,h=q&&W&&r===s&&n===d,g=G.current&&U&&q&&W&&(()=>{const e=Math.min(q.row,W.row),t=Math.max(q.row,W.row),o=Math.min(q.col,W.col),l=Math.max(q.col,W.col);let c=e,a=t,s=o,i=l;return U.row>t?a=U.row:U.row<e&&(c=U.row),U.col>l?i=U.col:U.col<o&&(s=U.col),r>=c&&r<=a&&n>=s&&n<=i&&!(r>=e&&r<=t&&n>=o&&n<=l)})(),m="sm"===a?.fontSize?"text-[11px]":"lg"===a?.fontSize?"text-sm":"xl"===a?.fontSize?"text-base":"text-xs",f=`${a?.bold?" font-bold":""}${a?.italic?" italic":""}${a?.underline?" underline":""}`;/* @__PURE__ */
13
+ /* @__PURE__ */i("td",{className:`relative px-1 py-1 text-center text-[10px] text-gray-400 border-b border-r border-gray-200 bg-gray-50 select-none cursor-pointer hover:bg-gray-200${o?" !bg-blue-200 !text-gray-700":""}${R===r?" !bg-blue-100":""}`,draggable:!0,onDragStart:()=>(e=>T(e))(r),onDragOver:e=>((e,t)=>{e.preventDefault(),K(t)})(e,r),onDrop:()=>(e=>{if(null===O||O===e)return T(null),void K(null);const t=ee.map(e=>[...e]),[n]=t.splice(O,1);t.splice(e,0,n),m(t),T(null),K(null)})(r),onDragEnd:()=>{T(null),K(null)},onClick:t=>{t.shiftKey&&B||q({row:r,col:0}),J({row:r,col:e.length-1})},onContextMenu:e=>we(e,r),children:[r+1,
14
+ /* @__PURE__ */u("div",{className:"absolute -bottom-1 left-0 right-0 h-2 cursor-row-resize z-20",onMouseDown:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),z.current={row:t,startY:e.clientY,startH:fe(t)},document.body.style.cursor="row-resize"})(e,r),onDoubleClick:e=>{e.stopPropagation(),ye(r)},title:k.resize})]}),e.map((e,n)=>{const o=B&&W&&function(e,t,n,r){const o=Math.min(e.row,t.row),l=Math.max(e.row,t.row),c=Math.min(e.col,t.col),a=Math.max(e.col,t.col);return n>=o&&n<=l&&r>=c&&r<=a}(B,W,r,n),l=H?.row===r&&H?.col===n&&!e.readOnly,c=C?.row===r&&C?.col===n,a=v?.[`${r}:${n}`],s=B&&W?Math.max(B.row,W.row):-1,d=B&&W?Math.max(B.col,W.col):-1,h=B&&W&&r===s&&n===d,g=V.current&&G&&B&&W&&(()=>{const e=Math.min(B.row,W.row),t=Math.max(B.row,W.row),o=Math.min(B.col,W.col),l=Math.max(B.col,W.col);let c=e,a=t,s=o,i=l;return G.row>t?a=G.row:G.row<e&&(c=G.row),G.col>l?i=G.col:G.col<o&&(s=G.col),r>=c&&r<=a&&n>=s&&n<=i&&!(r>=e&&r<=t&&n>=o&&n<=l)})(),m="sm"===a?.fontSize?"text-[11px]":"lg"===a?.fontSize?"text-sm":"xl"===a?.fontSize?"text-base":"text-xs",f=`${a?.bold?" font-bold":""}${a?.italic?" italic":""}${a?.underline?" underline":""}`;/* @__PURE__ */
15
15
  return i("td",{className:`relative px-0 py-0 border-b border-r border-gray-200 text-sm${e.readOnly?" bg-gray-50 text-gray-500 cursor-default":" cursor-cell"}${o?" !bg-blue-100":""}${c&&!o?" ring-2 ring-inset ring-blue-400":""}${g?" !bg-blue-50 ring-1 ring-inset ring-blue-300":""}`,onMouseDown:e=>{if(e.target===e.currentTarget){ne(e,r,n);const t=e.currentTarget.querySelector("[data-row][data-col]");t?.focus()}},onMouseEnter:()=>re(r,n),onClick:e=>{if(e.target===e.currentTarget){const t=e.currentTarget.querySelector("[data-row][data-col]");t?.focus()}},onDoubleClick:t=>{t.target!==t.currentTarget||e.readOnly||Y({row:r,col:n})},children:[
16
- /* @__PURE__ */u(w,{contentEditable:l,suppressContentEditableWarning:!0,tabIndex:0,"data-row":r,"data-col":n,className:`w-full h-full px-2 py-1 rosh-focus-ring whitespace-nowrap overflow-hidden ${"right"===e.align?"text-right":"center"===e.align?"text-center":""} ${e.readOnly?"cursor-default":"cursor-cell"} font-mono ${m}${f}`,onMouseDown:e=>ne(e,r,n),onMouseEnter:()=>re(r,n),onDoubleClick:()=>{e.readOnly||Y({row:r,col:n})},onFocus:()=>{E({row:r,col:n}),_.current||(B({row:r,col:n}),J({row:r,col:n}))},onBlur:e=>{const o=e.currentTarget.textContent||"";o!==(t[n]||"")&&te(r,n,o),Y(null)},onInput:()=>ce(r),onPaste:e=>oe(e,r,n),onKeyDown:t=>{if(!(l||e.readOnly||1!==t.key.length||t.ctrlKey||t.metaKey||t.altKey))return t.preventDefault(),te(r,n,t.key),j.current={row:r,col:n},void Y({row:r,col:n});le(t,r,n)},text:t[n]||""}),h&&/* @__PURE__ */u("div",{onMouseDown:ve,title:k.fill,className:"absolute -bottom-[3px] -right-[3px] w-[7px] h-[7px] bg-blue-500 border border-white cursor-crosshair z-30 hover:bg-blue-600"})]},n)})]},r)}),Ae>0&&/* @__PURE__ */u("tr",{style:{height:Ae}})]})]}),ae&&s(
16
+ /* @__PURE__ */u(w,{contentEditable:l,suppressContentEditableWarning:!0,tabIndex:0,"data-row":r,"data-col":n,className:`w-full h-full px-2 py-1 rosh-focus-ring whitespace-nowrap overflow-hidden ${"right"===e.align?"text-right":"center"===e.align?"text-center":""} ${e.readOnly?"cursor-default":"cursor-cell"} font-mono ${m}${f}`,onMouseDown:e=>ne(e,r,n),onMouseEnter:()=>re(r,n),onDoubleClick:()=>{e.readOnly||Y({row:r,col:n})},onFocus:()=>{E({row:r,col:n}),_.current||(q({row:r,col:n}),J({row:r,col:n}))},onBlur:e=>{const o=e.currentTarget.textContent||"";o!==(t[n]||"")&&te(r,n,o),Y(null)},onInput:()=>ce(r),onPaste:e=>oe(e,r,n),onKeyDown:t=>{if(!(l||e.readOnly||1!==t.key.length||t.ctrlKey||t.metaKey||t.altKey))return t.preventDefault(),te(r,n,t.key),j.current={row:r,col:n},void Y({row:r,col:n});le(t,r,n)},text:t[n]||""}),h&&/* @__PURE__ */u("div",{onMouseDown:ve,title:k.fill,className:"absolute -bottom-[3px] -right-[3px] w-[7px] h-[7px] bg-blue-500 border border-white cursor-crosshair z-30 hover:bg-blue-600"})]},n)})]},r)}),Ne>0&&/* @__PURE__ */u("tr",{style:{height:Ne}})]})]}),ae&&s(
17
17
  /* @__PURE__ */i(d,{children:[
18
18
  /* @__PURE__ */u("div",{className:"fixed inset-0 z-[200]",onPointerDown:()=>se(null)}),
19
19
  /* @__PURE__ */u("div",{className:"fixed z-[201] bg-white rounded-lg shadow-lg border border-gray-200 py-1 min-w-[160px]",style:{left:ae.x,top:ae.y},children:ae.items.map((e,t)=>/* @__PURE__ */u("button",{onPointerDown:t=>{t.stopPropagation(),e.onClick()},className:"w-full text-left px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-100",children:e.label},t))})]}),document.body)]})}export{g as EditableGrid,h as withSpareRow};
@@ -1,27 +1,27 @@
1
- import{navVisible as e,isReachable as t,visibleChildren as n,isSection as r}from"./chunk-5A7MWTXX.js";import{useDismissPopupsOnOpen as a}from"./chunk-AFYQTVZO.js";import{glassStyle as l}from"./chunk-HZZNJHRH.js";import{Z_LAYERS as o}from"./chunk-X4FJ54PP.js";import{useShellStrings as s}from"./chunk-J3LIIIHJ.js";import{useState as i,useEffect as c,useRef as d,useMemo as u,useId as p,useCallback as y}from"react";import{jsx as f,jsxs as m}from"react/jsx-runtime";import{createPortal as h}from"react-dom";var b={favicon:"h-8 w-8",compact:"h-10 w-10",wordmark:"h-10 w-40"};function g(e){return e.trim().charAt(0).toLocaleUpperCase()||"·"}function x(e,t,n){return!1===e?"framed":null==e||null==t?"plate-light":t?"light"===n?"plate-dark":"bare":"dark"===n?"plate-light":"bare"}var k={"plate-light":"bg-white shadow-[0_2px_12px_var(--rosh-mark-plate-shadow)]","plate-dark":"bg-neutral-900 shadow-[0_2px_12px_var(--rosh-mark-plate-shadow-strong)]",framed:"border border-black/10 shadow-[0_2px_12px_var(--rosh-mark-plate-shadow)]",bare:""};function v(e,t,n){return"bare"===e?{}:"framed"===e?{borderRadius:t}:{borderRadius:t,padding:n}}function w({src:e,fallbackSrc:t,fallbackHasAlpha:n=null,fallbackIsLight:r=null,fallbackAdaptive:a,alt:l,slot:o="compact",surface:s="light",size:d,width:u,height:p,decorative:y=!1,fallbackMode:m="monogram",adaptive:h=!1,hasAlpha:w=null,isLight:N=null,treatmentPadding:L=4,treatmentRadius:_=8,className:A="",style:C}){const[$,I]=i(e||t||"");c(()=>{I(e||t||"")},[e,t]);const T=Boolean(t&&$===t&&$!==e),E=(T?a??h:h)?x(T?n:w,T?r:N,s):"bare",j=["inline-flex shrink-0 items-center justify-center overflow-hidden",null==d&&null==u&&null==p?b[o]:"","dark"===s?"text-white":"text-gray-700",k[E],A].filter(Boolean).join(" "),S={...v(E,_,L),...null==d?{width:u,height:p}:{width:d,height:d},...C};return $?/* @__PURE__ */f("span",{className:j,"data-brand-treatment":E,style:S,children:/* @__PURE__ */f("img",{src:$,alt:y?"":l,"data-brand-slot":o,className:"block max-h-full max-w-full",style:{objectFit:"contain"},onError:()=>I(e=>t&&e!==t?t:"")})}):"none"===m?null:/* @__PURE__ */f("span",{"data-brand-fallback":!0,"data-brand-slot":o,"aria-label":y?void 0:l,"aria-hidden":y||void 0,role:y?void 0:"img",className:`${j} rounded-md bg-gray-100 font-semibold`,style:S,children:y?null:g(l)})}function N(n,r){return e(n,r)?n.items.filter(n=>e(n,r)&&t(n,r)):[]}function L(e,r){return n(e,r).filter(e=>t(e,r))}function _(n,a,l){const o=new Set(a.erp),s=new Set(a.system),i=new Set(a.footer??[]),c=n.filter(r),d=e=>c.filter(t=>e.has(t.label)&&N(t,l).length>0);return{topItems:n.filter(e=>!r(e)).filter(n=>e(n,l)&&t(n,l)),erpSections:d(o),systemSections:d(s),virtualSections:(a.virtual??[]).filter(e=>e.items.length>0),footerSections:d(i),footerItems:(a.footerItems??[]).filter(n=>e(n,l)&&t(n,l))}}function A(e,t,n){return!!t&&e.some(e=>e.to===t||A(L(e,n),t,n))}var C="__page__";function $(e){const t=e.indexOf("?");if(t<0)return{path:e,search:""};const n=new URLSearchParams(e.slice(t+1));return{path:e.slice(0,t),search:n.get("search")??""}}function I(e,t,n){const r=function(e,t){const n=[],r=e=>{const a=L(e,t);0===a.length?n.push(e):a.forEach(r)};e.topItems.forEach(r);for(const n of[...e.erpSections,...e.systemSections,...e.footerSections])N(n,t).forEach(r);for(const t of e.virtualSections)t.items.forEach(r);return e.footerItems.forEach(r),n}(e,t);return Object.assign(async e=>{const t=e.trim().toLowerCase();if(!t)return[];const a=/* @__PURE__ */new Set,l=[];for(const e of r){const r=e.menuLabel??e.label;a.has(e.to)||!e.label.toLowerCase().includes(t)&&!r.toLowerCase().includes(t)||(a.add(e.to),l.push({type:n,label:e.label,entity_type:C,entity_id:e.to}))}return l.slice(0,8)},{destinations:r})}function T(e,t){if(!Array.isArray(e))return[];const n=[];for(const r of e){if(!r||"string"!=typeof r.entityType||"string"!=typeof r.entityId||"string"!=typeof r.label)continue;if("preview-file"===r.entityType)continue;const e="page"===r.entityType;n.push({type:e?t:"",label:r.label,entity_type:e?C:r.entityType,entity_id:r.entityId})}return n}var E="M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z";function j(e){return e.typeKey??e.type}function S(e,t){return t?.[j(e)]??e.type}function M(e,t,n){return 0===n.length?null:{key:e,title:t,rows:n.map((e,t)=>({kind:"action",key:`action:${t}:${e.label}`,label:e.label,icon:e.icon,action:e})),count:n.length}}function R(e,t,n,r){return{type:e,label:t,entity_type:C,entity_id:`${n}?search=${encodeURIComponent(r.trim())}`}}function K(e,t,n,r,a){const l=function(e){const t=/* @__PURE__ */new Map;for(const n of e){const e=j(n),r=t.get(e);r?r.results.push(n):t.set(e,{type:n.type,results:[n]})}return Array.from(t,([e,t])=>({key:e,...t}))}(e).map(e=>{const t=e.results.map((t,n)=>({kind:"result",key:`result:${e.key}:${t.entity_type}:${t.entity_id}:${n}`,label:t.label,sub:t.sub,result:t})),r=!!a?.truncatedTypes?.includes(e.key),l=r?a?.listRoutes?.[e.key]:void 0,o=a?.typeLabels?.[e.key]??e.type;if(a&&l){const r=a.seeAllLabel(l.label);t.push({kind:"seeAll",key:`seeall:${e.key}`,label:r,result:R(o,r,l.path,n)})}return{key:`type:${e.key}`,title:o,rows:t,count:e.results.length,truncated:r}}),o=M("actions",r,function(e,t){const n=t.trim().toLowerCase();return e&&n?e.filter(e=>e.label.toLowerCase().includes(n)||(e.keywords??[]).some(e=>e.toLowerCase().includes(n))):[]}(t,n));return o?[...l,o]:l}function D(e,t,n){return 0===n?0:Math.min(Math.max(e+t,0),n-1)}var H=(e,t)=>e.entity_type===t.entity_type&&e.entity_id===t.entity_id;function P(e,t,n=8){return[t,...e.filter(e=>!H(e,t))].slice(0,n)}function B(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(!n||"object"!=typeof n)continue;const e=n;if("string"!=typeof e.type||"string"!=typeof e.label||"string"!=typeof e.entity_type||"string"!=typeof e.entity_id)continue;const r={type:e.type,label:e.label,entity_type:e.entity_type,entity_id:e.entity_id};"string"==typeof e.sub&&(r.sub=e.sub),"string"==typeof e.typeKey&&(r.typeKey=e.typeKey),t.some(e=>H(e,r))||t.push(r)}return t.slice(0,8)}function z(e){if(Array.isArray(e))return{results:e,truncatedTypes:[]};if(e&&"object"==typeof e&&Array.isArray(e.results)){const{results:t,truncatedTypes:n}=e;return{results:t,truncatedTypes:Array.isArray(n)?n:[]}}return{results:[],truncatedTypes:[]}}var F=[];function J(e,t,n){const[r,a]=i([]),[l,o]=i(F),[s,u]=i(!1),[p,f]=i("none"),m=d(function(){let e=0,t=null;const n=()=>{e+=1,t?.abort(),t=null};return{begin:()=>{n();const r=e,a=new AbortController;return t=a,{signal:a.signal,isCurrent:()=>r===e}},cancel:n}}());c(()=>{const r=m.current;if(e.length<n||!t||0===t.length)return r.cancel(),a(e=>0===e.length?e:[]),o(F),f("none"),void u(!1);u(!0);const l=setTimeout(async()=>{const n=r.begin(),l=await async function(e,t,n){const r=await Promise.all(e.map(async e=>{try{return{failed:!1,...z(await e(t,{signal:n}))}}catch(e){const t=n.aborted||function(e){if(!e||"object"!=typeof e)return!1;const{name:t,code:n}=e;return"AbortError"===t||"CanceledError"===t||"ERR_CANCELED"===n}(e);return{failed:!t,results:[],truncatedTypes:[]}}}));return{results:r.flatMap(e=>e.results),truncatedTypes:Array.from(new Set(r.flatMap(e=>e.truncatedTypes))),failed:r.filter(e=>e.failed).length}}(t,e,n.signal);n.isCurrent()&&(a(l.results),o(l.truncatedTypes),f(0===l.failed?"none":l.failed>=t.length?"all":"some"),u(!1))},250);return()=>{clearTimeout(l),r.cancel()}},[e,t,n]);return{results:r,truncatedTypes:l,loading:s,failure:p,reset:y(()=>{m.current.cancel(),a(e=>0===e.length?e:[]),o(F),f("none"),u(!1)},[])}}var U=(e,t)=>`${e}-opt-${t}`;function O(e,t){if("seeAll"===e.kind)return"M13.5 4.5L21 12m0 0l-7.5 7.5M21 12H3";if("action"===e.kind)return e.icon??E;if(e.icon)return e.icon;const n=t?.[j(e.result)];return n||E}function W({sections:e,activeIdx:t,listId:n,label:r,typeIcons:a,groupCount:l,groupLabel:o,onHover:s,onPick:i}){let c=0;/* @__PURE__ */
1
+ import{navVisible as e,isReachable as t,visibleChildren as n,isSection as r}from"./chunk-5A7MWTXX.js";import{useDismissPopupsOnOpen as a}from"./chunk-AFYQTVZO.js";import{glassStyle as l}from"./chunk-HZZNJHRH.js";import{Z_LAYERS as o}from"./chunk-X4FJ54PP.js";import{useShellStrings as s}from"./chunk-AJB5G52B.js";import{useState as i,useEffect as c,useRef as d,useMemo as u,useId as p,useCallback as y}from"react";import{jsx as f,jsxs as m}from"react/jsx-runtime";import{createPortal as h}from"react-dom";var b={favicon:"h-8 w-8",compact:"h-10 w-10",wordmark:"h-10 w-40"};function g(e){return e.trim().charAt(0).toLocaleUpperCase()||"·"}function x(e,t,n){return!1===e?"framed":null==e||null==t?"plate-light":t?"light"===n?"plate-dark":"bare":"dark"===n?"plate-light":"bare"}var k={"plate-light":"bg-white shadow-[0_2px_12px_var(--rosh-mark-plate-shadow)]","plate-dark":"bg-neutral-900 shadow-[0_2px_12px_var(--rosh-mark-plate-shadow-strong)]",framed:"border border-black/10 shadow-[0_2px_12px_var(--rosh-mark-plate-shadow)]",bare:""};function v(e,t,n){return"bare"===e?{}:"framed"===e?{borderRadius:t}:{borderRadius:t,padding:n}}function w({src:e,fallbackSrc:t,fallbackHasAlpha:n=null,fallbackIsLight:r=null,fallbackAdaptive:a,alt:l,slot:o="compact",surface:s="light",size:d,width:u,height:p,decorative:y=!1,fallbackMode:m="monogram",adaptive:h=!1,hasAlpha:w=null,isLight:N=null,treatmentPadding:_=4,treatmentRadius:L=8,className:A="",style:C}){const[$,T]=i(e||t||"");c(()=>{T(e||t||"")},[e,t]);const E=Boolean(t&&$===t&&$!==e),I=(E?a??h:h)?x(E?n:w,E?r:N,s):"bare",j=["inline-flex shrink-0 items-center justify-center overflow-hidden",null==d&&null==u&&null==p?b[o]:"","dark"===s?"text-white":"text-gray-700",k[I],A].filter(Boolean).join(" "),S={...v(I,L,_),...null==d?{width:u,height:p}:{width:d,height:d},...C};return $?/* @__PURE__ */f("span",{className:j,"data-brand-treatment":I,style:S,children:/* @__PURE__ */f("img",{src:$,alt:y?"":l,"data-brand-slot":o,className:"block max-h-full max-w-full",style:{objectFit:"contain"},onError:()=>T(e=>t&&e!==t?t:"")})}):"none"===m?null:/* @__PURE__ */f("span",{"data-brand-fallback":!0,"data-brand-slot":o,"aria-label":y?void 0:l,"aria-hidden":y||void 0,role:y?void 0:"img",className:`${j} rounded-md bg-gray-100 font-semibold`,style:S,children:y?null:g(l)})}function N(n,r){return e(n,r)?n.items.filter(n=>e(n,r)&&t(n,r)):[]}function _(e,r){return n(e,r).filter(e=>t(e,r))}function L(n,a,l){const o=new Set(a.erp),s=new Set(a.system),i=new Set(a.footer??[]),c=n.filter(r),d=e=>c.filter(t=>e.has(t.label)&&N(t,l).length>0);return{topItems:n.filter(e=>!r(e)).filter(n=>e(n,l)&&t(n,l)),erpSections:d(o),systemSections:d(s),virtualSections:(a.virtual??[]).filter(e=>e.items.length>0),footerSections:d(i),footerItems:(a.footerItems??[]).filter(n=>e(n,l)&&t(n,l))}}function A(e,t,n){return!!t&&e.some(e=>e.to===t||A(_(e,n),t,n))}var C="__page__";function $(e){const t=e.indexOf("?");if(t<0)return{path:e,search:""};const n=new URLSearchParams(e.slice(t+1));return{path:e.slice(0,t),search:n.get("search")??""}}function T(e,t,n){const r=function(e,t){const n=[],r=e=>{const a=_(e,t);0===a.length?n.push(e):a.forEach(r)};e.topItems.forEach(r);for(const n of[...e.erpSections,...e.systemSections,...e.footerSections])N(n,t).forEach(r);for(const t of e.virtualSections)t.items.forEach(r);return e.footerItems.forEach(r),n}(e,t);return Object.assign(async e=>{const t=e.trim().toLowerCase();if(!t)return[];const a=/* @__PURE__ */new Set,l=[];for(const e of r){const r=e.menuLabel??e.label;a.has(e.to)||!e.label.toLowerCase().includes(t)&&!r.toLowerCase().includes(t)||(a.add(e.to),l.push({type:n,label:e.label,entity_type:C,entity_id:e.to}))}return l.slice(0,8)},{destinations:r})}function E(e,t){if(!Array.isArray(e))return[];const n=[];for(const r of e){if(!r||"string"!=typeof r.entityType||"string"!=typeof r.entityId||"string"!=typeof r.label)continue;if("preview-file"===r.entityType)continue;const e="page"===r.entityType;n.push({type:e?t:"",label:r.label,entity_type:e?C:r.entityType,entity_id:r.entityId})}return n}var I="M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z";function j(e){return e.typeKey??e.type}function S(e,t){return t?.[j(e)]??e.type}function M(e,t,n){return 0===n.length?null:{key:e,title:t,rows:n.map((e,t)=>({kind:"action",key:`action:${t}:${e.label}`,label:e.label,icon:e.icon,action:e})),count:n.length}}function R(e,t,n,r){return{type:e,label:t,entity_type:C,entity_id:`${n}?search=${encodeURIComponent(r.trim())}`}}function K(e,t,n,r,a){const l=function(e){const t=/* @__PURE__ */new Map;for(const n of e){const e=j(n),r=t.get(e);r?r.results.push(n):t.set(e,{type:n.type,results:[n]})}return Array.from(t,([e,t])=>({key:e,...t}))}(e).map(e=>{const t=e.results.map((t,n)=>({kind:"result",key:`result:${e.key}:${t.entity_type}:${t.entity_id}:${n}`,label:t.label,sub:t.sub,result:t})),r=!!a?.truncatedTypes?.includes(e.key),l=r?a?.listRoutes?.[e.key]:void 0,o=a?.typeLabels?.[e.key]??e.type;if(a&&l){const r=a.seeAllLabel(l.label);t.push({kind:"seeAll",key:`seeall:${e.key}`,label:r,result:R(o,r,l.path,n)})}return{key:`type:${e.key}`,title:o,rows:t,count:e.results.length,truncated:r}}),o=M("actions",r,function(e,t){const n=t.trim().toLowerCase();return e&&n?e.filter(e=>e.label.toLowerCase().includes(n)||(e.keywords??[]).some(e=>e.toLowerCase().includes(n))):[]}(t,n));return o?[...l,o]:l}function D(e,t,n){return 0===n?0:Math.min(Math.max(e+t,0),n-1)}var B=(e,t)=>e.entity_type===t.entity_type&&e.entity_id===t.entity_id;function P(e,t,n=8){return[t,...e.filter(e=>!B(e,t))].slice(0,n)}function H(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(!n||"object"!=typeof n)continue;const e=n;if("string"!=typeof e.type||"string"!=typeof e.label||"string"!=typeof e.entity_type||"string"!=typeof e.entity_id)continue;const r={type:e.type,label:e.label,entity_type:e.entity_type,entity_id:e.entity_id};"string"==typeof e.sub&&(r.sub=e.sub),"string"==typeof e.typeKey&&(r.typeKey=e.typeKey),t.some(e=>B(e,r))||t.push(r)}return t.slice(0,8)}function z(e){if(Array.isArray(e))return{results:e,truncatedTypes:[]};if(e&&"object"==typeof e&&Array.isArray(e.results)){const{results:t,truncatedTypes:n}=e;return{results:t,truncatedTypes:Array.isArray(n)?n:[]}}return{results:[],truncatedTypes:[]}}var F=[];function U(e,t,n){const[r,a]=i([]),[l,o]=i(F),[s,u]=i(!1),[p,f]=i("none"),m=d(function(){let e=0,t=null;const n=()=>{e+=1,t?.abort(),t=null};return{begin:()=>{n();const r=e,a=new AbortController;return t=a,{signal:a.signal,isCurrent:()=>r===e}},cancel:n}}());c(()=>{const r=m.current;if(e.length<n||!t||0===t.length)return r.cancel(),a(e=>0===e.length?e:[]),o(F),f("none"),void u(!1);u(!0);const l=setTimeout(async()=>{const n=r.begin(),l=await async function(e,t,n){const r=await Promise.all(e.map(async e=>{try{return{failed:!1,...z(await e(t,{signal:n}))}}catch(e){const t=n.aborted||function(e){if(!e||"object"!=typeof e)return!1;const{name:t,code:n}=e;return"AbortError"===t||"CanceledError"===t||"ERR_CANCELED"===n}(e);return{failed:!t,results:[],truncatedTypes:[]}}}));return{results:r.flatMap(e=>e.results),truncatedTypes:Array.from(new Set(r.flatMap(e=>e.truncatedTypes))),failed:r.filter(e=>e.failed).length}}(t,e,n.signal);n.isCurrent()&&(a(l.results),o(l.truncatedTypes),f(0===l.failed?"none":l.failed>=t.length?"all":"some"),u(!1))},250);return()=>{clearTimeout(l),r.cancel()}},[e,t,n]);return{results:r,truncatedTypes:l,loading:s,failure:p,reset:y(()=>{m.current.cancel(),a(e=>0===e.length?e:[]),o(F),f("none"),u(!1)},[])}}var J=(e,t)=>`${e}-opt-${t}`;function O(e,t){if("seeAll"===e.kind)return"M13.5 4.5L21 12m0 0l-7.5 7.5M21 12H3";if("action"===e.kind)return e.icon??I;if(e.icon)return e.icon;const n=t?.[j(e.result)];return n||I}function W({sections:e,activeIdx:t,listId:n,label:r,typeIcons:a,groupCount:l,groupLabel:o,onHover:s,onPick:i}){let c=0;/* @__PURE__ */
2
2
  return f("div",{id:n,role:"listbox","aria-label":r,className:"py-1",children:e.map(e=>/* @__PURE__ */m("div",{role:"group","aria-label":o(e.title,e.count,!!e.truncated),children:[
3
3
  /* @__PURE__ */m("div",{"aria-hidden":"true",className:"flex items-center justify-between px-4 pt-2 pb-1 text-[11px] font-semibold uppercase tracking-wide text-gray-400",children:[
4
4
  /* @__PURE__ */f("span",{children:e.title}),
5
5
  /* @__PURE__ */f("span",{className:"font-medium normal-case tracking-normal",children:l(e.count,!!e.truncated)})]}),e.rows.map(e=>{const r=c++,l=r===t,o="action"===e.kind||"seeAll"===e.kind?void 0:e.badge,d="action"===e.kind||"seeAll"===e.kind?void 0:e.sub,u="seeAll"===e.kind;/* @__PURE__ */
6
- return m("div",{id:U(n,r),role:"option","aria-selected":l,className:"flex items-center gap-3 w-full px-4 py-2.5 text-left cursor-pointer transition-colors "+(l?"bg-blue-50":"hover:bg-gray-50"),onMouseDown:e=>e.preventDefault(),onClick:()=>i(e),onMouseEnter:()=>s(r),children:[
6
+ return m("div",{id:J(n,r),role:"option","aria-selected":l,className:"flex items-center gap-3 w-full px-4 py-2.5 text-left cursor-pointer transition-colors "+(l?"bg-blue-50":"hover:bg-gray-50"),onMouseDown:e=>e.preventDefault(),onClick:()=>i(e),onMouseEnter:()=>s(r),children:[
7
7
  /* @__PURE__ */f("svg",{className:"h-4 w-4 text-gray-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:/* @__PURE__ */f("path",{strokeLinecap:"round",strokeLinejoin:"round",d:O(e,a)})}),
8
8
  /* @__PURE__ */m("div",{className:"flex-1 min-w-0",children:[
9
- /* @__PURE__ */f("p",{className:"text-sm font-medium truncate "+(u?"text-blue-600":"text-gray-900"),children:e.label}),d&&/* @__PURE__ */f("p",{className:"text-xs text-gray-400 truncate",children:d})]}),o&&/* @__PURE__ */f("span",{className:"shrink-0 rounded-full bg-gray-100 px-2 py-0.5 text-[10px] font-medium text-gray-500",children:o})]},e.key)})]},e.key))})}var X="react-os-shell:open-global-search";function Z(){"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent(X))}function V({providers:e,typeIcons:t,typeLabels:n,listRoutes:r,placeholder:b,quickActions:g,onSelect:x,recent:k,onRecord:v,favorites:w}={}){const N=s().search,L=b??N.placeholder,[_,A]=i(!1),[C,$]=i(""),[I,T]=i(0),j=d(null),{results:R,truncatedTypes:H,loading:P,failure:B,reset:z}=J(C,e,2);c(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"k"===e.key&&(e.preventDefault(),A(e=>!e)),"Escape"===e.key&&_&&A(!1)},t=()=>A(!0);return window.addEventListener("keydown",e),window.addEventListener(X,t),()=>{window.removeEventListener("keydown",e),window.removeEventListener(X,t)}},[_]),a(_);const[F,O]=i(!1);_!==F&&(O(_),_&&($(""),T(0),z())),c(()=>{_?setTimeout(()=>j.current?.focus(),50):$("")},[_]),c(()=>{T(0)},[R]);const Z=C.length>=2,V=u(()=>Z?K(R,g,C,N.actions,{truncatedTypes:H,listRoutes:r,typeLabels:n,seeAllLabel:N.seeAll}):function(e,t){const n=[];e.recent?.length&&n.push({key:"recent",title:t.recent,rows:e.recent.map((t,n)=>({kind:"recent",key:`recent:${t.entity_type}:${t.entity_id}:${n}`,label:t.label,sub:t.sub,badge:S(t,e.typeLabels),result:t})),count:e.recent.length}),e.favorites?.length&&n.push({key:"favorites",title:t.favorites,rows:e.favorites.map((t,n)=>({kind:"favorite",key:`favorite:${t.entity_type}:${t.entity_id}:${n}`,label:t.label,sub:t.sub,badge:S(t,e.typeLabels)||void 0,icon:"M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z",result:t})),count:e.favorites.length});const r=M("actions",t.actions,e.actions??[]);return r&&n.push(r),n}({recent:k,favorites:w,actions:g,typeLabels:n},N),[Z,R,H,r,n,g,C,k,w,N]),q=u(()=>function(e){return e.flatMap(e=>e.rows)}(V),[V]),G=Math.min(I,Math.max(q.length-1,0)),Q=p(),Y=q.length>0;c(()=>{_&&0!==q.length&&document.getElementById(U(Q,G))?.scrollIntoView?.({block:"nearest"})},[_,G,q.length,Q]);const ee=y(e=>{A(!1),"action"!==e.kind?("result"!==e.kind&&"recent"!==e.kind||v?.(e.result),x?.(e.result)):e.action.onSelect()},[x,v]);return _?h(
9
+ /* @__PURE__ */f("p",{className:"text-sm font-medium truncate "+(u?"text-blue-600":"text-gray-900"),children:e.label}),d&&/* @__PURE__ */f("p",{className:"text-xs text-gray-400 truncate",children:d})]}),o&&/* @__PURE__ */f("span",{className:"shrink-0 rounded-full bg-gray-100 px-2 py-0.5 text-[10px] font-medium text-gray-500",children:o})]},e.key)})]},e.key))})}var X="react-os-shell:open-global-search";function Z(){"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent(X))}function G({providers:e,typeIcons:t,typeLabels:n,listRoutes:r,placeholder:b,quickActions:g,onSelect:x,recent:k,onRecord:v,favorites:w}={}){const N=s().search,_=b??N.placeholder,[L,A]=i(!1),[C,$]=i(""),[T,E]=i(0),j=d(null),{results:R,truncatedTypes:B,loading:P,failure:H,reset:z}=U(C,e,2);c(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"k"===e.key&&(e.preventDefault(),A(e=>!e)),"Escape"===e.key&&L&&A(!1)},t=()=>A(!0);return window.addEventListener("keydown",e),window.addEventListener(X,t),()=>{window.removeEventListener("keydown",e),window.removeEventListener(X,t)}},[L]),a(L);const[F,O]=i(!1);L!==F&&(O(L),L&&($(""),E(0),z())),c(()=>{L?setTimeout(()=>j.current?.focus(),50):$("")},[L]),c(()=>{E(0)},[R]);const Z=C.length>=2,G=u(()=>Z?K(R,g,C,N.actions,{truncatedTypes:B,listRoutes:r,typeLabels:n,seeAllLabel:N.seeAll}):function(e,t){const n=[];e.recent?.length&&n.push({key:"recent",title:t.recent,rows:e.recent.map((t,n)=>({kind:"recent",key:`recent:${t.entity_type}:${t.entity_id}:${n}`,label:t.label,sub:t.sub,badge:S(t,e.typeLabels),result:t})),count:e.recent.length}),e.favorites?.length&&n.push({key:"favorites",title:t.favorites,rows:e.favorites.map((t,n)=>({kind:"favorite",key:`favorite:${t.entity_type}:${t.entity_id}:${n}`,label:t.label,sub:t.sub,badge:S(t,e.typeLabels)||void 0,icon:"M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z",result:t})),count:e.favorites.length});const r=M("actions",t.actions,e.actions??[]);return r&&n.push(r),n}({recent:k,favorites:w,actions:g,typeLabels:n},N),[Z,R,B,r,n,g,C,k,w,N]),V=u(()=>function(e){return e.flatMap(e=>e.rows)}(G),[G]),q=Math.min(T,Math.max(V.length-1,0)),Q=p(),Y=V.length>0;c(()=>{L&&0!==V.length&&document.getElementById(J(Q,q))?.scrollIntoView?.({block:"nearest"})},[L,q,V.length,Q]);const ee=y(e=>{A(!1),"action"!==e.kind?("result"!==e.kind&&"recent"!==e.kind||v?.(e.result),x?.(e.result)):e.action.onSelect()},[x,v]);return L?h(
10
10
  /* @__PURE__ */m("div",{"data-global-search":"",className:"fixed inset-0 flex items-start justify-center pt-[15vh]",style:{zIndex:o.overlay},onClick:()=>A(!1),children:[
11
11
  /* @__PURE__ */f("div",{"data-global-search-backdrop":"",className:"absolute inset-0 bg-black/50 backdrop-blur-sm"}),
12
12
  /* @__PURE__ */m("div",{className:"relative z-10 w-full max-w-xl rounded-(--radius-popup) overflow-hidden",onClick:e=>e.stopPropagation(),style:l(),children:[
13
13
  /* @__PURE__ */m("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-gray-200",children:[
14
- /* @__PURE__ */f("svg",{className:"h-5 w-5 text-gray-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */f("path",{strokeLinecap:"round",strokeLinejoin:"round",d:E})}),
15
- /* @__PURE__ */f("input",{ref:j,type:"text",value:C,onChange:e=>{$(e.target.value),T(0)},onKeyDown:e=>{"ArrowDown"===e.key?(e.preventDefault(),T(D(G,1,q.length))):"ArrowUp"===e.key?(e.preventDefault(),T(D(G,-1,q.length))):"Tab"===e.key&&q.length>0?(e.preventDefault(),T(function(e,t,n){const r=e.length;if(0===r)return 0;const a=[];let l=0;for(const t of e)a.push(l),l+=t;let o=0;for(let e=0;e<r;e++)t>=a[e]&&(o=e);return a[(o+n+r)%r]}(V.map(e=>e.rows.length),G,e.shiftKey?-1:1))):"Enter"===e.key&&q[G]&&ee(q[G])},placeholder:L,role:"combobox","aria-expanded":Y,"aria-controls":Y?Q:void 0,"aria-activedescendant":Y?U(Q,G):void 0,"aria-autocomplete":"list",className:"flex-1 text-sm bg-transparent border-0 rosh-focus-ring placeholder-gray-400"}),P&&/* @__PURE__ */f("span",{"data-global-search-spinner":"",role:"status","aria-label":N.searching,className:"h-4 w-4 shrink-0 animate-spin rounded-full border-2 border-gray-300 border-t-gray-500"}),
14
+ /* @__PURE__ */f("svg",{className:"h-5 w-5 text-gray-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */f("path",{strokeLinecap:"round",strokeLinejoin:"round",d:I})}),
15
+ /* @__PURE__ */f("input",{ref:j,type:"text",value:C,onChange:e=>{$(e.target.value),E(0)},onKeyDown:e=>{"ArrowDown"===e.key?(e.preventDefault(),E(D(q,1,V.length))):"ArrowUp"===e.key?(e.preventDefault(),E(D(q,-1,V.length))):"Tab"===e.key&&V.length>0?(e.preventDefault(),E(function(e,t,n){const r=e.length;if(0===r)return 0;const a=[];let l=0;for(const t of e)a.push(l),l+=t;let o=0;for(let e=0;e<r;e++)t>=a[e]&&(o=e);return a[(o+n+r)%r]}(G.map(e=>e.rows.length),q,e.shiftKey?-1:1))):"Enter"===e.key&&V[q]&&ee(V[q])},placeholder:_,role:"combobox","aria-expanded":Y,"aria-controls":Y?Q:void 0,"aria-activedescendant":Y?J(Q,q):void 0,"aria-autocomplete":"list",className:"flex-1 text-sm bg-transparent border-0 rosh-focus-ring placeholder-gray-400"}),P&&/* @__PURE__ */f("span",{"data-global-search-spinner":"",role:"status","aria-label":N.searching,className:"h-4 w-4 shrink-0 animate-spin rounded-full border-2 border-gray-300 border-t-gray-500"}),
16
16
  /* @__PURE__ */f("kbd",{className:"hidden sm:inline-flex items-center rounded border border-gray-300 px-1.5 py-0.5 text-[10px] font-medium text-gray-400",children:N.escBadge})]}),
17
- /* @__PURE__ */m("div",{className:"max-h-[50vh] overflow-y-auto",children:[P&&0===q.length&&/* @__PURE__ */f("div",{className:"px-4 py-6 text-center text-sm text-gray-400",children:N.searching}),!P&&"all"===B&&Z&&/* @__PURE__ */f("div",{role:"alert",className:"px-4 py-3 text-center text-sm text-red-600",children:N.searchFailed}),!P&&Z&&0===q.length&&"all"!==B&&/* @__PURE__ */f("div",{className:"px-4 py-6 text-center text-sm text-gray-400",children:N.noResults}),Y&&/* @__PURE__ */f(W,{sections:V,activeIdx:G,listId:Q,label:N.listLabel,typeIcons:t,groupCount:N.groupCount,groupLabel:N.groupLabel,onHover:T,onPick:ee}),!P&&"some"===B&&Z&&/* @__PURE__ */f("div",{role:"status",className:"px-4 py-2 text-xs text-amber-600",children:N.partialFailure}),!P&&!Z&&0===q.length&&/* @__PURE__ */f("div",{className:"px-4 py-6 text-center text-sm text-gray-400",children:N.minChars(2)})]}),
17
+ /* @__PURE__ */m("div",{className:"max-h-[50vh] overflow-y-auto",children:[P&&0===V.length&&/* @__PURE__ */f("div",{className:"px-4 py-6 text-center text-sm text-gray-400",children:N.searching}),!P&&"all"===H&&Z&&/* @__PURE__ */f("div",{role:"alert",className:"px-4 py-3 text-center text-sm text-red-600",children:N.searchFailed}),!P&&Z&&0===V.length&&"all"!==H&&/* @__PURE__ */f("div",{className:"px-4 py-6 text-center text-sm text-gray-400",children:N.noResults}),Y&&/* @__PURE__ */f(W,{sections:G,activeIdx:q,listId:Q,label:N.listLabel,typeIcons:t,groupCount:N.groupCount,groupLabel:N.groupLabel,onHover:E,onPick:ee}),!P&&"some"===H&&Z&&/* @__PURE__ */f("div",{role:"status",className:"px-4 py-2 text-xs text-amber-600",children:N.partialFailure}),!P&&!Z&&0===V.length&&/* @__PURE__ */f("div",{className:"px-4 py-6 text-center text-sm text-gray-400",children:N.minChars(2)})]}),
18
18
  /* @__PURE__ */m("div",{className:"flex items-center justify-between px-4 py-2 border-t border-gray-100 bg-gray-50 text-[11px] text-gray-400",children:[
19
19
  /* @__PURE__ */m("div",{className:"flex items-center gap-3",children:[
20
20
  /* @__PURE__ */m("span",{className:"flex items-center gap-1",children:[
21
21
  /* @__PURE__ */f("kbd",{className:"rounded border border-gray-300 px-1 py-0.5 font-medium",children:"↑"}),
22
22
  /* @__PURE__ */f("kbd",{className:"rounded border border-gray-300 px-1 py-0.5 font-medium",children:"↓"}),` ${N.navigate}`]}),
23
23
  /* @__PURE__ */m("span",{className:"flex items-center gap-1",children:[
24
- /* @__PURE__ */f("kbd",{className:"rounded border border-gray-300 px-1 py-0.5 font-medium",children:N.enterKey}),` ${N.open}`]}),V.length>1&&/* @__PURE__ */m("span",{className:"flex items-center gap-1",children:[
24
+ /* @__PURE__ */f("kbd",{className:"rounded border border-gray-300 px-1 py-0.5 font-medium",children:N.enterKey}),` ${N.open}`]}),G.length>1&&/* @__PURE__ */m("span",{className:"flex items-center gap-1",children:[
25
25
  /* @__PURE__ */f("kbd",{className:"rounded border border-gray-300 px-1 py-0.5 font-medium",children:N.tabKey}),` ${N.nextGroup}`]})]}),
26
26
  /* @__PURE__ */m("span",{className:"flex items-center gap-1",children:[
27
- /* @__PURE__ */f("kbd",{className:"rounded border border-gray-300 px-1 py-0.5 font-medium",children:N.escKey}),` ${N.close}`]})]})]})]}),document.body):null}export{w as BrandMark,V as GlobalSearch,C as PAGE_RESULT_ENTITY,T as favoritesToResults,I as navPagesProvider,Z as openGlobalSearch,$ as parsePageResultTarget,_ as partitionNav,P as pushRecent,x as resolveBrandMarkTreatment,A as rowsContainRoute,B as sanitizeRecent,L as visibleNavChildren,N as visibleSectionItems};
27
+ /* @__PURE__ */f("kbd",{className:"rounded border border-gray-300 px-1 py-0.5 font-medium",children:N.escKey}),` ${N.close}`]})]})]})]}),document.body):null}export{w as BrandMark,G as GlobalSearch,C as PAGE_RESULT_ENTITY,E as favoritesToResults,T as navPagesProvider,Z as openGlobalSearch,$ as parsePageResultTarget,L as partitionNav,P as pushRecent,x as resolveBrandMarkTreatment,A as rowsContainRoute,H as sanitizeRecent,_ as visibleNavChildren,N as visibleSectionItems};
@@ -1 +1 @@
1
- import{requestFilesTrashView as n}from"./chunk-LMIQV3NB.js";var o=null;function r(n){o=n}function t(){return o}function u(){n()}export{t as getFilesDemoTree,u as openFilesInTrashMode,r as setFilesDemoTree};
1
+ import{requestFilesTrashView as n}from"./chunk-YQI7KXX3.js";var o=null;function r(n){o=n}function t(){return o}function u(){n()}export{t as getFilesDemoTree,u as openFilesInTrashMode,r as setFilesDemoTree};
@@ -1,29 +1,29 @@
1
- import{useDismissPopupsOnOpen as e}from"./chunk-AFYQTVZO.js";import{registerModalEscapeInterceptor as t,Z_LAYERS as n}from"./chunk-X4FJ54PP.js";import{CloseFallbackB as r,WarningFallback as o,CloseFallback as l}from"./chunk-XUF7VW4U.js";import{useShellStrings as i,splitAround as a}from"./chunk-J3LIIIHJ.js";import{Icon as s}from"./chunk-YKZHOXI4.js";import{createContext as c,useEffect as d,useRef as u,useId as m,useContext as f,useState as b,useCallback as h}from"react";import{jsxs as g,jsx as p,Fragment as y}from"react/jsx-runtime";var x=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");function v(e){return Array.from(e.querySelectorAll(x)).filter(e=>null!==e.offsetParent||e===document.activeElement)}var w=[];function N(e){const t=w.findIndex(t=>t!==e&&e.contains(t));-1===t?w.push(e):w.splice(t,0,e)}function k(e){const t=w.lastIndexOf(e);-1!==t&&w.splice(t,1)}var C=/* @__PURE__ */new WeakSet;function L(e){return v(e)}function E(e,t){d(()=>{if(!t)return;const n=e.current;return n?(C.add(n),N(n),()=>{k(n),C.delete(n)}):void 0},[e,t])}function P(e,t){const n=w.lastIndexOf(t),r=n>0?w[n-1]:-1===n?w[w.length-1]??null:null,o=v(r??e.ownerDocument.body).filter(n=>!t.contains(n)&&!e.contains(n)),l=o.find(t=>0!==(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING));return l||(r&&!C.has(r)?o[0]??null:null)}function j(e,t,n){d(()=>{if(!t)return;const r=e.current;if(!r)return;const o=document.activeElement,l=n?.current??v(r)[0]??r;l!==r||r.hasAttribute("tabindex")||r.setAttribute("tabindex","-1"),l.focus();const i=e=>{if("Tab"!==e.key)return;if(w[w.length-1]!==r)return;const t=v(r);if(0===t.length)return void e.preventDefault();const n=t[0],o=t[t.length-1],l=document.activeElement;!e.shiftKey||l!==n&&r.contains(l)?e.shiftKey||l!==o&&r.contains(l)||(e.preventDefault(),n.focus()):(e.preventDefault(),o.focus())};return N(r),document.addEventListener("keydown",i,!0),()=>{k(r),document.removeEventListener("keydown",i,!0),(r.contains(document.activeElement)||document.activeElement===document.body)&&o?.focus?.()}},[e,t,n])}var I=0,F=null;function O(e){d(()=>{if(!e)return;const t=document.body;if(0===I){F={overflow:t.style.overflow,paddingRight:t.style.paddingRight};const e=window.innerWidth-document.documentElement.clientWidth;t.style.overflow="hidden",e>0&&(t.style.paddingRight=`${e}px`)}return I+=1,()=>{0===(I-=1)&&F&&(t.style.overflow=F.overflow,t.style.paddingRight=F.paddingRight,F=null)}},[e])}var T={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-4xl"};function W({open:o,onClose:l,title:a,description:c,role:f="dialog",children:b,footer:h,blocking:y=!1,size:x="md",initialFocus:v,"aria-label":w,"aria-labelledby":N,"aria-describedby":k,className:C=""}){const L=u(null),E=m(),P=m(),I=!y&&!h,F=m(),W=i().dialog;return e(o),j(L,o,v),O(o),d(()=>{if(o)return t(()=>(y||l(),!0),()=>L.current)},[o,y,l]),o?/* @__PURE__ */g("div",{className:"fixed inset-0",style:{zIndex:n.overlay},role:"presentation",children:[
1
+ import{useDismissPopupsOnOpen as e}from"./chunk-AFYQTVZO.js";import{registerModalEscapeInterceptor as t,Z_LAYERS as n}from"./chunk-X4FJ54PP.js";import{CloseFallbackB as r,WarningFallback as o,CloseFallback as l}from"./chunk-JJIPGAXI.js";import{useShellStrings as i,splitAround as a}from"./chunk-AJB5G52B.js";import{Icon as s}from"./chunk-YKZHOXI4.js";import{createContext as c,useEffect as d,useRef as u,useId as m,useContext as f,useState as b,useCallback as h}from"react";import{jsxs as g,jsx as p,Fragment as y}from"react/jsx-runtime";var x=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");function v(e){return Array.from(e.querySelectorAll(x)).filter(e=>null!==e.offsetParent||e===document.activeElement)}var w=[];function N(e){const t=w.findIndex(t=>t!==e&&e.contains(t));-1===t?w.push(e):w.splice(t,0,e)}function k(e){const t=w.lastIndexOf(e);-1!==t&&w.splice(t,1)}var C=/* @__PURE__ */new WeakSet;function E(e){return v(e)}function L(e,t){d(()=>{if(!t)return;const n=e.current;return n?(C.add(n),N(n),()=>{k(n),C.delete(n)}):void 0},[e,t])}function P(e,t){const n=w.lastIndexOf(t),r=n>0?w[n-1]:-1===n?w[w.length-1]??null:null,o=v(r??e.ownerDocument.body).filter(n=>!t.contains(n)&&!e.contains(n)),l=o.find(t=>0!==(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING));return l||(r&&!C.has(r)?o[0]??null:null)}function j(e,t,n){d(()=>{if(!t)return;const r=e.current;if(!r)return;const o=document.activeElement,l=n?.current??v(r)[0]??r;l!==r||r.hasAttribute("tabindex")||r.setAttribute("tabindex","-1"),l.focus();const i=e=>{if("Tab"!==e.key)return;if(w[w.length-1]!==r)return;const t=v(r);if(0===t.length)return void e.preventDefault();const n=t[0],o=t[t.length-1],l=document.activeElement;!e.shiftKey||l!==n&&r.contains(l)?e.shiftKey||l!==o&&r.contains(l)||(e.preventDefault(),n.focus()):(e.preventDefault(),o.focus())};return N(r),document.addEventListener("keydown",i,!0),()=>{k(r),document.removeEventListener("keydown",i,!0),(r.contains(document.activeElement)||document.activeElement===document.body)&&o?.focus?.()}},[e,t,n])}var I=0,F=null;function O(e){d(()=>{if(!e)return;const t=document.body;if(0===I){F={overflow:t.style.overflow,paddingRight:t.style.paddingRight};const e=window.innerWidth-document.documentElement.clientWidth;t.style.overflow="hidden",e>0&&(t.style.paddingRight=`${e}px`)}return I+=1,()=>{0===(I-=1)&&F&&(t.style.overflow=F.overflow,t.style.paddingRight=F.paddingRight,F=null)}},[e])}var T={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-4xl"};function D({open:o,onClose:l,title:a,description:c,role:f="dialog",children:b,footer:h,blocking:y=!1,size:x="md",initialFocus:v,"aria-label":w,"aria-labelledby":N,"aria-describedby":k,className:C=""}){const E=u(null),L=m(),P=m(),I=!y&&!h,F=m(),D=i().dialog;return e(o),j(E,o,v),O(o),d(()=>{if(o)return t(()=>(y||l(),!0),()=>E.current)},[o,y,l]),o?/* @__PURE__ */g("div",{className:"fixed inset-0",style:{zIndex:n.overlay},role:"presentation",children:[
2
2
  /* @__PURE__ */p("div",{className:"fixed inset-0 bg-black/30","aria-hidden":"true"}),
3
- /* @__PURE__ */p("div",{className:"fixed inset-0 flex items-center justify-center p-4",onClick:y?void 0:e=>{e.target===e.currentTarget&&l()},children:/* @__PURE__ */g("div",{ref:L,role:f,"aria-modal":"true","aria-labelledby":a?F:N,"aria-label":a||N?void 0:w,"aria-describedby":k??(c?P:b?E:void 0),className:`relative max-h-full w-full ${T[x]} overflow-y-auto overscroll-contain rounded-(--radius-card) bg-white p-6 shadow-xl ${C}`.trim(),children:[a&&/* @__PURE__ */p("h2",{id:F,className:(I?"pr-8 ":"")+"text-base font-semibold text-gray-900",children:a}),c&&/* @__PURE__ */p("p",{id:P,className:((a?"mt-1":I?"pr-8":"")+" text-sm text-gray-500").trim(),children:c}),b&&/* @__PURE__ */p("div",{id:E,className:"mt-2 text-sm text-gray-600",children:b}),h&&/* @__PURE__ */p("div",{className:"mt-6 flex flex-wrap justify-end gap-3",children:h}),I&&/* @__PURE__ */p("button",{type:"button",onClick:l,"aria-label":W.close,className:"absolute right-3 top-3 rounded-(--radius-control) p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:/* @__PURE__ */p(s,{name:"close",fallback:r,className:"h-5 w-5",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true"})})]})})]}):null}var D=c(()=>Promise.resolve(!1)),$=()=>f(D),A=()=>Promise.resolve(!1),K=e=>A(e),R=()=>Promise.resolve(!1),J=e=>R(e),S=()=>Promise.resolve(null),U=e=>S(e),V={danger:{icon:"text-red-600 bg-red-100",button:"bg-red-600 hover:bg-red-700 text-white"},warning:{icon:"text-yellow-600 bg-yellow-100",button:"bg-yellow-600 hover:bg-yellow-700 text-white"},info:{icon:"text-blue-600 bg-blue-100",button:"bg-blue-600 hover:bg-blue-700 text-white"}},X="bg-white text-gray-700 border border-gray-300 px-4 py-2 text-sm font-medium rounded-lg hover:bg-gray-50";function z(){/* @__PURE__ */
4
- return p(s,{name:"warning",fallback:o,className:"h-5 w-5",strokeWidth:1.5,"aria-hidden":"true"})}function H(){/* @__PURE__ */
5
- return p(s,{name:"close",fallback:l,className:"h-5 w-5",strokeWidth:1.5,"aria-hidden":"true"})}function Y({children:e}){const[t,n]=b(!1),[r,o]=b({message:""}),[l,s]=b(0),c=u(),m=u(null),f=u(0),x=u([]),v=u(null),w=u(null),N=h(e=>{m.current=e.id,c.current=e.resolve,s(e.id),o(e.options),n(!0)},[]),k=h(e=>{const t="string"==typeof e?{message:e}:e;return new Promise(e=>{const n={id:++f.current,options:t,resolve:e};null===m.current?N(n):x.current.push(n)})},[N]),[C,L]=b(!1),[E,P]=b({message:""}),[j,I]=b(""),F=u(),O=h(e=>(P(e),I(""),L(!0),new Promise(e=>{F.current=e})),[]),[T,$]=b(!1),[K,J]=b({}),[U,Y]=b(""),Z=u(),_=h(e=>{const t="string"==typeof e?{message:e}:e;return J(t),Y(t.defaultValue??""),$(!0),new Promise(e=>{Z.current=e})},[]);d(()=>{A=k,R=O,S=_},[k,O,_]);const q=(e,t)=>{if(m.current!==e)return;const r=c.current,o=x.current.shift();o?N(o):(m.current=null,c.current=void 0,n(!1)),r?.(t)},G=e=>{L(!1),I(""),F.current?.(e)},M=e=>{if(e){const e=U.trim();if(!e&&!K.allowEmpty)return $(!1),void Z.current?.(null);$(!1),Z.current?.(e)}else $(!1),Z.current?.(null)},Q=r.variant||(r.confirmLabel?.toLowerCase().includes("delete")||r.message.toLowerCase().includes("delete")?"danger":"info"),B=V[Q],ee=V["warning"===E.variant?"warning":"danger"],te=E.confirmWord,ne=null==te||j===te,re=i().dialog,[oe,le]=a(re.typeToConfirm);/* @__PURE__ */
6
- return g(D.Provider,{value:k,children:[e,
7
- /* @__PURE__ */p(W,{open:t,onClose:()=>q(l,!1),initialFocus:v,footer:/* @__PURE__ */g(y,{children:[
8
- /* @__PURE__ */p("button",{ref:v,type:"button",onClick:()=>q(l,!1),className:X,children:r.cancelLabel||re.cancel}),
9
- /* @__PURE__ */p("button",{type:"button",onClick:()=>q(l,!0),className:`px-4 py-2 text-sm font-medium rounded-lg ${B.button}`,children:r.confirmLabel||re.ok})]}),children:/* @__PURE__ */g("div",{className:"flex gap-4",children:[
10
- /* @__PURE__ */p("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${B.icon}`,children:/* @__PURE__ */p(z,{})}),
3
+ /* @__PURE__ */p("div",{className:"fixed inset-0 flex items-center justify-center p-4",onClick:y?void 0:e=>{e.target===e.currentTarget&&l()},children:/* @__PURE__ */g("div",{ref:E,role:f,"aria-modal":"true","aria-labelledby":a?F:N,"aria-label":a||N?void 0:w,"aria-describedby":k??(c?P:b?L:void 0),className:`relative max-h-full w-full ${T[x]} overflow-y-auto overscroll-contain rounded-(--radius-card) bg-white p-6 shadow-xl ${C}`.trim(),children:[a&&/* @__PURE__ */p("h2",{id:F,className:(I?"pr-8 ":"")+"text-base font-semibold text-gray-900",children:a}),c&&/* @__PURE__ */p("p",{id:P,className:((a?"mt-1":I?"pr-8":"")+" text-sm text-gray-500").trim(),children:c}),b&&/* @__PURE__ */p("div",{id:L,className:"mt-2 text-sm text-gray-600",children:b}),h&&/* @__PURE__ */p("div",{className:"mt-6 flex flex-wrap justify-end gap-3",children:h}),I&&/* @__PURE__ */p("button",{type:"button",onClick:l,"aria-label":D.close,className:"absolute right-3 top-3 rounded-(--radius-control) p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:/* @__PURE__ */p(s,{name:"close",fallback:r,className:"h-5 w-5",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true"})})]})})]}):null}var W=c(()=>Promise.resolve(!1)),A=()=>f(W),$=()=>Promise.resolve(!1),K=e=>$(e),R=()=>Promise.resolve(!1),J=e=>R(e),G=()=>Promise.resolve(null),S=e=>G(e),X={danger:{icon:"text-red-600 bg-red-100",button:"bg-red-600 hover:bg-red-700 text-white"},warning:{icon:"text-yellow-600 bg-yellow-100",button:"bg-yellow-600 hover:bg-yellow-700 text-white"},info:{icon:"text-blue-600 bg-blue-100",button:"bg-blue-600 hover:bg-blue-700 text-white"}},z="bg-white text-gray-700 border border-gray-300 px-4 py-2 text-sm font-medium rounded-lg hover:bg-gray-50";function B(){/* @__PURE__ */
4
+ return p(s,{name:"warning",fallback:o,className:"h-5 w-5",strokeWidth:1.5,"aria-hidden":"true"})}function V(){/* @__PURE__ */
5
+ return p(s,{name:"close",fallback:l,className:"h-5 w-5",strokeWidth:1.5,"aria-hidden":"true"})}function Y({children:e}){const[t,n]=b(!1),[r,o]=b({message:""}),[l,s]=b(0),c=u(),m=u(null),f=u(0),x=u([]),v=u(null),w=u(null),N=h(e=>{m.current=e.id,c.current=e.resolve,s(e.id),o(e.options),n(!0)},[]),k=h(e=>{const t="string"==typeof e?{message:e}:e;return new Promise(e=>{const n={id:++f.current,options:t,resolve:e};null===m.current?N(n):x.current.push(n)})},[N]),[C,E]=b(!1),[L,P]=b({message:""}),[j,I]=b(""),F=u(),O=h(e=>(P(e),I(""),E(!0),new Promise(e=>{F.current=e})),[]),[T,A]=b(!1),[K,J]=b({}),[S,Y]=b(""),Z=u(),_=h(e=>{const t="string"==typeof e?{message:e}:e;return J(t),Y(t.defaultValue??""),A(!0),new Promise(e=>{Z.current=e})},[]);d(()=>{$=k,R=O,G=_},[k,O,_]);const q=(e,t)=>{if(m.current!==e)return;const r=c.current,o=x.current.shift();o?N(o):(m.current=null,c.current=void 0,n(!1)),r?.(t)},H=e=>{E(!1),I(""),F.current?.(e)},M=e=>{if(e){const e=S.trim();if(!e&&!K.allowEmpty)return A(!1),void Z.current?.(null);A(!1),Z.current?.(e)}else A(!1),Z.current?.(null)},Q=r.variant||(r.confirmLabel?.toLowerCase().includes("delete")||r.message.toLowerCase().includes("delete")?"danger":"info"),U=X[Q],ee=X["warning"===L.variant?"warning":"danger"],te=L.confirmWord,ne=null==te||j===te,re=i().dialog,[oe,le]=a(re.typeToConfirm);/* @__PURE__ */
6
+ return g(W.Provider,{value:k,children:[e,
7
+ /* @__PURE__ */p(D,{open:t,onClose:()=>q(l,!1),initialFocus:v,footer:/* @__PURE__ */g(y,{children:[
8
+ /* @__PURE__ */p("button",{ref:v,type:"button",onClick:()=>q(l,!1),className:z,children:r.cancelLabel||re.cancel}),
9
+ /* @__PURE__ */p("button",{type:"button",onClick:()=>q(l,!0),className:`px-4 py-2 text-sm font-medium rounded-lg ${U.button}`,children:r.confirmLabel||re.ok})]}),children:/* @__PURE__ */g("div",{className:"flex gap-4",children:[
10
+ /* @__PURE__ */p("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${U.icon}`,children:/* @__PURE__ */p(B,{})}),
11
11
  /* @__PURE__ */g("div",{className:"flex-1",children:[
12
12
  /* @__PURE__ */p("h2",{className:"text-base font-semibold text-gray-900",children:r.title||re.confirmTitle}),
13
13
  /* @__PURE__ */p("p",{className:"mt-2 text-sm text-gray-600",children:r.message})]})]})}),
14
- /* @__PURE__ */g(W,{open:C,onClose:()=>G(!1),initialFocus:null!=te?void 0:w,footer:/* @__PURE__ */g(y,{children:[
15
- /* @__PURE__ */p("button",{ref:w,type:"button",onClick:()=>G(!1),className:X,children:E.cancelLabel||re.destructiveCancel}),
16
- /* @__PURE__ */p("button",{type:"button",onClick:()=>G(!0),disabled:!ne,className:`px-4 py-2 text-sm font-medium rounded-lg disabled:opacity-40 ${ee.button}`,children:te??E.confirmLabel??re.destructiveConfirm})]}),children:[
17
- /* @__PURE__ */p("button",{type:"button",onClick:()=>G(!1),"aria-label":re.close,className:"absolute right-4 top-4 rounded-md p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:/* @__PURE__ */p(H,{})}),
14
+ /* @__PURE__ */g(D,{open:C,onClose:()=>H(!1),initialFocus:null!=te?void 0:w,footer:/* @__PURE__ */g(y,{children:[
15
+ /* @__PURE__ */p("button",{ref:w,type:"button",onClick:()=>H(!1),className:z,children:L.cancelLabel||re.destructiveCancel}),
16
+ /* @__PURE__ */p("button",{type:"button",onClick:()=>H(!0),disabled:!ne,className:`px-4 py-2 text-sm font-medium rounded-lg disabled:opacity-40 ${ee.button}`,children:te??L.confirmLabel??re.destructiveConfirm})]}),children:[
17
+ /* @__PURE__ */p("button",{type:"button",onClick:()=>H(!1),"aria-label":re.close,className:"absolute right-4 top-4 rounded-md p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:/* @__PURE__ */p(V,{})}),
18
18
  /* @__PURE__ */g("div",{className:"flex gap-4",children:[
19
- /* @__PURE__ */p("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${ee.icon}`,children:/* @__PURE__ */p(z,{})}),
19
+ /* @__PURE__ */p("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${ee.icon}`,children:/* @__PURE__ */p(B,{})}),
20
20
  /* @__PURE__ */g("div",{className:"flex-1",children:[
21
- /* @__PURE__ */p("h2",{className:"text-base font-semibold text-gray-900 pr-6",children:E.title||re.destructiveTitle}),
22
- /* @__PURE__ */p("p",{className:"mt-2 text-sm text-gray-600",children:E.message}),null!=te&&/* @__PURE__ */g(y,{children:[
21
+ /* @__PURE__ */p("h2",{className:"text-base font-semibold text-gray-900 pr-6",children:L.title||re.destructiveTitle}),
22
+ /* @__PURE__ */p("p",{className:"mt-2 text-sm text-gray-600",children:L.message}),null!=te&&/* @__PURE__ */g(y,{children:[
23
23
  /* @__PURE__ */g("p",{className:"mt-3 text-sm text-gray-700",children:[oe,
24
24
  /* @__PURE__ */p("kbd",{className:"rounded border border-gray-300 bg-gray-50 px-1.5 py-0.5 text-xs font-bold text-red-600 font-mono",children:te}),le]}),
25
- /* @__PURE__ */p("input",{autoFocus:!0,type:"text",value:j,onChange:e=>I(e.target.value),onKeyDown:e=>{"Enter"===e.key&&j===te&&G(!0)},placeholder:te,className:"mt-2 w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-red-500"})]})]})]})]}),
26
- /* @__PURE__ */g(W,{open:T,onClose:()=>M(!1),title:K.title||re.promptTitle,footer:/* @__PURE__ */g(y,{children:[
27
- /* @__PURE__ */p("button",{type:"button",onClick:()=>M(!1),className:X,children:K.cancelLabel||re.cancel}),
28
- /* @__PURE__ */p("button",{type:"button",onClick:()=>M(!0),disabled:!K.allowEmpty&&!U.trim(),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 text-sm font-medium rounded-lg disabled:opacity-40",children:K.confirmLabel||re.ok})]}),children:[K.message&&/* @__PURE__ */p("p",{className:"text-sm text-gray-600",children:K.message}),
29
- /* @__PURE__ */p("input",{autoFocus:!0,type:"text",value:U,onChange:e=>Y(e.target.value),onKeyDown:e=>{"Enter"===e.key?M(!0):"Escape"===e.key&&M(!1)},onFocus:e=>e.target.select(),placeholder:K.placeholder,className:"mt-3 w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-accent)]"})]})]})}export{Y as ConfirmProvider,W as Dialog,K as confirm,J as confirmDestructive,L as focusableIn,U as prompt,P as stopAfter,$ as useConfirm,j as useFocusTrap,O as useScrollLock,E as useTabLayer};
25
+ /* @__PURE__ */p("input",{autoFocus:!0,type:"text",value:j,onChange:e=>I(e.target.value),onKeyDown:e=>{"Enter"===e.key&&j===te&&H(!0)},placeholder:te,className:"mt-2 w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-red-500"})]})]})]})]}),
26
+ /* @__PURE__ */g(D,{open:T,onClose:()=>M(!1),title:K.title||re.promptTitle,footer:/* @__PURE__ */g(y,{children:[
27
+ /* @__PURE__ */p("button",{type:"button",onClick:()=>M(!1),className:z,children:K.cancelLabel||re.cancel}),
28
+ /* @__PURE__ */p("button",{type:"button",onClick:()=>M(!0),disabled:!K.allowEmpty&&!S.trim(),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 text-sm font-medium rounded-lg disabled:opacity-40",children:K.confirmLabel||re.ok})]}),children:[K.message&&/* @__PURE__ */p("p",{className:"text-sm text-gray-600",children:K.message}),
29
+ /* @__PURE__ */p("input",{autoFocus:!0,type:"text",value:S,onChange:e=>Y(e.target.value),onKeyDown:e=>{"Enter"===e.key?M(!0):"Escape"===e.key&&M(!1)},onFocus:e=>e.target.select(),placeholder:K.placeholder,className:"mt-3 w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-accent)]"})]})]})}export{Y as ConfirmProvider,D as Dialog,K as confirm,J as confirmDestructive,E as focusableIn,S as prompt,P as stopAfter,A as useConfirm,j as useFocusTrap,O as useScrollLock,L as useTabLayer};
@@ -1,9 +1,9 @@
1
- import{useCopyText as e,CopyGlyph as t}from"./chunk-GMMTTWHB.js";import{PopupMenu as n,PopupMenuItem as r,PopupMenuDivider as l}from"./chunk-ZDF5AR5W.js";import{CloseFallbackC as i}from"./chunk-XUF7VW4U.js";import{useShellStrings as a}from"./chunk-J3LIIIHJ.js";import{Icon as o}from"./chunk-YKZHOXI4.js";import{useState as s,useEffect as c,Fragment as d}from"react";import{jsxs as m,jsx as u,Fragment as p}from"react/jsx-runtime";var y="outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-500";function h(){/* @__PURE__ */
1
+ import{useCopyText as e,CopyGlyph as t}from"./chunk-UAJQB45Y.js";import{PopupMenu as n,PopupMenuItem as r,PopupMenuDivider as l}from"./chunk-HIAHERCD.js";import{CloseFallbackC as i}from"./chunk-JJIPGAXI.js";import{useShellStrings as a}from"./chunk-AJB5G52B.js";import{Icon as o}from"./chunk-YKZHOXI4.js";import{useState as s,useEffect as c,Fragment as d}from"react";import{jsxs as m,jsx as u,Fragment as p}from"react/jsx-runtime";var y="outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-500";function h(){/* @__PURE__ */
2
2
  return u(o,{name:"close",fallback:i,"aria-hidden":"true",className:"size-3.5"})}function b({text:n,label:r,copiedLabel:l}){const{copied:i,copy:a}=e(n);/* @__PURE__ */
3
- return u("button",{type:"button",tabIndex:-1,"aria-label":i?l:r,title:i?l:r,onClick:a,className:"flex size-5 shrink-0 items-center justify-center rounded text-gray-400 hover:bg-gray-200 hover:text-gray-700 @max-[10rem]:hidden",children:/* @__PURE__ */u(t,{copied:i,className:"size-3.5"})})}function f({tabs:e,activeKey:t,idFor:i,panelMounted:o,onActivate:f,onClose:g,onCloseMany:x,label:k,className:v,activeClassName:w,end:N,onIconMenu:C,menuItems:I}){const j=a().pageTabs,[$,z]=s(null),M=e.length;c(()=>{if(!t)return;const e=document.getElementById(i(t,"tab"));e?.scrollIntoView?.({block:"nearest",inline:"nearest"})},[i,t,M]);const D=e.some(e=>e.key===t)?t:e[0]?.key,A=t=>{const n=e[(t+e.length)%e.length];n&&document.getElementById(i(n.key,"tab"))?.focus()},_=$?e.find(e=>e.key===$.key):void 0,B=_&&I?I(_.key):[],T=_?e.indexOf(_):-1,E=e=>e.some(e=>!e.pinned),F=e=>()=>{z(null),e()};/* @__PURE__ */
3
+ return u("button",{type:"button",tabIndex:-1,"aria-label":i?l:r,title:i?l:r,onClick:a,className:"flex size-5 shrink-0 items-center justify-center rounded text-gray-400 hover:bg-gray-200 hover:text-gray-700 @max-[10rem]:hidden",children:/* @__PURE__ */u(t,{copied:i,className:"size-3.5"})})}function f({tabs:e,activeKey:t,idFor:i,panelMounted:o,onActivate:f,onClose:g,onCloseMany:x,label:k,className:v,activeClassName:w,end:N,onIconMenu:C,menuItems:I}){const j=a().pageTabs,[$,z]=s(null),A=e.length;c(()=>{if(!t)return;const e=document.getElementById(i(t,"tab"));e?.scrollIntoView?.({block:"nearest",inline:"nearest"})},[i,t,A]);const D=e.some(e=>e.key===t)?t:e[0]?.key,B=t=>{const n=e[(t+e.length)%e.length];n&&document.getElementById(i(n.key,"tab"))?.focus()},M=$?e.find(e=>e.key===$.key):void 0,_=M&&I?I(M.key):[],E=M?e.indexOf(M):-1,H=e=>e.some(e=>!e.pinned),J=e=>()=>{z(null),e()};/* @__PURE__ */
4
4
  return m("div",{className:v??"relative flex h-10 shrink-0 items-end gap-3 bg-gray-100 px-3",children:[
5
5
  /* @__PURE__ */u("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 bottom-0 h-px bg-gray-200"}),
6
- /* @__PURE__ */u("div",{role:"tablist","aria-label":k,onKeyDown:t=>{const n=e.findIndex(e=>document.getElementById(i(e.key,"tab"))===t.target);if(!(n<0)){if("ArrowRight"===t.key)A(n+1);else if("ArrowLeft"===t.key)A(n-1);else if("Home"===t.key)A(0);else if("End"===t.key)A(e.length-1);else{if("Delete"!==t.key||e[n].pinned)return;g(e[n].key)}t.preventDefault()}},className:"flex min-w-0 flex-1 items-end overflow-x-auto overflow-y-hidden [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:e.map((n,r)=>{const l=n.key===t,a=!!n.dirty,s=n.icon,c=l?w??"z-[1] border-gray-200 bg-gray-50 text-gray-900":"border-transparent text-gray-600 hover:bg-gray-200/70 hover:text-gray-900",p=r>0&&!l&&e[r-1].key!==t,x={type:"button",role:"tab",id:i(n.key,"tab"),"aria-selected":l,"aria-controls":o?.(n.key)?i(n.key,"panel"):void 0,tabIndex:n.key===D?0:-1,title:n.title,onClick:()=>f(n.key)},k={onContextMenu:e=>((e,t)=>{e.preventDefault(),z({x:e.clientX,y:e.clientY,key:t.key})})(e,n),onAuxClick:e=>((e,t)=>{1!==e.button||t.pinned||(e.preventDefault(),g(t.key))})(e,n),onMouseDown:e=>{1===e.button&&e.preventDefault()}},v=s&&
6
+ /* @__PURE__ */u("div",{role:"tablist","aria-label":k,onKeyDown:t=>{const n=e.findIndex(e=>document.getElementById(i(e.key,"tab"))===t.target);if(!(n<0)){if("ArrowRight"===t.key)B(n+1);else if("ArrowLeft"===t.key)B(n-1);else if("Home"===t.key)B(0);else if("End"===t.key)B(e.length-1);else{if("Delete"!==t.key||e[n].pinned)return;g(e[n].key)}t.preventDefault()}},className:"flex min-w-0 flex-1 items-end overflow-x-auto overflow-y-hidden [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:e.map((n,r)=>{const l=n.key===t,a=!!n.dirty,s=n.icon,c=l?w??"z-[1] border-gray-200 bg-gray-50 text-gray-900":"border-transparent text-gray-600 hover:bg-gray-200/70 hover:text-gray-900",p=r>0&&!l&&e[r-1].key!==t,x={type:"button",role:"tab",id:i(n.key,"tab"),"aria-selected":l,"aria-controls":o?.(n.key)?i(n.key,"panel"):void 0,tabIndex:n.key===D?0:-1,title:n.title,onClick:()=>f(n.key)},k={onContextMenu:e=>((e,t)=>{e.preventDefault(),z({x:e.clientX,y:e.clientY,key:t.key})})(e,n),onAuxClick:e=>((e,t)=>{1!==e.button||t.pinned||(e.preventDefault(),g(t.key))})(e,n),onMouseDown:e=>{1===e.button&&e.preventDefault()}},v=s&&
7
7
  /* @__PURE__ */m("span",{className:"relative flex size-4 shrink-0 items-center justify-center text-gray-500 [&>svg]:size-4","aria-hidden":"true",children:[s,a&&!l&&!n.pinned&&
8
8
  /* @__PURE__ */u("span",{className:"absolute -right-1 -top-1 hidden size-2 rounded-full bg-gray-500 ring-2 ring-gray-100 @max-[6.5rem]:block @max-[6.5rem]:group-hover:hidden"})]}),N=l&&!!C&&!!s;return n.pinned?/* @__PURE__ */u("div",{role:"presentation",className:`group relative flex h-9 flex-none items-center justify-center rounded-t-md border border-b-0 transition-colors ${s?"w-10":""} ${c}`,...k,children:/* @__PURE__ */m("button",{...x,className:`flex h-full items-center justify-center rounded-t-md ${s?"w-full":"px-3"} ${y}`,children:[v,
9
9
  /* @__PURE__ */u("span",{className:s?"sr-only":"whitespace-nowrap text-[13px]",children:n.title})]})},n.key):/* @__PURE__ */m(d,{children:[p&&/* @__PURE__ */u("span",{"aria-hidden":"true",className:"mb-2.5 h-4 w-px shrink-0 self-end border-l border-gray-300"}),
@@ -12,10 +12,10 @@ return m("div",{className:v??"relative flex h-10 shrink-0 items-end gap-3 bg-gra
12
12
  /* @__PURE__ */m("button",{...x,className:`flex h-full min-w-0 flex-1 items-center gap-2 rounded-t-md pr-1 text-left ${N?"pl-1.5":"pl-3"} ${y} ${l?N?"":"@max-[5rem]:pl-2.5":"@max-[6.5rem]:pr-3 @max-[6.5rem]:group-hover:pr-1 @max-[4.5rem]:justify-center @max-[4.5rem]:px-0 @max-[4.5rem]:group-hover:pl-1.5"}`,children:[!N&&v,
13
13
  /* @__PURE__ */u("span",{className:"min-w-0 flex-1 overflow-hidden whitespace-nowrap [mask-image:linear-gradient(to_right,#000_calc(100%-1rem),transparent)] "+(s?l?"@max-[5rem]:sr-only":"@max-[4.5rem]:sr-only":""),children:n.title})]}),l&&n.copy&&/* @__PURE__ */u(b,{text:n.copy,label:j.copy(n.copy),copiedLabel:j.copied}),
14
14
  /* @__PURE__ */m("span",{className:"mr-1.5 flex size-5 shrink-0 items-center justify-center "+(l?"":"@max-[6.5rem]:hidden @max-[6.5rem]:group-hover:flex"),children:[a&&/* @__PURE__ */u("span",{role:"img","aria-label":j.unsaved,className:"size-2 rounded-full bg-gray-500 group-hover:hidden"}),
15
- /* @__PURE__ */u("button",{type:"button",tabIndex:-1,"aria-label":j.closeTab?.(n.title)??`${j.close} ${n.title}`,onClick:()=>g(n.key),className:"size-5 items-center justify-center rounded text-gray-400 hover:bg-gray-200 hover:text-gray-700 "+(a?"hidden group-hover:flex":l?"flex":"flex opacity-0 group-hover:opacity-100 focus-visible:opacity-100"),children:/* @__PURE__ */u(h,{})})]})]})]},n.key)})}),N&&/* @__PURE__ */u("div",{className:"flex shrink-0 items-center gap-2 self-center",children:N}),$&&_&&/* @__PURE__ */m(n,{portal:!0,style:{left:$.x,top:$.y},onClose:()=>z(null),children:[B.length>0&&/* @__PURE__ */m(p,{children:[B.map((e,t)=>/* @__PURE__ */m(r,{onClick:F(e.onSelect),children:[e.icon,e.label]},t)),
15
+ /* @__PURE__ */u("button",{type:"button",tabIndex:-1,"aria-label":j.closeTab?.(n.title)??`${j.close} ${n.title}`,onClick:()=>g(n.key),className:"size-5 items-center justify-center rounded text-gray-400 hover:bg-gray-200 hover:text-gray-700 "+(a?"hidden group-hover:flex":l?"flex":"flex opacity-0 group-hover:opacity-100 focus-visible:opacity-100"),children:/* @__PURE__ */u(h,{})})]})]})]},n.key)})}),N&&/* @__PURE__ */u("div",{className:"flex shrink-0 items-center gap-2 self-center",children:N}),$&&M&&/* @__PURE__ */m(n,{portal:!0,style:{left:$.x,top:$.y},onClose:()=>z(null),children:[_.length>0&&/* @__PURE__ */m(p,{children:[_.map((e,t)=>/* @__PURE__ */m(r,{onClick:J(e.onSelect),children:[e.icon,e.label]},t)),
16
16
  /* @__PURE__ */u(l,{})]}),
17
- /* @__PURE__ */u(r,{disabled:_.pinned,onClick:F(()=>g(_.key)),children:j.close}),
17
+ /* @__PURE__ */u(r,{disabled:M.pinned,onClick:J(()=>g(M.key)),children:j.close}),
18
18
  /* @__PURE__ */u(l,{}),
19
- /* @__PURE__ */u(r,{disabled:!E(e.filter(e=>e.key!==_.key)),onClick:F(()=>x("others",_.key)),children:j.closeOthers}),
20
- /* @__PURE__ */u(r,{disabled:!E(e.slice(T+1)),onClick:F(()=>x("right",_.key)),children:j.closeRight}),
21
- /* @__PURE__ */u(r,{disabled:!E(e),onClick:F(()=>x("all",null)),children:j.closeAll})]})]})}export{f as TabStrip};
19
+ /* @__PURE__ */u(r,{disabled:!H(e.filter(e=>e.key!==M.key)),onClick:J(()=>x("others",M.key)),children:j.closeOthers}),
20
+ /* @__PURE__ */u(r,{disabled:!H(e.slice(E+1)),onClick:J(()=>x("right",M.key)),children:j.closeRight}),
21
+ /* @__PURE__ */u(r,{disabled:!H(e),onClick:J(()=>x("all",null)),children:j.closeAll})]})]})}export{f as TabStrip};