efficient-shell 7.45.0 → 7.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -0
- package/dist/{Browser-7M22OFSW.js → Browser-5AN7EBVV.js} +14 -14
- package/dist/Calculator-YGJ7I5VT.js +29 -0
- package/dist/ConfirmDialog-OJLZG4QL.js +1 -0
- package/dist/{CurrencyConverter-4QTVWEFM.js → CurrencyConverter-PH75TBDL.js} +6 -6
- package/dist/{Documents-LELK7IBM.js → Documents-HZF3MZCH.js} +22 -22
- package/dist/Files-5H7LBVIF.js +87 -0
- package/dist/{Notepad-CLHKYQ34.js → Notepad-WTWGNCLT.js} +14 -14
- package/dist/PdfViewer-D4GRPG4G.js +1 -0
- package/dist/{PomodoroTimer-L45QS5OR.js → PomodoroTimer-BUKDNFPJ.js} +24 -24
- package/dist/{Preview-47BCBIP4.js → Preview-ZMDRH6GO.js} +65 -65
- package/dist/Sidebar-A3UG662D.js +44 -0
- package/dist/{Spreadsheet-6NX5WA4J.js → Spreadsheet-WOSOG5TR.js} +13 -13
- package/dist/{Stock-ZZ6AM43M.js → Stock-FB5VIBVY.js} +3 -3
- package/dist/{Weather-K3BZD2NX.js → Weather-2MOP5LTK.js} +17 -17
- package/dist/{WorldClock-5STYQA56.js → WorldClock-KMMKBE4B.js} +6 -6
- package/dist/ai/index.d.ts +271 -0
- package/dist/ai/index.js +37 -0
- package/dist/ai.css +2 -0
- package/dist/apps/index.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/brand.css +1 -1
- package/dist/{chunk-JJBFXVOY.js → chunk-3RKM5ZGV.js} +2 -2
- package/dist/{chunk-YRLOXHKG.js → chunk-3ZZ2UPNR.js} +1 -1
- package/dist/{chunk-DENNF2LM.js → chunk-4FQTMGCA.js} +2 -2
- package/dist/{chunk-M2AM6DAA.js → chunk-4QW4I2XQ.js} +1 -1
- package/dist/{chunk-GM2ASLIK.js → chunk-4TOFAEAW.js} +29 -29
- package/dist/{chunk-XDR3Y3WU.js → chunk-55NGVBTR.js} +5 -5
- package/dist/{chunk-G4UIEBPD.js → chunk-BFJRKFOH.js} +13 -13
- package/dist/{chunk-HPUHB47C.js → chunk-BMYURA2N.js} +1 -1
- package/dist/chunk-CLYMUTNF.js +27 -0
- package/dist/{chunk-PR7MCFEU.js → chunk-EZTEOTUD.js} +95 -95
- package/dist/{chunk-FQIZMZDX.js → chunk-FBXOKW33.js} +3 -3
- package/dist/{chunk-K6YIBHZN.js → chunk-FGPEAC7B.js} +16 -16
- package/dist/{chunk-XYG3CVL5.js → chunk-FY3H52BM.js} +1 -1
- package/dist/{chunk-UNLQRUWP.js → chunk-GFWRYNPX.js} +18 -18
- package/dist/{chunk-LK7BWXYY.js → chunk-JFZLYYAN.js} +1 -1
- package/dist/{chunk-JXMYF3JR.js → chunk-JGWOY2KV.js} +9 -9
- package/dist/{chunk-UNA3BQJI.js → chunk-MMLU5ZHI.js} +9 -9
- package/dist/{chunk-ABKFLSHY.js → chunk-NX5HJ6L5.js} +1 -1
- package/dist/chunk-OQBWV2RH.js +1020 -0
- package/dist/chunk-RWNNFCSA.js +1 -0
- package/dist/chunk-UBXRSOQ6.js +47 -0
- package/dist/chunk-USLPE6K3.js +1 -0
- package/dist/{chunk-CWCKDF37.js → chunk-VJ6KJYRS.js} +3 -3
- package/dist/{chunk-LTEM56OL.js → chunk-WSRZRWN7.js} +1 -1
- package/dist/{chunk-3G5TA3IF.js → chunk-YT4B3NSV.js} +4 -3
- package/dist/{chunk-HQ74L5MM.js → chunk-YWJD6RUT.js} +1 -1
- package/dist/{chunk-X6NYTLYX.js → chunk-ZELMENOO.js} +2 -2
- package/dist/icons/index.js +1 -1
- package/dist/{index-BWDtKUcA.d.ts → index-BI54lOAz.d.ts} +30 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +682 -682
- package/dist/map/index.js +8 -8
- package/dist/markdown/index.js +1 -1
- package/dist/page-tabs/index.js +5 -5
- package/dist/pdf/index.js +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +1 -1
- package/package.json +21 -4
- package/dist/Calculator-LKWOOCNC.js +0 -29
- package/dist/ConfirmDialog-ZT3XT66V.js +0 -1
- package/dist/Files-LAWZGFQQ.js +0 -87
- package/dist/PdfViewer-VJ743BW7.js +0 -1
- package/dist/Sidebar-AYYJL3IJ.js +0 -44
- package/dist/chunk-NGWXT4QX.js +0 -1
- package/dist/chunk-NZBFQTOB.js +0 -27
- package/dist/chunk-WGSCC6QU.js +0 -1050
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
import{isStaleChunkError as
|
|
1
|
+
import{CopyButton as e}from"./chunk-VJ6KJYRS.js";import{isStaleChunkError as t,CMD_Z as n,CMD_SHIFT_Z as r,Result as o,useIsMobile as i,useIsPhone as a,useShellPrefs as s}from"./chunk-JGWOY2KV.js";import{reportBoundaryError as l}from"./chunk-KNUR2UEG.js";import{confirm as c,dialogA11y as d}from"./chunk-GFWRYNPX.js";import{computeMaximizedBox as u,isSidebarStripReserved as h,boxFillsWorkArea as m,readAlwaysMaximizedFlag as p,WORK_AREA_CHANGED_EVENT as f,useShellAuth as w,scrollerIsFluid as y,growBoxToWidth as g,widthToFit as b,navIcons as v}from"./chunk-DSSLOQDW.js";import{PopupMenu as x,PopupMenuItem as k,PopupMenuDivider as E,PopupMenuLabel as C}from"./chunk-MMLU5ZHI.js";import{Button_default as M}from"./chunk-G5GERM76.js";import{Z_LAYERS as N,runEscapeInterceptors as S}from"./chunk-FIEA5CGB.js";import{Icon as L}from"./chunk-YT4B3NSV.js";import{useShellStrings as T}from"./chunk-LVCRH3K6.js";import{LoadingSpinner as z}from"./chunk-2J6F4EE7.js";import{createContext as A,useContext as D,Component as P,useLayoutEffect as I,useRef as K,useEffect as $,useState as W,useSyncExternalStore as O,useCallback as R,isValidElement as F,Fragment as q,Children as j,cloneElement as B,useMemo as H,useId as Y,useReducer as U,Suspense as X}from"react";import{jsxs as V,jsx as J,Fragment as _}from"react/jsx-runtime";import{createPortal as G}from"react-dom";import{useLocation as Q}from"react-router-dom";import{useQueryClient as Z,useQuery as ee}from"@tanstack/react-query";function te(e){return"component"in e}function ne(e){return"endpoint"in e}var re={};function oe(e){re=e}var ie=new Proxy({},{get:(e,t)=>re[t],has:(e,t)=>t in re,ownKeys:()=>Object.keys(re),getOwnPropertyDescriptor(e,t){if(t in re)return{configurable:!0,enumerable:!0,value:re[t]}}}),ae=null;function se(e){ae=e}function le(){return null!==ae}var ce=/* @__PURE__ */new Set(["get","post","put","patch","delete","head","options","request"]),de=new Proxy({},{get:(e,t)=>ae?ae[t]:"string"==typeof t&&ce.has(t)?()=>Promise.resolve({data:null,status:0,statusText:"",headers:{},config:{}}):void 0}),ue=A(null);function he(){return D(ue)?.pageSearch??""}var me=null,pe=/* @__PURE__ */new Set;function fe(e){me!==e&&(me=e,pe.forEach(e=>e()))}function we(){return me}function ye(e){return pe.add(e),()=>{pe.delete(e)}}function ge({error:e,onReload:n}){const r=t(e);/* @__PURE__ */
|
|
2
2
|
return V("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 py-12 text-center",children:[
|
|
3
|
-
/* @__PURE__ */
|
|
3
|
+
/* @__PURE__ */J(L,{name:"warning",className:"h-8 w-8 text-amber-500",strokeWidth:1.5}),
|
|
4
4
|
/* @__PURE__ */V("div",{className:"min-w-0",children:[
|
|
5
|
-
/* @__PURE__ */
|
|
6
|
-
/* @__PURE__ */
|
|
7
|
-
/* @__PURE__ */
|
|
8
|
-
return V("div",{className:`flex items-center gap-2 ${e}`,"data-undo-controls":
|
|
9
|
-
/* @__PURE__ */
|
|
10
|
-
/* @__PURE__ */
|
|
11
|
-
return
|
|
12
|
-
return
|
|
13
|
-
return
|
|
14
|
-
return
|
|
15
|
-
return
|
|
16
|
-
return
|
|
17
|
-
return
|
|
18
|
-
return
|
|
19
|
-
return
|
|
20
|
-
/* @__PURE__ */
|
|
21
|
-
/* @__PURE__ */
|
|
22
|
-
/* @__PURE__ */
|
|
23
|
-
/* @__PURE__ */
|
|
24
|
-
return V("div",{className:"group flex flex-col items-center",onMouseEnter:()=>rt(t),children:[!m&&/* @__PURE__ */
|
|
25
|
-
/* @__PURE__ */
|
|
26
|
-
/* @__PURE__ */
|
|
27
|
-
/* @__PURE__ */V(
|
|
28
|
-
return V("button",{onClick:()=>o(r.id),onMouseEnter:t=>{return n=e.items,r=t.currentTarget,void(w||(
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
/* @__PURE__ */
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
/* @__PURE__ */V(k,{onClick:()=>{
|
|
34
|
-
/* @__PURE__ */
|
|
35
|
-
/* @__PURE__ */V(k,{onClick:()=>{
|
|
36
|
-
/* @__PURE__ */
|
|
37
|
-
/* @__PURE__ */
|
|
38
|
-
/* @__PURE__ */V(k,{danger:!0,onClick:()=>{
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
return V(
|
|
41
|
-
/* @__PURE__ */
|
|
42
|
-
/* @__PURE__ */
|
|
5
|
+
/* @__PURE__ */J("p",{className:"text-sm font-medium text-gray-700",children:r?"This window needs the latest version of the app":"This window crashed"}),
|
|
6
|
+
/* @__PURE__ */J("p",{className:"mt-1 text-xs text-gray-400 max-w-sm break-words",children:r?"A new version was deployed while this tab was open. Reload the page to pick it up.":e.message||String(e)})]}),
|
|
7
|
+
/* @__PURE__ */J("button",{type:"button",onClick:r?()=>window.location.reload():n,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 text-sm font-medium rounded-lg",children:r?"Reload page":"Reload window"})]})}var be=class extends P{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),l(e)}reset=()=>this.setState({error:null});render(){const{error:e}=this.state;return e?this.props.fallback?this.props.fallback(e,this.reset):/* @__PURE__ */J(ge,{error:e,onReload:this.reset}):this.props.children}},ve=A(null),xe="text-xs text-gray-500 hover:text-gray-700 disabled:opacity-40 disabled:hover:text-gray-500 disabled:cursor-default";function ke({className:e="",auto:t=!1}){const o=D(ve),i=T().undo,a=o?.claimOwnMount;if(I(()=>{if(!t&&a)return a(!0),()=>a(!1)},[t,a]),!o||!o.enabled)return null;const{undo:s,redo:l,canUndo:c,canRedo:d,undoLabel:u,redoLabel:h}=o;/* @__PURE__ */
|
|
8
|
+
return V("div",{className:`flex items-center gap-2 ${e}`,"data-undo-controls":t?"shell":"form",children:[
|
|
9
|
+
/* @__PURE__ */J("button",{type:"button",onClick:s,disabled:!c,title:c?i.undoStep(u??"",n):i.nothingToUndo,className:xe,children:i.undo}),
|
|
10
|
+
/* @__PURE__ */J("button",{type:"button",onClick:l,disabled:!d,title:d?i.redoStep(h??"",r):i.nothingToRedo,className:xe,children:i.redo})]})}var Ee=/* @__PURE__ */new Set([408,429]);function Ce(e){const t=e?.response?.status;return"number"==typeof t?t:void 0}function Me(e){const t=Ce(e);return null!=t&&(t>=400&&t<500&&!Ee.has(t))}function Ne(e,t){return!Me(t)&&e<3}function Se(){const e=T().loading;/* @__PURE__ */
|
|
11
|
+
return J(z,{size:"sm",padding:"p-8",label:e.label})}var Le="flex-1 min-h-0";function Te(){const e=T().record;/* @__PURE__ */
|
|
12
|
+
return J(z,{label:e.loading,padding:"",className:Le})}function ze(e){return e??void 0}function Ae({isPending:e,isFetching:t,enabled:n=!0,error:r,onRetry:i}){const a=T().record;if(t||e&&n)/* @__PURE__ */return J(Te,{});if(r){const e=Ce(r);if(401===e)/* @__PURE__ */
|
|
13
|
+
return J(o,{status:"warning",title:a.signInRequired,subTitle:a.signInBody,className:Le});if(403===e)/* @__PURE__ */
|
|
14
|
+
return J(o,{status:"403",className:Le});if(404===e||410===e)/* @__PURE__ */
|
|
15
|
+
return J(o,{status:"404",title:a.notFound,className:Le});const t=null==e||408===e||429===e||e>=500;/* @__PURE__ */
|
|
16
|
+
return J(o,{status:"500",title:a.loadFailed,subTitle:t?a.checkConnection:a.rejected,extra:t?/* @__PURE__ */J(M,{variant:"secondary",size:"sm",onClick:i,children:a.retry}):void 0,className:Le})}/* @__PURE__ */
|
|
17
|
+
return J(o,{status:"404",title:a.notFound,className:Le})}function De({entity:e,children:t,...n}){return null!=e?/* @__PURE__ */J(_,{children:t(e)}):/* @__PURE__ */J(Ae,{...n})}var Pe=/^[a-z]+(?:-[a-z]+)*-\d{13}$/;function Ie(e){return"string"==typeof e&&(e.startsWith("new-")||Pe.test(e))}function Ke(e){if(Ie(e.entityId))return!0;const t=e.entitySnapshot;return!(!t||"object"!=typeof t||!t._new&&!t._duplicate)}var $e=A({openWindows:[],openEntity:()=>{},openPage:()=>{},closeEntity:()=>{},minimize:()=>{},items:[],restore:()=>{},remove:()=>{},restoreIfMinimized:()=>!1,openItems:[]}),We=A(null);function Oe(e){const t=D(We),n=K(null);null===n.current&&(n.current=/* @__PURE__ */Symbol("window-dirty")),I(()=>{if(t)return t(n.current,e)},[t,e]),$(()=>{if(!t||!e)return;const n=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[t,e])}function Re(){const e=K(/* @__PURE__ */new Map),[t,n]=W(!1);return{dirty:t,registerDirty:R((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 Fe(){return D($e)}function qe(e){if("page"!==e.type&&Ke(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 je({item:e,onClose:t,accentRgb:n}){const{dirty:r,registerDirty:o}=Re(),i=ie[e.route];if(!i||!te(i))return null;const a=i,s=a.component;/* @__PURE__ */
|
|
18
|
+
return J(Ar,{open:!0,onClose:t,icon:v[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__ */J(We.Provider,{value:o,children:/* @__PURE__ */J(X,{fallback:/* @__PURE__ */J("div",{className:"flex items-center justify-center py-12",children:/* @__PURE__ */J(Se,{})}),children:/* @__PURE__ */J(s,{})})})})}function Be({entityType:e,entityId:t,label:n}){const r=T(),o=Z(),{data:i}=ee({queryKey:["my-profile-sidebar"],enabled:le(),queryFn:()=>de.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 J("button",{onClick:()=>{const r=s?a.filter(n=>!(n.entityType===e&&n.entityId===t)):[...a,{entityType:e,entityId:t,label:n}];de.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__ */J(L,{name:"star",className:"h-4 w-4",fill:s?"currentColor":"none",strokeWidth:1.5})})}var He=/* @__PURE__ */new Set;function Ye({item:e,onClose:t,onMinimize:n,accentRgb:r}){const o=ie[e.entityType];if(!o||!ne(o))return null;const i=o,[a,s]=W(!1),{dirty:l,registerDirty:c}=Re(),d=i.queryKey||i.endpoint.replace(/^\/|\/$/g,"").split("/").pop()||e.entityType,u=e.entitySnapshot?._duplicate,h=Ie(e.entityId),m=!i.selfFetching&&!u&&!h&&le(),p=ee({queryKey:[d,e.entityId],queryFn:()=>{return de.get((t=i.endpoint,n=String(e.entityId),`${t}${encodeURIComponent(n)}/`)).then(e=>e.data);var t,n},initialData:ze(e.entitySnapshot),initialDataUpdatedAt:0,enabled:m,staleTime:0,refetchOnWindowFocus:!0,refetchOnMount:"always",refetchInterval:e=>!Me(e.state.error)&&6e4,refetchIntervalInBackground:!1,retry:Ne}),f=p.data,w=p.refetch;$(()=>{var t;if(m)return t=t=>{t!==e.id||He.has(t)||w({cancelRefetch:!1})},Kn.add(t),()=>{Kn.delete(t)}},[w,e.id,m]);const y=R(()=>{a&&!l?s(!1):t()},[a,l,t]),g=i.selfFetching?e.label:f?i.title(f,a,s):e.label,b=i.icon,x=b?v[b]:null,k=g,E=!i.selfFetching&&f&&i.footer&&!u?i.footer(f):void 0;return i.rendersOwnModal?i.selfFetching?/* @__PURE__ */J(X,{fallback:/* @__PURE__ */J(Se,{}),children:i.render(f??e.entitySnapshot,t,e.entityId,a,s)}):null!=f?/* @__PURE__ */J(X,{fallback:/* @__PURE__ */J(Ar,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */J(Te,{})}),children:i.render(f,t,e.entityId,a,s)}):/* @__PURE__ */J(Ar,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */J(Ae,{isPending:p.isPending,isFetching:p.isFetching,enabled:m,error:p.error,onRetry:w})}):/* @__PURE__ */J(Ar,{open:!0,onClose:y,onMinimize:n,initialBox:e.savedBox,icon:x,title:k,footer:E,copyText:e.label,windowKey:e.id,openedFromKey:e.openedFrom,size:i.size||"2xl",dirty:l,editing:a||h||u,dimensions:i.dimensions,autoHeight:i.autoHeight,autoMinHeight:i.autoMinHeight,autoWidth:i.autoWidth,appStyle:i.appStyle,flushBody:i.flushBody,accentRgb:r,children:/* @__PURE__ */J(We.Provider,{value:c,children:/* @__PURE__ */J(X,{fallback:/* @__PURE__ */J(Te,{}),children:i.selfFetching?i.render(null,t,e.entityId,a,s):/* @__PURE__ */J(De,{entity:f,isPending:p.isPending,isFetching:p.isFetching,enabled:m,error:p.error,onRetry:w,children:n=>i.render(n,t,e.entityId,a,s)})})})})}function Ue(e){return document.querySelector(`[data-modal-panel][data-window-key="${e}"]`)}function Xe(e){return document.querySelector(`[data-modal-panel][data-window-root][data-window-owner="${e}"]`)}function Ve(e){const t=Ue(e),n=t??Xe(e);if(!n)return;if(t&&!Xn(t))return r=e,void window.dispatchEvent(new CustomEvent("modal-reveal",{detail:{windowKey:r}}));var r;const o=n.getAttribute("data-modal-id");o&&$n(o)}function Je(e){if("page"!==e.type)return!0;const t=e.route?ie[e.route]:void 0;if(!t||!te(t))return!0;const n=t;return!n.widget&&!n.utility}function _e(){const e=sr();if(!e)return;const t=document.querySelector(`[data-modal-panel][data-modal-id="${e}"]`);return t?.getAttribute("data-window-key")??void 0}var Ge=/* @__PURE__ */new Map;function Qe(){const e=_e();if(e)return Ge.get(e)}function Ze(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 et="rosh-peek-style",tt=N.peek,nt=N.taskbarPreview;function rt(e){"undefined"!=typeof document&&(!function(){if("undefined"==typeof document||document.getElementById(et))return;const e=document.createElement("style");e.id=et,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:${tt}!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 ot(){"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 it({id:e,label:t,maxW:n,maxH:r,titleAbove:o=!1,onClick:i,onClose:a}){const s=T(),l=K(null),[c,d]=W({w:n,h:Math.round(.75*r)}),[u,h]=W(!1);return I(()=>{const o=l.current;if(!o)return;const i=Ue(e)??Ze(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)),u=Math.max(60,Math.round(a.height*s));d({w:c,h:u}),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.querySelectorAll('[role="dialog"], [data-portal]').forEach(e=>{e.style.display="none"}),o.innerHTML="",o.appendChild(m),()=>{o.innerHTML=""}},[e,t,n,r]),/* @__PURE__ */V("div",{style:{width:c.w,height:c.h},className:"relative rounded-md overflow-hidden bg-white/95 border border-gray-300 shadow-(--elevation-panel) cursor-pointer ring-2 ring-transparent group-hover:ring-blue-400 transition shrink-0",onClick:i,children:[
|
|
20
|
+
/* @__PURE__ */J("div",{ref:l,className:"absolute inset-0 z-0 overflow-hidden"}),!u&&/* @__PURE__ */V("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-gray-400 bg-gray-50",children:[
|
|
21
|
+
/* @__PURE__ */J(L,{name:"window",className:"h-6 w-6",strokeWidth:1.5}),
|
|
22
|
+
/* @__PURE__ */J("span",{className:"mt-1 text-3xs uppercase tracking-wide",children:"Hidden"})]}),!o&&/* @__PURE__ */J("div",{className:"absolute bottom-0 left-0 right-0 z-10 px-2 py-1 text-2xs font-medium text-white bg-gradient-to-t from-black/80 to-transparent truncate pointer-events-none",children:t}),a&&/* @__PURE__ */J("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-white flex items-center justify-center",title:s.taskbar.closeWindow,children:/* @__PURE__ */J(L,{name:"close",className:"h-3 w-3",strokeWidth:3})})]})}function at({items:e,anchorEl:t,onActivate:n,onClose:r,onMouseEnter:o,onMouseLeave:i}){const a=T(),s=e.length>1,l=K(null),[c,d]=W({left:-9999,top:-9999,ready:!1}),[u,h]=W(()=>"undefined"!=typeof document&&getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom");I(()=>{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)),d({left:a,top:i,ready:!0})};n();const r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[t,e.length]),$(()=>ot,[]);const m="top"===u,p=(m?"mt-1":"mb-1")+" max-w-[240px] truncate text-2xs font-medium text-gray-900 bg-white/80 px-2 py-0.5 rounded shadow-sm ring-2 ring-transparent transition group-hover:ring-blue-400";return G(
|
|
23
|
+
/* @__PURE__ */J("div",{ref:l,"data-taskbar-preview":"",style:{position:"fixed",left:c.left,top:c.top,zIndex:nt,maxWidth:"calc(100vw - 16px)",opacity:c.ready?1:0},className:s?"flex gap-2 flex-wrap":"",onMouseEnter:o,onMouseLeave:()=>{ot(),i()},children:e.map(e=>{const t=Ue(e.id)??Ze(e.label),o=t?function(e){if(Xn(e))return null;const t=e.getBoundingClientRect(),n=qn(),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 V("div",{className:"group flex flex-col items-center",onMouseEnter:()=>rt(t),children:[!m&&/* @__PURE__ */J("span",{className:p,children:e.label}),
|
|
25
|
+
/* @__PURE__ */J(it,{id:e.id,label:e.label,maxW:240,maxH:160,titleAbove:!0,onClick:()=>n(e.id),onClose:()=>r(e.id)}),m&&/* @__PURE__ */J("span",{className:p,children:e.label}),null!==o&&/* @__PURE__ */V("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-white shadow-sm",children:[
|
|
26
|
+
/* @__PURE__ */J(L,{name:"arrow-right",className:"h-3 w-3",style:{transform:`rotate(${o}deg)`},strokeWidth:3}),"Off screen"]})]},e.id)})}),document.body)}function st(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 lt({openWindows:e,onRemove:t,onSplitView:n,onActivate:r,onActivateById:o}){const i=T(),[a,s]=W(null);$(()=>{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=O(lr,sr),[,c]=W(0);$(()=>{const e=()=>c(e=>e+1);return window.addEventListener("modal-geometry",e),window.addEventListener("resize",e),()=>{window.removeEventListener("modal-geometry",e),window.removeEventListener("resize",e)}},[]);const[,d]=W(0);$(()=>{const e=()=>d(e=>e+1);return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[]);const u=e=>{const t=Ze(e),n=t?.querySelector("[data-window-title]");return n?.textContent?.trim()||e},[h,m]=W(null),[p,f]=W(null),[w,y]=W(null),g=K(null),b=()=>{g.current&&(clearTimeout(g.current),g.current=null),g.current=setTimeout(()=>{m(null),f(null)},150)},M=e.filter(e=>!e.route||!ie[e.route]?.utility);if(!a||!a.isConnected||0===M.length)return null;const N=[],S=/* @__PURE__ */new Map;for(const e of M){const t=e.route?ie[e.route]:void 0,n=t?.taskbarGroup,r=n?.key??e.route??`entity:${e.id}`,o=S.get(r);if(void 0!==o)N[o].items.push(e);else{S.set(r,N.length);const o=n?.label??t?.label??e.label;N.push({key:r,route:n?.icon??e.route,label:o,items:[e]})}}return G(
|
|
27
|
+
/* @__PURE__ */V(_,{children:[N.map(e=>{const n=e.route?v[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,c=e.items.some(e=>{const t=Ue(e.id)??Ze(e.label);return!!t&&!Xn(t)});/* @__PURE__ */
|
|
28
|
+
return V("button",{onClick:()=>o(r.id),onMouseEnter:t=>{return n=e.items,r=t.currentTarget,void(w||(g.current&&(clearTimeout(g.current),g.current=null),g.current=setTimeout(()=>{m(n),f(r)},350)));var n,r},onMouseLeave:b,onDoubleClick:e=>{e.stopPropagation(),window.dispatchEvent(new CustomEvent("modal-center",{detail:{windowKey:r.id,label:r.label}}))},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),g.current&&(clearTimeout(g.current),g.current=null),m(null),f(null),s?y({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&&F(n)?B(n,{className:"h-3.5 w-3.5 shrink-0"}):/* @__PURE__ */J(L,{name:"expand",className:"h-3.5 w-3.5 shrink-0",strokeWidth:2}),
|
|
29
|
+
/* @__PURE__ */J("span",{className:"truncate flex-1",children:s?e.label:u(r.label)}),c&&/* @__PURE__ */J("span",{title:i.taskbar.offscreenDot,className:"shrink-0 h-1.5 w-1.5 rounded-full bg-amber-500"}),s&&/* @__PURE__ */J("span",{className:"shrink-0 px-2 py-0.5 rounded-full bg-blue-500/80 text-white text-2xs font-bold leading-none",children:e.items.length}),!s&&/* @__PURE__ */J("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__ */J(L,{name:"close",className:"h-3 w-3",strokeWidth:2})})]},e.key)}),
|
|
30
|
+
/* @__PURE__ */J("div",{className:"flex-1"}),M.length>=2&&/* @__PURE__ */V("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-blue-50 transition-colors shrink-0",children:[
|
|
31
|
+
/* @__PURE__ */J(L,{name:"grid",className:"h-3 w-3",strokeWidth:2}),"Exposé"]}),w&&/* @__PURE__ */V(x,{portal:!0,minWidth:200,style:st(w.x,w.y),onClose:()=>y(null),children:[
|
|
32
|
+
/* @__PURE__ */J(C,{children:w.label}),
|
|
33
|
+
/* @__PURE__ */V(k,{onClick:()=>{y(null),w.items.forEach(e=>function(e){const t=En.get(e);t&&Wn(t)}(e.id))},children:[
|
|
34
|
+
/* @__PURE__ */J(L,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),i.taskbar.minimizeAllWindows]}),
|
|
35
|
+
/* @__PURE__ */V(k,{onClick:()=>{y(null),w.items.forEach(e=>o(e.id))},children:[
|
|
36
|
+
/* @__PURE__ */J("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */J("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__ */J(E,{}),
|
|
38
|
+
/* @__PURE__ */V(k,{danger:!0,onClick:()=>{y(null),w.items.forEach(e=>t(e.id))},children:[
|
|
39
|
+
/* @__PURE__ */J(L,{name:"close",className:"h-4 w-4",strokeWidth:2}),`${i.taskbar.closeAllWindows} (${w.items.length})`]})]}),h&&p&&/* @__PURE__ */J(at,{items:h,anchorEl:p,onActivate:e=>{o(e),m(null),f(null)},onClose:e=>{t(e),m(null),f(null)},onMouseEnter:()=>{g.current&&(clearTimeout(g.current),g.current=null)},onMouseLeave:b})]}),a)}var ct=["/login","/forgot-password","/reset-password","/force-change-password"];function dt({children:e,windowAccentForRoute:t}){const n=Q(),r=ct.some(e=>n.pathname.startsWith(e)),[o,i]=W([]),a=K(o);I(()=>{a.current=o},[o]);const s=O(ye,we,we),l=K(/* @__PURE__ */new Map),c=e=>{const t=Je(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};$(()=>{Ge.clear();for(const e of o)e.route&&Ge.set(e.id,e.route)},[o]);const d=R(e=>{i(t=>t.filter(t=>t.id!==e))},[]),u=R(e=>{var t;Ue(e)||Xe(e)?(t=e,window.dispatchEvent(new CustomEvent(cr,{detail:{windowKey:t}}))):d(e)},[d]),h=(e,t=!1)=>{const n=gn;t&&He.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,(bn.get(i)??-1)>a)||$n(o),t&&He.delete(e)},50)},m=R((e,t,n,r,o)=>{if(!ie[e]||!ne(ie[e]))return;const a=`${e}:${t}`,s=_e();i(i=>{const l=i.find(n=>n.entityType===e&&String(n.entityId)===String(t));return l?(h(l.id),i):(h(a,!0),[...i,{id:a,type:"modal",label:r||t,route:o||window.location.pathname,entityType:e,entityId:t,entitySnapshot:ze(n),openedFrom:s}])})},[]),p=R((e,t={})=>{if(!ie[e]||!te(ie[e]))return;const n=ie[e],{reuse:r=!1,background:o=!1,shellOwned:s,search:l}=t,c=e=>{var t;o?(t=e,Ln.add(t)):h(e)};if(n.widget){const t=a.current.find(t=>"page"===t.type&&t.route===e);if(t)return void u(t.id)}const d=_e();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 c(a),[...t,{id:a,type:"page",label:n.label,route:e,openedFrom:d,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}}]}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 c(a),[...t,{id:a,type:"page",label:n.label,route:e,openedFrom:d,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}}]})},[u]),f=R(()=>{},[]),w=R(()=>{},[]),y=u,g=u;/* @__PURE__ */
|
|
40
|
+
return V($e.Provider,{value:{openWindows:o,openEntity:m,openPage:p,closeEntity:y,minimize:f,items:[],openItems:o,restore:w,remove:g,restoreIfMinimized:()=>!1},children:[e,
|
|
41
|
+
/* @__PURE__ */J(lt,{openWindows:o,onRemove:u,onSplitView:Tr,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&&$n(e)}})},onActivateById:Ve}),
|
|
42
|
+
/* @__PURE__ */J(zr,{}),!r&&o.map(e=>{const n=e.route?t?.(e.route):void 0;
|
|
43
43
|
/* @__PURE__ */
|
|
44
|
-
return
|
|
45
|
-
return
|
|
46
|
-
return
|
|
44
|
+
return J(ue.Provider,{value:c(e),children:/* @__PURE__ */J(be,{fallback:(t,n)=>/* @__PURE__ */J(Ar,{open:!0,onClose:()=>d(e.id),title:e.label,size:"md",autoHeight:!0,windowKey:e.id,children:/* @__PURE__ */J(ge,{error:t,onReload:n})}),children:/* @__PURE__ */J($t,{spec:qe(e),children:/* @__PURE__ */J(Or,{windowId:e.id,children:"page"===e.type?/* @__PURE__ */J(je,{item:e,onClose:()=>d(e.id),accentRgb:n}):/* @__PURE__ */J(Ye,{item:e,onClose:()=>d(e.id),onMinimize:()=>{},accentRgb:n})})})})},e.id)})]})}var ut=null,ht=/* @__PURE__ */new Set;function mt(){return ut}function pt(e){if(ut!==e){ut=e;for(const e of ht)e()}}function ft(e){return ht.add(e),()=>{ht.delete(e)}}var wt=!1,yt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},gt=()=>{};function bt(e){wt=e,yt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0}}function vt(e,t){wt&&("submenu"===e?yt.submenus++:yt.menus++,yt.menuKey=t)}function xt(e){if(!wt)return gt;const t=performance.now();let n=!1;return()=>{if(n)return;if(n=!0,!wt)return;const r=performance.now()-t;"move"===e?yt.moveMs+=r:yt.resizeMs+=r}}function kt(){const e=yt;return yt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},e}var Et=/* @__PURE__ */new Set(["button","a","input","select","textarea","kbd"]),Ct=/* @__PURE__ */new Set(["svg"]);function Mt(e){const t=[],n={text:"",accessories:[]};return Nt(e,n,t),n.text=t.join("").replace(/\s+/g," ").trim(),n}function Nt(t,n,r){if(null==t||"boolean"==typeof t)return;if("string"==typeof t||"number"==typeof t)return void r.push(String(t));if(Array.isArray(t))return void t.forEach(e=>Nt(e,n,r));if(!F(t))return;const o=t;if(o.type!==e)if(o.type!==q){if("string"==typeof o.type){if(Ct.has(o.type))return;if(!Et.has(o.type))return r.push(" "),j.toArray(o.props.children).forEach(e=>Nt(e,n,r)),void r.push(" ")}n.accessories.push(B(o,{key:`title-part-${n.accessories.length}`}))}else j.toArray(o.props.children).forEach(e=>Nt(e,n,r));else void 0===n.copy&&"string"==typeof o.props.text&&o.props.text&&(n.copy=o.props.text)}var St=/* @__PURE__ */new Map,Lt=/* @__PURE__ */new Set,Tt=0;function zt(){Tt++,Lt.forEach(e=>e())}function At(e){return St.get(e)}function Dt(e){return Lt.add(e),()=>{Lt.delete(e)}}function Pt(){return Tt}var It=A(""),Kt=A(null);function $t({spec:e,children:t}){/* @__PURE__ */
|
|
45
|
+
return J(Kt.Provider,{value:e,children:t})}var Wt=/* @__PURE__ */new Set(["button","input","textarea","select","kbd","svg"]),Ot='button[type="submit"], button[data-submit], button.btn-submit, button.bg-green-600, button.bg-blue-600',Rt='button, a[href], summary, [role="button"], [role="link"], [role="menuitem"], select';function Ft(e){return qt(e).replace(/\s+/g," ").trim()}function qt(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(qt).join("");if(F(e)){const t=e,n="string"==typeof t.type?t.type:"";return Wt.has(n)?"":` ${qt(t.props?.children)} `}return""}function jt(e){const t=D(It);$(()=>{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 Bt={};function Ht(e,t,n){const r=D(It);$(()=>{if(!r)return;Bt[r]||(Bt[r]=[]);const o={label:e,icon:n,onClick:t};return Bt[r].push(o),()=>{Bt[r]=(Bt[r]||[]).filter(e=>e!==o)}},[r,e,t,n])}function Yt({title:e}){const t=K(null);return $(()=>{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__ */J("span",{ref:t,style:{display:"none"},"aria-hidden":"true"})}function Ut(e){}var Xt=A(null);function Vt(){return D(It)}function Jt(){const e=O(lr,sr),t=D(Xt);return t?.active??(fn.length<=1||null!=e)}function _t({children:e,position:t="right",quiet:n=!1}){const r=D(Xt),[o,i]=W(null);return $(()=>{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?G(e,o):null}function Gt({onClick:e,children:t,className:n}){const r=D(Xt);/* @__PURE__ */
|
|
46
|
+
return J("button",{type:"button",onClick:async()=>{if(r?.isDirty){const{confirm:e}=await(import("./ConfirmDialog-OJLZG4QL.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 Qt="erp_window_positions",Zt={};try{const e=localStorage.getItem(Qt);e&&(Zt=JSON.parse(e))}catch{}var en=null;function tn(){en&&clearTimeout(en),en=setTimeout(()=>{try{localStorage.setItem(Qt,JSON.stringify(Zt))}catch{}},500)}var nn="erp_activation_order",rn=[];try{const e=localStorage.getItem(nn),t=e?JSON.parse(e):null;Array.isArray(t)&&t.every(e=>"string"==typeof e)&&(rn=t)}catch{}var on=null;function an(){on&&clearTimeout(on),on=setTimeout(()=>{try{localStorage.setItem(nn,JSON.stringify(rn))}catch{}},500)}function sn(e,t){Zt[e]||(Zt[e]=t,tn())}function ln(e){return Zt[e]?{...Zt[e]}:null}function cn(e,t){Zt[e]=t,tn()}function dn(){const e=u(),t=h();let n=!1;for(const r of Object.keys(Zt))m(Zt[r],e,t)&&(delete Zt[r],n=!0);n&&tn()}var un={sm:384,md:512,lg:672,xl:896,"2xl":1152,"3xl":1408},hn=4e3,mn=()=>{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"},pn={small:.8,medium:1,large:1.25,maximized:1.25},fn=[],wn=/* @__PURE__ */new Set,yn=/* @__PURE__ */new Set,gn=0,bn=/* @__PURE__ */new Map;var vn=0;function xn(){return vn}function kn(){vn++,wn.forEach(e=>e())}var En=/* @__PURE__ */new Map,Cn=/* @__PURE__ */new Map,Mn=/* @__PURE__ */new Map;function Nn(){for(let e=fn.length-1;e>=0;e--){const t=Mn.get(fn[e]);if(t?.tab)return t.owner}return null}function Sn(){return O(lr,Nn,()=>null)}var Ln=/* @__PURE__ */new Set;var Tn=null;function zn(e){Tn=null,$n(e)}function An(e){Tn=e;const t=En.get(e);t&&zn(t)}function Dn(e){Tn===e&&(Tn=null)}function Pn(e,t,n){if(n&&Mn.set(e,n),t)if(En.set(t,e),Cn.set(e,t),Ln.delete(t)){fn.unshift(e);const n=rn.indexOf(t);-1!==n&&rn.splice(n,1),rn.unshift(t),an()}else!function(e,t){const n=rn.indexOf(t);if(-1===n)return void fn.push(e);let r=fn.length;for(let e=0;e<fn.length;e++){const t=Cn.get(fn[e]);if(t&&rn.indexOf(t)>n){r=e;break}}fn.splice(r,0,e)}(e,t),-1===rn.indexOf(t)&&(rn.push(t),an());else fn.push(e);kn(),window.dispatchEvent(new CustomEvent("modal-reorder")),t&&Tn===t&&zn(e)}function In(e){return e?Mn.get(e)?.owner??Cn.get(e)??null:null}var Kn=/* @__PURE__ */new Set;function $n(e){const t=In(sr()),n=fn.indexOf(e);-1!==n&&fn.splice(n,1),fn.push(e);const r=Mn.get(e);if(r?.root&&r.tab&&p()){const e=fn.filter(e=>{const t=Mn.get(e);return!!t&&!t.root&&t.owner===r.owner});for(const t of e)fn.splice(fn.indexOf(t),1),fn.push(t)}yn.delete(e);const o=Cn.get(e);if(o){const e=rn.indexOf(o);-1!==e&&rn.splice(e,1),rn.push(o),an(),Tn&&Tn!==o&&(Tn=null)}kn(),window.dispatchEvent(new CustomEvent("modal-reorder"));const i=In(sr());i&&i!==t&&Kn.forEach(e=>e(i))}function Wn(e){const t=fn.indexOf(e);-1!==t&&fn.splice(t,1),yn.add(e),bn.set(e,++gn);const n=Cn.get(e);if(n){const e=rn.indexOf(n);-1!==e&&(rn.splice(e,1),an())}kn(),window.dispatchEvent(new CustomEvent("modal-reorder"))}var On=/* @__PURE__ */new Set;var Rn=8,Fn=32;function qn(){return u()}var jn=40,Bn=80,Hn=384,Yn=400;function Un(e,t=qn()){const n=Math.min(Math.max(e.x,t.x+Bn-e.w),t.x+t.w-Bn),r=Math.min(Math.max(e.y,t.y),t.y+t.h-jn);return n===e.x&&r===e.y?e:{...e,x:n,y:r}}function Xn(e){const t=e.getBoundingClientRect();if(0===t.width||0===t.height)return!0;const n=qn();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 Vn(e){const t=qn(),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 Jn=null;function _n(e){const t=(Jn||((Jn=document.createElement("div")).style.cssText=["position: fixed","pointer-events: none",`z-index: ${N.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(Jn)),Jn);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 Gn(){Jn&&(Jn.style.opacity="0",Jn.style.display="none")}var Qn=[{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"}],Zn=350,er=200;function tr({maximized:e,onToggleMax:t,onSnap:n,buttonClassName:r,strings:o}){const[i,a]=W(!1),s=K(void 0),l=K(void 0);$(()=>()=>{clearTimeout(s.current),clearTimeout(l.current)},[]);const c=()=>{clearTimeout(l.current),s.current=setTimeout(()=>a(!0),Zn)},d=()=>{clearTimeout(s.current),l.current=setTimeout(()=>a(!1),er)};/* @__PURE__ */
|
|
47
47
|
return V("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:d,children:[
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
/* @__PURE__ */_("div",{onMouseDown:e=>{e.stopPropagation(),fr(!1)},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",zIndex:N.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 Ar({open:e,onClose:t,title:n,icon:r,copyText:s,size:c="lg",dirty:m=!1,onNext:y,onPrev:g,footer:C,bodyScroll:M,onMinimize:L,initialBox:A,actions:I,actionsLeft:q,editing:j=!1,allowPinOnTop:Y,initialPosition:X,widget:Q,compact:Z,appStyle:ee,flushBody:te,autoHeight:ne,autoMinHeight:re,autoWidth:oe,widgetMenu:ie,dimensions:ae,windowKey:se,openedFromKey:le,accentRgb:ce,children:de}){const[he,me]=W(()=>u()),pe=o()&&!he,fe=i()&&!!Q,[we,ye]=W(0),[ge,xe]=W(!1),Ee=$(null),Ce=$(0);K(()=>{Ce.current=we},[we]);const Me=O(e=>{pe&&(Ee.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},xe(!0),pt(le??null))},[pe,le]),Ne=R(ft,mt);K(()=>{if(!ge)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,xe(!1),ye(0),void pt(null);ye(Math.max(0,t))},n=()=>{if(!Ee.current)return;const e=.3*window.innerWidth,n=Ce.current>e;Ee.current=null,xe(!1),n?(ye(window.innerWidth),setTimeout(()=>{t(),ye(0),pt(null)},180)):(ye(0),pt(null))};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",n),window.addEventListener("pointercancel",n),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",n),window.removeEventListener("pointercancel",n)}},[ge]);const[Se,Le]=W(n),Te=T(),ze=Te.window;K(()=>{Le(n)},[n]);const Ae=H(()=>Ft(Se).trim()||void 0,[Se]),De=U(),[Ie,Pe]=W(!1),$e=$(!1),[Ke,We]=W(!1),[Oe,qe]=W(null),je=D($t),Be=D(ue),{prefs:He,save:Ue}=a(),Ye=!!He.window_accent_stripe,Xe=He.favorite_documents||[],Ve=!!je&&Xe.some(e=>e.entityType===je.entityType&&e.entityId===je.entityId),_e=O(()=>{if(!je)return;const e=Ve?Xe.filter(e=>!(e.entityType===je.entityType&&e.entityId===je.entityId)):[...Xe,{entityType:je.entityType,entityId:je.entityId,label:je.label}];Ue({favorite_documents:e})},[je,Ve,Xe,Ue]),[Je,Ge]=W(null),[Qe,Ze]=W("top-right"===X?"right":"left"),et=$(!1),tt=$(null);P(()=>{const e=tt.current;e&&(ce?e.style.setProperty("--window-accent-rgb",ce):e.style.removeProperty("--window-accent-rgb"))},[ce]);const nt=$(!1),rt=$(null),ot=$(null),it=$(null),[at,st]=W(!1),lt=$(null),ct=!!(C||I||q)||at,dt=D(ve),ut=""!==D(Pt),ht=$(null);ht.current=Be?{owner:Be.key,tab:Be.tab,root:!ut}:null;const wt=se||(Be&&!ut?Be.key:null),yt=!!dt&&!ut&&dt.enabled&&dt.hasState&&(j||dt.declaredEditable)&&!dt.handMounted&&ct&&!Q&&!Z&&!ee&&!pe,gt=/* @__PURE__ */_(z,{name:"window",className:"h-4 w-4",strokeWidth:1.5}),bt=r&&F(r)?B(r,{className:`h-4 w-4 ${r.props?.className??""}`.trim()}):r??gt,vt=()=>/* @__PURE__ */_("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:bt}),xt=40,{minimize:kt,items:Et,restoreIfMinimized:Ct,openWindows:Nt}=Fe(),Lt=$(`modal-${Math.random().toString(36).slice(2,8)}`).current;K(()=>{if(Q)return Rn.add(Lt),()=>{Rn.delete(Lt)}},[Q,Lt]),K(()=>{const e=e=>{const t=e.detail;t?.id===Lt&&Le(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[Lt]);const[Tt,At]=W(N.window),Dt=function(e){const t=R(lr,sr);return fn.length<=1||t===e}(Lt),It=function(e){return R(lr,()=>yn.has(e))}(Lt),Kt=R(mr,pr),Wt=R(vr,xr),qt=R(Mr,Nr),jt=!Y&&!Q,Ht=Kt&&jt,[Ut,Yt]=W(!1),Vt=Ht&&qt===Lt,[_t,Jt]=W(!1),Gt=_t&&jt&&Wt===Lt?"picked":null,Qt=$(Ht);K(()=>{if(Qt.current&&!Ht){Jt(!0);const e=setTimeout(()=>{Jt(!1),gr===Lt&&kr(null)},700);return Qt.current=Ht,()=>clearTimeout(e)}Qt.current=Ht},[Ht,Lt]),K(()=>{Ht||Yt(!1)},[Ht]),K(()=>{const e=ot.current,t=it.current;if(!e&&!t)return;const n=e=>e?Array.from(e.children).filter(e=>"shell"!==e.dataset.undoControls).length:0,r=()=>st(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()},[e]),K(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&tt.current){const t=tt.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=ot.current,n=it.current;return t&&t.addEventListener("click",e),n&&n.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e),n&&n.removeEventListener("click",e)}},[e]);const en=$(!1),nn=O(l,[]),rn=O(()=>{const e=l(),t=ae?ae[0]:un[c]||672,n=e.w-80,r=e.h-80,o=Math.min(t,n),i=pn[mn()],a=ae?Math.min(ae[1],r):(()=>{const t=("sm"===c?500:"md"===c?600:"lg"===c?700:"xl"===c?800:920)*i;return Math.max(320,Math.min(t,e.h-80))})(),s="cascade"!==(getComputedStyle(document.documentElement).getPropertyValue("--window-position")?.trim()||"cascade")||u()?0:30*(fn.length-1),d=Math.max(xt,(r-a)/2),h=(n-o)/2,m=e.h-xt-a-d;return"top-right"===X?{x:e.x+e.w-o-xt,y:e.y+xt,w:o,h:a}:"top-left"===X?{x:e.x+xt,y:e.y+xt,w:o,h:a}:{x:e.x+Math.max(xt,(n-o)/2+xt)+Math.min(s,Math.max(0,h)),y:e.y+d+Math.min(s,Math.max(0,m)),w:o,h:a}},[c]),on=$(!1);e||(on.current=!1);const an=se||s||null;K(()=>{if(!e)return;In(Lt,an,ht.current??void 0),se||Kn(Lt),en.current=!1,At(ar(Lt));const t=()=>{At(ar(Lt))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===se;if(!e.label)return!1;const t=tt.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if(Kn(Lt),Ln.current)return;const t=qn(),n=Math.min(Pn.current.w,t.w-40),o=Math.min(Pn.current.h,t.h-40),i=t.x+(t.w-n)/2,a=t.y+(t.h-o)/2;cn({x:i,y:a,w:n,h:o}),Dn(!1)},i=e=>{const t=e.detail;r(t)&&(Kn(Lt),qe({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==se)return;Kn(Lt);const t=Pn.current,n=function(e,t=qn()){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=tt.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)}cn(n)};return window.addEventListener("modal-reorder",t),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=fn.indexOf(e);-1!==t&&(fn.splice(t,1),kn()),yn.delete(e),bn.delete(e),Mn.delete(e);const n=Cn.get(e);n&&(Cn.delete(e),En.delete(n))}(Lt),window.removeEventListener("modal-reorder",t),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"))}},[e,Lt,an,nn]);const sn=!Q&&"maximized"===mn(),[ln,cn]=W(()=>{if(an&&Zt[an]){const e={...Zt[an]};return ae&&(e.w=ae[0],ne||(e.h=ae[1])),Yn(e)}return A?{x:A.x,y:A.y,w:A.w,h:A.h}:sn?nn():rn()}),[dn,wn]=W(()=>!ne),gn=$(he),vn=$(null);K(()=>{const e=()=>{const e=u();e!==gn.current&&vn.current?.(e),gn.current=e,me(e),At(ar(Lt))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[Lt]);const xn=he&&!!Be?.tab&&!ut&&!Q&&!pe,Nn=xn,Ln=$(Nn);Ln.current=Nn;const Tn=Sn(),zn=he&&!!Be?.tab&&!Q&&!pe&&!Kt&&Tn!==Be.key,[An,Dn]=W(()=>an&&Zt[an]||A?Nn:Nn||sn),Pn=$(ln);Pn.current=ln;const $n=$(An);P(()=>{$n.current=An},[An]),P(()=>{if(dn||xn)return;const e=tt.current,t=rt.current;if(!e||!t)return;const n=re??(Q?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 d=e.offsetHeight-t.offsetHeight,u=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=u,t.style.height=m,t.style.overflowY=h;const w=c.offsetHeight>f+4,y=Math.max(n,window.innerHeight-r-Math.max(0,Pn.current.y)-24),g=w?Math.min(Pn.current.h,y):Math.min(Math.max(n,d+p),y),b=Math.abs(g-o)>1;b&&(o=g,cn(e=>Math.abs(e.h-g)>1?{...e,h:g}:e)),Q||(g<=n?i&&(clearTimeout(i),i=null):(b||null===i)&&(i&&clearTimeout(i),i=setTimeout(()=>{const e=o;s(),o===e&&wn(!0)},160)))},l=new ResizeObserver(s);s(),lt.current&&l.observe(lt.current);const c=new MutationObserver(s);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{l.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[dn,Q,re,ct,xn]),P(()=>{if(!ne||!dn||Q||!e)return;const t=lt.current;if(!t)return;let n=t.offsetHeight;const r=new ResizeObserver(()=>{if(!t.isConnected)return;const e=t.offsetHeight,r=e-n,o=e>0!=n>0;if(n=e,!o||0===r||An)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=re??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,s=Math.max(i,window.innerHeight-a-Math.max(0,Pn.current.y)-24);cn(e=>({...e,h:Math.min(Math.max(i,e.h+r),s)}))});return r.observe(t),()=>r.disconnect()},[ne,dn,Q,e,An,re]);const jn=!1!==oe&&!Q&&!ee&&!pe,[Bn,Xn]=W(()=>!jn);P(()=>{if(Bn||!e)return;if(!jn||An)return void Xn(!0);const t=tt.current,n=rt.current;if(!t||!n)return;const r=/* @__PURE__ */new WeakSet;let o=Pn.current.w,i=0;const a=()=>Xn(!0),s=()=>{i=0;const e=Pn.current;if(Math.abs(e.w-o)>1||document.body.classList.contains("rosh-gesturing"))return void a();const s=l(),c=s.w-80;if(e.w>=c)return void a();const d=[],u=[];for(const e of[n,...Array.from(n.querySelectorAll("*"))]){const t=e.scrollWidth-e.clientWidth;if(t<=4||r.has(e))continue;const n=getComputedStyle(e).overflowX;"auto"!==n&&"scroll"!==n||(d.push(e),u.push(t))}if(!d.length)return;const h=Math.min(c,e.w+Math.max(...u)),m=h-e.w,y=t.style.width;t.style.width=`${h}px`;const g=d.map((e,t)=>({over:u[t],residual:e.scrollWidth-e.clientWidth}));t.style.width=y,g.forEach((e,t)=>{p(e,m)||r.add(d[t])});const b=f(e,w(e.w,m,g),s,xt);b!==e&&(o=b.w,cn(b))};s();const c=new MutationObserver(()=>{i||(i=requestAnimationFrame(s))});c.observe(n,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["style","class","hidden"]});const d=setTimeout(a,hn);return()=>{c.disconnect(),i&&cancelAnimationFrame(i),clearTimeout(d)}},[Bn,e,jn,An]);const _n=$(null),Qn=!(!Be?.tab||ut||Q||pe);vn.current=e=>{if(!Qn)return;if(e)return _n.current||(_n.current={box:{...Pn.current},maximized:$n.current}),void($n.current=!0);const t=_n.current;_n.current=null;const n=l();if(t?.maximized)return $n.current=!0,Dn(!0),void cn(n);const r=t?.box??(an?Zt[an]:void 0);if($n.current=!1,Dn(!1),r&&!d(r,n,!1)){const e={...r};ae&&(e.w=ae[0],ne||(e.h=ae[1])),cn(Yn(e))}else cn(rn())},K(()=>{Nn&&($n.current=!0,Dn(!0),cn(nn()))},[Nn,nn]),K(()=>{if(Q)return;const e=()=>{const e=an?Zt[an]:void 0;if($n.current=!1,Dn(!1),e){const t={...e};ae&&(t.w=ae[0],ne||(t.h=ae[1])),cn(Yn(t))}else cn(rn())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[Q,rn,an]),K(()=>{e&&an&&!xn&&(Zt[an]=ln,tn()),e&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[ln,e,an,xn]),K(()=>{if(!e)return;const t=()=>{$n.current?cn(nn()):document.body.classList.contains("rosh-gesturing")||cn(Yn)};window.addEventListener("resize",t),window.addEventListener(h,t);let n=null;return An&&(n=new MutationObserver(t),n.observe(document.body,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["class"]})),()=>{window.removeEventListener("resize",t),window.removeEventListener(h,t),n?.disconnect()}},[e,An,nn]),K(()=>{if(e&&(Pe(!1),$e.current=!1,et.current=!1,Xn(!jn),!Ln.current)){if(an&&Zt[an]){const e=Zt[an];return void cn(t=>Yn({...e,...ne?{h:t.h}:{},...jn?{x:t.x,w:t.w}:{}}))}A&&(cn({x:A.x,y:A.y,w:A.w,h:A.h}),Dn(A.maximized))}},[e]),K(()=>{if(!e||"auto"!==m)return;let t;const n=e=>{tt.current?.contains(e.target)&&!$e.current&&($e.current=!0,t=setTimeout(()=>Pe(!0),0))};return document.addEventListener("input",n,!0),document.addEventListener("change",n,!0),()=>{clearTimeout(t),document.removeEventListener("input",n,!0),document.removeEventListener("change",n,!0)}},[e,m]);const Zn="auto"===m?Ie:!0===m,er=Be&&!ut?Be.key:null,nr=H(()=>Mt(Se),[Se]),dr=$({shortcutSpec:je,isOnDesktop:Ve,toggleDesktopShortcut:_e,taskbarStrings:Te.taskbar});P(()=>{dr.current={shortcutSpec:je,isOnDesktop:Ve,toggleDesktopShortcut:_e,taskbarStrings:Te.taskbar}});const ur=$(null);ur.current||(ur.current={open:(e,t)=>qe({x:e,y:t}),items:()=>{const e=dr.current,t=[];e.shortcutSpec&&t.push({label:e.isOnDesktop?e.taskbarStrings.removeFromDesktop:e.taskbarStrings.addToDesktop,onSelect:e.toggleDesktopShortcut});for(const e of Bt[Lt]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),K(()=>{e&&er&&function(e,t){const n=St.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.menu===t.menu||(St.set(e,t),zt())}(er,{title:nr.text||Ae,dirty:Zn,copy:nr.copy,menu:ur.current??void 0})},[e,er,Ae,Zn,nr.text,nr.copy]),K(()=>{if(e&&er)return()=>{return e=er,void(St.delete(e)&&zt());var e}},[e,er]),Re(!(se||!e)&&Zn);const hr=O(async()=>{if(!et.current){if(Zn||"auto"===m&&$e.current){et.current=!0;const e=Ae,t=await b({title:"Discard changes?",message:e?`“${e}” has unsaved changes. Are you sure you want to close? All changes will be lost.`:"You have unsaved changes. Are you sure you want to close? All changes will be lost.",confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"});if(et.current=!1,!t)return}t()}},[Zn,m,t,Ae]);P(()=>{if(!e||!wt)return;const t=e=>{e.detail?.windowKey===wt&&hr()};return window.addEventListener(cr,t),()=>window.removeEventListener(cr,t)},[e,wt,hr]);const wr=$(null),yr=O(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(qe(null),Kn(Lt),Ln.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=tt.current,s=a?.getBoundingClientRect();let l,c,d,u;if(wr.current){const t=wr.current;wr.current=null,u=t.w,d=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=`${u}px`,a.style.height=`${d}px`,a.style.left=`${l}px`,a.style.top=`${c}px`)}else l=s?s.left:Pn.current.x,c=s?s.top:Pn.current.y,d=s?s.height:Pn.current.h,u=s?s.width:Pn.current.w;Dn(!1),cn(e=>({...e,x:l,y:c,w:u,h:d}));let h=null;const m=e=>{if(!r){if(Math.abs(e.clientX-o)<or&&Math.abs(e.clientY-i)<or)return;r=ir(t,n,"move","move"),a&&(a.style.transition="none")}const s=l+e.clientX-o,d=Math.max(0,c+e.clientY-i);if(a&&(a.style.transform=`translate(${s-l}px, ${d-c}px)`),Pn.current={...Pn.current,x:s,y:d},!Q){const t=function(e,t){const n=qn(),r=e<=n.x+On,o=e>=n.x+n.w-On,i=t<=n.y+On,a=t>=n.y+n.h-On,s=e<=n.x+Fn,l=e>=n.x+n.w-Fn,c=t<=n.y+Fn,d=t>=n.y+n.h-Fn;return i&&s?"tl":i&&l?"tr":a&&s?"bl":a&&l?"br":c&&r?"tl":c&&o?"tr":d&&r?"bl":d&&o?"br":i?"top":r?"left":o?"right":null}(e.clientX,e.clientY);t!==h&&(h=t,t?Jn(Vn(t)):Gn())}},p=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",p),r?.(),Gn();const e=Yn({...Pn.current});if(Pn.current=e,!Q&&h){wr.current={x:l,y:c,w:u,h:d};const e=Vn(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 cn(e)}if(Q){const t=e.x+e.w/2,n=window.innerWidth/2;Ze(t>n?"right":"left")}a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.transform="",a.style.transition=""),cn(e)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",p)},[]),br=O((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=tt.current,l=s?.getBoundingClientRect(),c=l?l.left:Pn.current.x,d=l?l.top:Pn.current.y,u=l?l.width:Pn.current.w,h=l?l.height:Pn.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;Dn(!1),cn({x:c,y:d,w:u,h:h}),Pn.current={x:c,y:d,w:u,h:h};let y=0,g=null;const b=()=>{if(y=0,!g)return;const e=g;g=null,Pn.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`)},v=e=>{if(!o){if(Math.abs(e.clientX-i)<or&&Math.abs(e.clientY-a)<or)return;o=ir(n,r,rr[t],"resize")}g=((e,t)=>{let n=c,r=d,o=u,i=h;if(f&&(o=Math.max(Hn,u+e)),w&&(i=Math.max(Un,h+t)),m){const t=Math.max(Hn,u-e);n=c+u-t,o=t}if(p){const e=Math.max(Un,h-t);r=d+h-e,i=e}return{x:n,y:r,w:o,h:i}})(e.clientX-i,e.clientY-a),y||(y=requestAnimationFrame(b))},x=()=>{window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",x),y&&cancelAnimationFrame(y),b(),o?.(),cn({...Pn.current})};window.addEventListener("pointermove",v),window.addEventListener("pointerup",x)},[]),Er=O(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(),Kn(Lt),"Enter"===e.key)return void(An?(Dn(!1),cn(rn())):(Dn(!0),cn(nn())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{wr.current||(wr.current={...Pn.current})};if(r<0)return e(),Dn(!0),void cn(nn());if(r>0){if(An)return Dn(!1),void cn(rn());if(wr.current){const e=Yn(wr.current);return wr.current=null,Pn.current=e,void cn(e)}return void Wn(Lt)}e(),Dn(!1);const t=Vn(n<0?"left":"right");return Pn.current=t,void cn(t)}if(An)return;const o=Pn.current,i=e.shiftKey?{...o,w:Math.max(Hn,o.w+24*n),h:Math.max(Un,o.h+24*r)}:Yn({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});Pn.current=i,cn(i)},[Lt,An,rn,nn]),Cr=O(e=>{wr.current||(wr.current={...Pn.current}),Dn(!1);const t=Vn(e);Pn.current=t,cn(t),Kn(Lt)},[Lt]),Sr=Nn||Ht?{}:{tabIndex:0,role:"group","aria-label":Ae?`${Ae} — ${ze.windowSuffix}`:ze.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:Er},Lr=()=>{Dn(!0),cn(nn())},Tr=O(()=>{const e=tt.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(Rt);t&&!t.disabled&&t.click()}},[]);K(()=>{if(!e)return;if(Q)return;const t=e=>{if(fn[fn.length-1]===Lt&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),Tr();else{if("INPUT"===t.tagName&&t.closest("form"))return;if(!(t instanceof Element&&tt.current?.contains(t)))return;if(t.closest(Ot))return;e.preventDefault()}}};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e,Tr,Lt,Q]),K(()=>{if(!e)return;const t=e=>{fn[fn.length-1]===Lt&&((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:Lt}})),$e.current=!1,Pe(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:Lt}}))))};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e]),K(()=>{if(!e)return;if(Q)return;const t=e=>{if("Escape"===e.key&&fn[fn.length-1]===Lt){if(S(e))return e.preventDefault(),void e.stopPropagation();if(xn&&!j)return;e.preventDefault(),e.stopPropagation(),hr()}};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e,hr,Lt,Q,xn,j]);const zr=e&&(void 0!==y||void 0!==g),Ar=O(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-white 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(K(()=>{if(!e)return;const t=e=>{if(fn[fn.length-1]!==Lt)return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&zr&&(e.preventDefault(),y?y():Ar("bottom")),"k"===e.key&&zr&&(e.preventDefault(),g?g():Ar("top"))))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e,y,g,zr,Ar,Lt]),!e||on.current)return null;const Dr=Ht?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,d=qn(),u=(d.w-20*(o+1))/o,h=(d.h-14*(i+1)-22*i)/i,m=c?(o-l)*(u+20)/2:0;return{x:d.x+20+s*(u+20)+m,y:d.y+14+a*(h+14+22),w:u,h:h}}(Lt):null,Ir=Ht&&Dr?Math.min(Dr.w/ln.w,Dr.h/ln.h):1,Pr=(()=>{if(Ht&&Dr){const e=Ir,t=ln.w*e,n=ln.h*e,r=Dr.x+(Dr.w-t)/2-ln.x,o=Dr.y+(Dr.h-n)/2-ln.y,i=Ut||Vt;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:N.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(_t&&jt){const e="picked"===Gt;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:N.expose+30}:{}}}return null})(),$r=v({modal:!1,titleId:!Q&&(xn?!Be?.home:!pe)?De:void 0,label:nr.text||Ae}),Kr=/* @__PURE__ */V("div",{children:[
|
|
50
|
-
/* @__PURE__ */V("div",{ref:tt,"data-modal-panel":!0,"data-modal-id":Lt,"data-window-key":se||void 0,...
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
/* @__PURE__ */
|
|
55
|
-
/* @__PURE__ */
|
|
56
|
-
/* @__PURE__ */
|
|
48
|
+
/* @__PURE__ */J("button",{onClick:t,onFocus:c,onBlur:d,title:e?o.windowed:o.maximize,className:r,children:e?"❐":"⤢"}),i&&/* @__PURE__ */J("div",{role:"group","aria-label":o.snapLayouts,onMouseEnter:()=>clearTimeout(l.current),onMouseLeave:d,className:"absolute right-0 top-full z-30 mt-1 grid w-max grid-cols-2 gap-1 rounded-lg border border-gray-200 bg-white p-2 shadow-lg",children:Qn.map(({zone:e,labelKey:t,region:r})=>/* @__PURE__ */J("button",{type:"button","aria-label":o[t],title:o[t],onClick:()=>{a(!1),n(e)},onFocus:()=>clearTimeout(l.current),onBlur:d,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__ */J("span",{"aria-hidden":"true",className:`absolute rounded-sm bg-blue-500/70 ${r}`,style:{margin:2}})},e))})]})}var nr="rosh-gesture-style";var rr={se:"nwse-resize",nw:"nwse-resize",sw:"nesw-resize",ne:"nesw-resize",n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize"},or=4;function ir(e,t,n,r){!function(){if("undefined"==typeof document||document.getElementById(nr))return;const e=document.createElement("style");e.id=nr,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=xt(r);let a=!1;return()=>{if(!a){a=!0,i();try{e.releasePointerCapture(t)}catch{}o.remove(),document.body.classList.remove("rosh-gesturing")}}}function ar(e){const t=fn.indexOf(e);if(-1===t)return-1;const n=N.window+t*N.windowStep,r=Mn.get(e);if(!r||r.root||!r.tab||!p())return n;let o=-1;for(const[e,t]of Mn){if(!t.root||t.owner!==r.owner)continue;const n=fn.indexOf(e);-1!==n&&(o=Math.max(o,N.window+n*N.windowStep))}return o>=n?o+2+Math.min(t,7):n}function sr(){return fn[fn.length-1]||null}function lr(e){return wn.add(e),()=>{wn.delete(e)}}"undefined"!=typeof window&&window.addEventListener("deactivate-all-modals",function(){for(let e=fn.length-1;e>=0;e--)On.has(fn[e])||fn.splice(e,1);rn=rn.filter(e=>{const t=En.get(e);return null!=t&&On.has(t)}),an(),kn(),window.dispatchEvent(new CustomEvent("modal-reorder"))});var cr="modal-close-request";function dr(e){O(lr,xn);const t=D(Xt);if(fn.length<=1)return!0;if(e){const t=En.get(e);if(null!=t)return sr()===t}return t?.active??null!=sr()}var ur=!1,hr=/* @__PURE__ */new Set;function mr(e){return hr.add(e),()=>hr.delete(e)}function pr(){return ur}function fr(e){ur!==e&&(ur=e,hr.forEach(e=>e()))}function wr(){fr(!ur)}function yr(){fr(!1)}var gr=null,br=/* @__PURE__ */new Set;function vr(e){return br.add(e),()=>br.delete(e)}function xr(){return gr}function kr(e){gr!==e&&(gr=e,br.forEach(e=>e()))}var Er=null,Cr=/* @__PURE__ */new Set;function Mr(e){return Cr.add(e),()=>Cr.delete(e)}function Nr(){return Er}function Sr(e){Er!==e&&(Er=e,Cr.forEach(e=>e()))}function Lr(){if(!Er)return void fr(!1);kr(Er),Sr(null),fr(!1)}function Tr(){fr(!ur),window.dispatchEvent(new CustomEvent("modal-split-view"))}function zr(){const e=O(mr,pr),[t,n]=W(e),[r,o]=W(e);return $(()=>{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?G(
|
|
49
|
+
/* @__PURE__ */J("div",{onMouseDown:e=>{e.stopPropagation(),fr(!1)},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",zIndex:N.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 Ar({open:e,onClose:t,title:n,icon:r,copyText:o,size:l="lg",dirty:h=!1,onNext:w,onPrev:v,footer:C,bodyScroll:M,onMinimize:z,initialBox:A,actions:P,actionsLeft:q,editing:j=!1,allowPinOnTop:U,initialPosition:X,widget:Q,compact:Z,appStyle:ee,flushBody:te,autoHeight:ne,autoMinHeight:re,autoWidth:oe,widgetMenu:ie,dimensions:ae,windowKey:se,openedFromKey:le,accentRgb:ce,children:de}){const[he,me]=W(()=>p()),pe=i()&&!he,fe=a()&&!!Q,[we,ye]=W(0),[ge,xe]=W(!1),Ee=K(null),Ce=K(0);$(()=>{Ce.current=we},[we]);const Me=R(e=>{pe&&(Ee.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},xe(!0),pt(le??null))},[pe,le]),Ne=O(ft,mt);$(()=>{if(!ge)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,xe(!1),ye(0),void pt(null);ye(Math.max(0,t))},n=()=>{if(!Ee.current)return;const e=.3*window.innerWidth,n=Ce.current>e;Ee.current=null,xe(!1),n?(ye(window.innerWidth),setTimeout(()=>{t(),ye(0),pt(null)},180)):(ye(0),pt(null))};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",n),window.addEventListener("pointercancel",n),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",n),window.removeEventListener("pointercancel",n)}},[ge]);const[Se,Le]=W(n),Te=T(),ze=Te.window;$(()=>{Le(n)},[n]);const Ae=H(()=>Ft(Se).trim()||void 0,[Se]),De=Y(),[Pe,Ie]=W(!1),Ke=K(!1),[$e,We]=W(!1),[Re,qe]=W(null),je=D(Kt),Be=D(ue),{prefs:He,save:Ye}=s(),Ue=!!He.window_accent_stripe,Xe=He.favorite_documents||[],Ve=!!je&&Xe.some(e=>e.entityType===je.entityType&&e.entityId===je.entityId),Je=R(()=>{if(!je)return;const e=Ve?Xe.filter(e=>!(e.entityType===je.entityType&&e.entityId===je.entityId)):[...Xe,{entityType:je.entityType,entityId:je.entityId,label:je.label}];Ye({favorite_documents:e})},[je,Ve,Xe,Ye]),[_e,Ge]=W(null),[Qe,Ze]=W("top-right"===X?"right":"left"),et=K(!1),tt=K(null);I(()=>{const e=tt.current;e&&(ce?e.style.setProperty("--window-accent-rgb",ce):e.style.removeProperty("--window-accent-rgb"))},[ce]);const nt=K(!1),rt=K(null),ot=K(null),it=K(null),[at,st]=W(!1),lt=K(null),ct=!!(C||P||q)||at,dt=D(ve),ut=""!==D(It),ht=K(null);ht.current=Be?{owner:Be.key,tab:Be.tab,root:!ut}:null;const wt=se||(Be&&!ut?Be.key:null),yt=!!dt&&!ut&&dt.enabled&&dt.hasState&&(j||dt.declaredEditable)&&!dt.handMounted&&ct&&!Q&&!Z&&!ee&&!pe,gt=/* @__PURE__ */J(L,{name:"window",className:"h-4 w-4",strokeWidth:1.5}),bt=r&&F(r)?B(r,{className:`h-4 w-4 ${r.props?.className??""}`.trim()}):r??gt,vt=()=>/* @__PURE__ */J("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:bt}),xt=40,{minimize:kt,items:Et,restoreIfMinimized:Ct,openWindows:Nt}=Fe(),Lt=K(`modal-${Math.random().toString(36).slice(2,8)}`).current;$(()=>{if(Q)return On.add(Lt),()=>{On.delete(Lt)}},[Q,Lt]),$(()=>{const e=e=>{const t=e.detail;t?.id===Lt&&Le(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[Lt]);const[Tt,At]=W(N.window),Dt=function(e){const t=O(lr,sr);return fn.length<=1||t===e}(Lt),Pt=function(e){return O(lr,()=>yn.has(e))}(Lt),$t=O(mr,pr),Wt=O(vr,xr),qt=O(Mr,Nr),jt=!U&&!Q,Ht=$t&&jt,[Yt,Ut]=W(!1),Vt=Ht&&qt===Lt,[Jt,_t]=W(!1),Gt=Jt&&jt&&Wt===Lt?"picked":null,Qt=K(Ht);$(()=>{if(Qt.current&&!Ht){_t(!0);const e=setTimeout(()=>{_t(!1),gr===Lt&&kr(null)},700);return Qt.current=Ht,()=>clearTimeout(e)}Qt.current=Ht},[Ht,Lt]),$(()=>{Ht||Ut(!1)},[Ht]),$(()=>{const e=ot.current,t=it.current;if(!e&&!t)return;const n=e=>e?Array.from(e.children).filter(e=>"shell"!==e.dataset.undoControls).length:0,r=()=>st(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()},[e]),$(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&tt.current){const t=tt.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=ot.current,n=it.current;return t&&t.addEventListener("click",e),n&&n.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e),n&&n.removeEventListener("click",e)}},[e]);const en=K(!1),nn=R(u,[]),rn=R(()=>{const e=u(),t=ae?ae[0]:un[l]||672,n=e.w-80,r=e.h-80,o=Math.min(t,n),i=pn[mn()],a=ae?Math.min(ae[1],r):(()=>{const t=("sm"===l?500:"md"===l?600:"lg"===l?700:"xl"===l?800:920)*i;return Math.max(320,Math.min(t,e.h-80))})(),s="cascade"!==(getComputedStyle(document.documentElement).getPropertyValue("--window-position")?.trim()||"cascade")||p()?0:30*(fn.length-1),c=Math.max(xt,(r-a)/2),d=(n-o)/2,h=e.h-xt-a-c;return"top-right"===X?{x:e.x+e.w-o-xt,y:e.y+xt,w:o,h:a}:"top-left"===X?{x:e.x+xt,y:e.y+xt,w:o,h:a}:{x:e.x+Math.max(xt,(n-o)/2+xt)+Math.min(s,Math.max(0,d)),y:e.y+c+Math.min(s,Math.max(0,h)),w:o,h:a}},[l]),on=K(!1);e||(on.current=!1);const an=se||o||null;$(()=>{if(!e)return;Pn(Lt,an,ht.current??void 0),se||$n(Lt),en.current=!1,At(ar(Lt));const t=()=>{At(ar(Lt))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===se;if(!e.label)return!1;const t=tt.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if($n(Lt),Ln.current)return;const t=qn(),n=Math.min(In.current.w,t.w-40),o=Math.min(In.current.h,t.h-40),i=t.x+(t.w-n)/2,a=t.y+(t.h-o)/2;cn({x:i,y:a,w:n,h:o}),Dn(!1)},i=e=>{const t=e.detail;r(t)&&($n(Lt),qe({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==se)return;$n(Lt);const t=In.current,n=function(e,t=qn()){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=tt.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)}cn(n)};return window.addEventListener("modal-reorder",t),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=fn.indexOf(e);-1!==t&&(fn.splice(t,1),kn()),yn.delete(e),bn.delete(e),Mn.delete(e);const n=Cn.get(e);n&&(Cn.delete(e),En.delete(n))}(Lt),window.removeEventListener("modal-reorder",t),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"))}},[e,Lt,an,nn]);const sn=!Q&&"maximized"===mn(),[ln,cn]=W(()=>{if(an&&Zt[an]){const e={...Zt[an]};return ae&&(e.w=ae[0],ne||(e.h=ae[1])),Un(e)}return A?{x:A.x,y:A.y,w:A.w,h:A.h}:sn?nn():rn()}),[dn,wn]=W(()=>!ne),gn=K(he),vn=K(null);$(()=>{const e=()=>{const e=p();e!==gn.current&&vn.current?.(e),gn.current=e,me(e),At(ar(Lt))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[Lt]);const xn=he&&!!Be?.tab&&!ut&&!Q&&!pe,Nn=xn,Ln=K(Nn);Ln.current=Nn;const Tn=Sn(),zn=he&&!!Be?.tab&&!Q&&!pe&&!$t&&Tn!==Be.key,[An,Dn]=W(()=>an&&Zt[an]||A?Nn:Nn||sn),In=K(ln);In.current=ln;const Kn=K(An);I(()=>{Kn.current=An},[An]),I(()=>{if(dn||xn)return;const e=tt.current,t=rt.current;if(!e||!t)return;const n=re??(Q?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 d=e.offsetHeight-t.offsetHeight,u=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=u,t.style.height=m,t.style.overflowY=h;const w=c.offsetHeight>f+4,y=Math.max(n,window.innerHeight-r-Math.max(0,In.current.y)-24),g=w?Math.min(In.current.h,y):Math.min(Math.max(n,d+p),y),b=Math.abs(g-o)>1;b&&(o=g,cn(e=>Math.abs(e.h-g)>1?{...e,h:g}:e)),Q||(g<=n?i&&(clearTimeout(i),i=null):(b||null===i)&&(i&&clearTimeout(i),i=setTimeout(()=>{const e=o;s(),o===e&&wn(!0)},160)))},l=new ResizeObserver(s);s(),lt.current&&l.observe(lt.current);const c=new MutationObserver(s);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{l.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[dn,Q,re,ct,xn]),I(()=>{if(!ne||!dn||Q||!e)return;const t=lt.current;if(!t)return;let n=t.offsetHeight;const r=new ResizeObserver(()=>{if(!t.isConnected)return;const e=t.offsetHeight,r=e-n,o=e>0!=n>0;if(n=e,!o||0===r||An)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=re??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,s=Math.max(i,window.innerHeight-a-Math.max(0,In.current.y)-24);cn(e=>({...e,h:Math.min(Math.max(i,e.h+r),s)}))});return r.observe(t),()=>r.disconnect()},[ne,dn,Q,e,An,re]);const jn=!1!==oe&&!Q&&!ee&&!pe,[Bn,Xn]=W(()=>!jn);I(()=>{if(Bn||!e)return;if(!jn||An)return void Xn(!0);const t=tt.current,n=rt.current;if(!t||!n)return;const r=/* @__PURE__ */new WeakSet;let o=In.current.w,i=0;const a=()=>Xn(!0),s=()=>{i=0;const e=In.current;if(Math.abs(e.w-o)>1||document.body.classList.contains("rosh-gesturing"))return void a();const s=u(),l=s.w-80;if(e.w>=l)return void a();const c=[],d=[];for(const e of[n,...Array.from(n.querySelectorAll("*"))]){const t=e.scrollWidth-e.clientWidth;if(t<=4||r.has(e))continue;const n=getComputedStyle(e).overflowX;"auto"!==n&&"scroll"!==n||(c.push(e),d.push(t))}if(!c.length)return;const h=Math.min(l,e.w+Math.max(...d)),m=h-e.w,p=t.style.width;t.style.width=`${h}px`;const f=c.map((e,t)=>({over:d[t],residual:e.scrollWidth-e.clientWidth}));t.style.width=p,f.forEach((e,t)=>{y(e,m)||r.add(c[t])});const w=g(e,b(e.w,m,f),s,xt);w!==e&&(o=w.w,cn(w))};s();const l=new MutationObserver(()=>{i||(i=requestAnimationFrame(s))});l.observe(n,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["style","class","hidden"]});const c=setTimeout(a,hn);return()=>{l.disconnect(),i&&cancelAnimationFrame(i),clearTimeout(c)}},[Bn,e,jn,An]);const Jn=K(null),Qn=!(!Be?.tab||ut||Q||pe);vn.current=e=>{if(!Qn)return;if(e)return Jn.current||(Jn.current={box:{...In.current},maximized:Kn.current}),void(Kn.current=!0);const t=Jn.current;Jn.current=null;const n=u();if(t?.maximized)return Kn.current=!0,Dn(!0),void cn(n);const r=t?.box??(an?Zt[an]:void 0);if(Kn.current=!1,Dn(!1),r&&!m(r,n,!1)){const e={...r};ae&&(e.w=ae[0],ne||(e.h=ae[1])),cn(Un(e))}else cn(rn())},$(()=>{Nn&&(Kn.current=!0,Dn(!0),cn(nn()))},[Nn,nn]),$(()=>{if(Q)return;const e=()=>{const e=an?Zt[an]:void 0;if(Kn.current=!1,Dn(!1),e){const t={...e};ae&&(t.w=ae[0],ne||(t.h=ae[1])),cn(Un(t))}else cn(rn())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[Q,rn,an]),$(()=>{e&&an&&!xn&&(Zt[an]=ln,tn()),e&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[ln,e,an,xn]),$(()=>{if(!e)return;const t=()=>{Kn.current?cn(nn()):document.body.classList.contains("rosh-gesturing")||cn(Un)};window.addEventListener("resize",t),window.addEventListener(f,t);let n=null;return An&&(n=new MutationObserver(t),n.observe(document.body,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["class"]})),()=>{window.removeEventListener("resize",t),window.removeEventListener(f,t),n?.disconnect()}},[e,An,nn]),$(()=>{if(e&&(Ie(!1),Ke.current=!1,et.current=!1,Xn(!jn),!Ln.current)){if(an&&Zt[an]){const e=Zt[an];return void cn(t=>Un({...e,...ne?{h:t.h}:{},...jn?{x:t.x,w:t.w}:{}}))}A&&(cn({x:A.x,y:A.y,w:A.w,h:A.h}),Dn(A.maximized))}},[e]),$(()=>{if(!e||"auto"!==h)return;let t;const n=e=>{tt.current?.contains(e.target)&&!Ke.current&&(Ke.current=!0,t=setTimeout(()=>Ie(!0),0))};return document.addEventListener("input",n,!0),document.addEventListener("change",n,!0),()=>{clearTimeout(t),document.removeEventListener("input",n,!0),document.removeEventListener("change",n,!0)}},[e,h]);const Zn="auto"===h?Pe:!0===h,er=Be&&!ut?Be.key:null,nr=H(()=>Mt(Se),[Se]),dr=K({shortcutSpec:je,isOnDesktop:Ve,toggleDesktopShortcut:Je,taskbarStrings:Te.taskbar});I(()=>{dr.current={shortcutSpec:je,isOnDesktop:Ve,toggleDesktopShortcut:Je,taskbarStrings:Te.taskbar}});const ur=K(null);ur.current||(ur.current={open:(e,t)=>qe({x:e,y:t}),items:()=>{const e=dr.current,t=[];e.shortcutSpec&&t.push({label:e.isOnDesktop?e.taskbarStrings.removeFromDesktop:e.taskbarStrings.addToDesktop,onSelect:e.toggleDesktopShortcut});for(const e of Bt[Lt]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),$(()=>{e&&er&&function(e,t){const n=St.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.menu===t.menu||(St.set(e,t),zt())}(er,{title:nr.text||Ae,dirty:Zn,copy:nr.copy,menu:ur.current??void 0})},[e,er,Ae,Zn,nr.text,nr.copy]),$(()=>{if(e&&er)return()=>{return e=er,void(St.delete(e)&&zt());var e}},[e,er]),Oe(!(se||!e)&&Zn);const hr=R(async()=>{if(!et.current){if(Zn||"auto"===h&&Ke.current){et.current=!0;const e=Ae,t=await c({title:"Discard changes?",message:e?`“${e}” has unsaved changes. Are you sure you want to close? All changes will be lost.`:"You have unsaved changes. Are you sure you want to close? All changes will be lost.",confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"});if(et.current=!1,!t)return}t()}},[Zn,h,t,Ae]);I(()=>{if(!e||!wt)return;const t=e=>{e.detail?.windowKey===wt&&hr()};return window.addEventListener(cr,t),()=>window.removeEventListener(cr,t)},[e,wt,hr]);const wr=K(null),yr=R(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(qe(null),$n(Lt),Ln.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=tt.current,s=a?.getBoundingClientRect();let l,c,d,u;if(wr.current){const t=wr.current;wr.current=null,u=t.w,d=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=`${u}px`,a.style.height=`${d}px`,a.style.left=`${l}px`,a.style.top=`${c}px`)}else l=s?s.left:In.current.x,c=s?s.top:In.current.y,d=s?s.height:In.current.h,u=s?s.width:In.current.w;Dn(!1),cn(e=>({...e,x:l,y:c,w:u,h:d}));let h=null;const m=e=>{if(!r){if(Math.abs(e.clientX-o)<or&&Math.abs(e.clientY-i)<or)return;r=ir(t,n,"move","move"),a&&(a.style.transition="none")}const s=l+e.clientX-o,d=Math.max(0,c+e.clientY-i);if(a&&(a.style.transform=`translate(${s-l}px, ${d-c}px)`),In.current={...In.current,x:s,y:d},!Q){const t=function(e,t){const n=qn(),r=e<=n.x+Rn,o=e>=n.x+n.w-Rn,i=t<=n.y+Rn,a=t>=n.y+n.h-Rn,s=e<=n.x+Fn,l=e>=n.x+n.w-Fn,c=t<=n.y+Fn,d=t>=n.y+n.h-Fn;return i&&s?"tl":i&&l?"tr":a&&s?"bl":a&&l?"br":c&&r?"tl":c&&o?"tr":d&&r?"bl":d&&o?"br":i?"top":r?"left":o?"right":null}(e.clientX,e.clientY);t!==h&&(h=t,t?_n(Vn(t)):Gn())}},p=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",p),r?.(),Gn();const e=Un({...In.current});if(In.current=e,!Q&&h){wr.current={x:l,y:c,w:u,h:d};const e=Vn(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 cn(e)}if(Q){const t=e.x+e.w/2,n=window.innerWidth/2;Ze(t>n?"right":"left")}a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.transform="",a.style.transition=""),cn(e)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",p)},[]),br=R((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=tt.current,l=s?.getBoundingClientRect(),c=l?l.left:In.current.x,d=l?l.top:In.current.y,u=l?l.width:In.current.w,h=l?l.height:In.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;Dn(!1),cn({x:c,y:d,w:u,h:h}),In.current={x:c,y:d,w:u,h:h};let y=0,g=null;const b=()=>{if(y=0,!g)return;const e=g;g=null,In.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`)},v=e=>{if(!o){if(Math.abs(e.clientX-i)<or&&Math.abs(e.clientY-a)<or)return;o=ir(n,r,rr[t],"resize")}g=((e,t)=>{let n=c,r=d,o=u,i=h;if(f&&(o=Math.max(Hn,u+e)),w&&(i=Math.max(Yn,h+t)),m){const t=Math.max(Hn,u-e);n=c+u-t,o=t}if(p){const e=Math.max(Yn,h-t);r=d+h-e,i=e}return{x:n,y:r,w:o,h:i}})(e.clientX-i,e.clientY-a),y||(y=requestAnimationFrame(b))},x=()=>{window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",x),y&&cancelAnimationFrame(y),b(),o?.(),cn({...In.current})};window.addEventListener("pointermove",v),window.addEventListener("pointerup",x)},[]),Er=R(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(),$n(Lt),"Enter"===e.key)return void(An?(Dn(!1),cn(rn())):(Dn(!0),cn(nn())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{wr.current||(wr.current={...In.current})};if(r<0)return e(),Dn(!0),void cn(nn());if(r>0){if(An)return Dn(!1),void cn(rn());if(wr.current){const e=Un(wr.current);return wr.current=null,In.current=e,void cn(e)}return void Wn(Lt)}e(),Dn(!1);const t=Vn(n<0?"left":"right");return In.current=t,void cn(t)}if(An)return;const o=In.current,i=e.shiftKey?{...o,w:Math.max(Hn,o.w+24*n),h:Math.max(Yn,o.h+24*r)}:Un({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});In.current=i,cn(i)},[Lt,An,rn,nn]),Cr=R(e=>{wr.current||(wr.current={...In.current}),Dn(!1);const t=Vn(e);In.current=t,cn(t),$n(Lt)},[Lt]),Sr=Nn||Ht?{}:{tabIndex:0,role:"group","aria-label":Ae?`${Ae} — ${ze.windowSuffix}`:ze.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:Er},Lr=()=>{Dn(!0),cn(nn())},Tr=R(()=>{const e=tt.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(Ot);t&&!t.disabled&&t.click()}},[]);$(()=>{if(!e)return;if(Q)return;const t=e=>{if(fn[fn.length-1]===Lt&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),Tr();else{if("INPUT"===t.tagName&&t.closest("form"))return;if(!(t instanceof Element&&tt.current?.contains(t)))return;if(t.closest(Rt))return;e.preventDefault()}}};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e,Tr,Lt,Q]),$(()=>{if(!e)return;const t=e=>{fn[fn.length-1]===Lt&&((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:Lt}})),Ke.current=!1,Ie(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:Lt}}))))};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e]),$(()=>{if(!e)return;if(Q)return;const t=e=>{if("Escape"===e.key&&fn[fn.length-1]===Lt){if(S(e))return e.preventDefault(),void e.stopPropagation();if(xn&&!j)return;e.preventDefault(),e.stopPropagation(),hr()}};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e,hr,Lt,Q,xn,j]);const zr=e&&(void 0!==w||void 0!==v),Ar=R(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-white 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($(()=>{if(!e)return;const t=e=>{if(fn[fn.length-1]!==Lt)return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&zr&&(e.preventDefault(),w?w():Ar("bottom")),"k"===e.key&&zr&&(e.preventDefault(),v?v():Ar("top"))))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e,w,v,zr,Ar,Lt]),!e||on.current)return null;const Dr=Ht?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,d=qn(),u=(d.w-20*(o+1))/o,h=(d.h-14*(i+1)-22*i)/i,m=c?(o-l)*(u+20)/2:0;return{x:d.x+20+s*(u+20)+m,y:d.y+14+a*(h+14+22),w:u,h:h}}(Lt):null,Pr=Ht&&Dr?Math.min(Dr.w/ln.w,Dr.h/ln.h):1,Ir=(()=>{if(Ht&&Dr){const e=Pr,t=ln.w*e,n=ln.h*e,r=Dr.x+(Dr.w-t)/2-ln.x,o=Dr.y+(Dr.h-n)/2-ln.y,i=Yt||Vt;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:N.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(Jt&&jt){const e="picked"===Gt;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:N.expose+30}:{}}}return null})(),Kr=d({modal:!1,titleId:!Q&&(xn?!Be?.home:!pe)?De:void 0,label:nr.text||Ae}),$r=/* @__PURE__ */V("div",{children:[
|
|
50
|
+
/* @__PURE__ */V("div",{ref:tt,"data-modal-panel":!0,"data-modal-id":Lt,"data-window-key":se||void 0,...U?{"data-utility":""}:{},...$e?{"data-pinned-top":""}:{},...Q?{"data-widget":""}:{},...Be?{"data-window-owner":Be.key}:{},...Be&&!ut?{"data-window-root":""}:{},...xn?{"data-window-tab":""}:{},...Kr,className:xn?"fixed flex flex-col overflow-hidden":"fixed rounded-(--radius-window) flex flex-col overflow-hidden "+(Q?Dt?"shadow-xl":"shadow-lg":"border "+(Dt?"shadow-xl border-gray-200":"shadow-lg border-gray-300")),onMouseDownCapture:e=>{if(nt.current=!1,Ht){if(e.target.closest("[data-expose-close]"))return;return e.preventDefault(),e.stopPropagation(),kr(Lt),fr(!1),void $n(Lt)}if(!Dt&&!Q&&!$e&&0===e.button){const t=e.target;t.closest("[data-modal-panel]")===tt.current&&t.closest("button, input, a, select, textarea")&&!t.closest("[data-window-chrome]")&&(e.preventDefault(),e.stopPropagation(),nt.current=!0,qe(null),$n(Lt),window.addEventListener("mouseup",()=>{setTimeout(()=>{nt.current=!1},0)},{once:!0}))}},onClickCapture:e=>{nt.current&&(nt.current=!1,e.preventDefault(),e.stopPropagation())},onMouseDown:e=>{if(Ht)return;qe(null);e.target.closest("[data-modal-panel]")===tt.current&&(e.target.closest("button, input, a, select, textarea")||$n(Lt))},style:pe?{zIndex:Tt+1,top:0,left:0,right:0,bottom:"var(--mobile-bottom-nav, 56px)",width:"auto",height:"auto",transform:`translateX(${we}px)`,transition:ge?"none":"transform 180ms ease-out",...Q?{display:"none"}:{},...Tt<0?{display:"none"}:{},...Dt||$e||Ne&&se===Ne?{}:{display:"none"}}:{zIndex:$e?N.pinnedWindow:Tt+1,width:ln.w,height:ln.h,top:ln.y,...Q&&"right"===Qe?{right:window.innerWidth-ln.x-ln.w}:{left:ln.x},...Tt<0&&!$e?{display:"none"}:{},...fe?{display:"none"}:{},...zn?{visibility:"hidden",pointerEvents:"none"}:{},...Ir??{}},children:[pe&&!Q&&/* @__PURE__ */J("div",{onPointerDown:Me,className:"absolute top-0 bottom-0 left-0 w-[22px] z-[5]",style:{touchAction:"pan-y"},"aria-hidden":"true"}),Q?null:xn?Be?.home?null:/* @__PURE__ */V(_,{children:[
|
|
51
|
+
/* @__PURE__ */J("h2",{id:De,"data-window-title":!0,className:"sr-only",children:nr.text||Ae}),(nr.accessories.length>0||zr)&&/* @__PURE__ */V("div",{"data-window-chrome":"","data-record-bar":"",className:"flex h-9 shrink-0 select-none items-center gap-3 border-b border-gray-200 px-4",style:{backgroundColor:"rgb(var(--window-content-rgb))"},children:[
|
|
52
|
+
/* @__PURE__ */J("div",{className:"flex min-w-0 flex-1 items-center gap-2 overflow-hidden",children:nr.accessories}),zr&&/* @__PURE__ */V("span",{className:"flex items-center gap-1 shrink-0 text-2xs text-gray-400",children:[
|
|
53
|
+
/* @__PURE__ */J("kbd",{className:"rounded border border-gray-300 bg-gray-100 px-2 py-0.5 font-medium text-gray-500",children:"K"}),
|
|
54
|
+
/* @__PURE__ */J("span",{children:ze.prev}),
|
|
55
|
+
/* @__PURE__ */J("kbd",{className:"rounded border border-gray-300 bg-gray-100 px-2 py-0.5 font-medium ml-1 text-gray-500",children:"J"}),
|
|
56
|
+
/* @__PURE__ */J("span",{children:ze.next})]})]})]}):pe?null:
|
|
57
57
|
/* @__PURE__ */V("div",Z?{onPointerDown:yr,"data-window-chrome":"",...Sr,className:"flex items-center justify-between h-(--row-height-compact-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 "+(Dt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:Dt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
58
58
|
/* @__PURE__ */V("div",{"data-window-title":!0,title:Ae,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:Dt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Ht&&vt(),
|
|
59
|
-
/* @__PURE__ */
|
|
60
|
-
/* @__PURE__ */
|
|
59
|
+
/* @__PURE__ */J("span",{id:De,className:"truncate",children:Ht?Ft(Se):Se})]}),!Ht&&/* @__PURE__ */V("div",{className:"flex items-center gap-1 shrink-0 ml-2",children:[U&&/* @__PURE__ */J("button",{onClick:()=>We(e=>!e),title:$e?ze.unpin:ze.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+($e?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */J(L,{name:"bookmark-square",className:"h-3 w-3",fill:$e?"currentColor":"none",strokeWidth:1.5})}),
|
|
60
|
+
/* @__PURE__ */J("button",{type:"button",onClick:hr,className:"rounded p-0.5 text-gray-400 hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */J(L,{name:"close",className:"h-4 w-4"})})]})]}:ee?{onPointerDown:yr,"data-window-chrome":"",...Sr,className:"flex items-center justify-between h-(--row-height-compact-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 "+(Dt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:Dt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
61
61
|
/* @__PURE__ */V("div",{"data-window-title":!0,title:Ae,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:Dt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Ht&&vt(),
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
-
/* @__PURE__ */
|
|
62
|
+
/* @__PURE__ */J("span",{id:De,className:"truncate",children:Ht?Ft(Se):Se})]}),!Ht&&/* @__PURE__ */V("div",{className:"flex items-center gap-0.5 shrink-0 ml-2",children:[U&&/* @__PURE__ */J("button",{onClick:()=>We(e=>!e),title:$e?ze.unpin:ze.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+($e?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */J(L,{name:"bookmark-square",className:"h-3 w-3",fill:$e?"currentColor":"none",strokeWidth:1.5})}),
|
|
63
|
+
/* @__PURE__ */J("button",{onClick:()=>Wn(Lt),title:ze.minimize,className:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",children:"─"}),!Nn&&/* @__PURE__ */J(tr,{maximized:An,onToggleMax:()=>{An?(Dn(!1),cn(rn())):Lr()},onSnap:Cr,buttonClassName:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",strings:ze}),
|
|
64
|
+
/* @__PURE__ */J("button",{type:"button",onClick:hr,className:"rounded p-0.5 text-gray-400 hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */J(L,{name:"close",className:"h-4 w-4"})})]})]}:{onPointerDown:yr,"data-window-chrome":"",...Sr,className:"flex items-center justify-between h-(--row-height-window-bar) px-4 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 "+(Dt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:Dt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
65
65
|
/* @__PURE__ */V("div",{"data-window-title":!0,title:Ae,className:"text-base font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:Dt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Ht&&vt(),
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
/* @__PURE__ */
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
-
/* @__PURE__ */
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
/* @__PURE__ */
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
/* @__PURE__ */
|
|
66
|
+
/* @__PURE__ */J("span",{id:De,className:"truncate",children:Ht?Ft(Se):Se})]}),!Ht&&/* @__PURE__ */V("div",{className:"flex items-center gap-2 shrink-0 ml-4",children:[zr&&/* @__PURE__ */V("span",{className:"flex items-center gap-1 mr-1 text-2xs text-gray-400",children:[
|
|
67
|
+
/* @__PURE__ */J("kbd",{className:"rounded border border-gray-300 bg-gray-200 px-2 py-0.5 font-medium text-gray-500",children:"K"}),
|
|
68
|
+
/* @__PURE__ */J("span",{children:ze.prev}),
|
|
69
|
+
/* @__PURE__ */J("kbd",{className:"rounded border border-gray-300 bg-gray-200 px-2 py-0.5 font-medium ml-1 text-gray-500",children:"J"}),
|
|
70
|
+
/* @__PURE__ */J("span",{children:ze.next})]}),U&&/* @__PURE__ */J("button",{onClick:()=>We(e=>!e),title:$e?ze.unpin:ze.pinOnTop,className:"text-xs px-2 py-1 rounded hover:bg-gray-200 "+($e?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */J(L,{name:"bookmark-square",className:"h-3.5 w-3.5",fill:$e?"currentColor":"none",strokeWidth:1.5})}),
|
|
71
|
+
/* @__PURE__ */J("button",{onClick:()=>Wn(Lt),title:ze.minimize,className:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",children:"─"}),!Nn&&/* @__PURE__ */J(tr,{maximized:An,onToggleMax:()=>{An?(Dn(!1),cn(rn())):Lr()},onSnap:Cr,buttonClassName:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",strings:ze}),
|
|
72
|
+
/* @__PURE__ */J("kbd",{className:"rounded border border-gray-300 bg-gray-200 px-2 py-0.5 text-2xs font-medium text-gray-400",children:"ESC"}),
|
|
73
|
+
/* @__PURE__ */J("button",{type:"button",onClick:hr,className:"rounded-(--radius-control) text-gray-400 hover:text-gray-600",children:/* @__PURE__ */J(L,{name:"close",className:"h-5 w-5"})})]})]}),ce&&Ue&&!Q&&!pe&&/* @__PURE__ */J("div",{"aria-hidden":"true",className:"h-[3px] shrink-0 pointer-events-none",style:{backgroundColor:`rgb(var(--window-accent-rgb) / ${Dt?.9:.55})`}}),
|
|
74
|
+
/* @__PURE__ */J(It.Provider,{value:Lt,children:/* @__PURE__ */J(Xt.Provider,{value:{rightRef:ot,leftRef:it,notify:()=>st(!0),active:Dt,isDirty:Zn,footerOpen:ct&&!Q&&!Z&&!ee&&!pe},children:/* @__PURE__ */J("div",{ref:rt,...Q?{onPointerDown:yr,onContextMenu:e=>{e.preventDefault(),Ge({x:e.clientX,y:e.clientY})}}:{},className:`flex-1 min-h-0 flex flex-col ${Q?"p-0 cursor-move":ee||te?"p-0":Z?"p-2":"p-4"} ${Q||xn?"":"backdrop-blur-sm"} ${!1===M||ee||te?"overflow-hidden":"overflow-y-auto overscroll-contain"} ${Q?"rounded-2xl select-none":""}`,style:{...Q?{touchAction:"none"}:{},backgroundColor:Q?"transparent":xn?"rgb(var(--window-content-rgb))":Dt?"rgb(var(--window-content-rgb) / var(--active-content-opacity, 0.9))":"rgb(var(--window-content-rgb) / var(--inactive-content-opacity, 0.8))"},children:/* @__PURE__ */J(be,{children:de})})})}),Q&&_e&&/* @__PURE__ */V(x,{minWidth:160,style:{left:_e.x,top:_e.y},onClose:()=>Ge(null),children:[
|
|
75
|
+
/* @__PURE__ */J(k,{onClick:()=>{Ge(null),window.dispatchEvent(new CustomEvent("widget-open-settings",{detail:Lt}))},children:"Settings"}),
|
|
76
|
+
/* @__PURE__ */J(E,{}),ie&&/* @__PURE__ */V(_,{children:[ie,
|
|
77
|
+
/* @__PURE__ */J(E,{})]}),
|
|
78
78
|
/* @__PURE__ */V(k,{onClick:()=>{Ge(null),We(e=>!e)},children:[
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
/* @__PURE__ */
|
|
79
|
+
/* @__PURE__ */J("span",{className:"flex-1",children:"Always on Top"}),$e&&/* @__PURE__ */J(L,{name:"check",className:"h-4 w-4 text-blue-600 shrink-0",strokeWidth:2})]}),
|
|
80
|
+
/* @__PURE__ */J(E,{}),
|
|
81
|
+
/* @__PURE__ */J(k,{onClick:()=>{Ge(null),hr()},children:"Close"})]}),
|
|
82
82
|
/* @__PURE__ */V("div",{onPointerDown:yr,ref:lt,className:`px-4 py-2 border-t border-gray-200 shrink-0 flex items-center justify-between text-xs select-none${xn?"":" cursor-move"}${Dt&&!xn?" backdrop-blur-sm":""}${Q||Z||ee||pe||!ct?" hidden":""}`,style:{touchAction:"none",backgroundColor:xn?"rgb(var(--window-footer-rgb))":Dt?"rgb(var(--window-footer-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-footer-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
83
|
-
/* @__PURE__ */V("div",{className:"flex items-center gap-2 min-w-0",children:[yt&&/* @__PURE__ */
|
|
84
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */V("div",{className:"flex items-center gap-2 min-w-0",children:[yt&&/* @__PURE__ */J(ke,{auto:!0}),q,
|
|
84
|
+
/* @__PURE__ */J("div",{ref:it,"data-modal-actions-left":!0,className:"flex items-center gap-2"}),C]}),
|
|
85
85
|
/* @__PURE__ */V("div",{className:"flex items-center gap-2 ml-auto",children:[
|
|
86
|
-
/* @__PURE__ */
|
|
87
|
-
/* @__PURE__ */
|
|
88
|
-
/* @__PURE__ */
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
-
/* @__PURE__ */
|
|
93
|
-
/* @__PURE__ */
|
|
94
|
-
/* @__PURE__ */
|
|
86
|
+
/* @__PURE__ */J("div",{ref:ot,"data-modal-actions":!0,className:"flex items-center gap-2"}),P]})]}),!Q&&!pe&&!Ht&&Dt&&!Nn&&/* @__PURE__ */V(_,{children:[
|
|
87
|
+
/* @__PURE__ */J("div",{onPointerDown:e=>br(e,"se"),className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize z-10"}),
|
|
88
|
+
/* @__PURE__ */J("div",{onPointerDown:e=>br(e,"sw"),className:"absolute bottom-0 left-0 w-3 h-3 cursor-nesw-resize z-10"}),
|
|
89
|
+
/* @__PURE__ */J("div",{onPointerDown:e=>br(e,"ne"),className:"absolute top-0 right-0 w-3 h-3 cursor-nesw-resize z-10"}),
|
|
90
|
+
/* @__PURE__ */J("div",{onPointerDown:e=>br(e,"nw"),className:"absolute top-0 left-0 w-3 h-3 cursor-nwse-resize z-10"}),
|
|
91
|
+
/* @__PURE__ */J("div",{onPointerDown:e=>br(e,"n"),className:"absolute top-0 left-3 right-3 h-1 cursor-ns-resize"}),
|
|
92
|
+
/* @__PURE__ */J("div",{onPointerDown:e=>br(e,"s"),className:"absolute bottom-0 left-3 right-3 h-1 cursor-ns-resize"}),
|
|
93
|
+
/* @__PURE__ */J("div",{onPointerDown:e=>br(e,"e"),className:"absolute top-3 bottom-3 right-0 w-1 cursor-ew-resize"}),
|
|
94
|
+
/* @__PURE__ */J("div",{onPointerDown:e=>br(e,"w"),className:"absolute top-3 bottom-3 left-0 w-1 cursor-ew-resize"})]}),Ht&&/* @__PURE__ */J("div",{className:"absolute inset-0",style:{zIndex:N.hint,cursor:"pointer",background:"transparent"},onMouseEnter:()=>Ut(!0),onMouseLeave:()=>Ut(!1),onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),$n(Lt),fr(!1)},onClick:e=>{e.stopPropagation(),e.preventDefault()},children:Yt&&/* @__PURE__ */J("button",{type:"button","data-expose-close":!0,"aria-label":Te.taskbar.closeWindow,title:"Close",className:"absolute flex items-center justify-center rounded-full bg-black/55 text-white 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/Pr})`,transformOrigin:"top right",zIndex:N.raised},onMouseDown:e=>{e.stopPropagation(),e.preventDefault()},onClick:e=>{e.stopPropagation(),e.preventDefault(),hr()},children:/* @__PURE__ */J(L,{name:"close",className:"h-4 w-4",strokeWidth:2.2})})})]}),Ht&&Dr&&/* @__PURE__ */J("div",{className:"fixed pointer-events-none select-none truncate text-center",style:{left:Dr.x,top:Dr.y+Dr.h+4,width:Dr.w,zIndex:N.expose+(Yt?21:11),color:"white",fontSize:"var(--text-xs)",fontWeight:500,textShadow:"0 1px 2px rgba(0,0,0,0.6)"},children:Ft(Se)})]}),Wr=Re&&/* @__PURE__ */V(x,{style:{left:Re.x,top:Re.y},onClose:()=>qe(null),minWidth:160,children:[!Q&&!Z&&!xn&&/* @__PURE__ */V(_,{children:[
|
|
95
95
|
/* @__PURE__ */V(k,{onClick:()=>{Wn(Lt),qe(null)},children:[
|
|
96
|
-
/* @__PURE__ */
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
-
/* @__PURE__ */
|
|
99
|
-
/* @__PURE__ */
|
|
100
|
-
/* @__PURE__ */
|
|
101
|
-
/* @__PURE__ */
|
|
96
|
+
/* @__PURE__ */J(L,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),ze.minimize]}),!Nn&&/* @__PURE__ */V(k,An?{onClick:()=>{Dn(!1),cn(rn()),qe(null)},children:[
|
|
97
|
+
/* @__PURE__ */J("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */J("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 4.5v15m6-15v15M4.5 9h15M4.5 15h15"})}),ze.windowed]}:{onClick:()=>{Lr(),qe(null)},children:[
|
|
98
|
+
/* @__PURE__ */J(L,{name:"expand",className:"h-4 w-4",strokeWidth:1.5}),ze.maximize]})]}),U&&!xn&&/* @__PURE__ */V(k,{onClick:()=>{We(e=>!e),qe(null)},children:[
|
|
99
|
+
/* @__PURE__ */J(L,{name:"bookmark-square",className:"h-4 w-4 "+($e?"text-blue-600":""),fill:$e?"currentColor":"none",strokeWidth:1.5}),$e?ze.unpin:ze.pinOnTop]}),je&&/* @__PURE__ */V(k,{onClick:()=>{qe(null),Je()},children:[
|
|
100
|
+
/* @__PURE__ */J(L,{name:"star",className:"h-4 w-4",fill:Ve?"currentColor":"none",strokeWidth:1.5}),Ve?Te.taskbar.removeFromDesktop:Te.taskbar.addToDesktop]}),(Bt[Lt]||[]).length>0&&/* @__PURE__ */J(_,{children:(Bt[Lt]||[]).map((e,t)=>/* @__PURE__ */V(k,{onClick:()=>{qe(null),e.onClick()},children:[e.icon,e.label]},t))}),!(xn&&Be?.home)&&/* @__PURE__ */V(_,{children:[
|
|
101
|
+
/* @__PURE__ */J(E,{}),
|
|
102
102
|
/* @__PURE__ */V(k,{danger:!0,onClick:()=>{qe(null),hr()},children:[
|
|
103
|
-
/* @__PURE__ */
|
|
104
|
-
/* @__PURE__ */
|
|
105
|
-
/* @__PURE__ */
|
|
106
|
-
/* @__PURE__ */
|
|
107
|
-
/* @__PURE__ */V(
|
|
108
|
-
return V(ve.Provider,{value:ae,children:[ce&&/* @__PURE__ */
|
|
103
|
+
/* @__PURE__ */J(L,{name:"close",className:"h-4 w-4"}),ze.close]})]})]}),Or=!!se&&Nt.some(e=>e.id===se),Rr=!Pt||Or||Q?null:/* @__PURE__ */V("div",{"data-modal-restore-tab":!0,"data-modal-id":Lt,className:"fixed left-1/2 z-(--z-restore-tab) flex -translate-x-1/2 items-center gap-1 rounded-lg border border-gray-300 bg-white px-2 py-1 shadow-lg",style:{bottom:"calc(var(--taskbar-height, 0px) + 12px)"},children:[
|
|
104
|
+
/* @__PURE__ */J("button",{type:"button",onClick:()=>$n(Lt),title:ze.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:Ae||ze.windowSuffix}),
|
|
105
|
+
/* @__PURE__ */J("button",{type:"button",onClick:()=>$n(Lt),title:ze.restore,"aria-label":ze.restore,className:"rounded px-2 py-0.5 text-xs leading-none text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:"▴"}),
|
|
106
|
+
/* @__PURE__ */J("button",{type:"button",onClick:()=>{hr()},title:ze.close,"aria-label":ze.close,className:"rounded px-2 py-0.5 text-xs leading-none text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:"✕"})]});return G(
|
|
107
|
+
/* @__PURE__ */V(Kt.Provider,{value:null,children:[$r,Wr,Rr]}),document.body)}"undefined"!=typeof window&&window.addEventListener("keydown",e=>{ur&&"Escape"===e.key&&(Sr(null),fr(!1))});var Dr=100,Pr={past:[],future:[]};function Ir(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>Dr?r.slice(r.length-Dr):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:Pr}}var Kr=/* @__PURE__ */new Set(["INPUT","TEXTAREA","SELECT"]);var $r=500,Wr=250;function Or({children:e,canEdit:t=!0,perms:n,windowId:r}){const[o,i]=U(Ir,Pr),a=K(/* @__PURE__ */new Map),[s,l]=W(0),c=s>0,[d,u]=W(0),[h,m]=W(0),p=h>0,{hasAnyPerm:f}=w(),y=t&&0===d&&(!(n&&n.length>0)||f(n)),g=K(null),b=K(!1),v=R(()=>{const e={};for(const[t,n]of a.current)e[t]=n.getLast();return e},[]),x=R((e,t)=>{a.current.has(e)||l(e=>e+1),a.current.set(e,t)},[]),k=R(e=>{a.current.delete(e)&&l(e=>e-1)},[]),E=R(e=>{u(t=>t+(e?1:-1))},[]),C=R(e=>{m(t=>t+(e?1:-1))},[]),[M,N]=W(0),S=M>0,L=R(e=>{N(t=>t+(e?1:-1))},[]),T=D(ve),z=T?.claimReadOnly;$(()=>{if(z&&!y)return z(!0),()=>z(!1)},[z,y]);const A=T?.claimOwnMount;$(()=>{if(A&&S)return A(!0),()=>A(!1)},[A,S]);const P=K({last:0,count:0,tripped:!1}),I=K(!1),O=R((e,t,n)=>{if(b.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)||(I.current=!0));if(!y||g.current)return;const r=P.current;if(r.tripped)return;const o=Date.now();if(o-r.last>Wr&&(r.count=0),r.last=o,++r.count>$r)return r.tripped=!0,void console.error(`[efficient-shell] UndoProvider: "${e}" recorded ${$r} 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:v(),label:e,coalesceKey:t},queueMicrotask(()=>{const e=g.current;g.current=null,e&&i({type:"record",step:e})})},[y,v]),F=R(e=>{for(const[t,n]of Object.entries(e)){const e=a.current.get(t);e&&(e.setLast(n),e.apply(n))}},[]),q=R(()=>{const e=o.past[o.past.length-1];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};F(e.values),i({type:"undo",redoStep:t})},[o.past,v,F]),j=R(()=>{const e=o.future[0];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};F(e.values),i({type:"redo",undoStep:t})},[o.future,v,F]),[B,Y]=W(0),X=K(0),_=K(0),G=K(!1),Q=R(()=>{b.current=!0,I.current=!1,g.current=null,X.current+=1,_.current=X.current,Y(X.current)},[]),Z=K(void 0),ee=R(e=>{void 0!==e&&(void 0!==Z.current&&e!==Z.current&&(G.current=!0),Z.current=e),Q()},[Q]);$(()=>{b.current&&B===_.current&&(b.current=!1,g.current=null,(I.current||G.current)&&i({type:"clear"}),I.current=!1,G.current=!1)},[B]);const te=R(()=>{G.current=!0,i({type:"clear"}),Q()},[Q]),ne=y&&o.past.length>0,re=y&&o.future.length>0,oe=dr(r),ie=K({undo:q,redo:j,canUndo:ne,canRedo:re});ie.current={undo:q,redo:j,canUndo:ne,canRedo:re},$(()=>{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&&Kr.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=H(()=>({register:x,unregister:k,record:O,undo:q,redo:j,clear:te,baseline:ee,canUndo:ne,canRedo:re,enabled:y,hasState:c,handMounted:S,claimOwnMount:L,claimReadOnly:E,declaredEditable:p,claimEditable:C,undoLabel:ne?o.past[o.past.length-1].label:null,redoLabel:re?o.future[0].label:null}),[x,k,O,q,j,te,ee,ne,re,y,c,S,L,E,p,C,o.past,o.future]),se=""!==Vt(),le=D(Xt)?.footerOpen??!1,ce=se&&y&&c&&!S&≤/* @__PURE__ */
|
|
108
|
+
return V(ve.Provider,{value:ae,children:[ce&&/* @__PURE__ */J(_t,{position:"left",quiet:!0,children:/* @__PURE__ */J(ke,{auto:!0})}),e]})}function Rr(){const e=D(ve),t=R(()=>{},[]);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 Fr(e){const t=D(ve),n=t?.claimReadOnly,r=t?.claimEditable;$(()=>{const t=e?r:n;if(t)return t(!0),()=>t(!1)},[n,r,e])}function qr(e,t,n){const r=D(ve),o=Y(),i=K(e),a=K(t);a.current=t,$(()=>{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=K(r);c.current=r;const d=K({label:s,coalesceKey:l});d.current={label:s,coalesceKey:l},$(()=>{const t=c.current;t&&(Object.is(e,i.current)||(t.record(d.current.label,d.current.coalesceKey,{prev:i.current,next:e}),i.current=e))},[e])}function jr(e,t){const[n,r]=W(e);return qr(n,e=>r(()=>e),t),[n,r]}export{Gt as CancelButton,Be as DocFavStar,Ae as EntityWindowFallback,Te as EntityWindowLoading,De as EntityWindowState,Rt as KEY_ACTIVATED_SELECTOR,Se as LoadingSpinner,Ot as MODAL_SUBMIT_SELECTOR,Ar as Modal,_t as ModalActions,ke as UndoControls,Or as UndoProvider,ie as WINDOW_REGISTRY,ge as WindowCrashedFallback,be as WindowErrorBoundary,dt as WindowManagerProvider,Yt as WindowTitle,Ve as activateWindowById,xt as beginWindowGesture,Dn as cancelWindowFront,de as client_default,Lr as commitExposeHighlight,kt as drainPerfEvents,yr as exitExposeMode,dn as forgetMaximizedWindowBoxes,sr as getActiveModalId,Qe as getActiveWindowRoute,Nr as getExposeHighlight,Pt as getWindowChromeVersion,ln as getWindowPosition,Ie as isDraftEntityId,Ke as isDraftEntityWindow,ne as isEntityEntry,te as isPageEntry,le as isShellApiClientConfigured,Je as isTabWindow,vt as markMenuOpen,At as readWindowChrome,An as requestWindowFront,Sr as setExposeHighlight,bt as setPerfCollecting,se as setShellApiClient,fe as setShellHomeRoute,oe as setShellWindowRegistry,sn as setWindowDefaultPosition,cn as setWindowPosition,Mt as splitTitle,Mr as subscribeExposeHighlight,Dt as subscribeWindowChrome,wr as toggleExposeMode,Sn as useCurrentTabKey,Vt as useEnclosingModalId,dr as useIsActiveWindow,Jt as useModalActive,he as usePageSearch,Rr as useUndo,Fr as useUndoCanEdit,qr as useUndoable,jr as useUndoableState,jt as useWidgetSettings,Oe as useWindowDirty,Fe as useWindowManager,Ht as useWindowMenuItem,Ut as useWindowTitle};
|