efficient-shell 10.23.0 → 11.1.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 (157) hide show
  1. package/README.md +32 -5
  2. package/dist/Browser-PTDZDMCG.js +44 -0
  3. package/dist/Calculator-KP57FK7Y.js +29 -0
  4. package/dist/CurrencyConverter-W66ZDA6I.js +21 -0
  5. package/dist/{Documents-MTCJXTXY.js → Documents-EASK3J36.js} +3 -3
  6. package/dist/{Files-XMZ3XBP4.js → Files-YT4Z4J36.js} +28 -28
  7. package/dist/Notepad-T6NV4BSM.js +24 -0
  8. package/dist/{PomodoroTimer-5ELVNJEU.js → PomodoroTimer-6B2MNLWD.js} +31 -31
  9. package/dist/{Preview-QCA6XUDU.js → Preview-KHCQHAWG.js} +17 -17
  10. package/dist/Sidebar-BCTWRG7P.js +44 -0
  11. package/dist/{Spreadsheet-EKYP6XIX.js → Spreadsheet-IQZECLJW.js} +11 -11
  12. package/dist/{Stock-TRG6CAZJ.js → Stock-GCCTYXAG.js} +3 -3
  13. package/dist/{Weather-YGTT7UWR.js → Weather-DL4IZELD.js} +17 -17
  14. package/dist/{WorldClock-UCX5LCJB.js → WorldClock-ZVN5O77W.js} +6 -6
  15. package/dist/ai/index.js +91 -91
  16. package/dist/api/shellHttp.d.ts +52 -0
  17. package/dist/api/shellHttp.js +1 -0
  18. package/dist/apps/index.js +1 -1
  19. package/dist/bin/media-host-check.js +1 -1
  20. package/dist/bin/ui-check.js +1 -1
  21. package/dist/brand.css +1 -1
  22. package/dist/chunk-2QY5BJLA.js +2 -0
  23. package/dist/chunk-3XZFWR6T.js +13 -0
  24. package/dist/{chunk-CIHR5ZKF.js → chunk-4DDL6NXB.js} +1 -1
  25. package/dist/chunk-4LXCCZDM.js +1 -0
  26. package/dist/{chunk-U2RFKQVA.js → chunk-5H4SWQGM.js} +1 -1
  27. package/dist/{chunk-USWA6YNZ.js → chunk-5PDHKH2A.js} +3 -3
  28. package/dist/{chunk-GCZU4XFA.js → chunk-5WY5DQI7.js} +1 -1
  29. package/dist/{chunk-75UD5ZMP.js → chunk-6IOFNPR6.js} +3 -3
  30. package/dist/{chunk-OTITQ3IH.js → chunk-6KGIHI6X.js} +7 -7
  31. package/dist/{chunk-5RQJRD2E.js → chunk-7DQ3PM5Z.js} +1 -1
  32. package/dist/{chunk-YOZGW2RB.js → chunk-7FW2BQTV.js} +1 -1
  33. package/dist/chunk-AIJ3G6BD.js +1 -0
  34. package/dist/{chunk-DRUQH4ZE.js → chunk-AIJ6OR6X.js} +2 -2
  35. package/dist/{chunk-RV2FGSGH.js → chunk-ALTBTO3Z.js} +2 -2
  36. package/dist/{chunk-VCCGS6Q2.js → chunk-AM6HSHT5.js} +19 -19
  37. package/dist/chunk-ATMJ5ZPK.js +1 -0
  38. package/dist/{chunk-CQEVJG43.js → chunk-AWGJIDBR.js} +1 -1
  39. package/dist/{chunk-XJPKDTQN.js → chunk-BUO7XCYR.js} +12 -12
  40. package/dist/{chunk-USVL5SLG.js → chunk-D5HGRACW.js} +1 -1
  41. package/dist/{chunk-JET2TKEQ.js → chunk-DOF56HTO.js} +5 -5
  42. package/dist/chunk-E6FDUFPH.js +1 -0
  43. package/dist/chunk-ETJRGQNG.js +1 -0
  44. package/dist/chunk-F3ZOO23R.js +1 -0
  45. package/dist/chunk-HNUKXGYP.js +5 -0
  46. package/dist/chunk-HNVSVTNC.js +16 -0
  47. package/dist/{chunk-GOXQJCXG.js → chunk-HUU4XMWE.js} +17 -17
  48. package/dist/{chunk-Z3SLQKE6.js → chunk-ILY4DU3D.js} +1 -1
  49. package/dist/chunk-IQZD6QQF.js +99 -0
  50. package/dist/{chunk-E5QPXEKN.js → chunk-JFBL4PR3.js} +1 -1
  51. package/dist/{chunk-E6LQY6TB.js → chunk-KIXTJNHQ.js} +2 -2
  52. package/dist/{chunk-DGWS4GTI.js → chunk-KXU4ORKE.js} +1 -1
  53. package/dist/chunk-KYBXJL6A.js +23 -0
  54. package/dist/chunk-LH7IKIGE.js +1 -0
  55. package/dist/{chunk-JPOYR5AO.js → chunk-NZISMTQE.js} +5 -5
  56. package/dist/chunk-O3MBPAWZ.js +2 -0
  57. package/dist/{chunk-QWCEKHAP.js → chunk-OEPYQUXZ.js} +9 -9
  58. package/dist/{chunk-HUA3TGMM.js → chunk-P2C33RHT.js} +1 -1
  59. package/dist/{chunk-CX4XR4HO.js → chunk-PLC656AN.js} +1 -1
  60. package/dist/chunk-Q5Z3KHT2.js +1 -0
  61. package/dist/{chunk-RZQGPWSN.js → chunk-QOI4GQVH.js} +1 -1
  62. package/dist/{chunk-G7BBSHDF.js → chunk-QRU55BUS.js} +1 -1
  63. package/dist/{chunk-O52BQ5DP.js → chunk-QYXZC37J.js} +1 -1
  64. package/dist/{chunk-DBL7MFCB.js → chunk-RBZKV3ED.js} +5 -5
  65. package/dist/chunk-STKJA4PV.js +1 -0
  66. package/dist/chunk-SX3SG522.js +13 -0
  67. package/dist/{chunk-GC3DA6D6.js → chunk-T6BGS26U.js} +1 -1
  68. package/dist/{chunk-ZTV2BA3P.js → chunk-U6LKNGC6.js} +1 -1
  69. package/dist/chunk-UKBXQXDZ.js +1 -0
  70. package/dist/chunk-ULJQYXHB.js +1 -0
  71. package/dist/{chunk-I4DLYOPO.js → chunk-V2J2AHDW.js} +4 -4
  72. package/dist/chunk-WBJ6KNUF.js +1 -0
  73. package/dist/{chunk-Z46MSUTP.js → chunk-WLYYC3AP.js} +1 -1
  74. package/dist/{chunk-OGU5JE52.js → chunk-WOAMPTZI.js} +6 -6
  75. package/dist/data/DataTable.js +1 -1
  76. package/dist/data/EntityList.d.ts +125 -0
  77. package/dist/data/EntityList.js +2 -0
  78. package/dist/data/ResizableTable.d.ts +31 -0
  79. package/dist/data/ResizableTable.js +2 -0
  80. package/dist/data/useColumnConfig.d.ts +68 -0
  81. package/dist/data/useColumnConfig.js +2 -0
  82. package/dist/data/useSort.d.ts +55 -0
  83. package/dist/data/useSort.js +2 -0
  84. package/dist/data/useTableNav.d.ts +28 -0
  85. package/dist/data/useTableNav.js +2 -0
  86. package/dist/format/index.d.ts +1 -1
  87. package/dist/format/index.js +1 -1
  88. package/dist/forms/BorderInput.js +1 -1
  89. package/dist/forms/BrandAssetEditor.js +1 -1
  90. package/dist/forms/ColorPicker.js +1 -1
  91. package/dist/forms/CornersInput.js +1 -1
  92. package/dist/forms/DateRangePicker.js +1 -1
  93. package/dist/forms/Input.d.ts +50 -2
  94. package/dist/forms/Input.js +1 -1
  95. package/dist/forms/InputNumber.js +1 -1
  96. package/dist/forms/LinkPicker.js +1 -1
  97. package/dist/forms/MediaLibrary.js +1 -1
  98. package/dist/forms/MediaUploadGrid.js +1 -1
  99. package/dist/forms/PositionInput.js +1 -1
  100. package/dist/forms/SidesInput.js +1 -1
  101. package/dist/forms/Slider.js +1 -1
  102. package/dist/forms/SplitButton.js +1 -1
  103. package/dist/forms/WidthsBar.js +1 -1
  104. package/dist/forms/linkHref.js +1 -1
  105. package/dist/icons/efficient-glyphs.js +1 -1
  106. package/dist/icons/efficient-looks.js +1 -1
  107. package/dist/icons/efficient-meanings.d.ts +2 -2
  108. package/dist/icons/efficient-meanings.js +1 -1
  109. package/dist/icons/efficient.js +1 -1
  110. package/dist/icons/looks/map.js +1 -1
  111. package/dist/icons/payment.js +1 -1
  112. package/dist/icons/sets.js +1 -1
  113. package/dist/index.d.ts +15 -318
  114. package/dist/index.js +666 -694
  115. package/dist/markup/index.d.ts +55 -11
  116. package/dist/markup/index.js +1 -1
  117. package/dist/motion/values.d.ts +75 -0
  118. package/dist/motion/values.js +1 -0
  119. package/dist/motion.css +26 -0
  120. package/dist/page-tabs/index.js +4 -4
  121. package/dist/shell/ContextMenu.js +1 -1
  122. package/dist/shell/DropdownMenu.js +1 -1
  123. package/dist/shell/HelpCenter.js +1 -1
  124. package/dist/shell/ImageLightbox.js +1 -1
  125. package/dist/shell/LanguageSelect.js +1 -1
  126. package/dist/shell/Markdown.js +1 -1
  127. package/dist/shell/PopupMenu.js +1 -1
  128. package/dist/shell/SearchableSelect.d.ts +11 -1
  129. package/dist/shell/SearchableSelect.js +1 -1
  130. package/dist/shell/TopNav.js +1 -1
  131. package/dist/telemetry/index.js +1 -1
  132. package/dist/templates/AuthScreen.js +1 -1
  133. package/dist/templates/ChatTemplate.js +1 -1
  134. package/dist/templates/CheckoutTemplate.js +1 -1
  135. package/dist/templates/DataTablePage.js +1 -1
  136. package/dist/templates/FormLayoutPage.js +1 -1
  137. package/dist/tokens/type.d.ts +3 -31
  138. package/dist/tokens/type.js +1 -1
  139. package/dist/ui/index.d.ts +8 -1
  140. package/dist/ui/index.js +1 -1
  141. package/dist/version.js +1 -1
  142. package/package.json +3 -2
  143. package/dist/Browser-GTQKXJQ6.js +0 -43
  144. package/dist/Calculator-PM4TYWTE.js +0 -29
  145. package/dist/CurrencyConverter-4I2ENTSX.js +0 -21
  146. package/dist/Notepad-QIJN7VDZ.js +0 -24
  147. package/dist/Sidebar-7LN3ZEF4.js +0 -44
  148. package/dist/chunk-7IY47EKR.js +0 -1
  149. package/dist/chunk-7RP7QTRF.js +0 -12
  150. package/dist/chunk-CY5N5OA3.js +0 -2
  151. package/dist/chunk-DHKRXHJN.js +0 -1
  152. package/dist/chunk-H475WZPF.js +0 -23
  153. package/dist/chunk-I3XM2PSQ.js +0 -100
  154. package/dist/chunk-MAMWQCJ6.js +0 -2
  155. package/dist/chunk-OFCHJWM2.js +0 -1
  156. package/dist/chunk-PJPK2ADX.js +0 -1
  157. /package/dist/{chunk-CSA6CGXS.js → chunk-2F5SLLBJ.js} +0 -0
