efficient-shell 10.0.0 → 10.1.1
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.
- package/README.md +2 -2
- package/dist/{Browser-RFLTFP7Y.js → Browser-Q34VNUTL.js} +13 -13
- package/dist/{Calculator-DV2R65OS.js → Calculator-63XNC3BA.js} +12 -12
- package/dist/{CurrencyConverter-ELSCNMUT.js → CurrencyConverter-Q4HYAY4N.js} +9 -9
- package/dist/{Documents-HKTTXLSR.js → Documents-KLVVF4KK.js} +24 -24
- package/dist/{Files-ZSYGKZOV.js → Files-AOIBTQTE.js} +40 -40
- package/dist/Notepad-SOUIZDKN.js +24 -0
- package/dist/PdfViewer-WNKGFJD6.js +1 -0
- package/dist/{PomodoroTimer-XHNZGBDR.js → PomodoroTimer-X5Y3LA3V.js} +25 -25
- package/dist/{Preview-PLCASIZA.js → Preview-3FZTC25R.js} +25 -25
- package/dist/Sidebar-4OI4LP6G.js +44 -0
- package/dist/{Spreadsheet-Y7TJIBI5.js → Spreadsheet-RBEVCQIV.js} +13 -13
- package/dist/{Stock-KLYWTMMD.js → Stock-KESFJPYD.js} +4 -4
- package/dist/{Weather-CT2IZHEW.js → Weather-BYGZVNNK.js} +19 -19
- package/dist/{WorldClock-EJCUVIUW.js → WorldClock-P4JVDPGE.js} +6 -6
- package/dist/ai/index.js +38 -38
- package/dist/apps/index.js +1 -1
- package/dist/bin/media-host-check.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/brand.css +1 -1
- package/dist/charts/BoxPlotChart.js +1 -1
- package/dist/charts/CandlestickChart.js +1 -1
- package/dist/charts/CartesianPlot.js +1 -1
- package/dist/charts/ChordChart.js +1 -1
- package/dist/charts/ColumnChart.js +1 -1
- package/dist/charts/HeatmapChart.js +1 -1
- package/dist/charts/HistogramChart.js +1 -1
- package/dist/charts/RadarChart.js +1 -1
- package/dist/charts/RangeChart.js +1 -1
- package/dist/charts/SankeyChart.js +1 -1
- package/dist/charts/ScatterChart.js +1 -1
- package/dist/charts/SpecChart.js +1 -1
- package/dist/charts/SunburstChart.js +1 -1
- package/dist/charts/TimeSeriesChart.js +1 -1
- package/dist/charts/TreemapChart.js +1 -1
- package/dist/charts/WaterfallChart.js +1 -1
- package/dist/{chunk-PUIQFTCO.js → chunk-2OJ3HGFY.js} +5 -5
- package/dist/{chunk-PKIDVVAE.js → chunk-2SLQD57V.js} +5 -5
- package/dist/{chunk-NDEIZUMG.js → chunk-3V6ZERBS.js} +1 -1
- package/dist/{chunk-BXEKX4TB.js → chunk-3V74SUZO.js} +16 -16
- package/dist/{chunk-DL6QIWVR.js → chunk-42XMT5JN.js} +1 -1
- package/dist/{chunk-IQWIYZB5.js → chunk-45XXERGA.js} +2 -2
- package/dist/{chunk-B7KD3DGY.js → chunk-4UEXVRBC.js} +1 -1
- package/dist/{chunk-FRINAJU7.js → chunk-4UX6ET7G.js} +1 -1
- package/dist/{chunk-BFVL2VTS.js → chunk-4VDGVF5T.js} +1 -1
- package/dist/chunk-4X6GIVTI.js +29 -0
- package/dist/{chunk-D2WGDTWN.js → chunk-5EX6XXUX.js} +1 -1
- package/dist/{chunk-PA37I5ZX.js → chunk-5VDT4762.js} +2 -2
- package/dist/{chunk-EGAV5LSX.js → chunk-5VSP3TYU.js} +1 -1
- package/dist/{chunk-66JYKX4T.js → chunk-6FPDOEOX.js} +1 -1
- package/dist/{chunk-3AZBI76O.js → chunk-7ILNRFEV.js} +1 -1
- package/dist/{chunk-GQK3U2IO.js → chunk-7TONF2PM.js} +1 -1
- package/dist/{chunk-LKW3YAZN.js → chunk-A3VJ4PRU.js} +6 -6
- package/dist/chunk-ACVKU6YW.js +7 -0
- package/dist/{chunk-ELUTQZGP.js → chunk-AEQFFD5I.js} +1 -1
- package/dist/{chunk-QRJRGP2K.js → chunk-AGLBDT7X.js} +8 -8
- package/dist/chunk-AXL7VTNM.js +11 -0
- package/dist/{chunk-7BDZZANS.js → chunk-B7HW6XZD.js} +1 -1
- package/dist/{chunk-XILZGSMX.js → chunk-BDFZNLFQ.js} +1 -1
- package/dist/{chunk-C6MV6IAX.js → chunk-BMXMSAQE.js} +8 -8
- package/dist/{chunk-PUCPFBYO.js → chunk-BNQRPLBW.js} +1 -1
- package/dist/{chunk-XS4HFUTW.js → chunk-BZPPDYEE.js} +1 -1
- package/dist/{chunk-DPDRFLBY.js → chunk-CLQFP42I.js} +3 -3
- package/dist/{chunk-HKAQXFUR.js → chunk-CMHLXELO.js} +3 -3
- package/dist/{chunk-UZ43AT4O.js → chunk-CUA6CREW.js} +8 -8
- package/dist/{chunk-RYS3URDC.js → chunk-DY2M6BIG.js} +10 -10
- package/dist/{chunk-EGEWU776.js → chunk-E3RHEEA6.js} +1 -1
- package/dist/{chunk-WFANOFHG.js → chunk-F7A6K3D5.js} +5 -5
- package/dist/{chunk-QTQQKQGQ.js → chunk-FFASZGNZ.js} +3 -3
- package/dist/{chunk-MPALY3CL.js → chunk-FMC2XNSP.js} +6 -6
- package/dist/{chunk-D7X2HMMA.js → chunk-FS2KWQJW.js} +10 -10
- package/dist/{chunk-AJ3R5QPD.js → chunk-GGIFS34Z.js} +5 -5
- package/dist/{chunk-4E4GWE4L.js → chunk-GVY2X4CC.js} +16 -16
- package/dist/{chunk-HJPCHES5.js → chunk-GZYTCHPX.js} +4 -4
- package/dist/chunk-IFANUMK3.js +4 -0
- package/dist/{chunk-ZREDCRTL.js → chunk-J7CIBRDS.js} +1 -1
- package/dist/{chunk-ZOBLEXIU.js → chunk-JJYAYMY7.js} +1 -1
- package/dist/{chunk-ZPCADTM5.js → chunk-JRBQLRAZ.js} +1 -1
- package/dist/{chunk-YFUMK2E7.js → chunk-JZK3UDOT.js} +1 -1
- package/dist/{chunk-O33CUGOI.js → chunk-K64JRGNE.js} +5 -5
- package/dist/{chunk-IU5KBQEQ.js → chunk-K7PCBUDC.js} +6 -6
- package/dist/{chunk-VG5NGCMQ.js → chunk-KFRU53WD.js} +6 -6
- package/dist/{chunk-FSPFV4MI.js → chunk-KKSVRIMP.js} +2 -4
- package/dist/{chunk-T5V2GJ4D.js → chunk-KZQAGXME.js} +4 -4
- package/dist/{chunk-FTWWJHFX.js → chunk-LOYCPZUB.js} +1 -1
- package/dist/{chunk-GBLMVFDW.js → chunk-LPDI5NL6.js} +1 -1
- package/dist/{chunk-FPGRKHUW.js → chunk-MH6DI6YY.js} +11 -11
- package/dist/{chunk-GQMS5657.js → chunk-MLKY5ESV.js} +1 -1
- package/dist/{chunk-TGLHJS3M.js → chunk-MUMQ6PW7.js} +1 -1
- package/dist/chunk-N6TK43YN.js +100 -0
- package/dist/chunk-N6VP75F5.js +3 -0
- package/dist/{chunk-KAVFW5CU.js → chunk-NNOA7AVG.js} +5 -5
- package/dist/{chunk-6YQPLI5M.js → chunk-NQJKANUP.js} +11 -11
- package/dist/{chunk-UTQG344L.js → chunk-NW7Z3G7P.js} +11 -11
- package/dist/{chunk-LR77AS3N.js → chunk-O6ABVKHU.js} +4 -4
- package/dist/{chunk-25STFYV3.js → chunk-OPB3I4JH.js} +4 -4
- package/dist/{chunk-RBD7SB6M.js → chunk-P5YFQ4IQ.js} +1 -1
- package/dist/{chunk-JHZV4TN6.js → chunk-PF5CKD4C.js} +2 -2
- package/dist/{chunk-NDKQDIWN.js → chunk-Q4LBBFLO.js} +5 -5
- package/dist/{chunk-X6TJR6M2.js → chunk-Q5YM65DZ.js} +8 -8
- package/dist/{chunk-XOKANFQD.js → chunk-QASKQDUR.js} +16 -16
- package/dist/{chunk-5F7HMNCX.js → chunk-QODTON7V.js} +1 -1
- package/dist/{chunk-7KDGW6BR.js → chunk-QXRRAADR.js} +1 -1
- package/dist/chunk-QZ3MO3HB.js +1 -0
- package/dist/{chunk-VSAI5TH7.js → chunk-R4Q5653D.js} +20 -20
- package/dist/{chunk-DXHLUB36.js → chunk-RKFEJ5CX.js} +1 -1
- package/dist/{chunk-GKZUAT3K.js → chunk-RSIGTZMU.js} +1 -1
- package/dist/{chunk-GNU3U2TP.js → chunk-RZR3OAKV.js} +1 -1
- package/dist/chunk-SDI2UGAG.js +1 -0
- package/dist/chunk-SKY2NBTQ.js +6 -0
- package/dist/{chunk-MKEYXKZA.js → chunk-TDLU6GF5.js} +4 -4
- package/dist/chunk-UP442DPT.js +9 -0
- package/dist/{chunk-OUKDGO4N.js → chunk-V4RYE6KA.js} +8 -8
- package/dist/{chunk-E7WY4GZ3.js → chunk-VMDBVXDJ.js} +1 -1
- package/dist/{chunk-F24QTMTY.js → chunk-VP63OOO4.js} +3 -3
- package/dist/{chunk-GRBBQ3VF.js → chunk-WKSNTMEJ.js} +1 -1
- package/dist/{chunk-DVOQCAC2.js → chunk-WMQ2URP4.js} +1 -1
- package/dist/{chunk-ED3QFXBC.js → chunk-WP4CIYJ7.js} +1 -1
- package/dist/{chunk-UFXE363L.js → chunk-X6YT3I5F.js} +1 -1
- package/dist/{chunk-SGTZJMZ6.js → chunk-XABYSSXW.js} +1 -1
- package/dist/{chunk-GSBIJLTD.js → chunk-XAROKI7X.js} +1 -1
- package/dist/{chunk-ZMVCN4OA.js → chunk-XHMIJ7S3.js} +7 -7
- package/dist/{chunk-Q7HN6T3H.js → chunk-XNKIDGZW.js} +1 -1
- package/dist/{chunk-6I6VSUKY.js → chunk-Y23TGQFN.js} +4 -4
- package/dist/chunk-ZLHPCPXS.js +19 -0
- package/dist/{chunk-LPUGK2MC.js → chunk-ZN2BFSQR.js} +2 -2
- package/dist/{chunk-TXMAWCR7.js → chunk-ZRZ5LOW3.js} +1 -1
- package/dist/data/ListLoadError.js +1 -1
- package/dist/format/index.js +1 -1
- package/dist/forms/BorderInput.js +1 -1
- package/dist/forms/BrandAssetEditor.js +1 -1
- package/dist/forms/Calendar.js +1 -1
- package/dist/forms/ColorPicker.js +1 -1
- package/dist/forms/ComposerAttachments.js +1 -1
- package/dist/forms/CornersInput.js +1 -1
- package/dist/forms/DatePicker.js +1 -1
- package/dist/forms/DateRangePicker.js +1 -1
- package/dist/forms/DisplayChips.js +1 -1
- package/dist/forms/FilePicker.js +1 -1
- package/dist/forms/IconPicker.js +1 -1
- package/dist/forms/InputNumber.js +1 -1
- package/dist/forms/LinkPicker.js +1 -1
- package/dist/forms/MediaLibrary.js +1 -1
- package/dist/forms/MediaUploadField.js +1 -1
- package/dist/forms/MediaUploadGrid.js +1 -1
- package/dist/forms/MediaUsedInList.js +1 -1
- package/dist/forms/PositionInput.js +1 -1
- package/dist/forms/Select.js +1 -1
- package/dist/forms/SidesInput.js +1 -1
- package/dist/forms/Slider.js +1 -1
- package/dist/forms/Snippet.js +1 -1
- package/dist/forms/SplitButton.js +1 -1
- package/dist/forms/TagInput.js +1 -1
- package/dist/forms/TextToolbar.js +1 -1
- package/dist/forms/WidthsBar.js +1 -1
- package/dist/forms/mediaLibraryMenu.js +1 -1
- package/dist/forms/textAlign.js +1 -1
- package/dist/hooks/useTheme.d.ts +1 -1
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +9 -2
- package/dist/index.js +129 -130
- package/dist/map/index.js +3 -3
- package/dist/markdown/index.js +1 -1
- package/dist/page-tabs/index.js +5 -5
- package/dist/pdf/index.js +1 -1
- package/dist/shell/AppUpdateBanner.js +1 -1
- package/dist/shell/Banner.js +1 -1
- package/dist/shell/Breadcrumbs.js +1 -1
- package/dist/shell/ColoredBadge.js +1 -1
- package/dist/shell/ConfirmDialog.js +1 -1
- package/dist/shell/ContextMenu.js +1 -1
- package/dist/shell/Dialog.js +1 -1
- package/dist/shell/Drawer.js +1 -1
- package/dist/shell/DropdownMenu.js +1 -1
- package/dist/shell/EmptyState.js +1 -1
- package/dist/shell/HelpCenter.js +1 -1
- package/dist/shell/ImageLightbox.js +1 -1
- package/dist/shell/LanguageSelect.js +1 -1
- package/dist/shell/Markdown.js +1 -1
- package/dist/shell/PageHeader.js +1 -1
- package/dist/shell/PopupMenu.js +1 -1
- package/dist/shell/ProductionTimeline.js +1 -1
- package/dist/shell/Result.js +1 -1
- package/dist/shell/SearchableSelect.js +1 -1
- package/dist/shell/SettingReset.js +1 -1
- package/dist/shell/SettingRow.js +1 -1
- package/dist/shell/SidebarLayout.js +1 -1
- package/dist/shell/SidebarNav.js +1 -1
- package/dist/shell/SortableList.js +1 -1
- package/dist/shell/StepChain.js +1 -1
- package/dist/shell/Stepper.js +1 -1
- package/dist/shell/TopNav.js +1 -1
- package/dist/shell/Tree.js +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/templates/ChatTemplate.js +1 -1
- package/dist/templates/CheckoutTemplate.js +1 -1
- package/dist/templates/DashboardTemplate.js +1 -1
- package/dist/templates/DataTablePage.js +1 -1
- package/dist/templates/EmailTemplate.js +1 -1
- package/dist/templates/ErrorBoundary.d.ts +1 -1
- package/dist/templates/FormLayoutPage.js +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/Notepad-63Q3JSCV.js +0 -25
- package/dist/PdfViewer-DFBPEUY5.js +0 -1
- package/dist/Sidebar-QFT5WPK4.js +0 -44
- package/dist/chunk-4AJRHTTB.js +0 -1
- package/dist/chunk-5CH2RGL6.js +0 -29
- package/dist/chunk-7YU27U3Y.js +0 -19
- package/dist/chunk-AEJNFA2K.js +0 -6
- package/dist/chunk-IEAFSVXC.js +0 -1
- package/dist/chunk-POCQ7ZL4.js +0 -3
- package/dist/chunk-PVR4KU7H.js +0 -7
- package/dist/chunk-R2QDO7NY.js +0 -4
- package/dist/chunk-RBXSU25O.js +0 -9
- package/dist/chunk-XSJJPACH.js +0 -11
- package/dist/chunk-ZBTDMQUI.js +0 -100
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import{
|
|
2
|
-
return k("span","checkbox"===e?{"aria-hidden":!0,"data-menu-check":"",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded border "+(t?"border-blue-600 bg-blue-600 text-white":"border-gray-400"),children:t&&
|
|
3
|
-
return x("button",{ref:f,id:u,role:"radio"===E?"menuitemradio":"checkbox"===E?"menuitemcheckbox":a??(C?"menuitem":void 0),"aria-checked":E?l:void 0,"aria-labelledby":b?w:void 0,"aria-describedby":b?N:void 0,tabIndex:d,onClick:()=>{
|
|
1
|
+
import{keepsNativeMenu as e}from"./chunk-5QFPTDQF.js";import{optionNoteClass as t}from"./chunk-URHGHXDN.js";import{Icon as n}from"./chunk-KKSVRIMP.js";import{onOverlayOpen as r}from"./chunk-PGN5ME7B.js";import{Z_LAYERS as o}from"./chunk-62LW225J.js";import{useHydrated as i,useBrowserLayoutEffect as a}from"./chunk-D65T4H6J.js";import{glassStyle as l,GLASS_DIVIDER as c}from"./chunk-DTJRIWFR.js";import{registerModalEscapeInterceptor as s}from"./chunk-TWVUQUUD.js";import{createContext as d,forwardRef as u,useContext as p,useId as m,useRef as h,useState as f,useEffect as g,useMemo as y,useCallback as b}from"react";import{createPortal as w}from"react-dom";import{jsxs as x,jsx as k,Fragment as v}from"react/jsx-runtime";function N(e,t,n){return e.length===t+1&&e[t].key===n.key?e:[...e.slice(0,t),n]}function C(e,t){const n=Math.max(0,t);return e.length>n?e.slice(0,n):e}function T(e,t,n){if(0===t.length||0===e.length)return[];const r=[e];for(let e=1;e<t.length;e++){const o=r[e-1].find(n=>n.to===t[e].key),i=o?n(o):[];if(0===i.length)break;r.push(i)}return r}function E(e,t,n,r){const o=Math.max(0,r-n),i=Math.min(t,o),a=e-i/2;return a<n?n:a+i>r?Math.max(n,r-i):a}function M(e,t,n,r,o,i=!1,a=8){const l=t+o,c=e-o-n,s=c>=a;return i&&s?{left:c,flipped:!0}:l+n<=r-a?{left:l,flipped:!1}:s?{left:c,flipped:!0}:i?{left:a,flipped:!0}:{left:Math.max(a,r-a-n),flipped:!1}}function W(){try{return getComputedStyle(document.documentElement).getPropertyValue("--menu-density")?.trim()||"normal"}catch{return"normal"}}var $=d(null),L=d(!1);function R({children:t,style:n,className:a="",onClose:c,minWidth:d=180,portal:u=!1}){const p=h(null),b=m(),[x,v]=f([]),T=h();g(()=>()=>clearTimeout(T.current),[]);const E=i(),M=y(()=>{const e=()=>clearTimeout(T.current);return{id:b,depth:0,path:x,open:(t,n)=>{e(),v(e=>N(e,t,n))},scheduleClose:t=>{e(),T.current=setTimeout(()=>v(e=>C(e,t)),200)},closeBelow:t=>{e(),v(e=>C(e,t))},cancelClose:e,closeTree:()=>{e(),v([]),c?.()},root:p}},[b,x,c]);g(()=>{if(!c)return;const e=e=>{e.target.closest("[data-menu-toggle]")||e.target.closest?.(`[data-popup-menu-tree="${b}"]`)||p.current&&!p.current.contains(e.target)&&c()},t=e=>{"Escape"===e.key&&c()};window.addEventListener("pointerdown",e),window.addEventListener("keydown",t);const n=r(c),o=s(()=>!1,()=>p.current);return()=>{window.removeEventListener("pointerdown",e),window.removeEventListener("keydown",t),n(),o()}},[c,b]),g(()=>{const e=p.current;e&&requestAnimationFrame(()=>{const t=e.getBoundingClientRect();if(t.right>window.innerWidth-8){const n=t.right-window.innerWidth+8;e.style.left?e.style.left=parseFloat(e.style.left)-n+"px":e.style.right||(e.style.left=t.left-n+"px")}if(t.left<8&&(e.style.left?e.style.left="8px":e.style.right&&(e.style.right=window.innerWidth-t.width-8+"px")),t.bottom>window.innerHeight-8){const n=t.bottom-window.innerHeight+8;e.style.top?e.style.top=parseFloat(e.style.top)-n+"px":e.style.bottom?e.style.bottom="8px":e.style.top=t.top-n+"px"}t.top<8&&(e.style.top?e.style.top="8px":e.style.bottom&&(e.style.bottom=window.innerHeight-t.height-8+"px"))})});const L=W(),R=/(^|[\s:])!?z-/.test(a),j=/* @__PURE__ */k("div",{ref:p,"data-popup-menu-tree":b,className:`fixed rounded-(--radius-popup) ${"tight"===L?"py-1":"large"===L?"py-2":"py-1"} ${a}`,onContextMenu:t=>{e(t.target)||t.preventDefault()},style:{...R?{}:{zIndex:o.menu},minWidth:d,animation:"popup-in 0.12s ease-out",...l(),...n},children:/* @__PURE__ */k($.Provider,{value:M,children:t})});return u?E?w(j,document.body):null:j}function j(e,t,n,r=!1){const o=W(),i="tight"===o?"0.25rem":"large"===o?"0.6rem":0;return{className:`w-full flex items-center gap-2 text-left transition-colors rounded-lg mx-auto\n ${e?"text-red-600 not-disabled:not-aria-disabled:hover:bg-red-50":r?"bg-accent-tint text-blue-700":"text-ink not-disabled:not-aria-disabled:hover:bg-accent-tint not-disabled:not-aria-disabled:hover:text-blue-700"}\n ${t?"opacity-40 cursor-not-allowed":""}\n ${n}`,style:{width:"calc(100% - 8px)",marginLeft:4,marginRight:4,fontSize:"var(--menu-font-size, 14px)",paddingLeft:"var(--menu-padding-x, 1rem)",paddingRight:"var(--menu-padding-x, 1rem)",paddingTop:i,paddingBottom:i,..."normal"===o?{minHeight:"calc(var(--row-height-menu, 2.25rem) + 2 * (var(--menu-padding-y, 0.5rem) - 0.5rem))"}:{}}}}var B=/* @__PURE__ */k(n,{name:"check","aria-hidden":!0,className:"h-4 w-4",strokeWidth:2});function D({kind:e,checked:t}){/* @__PURE__ */
|
|
2
|
+
return k("span","checkbox"===e?{"aria-hidden":!0,"data-menu-check":"",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded border "+(t?"border-blue-600 bg-blue-600 text-white":"border-gray-400"),children:t&&B}:{"aria-hidden":!0,"data-menu-check":"",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:t&&B})}var H=u(function({onClick:e,children:n,className:r="",danger:o,disabled:i,role:a,checked:l,icon:c,description:s,tabIndex:d,id:u,onMouseEnter:h},f){const g=p($),y=m(),b=null!=s&&!1!==s,w=`${u??y}-label`,N=`${u??y}-note`,C=p(L),T=j(o,i,r),E=void 0===l?null:"menuitemradio"===a?"radio":"checkbox";/* @__PURE__ */
|
|
3
|
+
return x("button",{ref:f,id:u,role:"radio"===E?"menuitemradio":"checkbox"===E?"menuitemcheckbox":a??(C?"menuitem":void 0),"aria-checked":E?l:void 0,"aria-labelledby":b?w:void 0,"aria-describedby":b?N:void 0,tabIndex:d,onClick:()=>{e?.(),g&&g.depth>0&&"checkbox"!==E&&g.closeTree()},onMouseEnter:()=>{g?.scheduleClose(g.depth),h?.()},disabled:i,className:T.className,style:T.style,children:[E&&/* @__PURE__ */k(D,{kind:E,checked:!!l}),b?
|
|
4
4
|
/* @__PURE__ */x("span",{className:"block min-w-0 flex-1 py-2",children:[
|
|
5
|
-
/* @__PURE__ */x("span",{className:"flex items-center gap-2",children:[null!=c&&/* @__PURE__ */k(
|
|
5
|
+
/* @__PURE__ */x("span",{className:"flex items-center gap-2",children:[null!=c&&/* @__PURE__ */k(P,{children:c}),
|
|
6
6
|
/* @__PURE__ */k("span",{id:w,className:"min-w-0",children:n})]}),
|
|
7
|
-
/* @__PURE__ */k("span",{id:N,"data-menu-note":"",className:
|
|
8
|
-
return k("span",{"aria-hidden":"true","data-menu-icon":"",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:e})}var
|
|
7
|
+
/* @__PURE__ */k("span",{id:N,"data-menu-note":"",className:t(),style:null!=c?{paddingLeft:"1.5rem"}:void 0,children:s})]}):/* @__PURE__ */x(v,{children:[null!=c&&/* @__PURE__ */k(P,{children:c}),n]})]})});function P({children:e}){/* @__PURE__ */
|
|
8
|
+
return k("span",{"aria-hidden":"true","data-menu-icon":"",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:e})}var A=/* @__PURE__ */k(n,{name:"chevron-right","aria-hidden":!0,className:"h-3.5 w-3.5 shrink-0 ml-auto",strokeWidth:2});function F(e){let t=o.menu;for(let n=e;n&&n!==document.body;n=n.parentElement){const e=parseInt(getComputedStyle(n).zIndex,10);Number.isNaN(e)||(t=e)}return t}function I(e){return e?[...e.querySelectorAll("button:not([disabled]), a[href]")].filter(t=>t.closest("[data-popup-submenu-panel]")===e):[]}function S({label:t,icon:n,children:r,disabled:o,className:i="",minWidth:c=180,maxHeight:d,rowProps:u}){const f=p($),N=m(),C=h(null),T=h(null),L=h(),R=h(!1),B=`${N}-menu`;g(()=>()=>clearTimeout(L.current),[]);const D=f?.depth??0,H=f?.path[D],P=!!H&&H.key===N&&!o,S=b(e=>{if(!f||o||!C.current)return;clearTimeout(L.current),R.current=e;const t=C.current.getBoundingClientRect(),n=C.current.closest("[data-popup-submenu-panel]")??C.current.closest("[data-popup-menu-tree]"),r=n?.getBoundingClientRect()??t,i=D>0&&(f.path[D-1]?.flipped??!1),a=M(r.left,r.right,c,window.innerWidth,4,i);f.open(D,{key:N,y:t.top,...a})},[f,o,D,N,c]),z=e=>{f?.closeBelow(D),C.current?.focus()};g(()=>{if(P)return s(e=>"Escape"===e.key&&(!(f&&f.path.length>D+1)&&(z(),!0)),()=>T.current)}),a(()=>{if(!P||!H)return;const e=()=>{const e=T.current;if(!e||!C.current)return;const t=C.current.closest("[data-popup-submenu-panel]")??C.current.closest("[data-popup-menu-tree]"),n=t?.getBoundingClientRect()??C.current.getBoundingClientRect(),r=D>0&&(f?.path[D-1]?.flipped??!1),o=e.offsetWidth||c,i=M(n.left,n.right,o,window.innerWidth,4,r,8),a=e.offsetHeight,l=E(C.current.getBoundingClientRect().top+a/2,a,8,window.innerHeight-8);e.style.left=`${i.left}px`,e.style.top=`${l}px`,e.dataset.flipped=String(i.flipped)};e();let t=0;const n=requestAnimationFrame(()=>{t=requestAnimationFrame(e)});return()=>{cancelAnimationFrame(n),cancelAnimationFrame(t)}}),g(()=>{P&&R.current&&(R.current=!1,I(T.current)[0]?.focus())},[P]);const U=y(()=>f&&{...f,depth:D+1},[f,D]);if(!f)throw new Error("PopupSubmenu must be rendered inside a PopupMenu");const q=j(!1,o,i,P),K=W();/* @__PURE__ */
|
|
9
9
|
return x(v,{children:[
|
|
10
|
-
/* @__PURE__ */x("button",{ref:C,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":
|
|
11
|
-
/* @__PURE__ */k("span",{className:"min-w-0 flex-1 truncate",children:
|
|
12
|
-
/* @__PURE__ */k("div",{ref:T,id:
|
|
10
|
+
/* @__PURE__ */x("button",{ref:C,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":P,"aria-controls":P?B:void 0,disabled:o,"data-popup-submenu-row":!0,className:q.className,style:q.style,onClick:e=>{const t=0===e.detail;P?t&&I(T.current)[0]?.focus():S(t)},...u,onKeyDown:e=>{"ArrowRight"===e.key&&(e.preventDefault(),e.stopPropagation(),S(!0))},onMouseEnter:()=>{u?.onMouseEnter?.(),o||(f.cancelClose(),P?f.closeBelow(D+1):(clearTimeout(L.current),L.current=setTimeout(()=>S(!1),120)))},onMouseLeave:()=>{clearTimeout(L.current),f.scheduleClose(D)},children:[n,
|
|
11
|
+
/* @__PURE__ */k("span",{className:"min-w-0 flex-1 truncate",children:t}),A]}),P&&w(
|
|
12
|
+
/* @__PURE__ */k("div",{ref:T,id:B,role:"menu","data-popup-menu-tree":f.id,"data-popup-submenu-panel":!0,className:"fixed rounded-(--radius-popup) overflow-x-hidden overflow-y-auto overscroll-contain "+("tight"===K?"py-1":"large"===K?"py-2":"py-1"),style:{left:H.left,top:H.y,minWidth:c,maxHeight:void 0===d?"calc(100vh - 16px)":`min(${"number"==typeof d?`${d}px`:d}, calc(100vh - 16px))`,zIndex:F(f.root.current)+D+1,animation:(H.flipped?"popup-submenu-in-left":"popup-submenu-in")+" 0.1s ease-out",...l()},onKeyDown:e=>{if(e.target.closest("[data-popup-submenu-panel]")!==e.currentTarget)return;const t=I(T.current),n=t.indexOf(document.activeElement),r=n=>{e.preventDefault(),e.stopPropagation(),t[(n+t.length)%t.length]?.focus()};"ArrowDown"===e.key?r(n+1):"ArrowUp"===e.key?r(n<0?t.length-1:n-1):"Home"===e.key?r(0):"End"===e.key?r(t.length-1):"ArrowLeft"===e.key&&(e.preventDefault(),e.stopPropagation(),z())},onMouseEnter:()=>{f.cancelClose(),clearTimeout(L.current)},onMouseLeave:()=>f.scheduleClose(D+1),onContextMenu:t=>{e(t.target)||t.preventDefault()},children:/* @__PURE__ */k($.Provider,{value:U,children:r})}),document.body)]})}function z(){const e=W();/* @__PURE__ */
|
|
13
13
|
return k("div",{className:`border-t ${c} ${"tight"===e?"my-0.5":"large"===e?"my-2":"my-1"} mx-3`})}function U(){const e=W(),t="tight"===e?"0.125rem":"large"===e?"0.375rem":"0.25rem";return{color:"var(--ink-muted)",paddingLeft:"var(--menu-padding-x, 1rem)",paddingRight:"var(--menu-padding-x, 1rem)",paddingTop:t,paddingBottom:t}}function q({children:e}){/* @__PURE__ */
|
|
14
|
-
return k("div",{className:"text-xs font-medium uppercase tracking-wide",style:U(),children:e})}function
|
|
15
|
-
return k("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */k("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})})}export{
|
|
14
|
+
return k("div",{className:"text-xs font-medium uppercase tracking-wide",style:U(),children:e})}function K({d:e,className:t="h-4 w-4"}){/* @__PURE__ */
|
|
15
|
+
return k("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */k("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})})}export{D as MenuCheckMark,K as MenuIcon,L as MenuSemanticsContext,R as PopupMenu,z as PopupMenuDivider,H as PopupMenuItem,q as PopupMenuLabel,S as PopupSubmenu,E as clampMenuTop,C as closeMenuBelow,j as itemLook,M as menuPanelLeft,U as menuTextRowStyle,N as openMenuLevel,T as resolveMenuLevels};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Card as e}from"./chunk-CBGKLHPB.js";import{Select_default as l}from"./chunk-
|
|
1
|
+
import{Card as e}from"./chunk-CBGKLHPB.js";import{Select_default as l}from"./chunk-ZLHPCPXS.js";import{FormField as a}from"./chunk-6KBDNYRW.js";import{Checkbox_default as r}from"./chunk-CGZBDI6C.js";import{Banner as i}from"./chunk-6FPDOEOX.js";import{Input_default as c}from"./chunk-MAMWQCJ6.js";import{Button_default as s}from"./chunk-NHH2MXFU.js";import{useState as d}from"react";import{jsx as n,jsxs as t}from"react/jsx-runtime";var h=[{name:"Mechanical keyboard",qty:1,price:129},{name:"USB-C cable (2m)",qty:2,price:12},{name:"Laptop stand",qty:1,price:48}];function m(){const[m,o]=d(!0),[p,u]=d("us"),y=h.reduce((e,l)=>e+l.qty*l.price,0),g=y+9;/* @__PURE__ */
|
|
2
2
|
return n("div",{className:"h-full overflow-auto bg-gray-50 p-6",children:/* @__PURE__ */t("div",{className:"mx-auto max-w-5xl space-y-5",children:[
|
|
3
3
|
/* @__PURE__ */n("h1",{className:"text-xl font-semibold text-gray-900",children:"Checkout"}),
|
|
4
4
|
/* @__PURE__ */t("div",{className:"grid grid-cols-1 gap-5 lg:grid-cols-3",children:[
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{requestFilesTrashView as n}from"./chunk-
|
|
1
|
+
import{requestFilesTrashView as n}from"./chunk-XAROKI7X.js";var o=null;function r(n){o=n}function t(){return o}function u(){n()}export{t as getFilesDemoTree,u as openFilesInTrashMode,r as setFilesDemoTree};
|
|
@@ -0,0 +1,100 @@
|
|
|
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-E3RHEEA6.js";import{CMD_Z as p,CMD_SHIFT_Z as f}from"./chunk-ZDMZM7HD.js";import{CopyButton as w}from"./chunk-3V6ZERBS.js";import{confirm as y}from"./chunk-GVY2X4CC.js";import{ItemCount as g}from"./chunk-GMRZX2ET.js";import{isInOverlayOver as v}from"./chunk-SDI2UGAG.js";import{dialogA11y as b}from"./chunk-VWGWZY7A.js";import{ColoredBadge as x}from"./chunk-RKFEJ5CX.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-MH6DI6YY.js";import{StatusBadge as z}from"./chunk-LNARMEEZ.js";import{Button_default as A}from"./chunk-NHH2MXFU.js";import{Icon as D}from"./chunk-KKSVRIMP.js";import{LoadingSpinner as P}from"./chunk-R2VKEMZH.js";import{Z_LAYERS as I}from"./chunk-62LW225J.js";import{runEscapeInterceptors as R}from"./chunk-TWVUQUUD.js";import{useShellStrings as K}from"./chunk-X2PZMXDP.js";import{createContext as W,useContext as $,Component as O,useLayoutEffect as j,useRef as F,useEffect as q,useState as H,useSyncExternalStore as B,useCallback as U,isValidElement as Y,Fragment as X,Children as V,cloneElement as G,useMemo as _,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=W(null);function ge(){return $(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 O{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=W(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=$(Le),r=K().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 Re(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 Ke(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 We=(e,t)=>!!t&&"page"===e.type&&e.route===t;function $e(){const e=K().loading;/* @__PURE__ */
|
|
11
|
+
return te(P,{size:"sm",padding:"p-8",label:e.label})}var Oe="flex-1 min-h-0";function je(){const e=K().record;/* @__PURE__ */
|
|
12
|
+
return te(P,{label:e.loading,padding:"",className:Oe})}function Fe(e){return e??void 0}function qe({isPending:e,isFetching:t,enabled:n=!0,error:r,onRetry:o}){const i=K().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:Oe});if(403===e)/* @__PURE__ */
|
|
14
|
+
return te(m,{status:"403",className:Oe});if(404===e||410===e)/* @__PURE__ */
|
|
15
|
+
return te(m,{status:"404",title:i.notFound,className:Oe});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:Oe})}/* @__PURE__ */
|
|
17
|
+
return te(m,{status:"404",title:i.notFound,className:Oe})}function He({entity:e,children:t,...n}){return null!=e?/* @__PURE__ */te(ne,{children:t(e)}):/* @__PURE__ */te(qe,{...n})}var Be=/^[a-z]+(?:-[a-z]+)*-\d{13}$/;function Ue(e){return"string"==typeof e&&(e.startsWith("new-")||Be.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=W({openWindows:[],openEntity:()=>{},openPage:()=>{},reorderWindows:()=>{},closeEntity:()=>{},minimize:()=>{},items:[],restore:()=>{},remove:()=>{},restoreIfMinimized:()=>!1,openItems:[]}),Ve=W(null);function Ge(e){const t=$(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 _e(){const e=F(/* @__PURE__ */new Map),[t,n]=H(!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 $(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}=_e(),i=de[e.route];if(!i||!se(i))return null;const a=i,s=a.component;/* @__PURE__ */
|
|
18
|
+
return te(Gr,{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($e,{})}),children:/* @__PURE__ */te(s,{})})})})}function et({entityType:e,entityId:t,label:n}){const r=K(),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]=H(!1),{dirty:l,registerDirty:u}=_e(),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($e,{}),children:i.render(w??e.entitySnapshot,t,e.entityId,a,s)}):null!=w?/* @__PURE__ */te(Q,{fallback:/* @__PURE__ */te(Gr,{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(Gr,{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(Gr,{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(He,{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=K(),l=F(null),[c,u]=H({w:n,h:Math.round(.75*r)}),[d,h]=H(!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=K(),s=e.length>1,l=F(null),[c,u]=H({left:-9999,top:-9999,ready:!1}),[d,h]=H(()=>"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=K(),[a,s]=H(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=B(Nr,Mr),[,u]=H(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]=H(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]=H(null),[f,w]=H(null),[y,v]=H(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)?G(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=$n.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]=H([]),a=F(o);j(()=>{a.current=o},[o]);const s=B(Ee,ke,ke),l=F(/* @__PURE__ */new Map),c=e=>{const t=Re(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&<.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(!Re(t))return e.length;if(t.shellOwned&&We(t,n.home))return 0;const r=We(t,n.home)?void 0:Ke(t)?.key;if(r){let t=-1;if(e.forEach((e,o)=>{Re(e)&&!We(e,n.home)&&Ke(e)?.key===r&&(t=o)}),t>=0)return t+1}if("page"===t.type&&t.route&&!We(t,n.home)&&n.favorites.includes(t.route))return e.length>0&&We(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=>Re(e[t])&&!We(e[t],n.home)?Ke(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,Hn.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(Gr,{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 Rt(){const e=zt;return zt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},e}var Kt=/* @__PURE__ */new Set([z,x]),Wt=e=>Kt.has(e)||"function"==typeof e&&"badge"===e.titleRole,$t=/* @__PURE__ */new Set(["button","a","input","select","textarea","kbd"]),Ot=/* @__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(Ot.has(r.type))return;if(!$t.has(r.type))return n.push(" "),V.toArray(r.props.children).forEach(e=>Ft(e,t,n)),void n.push(" ")}const o=G(r,{key:`title-part-${t.accessories.length}`});t.accessories.push(o),(Wt(r.type)?t.badges:t.actions).push(o)}var qt=/* @__PURE__ */new Map,Ht=/* @__PURE__ */new Set,Bt=0;function Ut(){Bt++,Ht.forEach(e=>e())}function Yt(e){return qt.get(e)}function Xt(e){return Ht.add(e),()=>{Ht.delete(e)}}function Vt(){return Bt}var Gt=W(""),_t=W(null);function Jt({spec:e,children:t}){/* @__PURE__ */
|
|
45
|
+
return te(_t.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=$(Gt);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=$(Gt);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=W(null);function un(){return $(Gt)}function dn(){const e=B(Nr,Mr),t=$(cn);return t?.active??(zn.length<=1||null!=e)}function hn({children:e,position:t="right",quiet:n=!1}){const r=$(cn),[o,i]=H(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=$(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 Rn=0;function Kn(){return Rn}function Wn(){Rn++,An.forEach(e=>e())}var $n=/* @__PURE__ */new Map,On=/* @__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 B(Nr,Fn,()=>null)}var Hn=/* @__PURE__ */new Set;var Bn=null;function Un(e){Bn=null,er(e)}function Yn(e){Bn=e;const t=$n.get(e);t&&Un(t)}var Xn=/* @__PURE__ */new Map;function Vn(e){return Xn.get(e)?.holdsChanges()??!1}function Gn(e){const t=Xn.get(e);return t?t.ask():Promise.resolve(!0)}function _n(e){Bn===e&&(Bn=null)}function Jn(e,t,n){if(n&&jn.set(e,n),t)if($n.set(t,e),On.set(e,t),Hn.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=On.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);Wn(),window.dispatchEvent(new CustomEvent("modal-reorder")),t&&Bn===t&&Un(e)}function Zn(e){return e?jn.get(e)?.owner??On.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 o=jn.get(e);if(o?.root&&o.tab&&r()){const e=zn.filter(e=>{const t=jn.get(e);return!!t&&!t.root&&t.owner===o.owner});for(const t of e)zn.splice(zn.indexOf(t),1),zn.push(t)}Dn.delete(e);const i=On.get(e);if(i){const e=vn.indexOf(i);-1!==e&&vn.splice(e,1),vn.push(i),xn(),Bn&&Bn!==i&&(Bn=null)}Wn(),window.dispatchEvent(new CustomEvent("modal-reorder"));const a=Zn(Mr());a&&a!==t&&Qn.forEach(e=>e(a))}function tr(e){const t=zn.indexOf(e);-1!==t&&zn.splice(t,1),Dn.add(e),In.set(e,++Pn);const n=On.get(e);if(n){const e=vn.indexOf(n);-1!==e&&(vn.splice(e,1),xn())}Wn(),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]=H(!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,o=jn.get(e);if(!o||o.root||!o.tab||!r())return n;let i=-1;for(const[e,t]of jn){if(!t.root||t.owner!==o.owner)continue;const n=zn.indexOf(e);-1!==n&&(i=Math.max(i,I.window+n*I.windowStep))}return i>=n?i+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=$n.get(e);return null!=t&&nr.has(t)}),xn(),Wn(),window.dispatchEvent(new CustomEvent("modal-reorder"))});var Sr="modal-close-request";function Lr(e){B(Nr,Kn);const t=$(cn);if(zn.length<=1)return!0;if(e){const t=$n.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 Rr(){Pr(!1)}var Kr=null,Wr=/* @__PURE__ */new Set;function $r(e){return Wr.add(e),()=>Wr.delete(e)}function Or(){return Kr}function jr(e){Kr!==e&&(Kr=e,Wr.forEach(e=>e()))}var Fr=null,qr=/* @__PURE__ */new Set;function Hr(e){return qr.add(e),()=>qr.delete(e)}function Br(){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=B(Ar,Dr),[t,n]=H(e),[r,o]=H(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 Gr({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:W,allowPinOnTop:O,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]=H(()=>r()),we=k()&&!pe,ge=E()&&!!V,[ve,be]=H(0),[xe,ke]=H(!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=B(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]=H(c),De=K(),Pe=De.window;q(()=>{Ae(c)},[c]);const Ie=_(()=>tn(Te).trim()||void 0,[Te]),Re=J(),[Ke,We]=H(!1),$e=F(!1),[Oe,je]=H(!1),[Fe,qe]=H(null),He=$(_t),Be=$(ye),{prefs:Ue,save:Ye}=M(),Xe=!!Ue.window_accent_stripe,Ve=Ue.favorite_documents||[],_e=!!He&&Ve.some(e=>e.entityType===He.entityType&&e.entityId===He.entityId),Ze=U(()=>{if(!He)return;const e=_e?Ve.filter(e=>!(e.entityType===He.entityType&&e.entityId===He.entityId)):[...Ve,{entityType:He.entityType,entityId:He.entityId,label:He.label}];Ye({favorite_documents:e})},[He,_e,Ve,Ye]),[Qe,et]=H(null),[tt,nt]=H("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]=H(!1),dt=F(null),ht=F(null),mt=F(null),[pt,ft]=H(!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=!!W&&!V&&!Z&&!Q&&(W.editing||"hidden"!==W.state),yt=!!(w||T||z)||ct||wt,gt=$(Le),vt=""!==$(Gt),bt=F(null);bt.current=Be?{owner:Be.key,tab:Be.tab,root:!vt}:null;const xt=ue||(Be&&!vt?Be.key:null),kt=!!gt&&!vt&>.enabled&>.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)?G(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(),Rt=F(`modal-${Math.random().toString(36).slice(2,8)}`).current;q(()=>{if(V)return nr.add(Rt),()=>{nr.delete(Rt)}},[V,Rt]),q(()=>{const e=e=>{const t=e.detail;t?.id===Rt&&Ae(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[Rt]);const[Kt,Wt]=H(I.window),$t=function(e){const t=B(Nr,Mr);return zn.length<=1||t===e}(Rt),Ot=F(W);Ot.current=W;const Ft=!!W&&!W.editing&&"enabled"===W.state;q(()=>{if(!t||!$t||!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(),Ot.current?.onEdit()))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,$t,Ft]);const Ht=function(e){return B(Nr,()=>Dn.has(e))}(Rt);Et({panelRef:ot,bodyRef:at,open:t,widget:!!V,active:$t,minimized:Ht});const Bt=B(Ar,Dr),Yt=B($r,Or),Xt=B(Hr,Br),Vt=!O&&!V,Jt=Bt&&Vt,[Zt,nn]=H(!1),rn=Jt&&Xt===Rt,[an,sn]=H(!1),ln=an&&Vt&&Yt===Rt?"picked":null,un=F(Jt);q(()=>{if(un.current&&!Jt){sn(!0);const e=setTimeout(()=>{sn(!1),Kr===Rt&&jr(null)},700);return un.current=Jt,()=>clearTimeout(e)}un.current=Jt},[Jt,Rt]),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(Rt,wn,bt.current??void 0),ue||er(Rt),dn.current=!1,Wt(Cr(Rt));const e=()=>{Wt(Cr(Rt))},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(Rt),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}),Bn(!1)},i=e=>{const t=e.detail;r(t)&&(er(Rt),qe({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==ue)return;er(Rt);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),Wn()),Dn.delete(e),In.delete(e),jn.delete(e);const n=On.get(e);n&&(On.delete(e),$n.delete(n))}(Rt),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,Rt,wn,hn]);const gn=!V&&"maximized"===Ln(),[vn,bn]=H(()=>{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]=H(()=>!ie),En=F(pe),Cn=F(null);q(()=>{const e=()=>{const e=r();e!==En.current&&Cn.current?.(e),En.current=e,fe(e),Wt(Cr(Rt))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[Rt]);const Mn=pe&&!!Be?.tab&&!vt&&!V&&!we,An=Mn,Pn=F(An);Pn.current=An;const Rn=qn(),Kn=pe&&!!Be?.tab&&!V&&!we&&!Bt&&Rn!==Be.key,Fn=!!V&&pe&&!Bt&&null!==Rn,[Hn,Bn]=H(()=>wn&&fn[wn]||C?An:An||gn),Un=F(vn);Un.current=vn;const Yn=F(Hn);j(()=>{Yn.current=Hn},[Hn]),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||Hn)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,Hn,ae]);const Vn=!1!==se&&!V&&!Q&&!we,[Gn,_n]=H(()=>!Vn);j(()=>{if(Gn||!t)return;if(!Vn||Hn)return void _n(!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=()=>_n(!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)}},[Gn,t,Vn,Hn]);const Zn=F(null),Qn=!(!Be?.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,Bn(!0),void bn(o);const i=r?.box??(wn?fn[wn]:void 0);if(Yn.current=!1,Bn(!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,Bn(!0),bn(hn()))},[An,hn]),q(()=>{if(V)return;const e=()=>{const e=wn?fn[wn]:void 0;if(Yn.current=!1,Bn(!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 Hn&&(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,Hn,hn]),q(()=>{if(t&&(We(!1),$e.current=!1,rt.current=!1,_n(!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}),Bn(C.maximized))}},[t]),q(()=>{if(!t||"auto"!==m)return;let e;const n=t=>{ot.current?.contains(t.target)&&!$e.current&&($e.current=!0,e=setTimeout(()=>We(!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?Ke:!0===m,sr=Be&&!vt?Be.key:null,dr=_(()=>jt(Te),[Te]),mr=F({shortcutSpec:He,isOnDesktop:_e,toggleDesktopShortcut:Ze,taskbarStrings:De.taskbar});j(()=>{mr.current={shortcutSpec:He,isOnDesktop:_e,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[Rt]||[])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]),Ge(!(ue||!t)&&ar);const yr=U(()=>ar||"auto"===m&&$e.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")&&($e.current=!1,We(!1),Ot.current?.onDiscard())},[gr]),Tr=U(async()=>{const e=await gr("switch");return e&&($e.current=!1,We(!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),Rr=U(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(qe(null),er(Rt),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;Bn(!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)},[]),Wr=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;Bn(!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(Rt),"Enter"===e.key)return void(Hn?(Bn(!1),bn(mn())):(Bn(!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(),Bn(!0),void bn(hn());if(r>0){if(Hn)return Bn(!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(Rt)}e(),Bn(!1);const t=hr(n<0?"left":"right");return Un.current=t,void bn(t)}if(Hn)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)},[Rt,Hn,mn,hn]),qr=U(e=>{Ir.current||(Ir.current={...Un.current}),Bn(!1);const t=hr(e);Un.current=t,bn(t),er(Rt)},[Rt]),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=()=>{Bn(!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]===Rt&&!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,Rt,V]),q(()=>{if(!t)return;const e=e=>{zn[zn.length-1]===Rt&&(v(e.target,ot.current)||((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:Rt}})),$e.current=!1,We(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:Rt}})))))};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]===Rt){if(R(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,Rt,V,Mn,P]);const Vr=t&&(void 0!==p||void 0!==f),[Gr]=H(()=>{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}),_r=Mn&&!Be?.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:_r&&Gr?Gr:void 0,menu:wr.current??void 0})},[t,sr,Ie,ar,dr.text,dr.copy,_r,Gr]);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]!==Rt)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,Rt]),!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}}(Rt):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?!Be?.home:!we)?Re:void 0,label:dr.text||Ie}),no=/* @__PURE__ */ee("div",{children:[
|
|
50
|
+
/* @__PURE__ */ee("div",{ref:ot,"data-modal-panel":!0,"data-modal-id":Rt,"data-window-key":ue||void 0,...O?{"data-utility":""}:{},...Oe?{"data-pinned-top":""}:{},...V?{"data-widget":""}:{},...Be?{"data-window-owner":Be.key}:{},...Be&&!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?$t?"shadow-xl":"shadow-lg":"border "+($t?"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(Rt),Pr(!1),void er(Rt)}if(!$t&&!V&&!Oe&&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(Rt),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(Rt))},style:we?{zIndex:Kt+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"}:{},...Kt<0?{display:"none"}:{},...$t||Oe||Ne&&ue===Ne?{}:{display:"none"}}:{zIndex:Oe?I.pinnedWindow:Kt+1,width:vn.w,height:vn.h,top:vn.y,...V&&"right"===tt?{right:window.innerWidth-vn.x-vn.w}:{left:vn.x},...Kt<0&&!Oe?{display:"none"}:{},...ge?{display:"none"}:{},...Kn||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?Be?.home?null:/* @__PURE__ */ee(ne,{children:[
|
|
51
|
+
/* @__PURE__ */te("h2",{id:Re,"data-window-title":!0,className:"sr-only",children:dr.text||Ie}),_r&&Gr&&re(
|
|
52
|
+
/* @__PURE__ */te(ne,{children:dr.actions}),Gr),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:Rr,"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 "+($t?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:$t?"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:$t?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Jt&&Tt(),
|
|
55
|
+
/* @__PURE__ */te("span",{id:Re,className:"truncate",children:Jt?tn(Te):Te})]}),!Jt&&/* @__PURE__ */ee("div",{className:"flex items-center gap-2 shrink-0 ml-2",children:[O&&/* @__PURE__ */te("button",{onClick:()=>je(e=>!e),title:Oe?Pe.unpin:Pe.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+(Oe?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */te(D,{name:"bookmark-square",className:"h-3 w-3",fill:Oe?"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:Rr,"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 "+($t?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:$t?"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:$t?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Jt&&Tt(),
|
|
58
|
+
/* @__PURE__ */te("span",{id:Re,className:"truncate",children:Jt?tn(Te):Te})]}),!Jt&&/* @__PURE__ */ee("div",{className:"flex items-center gap-2 shrink-0 ml-2",children:[O&&/* @__PURE__ */te("button",{onClick:()=>je(e=>!e),title:Oe?Pe.unpin:Pe.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+(Oe?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */te(D,{name:"bookmark-square",className:"h-3 w-3",fill:Oe?"currentColor":"none",strokeWidth:1.5})}),
|
|
59
|
+
/* @__PURE__ */te("button",{onClick:()=>tr(Rt),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:Hn,onToggleMax:()=>{Hn?(Bn(!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:Rr,"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 "+($t?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:$t?"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:$t?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Jt&&Tt(),
|
|
62
|
+
/* @__PURE__ */te("span",{id:Re,className:"truncate",children:Jt?tn(Te):Te})]}),!Jt&&/* @__PURE__ */ee("div",{className:"flex items-center gap-3 shrink-0 ml-4",children:[O&&/* @__PURE__ */te("button",{onClick:()=>je(e=>!e),title:Oe?Pe.unpin:Pe.pinOnTop,className:"text-xs px-2 py-1 rounded hover:bg-gray-200 "+(Oe?"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:Oe?"currentColor":"none",strokeWidth:1.5})}),
|
|
63
|
+
/* @__PURE__ */te("button",{onClick:()=>tr(Rt),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:Hn,onToggleMax:()=>{Hn?(Bn(!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) / ${$t?.9:.55})`}}),
|
|
65
|
+
/* @__PURE__ */te(Gt.Provider,{value:Rt,children:/* @__PURE__ */te(cn.Provider,{value:{rightRef:st,leftRef:lt,notify:()=>ut(!0),active:$t,isDirty:ar,footerOpen:yt&&!V&&!Z&&!Q&&!we},children:/* @__PURE__ */te("div",{ref:at,...V?{onPointerDown:Rr,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))":$t?"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:Rt}))},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"}),Oe&&/* @__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:Rr,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"}${$t&&!Mn?" backdrop-blur-sm":""}${V||Z||Q||we||!yt?" hidden":""}`,style:{touchAction:"none",backgroundColor:Mn?"rgb(var(--window-footer-rgb))":$t?"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&&W&&(W.editing?/* @__PURE__ */te(A,{variant:"secondary",size:"sm","data-modal-discard":"",onClick:()=>{Lr()},children:Pe.discard}):"object"==typeof W.state?/* @__PURE__ */te(A,{variant:"secondary",size:"sm","data-modal-edit":"","aria-disabled":!0,disabledReason:W.state.disabledReason,children:Pe.edit}):/* @__PURE__ */te(A,{variant:"secondary",size:"sm","data-modal-edit":"",onClick:()=>W.onEdit(),children:Pe.edit})),
|
|
78
|
+
/* @__PURE__ */te("div",{ref:st,"data-modal-actions":!0,className:"flex items-center gap-2"}),T]})]}),!V&&!we&&!Jt&&$t&&!An&&/* @__PURE__ */ee(ne,{children:[
|
|
79
|
+
/* @__PURE__ */te("div",{onPointerDown:e=>Wr(e,"se"),className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize z-10"}),
|
|
80
|
+
/* @__PURE__ */te("div",{onPointerDown:e=>Wr(e,"sw"),className:"absolute bottom-0 left-0 w-3 h-3 cursor-nesw-resize z-10"}),
|
|
81
|
+
/* @__PURE__ */te("div",{onPointerDown:e=>Wr(e,"ne"),className:"absolute top-0 right-0 w-3 h-3 cursor-nesw-resize z-10"}),
|
|
82
|
+
/* @__PURE__ */te("div",{onPointerDown:e=>Wr(e,"nw"),className:"absolute top-0 left-0 w-3 h-3 cursor-nwse-resize z-10"}),
|
|
83
|
+
/* @__PURE__ */te("div",{onPointerDown:e=>Wr(e,"n"),className:"absolute top-0 left-3 right-3 h-1 cursor-ns-resize"}),
|
|
84
|
+
/* @__PURE__ */te("div",{onPointerDown:e=>Wr(e,"s"),className:"absolute bottom-0 left-3 right-3 h-1 cursor-ns-resize"}),
|
|
85
|
+
/* @__PURE__ */te("div",{onPointerDown:e=>Wr(e,"e"),className:"absolute top-3 bottom-3 right-0 w-1 cursor-ew-resize"}),
|
|
86
|
+
/* @__PURE__ */te("div",{onPointerDown:e=>Wr(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(Rt),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(Rt),qe(null)},children:[
|
|
88
|
+
/* @__PURE__ */te(D,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),Pe.minimize]}),!An&&/* @__PURE__ */ee(S,Hn?{onClick:()=>{Bn(!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]})]}),O&&!Mn&&/* @__PURE__ */ee(S,{onClick:()=>{je(e=>!e),qe(null)},children:[
|
|
91
|
+
/* @__PURE__ */te(D,{name:"bookmark-square",className:"h-4 w-4 "+(Oe?"text-blue-600":""),fill:Oe?"currentColor":"none",strokeWidth:1.5}),Oe?Pe.unpin:Pe.pinOnTop]}),He&&/* @__PURE__ */ee(S,{onClick:()=>{qe(null),Ze()},children:[
|
|
92
|
+
/* @__PURE__ */te(D,{name:"star",className:"h-4 w-4",fill:_e?"currentColor":"none",strokeWidth:1.5}),_e?De.taskbar.removeFromDesktop:De.taskbar.addToDesktop]}),(on[Rt]||[]).length>0&&/* @__PURE__ */te(ne,{children:(on[Rt]||[]).map((e,t)=>/* @__PURE__ */ee(S,{onClick:()=>{qe(null),e.onClick()},children:[e.icon,e.label]},t))}),!(Mn&&Be?.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=!Ht||oo||V?null:/* @__PURE__ */ee("div",{"data-modal-restore-tab":!0,"data-modal-id":Rt,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(Rt),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(Rt),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(_t.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 _r=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>_r?r.slice(r.length-_r):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]=H(0),u=l>0,[d,h]=H(0),[m,p]=H(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]=H(0),S=M>0,L=U(e=>{N(t=>t+(e?1:-1))},[]),T=$(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]),R=U(e=>{for(const[t,n]of Object.entries(e)){const e=s.current.get(t);e&&(e.setLast(n),e.apply(n))}},[]),K=U(()=>{const e=o.past[o.past.length-1];if(!e)return;const t={values:b(),label:e.label,coalesceKey:null};R(e.values),a({type:"undo",redoStep:t})},[o.past,b,R]),W=U(()=>{const e=o.future[0];if(!e)return;const t={values:b(),label:e.label,coalesceKey:null};R(e.values),a({type:"redo",undoStep:t})},[o.future,b,R]),[O,j]=H(0),B=F(0),Y=F(0),X=F(!1),V=U(()=>{v.current=!0,P.current=!1,g.current=null,B.current+=1,Y.current=B.current,j(B.current)},[]),G=F(void 0),J=U(e=>{void 0!==e&&(void 0!==G.current&&e!==G.current&&(X.current=!0),G.current=e),V()},[V]);q(()=>{v.current&&O===Y.current&&(v.current=!1,g.current=null,(P.current||X.current)&&a({type:"clear"}),P.current=!1,X.current=!1)},[O]);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:K,redo:W,canUndo:ne,canRedo:re});ie.current={undo:K,redo:W,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=_(()=>({register:x,unregister:k,record:I,undo:K,redo:W,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,K,W,Q,J,ne,re,y,u,S,L,E,f,C,o.past,o.future]),se=""!==un(),le=$(cn)?.footerOpen??!1,ce=se&&y&&u&&!S&≤/* @__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=$(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=$(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=$(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]=H(e);return io(n,e=>r(()=>e),t),[n,r]}export{mn as CancelButton,et as DocFavStar,qe as EntityWindowFallback,je as EntityWindowLoading,He as EntityWindowState,en as KEY_ACTIVATED_SELECTOR,$e as LoadingSpinner,Qt as MODAL_SUBMIT_SELECTOR,Gr 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,_n as cancelWindowFront,we as client_default,Yr as commitExposeHighlight,Gn as confirmWindowDiscard,Rt as drainPerfEvents,Rr as exitExposeMode,Mn as forgetMaximizedWindowBoxes,Mr as getActiveModalId,ct as getActiveWindowRoute,Br as getExposeHighlight,Vt as getWindowChromeVersion,En as getWindowPosition,Ue as isDraftEntityId,Ye as isDraftEntityWindow,le as isEntityEntry,se as isPageEntry,pe as isShellApiClientConfigured,Re 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,Hr as subscribeExposeHighlight,Xt as subscribeWindowChrome,Ke 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,Ge as useWindowDirty,Je as useWindowManager,an as useWindowMenuItem,ln as useWindowTitle,Vn as windowHoldsChanges};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{DropdownMenu as e}from"./chunk-ACVKU6YW.js";import{Button_default as i}from"./chunk-NHH2MXFU.js";import{iconButtonClasses as n}from"./chunk-UQYNPYF4.js";import{Icon as r}from"./chunk-KKSVRIMP.js";import{Tooltip as a}from"./chunk-BCDG4N6L.js";import{forwardRef as l,useId as o}from"react";import{jsxs as s,jsx as t}from"react/jsx-runtime";var d="relative focus-visible:z-10",m={secondary:"border-l-0",primary:"border-l border-white/30",warning:"border-l border-white/30"},c=l(function({children:l,onClick:c,type:b="button",items:h,menuLabel:u,variant:f="primary",size:p="md",loading:v=!1,leftIcon:k,disabled:N=!1,disabledReason:g,tooltip:w,menuDisabled:x=!1,menuDisabledReason:j,onMenuOpenChange:y,menuFooter:C,menuFooterLabel:W,align:z="end",side:F="bottom",menuMinWidth:L,linkAs:M,block:R=!1,className:A=""},D){const I=N&&(null!=g&&""!==g&&!1!==g)&&!v,K=x&&null!=j&&""!==j&&!1!==j,U=o(),Y=/* @__PURE__ */t(i,{ref:D,type:b,variant:f,size:p,loading:v,leftIcon:k,block:R,disabled:N&&!I,"aria-disabled":!!I||void 0,disabledReason:I?g:void 0,onClick:c,className:`rounded-r-none ${d}`,children:l}),$=R?"relative flex min-w-0 flex-1":"relative inline-flex",B=p.startsWith("touch")?"h-5 w-5":"h-4 w-4";/* @__PURE__ */
|
|
2
|
+
return s("div",{className:[R?"flex w-full":"inline-flex","items-stretch",A].filter(Boolean).join(" "),children:[null==w||""===w||I?Y:/* @__PURE__ */t(a,{content:w,className:$,children:Y}),
|
|
3
|
+
/* @__PURE__ */t(a,{content:K?j:u,describe:!1,className:"relative inline-flex shrink-0",children:/* @__PURE__ */t(e,{"aria-label":u,"aria-describedby":K?U:void 0,items:h,align:z,side:F,minWidth:L,linkAs:M,disabled:x&&!K,"aria-disabled":K,onOpenChange:y,footer:C,footerLabel:W,triggerClassName:n({variant:f,size:p,className:`rounded-l-none ${m[f]} ${d}`}),trigger:/* @__PURE__ */t(r,{name:"chevron-down",className:B,strokeWidth:2,"aria-hidden":"true"})})}),K&&/* @__PURE__ */t("span",{id:U,className:"sr-only",children:j})]})});export{c as SplitButton_default};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{writeClipboard as e}from"./chunk-VC42SDAC.js";import{IconButton_default as r}from"./chunk-RUTUVS4H.js";import{toast_default as t}from"./chunk-OQW42DOR.js";import{Icon as n}from"./chunk-
|
|
1
|
+
import{writeClipboard as e}from"./chunk-VC42SDAC.js";import{IconButton_default as r}from"./chunk-RUTUVS4H.js";import{toast_default as t}from"./chunk-OQW42DOR.js";import{Icon as n}from"./chunk-KKSVRIMP.js";import{useShellStrings as a}from"./chunk-X2PZMXDP.js";import{useState as i,useRef as o,useEffect as c,useCallback as l}from"react";import{jsxs as m,jsx as s,Fragment as d}from"react/jsx-runtime";var u={bordered:"border border-gray-300 bg-white",flat:"bg-gray-100"},p={sm:{box:"gap-2 px-3 py-1 text-xs",button:"-my-1"},md:{box:"gap-2 px-3 min-h-8 py-1 text-sm",button:"-my-0.5"}};function b(){/* @__PURE__ */
|
|
2
2
|
return s(n,{name:"copy",className:"h-4 w-4","aria-hidden":"true"})}function h(){/* @__PURE__ */
|
|
3
|
-
return s(n,{name:"check",className:"h-4 w-4 text-green-600","aria-hidden":"true"})}function y({value:n,children:y,symbol:f,label:x,size:g="md",variant:k="bordered",hideCopyButton:v=!1,onCopy:w,multiline:N=!1,id:j,"aria-describedby":C,className:T=""}){const[D,P]=i(!1),
|
|
4
|
-
return m("div",{id:
|
|
3
|
+
return s(n,{name:"check",className:"h-4 w-4 text-green-600","aria-hidden":"true"})}function y({value:n,children:y,symbol:f,label:x,size:g="md",variant:k="bordered",hideCopyButton:v=!1,onCopy:w,multiline:N=!1,id:j,"aria-describedby":C,className:T=""}){const[D,P]=i(!1),R=o(null),S=a().copy;c(()=>()=>{R.current&&clearTimeout(R.current)},[]);const V=l(async()=>{await e(n)?(P(!0),R.current&&clearTimeout(R.current),R.current=setTimeout(()=>{P(!1),R.current=null},2e3),w?.(n)):t.error(S.failed)},[n,w,S]),{box:B,button:K}=p[g],M=!v;/* @__PURE__ */
|
|
4
|
+
return m("div",{id:M?void 0:j,"aria-describedby":M?void 0:C,className:["inline-flex max-w-full items-center rounded-md",u[k],B,T].filter(Boolean).join(" "),children:[null!=f&&""!==f&&/* @__PURE__ */s("span",{"aria-hidden":"true",className:"shrink-0 select-none font-mono text-gray-400",children:f}),
|
|
5
5
|
/* @__PURE__ */s("span",{className:"min-w-0 font-mono text-gray-800 "+(N?"whitespace-pre-wrap break-all":"truncate"),title:N?void 0:n,children:y??n}),!v&&/* @__PURE__ */m(d,{children:[
|
|
6
|
-
/* @__PURE__ */s(r,{id:j,"aria-label":x?
|
|
7
|
-
/* @__PURE__ */s("span",{"aria-live":"polite",className:"sr-only",children:D?
|
|
6
|
+
/* @__PURE__ */s(r,{id:j,"aria-label":x?S.copyLabel(x):S.copy,"aria-describedby":C,onClick:V,className:`${K} text-gray-400`,children:/* @__PURE__ */s(D?h:b,{})}),
|
|
7
|
+
/* @__PURE__ */s("span",{"aria-live":"polite",className:"sr-only",children:D?S.copied:""})]})]})}export{y as Snippet};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import{TimelineCard as e}from"./chunk-S4Z657L6.js";import{TimelineGlyph as t,TimelineProgressIcon as r,TimelineTrack as n}from"./chunk-YL6LLHJA.js";import{toDayMs as a,fmtSliderDate as o,DAY_MS as i}from"./chunk-YDEIXM2A.js";import{Icon as s}from"./chunk-
|
|
2
|
-
return b("div",{className:"select-none",children:/* @__PURE__ */b(n,{axis:_?"spread":"linear",labels:_?"none":"active",endMark:_?v:null,items:x,markers:D,startMs:e,endMs:t,activeKey:s,onActivate:e=>{const t=P.get(e);null!=t&&l(t),p(e)},playback:k,edgeCaptions:f,thumb:{valueMs:i,onChange:l,onDragStart:g,stops:S,ariaLabel:M.scrub,valueText:e=>{const t=(e=>N.find(t=>t.ms===e)?.report)(e);return t?`${y(t)} · ${o(e,w)}`:o(e,w)}},ariaLabel:M.label(o(e,w),o(t,w))})})}function N({snapshot:n,onPickReport:i,onOpenReport:l,onOpenMarker:m,renderReportPreview:k,onScrubProgress:f,heading:_,edgeCaptions:M,reportLabel:N=e=>e.progress_number,resetLabel:x,variant:P="card",onPlayStart:S}){const{reports:D,markers:C,poNumber:R,startMs:O,endMs:q,totalLeadDays:L,scrubMs:A,setScrubMs:I,displayed:T,scrubbedAway:j,resetToCurrent:$,currentReportId:F,currentReportProgressNumber:
|
|
3
|
-
/* @__PURE__ */h("button",{type:"button",onClick:
|
|
4
|
-
/* @__PURE__ */b("span",{children:
|
|
1
|
+
import{TimelineCard as e}from"./chunk-S4Z657L6.js";import{TimelineGlyph as t,TimelineProgressIcon as r,TimelineTrack as n}from"./chunk-YL6LLHJA.js";import{toDayMs as a,fmtSliderDate as o,DAY_MS as i}from"./chunk-YDEIXM2A.js";import{Icon as s}from"./chunk-KKSVRIMP.js";import{useBrowserValueOnce as l}from"./chunk-D65T4H6J.js";import{useShellStrings as c,useShellLocale as d,splitAround as p}from"./chunk-X2PZMXDP.js";import{useState as u,useEffect as m,useRef as g}from"react";import{jsxs as h,jsx as b,Fragment as y}from"react/jsx-runtime";var k=/* @__PURE__ */new Set(["finished","partial_shipped","shipped","completed","cancelled"]),f=[{key:"casting",label:"Casting",weight:.2},{key:"cnc",label:"CNC",weight:.2},{key:"painting",label:"Painting",weight:.5},{key:"packing",label:"Packing",weight:.1},{key:"finished_goods",label:"FG",weight:0},{key:"stock_qty",label:"Stock",weight:0}];function _(e){if(e.order_qty<=0)return 0;let t=0;for(const r of f)if(r.weight>0){t+=Math.min((e[r.key]||0)/e.order_qty,1)*r.weight}return 100*t}function v(e){const t=e?.items??[];return 0===t.length?0:t.reduce((e,t)=>e+_(t),0)/t.length}function M(e){const{reports:t,poProductionStartDate:r,poEstCompletionDate:n,poStatus:o,poNumber:s="",currentReportId:d,currentReportDate:p,msPerDayOfPlayback:h=500,markers:b=[]}=e,[y,f]=u(null),_=c().production;m(()=>{p?f(new Date(p).getTime()):t.length>0&&f(new Date(t[0].date).getTime())},[d]);const[v,M]=u(!1),w=g(null),N=()=>{null!=w.current&&(cancelAnimationFrame(w.current),w.current=null),M(!1)};m(()=>()=>N(),[]),m(()=>{N()},[d]);const x=t.map(e=>a(e.date)).filter(e=>null!=e),P=l(Date.now,null)??Math.max(0,...x,...b.map(e=>a(e.date)??0),a(r??null)??0,a(n??null)??0),S=x.length?Math.min(...x):P,D=x.length?Math.max(...x):P,C=a(r??null)??S,R=a(n??null)??0,O=k.has((o||"").toLowerCase()),q=b.reduce((e,t)=>{const r=a(t.date);return null!=r&&r>e?r:e},0),L=(()=>{const e=[R,D,q,C+i];return O||e.push(P),Math.max(...e)})(),A=Math.max(1,Math.round((L-C)/i)),I=a(p??null)??D??C,T=Math.min(Math.max(y??I,C),L),j=t.find(e=>{const t=a(e.date);return null!=t&&t<=T})??null;let $=null;for(let e=t.length-1;e>=0;e--){const r=a(t[e].date);if(null!=r&&r>T){$=t[e];break}}const F=(()=>{if(j||!$||0===t.length)return null;const e=(t[t.length-1].items??[]).map((e,t)=>({id:`zero-${e.part_number}-${t}`,part_number:e.part_number,description:e.description??"",order_qty:Number(e.order_qty||0),casting:0,cnc:0,painting:0,packing:0,finished_goods:0,stock_qty:0}));return{id:`zero-${s}`,progress_number:_.start,date:r||new Date(C).toISOString().slice(0,10),items:e,est_completion_date:n??null,created_by_name:"",notes:""}})(),K=j??F,X=j?a(j.date):F?C:null,z=$?a($.date):null,E=!!(K&&$&&null!=X&&null!=z&&T>X&&T<z);let H,J;if(E&&null!=X&&null!=z){const e=(T-X)/Math.max(z-X,1),t=(t,r)=>Math.round(t+(r-t)*e),r={};for(const e of K?.items??[])r[e.part_number]=e;const n={};for(const e of $?.items??[])n[e.part_number]=e;const o=Array.from(/* @__PURE__ */new Set([...Object.keys(r),...Object.keys(n)])).map((e,a)=>{const o=r[e]??{},i=n[e]??{},s=e=>Number(e)||0;return{id:`interp-${e}-${a}`,part_number:e,description:o.description??i.description??"",order_qty:s(o.order_qty??i.order_qty??0),casting:t(s(o.casting),s(i.casting)),cnc:t(s(o.cnc),s(i.cnc)),painting:t(s(o.painting),s(i.painting)),packing:t(s(o.packing),s(i.packing)),finished_goods:t(s(o.finished_goods),s(i.finished_goods)),stock_qty:t(s(o.stock_qty),s(i.stock_qty))}}),i=a(K?.est_completion_date),s=a($?.est_completion_date);let l;l=null!=i&&null!=s?new Date(Math.round(i+(s-i)*e)).toISOString().slice(0,10):K?.est_completion_date||$?.est_completion_date||null,H={id:`interp-${T}`,progress_number:_.estimated,date:new Date(T).toISOString().slice(0,10),created_by_name:"",est_completion_date:l,items:o,notes:""},J=K}else if(H=K??t[t.length-1]??null,H){const e=t.findIndex(e=>e.id===H.id);J=e>=0&&e<t.length-1?t[e+1]:null}else J=null;const Y={};for(const e of J?.items??[])Y[e.part_number]=e;const Z=!(!d||H?.id===d),B=d?Math.min(a(p??null)??L,L):L,G=d?t.find(e=>e.id===d)?.progress_number:void 0;return{startMs:C,endMs:L,totalLeadDays:A,scrubMs:T,setScrubMs:e=>{N(),f(e)},resetToCurrent:()=>{N(),p&&f(new Date(p).getTime())},scrubbedAway:Z,beforeAnchor:K,nextAfter:$,displayed:H,prevReport:J,prevByPN:Y,isInterpolated:E,playing:v,startPlay:()=>{if(v)return void N();if(B<=C)return void f(B);M(!0),f(C);let e=performance.now(),t=C;const r=n=>{const a=n-e;if(e=n,t+=a/h*i,t>=B)return f(B),w.current=null,void M(!1);f(t),w.current=requestAnimationFrame(r)};w.current=requestAnimationFrame(r)},stopPlay:N,reports:t,markers:b,poNumber:s,currentReportId:d,currentReportProgressNumber:G,estCompletionMs:a(n??null)}}function w({startMs:e,endMs:t,reports:r,markers:a,valueMs:i,activeId:s,onChange:l,onPickReport:p,onOpenReport:u,onOpenMarker:m,onDragStart:g,renderReportPreview:h,reportLabel:y,playback:k,edgeCaptions:f,bare:_=!1,endMark:v=null}){const M=c().production,w=d(),N=r.map(e=>({report:e,ms:new Date(e.date).getTime()})).filter(({ms:e})=>Number.isFinite(e)).sort((e,t)=>e.ms-t.ms),x=N.map(({report:e,ms:t})=>({key:e.id,ms:t,kind:"report",label:y(e),preview:e.preview??h?.(e),onOpen:u?()=>u(e.id):void 0})),P=new Map(N.map(({report:e,ms:t})=>[e.id,t])),S=N.map(({ms:e})=>e),D=m?a.map(e=>({...e,onOpen:m})):a;/* @__PURE__ */
|
|
2
|
+
return b("div",{className:"select-none",children:/* @__PURE__ */b(n,{axis:_?"spread":"linear",labels:_?"none":"active",endMark:_?v:null,items:x,markers:D,startMs:e,endMs:t,activeKey:s,onActivate:e=>{const t=P.get(e);null!=t&&l(t),p(e)},playback:k,edgeCaptions:f,thumb:{valueMs:i,onChange:l,onDragStart:g,stops:S,ariaLabel:M.scrub,valueText:e=>{const t=(e=>N.find(t=>t.ms===e)?.report)(e);return t?`${y(t)} · ${o(e,w)}`:o(e,w)}},ariaLabel:M.label(o(e,w),o(t,w))})})}function N({snapshot:n,onPickReport:i,onOpenReport:l,onOpenMarker:m,renderReportPreview:k,onScrubProgress:f,heading:_,edgeCaptions:M,reportLabel:N=e=>e.progress_number,resetLabel:x,variant:P="card",onPlayStart:S}){const{reports:D,markers:C,poNumber:R,startMs:O,endMs:q,totalLeadDays:L,scrubMs:A,setScrubMs:I,displayed:T,scrubbedAway:j,resetToCurrent:$,currentReportId:F,currentReportProgressNumber:K,estCompletionMs:X}=n,z=function(e,t,r){const[n,a]=u(!1),o=g(!1);return{playing:n,toggle:()=>{n?a(!1):0!==e.length&&(r?.(),o.current||(o.current=!0,t(e[0])),a(!0))},stop:()=>{o.current=!1,a(!1)}}}(D.map(e=>a(e.date)).filter(e=>null!=e).sort((e,t)=>e-t),I,S),E=c().production,H=d(),J=_??E.heading,Y=e=>o(e,H);if(0===D.length&&0===C.length)return null;const Z=C.filter(e=>"shipment"===e.kind),B=C.filter(e=>"inspection"===e.kind),G=C.filter(e=>"invoice"===e.kind),V=(T?.items??[]).reduce((e,t)=>e+(Number(t.stock_qty)||0),0),Q=T?v(T):0,U=D.find(e=>e.id===F),W=U?N(U):K,ee=
|
|
3
|
+
/* @__PURE__ */h("button",{type:"button",onClick:z.toggle,"aria-pressed":z.playing,title:z.playing?E.pause:E.playTitle,className:"rosh-tl-play text-gray-700 border-gray-300 hover:text-blue-600 hover:border-blue-600",children:[z.playing?/* @__PURE__ */b(s,{name:"pause","aria-hidden":"true"}):/* @__PURE__ */b(s,{name:"play","aria-hidden":"true"}),
|
|
4
|
+
/* @__PURE__ */b("span",{children:z.playing?E.pause:E.play})]}),te=j&&(x??W)?/* @__PURE__ */b("button",{type:"button",onClick:()=>{z.stop(),$()},className:"text-xs text-blue-600 underline-offset-4 hover:underline font-medium",children:x??E.backTo(String(W))}):null,[re,ne]=p(E.showing),ae=e=>/* @__PURE__ */b("p",{className:"rosh-tl-status text-gray-800",children:T?/* @__PURE__ */h(y,{children:[e&&re,
|
|
5
5
|
/* @__PURE__ */b("b",{className:"font-medium",children:N(T)}),e&&ne,
|
|
6
|
-
/* @__PURE__ */h("span",{className:"text-gray-500",children:[" · ",
|
|
6
|
+
/* @__PURE__ */h("span",{className:"text-gray-500",children:[" · ",Y(new Date(T.date).getTime())," · ",E.overall(Math.round(Q))," · ",E.inStock(V)]})]}):/* @__PURE__ */b("span",{className:"text-gray-500",children:E.noReport})});if("rail"===P){const e=null!=X&&X>=q&&q>O,t=e?{key:"__estimate__",label:E.estimatedCompletion,dateText:Y(X)}:null;/* @__PURE__ */
|
|
7
7
|
return h("div",{className:"shrink-0","data-timeline-variant":"rail",children:[
|
|
8
|
-
/* @__PURE__ */b(w,{bare:!0,endMark:t,startMs:O,endMs:q,reports:D,markers:C,valueMs:A,activeId:T?.id??"",onChange:I,onPickReport:i,onOpenReport:l,onOpenMarker:m,renderReportPreview:k,reportLabel:N,edgeCaptions:{start:M?.start??
|
|
8
|
+
/* @__PURE__ */b(w,{bare:!0,endMark:t,startMs:O,endMs:q,reports:D,markers:C,valueMs:A,activeId:T?.id??"",onChange:I,onPickReport:i,onOpenReport:l,onOpenMarker:m,renderReportPreview:k,reportLabel:N,edgeCaptions:{start:M?.start??E.start,end:M?.end??(e?E.estDone:void 0)},onDragStart:z.stop,playback:{playing:z.playing,onArrive:(e,t)=>I(t),onProgress:f,onStop:z.stop}}),
|
|
9
9
|
/* @__PURE__ */h("div",{className:"rosh-tl-railrow","data-timeline-part":"rail-row",children:[ee,te,ae(!1)]})]})}/* @__PURE__ */
|
|
10
|
-
return b("div",{className:"shrink-0",children:/* @__PURE__ */b(e,{icon:/* @__PURE__ */b(r,{}),heading:
|
|
10
|
+
return b("div",{className:"shrink-0",children:/* @__PURE__ */b(e,{icon:/* @__PURE__ */b(r,{}),heading:J,subject:R,meta:[`${Y(O)} → ${Y(q)}`,E.leadTime(L)],actions:/* @__PURE__ */h(y,{children:[te,ee]}),footer:/* @__PURE__ */h(y,{children:[ae(!0),
|
|
11
11
|
/* @__PURE__ */h("div",{className:"rosh-tl-legend",children:[D.length>0&&/* @__PURE__ */h("span",{className:"border-gray-200 text-gray-500",children:[
|
|
12
|
-
/* @__PURE__ */b("i",{"aria-hidden":"true",className:"rosh-tl-glyph is-ring border-blue-600"}),
|
|
13
|
-
/* @__PURE__ */b("i",{"aria-hidden":"true",className:"rosh-tl-glyph is-diamond",style:{background:"var(--tl-shipment)",color:"var(--tl-on-kind)"},children:/* @__PURE__ */b(t,{name:"truck"})}),
|
|
14
|
-
/* @__PURE__ */b("i",{"aria-hidden":"true",className:"rosh-tl-glyph is-disc",style:{background:"var(--tl-inspection)",color:"var(--tl-on-kind)"},children:/* @__PURE__ */b(t,{name:"flask"})}),
|
|
15
|
-
/* @__PURE__ */b("i",{"aria-hidden":"true",className:"rosh-tl-glyph is-disc",style:{background:"var(--tl-invoice)",color:"var(--tl-on-kind)"},children:/* @__PURE__ */b(t,{name:"receipt"})}),
|
|
12
|
+
/* @__PURE__ */b("i",{"aria-hidden":"true",className:"rosh-tl-glyph is-ring border-blue-600"}),E.report]}),Z.length>0&&/* @__PURE__ */h("span",{className:"border-gray-200 text-gray-500",children:[
|
|
13
|
+
/* @__PURE__ */b("i",{"aria-hidden":"true",className:"rosh-tl-glyph is-diamond",style:{background:"var(--tl-shipment)",color:"var(--tl-on-kind)"},children:/* @__PURE__ */b(t,{name:"truck"})}),E.shipment]}),B.length>0&&/* @__PURE__ */h("span",{className:"border-gray-200 text-gray-500",children:[
|
|
14
|
+
/* @__PURE__ */b("i",{"aria-hidden":"true",className:"rosh-tl-glyph is-disc",style:{background:"var(--tl-inspection)",color:"var(--tl-on-kind)"},children:/* @__PURE__ */b(t,{name:"flask"})}),E.inspection]}),G.length>0&&/* @__PURE__ */h("span",{className:"border-gray-200 text-gray-500",children:[
|
|
15
|
+
/* @__PURE__ */b("i",{"aria-hidden":"true",className:"rosh-tl-glyph is-disc",style:{background:"var(--tl-invoice)",color:"var(--tl-on-kind)"},children:/* @__PURE__ */b(t,{name:"receipt"})}),E.invoice]})]})]}),children:/* @__PURE__ */b(w,{startMs:O,endMs:q,reports:D,markers:C,valueMs:A,activeId:T?.id??"",onChange:I,onPickReport:i,onOpenReport:l,onOpenMarker:m,renderReportPreview:k,reportLabel:N,edgeCaptions:M,onDragStart:z.stop,playback:{playing:z.playing,onArrive:(e,t)=>I(t),onProgress:f,onStop:z.stop}})})})}export{k as POST_PRODUCTION_STATUSES,N as ProductionTimeline,f as STAGES,_ as calcOverall,v as calcReportOverall,M as useProductionTimeline};
|