efficient-shell 13.13.0 → 13.15.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 (146) hide show
  1. package/README.md +12 -1
  2. package/dist/{Browser-H3A2AO7Q.js → Browser-KHMTFVKZ.js} +14 -14
  3. package/dist/Calculator-OKVS4UOJ.js +29 -0
  4. package/dist/CurrencyConverter-ZA2NGJWI.js +21 -0
  5. package/dist/{Files-YVC66K6X.js → Files-EN4DDZYV.js} +56 -56
  6. package/dist/Notepad-PHQNEUKW.js +24 -0
  7. package/dist/{PomodoroTimer-I575OSRR.js → PomodoroTimer-PW7BRZUJ.js} +48 -48
  8. package/dist/{Preview-UXATJW7C.js → Preview-OSQHIS3Z.js} +32 -32
  9. package/dist/Stock-2P4NWUNB.js +16 -0
  10. package/dist/{Weather-RPCD2UW3.js → Weather-7LIQ4POB.js} +21 -21
  11. package/dist/{WorldClock-AC3EUSVG.js → WorldClock-KHBYIJQZ.js} +4 -4
  12. package/dist/ai/index.js +47 -47
  13. package/dist/apps/index.js +1 -1
  14. package/dist/bin/browser-check.js +1 -1
  15. package/dist/bin/media-host-check.js +1 -1
  16. package/dist/bin/ui-check.js +1 -1
  17. package/dist/brand.css +1 -1
  18. package/dist/charts/ChartFrame.js +1 -1
  19. package/dist/charts/SpecChart.js +1 -1
  20. package/dist/{chunk-6LDXTZGE.js → chunk-3OUG6QAD.js} +1 -1
  21. package/dist/{chunk-XRTH47EO.js → chunk-3QNZ7YGZ.js} +66 -66
  22. package/dist/chunk-42RCQEEJ.js +14 -0
  23. package/dist/{chunk-U7WDBCVV.js → chunk-4OBSVO6U.js} +1 -1
  24. package/dist/{chunk-3PLQKRD4.js → chunk-5HBAJ2UA.js} +14 -14
  25. package/dist/{chunk-EMRTVPQ5.js → chunk-6CDWPEND.js} +7 -7
  26. package/dist/{chunk-L3BECLHD.js → chunk-6LS6Q77E.js} +1 -1
  27. package/dist/{chunk-EHNQGKW4.js → chunk-7JG64RQW.js} +1 -1
  28. package/dist/{chunk-FT2YDMG7.js → chunk-A4WNUFLT.js} +1 -1
  29. package/dist/chunk-AOLJKOO6.js +28 -0
  30. package/dist/{chunk-NEHVW324.js → chunk-AWWNMSDN.js} +8 -8
  31. package/dist/chunk-BWJZTHZ6.js +1 -0
  32. package/dist/{chunk-2GMYO6ET.js → chunk-BWLC56GZ.js} +1 -1
  33. package/dist/chunk-CBUBDXJ2.js +1 -0
  34. package/dist/{chunk-S5N37QIV.js → chunk-CGKY4ZRA.js} +1 -1
  35. package/dist/{chunk-IG7JPSBG.js → chunk-D3T3JCUC.js} +1 -1
  36. package/dist/{chunk-B53VREFW.js → chunk-DVHRL3G6.js} +5 -5
  37. package/dist/chunk-EV5BEEVO.js +1 -0
  38. package/dist/chunk-F6UJLCMI.js +19 -0
  39. package/dist/chunk-FHNQC2MA.js +1 -0
  40. package/dist/{chunk-AHMYBYXJ.js → chunk-G4PPHQ23.js} +1 -1
  41. package/dist/chunk-G5UGCAWN.js +17 -0
  42. package/dist/{chunk-LURBH6G4.js → chunk-GKNF53YM.js} +1 -1
  43. package/dist/chunk-GSLZ46DJ.js +24 -0
  44. package/dist/{chunk-GITRDCHS.js → chunk-GURY4WS5.js} +1 -1
  45. package/dist/chunk-HNPJ3V3I.js +6 -0
  46. package/dist/{chunk-2QE6QD4Y.js → chunk-HVHIXX6O.js} +8 -8
  47. package/dist/{chunk-JPKNVTTK.js → chunk-I6JTDAOB.js} +1 -1
  48. package/dist/{chunk-YY7OFUT2.js → chunk-JFRBUVHX.js} +2 -2
  49. package/dist/chunk-KXPXLUNM.js +4 -0
  50. package/dist/chunk-LHHJHTWP.js +1 -0
  51. package/dist/{chunk-QQGNTDMO.js → chunk-LLYMOV4S.js} +1 -1
  52. package/dist/{chunk-AI4A7GYI.js → chunk-NISLELJF.js} +1 -1
  53. package/dist/{chunk-WIFK6TLB.js → chunk-NYKOATR5.js} +1 -1
  54. package/dist/chunk-O2PVZC5D.js +8 -0
  55. package/dist/{chunk-SR6DDTUN.js → chunk-QQK7HKNK.js} +1 -1
  56. package/dist/{chunk-RZJ63ZM4.js → chunk-QVQO3EFL.js} +9 -9
  57. package/dist/{chunk-6LYKIC7W.js → chunk-RZ3OQFOD.js} +6 -6
  58. package/dist/chunk-S25KELFW.js +11 -0
  59. package/dist/{chunk-JHGBFZHL.js → chunk-S6YEPA4I.js} +5 -5
  60. package/dist/{chunk-L3STE7JN.js → chunk-TTLVTJR6.js} +1 -1
  61. package/dist/{chunk-UKBXQXDZ.js → chunk-U6DRRCCG.js} +1 -1
  62. package/dist/{chunk-TNNH6F3V.js → chunk-UGEX7SVM.js} +7 -7
  63. package/dist/chunk-UVCMV2TL.js +1 -0
  64. package/dist/{chunk-PKXHAF43.js → chunk-WJ7U6TGK.js} +6 -6
  65. package/dist/{chunk-HK53EKZH.js → chunk-WLG7BE55.js} +1 -1
  66. package/dist/{chunk-WBXPA7TY.js → chunk-WP43XYL6.js} +1 -1
  67. package/dist/{chunk-JMGDGNM7.js → chunk-WU2ZA6J2.js} +1 -1
  68. package/dist/chunk-YDQBELHJ.js +6 -0
  69. package/dist/{chunk-YNVH2EIE.js → chunk-ZNKZ6J65.js} +3 -3
  70. package/dist/chunk-ZOCE74ED.js +2 -0
  71. package/dist/data/EntityList.js +1 -1
  72. package/dist/data/ResizableTable.js +1 -1
  73. package/dist/data/statusColumn.d.ts +30 -0
  74. package/dist/data/statusColumn.js +1 -0
  75. package/dist/data/useColumnConfig.js +1 -1
  76. package/dist/forms/BorderInput.js +1 -1
  77. package/dist/forms/BrandAssetEditor.js +1 -1
  78. package/dist/forms/ColorPicker.js +1 -1
  79. package/dist/forms/ComposerAttachments.js +1 -1
  80. package/dist/forms/FilePicker.js +1 -1
  81. package/dist/forms/IconPicker.js +1 -1
  82. package/dist/forms/MediaLibrary.js +1 -1
  83. package/dist/forms/MediaUploadField.js +1 -1
  84. package/dist/forms/MediaUploadGrid.js +1 -1
  85. package/dist/forms/MediaUsedInList.js +1 -1
  86. package/dist/forms/TagInput.js +1 -1
  87. package/dist/forms/WidthsBar.js +1 -1
  88. package/dist/icons/brands.node.js +1 -1
  89. package/dist/icons/efficient-glyphs.js +1 -1
  90. package/dist/icons/efficient-looks.js +1 -1
  91. package/dist/icons/efficient.js +1 -1
  92. package/dist/icons/looks/map.js +1 -1
  93. package/dist/icons/payment.js +1 -1
  94. package/dist/icons/sets.js +1 -1
  95. package/dist/index.d.ts +2 -1
  96. package/dist/index.js +517 -517
  97. package/dist/page-tabs/index.js +5 -5
  98. package/dist/shell/Card.js +1 -1
  99. package/dist/shell/ColoredBadge.js +1 -1
  100. package/dist/shell/ConfirmDialog.js +1 -1
  101. package/dist/shell/Dialog.d.ts +14 -4
  102. package/dist/shell/Dialog.js +1 -1
  103. package/dist/shell/Drawer.js +1 -1
  104. package/dist/shell/EditableGrid.js +1 -1
  105. package/dist/shell/ImageLightbox.js +1 -1
  106. package/dist/shell/Popover.js +1 -1
  107. package/dist/shell/SidebarLayout.js +1 -1
  108. package/dist/shell/StatusBadge.d.ts +7 -1
  109. package/dist/shell/StatusBadge.js +1 -1
  110. package/dist/shell/TransferProgress.js +1 -1
  111. package/dist/shell/Tree.js +1 -1
  112. package/dist/shell/discardGuard.js +1 -1
  113. package/dist/telemetry/index.js +1 -1
  114. package/dist/templates/AuthScreen.js +1 -1
  115. package/dist/templates/ChatTemplate.js +1 -1
  116. package/dist/templates/CheckoutTemplate.js +1 -1
  117. package/dist/templates/DashboardTemplate.js +1 -1
  118. package/dist/templates/DataTablePage.js +1 -1
  119. package/dist/templates/EmailTemplate.js +1 -1
  120. package/dist/templates/FormLayoutPage.js +1 -1
  121. package/dist/templates/GalleryTemplate.js +1 -1
  122. package/dist/ui/index.d.ts +2 -1
  123. package/dist/ui/index.js +1 -1
  124. package/dist/ui.css +4 -1
  125. package/dist/version.js +1 -1
  126. package/package.json +1 -1
  127. package/dist/Calculator-3PVLP3UK.js +0 -29
  128. package/dist/CurrencyConverter-JLRIAP2Z.js +0 -21
  129. package/dist/Notepad-BCND3SM3.js +0 -24
  130. package/dist/Stock-EPJQJ3XE.js +0 -16
  131. package/dist/chunk-4S3E3VJH.js +0 -11
  132. package/dist/chunk-64RHGJXK.js +0 -4
  133. package/dist/chunk-6AUQWWUA.js +0 -17
  134. package/dist/chunk-AEEK74UI.js +0 -6
  135. package/dist/chunk-FQD6P6EZ.js +0 -4
  136. package/dist/chunk-GYPYOBG5.js +0 -19
  137. package/dist/chunk-JGKDWDVM.js +0 -27
  138. package/dist/chunk-NJD7HVTP.js +0 -14
  139. package/dist/chunk-NMP74ZCB.js +0 -1
  140. package/dist/chunk-PR3VNBQY.js +0 -28
  141. package/dist/chunk-RIG5FEVS.js +0 -1
  142. package/dist/chunk-S5AGWCMT.js +0 -1
  143. package/dist/chunk-VP64XZR6.js +0 -1
  144. package/dist/chunk-XSHDPG45.js +0 -9
  145. /package/dist/{chunk-JR2HHKVP.js → chunk-HOHHRNCB.js} +0 -0
  146. /package/dist/{chunk-CLEMKDRO.js → chunk-VG6BT2UG.js} +0 -0
