efficient-shell 4.162.0 → 4.163.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 +152 -0
- package/dist/{Browser-TNUODLDN.js → Browser-2I27OQFE.js} +14 -14
- package/dist/Calculator-2EB2RAT7.js +29 -0
- package/dist/ConfirmDialog-4LZXI6FM.js +1 -0
- package/dist/{CurrencyConverter-4XKRUO7Y.js → CurrencyConverter-4EEIPAVX.js} +5 -5
- package/dist/{Documents-VYDMJL37.js → Documents-24YAA5UU.js} +7 -7
- package/dist/{Files-D3D6JWSJ.js → Files-BU7FY2VD.js} +24 -24
- package/dist/{Notepad-CBJIS3WA.js → Notepad-3D4L3K5W.js} +7 -7
- package/dist/PdfViewer-5VBKCPCM.js +1 -0
- package/dist/{PomodoroTimer-PB6J2LMS.js → PomodoroTimer-B4OPUTJL.js} +26 -26
- package/dist/{Preview-O2UZROZO.js → Preview-VZSNH76G.js} +10 -10
- package/dist/{Sidebar-PPC3OK4H.js → Sidebar-7AY5WJZC.js} +27 -27
- package/dist/{Spreadsheet-AYV4CQP3.js → Spreadsheet-TAJ24BQS.js} +14 -14
- package/dist/{Stock-FGJ5HQ7H.js → Stock-VEPDDIMJ.js} +3 -3
- package/dist/{Weather-FW3WWYCI.js → Weather-KGZF4DDW.js} +19 -19
- package/dist/{WorldClock-UC4CXE2N.js → WorldClock-UGADOCFW.js} +5 -5
- package/dist/apps/index.js +1 -1
- package/dist/brand.css +1 -1
- package/dist/{chunk-HQLEQIMG.js → chunk-2FZGALCU.js} +7 -7
- package/dist/{chunk-2S73NE3L.js → chunk-4GOHPACN.js} +1 -1
- package/dist/{chunk-GTQJYE6M.js → chunk-6A7BN7EN.js} +6 -6
- package/dist/chunk-A6O4Y63A.js +1 -0
- package/dist/{chunk-GBL5KOGP.js → chunk-E4JWTNG5.js} +18 -18
- package/dist/{chunk-STJVLCQU.js → chunk-FWY5IRGL.js} +2 -2
- package/dist/{chunk-4SQNYTO3.js → chunk-GSBX7KIS.js} +17 -17
- package/dist/{chunk-4VMA4ALC.js → chunk-IJ3V2YOS.js} +8 -8
- package/dist/{chunk-7ESGXPKN.js → chunk-J5HNLMGZ.js} +7 -7
- package/dist/chunk-L7ZMDZAB.js +9 -0
- package/dist/{chunk-5UNSI4UI.js → chunk-MAMJHPFN.js} +1 -1
- package/dist/{chunk-EYU4IAEZ.js → chunk-NLASNJNY.js} +1 -1
- package/dist/{chunk-EU3AQ4B2.js → chunk-PX435JG4.js} +1 -1
- package/dist/chunk-QRJ2ERKR.js +9 -0
- package/dist/{chunk-ZWYKMIX7.js → chunk-TBM3ZIAN.js} +14 -14
- package/dist/{chunk-6WLGERBO.js → chunk-TZ2EFTST.js} +8 -8
- package/dist/{chunk-7EACKL5V.js → chunk-UMOVLVTC.js} +1 -1
- package/dist/chunk-VWTYRICQ.js +963 -0
- package/dist/{chunk-A2FL26TE.js → chunk-WURTAA2S.js} +1 -1
- package/dist/chunk-YJX2IWHB.js +1 -0
- package/dist/{chunk-S6ZIQSAF.js → chunk-ZAJPQAGP.js} +1 -1
- package/dist/file-intake/index.js +1 -1
- package/dist/{index-DYVoKNru.d.ts → index-JQXMH_km.d.ts} +540 -69
- package/dist/index.d.ts +3 -42
- package/dist/index.js +645 -645
- package/dist/map/index.js +2 -2
- package/dist/page-tabs/index.js +5 -5
- package/dist/pdf/index.js +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +1 -1
- package/package.json +3 -2
- package/dist/Calculator-HHPPI72V.js +0 -29
- package/dist/ConfirmDialog-D46T6ZXW.js +0 -1
- package/dist/PdfViewer-UEMING6A.js +0 -1
- package/dist/chunk-6CKRJ4YK.js +0 -942
- package/dist/chunk-DYVN6C2E.js +0 -9
- package/dist/chunk-LQVXGB7A.js +0 -1
- package/dist/chunk-O46U4PVN.js +0 -4
- package/dist/chunk-UZUH5PVW.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{isStaleChunkError as e,CMD_Z as t,CMD_SHIFT_Z as n,LoadingSpinner as r,Result as o,useIsMobile as i,useShellPrefs as a}from"./chunk-
|
|
1
|
+
import{isStaleChunkError as e,CMD_Z as t,CMD_SHIFT_Z as n,LoadingSpinner as r,Result as o,useIsMobile as i,useShellPrefs as a}from"./chunk-6A7BN7EN.js";import{computeMaximizedBox as l,isSidebarStripReserved as s,boxFillsWorkArea as c,readAlwaysMaximizedFlag as d,WORK_AREA_CHANGED_EVENT as u,useShellAuth as h,scrollerIsFluid as m,growBoxToWidth as p,widthToFit as f,navIcons as w}from"./chunk-DSSLOQDW.js";import{Button_default as y}from"./chunk-PH3PRIFP.js";import{CopyButton as g}from"./chunk-6KO2U66R.js";import{confirm as v}from"./chunk-E4JWTNG5.js";import{PopupMenu as b,PopupMenuItem as x,PopupMenuDivider as k,PopupMenuLabel as E}from"./chunk-L7ZMDZAB.js";import{Z_LAYERS as M,runEscapeInterceptors as L}from"./chunk-OSJ3ADF2.js";import{useShellStrings as C}from"./chunk-YJX2IWHB.js";import{createContext as N,useContext as S,Component as A,useLayoutEffect as T,useRef as z,useEffect as D,useState as P,useSyncExternalStore as I,useCallback as $,isValidElement as W,Fragment as K,Children as O,cloneElement as R,useMemo as j,useReducer as B,useId as H,Suspense as F}from"react";import{jsxs as q,jsx as V,Fragment as Y}from"react/jsx-runtime";import{createPortal as U}from"react-dom";import{XMarkIcon as X}from"@heroicons/react/24/outline";import{useLocation as _}from"react-router-dom";import{useQueryClient as J,useQuery as G}from"@tanstack/react-query";function Z(e){return"component"in e}function Q(e){return"endpoint"in e}var ee={};function te(e){ee=e}var ne=new Proxy({},{get:(e,t)=>ee[t],has:(e,t)=>t in ee,ownKeys:()=>Object.keys(ee),getOwnPropertyDescriptor(e,t){if(t in ee)return{configurable:!0,enumerable:!0,value:ee[t]}}}),re=null;function oe(e){re=e}function ie(){return null!==re}var ae=/* @__PURE__ */new Set(["get","post","put","patch","delete","head","options","request"]),le=new Proxy({},{get:(e,t)=>re?re[t]:"string"==typeof t&&ae.has(t)?()=>Promise.resolve({data:null,status:0,statusText:"",headers:{},config:{}}):void 0}),se=N(null);function ce(){return S(se)?.pageSearch??""}var de=null,ue=/* @__PURE__ */new Set;function he(e){de!==e&&(de=e,ue.forEach(e=>e()))}function me(){return de}function pe(e){return ue.add(e),()=>{ue.delete(e)}}function fe({error:t,onReload:n}){const r=e(t);/* @__PURE__ */
|
|
2
2
|
return q("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 py-12 text-center",children:[
|
|
3
3
|
/* @__PURE__ */V("svg",{className:"h-8 w-8 text-amber-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */V("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"})}),
|
|
4
4
|
/* @__PURE__ */q("div",{className:"min-w-0",children:[
|
|
@@ -14,14 +14,14 @@ return V(o,{status:"warning",title:"Sign in required",subTitle:"Your session may
|
|
|
14
14
|
return V(o,{status:"403",className:Le});if(404===e||410===e)/* @__PURE__ */
|
|
15
15
|
return V(o,{status:"404",title:"Record not found",className:Le});const t=null==e||408===e||429===e||e>=500;/* @__PURE__ */
|
|
16
16
|
return V(o,{status:"500",title:"Couldn't load record",subTitle:t?"Check your connection and try again.":"The server rejected this request.",extra:t?/* @__PURE__ */V(y,{variant:"secondary",size:"sm",onClick:i,children:"Try again"}):void 0,className:Le})}/* @__PURE__ */
|
|
17
|
-
return V(o,{status:"404",title:"Record not found",className:Le})}function Ae({entity:e,children:t,...n}){return null!=e?/* @__PURE__ */V(Y,{children:t(e)}):/* @__PURE__ */V(Se,{...n})}var Te=/^[a-z]+(?:-[a-z]+)*-\d{13}$/;function ze(e){return"string"==typeof e&&(e.startsWith("new-")||Te.test(e))}function De(e){if(ze(e.entityId))return!0;const t=e.entitySnapshot;return!(!t||"object"!=typeof t||!t._new&&!t._duplicate)}var Pe=N({openWindows:[],openEntity:()=>{},openPage:()=>{},closeEntity:()=>{},minimize:()=>{},items:[],restore:()=>{},remove:()=>{},restoreIfMinimized:()=>!1,openItems:[]}),Ie=N(null);function $e(e){const t=S(Ie),n=z(null);null===n.current&&(n.current=/* @__PURE__ */Symbol("window-dirty")),T(()=>{if(t)return t(n.current,e)},[t,e]),D(()=>{if(!t||!e)return;const n=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[t,e])}function We(){const e=z(/* @__PURE__ */new Map),[t,n]=P(!1);return{dirty:t,registerDirty:$((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 Ke(){return S(Pe)}function Oe(e){if("page"!==e.type&&De(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 Re({item:e,onClose:t,accentRgb:n}){const{dirty:r,registerDirty:o}=We(),i=ne[e.route];if(!i||!
|
|
17
|
+
return V(o,{status:"404",title:"Record not found",className:Le})}function Ae({entity:e,children:t,...n}){return null!=e?/* @__PURE__ */V(Y,{children:t(e)}):/* @__PURE__ */V(Se,{...n})}var Te=/^[a-z]+(?:-[a-z]+)*-\d{13}$/;function ze(e){return"string"==typeof e&&(e.startsWith("new-")||Te.test(e))}function De(e){if(ze(e.entityId))return!0;const t=e.entitySnapshot;return!(!t||"object"!=typeof t||!t._new&&!t._duplicate)}var Pe=N({openWindows:[],openEntity:()=>{},openPage:()=>{},closeEntity:()=>{},minimize:()=>{},items:[],restore:()=>{},remove:()=>{},restoreIfMinimized:()=>!1,openItems:[]}),Ie=N(null);function $e(e){const t=S(Ie),n=z(null);null===n.current&&(n.current=/* @__PURE__ */Symbol("window-dirty")),T(()=>{if(t)return t(n.current,e)},[t,e]),D(()=>{if(!t||!e)return;const n=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[t,e])}function We(){const e=z(/* @__PURE__ */new Map),[t,n]=P(!1);return{dirty:t,registerDirty:$((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 Ke(){return S(Pe)}function Oe(e){if("page"!==e.type&&De(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 Re({item:e,onClose:t,accentRgb:n}){const{dirty:r,registerDirty:o}=We(),i=ne[e.route];if(!i||!Z(i))return null;const a=i,l=a.component;/* @__PURE__ */
|
|
18
18
|
return V(Cr,{open:!0,onClose:t,icon:w[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__ */V(Ie.Provider,{value:o,children:/* @__PURE__ */V(F,{fallback:/* @__PURE__ */V("div",{className:"flex items-center justify-center py-12",children:/* @__PURE__ */V(Me,{})}),children:/* @__PURE__ */V(l,{})})})})}function je({entityType:e,entityId:t,label:n}){const r=C(),o=J(),{data:i}=G({queryKey:["my-profile-sidebar"],enabled:ie(),queryFn:()=>le.get("/auth/me/").then(e=>e.data)}),a=(i?.preferences||{}).favorite_documents||[],l=a.some(n=>n.entityType===e&&n.entityId===t);/* @__PURE__ */
|
|
19
|
-
return V("button",{onClick:()=>{const r=l?a.filter(n=>!(n.entityType===e&&n.entityId===t)):[...a,{entityType:e,entityId:t,label:n}];le.patch("/auth/me/",{preferences:{favorite_documents:r}}).then(()=>{o.invalidateQueries({queryKey:["my-profile-sidebar"]})})},title:l?r.taskbar.removeFromDesktop:r.taskbar.addToDesktop,className:"shrink-0 transition-colors "+(l?"text-yellow-500 hover:text-yellow-600":"text-gray-300 hover:text-yellow-400"),children:/* @__PURE__ */V("svg",{className:"h-4 w-4",fill:l?"currentColor":"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */V("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z"})})})}var Be=/* @__PURE__ */new Set;function He({item:e,onClose:t,onMinimize:n,accentRgb:r}){const o=ne[e.entityType];if(!o||!
|
|
19
|
+
return V("button",{onClick:()=>{const r=l?a.filter(n=>!(n.entityType===e&&n.entityId===t)):[...a,{entityType:e,entityId:t,label:n}];le.patch("/auth/me/",{preferences:{favorite_documents:r}}).then(()=>{o.invalidateQueries({queryKey:["my-profile-sidebar"]})})},title:l?r.taskbar.removeFromDesktop:r.taskbar.addToDesktop,className:"shrink-0 transition-colors "+(l?"text-yellow-500 hover:text-yellow-600":"text-gray-300 hover:text-yellow-400"),children:/* @__PURE__ */V("svg",{className:"h-4 w-4",fill:l?"currentColor":"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */V("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z"})})})}var Be=/* @__PURE__ */new Set;function He({item:e,onClose:t,onMinimize:n,accentRgb:r}){const o=ne[e.entityType];if(!o||!Q(o))return null;const i=o,[a,l]=P(!1),{dirty:s,registerDirty:c}=We(),d=i.queryKey||i.endpoint.replace(/^\/|\/$/g,"").split("/").pop()||e.entityType,u=e.entitySnapshot?._duplicate,h=ze(e.entityId),m=!i.selfFetching&&!u&&!h&&ie(),p=G({queryKey:[d,e.entityId],queryFn:()=>{return le.get((t=i.endpoint,n=String(e.entityId),`${t}${encodeURIComponent(n)}/`)).then(e=>e.data);var t,n},initialData:Ne(e.entitySnapshot),initialDataUpdatedAt:0,enabled:m,staleTime:0,refetchOnWindowFocus:!0,refetchOnMount:"always",refetchInterval:e=>!ke(e.state.error)&&6e4,refetchIntervalInBackground:!1,retry:Ee}),f=p.data,y=p.refetch;D(()=>{var t;if(m)return t=t=>{t!==e.id||Be.has(t)||y({cancelRefetch:!1})},Tn.add(t),()=>{Tn.delete(t)}},[y,e.id,m]);const g=$(()=>{a&&!s?l(!1):t()},[a,s,t]),v=i.selfFetching?e.label:f?i.title(f,a,l):e.label,b=i.icon,x=b?w[b]:null,k=v,E=!i.selfFetching&&f&&i.footer&&!u?i.footer(f):void 0;return i.rendersOwnModal?i.selfFetching?/* @__PURE__ */V(F,{fallback:/* @__PURE__ */V(Me,{}),children:i.render(f??e.entitySnapshot,t,e.entityId,a,l)}):null!=f?/* @__PURE__ */V(F,{fallback:/* @__PURE__ */V(Cr,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */V(Ce,{})}),children:i.render(f,t,e.entityId,a,l)}):/* @__PURE__ */V(Cr,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */V(Se,{isPending:p.isPending,isFetching:p.isFetching,enabled:m,error:p.error,onRetry:y})}):/* @__PURE__ */V(Cr,{open:!0,onClose:g,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:s,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__ */V(Ie.Provider,{value:c,children:/* @__PURE__ */V(F,{fallback:/* @__PURE__ */V(Ce,{}),children:i.selfFetching?i.render(null,t,e.entityId,a,l):/* @__PURE__ */V(Ae,{entity:f,isPending:p.isPending,isFetching:p.isFetching,enabled:m,error:p.error,onRetry:y,children:n=>i.render(n,t,e.entityId,a,l)})})})})}function Fe(e){return document.querySelector(`[data-modal-panel][data-window-key="${e}"]`)}function qe(e){return document.querySelector(`[data-modal-panel][data-window-root][data-window-owner="${e}"]`)}function Ve(e){const t=Fe(e),n=t??qe(e);if(!n)return;if(t&&!Hn(t))return r=e,void window.dispatchEvent(new CustomEvent("modal-reveal",{detail:{windowKey:r}}));var r;const o=n.getAttribute("data-modal-id");o&&zn(o)}function Ye(e){if("page"!==e.type)return!0;const t=e.route?ne[e.route]:void 0;if(!t||!Z(t))return!0;const n=t;return!n.widget&&!n.utility}function Ue(){const e=nr();if(!e)return;const t=document.querySelector(`[data-modal-panel][data-modal-id="${e}"]`);return t?.getAttribute("data-window-key")??void 0}var Xe=/* @__PURE__ */new Map;function _e(){const e=Ue();if(e)return Xe.get(e)}function Je(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 Ge="rosh-peek-style";function Ze(e){"undefined"!=typeof document&&(!function(){if("undefined"==typeof document||document.getElementById(Ge))return;const e=document.createElement("style");e.id=Ge,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:249!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 Qe(){"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 et({id:e,label:t,maxW:n,maxH:r,titleAbove:o=!1,onClick:i,onClose:a}){const l=C(),s=z(null),[c,d]=P({w:n,h:Math.round(.75*r)}),[u,h]=P(!1);return T(()=>{const o=s.current;if(!o)return;const i=Fe(e)??Je(t);if(!i)return void h(!1);const a=i.getBoundingClientRect();if(0===a.width||0===a.height)return void h(!1);const l=Math.min(n/a.width,r/a.height),c=Math.max(80,Math.round(a.width*l)),u=Math.max(60,Math.round(a.height*l));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(${l})`,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__ */q("div",{style:{width:c.w,height:c.h},className:"relative rounded-md overflow-hidden bg-white/95 border border-gray-300 shadow-md cursor-pointer ring-2 ring-transparent group-hover:ring-blue-400 transition shrink-0",onClick:i,children:[
|
|
20
20
|
/* @__PURE__ */V("div",{ref:s,className:"absolute inset-0 z-0 overflow-hidden"}),!u&&/* @__PURE__ */q("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-gray-400 bg-gray-50",children:[
|
|
21
21
|
/* @__PURE__ */V("svg",{className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */V("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6.75A2.25 2.25 0 016 4.5h12a2.25 2.25 0 012.25 2.25v10.5A2.25 2.25 0 0118 19.5H6a2.25 2.25 0 01-2.25-2.25V6.75z M3.75 9h16.5"})}),
|
|
22
|
-
/* @__PURE__ */V("span",{className:"mt-1 text-[10px] uppercase tracking-wide",children:"Hidden"})]}),!o&&/* @__PURE__ */V("div",{className:"absolute bottom-0 left-0 right-0 z-10 px-2 py-1 text-[10px] font-medium text-white bg-gradient-to-t from-black/80 to-transparent truncate pointer-events-none",children:t}),a&&/* @__PURE__ */V("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:l.taskbar.closeWindow,children:/* @__PURE__ */V("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:/* @__PURE__ */V("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}function tt({items:e,anchorEl:t,onActivate:n,onClose:r,onMouseEnter:o,onMouseLeave:i}){const a=C(),l=e.length>1,s=z(null),[c,d]=P({left:-9999,top:-9999,ready:!1}),[u,h]=P(()=>"undefined"!=typeof document&&getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom");T(()=>{const e=s.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]),D(()=>
|
|
23
|
-
/* @__PURE__ */V("div",{ref:s,"data-taskbar-preview":"",style:{position:"fixed",left:c.left,top:c.top,zIndex:300,maxWidth:"calc(100vw - 16px)",opacity:c.ready?1:0},className:l?"flex gap-2 flex-wrap":"",onMouseEnter:o,onMouseLeave:()=>{
|
|
24
|
-
return q("div",{className:"group flex flex-col items-center",onMouseEnter:()=>
|
|
22
|
+
/* @__PURE__ */V("span",{className:"mt-1 text-[10px] uppercase tracking-wide",children:"Hidden"})]}),!o&&/* @__PURE__ */V("div",{className:"absolute bottom-0 left-0 right-0 z-10 px-2 py-1 text-[10px] font-medium text-white bg-gradient-to-t from-black/80 to-transparent truncate pointer-events-none",children:t}),a&&/* @__PURE__ */V("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:l.taskbar.closeWindow,children:/* @__PURE__ */V("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:/* @__PURE__ */V("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}function tt({items:e,anchorEl:t,onActivate:n,onClose:r,onMouseEnter:o,onMouseLeave:i}){const a=C(),l=e.length>1,s=z(null),[c,d]=P({left:-9999,top:-9999,ready:!1}),[u,h]=P(()=>"undefined"!=typeof document&&getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom");T(()=>{const e=s.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]),D(()=>Qe,[]);const m="top"===u,p=(m?"mt-1":"mb-1")+" max-w-[240px] truncate text-[11px] 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 U(
|
|
23
|
+
/* @__PURE__ */V("div",{ref:s,"data-taskbar-preview":"",style:{position:"fixed",left:c.left,top:c.top,zIndex:300,maxWidth:"calc(100vw - 16px)",opacity:c.ready?1:0},className:l?"flex gap-2 flex-wrap":"",onMouseEnter:o,onMouseLeave:()=>{Qe(),i()},children:e.map(e=>{const t=Fe(e.id)??Je(e.label),o=t?function(e){if(Hn(e))return null;const t=e.getBoundingClientRect(),n=Wn(),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 q("div",{className:"group flex flex-col items-center",onMouseEnter:()=>Ze(t),children:[!m&&/* @__PURE__ */V("span",{className:p,children:e.label}),
|
|
25
25
|
/* @__PURE__ */V(et,{id:e.id,label:e.label,maxW:240,maxH:160,titleAbove:!0,onClick:()=>n(e.id),onClose:()=>r(e.id)}),m&&/* @__PURE__ */V("span",{className:p,children:e.label}),null!==o&&/* @__PURE__ */q("span",{title:a.taskbar.offscreenHint,className:"mt-1 inline-flex items-center gap-1 rounded bg-amber-500 px-1.5 py-0.5 text-[10px] font-semibold text-white shadow-sm",children:[
|
|
26
26
|
/* @__PURE__ */V("svg",{className:"h-3 w-3",style:{transform:`rotate(${o}deg)`},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:/* @__PURE__ */V("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14m0 0l-5-5m5 5l-5 5"})}),"Off screen"]})]},e.id)})}),document.body)}function nt(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 rt({openWindows:e,onRemove:t,onSplitView:n,onActivate:r,onActivateById:o}){const i=C(),[a,l]=P(null);D(()=>{let e,t;const n=()=>{clearInterval(e),clearTimeout(t),e=void 0},r=()=>{const e=document.getElementById("taskbar-windows");return l(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 s=I(rr,nr),[,c]=P(0);D(()=>{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]=P(0);D(()=>{const e=()=>d(e=>e+1);return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[]);const u=e=>{const t=Je(e),n=t?.querySelector("[data-window-title]");return n?.textContent?.trim()||e},[h,m]=P(null),[p,f]=P(null),[y,g]=P(null),v=z(null),M=()=>{v.current&&(clearTimeout(v.current),v.current=null),v.current=setTimeout(()=>{m(null),f(null)},150)},L=e.filter(e=>!e.route||!ne[e.route]?.utility);if(!a||!a.isConnected||0===L.length)return null;const N=[],S=/* @__PURE__ */new Map;for(const e of L){const t=e.route?ne[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 U(
|
|
27
27
|
/* @__PURE__ */q(Y,{children:[N.map(e=>{const n=e.route?w[e.route]:null,r=e.items[e.items.length-1];let a=!1;if(s){const t=document.querySelector(`[data-modal-id="${s}"]`);if(t){const n=t.querySelector("[data-window-title]"),r=n?.textContent??"";a=e.items.some(e=>r.includes(e.label))}}const l=e.items.length>1,c=e.items.some(e=>{const t=Fe(e.id)??Je(e.label);return!!t&&!Hn(t)});/* @__PURE__ */
|
|
@@ -40,17 +40,17 @@ return q("button",{onClick:()=>o(r.id),onMouseEnter:t=>{return n=e.items,r=t.cur
|
|
|
40
40
|
/* @__PURE__ */V("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */V("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75h6.5v6.5h-6.5zM13.75 8.75h6.5v6.5h-6.5z"})}),i.taskbar.restoreAllWindows]}),
|
|
41
41
|
/* @__PURE__ */V(k,{}),
|
|
42
42
|
/* @__PURE__ */q(x,{danger:!0,onClick:()=>{g(null),y.items.forEach(e=>t(e.id))},children:[
|
|
43
|
-
/* @__PURE__ */V("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */V("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),`${i.taskbar.closeAllWindows} (${y.items.length})`]})]}),h&&p&&/* @__PURE__ */V(tt,{items:h,anchorEl:p,onActivate:e=>{o(e),m(null),f(null)},onClose:e=>{t(e),m(null),f(null)},onMouseEnter:()=>{v.current&&(clearTimeout(v.current),v.current=null)},onMouseLeave:M})]}),a)}var ot=["/login","/forgot-password","/reset-password","/force-change-password"];function it({children:e,windowAccentForRoute:t}){const n=_(),r=ot.some(e=>n.pathname.startsWith(e)),[o,i]=P([]),a=z(o);T(()=>{a.current=o},[o]);const l=I(pe,me,me),s=z(/* @__PURE__ */new Map),c=e=>{const t=Ye(e),n=!!l&&"page"===e.type&&e.route===l,r=e.pageSearch||void 0,o=s.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 s.current.set(e.id,i),i};D(()=>{Xe.clear();for(const e of o)e.route&&Xe.set(e.id,e.route)},[o]);const d=$(e=>{i(t=>t.filter(t=>t.id!==e))},[]),u=$(e=>{var t;Fe(e)||qe(e)?(t=e,window.dispatchEvent(new CustomEvent(or,{detail:{windowKey:t}}))):d(e)},[d]),h=(e,t=!1)=>{const n=mn;t&&Be.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,(pn.get(i)??-1)>a)||zn(o),t&&Be.delete(e)},50)},m=$((e,t,n,r,o)=>{if(!ne[e]||!
|
|
43
|
+
/* @__PURE__ */V("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */V("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),`${i.taskbar.closeAllWindows} (${y.items.length})`]})]}),h&&p&&/* @__PURE__ */V(tt,{items:h,anchorEl:p,onActivate:e=>{o(e),m(null),f(null)},onClose:e=>{t(e),m(null),f(null)},onMouseEnter:()=>{v.current&&(clearTimeout(v.current),v.current=null)},onMouseLeave:M})]}),a)}var ot=["/login","/forgot-password","/reset-password","/force-change-password"];function it({children:e,windowAccentForRoute:t}){const n=_(),r=ot.some(e=>n.pathname.startsWith(e)),[o,i]=P([]),a=z(o);T(()=>{a.current=o},[o]);const l=I(pe,me,me),s=z(/* @__PURE__ */new Map),c=e=>{const t=Ye(e),n=!!l&&"page"===e.type&&e.route===l,r=e.pageSearch||void 0,o=s.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 s.current.set(e.id,i),i};D(()=>{Xe.clear();for(const e of o)e.route&&Xe.set(e.id,e.route)},[o]);const d=$(e=>{i(t=>t.filter(t=>t.id!==e))},[]),u=$(e=>{var t;Fe(e)||qe(e)?(t=e,window.dispatchEvent(new CustomEvent(or,{detail:{windowKey:t}}))):d(e)},[d]),h=(e,t=!1)=>{const n=mn;t&&Be.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,(pn.get(i)??-1)>a)||zn(o),t&&Be.delete(e)},50)},m=$((e,t,n,r,o)=>{if(!ne[e]||!Q(ne[e]))return;const a=`${e}:${t}`,l=Ue();i(i=>{const s=i.find(n=>n.entityType===e&&String(n.entityId)===String(t));return s?(h(s.id),i):(h(a,!0),[...i,{id:a,type:"modal",label:r||t,route:o||window.location.pathname,entityType:e,entityId:t,entitySnapshot:Ne(n),openedFrom:l}])})},[]),p=$((e,t={})=>{if(!ne[e]||!Z(ne[e]))return;const n=ne[e],{reuse:r=!1,background:o=!1,shellOwned:l,search:s}=t,c=e=>{var t;o?(t=e,En.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=Ue();i(t=>{if(n.multiInstance){const i=t.filter(t=>"page"===t.type&&t.route===e);if(r&&!s&&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,...l?{shellOwned:l}:{},...s?{pageSearch:s}:{}}]}const i=t.find(t=>"page"===t.type&&t.route===e);if(i)return n.widget?t:(o||h(i.id),s&&i.pageSearch!==s?t.map(e=>e===i?{...e,pageSearch:s}:e):t);const a=`page:${e}`;return c(a),[...t,{id:a,type:"page",label:n.label,route:e,openedFrom:d,...l?{shellOwned:l}:{},...s?{pageSearch:s}:{}}]})},[u]),f=$(()=>{},[]),w=$(()=>{},[]),y=u,g=u;/* @__PURE__ */
|
|
44
44
|
return q(Pe.Provider,{value:{openWindows:o,openEntity:m,openPage:p,closeEntity:y,minimize:f,items:[],openItems:o,restore:w,remove:g,restoreIfMinimized:()=>!1},children:[e,
|
|
45
45
|
/* @__PURE__ */V(rt,{openWindows:o,onRemove:u,onSplitView:Mr,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&&zn(e)}})},onActivateById:Ve}),
|
|
46
46
|
/* @__PURE__ */V(Lr,{}),!r&&o.map(e=>{const n=e.route?t?.(e.route):void 0;
|
|
47
47
|
/* @__PURE__ */
|
|
48
48
|
return V(se.Provider,{value:c(e),children:/* @__PURE__ */V(we,{fallback:(t,n)=>/* @__PURE__ */V(Cr,{open:!0,onClose:()=>d(e.id),title:e.label,size:"md",autoHeight:!0,windowKey:e.id,children:/* @__PURE__ */V(fe,{error:t,onReload:n})}),children:/* @__PURE__ */V(zt,{spec:Oe(e),children:/* @__PURE__ */V(Pr,{windowId:e.id,children:"page"===e.type?/* @__PURE__ */V(Re,{item:e,onClose:()=>d(e.id),accentRgb:n}):/* @__PURE__ */V(He,{item:e,onClose:()=>d(e.id),onMinimize:()=>{},accentRgb:n})})})})},e.id)})]})}var at=null,lt=/* @__PURE__ */new Set;function st(){return at}function ct(e){if(at!==e){at=e;for(const e of lt)e()}}function dt(e){return lt.add(e),()=>{lt.delete(e)}}var ut=!1,ht={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},mt=()=>{};function pt(e){ut=e,ht={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0}}function ft(e,t){ut&&("submenu"===e?ht.submenus++:ht.menus++,ht.menuKey=t)}function wt(e){if(!ut)return mt;const t=performance.now();let n=!1;return()=>{if(n)return;if(n=!0,!ut)return;const r=performance.now()-t;"move"===e?ht.moveMs+=r:ht.resizeMs+=r}}function yt(){const e=ht;return ht={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},e}var gt=/* @__PURE__ */new Set(["button","a","input","select","textarea","kbd"]),vt=/* @__PURE__ */new Set(["svg"]);function bt(e){const t=[],n={text:"",accessories:[]};return xt(e,n,t),n.text=t.join("").replace(/\s+/g," ").trim(),n}function xt(e,t,n){if(null==e||"boolean"==typeof e)return;if("string"==typeof e||"number"==typeof e)return void n.push(String(e));if(Array.isArray(e))return void e.forEach(e=>xt(e,t,n));if(!W(e))return;const r=e;if(r.type!==g)if(r.type!==K){if("string"==typeof r.type){if(vt.has(r.type))return;if(!gt.has(r.type))return n.push(" "),O.toArray(r.props.children).forEach(e=>xt(e,t,n)),void n.push(" ")}t.accessories.push(R(r,{key:`title-part-${t.accessories.length}`}))}else O.toArray(r.props.children).forEach(e=>xt(e,t,n));else void 0===t.copy&&"string"==typeof r.props.text&&r.props.text&&(t.copy=r.props.text)}var kt=/* @__PURE__ */new Map,Et=/* @__PURE__ */new Set,Mt=0;function Lt(){Mt++,Et.forEach(e=>e())}function Ct(e){return kt.get(e)}function Nt(e){return Et.add(e),()=>{Et.delete(e)}}function St(){return Mt}var At=N(""),Tt=N(null);function zt({spec:e,children:t}){/* @__PURE__ */
|
|
49
49
|
return V(Tt.Provider,{value:e,children:t})}var Dt=/* @__PURE__ */new Set(["button","input","textarea","select","kbd","svg"]),Pt='button[type="submit"], button[data-submit], button.btn-submit, button.bg-green-600, button.bg-blue-600',It='button, a[href], summary, [role="button"], [role="link"], [role="menuitem"], select';function $t(e){return Wt(e).replace(/\s+/g," ").trim()}function Wt(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(Wt).join("");if(W(e)){const t=e,n="string"==typeof t.type?t.type:"";return Dt.has(n)?"":` ${Wt(t.props?.children)} `}return""}function Kt(e){const t=S(At);D(()=>{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 Ot={};function Rt(e,t,n){const r=S(At);D(()=>{if(!r)return;Ot[r]||(Ot[r]=[]);const o={label:e,icon:n,onClick:t};return Ot[r].push(o),()=>{Ot[r]=(Ot[r]||[]).filter(e=>e!==o)}},[r,e,t,n])}function jt({title:e}){const t=z(null);return D(()=>{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__ */V("span",{ref:t,style:{display:"none"},"aria-hidden":"true"})}function Bt(e){}var Ht=N(null);function Ft(){return S(At)}function qt(){const e=I(rr,nr),t=S(Ht);return t?.active??(dn.length<=1||null!=e)}function Vt({children:e,position:t="right",quiet:n=!1}){const r=S(Ht),[o,i]=P(null);return D(()=>{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),l=setTimeout(()=>clearInterval(a),2e3);return()=>{clearInterval(a),clearTimeout(l)}},[r,t,n]),o?U(e,o):null}function Yt({onClick:e,children:t,className:n}){const r=S(Ht);/* @__PURE__ */
|
|
50
|
-
return V("button",{type:"button",onClick:async()=>{if(r?.isDirty){const{confirm:e}=await(import("./ConfirmDialog-
|
|
50
|
+
return V("button",{type:"button",onClick:async()=>{if(r?.isDirty){const{confirm:e}=await(import("./ConfirmDialog-4LZXI6FM.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 Ut="erp_window_positions",Xt={};try{const e=localStorage.getItem(Ut);e&&(Xt=JSON.parse(e))}catch{}var _t=null;function Jt(){_t&&clearTimeout(_t),_t=setTimeout(()=>{try{localStorage.setItem(Ut,JSON.stringify(Xt))}catch{}},500)}var Gt="erp_activation_order",Zt=[];try{const e=localStorage.getItem(Gt),t=e?JSON.parse(e):null;Array.isArray(t)&&t.every(e=>"string"==typeof e)&&(Zt=t)}catch{}var Qt=null;function en(){Qt&&clearTimeout(Qt),Qt=setTimeout(()=>{try{localStorage.setItem(Gt,JSON.stringify(Zt))}catch{}},500)}function tn(e,t){Xt[e]||(Xt[e]=t,Jt())}function nn(e){return Xt[e]?{...Xt[e]}:null}function rn(e,t){Xt[e]=t,Jt()}function on(){const e=l(),t=s();let n=!1;for(const r of Object.keys(Xt))c(Xt[r],e,t)&&(delete Xt[r],n=!0);n&&Jt()}var an={sm:384,md:512,lg:672,xl:896,"2xl":1152,"3xl":1408},ln=4e3,sn=()=>{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"},cn={small:.8,medium:1,large:1.25,maximized:1.25},dn=[],un=/* @__PURE__ */new Set,hn=/* @__PURE__ */new Set,mn=0,pn=/* @__PURE__ */new Map;var fn=0;function wn(){return fn}function yn(){fn++,un.forEach(e=>e())}var gn=/* @__PURE__ */new Map,vn=/* @__PURE__ */new Map,bn=/* @__PURE__ */new Map;function xn(){for(let e=dn.length-1;e>=0;e--){const t=bn.get(dn[e]);if(t?.tab)return t.owner}return null}function kn(){return I(rr,xn,()=>null)}var En=/* @__PURE__ */new Set;var Mn=null;function Ln(e){Mn=null,zn(e)}function Cn(e){Mn=e;const t=gn.get(e);t&&Ln(t)}function Nn(e){Mn===e&&(Mn=null)}function Sn(e,t,n){if(n&&bn.set(e,n),t)if(gn.set(t,e),vn.set(e,t),En.delete(t)){dn.unshift(e);const n=Zt.indexOf(t);-1!==n&&Zt.splice(n,1),Zt.unshift(t),en()}else!function(e,t){const n=Zt.indexOf(t);if(-1===n)return void dn.push(e);let r=dn.length;for(let e=0;e<dn.length;e++){const t=vn.get(dn[e]);if(t&&Zt.indexOf(t)>n){r=e;break}}dn.splice(r,0,e)}(e,t),-1===Zt.indexOf(t)&&(Zt.push(t),en());else dn.push(e);yn(),window.dispatchEvent(new CustomEvent("modal-reorder")),t&&Mn===t&&Ln(e)}function An(e){return e?bn.get(e)?.owner??vn.get(e)??null:null}var Tn=/* @__PURE__ */new Set;function zn(e){const t=An(nr()),n=dn.indexOf(e);-1!==n&&dn.splice(n,1),dn.push(e);const r=bn.get(e);if(r?.root&&r.tab&&d()){const e=dn.filter(e=>{const t=bn.get(e);return!!t&&!t.root&&t.owner===r.owner});for(const t of e)dn.splice(dn.indexOf(t),1),dn.push(t)}hn.delete(e);const o=vn.get(e);if(o){const e=Zt.indexOf(o);-1!==e&&Zt.splice(e,1),Zt.push(o),en(),Mn&&Mn!==o&&(Mn=null)}yn(),window.dispatchEvent(new CustomEvent("modal-reorder"));const i=An(nr());i&&i!==t&&Tn.forEach(e=>e(i))}function Dn(e){const t=dn.indexOf(e);-1!==t&&dn.splice(t,1),hn.add(e),pn.set(e,++mn);const n=vn.get(e);if(n){const e=Zt.indexOf(n);-1!==e&&(Zt.splice(e,1),en())}yn(),window.dispatchEvent(new CustomEvent("modal-reorder"))}var Pn=/* @__PURE__ */new Set;var In=8,$n=32;function Wn(){return l()}var Kn=40,On=80,Rn=384,jn=400;function Bn(e,t=Wn()){const n=Math.min(Math.max(e.x,t.x+On-e.w),t.x+t.w-On),r=Math.min(Math.max(e.y,t.y),t.y+t.h-Kn);return n===e.x&&r===e.y?e:{...e,x:n,y:r}}function Hn(e){const t=e.getBoundingClientRect();if(0===t.width||0===t.height)return!0;const n=Wn();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 Fn(e){const t=Wn(),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 qn=null;function Vn(e){const t=(qn||((qn=document.createElement("div")).style.cssText=["position: fixed","pointer-events: none","z-index: 40","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(qn)),qn);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 Yn(){qn&&(qn.style.opacity="0",qn.style.display="none")}var Un=[{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"}],Xn=350,_n=200;function Jn({maximized:e,onToggleMax:t,onSnap:n,buttonClassName:r,strings:o}){const[i,a]=P(!1),l=z(void 0),s=z(void 0);D(()=>()=>{clearTimeout(l.current),clearTimeout(s.current)},[]);const c=()=>{clearTimeout(s.current),l.current=setTimeout(()=>a(!0),Xn)},d=()=>{clearTimeout(l.current),s.current=setTimeout(()=>a(!1),_n)};/* @__PURE__ */
|
|
51
51
|
return q("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:d,children:[
|
|
52
|
-
/* @__PURE__ */V("button",{onClick:t,onFocus:c,onBlur:d,title:e?o.windowed:o.maximize,className:r,children:e?"❐":"⤢"}),i&&/* @__PURE__ */V("div",{role:"group","aria-label":o.snapLayouts,onMouseEnter:()=>clearTimeout(s.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-1.5 shadow-lg",children:Un.map(({zone:e,labelKey:t,region:r})=>/* @__PURE__ */V("button",{type:"button","aria-label":o[t],title:o[t],onClick:()=>{a(!1),n(e)},onFocus:()=>clearTimeout(s.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__ */V("span",{"aria-hidden":"true",className:`absolute rounded-sm bg-blue-500/70 ${r}`,style:{margin:2}})},e))})]})}var Gn="rosh-gesture-style";var
|
|
53
|
-
/* @__PURE__ */V("div",{onMouseDown:e=>{e.stopPropagation(),dr(!1)},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",zIndex:2e3,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 Cr({open:e,onClose:t,title:n,icon:r,copyText:o,size:s="lg",dirty:h=!1,onNext:w,onPrev:y,footer:g,bodyScroll:E,onMinimize:N,initialBox:A,actions:K,actionsLeft:O,editing:B=!1,allowPinOnTop:H,initialPosition:F,widget:_,compact:J,appStyle:G,flushBody:Q,autoHeight:Z,autoMinHeight:ee,autoWidth:te,widgetMenu:ne,dimensions:re,windowKey:oe,openedFromKey:ie,accentRgb:ae,children:le}){const ce=i(),[de,ue]=P(0),[he,me]=P(!1),pe=z(null),fe=z(0);D(()=>{fe.current=de},[de]);const ge=$(e=>{ce&&(pe.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},me(!0),ct(ie??null))},[ce,ie]),be=I(dt,st);D(()=>{if(!he)return;const e=e=>{if(!pe.current)return;const t=e.clientX-pe.current.startX;if(Math.abs(e.clientY-pe.current.startY)>Math.abs(t)+12)return pe.current=null,me(!1),ue(0),void ct(null);ue(Math.max(0,t))},n=()=>{if(!pe.current)return;const e=.3*window.innerWidth,n=fe.current>e;pe.current=null,me(!1),n?(ue(window.innerWidth),setTimeout(()=>{t(),ue(0),ct(null)},180)):(ue(0),ct(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)}},[he]);const[xe,ke]=P(n),Ee=C(),Me=Ee.window;D(()=>{ke(n)},[n]);const Le=j(()=>$t(xe).trim()||void 0,[xe]),[Ce,Ne]=P(!1),Se=z(!1),[Ae,Te]=P(!1),[ze,De]=P(null),Pe=S(Tt),Ie=S(se),{prefs:We,save:Oe}=a(),Re=!!We.window_accent_stripe,je=We.favorite_documents||[],Be=!!Pe&&je.some(e=>e.entityType===Pe.entityType&&e.entityId===Pe.entityId),He=$(()=>{if(!Pe)return;const e=Be?je.filter(e=>!(e.entityType===Pe.entityType&&e.entityId===Pe.entityId)):[...je,{entityType:Pe.entityType,entityId:Pe.entityId,label:Pe.label}];Oe({favorite_documents:e})},[Pe,Be,je,Oe]),[Fe,qe]=P(null),[Ve,Ye]=P("top-right"===F?"right":"left"),Ue=z(!1),Xe=z(null);T(()=>{const e=Xe.current;e&&(ae?e.style.setProperty("--window-accent-rgb",ae):e.style.removeProperty("--window-accent-rgb"))},[ae]);const _e=z(!1),Je=z(null),Ge=z(null),Qe=z(null),[Ze,et]=P(!1),tt=z(null),nt=!!(g||K||O)||Ze,rt=S(ye),ot=""!==S(At),it=z(null);it.current=Ie?{owner:Ie.key,tab:Ie.tab,root:!ot}:null;const at=oe||(Ie&&!ot?Ie.key:null),lt=!!rt&&!ot&&rt.enabled&&rt.hasState&&(B||rt.declaredEditable)&&!rt.handMounted&&nt&&!_&&!J&&!G&&!ce,ut=/* @__PURE__ */V("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */V("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6.75A2.25 2.25 0 016 4.5h12a2.25 2.25 0 012.25 2.25v10.5A2.25 2.25 0 0118 19.5H6a2.25 2.25 0 01-2.25-2.25V6.75z M3.75 9h16.5"})}),ht=r&&W(r)?R(r,{className:`h-4 w-4 ${r.props?.className??""}`.trim()}):r??ut,mt=()=>/* @__PURE__ */V("button",{onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();De(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:ht}),pt=40,{minimize:ft,items:wt,restoreIfMinimized:yt,openWindows:gt}=Ke(),vt=z(`modal-${Math.random().toString(36).slice(2,8)}`).current;D(()=>{if(_)return Pn.add(vt),()=>{Pn.delete(vt)}},[_,vt]),D(()=>{const e=e=>{const t=e.detail;t?.id===vt&&ke(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[vt]);const[xt,Et]=P(M.window),Mt=function(e){const t=I(rr,nr);return dn.length<=1||t===e}(vt),Ct=function(e){return I(rr,()=>hn.has(e))}(vt),Nt=I(sr,cr),St=I(fr,wr),zt=I(br,xr),Dt=!H&&!_,Wt=Nt&&Dt,[Kt,Rt]=P(!1),jt=Wt&&zt===vt,[Bt,Ft]=P(!1),qt=Bt&&Dt&&St===vt?"picked":null,Vt=z(Wt);D(()=>{if(Vt.current&&!Wt){Ft(!0);const e=setTimeout(()=>{Ft(!1),mr===vt&&yr(null)},700);return Vt.current=Wt,()=>clearTimeout(e)}Vt.current=Wt},[Wt,vt]),D(()=>{Wt||Rt(!1)},[Wt]),D(()=>{const e=Ge.current,t=Qe.current;if(!e&&!t)return;const n=e=>e?Array.from(e.children).filter(e=>"shell"!==e.dataset.undoControls).length:0,r=()=>et(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]),D(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&Xe.current){const t=Xe.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=Ge.current,n=Qe.current;return t&&t.addEventListener("click",e),n&&n.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e),n&&n.removeEventListener("click",e)}},[e]);const Yt=z(!1),Ut=$(l,[]),_t=$(()=>{const e=l(),t=re?re[0]:an[s]||672,n=e.w-80,r=e.h-80,o=Math.min(t,n),i=cn[sn()],a=re?Math.min(re[1],r):(()=>{const t=("sm"===s?500:"md"===s?600:"lg"===s?700:"xl"===s?800:920)*i;return Math.max(320,Math.min(t,e.h-80))})(),c="cascade"!==(getComputedStyle(document.documentElement).getPropertyValue("--window-position")?.trim()||"cascade")||d()?0:30*(dn.length-1),u=Math.max(pt,(r-a)/2),h=(n-o)/2,m=e.h-pt-a-u;return"top-right"===F?{x:e.x+e.w-o-pt,y:e.y+pt,w:o,h:a}:"top-left"===F?{x:e.x+pt,y:e.y+pt,w:o,h:a}:{x:e.x+Math.max(pt,(n-o)/2+pt)+Math.min(c,Math.max(0,h)),y:e.y+u+Math.min(c,Math.max(0,m)),w:o,h:a}},[s]),Gt=z(!1);e||(Gt.current=!1);const Qt=oe||o||null;D(()=>{if(!e)return;Sn(vt,Qt,it.current??void 0),oe||zn(vt),Yt.current=!1,Et(tr(vt));const t=()=>{Et(tr(vt))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===oe;if(!e.label)return!1;const t=Xe.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if(zn(vt),En.current)return;const t=Wn(),n=Math.min(An.current.w,t.w-40),o=Math.min(An.current.h,t.h-40),i=t.x+(t.w-n)/2,a=t.y+(t.h-o)/2;tn({x:i,y:a,w:n,h:o}),Nn(!1)},i=e=>{const t=e.detail;r(t)&&(zn(vt),De({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==oe)return;zn(vt);const t=An.current,n=function(e,t=Wn()){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=Xe.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)}tn(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=dn.indexOf(e);-1!==t&&(dn.splice(t,1),yn()),hn.delete(e),pn.delete(e),bn.delete(e);const n=vn.get(e);n&&(vn.delete(e),gn.delete(n))}(vt),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,vt,Qt,Ut]);const Zt=!_&&"maximized"===sn(),[en,tn]=P(()=>{if(Qt&&Xt[Qt]){const e={...Xt[Qt]};return re&&(e.w=re[0],Z||(e.h=re[1])),Bn(e)}return A?{x:A.x,y:A.y,w:A.w,h:A.h}:Zt?Ut():_t()}),[nn,rn]=P(()=>!Z),[on,un]=P(()=>d()),mn=z(on),fn=z(null);D(()=>{const e=()=>{const e=d();e!==mn.current&&fn.current?.(e),mn.current=e,un(e),Et(tr(vt))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[vt]);const wn=on&&!!Ie?.tab&&!ot&&!_&&!ce,xn=wn,En=z(xn);En.current=xn;const Mn=kn(),Ln=on&&!!Ie?.tab&&!_&&!ce&&!Nt&&Mn!==Ie.key,[Cn,Nn]=P(()=>Qt&&Xt[Qt]||A?xn:xn||Zt),An=z(en);An.current=en;const Tn=z(Cn);T(()=>{Tn.current=Cn},[Cn]),T(()=>{if(nn||wn)return;const e=Xe.current,t=Je.current;if(!e||!t)return;const n=ee??(_?0:240),r=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0;let o=0,i=null,a=null;const l=()=>{const c=t.firstElementChild;if(!c||e.offsetHeight<=0)return;c!==a&&(a&&s.unobserve(a),s.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,An.current.y)-24),g=w?Math.min(An.current.h,y):Math.min(Math.max(n,d+p),y),v=Math.abs(g-o)>1;v&&(o=g,tn(e=>Math.abs(e.h-g)>1?{...e,h:g}:e)),_||(g<=n?i&&(clearTimeout(i),i=null):(v||null===i)&&(i&&clearTimeout(i),i=setTimeout(()=>{const e=o;l(),o===e&&rn(!0)},160)))},s=new ResizeObserver(l);l(),tt.current&&s.observe(tt.current);const c=new MutationObserver(l);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{s.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[nn,_,ee,nt,wn]),T(()=>{if(!Z||!nn||_||!e)return;const t=tt.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||Cn)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=ee??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,l=Math.max(i,window.innerHeight-a-Math.max(0,An.current.y)-24);tn(e=>({...e,h:Math.min(Math.max(i,e.h+r),l)}))});return r.observe(t),()=>r.disconnect()},[Z,nn,_,e,Cn,ee]);const Kn=!1!==te&&!_&&!G&&!ce,[On,Hn]=P(()=>!Kn);T(()=>{if(On||!e)return;if(!Kn||Cn)return void Hn(!0);const t=Xe.current,n=Je.current;if(!t||!n)return;const r=/* @__PURE__ */new WeakSet;let o=An.current.w,i=0;const a=()=>Hn(!0),s=()=>{i=0;const e=An.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)),w=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)=>{m(e,w)||r.add(d[t])});const v=p(e,f(e.w,w,g),s,pt);v!==e&&(o=v.w,tn(v))};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,ln);return()=>{c.disconnect(),i&&cancelAnimationFrame(i),clearTimeout(d)}},[On,e,Kn,Cn]);const qn=z(null),Un=!(!Ie?.tab||ot||_||ce);fn.current=e=>{if(!Un)return;if(e)return qn.current||(qn.current={box:{...An.current},maximized:Tn.current}),void(Tn.current=!0);const t=qn.current;qn.current=null;const n=l();if(t?.maximized)return Tn.current=!0,Nn(!0),void tn(n);const r=t?.box??(Qt?Xt[Qt]:void 0);if(Tn.current=!1,Nn(!1),r&&!c(r,n,!1)){const e={...r};re&&(e.w=re[0],Z||(e.h=re[1])),tn(Bn(e))}else tn(_t())},D(()=>{xn&&(Tn.current=!0,Nn(!0),tn(Ut()))},[xn,Ut]),D(()=>{if(_)return;const e=()=>{const e=Qt?Xt[Qt]:void 0;if(Tn.current=!1,Nn(!1),e){const t={...e};re&&(t.w=re[0],Z||(t.h=re[1])),tn(Bn(t))}else tn(_t())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[_,_t,Qt]),D(()=>{e&&Qt&&!wn&&(Xt[Qt]=en,Jt()),e&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[en,e,Qt,wn]),D(()=>{if(!e)return;const t=()=>{Tn.current?tn(Ut()):document.body.classList.contains("rosh-gesturing")||tn(Bn)};window.addEventListener("resize",t),window.addEventListener(u,t);let n=null;return Cn&&(n=new MutationObserver(t),n.observe(document.body,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["class"]})),()=>{window.removeEventListener("resize",t),window.removeEventListener(u,t),n?.disconnect()}},[e,Cn,Ut]),D(()=>{if(e&&(Ne(!1),Se.current=!1,Ue.current=!1,Hn(!Kn),!En.current)){if(Qt&&Xt[Qt]){const e=Xt[Qt];return void tn(t=>Bn({...e,...Z?{h:t.h}:{},...Kn?{x:t.x,w:t.w}:{}}))}A&&(tn({x:A.x,y:A.y,w:A.w,h:A.h}),Nn(A.maximized))}},[e]),D(()=>{if(!e||"auto"!==h)return;let t;const n=e=>{Xe.current?.contains(e.target)&&!Se.current&&(Se.current=!0,t=setTimeout(()=>Ne(!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 Xn="auto"===h?Ce:!0===h,_n=Ie&&!ot?Ie.key:null,Gn=j(()=>bt(xe),[xe]),ir=z({shortcutSpec:Pe,isOnDesktop:Be,toggleDesktopShortcut:He,taskbarStrings:Ee.taskbar});T(()=>{ir.current={shortcutSpec:Pe,isOnDesktop:Be,toggleDesktopShortcut:He,taskbarStrings:Ee.taskbar}});const ar=z(null);ar.current||(ar.current={open:(e,t)=>De({x:e,y:t}),items:()=>{const e=ir.current,t=[];e.shortcutSpec&&t.push({label:e.isOnDesktop?e.taskbarStrings.removeFromDesktop:e.taskbarStrings.addToDesktop,onSelect:e.toggleDesktopShortcut});for(const e of Ot[vt]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),D(()=>{e&&_n&&function(e,t){const n=kt.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.menu===t.menu||(kt.set(e,t),Lt())}(_n,{title:Gn.text||Le,dirty:Xn,copy:Gn.copy,menu:ar.current??void 0})},[e,_n,Le,Xn,Gn.text,Gn.copy]),D(()=>{if(e&&_n)return()=>{return e=_n,void(kt.delete(e)&&Lt());var e}},[e,_n]),$e(!(oe||!e)&&Xn);const lr=$(async()=>{if(!Ue.current){if(Xn||"auto"===h&&Se.current){Ue.current=!0;const e=Le,t=await v({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(Ue.current=!1,!t)return}t()}},[Xn,h,t,Le]);T(()=>{if(!e||!at)return;const t=e=>{e.detail?.windowKey===at&&lr()};return window.addEventListener(or,t),()=>window.removeEventListener(or,t)},[e,at,lr]);const ur=z(null),hr=$(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(De(null),zn(vt),En.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=Xe.current,l=a?.getBoundingClientRect();let s,c,d,u;if(ur.current){const t=ur.current;ur.current=null,u=t.w,d=t.h;const n=l?Math.min(Math.max(20,e.clientX-l.left),t.w-20):t.w/2;s=e.clientX-n,c=e.clientY-12,a&&(a.style.width=`${u}px`,a.style.height=`${d}px`,a.style.left=`${s}px`,a.style.top=`${c}px`)}else s=l?l.left:An.current.x,c=l?l.top:An.current.y,d=l?l.height:An.current.h,u=l?l.width:An.current.w;Nn(!1),tn(e=>({...e,x:s,y:c,w:u,h:d}));let h=null;const m=e=>{if(!r){if(Math.abs(e.clientX-o)<Zn&&Math.abs(e.clientY-i)<Zn)return;r=er(t,n,"move","move"),a&&(a.style.transition="none")}const l=s+e.clientX-o,d=Math.max(0,c+e.clientY-i);if(a&&(a.style.transform=`translate(${l-s}px, ${d-c}px)`),An.current={...An.current,x:l,y:d},!_){const t=function(e,t){const n=Wn(),r=e<=n.x+In,o=e>=n.x+n.w-In,i=t<=n.y+In,a=t>=n.y+n.h-In,l=e<=n.x+$n,s=e>=n.x+n.w-$n,c=t<=n.y+$n,d=t>=n.y+n.h-$n;return i&&l?"tl":i&&s?"tr":a&&l?"bl":a&&s?"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?Vn(Fn(t)):Yn())}},p=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",p),r?.(),Yn();const e=Bn({...An.current});if(An.current=e,!_&&h){ur.current={x:s,y:c,w:u,h:d};const e=Fn(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 tn(e)}if(_){const t=e.x+e.w/2,n=window.innerWidth/2;Ye(t>n?"right":"left")}a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.transform="",a.style.transition=""),tn(e)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",p)},[]),pr=$((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,l=Xe.current,s=l?.getBoundingClientRect(),c=s?s.left:An.current.x,d=s?s.top:An.current.y,u=s?s.width:An.current.w,h=s?s.height:An.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;Nn(!1),tn({x:c,y:d,w:u,h:h}),An.current={x:c,y:d,w:u,h:h};let y=0,g=null;const v=()=>{if(y=0,!g)return;const e=g;g=null,An.current=e,l&&(l.style.left=`${e.x}px`,l.style.top=`${e.y}px`,l.style.width=`${e.w}px`,l.style.height=`${e.h}px`)},b=e=>{if(!o){if(Math.abs(e.clientX-i)<Zn&&Math.abs(e.clientY-a)<Zn)return;o=er(n,r,Qn[t],"resize")}g=((e,t)=>{let n=c,r=d,o=u,i=h;if(f&&(o=Math.max(Rn,u+e)),w&&(i=Math.max(jn,h+t)),m){const t=Math.max(Rn,u-e);n=c+u-t,o=t}if(p){const e=Math.max(jn,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(v))},x=()=>{window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",x),y&&cancelAnimationFrame(y),v(),o?.(),tn({...An.current})};window.addEventListener("pointermove",b),window.addEventListener("pointerup",x)},[]),gr=$(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(),zn(vt),"Enter"===e.key)return void(Cn?(Nn(!1),tn(_t())):(Nn(!0),tn(Ut())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{ur.current||(ur.current={...An.current})};if(r<0)return e(),Nn(!0),void tn(Ut());if(r>0){if(Cn)return Nn(!1),void tn(_t());if(ur.current){const e=Bn(ur.current);return ur.current=null,An.current=e,void tn(e)}return void Dn(vt)}e(),Nn(!1);const t=Fn(n<0?"left":"right");return An.current=t,void tn(t)}if(Cn)return;const o=An.current,i=e.shiftKey?{...o,w:Math.max(Rn,o.w+24*n),h:Math.max(jn,o.h+24*r)}:Bn({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});An.current=i,tn(i)},[vt,Cn,_t,Ut]),vr=$(e=>{ur.current||(ur.current={...An.current}),Nn(!1);const t=Fn(e);An.current=t,tn(t),zn(vt)},[vt]),kr=xn||Wt?{}:{tabIndex:0,role:"group","aria-label":Le?`${Le} — ${Me.windowSuffix}`:Me.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:gr},Er=()=>{Nn(!0),tn(Ut())},Mr=$(()=>{const e=Xe.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(Pt);t&&!t.disabled&&t.click()}},[]);D(()=>{if(!e)return;if(_)return;const t=e=>{if(dn[dn.length-1]===vt&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),Mr();else{if("INPUT"===t.tagName&&t.closest("form"))return;if(!(t instanceof Element&&Xe.current?.contains(t)))return;if(t.closest(It))return;e.preventDefault()}}};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e,Mr,vt,_]),D(()=>{if(!e)return;const t=e=>{dn[dn.length-1]===vt&&((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:vt}})),Se.current=!1,Ne(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:vt}}))))};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e]),D(()=>{if(!e)return;if(_)return;const t=e=>{if("Escape"===e.key&&dn[dn.length-1]===vt){if(L(e))return e.preventDefault(),void e.stopPropagation();if(wn&&!B)return;e.preventDefault(),e.stopPropagation(),lr()}};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e,lr,vt,_,wn,B]);const Lr=e&&(void 0!==w||void 0!==y),Cr=$(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-[9999] bg-gray-900 text-white px-5 py-2.5 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(D(()=>{if(!e)return;const t=e=>{if(dn[dn.length-1]!==vt)return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&Lr&&(e.preventDefault(),w?w():Cr("bottom")),"k"===e.key&&Lr&&(e.preventDefault(),y?y():Cr("top"))))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e,w,y,Lr,Cr,vt]),!e||Gt.current)return null;const Nr=Wt?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),l=n%o,s=r-o*(i-1),c=a===i-1&&s<o,d=Wn(),u=(d.w-20*(o+1))/o,h=(d.h-14*(i+1)-22*i)/i,m=c?(o-s)*(u+20)/2:0;return{x:d.x+20+l*(u+20)+m,y:d.y+14+a*(h+14+22),w:u,h:h}}(vt):null,Sr=Wt&&Nr?Math.min(Nr.w/en.w,Nr.h/en.h):1,Ar=(()=>{if(Wt&&Nr){const e=Sr,t=en.w*e,n=en.h*e,r=Nr.x+(Nr.w-t)/2-en.x,o=Nr.y+(Nr.h-n)/2-en.y,i=Kt||jt;return{transform:`translate(${r}px, ${o}px) scale(${e})`,transformOrigin:"top left",transition:"transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 280ms",cursor:"pointer",zIndex:i?2020:2010,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(Bt&&Dt){const e="picked"===qt;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:2030}:{}}}return null})(),Tr=/* @__PURE__ */q("div",{children:[
|
|
52
|
+
/* @__PURE__ */V("button",{onClick:t,onFocus:c,onBlur:d,title:e?o.windowed:o.maximize,className:r,children:e?"❐":"⤢"}),i&&/* @__PURE__ */V("div",{role:"group","aria-label":o.snapLayouts,onMouseEnter:()=>clearTimeout(s.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-1.5 shadow-lg",children:Un.map(({zone:e,labelKey:t,region:r})=>/* @__PURE__ */V("button",{type:"button","aria-label":o[t],title:o[t],onClick:()=>{a(!1),n(e)},onFocus:()=>clearTimeout(s.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__ */V("span",{"aria-hidden":"true",className:`absolute rounded-sm bg-blue-500/70 ${r}`,style:{margin:2}})},e))})]})}var Gn="rosh-gesture-style";var Zn={se:"nwse-resize",nw:"nwse-resize",sw:"nesw-resize",ne:"nesw-resize",n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize"},Qn=4;function er(e,t,n,r){!function(){if("undefined"==typeof document||document.getElementById(Gn))return;const e=document.createElement("style");e.id=Gn,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=wt(r);let a=!1;return()=>{if(!a){a=!0,i();try{e.releasePointerCapture(t)}catch{}o.remove(),document.body.classList.remove("rosh-gesturing")}}}function tr(e){const t=dn.indexOf(e);if(-1===t)return-1;const n=M.window+t*M.windowStep,r=bn.get(e);if(!r||r.root||!r.tab||!d())return n;let o=-1;for(const[e,t]of bn){if(!t.root||t.owner!==r.owner)continue;const n=dn.indexOf(e);-1!==n&&(o=Math.max(o,M.window+n*M.windowStep))}return o>=n?o+2+Math.min(t,7):n}function nr(){return dn[dn.length-1]||null}function rr(e){return un.add(e),()=>{un.delete(e)}}"undefined"!=typeof window&&window.addEventListener("deactivate-all-modals",function(){for(let e=dn.length-1;e>=0;e--)Pn.has(dn[e])||dn.splice(e,1);Zt=Zt.filter(e=>{const t=gn.get(e);return null!=t&&Pn.has(t)}),en(),yn(),window.dispatchEvent(new CustomEvent("modal-reorder"))});var or="modal-close-request";function ir(e){I(rr,wn);const t=S(Ht);if(dn.length<=1)return!0;if(e){const t=gn.get(e);if(null!=t)return nr()===t}return t?.active??null!=nr()}var ar=!1,lr=/* @__PURE__ */new Set;function sr(e){return lr.add(e),()=>lr.delete(e)}function cr(){return ar}function dr(e){ar!==e&&(ar=e,lr.forEach(e=>e()))}function ur(){dr(!ar)}function hr(){dr(!1)}var mr=null,pr=/* @__PURE__ */new Set;function fr(e){return pr.add(e),()=>pr.delete(e)}function wr(){return mr}function yr(e){mr!==e&&(mr=e,pr.forEach(e=>e()))}var gr=null,vr=/* @__PURE__ */new Set;function br(e){return vr.add(e),()=>vr.delete(e)}function xr(){return gr}function kr(e){gr!==e&&(gr=e,vr.forEach(e=>e()))}function Er(){if(!gr)return void dr(!1);yr(gr),kr(null),dr(!1)}function Mr(){dr(!ar),window.dispatchEvent(new CustomEvent("modal-split-view"))}function Lr(){const e=I(sr,cr),[t,n]=P(e),[r,o]=P(e);return D(()=>{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?U(
|
|
53
|
+
/* @__PURE__ */V("div",{onMouseDown:e=>{e.stopPropagation(),dr(!1)},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",zIndex:2e3,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 Cr({open:e,onClose:t,title:n,icon:r,copyText:o,size:s="lg",dirty:h=!1,onNext:w,onPrev:y,footer:g,bodyScroll:E,onMinimize:N,initialBox:A,actions:K,actionsLeft:O,editing:B=!1,allowPinOnTop:H,initialPosition:F,widget:_,compact:J,appStyle:G,flushBody:Z,autoHeight:Q,autoMinHeight:ee,autoWidth:te,widgetMenu:ne,dimensions:re,windowKey:oe,openedFromKey:ie,accentRgb:ae,children:le}){const ce=i(),[de,ue]=P(0),[he,me]=P(!1),pe=z(null),fe=z(0);D(()=>{fe.current=de},[de]);const ge=$(e=>{ce&&(pe.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},me(!0),ct(ie??null))},[ce,ie]),be=I(dt,st);D(()=>{if(!he)return;const e=e=>{if(!pe.current)return;const t=e.clientX-pe.current.startX;if(Math.abs(e.clientY-pe.current.startY)>Math.abs(t)+12)return pe.current=null,me(!1),ue(0),void ct(null);ue(Math.max(0,t))},n=()=>{if(!pe.current)return;const e=.3*window.innerWidth,n=fe.current>e;pe.current=null,me(!1),n?(ue(window.innerWidth),setTimeout(()=>{t(),ue(0),ct(null)},180)):(ue(0),ct(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)}},[he]);const[xe,ke]=P(n),Ee=C(),Me=Ee.window;D(()=>{ke(n)},[n]);const Le=j(()=>$t(xe).trim()||void 0,[xe]),[Ce,Ne]=P(!1),Se=z(!1),[Ae,Te]=P(!1),[ze,De]=P(null),Pe=S(Tt),Ie=S(se),{prefs:We,save:Oe}=a(),Re=!!We.window_accent_stripe,je=We.favorite_documents||[],Be=!!Pe&&je.some(e=>e.entityType===Pe.entityType&&e.entityId===Pe.entityId),He=$(()=>{if(!Pe)return;const e=Be?je.filter(e=>!(e.entityType===Pe.entityType&&e.entityId===Pe.entityId)):[...je,{entityType:Pe.entityType,entityId:Pe.entityId,label:Pe.label}];Oe({favorite_documents:e})},[Pe,Be,je,Oe]),[Fe,qe]=P(null),[Ve,Ye]=P("top-right"===F?"right":"left"),Ue=z(!1),Xe=z(null);T(()=>{const e=Xe.current;e&&(ae?e.style.setProperty("--window-accent-rgb",ae):e.style.removeProperty("--window-accent-rgb"))},[ae]);const _e=z(!1),Je=z(null),Ge=z(null),Ze=z(null),[Qe,et]=P(!1),tt=z(null),nt=!!(g||K||O)||Qe,rt=S(ye),ot=""!==S(At),it=z(null);it.current=Ie?{owner:Ie.key,tab:Ie.tab,root:!ot}:null;const at=oe||(Ie&&!ot?Ie.key:null),lt=!!rt&&!ot&&rt.enabled&&rt.hasState&&(B||rt.declaredEditable)&&!rt.handMounted&&nt&&!_&&!J&&!G&&!ce,ut=/* @__PURE__ */V("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */V("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6.75A2.25 2.25 0 016 4.5h12a2.25 2.25 0 012.25 2.25v10.5A2.25 2.25 0 0118 19.5H6a2.25 2.25 0 01-2.25-2.25V6.75z M3.75 9h16.5"})}),ht=r&&W(r)?R(r,{className:`h-4 w-4 ${r.props?.className??""}`.trim()}):r??ut,mt=()=>/* @__PURE__ */V("button",{onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();De(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:ht}),pt=40,{minimize:ft,items:wt,restoreIfMinimized:yt,openWindows:gt}=Ke(),vt=z(`modal-${Math.random().toString(36).slice(2,8)}`).current;D(()=>{if(_)return Pn.add(vt),()=>{Pn.delete(vt)}},[_,vt]),D(()=>{const e=e=>{const t=e.detail;t?.id===vt&&ke(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[vt]);const[xt,Et]=P(M.window),Mt=function(e){const t=I(rr,nr);return dn.length<=1||t===e}(vt),Ct=function(e){return I(rr,()=>hn.has(e))}(vt),Nt=I(sr,cr),St=I(fr,wr),zt=I(br,xr),Dt=!H&&!_,Wt=Nt&&Dt,[Kt,Rt]=P(!1),jt=Wt&&zt===vt,[Bt,Ft]=P(!1),qt=Bt&&Dt&&St===vt?"picked":null,Vt=z(Wt);D(()=>{if(Vt.current&&!Wt){Ft(!0);const e=setTimeout(()=>{Ft(!1),mr===vt&&yr(null)},700);return Vt.current=Wt,()=>clearTimeout(e)}Vt.current=Wt},[Wt,vt]),D(()=>{Wt||Rt(!1)},[Wt]),D(()=>{const e=Ge.current,t=Ze.current;if(!e&&!t)return;const n=e=>e?Array.from(e.children).filter(e=>"shell"!==e.dataset.undoControls).length:0,r=()=>et(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]),D(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&Xe.current){const t=Xe.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=Ge.current,n=Ze.current;return t&&t.addEventListener("click",e),n&&n.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e),n&&n.removeEventListener("click",e)}},[e]);const Yt=z(!1),Ut=$(l,[]),_t=$(()=>{const e=l(),t=re?re[0]:an[s]||672,n=e.w-80,r=e.h-80,o=Math.min(t,n),i=cn[sn()],a=re?Math.min(re[1],r):(()=>{const t=("sm"===s?500:"md"===s?600:"lg"===s?700:"xl"===s?800:920)*i;return Math.max(320,Math.min(t,e.h-80))})(),c="cascade"!==(getComputedStyle(document.documentElement).getPropertyValue("--window-position")?.trim()||"cascade")||d()?0:30*(dn.length-1),u=Math.max(pt,(r-a)/2),h=(n-o)/2,m=e.h-pt-a-u;return"top-right"===F?{x:e.x+e.w-o-pt,y:e.y+pt,w:o,h:a}:"top-left"===F?{x:e.x+pt,y:e.y+pt,w:o,h:a}:{x:e.x+Math.max(pt,(n-o)/2+pt)+Math.min(c,Math.max(0,h)),y:e.y+u+Math.min(c,Math.max(0,m)),w:o,h:a}},[s]),Gt=z(!1);e||(Gt.current=!1);const Zt=oe||o||null;D(()=>{if(!e)return;Sn(vt,Zt,it.current??void 0),oe||zn(vt),Yt.current=!1,Et(tr(vt));const t=()=>{Et(tr(vt))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===oe;if(!e.label)return!1;const t=Xe.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if(zn(vt),En.current)return;const t=Wn(),n=Math.min(An.current.w,t.w-40),o=Math.min(An.current.h,t.h-40),i=t.x+(t.w-n)/2,a=t.y+(t.h-o)/2;tn({x:i,y:a,w:n,h:o}),Nn(!1)},i=e=>{const t=e.detail;r(t)&&(zn(vt),De({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==oe)return;zn(vt);const t=An.current,n=function(e,t=Wn()){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=Xe.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)}tn(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=dn.indexOf(e);-1!==t&&(dn.splice(t,1),yn()),hn.delete(e),pn.delete(e),bn.delete(e);const n=vn.get(e);n&&(vn.delete(e),gn.delete(n))}(vt),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,vt,Zt,Ut]);const Qt=!_&&"maximized"===sn(),[en,tn]=P(()=>{if(Zt&&Xt[Zt]){const e={...Xt[Zt]};return re&&(e.w=re[0],Q||(e.h=re[1])),Bn(e)}return A?{x:A.x,y:A.y,w:A.w,h:A.h}:Qt?Ut():_t()}),[nn,rn]=P(()=>!Q),[on,un]=P(()=>d()),mn=z(on),fn=z(null);D(()=>{const e=()=>{const e=d();e!==mn.current&&fn.current?.(e),mn.current=e,un(e),Et(tr(vt))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[vt]);const wn=on&&!!Ie?.tab&&!ot&&!_&&!ce,xn=wn,En=z(xn);En.current=xn;const Mn=kn(),Ln=on&&!!Ie?.tab&&!_&&!ce&&!Nt&&Mn!==Ie.key,[Cn,Nn]=P(()=>Zt&&Xt[Zt]||A?xn:xn||Qt),An=z(en);An.current=en;const Tn=z(Cn);T(()=>{Tn.current=Cn},[Cn]),T(()=>{if(nn||wn)return;const e=Xe.current,t=Je.current;if(!e||!t)return;const n=ee??(_?0:240),r=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0;let o=0,i=null,a=null;const l=()=>{const c=t.firstElementChild;if(!c||e.offsetHeight<=0)return;c!==a&&(a&&s.unobserve(a),s.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,An.current.y)-24),g=w?Math.min(An.current.h,y):Math.min(Math.max(n,d+p),y),v=Math.abs(g-o)>1;v&&(o=g,tn(e=>Math.abs(e.h-g)>1?{...e,h:g}:e)),_||(g<=n?i&&(clearTimeout(i),i=null):(v||null===i)&&(i&&clearTimeout(i),i=setTimeout(()=>{const e=o;l(),o===e&&rn(!0)},160)))},s=new ResizeObserver(l);l(),tt.current&&s.observe(tt.current);const c=new MutationObserver(l);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{s.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[nn,_,ee,nt,wn]),T(()=>{if(!Q||!nn||_||!e)return;const t=tt.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||Cn)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=ee??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,l=Math.max(i,window.innerHeight-a-Math.max(0,An.current.y)-24);tn(e=>({...e,h:Math.min(Math.max(i,e.h+r),l)}))});return r.observe(t),()=>r.disconnect()},[Q,nn,_,e,Cn,ee]);const Kn=!1!==te&&!_&&!G&&!ce,[On,Hn]=P(()=>!Kn);T(()=>{if(On||!e)return;if(!Kn||Cn)return void Hn(!0);const t=Xe.current,n=Je.current;if(!t||!n)return;const r=/* @__PURE__ */new WeakSet;let o=An.current.w,i=0;const a=()=>Hn(!0),s=()=>{i=0;const e=An.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)),w=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)=>{m(e,w)||r.add(d[t])});const v=p(e,f(e.w,w,g),s,pt);v!==e&&(o=v.w,tn(v))};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,ln);return()=>{c.disconnect(),i&&cancelAnimationFrame(i),clearTimeout(d)}},[On,e,Kn,Cn]);const qn=z(null),Un=!(!Ie?.tab||ot||_||ce);fn.current=e=>{if(!Un)return;if(e)return qn.current||(qn.current={box:{...An.current},maximized:Tn.current}),void(Tn.current=!0);const t=qn.current;qn.current=null;const n=l();if(t?.maximized)return Tn.current=!0,Nn(!0),void tn(n);const r=t?.box??(Zt?Xt[Zt]:void 0);if(Tn.current=!1,Nn(!1),r&&!c(r,n,!1)){const e={...r};re&&(e.w=re[0],Q||(e.h=re[1])),tn(Bn(e))}else tn(_t())},D(()=>{xn&&(Tn.current=!0,Nn(!0),tn(Ut()))},[xn,Ut]),D(()=>{if(_)return;const e=()=>{const e=Zt?Xt[Zt]:void 0;if(Tn.current=!1,Nn(!1),e){const t={...e};re&&(t.w=re[0],Q||(t.h=re[1])),tn(Bn(t))}else tn(_t())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[_,_t,Zt]),D(()=>{e&&Zt&&!wn&&(Xt[Zt]=en,Jt()),e&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[en,e,Zt,wn]),D(()=>{if(!e)return;const t=()=>{Tn.current?tn(Ut()):document.body.classList.contains("rosh-gesturing")||tn(Bn)};window.addEventListener("resize",t),window.addEventListener(u,t);let n=null;return Cn&&(n=new MutationObserver(t),n.observe(document.body,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["class"]})),()=>{window.removeEventListener("resize",t),window.removeEventListener(u,t),n?.disconnect()}},[e,Cn,Ut]),D(()=>{if(e&&(Ne(!1),Se.current=!1,Ue.current=!1,Hn(!Kn),!En.current)){if(Zt&&Xt[Zt]){const e=Xt[Zt];return void tn(t=>Bn({...e,...Q?{h:t.h}:{},...Kn?{x:t.x,w:t.w}:{}}))}A&&(tn({x:A.x,y:A.y,w:A.w,h:A.h}),Nn(A.maximized))}},[e]),D(()=>{if(!e||"auto"!==h)return;let t;const n=e=>{Xe.current?.contains(e.target)&&!Se.current&&(Se.current=!0,t=setTimeout(()=>Ne(!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 Xn="auto"===h?Ce:!0===h,_n=Ie&&!ot?Ie.key:null,Gn=j(()=>bt(xe),[xe]),ir=z({shortcutSpec:Pe,isOnDesktop:Be,toggleDesktopShortcut:He,taskbarStrings:Ee.taskbar});T(()=>{ir.current={shortcutSpec:Pe,isOnDesktop:Be,toggleDesktopShortcut:He,taskbarStrings:Ee.taskbar}});const ar=z(null);ar.current||(ar.current={open:(e,t)=>De({x:e,y:t}),items:()=>{const e=ir.current,t=[];e.shortcutSpec&&t.push({label:e.isOnDesktop?e.taskbarStrings.removeFromDesktop:e.taskbarStrings.addToDesktop,onSelect:e.toggleDesktopShortcut});for(const e of Ot[vt]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),D(()=>{e&&_n&&function(e,t){const n=kt.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.menu===t.menu||(kt.set(e,t),Lt())}(_n,{title:Gn.text||Le,dirty:Xn,copy:Gn.copy,menu:ar.current??void 0})},[e,_n,Le,Xn,Gn.text,Gn.copy]),D(()=>{if(e&&_n)return()=>{return e=_n,void(kt.delete(e)&&Lt());var e}},[e,_n]),$e(!(oe||!e)&&Xn);const lr=$(async()=>{if(!Ue.current){if(Xn||"auto"===h&&Se.current){Ue.current=!0;const e=Le,t=await v({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(Ue.current=!1,!t)return}t()}},[Xn,h,t,Le]);T(()=>{if(!e||!at)return;const t=e=>{e.detail?.windowKey===at&&lr()};return window.addEventListener(or,t),()=>window.removeEventListener(or,t)},[e,at,lr]);const ur=z(null),hr=$(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(De(null),zn(vt),En.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=Xe.current,l=a?.getBoundingClientRect();let s,c,d,u;if(ur.current){const t=ur.current;ur.current=null,u=t.w,d=t.h;const n=l?Math.min(Math.max(20,e.clientX-l.left),t.w-20):t.w/2;s=e.clientX-n,c=e.clientY-12,a&&(a.style.width=`${u}px`,a.style.height=`${d}px`,a.style.left=`${s}px`,a.style.top=`${c}px`)}else s=l?l.left:An.current.x,c=l?l.top:An.current.y,d=l?l.height:An.current.h,u=l?l.width:An.current.w;Nn(!1),tn(e=>({...e,x:s,y:c,w:u,h:d}));let h=null;const m=e=>{if(!r){if(Math.abs(e.clientX-o)<Qn&&Math.abs(e.clientY-i)<Qn)return;r=er(t,n,"move","move"),a&&(a.style.transition="none")}const l=s+e.clientX-o,d=Math.max(0,c+e.clientY-i);if(a&&(a.style.transform=`translate(${l-s}px, ${d-c}px)`),An.current={...An.current,x:l,y:d},!_){const t=function(e,t){const n=Wn(),r=e<=n.x+In,o=e>=n.x+n.w-In,i=t<=n.y+In,a=t>=n.y+n.h-In,l=e<=n.x+$n,s=e>=n.x+n.w-$n,c=t<=n.y+$n,d=t>=n.y+n.h-$n;return i&&l?"tl":i&&s?"tr":a&&l?"bl":a&&s?"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?Vn(Fn(t)):Yn())}},p=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",p),r?.(),Yn();const e=Bn({...An.current});if(An.current=e,!_&&h){ur.current={x:s,y:c,w:u,h:d};const e=Fn(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 tn(e)}if(_){const t=e.x+e.w/2,n=window.innerWidth/2;Ye(t>n?"right":"left")}a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.transform="",a.style.transition=""),tn(e)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",p)},[]),pr=$((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,l=Xe.current,s=l?.getBoundingClientRect(),c=s?s.left:An.current.x,d=s?s.top:An.current.y,u=s?s.width:An.current.w,h=s?s.height:An.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;Nn(!1),tn({x:c,y:d,w:u,h:h}),An.current={x:c,y:d,w:u,h:h};let y=0,g=null;const v=()=>{if(y=0,!g)return;const e=g;g=null,An.current=e,l&&(l.style.left=`${e.x}px`,l.style.top=`${e.y}px`,l.style.width=`${e.w}px`,l.style.height=`${e.h}px`)},b=e=>{if(!o){if(Math.abs(e.clientX-i)<Qn&&Math.abs(e.clientY-a)<Qn)return;o=er(n,r,Zn[t],"resize")}g=((e,t)=>{let n=c,r=d,o=u,i=h;if(f&&(o=Math.max(Rn,u+e)),w&&(i=Math.max(jn,h+t)),m){const t=Math.max(Rn,u-e);n=c+u-t,o=t}if(p){const e=Math.max(jn,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(v))},x=()=>{window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",x),y&&cancelAnimationFrame(y),v(),o?.(),tn({...An.current})};window.addEventListener("pointermove",b),window.addEventListener("pointerup",x)},[]),gr=$(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(),zn(vt),"Enter"===e.key)return void(Cn?(Nn(!1),tn(_t())):(Nn(!0),tn(Ut())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{ur.current||(ur.current={...An.current})};if(r<0)return e(),Nn(!0),void tn(Ut());if(r>0){if(Cn)return Nn(!1),void tn(_t());if(ur.current){const e=Bn(ur.current);return ur.current=null,An.current=e,void tn(e)}return void Dn(vt)}e(),Nn(!1);const t=Fn(n<0?"left":"right");return An.current=t,void tn(t)}if(Cn)return;const o=An.current,i=e.shiftKey?{...o,w:Math.max(Rn,o.w+24*n),h:Math.max(jn,o.h+24*r)}:Bn({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});An.current=i,tn(i)},[vt,Cn,_t,Ut]),vr=$(e=>{ur.current||(ur.current={...An.current}),Nn(!1);const t=Fn(e);An.current=t,tn(t),zn(vt)},[vt]),kr=xn||Wt?{}:{tabIndex:0,role:"group","aria-label":Le?`${Le} — ${Me.windowSuffix}`:Me.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:gr},Er=()=>{Nn(!0),tn(Ut())},Mr=$(()=>{const e=Xe.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(Pt);t&&!t.disabled&&t.click()}},[]);D(()=>{if(!e)return;if(_)return;const t=e=>{if(dn[dn.length-1]===vt&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),Mr();else{if("INPUT"===t.tagName&&t.closest("form"))return;if(!(t instanceof Element&&Xe.current?.contains(t)))return;if(t.closest(It))return;e.preventDefault()}}};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e,Mr,vt,_]),D(()=>{if(!e)return;const t=e=>{dn[dn.length-1]===vt&&((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:vt}})),Se.current=!1,Ne(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:vt}}))))};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e]),D(()=>{if(!e)return;if(_)return;const t=e=>{if("Escape"===e.key&&dn[dn.length-1]===vt){if(L(e))return e.preventDefault(),void e.stopPropagation();if(wn&&!B)return;e.preventDefault(),e.stopPropagation(),lr()}};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e,lr,vt,_,wn,B]);const Lr=e&&(void 0!==w||void 0!==y),Cr=$(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-[9999] bg-gray-900 text-white px-5 py-2.5 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(D(()=>{if(!e)return;const t=e=>{if(dn[dn.length-1]!==vt)return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&Lr&&(e.preventDefault(),w?w():Cr("bottom")),"k"===e.key&&Lr&&(e.preventDefault(),y?y():Cr("top"))))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e,w,y,Lr,Cr,vt]),!e||Gt.current)return null;const Nr=Wt?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),l=n%o,s=r-o*(i-1),c=a===i-1&&s<o,d=Wn(),u=(d.w-20*(o+1))/o,h=(d.h-14*(i+1)-22*i)/i,m=c?(o-s)*(u+20)/2:0;return{x:d.x+20+l*(u+20)+m,y:d.y+14+a*(h+14+22),w:u,h:h}}(vt):null,Sr=Wt&&Nr?Math.min(Nr.w/en.w,Nr.h/en.h):1,Ar=(()=>{if(Wt&&Nr){const e=Sr,t=en.w*e,n=en.h*e,r=Nr.x+(Nr.w-t)/2-en.x,o=Nr.y+(Nr.h-n)/2-en.y,i=Kt||jt;return{transform:`translate(${r}px, ${o}px) scale(${e})`,transformOrigin:"top left",transition:"transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 280ms",cursor:"pointer",zIndex:i?2020:2010,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(Bt&&Dt){const e="picked"===qt;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:2030}:{}}}return null})(),Tr=/* @__PURE__ */q("div",{children:[
|
|
54
54
|
/* @__PURE__ */q("div",{ref:Xe,"data-modal-panel":!0,"data-modal-id":vt,"data-window-key":oe||void 0,...H?{"data-utility":""}:{},...Ae?{"data-pinned-top":""}:{},..._?{"data-widget":""}:{},...Ie?{"data-window-owner":Ie.key}:{},...Ie&&!ot?{"data-window-root":""}:{},...wn?{"data-window-tab":""}:{},className:wn?"fixed flex flex-col overflow-hidden":"fixed rounded-2xl flex flex-col overflow-hidden "+(_?Mt?"shadow-2xl":"shadow-lg":"border "+(Mt?"shadow-2xl border-gray-200":"shadow-lg border-gray-300")),onMouseDownCapture:e=>{if(_e.current=!1,Wt){if(e.target.closest("[data-expose-close]"))return;return e.preventDefault(),e.stopPropagation(),yr(vt),dr(!1),void zn(vt)}if(!Mt&&!_&&!Ae&&0===e.button){const t=e.target;t.closest("[data-modal-panel]")===Xe.current&&t.closest("button, input, a, select, textarea")&&!t.closest("[data-window-chrome]")&&(e.preventDefault(),e.stopPropagation(),_e.current=!0,De(null),zn(vt),window.addEventListener("mouseup",()=>{setTimeout(()=>{_e.current=!1},0)},{once:!0}))}},onClickCapture:e=>{_e.current&&(_e.current=!1,e.preventDefault(),e.stopPropagation())},onMouseDown:e=>{if(Wt)return;De(null);e.target.closest("[data-modal-panel]")===Xe.current&&(e.target.closest("button, input, a, select, textarea")||zn(vt))},style:ce?{zIndex:xt+1,top:0,left:0,right:0,bottom:"var(--mobile-bottom-nav, 56px)",width:"auto",height:"auto",transform:`translateX(${de}px)`,transition:he?"none":"transform 180ms ease-out",..._?{display:"none"}:{},...xt<0?{display:"none"}:{},...Mt||Ae||be&&oe===be?{}:{display:"none"}}:{zIndex:Ae?M.pinnedWindow:xt+1,width:en.w,height:en.h,top:en.y,..._&&"right"===Ve?{right:window.innerWidth-en.x-en.w}:{left:en.x},...xt<0&&!Ae?{display:"none"}:{},...Ln?{visibility:"hidden",pointerEvents:"none"}:{},...Ar??{}},children:[ce&&!_&&/* @__PURE__ */V("div",{onPointerDown:ge,className:"absolute top-0 bottom-0 left-0 w-[22px] z-[5]",style:{touchAction:"pan-y"},"aria-hidden":"true"}),_?null:wn?Ie?.home?null:/* @__PURE__ */q(Y,{children:[
|
|
55
55
|
/* @__PURE__ */V("h2",{"data-window-title":!0,className:"sr-only",children:Gn.text||Le}),(Gn.accessories.length>0||Lr)&&/* @__PURE__ */q("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:[
|
|
56
56
|
/* @__PURE__ */V("div",{className:"flex min-w-0 flex-1 items-center gap-2 overflow-hidden",children:Gn.accessories}),Lr&&/* @__PURE__ */q("span",{className:"flex items-center gap-1 shrink-0 text-[10px] text-gray-400",children:[
|
|
@@ -75,7 +75,7 @@ return q("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:d,
|
|
|
75
75
|
/* @__PURE__ */V("button",{onClick:()=>Dn(vt),title:Me.minimize,className:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",children:"─"}),!xn&&/* @__PURE__ */V(Jn,{maximized:Cn,onToggleMax:()=>{Cn?(Nn(!1),tn(_t())):Er()},onSnap:vr,buttonClassName:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",strings:Me}),
|
|
76
76
|
/* @__PURE__ */V("kbd",{className:"rounded border border-gray-300 bg-gray-200 px-1.5 py-0.5 text-[10px] font-medium text-gray-400",children:"ESC"}),
|
|
77
77
|
/* @__PURE__ */V("button",{type:"button",onClick:lr,className:"rounded-md text-gray-400 hover:text-gray-600",children:/* @__PURE__ */V(X,{className:"h-5 w-5"})})]})]}),ae&&Re&&!_&&!ce&&/* @__PURE__ */V("div",{"aria-hidden":"true",className:"h-[3px] shrink-0 pointer-events-none",style:{backgroundColor:`rgb(var(--window-accent-rgb) / ${Mt?.9:.55})`}}),
|
|
78
|
-
/* @__PURE__ */V(At.Provider,{value:vt,children:/* @__PURE__ */V(Ht.Provider,{value:{rightRef:Ge,leftRef:
|
|
78
|
+
/* @__PURE__ */V(At.Provider,{value:vt,children:/* @__PURE__ */V(Ht.Provider,{value:{rightRef:Ge,leftRef:Ze,notify:()=>et(!0),active:Mt,isDirty:Xn,footerOpen:nt&&!_&&!J&&!G&&!ce},children:/* @__PURE__ */V("div",{ref:Je,..._?{onPointerDown:hr,onContextMenu:e=>{e.preventDefault(),qe({x:e.clientX,y:e.clientY})}}:{},className:`flex-1 min-h-0 flex flex-col ${_?"p-0 cursor-move":G||Z?"p-0":J?"p-2":"p-4"} ${_||wn?"":"backdrop-blur-sm"} ${!1===E||G||Z?"overflow-hidden":"overflow-y-auto overscroll-contain"} ${_?"rounded-2xl select-none":""}`,style:{..._?{touchAction:"none"}:{},backgroundColor:_?"transparent":wn?"rgb(var(--window-content-rgb))":Mt?"rgb(var(--window-content-rgb) / var(--active-content-opacity, 0.9))":"rgb(var(--window-content-rgb) / var(--inactive-content-opacity, 0.8))"},children:/* @__PURE__ */V(we,{children:le})})})}),_&&Fe&&/* @__PURE__ */q(b,{minWidth:160,style:{left:Fe.x,top:Fe.y},onClose:()=>qe(null),children:[
|
|
79
79
|
/* @__PURE__ */V(x,{onClick:()=>{qe(null),window.dispatchEvent(new CustomEvent("widget-open-settings",{detail:vt}))},children:"Settings"}),
|
|
80
80
|
/* @__PURE__ */V(k,{}),ne&&/* @__PURE__ */q(Y,{children:[ne,
|
|
81
81
|
/* @__PURE__ */V(k,{})]}),
|
|
@@ -85,7 +85,7 @@ return q("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:d,
|
|
|
85
85
|
/* @__PURE__ */V(x,{onClick:()=>{qe(null),lr()},children:"Close"})]}),
|
|
86
86
|
/* @__PURE__ */q("div",{onPointerDown:hr,ref:tt,className:`px-4 py-2 border-t border-gray-200 shrink-0 flex items-center justify-between text-xs select-none${wn?"":" cursor-move"}${Mt&&!wn?" backdrop-blur-sm":""}${_||J||G||ce||!nt?" hidden":""}`,style:{touchAction:"none",backgroundColor:wn?"rgb(var(--window-footer-rgb))":Mt?"rgb(var(--window-footer-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-footer-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
87
87
|
/* @__PURE__ */q("div",{className:"flex items-center gap-2 min-w-0",children:[lt&&/* @__PURE__ */V(ve,{auto:!0}),O,
|
|
88
|
-
/* @__PURE__ */V("div",{ref:
|
|
88
|
+
/* @__PURE__ */V("div",{ref:Ze,"data-modal-actions-left":!0,className:"flex items-center gap-2"}),g]}),
|
|
89
89
|
/* @__PURE__ */q("div",{className:"flex items-center gap-2 ml-auto",children:[
|
|
90
90
|
/* @__PURE__ */V("div",{ref:Ge,"data-modal-actions":!0,className:"flex items-center gap-2"}),K]})]}),!_&&!ce&&!Wt&&Mt&&!xn&&/* @__PURE__ */q(Y,{children:[
|
|
91
91
|
/* @__PURE__ */V("div",{onPointerDown:e=>pr(e,"se"),className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize z-10"}),
|
|
@@ -108,5 +108,5 @@ return q("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:d,
|
|
|
108
108
|
/* @__PURE__ */V("button",{type:"button",onClick:()=>zn(vt),title:Me.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:Le||Me.windowSuffix}),
|
|
109
109
|
/* @__PURE__ */V("button",{type:"button",onClick:()=>zn(vt),title:Me.restore,"aria-label":Me.restore,className:"rounded px-1.5 py-0.5 text-xs leading-none text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:"▴"}),
|
|
110
110
|
/* @__PURE__ */V("button",{type:"button",onClick:()=>{lr()},title:Me.close,"aria-label":Me.close,className:"rounded px-1.5 py-0.5 text-xs leading-none text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:"✕"})]});return U(
|
|
111
|
-
/* @__PURE__ */q(Tt.Provider,{value:null,children:[Tr,zr,Pr]}),document.body)}"undefined"!=typeof window&&window.addEventListener("keydown",e=>{ar&&"Escape"===e.key&&(kr(null),dr(!1))});var Nr=100,Sr={past:[],future:[]};function Ar(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>Nr?r.slice(r.length-Nr):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:Sr}}var Tr=/* @__PURE__ */new Set(["INPUT","TEXTAREA","SELECT"]);var zr=500,Dr=250;function Pr({children:e,canEdit:t=!0,perms:n,windowId:r}){const[o,i]=B(Ar,Sr),a=z(/* @__PURE__ */new Map),[l,s]=P(0),c=l>0,[d,u]=P(0),[m,p]=P(0),f=m>0,{hasAnyPerm:w}=h(),y=t&&0===d&&(!(n&&n.length>0)||w(n)),g=z(null),v=z(!1),b=$(()=>{const e={};for(const[t,n]of a.current)e[t]=n.getLast();return e},[]),x=$((e,t)=>{a.current.has(e)||s(e=>e+1),a.current.set(e,t)},[]),k=$(e=>{a.current.delete(e)&&s(e=>e-1)},[]),E=$(e=>{u(t=>t+(e?1:-1))},[]),M=$(e=>{p(t=>t+(e?1:-1))},[]),[L,C]=P(0),N=L>0,A=$(e=>{C(t=>t+(e?1:-1))},[]),T=S(ye),I=T?.claimReadOnly;D(()=>{if(I&&!y)return I(!0),()=>I(!1)},[I,y]);const W=T?.claimOwnMount;D(()=>{if(W&&N)return W(!0),()=>W(!1)},[W,N]);const K=z({last:0,count:0,tripped:!1}),O=z(!1),R=$((e,t,n)=>{if(v.current)return void(n&&function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(Array.isArray(e)!==Array.isArray(t))return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}(n.prev,n.next)||(O.current=!0));if(!y||g.current)return;const r=K.current;if(r.tripped)return;const o=Date.now();if(o-r.last>Dr&&(r.count=0),r.last=o,++r.count>zr)return r.tripped=!0,void console.error(`[efficient-shell] UndoProvider: "${e}" recorded ${zr} undo steps with no pause between them, which no user action can do. The value passed to useUndoable for this slice is almost certainly rebuilt on every render (a .map/.filter/object literal in the call) rather than held in state, so it reads as changed every time — and since recording a step re-renders the form, that is a loop. Undo recording is now off for this form to keep the tab responsive.`);g.current={values:b(),label:e,coalesceKey:t},queueMicrotask(()=>{const e=g.current;g.current=null,e&&i({type:"record",step:e})})},[y,b]),H=$(e=>{for(const[t,n]of Object.entries(e)){const e=a.current.get(t);e&&(e.setLast(n),e.apply(n))}},[]),F=$(()=>{const e=o.past[o.past.length-1];if(!e)return;const t={values:b(),label:e.label,coalesceKey:null};H(e.values),i({type:"undo",redoStep:t})},[o.past,b,H]),Y=$(()=>{const e=o.future[0];if(!e)return;const t={values:b(),label:e.label,coalesceKey:null};H(e.values),i({type:"redo",undoStep:t})},[o.future,b,H]),[U,X]=P(0),_=z(0),J=z(0),G=z(!1),
|
|
112
|
-
return q(ye.Provider,{value:ae,children:[ce&&/* @__PURE__ */V(Vt,{position:"left",quiet:!0,children:/* @__PURE__ */V(ve,{auto:!0})}),e]})}function Ir(){const e=S(ye),t=$(()=>{},[]);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 $r(e){const t=S(ye),n=t?.claimReadOnly,r=t?.claimEditable;D(()=>{const t=e?r:n;if(t)return t(!0),()=>t(!1)},[n,r,e])}function Wr(e,t,n){const r=S(ye),o=H(),i=z(e),a=z(t);a.current=t,D(()=>{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:l,coalesceKey:s=null}=n,c=z(r);c.current=r;const d=z({label:l,coalesceKey:s});d.current={label:l,coalesceKey:s},D(()=>{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 Kr(e,t){const[n,r]=P(e);return Wr(n,e=>r(()=>e),t),[n,r]}export{Yt as CancelButton,je as DocFavStar,Se as EntityWindowFallback,Ce as EntityWindowLoading,Ae as EntityWindowState,It as KEY_ACTIVATED_SELECTOR,Me as LoadingSpinner,Pt as MODAL_SUBMIT_SELECTOR,Cr as Modal,Vt as ModalActions,ve as UndoControls,Pr as UndoProvider,ne as WINDOW_REGISTRY,fe as WindowCrashedFallback,we as WindowErrorBoundary,it as WindowManagerProvider,jt as WindowTitle,Ve as activateWindowById,wt as beginWindowGesture,Nn as cancelWindowFront,le as client_default,Er as commitExposeHighlight,yt as drainPerfEvents,hr as exitExposeMode,on as forgetMaximizedWindowBoxes,nr as getActiveModalId,_e as getActiveWindowRoute,xr as getExposeHighlight,St as getWindowChromeVersion,nn as getWindowPosition,ze as isDraftEntityId,De as isDraftEntityWindow,
|
|
111
|
+
/* @__PURE__ */q(Tt.Provider,{value:null,children:[Tr,zr,Pr]}),document.body)}"undefined"!=typeof window&&window.addEventListener("keydown",e=>{ar&&"Escape"===e.key&&(kr(null),dr(!1))});var Nr=100,Sr={past:[],future:[]};function Ar(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>Nr?r.slice(r.length-Nr):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:Sr}}var Tr=/* @__PURE__ */new Set(["INPUT","TEXTAREA","SELECT"]);var zr=500,Dr=250;function Pr({children:e,canEdit:t=!0,perms:n,windowId:r}){const[o,i]=B(Ar,Sr),a=z(/* @__PURE__ */new Map),[l,s]=P(0),c=l>0,[d,u]=P(0),[m,p]=P(0),f=m>0,{hasAnyPerm:w}=h(),y=t&&0===d&&(!(n&&n.length>0)||w(n)),g=z(null),v=z(!1),b=$(()=>{const e={};for(const[t,n]of a.current)e[t]=n.getLast();return e},[]),x=$((e,t)=>{a.current.has(e)||s(e=>e+1),a.current.set(e,t)},[]),k=$(e=>{a.current.delete(e)&&s(e=>e-1)},[]),E=$(e=>{u(t=>t+(e?1:-1))},[]),M=$(e=>{p(t=>t+(e?1:-1))},[]),[L,C]=P(0),N=L>0,A=$(e=>{C(t=>t+(e?1:-1))},[]),T=S(ye),I=T?.claimReadOnly;D(()=>{if(I&&!y)return I(!0),()=>I(!1)},[I,y]);const W=T?.claimOwnMount;D(()=>{if(W&&N)return W(!0),()=>W(!1)},[W,N]);const K=z({last:0,count:0,tripped:!1}),O=z(!1),R=$((e,t,n)=>{if(v.current)return void(n&&function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(Array.isArray(e)!==Array.isArray(t))return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}(n.prev,n.next)||(O.current=!0));if(!y||g.current)return;const r=K.current;if(r.tripped)return;const o=Date.now();if(o-r.last>Dr&&(r.count=0),r.last=o,++r.count>zr)return r.tripped=!0,void console.error(`[efficient-shell] UndoProvider: "${e}" recorded ${zr} undo steps with no pause between them, which no user action can do. The value passed to useUndoable for this slice is almost certainly rebuilt on every render (a .map/.filter/object literal in the call) rather than held in state, so it reads as changed every time — and since recording a step re-renders the form, that is a loop. Undo recording is now off for this form to keep the tab responsive.`);g.current={values:b(),label:e,coalesceKey:t},queueMicrotask(()=>{const e=g.current;g.current=null,e&&i({type:"record",step:e})})},[y,b]),H=$(e=>{for(const[t,n]of Object.entries(e)){const e=a.current.get(t);e&&(e.setLast(n),e.apply(n))}},[]),F=$(()=>{const e=o.past[o.past.length-1];if(!e)return;const t={values:b(),label:e.label,coalesceKey:null};H(e.values),i({type:"undo",redoStep:t})},[o.past,b,H]),Y=$(()=>{const e=o.future[0];if(!e)return;const t={values:b(),label:e.label,coalesceKey:null};H(e.values),i({type:"redo",undoStep:t})},[o.future,b,H]),[U,X]=P(0),_=z(0),J=z(0),G=z(!1),Z=$(()=>{v.current=!0,O.current=!1,g.current=null,_.current+=1,J.current=_.current,X(_.current)},[]),Q=z(void 0),ee=$(e=>{void 0!==e&&(void 0!==Q.current&&e!==Q.current&&(G.current=!0),Q.current=e),Z()},[Z]);D(()=>{v.current&&U===J.current&&(v.current=!1,g.current=null,(O.current||G.current)&&i({type:"clear"}),O.current=!1,G.current=!1)},[U]);const te=$(()=>{G.current=!0,i({type:"clear"}),Z()},[Z]),ne=y&&o.past.length>0,re=y&&o.future.length>0,oe=ir(r),ie=z({undo:F,redo:Y,canUndo:ne,canRedo:re});ie.current={undo:F,redo:Y,canUndo:ne,canRedo:re},D(()=>{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&&Tr.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=j(()=>({register:x,unregister:k,record:R,undo:F,redo:Y,clear:te,baseline:ee,canUndo:ne,canRedo:re,enabled:y,hasState:c,handMounted:N,claimOwnMount:A,claimReadOnly:E,declaredEditable:f,claimEditable:M,undoLabel:ne?o.past[o.past.length-1].label:null,redoLabel:re?o.future[0].label:null}),[x,k,R,F,Y,te,ee,ne,re,y,c,N,A,E,f,M,o.past,o.future]),le=""!==Ft(),se=S(Ht)?.footerOpen??!1,ce=le&&y&&c&&!N&&se;/* @__PURE__ */
|
|
112
|
+
return q(ye.Provider,{value:ae,children:[ce&&/* @__PURE__ */V(Vt,{position:"left",quiet:!0,children:/* @__PURE__ */V(ve,{auto:!0})}),e]})}function Ir(){const e=S(ye),t=$(()=>{},[]);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 $r(e){const t=S(ye),n=t?.claimReadOnly,r=t?.claimEditable;D(()=>{const t=e?r:n;if(t)return t(!0),()=>t(!1)},[n,r,e])}function Wr(e,t,n){const r=S(ye),o=H(),i=z(e),a=z(t);a.current=t,D(()=>{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:l,coalesceKey:s=null}=n,c=z(r);c.current=r;const d=z({label:l,coalesceKey:s});d.current={label:l,coalesceKey:s},D(()=>{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 Kr(e,t){const[n,r]=P(e);return Wr(n,e=>r(()=>e),t),[n,r]}export{Yt as CancelButton,je as DocFavStar,Se as EntityWindowFallback,Ce as EntityWindowLoading,Ae as EntityWindowState,It as KEY_ACTIVATED_SELECTOR,Me as LoadingSpinner,Pt as MODAL_SUBMIT_SELECTOR,Cr as Modal,Vt as ModalActions,ve as UndoControls,Pr as UndoProvider,ne as WINDOW_REGISTRY,fe as WindowCrashedFallback,we as WindowErrorBoundary,it as WindowManagerProvider,jt as WindowTitle,Ve as activateWindowById,wt as beginWindowGesture,Nn as cancelWindowFront,le as client_default,Er as commitExposeHighlight,yt as drainPerfEvents,hr as exitExposeMode,on as forgetMaximizedWindowBoxes,nr as getActiveModalId,_e as getActiveWindowRoute,xr as getExposeHighlight,St as getWindowChromeVersion,nn as getWindowPosition,ze as isDraftEntityId,De as isDraftEntityWindow,Q as isEntityEntry,Z as isPageEntry,ie as isShellApiClientConfigured,Ye as isTabWindow,ft as markMenuOpen,Ct as readWindowChrome,Cn as requestWindowFront,kr as setExposeHighlight,pt as setPerfCollecting,oe as setShellApiClient,he as setShellHomeRoute,te as setShellWindowRegistry,tn as setWindowDefaultPosition,rn as setWindowPosition,bt as splitTitle,br as subscribeExposeHighlight,Nt as subscribeWindowChrome,ur as toggleExposeMode,kn as useCurrentTabKey,Ft as useEnclosingModalId,ir as useIsActiveWindow,qt as useModalActive,ce as usePageSearch,Ir as useUndo,$r as useUndoCanEdit,Wr as useUndoable,Kr as useUndoableState,Kt as useWidgetSettings,$e as useWindowDirty,Ke as useWindowManager,Rt as useWindowMenuItem,Bt as useWindowTitle};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import{navVisible as e,isReachable as t,visibleChildren as n,isSection as r}from"./chunk-5A7MWTXX.js";import{glassStyle as a}from"./chunk-
|
|
1
|
+
import{navVisible as e,isReachable as t,visibleChildren as n,isSection as r}from"./chunk-5A7MWTXX.js";import{glassStyle as a}from"./chunk-L7ZMDZAB.js";import{useDismissPopupsOnOpen as l,Z_LAYERS as o}from"./chunk-OSJ3ADF2.js";import{useShellStrings as s}from"./chunk-YJX2IWHB.js";import{useState as i,useEffect as c,useRef as d,useMemo as u,useId as p,useCallback as y}from"react";import{jsx as f,jsxs as m}from"react/jsx-runtime";import{createPortal as h}from"react-dom";var b={favicon:"h-8 w-8",compact:"h-10 w-10",wordmark:"h-10 w-40"};function g(e){return e.trim().charAt(0).toLocaleUpperCase()||"·"}function x(e,t,n){return!1===e?"framed":null==e||null==t?"plate-light":t?"light"===n?"plate-dark":"bare":"dark"===n?"plate-light":"bare"}var v={"plate-light":"bg-white shadow-[0_2px_12px_var(--rosh-mark-plate-shadow)]","plate-dark":"bg-neutral-900 shadow-[0_2px_12px_var(--rosh-mark-plate-shadow-strong)]",framed:"border border-black/10 shadow-[0_2px_12px_var(--rosh-mark-plate-shadow)]",bare:""};function k(e,t,n){return"bare"===e?{}:"framed"===e?{borderRadius:t}:{borderRadius:t,padding:n}}function w({src:e,fallbackSrc:t,fallbackHasAlpha:n=null,fallbackIsLight:r=null,fallbackAdaptive:a,alt:l,slot:o="compact",surface:s="light",size:d,width:u,height:p,decorative:y=!1,fallbackMode:m="monogram",adaptive:h=!1,hasAlpha:w=null,isLight:N=null,treatmentPadding:_=4,treatmentRadius:A=8,className:L="",style:C}){const[$,E]=i(e||t||"");c(()=>{E(e||t||"")},[e,t]);const T=Boolean(t&&$===t&&$!==e),I=(T?a??h:h)?x(T?n:w,T?r:N,s):"bare",S=["inline-flex shrink-0 items-center justify-center overflow-hidden",null==d&&null==u&&null==p?b[o]:"","dark"===s?"text-white":"text-gray-700",v[I],L].filter(Boolean).join(" "),j={...k(I,A,_),...null==d?{width:u,height:p}:{width:d,height:d},...C};return $?/* @__PURE__ */f("span",{className:S,"data-brand-treatment":I,style:j,children:/* @__PURE__ */f("img",{src:$,alt:y?"":l,"data-brand-slot":o,className:"block max-h-full max-w-full",style:{objectFit:"contain"},onError:()=>E(e=>t&&e!==t?t:"")})}):"none"===m?null:/* @__PURE__ */f("span",{"data-brand-fallback":!0,"data-brand-slot":o,"aria-label":y?void 0:l,"aria-hidden":y||void 0,role:y?void 0:"img",className:`${S} rounded-md bg-gray-100 font-semibold`,style:j,children:y?null:g(l)})}function N(n,r){return e(n,r)?n.items.filter(n=>e(n,r)&&t(n,r)):[]}function _(e,r){return n(e,r).filter(e=>t(e,r))}function A(n,a,l){const o=new Set(a.erp),s=new Set(a.system),i=new Set(a.footer??[]),c=n.filter(r),d=e=>c.filter(t=>e.has(t.label)&&N(t,l).length>0);return{topItems:n.filter(e=>!r(e)).filter(n=>e(n,l)&&t(n,l)),erpSections:d(o),systemSections:d(s),virtualSections:(a.virtual??[]).filter(e=>e.items.length>0),footerSections:d(i),footerItems:(a.footerItems??[]).filter(n=>e(n,l)&&t(n,l))}}function L(e,t,n){return!!t&&e.some(e=>e.to===t||L(_(e,n),t,n))}var C="__page__";function $(e){const t=e.indexOf("?");if(t<0)return{path:e,search:""};const n=new URLSearchParams(e.slice(t+1));return{path:e.slice(0,t),search:n.get("search")??""}}function E(e,t,n){const r=function(e,t){const n=[],r=e=>{const a=_(e,t);0===a.length?n.push(e):a.forEach(r)};e.topItems.forEach(r);for(const n of[...e.erpSections,...e.systemSections,...e.footerSections])N(n,t).forEach(r);for(const t of e.virtualSections)t.items.forEach(r);return e.footerItems.forEach(r),n}(e,t);return Object.assign(async e=>{const t=e.trim().toLowerCase();if(!t)return[];const a=/* @__PURE__ */new Set,l=[];for(const e of r){const r=e.menuLabel??e.label;a.has(e.to)||!e.label.toLowerCase().includes(t)&&!r.toLowerCase().includes(t)||(a.add(e.to),l.push({type:n,label:e.label,entity_type:C,entity_id:e.to}))}return l.slice(0,8)},{destinations:r})}function T(e,t){if(!Array.isArray(e))return[];const n=[];for(const r of e){if(!r||"string"!=typeof r.entityType||"string"!=typeof r.entityId||"string"!=typeof r.label)continue;if("preview-file"===r.entityType)continue;const e="page"===r.entityType;n.push({type:e?t:"",label:r.label,entity_type:e?C:r.entityType,entity_id:r.entityId})}return n}var I="M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z";function S(e,t,n){return 0===n.length?null:{key:e,title:t,rows:n.map((e,t)=>({kind:"action",key:`action:${t}:${e.label}`,label:e.label,icon:e.icon,action:e})),count:n.length}}function j(e,t,n,r){return{type:e,label:t,entity_type:C,entity_id:`${n}?search=${encodeURIComponent(r.trim())}`}}function M(e,t,n,r,a){const l=function(e){const t=/* @__PURE__ */new Map;for(const n of e){const e=t.get(n.type);e?e.push(n):t.set(n.type,[n])}return Array.from(t,([e,t])=>({type:e,results:t}))}(e).map(e=>{const t=e.results.map((t,n)=>({kind:"result",key:`result:${e.type}:${t.entity_type}:${t.entity_id}:${n}`,label:t.label,sub:t.sub,result:t})),r=!!a?.truncatedTypes?.includes(e.type),l=r?a?.listRoutes?.[e.type]:void 0;if(a&&l){const r=a.seeAllLabel(l.label);t.push({kind:"seeAll",key:`seeall:${e.type}`,label:r,result:j(e.type,r,l.path,n)})}return{key:`type:${e.type}`,title:e.type,rows:t,count:e.results.length,truncated:r}}),o=S("actions",r,function(e,t){const n=t.trim().toLowerCase();return e&&n?e.filter(e=>e.label.toLowerCase().includes(n)||(e.keywords??[]).some(e=>e.toLowerCase().includes(n))):[]}(t,n));return o?[...l,o]:l}function R(e,t,n){return 0===n?0:Math.min(Math.max(e+t,0),n-1)}var D=(e,t)=>e.entity_type===t.entity_type&&e.entity_id===t.entity_id;function B(e,t,n=8){return[t,...e.filter(e=>!D(e,t))].slice(0,n)}function K(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(!n||"object"!=typeof n)continue;const e=n;if("string"!=typeof e.type||"string"!=typeof e.label||"string"!=typeof e.entity_type||"string"!=typeof e.entity_id)continue;const r={type:e.type,label:e.label,entity_type:e.entity_type,entity_id:e.entity_id};"string"==typeof e.sub&&(r.sub=e.sub),t.some(e=>D(e,r))||t.push(r)}return t.slice(0,8)}function P(e){if(Array.isArray(e))return{results:e,truncatedTypes:[]};if(e&&"object"==typeof e&&Array.isArray(e.results)){const{results:t,truncatedTypes:n}=e;return{results:t,truncatedTypes:Array.isArray(n)?n:[]}}return{results:[],truncatedTypes:[]}}var z=[];function H(e,t,n){const[r,a]=i([]),[l,o]=i(z),[s,u]=i(!1),[p,f]=i("none"),m=d(function(){let e=0,t=null;const n=()=>{e+=1,t?.abort(),t=null};return{begin:()=>{n();const r=e,a=new AbortController;return t=a,{signal:a.signal,isCurrent:()=>r===e}},cancel:n}}());c(()=>{const r=m.current;if(e.length<n||!t||0===t.length)return r.cancel(),a(e=>0===e.length?e:[]),o(z),f("none"),void u(!1);u(!0);const l=setTimeout(async()=>{const n=r.begin(),l=await async function(e,t,n){const r=await Promise.all(e.map(async e=>{try{return{failed:!1,...P(await e(t,{signal:n}))}}catch(e){const t=n.aborted||function(e){if(!e||"object"!=typeof e)return!1;const{name:t,code:n}=e;return"AbortError"===t||"CanceledError"===t||"ERR_CANCELED"===n}(e);return{failed:!t,results:[],truncatedTypes:[]}}}));return{results:r.flatMap(e=>e.results),truncatedTypes:Array.from(new Set(r.flatMap(e=>e.truncatedTypes))),failed:r.filter(e=>e.failed).length}}(t,e,n.signal);n.isCurrent()&&(a(l.results),o(l.truncatedTypes),f(0===l.failed?"none":l.failed>=t.length?"all":"some"),u(!1))},250);return()=>{clearTimeout(l),r.cancel()}},[e,t,n]);return{results:r,truncatedTypes:l,loading:s,failure:p,reset:y(()=>{m.current.cancel(),a(e=>0===e.length?e:[]),o(z),f("none"),u(!1)},[])}}var F=(e,t)=>`${e}-opt-${t}`;function U(e,t){return"seeAll"===e.kind?"M13.5 4.5L21 12m0 0l-7.5 7.5M21 12H3":"action"===e.kind?e.icon??I:e.icon?e.icon:t?.[e.result.type]?t[e.result.type]:I}function W({sections:e,activeIdx:t,listId:n,label:r,typeIcons:a,groupCount:l,groupLabel:o,onHover:s,onPick:i}){let c=0;/* @__PURE__ */
|
|
2
2
|
return f("div",{id:n,role:"listbox","aria-label":r,className:"py-1",children:e.map(e=>/* @__PURE__ */m("div",{role:"group","aria-label":o(e.title,e.count,!!e.truncated),children:[
|
|
3
3
|
/* @__PURE__ */m("div",{"aria-hidden":"true",className:"flex items-center justify-between px-4 pt-2 pb-1 text-[11px] font-semibold uppercase tracking-wide text-gray-400",children:[
|
|
4
4
|
/* @__PURE__ */f("span",{children:e.title}),
|
|
5
5
|
/* @__PURE__ */f("span",{className:"font-medium normal-case tracking-normal",children:l(e.count,!!e.truncated)})]}),e.rows.map(e=>{const r=c++,l=r===t,o="action"===e.kind||"seeAll"===e.kind?void 0:e.badge,d="action"===e.kind||"seeAll"===e.kind?void 0:e.sub,u="seeAll"===e.kind;/* @__PURE__ */
|
|
6
|
-
return m("div",{id:
|
|
7
|
-
/* @__PURE__ */f("svg",{className:"h-4 w-4 text-gray-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:/* @__PURE__ */f("path",{strokeLinecap:"round",strokeLinejoin:"round",d:
|
|
6
|
+
return m("div",{id:F(n,r),role:"option","aria-selected":l,className:"flex items-center gap-3 w-full px-4 py-2.5 text-left cursor-pointer transition-colors "+(l?"bg-blue-50":"hover:bg-gray-50"),onMouseDown:e=>e.preventDefault(),onClick:()=>i(e),onMouseEnter:()=>s(r),children:[
|
|
7
|
+
/* @__PURE__ */f("svg",{className:"h-4 w-4 text-gray-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:/* @__PURE__ */f("path",{strokeLinecap:"round",strokeLinejoin:"round",d:U(e,a)})}),
|
|
8
8
|
/* @__PURE__ */m("div",{className:"flex-1 min-w-0",children:[
|
|
9
|
-
/* @__PURE__ */f("p",{className:"text-sm font-medium truncate "+(u?"text-blue-600":"text-gray-900"),children:e.label}),d&&/* @__PURE__ */f("p",{className:"text-xs text-gray-400 truncate",children:d})]}),o&&/* @__PURE__ */f("span",{className:"shrink-0 rounded-full bg-gray-100 px-2 py-0.5 text-[10px] font-medium text-gray-500",children:o})]},e.key)})]},e.key))})}var O="react-os-shell:open-global-search";function
|
|
9
|
+
/* @__PURE__ */f("p",{className:"text-sm font-medium truncate "+(u?"text-blue-600":"text-gray-900"),children:e.label}),d&&/* @__PURE__ */f("p",{className:"text-xs text-gray-400 truncate",children:d})]}),o&&/* @__PURE__ */f("span",{className:"shrink-0 rounded-full bg-gray-100 px-2 py-0.5 text-[10px] font-medium text-gray-500",children:o})]},e.key)})]},e.key))})}var O="react-os-shell:open-global-search";function X(){"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent(O))}function J({providers:e,typeIcons:t,listRoutes:n,placeholder:r,quickActions:b,onSelect:g,recent:x,onRecord:v,favorites:k}={}){const w=s().search,N=r??w.placeholder,[_,A]=i(!1),[L,C]=i(""),[$,E]=i(0),T=d(null),{results:j,truncatedTypes:D,loading:B,failure:K,reset:P}=H(L,e,2);c(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"k"===e.key&&(e.preventDefault(),A(e=>!e)),"Escape"===e.key&&_&&A(!1)},t=()=>A(!0);return window.addEventListener("keydown",e),window.addEventListener(O,t),()=>{window.removeEventListener("keydown",e),window.removeEventListener(O,t)}},[_]),l(_);const[z,U]=i(!1);_!==z&&(U(_),_&&(C(""),E(0),P())),c(()=>{_?setTimeout(()=>T.current?.focus(),50):C("")},[_]),c(()=>{E(0)},[j]);const X=L.length>=2,J=u(()=>X?M(j,b,L,w.actions,{truncatedTypes:D,listRoutes:n,seeAllLabel:w.seeAll}):function(e,t){const n=[];e.recent?.length&&n.push({key:"recent",title:t.recent,rows:e.recent.map((e,t)=>({kind:"recent",key:`recent:${e.entity_type}:${e.entity_id}:${t}`,label:e.label,sub:e.sub,badge:e.type,result:e})),count:e.recent.length}),e.favorites?.length&&n.push({key:"favorites",title:t.favorites,rows:e.favorites.map((e,t)=>({kind:"favorite",key:`favorite:${e.entity_type}:${e.entity_id}:${t}`,label:e.label,sub:e.sub,badge:e.type||void 0,icon:"M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z",result:e})),count:e.favorites.length});const r=S("actions",t.actions,e.actions??[]);return r&&n.push(r),n}({recent:x,favorites:k,actions:b},w),[X,j,D,n,b,L,x,k,w]),Z=u(()=>function(e){return e.flatMap(e=>e.rows)}(J),[J]),q=Math.min($,Math.max(Z.length-1,0)),G=p(),V=Z.length>0;c(()=>{_&&0!==Z.length&&document.getElementById(F(G,q))?.scrollIntoView?.({block:"nearest"})},[_,q,Z.length,G]);const Y=y(e=>{A(!1),"action"!==e.kind?("result"!==e.kind&&"recent"!==e.kind||v?.(e.result),g?.(e.result)):e.action.onSelect()},[g,v]);return _?h(
|
|
10
10
|
/* @__PURE__ */m("div",{"data-global-search":"",className:"fixed inset-0 flex items-start justify-center pt-[15vh]",style:{zIndex:o.overlay},onClick:()=>A(!1),children:[
|
|
11
11
|
/* @__PURE__ */f("div",{"data-global-search-backdrop":"",className:"absolute inset-0 bg-black/50 backdrop-blur-sm"}),
|
|
12
12
|
/* @__PURE__ */m("div",{className:"relative z-10 w-full max-w-xl rounded-2xl overflow-hidden",onClick:e=>e.stopPropagation(),style:a(),children:[
|
|
13
13
|
/* @__PURE__ */m("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-gray-200",children:[
|
|
14
14
|
/* @__PURE__ */f("svg",{className:"h-5 w-5 text-gray-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */f("path",{strokeLinecap:"round",strokeLinejoin:"round",d:I})}),
|
|
15
|
-
/* @__PURE__ */f("input",{ref:T,type:"text",value:L,onChange:e=>{C(e.target.value),E(0)},onKeyDown:e=>{"ArrowDown"===e.key?(e.preventDefault(),E(R(
|
|
15
|
+
/* @__PURE__ */f("input",{ref:T,type:"text",value:L,onChange:e=>{C(e.target.value),E(0)},onKeyDown:e=>{"ArrowDown"===e.key?(e.preventDefault(),E(R(q,1,Z.length))):"ArrowUp"===e.key?(e.preventDefault(),E(R(q,-1,Z.length))):"Tab"===e.key&&Z.length>0?(e.preventDefault(),E(function(e,t,n){const r=e.length;if(0===r)return 0;const a=[];let l=0;for(const t of e)a.push(l),l+=t;let o=0;for(let e=0;e<r;e++)t>=a[e]&&(o=e);return a[(o+n+r)%r]}(J.map(e=>e.rows.length),q,e.shiftKey?-1:1))):"Enter"===e.key&&Z[q]&&Y(Z[q])},placeholder:N,role:"combobox","aria-expanded":V,"aria-controls":V?G:void 0,"aria-activedescendant":V?F(G,q):void 0,"aria-autocomplete":"list",className:"flex-1 text-sm bg-transparent border-0 rosh-focus-ring placeholder-gray-400"}),B&&/* @__PURE__ */f("span",{"data-global-search-spinner":"",role:"status","aria-label":w.searching,className:"h-4 w-4 shrink-0 animate-spin rounded-full border-2 border-gray-300 border-t-gray-500"}),
|
|
16
16
|
/* @__PURE__ */f("kbd",{className:"hidden sm:inline-flex items-center rounded border border-gray-300 px-1.5 py-0.5 text-[10px] font-medium text-gray-400",children:w.escBadge})]}),
|
|
17
|
-
/* @__PURE__ */m("div",{className:"max-h-[50vh] overflow-y-auto",children:[
|
|
17
|
+
/* @__PURE__ */m("div",{className:"max-h-[50vh] overflow-y-auto",children:[B&&0===Z.length&&/* @__PURE__ */f("div",{className:"px-4 py-6 text-center text-sm text-gray-400",children:w.searching}),!B&&"all"===K&&X&&/* @__PURE__ */f("div",{role:"alert",className:"px-4 py-3 text-center text-sm text-red-600",children:w.searchFailed}),!B&&X&&0===Z.length&&"all"!==K&&/* @__PURE__ */f("div",{className:"px-4 py-6 text-center text-sm text-gray-400",children:w.noResults}),V&&/* @__PURE__ */f(W,{sections:J,activeIdx:q,listId:G,label:w.listLabel,typeIcons:t,groupCount:w.groupCount,groupLabel:w.groupLabel,onHover:E,onPick:Y}),!B&&"some"===K&&X&&/* @__PURE__ */f("div",{role:"status",className:"px-4 py-2 text-xs text-amber-600",children:w.partialFailure}),!B&&!X&&0===Z.length&&/* @__PURE__ */f("div",{className:"px-4 py-6 text-center text-sm text-gray-400",children:w.minChars(2)})]}),
|
|
18
18
|
/* @__PURE__ */m("div",{className:"flex items-center justify-between px-4 py-2 border-t border-gray-100 bg-gray-50 text-[11px] text-gray-400",children:[
|
|
19
19
|
/* @__PURE__ */m("div",{className:"flex items-center gap-3",children:[
|
|
20
20
|
/* @__PURE__ */m("span",{className:"flex items-center gap-1",children:[
|
|
21
21
|
/* @__PURE__ */f("kbd",{className:"rounded border border-gray-300 px-1 py-0.5 font-medium",children:"↑"}),
|
|
22
22
|
/* @__PURE__ */f("kbd",{className:"rounded border border-gray-300 px-1 py-0.5 font-medium",children:"↓"}),` ${w.navigate}`]}),
|
|
23
23
|
/* @__PURE__ */m("span",{className:"flex items-center gap-1",children:[
|
|
24
|
-
/* @__PURE__ */f("kbd",{className:"rounded border border-gray-300 px-1 py-0.5 font-medium",children:w.enterKey}),` ${w.open}`]}),
|
|
24
|
+
/* @__PURE__ */f("kbd",{className:"rounded border border-gray-300 px-1 py-0.5 font-medium",children:w.enterKey}),` ${w.open}`]}),J.length>1&&/* @__PURE__ */m("span",{className:"flex items-center gap-1",children:[
|
|
25
25
|
/* @__PURE__ */f("kbd",{className:"rounded border border-gray-300 px-1 py-0.5 font-medium",children:w.tabKey}),` ${w.nextGroup}`]})]}),
|
|
26
26
|
/* @__PURE__ */m("span",{className:"flex items-center gap-1",children:[
|
|
27
|
-
/* @__PURE__ */f("kbd",{className:"rounded border border-gray-300 px-1 py-0.5 font-medium",children:w.escKey}),` ${w.close}`]})]})]})]}),document.body):null}export{w as BrandMark,
|
|
27
|
+
/* @__PURE__ */f("kbd",{className:"rounded border border-gray-300 px-1 py-0.5 font-medium",children:w.escKey}),` ${w.close}`]})]})]})]}),document.body):null}export{w as BrandMark,J as GlobalSearch,C as PAGE_RESULT_ENTITY,T as favoritesToResults,E as navPagesProvider,X as openGlobalSearch,$ as parsePageResultTarget,A as partitionNav,B as pushRecent,x as resolveBrandMarkTreatment,L as rowsContainRoute,K as sanitizeRecent,_ as visibleNavChildren,N as visibleSectionItems};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useShellStrings as e}from"./chunk-
|
|
1
|
+
import{useShellStrings as e}from"./chunk-YJX2IWHB.js";import{Fragment as i}from"react";import{jsx as t,jsxs as a}from"react/jsx-runtime";var n=/* @__PURE__ */t("svg",{className:"h-3.5 w-3.5 shrink-0 text-gray-300",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":!0,children:/* @__PURE__ */t("path",{fillRule:"evenodd",d:"M7.21 14.77a.75.75 0 0 1 .02-1.06L11.168 10 7.23 6.29a.75.75 0 1 1 1.04-1.08l4.5 4.25a.75.75 0 0 1 0 1.08l-4.5 4.25a.75.75 0 0 1-1.06-.02Z",clipRule:"evenodd"})}),l="inline-flex min-w-0 items-center gap-1 truncate rounded px-1 -mx-1 text-gray-500 transition-colors hover:text-gray-900 hover:underline rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]";function s({items:s,separator:r,maxItems:c=0,className:m}){const o=e().breadcrumbs;if(0===s.length)return null;const h=r??n,d=[],u=s.length-1;if(c>0&&s.length>c&&c>=2){const e=Math.max(1,c-1);d.push({kind:"item",item:s[0],isLast:!1}),d.push({kind:"ellipsis"});for(let i=s.length-e;i<=u;i++)d.push({kind:"item",item:s[i],isLast:i===u})}else s.forEach((e,i)=>d.push({kind:"item",item:e,isLast:i===u}));/* @__PURE__ */
|
|
2
2
|
return t("nav",{"aria-label":o.label,className:`min-w-0 ${m??""}`,children:/* @__PURE__ */t("ol",{className:"flex items-center gap-1.5 text-sm",children:d.map((e,n)=>/* @__PURE__ */a(i,{children:[n>0&&/* @__PURE__ */t("li",{"aria-hidden":!0,className:"flex items-center",children:h}),
|
|
3
3
|
/* @__PURE__ */t("li",{className:"flex min-w-0 items-center",children:"ellipsis"===e.kind?/* @__PURE__ */t("span",{className:"px-0.5 text-gray-400 select-none","aria-label":o.hidden,children:"…"}):e.isLast||!e.item.href&&!e.item.onClick?/* @__PURE__ */a("span",{"aria-current":e.isLast?"page":void 0,className:"inline-flex min-w-0 items-center gap-1 truncate "+(e.isLast?"font-medium text-gray-900":"text-gray-500"),children:[e.item.icon,
|
|
4
4
|
/* @__PURE__ */t("span",{className:"truncate",children:e.item.label})]}):e.item.href?/* @__PURE__ */a("a",{href:e.item.href,onClick:e.item.onClick,className:l,children:[e.item.icon,
|