@@ -1,12 +0,0 @@
1
- import{nextEnabledIndex as e}from"./chunk-EO5RLFRX.js";import{flattenOptionItems as t,filterOptionItems as n,optionMatches as r,groupedRows as l,OptionCheck as o,OptionSublabel as i}from"./chunk-LJN77RG6.js";import{INPUT_BASE_ON as a,INPUT_BASE as s}from"./chunk-AYZY3YNC.js";import{Button_default as u}from"./chunk-EOVXFXVV.js";import{LoadingSpinner as c}from"./chunk-R2VKEMZH.js";import{Tooltip as d}from"./chunk-NJN5IKWO.js";import{onOverlayOpen as h}from"./chunk-PGN5ME7B.js";import{Z_LAYERS as p}from"./chunk-62LW225J.js";import{useDropdownPosition as m,MENU_MAX_HEIGHT as f}from"./chunk-GLUJS42B.js";import{useBrowserLayoutEffect as b}from"./chunk-D65T4H6J.js";import{GLASS_DIVIDER as g,glassStyle as v}from"./chunk-5FYDNH4Y.js";import{registerModalEscapeInterceptor as y}from"./chunk-TWVUQUUD.js";import{useShellStrings as w}from"./chunk-GDQJBQ5B.js";import{useState as x,useId as k,useRef as N,useMemo as $,useEffect as j}from"react";import{createPortal as D}from"react-dom";import{jsxs as C,jsx as S}from"react/jsx-runtime";function W(e,t){const n=e.length;if(0===n||t(e.join(", ")))return{shown:n,cut:!1};if(1===n)return{shown:1,cut:!0};let r=0;for(let l=1;l<n&&t(`${e.slice(0,l).join(", ")} +${n-l}`);l+=1)r=l;return{shown:r,cut:!1}}function L({onClear:e,ariaLabel:t}){/* @__PURE__ */
2
- return S("button",{type:"button","aria-label":t,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),e()},className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity text-base leading-none",children:"×"})}function R(R){const{options:E,placeholder:F,emptyOptionLabel:M,className:z="",disabled:O,id:T,filter:A=!1,allowFreeText:B=!1,freeTextOption:J,onSearchChange:H,loading:I=!1,error:U,onRetry:V,rightAdornment:Y,renderOption:G,clearable:K=!0,"aria-label":Q,"aria-labelledby":X,"aria-describedby":P}=R,Z=!0===R.multiple,q=R.multiple?R.value:R.value?[R.value]:[],_=R.multiple?"":R.value,ee=e=>{R.multiple?R.onChange(e):R.onChange(e[0]??"")},te=q.length>0,ne=A&&te&&!O,re=Z||A,le=null!=J,oe=B||le,[ie,ae]=x(!1),[se,ue]=x(-1),ce=k(),de=T??`${ce}-input`,he=`${ce}-listbox`,pe=e=>`${ce}-opt-${e}`,[me,fe]=x(""),be=w(),ge=M??be.select.none,ve=e=>{fe(e),ue(-1),H?.(e)},ye=N(null),we=N(null),xe=N(null),ke=N(null),Ne=N(ie);Ne.current=ie;const $e=N(!1),je=e=>{Ne.current&&(Ne.current=!1,e&&B&&!le&&Ke&&(Z?q.includes(Ke)||ee([...q,Ke]):Ke!==_&&ee([Ke])),ae(!1),ve(""))},De=(e,t)=>{if(!e.disabled){if(Z)return ee(q.includes(e.value)?q.filter(t=>t!==e.value):[...q,e.value]),void(e===Qe?ve(""):ue(t));ee([e.value]),je(!1)}},[Ce,Se]=x(null);b(()=>{if(!Y||ie)return void Se(null);const e=ke.current?.offsetWidth??0;Se(e?e+(Me?32:8)+6:null)});const We=m(we,ie,re?{popupRef:xe}:{matchTriggerWidth:!0}),Le=$(()=>t(E),[E]),Re=q.join("\0"),Ee=$(()=>{const e=[],t=/* @__PURE__ */new Set;for(const n of Le)q.includes(n.value)&&!t.has(n.value)&&(t.add(n.value),e.push(n.label));if(oe)for(const n of q)t.has(n)||e.push(n);return e},[Le,Re,oe]),Fe=Ee.join(", "),Me=K&&te&&!O,[ze,Oe]=x(null),Te=N(null),Ae=N(""),Be=N(()=>{});Be.current=()=>{const e=we.current,t=Te.current;if(!Z||!e||!t)return;const n=getComputedStyle(e),r=e.clientWidth-(parseFloat(n.paddingLeft)||0)-(parseFloat(n.paddingRight)||0),l=[n.fontStyle,n.fontWeight,n.fontSize,n.fontFamily,n.letterSpacing].join("|"),o=`${r}|${l}|${Ee.join("\0")}`;if(o===Ae.current)return;Ae.current=o;let i=null;r>0&&Ee.length>0&&(t.style.fontStyle=n.fontStyle,t.style.fontWeight=n.fontWeight,t.style.fontSize=n.fontSize,t.style.fontFamily=n.fontFamily,t.style.letterSpacing=n.letterSpacing,i=W(Ee,e=>(t.textContent=e,t.getBoundingClientRect().width<=r)),t.textContent=""),Oe(e=>e?.shown===i?.shown&&e?.cut===i?.cut?e:i)},b(()=>{Be.current()}),j(()=>{const e=we.current;if(!Z||!e||"undefined"==typeof ResizeObserver)return;const t=new ResizeObserver(()=>Be.current());return t.observe(e),()=>t.disconnect()},[Z]);const Je=Ee.length,He=!Z||!ze||ze.shown>=Je?Fe:0===ze.shown?be.select.selectedCount(Je):`${Ee.slice(0,ze.shown).join(", ")} +${Je-ze.shown}`,Ie=Z&&null!==ze&&(ze.shown<Je||ze.cut),Ue=ie&&te&&re;j(()=>{if(!ie)return;const e=e=>{const t=e.target;ye.current?.contains(t)||xe.current?.contains(t)||je(!0)};document.addEventListener("mousedown",e);const t=h(()=>je(!0));return()=>{document.removeEventListener("mousedown",e),t()}},[ie,B,me,Re,R.onChange]),j(()=>{if(ie)return y(e=>!("Escape"!==e.key||!Ne.current)&&(je(!1),we.current?.blur(),!0),()=>xe.current)},[ie]);const Ve=$(()=>{const e=/* @__PURE__ */new Set;return n(E,t=>!e.has(t.value)&&(e.add(t.value),!0))},[E]),Ye=$(()=>{if(H)return Ve;const e=me.trim().toLowerCase();return e?n(Ve,t=>r(t,e)):Ve},[Ve,me,H]),Ge=$(()=>t(Ye),[Ye]),Ke=me.trim(),Qe=$(()=>le&&Ke?Le.some(e=>e.label===Ke)||q.includes(Ke)?null:{value:Ke,label:Ke}:null,[le,Ke,Le,Re]),Xe=$(()=>Qe?[...Ge,Qe]:Ge,[Ge,Qe]);/* @__PURE__ */
3
- return C("div",{ref:ye,className:"relative group",onBlur:e=>{const t=e.relatedTarget;t&&(ye.current?.contains(t)||xe.current?.contains(t))||$e.current||document.activeElement!==we.current&&je(!0)},children:[(Pe=/* @__PURE__ */S("input",{id:de,ref:we,type:"text",autoComplete:"off",role:"combobox","aria-expanded":ie,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-controls":ie?he:void 0,"aria-activedescendant":ie&&se>=0&&se<Xe.length?pe(se):void 0,"aria-label":X?void 0:Q,"aria-labelledby":X,"aria-describedby":P,value:ie?me:He,onChange:e=>{ve(e.target.value),ae(!0)},onFocus:()=>{O||(ve(""),ae(!0))},onKeyDown:t=>{if("ArrowDown"===t.key||"ArrowUp"===t.key){if(O)return;if(t.preventDefault(),!ie)return void ae(!0);if(0===Xe.length)return;const n="ArrowDown"===t.key?1:-1;return void ue(t=>e(Xe,t,n))}"Enter"===t.key?(t.preventDefault(),ie&&se>=0&&se<Xe.length?De(Xe[se],se):1!==Ge.length||Ge[0].disabled?B&&!le&&Ke&&(Z?(q.includes(Ke)||ee([...q,Ke]),ve("")):(ee([Ke]),je(!1),we.current?.blur())):De(Ge[0],0)):"Escape"===t.key?(je(!1),we.current?.blur()):"Tab"===t.key&&je(!0)},placeholder:Ue?He:F||ge,className:`${ne?a:s} ${z} ${Me?"pr-8":""} ${O?"bg-surface-sunken text-ink-faintest cursor-not-allowed":""} truncate${Ue?" rosh-field-shows-choice":""}`,style:Ce?{paddingRight:Ce}:void 0,disabled:O}),Z?/* @__PURE__ */S(d,{content:!ie&&Ie?Fe:null,className:"block",children:Pe}):Pe),Z&&
4
- /* @__PURE__ */S("div",{"aria-hidden":"true",className:"pointer-events-none invisible absolute left-0 top-0 h-0 w-0 overflow-hidden",children:/* @__PURE__ */S("span",{ref:Te,className:"whitespace-pre"})}),Me&&/* @__PURE__ */S(L,{ariaLabel:be.select.clear,onClear:()=>{ee([]),je(!1)}}),Y&&!ie&&/* @__PURE__ */S("div",{ref:ke,className:`absolute top-1/2 -translate-y-1/2 ${Me?"right-8":"right-2"} flex items-center gap-1 flex-nowrap justify-end pointer-events-none`,children:Y}),ie&&D(
5
- /* @__PURE__ */C("div",{ref:xe,onMouseDownCapture:()=>{$e.current=!0,setTimeout(()=>{$e.current=!1},0)},className:"fixed rounded-(--radius-popup) overflow-hidden",style:{zIndex:p.popup,left:We?.left,right:We?.right,top:We?.top,bottom:We?.bottom,minWidth:We?.minWidth,width:We?.width,...re&&{maxWidth:We?.maxWidth},visibility:We?void 0:"hidden",...v()},children:[Z&&te&&K&&!O&&
6
- /* @__PURE__ */S("button",{type:"button",tabIndex:-1,onMouseDown:e=>{e.preventDefault(),ee([])},className:`block w-full text-left px-3 min-h-(--row-height-menu) py-2 leading-5 text-sm text-gray-600 hover:bg-row-hover border-b ${g}`,children:be.select.clearAll}),I?
7
- /* @__PURE__ */S(c,{size:"sm",padding:"py-2",label:be.search.searching}):U?/* @__PURE__ */C("div",{role:"alert",className:"flex items-center gap-2 px-3 py-2 text-sm text-red-600",children:[
8
- /* @__PURE__ */S("span",{className:"min-w-0 flex-1",children:U}),V&&/* @__PURE__ */S(u,{variant:"link",size:"sm",onMouseDown:e=>e.preventDefault(),onClick:V,className:"shrink-0",children:be.list.retry})]}):null,
9
- /* @__PURE__ */C("div",{id:he,role:Xe.length?"listbox":void 0,"aria-labelledby":Xe.length?X??(Q?void 0:de):void 0,"aria-label":Xe.length&&!X?Q:void 0,"aria-multiselectable":!(!Xe.length||!Z)||void 0,className:"overflow-y-auto",style:{maxHeight:We?.maxHeight??f},children:[0===Xe.length?I||U?null:/* @__PURE__ */S("p",{className:"px-3 py-3 text-sm text-ink-faintest text-center",children:be.select.noMatches}):0===Ge.length?null:l(Ye,(e,t)=>{const n=q.includes(e.value);/* @__PURE__ */
10
- return C("button",{id:pe(t),type:"button",role:"option","aria-selected":n,"aria-disabled":e.disabled||void 0,tabIndex:-1,onMouseDown:n=>{(e.disabled||Z)&&n.preventDefault(),De(e,t)},className:"w-full overflow-hidden text-left px-3 min-h-(--row-height-menu) py-2 text-sm flex items-center justify-between gap-2 whitespace-nowrap "+(e.disabled?"cursor-not-allowed text-gray-400":`hover:bg-gray-50 ${n?"text-blue-600 font-medium":"text-gray-700"} ${t===se?"bg-gray-100":n?"bg-blue-50/50":""}`),children:[Z&&/* @__PURE__ */S(o,{selected:n}),
11
- /* @__PURE__ */S("span",{className:`min-w-0 ${re?"flex-auto":"flex-1"} truncate`,children:G?G(e,{selected:n,active:t===se}):e.label}),e.sublabel&&/* @__PURE__ */S(i,{grows:re,children:e.sublabel})]},e.value)},ce),Qe&&J&&
12
- /* @__PURE__ */S("button",{id:pe(Ge.length),type:"button",role:"option","aria-selected":!1,tabIndex:-1,onMouseDown:e=>{Z&&e.preventDefault(),De(Qe,Ge.length)},className:`w-full overflow-hidden text-left px-3 min-h-(--row-height-menu) py-2 text-sm flex items-center gap-2 whitespace-nowrap text-ink hover:bg-row-hover ${Ge.length?`border-t ${g}`:""} ${se===Ge.length?"bg-gray-100":""}`,children:/* @__PURE__ */S("span",{className:"min-w-0 flex-1 truncate",children:J(Qe.value)})},`${ce}-typed`)]})]}),document.body)]});var Pe}export{R as SearchableSelect,W as fitChoice};
@@ -1,2 +0,0 @@
1
- import{createContext as t,useContext as e}from"react";import{jsx as r}from"react/jsx-runtime";var n={},o=new Proxy(n,{get:(t,e)=>n[e],has:(t,e)=>e in n,ownKeys:()=>Object.keys(n),getOwnPropertyDescriptor(t,e){if(e in n)return{configurable:!0,enumerable:!0,value:n[e]}}});function a(t){for(const t of Object.keys(n))delete n[t];Object.assign(n,t)}var u={},i=[],c={erp:[],system:[],virtual:[],footer:[]},s=t({hasAnyPerm:()=>!0});function d({value:t,children:e}){/* @__PURE__ */
2
- return r(s.Provider,{value:t,children:e})}function m(){return e(s)}var l=42,h=240,f=6,p=49,w=6,y=200,g=420,b="react-os-shell:work-area-changed";function v(){const t=getComputedStyle(document.documentElement),e=parseInt(t.getPropertyValue("--taskbar-height"))||0,r=parseInt(t.getPropertyValue("--taskbar-width"))||0,n=t.getPropertyValue("--taskbar-position")?.trim()||"bottom",o=parseInt(t.getPropertyValue("--sidebar-width"))||0;return{x:("left"===n?r:0)+o,y:"top"===n?e:0,w:window.innerWidth-("left"===n||"right"===n?r:0)-o,h:window.innerHeight-("top"===n||"bottom"===n?e:0)}}function x(t,e,r){const n=r?e.w+280:e.w-280,o=Math.abs(t.w-e.w)<=4||Math.abs(t.w-n)<=4;return Math.abs(t.h-e.h)<=4&&o}function M({over:t,residual:e},r){return e<=1||t-e>=r-2}function P(t,e,r){let n=t;for(const o of r)M(o,e)&&(n=Math.max(n,t+o.over));return Math.ceil(n)}function k(t,e,r,n){const o=Math.min(e,r.w-2*n);if(o<=t.w+1)return t;const a=r.x+n,u=r.x+r.w-n-o,i=Math.min(Math.max(t.x-(o-t.w)/2,a),u);return{...t,x:Math.round(i),w:Math.round(o)}}function V(){return(parseInt(getComputedStyle(document.documentElement).getPropertyValue("--sidebar-width"))||0)>0}function j(){return"undefined"!=typeof document&&"sidebar"===getComputedStyle(document.documentElement).getPropertyValue("--layout-mode")?.trim()}export{f as RAIL_COLLAPSED_INSET,p as RAIL_COLLAPSED_W,g as RAIL_MAX_W,w as RAIL_MENU_GAP,y as RAIL_MIN_W,h as RAIL_W,d as ShellAuthProvider,l as TAB_STRIP_H,b as WORK_AREA_CHANGED_EVENT,x as boxFillsWorkArea,v as computeMaximizedBox,k as growBoxToWidth,V as isSidebarStripReserved,o as navIcons,i as navSections,j as readAlwaysMaximizedFlag,M as scrollerIsFluid,u as sectionIcons,a as setShellNavIcons,c as startMenuCategories,m as useShellAuth,P as widthToFit};
@@ -1 +0,0 @@
1
- var r=[9,11,12,14,16,18,20,24,30],n={body:400,control:500,heading:600,figure:700},o={fast:120,base:160},e={entrance:600,countUp:1400,loop:5e4},a={short:.6,normal:1,long:1.6},t={arrive:"cubic-bezier(0.22, 1, 0.36, 1)",loop:"linear"};function i(r,n="normal"){return Math.round(e[r]*a[n])}var c={hairline:1,strong:2,accent:4};export{c as BORDER_WIDTHS,n as FONT_WEIGHTS,o as MOTION_DURATIONS,e as PAGE_MOTION_DURATIONS,t as PAGE_MOTION_EASING,a as PAGE_MOTION_STEPS,r as TYPE_SCALE,i as pageMotionMs};
@@ -1,23 +0,0 @@
1
- import{Calendar as e}from"./chunk-JH4ZCPHW.js";import{toDateKey as t,fromDateKey as r,toMonthKey as n}from"./chunk-2HMNOLKX.js";import{FILTER_ON as a,FILTER_ON_INK as o,FILTER_OFF as i}from"./chunk-AYZY3YNC.js";import{calendarNames as l}from"./chunk-Y3JW2GW5.js";import{pad2 as s}from"./chunk-LF27WIN2.js";import{buttonClasses as c}from"./chunk-UQYNPYF4.js";import{Icon as d}from"./chunk-2UO47XB4.js";import{onOverlayOpen as m}from"./chunk-PGN5ME7B.js";import{Z_LAYERS as u}from"./chunk-62LW225J.js";import{useDropdownPosition as h}from"./chunk-GLUJS42B.js";import{useBrowserLayoutEffect as p}from"./chunk-D65T4H6J.js";import{glassStyle as f}from"./chunk-5FYDNH4Y.js";import{useShellStrings as g,useShellLocale as b}from"./chunk-GDQJBQ5B.js";import{useState as x,useRef as v,useId as y,useEffect as w}from"react";import{createPortal as N}from"react-dom";import{jsxs as k,Fragment as C,jsx as M}from"react/jsx-runtime";var W=["last2Weeks","lastMonth","last3Months","last6Months","last12Months"],D=t;function j(e,r){const n=r.getFullYear(),a=r.getMonth(),o=new Date(n,a,r.getDate()),i=new Date(n,a,0),l=e=>new Date(n,a-e,1);switch(e){case"last2Weeks":return{from:t(new Date(n,a,r.getDate()-14)),to:t(o)};case"lastMonth":return{from:t(l(1)),to:t(i)};case"last3Months":return{from:t(l(3)),to:t(i)};case"last6Months":return{from:t(l(6)),to:t(i)};case"last12Months":return{from:t(l(12)),to:t(i)}}}function $(e,t,r){const a=n(e);return t&&a<t.slice(0,7)?t.slice(0,7):r&&a>r.slice(0,7)?r.slice(0,7):a}function Y(e){const t=r(e);return t?`${s(t.getDate())}/${s(t.getMonth()+1)}/${t.getFullYear()}`:e}var F=/* @__PURE__ */new Map;function H({from:t,to:n,onChange:s,formatDisplay:D,clearable:H,required:O=!1,name:S,id:B,"aria-labelledby":L,"aria-label":J,weekStartsOn:G,placeholder:T,fullWidth:U=!1,min:E,max:R,disabled:q=!1,allowOpenEnd:A=!1}){const I=g().dateRange,P=b(),Q=D??(P?function(e){let t=F.get(e);t||(t=new Intl.DateTimeFormat(e,{year:"numeric",month:"2-digit",day:"2-digit",timeZone:"UTC",calendar:"gregory"}),F.set(e,t));const n=t;return e=>{const t=r(e);return t?n.format(new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()))):e}}(P):Y),Z=T??I.placeholder,X=H??!O,[z,K]=x(!1),[V,_]=x(t),[ee,te]=x(n),[re,ne]=x(null),[ae,oe]=x("from"),ie=v(null),le=v(null),se=v(null),ce=y(),de=y(),me=y(),[ue,he]=x(!1),pe=h(ie,z,{preferredMaxWidth:520,preferredMaxHeight:ue?720:560,popupRef:se}),fe=v(null),ge=v(null),[be,xe]=x(!0);p(()=>{const e=ge.current;if(!z||!ue||!e)return;const t=getComputedStyle(e).gridTemplateColumns.split(" ").filter(Boolean).length||1,r=parseFloat(getComputedStyle(e).columnGap)||0,n=(e.clientWidth-r*(t-1))/t,a=Math.max(...Array.from(e.querySelectorAll("[data-preset-measure]"),e=>e.offsetWidth))+24+2<=n+.5;a!==be&&xe(a)});const ve=v(null);p(()=>{const e=se.current;if(!z||!pe||!e)return;const t=getComputedStyle(e),r=pe.maxWidth-(e.offsetWidth-e.clientWidth)-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight);if(ue)null!==ve.current&&ve.current<=r&&he(!1);else{const e=fe.current?.offsetWidth??0;if(0===e)return;ve.current=e,e>r+.5&&he(!0)}});const[ye,we]=x(!1);p(()=>{const e=!!B&&(le.current?.labels?.length??0)>0;e!==ye&&we(e)});const Ne=!!J||!!L||ye,ke=/* @__PURE__ */new Date,[Ce,Me]=x(()=>t?t.slice(0,7):$(ke,E,R)),We=W.filter(e=>((e,t,r)=>(!t||e.from>=t)&&(!r||e.to<=r))(j(e,ke),E,R)),De=e=>e?Q(e):"";w(()=>{if(!z)return;const e=e=>{const t=e.target;ie.current?.contains(t)||se.current?.contains(t)||K(!1)};document.addEventListener("mousedown",e);const t=m(()=>K(!1));return()=>{document.removeEventListener("mousedown",e),t()}},[z]),w(()=>{q&&K(!1)},[q]);const je=()=>{s("",""),K(!1)},$e=t&&n?`${De(t)} — ${De(n)}`:t?I.fromOnly(De(t)):n?I.toOnly(De(n)):"",Ye=l(P),Fe=e=>{const t=r(e);return t?Ye.longDate(t.getFullYear(),t.getMonth(),t.getDate()):e},He=t&&n?I.range(Fe(t),Fe(n)):t?I.fromOnly(Fe(t)):n?I.toOnly(Fe(n)):Z,Oe=e=>ue?"h-8 w-full min-w-0 truncate rounded-(--radius-control) border px-3 text-sm transition-colors "+(re===e?"border-blue-300 bg-accent-tint text-blue-700 font-medium":"border-line text-ink hover:bg-row-hover"):"h-8 text-left px-3 text-sm rounded-(--radius-control) transition-colors "+(re===e?"bg-accent-tint text-blue-700 font-medium":"text-ink hover:bg-row-hover"),Se=/* @__PURE__ */k(C,{children:[We.map(e=>/* @__PURE__ */M("button",{type:"button",onClick:()=>(e=>{if("Custom"===e)return;const t=j(e,ke);_(t.from),te(t.to),ne(e),Me(t.from.slice(0,7))})(e),className:Oe(e),"aria-label":ue?I[e]:void 0,children:ue?be?I[e]:I[`${e}Short`]:I[e]},e)),
2
- /* @__PURE__ */M("button",{type:"button",onClick:()=>ne("Custom"),className:Oe("Custom"),children:I.custom})]}),Be=(e,t)=>A?/* @__PURE__ */M("button",{type:"button","data-range-end":e,"aria-pressed":ae===e,onClick:()=>oe(e),className:"flex items-center gap-2 whitespace-nowrap rounded rosh-focus-ring",children:t}):/* @__PURE__ */M("div",{className:"flex items-center gap-2 whitespace-nowrap",children:t}),Le=e=>A&&ae===e?" ring-1 ring-blue-400":"",Je=
3
- /* @__PURE__ */M(e,{mode:"range",min:E,max:R,value:V||null,endValue:ee||null,month:Ce,onMonthChange:Me,onSelect:e=>{ne("Custom"),A?"from"===ae?(ee&&e>ee?(_(ee),te(e)):_(e),oe("to")):V&&e<V?(te(V),_(e)):te(e):!V||V&&ee?(_(e),te("")):e<V?(te(V),_(e)):te(e)},weekStartsOn:G,"aria-label":I.dialog});/* @__PURE__ */
4
- return k("div",{className:"relative"+(U?" w-full":""),ref:ie,children:[
5
- /* @__PURE__ */k("div",{className:`${U?"flex w-full":"inline-flex"} h-8 items-center gap-2 border rounded-lg px-3 text-sm focus-within:border-blue-500 has-focus-visible:ring-1 has-focus-visible:ring-[color:var(--rosh-focus-ring-deep)] ${t||n?`${a} ${o}`:i}${q?" cursor-not-allowed opacity-60":""}`,children:[
6
- /* @__PURE__ */k("button",{ref:le,type:"button",onClick:()=>{q||(_(t),te(n),ne(null),oe(t&&!n?"to":"from"),Me(t?t.slice(0,7):$(ke,E,R)),K(!0))},"aria-haspopup":"dialog","aria-expanded":z,id:B,disabled:q||void 0,"aria-label":J,"aria-labelledby":L,"aria-describedby":[Ne?de:void 0,O?me:void 0].filter(Boolean).join(" ")||void 0,"aria-controls":z?ce:void 0,className:"inline-flex items-center gap-2 rosh-focus-ring"+(U?" min-w-0 flex-1 justify-start":""),children:[
7
- /* @__PURE__ */M(d,{name:"date",className:"w-4 h-4 shrink-0",strokeWidth:"2","aria-hidden":"true"}),
8
- /* @__PURE__ */M("span",{className:"truncate",children:$e||Z})]}),X&&!q&&(t||n)&&/* @__PURE__ */M("button",{type:"button",onClick:je,"aria-label":I.clearRange,className:"text-blue-400 hover:text-red-500 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-deep)] rounded",children:"×"})]}),Ne&&/* @__PURE__ */M("span",{id:de,className:"sr-only",children:He}),O&&/* @__PURE__ */M("span",{id:me,className:"sr-only",children:I.required}),S&&/* @__PURE__ */k(C,{children:[
9
- /* @__PURE__ */M("input",{type:"hidden",name:S.from,value:t,disabled:q||void 0}),
10
- /* @__PURE__ */M("input",{type:"hidden",name:S.to,value:n,disabled:q||void 0})]}),z&&N(
11
- /* @__PURE__ */k("div",{ref:se,id:ce,role:"dialog","aria-label":I.dialog,"data-layout":ue?"stacked":"side",className:"fixed rounded-(--radius-popup) p-4",style:{zIndex:u.popup,left:pe?.left,right:pe?.right,top:pe?.top,bottom:pe?.bottom,width:ue&&pe?pe.maxWidth:"max-content",maxWidth:pe?.maxWidth,maxHeight:pe?.maxHeight,overflowY:"auto",visibility:pe?void 0:"hidden",...f()},children:[
12
- /* @__PURE__ */k("div",{className:ue?"mb-3 flex flex-wrap items-center gap-x-4 gap-y-2":"flex items-center gap-3 mb-3",children:[Be("from",/* @__PURE__ */k(C,{children:[
13
- /* @__PURE__ */M("span",{className:"text-xs font-medium text-gray-500",children:I.from}),
14
- /* @__PURE__ */M("span",{className:`text-sm px-2 py-1 rounded border min-w-[90px] ${V?"border-blue-300 bg-accent-tint text-blue-700":"border-line bg-surface-sunken text-ink-faintest"}${Le("from")}`,children:V?De(V):I.start})]})),!ue&&/* @__PURE__ */M("span",{className:"text-gray-300",children:"—"}),Be("to",/* @__PURE__ */k(C,{children:[
15
- /* @__PURE__ */M("span",{className:"text-xs font-medium text-gray-500",children:I.to}),
16
- /* @__PURE__ */M("span",{className:`text-sm px-2 py-1 rounded border min-w-[90px] ${ee?"border-blue-300 bg-accent-tint text-blue-700":"border-line bg-surface-sunken text-ink-faintest"}${Le("to")}`,children:ee?De(ee):I.end})]}))]}),ue?/* @__PURE__ */k(C,{children:[We.length>0&&/* @__PURE__ */k("div",{className:"mb-3 @container",children:[!be&&/* @__PURE__ */M("p",{"aria-hidden":"true",className:"mb-1 text-xs font-medium text-ink-faint",children:I.lastHeading}),
17
- /* @__PURE__ */k("div",{ref:ge,className:"relative grid grid-cols-2 gap-2 @min-[320px]:grid-cols-3",children:[Se,We.map(e=>/* @__PURE__ */M("span",{"data-preset-measure":"","aria-hidden":"true",className:"invisible absolute left-0 top-0 whitespace-nowrap text-sm",children:I[e]},e))]})]}),
18
- /* @__PURE__ */M("div",{className:"w-full",children:Je})]}):
19
- /* @__PURE__ */k("div",{ref:fe,className:"flex w-max gap-4",children:[
20
- /* @__PURE__ */M("div",{className:"w-64",children:Je}),We.length>0&&/* @__PURE__ */M("div",{className:"border-l border-gray-200 pl-4 flex flex-col gap-1 min-w-[130px]",children:Se})]}),
21
- /* @__PURE__ */k("div",{className:"flex flex-wrap justify-end gap-2 mt-4 pt-3 border-t border-gray-200",children:[X&&/* @__PURE__ */M("button",{type:"button",onClick:je,className:c({variant:"ghost"}),children:I.clear}),
22
- /* @__PURE__ */M("button",{type:"button",onClick:()=>K(!1),className:c({variant:"secondary"}),children:I.cancel}),
23
- /* @__PURE__ */M("button",{type:"button",onClick:()=>{s(V,ee),K(!1)},disabled:A?!V&&!ee:!V||!ee,className:c({variant:"primary"}),children:I.apply})]})]}),document.body)]})}export{H as DateRangePicker,j as presetRange,D as toISODate};
@@ -1,100 +0,0 @@
1
- import{computeMaximizedBox as e,isSidebarStripReserved as t,boxFillsWorkArea as n,readAlwaysMaximizedFlag as r,WORK_AREA_CHANGED_EVENT as o,useShellAuth as i,scrollerIsFluid as a,growBoxToWidth as s,widthToFit as l,navIcons as c}from"./chunk-CY5N5OA3.js";import{ROW_HEIGHTS as u}from"./chunk-AW7TOB6N.js";import{reportBoundaryError as d}from"./chunk-KNUR2UEG.js";import{isStaleChunkError as h}from"./chunk-JDCM2VHG.js";import{Result as m}from"./chunk-QYL26AB4.js";import{CMD_Z as p,CMD_SHIFT_Z as f}from"./chunk-ZDMZM7HD.js";import{CopyButton as w}from"./chunk-2E2SUEEE.js";import{confirm as y}from"./chunk-PLK2WHZG.js";import{ItemCount as g}from"./chunk-55AEZX6K.js";import{isInOverlayOver as v}from"./chunk-3DVNXNTF.js";import{dialogA11y as b}from"./chunk-VWGWZY7A.js";import{ColoredBadge as x}from"./chunk-OKHKY3ZZ.js";import{useIsMobile as k,useIsPhone as E}from"./chunk-UGTRSRIW.js";import{focusableIn as C}from"./chunk-CDAJKLGL.js";import{useShellPrefs as M}from"./chunk-KC3EX26K.js";import{PopupMenu as N,PopupMenuItem as S,PopupMenuDivider as L,PopupMenuLabel as T}from"./chunk-OTITQ3IH.js";import{StatusBadge as z}from"./chunk-FZM3ZPW3.js";import{Button_default as A}from"./chunk-EOVXFXVV.js";import{Icon as D}from"./chunk-2UO47XB4.js";import{LoadingSpinner as P}from"./chunk-R2VKEMZH.js";import{Z_LAYERS as I}from"./chunk-62LW225J.js";import{runEscapeInterceptors as K}from"./chunk-TWVUQUUD.js";import{useShellStrings as W}from"./chunk-GDQJBQ5B.js";import{createContext as R,useContext as O,Component as $,useLayoutEffect as j,useRef as F,useEffect as q,useState as B,useSyncExternalStore as H,useCallback as U,isValidElement as Y,Fragment as X,Children as V,cloneElement as _,useMemo as G,useId as J,useReducer as Z,Suspense as Q}from"react";import{jsxs as ee,jsx as te,Fragment as ne}from"react/jsx-runtime";import{createPortal as re}from"react-dom";import{useLocation as oe}from"react-router-dom";import{useQueryClient as ie,useQuery as ae}from"@tanstack/react-query";function se(e){return"component"in e}function le(e){return"endpoint"in e}var ce={};function ue(e){ce=e}var de=new Proxy({},{get:(e,t)=>ce[t],has:(e,t)=>t in ce,ownKeys:()=>Object.keys(ce),getOwnPropertyDescriptor(e,t){if(t in ce)return{configurable:!0,enumerable:!0,value:ce[t]}}}),he=null;function me(e){he=e}function pe(){return null!==he}var fe=/* @__PURE__ */new Set(["get","post","put","patch","delete","head","options","request"]),we=new Proxy({},{get:(e,t)=>he?he[t]:"string"==typeof t&&fe.has(t)?()=>Promise.resolve({data:null,status:0,statusText:"",headers:{},config:{}}):void 0}),ye=R(null);function ge(){return O(ye)?.pageSearch??""}var ve=null,be=/* @__PURE__ */new Set;function xe(e){ve!==e&&(ve=e,be.forEach(e=>e()))}function ke(){return ve}function Ee(e){return be.add(e),()=>{be.delete(e)}}var Ce=null;function Me(e){Ce=e}function Ne({error:e,onReload:t}){const n=h(e);/* @__PURE__ */
2
- return ee("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 py-12 text-center",children:[
3
- /* @__PURE__ */te(D,{name:"warning",className:"h-8 w-8 text-amber-500",strokeWidth:1.5}),
4
- /* @__PURE__ */ee("div",{className:"min-w-0",children:[
5
- /* @__PURE__ */te("p",{className:"text-sm font-medium text-gray-700",children:n?"This window needs the latest version of the app":"This window crashed"}),
6
- /* @__PURE__ */te("p",{className:"mt-1 text-xs text-gray-400 max-w-sm break-words",children:n?"A new version was deployed while this tab was open. Reload the page to pick it up.":e.message||String(e)})]}),
7
- /* @__PURE__ */te("button",{type:"button",onClick:n?()=>window.location.reload():t,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 text-sm font-medium rounded-lg",children:n?"Reload page":"Reload window"})]})}var Se=class extends ${state={error:null};static getDerivedStateFromError(e){return{error:e instanceof Error?e:new Error(String(e))}}componentDidCatch(e,t){console.error("[efficient-shell] window content crashed:",e,t.componentStack),d(e)}reset=()=>this.setState({error:null});render(){const{error:e}=this.state;return e?this.props.fallback?this.props.fallback(e,this.reset):/* @__PURE__ */te(Ne,{error:e,onReload:this.reset}):this.props.children}},Le=R(null),Te="text-xs text-gray-500 hover:text-gray-700 disabled:opacity-40 disabled:hover:text-gray-500 disabled:cursor-default";function ze({className:e="",auto:t=!1}){const n=O(Le),r=W().undo,o=n?.claimOwnMount;if(j(()=>{if(!t&&o)return o(!0),()=>o(!1)},[t,o]),!n||!n.enabled)return null;const{undo:i,redo:a,canUndo:s,canRedo:l,undoLabel:c,redoLabel:u}=n;/* @__PURE__ */
8
- return ee("div",{className:`flex items-center gap-2 ${e}`,"data-undo-controls":t?"shell":"form",children:[
9
- /* @__PURE__ */te("button",{type:"button",onClick:i,disabled:!s,title:s?r.undoStep(c??"",p):r.nothingToUndo,className:Te,children:r.undo}),
10
- /* @__PURE__ */te("button",{type:"button",onClick:a,disabled:!l,title:l?r.redoStep(u??"",f):r.nothingToRedo,className:Te,children:r.redo})]})}var Ae=/* @__PURE__ */new Set([408,429]);function De(e){const t=e?.response?.status;return"number"==typeof t?t:void 0}function Pe(e){const t=De(e);return null!=t&&(t>=400&&t<500&&!Ae.has(t))}function Ie(e,t){return!Pe(t)&&e<3}function Ke(e){if("page"!==e.type)return!0;const t=e.route?de[e.route]:void 0;if(!t||!se(t))return!0;const n=t;return!n.widget&&!n.utility}function We(e){const t=e.route?de[e.route]:void 0;if(!t||!se(t))return;const n=t;return n.taskbarGroup?n.taskbarGroup:{key:e.route,label:n.label,icon:e.route}}var Re=(e,t)=>!!t&&"page"===e.type&&e.route===t;function Oe(){const e=W().loading;/* @__PURE__ */
11
- return te(P,{size:"sm",padding:"p-8",label:e.label})}var $e="flex-1 min-h-0";function je(){const e=W().record;/* @__PURE__ */
12
- return te(P,{label:e.loading,padding:"",className:$e})}function Fe(e){return e??void 0}function qe({isPending:e,isFetching:t,enabled:n=!0,error:r,onRetry:o}){const i=W().record;if(t||e&&n)/* @__PURE__ */return te(je,{});if(r){const e=De(r);if(401===e)/* @__PURE__ */
13
- return te(m,{status:"warning",title:i.signInRequired,subTitle:i.signInBody,className:$e});if(403===e)/* @__PURE__ */
14
- return te(m,{status:"403",className:$e});if(404===e||410===e)/* @__PURE__ */
15
- return te(m,{status:"404",title:i.notFound,className:$e});const t=null==e||408===e||429===e||e>=500;/* @__PURE__ */
16
- return te(m,{status:"500",title:i.loadFailed,subTitle:t?i.checkConnection:i.rejected,extra:t?/* @__PURE__ */te(A,{variant:"secondary",size:"sm",onClick:o,children:i.retry}):void 0,className:$e})}/* @__PURE__ */
17
- return te(m,{status:"404",title:i.notFound,className:$e})}function Be({entity:e,children:t,...n}){return null!=e?/* @__PURE__ */te(ne,{children:t(e)}):/* @__PURE__ */te(qe,{...n})}var He=/^[a-z]+(?:-[a-z]+)*-\d{13}$/;function Ue(e){return"string"==typeof e&&(e.startsWith("new-")||He.test(e))}function Ye(e){if(Ue(e.entityId))return!0;const t=e.entitySnapshot;return!(!t||"object"!=typeof t||!t._new&&!t._duplicate)}var Xe=R({openWindows:[],openEntity:()=>{},openPage:()=>{},reorderWindows:()=>{},closeEntity:()=>{},minimize:()=>{},items:[],restore:()=>{},remove:()=>{},restoreIfMinimized:()=>!1,openItems:[]}),Ve=R(null);function _e(e){const t=O(Ve),n=F(null);null===n.current&&(n.current=/* @__PURE__ */Symbol("window-dirty")),j(()=>{if(t)return t(n.current,e)},[t,e]),q(()=>{if(!t||!e)return;const n=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[t,e])}function Ge(){const e=F(/* @__PURE__ */new Map),[t,n]=B(!1);return{dirty:t,registerDirty:U((t,r)=>{const o=()=>{const t=Array.from(e.current.values()).some(Boolean);n(e=>e===t?e:t)};return e.current.set(t,r),o(),()=>{e.current.delete(t),o()}},[])}}function Je(){return O(Xe)}function Ze(e){if("page"!==e.type&&Ye(e))return null;const t="page"===e.type?"page":e.entityType||"",n="page"===e.type?e.route||"":e.entityId||"";return t&&n?{entityType:t,entityId:n,label:e.label}:null}function Qe({item:e,onClose:t,accentRgb:n}){const{dirty:r,registerDirty:o}=Ge(),i=de[e.route];if(!i||!se(i))return null;const a=i,s=a.component;/* @__PURE__ */
18
- return te(_r,{open:!0,onClose:t,icon:c[e.route],title:a.label,size:a.size||"2xl",dirty:r,allowPinOnTop:a.allowPinOnTop,initialPosition:a.initialPosition,widget:a.widget,compact:a.compact,appStyle:a.appStyle,flushBody:a.flushBody,autoHeight:a.autoHeight,autoMinHeight:a.autoMinHeight,autoWidth:a.autoWidth,dimensions:a.dimensions,windowKey:e.id,openedFromKey:e.openedFrom,accentRgb:n,children:/* @__PURE__ */te(Ve.Provider,{value:o,children:/* @__PURE__ */te(Q,{fallback:/* @__PURE__ */te("div",{className:"flex items-center justify-center py-12",children:/* @__PURE__ */te(Oe,{})}),children:/* @__PURE__ */te(s,{})})})})}function et({entityType:e,entityId:t,label:n}){const r=W(),o=ie(),{data:i}=ae({queryKey:["my-profile-sidebar"],enabled:pe(),queryFn:()=>we.get("/auth/me/").then(e=>e.data)}),a=(i?.preferences||{}).favorite_documents||[],s=a.some(n=>n.entityType===e&&n.entityId===t);/* @__PURE__ */
19
- return te("button",{onClick:()=>{const r=s?a.filter(n=>!(n.entityType===e&&n.entityId===t)):[...a,{entityType:e,entityId:t,label:n}];we.patch("/auth/me/",{preferences:{favorite_documents:r}}).then(()=>{o.invalidateQueries({queryKey:["my-profile-sidebar"]})})},title:s?r.taskbar.removeFromDesktop:r.taskbar.addToDesktop,className:"shrink-0 transition-colors "+(s?"text-yellow-500 hover:text-yellow-600":"text-gray-300 hover:text-yellow-400"),children:/* @__PURE__ */te(D,{name:"star",className:"h-4 w-4",fill:s?"currentColor":"none",strokeWidth:1.5})})}var tt=/* @__PURE__ */new Set,nt=()=>"hidden";function rt({item:e,onClose:t,onMinimize:n,accentRgb:r}){const o=de[e.entityType];if(!o||!le(o))return null;const i=o,[a,s]=B(!1),{dirty:l,registerDirty:u}=Ge(),d=i.queryKey||i.endpoint.replace(/^\/|\/$/g,"").split("/").pop()||e.entityType,h=e.entitySnapshot?._duplicate,m=Ue(e.entityId),p=!i.selfFetching&&!h&&!m&&pe(),f=ae({queryKey:[d,e.entityId],queryFn:()=>{return we.get((t=i.endpoint,n=String(e.entityId),`${t}${encodeURIComponent(n)}/`)).then(e=>e.data);var t,n},initialData:Fe(e.entitySnapshot),initialDataUpdatedAt:0,enabled:p,staleTime:0,refetchOnWindowFocus:!0,refetchOnMount:"always",refetchInterval:e=>!Pe(e.state.error)&&6e4,refetchIntervalInBackground:!1,retry:Ie}),w=f.data,y=f.refetch;q(()=>{var t;if(p)return t=t=>{t!==e.id||tt.has(t)||y({cancelRefetch:!1})},Qn.add(t),()=>{Qn.delete(t)}},[y,e.id,p]);const g=U(()=>{a&&!l?s(!1):t()},[a,l,t]),v=(i.useEdit??nt)(w??null),b=!i.useEdit||m||h?void 0:{state:v,editing:a,onEdit:()=>s(!0),onDiscard:()=>s(!1)},x=i.selfFetching?e.label:w?i.title(w,a,s):e.label,k=i.icon,E=k?c[k]:null,C=x,M=!i.selfFetching&&w&&i.footer&&!h?i.footer(w):void 0;return i.rendersOwnModal?i.selfFetching?/* @__PURE__ */te(Q,{fallback:/* @__PURE__ */te(Oe,{}),children:i.render(w??e.entitySnapshot,t,e.entityId,a,s)}):null!=w?/* @__PURE__ */te(Q,{fallback:/* @__PURE__ */te(_r,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */te(je,{})}),children:i.render(w,t,e.entityId,a,s)}):/* @__PURE__ */te(_r,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */te(qe,{isPending:f.isPending,isFetching:f.isFetching,enabled:p,error:f.error,onRetry:y})}):/* @__PURE__ */te(_r,{open:!0,onClose:g,onMinimize:n,initialBox:e.savedBox,icon:E,title:C,footer:M,copyText:e.label,windowKey:e.id,openedFromKey:e.openedFrom,size:i.size||"2xl",dirty:l,editing:a||m||h,edit:b,dimensions:i.dimensions,autoHeight:i.autoHeight,autoMinHeight:i.autoMinHeight,autoWidth:i.autoWidth,appStyle:i.appStyle,flushBody:i.flushBody,accentRgb:r,children:/* @__PURE__ */te(Ve.Provider,{value:u,children:/* @__PURE__ */te(Q,{fallback:/* @__PURE__ */te(je,{}),children:i.selfFetching?i.render(null,t,e.entityId,a,s):/* @__PURE__ */te(Be,{entity:w,isPending:f.isPending,isFetching:f.isFetching,enabled:p,error:f.error,onRetry:y,children:n=>i.render(n,t,e.entityId,a,s)})})})})}function ot(e){return document.querySelector(`[data-modal-panel][data-window-key="${e}"]`)}function it(e){return document.querySelector(`[data-modal-panel][data-window-root][data-window-owner="${e}"]`)}function at(e){const t=ot(e),n=t??it(e);if(!n)return;if(t&&!dr(t))return r=e,void window.dispatchEvent(new CustomEvent("modal-reveal",{detail:{windowKey:r}}));var r;const o=n.getAttribute("data-modal-id");o&&er(o)}function st(){const e=Mr();if(!e)return;const t=document.querySelector(`[data-modal-panel][data-modal-id="${e}"]`);return t?.getAttribute("data-window-key")??void 0}var lt=/* @__PURE__ */new Map;function ct(){const e=st();if(e)return lt.get(e)}function ut(e){const t=document.querySelectorAll("[data-modal-panel]");for(const n of Array.from(t)){const t=n.querySelector("[data-window-title]");if(t?.textContent?.includes(e))return n}return null}var dt="rosh-peek-style",ht=I.peek,mt=I.taskbarPreview;function pt(e){"undefined"!=typeof document&&(!function(){if("undefined"==typeof document||document.getElementById(dt))return;const e=document.createElement("style");e.id=dt,e.textContent=`body.rosh-peeking [data-modal-panel]{transition:opacity .18s ease}body.rosh-peeking [data-modal-panel]:not([data-peek-focus]){opacity:.4}body.rosh-peeking [data-modal-panel][data-peek-focus]{opacity:1}body.rosh-peeking [data-modal-panel][data-peek-focus]:not([data-pinned-top]){z-index:${ht}!important}html.rosh-reduce-transparency body.rosh-peeking [data-modal-panel]:not([data-peek-focus]){opacity:.92}@media (prefers-reduced-motion:reduce){body.rosh-peeking [data-modal-panel]{transition:none}}`,document.head.appendChild(e)}(),document.querySelectorAll("[data-modal-panel][data-peek-focus]").forEach(e=>e.removeAttribute("data-peek-focus")),e&&e.setAttribute("data-peek-focus",""),document.body.classList.toggle("rosh-peeking",!!e))}function ft(){"undefined"!=typeof document&&(document.body.classList.remove("rosh-peeking"),document.querySelectorAll("[data-modal-panel][data-peek-focus]").forEach(e=>e.removeAttribute("data-peek-focus")))}function wt({id:e,label:t,maxW:n,maxH:r,titleAbove:o=!1,onClick:i,onClose:a}){const s=W(),l=F(null),[c,u]=B({w:n,h:Math.round(.75*r)}),[d,h]=B(!1);return j(()=>{const o=l.current;if(!o)return;const i=ot(e)??ut(t);if(!i)return void h(!1);const a=i.getBoundingClientRect();if(0===a.width||0===a.height)return void h(!1);const s=Math.min(n/a.width,r/a.height),c=Math.max(80,Math.round(a.width*s)),d=Math.max(60,Math.round(a.height*s));u({w:c,h:d}),h(!0);const m=i.cloneNode(!0);return m.style.position="absolute",m.style.top="0",m.style.left="0",m.style.right="auto",m.style.bottom="auto",m.style.width=a.width+"px",m.style.height=a.height+"px",m.style.transform=`scale(${s})`,m.style.transformOrigin="top left",m.style.pointerEvents="none",m.style.animation="none",m.style.zIndex="auto",m.removeAttribute("data-modal-panel"),m.removeAttribute("data-modal-id"),m.removeAttribute("data-window-key"),m.removeAttribute("role"),m.removeAttribute("aria-labelledby"),m.removeAttribute("aria-label"),m.querySelectorAll('[role="dialog"], [data-portal]').forEach(e=>{e.style.display="none"}),o.innerHTML="",o.appendChild(m),()=>{o.innerHTML=""}},[e,t,n,r]),/* @__PURE__ */ee("div",{style:{width:c.w,height:c.h},className:"relative rounded-md overflow-hidden bg-white/95 border border-line-strong shadow-(--elevation-panel) cursor-pointer ring-2 ring-transparent group-hover:ring-blue-400 transition shrink-0",onClick:i,children:[
20
- /* @__PURE__ */te("div",{ref:l,className:"absolute inset-0 z-0 overflow-hidden"}),!d&&/* @__PURE__ */ee("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-gray-400 bg-gray-50",children:[
21
- /* @__PURE__ */te(D,{name:"window",className:"h-6 w-6",strokeWidth:1.5}),
22
- /* @__PURE__ */te("span",{className:"mt-1 text-3xs uppercase tracking-wide",children:"Hidden"})]}),!o&&/* @__PURE__ */te("div",{className:"absolute bottom-0 left-0 right-0 z-10 px-2 py-1 text-2xs font-medium text-on-accent bg-gradient-to-t from-black/80 to-transparent truncate pointer-events-none",children:t}),a&&/* @__PURE__ */te("button",{onClick:e=>{e.stopPropagation(),a()},className:"absolute top-1 right-1 z-20 h-5 w-5 rounded-full bg-gray-900/90 ring-1 ring-white/80 shadow-sm hover:bg-red-500 text-on-accent flex items-center justify-center",title:s.taskbar.closeWindow,children:/* @__PURE__ */te(D,{name:"close",className:"h-3 w-3",strokeWidth:3})})]})}function yt({items:e,anchorEl:t,onActivate:n,onClose:r,onMouseEnter:o,onMouseLeave:i}){const a=W(),s=e.length>1,l=F(null),[c,u]=B({left:-9999,top:-9999,ready:!1}),[d,h]=B(()=>"undefined"!=typeof document&&getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom");j(()=>{const e=l.current;if(!e)return;const n=()=>{const n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),o=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom";h(o);let i,a=n.left+n.width/2-r.width/2;"top"===o?i=n.bottom+8:"left"===o?(a=n.right+8,i=n.top+n.height/2-r.height/2):"right"===o?(a=n.left-r.width-8,i=n.top+n.height/2-r.height/2):i=n.top-r.height-8,a=Math.max(8,Math.min(a,window.innerWidth-r.width-8)),i=Math.max(8,Math.min(i,window.innerHeight-r.height-8)),u({left:a,top:i,ready:!0})};n();const r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[t,e.length]),q(()=>ft,[]);const m="top"===d,p=(m?"mt-1":"mb-1")+" max-w-[240px] truncate text-2xs font-medium text-ink-strongest bg-white/80 px-2 py-0.5 rounded shadow-sm ring-2 ring-transparent transition group-hover:ring-blue-400";return re(
23
- /* @__PURE__ */te("div",{ref:l,"data-taskbar-preview":"",style:{position:"fixed",left:c.left,top:c.top,zIndex:mt,maxWidth:"calc(100vw - 16px)",opacity:c.ready?1:0},className:s?"flex gap-2 flex-wrap":"",onMouseEnter:o,onMouseLeave:()=>{ft(),i()},children:e.map(e=>{const t=ot(e.id)??ut(e.label),o=t?function(e){if(dr(e))return null;const t=e.getBoundingClientRect(),n=ir(),r=t.left+t.width/2-(n.x+n.w/2),o=t.top+t.height/2-(n.y+n.h/2);return 180*Math.atan2(o,r)/Math.PI}(t):null;/* @__PURE__ */
24
- return ee("div",{className:"group flex flex-col items-center",onMouseEnter:()=>pt(t),children:[!m&&/* @__PURE__ */te("span",{className:p,children:e.label}),
25
- /* @__PURE__ */te(wt,{id:e.id,label:e.label,maxW:240,maxH:160,titleAbove:!0,onClick:()=>n(e.id),onClose:()=>r(e.id)}),m&&/* @__PURE__ */te("span",{className:p,children:e.label}),null!==o&&/* @__PURE__ */ee("span",{title:a.taskbar.offscreenHint,className:"mt-1 inline-flex items-center gap-1 rounded bg-amber-500 px-2 py-0.5 text-2xs font-semibold text-on-accent shadow-sm",children:[
26
- /* @__PURE__ */te(D,{name:"arrow-right",className:"h-3 w-3",style:{transform:`rotate(${o}deg)`},strokeWidth:3}),"Off screen"]})]},e.id)})}),document.body)}function gt(e,t){const n=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom";return"top"===n?{left:Math.min(e,window.innerWidth-220),top:t+4}:"left"===n?{left:e+4,top:Math.min(t,window.innerHeight-160)}:"right"===n?{right:window.innerWidth-e+4,top:Math.min(t,window.innerHeight-160)}:{left:Math.min(e,window.innerWidth-220),bottom:window.innerHeight-t+4}}function vt({openWindows:e,onRemove:t,onSplitView:n,onActivate:r,onActivateById:o}){const i=W(),[a,s]=B(null);q(()=>{let e,t;const n=()=>{clearInterval(e),clearTimeout(t),e=void 0},r=()=>{const e=document.getElementById("taskbar-windows");return s(t=>t===e?t:e),!!e},o=()=>{n(),r()||(e=setInterval(()=>{r()&&n()},100),t=setTimeout(n,5e3))};return o(),window.addEventListener("react-os-shell:layout-mode-changed",o),()=>{n(),window.removeEventListener("react-os-shell:layout-mode-changed",o)}},[]);const l=H(Nr,Mr),[,u]=B(0);q(()=>{const e=()=>u(e=>e+1);return window.addEventListener("modal-geometry",e),window.addEventListener("resize",e),()=>{window.removeEventListener("modal-geometry",e),window.removeEventListener("resize",e)}},[]);const[,d]=B(0);q(()=>{const e=()=>d(e=>e+1);return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[]);const h=e=>{const t=ut(e),n=t?.querySelector("[data-window-title]");return n?.textContent?.trim()||e},[m,p]=B(null),[f,w]=B(null),[y,v]=B(null),b=F(null),x=()=>{b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{p(null),w(null)},150)},k=e.filter(e=>!e.route||!de[e.route]?.utility);if(!a||!a.isConnected||0===k.length)return null;const E=[],C=/* @__PURE__ */new Map;for(const e of k){const t=e.route?de[e.route]:void 0,n=t?.taskbarGroup,r=n?.key??e.route??`entity:${e.id}`,o=C.get(r);if(void 0!==o)E[o].items.push(e);else{C.set(r,E.length);const o=n?.label??t?.label??e.label;E.push({key:r,route:n?.icon??e.route,label:o,items:[e]})}}return re(
27
- /* @__PURE__ */ee(ne,{children:[E.map(e=>{const n=e.route?c[e.route]:null,r=e.items[e.items.length-1];let a=!1;if(l){const t=document.querySelector(`[data-modal-id="${l}"]`);if(t){const n=t.querySelector("[data-window-title]"),r=n?.textContent??"";a=e.items.some(e=>r.includes(e.label))}}const s=e.items.length>1,u=e.items.some(e=>{const t=ot(e.id)??ut(e.label);return!!t&&!dr(t)});/* @__PURE__ */
28
- return ee("button",{onClick:()=>o(r.id),onMouseEnter:t=>{return n=e.items,r=t.currentTarget,void(y||(b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{p(n),w(r)},350)));var n,r},onMouseLeave:x,onDoubleClick:e=>{e.stopPropagation(),window.dispatchEvent(new CustomEvent("modal-center",{detail:{windowKey:r.id,label:r.label}}))},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),b.current&&(clearTimeout(b.current),b.current=null),p(null),w(null),s?v({x:t.clientX,y:t.clientY,items:e.items,label:e.label}):window.dispatchEvent(new CustomEvent("modal-context-menu",{detail:{windowKey:r.id,label:r.label,x:t.clientX,y:t.clientY}}))},style:{width:"var(--window-tab-width, 200px)",fontSize:"var(--window-tab-font-size, 12px)"},"data-tab-group":e.key,className:"group relative flex items-center gap-2 rounded-lg px-3 py-2 font-medium transition-all min-w-0 shrink "+(a?"bg-blue-100/60 border border-blue-400/60 text-blue-700":"bg-gray-50/40 border border-gray-200/40 text-gray-700 hover:bg-gray-200/40"),children:[n&&Y(n)?_(n,{className:"h-3.5 w-3.5 shrink-0"}):/* @__PURE__ */te(D,{name:"expand",className:"h-3.5 w-3.5 shrink-0",strokeWidth:2}),
29
- /* @__PURE__ */te("span",{className:"truncate flex-1",children:s?e.label:h(r.label)}),u&&/* @__PURE__ */te("span",{title:i.taskbar.offscreenDot,className:"shrink-0 h-1.5 w-1.5 rounded-full bg-amber-500"}),s&&/* @__PURE__ */te(g,{count:e.items.length,label:i.count.windows(e.items.length)}),!s&&/* @__PURE__ */te("span",{role:"button",onClick:e=>{e.stopPropagation(),t(r.id)},className:"ml-auto text-gray-400 hover:text-red-500 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:/* @__PURE__ */te(D,{name:"close",className:"h-3 w-3",strokeWidth:2})})]},e.key)}),
30
- /* @__PURE__ */te("div",{className:"flex-1"}),k.length>=2&&/* @__PURE__ */ee("button",{onClick:n,title:i.taskbar.expose,className:"flex items-center gap-1 rounded px-2 py-1 text-2xs font-medium text-blue-600 border border-blue-300 hover:bg-accent-tint transition-colors shrink-0",children:[
31
- /* @__PURE__ */te(D,{name:"grid",className:"h-3 w-3",strokeWidth:2}),"Exposé"]}),y&&/* @__PURE__ */ee(N,{portal:!0,minWidth:200,style:gt(y.x,y.y),onClose:()=>v(null),children:[
32
- /* @__PURE__ */te(T,{children:y.label}),
33
- /* @__PURE__ */ee(S,{onClick:()=>{v(null),y.items.forEach(e=>function(e){const t=On.get(e);t&&tr(t)}(e.id))},children:[
34
- /* @__PURE__ */te(D,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),i.taskbar.minimizeAllWindows]}),
35
- /* @__PURE__ */ee(S,{onClick:()=>{v(null),y.items.forEach(e=>o(e.id))},children:[
36
- /* @__PURE__ */te("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */te("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75h6.5v6.5h-6.5zM13.75 8.75h6.5v6.5h-6.5z"})}),i.taskbar.restoreAllWindows]}),
37
- /* @__PURE__ */te(L,{}),
38
- /* @__PURE__ */ee(S,{danger:!0,onClick:()=>{v(null),y.items.forEach(e=>t(e.id))},children:[
39
- /* @__PURE__ */te(D,{name:"close",className:"h-4 w-4",strokeWidth:2}),`${i.taskbar.closeAllWindows} (${y.items.length})`]})]}),m&&f&&/* @__PURE__ */te(yt,{items:m,anchorEl:f,onActivate:e=>{o(e),p(null),w(null)},onClose:e=>{t(e),p(null),w(null)},onMouseEnter:()=>{b.current&&(clearTimeout(b.current),b.current=null)},onMouseLeave:x})]}),a)}var bt=["/login","/forgot-password","/reset-password","/force-change-password"];function xt({children:e,windowAccentForRoute:t}){const n=oe(),r=bt.some(e=>n.pathname.startsWith(e)),[o,i]=B([]),a=F(o);j(()=>{a.current=o},[o]);const s=H(Ee,ke,ke),l=F(/* @__PURE__ */new Map),c=e=>{const t=Ke(e),n=!!s&&"page"===e.type&&e.route===s,r=e.pageSearch||void 0,o=l.current.get(e.id);if(o&&o.tab===t&&o.home===n&&o.pageSearch===r)return o;const i={key:e.id,tab:t,home:n,...r?{pageSearch:r}:{}};return l.current.set(e.id,i),i};q(()=>{lt.clear();for(const e of o)e.route&&lt.set(e.id,e.route)},[o]);const u=U(e=>{i(t=>t.filter(t=>t.id!==e))},[]),d=U(e=>{var t;ot(e)||it(e)?(t=e,window.dispatchEvent(new CustomEvent(Sr,{detail:{windowKey:t}}))):u(e)},[u]),h=(e,t=!1)=>{const n=Pn;t&&tt.add(e),setTimeout(()=>{const r=document.querySelector(`[data-modal-panel][data-window-key="${e}"]`),o=r?.getAttribute("data-modal-id");var i,a;!o||(i=o,a=n,(In.get(i)??-1)>a)||er(o),t&&tt.delete(e)},50)},m=(e,t,n)=>{const r=Ce;if(n||!r)return[...e,t];const o=function(e,t,n){if(!Ke(t))return e.length;if(t.shellOwned&&Re(t,n.home))return 0;const r=Re(t,n.home)?void 0:We(t)?.key;if(r){let t=-1;if(e.forEach((e,o)=>{Ke(e)&&!Re(e,n.home)&&We(e)?.key===r&&(t=o)}),t>=0)return t+1}if("page"===t.type&&t.route&&!Re(t,n.home)&&n.favorites.includes(t.route))return e.length>0&&Re(e[0],n.home)?1:0;const o=t.openedFrom?e.findIndex(e=>e.id===t.openedFrom):-1;if(o>=0){const t=/* @__PURE__ */new Set([e[o].id]);let r=o+1;for(;r<e.length&&e[r].openedFrom&&t.has(e[r].openedFrom);)t.add(e[r].id),r++;const i=t=>Ke(e[t])&&!Re(e[t],n.home)?We(e[t])?.key:void 0;for(;r>0&&r<e.length&&void 0!==i(r)&&i(r)===i(r-1);)r++;return r}return e.length}(e,t,{home:ke(),favorites:r.favorites});return[...e.slice(0,o),t,...e.slice(o)]},p=U(e=>{i(t=>function(e,t){const n=new Set(t),r=new Map(e.map(e=>[e.id,e])),o=t.map(e=>r.get(e)).filter(e=>!!e);if(o.length!==n.size)return e;let i=0;const a=e.map(e=>n.has(e.id)?o[i++]:e);return a.every((t,n)=>t===e[n])?e:a}(t,e))},[]),f=U((e,t,n,r,o,a={})=>{if(!de[e]||!le(de[e]))return;const s=`${e}:${t}`,l=st();i(i=>{const c=i.find(n=>n.entityType===e&&String(n.entityId)===String(t));return c?(h(c.id),i):(h(s,!0),m(i,{id:s,type:"modal",label:r||t,route:o||window.location.pathname,entityType:e,entityId:t,entitySnapshot:Fe(n),openedFrom:l},!!a.append))})},[]),w=U((e,t={})=>{if(!de[e]||!se(de[e]))return;const n=de[e],{reuse:r=!1,background:o=!1,shellOwned:s,search:l,append:c=!1}=t,u=e=>{var t;o?(t=e,Bn.add(t)):h(e)};if(n.widget){const t=a.current.find(t=>"page"===t.type&&t.route===e);if(t)return void d(t.id)}const p=st();i(t=>{if(n.multiInstance){const i=t.filter(t=>"page"===t.type&&t.route===e);if(r&&!l&&i.length>0)return o||h(i[i.length-1].id),t;const a=`page:${e}:${Math.random().toString(36).slice(2,8)}`;return u(a),m(t,{id:a,type:"page",label:n.label,route:e,openedFrom:p,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}},c)}const i=t.find(t=>"page"===t.type&&t.route===e);if(i)return n.widget?t:(o||h(i.id),l&&i.pageSearch!==l?t.map(e=>e===i?{...e,pageSearch:l}:e):t);const a=`page:${e}`;return u(a),m(t,{id:a,type:"page",label:n.label,route:e,openedFrom:p,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}},c)})},[d]),y=U(()=>{},[]),g=U(()=>{},[]),v=d,b=d;/* @__PURE__ */
40
- return ee(Xe.Provider,{value:{openWindows:o,openEntity:f,openPage:w,reorderWindows:p,closeEntity:v,minimize:y,items:[],openItems:o,restore:g,remove:b,restoreIfMinimized:()=>!1},children:[e,
41
- /* @__PURE__ */te(vt,{openWindows:o,onRemove:d,onSplitView:Xr,onActivate:e=>{document.querySelectorAll("[data-modal-panel]").forEach(t=>{const n=t.querySelector("[data-window-title]");if(n?.textContent?.includes(e)){const e=t.getAttribute("data-modal-id");e&&er(e)}})},onActivateById:at}),
42
- /* @__PURE__ */te(Vr,{}),!r&&o.map(e=>{const n=e.route?t?.(e.route):void 0;
43
- /* @__PURE__ */
44
- return te(ye.Provider,{value:c(e),children:/* @__PURE__ */te(Se,{fallback:(t,n)=>/* @__PURE__ */te(_r,{open:!0,onClose:()=>u(e.id),title:e.label,size:"md",autoHeight:!0,windowKey:e.id,children:/* @__PURE__ */te(Ne,{error:t,onReload:n})}),children:/* @__PURE__ */te(Jt,{spec:Ze(e),children:/* @__PURE__ */te(no,{windowId:e.id,children:"page"===e.type?/* @__PURE__ */te(Qe,{item:e,onClose:()=>u(e.id),accentRgb:n}):/* @__PURE__ */te(rt,{item:e,onClose:()=>u(e.id),onMinimize:()=>{},accentRgb:n})})})})},e.id)})]})}var kt=400;function Et({panelRef:e,bodyRef:t,open:n,widget:r,active:o,minimized:i}){const a=F(null),s=F(!1);n&&!s.current&&(a.current="undefined"==typeof document?null:document.activeElement),s.current=n;const l=F(!1),c=F(void 0),u=F(i),d=u.current&&!i;u.current=i;const h=()=>{l.current=!0,clearTimeout(c.current),c.current=setTimeout(()=>{l.current=!1},kt)};q(()=>{n&&!r&&h()},[n,r]),q(()=>{d&&n&&!r&&h()},[d]),q(()=>()=>clearTimeout(c.current),[]),q(()=>{if(!n||r||!o||i||!l.current)return;l.current=!1;const a=e.current;if(!a||a.contains(document.activeElement))return;if(document.activeElement?.closest('[aria-modal="true"]'))return;const s=t.current?C(t.current)[0]:void 0;s?s.focus():(a.hasAttribute("tabindex")||a.setAttribute("tabindex","-1"),a.focus())},[n,r,o,i,e,t]),j(()=>{if(!n||r)return;const t=e.current;return()=>{const e=a.current,n=document.activeElement;(!n||n===document.body||!!t?.contains(n))&&e&&e.isConnected&&!t?.contains(e)&&e.focus?.()}},[n,r,e])}var Ct=null,Mt=/* @__PURE__ */new Set;function Nt(){return Ct}function St(e){if(Ct!==e){Ct=e;for(const e of Mt)e()}}function Lt(e){return Mt.add(e),()=>{Mt.delete(e)}}var Tt=!1,zt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},At=()=>{};function Dt(e){Tt=e,zt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0}}function Pt(e,t){Tt&&("submenu"===e?zt.submenus++:zt.menus++,zt.menuKey=t)}function It(e){if(!Tt)return At;const t=performance.now();let n=!1;return()=>{if(n)return;if(n=!0,!Tt)return;const r=performance.now()-t;"move"===e?zt.moveMs+=r:zt.resizeMs+=r}}function Kt(){const e=zt;return zt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},e}var Wt=/* @__PURE__ */new Set([z,x]),Rt=e=>Wt.has(e)||"function"==typeof e&&"badge"===e.titleRole,Ot=/* @__PURE__ */new Set(["button","a","input","select","textarea","kbd"]),$t=/* @__PURE__ */new Set(["svg"]);function jt(e){const t=[],n={text:"",accessories:[],badges:[],actions:[]};return Ft(e,n,t),n.text=t.join("").replace(/\s+/g," ").trim(),n}function Ft(e,t,n){if(null==e||"boolean"==typeof e)return;if("string"==typeof e||"number"==typeof e)return void n.push(String(e));if(Array.isArray(e))return void e.forEach(e=>Ft(e,t,n));if(!Y(e))return;const r=e;if(r.type===w)return void(void 0===t.copy&&"string"==typeof r.props.text&&r.props.text&&(t.copy=r.props.text));if(r.type===X)return void V.toArray(r.props.children).forEach(e=>Ft(e,t,n));if("string"==typeof r.type){if($t.has(r.type))return;if(!Ot.has(r.type))return n.push(" "),V.toArray(r.props.children).forEach(e=>Ft(e,t,n)),void n.push(" ")}const o=_(r,{key:`title-part-${t.accessories.length}`});t.accessories.push(o),(Rt(r.type)?t.badges:t.actions).push(o)}var qt=/* @__PURE__ */new Map,Bt=/* @__PURE__ */new Set,Ht=0;function Ut(){Ht++,Bt.forEach(e=>e())}function Yt(e){return qt.get(e)}function Xt(e){return Bt.add(e),()=>{Bt.delete(e)}}function Vt(){return Ht}var _t=R(""),Gt=R(null);function Jt({spec:e,children:t}){/* @__PURE__ */
45
- return te(Gt.Provider,{value:e,children:t})}var Zt=/* @__PURE__ */new Set(["button","input","textarea","select","kbd","svg"]),Qt='button[type="submit"], button[data-submit], button.btn-submit, button.bg-green-600, button.bg-blue-600',en='button, a[href], summary, [role="button"], [role="link"], [role="menuitem"], select';function tn(e){return nn(e).replace(/\s+/g," ").trim()}function nn(e){if(null==e||"boolean"==typeof e)return"";if("string"==typeof e)return e;if("number"==typeof e)return String(e);if(Array.isArray(e))return e.map(nn).join("");if(Y(e)){const t=e,n="string"==typeof t.type?t.type:"";return Zt.has(n)?"":` ${nn(t.props?.children)} `}return""}function rn(e){const t=O(_t);q(()=>{if(!t)return;const n=n=>{n.detail===t&&e()};return window.addEventListener("widget-open-settings",n),()=>window.removeEventListener("widget-open-settings",n)},[e,t])}var on={};function an(e,t,n){const r=O(_t);q(()=>{if(!r)return;on[r]||(on[r]=[]);const o={label:e,icon:n,onClick:t};return on[r].push(o),()=>{on[r]=(on[r]||[]).filter(e=>e!==o)}},[r,e,t,n])}function sn({title:e}){const t=F(null);return q(()=>{const n=setTimeout(()=>{const n=t.current?.closest("[data-modal-id]"),r=n?.getAttribute("data-modal-id");r&&window.dispatchEvent(new CustomEvent("window-title-update",{detail:{id:r,title:e}}))},0);return()=>clearTimeout(n)},[e]),/* @__PURE__ */te("span",{ref:t,style:{display:"none"},"aria-hidden":"true"})}function ln(e){}var cn=R(null);function un(){return O(_t)}function dn(){const e=H(Nr,Mr),t=O(cn);return t?.active??(zn.length<=1||null!=e)}function hn({children:e,position:t="right",quiet:n=!1}){const r=O(cn),[o,i]=B(null);return q(()=>{if(!r)return;const e="left"===t?r.leftRef:r.rightRef,o=()=>!!e.current&&(i(e.current),n||r.notify(),!0);if(o())return;const a=setInterval(()=>{o()&&clearInterval(a)},50),s=setTimeout(()=>clearInterval(a),2e3);return()=>{clearInterval(a),clearTimeout(s)}},[r,t,n]),o?re(e,o):null}function mn({onClick:e,children:t,className:n}){const r=O(cn);/* @__PURE__ */
46
- return te("button",{type:"button",onClick:async()=>{if(r?.isDirty){const{confirm:e}=await(import("./shell/ConfirmDialog.js"));if(!await e({title:"Discard changes?",message:"You have unsaved changes. Are you sure you want to cancel? All changes will be lost.",confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"}))return}e()},className:n||"bg-white text-gray-700 border border-gray-300 px-4 py-2 text-sm font-medium rounded-lg hover:bg-gray-50",children:t||"Cancel"})}var pn="erp_window_positions",fn={};try{const e=localStorage.getItem(pn);e&&(fn=JSON.parse(e))}catch{}var wn=null;function yn(){wn&&clearTimeout(wn),wn=setTimeout(()=>{try{localStorage.setItem(pn,JSON.stringify(fn))}catch{}},500)}var gn="erp_activation_order",vn=[];try{const e=localStorage.getItem(gn),t=e?JSON.parse(e):null;Array.isArray(t)&&t.every(e=>"string"==typeof e)&&(vn=t)}catch{}var bn=null;function xn(){bn&&clearTimeout(bn),bn=setTimeout(()=>{try{localStorage.setItem(gn,JSON.stringify(vn))}catch{}},500)}function kn(e,t){fn[e]||(fn[e]=t,yn())}function En(e){return fn[e]?{...fn[e]}:null}function Cn(e,t){fn[e]=t,yn()}function Mn(){const r=e(),o=t();let i=!1;for(const e of Object.keys(fn))n(fn[e],r,o)&&(delete fn[e],i=!0);i&&yn()}var Nn={sm:384,md:512,lg:672,xl:896,"2xl":1152,"3xl":1408},Sn=4e3,Ln=()=>{if("undefined"==typeof document)return"large";const e=getComputedStyle(document.documentElement).getPropertyValue("--default-window-size")?.trim();return"small"===e||"medium"===e||"maximized"===e?e:"large"},Tn={small:.8,medium:1,large:1.25,maximized:1.25},zn=[],An=/* @__PURE__ */new Set,Dn=/* @__PURE__ */new Set,Pn=0,In=/* @__PURE__ */new Map;var Kn=0;function Wn(){return Kn}function Rn(){Kn++,An.forEach(e=>e())}var On=/* @__PURE__ */new Map,$n=/* @__PURE__ */new Map,jn=/* @__PURE__ */new Map;function Fn(){for(let e=zn.length-1;e>=0;e--){const t=jn.get(zn[e]);if(t?.tab)return t.owner}return null}function qn(){return H(Nr,Fn,()=>null)}var Bn=/* @__PURE__ */new Set;var Hn=null;function Un(e){Hn=null,er(e)}function Yn(e){Hn=e;const t=On.get(e);t&&Un(t)}var Xn=/* @__PURE__ */new Map;function Vn(e){return Xn.get(e)?.holdsChanges()??!1}function _n(e){const t=Xn.get(e);return t?t.ask():Promise.resolve(!0)}function Gn(e){Hn===e&&(Hn=null)}function Jn(e,t,n){if(n&&jn.set(e,n),t)if(On.set(t,e),$n.set(e,t),Bn.delete(t)){zn.unshift(e);const n=vn.indexOf(t);-1!==n&&vn.splice(n,1),vn.unshift(t),xn()}else!function(e,t){const n=vn.indexOf(t);if(-1===n)return void zn.push(e);let r=zn.length;for(let e=0;e<zn.length;e++){const t=$n.get(zn[e]);if(t&&vn.indexOf(t)>n){r=e;break}}zn.splice(r,0,e)}(e,t),-1===vn.indexOf(t)&&(vn.push(t),xn());else zn.push(e);Rn(),window.dispatchEvent(new CustomEvent("modal-reorder")),t&&Hn===t&&Un(e)}function Zn(e){return e?jn.get(e)?.owner??$n.get(e)??null:null}var Qn=/* @__PURE__ */new Set;function er(e){const t=Zn(Mr()),n=zn.indexOf(e);-1!==n&&zn.splice(n,1),zn.push(e);const r=jn.get(e);if(r?.root)for(const[e,t]of jn){if(t.root||t.owner!==r.owner||Dn.has(e))continue;const n=zn.indexOf(e);-1!==n&&zn.splice(n,1),zn.push(e)}Dn.delete(e);const o=$n.get(e);if(o){const e=vn.indexOf(o);-1!==e&&vn.splice(e,1),vn.push(o),xn(),Hn&&Hn!==o&&(Hn=null)}Rn(),window.dispatchEvent(new CustomEvent("modal-reorder"));const i=Zn(Mr());i&&i!==t&&Qn.forEach(e=>e(i))}function tr(e){const t=zn.indexOf(e);-1!==t&&zn.splice(t,1),Dn.add(e),In.set(e,++Pn);const n=$n.get(e);if(n){const e=vn.indexOf(n);-1!==e&&(vn.splice(e,1),xn())}Rn(),window.dispatchEvent(new CustomEvent("modal-reorder"))}var nr=/* @__PURE__ */new Set;var rr=8,or=32;function ir(){return e()}var ar=u.windowBar,sr=80,lr=384,cr=400;function ur(e,t=ir()){const n=Math.min(Math.max(e.x,t.x+sr-e.w),t.x+t.w-sr),r=Math.min(Math.max(e.y,t.y),t.y+t.h-ar);return n===e.x&&r===e.y?e:{...e,x:n,y:r}}function dr(e){const t=e.getBoundingClientRect();if(0===t.width||0===t.height)return!0;const n=ir();return t.left>=n.x-1&&t.top>=n.y-1&&t.right<=n.x+n.w+1&&t.bottom<=n.y+n.h+1}function hr(e){const t=ir(),n=Math.floor(t.w/2),r=Math.floor(t.h/2);switch(e){case"top":return{x:t.x,y:t.y,w:t.w,h:t.h};case"left":return{x:t.x,y:t.y,w:n,h:t.h};case"right":return{x:t.x+n,y:t.y,w:t.w-n,h:t.h};case"tl":return{x:t.x,y:t.y,w:n,h:r};case"tr":return{x:t.x+n,y:t.y,w:t.w-n,h:r};case"bl":return{x:t.x,y:t.y+r,w:n,h:t.h-r};case"br":return{x:t.x+n,y:t.y+r,w:t.w-n,h:t.h-r}}}var mr=null;function pr(e){const t=(mr||((mr=document.createElement("div")).style.cssText=["position: fixed","pointer-events: none",`z-index: ${I.snapPreview}`,"border-radius: 8px","background: rgba(59, 130, 246, 0.18)","border: 2px solid rgb(59, 130, 246)","transition: left 120ms ease, top 120ms ease, width 120ms ease, height 120ms ease, opacity 120ms ease","opacity: 0","display: none"].join(";"),document.body.appendChild(mr)),mr);t.style.display="block",t.style.left=`${e.x}px`,t.style.top=`${e.y}px`,t.style.width=`${e.w}px`,t.style.height=`${e.h}px`,t.style.opacity="1"}function fr(){mr&&(mr.style.opacity="0",mr.style.display="none")}var wr=[{zone:"left",labelKey:"snapLeft",region:"inset-y-0 left-0 w-1/2"},{zone:"right",labelKey:"snapRight",region:"inset-y-0 right-0 w-1/2"},{zone:"tl",labelKey:"snapTopLeft",region:"top-0 left-0 h-1/2 w-1/2"},{zone:"tr",labelKey:"snapTopRight",region:"top-0 right-0 h-1/2 w-1/2"},{zone:"bl",labelKey:"snapBottomLeft",region:"bottom-0 left-0 h-1/2 w-1/2"},{zone:"br",labelKey:"snapBottomRight",region:"bottom-0 right-0 h-1/2 w-1/2"}],yr=350,gr=200;function vr({maximized:e,onToggleMax:t,onSnap:n,buttonClassName:r,strings:o}){const[i,a]=B(!1),s=F(void 0),l=F(void 0);q(()=>()=>{clearTimeout(s.current),clearTimeout(l.current)},[]);const c=()=>{clearTimeout(l.current),s.current=setTimeout(()=>a(!0),yr)},u=()=>{clearTimeout(s.current),l.current=setTimeout(()=>a(!1),gr)};/* @__PURE__ */
47
- return ee("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:u,children:[
48
- /* @__PURE__ */te("button",{onClick:t,onFocus:c,onBlur:u,title:e?o.windowed:o.maximize,className:r,children:e?"❐":"⤢"}),i&&/* @__PURE__ */te("div",{role:"group","aria-label":o.snapLayouts,onMouseEnter:()=>clearTimeout(l.current),onMouseLeave:u,className:"absolute right-0 top-full z-30 mt-1 grid w-max grid-cols-2 gap-1 rounded-lg border border-line bg-surface p-2 shadow-lg",children:wr.map(({zone:e,labelKey:t,region:r})=>/* @__PURE__ */te("button",{type:"button","aria-label":o[t],title:o[t],onClick:()=>{a(!1),n(e)},onFocus:()=>clearTimeout(l.current),onBlur:u,className:"relative h-7 w-11 rounded border border-gray-300 bg-gray-50 hover:border-blue-400 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400",children:/* @__PURE__ */te("span",{"aria-hidden":"true",className:`absolute rounded-sm bg-blue-500/70 ${r}`,style:{margin:2}})},e))})]})}var br="rosh-gesture-style";var xr={se:"nwse-resize",nw:"nwse-resize",sw:"nesw-resize",ne:"nesw-resize",n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize"},kr=4;function Er(e,t,n,r){!function(){if("undefined"==typeof document||document.getElementById(br))return;const e=document.createElement("style");e.id=br,e.textContent="body.rosh-gesturing [data-modal-panel]{will-change:transform}",document.head.appendChild(e)}();try{e.setPointerCapture(t)}catch{}document.body.classList.add("rosh-gesturing");const o=document.createElement("div");o.setAttribute("data-drag-shield",""),o.style.cssText=`position:fixed;inset:0;z-index:2147483647;cursor:${n};background:transparent;touch-action:none`,document.body.appendChild(o);const i=It(r);let a=!1;return()=>{if(!a){a=!0,i();try{e.releasePointerCapture(t)}catch{}o.remove(),document.body.classList.remove("rosh-gesturing")}}}function Cr(e){const t=zn.indexOf(e);if(-1===t)return-1;const n=I.window+t*I.windowStep,r=jn.get(e);if(!r||r.root)return n;let o=-1;for(const[e,t]of jn){if(!t.root||t.owner!==r.owner)continue;const n=zn.indexOf(e);-1!==n&&(o=Math.max(o,I.window+n*I.windowStep))}return o>=n?o+2+Math.min(t,7):n}function Mr(){return zn[zn.length-1]||null}function Nr(e){return An.add(e),()=>{An.delete(e)}}"undefined"!=typeof window&&window.addEventListener("deactivate-all-modals",function(){for(let e=zn.length-1;e>=0;e--)nr.has(zn[e])||zn.splice(e,1);vn=vn.filter(e=>{const t=On.get(e);return null!=t&&nr.has(t)}),xn(),Rn(),window.dispatchEvent(new CustomEvent("modal-reorder"))});var Sr="modal-close-request";function Lr(e){H(Nr,Wn);const t=O(cn);if(zn.length<=1)return!0;if(e){const t=On.get(e);if(null!=t)return Mr()===t}return t?.active??null!=Mr()}var Tr=!1,zr=/* @__PURE__ */new Set;function Ar(e){return zr.add(e),()=>zr.delete(e)}function Dr(){return Tr}function Pr(e){Tr!==e&&(Tr=e,zr.forEach(e=>e()))}function Ir(){Pr(!Tr)}function Kr(){Pr(!1)}var Wr=null,Rr=/* @__PURE__ */new Set;function Or(e){return Rr.add(e),()=>Rr.delete(e)}function $r(){return Wr}function jr(e){Wr!==e&&(Wr=e,Rr.forEach(e=>e()))}var Fr=null,qr=/* @__PURE__ */new Set;function Br(e){return qr.add(e),()=>qr.delete(e)}function Hr(){return Fr}function Ur(e){Fr!==e&&(Fr=e,qr.forEach(e=>e()))}function Yr(){if(!Fr)return void Pr(!1);jr(Fr),Ur(null),Pr(!1)}function Xr(){Pr(!Tr),window.dispatchEvent(new CustomEvent("modal-split-view"))}function Vr(){const e=H(Ar,Dr),[t,n]=B(e),[r,o]=B(e);return q(()=>{if(e){n(!0);const e=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(e)}o(!1);const t=setTimeout(()=>n(!1),280);return()=>clearTimeout(t)},[e]),t&&"undefined"!=typeof document?re(
49
- /* @__PURE__ */te("div",{onMouseDown:e=>{e.stopPropagation(),Pr(!1)},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",zIndex:I.expose,cursor:"pointer",opacity:r?1:0,transition:"opacity 260ms cubic-bezier(0.2, 0.8, 0.2, 1)",pointerEvents:r?"auto":"none"}}),document.body):null}function _r({open:t,onClose:i,title:c,icon:u,copyText:d,size:h="lg",dirty:m=!1,onNext:p,onPrev:f,footer:w,bodyScroll:g,onMinimize:x,initialBox:C,actions:T,actionsLeft:z,editing:P=!1,edit:R,allowPinOnTop:$,initialPosition:X,widget:V,compact:Z,appStyle:Q,flushBody:oe,autoHeight:ie,autoMinHeight:ae,autoWidth:se,widgetMenu:le,dimensions:ce,windowKey:ue,openedFromKey:de,accentRgb:he,children:me}){const[pe,fe]=B(()=>r()),we=k()&&!pe,ge=E()&&!!V,[ve,be]=B(0),[xe,ke]=B(!1),Ee=F(null),Ce=F(0);q(()=>{Ce.current=ve},[ve]);const Me=U(e=>{we&&(Ee.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},ke(!0),St(de??null))},[we,de]),Ne=H(Lt,Nt);q(()=>{if(!xe)return;const e=e=>{if(!Ee.current)return;const t=e.clientX-Ee.current.startX;if(Math.abs(e.clientY-Ee.current.startY)>Math.abs(t)+12)return Ee.current=null,ke(!1),be(0),void St(null);be(Math.max(0,t))},t=()=>{if(!Ee.current)return;const e=.3*window.innerWidth,t=Ce.current>e;Ee.current=null,ke(!1),t?(be(window.innerWidth),setTimeout(()=>{i(),be(0),St(null)},180)):(be(0),St(null))};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t),window.addEventListener("pointercancel",t),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t),window.removeEventListener("pointercancel",t)}},[xe]);const[Te,Ae]=B(c),De=W(),Pe=De.window;q(()=>{Ae(c)},[c]);const Ie=G(()=>tn(Te).trim()||void 0,[Te]),Ke=J(),[We,Re]=B(!1),Oe=F(!1),[$e,je]=B(!1),[Fe,qe]=B(null),Be=O(Gt),He=O(ye),{prefs:Ue,save:Ye}=M(),Xe=!!Ue.window_accent_stripe,Ve=Ue.favorite_documents||[],Ge=!!Be&&Ve.some(e=>e.entityType===Be.entityType&&e.entityId===Be.entityId),Ze=U(()=>{if(!Be)return;const e=Ge?Ve.filter(e=>!(e.entityType===Be.entityType&&e.entityId===Be.entityId)):[...Ve,{entityType:Be.entityType,entityId:Be.entityId,label:Be.label}];Ye({favorite_documents:e})},[Be,Ge,Ve,Ye]),[Qe,et]=B(null),[tt,nt]=B("top-right"===X?"right":"left"),rt=F(!1),ot=F(null);j(()=>{const e=ot.current;e&&(he?e.style.setProperty("--window-accent-rgb",he):e.style.removeProperty("--window-accent-rgb"))},[he]);const it=F(!1),at=F(null),st=F(null),lt=F(null),[ct,ut]=B(!1),dt=F(null),ht=F(null),mt=F(null),[pt,ft]=B(!1);j(()=>{const e=ht.current,t=mt.current;if(!e||!t)return;const n=()=>ft(function(e,t){return e.scrollWidth>t.clientWidth}(t,e));if(n(),"undefined"==typeof ResizeObserver)return;const r=new ResizeObserver(n);return r.observe(e),r.observe(t),()=>r.disconnect()},[null!=w&&!1!==w]);const wt=!!R&&!V&&!Z&&!Q&&(R.editing||"hidden"!==R.state),yt=!!(w||T||z)||ct||wt,gt=O(Le),vt=""!==O(_t),bt=F(null);bt.current=He?{owner:He.key,tab:He.tab,root:!vt}:null;const xt=ue||(He&&!vt?He.key:null),kt=!!gt&&!vt&&gt.enabled&&gt.hasState&&(P||gt.declaredEditable)&&!gt.handMounted&&yt&&!V&&!Z&&!Q&&!we,Ct=/* @__PURE__ */te(D,{name:"window",className:"h-4 w-4",strokeWidth:1.5}),Mt=u&&Y(u)?_(u,{className:`h-4 w-4 ${u.props?.className??""}`.trim()}):u??Ct,Tt=()=>/* @__PURE__ */te("button",{onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();qe(e=>e?null:{x:t.left,y:t.bottom+4})},className:"shrink-0 p-0.5 rounded hover:bg-gray-200/50 transition-colors",title:"Window menu",children:Mt}),zt=40,{minimize:At,items:Dt,restoreIfMinimized:Pt,openWindows:It}=Je(),Kt=F(`modal-${Math.random().toString(36).slice(2,8)}`).current;q(()=>{if(V)return nr.add(Kt),()=>{nr.delete(Kt)}},[V,Kt]),q(()=>{const e=e=>{const t=e.detail;t?.id===Kt&&Ae(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[Kt]);const[Wt,Rt]=B(I.window),Ot=function(e){const t=H(Nr,Mr);return zn.length<=1||t===e}(Kt),$t=F(R);$t.current=R;const Ft=!!R&&!R.editing&&"enabled"===R.state;q(()=>{if(!t||!Ot||!Ft)return;const e=e=>{("KeyE"===e.code||"E"===e.key||"e"===e.key)&&e.altKey&&e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(v(e.target,ot.current)||(e.preventDefault(),e.stopPropagation(),$t.current?.onEdit()))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Ot,Ft]);const Bt=function(e){return H(Nr,()=>Dn.has(e))}(Kt);Et({panelRef:ot,bodyRef:at,open:t,widget:!!V,active:Ot,minimized:Bt});const Ht=H(Ar,Dr),Yt=H(Or,$r),Xt=H(Br,Hr),Vt=!$&&!V,Jt=Ht&&Vt,[Zt,nn]=B(!1),rn=Jt&&Xt===Kt,[an,sn]=B(!1),ln=an&&Vt&&Yt===Kt?"picked":null,un=F(Jt);q(()=>{if(un.current&&!Jt){sn(!0);const e=setTimeout(()=>{sn(!1),Wr===Kt&&jr(null)},700);return un.current=Jt,()=>clearTimeout(e)}un.current=Jt},[Jt,Kt]),q(()=>{Jt||nn(!1)},[Jt]),q(()=>{const e=st.current,t=lt.current;if(!e&&!t)return;const n=e=>e?Array.from(e.children).filter(e=>"shell"!==e.dataset.undoControls).length:0,r=()=>ut(n(e)+n(t)>0);r();const o=new MutationObserver(r);return e&&o.observe(e,{childList:!0}),t&&o.observe(t,{childList:!0}),()=>o.disconnect()},[t]),q(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&ot.current){const t=ot.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=st.current,n=lt.current;return t&&t.addEventListener("click",e),n&&n.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e),n&&n.removeEventListener("click",e)}},[t]);const dn=F(!1),hn=U(e,[]),mn=U(()=>{const t=e(),n=ce?ce[0]:Nn[h]||672,o=t.w-80,i=t.h-80,a=Math.min(n,o),s=Tn[Ln()],l=ce?Math.min(ce[1],i):(()=>{const e=("sm"===h?500:"md"===h?600:"lg"===h?700:"xl"===h?800:920)*s;return Math.max(320,Math.min(e,t.h-80))})(),c="cascade"!==(getComputedStyle(document.documentElement).getPropertyValue("--window-position")?.trim()||"cascade")||r()?0:30*(zn.length-1),u=Math.max(zt,(i-l)/2),d=(o-a)/2,m=t.h-zt-l-u;return"top-right"===X?{x:t.x+t.w-a-zt,y:t.y+zt,w:a,h:l}:"top-left"===X?{x:t.x+zt,y:t.y+zt,w:a,h:l}:{x:t.x+Math.max(zt,(o-a)/2+zt)+Math.min(c,Math.max(0,d)),y:t.y+u+Math.min(c,Math.max(0,m)),w:a,h:l}},[h]),pn=F(!1);t||(pn.current=!1);const wn=ue||d||null;q(()=>{if(!t)return;Jn(Kt,wn,bt.current??void 0),ue||er(Kt),dn.current=!1,Rt(Cr(Kt));const e=()=>{Rt(Cr(Kt))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===ue;if(!e.label)return!1;const t=ot.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if(er(Kt),Pn.current)return;const t=ir(),n=Math.min(Un.current.w,t.w-40),o=Math.min(Un.current.h,t.h-40),i=t.x+(t.w-n)/2,a=t.y+(t.h-o)/2;bn({x:i,y:a,w:n,h:o}),Hn(!1)},i=e=>{const t=e.detail;r(t)&&(er(Kt),qe({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==ue)return;er(Kt);const t=Un.current,n=function(e,t=ir()){const n=Math.min(e.w,t.w),r=Math.min(e.h,t.h);return{w:n,h:r,x:Math.min(Math.max(e.x,t.x),t.x+t.w-n),y:Math.min(Math.max(e.y,t.y),t.y+t.h-r)}}(t);if(n.x===t.x&&n.y===t.y&&n.w===t.w&&n.h===t.h)return;const r=ot.current,o="function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(r&&!o){let e=!1;const t=()=>{e||(e=!0,r.style.transition="",window.dispatchEvent(new CustomEvent("modal-geometry")))};r.style.transition="left .28s ease, top .28s ease, width .28s ease, height .28s ease",r.addEventListener("transitionend",t,{once:!0}),window.setTimeout(t,400)}bn(n)};return window.addEventListener("modal-reorder",e),window.addEventListener("modal-split-view",n),window.addEventListener("modal-center",o),window.addEventListener("modal-reveal",a),window.addEventListener("modal-context-menu",i),()=>{!function(e){const t=zn.indexOf(e);-1!==t&&(zn.splice(t,1),Rn()),Dn.delete(e),In.delete(e),jn.delete(e);const n=$n.get(e);n&&($n.delete(e),On.delete(n))}(Kt),window.removeEventListener("modal-reorder",e),window.removeEventListener("modal-split-view",n),window.removeEventListener("modal-center",o),window.removeEventListener("modal-reveal",a),window.removeEventListener("modal-context-menu",i),window.dispatchEvent(new CustomEvent("modal-reorder"))}},[t,Kt,wn,hn]);const gn=!V&&"maximized"===Ln(),[vn,bn]=B(()=>{if(wn&&fn[wn]){const e={...fn[wn]};return ce&&(e.w=ce[0],ie||(e.h=ce[1])),ur(e)}return C?{x:C.x,y:C.y,w:C.w,h:C.h}:gn?hn():mn()}),[xn,kn]=B(()=>!ie),En=F(pe),Cn=F(null);q(()=>{const e=()=>{const e=r();e!==En.current&&Cn.current?.(e),En.current=e,fe(e),Rt(Cr(Kt))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[Kt]);const Mn=pe&&!!He?.tab&&!vt&&!V&&!we,An=Mn,Pn=F(An);Pn.current=An;const Kn=qn(),Wn=pe&&!!He?.tab&&!V&&!we&&!Ht&&Kn!==He.key,Fn=!!V&&pe&&!Ht&&null!==Kn,[Bn,Hn]=B(()=>wn&&fn[wn]||C?An:An||gn),Un=F(vn);Un.current=vn;const Yn=F(Bn);j(()=>{Yn.current=Bn},[Bn]),j(()=>{if(xn||Mn)return;const e=ot.current,t=at.current;if(!e||!t)return;const n=ae??(V?0:240),r=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0;let o=0,i=null,a=null;const s=()=>{const c=t.firstElementChild;if(!c||e.offsetHeight<=0)return;c!==a&&(a&&l.unobserve(a),l.observe(c),a=c);const u=e.offsetHeight-t.offsetHeight,d=t.style.flex,h=t.style.overflowY,m=t.style.height;t.style.flex="0 0 auto",t.style.height="auto",t.style.overflowY="visible";const p=t.offsetHeight,f=c.offsetHeight;t.style.flex=d,t.style.height=m,t.style.overflowY=h;const w=c.offsetHeight>f+4,y=Math.max(n,window.innerHeight-r-Math.max(0,Un.current.y)-24),g=w?Math.min(Un.current.h,y):Math.min(Math.max(n,u+p),y),v=Math.abs(g-o)>1;v&&(o=g,bn(e=>Math.abs(e.h-g)>1?{...e,h:g}:e)),V||(g<=n?i&&(clearTimeout(i),i=null):(v||null===i)&&(i&&clearTimeout(i),i=setTimeout(()=>{const e=o;s(),o===e&&kn(!0)},160)))},l=new ResizeObserver(s);s(),dt.current&&l.observe(dt.current);const c=new MutationObserver(s);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{l.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[xn,V,ae,yt,Mn]),j(()=>{if(!ie||!xn||V||!t)return;const e=dt.current;if(!e)return;let n=e.offsetHeight;const r=new ResizeObserver(()=>{if(!e.isConnected)return;const t=e.offsetHeight,r=t-n,o=t>0!=n>0;if(n=t,!o||0===r||Bn)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=ae??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,s=Math.max(i,window.innerHeight-a-Math.max(0,Un.current.y)-24);bn(e=>({...e,h:Math.min(Math.max(i,e.h+r),s)}))});return r.observe(e),()=>r.disconnect()},[ie,xn,V,t,Bn,ae]);const Vn=!1!==se&&!V&&!Q&&!we,[_n,Gn]=B(()=>!Vn);j(()=>{if(_n||!t)return;if(!Vn||Bn)return void Gn(!0);const n=ot.current,r=at.current;if(!n||!r)return;const o=/* @__PURE__ */new WeakSet;let i=Un.current.w,c=0;const u=()=>Gn(!0),d=()=>{c=0;const t=Un.current;if(Math.abs(t.w-i)>1||document.body.classList.contains("rosh-gesturing"))return void u();const d=e(),h=d.w-80;if(t.w>=h)return void u();const m=[],p=[];for(const e of[r,...Array.from(r.querySelectorAll("*"))]){const t=e.scrollWidth-e.clientWidth;if(t<=4||o.has(e))continue;const n=getComputedStyle(e).overflowX;"auto"!==n&&"scroll"!==n||(m.push(e),p.push(t))}if(!m.length)return;const f=Math.min(h,t.w+Math.max(...p)),w=f-t.w,y=n.style.width;n.style.width=`${f}px`;const g=m.map((e,t)=>({over:p[t],residual:e.scrollWidth-e.clientWidth}));n.style.width=y,g.forEach((e,t)=>{a(e,w)||o.add(m[t])});const v=s(t,l(t.w,w,g),d,zt);v!==t&&(i=v.w,bn(v))};d();const h=new MutationObserver(()=>{c||(c=requestAnimationFrame(d))});h.observe(r,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["style","class","hidden"]});const m=setTimeout(u,Sn);return()=>{h.disconnect(),c&&cancelAnimationFrame(c),clearTimeout(m)}},[_n,t,Vn,Bn]);const Zn=F(null),Qn=!(!He?.tab||vt||V||we);Cn.current=t=>{if(!Qn)return;if(t)return Zn.current||(Zn.current={box:{...Un.current},maximized:Yn.current}),void(Yn.current=!0);const r=Zn.current;Zn.current=null;const o=e();if(r?.maximized)return Yn.current=!0,Hn(!0),void bn(o);const i=r?.box??(wn?fn[wn]:void 0);if(Yn.current=!1,Hn(!1),i&&!n(i,o,!1)){const e={...i};ce&&(e.w=ce[0],ie||(e.h=ce[1])),bn(ur(e))}else bn(mn())},q(()=>{An&&(Yn.current=!0,Hn(!0),bn(hn()))},[An,hn]),q(()=>{if(V)return;const e=()=>{const e=wn?fn[wn]:void 0;if(Yn.current=!1,Hn(!1),e){const t={...e};ce&&(t.w=ce[0],ie||(t.h=ce[1])),bn(ur(t))}else bn(mn())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[V,mn,wn]),q(()=>{t&&wn&&!Mn&&(fn[wn]=vn,yn()),t&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[vn,t,wn,Mn]),q(()=>{if(!t)return;const e=()=>{Yn.current?bn(hn()):document.body.classList.contains("rosh-gesturing")||bn(ur)};window.addEventListener("resize",e),window.addEventListener(o,e);let n=null;return Bn&&(n=new MutationObserver(e),n.observe(document.body,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["class"]})),()=>{window.removeEventListener("resize",e),window.removeEventListener(o,e),n?.disconnect()}},[t,Bn,hn]),q(()=>{if(t&&(Re(!1),Oe.current=!1,rt.current=!1,Gn(!Vn),!Pn.current)){if(wn&&fn[wn]){const e=fn[wn];return void bn(t=>ur({...e,...ie?{h:t.h}:{},...Vn?{x:t.x,w:t.w}:{}}))}C&&(bn({x:C.x,y:C.y,w:C.w,h:C.h}),Hn(C.maximized))}},[t]),q(()=>{if(!t||"auto"!==m)return;let e;const n=t=>{ot.current?.contains(t.target)&&!Oe.current&&(Oe.current=!0,e=setTimeout(()=>Re(!0),0))};return document.addEventListener("input",n,!0),document.addEventListener("change",n,!0),()=>{clearTimeout(e),document.removeEventListener("input",n,!0),document.removeEventListener("change",n,!0)}},[t,m]);const ar="auto"===m?We:!0===m,sr=He&&!vt?He.key:null,dr=G(()=>jt(Te),[Te]),mr=F({shortcutSpec:Be,isOnDesktop:Ge,toggleDesktopShortcut:Ze,taskbarStrings:De.taskbar});j(()=>{mr.current={shortcutSpec:Be,isOnDesktop:Ge,toggleDesktopShortcut:Ze,taskbarStrings:De.taskbar}});const wr=F(null);wr.current||(wr.current={open:(e,t)=>qe({x:e,y:t}),items:()=>{const e=mr.current,t=[];e.shortcutSpec&&t.push({label:e.isOnDesktop?e.taskbarStrings.removeFromDesktop:e.taskbarStrings.addToDesktop,onSelect:e.toggleDesktopShortcut});for(const e of on[Kt]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),q(()=>{if(t&&sr)return()=>{return e=sr,void(qt.delete(e)&&Ut());var e}},[t,sr]),_e(!(ue||!t)&&ar);const yr=U(()=>ar||"auto"===m&&Oe.current,[ar,m]),gr=U(async e=>{if(rt.current)return!1;if(!yr())return!0;rt.current=!0;const t=Ie,n="close"===e?"Are you sure you want to close?":"discard"===e?"Are you sure you want to stop editing?":"Are you sure you want to continue?",r=await y({title:"Discard changes?",message:t?`“${t}” has unsaved changes. ${n} All changes will be lost.`:`You have unsaved changes. ${n} All changes will be lost.`,confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"});return rt.current=!1,r},[yr,Ie]),br=U(()=>rt.current?Promise.resolve():yr()?gr("close").then(e=>{e&&i()}):(i(),Promise.resolve()),[yr,gr,i]),Lr=U(async()=>{await gr("discard")&&(Oe.current=!1,Re(!1),$t.current?.onDiscard())},[gr]),Tr=U(async()=>{const e=await gr("switch");return e&&(Oe.current=!1,Re(!1)),e},[gr]),zr=F(()=>!1);j(()=>{zr.current=yr}),j(()=>{if(!t||!ue)return;const e={holdsChanges:()=>zr.current(),ask:Tr};return Xn.set(ue,e),()=>{Xn.get(ue)===e&&Xn.delete(ue)}},[t,ue,Tr]),j(()=>{if(!t||!xt)return;const e=e=>{e.detail?.windowKey===xt&&br()};return window.addEventListener(Sr,e),()=>window.removeEventListener(Sr,e)},[t,xt,br]);const Ir=F(null),Kr=U(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(qe(null),er(Kt),Pn.current)return void e.preventDefault();e.preventDefault();const t=e.currentTarget,n=e.pointerId;let r=null;const o=e.clientX,i=e.clientY,a=ot.current,s=a?.getBoundingClientRect();let l,c,u,d;if(Ir.current){const t=Ir.current;Ir.current=null,d=t.w,u=t.h;const n=s?Math.min(Math.max(20,e.clientX-s.left),t.w-20):t.w/2;l=e.clientX-n,c=e.clientY-12,a&&(a.style.width=`${d}px`,a.style.height=`${u}px`,a.style.left=`${l}px`,a.style.top=`${c}px`)}else l=s?s.left:Un.current.x,c=s?s.top:Un.current.y,u=s?s.height:Un.current.h,d=s?s.width:Un.current.w;Hn(!1),bn(e=>({...e,x:l,y:c,w:d,h:u}));let h=null;const m=e=>{if(!r){if(Math.abs(e.clientX-o)<kr&&Math.abs(e.clientY-i)<kr)return;r=Er(t,n,"move","move"),a&&(a.style.transition="none")}const s=l+e.clientX-o,u=Math.max(0,c+e.clientY-i);if(a&&(a.style.transform=`translate(${s-l}px, ${u-c}px)`),Un.current={...Un.current,x:s,y:u},!V){const t=function(e,t){const n=ir(),r=e<=n.x+rr,o=e>=n.x+n.w-rr,i=t<=n.y+rr,a=t>=n.y+n.h-rr,s=e<=n.x+or,l=e>=n.x+n.w-or,c=t<=n.y+or,u=t>=n.y+n.h-or;return i&&s?"tl":i&&l?"tr":a&&s?"bl":a&&l?"br":c&&r?"tl":c&&o?"tr":u&&r?"bl":u&&o?"br":i?"top":r?"left":o?"right":null}(e.clientX,e.clientY);t!==h&&(h=t,t?pr(hr(t)):fr())}},p=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",p),r?.(),fr();const e=ur({...Un.current});if(Un.current=e,!V&&h){Ir.current={x:l,y:c,w:d,h:u};const e=hr(h);return a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.width=`${e.w}px`,a.style.height=`${e.h}px`,a.style.transform="",a.style.transition=""),void bn(e)}if(V){const t=e.x+e.w/2,n=window.innerWidth/2;nt(t>n?"right":"left")}a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.transform="",a.style.transition=""),bn(e)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",p)},[]),Rr=U((e,t)=>{if(0!==e.button)return;e.preventDefault(),e.stopPropagation();const n=e.currentTarget,r=e.pointerId;let o=null;const i=e.clientX,a=e.clientY,s=ot.current,l=s?.getBoundingClientRect(),c=l?l.left:Un.current.x,u=l?l.top:Un.current.y,d=l?l.width:Un.current.w,h=l?l.height:Un.current.h,m="sw"===t||"nw"===t||"w"===t,p="ne"===t||"nw"===t||"n"===t,f="se"===t||"ne"===t||"e"===t,w="se"===t||"sw"===t||"s"===t;Hn(!1),bn({x:c,y:u,w:d,h:h}),Un.current={x:c,y:u,w:d,h:h};let y=0,g=null;const v=()=>{if(y=0,!g)return;const e=g;g=null,Un.current=e,s&&(s.style.left=`${e.x}px`,s.style.top=`${e.y}px`,s.style.width=`${e.w}px`,s.style.height=`${e.h}px`)},b=e=>{if(!o){if(Math.abs(e.clientX-i)<kr&&Math.abs(e.clientY-a)<kr)return;o=Er(n,r,xr[t],"resize")}g=((e,t)=>{let n=c,r=u,o=d,i=h;if(f&&(o=Math.max(lr,d+e)),w&&(i=Math.max(cr,h+t)),m){const t=Math.max(lr,d-e);n=c+d-t,o=t}if(p){const e=Math.max(cr,h-t);r=u+h-e,i=e}return{x:n,y:r,w:o,h:i}})(e.clientX-i,e.clientY-a),y||(y=requestAnimationFrame(v))},x=()=>{window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",x),y&&cancelAnimationFrame(y),v(),o?.(),bn({...Un.current})};window.addEventListener("pointermove",b),window.addEventListener("pointerup",x)},[]),Fr=U(e=>{if(e.target.closest("button, input, a, kbd, select, textarea"))return;const t={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[e.key];if(!t&&"Enter"!==e.key)return;if(e.preventDefault(),e.stopPropagation(),er(Kt),"Enter"===e.key)return void(Bn?(Hn(!1),bn(mn())):(Hn(!0),bn(hn())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{Ir.current||(Ir.current={...Un.current})};if(r<0)return e(),Hn(!0),void bn(hn());if(r>0){if(Bn)return Hn(!1),void bn(mn());if(Ir.current){const e=ur(Ir.current);return Ir.current=null,Un.current=e,void bn(e)}return void tr(Kt)}e(),Hn(!1);const t=hr(n<0?"left":"right");return Un.current=t,void bn(t)}if(Bn)return;const o=Un.current,i=e.shiftKey?{...o,w:Math.max(lr,o.w+24*n),h:Math.max(cr,o.h+24*r)}:ur({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});Un.current=i,bn(i)},[Kt,Bn,mn,hn]),qr=U(e=>{Ir.current||(Ir.current={...Un.current}),Hn(!1);const t=hr(e);Un.current=t,bn(t),er(Kt)},[Kt]),Ur=An||Jt?{}:{tabIndex:0,role:"group","aria-label":Ie?`${Ie} — ${Pe.windowSuffix}`:Pe.windowSuffix,"aria-keyshortcuts":"ArrowUp ArrowDown ArrowLeft ArrowRight Shift+ArrowUp Shift+ArrowDown Shift+ArrowLeft Shift+ArrowRight Control+ArrowUp Control+ArrowDown Control+ArrowLeft Control+ArrowRight Enter",onKeyDown:Fr},Yr=()=>{Hn(!0),bn(hn())},Xr=U(()=>{const e=ot.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(Qt);t&&!t.disabled&&t.click()}},[]);q(()=>{if(!t)return;if(V)return;const e=e=>{if(zn[zn.length-1]===Kt&&!v(e.target,ot.current)&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),Xr();else{if("INPUT"===t.tagName&&t.closest("form"))return;if(!(t instanceof Element&&ot.current?.contains(t)))return;if(t.closest(en))return;e.preventDefault()}}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Xr,Kt,V]),q(()=>{if(!t)return;const e=e=>{zn[zn.length-1]===Kt&&(v(e.target,ot.current)||((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:Kt}})),Oe.current=!1,Re(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:Kt}})))))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]),q(()=>{if(!t)return;if(V)return;const e=e=>{if("Escape"===e.key&&zn[zn.length-1]===Kt){if(K(e))return e.preventDefault(),void e.stopPropagation();if(Mn&&!P)return;e.preventDefault(),e.stopPropagation(),br()}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,br,Kt,V,Mn,P]);const Vr=t&&(void 0!==p||void 0!==f),[_r]=B(()=>{if("undefined"==typeof document)return null;const e=document.createElement("span");return e.className="flex shrink-0 items-center gap-2",e.setAttribute("data-tab-actions",""),e}),Gr=Mn&&!He?.home&&dr.actions.length>0;q(()=>{t&&sr&&function(e,t){const n=qt.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.actions===t.actions&&n.menu===t.menu||(qt.set(e,t),Ut())}(sr,{title:dr.text||Ie,dirty:ar,copy:dr.copy,actions:Gr&&_r?_r:void 0,menu:wr.current??void 0})},[t,sr,Ie,ar,dr.text,dr.copy,Gr,_r]);const Jr=U(e=>{const t=document.getElementById("nav-boundary-toast");t&&t.remove();const n="bottom"===e?["That's the last one, chief.","You've hit rock bottom... of the list.","End of the line, buddy.","Nothing left. Go outside.","Congratulations, you scrolled to the void.","There's no more. I checked.","You've reached the edge of the known universe.","Plot twist: there is no next one.","Even scrolling has limits. Unlike your ambition.","Last one. Time to touch grass."]:["Already at the top. Overachiever.","There is no item above this. Trust me.","You're #1. Literally.","Can't go higher. You've peaked.","This is it. The summit. The top.","First item. No VIP lounge above this.","Going up? Nope. Elevator's broken.","You want negative indexes? Bold.","Top of the list. Top of the world.","The only way is down from here."],r=n[Math.floor(Math.random()*n.length)],o=document.createElement("div");o.id="nav-boundary-toast",o.className="fixed bottom-6 left-1/2 -translate-x-1/2 z-(--z-toast) bg-gray-900 text-on-accent flex min-h-10 items-center px-5 py-3 rounded-lg shadow-lg text-sm font-medium transition-opacity duration-300",o.textContent=r,document.body.appendChild(o),setTimeout(()=>{o.style.opacity="0",setTimeout(()=>o.remove(),300)},2e3)},[]);if(q(()=>{if(!t)return;const e=e=>{if(zn[zn.length-1]!==Kt)return;if(v(e.target,ot.current))return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&Vr&&(e.preventDefault(),p?p():Jr("bottom")),"k"===e.key&&Vr&&(e.preventDefault(),f?f():Jr("top"))))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,p,f,Vr,Jr,Kt]),!t||pn.current)return null;const Zr=Jt?function(e){if("undefined"==typeof document)return null;const t=Array.from(document.querySelectorAll("[data-modal-panel]")).filter(e=>{const t=e;return!t.hasAttribute("data-utility")&&!t.hasAttribute("data-widget")&&"none"!==t.style.display});t.sort((e,t)=>(e.getAttribute("data-modal-id")||"").localeCompare(t.getAttribute("data-modal-id")||""));const n=t.findIndex(t=>t.getAttribute("data-modal-id")===e),r=t.length;if(n<0||r<1)return null;const o=Math.ceil(Math.sqrt(r)),i=Math.ceil(r/o),a=Math.floor(n/o),s=n%o,l=r-o*(i-1),c=a===i-1&&l<o,u=ir(),d=(u.w-20*(o+1))/o,h=(u.h-14*(i+1)-22*i)/i,m=c?(o-l)*(d+20)/2:0;return{x:u.x+20+s*(d+20)+m,y:u.y+14+a*(h+14+22),w:d,h:h}}(Kt):null,Qr=Jt&&Zr?Math.min(Zr.w/vn.w,Zr.h/vn.h):1,eo=(()=>{if(Jt&&Zr){const e=Qr,t=vn.w*e,n=vn.h*e,r=Zr.x+(Zr.w-t)/2-vn.x,o=Zr.y+(Zr.h-n)/2-vn.y,i=Zt||rn;return{transform:`translate(${r}px, ${o}px) scale(${e})`,transformOrigin:"top left",transition:"transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 280ms",cursor:"pointer",zIndex:I.expose+(i?20:10),boxShadow:i?"0 24px 72px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.55), 0 0 36px 12px rgba(96,165,250,0.85), 0 0 96px 28px rgba(96,165,250,0.55)":"0 16px 48px rgba(0,0,0,0.55)",pointerEvents:"auto"}}if(an&&Vt){const e="picked"===ln;return{transition:e?"transform 640ms cubic-bezier(0.34, 1.42, 0.64, 1), box-shadow 600ms":"transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 600ms",...e?{zIndex:I.expose+30}:{}}}return null})(),to=b({modal:!1,titleId:!V&&(Mn?!He?.home:!we)?Ke:void 0,label:dr.text||Ie}),no=/* @__PURE__ */ee("div",{children:[
50
- /* @__PURE__ */ee("div",{ref:ot,"data-modal-panel":!0,"data-modal-id":Kt,"data-window-key":ue||void 0,...$?{"data-utility":""}:{},...$e?{"data-pinned-top":""}:{},...V?{"data-widget":""}:{},...He?{"data-window-owner":He.key}:{},...He&&!vt?{"data-window-root":""}:{},...Mn?{"data-window-tab":""}:{},...to,className:Mn?"fixed flex flex-col overflow-hidden":"fixed rounded-(--radius-window) flex flex-col overflow-hidden "+(V?Ot?"shadow-xl":"shadow-lg":"border "+(Ot?"shadow-xl border-line":"shadow-lg border-line-strong")),onMouseDownCapture:e=>{if(it.current=!1,Jt){if(e.target.closest("[data-expose-close]"))return;return e.preventDefault(),e.stopPropagation(),jr(Kt),Pr(!1),void er(Kt)}if(!Ot&&!V&&!$e&&0===e.button){const t=e.target;t.closest("[data-modal-panel]")===ot.current&&t.closest("button, input, a, select, textarea")&&!t.closest("[data-window-chrome]")&&(e.preventDefault(),e.stopPropagation(),it.current=!0,qe(null),er(Kt),window.addEventListener("mouseup",()=>{setTimeout(()=>{it.current=!1},0)},{once:!0}))}},onClickCapture:e=>{it.current&&(it.current=!1,e.preventDefault(),e.stopPropagation())},onMouseDown:e=>{if(Jt)return;qe(null);e.target.closest("[data-modal-panel]")===ot.current&&(e.target.closest("button, input, a, select, textarea")||er(Kt))},style:we?{zIndex:Wt+1,top:0,left:0,right:0,bottom:"var(--mobile-bottom-nav, 56px)",width:"auto",height:"auto",transform:`translateX(${ve}px)`,transition:xe?"none":"transform 180ms ease-out",...V?{display:"none"}:{},...Wt<0?{display:"none"}:{},...Ot||$e||Ne&&ue===Ne?{}:{display:"none"}}:{zIndex:$e?I.pinnedWindow:Wt+1,width:vn.w,height:vn.h,top:vn.y,...V&&"right"===tt?{right:window.innerWidth-vn.x-vn.w}:{left:vn.x},...Wt<0&&!$e?{display:"none"}:{},...ge?{display:"none"}:{},...Wn||Fn?{visibility:"hidden",pointerEvents:"none"}:{},...eo??{}},children:[we&&!V&&/* @__PURE__ */te("div",{onPointerDown:Me,className:"absolute top-0 bottom-0 left-0 w-[22px] z-[5]",style:{touchAction:"pan-y"},"aria-hidden":"true"}),V?null:Mn?He?.home?null:/* @__PURE__ */ee(ne,{children:[
51
- /* @__PURE__ */te("h2",{id:Ke,"data-window-title":!0,className:"sr-only",children:dr.text||Ie}),Gr&&_r&&re(
52
- /* @__PURE__ */te(ne,{children:dr.actions}),_r),dr.badges.length>0&&/* @__PURE__ */te("div",{"data-window-chrome":"","data-record-bar":"",className:"flex h-9 shrink-0 select-none items-center gap-2 overflow-hidden border-b border-gray-200 px-4",style:{backgroundColor:"rgb(var(--window-content-rgb))"},children:dr.badges})]}):we?null:
53
- /* @__PURE__ */ee("div",Z?{onPointerDown:Kr,"data-window-chrome":"",...Ur,className:"flex items-center justify-between h-(--row-height-compact-bar) px-3 border-b border-line shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(Ot?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:Ot?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
54
- /* @__PURE__ */ee("div",{"data-window-title":!0,title:Ie,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:Ot?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Jt&&Tt(),
55
- /* @__PURE__ */te("span",{id:Ke,className:"truncate",children:Jt?tn(Te):Te})]}),!Jt&&/* @__PURE__ */ee("div",{className:"flex items-center gap-2 shrink-0 ml-2",children:[$&&/* @__PURE__ */te("button",{onClick:()=>je(e=>!e),title:$e?Pe.unpin:Pe.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+($e?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */te(D,{name:"bookmark-square",className:"h-3 w-3",fill:$e?"currentColor":"none",strokeWidth:1.5})}),
56
- /* @__PURE__ */te("button",{type:"button",onClick:br,"aria-label":Pe.close,className:"rounded p-0.5 text-ink-faintest hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */te(D,{name:"close",className:"h-4 w-4"})})]})]}:Q?{onPointerDown:Kr,"data-window-chrome":"",...Ur,className:"flex items-center justify-between h-(--row-height-compact-bar) px-3 border-b border-line shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(Ot?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:Ot?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
57
- /* @__PURE__ */ee("div",{"data-window-title":!0,title:Ie,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:Ot?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Jt&&Tt(),
58
- /* @__PURE__ */te("span",{id:Ke,className:"truncate",children:Jt?tn(Te):Te})]}),!Jt&&/* @__PURE__ */ee("div",{className:"flex items-center gap-2 shrink-0 ml-2",children:[$&&/* @__PURE__ */te("button",{onClick:()=>je(e=>!e),title:$e?Pe.unpin:Pe.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+($e?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */te(D,{name:"bookmark-square",className:"h-3 w-3",fill:$e?"currentColor":"none",strokeWidth:1.5})}),
59
- /* @__PURE__ */te("button",{onClick:()=>tr(Kt),title:Pe.minimize,className:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",children:"─"}),!An&&/* @__PURE__ */te(vr,{maximized:Bn,onToggleMax:()=>{Bn?(Hn(!1),bn(mn())):Yr()},onSnap:qr,buttonClassName:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",strings:Pe}),
60
- /* @__PURE__ */te("button",{type:"button",onClick:br,"aria-label":Pe.close,className:"rounded p-0.5 text-ink-faintest hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */te(D,{name:"close",className:"h-4 w-4"})})]})]}:{onPointerDown:Kr,"data-window-chrome":"",...Ur,className:"flex items-center justify-between h-(--row-height-window-bar) px-3 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(Ot?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:Ot?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
61
- /* @__PURE__ */ee("div",{"data-window-title":!0,title:Ie,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:Ot?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Jt&&Tt(),
62
- /* @__PURE__ */te("span",{id:Ke,className:"truncate",children:Jt?tn(Te):Te})]}),!Jt&&/* @__PURE__ */ee("div",{className:"flex items-center gap-3 shrink-0 ml-4",children:[$&&/* @__PURE__ */te("button",{onClick:()=>je(e=>!e),title:$e?Pe.unpin:Pe.pinOnTop,className:"text-xs px-2 py-1 rounded hover:bg-gray-200 "+($e?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */te(D,{name:"bookmark-square",className:"h-3.5 w-3.5",fill:$e?"currentColor":"none",strokeWidth:1.5})}),
63
- /* @__PURE__ */te("button",{onClick:()=>tr(Kt),title:Pe.minimize,className:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",children:"─"}),!An&&/* @__PURE__ */te(vr,{maximized:Bn,onToggleMax:()=>{Bn?(Hn(!1),bn(mn())):Yr()},onSnap:qr,buttonClassName:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",strings:Pe}),
64
- /* @__PURE__ */te("button",{type:"button",onClick:br,"aria-label":Pe.close,className:"rounded-(--radius-control) text-ink-faintest hover:text-gray-600",children:/* @__PURE__ */te(D,{name:"close",className:"h-5 w-5"})})]})]}),he&&Xe&&!V&&!we&&/* @__PURE__ */te("div",{"aria-hidden":"true",className:"h-[3px] shrink-0 pointer-events-none",style:{backgroundColor:`rgb(var(--window-accent-rgb) / ${Ot?.9:.55})`}}),
65
- /* @__PURE__ */te(_t.Provider,{value:Kt,children:/* @__PURE__ */te(cn.Provider,{value:{rightRef:st,leftRef:lt,notify:()=>ut(!0),active:Ot,isDirty:ar,footerOpen:yt&&!V&&!Z&&!Q&&!we},children:/* @__PURE__ */te("div",{ref:at,...V?{onPointerDown:Kr,onContextMenu:e=>{e.preventDefault(),et({x:e.clientX,y:e.clientY})}}:{},className:`flex-1 min-h-0 flex flex-col ${V?"p-0 cursor-move":Q||oe?"p-0":Z?"p-2":"p-4"} ${V||Mn?"":"backdrop-blur-sm"} ${!1===g||Q||oe?"overflow-hidden":"overflow-y-auto overscroll-contain"} ${V?"rounded-2xl select-none":""}`,style:{...V?{touchAction:"none"}:{},backgroundColor:V?"transparent":Mn?"rgb(var(--window-content-rgb))":Ot?"rgb(var(--window-content-rgb) / var(--active-content-opacity, 0.9))":"rgb(var(--window-content-rgb) / var(--inactive-content-opacity, 0.8))"},children:/* @__PURE__ */te(Se,{children:me})})})}),V&&Qe&&/* @__PURE__ */ee(N,{minWidth:160,style:{left:Qe.x,top:Qe.y},onClose:()=>et(null),children:[
66
- /* @__PURE__ */te(S,{onClick:()=>{et(null),window.dispatchEvent(new CustomEvent("widget-open-settings",{detail:Kt}))},children:"Settings"}),
67
- /* @__PURE__ */te(L,{}),le&&/* @__PURE__ */ee(ne,{children:[le,
68
- /* @__PURE__ */te(L,{})]}),
69
- /* @__PURE__ */ee(S,{onClick:()=>{et(null),je(e=>!e)},children:[
70
- /* @__PURE__ */te("span",{className:"flex-1",children:"Always on Top"}),$e&&/* @__PURE__ */te(D,{name:"check",className:"h-4 w-4 text-blue-600 shrink-0",strokeWidth:2})]}),
71
- /* @__PURE__ */te(L,{}),
72
- /* @__PURE__ */te(S,{onClick:()=>{et(null),br()},children:"Close"})]}),
73
- /* @__PURE__ */ee("div",{onPointerDown:Kr,ref:dt,"data-modal-footer":"",className:`px-4 py-2 border-t border-gray-200 shrink-0 flex items-center justify-between text-xs select-none${Mn?"":" cursor-move"}${Ot&&!Mn?" backdrop-blur-sm":""}${V||Z||Q||we||!yt?" hidden":""}`,style:{touchAction:"none",backgroundColor:Mn?"rgb(var(--window-footer-rgb))":Ot?"rgb(var(--window-footer-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-footer-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
74
- /* @__PURE__ */ee("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[kt&&/* @__PURE__ */te(ze,{auto:!0}),z,
75
- /* @__PURE__ */te("div",{ref:lt,"data-modal-actions-left":!0,className:"flex items-center gap-2 shrink-0"}),null!=w&&!1!==w&&
76
- /* @__PURE__ */te("div",{ref:ht,"data-modal-footer-facts":"",className:"min-w-0 flex-1 overflow-hidden",children:/* @__PURE__ */te("div",{ref:mt,className:"inline-flex items-center gap-2 whitespace-nowrap"+(pt?" invisible":""),children:w})})]}),
77
- /* @__PURE__ */ee("div",{"data-modal-footer-right":"",className:"flex items-center gap-2 ml-auto shrink-0",children:[wt&&R&&(R.editing?/* @__PURE__ */te(A,{variant:"secondary",size:"sm","data-modal-discard":"",onClick:()=>{Lr()},children:Pe.discard}):"object"==typeof R.state?/* @__PURE__ */te(A,{variant:"secondary",size:"sm","data-modal-edit":"","aria-disabled":!0,disabledReason:R.state.disabledReason,children:Pe.edit}):/* @__PURE__ */te(A,{variant:"secondary",size:"sm","data-modal-edit":"",onClick:()=>R.onEdit(),children:Pe.edit})),
78
- /* @__PURE__ */te("div",{ref:st,"data-modal-actions":!0,className:"flex items-center gap-2"}),T]})]}),!V&&!we&&!Jt&&Ot&&!An&&/* @__PURE__ */ee(ne,{children:[
79
- /* @__PURE__ */te("div",{onPointerDown:e=>Rr(e,"se"),className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize z-10"}),
80
- /* @__PURE__ */te("div",{onPointerDown:e=>Rr(e,"sw"),className:"absolute bottom-0 left-0 w-3 h-3 cursor-nesw-resize z-10"}),
81
- /* @__PURE__ */te("div",{onPointerDown:e=>Rr(e,"ne"),className:"absolute top-0 right-0 w-3 h-3 cursor-nesw-resize z-10"}),
82
- /* @__PURE__ */te("div",{onPointerDown:e=>Rr(e,"nw"),className:"absolute top-0 left-0 w-3 h-3 cursor-nwse-resize z-10"}),
83
- /* @__PURE__ */te("div",{onPointerDown:e=>Rr(e,"n"),className:"absolute top-0 left-3 right-3 h-1 cursor-ns-resize"}),
84
- /* @__PURE__ */te("div",{onPointerDown:e=>Rr(e,"s"),className:"absolute bottom-0 left-3 right-3 h-1 cursor-ns-resize"}),
85
- /* @__PURE__ */te("div",{onPointerDown:e=>Rr(e,"e"),className:"absolute top-3 bottom-3 right-0 w-1 cursor-ew-resize"}),
86
- /* @__PURE__ */te("div",{onPointerDown:e=>Rr(e,"w"),className:"absolute top-3 bottom-3 left-0 w-1 cursor-ew-resize"})]}),Jt&&/* @__PURE__ */te("div",{className:"absolute inset-0",style:{zIndex:I.hint,cursor:"pointer",background:"transparent"},onMouseEnter:()=>nn(!0),onMouseLeave:()=>nn(!1),onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),er(Kt),Pr(!1)},onClick:e=>{e.stopPropagation(),e.preventDefault()},children:Zt&&/* @__PURE__ */te("button",{type:"button","data-expose-close":!0,"aria-label":De.taskbar.closeWindow,title:"Close",className:"absolute flex items-center justify-center rounded-full bg-black/55 text-on-accent shadow-lg ring-1 ring-white/40 transition-colors hover:bg-red-500",style:{top:8,right:8,width:30,height:30,transform:`scale(${1/Qr})`,transformOrigin:"top right",zIndex:I.raised},onMouseDown:e=>{e.stopPropagation(),e.preventDefault()},onClick:e=>{e.stopPropagation(),e.preventDefault(),br()},children:/* @__PURE__ */te(D,{name:"close",className:"h-4 w-4",strokeWidth:2.2})})})]}),Jt&&Zr&&/* @__PURE__ */te("div",{className:"fixed pointer-events-none select-none truncate text-center",style:{left:Zr.x,top:Zr.y+Zr.h+4,width:Zr.w,zIndex:I.expose+(Zt?21:11),color:"white",fontSize:"var(--text-xs)",fontWeight:500,textShadow:"0 1px 2px rgba(0,0,0,0.6)"},children:tn(Te)})]}),ro=Fe&&/* @__PURE__ */ee(N,{style:{left:Fe.x,top:Fe.y},onClose:()=>qe(null),minWidth:160,children:[!V&&!Z&&!Mn&&/* @__PURE__ */ee(ne,{children:[
87
- /* @__PURE__ */ee(S,{onClick:()=>{tr(Kt),qe(null)},children:[
88
- /* @__PURE__ */te(D,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),Pe.minimize]}),!An&&/* @__PURE__ */ee(S,Bn?{onClick:()=>{Hn(!1),bn(mn()),qe(null)},children:[
89
- /* @__PURE__ */te("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */te("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 4.5v15m6-15v15M4.5 9h15M4.5 15h15"})}),Pe.windowed]}:{onClick:()=>{Yr(),qe(null)},children:[
90
- /* @__PURE__ */te(D,{name:"expand",className:"h-4 w-4",strokeWidth:1.5}),Pe.maximize]})]}),$&&!Mn&&/* @__PURE__ */ee(S,{onClick:()=>{je(e=>!e),qe(null)},children:[
91
- /* @__PURE__ */te(D,{name:"bookmark-square",className:"h-4 w-4 "+($e?"text-blue-600":""),fill:$e?"currentColor":"none",strokeWidth:1.5}),$e?Pe.unpin:Pe.pinOnTop]}),Be&&/* @__PURE__ */ee(S,{onClick:()=>{qe(null),Ze()},children:[
92
- /* @__PURE__ */te(D,{name:"star",className:"h-4 w-4",fill:Ge?"currentColor":"none",strokeWidth:1.5}),Ge?De.taskbar.removeFromDesktop:De.taskbar.addToDesktop]}),(on[Kt]||[]).length>0&&/* @__PURE__ */te(ne,{children:(on[Kt]||[]).map((e,t)=>/* @__PURE__ */ee(S,{onClick:()=>{qe(null),e.onClick()},children:[e.icon,e.label]},t))}),!(Mn&&He?.home)&&/* @__PURE__ */ee(ne,{children:[
93
- /* @__PURE__ */te(L,{}),
94
- /* @__PURE__ */ee(S,{danger:!0,onClick:()=>{qe(null),br()},children:[
95
- /* @__PURE__ */te(D,{name:"close",className:"h-4 w-4"}),Pe.close]})]})]}),oo=!!ue&&It.some(e=>e.id===ue),io=!Bt||oo||V?null:/* @__PURE__ */ee("div",{"data-modal-restore-tab":!0,"data-modal-id":Kt,className:"fixed left-1/2 z-(--z-restore-tab) flex -translate-x-1/2 items-center gap-1 rounded-lg border border-line-strong bg-surface px-2 py-1 shadow-lg",style:{bottom:"calc(var(--taskbar-height, 0px) + 12px)"},children:[
96
- /* @__PURE__ */te("button",{type:"button",onClick:()=>er(Kt),title:Pe.restore,className:"max-w-[16rem] truncate rounded px-2 py-0.5 text-sm font-medium text-gray-700 hover:bg-gray-100 hover:text-gray-900",children:Ie||Pe.windowSuffix}),
97
- /* @__PURE__ */te("button",{type:"button",onClick:()=>er(Kt),title:Pe.restore,"aria-label":Pe.restore,className:"rounded px-2 py-0.5 text-xs leading-none text-ink-faintest hover:bg-gray-100 hover:text-gray-600",children:"▴"}),
98
- /* @__PURE__ */te("button",{type:"button",onClick:()=>{br()},title:Pe.close,"aria-label":Pe.close,className:"rounded px-2 py-0.5 text-xs leading-none text-ink-faintest hover:bg-gray-100 hover:text-gray-600",children:"✕"})]});return re(
99
- /* @__PURE__ */ee(Gt.Provider,{value:null,children:[no,ro,io]}),document.body)}"undefined"!=typeof window&&window.addEventListener("keydown",e=>{Tr&&"Escape"===e.key&&(Ur(null),Pr(!1))});var Gr=100,Jr={past:[],future:[]};function Zr(e,t){switch(t.type){case"record":{const n=e.past[e.past.length-1];if(null!==t.step.coalesceKey&&n?.coalesceKey===t.step.coalesceKey)return 0===e.future.length?e:{...e,future:[]};const r=[...e.past,t.step];return{past:r.length>Gr?r.slice(r.length-Gr):r,future:[]}}case"undo":return 0===e.past.length?e:{past:e.past.slice(0,-1),future:[t.redoStep,...e.future]};case"redo":return 0===e.future.length?e:{past:[...e.past,t.undoStep],future:e.future.slice(1)};case"clear":return 0===e.past.length&&0===e.future.length?e:Jr}}var Qr=/* @__PURE__ */new Set(["INPUT","TEXTAREA","SELECT"]);var eo=500,to=250;function no({children:e,canEdit:t=!0,perms:n,windowId:r}){const[o,a]=Z(Zr,Jr),s=F(/* @__PURE__ */new Map),[l,c]=B(0),u=l>0,[d,h]=B(0),[m,p]=B(0),f=m>0,{hasAnyPerm:w}=i(),y=t&&0===d&&(!(n&&n.length>0)||w(n)),g=F(null),v=F(!1),b=U(()=>{const e={};for(const[t,n]of s.current)e[t]=n.getLast();return e},[]),x=U((e,t)=>{s.current.has(e)||c(e=>e+1),s.current.set(e,t)},[]),k=U(e=>{s.current.delete(e)&&c(e=>e-1)},[]),E=U(e=>{h(t=>t+(e?1:-1))},[]),C=U(e=>{p(t=>t+(e?1:-1))},[]),[M,N]=B(0),S=M>0,L=U(e=>{N(t=>t+(e?1:-1))},[]),T=O(Le),z=T?.claimReadOnly;q(()=>{if(z&&!y)return z(!0),()=>z(!1)},[z,y]);const A=T?.claimOwnMount;q(()=>{if(A&&S)return A(!0),()=>A(!1)},[A,S]);const D=F({last:0,count:0,tripped:!1}),P=F(!1),I=U((e,t,n)=>{if(v.current)return void(n&&function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(Array.isArray(e)!==Array.isArray(t))return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}(n.prev,n.next)||(P.current=!0));if(!y||g.current)return;const r=D.current;if(r.tripped)return;const o=Date.now();if(o-r.last>to&&(r.count=0),r.last=o,++r.count>eo)return r.tripped=!0,void console.error(`[efficient-shell] UndoProvider: "${e}" recorded ${eo} undo steps with no pause between them, which no user action can do. The value passed to useUndoable for this slice is almost certainly rebuilt on every render (a .map/.filter/object literal in the call) rather than held in state, so it reads as changed every time — and since recording a step re-renders the form, that is a loop. Undo recording is now off for this form to keep the tab responsive.`);g.current={values:b(),label:e,coalesceKey:t},queueMicrotask(()=>{const e=g.current;g.current=null,e&&a({type:"record",step:e})})},[y,b]),K=U(e=>{for(const[t,n]of Object.entries(e)){const e=s.current.get(t);e&&(e.setLast(n),e.apply(n))}},[]),W=U(()=>{const e=o.past[o.past.length-1];if(!e)return;const t={values:b(),label:e.label,coalesceKey:null};K(e.values),a({type:"undo",redoStep:t})},[o.past,b,K]),R=U(()=>{const e=o.future[0];if(!e)return;const t={values:b(),label:e.label,coalesceKey:null};K(e.values),a({type:"redo",undoStep:t})},[o.future,b,K]),[$,j]=B(0),H=F(0),Y=F(0),X=F(!1),V=U(()=>{v.current=!0,P.current=!1,g.current=null,H.current+=1,Y.current=H.current,j(H.current)},[]),_=F(void 0),J=U(e=>{void 0!==e&&(void 0!==_.current&&e!==_.current&&(X.current=!0),_.current=e),V()},[V]);q(()=>{v.current&&$===Y.current&&(v.current=!1,g.current=null,(P.current||X.current)&&a({type:"clear"}),P.current=!1,X.current=!1)},[$]);const Q=U(()=>{X.current=!0,a({type:"clear"}),V()},[V]),ne=y&&o.past.length>0,re=y&&o.future.length>0,oe=Lr(r),ie=F({undo:W,redo:R,canUndo:ne,canRedo:re});ie.current={undo:W,redo:R,canUndo:ne,canRedo:re},q(()=>{if(!oe||!y)return;const e=e=>{const t=function(e){if(!e.metaKey&&!e.ctrlKey||e.altKey)return null;const t=e.key.toLowerCase(),n="z"===t?e.shiftKey?"redo":"undo":"y"!==t||!e.ctrlKey||e.metaKey||e.shiftKey?null:"redo";if(!n)return null;const r=e.target;return r?.isContentEditable||r?.tagName&&Qr.has(r.tagName.toUpperCase())?null:n}(e);if(!t)return;const n=ie.current;("undo"===t?n.canUndo:n.canRedo)&&(e.preventDefault(),"undo"===t?n.undo():n.redo())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[oe,y]);const ae=G(()=>({register:x,unregister:k,record:I,undo:W,redo:R,clear:Q,baseline:J,canUndo:ne,canRedo:re,enabled:y,hasState:u,handMounted:S,claimOwnMount:L,claimReadOnly:E,declaredEditable:f,claimEditable:C,undoLabel:ne?o.past[o.past.length-1].label:null,redoLabel:re?o.future[0].label:null}),[x,k,I,W,R,Q,J,ne,re,y,u,S,L,E,f,C,o.past,o.future]),se=""!==un(),le=O(cn)?.footerOpen??!1,ce=se&&y&&u&&!S&&le;/* @__PURE__ */
100
- return ee(Le.Provider,{value:ae,children:[ce&&/* @__PURE__ */te(hn,{position:"left",quiet:!0,children:/* @__PURE__ */te(ze,{auto:!0})}),e]})}function ro(){const e=O(Le),t=U(()=>{},[]);return{undo:e?.undo??t,redo:e?.redo??t,clear:e?.clear??t,baseline:e?.baseline??t,canUndo:e?.canUndo??!1,canRedo:e?.canRedo??!1,undoLabel:e?.undoLabel??null,redoLabel:e?.redoLabel??null,enabled:e?.enabled??!1,hasState:e?.hasState??!1}}function oo(e){const t=O(Le),n=t?.claimReadOnly,r=t?.claimEditable;q(()=>{const t=e?r:n;if(t)return t(!0),()=>t(!1)},[n,r,e])}function io(e,t,n){const r=O(Le),o=J(),i=F(e),a=F(t);a.current=t,q(()=>{if(r)return r.register(o,{getLast:()=>i.current,setLast:e=>{i.current=e},apply:e=>a.current(e)}),()=>r.unregister(o)},[r,o]);const{label:s,coalesceKey:l=null}=n,c=F(r);c.current=r;const u=F({label:s,coalesceKey:l});u.current={label:s,coalesceKey:l},q(()=>{const t=c.current;t&&(Object.is(e,i.current)||(t.record(u.current.label,u.current.coalesceKey,{prev:i.current,next:e}),i.current=e))},[e])}function ao(e,t){const[n,r]=B(e);return io(n,e=>r(()=>e),t),[n,r]}export{mn as CancelButton,et as DocFavStar,qe as EntityWindowFallback,je as EntityWindowLoading,Be as EntityWindowState,en as KEY_ACTIVATED_SELECTOR,Oe as LoadingSpinner,Qt as MODAL_SUBMIT_SELECTOR,_r as Modal,hn as ModalActions,ze as UndoControls,no as UndoProvider,de as WINDOW_REGISTRY,Ne as WindowCrashedFallback,Se as WindowErrorBoundary,xt as WindowManagerProvider,sn as WindowTitle,at as activateWindowById,It as beginWindowGesture,Gn as cancelWindowFront,we as client_default,Yr as commitExposeHighlight,_n as confirmWindowDiscard,Kt as drainPerfEvents,Kr as exitExposeMode,Mn as forgetMaximizedWindowBoxes,Mr as getActiveModalId,ct as getActiveWindowRoute,Hr as getExposeHighlight,Vt as getWindowChromeVersion,En as getWindowPosition,Ue as isDraftEntityId,Ye as isDraftEntityWindow,le as isEntityEntry,se as isPageEntry,pe as isShellApiClientConfigured,Ke as isTabWindow,Pt as markMenuOpen,Yt as readWindowChrome,Yn as requestWindowFront,Ur as setExposeHighlight,Dt as setPerfCollecting,me as setShellApiClient,xe as setShellHomeRoute,Me as setShellTabStrip,ue as setShellWindowRegistry,kn as setWindowDefaultPosition,Cn as setWindowPosition,jt as splitTitle,Br as subscribeExposeHighlight,Xt as subscribeWindowChrome,We as tabGroupOf,Ir as toggleExposeMode,qn as useCurrentTabKey,un as useEnclosingModalId,Lr as useIsActiveWindow,dn as useModalActive,ge as usePageSearch,ro as useUndo,oo as useUndoCanEdit,io as useUndoable,ao as useUndoableState,rn as useWidgetSettings,_e as useWindowDirty,Je as useWindowManager,an as useWindowMenuItem,ln as useWindowTitle,Vn as windowHoldsChanges};
@@ -1,2 +0,0 @@
1
- import{inputClasses as e,PLACEHOLDER_INK as a}from"./chunk-AYZY3YNC.js";import{forwardRef as r}from"react";import{jsx as t,jsxs as n}from"react/jsx-runtime";var i=r(function({invalid:r,leftIcon:i,rightAdornment:l,size:s,className:o="",readOnly:c,...m},d){const p=`${i?"pl-10":""} ${l?"pr-10":""}`.trim(),f=
2
- /* @__PURE__ */t("input",{ref:d,"aria-invalid":r||void 0,readOnly:c,className:e({invalid:r,size:s,readOnly:c,className:[p,o].filter(Boolean).join(" ")}),...m});return i||l?/* @__PURE__ */n("div",{className:"relative",children:[i&&/* @__PURE__ */t("span",{className:`pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 ${a}`,children:i}),f,l&&/* @__PURE__ */t("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400",children:l})]}):f});export{i as Input_default};
@@ -1 +0,0 @@
1
- var r="10.23.0",a=r;export{a as APP_VERSION,r as VERSION};
@@ -1 +0,0 @@
1
- var e={bold:{open:"**",close:"**",placeholder:"bold text"},italic:{open:"_",close:"_",placeholder:"italic text"},strike:{open:"~~",close:"~~",placeholder:"struck out"},code:{open:"`",close:"`",placeholder:"code"},highlight:{open:"==",close:"==",placeholder:"highlighted text"},quiet:{open:"^^",close:"^^",placeholder:"quiet text"},underline:{open:"[",close:"]{underline}",placeholder:"underlined text"},sup:{open:"[",close:"]{sup}",placeholder:"superscript"},sub:{open:"[",close:"]{sub}",placeholder:"subscript"}};function t(e){return/^[a-z][a-z0-9-]*$/.test(e)}function n(e){return t(e)||/^#[0-9a-fA-F]{6}$/.test(e)}function l(e){return n(e)?e.startsWith("#")?e.toLowerCase():e:null}function r(e,t){const n=/^\{(underline|sup|sub|color=([a-z][a-z0-9-]*|#[0-9a-fA-F]{6}))\}/.exec(e.slice(t,t+64));return n?void 0===n[2]?{kind:n[1],length:n[0].length}:{kind:"color",color:n[2],length:n[0].length}:null}var s={bold:e.bold.placeholder,italic:e.italic.placeholder,strike:e.strike.placeholder,code:e.code.placeholder,highlight:e.highlight.placeholder,quiet:e.quiet.placeholder,link:"link text",underline:e.underline.placeholder,sup:e.sup.placeholder,sub:e.sub.placeholder,color:"colored text"},i={bullet:()=>"- ",number:e=>`${e+1}. `,quote:()=>"> "};function o(t,n,l,r,o=k,c=s){if("clear"===r)return W(t,n,l,o);const u=t.slice(n,l);if("link"===r){const e=u||c.link,r=`[${e}](https://)`;return{text:t.slice(0,n)+r+t.slice(l),selectionStart:n+e.length+3,selectionEnd:n+r.length-1}}const h=i[r];if(h){const e=t.lastIndexOf("\n",Math.max(n-1,0))+1,r=t.indexOf("\n",l),s=-1===r?t.length:r,i=t.slice(e,s).split("\n"),o=i.every((e,t)=>e.startsWith(h(t))),c=i.map((e,t)=>o?e.slice(h(t).length):h(t)+e).join("\n");return{text:t.slice(0,e)+c+t.slice(s),selectionStart:e,selectionEnd:e+c.length}}const{open:f,close:d}=e[r],m=r,p=c[m]??s[m];if(a(t,n,l,r))return{text:t.slice(0,n-f.length)+u+t.slice(l+d.length),selectionStart:n-f.length,selectionEnd:n-f.length+u.length};const b=u||p;return{text:t.slice(0,n)+f+b+d+t.slice(l),selectionStart:n+f.length,selectionEnd:n+f.length+b.length}}function c(e,t,n,i,o=s){const c={text:e,selectionStart:t,selectionEnd:n};if(null!==i){const e=l(i);if(null===e)return c;i=e}const a=e.slice(t,n),u=t>=1&&"["===e[t-1]&&"]"===e[n]?r(e,n+1):null;if("color"===u?.kind){const l=t-1,r=e.slice(n+1+u.length);return null===i?{text:e.slice(0,l)+a+r,selectionStart:l,selectionEnd:l+a.length}:{text:`${e.slice(0,n)}]{color=${i}}${r}`,selectionStart:t,selectionEnd:n}}if(null===i)return c;const h=a||(o.color??s.color);return{text:`${e.slice(0,t)}[${h}]{color=${i}}${e.slice(n)}`,selectionStart:t+1,selectionEnd:t+1+h.length}}function a(t,n,l,r){const s=e[r];if(!s)return!1;const{open:i,close:o}=s;return n>=i.length&&t.slice(n-i.length,n)===i&&t.slice(l,l+o.length)===o}function u(e,t,n){const l=0===t?0:e.lastIndexOf("\n",t-1)+1;for(let r=e.lastIndexOf("[",t);r>=l;r=0===r?-1:e.lastIndexOf("[",r-1)){const t=B(e,r);if(t&&n<=t.end)return{start:r,end:t.end,label:t.label,href:t.href}}return null}function h(e,t,n,l){const r=u(e,t,n),s=r?r.start:t,i=r?r.end:n,o=`[${r?r.label:e.slice(t,n)||l}](${l})`,c=s+o.length;return{text:e.slice(0,s)+o+e.slice(i),selectionStart:c,selectionEnd:c}}function f(e,t){return{text:e.slice(0,t.start)+t.label+e.slice(t.end),selectionStart:t.start,selectionEnd:t.start+t.label.length}}var d=[{style:"bold",label:"B",name:"Strong",title:"Strong · **words** · ⌘B",shortcut:"b"},{style:"italic",label:"I",name:"Italic",title:"Italic · _words_ · ⌘I",shortcut:"i"},{style:"strike",label:"S",name:"Strikethrough",title:"Strikethrough · ~~words~~"},{style:"highlight",label:"◆",name:"Emphasis",title:"Emphasis · ==words=="},{style:"quiet",label:"a",name:"Quiet",title:"Quiet · ^^words^^"},{style:"code",label:"‹›",name:"Code",title:"Code"},{style:"link",label:"🔗",name:"Link",title:"Link · [words](https://…) · ⌘K",shortcut:"k"},{style:"bullet",label:"•",name:"Bulleted list",title:"Bulleted list"},{style:"number",label:"1.",name:"Numbered list",title:"Numbered list"},{style:"quote",label:"❝",name:"Quote",title:"Quote"},{style:"clear",label:"T×",name:"Clear marks",title:"Clear marks · ⌘⇧X",shortcut:"shift+x"}],m={bold:"Strong",highlight:"Emphasis",quiet:"Quiet"};function p(e){return d.filter(t=>e.includes(t.style))}var k=[{open:"**",close:"**",kind:"bold"},{open:"==",close:"==",kind:"highlight"},{open:"~~",close:"~~",kind:"strike"},{open:"_",close:"_",kind:"italic",wordBoundary:!0},{open:"^^",close:"^^",kind:"quiet"},{open:"@@",close:"@@",kind:"highlight"},{open:"++",close:"++",kind:"bold",wordStart:!0}],b=["highlight","quiet"],g=d.map(e=>e.style).filter(e=>k.some(t=>t.kind===e)).filter(e=>!b.includes(e)),x=[...k,{open:"*",close:"*",kind:"accent"}],S=[...k,{open:"*",close:"*",kind:"accent"},{open:"#",close:"#",kind:"bold",notBefore:"0123456789"},{open:"[",close:"]",kind:"italic",notBefore:"(",notBeforeBlock:!0}];function v(e){return!/\s/.test(e)&&!/[!-\/:-@[-`{-~]/.test(e)}function w(e,t){const n=[];let l="",r=0;for(;r<e.length;){const s=E(e,r,t);s?(n.push({kind:"text",text:l}),l="",n.push({kind:s.rule.kind,text:s.inner}),r=s.end):(l+=e[r],r+=1)}return n.push({kind:"text",text:l}),n}function E(e,t,n){for(const l of n){if(!e.startsWith(l.open,t))continue;if(l.wordBoundary&&t>0&&v(e[t-1]))continue;if(l.wordStart&&t>0&&/[\p{L}\p{N}]/u.test(e[t-1]))continue;const n=t+l.open.length,s=e.indexOf(l.close,n);if(s<n+1)continue;const i=e.slice(n,s);if(i.includes(l.close[0]))continue;if(i.includes("\n"))continue;const o=s+l.close.length,c=e[o];if((!l.notBefore||void 0===c||!l.notBefore.includes(c))&&!(l.notBeforeBlock&&r(e,o)||l.wordBoundary&&void 0!==c&&v(c)))return{rule:l,inner:i,end:o}}return null}function y(e,t){return w(e,t).map(e=>e.text).join("")}var M=["http","https","mailto","tel"];function $(e){if(""===e||/[\s\u0000-\u001f\u007f]/.test(e))return!1;const t=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!t||M.includes(t[1].toLowerCase())}function B(e,t){if("["!==e[t])return null;const n=e.indexOf("]",t+1);if(n<t+2||"("!==e[n+1])return null;const l=e.slice(t+1,n);if(l.includes("["))return null;const r=e.indexOf(")",n+2);if(-1===r)return null;const s=e.slice(n+2,r);return $(s)?{label:l,href:s,end:r+1}:null}function z(e,t){if("["!==e[t])return null;let n=0;for(let l=t;l<e.length;l+=1){const s=e[l];if("\n"===s)return null;if("["===s)n+=1;else if("]"===s){if(n-=1,n>0)continue;if(l===t+1)return null;const s=r(e,l+1);return s?{kind:s.kind,color:s.color,label:e.slice(t+1,l),close:e.slice(l,l+1+s.length),end:l+1+s.length}:null}}return null}var q=4;function I(e,t,n){const l=[];let r="";const s=()=>{r&&l.push({kind:"text",text:r}),r=""},i=e=>n+1<q?I(e,t,n+1):[{kind:"text",text:e}];let o=0;for(;o<e.length;){const n=B(e,o);if(n){s(),l.push({kind:"link",href:n.href,children:i(n.label)}),o=n.end;continue}const c=z(e,o);if(c){s(),l.push({kind:c.kind,open:"[",close:c.close,...void 0===c.color?{}:{color:c.color},children:i(c.label)}),o=c.end;continue}const a=E(e,o,t);a?(s(),l.push({kind:a.rule.kind,open:a.rule.open,close:a.rule.close,children:i(a.inner)}),o=a.end):(r+=e[o],o+=1)}return s(),l}function O(e,t){return e.split("\n").map(e=>{const{bullet:n,number:l,rest:r}=function(e){if(e.startsWith("- ")&&""!==e.slice(2).trim())return{bullet:!0,number:null,rest:e.slice(2)};const t=/^([0-9]{1,3})\. /.exec(e);return t&&""!==e.slice(t[0].length).trim()?{bullet:!1,number:t[1],rest:e.slice(t[0].length)}:{bullet:!1,number:null,rest:e}}(e);return{bullet:n,number:l,children:I(r,t,0)}})}function C(e){return null!=e.number?`${e.number}. `:e.bullet?"- ":""}function _(e){return e.map(e=>"text"===e.kind?e.text:"link"===e.kind?`[${_(e.children)}](${e.href})`:e.open+_(e.children)+e.close).join("")}function j(e){return e.map(e=>C(e)+_(e.children)).join("\n")}function L(t,n,r){if("link"===n)return void 0===r?null:{id:t,kind:"link",open:"[",close:`](${r})`,href:r};if("color"===n){const e=void 0===r?null:l(r);return null===e?null:{id:t,kind:"color",open:"[",close:`]{color=${e}}`,color:e}}const s=e[n];return s&&"code"!==n?{id:t,kind:n,open:s.open,close:s.close}:null}function Q(e,t){let n=0,l=0;return e.split("\n").map(e=>{const[r]=O(e,t);let s=l+C(r).length;l+=e.length+1;const i=[],o=(e,t)=>{for(const l of e){if("text"===l.kind){for(const e of l.text)i.push({ch:e,marks:t,at:s}),s+=e.length;continue}const e="link"===l.kind?L(++n,"link",l.href):{id:++n,kind:l.kind,open:l.open,close:l.close,...void 0===l.color?{}:{color:l.color}};s+=e.open.length,o(l.children,[...t,e]),s+=e.close.length}};return o(r.children,[]),{bullet:r.bullet,number:r.number??null,chars:i}})}function A(e){let t="";const n=[];return e.forEach((e,l)=>{l>0&&(t+="\n"),t+=C(e);const r=[],s=[];for(const n of e.chars){let e=0;for(;e<r.length&&e<n.marks.length&&r[e].id===n.marks[e].id;)e+=1;for(;r.length>e;)t+=r.pop().close;for(let l=e;l<n.marks.length;l+=1)t+=n.marks[l].open,r.push(n.marks[l]);s.push(t.length),t+=n.ch}for(;r.length>0;)t+=r.pop().close;n.push(s)}),{text:t,at:n}}function N(e,t){return e.length===t.length&&e.every((e,n)=>{const l=t[n];return e.bullet===l.bullet&&(e.number??null)===(l.number??null)&&(e.chars.length===l.chars.length&&e.chars.every((e,t)=>{const n=l.chars[t];return e.ch===n.ch&&e.marks.length===n.marks.length&&e.marks.every((e,t)=>e.kind===n.marks[t].kind&&e.href===n.marks[t].href&&e.color===n.marks[t].color)}))})}function W(e,t,n,l=k){const r=Q(e,l),s=r.flatMap(e=>e.chars),i={text:e,selectionStart:t,selectionEnd:n},o=e=>r.map(t=>({bullet:t.bullet,number:t.number,chars:t.chars.map(t=>({...t,marks:t.marks.filter(n=>"link"===n.kind||!e(t,n))}))})),c=e=>{const t=A(e);return N(e,Q(t.text,l))?t:null},a=(e,t)=>{let n=s.indexOf(t);for(let t=0;t<e.at.length;t+=1){if(n<e.at[t].length)return e.at[t][n];n-=e.at[t].length}return 0};if(t===n){const e=[...s].reverse().find(e=>e.at<t),n=s.find(e=>e.at>=t),l=new Set([...e?.marks??[],...n?.marks??[]].map(e=>e.id));if(![...l].some(e=>s.some(t=>t.marks.some(t=>t.id===e&&"link"!==t.kind))))return i;const r=c(o((e,t)=>l.has(t.id)));if(!r)return i;const u=n?a(r,n):e?a(r,e)+e.ch.length:0;return{text:r.text,selectionStart:u,selectionEnd:u}}const u=new Set(s.filter(e=>e.at>=t&&e.at<n));if(0===u.size)return i;const h=new Set([...u].flatMap(e=>e.marks.map(e=>e.id))),f=c(T(o(e=>u.has(e)),h))??c(o((e,t)=>h.has(t.id)));if(!f)return i;const d=s.find(e=>u.has(e)),m=[...s].reverse().find(e=>u.has(e));return{text:f.text,selectionStart:a(f,d),selectionEnd:a(f,m)+m.ch.length}}function F(e,t,n,l=k){if(t===n)return{text:e,selectionStart:t,selectionEnd:n};const r=Q(e,l),s=r.flatMap(e=>e.chars),i=new Set(s.filter(e=>e.at>=t&&e.at<n)),o=e=>"link"!==e.kind,c=new Set([...i].flatMap(e=>e.marks.filter(o).map(e=>e.id)));if(0===c.size)return{text:e,selectionStart:t,selectionEnd:n};const a=e=>r.map(t=>({bullet:t.bullet,number:t.number,chars:t.chars.map(t=>({...t,marks:e(t)}))})),u=a(e=>i.has(e)?e.marks.filter(e=>!o(e)):e.marks);u.forEach((e,t)=>{const n=e.chars,l=r[t].chars.map(e=>i.has(e)),s=e=>{n[e].marks=n[e].marks.filter(e=>!c.has(e.id))};n.forEach((e,t)=>{if(l[t]){if(0===t||!l[t-1])for(let e=t-1;e>=0&&/\s/.test(n[e].ch);e-=1)s(e);if(t===n.length-1||!l[t+1])for(let e=t+1;e<n.length&&/\s/.test(n[e].ch);e+=1)s(e)}})});const h=K(u,l)??K(a(e=>e.marks.filter(e=>!c.has(e.id))),l);return G(e,s,i,h,t,n)}function Z(e){return e.at.flat()}function K(e,t){const n=A(e);return N(e,Q(n.text,t))?n:null}function T(e,t){return e.map(e=>{const n=e.chars.map(e=>({...e}));for(const e of t){const t=t=>t.marks.some(t=>t.id===e),l=n.flatMap((e,n)=>t(e)?[n]:[]),r=t=>{n[t].marks=n[t].marks.filter(t=>t.id!==e)};for(let e=0;e<l.length&&/\s/.test(n[l[e]].ch);e+=1)r(l[e]);for(let e=l.length-1;e>=0&&/\s/.test(n[l[e]].ch)&&t(n[l[e]]);e-=1)r(l[e])}return{bullet:e.bullet,number:e.number,chars:n}})}function X(e,t){return t.kind===e||"highlight"===e&&"accent"===t.kind}function D(e,t,n){const l=e.findIndex(e=>n(e.id));return-1===l?[...e,t]:[...e.slice(0,l),t,...e.slice(l)]}function G(e,t,n,l,r,s){if(!l)return{text:e,selectionStart:r,selectionEnd:s};const i=Z(l),o=t.flatMap((e,t)=>n.has(e)?[t]:[]),c=o[0],a=o[o.length-1];return{text:l.text,selectionStart:i[c],selectionEnd:i[a]+t[a].ch.length}}function H(e,t,n,l,r=k){if(t===n||!L(0,l))return o(e,t,n,l,r);const s=Q(e,r),i=s.flatMap(e=>e.chars),c=new Set(i.filter(e=>e.at>=t&&e.at<n));if(0===c.size)return{text:e,selectionStart:t,selectionEnd:n};const a=e=>s.map(t=>({bullet:t.bullet,number:t.number,chars:t.chars.map(t=>({...t,marks:e(t)}))}));if([...c].every(e=>e.marks.some(e=>X(l,e)))){const s=new Set([...c].flatMap(e=>e.marks.filter(e=>X(l,e)).map(e=>e.id))),o=K(T(a(e=>c.has(e)?e.marks.filter(e=>!X(l,e)):e.marks),s),r)??K(a(e=>e.marks.filter(e=>!s.has(e.id))),r);return G(e,i,c,o,t,n)}const u=new Set([...c].flatMap(e=>e.marks.filter(e=>X(l,e)).map(e=>e.id))),h=new Set(i.filter(e=>c.has(e)||e.marks.some(e=>u.has(e.id)))),f=Math.max(0,...i.flatMap(e=>e.marks.map(e=>e.id)))+1,d=L(f,l),m=e=>i.every(t=>!t.marks.some(t=>t.id===e)||h.has(t)),p=K(T(a(e=>h.has(e)?D(e.marks.filter(e=>!X(l,e)),d,m):e.marks),/* @__PURE__ */new Set([f])),r);return G(e,i,c,p,t,n)}function J(e,t,n,l=k){const r=Q(e,l).flatMap(e=>e.chars);let s;if(t===n){const n=[...r].reverse().find(n=>n.at<t&&!e.slice(n.at,t).includes("\n"));s=n?[n]:[]}else s=r.filter(e=>e.at>=t&&e.at<n);if(0===s.length)/* @__PURE__ */return new Set;const i=s.map(e=>new Set(e.marks.map(e=>e.kind)));return new Set([...i[0]].filter(e=>i.every(t=>t.has(e))))}function P(e,t,n){const l=t===n?[[...e].reverse().find(e=>e.at<t),e.find(e=>e.at>=t)]:e.filter(e=>e.at>=t&&e.at<n);for(const e of l){const t=e?.marks.find(e=>"link"===e.kind);if(t)return t.id}return null}function R(e,t,n,l,r=k){const s=Q(e,r),i=s.flatMap(e=>e.chars),o=e=>s.map(t=>({bullet:t.bullet,number:t.number,chars:t.chars.map(t=>({...t,marks:e(t)}))})),c=(e,t,n)=>{const l=Z(e),r=i.reduce((e,n,l)=>t(n)?l:e,-1),s=l[r]+i[r].ch.length+n.close.length;return{text:e.text,selectionStart:s,selectionEnd:s}};if(t===n){const s=P(i,t,n);if(null===s)return h(e,t,n,l);const a=L(s,"link",l),u=K(o(e=>e.marks.map(e=>e.id===s?a:e)),r);return u?c(u,e=>e.marks.some(e=>e.id===s),a):{text:e,selectionStart:t,selectionEnd:n}}const a=new Set(i.filter(e=>e.at>=t&&e.at<n));if(0===a.size)return h(e,t,n,l);const u=L(Math.max(0,...i.flatMap(e=>e.marks.map(e=>e.id)))+1,"link",l),f=e=>i.every(t=>!t.marks.some(t=>t.id===e)||a.has(t)),d=K(o(e=>a.has(e)?D(e.marks.filter(e=>"link"!==e.kind),u,f):e.marks),r);return d?c(d,e=>a.has(e),u):{text:e,selectionStart:t,selectionEnd:n}}function U(e,t,n,l=k){const r=Q(e,l),s=r.flatMap(e=>e.chars),i=P(s,t,n);if(null===i)return{text:e,selectionStart:t,selectionEnd:n};const o=new Set(s.filter(e=>e.marks.some(e=>e.id===i)));return G(e,s,o,K(r.map(e=>({bullet:e.bullet,number:e.number,chars:e.chars.map(e=>({...e,marks:e.marks.filter(e=>e.id!==i)}))})),l),t,n)}function V(e,t,l,r,s=k){const i={text:e,selectionStart:t,selectionEnd:l};if(t===l||null!==r&&!n(r))return i;const o=Q(e,s),c=o.flatMap(e=>e.chars),a=new Set(c.filter(e=>e.at>=t&&e.at<l));if(0===a.size)return i;const u=e=>o.map(t=>({bullet:t.bullet,number:t.number,chars:t.chars.map(t=>({...t,marks:e(t)}))})),h=new Set([...a].flatMap(e=>e.marks.filter(e=>"color"===e.kind).map(e=>e.id)));if(null===r){const n=K(T(u(e=>a.has(e)?e.marks.filter(e=>"color"!==e.kind):e.marks),h),s)??K(u(e=>e.marks.filter(e=>!h.has(e.id))),s);return G(e,c,a,n,t,l)}const f=Math.max(0,...c.flatMap(e=>e.marks.map(e=>e.id)))+1,d=L(f,"color",r),m=e=>c.every(t=>!t.marks.some(t=>t.id===e)||a.has(t)),p=K(T(u(e=>a.has(e)?D(e.marks.filter(e=>"color"!==e.kind),d,m):e.marks),/* @__PURE__ */new Set([f,...h])),s);return G(e,c,a,p,t,l)}function Y(e,t,n,l=k){const r=Q(e,l).flatMap(e=>e.chars),s=t===n?[[...r].reverse().find(n=>n.at<t&&!e.slice(n.at,t).includes("\n"))].filter(e=>void 0!==e):r.filter(e=>e.at>=t&&e.at<n);if(0===s.length)return null;const i=e=>e.marks.filter(e=>"color"===e.kind).pop()?.color??null,o=i(s[0]);return null!==o&&s.every(e=>i(e)===o)?o:null}var ee=/^(?:- |([0-9]{1,3})\. )$/;function te(e,t,n){const l=e.split("\n"),r=[];let s=0;for(const e of l)r.push(s),s+=e.length+1;const i=e=>{let t=0;for(;t+1<r.length&&r[t+1]<=e;)t+=1;return t};return{first:i(t),last:i(Math.max(t,n)),starts:r}}function ne(e,t){if(null!=t.number)return"number";if(t.bullet)return"bullet";const n=ee.exec(e);return n?void 0===n[1]?"bullet":"number":null}function le(e,t,n,l,r=k){const s=e.split("\n"),i=Q(e,r),{first:o,last:c}=te(e,t,n),a=i.map((e,t)=>null===ne(s[t],e)||e.bullet||null!=e.number?{bullet:e.bullet,number:e.number??null,chars:e.chars}:{bullet:!1,number:null,chars:[]});let u=0;if("number"===l&&o>0&&"number"===ne(s[o-1],i[o-1])){const e=i[o-1].number??ee.exec(s[o-1])?.[1]??"0";u=Number(e)}const h=A(a.map((e,t)=>t<o||t>c?e:"bullet"===l?{bullet:!0,number:null,chars:e.chars}:"number"===l?{bullet:!1,number:String(u+=1),chars:e.chars}:{bullet:!1,number:null,chars:e.chars})).text.split("\n").map((e,t)=>t<o||t>c?s[t]:e),f=h.join("\n"),{starts:d}=te(e,0,0),m=t=>{const{first:n}=te(e,t,t);let l=0;for(let e=0;e<n;e+=1)l+=h[e].length-s[e].length;const r=null===ne(s[o=n],i[o])||i[o].bullet||null!=i[o].number?C(i[o]).length:s[o].length;var o;const c=h[n].length-(s[n].length-r),a=t-d[n];return d[n]+l+(a<r?c:a-r+c)};return{text:f,selectionStart:m(t),selectionEnd:m(n)}}function re(e,t,n,l=k){const r=e.split("\n"),s=Q(e,l),{first:i,last:o}=te(e,t,n),c=new Set(s.slice(i,o+1).map((e,t)=>ne(r[i+t],e)));return 1===c.size?[...c][0]:null}export{S as CAMPAIGN_MARKUP,g as COPY_FIELD_TOOLS,d as MARKUP_TOOLS,m as MARK_NAMES,s as MARK_PLACEHOLDERS,b as RETIRED_MARKS,k as STANDARD_MARKUP,x as STOREFRONT_MARKUP,c as applyColor,o as applyMark,W as clearMarks,F as clearStyle,Y as colorIn,V as colorOver,u as findLink,t as isColorName,n as isColorValue,$ as isSafeLinkHref,R as linkOver,re as listIn,a as markedAt,Q as markedLines,J as marksIn,p as markupTools,O as parseMarkup,f as removeLink,N as sameMarks,j as serializeMarkup,le as setList,L as spanFor,y as stripInline,H as toggleMark,w as tokenizeInline,U as unlinkAt,h as writeLink,A as writeMarkedLines};
File without changes