@@ -1,24 +0,0 @@
1
- import{getNumberingConfigs as e}from"./chunk-IG7JPSBG.js";import{SidebarLayout as t}from"./chunk-NJD7HVTP.js";import"./chunk-QWK6DRSN.js";import"./chunk-LXPDURUL.js";import{timeAgo as r}from"./chunk-OJI4ROSD.js";import"./chunk-NHKT5IH6.js";import"./chunk-36BRD5J3.js";import"./chunk-JRQMX4PK.js";import"./chunk-LF27WIN2.js";import{AboutApp as n}from"./chunk-L3STE7JN.js";import{useWindowManager as o,client_default as i}from"./chunk-XRTH47EO.js";import"./chunk-4LXCCZDM.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-M2TQOJ3G.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-BG3C4ALM.js";import"./chunk-JGKDWDVM.js";import"./chunk-FQD6P6EZ.js";import"./chunk-EIFNESXS.js";import"./chunk-FTKLODQK.js";import"./chunk-RIG5FEVS.js";import"./chunk-JR2HHKVP.js";import"./chunk-VWGWZY7A.js";import"./chunk-7QSDPSXP.js";import"./chunk-HK53EKZH.js";import"./chunk-4U5M37SF.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import{useShellPrefs as c}from"./chunk-KC3EX26K.js";import"./chunk-NMP74ZCB.js";import"./chunk-DWGYC7OD.js";import"./chunk-JMGDGNM7.js";import"./chunk-GOAFMGUI.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-EVYD6UFQ.js";import"./chunk-M5K4AX4E.js";import{Icon as s}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-G67CJAQ2.js";import"./chunk-SOZCWT6I.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-STKJA4PV.js";import{toast_default as l}from"./chunk-VQ35LXDC.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-IUVGHHR3.js";import"./chunk-C3QOHMR6.js";import{useRef as a,useEffect as p,useState as d,useCallback as m}from"react";import{useQuery as u}from"@tanstack/react-query";import{jsxs as h,Fragment as g,jsx as x}from"react/jsx-runtime";var y=[{key:"yellow",bg:"bg-yellow-100",border:"border-yellow-300",text:"text-yellow-900",dot:"bg-yellow-400"},{key:"blue",bg:"bg-blue-100",border:"border-blue-300",text:"text-blue-900",dot:"bg-blue-400"},{key:"green",bg:"bg-green-100",border:"border-green-300",text:"text-green-900",dot:"bg-green-400"},{key:"pink",bg:"bg-pink-100",border:"border-pink-300",text:"text-pink-900",dot:"bg-pink-400"},{key:"purple",bg:"bg-purple-100",border:"border-purple-300",text:"text-purple-900",dot:"bg-purple-400"},{key:"orange",bg:"bg-orange-100",border:"border-orange-300",text:"text-orange-900",dot:"bg-orange-400"},{key:"white",bg:"bg-white",border:"border-gray-300",text:"text-gray-900",dot:"bg-gray-300"}];var k={sales_order:{entityType:"order",endpoint:"/orders/sales-orders/"},purchase_order:{entityType:"purchase_order",endpoint:"/purchase-orders/"},invoice:{entityType:"invoice",endpoint:"/invoicing/invoices/"},vendor_invoice:{entityType:"vendor_invoice",endpoint:"/invoicing/vendor-invoices/"},shipment:{entityType:"shipment",endpoint:"/shipments/delivery-notes/"},receipt:{entityType:"payment",endpoint:"/invoicing/payments/"},vendor_payment:{entityType:"vendor_payment",endpoint:"/invoicing/vendor-payments/"},vendor_price_sheet:{entityType:"vendor_price_sheet",endpoint:"/pricing/manufacturer-price-sheets/"},client_price_sheet:{entityType:"price_sheet",endpoint:"/pricing/price-sheets/"},qc_report:{entityType:"qc_report",endpoint:"/qc-reports/"},warranty_claim:{entityType:"warranty_claim",endpoint:"/warranty-claims/claims/"},vendor_shipment:{entityType:"vendor_shipment",endpoint:"/shipments/goods-receipts/"}},b=/\[([ xX]?)\]/g;function f(){const{openEntity:f}=o(),{prefs:j,save:N}=c(),{data:v}=u({queryKey:["numbering-configs"],queryFn:()=>e(),retry:!1}),T=a({});p(()=>{if(!v)return;const e={};for(const t of v){const r=k[t.entity_type];if(!r)continue;const n=(t.prefix||"").replace("#","").toUpperCase();if(n&&(e[n]={...r,prefix:t.prefix}),t.alt_prefix){const n=t.alt_prefix.replace("#","").toUpperCase();n&&(e[n]={...r,prefix:t.alt_prefix})}}T.current=e},[v]);const w=j.notepad_notes||[],[_,D]=d(null),[S,C]=d(""),[W,G]=d(""),[J,M]=d("yellow"),[X,K]=d(!1),[O,$]=d(!1),H=a(null),R=a();p(()=>{if(!_&&w.length>0){const e=w[0];D(e.id),C(e.title),G(e.content),M(e.color)}},[w.length]);const U=m(e=>{N({notepad_notes:e})},[N]),Q=m(()=>{if(!_||!X)return;const e=w.map(e=>e.id===_?{...e,title:S,content:W,color:J,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);U(e),K(!1)},[_,X,S,W,J,w,U]);p(()=>{if(X)return R.current&&clearTimeout(R.current),R.current=setTimeout(Q,800),()=>{R.current&&clearTimeout(R.current)}},[X,Q]),p(()=>()=>{X&&Q()},[]);const E=e=>{X&&Q(),D(e.id),C(e.title),G(e.content),M(e.color),K(!1),$(!1)},I=e=>{const t=W.slice(0,e),r=W.slice(e).match(/^\[([ xX]?)\]/);if(!r)return;const n="x"===r[1]||"X"===r[1]?"[ ]":"[x]",o=W.slice(e+r[0].length);G(t+n+o),K(!0)},P=async(e,t)=>{const r=T.current[e];if(!r)return;const n=`${e}#${t}`;try{const{data:e}=await i.get(r.endpoint,{params:{search:n,page_size:1}}),t=(e?.results??e??[])[0];t?f(r.entityType,t.id,t,n):l.error(`${n} not found`)}catch{l.error(`Failed to look up ${n}`)}},F="Start writing...\n\nTips:\n [] Type [] for a checkbox, click to toggle\n SO#35001 Type XX#NNNNN to link entities (SO, PO, CI, VI, PL, etc.)",V=/* @__PURE__ */h(g,{children:[
2
- /* @__PURE__ */x("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */h("button",{onClick:()=>{X&&Q();const e={id:`note-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,title:"",content:"",color:"yellow",updated_at:/* @__PURE__ */(new Date).toISOString()},t=[e,...w];U(t),D(e.id),C(""),G(""),M("yellow"),K(!1),$(!0),setTimeout(()=>H.current?.focus(),50)},className:"w-full flex items-center justify-center gap-2 rounded-lg bg-accent-fill text-on-accent px-3 min-h-8 py-1 text-sm font-medium hover:bg-accent-fill-hover transition-colors",children:[
3
- /* @__PURE__ */x(s,{name:"add",className:"h-4 w-4",strokeWidth:2}),"New Note"]})}),
4
- /* @__PURE__ */x("div",{className:"flex-1 overflow-y-auto",children:0===w.length?/* @__PURE__ */x("p",{className:"text-sm text-gray-400 text-center py-8 px-4",children:"No notes yet. Create one to get started."}):w.map(e=>{const t=(n=e.color,y.find(e=>e.key===n)||y[0]);var n;/* @__PURE__ */
5
- return h("button",{onClick:()=>E(e),className:"w-full text-left px-3 py-3 border-b border-line-subtle transition-colors "+(_===e.id?"bg-accent-tint":"hover:bg-row-hover"),children:[
6
- /* @__PURE__ */h("div",{className:"flex items-center gap-2",children:[
7
- /* @__PURE__ */x("div",{className:`w-3 h-3 rounded-full shrink-0 ${t.dot}`}),
8
- /* @__PURE__ */x("span",{className:"text-sm font-medium text-gray-900 truncate flex-1",children:e.title||"Untitled"})]}),
9
- /* @__PURE__ */x("p",{className:"text-xs text-ink-faintest mt-0.5 truncate ml-5",children:e.content.replace(/\[[ xX]?\]/g,"").slice(0,60)||"Empty note"}),
10
- /* @__PURE__ */x("p",{className:"text-2xs text-gray-300 mt-0.5 ml-5",children:r(e.updated_at)})]},e.id)})})]});/* @__PURE__ */
11
- return h("div",{className:"h-full",children:[
12
- /* @__PURE__ */x(n,{app:"notepad"}),
13
- /* @__PURE__ */x(t,{sidebar:V,storageKey:"notepad.sidebarWidth",defaultWidth:224,minWidth:180,maxWidth:360,children:_?/* @__PURE__ */h("div",{className:"flex-1 flex flex-col min-w-0",children:[
14
- /* @__PURE__ */h("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-200",children:[
15
- /* @__PURE__ */x("input",{value:S,onChange:e=>{C(e.target.value),K(!0)},placeholder:"Note title...",className:"flex-1 text-lg font-semibold text-gray-900 outline-none bg-transparent placeholder:text-gray-300"}),
16
- /* @__PURE__ */x("div",{className:"flex gap-1",children:y.map(e=>/* @__PURE__ */x("button",{onClick:()=>{M(e.key),K(!0)},className:`w-5 h-5 rounded-full border-2 transition-all ${e.dot} ${J===e.key?"border-gray-600 scale-110":"border-transparent hover:border-gray-400"}`,title:e.key},e.key))}),
17
- /* @__PURE__ */x("button",{onClick:()=>(e=>{const t=w.filter(t=>t.id!==e);if(U(t),_===e){const e=t[0];e?E(e):(D(null),C(""),G(""))}})(_),title:"Delete note",className:"p-1 rounded text-gray-300 hover:text-red-500 transition-colors",children:/* @__PURE__ */x(s,{name:"trash",className:"h-4 w-4",strokeWidth:1.5})})]}),O?/* @__PURE__ */x("textarea",{ref:H,value:W,onChange:e=>{G(e.target.value),K(!0)},onBlur:()=>{$(!1),X&&Q()},placeholder:F,className:"flex-1 p-4 text-sm text-gray-700 outline-none resize-none bg-transparent leading-relaxed placeholder:text-gray-300 font-mono"}):/* @__PURE__ */x("div",{onClick:()=>{$(!0),setTimeout(()=>H.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:W?(e=>{if(!e)return[];const t=e.split("\n");return t.map((e,r)=>{const n=[];let o=0;const i=[],c=/([A-Z]{2,4})#(\d{4,6})/g;let l;for(;null!==(l=c.exec(e));){const e=l[1],t=l[2];if(T.current[e]){const n=l.index,o=l[0];i.push({idx:n,len:o.length,render:()=>/* @__PURE__ */x("button",{onClick:()=>P(e,t),className:"text-blue-600 hover:text-blue-800 hover:underline font-medium cursor-pointer",children:o},`ref-${r}-${n}`)})}}b.lastIndex=0;let a=0;for(let e=0;e<r;e++)a+=t[e].length+1;for(;null!==(l=b.exec(e));){const e="x"===l[1]||"X"===l[1],t=l.index,n=a+t;i.push({idx:t,len:l[0].length,render:()=>/* @__PURE__ */x("button",{onClick:()=>I(n),className:`inline-flex items-center justify-center w-4 h-4 rounded border ${e?"bg-blue-500 border-blue-500 text-white":"border-gray-400 bg-white hover:border-blue-400"} cursor-pointer align-text-bottom mr-0.5`,children:e&&/* @__PURE__ */x(s,{name:"check",className:"w-3 h-3",strokeWidth:3})},`cb-${r}-${t}`)})}i.sort((e,t)=>e.idx-t.idx);for(const t of i)t.idx>o&&n.push(/* @__PURE__ */x("span",{children:e.slice(o,t.idx)},`t-${r}-${o}`)),n.push(t.render()),o=t.idx+t.len;o<e.length&&n.push(/* @__PURE__ */x("span",{children:e.slice(o)},`t-${r}-${o}`)),0===n.length&&n.push(/* @__PURE__ */x("span",{children:"​"},`empty-${r}`));const p=/^\[x\]/i.test(e.trimStart());/* @__PURE__ */
18
- return x("div",{className:p?"line-through text-gray-400":"",children:n},r)})})(W):/* @__PURE__ */x("p",{className:"text-gray-300 whitespace-pre-line",children:F})}),
19
- /* @__PURE__ */h("div",{className:"px-4 min-h-8 py-1 border-t border-line-subtle flex items-center gap-4 text-2xs text-ink-faintest",children:[
20
- /* @__PURE__ */x("span",{children:"[] checkbox"}),
21
- /* @__PURE__ */x("span",{children:"SO#35001 entity link"}),
22
- /* @__PURE__ */x("span",{className:"ml-auto",children:O?"Editing":"Click to edit"})]})]}):/* @__PURE__ */x("div",{className:"flex-1 flex items-center justify-center",children:/* @__PURE__ */h("div",{className:"text-center text-gray-400",children:[
23
- /* @__PURE__ */x(s,{name:"page",className:"h-12 w-12 mx-auto mb-3 text-gray-300",strokeWidth:1}),
24
- /* @__PURE__ */x("p",{className:"text-sm",children:"Select a note or create a new one"})]})})})]})}export{f as default};
@@ -1,16 +0,0 @@
1
- import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-EHNQGKW4.js";import{useWidgetSettings as n}from"./chunk-XRTH47EO.js";import"./chunk-4LXCCZDM.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-M2TQOJ3G.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-BG3C4ALM.js";import"./chunk-JGKDWDVM.js";import"./chunk-FQD6P6EZ.js";import"./chunk-EIFNESXS.js";import"./chunk-FTKLODQK.js";import"./chunk-RIG5FEVS.js";import"./chunk-JR2HHKVP.js";import"./chunk-VWGWZY7A.js";import"./chunk-7QSDPSXP.js";import"./chunk-HK53EKZH.js";import"./chunk-4U5M37SF.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-KC3EX26K.js";import"./chunk-DWGYC7OD.js";import"./chunk-JMGDGNM7.js";import"./chunk-GOAFMGUI.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-EVYD6UFQ.js";import"./chunk-M5K4AX4E.js";import"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-G67CJAQ2.js";import"./chunk-SOZCWT6I.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-STKJA4PV.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-IUVGHHR3.js";import"./chunk-C3QOHMR6.js";import{useState as r,useCallback as c}from"react";import{jsxs as s,Fragment as i,jsx as a}from"react/jsx-runtime";var o=["AAPL","MSFT","GOOGL","TSLA","NVDA"],m="stock_symbols",l="stock_appearance",h={AAPL:{price:229.87,change:1.42,changePct:.62},MSFT:{price:451.16,change:-2.31,changePct:-.51},GOOGL:{price:178.34,change:.89,changePct:.5},AMZN:{price:201.45,change:-1.08,changePct:-.53},TSLA:{price:248.92,change:6.74,changePct:2.78},NVDA:{price:134.81,change:-3.12,changePct:-2.26},META:{price:563.27,change:4.55,changePct:.81}},p=Object.keys(h);function u(){try{const e=JSON.parse(localStorage.getItem(m)||"");if(Array.isArray(e)&&e.length)return e.slice(0,8)}catch{}return o}var d=e=>`${e>=0?"+":""}${e.toFixed(2)}`;function g(){const[o,g]=r(u),[k,x]=r(()=>e(l)),[j,N]=r(!1),[b,f]=r([]),[y,v]=r(k),[S,D]=r(""),A=c(()=>{f([...o]),v({...k}),D(""),N(!0)},[o,k]);n(A);const G=()=>{const e=S.trim().toUpperCase();!e||b.includes(e)||b.length>=8||(f(t=>[...t,e]),D(""))},M=p.filter(e=>!b.includes(e));/* @__PURE__ */
2
- return s(i,{children:[
3
- /* @__PURE__ */a("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${k.activeOpacity/100})`,backdropFilter:k.activeBlur>0?`blur(${k.activeBlur}px)`:void 0},children:/* @__PURE__ */a("div",{className:"px-4 py-3",children:0===o.length?/* @__PURE__ */a("div",{className:"text-xs text-gray-500 text-center py-6",children:"No symbols yet — add some in settings."}):/* @__PURE__ */a("div",{className:"space-y-0.5",children:o.map(e=>{const t=h[e],n=(t?.change??0)>=0,r=t?t.change>0?"text-green-600":t.change<0?"text-red-600":"text-gray-500":"text-gray-400";/* @__PURE__ */
4
- return s("div",{className:"flex items-center justify-between px-2 py-2 border-b border-gray-200 last:border-0",children:[
5
- /* @__PURE__ */a("span",{className:"text-sm font-bold text-gray-800 tracking-tight",children:e}),t?/* @__PURE__ */s("div",{className:"flex flex-col items-end leading-tight",children:[
6
- /* @__PURE__ */a("span",{className:"text-sm font-mono font-semibold text-gray-900 tabular-nums",children:(c=t.price,`$${c.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`)}),
7
- /* @__PURE__ */s("span",{className:`text-2xs font-medium tabular-nums ${r}`,children:[n?"▲":"▼"," ",d(t.change)," (",d(t.changePct),"%)"]})]}):/* @__PURE__ */a("span",{className:"text-sm font-mono text-gray-400 tabular-nums",children:"—"})]},e);var c})})})}),
8
- /* @__PURE__ */a(t,{open:j,onClose:()=>N(!1),title:"Stock Settings",appearance:y,onAppearanceChange:v,onSave:()=>{const e=b.map(e=>e.toUpperCase()).slice(0,8);g(e),x(y),localStorage.setItem(m,JSON.stringify(e)),localStorage.setItem(l,JSON.stringify(y)),N(!1)},children:/* @__PURE__ */s("div",{children:[
9
- /* @__PURE__ */s("h3",{className:"text-sm font-semibold text-ink mb-2",children:["Symbols ",
10
- /* @__PURE__ */s("span",{className:"text-2xs font-normal text-ink-faintest",children:["(",b.length,"/",8,")"]})]}),
11
- /* @__PURE__ */s("div",{className:"space-y-1 mb-2",children:[b.map((e,t)=>/* @__PURE__ */s("div",{className:"flex items-center justify-between py-1 px-2 bg-gray-50 rounded",children:[
12
- /* @__PURE__ */a("span",{className:"text-sm font-semibold text-gray-700",children:e}),
13
- /* @__PURE__ */a("button",{onClick:()=>f(e=>e.filter((e,n)=>n!==t)),className:"text-red-400 hover:text-red-600",children:"×"})]},t)),0===b.length&&/* @__PURE__ */a("p",{className:"text-2xs text-ink-faintest italic",children:"No symbols — add a ticker below."})]}),b.length<8?/* @__PURE__ */s("div",{className:"flex items-center gap-2",children:[
14
- /* @__PURE__ */a("input",{value:S,onChange:e=>D(e.target.value),onKeyDown:e=>{"Enter"===e.key&&G()},placeholder:"e.g. NVDA",className:"flex-1 bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm uppercase focus:outline-none focus:ring-1 focus:ring-blue-500"}),
15
- /* @__PURE__ */a("button",{onClick:G,className:"text-sm font-medium text-blue-600 hover:text-blue-800 px-2",children:"+ Add"})]}):/* @__PURE__ */s("p",{className:"text-2xs text-ink-faintest italic",children:["Max ",8," symbols — remove one to add another."]}),M.length>0&&b.length<8&&/* @__PURE__ */a("div",{className:"flex flex-wrap gap-2 mt-2",children:M.map(e=>/* @__PURE__ */a("button",{onClick:()=>f(t=>t.length<8?[...t,e]:t),className:"text-2xs font-medium text-gray-600 bg-gray-100 hover:bg-gray-200 rounded px-2 py-0.5 transition-colors",children:e},e))}),
16
- /* @__PURE__ */a("p",{className:"text-2xs text-ink-faintest mt-2",children:"Demo prices — static sample data, no live feed."})]})})]})}export{g as default};
@@ -1,11 +0,0 @@
1
- import{useShellLocale as e}from"./chunk-IUVGHHR3.js";import{formatPlain as r}from"./chunk-C3QOHMR6.js";import{useId as d,Children as n}from"react";import{jsxs as t,jsx as a}from"react/jsx-runtime";var i={none:{body:"",edge:"px-4 py-3"},sm:{body:"p-3",edge:"px-3 py-2"},md:{body:"p-4",edge:"px-4 py-3"},lg:{body:"p-6",edge:"px-6 py-4"}},l={neutral:"border-line",warning:"border-amber-300",current:"border-line"};function s({children:e,header:r,description:s,footer:c,padded:o=!0,padding:m,headingLevel:b,headerActions:u,"aria-label":p,className:h="",bodyClassName:x="",style:g,tone:f="neutral"}){const y=i[m??(o?"md":"none")],N=d(),v=d(),$=null!=r&&null!=s&&""!==s,w=null!=b&&null!=r,j=`h${b}`,k=null!=p&&""!==p,H=w||k,A=H?"section":"div",C=`rounded-(--radius-card) border ${l[f]} bg-surface shadow-sm ${h}`.trim(),R=n.toArray(e).length>0,B=R?"border-b border-line-subtle ":"",G="current"===f,I=G?"text-base font-semibold text-blue-700":"text-base font-semibold text-ink-strongest",L=G?"rounded-t-(--radius-card) bg-accent-tint ":"",M=`${B}${L}${y.edge} ${I}`;/* @__PURE__ */
2
- return t(A,{className:C,style:g,...k?{"aria-label":p}:w?{"aria-labelledby":N}:{},...$&&H?{"aria-describedby":v}:{},...G?{"aria-current":!0}:{},children:[$?
3
- /* @__PURE__ */t("div",{className:`${B}${L}${y.edge}`,children:[null!=u?/* @__PURE__ */t("div",{className:`flex items-center justify-between gap-3 ${I}`,children:[w?/* @__PURE__ */a(j,{id:N,children:r}):/* @__PURE__ */a("span",{children:r}),u]}):w?/* @__PURE__ */a(j,{id:N,className:I,children:r}):/* @__PURE__ */a("div",{className:I,children:r}),
4
- /* @__PURE__ */a("p",{id:v,className:G?"mt-0.5 text-xs text-gray-600":"mt-0.5 text-xs text-ink-faint",children:s})]}):null!=r&&(null!=u?
5
- /* @__PURE__ */t("div",{className:`${M} flex items-center justify-between gap-3`,children:[w?/* @__PURE__ */a(j,{id:N,children:r}):/* @__PURE__ */a("span",{children:r}),u]}):w?
6
- /* @__PURE__ */a(j,{id:N,className:M,children:r}):/* @__PURE__ */a("div",{className:M,children:r})),R&&/* @__PURE__ */a("div",{className:[y.body,x].filter(Boolean).join(" "),children:e}),c&&/* @__PURE__ */a("div",{className:`border-t border-gray-100 ${y.edge}`,children:c})]})}function c({label:d,value:n,icon:i,delta:l,className:s=""}){const c=e(),o="number"==typeof n&&c?r(n,c):n,m="up"===l?.direction?"text-green-600":"down"===l?.direction?"text-red-600":"text-gray-500",b="up"===l?.direction?"▲":"down"===l?.direction?"▼":"→";/* @__PURE__ */
7
- return t("div",{className:`rounded-(--radius-card) border border-gray-200 bg-white p-4 shadow-sm ${s}`.trim(),children:[
8
- /* @__PURE__ */t("div",{className:"flex items-center justify-between text-ink-faint",children:[
9
- /* @__PURE__ */a("span",{className:"text-xs font-medium uppercase tracking-wide",children:d}),i]}),
10
- /* @__PURE__ */t("div",{className:"mt-2 flex items-baseline gap-2",children:[
11
- /* @__PURE__ */a("span",{className:"text-2xl font-semibold text-gray-900",children:o}),l&&/* @__PURE__ */t("span",{className:`text-xs font-medium ${m}`,children:[b," ",l.value]})]})]})}export{s as Card,c as StatCard};
@@ -1,4 +0,0 @@
1
- import{useTabLayer as e,focusableIn as t,stopAfter as r}from"./chunk-DWGYC7OD.js";import{onOverlayOpen as n}from"./chunk-PGN5ME7B.js";import{Z_LAYERS as i}from"./chunk-62LW225J.js";import{popupBounds as o,VIEWPORT_MARGIN as a,placeMenu as c,followAnchor as s}from"./chunk-GLUJS42B.js";import{useHydrated as l,useBrowserLayoutEffect as u}from"./chunk-D65T4H6J.js";import{buttonClasses as d}from"./chunk-UQYNPYF4.js";import{registerModalEscapeInterceptor as m}from"./chunk-TWVUQUUD.js";import{useState as p,useRef as f,useId as h,useCallback as g,useEffect as v}from"react";import{createPortal as b}from"react-dom";import{jsxs as x,jsx as w}from"react/jsx-runtime";var y=/(^|[\s:])!?z-/;function k({trigger:k,children:C,title:N,description:D,"aria-label":E,align:j="start",side:O="bottom",open:T,defaultOpen:L=!1,onOpenChange:$,matchTriggerWidth:H=!1,maxHeight:P,initialFocus:S,id:W,triggerLabel:M,"aria-describedby":U,disabled:z,className:K="",triggerClassName:Y,panelClassName:B=""}){const[F,G]=p(L),J=(T??F)&&!z,R=l(),I=f(null),Q=f(null),V=f(null),q=f(null),A=h(),X=W??A,Z=h(),_=h(),ee=h(),te=f(null),re=f(!1),ne=f({openProp:T,onOpenChange:$});ne.current={openProp:T,onOpenChange:$};const ie=g(e=>{void 0===ne.current.openProp&&G(e),ne.current.onOpenChange?.(e)},[]),oe=g((e=!1)=>{re.current=e,ie(!1)},[ie]),ae=e=>{te.current=e.nativeEvent},ce=g(()=>{const e=V.current,t=Q.current;if(!e||!t)return;const r=t.getBoundingClientRect(),n=o(t),i=Math.max(0,n.right-n.left-2*a),s=e.style;s.left="0px",s.top="0px",s.maxWidth=`${i}px`,s.maxHeight="none",s.width=H?`${Math.min(r.width,i)}px`:"";const l={width:e.offsetWidth,height:e.offsetHeight},u=P??1/0,d=c({trigger:r,menu:{width:l.width,height:Math.min(l.height,u)},bounds:n,align:j,side:O}),m=Math.min(d.maxHeight,u);s.left=`${d.left}px`,s.top=`${d.top}px`,s.maxHeight=`${m}px`,s.overflowY=l.height>m?"auto":"",e.dataset.side=d.side,e.dataset.align=j},[j,O,H,P]);u(()=>{J&&R&&ce()}),v(()=>{if(!J||!R)return;const e=s(()=>Q.current,ce),t=q.current;if(!t||"undefined"==typeof ResizeObserver)return e;const r=new ResizeObserver(()=>ce());return r.observe(t),()=>{e(),r.disconnect()}},[J,R,ce]),v(()=>{if(!J)return;const e=e=>{let t=null,r=0;const n=e=>{t===e&&(t=null,window.clearTimeout(r),(e=>{if(te.current===e)return!1;const t=e.target;return!(t&&(I.current?.contains(t)||V.current?.contains(t)))})(e)&&oe(!0))},i=e=>{t=e,r=window.setTimeout(()=>n(e),0)},o=e=>n(e);return document.addEventListener(e,i,!0),window.addEventListener(e,o),()=>{window.clearTimeout(r),document.removeEventListener(e,i,!0),window.removeEventListener(e,o)}},t=e("pointerdown"),r=e("focusin"),i=n(()=>oe()),o=m(e=>"Escape"===e.key&&(oe(),Q.current?.focus(),!0),()=>V.current);return()=>{t(),r(),i(),o()}},[J,oe]),e(V,J&&R),u(()=>{if(!J||!R)return;const e=V.current;return()=>{if(re.current)return;const t=document.activeElement;t&&t!==document.body&&!e?.contains(t)||Q.current?.focus({preventScroll:!0})}},[J,R]),v(()=>{if(!J||!R)return;const e=V.current;e&&(re.current=!1,(S?.current??t(e)[0]??e).focus({preventScroll:!0}))},[J,R]);const se="function"==typeof C?C({close:()=>oe()}):C,le=N?{"aria-labelledby":_}:E?{"aria-label":E}:{"aria-labelledby":X};/* @__PURE__ */
2
- return x("div",{ref:I,className:`relative inline-flex ${K}`.trim(),children:[
3
- /* @__PURE__ */w("button",{ref:Q,id:X,type:"button","aria-haspopup":"dialog","aria-expanded":J,"aria-controls":J&&R?Z:void 0,"aria-label":M,"aria-describedby":U,disabled:z,onClick:()=>J?oe():ie(!0),onKeyDown:e=>{if("Tab"!==e.key||e.shiftKey||!J)return;const r=(()=>{const e=V.current;return e?t(e)[0]??e:null})();r&&(e.preventDefault(),r.focus({preventScroll:!0}))},className:Y??d({variant:"secondary"}),children:k}),J&&R&&b(
4
- /* @__PURE__ */w("div",{ref:V,id:Z,role:"dialog",...le,"aria-describedby":D?ee:void 0,tabIndex:-1,"data-popover-panel":"",onPointerDownCapture:ae,onFocusCapture:ae,onKeyDown:e=>{const n=V.current,i=Q.current;if("Tab"!==e.key||!n||!i||!n.contains(e.target))return;const o=t(n),a=document.activeElement;if(e.shiftKey){if(o.length>0&&a!==o[0]&&a!==n)return;return e.preventDefault(),void i.focus({preventScroll:!0})}if(o.length>0&&a!==o[o.length-1])return;e.preventDefault();const c=r(i,n);oe(!!c),(c??i).focus({preventScroll:!0})},className:`fixed rounded-xl border border-gray-200 bg-white p-3 shadow-lg ${B}`.trim(),style:y.test(B)?void 0:{zIndex:i.popup},children:/* @__PURE__ */x("div",{ref:q,children:[N&&/* @__PURE__ */w("h2",{id:_,className:"text-sm font-semibold text-gray-900",children:N}),D&&/* @__PURE__ */w("p",{id:ee,className:"mt-1 text-sm text-gray-500",children:D}),N||D?/* @__PURE__ */w("div",{className:"mt-3",children:se}):se]})}),document.body)]})}export{k as Popover};
@@ -1,17 +0,0 @@
1
- import{ChartSkeleton as e}from"./chunk-ZNV75GAG.js";import{ChartHighlightProvider as r,useHighlight as a}from"./chunk-CNYAHYE6.js";import{CHART_INK as t,resolveSeriesColor as s}from"./chunk-TZFACUMR.js";import{useShellStrings as l}from"./chunk-IUVGHHR3.js";import{jsx as n,jsxs as o,Fragment as c}from"react/jsx-runtime";function i({shape:e,colour:r}){const a="shrink-0";switch(e){case"circle":/* @__PURE__ */
2
- return n("span",{className:`${a} h-2.5 w-2.5 rounded-full`,style:{backgroundColor:r}});case"circle-outline":/* @__PURE__ */
3
- return n("span",{className:`${a} h-2.5 w-2.5 rounded-full border-2`,style:{borderColor:r}});case"rounded-square-outline":/* @__PURE__ */
4
- return n("span",{className:`${a} h-2.5 w-2.5 rounded-sm border-2`,style:{borderColor:r}});case"square":/* @__PURE__ */
5
- return n("span",{className:`${a} h-2.5 w-2.5`,style:{backgroundColor:r}});case"bar":/* @__PURE__ */
6
- return n("span",{className:`${a} h-1 w-4 rounded-full`,style:{backgroundColor:r}});case"bar-vertical":/* @__PURE__ */
7
- return n("span",{className:`${a} h-3.5 w-1 rounded-full`,style:{backgroundColor:r}});default:/* @__PURE__ */
8
- return n("span",{className:`${a} h-2.5 w-2.5 rounded-sm`,style:{backgroundColor:r}})}}function d({entries:e,interactive:r,fallbackSwatch:t,onClick:l}){const{highlighted:d,setHighlighted:u}=a();/* @__PURE__ */
9
- return n("ul",{className:"m-0 flex flex-wrap items-center gap-x-4 gap-y-1 p-0",children:e.map((e,a)=>{const h=r&&null!==d&&d!==e.key,m=/* @__PURE__ */o(c,{children:[
10
- /* @__PURE__ */n(i,{shape:e.swatch??t,colour:s(a,e.color,e.tone)}),e.label]});/* @__PURE__ */
11
- return n("li",{className:"list-none",children:r||l?/* @__PURE__ */n("button",{type:"button",onClick:l?()=>l(e.key):void 0,"aria-pressed":l?Boolean(e.pressed):void 0,onMouseEnter:r?()=>u(e.key):void 0,onMouseLeave:r?()=>u(null):void 0,onFocus:r?()=>u(e.key):void 0,onBlur:r?()=>u(null):void 0,className:"flex items-center gap-2 rounded text-xs text-gray-600 transition-opacity rosh-focus-outline "+(h?"opacity-40":""),children:m}):/* @__PURE__ */n("span",{className:"flex items-center gap-2 text-xs text-gray-600",children:m})},e.key)})})}function u({title:a,subtitle:s,legend:c,table:i,tableLabel:u,busy:h=!1,loading:m=!1,skeletonVariant:p="area",skeletonHeight:b,interactiveLegend:g=!0,legendSwatch:y="rounded-square",onLegendClick:f,actions:k,children:N,className:x}){const w=l().charts;/* @__PURE__ */
12
- return n(r,{children:/* @__PURE__ */o("section",{className:`flex min-w-0 flex-col gap-3 rounded-lg border border-gray-200 bg-white p-5 ${x??""}`,"aria-busy":h||m||void 0,children:[
13
- /* @__PURE__ */o("header",{className:"flex items-start justify-between gap-4",children:[
14
- /* @__PURE__ */o("div",{className:"min-w-0",children:[
15
- /* @__PURE__ */n("h3",{className:"text-base font-semibold text-ink-strongest",children:a}),s&&/* @__PURE__ */n("p",{className:"mt-0.5 text-sm text-gray-500",children:s})]}),k&&/* @__PURE__ */n("div",{className:"shrink-0",children:k})]}),m?/* @__PURE__ */n(e,{variant:p,height:b}):/* @__PURE__ */n("div",{className:h?"opacity-60 transition-opacity":"transition-opacity",children:N}),!m&&c&&c.length>1&&/* @__PURE__ */n(d,{entries:c,interactive:g,fallbackSwatch:y,onClick:f}),!m&&i&&/* @__PURE__ */o("details",{className:"border-t border-gray-100 pt-3",children:[
16
- /* @__PURE__ */n("summary",{className:"cursor-pointer text-sm font-medium text-gray-600 rosh-focus-outline",children:u??w.showTable}),
17
- /* @__PURE__ */n("div",{className:"mt-3 overflow-x-auto",style:{color:t.label},children:i})]})]})})}export{u as ChartFrame};
@@ -1,6 +0,0 @@
1
- import{resolveColumnShares as e,COLUMN_SHARES_EQUAL as t,COLUMN_SHARE_MIN as r,COLUMN_COUNT_MAX as n}from"./chunk-PLGJOHEG.js";import{InputNumber_default as o}from"./chunk-F5B5WOQ7.js";import{Tooltip as i}from"./chunk-SOZCWT6I.js";import{useShellStrings as l}from"./chunk-IUVGHHR3.js";import{useId as a,useRef as s,useState as c,useEffect as u,Fragment as d}from"react";import{jsxs as h,jsx as f}from"react/jsx-runtime";var m=(e,t,r)=>Math.min(r,Math.max(t,e)),p=e=>e.reduce((e,t)=>e+t,0),v=(e,t)=>e.length===t.length&&e.every((e,r)=>e===t[r]);var g,b="w-0.5",y=`${b} group-hover/widths:w-1 group-focus-visible/widths:w-1`;var w=["text-blue-700","text-gray-600"];function x({count:x,value:$,onChange:k,label:C,"aria-labelledby":N,readOnly:P=!1,disabled:M=!1,className:R=""}){const j=l().widths,z=a(),B=m(Math.round(x)||1,1,n),O=e($,B),S=O??[...t[B]??[]],A=[...S,100-p(S)],T=P||M,D=s(null),H=s({onChange:k,shown:S,locked:T,n:B,stored:O});H.current={onChange:k,shown:S,locked:T,n:B,stored:O};const I=t=>{const{onChange:r,shown:n,locked:o,n:i}=H.current;if(o)return!1;const l=e(t,i);return!(!l||v(l,n))&&(r(l),!0)},K=(e,t,n)=>{const o=e[t]+e[t+1],i=[...e];i[t]=m(Math.round(n),r,o-r),i[t+1]=o-i[t],I(i.slice(0,-1))&&(ne.current=null)},E=e=>t=>{if(t.altKey||t.ctrlKey||t.metaKey)return;const n=t.shiftKey?10:1,o=A[e]+A[e+1],i="ArrowRight"===t.key?A[e]+n:"ArrowLeft"===t.key?A[e]-n:"PageUp"===t.key?A[e]+10:"PageDown"===t.key?A[e]-10:"Home"===t.key?r:"End"===t.key?o-r:null;null!==i&&(t.preventDefault(),K(A,e,i))},W=s(null),[F,G]=c(null),L=()=>{W.current=null,G(null),document.body.style.removeProperty("cursor"),document.body.style.removeProperty("user-select")};u(()=>L,[]);const U=e=>t=>{if(0!==t.button||T)return;t.preventDefault();const r=D.current?.getBoundingClientRect().width??0;r<=0||(W.current={i:e,x:t.clientX,width:r,from:A,moved:!1,pointer:t.pointerId},G(e),t.currentTarget.setPointerCapture?.(t.pointerId),document.body.style.cursor="col-resize",document.body.style.userSelect="none")},V=e=>{const t=W.current;if(!t)return;if(0===e.buttons)return void L();const r=e.clientX-t.x;if(!t.moved){if(Math.abs(r)<3)return;t.moved=!0}K(t.from,t.i,t.from[t.i]+r/t.width*100)},X=e=>{const t=W.current;t&&(e.currentTarget.hasPointerCapture?.(t.pointer)&&e.currentTarget.releasePointerCapture(t.pointer),L())},q=(e,t)=>{const{shown:n}=H.current,o=function(e,t,n){const o=e.length,i=[...e];if(o<2)return i;const l=m(Math.round(n),r,100-(o-1)*r);let a=l-i[t];i[t]=l;const s=[...Array.from({length:o-1-t},(e,r)=>t+1+r),...Array.from({length:t},(e,r)=>t-1-r)];if(a<0)return i[s[0]]-=a,i;for(const e of s){if(a<=0)break;const t=Math.min(a,i[e]-r);i[e]-=t,a-=t}return i}([...n,100-p(n)],e,t);return I(o.slice(0,-1))?o:null},[J,Q]=c(0);u(()=>{const e=D.current;if(!e||"undefined"==typeof ResizeObserver)return;const t=new ResizeObserver(()=>Q(e.getBoundingClientRect().width));return t.observe(e),()=>t.disconnect()},[]);const Z=s(null),[Y,_]=c(null),[ee,te]=c([]),re=(e,t)=>_(r=>t?e:r===e?null:r),ne=s(null),oe=(e,t)=>{const r=ne.current;if(!r||r.column!==e||r.share!==t)return!1;const{onChange:n,locked:o,stored:i}=H.current;var l,a;return o||(l=i,a=r.stored,void 0===l||void 0===a?l===a:v(l,a))||n(r.stored),!0},ie=A.join(",");u(()=>{const e=null===Y?[]:function(e,t){if(!e)return[];const r=Array.from(e.querySelectorAll("input[data-widths-label]")),n=r[t]?.getBoundingClientRect();if(!n||0===n.width)return[];if(void 0===g&&(g=document.createElement("canvas").getContext("2d")),!g)return[];const o=g;return r.flatMap((e,r)=>{if(r===t)return[];const i=e.getBoundingClientRect(),l=getComputedStyle(e);o.font=`${l.fontWeight} ${l.fontSize} ${l.fontFamily}`;const a=o.measureText(e.value).width/2,s=(i.left+i.right)/2;return s+a>n.left&&s-a<n.right?[r]:[]})}(Z.current,Y);te(t=>v(t,e)?t:e)},[Y,ie,J]);const le=j.hint(B,r),ae=A.slice(0,-1).map((e,t)=>p(A.slice(0,t+1)));/* @__PURE__ */
2
- return h("div",{role:"group","aria-label":N?void 0:C,"aria-labelledby":N,"aria-describedby":B>1?z:void 0,className:`flex w-full min-w-0 flex-col gap-2 ${M?"opacity-60":""} ${R}`.trim(),children:[
3
- /* @__PURE__ */h("div",{ref:Z,"data-widths-bar":"",className:"relative h-8",children:[
4
- /* @__PURE__ */f("div",{ref:D,"data-widths-track":"",className:"flex h-full w-full overflow-hidden rounded-(--radius-control) bg-surface",children:A.map((e,t)=>/* @__PURE__ */f("div",{"data-widths-segment":"",style:{flexBasis:`${e}%`},className:`flex min-w-0 shrink-0 grow-0 items-center justify-center overflow-hidden whitespace-nowrap text-xs font-medium tabular-nums ${w[t%2]} ${t%2==0?"bg-accent-tint":""}`,children:1===B&&/* @__PURE__ */f("span",{"data-widths-label":"",children:`${e}%`})},t))}),
5
- /* @__PURE__ */f("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 rounded-(--radius-control) border border-line-strong"}),B>1&&A.map((e,t)=>/* @__PURE__ */h(d,{children:[(()=>{const n=Y===t,l=p(A.slice(0,t)),a=n?`max(${e}%, 40px)`:`${e}%`;/* @__PURE__ */
6
- return f("div",{"data-widths-tip":"",className:"absolute inset-y-0 "+(n?"z-20":""),style:{left:`clamp(0px, calc(${l+e/2}% - ${a} / 2), calc(100% - ${a}))`,width:a},children:/* @__PURE__ */f(i,{content:le,delay:600,describe:!1,className:"absolute inset-0",children:/* @__PURE__ */f(o,{appearance:"bare",value:e,display:()=>(e=>J>0&&J*e/100<36?String(e):`${e}%`)(e),suffix:"%",min:r,max:100-(B-1)*r,step:1,shiftStep:10,precision:0,allowEmpty:!1,reportWhileTyping:!1,readOnly:P,disabled:M,"aria-label":j.column(t+1),"aria-describedby":z,"data-widths-label":"",onChange:e=>{null===e||oe(t,e)||q(t,e)},onRevert:e=>((e,t)=>{H.current.locked||null===t||oe(e,t)||q(e,t)})(t,e),onFocus:()=>{ne.current={column:t,share:e,stored:H.current.stored},re(t,!0)},onBlur:()=>re(t,!1),className:`absolute inset-0 text-xs font-medium ${w[t%2]} ${ee.includes(t)&&!n?"opacity-0":""}`})})})})(),t<B-1&&/* @__PURE__ */f("div",{className:"absolute inset-y-0 z-10 w-3 -translate-x-1/2",style:{left:`${ae[t]}%`},children:/* @__PURE__ */f(i,{content:j.dragHint,delay:600,className:"relative flex h-full w-full",children:/* @__PURE__ */f("div",{role:"separator",tabIndex:M?-1:0,"aria-orientation":"vertical","aria-label":j.divider(t+1,t+2),"aria-valuenow":A[t],"aria-valuemin":r,"aria-valuemax":A[t]+A[t+1]-r,"aria-valuetext":j.dividerValue(t+1,A[t],t+2,A[t+1]),"aria-disabled":T||void 0,onKeyDown:T?void 0:E(t),onPointerDown:U(t),onPointerMove:V,onPointerUp:X,onPointerCancel:X,onLostPointerCapture:()=>{W.current&&L()},className:"group/widths flex h-full w-full touch-none justify-center rounded-(--radius-control) rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)] "+(T?"cursor-default":"cursor-col-resize"),children:/* @__PURE__ */f("span",{"aria-hidden":"true","data-widths-line":"",className:"h-full rounded-full "+(T?`${b} bg-gray-300`:`bg-accent-fill transition-[width,background-color] duration-(--motion-fast) group-hover/widths:bg-blue-700 ${F===t?"w-1":y}`)})})})})]},t))]}),B>1&&/* @__PURE__ */f("span",{id:z,className:"sr-only",children:le})]})}export{x as WidthsBar};
@@ -1,4 +0,0 @@
1
- import{useOverlayTarget as e,usePopupAnchor as r,usePanelPosition as i,usePopupLevel as t,usePopupLevelBindings as a,windowScrimStyle as o,OverlayLayerProvider as l,scrimHasCorners as n,popupLayerStyle as s}from"./chunk-RIG5FEVS.js";import{useDiscardGuard as d}from"./chunk-JR2HHKVP.js";import{dialogA11y as c}from"./chunk-VWGWZY7A.js";import{useDismissPopupsOnOpen as m}from"./chunk-7QSDPSXP.js";import{useFocusTrap as u,useScrollLock as p}from"./chunk-DWGYC7OD.js";import{Icon as f}from"./chunk-ISVODSRP.js";import{useHydrated as h}from"./chunk-D65T4H6J.js";import{registerModalEscapeInterceptor as v}from"./chunk-TWVUQUUD.js";import{useShellStrings as x}from"./chunk-IUVGHHR3.js";import{useRef as b,useId as y,useState as g,useEffect as k}from"react";import{createPortal as w}from"react-dom";import{jsxs as j,Fragment as N,jsx as $}from"react/jsx-runtime";var C="bg-black/30 backdrop-blur-sm",D={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-4xl","2xl":"max-w-6xl"};function V({open:V,onClose:H,title:S,description:W,role:G="dialog",children:I,footer:P,blocking:R=!1,size:U="md",aside:T=!1,dirty:E=!1,initialFocus:F,"aria-label":J,"aria-labelledby":O,"aria-describedby":Q,className:Y=""}){const z=b(null),A=y(),B=y(),K=!R,L=y(),X=x().dialog,Z=e(h()),[q,M]=g(null),_=d({open:V,dirty:E,onClose:H,title:S,layer:q}),ee=b(null),re=r(V&&null!==Z,ee),ie=i(re,z),te=t(V&&null!==Z,ee),ae=a(te,q),oe=o(te),le=null!==te.host;if(m(V),u(z,V&&null!==Z,F,ae),p(V),k(()=>{if(V)return v(()=>!ae.current?.(document.activeElement)&&(R||_(),!0),()=>z.current)},[V,R,_,ae]),!V||!Z)return null;/* @__PURE__ */
2
- return j(N,{children:[/* @__PURE__ */$("span",{ref:ee,hidden:!0,"data-popup-anchor":""}),w(
3
- /* @__PURE__ */$(l,{value:q,children:/* @__PURE__ */j("div",{ref:M,className:"fixed inset-0"+(T?" pointer-events-none opacity-0":le?" pointer-events-none":""),style:s(te),role:"presentation","data-overlay-layer":"","data-aside":T?"":void 0,children:[!le&&/* @__PURE__ */$("div",{className:`fixed inset-0 ${C}`,"aria-hidden":"true","data-popup-scrim":"system"}),oe&&/* @__PURE__ */$("div",{className:`fixed ${C}${T?"":" pointer-events-auto"}${n(te)?" rounded-(--radius-window)":""}`,style:oe,onClick:R?void 0:_,"aria-hidden":"true","data-popup-scrim":"window"}),
4
- /* @__PURE__ */$("div",{className:re?"fixed inset-0":"fixed inset-0 flex items-center justify-center p-4",onClick:R||le?void 0:e=>{e.target===e.currentTarget&&_()},children:/* @__PURE__ */j("div",{ref:z,"data-popup-panel":"",style:re?{left:ie?.left??0,top:ie?.top??0,visibility:ie?void 0:"hidden"}:void 0,...c({role:G,modal:!0,titleId:S?L:void 0,labelledBy:O,label:J}),"aria-describedby":Q??(W?B:I?A:void 0),className:`${re?"absolute max-h-[calc(100%-2rem)] w-[calc(100%-2rem)]":"relative max-h-full w-full"} ${D[U]} overflow-y-auto overscroll-contain rounded-(--radius-card) bg-white p-6 shadow-xl${le&&!T?" pointer-events-auto":""} ${Y}`.trim(),children:[S&&/* @__PURE__ */$("h2",{id:L,className:(K?"pr-8 ":"")+"text-base font-semibold text-gray-900",children:S}),W&&/* @__PURE__ */$("p",{id:B,className:((S?"mt-1":K?"pr-8":"")+" text-sm text-gray-500").trim(),children:W}),I&&/* @__PURE__ */$("div",{id:A,className:"mt-2 text-sm text-gray-600",children:I}),P&&/* @__PURE__ */$("div",{className:"mt-6 flex flex-wrap justify-end gap-3",children:P}),K&&/* @__PURE__ */$("button",{type:"button",onClick:_,"aria-label":X.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__ */$(f,{name:"close",className:"h-5 w-5",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true"})})]})})]})}),Z)]})}export{V as Dialog};
@@ -1,19 +0,0 @@
1
- import{escapeHtml as e}from"./chunk-G6DKCCWH.js";import{TH_ONE_LINE as t}from"./chunk-G67CJAQ2.js";import{useBrowserLayoutEffect as n}from"./chunk-D65T4H6J.js";import{useShellStrings as r}from"./chunk-IUVGHHR3.js";import{useRef as o,useState as l,useEffect as c,useCallback as a,useMemo as s}from"react";import{createPortal as i}from"react-dom";import{jsxs as u,jsx as h,Fragment as d}from"react/jsx-runtime";function w(e,t){const n=e[e.length-1];return n&&!n.some(e=>e.trim())?e:[...e,Array(t).fill("")]}function m({text:t,...n}){const r=s(()=>({__html:e(t)}),[t]);/* @__PURE__ */
2
- return h("div",{...n,dangerouslySetInnerHTML:r})}function g({columns:e,data:g,onChange:f,onColumnsChange:p,fixedRows:b=!1,minRows:y=15,maxHeight:v="260px",cellStyles:x,onFocusChange:M,onSelectionChange:D}){const k=o(null),C=r().grid,[E,$]=l(null);c(()=>{M?.(E)},[E,M]);const[L,S]=l({}),z=o(null),[A,N]=l({}),O=o(null),[T,K]=l(null),[R,H]=l(null),[P,F]=l(null),[I,j]=l(null),[X,Y]=l(null),W=o(null);n(()=>{const e=W.current;if(!e||e.row!==X?.row||e.col!==X?.col)return;W.current=null;const t=k.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]=l(null),[G,J]=l(null);c(()=>{D?.(q&&G?{anchor:q,end:G}:null)},[q,G,D]);const U=o(!1),[V,_]=l(null),Q=o(!1),Z=o({a:null,e:null});Z.current={a:q,e:G};const ee=q&&G&&(q.row!==G.row||q.col!==G.col),te=[...g];if(!b)for(;te.length<y;)te.push(Array(e.length).fill(""));const ne=a((t,n,r)=>{const o=te.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,f(o)},[te,e.length,f]),re=a((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!==(te[e]?.[t]||"")){const r=te.map(e=>[...e]);r[e]&&(r[e][t]=n,f(r))}}U.current=!0,e.shiftKey&&q||B({row:t,col:n}),J({row:t,col:n})},[te,f,q]),oe=a((e,t)=>{U.current&&J({row:e,col:t})},[]);c(()=>{const e=()=>{U.current=!1};return window.addEventListener("mouseup",e),()=>window.removeEventListener("mouseup",e)},[]),c(()=>{const e=e=>{if(!e.ctrlKey&&!e.metaKey||"c"!==e.key)return;if(!q||!G)return;const t=window.getSelection();if(t&&t.toString().length>0&&!ee)return;const n=Math.min(q.row,G.row),r=Math.max(q.row,G.row),o=Math.min(q.col,G.col),l=Math.max(q.col,G.col),c=[];for(let e=n;e<=r;e++){const t=[];for(let n=o;n<=l;n++)t.push(te[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,G,te,ee]),c(()=>{const t=t=>{if(!E)return;const n=document.activeElement;if(n?.isContentEditable)return;if(!k.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=te.map(e=>[...e]);for(let t=0;t<o.length;t++){const n=E.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=E.col+r;if(c>=e.length)break;e[c].readOnly||(l[n][c]=o[t][r].trim())}}f(b?l:w(l,e.length)),B({row:E.row,col:E.col}),J({row:Math.min(E.row+o.length-1,l.length-1),col:Math.min(E.col+(o[0]?.length||1)-1,e.length-1)})};return window.addEventListener("paste",t),()=>window.removeEventListener("paste",t)},[E,te,e,f,b]);const le=a((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=te.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())}}f(b?c:w(c,e.length))},[te,e,f,b]),ce=a((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(),ne(n,r,"")));if(t.preventDefault(),q&&G){const t=Math.min(q.row,G.row),n=Math.max(q.row,G.row),r=Math.min(q.col,G.col),o=Math.max(q.col,G.col),l=te.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]="");f(l)}else ne(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<te.length&&l>=0&&l<e.length){const e=k.current?.querySelector(`[data-row="${o}"][data-col="${l}"]`);e&&(e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",inline:"nearest"}),$({row:o,col:l}),Y(null),B({row:o,col:l}),J({row:o,col:l}))}},[e,te,te.length,ne,q,G,f]),ae=a(t=>{if(!b&&t>=te.length-2){const t=te.map(e=>[...e]);for(let n=0;n<5;n++)t.push(Array(e.length).fill(""));f(t)}},[b,te,e.length,f]),[se,ie]=l(null);c(()=>{if(!se)return;const e=()=>ie(null);return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e)},[se]);const ue=a(t=>{const n=te.map(e=>[...e]);n.splice(t,0,Array(e.length).fill("")),f(n)},[te,e.length,f]),he=a(e=>{if(te.length<=1)return;const t=te.filter((t,n)=>n!==e);f(t)},[te,f]),de=a(e=>{const t=te.map(t=>{const n=[...t];return n.splice(e,0,""),n});f(t)},[te,f]),we=a(t=>{if(e.length<=1)return;const n=te.map(e=>{const n=[...e];return n.splice(t,1),n});f(n)},[te,e.length,f]),me=a((e,t)=>{e.preventDefault(),b||ie({x:e.clientX,y:e.clientY,items:[{label:C.insertRowAbove,onClick:()=>{ue(t),ie(null)}},{label:C.insertRowBelow,onClick:()=>{ue(t+1),ie(null)}},{label:C.deleteRow(t+1),onClick:()=>{he(t),ie(null)}}]})},[b,ue,he,C]),ge=a((t,n)=>{t.preventDefault(),b||ie({x:t.clientX,y:t.clientY,items:[{label:C.insertColumnLeft,onClick:()=>{de(n),ie(null)}},{label:C.insertColumnRight,onClick:()=>{de(n+1),ie(null)}},{label:C.deleteColumn(String(e[n]?.title||n+1)),onClick:()=>{we(n),ie(null)}}]})},[b,e,de,we,C]),fe=t=>L[t]??e[t]?.width??150;c(()=>{const t=e=>{if(!z.current)return;const t=e.clientX-z.current.startX,n=Math.max(40,z.current.startW+t);S(e=>({...e,[z.current.col]:n}))},n=()=>{if(z.current&&p){const t=e.map((e,t)=>({...e,width:L[t]??e.width}));t[z.current.col]={...t[z.current.col],width:L[z.current.col]??e[z.current.col].width},p(t)}z.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,p]);const pe=e=>A[e]??28;c(()=>{const e=e=>{if(!O.current)return;const t=e.clientY-O.current.startY,n=Math.max(20,O.current.startH+t);N(e=>({...e,[O.current.row]:n}))},t=()=>{O.current=null,document.body.style.cursor=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[]);const be=a(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 te){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})),p){const n=e.map((e,n)=>({...e,width:n===t?l:L[n]??e.width}));p(n)}},[te,e,L,p]),ye=a(e=>{N(t=>{const n={...t};return delete n[e],n})},[]),ve=a(t=>{const{a:n,e:r}=Z.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,h=a;t.row>l?i=t.row:t.row<o&&(s=t.row),t.col>a?h=t.col:t.col<c&&(u=t.col);const d=l-o+1,w=a-c+1,m=te.map(e=>[...e]);for(;m.length<=i;)m.push(Array(e.length).fill(""));for(const e of m)for(;e.length<=h;)e.push("");function g(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<=h;t++){if(e>=o&&e<=l&&t>=c&&t<=a)continue;let n;if(1===w&&u===c&&h===a){const r=g(Array.from({length:d},(e,n)=>m[o+n]?.[t]??""));if(r){const c=parseFloat(m[l]?.[t]??"0"),a=parseFloat(m[o]?.[t]??"0"),s=e>l?e-l:-(o-e);n=String((e>l?c:a)+r.step*s)}else{const r=((e-o)%d+d)%d;n=m[o+r]?.[t]??""}}else if(1===d&&s===o&&i===l){const r=g(Array.from({length:w},(t,n)=>m[e]?.[c+n]??""));if(r){const o=parseFloat(m[e]?.[a]??"0"),l=parseFloat(m[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=m[e]?.[c+r]??""}}else{const r=((e-o)%d+d)%d,l=((t-c)%w+w)%w;n=m[o+r]?.[c+l]??""}m[e][t]=n}f(m),B({row:s,col:u}),J({row:i,col:h})},[te,e.length,f]);c(()=>{const e=e=>{if(!Q.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);_({row:r,col:o})},t=()=>{Q.current&&V&&ve(V),Q.current=!1,_(null),document.body.style.cursor=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[V,ve]);const xe=e=>{e.preventDefault(),e.stopPropagation(),Q.current=!0,document.body.style.cursor="crosshair"},Me=o(null),[De,ke]=l(0),[Ce,Ee]=l(800);c(()=>{const e=Me.current;if(!e)return;const t=()=>Ee(e.clientHeight||800);t();const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);const $e=te.length>100,Le=$e?Math.max(0,Math.floor(De/28)-20):0,Se=$e?Math.min(te.length,Math.ceil((De+Ce)/28)+20):te.length,ze=s(()=>te.slice(Le,Se),[te,Le,Se]),Ae=28*Le,Ne=28*(te.length-Se),Oe="px-2 h-8 text-left text-xs font-medium text-ink-faint uppercase bg-gray-100 border-b border-r border-line select-none";/* @__PURE__ */
3
- return u("div",{ref:Me,className:"border border-gray-300 rounded overflow-scroll grid-scroll",style:{maxHeight:v,height:v},onScroll:e=>ke(e.target.scrollTop),children:[
4
- /* @__PURE__ */u("table",{ref:k,className:"border-collapse select-none",style:{tableLayout:"fixed",minWidth:36+e.reduce((t,n)=>t+fe(e.indexOf(n)),0)},children:[
5
- /* @__PURE__ */u("colgroup",{children:[
6
- /* @__PURE__ */h("col",{style:{width:36}}),e.map((e,t)=>/* @__PURE__ */h("col",{style:{width:fe(t)}},e.key))]}),
7
- /* @__PURE__ */h("thead",{className:"sticky top-0 z-10",children:/* @__PURE__ */u("tr",{children:[
8
- /* @__PURE__ */h("th",{className:`${t} ${Oe} text-center w-9 cursor-pointer hover:bg-gray-200`,onClick:()=>{B({row:0,col:0}),J({row:te.length-1,col:e.length-1})},title:C.selectAll,children:"#"}),e.map((n,r)=>{const o=q&&G&&Math.min(q.col,G.col)<=r&&r<=Math.max(q.col,G.col)&&0===Math.min(q.row,G.row)&&Math.max(q.row,G.row)===te.length-1;/* @__PURE__ */
9
- return u("th",{className:`${t} ${Oe} cursor-pointer hover:bg-gray-200 relative${o?" !bg-blue-200":""}${I===r?" !bg-blue-100":""}`,style:{width:fe(r)},draggable:!0,onDragStart:()=>(e=>F(e))(r),onDragOver:e=>((e,t)=>{e.preventDefault(),j(t)})(e,r),onDrop:()=>(t=>{if(null===P||P===t)return F(null),void j(null);const n=te.map(e=>{const n=[...e],[r]=n.splice(P,1);return n.splice(t,0,r),n});if(f(n),p){const n=[...e],[r]=n.splice(P,1);n.splice(t,0,r),p(n)}F(null),j(null)})(r),onDragEnd:()=>{F(null),j(null)},onClick:e=>{e.shiftKey&&q||B({row:0,col:r}),J({row:te.length-1,col:r})},onContextMenu:e=>ge(e,r),children:[n.title,
10
- /* @__PURE__ */h("div",{className:"absolute -right-1 top-0 bottom-0 w-2 cursor-col-resize z-20",onMouseDown:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),z.current={col:t,startX:e.clientX,startW:fe(t)},document.body.style.cursor="col-resize"})(e,r),onDoubleClick:e=>{e.stopPropagation(),be(r)},title:C.resize})]},n.key)})]})}),
11
- /* @__PURE__ */u("tbody",{children:[Ae>0&&/* @__PURE__ */h("tr",{style:{height:Ae}}),ze.map((t,n)=>{const r=Le+n,o=q&&G&&Math.min(q.row,G.row)<=r&&r<=Math.max(q.row,G.row)&&0===Math.min(q.col,G.col)&&Math.max(q.col,G.col)===e.length-1;/* @__PURE__ */
12
- return u("tr",{style:{height:pe(r)},children:[
13
- /* @__PURE__ */u("td",{className:`relative px-1 py-1 text-center text-2xs text-ink-faintest border-b border-r border-line bg-surface-sunken select-none cursor-pointer hover:bg-gray-200${o?" !bg-blue-200 !text-gray-700":""}${R===r?" !bg-blue-100":""}`,draggable:!0,onDragStart:()=>(e=>K(e))(r),onDragOver:e=>((e,t)=>{e.preventDefault(),H(t)})(e,r),onDrop:()=>(e=>{if(null===T||T===e)return K(null),void H(null);const t=te.map(e=>[...e]),[n]=t.splice(T,1);t.splice(e,0,n),f(t),K(null),H(null)})(r),onDragEnd:()=>{K(null),H(null)},onClick:t=>{t.shiftKey&&q||B({row:r,col:0}),J({row:r,col:e.length-1})},onContextMenu:e=>me(e,r),children:[r+1,
14
- /* @__PURE__ */h("div",{className:"absolute -bottom-1 left-0 right-0 h-2 cursor-row-resize z-20",onMouseDown:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),O.current={row:t,startY:e.clientY,startH:pe(t)},document.body.style.cursor="row-resize"})(e,r),onDoubleClick:e=>{e.stopPropagation(),ye(r)},title:C.resize})]}),e.map((e,n)=>{const o=q&&G&&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,G,r,n),l=X?.row===r&&X?.col===n&&!e.readOnly,c=E?.row===r&&E?.col===n,a=x?.[`${r}:${n}`],s=q&&G?Math.max(q.row,G.row):-1,i=q&&G?Math.max(q.col,G.col):-1,d=q&&G&&r===s&&n===i,w=Q.current&&V&&q&&G&&(()=>{const e=Math.min(q.row,G.row),t=Math.max(q.row,G.row),o=Math.min(q.col,G.col),l=Math.max(q.col,G.col);let c=e,a=t,s=o,i=l;return V.row>t?a=V.row:V.row<e&&(c=V.row),V.col>l?i=V.col:V.col<o&&(s=V.col),r>=c&&r<=a&&n>=s&&n<=i&&!(r>=e&&r<=t&&n>=o&&n<=l)})(),g="sm"===a?.fontSize?"text-2xs":"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
- return u("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":""}${w?" !bg-blue-50 ring-1 ring-inset ring-blue-300":""}`,onMouseDown:e=>{if(e.target===e.currentTarget){re(e,r,n);const t=e.currentTarget.querySelector("[data-row][data-col]");t?.focus()}},onMouseEnter:()=>oe(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__ */h(m,{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 ${g}${f}`,onMouseDown:e=>re(e,r,n),onMouseEnter:()=>oe(r,n),onDoubleClick:()=>{e.readOnly||Y({row:r,col:n})},onFocus:()=>{$({row:r,col:n}),U.current||(B({row:r,col:n}),J({row:r,col:n}))},onBlur:e=>{const o=e.currentTarget.textContent||"";o!==(t[n]||"")&&ne(r,n,o),Y(null)},onInput:()=>ae(r),onPaste:e=>le(e,r,n),onKeyDown:t=>{if(!(l||e.readOnly||1!==t.key.length||t.ctrlKey||t.metaKey||t.altKey))return t.preventDefault(),ne(r,n,t.key),W.current={row:r,col:n},void Y({row:r,col:n});ce(t,r,n)},text:t[n]||""}),d&&/* @__PURE__ */h("div",{onMouseDown:xe,title:C.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__ */h("tr",{style:{height:Ne}})]})]}),se&&i(
17
- /* @__PURE__ */u(d,{children:[
18
- /* @__PURE__ */h("div",{className:"fixed inset-0 z-(--z-popup)",onPointerDown:()=>ie(null)}),
19
- /* @__PURE__ */h("div",{className:"fixed z-(--z-popup) bg-surface rounded-lg shadow-lg border border-line py-1 min-w-[160px]",style:{left:se.x,top:se.y},children:se.items.map((e,t)=>/* @__PURE__ */h("button",{onPointerDown:t=>{t.stopPropagation(),e.onClick()},className:"w-full text-left px-3 min-h-(--row-height-menu) py-2 leading-5 text-sm text-ink hover:bg-gray-100",children:e.label},t))})]}),document.body)]})}export{g as EditableGrid,w as withSpareRow};
@@ -1,27 +0,0 @@
1
- import{Dialog as e}from"./chunk-FQD6P6EZ.js";import{Icon as t}from"./chunk-ISVODSRP.js";import{buttonClasses as r}from"./chunk-UQYNPYF4.js";import{useShellStrings as n,splitAround as o}from"./chunk-IUVGHHR3.js";import{createContext as l,useContext as i,useState as s,useRef as a,useCallback as c,useEffect as u}from"react";import{jsxs as d,jsx as m,Fragment as h}from"react/jsx-runtime";var f=l(()=>Promise.resolve(!1)),b=()=>i(f),g=()=>Promise.resolve(!1),p=e=>g(e),v=()=>Promise.resolve(!1),y=e=>v(e),x=()=>Promise.resolve(null),N=e=>x(e),k={danger:{icon:"text-red-600 bg-red-100",button:r({variant:"danger"})},warning:{icon:"text-yellow-600 bg-yellow-100",button:r({variant:"warning"})},info:{icon:"text-blue-600 bg-accent-tint-strong",button:r({variant:"primary"})}},w=r({variant:"secondary"}),C=r({variant:"primary"}),P="w-full rounded-md border border-line-strong h-8 px-3 text-sm";function L(){/* @__PURE__ */
2
- return m(t,{name:"warning",className:"h-5 w-5",strokeWidth:1.5,"aria-hidden":"true"})}function j(){/* @__PURE__ */
3
- return m(t,{name:"close",className:"h-5 w-5",strokeWidth:1.5,"aria-hidden":"true"})}function F({children:t}){const[r,l]=s(!1),[i,b]=s({message:""}),[p,y]=s(0),N=a(),F=a(null),E=a(0),D=a([]),T=a(null),$=a(null),V=c(e=>{F.current=e.id,N.current=e.resolve,y(e.id),b(e.options),l(!0)},[]),W=c(e=>{const t="string"==typeof e?{message:e}:e;return new Promise(e=>{const r={id:++E.current,options:t,resolve:e};null===F.current?V(r):D.current.push(r)})},[V]),[H,I]=s(!1),[K,Q]=s({message:""}),[R,S]=s(""),U=a(),Y=c(e=>(Q(e),S(""),I(!0),new Promise(e=>{U.current=e})),[]),[G,O]=s(!1),[Z,q]=s({}),[z,A]=s(""),B=a(),J=c(e=>{const t="string"==typeof e?{message:e}:e;return q(t),A(t.defaultValue??""),O(!0),new Promise(e=>{B.current=e})},[]);u(()=>{g=W,v=Y,x=J},[W,Y,J]);const M=(e,t)=>{if(F.current!==e)return;const r=N.current,n=D.current.shift();n?V(n):(F.current=null,N.current=void 0,l(!1)),r?.(t)},X=e=>{I(!1),S(""),U.current?.(e)},_=e=>{if(e){const e=z.trim();if(!e&&!Z.allowEmpty)return O(!1),void B.current?.(null);O(!1),B.current?.(e)}else O(!1),B.current?.(null)},ee=i.variant||(i.confirmLabel?.toLowerCase().includes("delete")||i.message.toLowerCase().includes("delete")?"danger":"info"),te=k[ee],re=k["warning"===K.variant?"warning":"danger"],ne=K.confirmWord,oe=null==ne||R===ne,le=n().dialog,[ie,se]=o(le.typeToConfirm);/* @__PURE__ */
4
- return d(f.Provider,{value:W,children:[t,
5
- /* @__PURE__ */m(e,{open:r,onClose:()=>M(p,!1),initialFocus:T,footer:/* @__PURE__ */d(h,{children:[
6
- /* @__PURE__ */m("button",{ref:T,type:"button",onClick:()=>M(p,!1),className:w,children:i.cancelLabel||le.cancel}),
7
- /* @__PURE__ */m("button",{type:"button",onClick:()=>M(p,!0),className:te.button,children:i.confirmLabel||le.ok})]}),children:/* @__PURE__ */d("div",{className:"flex gap-4",children:[
8
- /* @__PURE__ */m("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${te.icon}`,children:/* @__PURE__ */m(L,{})}),
9
- /* @__PURE__ */d("div",{className:"flex-1",children:[
10
- /* @__PURE__ */m("h2",{className:"text-base font-semibold text-gray-900",children:i.title||le.confirmTitle}),
11
- /* @__PURE__ */m("p",{className:"mt-2 text-sm text-gray-600",children:i.message})]})]})}),
12
- /* @__PURE__ */d(e,{open:H,onClose:()=>X(!1),initialFocus:null!=ne?void 0:$,footer:/* @__PURE__ */d(h,{children:[
13
- /* @__PURE__ */m("button",{ref:$,type:"button",onClick:()=>X(!1),className:w,children:K.cancelLabel||le.destructiveCancel}),
14
- /* @__PURE__ */m("button",{type:"button",onClick:()=>X(!0),disabled:!oe,className:re.button,children:ne??K.confirmLabel??le.destructiveConfirm})]}),children:[
15
- /* @__PURE__ */m("button",{type:"button",onClick:()=>X(!1),"aria-label":le.close,className:"absolute right-4 top-4 rounded-md p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:/* @__PURE__ */m(j,{})}),
16
- /* @__PURE__ */d("div",{className:"flex gap-4",children:[
17
- /* @__PURE__ */m("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${re.icon}`,children:/* @__PURE__ */m(L,{})}),
18
- /* @__PURE__ */d("div",{className:"flex-1",children:[
19
- /* @__PURE__ */m("h2",{className:"text-base font-semibold text-gray-900 pr-6",children:K.title||le.destructiveTitle}),
20
- /* @__PURE__ */m("p",{className:"mt-2 text-sm text-gray-600",children:K.message}),null!=ne&&/* @__PURE__ */d(h,{children:[
21
- /* @__PURE__ */d("p",{className:"mt-3 text-sm text-gray-700",children:[ie,
22
- /* @__PURE__ */m("kbd",{className:"rounded border border-line-strong bg-surface-sunken px-2 py-0.5 text-xs font-bold text-red-600 font-mono",children:ne}),se]}),
23
- /* @__PURE__ */m("input",{autoFocus:!0,type:"text",value:R,onChange:e=>S(e.target.value),onKeyDown:e=>{"Enter"===e.key&&R===ne&&X(!0)},placeholder:ne,className:`mt-2 ${P} focus:border-red-500`})]})]})]})]}),
24
- /* @__PURE__ */d(e,{open:G,onClose:()=>_(!1),title:Z.title||le.promptTitle,footer:/* @__PURE__ */d(h,{children:[
25
- /* @__PURE__ */m("button",{type:"button",onClick:()=>_(!1),className:w,children:Z.cancelLabel||le.cancel}),
26
- /* @__PURE__ */m("button",{type:"button",onClick:()=>_(!0),disabled:!Z.allowEmpty&&!z.trim(),className:C,children:Z.confirmLabel||le.ok})]}),children:[Z.message&&/* @__PURE__ */m("p",{className:"text-sm text-gray-600",children:Z.message}),
27
- /* @__PURE__ */m("input",{autoFocus:!0,type:"text",value:z,onChange:e=>A(e.target.value),onKeyDown:e=>{"Enter"===e.key?_(!0):"Escape"===e.key&&_(!1)},onFocus:e=>e.target.select(),placeholder:Z.placeholder,className:`mt-3 ${P} focus:border-blue-500 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-accent)]`})]})]})}export{F as ConfirmProvider,p as confirm,y as confirmDestructive,N as prompt,b as useConfirm};
@@ -1,14 +0,0 @@
1
- import{SidebarBarContext as e,SidebarSheetContext as l}from"./chunk-QWK6DRSN.js";import{readStoredWidth as r,ResizeHandle as t}from"./chunk-LXPDURUL.js";import{useIsPhone as a}from"./chunk-UGTRSRIW.js";import{Icon as n}from"./chunk-ISVODSRP.js";import{useBrowserState as o}from"./chunk-D65T4H6J.js";import{useShellStrings as i}from"./chunk-IUVGHHR3.js";import{useState as s,useRef as c,useReducer as d,useMemo as h,Fragment as u,useEffect as m}from"react";import{jsxs as f,jsx as p}from"react/jsx-runtime";var b=(e,l,r)=>Math.min(Math.max(e,l),r);function x({sidebar:e,sidebarTop:l,sidebarBottom:n,children:u,side:m="left",storageKey:x,defaultWidth:N=256,minWidth:w=180,maxWidth:k=480,className:y="",sidebarClassName:D=("right"===m?"border-l border-gray-200 bg-gray-50":"border-r border-gray-200 bg-gray-50"),contentClassName:P="bg-white"}){const R="right"===m,j=i().sidebar,z=a(),C=function(){const[e,l]=s(!1),r=c(null),t=c(/* @__PURE__ */new Map),[,a]=d(e=>e+1,0),n=h(()=>({report(e,l,r){const n={label:l,el:r};return t.current.set(e,n),a(),()=>{t.current.get(e)===n&&(t.current.delete(e),a())}}}),[]);return{api:n,open:e,setOpen:l,current:()=>[...t.current.values()].sort((e,l)=>e.el&&l.el&&e.el.compareDocumentPosition(l.el)&Node.DOCUMENT_POSITION_PRECEDING?1:-1).map(e=>e.label()),trigger:r}}(),[I,O]=o(()=>(x?r(x,w,k):null)??b(N,w,k),b(N,w,k)),W=null!=l||null!=n,S=/* @__PURE__ */f("div",{className:"relative flex h-full shrink-0 flex-col",style:{width:I},children:[
2
- /* @__PURE__ */f("div",{className:`flex h-full flex-col ${W?"overflow-hidden":"overflow-y-auto"} ${D}`,children:[null!=l&&/* @__PURE__ */p("div",{className:"flex shrink-0 flex-col gap-2 px-2 pt-3 pb-2",children:l}),W?/* @__PURE__ */p("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e}):e,null!=n&&/* @__PURE__ */p("div",{className:"mt-auto flex shrink-0 flex-col gap-2 border-t border-gray-200 px-2 py-3",children:n})]}),
3
- /* @__PURE__ */p(t,{side:m,width:I,onResize:O,min:w,max:k,defaultWidth:b(N,w,k),storageKey:x,hint:j.resize})]}),E=/* @__PURE__ */p("div",{className:`flex min-w-0 flex-1 flex-col ${P}`,children:u});/* @__PURE__ */
4
- return f("div",z?{className:`relative flex h-full w-full flex-col overflow-hidden ${y}`,children:[
5
- /* @__PURE__ */p(g,{phone:C,top:l,fallback:j.sections}),E,
6
- /* @__PURE__ */p(v,{phone:C,bottom:n,label:j.sections,closeLabel:j.closeSections,children:e})]}:{className:`flex h-full w-full overflow-hidden ${y}`,children:[R?null:S,E,R?S:null]})}function g({phone:l,top:r,fallback:t}){const a=l.current();/* @__PURE__ */
7
- return f("div",{"data-sidebar-section-bar":!0,className:"flex h-11 shrink-0 items-center gap-2 border-b border-gray-200 bg-white px-3",children:[
8
- /* @__PURE__ */f("button",{ref:l.trigger,type:"button","aria-haspopup":"dialog","aria-expanded":l.open,onClick:()=>l.setOpen(!0),className:"flex h-8 min-w-0 flex-1 items-center gap-1 text-left text-sm font-semibold text-gray-900",children:[
9
- /* @__PURE__ */p("span",{className:"min-w-0 truncate",children:0===a.length?t:a.map((e,l)=>/* @__PURE__ */f(u,{children:[l>0&&" · ",e]},l))}),
10
- /* @__PURE__ */p(n,{name:"chevron-down",className:"size-4 shrink-0",strokeWidth:2,"aria-hidden":"true"})]}),null!=r&&/* @__PURE__ */p(e.Provider,{value:!0,children:/* @__PURE__ */p("div",{className:"flex min-w-0 max-w-[60%] shrink-0 items-center gap-2",children:r})})]})}function v({phone:e,bottom:r,label:t,closeLabel:a,children:n}){const o=c(null),{open:i,setOpen:s,trigger:d}=e,h=()=>{s(!1),o.current?.contains(document.activeElement)&&d.current?.focus()};return m(()=>{i&&o.current?.focus()},[i]),
11
- /* @__PURE__ */f(l.Provider,{value:e.api,children:[i&&/* @__PURE__ */p("button",{type:"button","aria-label":a,onClick:h,className:"absolute inset-0 z-(--z-in-box) cursor-default bg-gray-900/40"}),
12
- /* @__PURE__ */f("div",{ref:o,role:"dialog","aria-modal":"true","aria-label":t,tabIndex:-1,"data-sidebar-section-sheet":!0,onKeyDown:e=>{"Escape"===e.key&&(e.stopPropagation(),h())},onClick:e=>{const l=e.target.closest("button, a");!l||l.hasAttribute("aria-expanded")||l.closest("[data-sheet-keep-open]")||h()},className:(i?"flex":"hidden")+" absolute inset-x-0 bottom-0 z-(--z-in-box) max-h-[75%] flex-col rounded-t-2xl bg-white pt-2 shadow-(--elevation-dialog)",children:[
13
- /* @__PURE__ */p("div",{className:"mx-auto mb-2 h-1 w-9 shrink-0 rounded-full bg-gray-300","aria-hidden":"true"}),
14
- /* @__PURE__ */p("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 pb-3",children:n}),null!=r&&/* @__PURE__ */p("div",{className:"flex shrink-0 flex-col gap-2 border-t border-gray-200 px-2 py-3",children:r})]})]})}export{x as SidebarLayout};
@@ -1 +0,0 @@
1
- var r="13.13.0",a=r;export{a as APP_VERSION,r as VERSION};
@@ -1,28 +0,0 @@
1
- import{Tree as e,TreeRow as n,TreeGroup as l}from"./chunk-2QE6QD4Y.js";import{ImageLightbox as r}from"./chunk-NEHVW324.js";import{MarqueeBox as a}from"./chunk-IC72MGON.js";import{Drawer as i}from"./chunk-XSHDPG45.js";import{EmptyState as t}from"./chunk-VXSYHTBP.js";import{DescriptionList as o}from"./chunk-SACUSHVN.js";import{Breadcrumbs as d}from"./chunk-OZ4R6U2M.js";import{useGridSelection as s}from"./chunk-VLKDWKVR.js";import{useMarquee as c}from"./chunk-OLFYNMTD.js";import{ROOT_KEY as u,mediaLibraryMenu as m}from"./chunk-L2WBCXG7.js";import{useMediaMoveItems as p}from"./chunk-ZCGT5YNR.js";import{RenameField as h}from"./chunk-QIPO4EVJ.js";import{NativeSelect as f}from"./chunk-DEYVAMJQ.js";import{MediaUploadGrid as g}from"./chunk-EMRTVPQ5.js";import{MediaUsedInList as v}from"./chunk-GITRDCHS.js";import{Segmented as k}from"./chunk-HNIIDDLJ.js";import{copyToClipboard as y}from"./chunk-UFX7F3KG.js";import{Checkbox_default as b}from"./chunk-CGZBDI6C.js";import{useContextMenu as w,ContextMenu as x}from"./chunk-QMBMK6PP.js";import{Banner as C}from"./chunk-XWJT6TFU.js";import{Input_default as N}from"./chunk-PT4GMPUB.js";import{DropdownMenu as I}from"./chunk-3DSGJIC7.js";import{IconButton_default as D}from"./chunk-SV5RRBVA.js";import{useFileIntake as S,FileIntakeAlert as j}from"./chunk-VFSAJMNX.js";import{setModalDragAside as T,modalIdHolding as z}from"./chunk-EIFNESXS.js";import{ColoredBadge as F}from"./chunk-HK53EKZH.js";import{Button_default as E}from"./chunk-EVYD6UFQ.js";import{Icon as L}from"./chunk-ISVODSRP.js";import{Tooltip as O}from"./chunk-SOZCWT6I.js";import{buttonClasses as P}from"./chunk-UQYNPYF4.js";import{usePlotWidth as M}from"./chunk-MAFUXCPZ.js";import{useShellStrings as A}from"./chunk-IUVGHHR3.js";import{useRef as R,useMemo as U,useCallback as V,useState as B,useEffect as H}from"react";import{jsxs as K,Fragment as G,jsx as J}from"react/jsx-runtime";var Q="application/x-efficient-media-files",W="application/x-efficient-media-folder",X="application/x-efficient-media-file";function Y(e){if(!e||!Array.from(e.types).includes(X))return null;try{const n=JSON.parse(e.getData(X));if(n&&"string"==typeof n.id&&"string"==typeof n.url&&"string"==typeof n.name&&("image"===n.kind||"video"===n.kind))return{id:n.id,url:n.url,kind:n.kind,name:n.name}}catch{}return null}var $={type:"all",use:"any",sort:"newest"},Z={lock:/* @__PURE__ */J(L,{name:"lock","aria-hidden":"true",className:"h-4 w-4"}),folder:/* @__PURE__ */J(L,{name:"folder","aria-hidden":"true",className:"h-4 w-4"}),folderOpen:/* @__PURE__ */J(L,{name:"folder-open","aria-hidden":"true",className:"h-4 w-4"}),folderPlus:/* @__PURE__ */J(L,{name:"folder-plus","aria-hidden":"true",className:"h-4 w-4"}),trash:/* @__PURE__ */J(L,{name:"trash","aria-hidden":"true",className:"h-4 w-4"}),upload:/* @__PURE__ */J(L,{name:"upload","aria-hidden":"true",className:"h-4 w-4"}),search:/* @__PURE__ */J(L,{name:"search","aria-hidden":"true",className:"h-4 w-4"}),grid:/* @__PURE__ */J(L,{name:"grid","aria-hidden":"true",className:"h-4 w-4"}),list:/* @__PURE__ */J(L,{name:"list","aria-hidden":"true",className:"h-4 w-4"}),more:/* @__PURE__ */J(L,{name:"more","aria-hidden":"true",className:"h-4 w-4"}),copy:/* @__PURE__ */J(L,{name:"copy","aria-hidden":"true",className:"h-4 w-4"}),edit:/* @__PURE__ */J(L,{name:"edit","aria-hidden":"true",className:"h-4 w-4"}),swap:/* @__PURE__ */J(L,{name:"swap","aria-hidden":"true",className:"h-4 w-4"}),crop:/* @__PURE__ */J(L,{name:"crop","aria-hidden":"true",className:"h-4 w-4"}),external:/* @__PURE__ */J(L,{name:"external","aria-hidden":"true",className:"h-4 w-4"}),undo:/* @__PURE__ */J(L,{name:"undo","aria-hidden":"true",className:"h-4 w-4"})},q={link:/* @__PURE__ */J(L,{name:"link","aria-hidden":"true",className:"h-3 w-3"}),email:/* @__PURE__ */J(L,{name:"email","aria-hidden":"true",className:"h-3 w-3"}),lock:/* @__PURE__ */J(L,{name:"lock","aria-hidden":"true",className:"h-3 w-3"}),clock:/* @__PURE__ */J(L,{name:"clock","aria-hidden":"true",className:"h-3 w-3"})};function _(L){const{mode:Y="manage",layout:_="auto",location:ee,onLocationChange:ne,folders:le,products:re,allFilesCount:ae,trashCount:ie,files:te,query:oe,onQueryChange:de,filters:se=$,onFiltersChange:ce,extraFilters:ue,view:me="grid",onViewChange:pe,selectedIds:he,onSelectionChange:fe,usedIn:ge,denied:ve={},accept:ke="image/*,video/*",maxSizeBytes:ye,busy:be,progress:we,onUpload:xe,onNewFolder:Ce,onRename:Ne,onMove:Ie,onTrash:De,onDeleteFolder:Se,onRestore:je,onDeleteForever:Te,onEmptyTrash:ze,onReplace:Fe,onCropEdit:Ee,onOpenInDesign:Le,onChoose:Oe,onCancel:Pe,pickNote:Me,onDragOut:Ae,className:Re=""}=L,Ue=A().mediaLibrary,Ve=A().media,Be="pick"===Y,He=!Be,Ke=R(null),Ge=M(Ke,"phone"===_?343:1200),Je="phone"===_||"auto"===_&&Ge<640,Qe=U(()=>function(e=[]){const n=/* @__PURE__ */new Map,l=(e,r)=>{for(const a of e){const e=[...r,a];n.set(a.id,{node:a,path:e}),a.children&&l(a.children,e)}};return l(e,[]),n}(re),[re]),We=U(()=>new Map(le.map(e=>[e.id,e])),[le]),Xe=U(()=>{const e=/* @__PURE__ */new Map;for(const n of le){const l=n.parentId&&We.has(n.parentId)?n.parentId:null;e.set(l,[...e.get(l)??[],n])}return e},[le,We]),Ye=V(e=>{const n=[];for(let l=e?We.get(e):void 0;l&&(n.unshift(l),!(n.length>le.length));l=l.parentId?We.get(l.parentId):void 0);return n},[We,le.length]),$e=V((e,n)=>Ye(e).some(e=>e.id===n),[Ye]),[Ze,qe]=B(()=>/* @__PURE__ */new Set(["@files"])),_e=e=>qe(n=>{const l=new Set(n);return l.has(e)?l.delete(e):l.add(e),l}),en=V(e=>{qe(n=>e.every(e=>n.has(e))?n:/* @__PURE__ */new Set([...n,...e]))},[]),nn="files"===(ln=ee).place?`files:${ln.folderId??""}`:"products"===ln.place?`products:${ln.nodeId??""}`:"trash";var ln;H(()=>{if("files"===ee.place)en(["@files",...Ye(ee.folderId).slice(0,-1).map(e=>e.id)]);else if("products"===ee.place){const e=ee.nodeId?Qe.get(ee.nodeId)?.path??[]:[];en(["@products",...e.slice(0,-1).map(e=>`p:${e.id}`)])}},[nn]);const rn="products"===ee.place,an="trash"===ee.place,tn="files"===ee.place,on=tn?ee.folderId:null,dn=rn&&ee.nodeId?Qe.get(ee.nodeId)?.path[0]:void 0,sn=e=>e?.sharedFrom?`${Ue.readOnly} ${Ue.editedAtHq(e.sharedFrom)}`:Ue.readOnly,cn=U(()=>te.map(e=>e.id),[te]),un=U(()=>new Map(te.map(e=>[e.id,e])),[te]),mn=s(cn),pn=U(()=>cn.filter(e=>mn.selected.has(e)),[cn,mn.selected]),hn=1===pn.length?un.get(pn[0]):void 0,fn=R(!0);H(()=>{fn.current?fn.current=!1:mn.clear()},[nn]);const gn=he?.join("\0");H(()=>{he&&mn.setSelection(he)},[gn]);const vn=R(gn??""),kn=pn.join("\0");H(()=>{vn.current!==kn&&(vn.current=kn,fe?.(pn))},[kn]);const yn=(e,n={})=>{Be?mn.select(e):mn.select(e,{ctrl:!(!n.ctrlKey&&!n.metaKey),shift:!!n.shiftKey})},[bn,wn]=B(null),xn=e=>{const n=bn;if(wn(null),!n||null==e)return;e!==("folder"===n.kind?We.get(n.id)?.name:un.get(n.id)?.name)&&Ne?.(n,e)},Cn=async e=>{if(!Ce)return;const n=await Ce(e);en(["@files",...e?[e]:[]]),"string"==typeof n&&wn({kind:"folder",id:n})},Nn=V(e=>{const n=[],l=n=>{if("files"===e.kind)return n===on&&tn?Ue.alreadyHere:void 0;const l=We.get(e.id);return n===e.id||n&&$e(n,e.id)?Ue.notIntoItself:(l?.parentId??null)===n?Ue.folderAlreadyHere:void 0};n.push({key:u,label:Ue.allFiles,disabledReason:l(null)});const r=(e,a)=>{for(const i of Xe.get(e)??[])n.push({key:i.id,label:i.name,depth:a,disabledReason:l(i.id)}),r(i.id,a+1)};return r(null,1),n},[Xe,We,tn,$e,on,Ue]),In=V(e=>{const n=new Set(e.map(e=>un.get(e)?.kind??"image"));return 1===n.size?[...n][0]:"file"},[un]),[Dn,Sn]=B(null),jn={words:Ue,media:Ve,denied:ve,moveTargets:Nn,kindOf:In,urlOf:e=>un.get(e)?.url,newSubfolder:Ce&&He?e=>{Cn(e)}:void 0,rename:Ne&&He?e=>{"file"!==e.kind||mn.isSelected(e.id)||mn.select(e.id),wn(e)}:void 0,move:Ie&&He?Ie:void 0,trash:De&&He?De:void 0,deleteFolder:Se&&He?Se:void 0,folderNotEmpty:e=>!!We.get(e)?.notEmpty,replace:Fe&&He?Fe:void 0,copyUrl:e=>{const n=un.get(e)?.url;n&&y(Ue.urlLabel,n)},openInDesign:Le,restore:je,deleteForever:Te},Tn=e=>m(e,jn),zn=w(),Fn=(e,n)=>{Be||(mn.isSelected(e)||mn.select(e),zn.open(n,(e=>{const n=mn.isSelected(e)?pn:[e];return rn?{kind:"render",id:e}:an?{kind:"trashed",ids:n}:{kind:"files",ids:n}})(e)))},[En,Ln]=B(null),[On,Pn]=B(null),[Mn,An]=B(null);H(()=>{if(!On&&!En)return;const e=()=>{Pn(null),Ln(null)};return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[On,En]);const Rn=(e,n)=>Array.from(e.dataTransfer?.types??[]).includes(n),Un=(e,n)=>!(!Ie||ve.move||Be)&&(!!Rn(e,Q)||!(!Rn(e,W)||!Mn)&&(n!==Mn&&!(n&&$e(n,Mn)))),Vn=(e,n)=>({onDragEnter:l=>{Un(l,n)&&(l.preventDefault(),Ln(e))},onDragOver:l=>{Un(l,n)&&(l.preventDefault(),l.dataTransfer.dropEffect="move",En!==e&&Ln(e))},onDragLeave:n=>{const l=n.relatedTarget;l&&n.currentTarget.contains(l)||Ln(n=>n===e?null:n)},onDrop:e=>{if(Un(e,n))if(e.preventDefault(),Ln(null),Rn(e,Q)){let l;try{l=JSON.parse(e.dataTransfer.getData(Q))}catch{l=null}Array.isArray(l)&&l.length&&Ie({kind:"files",ids:l.map(String)},n)}else Mn&&(Ie({kind:"folder",id:Mn},n),An(null))}}),Bn=e=>{const n=e=>Rn(e,Q)||Rn(e,W)||Rn(e,"Files");return{onDragEnter:l=>{n(l)&&Pn(e)},onDragOver:l=>{n(l)&&On!==e&&Pn(e)},onDragLeave:n=>{const l=n.relatedTarget;l&&n.currentTarget.contains(l)||Pn(n=>n===e?null:n)}}},Hn=(e,n,l)=>/* @__PURE__ */J(O,{side:"right",content:On===e?Ue.noDropProducts:sn(l),open:On===e||!On&&void 0,children:/* @__PURE__ */J("span",{children:n})}),Kn=e=>({onContextMenu:n=>{zn.open(n,e)}}),Gn=(e,r,a)=>e.map(e=>{const i=`p:${e.id}`,t=a??e,o=Ze.has(i),d=e.children?.length?e.children:null;/* @__PURE__ */
2
- return K("div",{role:"none",className:"contents",children:[
3
- /* @__PURE__ */J(n,{label:Hn(i,e.name,t),level:r,icon:d&&o?Z.folderOpen:Z.folder,count:e.count,countLabel:null!=e.count?e.countLabel??Ue.fileCount(e.count):void 0,selected:rn&&ee.nodeId===e.id,expanded:d?o:void 0,onToggle:d?()=>_e(i):void 0,onSelect:()=>ne({place:"products",nodeId:e.id}),rowProps:{"data-media-row":i,...Bn(i),...He?Kn({kind:"product-node",id:e.id}):{}}}),d&&o&&/* @__PURE__ */J(l,{children:Gn(d,r+1,t)})]},e.id)}),Jn=(e,r)=>(Xe.get(e)??[]).map(e=>{const a=Xe.get(e.id),i=Ze.has(e.id),t="folder"===bn?.kind&&bn.id===e.id,o=Tn({kind:"folder",id:e.id});/* @__PURE__ */
4
- return K("div",{role:"none",className:"contents",children:[
5
- /* @__PURE__ */J(n,{label:e.name,level:r,icon:a&&i?Z.folderOpen:Z.folder,count:e.count,countLabel:null!=e.count?e.countLabel??Ue.fileCount(e.count):void 0,selected:t||tn&&ee.folderId===e.id,expanded:a?i:void 0,onToggle:a?()=>_e(e.id):void 0,onSelect:()=>ne({place:"files",folderId:e.id}),drop:En===e.id?"into":void 0,dragging:Mn===e.id,draggable:He&&!!Ie&&!ve.move,rename:t?/* @__PURE__ */J(h,{value:e.name,label:Ue.folderName,onDone:xn}):void 0,actions:He&&o.length?/* @__PURE__ */J(I,{align:"end","aria-label":Ue.folderActions,trigger:Z.more,items:o}):void 0,rowProps:{"data-media-row":e.id,...Vn(e.id,e.id),...He?Kn({kind:"folder",id:e.id}):{},...He&&Ie&&!ve.move?{draggable:!0,onDragStart:n=>{n.dataTransfer.effectAllowed="move",n.dataTransfer.setData(W,e.id),An(e.id)},onDragEnd:()=>{An(null),Ln(null)}}:{}}}),a&&i&&/* @__PURE__ */J(l,{children:Jn(e.id,r+1)})]},e.id)}),Qn=Ze.has("@files"),Wn=Ze.has("@products"),Xn=/* @__PURE__ */K(e,{"aria-label":Ue.folders,children:[re&&/* @__PURE__ */K(G,{children:[
6
- /* @__PURE__ */J(n,{label:Hn("@products",Ue.products),level:1,icon:Z.lock,badge:{label:Ue.readOnlyBadge,tone:"neutral"},expanded:re.length?Wn:void 0,onToggle:()=>_e("@products"),selected:rn&&null==ee.nodeId,onSelect:()=>ne({place:"products",nodeId:null}),rowProps:{"data-media-row":"@products",...Bn("@products")}}),Wn&&re.length>0&&/* @__PURE__ */J(l,{children:Gn(re,2)})]}),
7
- /* @__PURE__ */J(n,{label:Ue.allFiles,level:1,icon:Qn?Z.folderOpen:Z.folder,count:ae,countLabel:null!=ae?Ue.fileCount(ae):void 0,expanded:Xe.get(null)?.length?Qn:void 0,onToggle:()=>_e("@files"),selected:tn&&null==ee.folderId,onSelect:()=>ne({place:"files",folderId:null}),drop:"@files"===En?"into":void 0,rowProps:{"data-media-row":"@files",...Vn("@files",null)}}),Qn&&(Xe.get(null)?.length??0)>0&&/* @__PURE__ */J(l,{children:Jn(null,2)}),He&&/* @__PURE__ */J(n,{label:Ue.trash,level:1,icon:Z.trash,count:ie,countLabel:null!=ie?Ue.fileCount(ie):void 0,selected:an,onSelect:()=>ne({place:"trash"}),rowProps:{"data-media-row":"@trash"}})]}),Yn=(()=>{if(an)return[{label:Ue.trash}];if(rn){const e=ee.nodeId?Qe.get(ee.nodeId)?.path??[]:[];return[{label:Ue.products,onClick:e.length?()=>ne({place:"products",nodeId:null}):void 0},...e.map((n,l)=>({label:n.name,onClick:l<e.length-1?()=>ne({place:"products",nodeId:n.id}):void 0}))]}const e=Ye(on);return[{label:Ue.allFiles,onClick:e.length?()=>ne({place:"files",folderId:null}):void 0},...e.map((n,l)=>({label:n.name,onClick:l<e.length-1?()=>ne({place:"files",folderId:n.id}):void 0}))]})(),$n=rn?Ue.readOnly:ve.upload,Zn=!!xe&&!an&&!$n,qn=S({accept:ke,maxSizeBytes:ye,multiple:!0,disabled:!Zn,onAccept:e=>xe?.(e,on)}),_n=rn?Ue.noProductFolder:ve.newFolder,el=e=>e?{"aria-disabled":!0,disabledReason:e}:{},nl=/* @__PURE__ */K("div",{className:"flex flex-wrap items-center gap-2",children:[He&&Ce&&!an&&/* @__PURE__ */J(E,{variant:"secondary",size:"sm",leftIcon:Z.folderPlus,onClick:()=>{Cn(on)},...el(_n),children:Ue.newFolder}),xe&&!an&&/* @__PURE__ */J(E,{variant:"primary",size:"sm",leftIcon:Z.upload,onClick:()=>qn.open(),...el($n),children:Ue.upload}),He&&an&&ze&&te.length>0&&/* @__PURE__ */J(E,{variant:"danger",size:"sm",onClick:ze,...el(ve.deleteForever),children:Ue.emptyTrash})]}),ll=(e,n,l,r,a)=>/* @__PURE__ */J("div",{style:{width:Je?void 0:a,flex:Je?"1 1 120px":"0 0 auto",minWidth:0},children:/* @__PURE__ */J(f,{size:"sm","aria-label":e,value:n,onChange:r,options:l})},e),rl=e=>n=>ce?.({...se,[e]:n}),al=/* @__PURE__ */K("div",{className:"flex flex-wrap items-center gap-2",children:[de&&/* @__PURE__ */J("div",{style:{flex:"1 1 200px",minWidth:0},children:/* @__PURE__ */J(N,{size:"sm",type:"search",leftIcon:Z.search,placeholder:rn?Ue.searchProducts:Ue.search,"aria-label":rn?Ue.searchProducts:Ue.search,value:oe??"",onChange:e=>de(e.target.value)})}),ce&&ll(Ue.mediaType,se.type,[{value:"all",label:Ue.allTypes},{value:"image",label:Ue.images},{value:"video",label:Ue.videos},{value:"svg",label:"SVG"},{value:"gif",label:"GIF"}],rl("type"),130),ce&&!rn&&!an&&ll(Ue.use,se.use,[{value:"any",label:Ue.anyUse},{value:"email",label:Ue.emailOnly},{value:"website",label:Ue.websiteOnly},{value:"unused",label:Ue.notUsed}],rl("use"),130),ce&&He&&ll(Ue.sort,se.sort,[{value:"newest",label:Ue.newest},{value:"name",label:Ue.byName},{value:"size",label:Ue.bySize}],rl("sort"),110),ue?.map(e=>ll(e.label,e.value,e.options,e.onChange,120)),pe&&/* @__PURE__ */J(k,{size:"sm",label:Ue.view,value:me,onChange:pe,options:[{value:"grid",label:Ue.grid,icon:Z.grid},{value:"list",label:Ue.list,icon:Z.list}]})]}),il=e=>{const n=[];return null!=e.trashedDaysAgo&&n.push({key:"t",label:Ue.daysAgo(e.trashedDaysAgo),count:e.trashedDaysAgo,icon:q.clock,tone:"neutral"}),e.usedCount&&n.push({key:"u",label:Ue.used(e.usedCount),count:e.usedCount,icon:q.link,tone:"active"}),e.email&&n.push({key:"e",label:Ue.email,icon:q.email,tone:"queued"}),e.private&&n.push({key:"p",label:Ue.private,icon:q.lock,tone:"neutral"}),n},tl=e=>il(e).map(e=>/* @__PURE__ */J(F,{tone:e.tone,size:"xs",children:e.label},e.key)),ol=He&&tn&&!!Ie&&!ve.move,dl=!!Ae&&!an,sl=R(""),cl=R(null),ul=()=>cl.current?.dropped?"dropped":"cancelled",ml=R(Ae);ml.current=Ae;const pl=V(e=>{const n=cl.current;n&&(cl.current=null,n.stop(),T(sl.current,!1),e&&ml.current?.(e))},[]),hl=V(e=>{pl(ul());const n=Ke.current?.ownerDocument;if(!n)return;sl.current=z(Ke.current);const l=Ke.current?.closest("[data-modal-panel]"),r=e=>{sl.current&&!l?.contains(e.target)&&T(sl.current,!0)},a=()=>!!e&&!e.isConnected,i=()=>{const e=cl.current;if(e){if(a())return pl("dropped");e.dropped=!0,T(sl.current,!1)}},t=e=>{const n=e.dataTransfer?.dropEffect;pl(n&&"none"!==n?"dropped":a()?ul():"cancelled")},o=()=>{a()&&pl(ul())},d=["pointermove","pointerdown","mousemove","mousedown"];n.addEventListener("dragover",r,!0),n.addEventListener("drop",i,!0),n.addEventListener("dragend",t,!0);for(const e of d)n.addEventListener(e,o,!0);cl.current={dropped:!1,stop:()=>{n.removeEventListener("dragover",r,!0),n.removeEventListener("drop",i,!0),n.removeEventListener("dragend",t,!0);for(const e of d)n.removeEventListener(e,o,!0)}}},[pl]);H(()=>()=>pl(ul()),[pl]);const fl=(e,n,l)=>{if("start"!==e)return;const r=un.get(n);r&&gl(r)&&(hl(l??null),Ae(e))},gl=e=>!dl||e.private||e.pickDisabledReason?void 0:JSON.stringify({id:e.id,url:e.url,kind:"video"===e.kind?"video":"image",name:e.name}),vl=te.map(e=>({id:e.id,url:e.thumbUrl??e.url,name:e.name,kind:e.kind,caption:e.name,badges:il(e),dragData:ol?JSON.stringify(mn.isSelected(e.id)?pn:[e.id]):gl(e),...ol&&gl(e)?{dragAlso:{[X]:gl(e)}}:{}})),kl=Je?Math.max(72,Math.floor((Ge-24-16-1)/3)):112,yl=R(null),bl=c({containerRef:yl,enabled:He&&!Je&&te.length>0,selected:mn.selected,setSelection:e=>mn.setSelection(e),clearSelection:mn.clear}),wl=e=>{if(Be){const n=un.get(e);return void(!n||n.private||n.pickDisabledReason||Oe?.(n))}const n=cn.indexOf(e);n>=0&&Sn(n)},xl=te.length?null:oe?/* @__PURE__ */J(t,{variant:"dashed",title:Ue.noMatches}):rn?/* @__PURE__ */J(t,{variant:"dashed",title:Ue.emptyProducts,description:sn(dn)}):an?/* @__PURE__ */J(t,{variant:"dashed",title:Ue.trashEmpty}):!Zn||Be?/* @__PURE__ */J(t,{variant:"dashed",title:Ue.emptyFolder}):null,Cl="list"===me&&te.length>0,Nl=xl??(Cl?/* @__PURE__ */J("ul",{role:"listbox","aria-multiselectable":He||void 0,"aria-label":Ue.folders,className:"flex flex-col gap-1",children:te.map(e=>/* @__PURE__ */K("li",{role:"option","aria-selected":mn.isSelected(e.id),tabIndex:0,"data-grid-item":"","data-grid-id":e.id,onClick:n=>yn(e.id,n),onDoubleClick:()=>wl(e.id),onContextMenu:n=>Fn(e.id,n),draggable:!!gl(e)||void 0,onDragStart:gl(e)?n=>{n.dataTransfer.effectAllowed="link",n.dataTransfer.setData(X,gl(e)),fl("start",e.id,n.currentTarget)}:void 0,onKeyDown:n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),yn(e.id,n))},className:"flex h-12 cursor-pointer items-center gap-3 rounded-md px-2 text-sm rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)] "+(mn.isSelected(e.id)?"bg-accent-tint text-blue-700":"text-ink hover:bg-gray-100"),children:[
8
- /* @__PURE__ */J("img",{src:e.thumbUrl??e.url,alt:"",className:"h-10 w-10 shrink-0 rounded bg-gray-100 object-contain"}),
9
- /* @__PURE__ */J("span",{className:"min-w-0 flex-1 truncate",children:e.name}),
10
- /* @__PURE__ */J("span",{className:"flex shrink-0 items-center gap-1",children:tl(e)}),e.sizeLabel&&/* @__PURE__ */J("span",{className:"w-16 shrink-0 text-right text-xs text-ink-faint",children:e.sizeLabel})]},e.id))}):/* @__PURE__ */J(g,{items:vl,readOnly:!Zn||Be,onFiles:Zn&&!Be?e=>xe(e,on):void 0,accept:ke,maxSizeBytes:ye,busy:be,progress:we,fit:"contain",thumbSize:kl,dragType:ol?Q:dl?X:void 0,onDragOutChange:dl?(e,n,l)=>fl(e,n,l):void 0,selected:mn.selected,onItemClick:yn,onItemDoubleClick:wl,onItemContextMenu:He?Fn:void 0,menuOnMedia:He})),Il=p({count:pn.length,kind:In(pn),targets:Nn({kind:"files",ids:pn}),onPick:e=>Ie?.({kind:"files",ids:pn},e.key===u?null:e.key)}),Dl=P({variant:"secondary",size:"sm"}),Sl=/* @__PURE__ */J(I,{align:"start",triggerClassName:Dl,trigger:/* @__PURE__ */K(G,{children:[Z.folder,Ue.moveTo]}),items:Il,disabled:!!ve.move}),jl=He&&pn.length>1&&!rn?/* @__PURE__ */K("div",{"data-media-bulk":"",className:"flex flex-wrap items-center gap-2 rounded-lg border border-line px-3 py-2",children:[
11
- /* @__PURE__ */J(b,{checked:pn.length===te.length,indeterminate:pn.length<te.length,onChange:e=>e?mn.selectAll():mn.clear(),label:Ue.selected(pn.length)}),/* @__PURE__ */K(G,an?{children:[je&&/* @__PURE__ */J(E,{variant:"secondary",size:"sm",leftIcon:Z.undo,onClick:()=>je(pn),...el(ve.restore),children:Ue.restore}),Te&&/* @__PURE__ */J(E,{variant:"secondary-danger",size:"sm",onClick:()=>Te(pn),...el(ve.deleteForever),children:Ue.deleteForever})]}:{children:[Ie&&Sl,Ne&&/* @__PURE__ */J(E,{variant:"secondary",size:"sm",leftIcon:Z.edit,disabled:!0,children:Ue.rename}),De&&/* @__PURE__ */J(E,{variant:"secondary",size:"sm",leftIcon:Z.trash,onClick:()=>De({kind:"files",ids:pn}),...el(ve.trash),children:Ue.moveFilesToTrash(pn.length)})]}),
12
- /* @__PURE__ */J(E,{variant:"ghost",size:"sm",onClick:mn.clear,children:Ue.clearSelection})]}):null,Tl=e=>{const n=[],l=(e,l,r)=>{null!=r&&""!==r&&n.push({key:e,label:l,value:r})},r="file"===bn?.kind&&bn.id===e.id;l("name",Ue.name,r?/* @__PURE__ */J(h,{value:e.name,label:Ue.fileName,onDone:xn}):e.name),l("type",Ue.type,e.typeLabel),l("size",Ue.size,e.sizeLabel),l("resolution",Ue.resolution,e.resolution),rn?(l("design",Ue.design,e.design),l("finish",Ue.finish,e.finish),l("angle",Ue.angleLug,e.angleLug),l("owner",Ue.owner,e.owner)):(l("added",Ue.addedBy,e.addedBy),l("folder",Ue.folder,e.folderPath)),l("used",Ue.usedIn,null!=e.usedCount?Ue.places(e.usedCount):void 0);const a=m({kind:"files",ids:[e.id]},jn).find(e=>"submenu"===e.type);/* @__PURE__ */
13
- return K("div",{"data-media-details":"",className:"flex flex-col gap-3",children:[
14
- /* @__PURE__ */J("img",{src:e.url,alt:e.name,className:"aspect-square w-full rounded-lg bg-gray-100 object-contain"}),rn&&/* @__PURE__ */J(C,{tone:"neutral",title:Ue.readOnlyBadge,children:sn(dn)}),
15
- /* @__PURE__ */J(o,{size:"sm",columns:1,items:n}),!an&&/* @__PURE__ */K("div",{className:"flex gap-2",children:[
16
- /* @__PURE__ */J("div",{style:{flex:"1 1 0",minWidth:0},children:/* @__PURE__ */J(N,{size:"sm",readOnly:!0,value:e.url,"aria-label":Ue.fileUrl,onFocus:e=>e.currentTarget.select()})}),
17
- /* @__PURE__ */J(E,{variant:"secondary",size:"sm",leftIcon:Z.copy,onClick:()=>jn.copyUrl(e.id),children:Ue.copyUrl})]}),tn&&He&&/* @__PURE__ */K("div",{className:"flex flex-wrap gap-2",children:[Fe&&/* @__PURE__ */J(E,{variant:"secondary",size:"sm",leftIcon:Z.swap,onClick:()=>Fe(e.id),...el(ve.replace),children:Ue.replace}),Ee&&/* @__PURE__ */J(E,{variant:"secondary",size:"sm",leftIcon:Z.crop,onClick:()=>Ee(e.id),children:Ue.cropEdit}),Ie&&"submenu"===a?.type&&/* @__PURE__ */J(I,{align:"start",triggerClassName:Dl,trigger:/* @__PURE__ */K(G,{children:[Z.folder,Ue.moveTo]}),items:a.items,disabled:!!ve.move}),Ne&&/* @__PURE__ */J(E,{variant:"secondary",size:"sm",leftIcon:Z.edit,onClick:()=>wn({kind:"file",id:e.id}),...el(ve.rename),children:Ue.rename}),De&&/* @__PURE__ */J(D,{"aria-label":Ue.moveToTrash,size:"sm",onClick:()=>De({kind:"files",ids:[e.id]}),disabledReason:ve.trash,"aria-disabled":!!ve.trash||void 0,children:Z.trash})]}),an&&He&&/* @__PURE__ */K("div",{className:"flex flex-wrap gap-2",children:[je&&/* @__PURE__ */J(E,{variant:"primary",size:"sm",leftIcon:Z.undo,onClick:()=>je([e.id]),...el(ve.restore),children:Ue.restore}),Te&&/* @__PURE__ */J(E,{variant:"danger",size:"sm",onClick:()=>Te([e.id]),...el(ve.deleteForever),children:Ue.deleteForever})]}),rn&&Le&&/* @__PURE__ */J(E,{variant:"secondary",size:"sm",leftIcon:Z.external,onClick:()=>Le({kind:"render",id:e.id}),children:Ue.openInDesign}),ge&&/* @__PURE__ */J(v,{items:ge})]})},zl=hn?hn.private?Ue.privateNoPick:hn.pickDisabledReason:void 0,Fl=Be?/* @__PURE__ */K("div",{"data-media-picker-footer":"",className:"flex flex-wrap items-center justify-between gap-2 border-t border-line px-3 py-2",children:[
18
- /* @__PURE__ */J("span",{className:"min-w-0 truncate text-sm text-ink-faint",children:hn?Ue.oneChosen(hn.name):Ue.noneChosen}),
19
- /* @__PURE__ */K("div",{className:"flex gap-2",children:[Pe&&/* @__PURE__ */J(E,{variant:"secondary",size:"sm",onClick:Pe,children:Ue.cancel}),
20
- /* @__PURE__ */J(E,{variant:"primary",size:"sm",disabled:!hn,...el(zl),onClick:()=>{hn&&!zl&&Oe?.(hn)},children:Ue.chooseImage})]})]}):null,El=He&&!!hn,Ll=/* @__PURE__ */K("div",{className:"flex min-w-0 flex-col gap-3",children:[Me&&/* @__PURE__ */J(C,{tone:"neutral",children:Me}),
21
- /* @__PURE__ */K("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[
22
- /* @__PURE__ */J(d,{items:Yn}),nl]}),al,jl,
23
- /* @__PURE__ */K("div",{ref:yl,className:"relative",onPointerDown:bl.onPointerDown,onKeyDown:e=>{He&&(e.ctrlKey||e.metaKey)&&"a"===e.key.toLowerCase()?(e.preventDefault(),mn.selectAll()):"Escape"===e.key&&mn.size&&mn.clear()},children:[Nl,
24
- /* @__PURE__ */J(a,{rect:bl.rect})]}),Zn&&/* @__PURE__ */J("input",{...qn.inputProps}),
25
- /* @__PURE__ */J(j,{rejections:qn.rejections})]});/* @__PURE__ */
26
- return K("div",{ref:Ke,"data-media-library":"","data-layout":Je?"phone":"wide",className:`flex h-full min-h-0 min-w-0 flex-col ${Re}`.trim(),children:[/* @__PURE__ */K("div",Je?{className:"flex flex-col gap-3 p-3",children:[Xn,Ll]}:{className:"flex min-h-0 min-w-0 flex-1",children:[
27
- /* @__PURE__ */J("div",{className:"shrink-0 overflow-y-auto border-r border-line p-3",style:{width:280,"--rosh-tree-ground":"var(--surface)"},children:Xn}),
28
- /* @__PURE__ */J("div",{className:"min-w-0 flex-1 overflow-y-auto p-3",children:Ll}),El&&/* @__PURE__ */J("div",{className:"shrink-0 overflow-y-auto border-l border-line p-3",style:{width:300},children:Tl(hn)})]}),Fl,Je&&/* @__PURE__ */J(i,{open:El,onClose:mn.clear,side:"bottom",title:hn?.name,children:hn&&Tl(hn)}),zn.state&&/* @__PURE__ */J(x,{...zn.props,items:Tn(zn.state.data)}),null!=Dn&&te.length>0&&/* @__PURE__ */J(r,{images:te.map(e=>({url:e.url,caption:e.name})),startIndex:Math.min(Dn,te.length-1),onClose:()=>Sn(null)})]})}export{Q as MEDIA_FILES_DRAG_TYPE,X as MEDIA_FILE_DRAG_TYPE,W as MEDIA_FOLDER_DRAG_TYPE,_ as MediaLibrary,Y as readMediaFileDrag};
@@ -1 +0,0 @@
1
- import{getActiveModalId as t}from"./chunk-F3ZOO23R.js";import{Z_LAYERS as e}from"./chunk-62LW225J.js";import{useBrowserLayoutEffect as n}from"./chunk-D65T4H6J.js";import{createContext as i,useContext as o,useRef as r,useState as u}from"react";var l=i(void 0),d=l.Provider;function s(t){const e=o(l);return t?void 0===e?document.body:e:null}function h(t,e){if("undefined"==typeof Element||!(t instanceof Element))return!1;const n=t.closest("[data-overlay-layer]");return null!==n&&!e?.contains(n)}var c="[data-modal-panel], [data-popup-panel]";function f(t,e){const n=Math.max(0,t.left),i=Math.max(0,t.top),o=Math.min(e.width,t.left+t.width),r=Math.min(e.height,t.top+t.height);return o-n<1||r-i<1?null:{left:n,top:i,width:o-n,height:r-i}}function a(t,e,n){return n<e?e:Math.min(Math.max(t,e),n)}function w(){return{width:window.innerWidth,height:window.innerHeight}}function v(t,e){const i=r(null),o=r(!1);t&&!o.current&&(i.current="undefined"==typeof document?null:document.activeElement),o.current=t;const[l,d]=u(null);return n(()=>{if(!t)return void d(null);const n=(o=e.current,r=i.current,o?.parentElement?.closest(c)??r?.closest(c)??null);var o,r;if(!n)return void d(null);const u=()=>{const t=n.getBoundingClientRect(),e=w(),i=f({left:t.left,top:t.top,width:t.width,height:t.height},e),o=null!==i&&i.width>=e.width-1&&i.height>=e.height-1;d(t=>{const e=o?null:i;return t===e||t&&e&&t.left===e.left&&t.top===e.top&&t.width===e.width&&t.height===e.height?t:e})};u(),window.addEventListener("resize",u);const l="undefined"==typeof ResizeObserver?null:new ResizeObserver(u);return l?.observe(n),()=>{window.removeEventListener("resize",u),l?.disconnect()}},[t,e]),l}function p(t,e){const[i,o]=u(null);return n(()=>{const n=e.current;if(!t||!n)return void o(null);const i=()=>{const e=function(t,e,n,i=16){return{left:a(t.left+t.width/2-e.width/2,i,n.width-i-e.width),top:a(t.top+t.height/2-e.height/2,i,n.height-i-e.height)}}(t,{width:n.offsetWidth,height:n.offsetHeight},w());o(t=>t&&t.left===e.left&&t.top===e.top?t:e)};i(),window.addEventListener("resize",i);const r="undefined"==typeof ResizeObserver?null:new ResizeObserver(i);return r?.observe(n),()=>{window.removeEventListener("resize",i),r?.disconnect()}},[t,e]),i}var b=/* @__PURE__ */new WeakMap;function m(t){if(!t)return null;const e=t.closest("[data-overlay-layer]");return e?b.get(e)??null:t.closest("[data-modal-panel]")}var g={host:null,box:null,z:0,hidden:!1};function x(t,e){const i=r(null),o=r(!1);t&&!o.current&&(i.current="undefined"==typeof document?null:document.activeElement),o.current=t;const[l,d]=u(g);return n(()=>{if(!t)return void d(g);const n=(o=e.current,r=i.current,m(o?.parentElement)??m(r));var o,r;if(!n)return void d(g);const u=()=>{const t=n.getBoundingClientRect(),e=getComputedStyle(n),i=f({left:t.left,top:t.top,width:t.width,height:t.height},{width:window.innerWidth,height:window.innerHeight}),o=Number.parseInt(e.zIndex,10),r={host:n,box:i,z:Number.isFinite(o)?o:0,hidden:null===i||"none"===e.display||"hidden"===e.visibility};d(t=>{return n=r,(e=t).host===n.host&&e.z===n.z&&e.hidden===n.hidden&&(e.box===n.box||null!==e.box&&null!==n.box&&e.box.left===n.box.left&&e.box.top===n.box.top&&e.box.width===n.box.width&&e.box.height===n.box.height)?t:r;var e,n})};u(),window.addEventListener("resize",u);const l="undefined"==typeof ResizeObserver?null:new ResizeObserver(u);l?.observe(n);const s="undefined"==typeof MutationObserver?null:new MutationObserver(u);return s?.observe(n,{attributes:!0,attributeFilter:["style","class"]}),()=>{window.removeEventListener("resize",u),l?.disconnect(),s?.disconnect()}},[t,e]),l}function z(e,n){const i=r(null);return i.current=i=>function(t,e,n,i){const o=t.host;if(!o)return!1;if(n&&e?.contains(n))return!1;const r=o.getAttribute("data-modal-id");if(i&&r&&i!==r)return!0;const u=m(n);return null!==u&&u!==o&&!o.contains(u)}(e,n,i,t()),n&&function(t,e){b.set(t,e)}(n,e.host),i}function y(t){return t.host?{zIndex:t.z+1,...t.hidden?{visibility:"hidden"}:{}}:{zIndex:e.overlay}}function E(t){if(!t.host||!t.box)return null;const{left:e,top:n,width:i,height:o}=t.box;return{left:e,top:n,width:i,height:o}}function O(t){return null!==t.host&&!t.host.hasAttribute("data-window-tab")}export{d as OverlayLayerProvider,h as isInOverlayOver,y as popupLayerStyle,O as scrimHasCorners,s as useOverlayTarget,p as usePanelPosition,v as usePopupAnchor,x as usePopupLevel,z as usePopupLevelBindings,E as windowScrimStyle};