efficient-shell 13.18.1 → 13.20.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 +47 -3
- package/dist/{Browser-45J7LAYQ.js → Browser-XFEOOL5J.js} +12 -12
- package/dist/Calculator-V5SACDGQ.js +29 -0
- package/dist/CurrencyConverter-B3NWE6LM.js +21 -0
- package/dist/{Files-246CTCMQ.js → Files-LRSNSZ5Y.js} +65 -65
- package/dist/Notepad-GGBFJNRE.js +24 -0
- package/dist/PomodoroTimer-XLPBKMWS.js +91 -0
- package/dist/{Preview-GMSWWF4O.js → Preview-CWGCGKR5.js} +24 -24
- package/dist/{Stock-S266KGAF.js → Stock-PRUMXULJ.js} +4 -4
- package/dist/{Weather-TE4TTTQA.js → Weather-FO5DVYQ4.js} +18 -18
- package/dist/{WorldClock-5TPBHBYA.js → WorldClock-BYZ5BNLZ.js} +4 -4
- package/dist/ai/index.js +116 -116
- package/dist/apps/index.d.ts +1 -1
- package/dist/apps/index.js +1 -1
- package/dist/bin/browser-check.js +1 -1
- package/dist/bin/media-host-check.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/brand.css +1 -1
- package/dist/charts/PieChart.js +1 -1
- package/dist/charts/RadarChart.js +1 -1
- package/dist/charts/RadialBarChart.js +1 -1
- package/dist/charts/SpecChart.js +1 -1
- package/dist/charts/TimeSeriesChart.js +1 -1
- package/dist/{chunk-UGEA3C5C.js → chunk-23LK4PLJ.js} +5 -5
- package/dist/chunk-2TXQCA4C.js +15 -0
- package/dist/{chunk-SUTABWMQ.js → chunk-5EC62E65.js} +2 -2
- package/dist/{chunk-LGGATDPH.js → chunk-ABPVCVCT.js} +13 -13
- package/dist/{chunk-GEQZUCEO.js → chunk-BVX7LUAW.js} +6 -6
- package/dist/{chunk-5EHIWKUZ.js → chunk-EG5MU7XL.js} +1 -1
- package/dist/{chunk-LUCO5PS6.js → chunk-F3E3CEZM.js} +1 -1
- package/dist/{chunk-KSK4VZIM.js → chunk-FUPU7Z2G.js} +2 -2
- package/dist/{chunk-QTDR2CTB.js → chunk-IUQJGFEO.js} +3 -3
- package/dist/chunk-IXJIHTUI.js +91 -0
- package/dist/{chunk-4SYPNE3P.js → chunk-J4CVYOY3.js} +1 -1
- package/dist/{chunk-GSUWPNX4.js → chunk-JGKUENPD.js} +1 -1
- package/dist/{chunk-LNCAIY64.js → chunk-PBSCF2ML.js} +5 -5
- package/dist/{chunk-ENVANMHI.js → chunk-SHHRC5XK.js} +7 -7
- package/dist/{chunk-EHM3ZVVT.js → chunk-UC5IC3AM.js} +4 -4
- package/dist/chunk-VGUYAVDG.js +1 -0
- package/dist/{chunk-TKCCJRPE.js → chunk-VRJKV44O.js} +1 -1
- package/dist/{chunk-XU4I2DMR.js → chunk-WJTNQ7YD.js} +2 -2
- package/dist/{chunk-34HRPEQD.js → chunk-XOCRRCCP.js} +1 -1
- package/dist/{chunk-S7YUQLBN.js → chunk-XXTAMF3O.js} +6 -6
- package/dist/{chunk-QSJMLHBD.js → chunk-YE2YU526.js} +1 -1
- package/dist/chunk-YI4T5I5D.js +1 -0
- package/dist/data/EntityList.js +1 -1
- package/dist/data/ResizableTable.js +1 -1
- package/dist/forms/BrandAssetEditor.js +1 -1
- package/dist/forms/MediaLibrary.js +1 -1
- package/dist/forms/MediaUploadField.js +1 -1
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/useTheme.d.ts +1 -1
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.js +662 -665
- package/dist/shell/LanguageSelect.js +1 -1
- package/dist/shell/SettingRow.js +1 -1
- package/dist/shell/SidebarLayout.d.ts +5 -2
- package/dist/shell/SidebarLayout.js +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/templates/ChatTemplate.js +1 -1
- package/dist/templates/DashboardTemplate.js +1 -1
- package/dist/templates/EmailTemplate.js +1 -1
- package/dist/tokens/colour.d.ts +2 -2
- package/dist/{types-ClT92-8Z.d.ts → types-DWIjEVSy.d.ts} +5 -5
- package/dist/ui/index.js +1 -1
- package/dist/ui.css +11 -0
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/Calculator-4UBMDAJO.js +0 -29
- package/dist/CurrencyConverter-H3HHXXKT.js +0 -21
- package/dist/Notepad-KXIBS5XS.js +0 -24
- package/dist/PomodoroTimer-JVCYYGRD.js +0 -91
- package/dist/chunk-JYESSDBZ.js +0 -1
- package/dist/chunk-U5RG34NE.js +0 -14
- package/dist/chunk-ZI2FDUYJ.js +0 -99
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import{computeMaximizedBox as e,isSidebarStripReserved as t,boxFillsWorkArea as n,readAlwaysMaximizedFlag as r,WORK_AREA_CHANGED_EVENT as o,scrollerIsFluid as i,growBoxToWidth as a,widthToFit as s,navIcons as l}from"./chunk-4LXCCZDM.js";import{reportBoundaryError as c}from"./chunk-KNUR2UEG.js";import{isStaleChunkError as u}from"./chunk-JDCM2VHG.js";import{WindowInsetContext as d,NO_WINDOW_DRAG as h}from"./chunk-YI4T5I5D.js";import{Result as m}from"./chunk-M2TQOJ3G.js";import{CMD_Z as f,CMD_SHIFT_Z as p}from"./chunk-FBZUEZK7.js";import{CopyButton as w}from"./chunk-BG3C4ALM.js";import{confirm as y}from"./chunk-GMLOMLCS.js";import{useModalDragAside as g}from"./chunk-EIFNESXS.js";import{ItemCount as v}from"./chunk-SXHV5OLA.js";import{isInOverlayOver as b}from"./chunk-SF4IIV5Z.js";import{dialogA11y as x}from"./chunk-VWGWZY7A.js";import{ColoredBadge as k}from"./chunk-WRV6QKJN.js";import{ROW_HEIGHTS as E}from"./chunk-AW7TOB6N.js";import{LoadingSpinner as M}from"./chunk-4U5M37SF.js";import{activationOrder as C,activeListeners as S,ModalActionsContext as L,subscribeActive as N,getActiveModalId as z,KEY_ACTIVATED_SELECTOR as T}from"./chunk-F3ZOO23R.js";import{useShellAuth as A}from"./chunk-2QY5BJLA.js";import{useIsMobile as D,useIsPhone as I}from"./chunk-UGTRSRIW.js";import{useShellPrefs as P}from"./chunk-DPFEQQQU.js";import{focusableIn as R}from"./chunk-DWGYC7OD.js";import{StatusBadge as O}from"./chunk-YDJ5IZOU.js";import{PopupMenu as $,PopupMenuItem as W,PopupMenuDivider as K,PopupMenuLabel as j}from"./chunk-THAPVKEJ.js";import{Button_default as F}from"./chunk-UTISUEO4.js";import{Icon as B}from"./chunk-ISVODSRP.js";import{LoadingSpinner as q}from"./chunk-R2VKEMZH.js";import{Z_LAYERS as H}from"./chunk-62LW225J.js";import{shellHttp as U,isShellHttpConfigured as Y}from"./chunk-STKJA4PV.js";import{fitBoxScale as X,fitFrameStyle as V}from"./chunk-M6UKCZHT.js";import{runEscapeInterceptors as G}from"./chunk-TWVUQUUD.js";import{useShellStrings as J}from"./chunk-IUVGHHR3.js";import{createContext as _,createElement as Z,useContext as Q,Component as ee,useLayoutEffect as te,useRef as ne,useEffect as re,useState as oe,useSyncExternalStore as ie,useCallback as ae,isValidElement as se,Fragment as le,Children as ce,cloneElement as ue,useMemo as de,useId as he,useReducer as me,Suspense as fe}from"react";import{jsxs as pe,jsx as we,Fragment as ye}from"react/jsx-runtime";import{createPortal as ge}from"react-dom";import{useLocation as ve}from"react-router-dom";import{useQueryClient as be,useQuery as xe}from"@tanstack/react-query";function ke(e){return"component"in e}function Ee(e){return"endpoint"in e}var Me={};function Ce(e){Me=e}var Se=new Proxy({},{get:(e,t)=>Me[t],has:(e,t)=>t in Me,ownKeys:()=>Object.keys(Me),getOwnPropertyDescriptor(e,t){if(t in Me)return{configurable:!0,enumerable:!0,value:Me[t]}}});function Le(){return Y()}var Ne=U,ze=_({});function Te({value:e,children:t}){return Z(ze.Provider,{value:e},t)}function Ae(){return Q(ze)}var De=_(null);function Ie(){return Q(De)?.pageSearch??""}var Pe=null,Re=/* @__PURE__ */new Set;function Oe(e){Pe!==e&&(Pe=e,Re.forEach(e=>e()))}function $e(){return Pe}function We(e){return Re.add(e),()=>{Re.delete(e)}}var Ke=null;function je(e){Ke=e}function Fe({error:e,onReload:t}){const n=u(e);/* @__PURE__ */
|
|
2
|
+
return pe("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 py-12 text-center",children:[
|
|
3
|
+
/* @__PURE__ */we(B,{name:"warning",className:"h-8 w-8 text-amber-500",strokeWidth:1.5}),
|
|
4
|
+
/* @__PURE__ */pe("div",{className:"min-w-0",children:[
|
|
5
|
+
/* @__PURE__ */we("p",{className:"text-sm font-medium text-gray-700",children:n?"This window needs the latest version of the app":"This window crashed"}),
|
|
6
|
+
/* @__PURE__ */we("p",{className:"mt-1 text-xs text-gray-400 max-w-sm break-words",children:n?"A new version was deployed while this tab was open. Reload the page to pick it up.":e.message||String(e)})]}),
|
|
7
|
+
/* @__PURE__ */we("button",{type:"button",onClick:n?()=>window.location.reload():t,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 text-sm font-medium rounded-lg",children:n?"Reload page":"Reload window"})]})}var Be=class extends ee{state={error:null};static getDerivedStateFromError(e){return{error:e instanceof Error?e:new Error(String(e))}}componentDidCatch(e,t){console.error("[efficient-shell] window content crashed:",e,t.componentStack),c(e)}reset=()=>this.setState({error:null});render(){const{error:e}=this.state;return e?this.props.fallback?this.props.fallback(e,this.reset):/* @__PURE__ */we(Fe,{error:e,onReload:this.reset}):this.props.children}},qe=_(null),He="text-xs text-gray-500 hover:text-gray-700 disabled:opacity-40 disabled:hover:text-gray-500 disabled:cursor-default";function Ue({className:e="",auto:t=!1}){const n=Q(qe),r=J().undo,o=n?.claimOwnMount;if(te(()=>{if(!t&&o)return o(!0),()=>o(!1)},[t,o]),!n||!n.enabled)return null;const{undo:i,redo:a,canUndo:s,canRedo:l,undoLabel:c,redoLabel:u}=n;/* @__PURE__ */
|
|
8
|
+
return pe("div",{className:`flex items-center gap-2 ${e}`,"data-undo-controls":t?"shell":"form",children:[
|
|
9
|
+
/* @__PURE__ */we("button",{type:"button",onClick:i,disabled:!s,title:s?r.undoStep(c??"",f):r.nothingToUndo,className:He,children:r.undo}),
|
|
10
|
+
/* @__PURE__ */we("button",{type:"button",onClick:a,disabled:!l,title:l?r.redoStep(u??"",p):r.nothingToRedo,className:He,children:r.redo})]})}var Ye=/* @__PURE__ */new Set([408,429]);function Xe(e){const t=e?.response?.status;return"number"==typeof t?t:void 0}function Ve(e){const t=Xe(e);return null!=t&&(t>=400&&t<500&&!Ye.has(t))}function Ge(e,t){return!Ve(t)&&e<3}function Je(e){if("page"!==e.type)return!0;const t=e.route?Se[e.route]:void 0;if(!t||!ke(t))return!0;const n=t;return!n.widget&&!n.utility}function _e(e){const t=e.route?Se[e.route]:void 0;if(!t||!ke(t))return;const n=t;return n.taskbarGroup?n.taskbarGroup:{key:e.route,label:n.label,icon:e.route}}var Ze=(e,t)=>!!t&&"page"===e.type&&e.route===t;var Qe="flex-1 min-h-0";function et(){const e=J().record;/* @__PURE__ */
|
|
11
|
+
return we(q,{label:e.loading,padding:"",className:Qe})}function tt(e){return e??void 0}function nt({isPending:e,isFetching:t,enabled:n=!0,error:r,onRetry:o}){const i=J().record;if(t||e&&n)/* @__PURE__ */return we(et,{});if(r){const e=Xe(r);if(401===e)/* @__PURE__ */
|
|
12
|
+
return we(m,{status:"warning",title:i.signInRequired,subTitle:i.signInBody,className:Qe});if(403===e)/* @__PURE__ */
|
|
13
|
+
return we(m,{status:"403",className:Qe});if(404===e||410===e)/* @__PURE__ */
|
|
14
|
+
return we(m,{status:"404",title:i.notFound,className:Qe});const t=null==e||408===e||429===e||e>=500;/* @__PURE__ */
|
|
15
|
+
return we(m,{status:"500",title:i.loadFailed,subTitle:t?i.checkConnection:i.rejected,extra:t?/* @__PURE__ */we(F,{variant:"secondary",size:"sm",onClick:o,children:i.retry}):void 0,className:Qe})}/* @__PURE__ */
|
|
16
|
+
return we(m,{status:"404",title:i.notFound,className:Qe})}function rt({entity:e,children:t,...n}){return null!=e?/* @__PURE__ */we(ye,{children:t(e)}):/* @__PURE__ */we(nt,{...n})}var ot=/^[a-z]+(?:-[a-z]+)*-\d{13}$/;function it(e){return"string"==typeof e&&(e.startsWith("new-")||ot.test(e))}function at(e){if(it(e.entityId))return!0;const t=e.entitySnapshot;return!(!t||"object"!=typeof t||!t._new&&!t._duplicate)}var st=_({openWindows:[],openEntity:()=>{},openPage:()=>{},reorderWindows:()=>{},closeEntity:()=>{},minimize:()=>{},items:[],restore:()=>{},remove:()=>{},restoreIfMinimized:()=>!1,openItems:[]}),lt=_(null);function ct(e){const t=Q(lt),n=ne(null);null===n.current&&(n.current=/* @__PURE__ */Symbol("window-dirty")),te(()=>{if(t)return t(n.current,e)},[t,e]),re(()=>{if(!t||!e)return;const n=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[t,e])}function ut(){const e=ne(/* @__PURE__ */new Map),[t,n]=oe(!1);return{dirty:t,registerDirty:ae((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 dt(){return Q(st)}function ht(e){if("page"!==e.type&&at(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 mt({item:e,onClose:t,accentRgb:n}){const{dirty:r,registerDirty:o}=ut(),i=Se[e.route];if(!i||!ke(i))return null;const a=i,s=a.component;/* @__PURE__ */
|
|
17
|
+
return we(io,{open:!0,onClose:t,icon:l[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__ */we(lt.Provider,{value:o,children:/* @__PURE__ */we(fe,{fallback:/* @__PURE__ */we("div",{className:"flex items-center justify-center py-12",children:/* @__PURE__ */we(M,{})}),children:/* @__PURE__ */we(s,{})})})})}function ft({entityType:e,entityId:t,label:n}){const r=J(),o=be(),{data:i}=xe({queryKey:["my-profile-sidebar"],enabled:Le(),queryFn:()=>Ne.get("/auth/me/").then(e=>e.data)}),a=(i?.preferences||{}).favorite_documents||[],s=a.some(n=>n.entityType===e&&n.entityId===t);/* @__PURE__ */
|
|
18
|
+
return we("button",{onClick:()=>{const r=s?a.filter(n=>!(n.entityType===e&&n.entityId===t)):[...a,{entityType:e,entityId:t,label:n}];Ne.patch("/auth/me/",{preferences:{favorite_documents:r}}).then(()=>{o.invalidateQueries({queryKey:["my-profile-sidebar"]})})},title:s?r.taskbar.removeFromDesktop:r.taskbar.addToDesktop,className:"shrink-0 transition-colors "+(s?"text-yellow-500 hover:text-yellow-600":"text-gray-300 hover:text-yellow-400"),children:/* @__PURE__ */we(B,{name:"star",className:"h-4 w-4",fill:s?"currentColor":"none",strokeWidth:1.5})})}var pt=/* @__PURE__ */new Set,wt=()=>"hidden";function yt({item:e,onClose:t,onMinimize:n,accentRgb:r}){const o=Se[e.entityType];if(!o||!Ee(o))return null;const i=o,[a,s]=oe(!1),{dirty:c,registerDirty:u}=ut(),d=i.queryKey||i.endpoint.replace(/^\/|\/$/g,"").split("/").pop()||e.entityType,h=e.entitySnapshot?._duplicate,m=it(e.entityId),f=Ae(),p=(w=e.id,ie(N,()=>{const e=Xn.get(w);return null!=e&&Fn.has(e)}));var w;const y=!i.selfFetching&&!h&&!m&&Le(),g=xe({queryKey:[d,e.entityId],queryFn:()=>{return Ne.get((t=i.endpoint,n=String(e.entityId),`${t}${encodeURIComponent(n)}/`)).then(e=>e.data);var t,n},initialData:tt(e.entitySnapshot),initialDataUpdatedAt:0,enabled:y,staleTime:0,refetchOnWindowFocus:()=>{return void 0===(e=f.entityRefetchOnWindowFocus)||("function"==typeof e?e():e);var e},refetchOnMount:"always",refetchInterval:e=>function(e,t={}){if(Ve(e))return!1;if(t.minimized)return!1;const n=t.hostInterval;if(void 0===n)return 6e4;const r="function"==typeof n?n():n;return"number"==typeof r&&r>0&&r}(e.state.error,{minimized:p,hostInterval:f.entityRefetchInterval}),refetchIntervalInBackground:!1,retry:Ge}),v=g.data,b=g.refetch;re(()=>{var t;if(y)return t=t=>{t!==e.id||pt.has(t)||b({cancelRefetch:!1})},lr.add(t),()=>{lr.delete(t)}},[b,e.id,y]);const x=ae(()=>{a&&!c?s(!1):t()},[a,c,t]),k=(i.useEdit??wt)(v??null),E=!i.useEdit||m||h?void 0:{state:k,editing:a,onEdit:()=>s(!0),onDiscard:()=>s(!1)},C=i.selfFetching?e.label:v?i.title(v,a,s):e.label,S=i.icon,L=S?l[S]:null,z=C,T=!i.selfFetching&&v&&i.footer&&!h?i.footer(v):void 0;return i.rendersOwnModal?i.selfFetching?/* @__PURE__ */we(fe,{fallback:/* @__PURE__ */we(M,{}),children:i.render(v??e.entitySnapshot,t,e.entityId,a,s)}):null!=v?/* @__PURE__ */we(fe,{fallback:/* @__PURE__ */we(io,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */we(et,{})}),children:i.render(v,t,e.entityId,a,s)}):/* @__PURE__ */we(io,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */we(nt,{isPending:g.isPending,isFetching:g.isFetching,enabled:y,error:g.error,onRetry:b})}):/* @__PURE__ */we(io,{open:!0,onClose:x,onMinimize:n,initialBox:e.savedBox,icon:L,title:z,footer:T,copyText:e.label,windowKey:e.id,openedFromKey:e.openedFrom,size:i.size||"2xl",dirty:c,editing:a||m||h,edit:E,dimensions:i.dimensions,autoHeight:i.autoHeight,autoMinHeight:i.autoMinHeight,autoWidth:i.autoWidth,appStyle:i.appStyle,flushBody:i.flushBody,accentRgb:r,children:/* @__PURE__ */we(lt.Provider,{value:u,children:/* @__PURE__ */we(fe,{fallback:/* @__PURE__ */we(et,{}),children:i.selfFetching?i.render(null,t,e.entityId,a,s):/* @__PURE__ */we(rt,{entity:v,isPending:g.isPending,isFetching:g.isFetching,enabled:y,error:g.error,onRetry:b,children:n=>i.render(n,t,e.entityId,a,s)})})})})}function gt(e){return document.querySelector(`[data-modal-panel][data-window-key="${e}"]`)}function vt(e){return document.querySelector(`[data-modal-panel][data-window-root][data-window-owner="${e}"]`)}function bt(e){const t=gt(e),n=t??vt(e);if(!n)return;if(t&&!Er(t))return r=e,void window.dispatchEvent(new CustomEvent("modal-reveal",{detail:{windowKey:r}}));var r;const o=n.getAttribute("data-modal-id");o&&cr(o)}function xt(){const e=z();if(!e)return;const t=document.querySelector(`[data-modal-panel][data-modal-id="${e}"]`);return t?.getAttribute("data-window-key")??void 0}var kt=/* @__PURE__ */new Map;function Et(){const e=xt();if(e)return kt.get(e)}function Mt(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 Ct="rosh-peek-style",St=H.peek,Lt=H.taskbarPreview;function Nt(e){"undefined"!=typeof document&&(!function(){if("undefined"==typeof document||document.getElementById(Ct))return;const e=document.createElement("style");e.id=Ct,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:${St}!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 zt(){"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 Tt({id:e,label:t,maxW:n,maxH:r,titleAbove:o=!1,onClick:i,onClose:a}){const s=J(),l=ne(null),[c,u]=oe({w:n,h:Math.round(.75*r)}),[d,h]=oe(!1);return te(()=>{const o=l.current;if(!o)return;const i=gt(e)??Mt(t);if(!i)return void h(!1);const a=i.getBoundingClientRect();if(0===a.width||0===a.height)return void h(!1);const s=X({width:n,height:r},a),c=Math.max(80,Math.round(a.width*s)),d=Math.max(60,Math.round(a.height*s));u({w:c,h:d}),h(!0);const m=i.cloneNode(!0);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";const f=V(a.width,s);return Object.assign(m.style,{transform:f.transform??"",transformOrigin:f.transformOrigin}),m.style.pointerEvents="none",m.style.animation="none",m.style.zIndex="auto",m.removeAttribute("data-modal-panel"),m.removeAttribute("data-modal-id"),m.removeAttribute("data-window-key"),m.removeAttribute("role"),m.removeAttribute("aria-labelledby"),m.removeAttribute("aria-label"),m.querySelectorAll('[role="dialog"], [data-portal]').forEach(e=>{e.style.display="none"}),o.innerHTML="",o.appendChild(m),()=>{o.innerHTML=""}},[e,t,n,r]),/* @__PURE__ */pe("div",{style:{width:c.w,height:c.h},className:"relative rounded-md overflow-hidden bg-white/95 border border-line-strong shadow-(--elevation-panel) cursor-pointer ring-2 ring-transparent group-hover:ring-blue-400 transition shrink-0",onClick:i,children:[
|
|
19
|
+
/* @__PURE__ */we("div",{ref:l,className:"absolute inset-0 z-0 overflow-hidden"}),!d&&/* @__PURE__ */pe("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-gray-400 bg-gray-50",children:[
|
|
20
|
+
/* @__PURE__ */we(B,{name:"window",className:"h-6 w-6",strokeWidth:1.5}),
|
|
21
|
+
/* @__PURE__ */we("span",{className:"mt-1 text-3xs uppercase tracking-wide",children:"Hidden"})]}),!o&&/* @__PURE__ */we("div",{className:"absolute bottom-0 left-0 right-0 z-10 px-2 py-1 text-2xs font-medium text-on-accent bg-gradient-to-t from-black/80 to-transparent truncate pointer-events-none",children:t}),a&&/* @__PURE__ */we("button",{onClick:e=>{e.stopPropagation(),a()},className:"absolute top-1 right-1 z-20 h-5 w-5 rounded-full bg-gray-900/90 ring-1 ring-white/80 shadow-sm hover:bg-red-500 text-on-accent flex items-center justify-center",title:s.taskbar.closeWindow,children:/* @__PURE__ */we(B,{name:"close",className:"h-3 w-3",strokeWidth:3})})]})}function At({items:e,anchorEl:t,onActivate:n,onClose:r,onMouseEnter:o,onMouseLeave:i}){const a=J(),s=e.length>1,l=ne(null),[c,u]=oe({left:-9999,top:-9999,ready:!1}),[d,h]=oe(()=>"undefined"!=typeof document&&getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom");te(()=>{const e=l.current;if(!e)return;const n=()=>{const n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),o=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom";h(o);let i,a=n.left+n.width/2-r.width/2;"top"===o?i=n.bottom+8:"left"===o?(a=n.right+8,i=n.top+n.height/2-r.height/2):"right"===o?(a=n.left-r.width-8,i=n.top+n.height/2-r.height/2):i=n.top-r.height-8,a=Math.max(8,Math.min(a,window.innerWidth-r.width-8)),i=Math.max(8,Math.min(i,window.innerHeight-r.height-8)),u({left:a,top:i,ready:!0})};n();const r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[t,e.length]),re(()=>zt,[]);const m="top"===d,f=(m?"mt-1":"mb-1")+" max-w-[240px] truncate text-2xs font-medium text-ink-strongest bg-white/80 px-2 py-0.5 rounded shadow-sm ring-2 ring-transparent transition group-hover:ring-blue-400";return ge(
|
|
22
|
+
/* @__PURE__ */we("div",{ref:l,"data-taskbar-preview":"",style:{position:"fixed",left:c.left,top:c.top,zIndex:Lt,maxWidth:"calc(100vw - 16px)",opacity:c.ready?1:0},className:s?"flex gap-2 flex-wrap":"",onMouseEnter:o,onMouseLeave:()=>{zt(),i()},children:e.map(e=>{const t=gt(e.id)??Mt(e.label),o=t?function(e){if(Er(e))return null;const t=e.getBoundingClientRect(),n=fr(),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__ */
|
|
23
|
+
return pe("div",{className:"group flex flex-col items-center",onMouseEnter:()=>Nt(t),children:[!m&&/* @__PURE__ */we("span",{className:f,children:e.label}),
|
|
24
|
+
/* @__PURE__ */we(Tt,{id:e.id,label:e.label,maxW:240,maxH:160,titleAbove:!0,onClick:()=>n(e.id),onClose:()=>r(e.id)}),m&&/* @__PURE__ */we("span",{className:f,children:e.label}),null!==o&&/* @__PURE__ */pe("span",{title:a.taskbar.offscreenHint,className:"mt-1 inline-flex items-center gap-1 rounded bg-amber-500 px-2 py-0.5 text-2xs font-semibold text-on-accent shadow-sm",children:[
|
|
25
|
+
/* @__PURE__ */we(B,{name:"arrow-right",className:"h-3 w-3",style:{transform:`rotate(${o}deg)`},strokeWidth:3}),"Off screen"]})]},e.id)})}),document.body)}function Dt(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 It({openWindows:e,onRemove:t,onSplitView:n,onActivate:r,onActivateById:o}){const i=J(),[a,s]=oe(null);re(()=>{let e,t;const n=()=>{clearInterval(e),clearTimeout(t),e=void 0},r=()=>{const e=document.getElementById("taskbar-windows");return s(t=>t===e?t:e),!!e},o=()=>{n(),r()||(e=setInterval(()=>{r()&&n()},100),t=setTimeout(n,5e3))};return o(),window.addEventListener("react-os-shell:layout-mode-changed",o),()=>{n(),window.removeEventListener("react-os-shell:layout-mode-changed",o)}},[]);const c=ie(N,z),[,u]=oe(0);re(()=>{const e=()=>u(e=>e+1);return window.addEventListener("modal-geometry",e),window.addEventListener("resize",e),()=>{window.removeEventListener("modal-geometry",e),window.removeEventListener("resize",e)}},[]);const[,d]=oe(0);re(()=>{const e=()=>d(e=>e+1);return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[]);const h=e=>{const t=Mt(e),n=t?.querySelector("[data-window-title]");return n?.textContent?.trim()||e},[m,f]=oe(null),[p,w]=oe(null),[y,g]=oe(null),b=ne(null),x=()=>{b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{f(null),w(null)},150)},k=e.filter(e=>!e.route||!Se[e.route]?.utility);if(!a||!a.isConnected||0===k.length)return null;const E=[],M=/* @__PURE__ */new Map;for(const e of k){const t=e.route?Se[e.route]:void 0,n=t?.taskbarGroup,r=n?.key??e.route??`entity:${e.id}`,o=M.get(r);if(void 0!==o)E[o].items.push(e);else{M.set(r,E.length);const o=n?.label??t?.label??e.label;E.push({key:r,route:n?.icon??e.route,label:o,items:[e]})}}return ge(
|
|
26
|
+
/* @__PURE__ */pe(ye,{children:[E.map(e=>{const n=e.route?l[e.route]:null,r=e.items[e.items.length-1];let a=!1;if(c){const t=document.querySelector(`[data-modal-id="${c}"]`);if(t){const n=t.querySelector("[data-window-title]"),r=n?.textContent??"";a=e.items.some(e=>r.includes(e.label))}}const s=e.items.length>1,u=e.items.some(e=>{const t=gt(e.id)??Mt(e.label);return!!t&&!Er(t)});/* @__PURE__ */
|
|
27
|
+
return pe("button",{onClick:()=>o(r.id),onMouseEnter:t=>{return n=e.items,r=t.currentTarget,void(y||(b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{f(n),w(r)},350)));var n,r},onMouseLeave:x,onDoubleClick:e=>{e.stopPropagation(),window.dispatchEvent(new CustomEvent("modal-center",{detail:{windowKey:r.id,label:r.label}}))},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),b.current&&(clearTimeout(b.current),b.current=null),f(null),w(null),s?g({x:t.clientX,y:t.clientY,items:e.items,label:e.label}):window.dispatchEvent(new CustomEvent("modal-context-menu",{detail:{windowKey:r.id,label:r.label,x:t.clientX,y:t.clientY}}))},style:{width:"var(--window-tab-width, 200px)",fontSize:"var(--window-tab-font-size, 12px)"},"data-tab-group":e.key,className:"group relative flex items-center gap-2 rounded-lg px-3 py-2 font-medium transition-all min-w-0 shrink "+(a?"bg-blue-100/60 border border-blue-400/60 text-blue-700":"bg-gray-50/40 border border-gray-200/40 text-gray-700 hover:bg-gray-200/40"),children:[n&&se(n)?ue(n,{className:"h-3.5 w-3.5 shrink-0"}):/* @__PURE__ */we(B,{name:"expand",className:"h-3.5 w-3.5 shrink-0",strokeWidth:2}),
|
|
28
|
+
/* @__PURE__ */we("span",{className:"truncate flex-1",children:s?e.label:h(r.label)}),u&&/* @__PURE__ */we("span",{title:i.taskbar.offscreenDot,className:"shrink-0 h-1.5 w-1.5 rounded-full bg-amber-500"}),s&&/* @__PURE__ */we(v,{count:e.items.length,label:i.count.windows(e.items.length)}),!s&&/* @__PURE__ */we("span",{role:"button",onClick:e=>{e.stopPropagation(),t(r.id)},className:"ml-auto text-gray-400 hover:text-red-500 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:/* @__PURE__ */we(B,{name:"close",className:"h-3 w-3",strokeWidth:2})})]},e.key)}),
|
|
29
|
+
/* @__PURE__ */we("div",{className:"flex-1"}),k.length>=2&&/* @__PURE__ */pe("button",{onClick:n,title:i.taskbar.expose,className:"flex items-center gap-1 rounded px-2 py-1 text-2xs font-medium text-blue-600 border border-blue-300 hover:bg-accent-tint transition-colors shrink-0",children:[
|
|
30
|
+
/* @__PURE__ */we(B,{name:"grid",className:"h-3 w-3",strokeWidth:2}),"Exposé"]}),y&&/* @__PURE__ */pe($,{portal:!0,minWidth:200,style:Dt(y.x,y.y),onClose:()=>g(null),children:[
|
|
31
|
+
/* @__PURE__ */we(j,{children:y.label}),
|
|
32
|
+
/* @__PURE__ */pe(W,{onClick:()=>{g(null),y.items.forEach(e=>function(e){const t=Xn.get(e);t&&ur(t)}(e.id))},children:[
|
|
33
|
+
/* @__PURE__ */we(B,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),i.taskbar.minimizeAllWindows]}),
|
|
34
|
+
/* @__PURE__ */pe(W,{onClick:()=>{g(null),y.items.forEach(e=>o(e.id))},children:[
|
|
35
|
+
/* @__PURE__ */we("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */we("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75h6.5v6.5h-6.5zM13.75 8.75h6.5v6.5h-6.5z"})}),i.taskbar.restoreAllWindows]}),
|
|
36
|
+
/* @__PURE__ */we(K,{}),
|
|
37
|
+
/* @__PURE__ */pe(W,{danger:!0,onClick:()=>{g(null),y.items.forEach(e=>t(e.id))},children:[
|
|
38
|
+
/* @__PURE__ */we(B,{name:"close",className:"h-4 w-4",strokeWidth:2}),`${i.taskbar.closeAllWindows} (${y.items.length})`]})]}),m&&p&&/* @__PURE__ */we(At,{items:m,anchorEl:p,onActivate:e=>{o(e),f(null),w(null)},onClose:e=>{t(e),f(null),w(null)},onMouseEnter:()=>{b.current&&(clearTimeout(b.current),b.current=null)},onMouseLeave:x})]}),a)}var Pt=["/login","/forgot-password","/reset-password","/force-change-password"];function Rt({children:e,windowAccentForRoute:t}){const n=ve(),r=Pt.some(e=>n.pathname.startsWith(e)),[o,i]=oe([]),a=ne(o);te(()=>{a.current=o},[o]);const s=ie(We,$e,$e),l=ne(/* @__PURE__ */new Map),c=e=>{const t=Je(e),n=!!s&&"page"===e.type&&e.route===s,r=e.pageSearch||void 0,o=l.current.get(e.id);if(o&&o.tab===t&&o.home===n&&o.pageSearch===r)return o;const i={key:e.id,tab:t,home:n,...r?{pageSearch:r}:{}};return l.current.set(e.id,i),i};re(()=>{kt.clear();for(const e of o)e.route&&kt.set(e.id,e.route)},[o]);const u=ae(e=>{i(t=>t.filter(t=>t.id!==e))},[]),d=ae(e=>{var t;gt(e)||vt(e)?(t=e,window.dispatchEvent(new CustomEvent($r,{detail:{windowKey:t}}))):u(e)},[u]),h=(e,t=!1)=>{const n=Bn;t&&pt.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,(qn.get(i)??-1)>a)||cr(o),t&&pt.delete(e)},50)},m=(e,t,n)=>{const r=Ke;if(n||!r)return[...e,t];const o=function(e,t,n){if(!Je(t))return e.length;if(t.shellOwned&&Ze(t,n.home))return 0;const r=Ze(t,n.home)?void 0:_e(t)?.key;if(r){let t=-1;if(e.forEach((e,o)=>{Je(e)&&!Ze(e,n.home)&&_e(e)?.key===r&&(t=o)}),t>=0)return t+1}if("page"===t.type&&t.route&&!Ze(t,n.home)&&n.favorites.includes(t.route))return e.length>0&&Ze(e[0],n.home)?1:0;const o=t.openedFrom?e.findIndex(e=>e.id===t.openedFrom):-1;if(o>=0){const t=/* @__PURE__ */new Set([e[o].id]);let r=o+1;for(;r<e.length&&e[r].openedFrom&&t.has(e[r].openedFrom);)t.add(e[r].id),r++;const i=t=>Je(e[t])&&!Ze(e[t],n.home)?_e(e[t])?.key:void 0;for(;r>0&&r<e.length&&void 0!==i(r)&&i(r)===i(r-1);)r++;return r}return e.length}(e,t,{home:$e(),favorites:r.favorites});return[...e.slice(0,o),t,...e.slice(o)]},f=ae(e=>{i(t=>function(e,t){const n=new Set(t),r=new Map(e.map(e=>[e.id,e])),o=t.map(e=>r.get(e)).filter(e=>!!e);if(o.length!==n.size)return e;let i=0;const a=e.map(e=>n.has(e.id)?o[i++]:e);return a.every((t,n)=>t===e[n])?e:a}(t,e))},[]),p=ae((e,t,n,r,o,a={})=>{if(!Se[e]||!Ee(Se[e]))return;const s=`${e}:${t}`,l=xt();i(i=>{const c=i.find(n=>n.entityType===e&&String(n.entityId)===String(t));return c?(h(c.id),i):(h(s,!0),m(i,{id:s,type:"modal",label:r||t,route:o||window.location.pathname,entityType:e,entityId:t,entitySnapshot:tt(n),openedFrom:l},!!a.append))})},[]),w=ae((e,t={})=>{if(!Se[e]||!ke(Se[e]))return;const n=Se[e],{reuse:r=!1,background:o=!1,shellOwned:s,search:l,append:c=!1}=t,u=e=>{var t;o?(t=e,Zn.add(t)):h(e)};if(n.widget){const t=a.current.find(t=>"page"===t.type&&t.route===e);if(t)return void d(t.id)}const f=xt();i(t=>{if(n.multiInstance){const i=t.filter(t=>"page"===t.type&&t.route===e);if(s&&i.length>0)return t;if(r&&!l&&i.length>0)return o||h(i[i.length-1].id),t;const a=`page:${e}:${Math.random().toString(36).slice(2,8)}`;return u(a),m(t,{id:a,type:"page",label:n.label,route:e,openedFrom:f,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}},c)}const i=t.find(t=>"page"===t.type&&t.route===e);if(i)return n.widget?t:(o||h(i.id),l&&i.pageSearch!==l?t.map(e=>e===i?{...e,pageSearch:l}:e):t);const a=`page:${e}`;return u(a),m(t,{id:a,type:"page",label:n.label,route:e,openedFrom:f,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}},c)})},[d]),y=ae(()=>{},[]),g=ae(()=>{},[]),v=d,b=d;/* @__PURE__ */
|
|
39
|
+
return pe(st.Provider,{value:{openWindows:o,openEntity:p,openPage:w,reorderWindows:f,closeEntity:v,minimize:y,items:[],openItems:o,restore:g,remove:b,restoreIfMinimized:()=>!1},children:[e,
|
|
40
|
+
/* @__PURE__ */we(It,{openWindows:o,onRemove:d,onSplitView:ro,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&&cr(e)}})},onActivateById:bt}),
|
|
41
|
+
/* @__PURE__ */we(oo,{}),!r&&o.map(e=>{const n=e.route?t?.(e.route):void 0;
|
|
42
|
+
/* @__PURE__ */
|
|
43
|
+
return we(De.Provider,{value:c(e),children:/* @__PURE__ */we(Be,{fallback:(t,n)=>/* @__PURE__ */we(io,{open:!0,onClose:()=>u(e.id),title:e.label,size:"md",autoHeight:!0,windowKey:e.id,children:/* @__PURE__ */we(Fe,{error:t,onReload:n})}),children:/* @__PURE__ */we(hn,{spec:ht(e),children:/* @__PURE__ */we(mo,{windowId:e.id,children:"page"===e.type?/* @__PURE__ */we(mt,{item:e,onClose:()=>u(e.id),accentRgb:n}):/* @__PURE__ */we(yt,{item:e,onClose:()=>u(e.id),onMinimize:()=>{},accentRgb:n})})})})},e.id)})]})}var Ot=400;function $t({panelRef:e,bodyRef:t,open:n,widget:r,active:o,minimized:i}){const a=ne(null),s=ne(!1);n&&!s.current&&(a.current="undefined"==typeof document?null:document.activeElement),s.current=n;const l=ne(!1),c=ne(void 0),u=ne(i),d=u.current&&!i;u.current=i;const h=()=>{l.current=!0,clearTimeout(c.current),c.current=setTimeout(()=>{l.current=!1},Ot)};re(()=>{n&&!r&&h()},[n,r]),re(()=>{d&&n&&!r&&h()},[d]),re(()=>()=>clearTimeout(c.current),[]),re(()=>{if(!n||r||!o||i||!l.current)return;l.current=!1;const a=e.current;if(!a||a.contains(document.activeElement))return;if(document.activeElement?.closest('[aria-modal="true"]'))return;const s=t.current?R(t.current)[0]:void 0;s?s.focus():(a.hasAttribute("tabindex")||a.setAttribute("tabindex","-1"),a.focus())},[n,r,o,i,e,t]),te(()=>{if(!n||r)return;const t=e.current;return()=>{const e=a.current,n=document.activeElement;(!n||n===document.body||!!t?.contains(n))&&e&&e.isConnected&&!t?.contains(e)&&e.focus?.()}},[n,r,e])}var Wt=null,Kt=/* @__PURE__ */new Set;function jt(){return Wt}function Ft(e){if(Wt!==e){Wt=e;for(const e of Kt)e()}}function Bt(e){return Kt.add(e),()=>{Kt.delete(e)}}var qt=!1,Ht={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},Ut=()=>{};function Yt(e){qt=e,Ht={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0}}function Xt(e,t){qt&&("submenu"===e?Ht.submenus++:Ht.menus++,Ht.menuKey=t)}function Vt(e){if(!qt)return Ut;const t=performance.now();let n=!1;return()=>{if(n)return;if(n=!0,!qt)return;const r=performance.now()-t;"move"===e?Ht.moveMs+=r:Ht.resizeMs+=r}}function Gt(){const e=Ht;return Ht={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},e}var Jt=/* @__PURE__ */new Set([O,k]),_t=e=>Jt.has(e)||"function"==typeof e&&"badge"===e.titleRole,Zt=/* @__PURE__ */new Set(["button","a","input","select","textarea","kbd"]),Qt=/* @__PURE__ */new Set(["svg"]);function en(e){const t=[],n={text:"",accessories:[],badges:[],actions:[]};return tn(e,n,t),n.text=t.join("").replace(/\s+/g," ").trim(),n}function tn(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=>tn(e,t,n));if(!se(e))return;const r=e;if(r.type===w)return void(void 0===t.copy&&"string"==typeof r.props.text&&r.props.text&&(t.copy=r.props.text));if(r.type===le)return void ce.toArray(r.props.children).forEach(e=>tn(e,t,n));if("string"==typeof r.type){if(Qt.has(r.type))return;if(!Zt.has(r.type))return n.push(" "),ce.toArray(r.props.children).forEach(e=>tn(e,t,n)),void n.push(" ")}const o=ue(r,{key:`title-part-${t.accessories.length}`});t.accessories.push(o),(_t(r.type)?t.badges:t.actions).push(o)}var nn=/* @__PURE__ */new Map,rn=/* @__PURE__ */new Set,on=0;function an(){on++,rn.forEach(e=>e())}function sn(e){return nn.get(e)}function ln(e){return rn.add(e),()=>{rn.delete(e)}}function cn(){return on}var un=_(""),dn=_(null);function hn({spec:e,children:t}){/* @__PURE__ */
|
|
44
|
+
return we(dn.Provider,{value:e,children:t})}var mn=/* @__PURE__ */new Set(["button","input","textarea","select","kbd","svg"]),fn='button[type="submit"], button[data-submit], button.btn-submit, button.bg-green-600, button.bg-blue-600';function pn(e){return wn(e).replace(/\s+/g," ").trim()}function wn(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(wn).join("");if(se(e)){const t=e,n="string"==typeof t.type?t.type:"";return mn.has(n)?"":` ${wn(t.props?.children)} `}return""}function yn(e){const t=Q(un);re(()=>{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 gn={};function vn(e,t,n){const r=Q(un);re(()=>{if(!r)return;gn[r]||(gn[r]=[]);const o={label:e,icon:n,onClick:t};return gn[r].push(o),()=>{gn[r]=(gn[r]||[]).filter(e=>e!==o)}},[r,e,t,n])}function bn({title:e}){const t=ne(null);return re(()=>{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__ */we("span",{ref:t,style:{display:"none"},"aria-hidden":"true"})}function xn(e){}function kn(){return Q(un)}function En({children:e,position:t="right",quiet:n=!1}){const r=Q(L),[o,i]=oe(null);return re(()=>{if(!r)return;const e="left"===t?r.leftRef:r.rightRef,o=()=>!!e.current&&(i(e.current),n||r.notify(),!0);if(o())return;const a=setInterval(()=>{o()&&clearInterval(a)},50),s=setTimeout(()=>clearInterval(a),2e3);return()=>{clearInterval(a),clearTimeout(s)}},[r,t,n]),o?ge(e,o):null}function Mn({onClick:e,children:t,className:n}){const r=Q(L);/* @__PURE__ */
|
|
45
|
+
return we("button",{type:"button",onClick:async()=>{if(r?.isDirty){const{confirm:e}=await(import("./shell/ConfirmDialog.js"));if(!await e({title:"Discard changes?",message:"You have unsaved changes. Are you sure you want to cancel? All changes will be lost.",confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"}))return}e()},className:n||"bg-white text-gray-700 border border-gray-300 px-4 py-2 text-sm font-medium rounded-lg hover:bg-gray-50",children:t||"Cancel"})}var Cn="erp_window_positions",Sn={};try{const e=localStorage.getItem(Cn);e&&(Sn=JSON.parse(e))}catch{}var Ln=null;function Nn(){Ln&&clearTimeout(Ln),Ln=setTimeout(()=>{try{localStorage.setItem(Cn,JSON.stringify(Sn))}catch{}},500)}var zn="erp_activation_order",Tn=[];try{const e=localStorage.getItem(zn),t=e?JSON.parse(e):null;Array.isArray(t)&&t.every(e=>"string"==typeof e)&&(Tn=t)}catch{}var An=null;function Dn(){An&&clearTimeout(An),An=setTimeout(()=>{try{localStorage.setItem(zn,JSON.stringify(Tn))}catch{}},500)}function In(e,t){Sn[e]||(Sn[e]=t,Nn())}function Pn(e){return Sn[e]?{...Sn[e]}:null}function Rn(e,t){Sn[e]=t,Nn()}function On(){const r=e(),o=t();let i=!1;for(const e of Object.keys(Sn))n(Sn[e],r,o)&&(delete Sn[e],i=!0);i&&Nn()}var $n={sm:384,md:512,lg:672,xl:896,"2xl":1152,"3xl":1408},Wn=4e3,Kn=()=>{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"},jn={small:.8,medium:1,large:1.25,maximized:1.25},Fn=/* @__PURE__ */new Set,Bn=0,qn=/* @__PURE__ */new Map;var Hn=0;function Un(){return Hn}function Yn(){Hn++,S.forEach(e=>e())}var Xn=/* @__PURE__ */new Map,Vn=/* @__PURE__ */new Map,Gn=/* @__PURE__ */new Map;function Jn(){for(let e=C.length-1;e>=0;e--){const t=Gn.get(C[e]);if(t?.tab)return t.owner}return null}function _n(){return ie(N,Jn,()=>null)}var Zn=/* @__PURE__ */new Set;var Qn=null;function er(e){Qn=null,cr(e)}function tr(e){Qn=e;const t=Xn.get(e);t&&er(t)}var nr=/* @__PURE__ */new Map;function rr(e){return nr.get(e)?.holdsChanges()??!1}function or(e){const t=nr.get(e);return t?t.ask():Promise.resolve(!0)}function ir(e){Qn===e&&(Qn=null)}function ar(e,t,n){if(n&&Gn.set(e,n),t)if(Xn.set(t,e),Vn.set(e,t),Zn.delete(t)){C.unshift(e);const n=Tn.indexOf(t);-1!==n&&Tn.splice(n,1),Tn.unshift(t),Dn()}else!function(e,t){const n=Tn.indexOf(t);if(-1===n)return void C.push(e);let r=C.length;for(let e=0;e<C.length;e++){const t=Vn.get(C[e]);if(t&&Tn.indexOf(t)>n){r=e;break}}C.splice(r,0,e)}(e,t),-1===Tn.indexOf(t)&&(Tn.push(t),Dn());else C.push(e);Yn(),window.dispatchEvent(new CustomEvent("modal-reorder")),t&&Qn===t&&er(e)}function sr(e){return e?Gn.get(e)?.owner??Vn.get(e)??null:null}var lr=/* @__PURE__ */new Set;function cr(e){const t=sr(z()),n=C.indexOf(e);-1!==n&&C.splice(n,1),C.push(e);const r=Gn.get(e);if(r?.root)for(const[e,t]of Gn){if(t.root||t.owner!==r.owner||Fn.has(e))continue;const n=C.indexOf(e);-1!==n&&C.splice(n,1),C.push(e)}Fn.delete(e);const o=Vn.get(e);if(o){const e=Tn.indexOf(o);-1!==e&&Tn.splice(e,1),Tn.push(o),Dn(),Qn&&Qn!==o&&(Qn=null)}Yn(),window.dispatchEvent(new CustomEvent("modal-reorder"));const i=sr(z());i&&i!==t&&lr.forEach(e=>e(i))}function ur(e){const t=C.indexOf(e);-1!==t&&C.splice(t,1),Fn.add(e),qn.set(e,++Bn);const n=Vn.get(e);if(n){const e=Tn.indexOf(n);-1!==e&&(Tn.splice(e,1),Dn())}Yn(),window.dispatchEvent(new CustomEvent("modal-reorder"))}var dr=/* @__PURE__ */new Set;var hr=8,mr=32;function fr(){return e()}var pr="flex size-6 shrink-0 items-center justify-center rounded-full focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400",wr="flex size-3 items-center justify-center rounded-full text-gray-900/70",yr="size-2 opacity-0 group-hover/controls:opacity-100 group-focus-within/controls:opacity-100",gr=E.windowBar,vr=80,br=384,xr=400;function kr(e,t=fr()){const n=Math.min(Math.max(e.x,t.x+vr-e.w),t.x+t.w-vr),r=Math.min(Math.max(e.y,t.y),t.y+t.h-gr);return n===e.x&&r===e.y?e:{...e,x:n,y:r}}function Er(e){const t=e.getBoundingClientRect();if(0===t.width||0===t.height)return!0;const n=fr();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 Mr(e){const t=fr(),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 Cr=null;function Sr(e){const t=(Cr||((Cr=document.createElement("div")).style.cssText=["position: fixed","pointer-events: none",`z-index: ${H.snapPreview}`,"border-radius: 8px","background: rgba(59, 130, 246, 0.18)","border: 2px solid rgb(59, 130, 246)","transition: left 120ms ease, top 120ms ease, width 120ms ease, height 120ms ease, opacity 120ms ease","opacity: 0","display: none"].join(";"),document.body.appendChild(Cr)),Cr);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 Lr(){Cr&&(Cr.style.opacity="0",Cr.style.display="none")}var Nr=[{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"}],zr=350,Tr=200;function Ar({maximized:e,onToggleMax:t,onSnap:n,buttonClassName:r,strings:o,children:i}){const[a,s]=oe(!1),l=ne(void 0),c=ne(void 0);re(()=>()=>{clearTimeout(l.current),clearTimeout(c.current)},[]);const u=()=>{clearTimeout(c.current),l.current=setTimeout(()=>s(!0),zr)},d=()=>{clearTimeout(l.current),c.current=setTimeout(()=>s(!1),Tr)};/* @__PURE__ */
|
|
46
|
+
return pe("span",{className:"relative inline-flex",onMouseEnter:u,onMouseLeave:d,children:[
|
|
47
|
+
/* @__PURE__ */we("button",{onClick:t,onFocus:u,onBlur:d,"aria-label":e?o.windowed:o.maximize,title:e?o.windowed:o.maximize,className:r,children:i}),a&&/* @__PURE__ */we("div",{role:"group","aria-label":o.snapLayouts,onMouseEnter:()=>clearTimeout(c.current),onMouseLeave:d,className:"absolute left-0 top-full z-30 mt-1 grid w-max grid-cols-2 gap-1 rounded-lg border border-line bg-surface p-2 shadow-lg",children:Nr.map(({zone:e,labelKey:t,region:r})=>/* @__PURE__ */we("button",{type:"button","aria-label":o[t],title:o[t],onClick:()=>{s(!1),n(e)},onFocus:()=>clearTimeout(c.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__ */we("span",{"aria-hidden":"true",className:`absolute rounded-sm bg-blue-500/70 ${r}`,style:{margin:2}})},e))})]})}var Dr="rosh-gesture-style";var Ir={se:"nwse-resize",nw:"nwse-resize",sw:"nesw-resize",ne:"nesw-resize",n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize"},Pr=4;function Rr(e,t,n,r){!function(){if("undefined"==typeof document||document.getElementById(Dr))return;const e=document.createElement("style");e.id=Dr,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=Vt(r);let a=!1;return()=>{if(!a){a=!0,i();try{e.releasePointerCapture(t)}catch{}o.remove(),document.body.classList.remove("rosh-gesturing")}}}function Or(e){const t=C.indexOf(e);if(-1===t)return-1;const n=H.window+t*H.windowStep,r=Gn.get(e);if(!r||r.root)return n;let o=-1;for(const[e,t]of Gn){if(!t.root||t.owner!==r.owner)continue;const n=C.indexOf(e);-1!==n&&(o=Math.max(o,H.window+n*H.windowStep))}return o>=n?o+2+Math.min(t,7):n}"undefined"!=typeof window&&window.addEventListener("deactivate-all-modals",function(){for(let e=C.length-1;e>=0;e--)dr.has(C[e])||C.splice(e,1);Tn=Tn.filter(e=>{const t=Xn.get(e);return null!=t&&dr.has(t)}),Dn(),Yn(),window.dispatchEvent(new CustomEvent("modal-reorder"))});var $r="modal-close-request";function Wr(e){ie(N,Un);const t=Q(L);if(C.length<=1)return!0;if(e){const t=Xn.get(e);if(null!=t)return z()===t}return t?.active??null!=z()}var Kr=!1,jr=/* @__PURE__ */new Set;function Fr(e){return jr.add(e),()=>jr.delete(e)}function Br(){return Kr}function qr(e){Kr!==e&&(Kr=e,jr.forEach(e=>e()))}function Hr(){qr(!Kr)}function Ur(){qr(!1)}var Yr=null,Xr=/* @__PURE__ */new Set;function Vr(e){return Xr.add(e),()=>Xr.delete(e)}function Gr(){return Yr}function Jr(e){Yr!==e&&(Yr=e,Xr.forEach(e=>e()))}var _r=null,Zr=/* @__PURE__ */new Set;function Qr(e){return Zr.add(e),()=>Zr.delete(e)}function eo(){return _r}function to(e){_r!==e&&(_r=e,Zr.forEach(e=>e()))}function no(){if(!_r)return void qr(!1);Jr(_r),to(null),qr(!1)}function ro(){qr(!Kr),window.dispatchEvent(new CustomEvent("modal-split-view"))}function oo(){const e=ie(Fr,Br),[t,n]=oe(e),[r,o]=oe(e);return re(()=>{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?ge(
|
|
48
|
+
/* @__PURE__ */we("div",{onMouseDown:e=>{e.stopPropagation(),qr(!1)},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",zIndex:H.expose,cursor:"pointer",opacity:r?1:0,transition:"opacity 260ms cubic-bezier(0.2, 0.8, 0.2, 1)",pointerEvents:r?"auto":"none"}}),document.body):null}function io({open:t,onClose:l,title:c,icon:u,copyText:m,size:f="lg",dirty:p=!1,onNext:w,onPrev:v,footer:k,bodyScroll:M,onMinimize:S,initialBox:A,actions:R,actionsLeft:O,editing:j=!1,edit:q,allowPinOnTop:U,initialPosition:Y,widget:V,compact:_,appStyle:Z,flushBody:ee,autoHeight:se,autoMinHeight:le,autoWidth:ce,widgetMenu:ue,dimensions:me,windowKey:fe,openedFromKey:ve,accentRgb:be,children:xe}){const[ke,Ee]=oe(()=>r()),Me=D()&&!ke,Ce=I()&&!!V,[Se,Le]=oe(0),[Ne,ze]=oe(!1),Te=ne(null),Ae=ne(0);re(()=>{Ae.current=Se},[Se]);const Ie=ae(e=>{Me&&(Te.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},ze(!0),Ft(ve??null))},[Me,ve]),Pe=ie(Bt,jt);re(()=>{if(!Ne)return;const e=e=>{if(!Te.current)return;const t=e.clientX-Te.current.startX;if(Math.abs(e.clientY-Te.current.startY)>Math.abs(t)+12)return Te.current=null,ze(!1),Le(0),void Ft(null);Le(Math.max(0,t))},t=()=>{if(!Te.current)return;const e=.3*window.innerWidth,t=Ae.current>e;Te.current=null,ze(!1),t?(Le(window.innerWidth),setTimeout(()=>{l(),Le(0),Ft(null)},180)):(Le(0),Ft(null))};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t),window.addEventListener("pointercancel",t),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t),window.removeEventListener("pointercancel",t)}},[Ne]);const[Re,Oe]=oe(c),$e=J(),We=$e.window;re(()=>{Oe(c)},[c]);const Ke=de(()=>pn(Re).trim()||void 0,[Re]),je=he(),[Fe,He]=oe(!1),Ye=ne(!1),[Xe,Ve]=oe(!1),[Ge,Je]=oe(null),_e=Q(dn),Ze=Q(De),{prefs:Qe,save:et}=P(),tt=!!Qe.window_accent_stripe,nt=Qe.favorite_documents||[],rt=!!_e&&nt.some(e=>e.entityType===_e.entityType&&e.entityId===_e.entityId),ot=ae(()=>{if(!_e)return;const e=rt?nt.filter(e=>!(e.entityType===_e.entityType&&e.entityId===_e.entityId)):[...nt,{entityType:_e.entityType,entityId:_e.entityId,label:_e.label}];et({favorite_documents:e})},[_e,rt,nt,et]),[it,at]=oe(null),[st,lt]=oe("top-right"===Y?"right":"left"),ut=ne(!1),ht=ne(null);te(()=>{const e=ht.current;e&&(be?e.style.setProperty("--window-accent-rgb",be):e.style.removeProperty("--window-accent-rgb"))},[be]);const mt=ne(!1),ft=ne(null),pt=ne(null),wt=ne(null),[yt,gt]=oe(!1),vt=ne(null),bt=ne(null),xt=ne(null),[kt,Et]=oe(!1);te(()=>{const e=bt.current,t=xt.current;if(!e||!t)return;const n=()=>Et(function(e,t){return e.scrollWidth>t.clientWidth}(t,e));if(n(),"undefined"==typeof ResizeObserver)return;const r=new ResizeObserver(n);return r.observe(e),r.observe(t),()=>r.disconnect()},[null!=k&&!1!==k]);const Mt=!!q&&!V&&!_&&!Z&&(q.editing||"hidden"!==q.state),Ct=!!(k||R||O)||yt||Mt,St=Q(qe),Lt=""!==Q(un),Nt=ne(null);Nt.current=Ze?{owner:Ze.key,tab:Ze.tab,root:!Lt}:null;const zt=fe||(Ze&&!Lt?Ze.key:null),Tt=!!St&&!Lt&&St.enabled&&St.hasState&&(j||St.declaredEditable)&&!St.handMounted&&Ct&&!V&&!_&&!Z&&!Me,At=40,{minimize:Dt,items:It,restoreIfMinimized:Pt,openWindows:Rt}=dt(),Ot=ne(`modal-${Math.random().toString(36).slice(2,8)}`).current,Wt=g(Ot);re(()=>{if(V)return dr.add(Ot),()=>{dr.delete(Ot)}},[V,Ot]),re(()=>{const e=e=>{const t=e.detail;t?.id===Ot&&Oe(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[Ot]);const[Kt,qt]=oe(H.window),Ht=function(e){const t=ie(N,z);return C.length<=1||t===e}(Ot),Ut=ne(q);Ut.current=q;const Yt=!!q&&!q.editing&&"enabled"===q.state;re(()=>{if(!t||!Ht||!Yt)return;const e=e=>{("KeyE"===e.code||"E"===e.key||"e"===e.key)&&e.altKey&&e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(b(e.target,ht.current)||(e.preventDefault(),e.stopPropagation(),Ut.current?.onEdit()))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Ht,Yt]);const Xt=function(e){return ie(N,()=>Fn.has(e))}(Ot);$t({panelRef:ht,bodyRef:ft,open:t,widget:!!V,active:Ht,minimized:Xt});const Vt=ie(Fr,Br),Gt=ie(Vr,Gr),Jt=ie(Qr,eo),_t=!U&&!V,Zt=Vt&&_t,[Qt,tn]=oe(!1),rn=Zt&&Jt===Ot,[on,sn]=oe(!1),ln=on&&_t&&Gt===Ot?"picked":null,cn=ne(Zt);re(()=>{if(cn.current&&!Zt){sn(!0);const e=setTimeout(()=>{sn(!1),Yr===Ot&&Jr(null)},700);return cn.current=Zt,()=>clearTimeout(e)}cn.current=Zt},[Zt,Ot]),re(()=>{Zt||tn(!1)},[Zt]),re(()=>{const e=pt.current,t=wt.current;if(!e&&!t)return;const n=e=>e?Array.from(e.children).filter(e=>"shell"!==e.dataset.undoControls).length:0,r=()=>gt(n(e)+n(t)>0);r();const o=new MutationObserver(r);return e&&o.observe(e,{childList:!0}),t&&o.observe(t,{childList:!0}),()=>o.disconnect()},[t]),re(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&ht.current){const t=ht.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=pt.current,n=wt.current;return t&&t.addEventListener("click",e),n&&n.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e),n&&n.removeEventListener("click",e)}},[t]);const hn=ne(!1),mn=ae(e,[]),wn=ae(()=>{const t=e(),n=me?me[0]:$n[f]||672,o=t.w-80,i=t.h-80,a=Math.min(n,o),s=jn[Kn()],l=me?Math.min(me[1],i):(()=>{const e=("sm"===f?500:"md"===f?600:"lg"===f?700:"xl"===f?800:920)*s;return Math.max(320,Math.min(e,t.h-80))})(),c="cascade"!==(getComputedStyle(document.documentElement).getPropertyValue("--window-position")?.trim()||"cascade")||r()?0:30*(C.length-1),u=Math.max(At,(i-l)/2),d=(o-a)/2,h=t.h-At-l-u;return"top-right"===Y?{x:t.x+t.w-a-At,y:t.y+At,w:a,h:l}:"top-left"===Y?{x:t.x+At,y:t.y+At,w:a,h:l}:{x:t.x+Math.max(At,(o-a)/2+At)+Math.min(c,Math.max(0,d)),y:t.y+u+Math.min(c,Math.max(0,h)),w:a,h:l}},[f]),yn=ne(!1);t||(yn.current=!1);const vn=fe||m||null;re(()=>{if(!t)return;ar(Ot,vn,Nt.current??void 0),fe||cr(Ot),hn.current=!1,qt(Or(Ot));const e=()=>{qt(Or(Ot))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===fe;if(!e.label)return!1;const t=ht.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if(cr(Ot),An.current)return;const t=fr(),n=Math.min(Bn.current.w,t.w-40),o=Math.min(Bn.current.h,t.h-40),i=t.x+(t.w-n)/2,a=t.y+(t.h-o)/2;kn({x:i,y:a,w:n,h:o}),On(!1)},i=e=>{const t=e.detail;r(t)&&(cr(Ot),Je({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==fe)return;cr(Ot);const t=Bn.current,n=function(e,t=fr()){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=ht.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)}kn(n)};return window.addEventListener("modal-reorder",e),window.addEventListener("modal-split-view",n),window.addEventListener("modal-center",o),window.addEventListener("modal-reveal",a),window.addEventListener("modal-context-menu",i),()=>{!function(e){const t=C.indexOf(e);-1!==t&&(C.splice(t,1),Yn()),Fn.delete(e),qn.delete(e),Gn.delete(e);const n=Vn.get(e);n&&(Vn.delete(e),Xn.delete(n))}(Ot),window.removeEventListener("modal-reorder",e),window.removeEventListener("modal-split-view",n),window.removeEventListener("modal-center",o),window.removeEventListener("modal-reveal",a),window.removeEventListener("modal-context-menu",i),window.dispatchEvent(new CustomEvent("modal-reorder"))}},[t,Ot,vn,mn]);const bn=!V&&"maximized"===Kn(),[xn,kn]=oe(()=>{if(vn&&Sn[vn]){const e={...Sn[vn]};return me&&(e.w=me[0],se||(e.h=me[1])),kr(e)}return A?{x:A.x,y:A.y,w:A.w,h:A.h}:bn?mn():wn()}),[En,Mn]=oe(()=>!se),Cn=ne(ke),Ln=ne(null);re(()=>{const e=()=>{const e=r();e!==Cn.current&&Ln.current?.(e),Cn.current=e,Ee(e),qt(Or(Ot))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[Ot]);const zn=ke&&!!Ze?.tab&&!Lt&&!V&&!Me,Tn=zn,An=ne(Tn);An.current=Tn;const Dn=_n(),In=ke&&!!Ze?.tab&&!V&&!Me&&!Vt&&Dn!==Ze.key,Pn=!!V&&ke&&!Vt&&null!==Dn,[Rn,On]=oe(()=>vn&&Sn[vn]||A?Tn:Tn||bn),Bn=ne(xn);Bn.current=xn;const Hn=ne(Rn);te(()=>{Hn.current=Rn},[Rn]),te(()=>{if(En||zn)return;const e=ht.current,t=ft.current;if(!e||!t)return;const n=le??(V?0:240),r=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0;let o=0,i=null,a=null;const s=()=>{const c=t.firstElementChild;if(!c||e.offsetHeight<=0)return;c!==a&&(a&&l.unobserve(a),l.observe(c),a=c);const u=e.offsetHeight-t.offsetHeight,d=t.style.flex,h=t.style.overflowY,m=t.style.height;t.style.flex="0 0 auto",t.style.height="auto",t.style.overflowY="visible";const f=t.offsetHeight,p=c.offsetHeight;t.style.flex=d,t.style.height=m,t.style.overflowY=h;const w=c.offsetHeight>p+4,y=Math.max(n,window.innerHeight-r-Math.max(0,Bn.current.y)-24),g=w?Math.min(Bn.current.h,y):Math.min(Math.max(n,u+f),y),v=Math.abs(g-o)>1;v&&(o=g,kn(e=>Math.abs(e.h-g)>1?{...e,h:g}:e)),V||(g<=n?i&&(clearTimeout(i),i=null):(v||null===i)&&(i&&clearTimeout(i),i=setTimeout(()=>{const e=o;s(),o===e&&Mn(!0)},160)))},l=new ResizeObserver(s);s(),vt.current&&l.observe(vt.current);const c=new MutationObserver(s);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{l.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[En,V,le,Ct,zn]),te(()=>{if(!se||!En||V||!t)return;const e=vt.current;if(!e)return;let n=e.offsetHeight;const r=new ResizeObserver(()=>{if(!e.isConnected)return;const t=so.current?0:e.offsetHeight,r=t-n,o=t>0!=n>0;if(n=t,!o||0===r||Rn)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=le??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,s=Math.max(i,window.innerHeight-a-Math.max(0,Bn.current.y)-24);kn(e=>({...e,h:Math.min(Math.max(i,e.h+r),s)}))});return r.observe(e),()=>r.disconnect()},[se,En,V,t,Rn,le]);const Un=!1!==ce&&!V&&!Z&&!Me,[Jn,Zn]=oe(()=>!Un);te(()=>{if(Jn||!t)return;if(!Un||Rn)return void Zn(!0);const n=ht.current,r=ft.current;if(!n||!r)return;const o=/* @__PURE__ */new WeakSet;let l=Bn.current.w,c=0;const u=()=>Zn(!0),d=()=>{c=0;const t=Bn.current;if(Math.abs(t.w-l)>1||document.body.classList.contains("rosh-gesturing"))return void u();const d=e(),h=d.w-80;if(t.w>=h)return void u();const m=[],f=[];for(const e of[r,...Array.from(r.querySelectorAll("*"))]){const t=e.scrollWidth-e.clientWidth;if(t<=4||o.has(e))continue;const n=getComputedStyle(e).overflowX;"auto"!==n&&"scroll"!==n||(m.push(e),f.push(t))}if(!m.length)return;const p=Math.min(h,t.w+Math.max(...f)),w=p-t.w,y=n.style.width;n.style.width=`${p}px`;const g=m.map((e,t)=>({over:f[t],residual:e.scrollWidth-e.clientWidth}));n.style.width=y,g.forEach((e,t)=>{i(e,w)||o.add(m[t])});const v=a(t,s(t.w,w,g),d,At);v!==t&&(l=v.w,kn(v))};d();const h=new MutationObserver(()=>{c||(c=requestAnimationFrame(d))});h.observe(r,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["style","class","hidden"]});const m=setTimeout(u,Wn);return()=>{h.disconnect(),c&&cancelAnimationFrame(c),clearTimeout(m)}},[Jn,t,Un,Rn]);const Qn=ne(null),er=!(!Ze?.tab||Lt||V||Me);Ln.current=t=>{if(!er)return;if(t)return Qn.current||(Qn.current={box:{...Bn.current},maximized:Hn.current}),void(Hn.current=!0);const r=Qn.current;Qn.current=null;const o=e();if(r?.maximized)return Hn.current=!0,On(!0),void kn(o);const i=r?.box??(vn?Sn[vn]:void 0);if(Hn.current=!1,On(!1),i&&!n(i,o,!1)){const e={...i};me&&(e.w=me[0],se||(e.h=me[1])),kn(kr(e))}else kn(wn())},re(()=>{Tn&&(Hn.current=!0,On(!0),kn(mn()))},[Tn,mn]),re(()=>{if(V)return;const e=()=>{const e=vn?Sn[vn]:void 0;if(Hn.current=!1,On(!1),e){const t={...e};me&&(t.w=me[0],se||(t.h=me[1])),kn(kr(t))}else kn(wn())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[V,wn,vn]),re(()=>{t&&vn&&!zn&&(Sn[vn]=xn,Nn()),t&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[xn,t,vn,zn]),re(()=>{if(!t)return;const e=()=>{Hn.current?kn(mn()):document.body.classList.contains("rosh-gesturing")||kn(kr)};window.addEventListener("resize",e),window.addEventListener(o,e);let n=null;return Rn&&(n=new MutationObserver(e),n.observe(document.body,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["class"]})),()=>{window.removeEventListener("resize",e),window.removeEventListener(o,e),n?.disconnect()}},[t,Rn,mn]),re(()=>{if(t&&(He(!1),Ye.current=!1,ut.current=!1,Zn(!Un),!An.current)){if(vn&&Sn[vn]){const e=Sn[vn];return void kn(t=>kr({...e,...se?{h:t.h}:{},...Un?{x:t.x,w:t.w}:{}}))}A&&(kn({x:A.x,y:A.y,w:A.w,h:A.h}),On(A.maximized))}},[t]),re(()=>{if(!t||"auto"!==p)return;let e;const n=t=>{ht.current?.contains(t.target)&&!Ye.current&&(Ye.current=!0,e=setTimeout(()=>He(!0),0))};return document.addEventListener("input",n,!0),document.addEventListener("change",n,!0),()=>{clearTimeout(e),document.removeEventListener("input",n,!0),document.removeEventListener("change",n,!0)}},[t,p]);const tr="auto"===p?Fe:!0===p,rr=Ze&&!Lt?Ze.key:null,or=de(()=>en(Re),[Re]),ir=ne({shortcutSpec:_e,isOnDesktop:rt,toggleDesktopShortcut:ot,taskbarStrings:$e.taskbar});te(()=>{ir.current={shortcutSpec:_e,isOnDesktop:rt,toggleDesktopShortcut:ot,taskbarStrings:$e.taskbar}});const sr=ne(null);sr.current||(sr.current={open:(e,t)=>Je({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 gn[Ot]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),re(()=>{if(t&&rr)return()=>{return e=rr,void(nn.delete(e)&&an());var e}},[t,rr]),ct(!(fe||!t)&&tr);const lr=ae(()=>tr||"auto"===p&&Ye.current,[tr,p]),gr=ae(async e=>{if(ut.current)return!1;if(!lr())return!0;ut.current=!0;const t=Ke,n="close"===e?"Are you sure you want to close?":"discard"===e?"Are you sure you want to stop editing?":"Are you sure you want to continue?",r=await y({title:"Discard changes?",message:t?`“${t}” has unsaved changes. ${n} All changes will be lost.`:`You have unsaved changes. ${n} All changes will be lost.`,confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"});return ut.current=!1,r},[lr,Ke]),vr=ae(()=>ut.current?Promise.resolve():lr()?gr("close").then(e=>{e&&l()}):(l(),Promise.resolve()),[lr,gr,l]),Er=ae(async()=>{await gr("discard")&&(Ye.current=!1,He(!1),Ut.current?.onDiscard())},[gr]),Cr=ae(async()=>{const e=await gr("switch");return e&&(Ye.current=!1,He(!1)),e},[gr]),Nr=ne(()=>!1);te(()=>{Nr.current=lr}),te(()=>{if(!t||!fe)return;const e={holdsChanges:()=>Nr.current(),ask:Cr};return nr.set(fe,e),()=>{nr.get(fe)===e&&nr.delete(fe)}},[t,fe,Cr]),te(()=>{if(!t||!zt)return;const e=e=>{e.detail?.windowKey===zt&&vr()};return window.addEventListener($r,e),()=>window.removeEventListener($r,e)},[t,zt,vr]);const zr=ne(null),Tr=ae(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(Je(null),cr(Ot),An.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=ht.current,s=a?.getBoundingClientRect();let l,c,u,d;if(zr.current){const t=zr.current;zr.current=null,d=t.w,u=t.h;const n=s?Math.min(Math.max(20,e.clientX-s.left),t.w-20):t.w/2;l=e.clientX-n,c=e.clientY-12,a&&(a.style.width=`${d}px`,a.style.height=`${u}px`,a.style.left=`${l}px`,a.style.top=`${c}px`)}else l=s?s.left:Bn.current.x,c=s?s.top:Bn.current.y,u=s?s.height:Bn.current.h,d=s?s.width:Bn.current.w;On(!1),kn(e=>({...e,x:l,y:c,w:d,h:u}));let h=null;const m=e=>{if(!r){if(Math.abs(e.clientX-o)<Pr&&Math.abs(e.clientY-i)<Pr)return;r=Rr(t,n,"move","move"),a&&(a.style.transition="none")}const s=l+e.clientX-o,u=Math.max(0,c+e.clientY-i);if(a&&(a.style.transform=`translate(${s-l}px, ${u-c}px)`),Bn.current={...Bn.current,x:s,y:u},!V){const t=function(e,t){const n=fr(),r=e<=n.x+hr,o=e>=n.x+n.w-hr,i=t<=n.y+hr,a=t>=n.y+n.h-hr,s=e<=n.x+mr,l=e>=n.x+n.w-mr,c=t<=n.y+mr,u=t>=n.y+n.h-mr;return i&&s?"tl":i&&l?"tr":a&&s?"bl":a&&l?"br":c&&r?"tl":c&&o?"tr":u&&r?"bl":u&&o?"br":i?"top":r?"left":o?"right":null}(e.clientX,e.clientY);t!==h&&(h=t,t?Sr(Mr(t)):Lr())}},f=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",f),r?.(),Lr();const e=kr({...Bn.current});if(Bn.current=e,!V&&h){zr.current={x:l,y:c,w:d,h:u};const e=Mr(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 kn(e)}if(V){const t=e.x+e.w/2,n=window.innerWidth/2;lt(t>n?"right":"left")}a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.transform="",a.style.transition=""),kn(e)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",f)},[]),Dr=ae((e,t)=>{if(0!==e.button)return;e.preventDefault(),e.stopPropagation();const n=e.currentTarget,r=e.pointerId;let o=null;const i=e.clientX,a=e.clientY,s=ht.current,l=s?.getBoundingClientRect(),c=l?l.left:Bn.current.x,u=l?l.top:Bn.current.y,d=l?l.width:Bn.current.w,h=l?l.height:Bn.current.h,m="sw"===t||"nw"===t||"w"===t,f="ne"===t||"nw"===t||"n"===t,p="se"===t||"ne"===t||"e"===t,w="se"===t||"sw"===t||"s"===t;On(!1),kn({x:c,y:u,w:d,h:h}),Bn.current={x:c,y:u,w:d,h:h};let y=0,g=null;const v=()=>{if(y=0,!g)return;const e=g;g=null,Bn.current=e,s&&(s.style.left=`${e.x}px`,s.style.top=`${e.y}px`,s.style.width=`${e.w}px`,s.style.height=`${e.h}px`)},b=e=>{if(!o){if(Math.abs(e.clientX-i)<Pr&&Math.abs(e.clientY-a)<Pr)return;o=Rr(n,r,Ir[t],"resize")}g=((e,t)=>{let n=c,r=u,o=d,i=h;if(p&&(o=Math.max(br,d+e)),w&&(i=Math.max(xr,h+t)),m){const t=Math.max(br,d-e);n=c+d-t,o=t}if(f){const e=Math.max(xr,h-t);r=u+h-e,i=e}return{x:n,y:r,w:o,h:i}})(e.clientX-i,e.clientY-a),y||(y=requestAnimationFrame(v))},x=()=>{window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",x),y&&cancelAnimationFrame(y),v(),o?.(),kn({...Bn.current})};window.addEventListener("pointermove",b),window.addEventListener("pointerup",x)},[]),Wr=ae(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(),cr(Ot),"Enter"===e.key)return void(Rn?(On(!1),kn(wn())):(On(!0),kn(mn())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{zr.current||(zr.current={...Bn.current})};if(r<0)return e(),On(!0),void kn(mn());if(r>0){if(Rn)return On(!1),void kn(wn());if(zr.current){const e=kr(zr.current);return zr.current=null,Bn.current=e,void kn(e)}return void ur(Ot)}e(),On(!1);const t=Mr(n<0?"left":"right");return Bn.current=t,void kn(t)}if(Rn)return;const o=Bn.current,i=e.shiftKey?{...o,w:Math.max(br,o.w+24*n),h:Math.max(xr,o.h+24*r)}:kr({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});Bn.current=i,kn(i)},[Ot,Rn,wn,mn]),Kr=ae(e=>{zr.current||(zr.current={...Bn.current}),On(!1);const t=Mr(e);Bn.current=t,kn(t),cr(Ot)},[Ot]),jr=!V&&!zn&&!Me,[Hr,Ur]=oe(0),Xr=jr&&!_&&!Z&&(!!R||!!O||yt||Mt||Tt),_r=jr&&Hr>0&&!Xr,Zr=ne(_r);Zr.current=_r;const to=!!_||!!Z,no=to?"h-(--row-height-compact-bar)":"h-(--row-height-window-bar)",ro=ae(e=>{const t=e.closest("[data-window-body]");if(!t)return null;const n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return Math.abs(n.left-r.left)>2||Math.abs(n.top-r.top)>2?null:(Ur(e=>e+1),()=>Ur(e=>Math.max(0,e-1)))},[]),oo=de(()=>jr?{compact:to,over:_r,claim:ro}:null,[jr,to,_r,ro]),[io,ao]=oe(0),so=ne(jr);so.current=jr,te(()=>{const e=vt.current;if(!e||!Xr)return void ao(0);const t=()=>ao(Math.ceil(e.offsetWidth));if(t(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[Xr]);const lo=ae(e=>{if(Zt)return;e.preventDefault(),e.stopPropagation();const t=0===e.clientX&&0===e.clientY,n=e.currentTarget.getBoundingClientRect();Je(t?{x:n.left,y:n.bottom+4}:{x:e.clientX,y:e.clientY})},[Zt]),co=!!be&&tt&&!V&&!Me,uo=Tn||Zt?{}:{tabIndex:0,role:"group","aria-label":Ke?`${Ke} — ${We.windowSuffix}`:We.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:Wr},ho=()=>{On(!0),kn(mn())},mo=ae(()=>{const e=ht.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(fn);t&&!t.disabled&&t.click()}},[]);re(()=>{if(!t)return;if(V)return;const e=e=>{if(C[C.length-1]===Ot&&!b(e.target,ht.current)&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),mo();else{if("INPUT"===t.tagName&&t.closest("form"))return;if(!(t instanceof Element&&ht.current?.contains(t)))return;if(t.closest(T))return;e.preventDefault()}}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,mo,Ot,V]),re(()=>{if(!t)return;const e=e=>{C[C.length-1]===Ot&&(b(e.target,ht.current)||((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:Ot}})),Ye.current=!1,He(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:Ot}})))))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]),re(()=>{if(!t)return;if(V)return;const e=e=>{if("Escape"===e.key&&C[C.length-1]===Ot){if(G(e))return e.preventDefault(),void e.stopPropagation();if(zn&&!j)return;e.preventDefault(),e.stopPropagation(),vr()}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,vr,Ot,V,zn,j]);const fo=t&&(void 0!==w||void 0!==v),[po]=oe(()=>{if("undefined"==typeof document)return null;const e=document.createElement("span");return e.className="flex shrink-0 items-center gap-2",e.setAttribute("data-tab-actions",""),e}),wo=zn&&!Ze?.home&&or.actions.length>0;re(()=>{t&&rr&&function(e,t){const n=nn.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.actions===t.actions&&n.menu===t.menu||(nn.set(e,t),an())}(rr,{title:or.text||Ke,dirty:tr,copy:or.copy,actions:wo&&po?po:void 0,menu:sr.current??void 0})},[t,rr,Ke,tr,or.text,or.copy,wo,po]);const yo=ae(e=>{const t=document.getElementById("nav-boundary-toast");t&&t.remove();const n="bottom"===e?["That's the last one, chief.","You've hit rock bottom... of the list.","End of the line, buddy.","Nothing left. Go outside.","Congratulations, you scrolled to the void.","There's no more. I checked.","You've reached the edge of the known universe.","Plot twist: there is no next one.","Even scrolling has limits. Unlike your ambition.","Last one. Time to touch grass."]:["Already at the top. Overachiever.","There is no item above this. Trust me.","You're #1. Literally.","Can't go higher. You've peaked.","This is it. The summit. The top.","First item. No VIP lounge above this.","Going up? Nope. Elevator's broken.","You want negative indexes? Bold.","Top of the list. Top of the world.","The only way is down from here."],r=n[Math.floor(Math.random()*n.length)],o=document.createElement("div");o.id="nav-boundary-toast",o.className="fixed bottom-6 left-1/2 -translate-x-1/2 z-(--z-toast) bg-gray-900 text-on-accent flex min-h-10 items-center px-5 py-3 rounded-lg shadow-lg text-sm font-medium transition-opacity duration-300",o.textContent=r,document.body.appendChild(o),setTimeout(()=>{o.style.opacity="0",setTimeout(()=>o.remove(),300)},2e3)},[]);if(re(()=>{if(!t)return;const e=e=>{if(C[C.length-1]!==Ot)return;if(b(e.target,ht.current))return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&fo&&(e.preventDefault(),w?w():yo("bottom")),"k"===e.key&&fo&&(e.preventDefault(),v?v():yo("top"))))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,w,v,fo,yo,Ot]),!t||yn.current)return null;const go=Zt?function(e){if("undefined"==typeof document)return null;const t=Array.from(document.querySelectorAll("[data-modal-panel]")).filter(e=>{const t=e;return!t.hasAttribute("data-utility")&&!t.hasAttribute("data-widget")&&"none"!==t.style.display});t.sort((e,t)=>(e.getAttribute("data-modal-id")||"").localeCompare(t.getAttribute("data-modal-id")||""));const n=t.findIndex(t=>t.getAttribute("data-modal-id")===e),r=t.length;if(n<0||r<1)return null;const o=Math.ceil(Math.sqrt(r)),i=Math.ceil(r/o),a=Math.floor(n/o),s=n%o,l=r-o*(i-1),c=a===i-1&&l<o,u=fr(),d=(u.w-20*(o+1))/o,h=(u.h-14*(i+1)-22*i)/i,m=c?(o-l)*(d+20)/2:0;return{x:u.x+20+s*(d+20)+m,y:u.y+14+a*(h+14+22),w:d,h:h}}(Ot):null,vo=Zt&&go?X({width:go.w,height:go.h},{width:xn.w,height:xn.h}):1,bo=(()=>{if(Zt&&go){const e=vo,t=xn.w*e,n=xn.h*e,r=go.x+(go.w-t)/2-xn.x,o=go.y+(go.h-n)/2-xn.y,i=Qt||rn;return{transform:`translate(${r}px, ${o}px) scale(${e})`,transformOrigin:"top left",transition:"transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 280ms",cursor:"pointer",zIndex:H.expose+(i?20:10),boxShadow:i?"0 24px 72px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.55), 0 0 36px 12px rgba(96,165,250,0.85), 0 0 96px 28px rgba(96,165,250,0.55)":"0 16px 48px rgba(0,0,0,0.55)",pointerEvents:"auto"}}if(on&&_t){const e="picked"===ln;return{transition:e?"transform 640ms cubic-bezier(0.34, 1.42, 0.64, 1), box-shadow 600ms":"transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 600ms",...e?{zIndex:H.expose+30}:{}}}return null})(),xo=x({modal:!1,titleId:!V&&(zn?!Ze?.home:!Me)?je:void 0,label:or.text||Ke}),ko=/* @__PURE__ */pe("div",{children:[
|
|
49
|
+
/* @__PURE__ */pe("div",{ref:ht,"data-modal-panel":!0,"data-modal-id":Ot,"data-window-key":fe||void 0,...U?{"data-utility":""}:{},...Xe?{"data-pinned-top":""}:{},...V?{"data-widget":""}:{},...Ze?{"data-window-owner":Ze.key}:{},...Ze&&!Lt?{"data-window-root":""}:{},...zn?{"data-window-tab":""}:{},...xo,className:zn?"fixed flex flex-col overflow-hidden":"fixed rounded-(--radius-window) flex flex-col overflow-hidden "+(V?Ht?"shadow-xl":"shadow-lg":"border "+(Ht?"shadow-xl border-line":"shadow-lg border-line-strong")),onPointerDown:e=>{if(!Zr.current||Zt||0!==e.button)return;const t=e.target;if(t.closest("[data-modal-panel]")!==ht.current)return;if(t.closest("[data-window-chrome]"))return;const n=e.currentTarget.getBoundingClientRect(),r=n.height/(e.currentTarget.offsetHeight||n.height),o=(to?E.compactBar:E.windowBar)*r;e.clientY-n.top>o||t.closest(h)||Tr(e)},onContextMenu:e=>{const t=e.target;t.closest("[data-window-strip]")&&t.closest("[data-modal-panel]")===ht.current&&lo(e)},onMouseDownCapture:e=>{if(mt.current=!1,Zt){if(e.target.closest("[data-expose-close]"))return;return e.preventDefault(),e.stopPropagation(),Jr(Ot),qr(!1),void cr(Ot)}if(!Ht&&!V&&!Xe&&0===e.button){const t=e.target;t.closest("[data-modal-panel]")===ht.current&&t.closest("button, input, a, select, textarea")&&!t.closest("[data-window-chrome]")&&(e.preventDefault(),e.stopPropagation(),mt.current=!0,Je(null),cr(Ot),window.addEventListener("mouseup",()=>{setTimeout(()=>{mt.current=!1},0)},{once:!0}))}},onClickCapture:e=>{mt.current&&(mt.current=!1,e.preventDefault(),e.stopPropagation())},onMouseDown:e=>{if(Zt)return;Je(null);e.target.closest("[data-modal-panel]")===ht.current&&(e.target.closest("button, input, a, select, textarea")||cr(Ot))},style:Me?{zIndex:Kt+1,top:0,left:0,right:0,bottom:"var(--mobile-bottom-nav, 56px)",width:"auto",height:"auto",transform:`translateX(${Se}px)`,transition:Ne?"none":"transform 180ms ease-out",...V?{display:"none"}:{},...Kt<0?{display:"none"}:{},...Ht||Xe||Pe&&fe===Pe?{}:{display:"none"},...Wt?{visibility:"hidden",pointerEvents:"none"}:{}}:{zIndex:Xe?H.pinnedWindow:Kt+1,width:xn.w,height:xn.h,top:xn.y,...V&&"right"===st?{right:window.innerWidth-xn.x-xn.w}:{left:xn.x},...Kt<0&&!Xe?{display:"none"}:{},...Ce?{display:"none"}:{},...In||Pn||Wt?{visibility:"hidden",pointerEvents:"none"}:{},...bo??{}},children:[Me&&!V&&/* @__PURE__ */we("div",{onPointerDown:Ie,className:"absolute top-0 bottom-0 left-0 w-[22px] z-[5]",style:{touchAction:"pan-y"},"aria-hidden":"true"}),
|
|
50
|
+
/* @__PURE__ */pe("div",{"data-window-surface":"",className:"flex min-h-0 flex-1 flex-col "+(jr?"backdrop-blur-sm":""),style:jr?{backgroundColor:Ht?"rgb(var(--window-content-rgb) / var(--active-content-opacity, 0.9))":"rgb(var(--window-content-rgb) / var(--inactive-content-opacity, 0.8))"}:void 0,children:[V?null:zn?Ze?.home?null:/* @__PURE__ */pe(ye,{children:[
|
|
51
|
+
/* @__PURE__ */we("h2",{id:je,"data-window-title":!0,className:"sr-only",children:or.text||Ke}),wo&&po&&ge(
|
|
52
|
+
/* @__PURE__ */we(ye,{children:or.actions}),po),or.badges.length>0&&/* @__PURE__ */we("div",{"data-window-chrome":"","data-record-bar":"",className:"flex h-9 shrink-0 select-none items-center gap-2 overflow-hidden border-b border-gray-200 px-4",style:{backgroundColor:"rgb(var(--window-content-rgb))"},children:or.badges})]}):Me?null:
|
|
53
|
+
/* @__PURE__ */pe("div",{onPointerDown:Tr,onContextMenu:lo,"data-window-chrome":"",..._r?{"data-window-controls-over":""}:{},...uo,className:_r?`absolute left-0 z-10 flex ${no} items-center px-3 select-none focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400`:`flex items-center gap-3 ${no} px-3 shrink-0 cursor-move select-none focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400`,style:{touchAction:"none",..._r?{top:co?3:0}:{paddingRight:Xr?io:void 0}},children:[!Zt&&/* @__PURE__ */pe("div",{"data-window-controls":"",className:"group/controls flex shrink-0 items-center",children:[
|
|
54
|
+
/* @__PURE__ */we("button",{type:"button",onClick:vr,"aria-label":We.close,title:We.close,className:pr,children:/* @__PURE__ */we("span",{"aria-hidden":"true",className:`${wr} ${Ht?"bg-red-500":"bg-gray-300 group-hover/controls:bg-red-500"}`,children:/* @__PURE__ */we(B,{name:"close",className:yr,strokeWidth:3})})}),!_&&/* @__PURE__ */we("button",{type:"button",onClick:()=>ur(Ot),"aria-label":We.minimize,title:We.minimize,className:pr,children:/* @__PURE__ */we("span",{"aria-hidden":"true",className:`${wr} ${Ht?"bg-amber-400":"bg-gray-300 group-hover/controls:bg-amber-400"}`,children:/* @__PURE__ */we("span",{className:"h-0.5 w-2 rounded-full bg-current opacity-0 group-hover/controls:opacity-100 group-focus-within/controls:opacity-100"})})}),!_&&/* @__PURE__ */we(Ar,{maximized:Rn,onToggleMax:()=>{Rn?(On(!1),kn(wn())):ho()},onSnap:Kr,buttonClassName:pr,strings:We,children:/* @__PURE__ */we("span",{"aria-hidden":"true",className:`${wr} ${Ht?"bg-green-500":"bg-gray-300 group-hover/controls:bg-green-500"}`,children:/* @__PURE__ */we(B,{name:Rn?"collapse":"expand",className:yr,strokeWidth:3})})}),U&&/* @__PURE__ */we("button",{type:"button",onClick:()=>Ve(e=>!e),"aria-label":Xe?We.unpin:We.pinOnTop,title:Xe?We.unpin:We.pinOnTop,className:"ml-1 p-0.5 rounded hover:bg-gray-200 "+(Xe?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */we(B,{name:"bookmark-square",className:"h-3.5 w-3.5",fill:Xe?"currentColor":"none",strokeWidth:1.5})})]}),_r?
|
|
55
|
+
/* @__PURE__ */we("h2",{id:je,"data-window-title":!0,className:"sr-only",children:or.text||Ke}):/* @__PURE__ */we("div",{"data-window-title":!0,title:Ke,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:Ht?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:/* @__PURE__ */we("span",{id:je,className:"truncate",children:Zt?pn(Re):Re})})]}),co&&/* @__PURE__ */we("div",{"aria-hidden":"true",className:"h-[3px] shrink-0 pointer-events-none",style:{backgroundColor:`rgb(var(--window-accent-rgb) / ${Ht?.9:.55})`}}),
|
|
56
|
+
/* @__PURE__ */we(un.Provider,{value:Ot,children:/* @__PURE__ */we(d.Provider,{value:oo,children:/* @__PURE__ */we(L.Provider,{value:{rightRef:pt,leftRef:wt,notify:()=>gt(!0),active:Ht,isDirty:tr,footerOpen:Ct&&!V&&!_&&!Z&&!Me},children:/* @__PURE__ */we("div",{ref:ft,"data-window-body":"",...V?{onPointerDown:Tr,onContextMenu:e=>{e.preventDefault(),at({x:e.clientX,y:e.clientY})}}:{},className:`flex-1 min-h-0 flex flex-col ${V?"p-0 cursor-move":Z||ee?"p-0":_?"p-2":"p-4"} ${V||zn||jr?"":"backdrop-blur-sm"} ${!1===M||Z||ee?"overflow-hidden":"overflow-y-auto overscroll-contain"+(jr?" mb-2 mr-1":"")} ${V?"rounded-2xl select-none":""}`,style:{...V?{touchAction:"none"}:{},backgroundColor:V||jr?"transparent":zn?"rgb(var(--window-content-rgb))":Ht?"rgb(var(--window-content-rgb) / var(--active-content-opacity, 0.9))":"rgb(var(--window-content-rgb) / var(--inactive-content-opacity, 0.8))"},children:/* @__PURE__ */we(Be,{children:xe})})})})})]}),V&&it&&/* @__PURE__ */pe($,{minWidth:160,style:{left:it.x,top:it.y},onClose:()=>at(null),children:[
|
|
57
|
+
/* @__PURE__ */we(W,{onClick:()=>{at(null),window.dispatchEvent(new CustomEvent("widget-open-settings",{detail:Ot}))},children:"Settings"}),
|
|
58
|
+
/* @__PURE__ */we(K,{}),ue&&/* @__PURE__ */pe(ye,{children:[ue,
|
|
59
|
+
/* @__PURE__ */we(K,{})]}),
|
|
60
|
+
/* @__PURE__ */pe(W,{onClick:()=>{at(null),Ve(e=>!e)},children:[
|
|
61
|
+
/* @__PURE__ */we("span",{className:"flex-1",children:"Always on Top"}),Xe&&/* @__PURE__ */we(B,{name:"check",className:"h-4 w-4 text-blue-600 shrink-0",strokeWidth:2})]}),
|
|
62
|
+
/* @__PURE__ */we(K,{}),
|
|
63
|
+
/* @__PURE__ */we(W,{onClick:()=>{at(null),vr()},children:"Close"})]}),
|
|
64
|
+
/* @__PURE__ */pe("div",{onPointerDown:Tr,ref:vt,"data-modal-footer":"",...jr?{"data-modal-footer-top":""}:{},className:jr?`absolute right-0 z-10 flex ${no} items-center gap-2 px-3 text-xs select-none cursor-move${Xr?"":" hidden"}`:`px-4 py-2 border-t border-gray-200 shrink-0 flex items-center justify-between text-xs select-none${zn?"":" cursor-move"}${Ht&&!zn?" backdrop-blur-sm":""}${V||_||Z||Me||!Ct?" hidden":""}`,style:jr?{touchAction:"none",top:co?3:0}:{touchAction:"none",backgroundColor:zn?"rgb(var(--window-footer-rgb))":Ht?"rgb(var(--window-footer-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-footer-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
65
|
+
/* @__PURE__ */pe("div",{className:jr?"flex shrink-0 items-center gap-2":"flex items-center gap-2 min-w-0 flex-1",children:[Tt&&/* @__PURE__ */we(Ue,{auto:!0}),O,
|
|
66
|
+
/* @__PURE__ */we("div",{ref:wt,"data-modal-actions-left":!0,className:"flex items-center gap-2 shrink-0"}),null!=k&&!1!==k&&!jr&&
|
|
67
|
+
/* @__PURE__ */we("div",{ref:bt,"data-modal-footer-facts":"",className:"min-w-0 flex-1 overflow-hidden",children:/* @__PURE__ */we("div",{ref:xt,className:"inline-flex items-center gap-2 whitespace-nowrap"+(kt?" invisible":""),children:k})})]}),
|
|
68
|
+
/* @__PURE__ */pe("div",{"data-modal-footer-right":"",className:"flex items-center gap-2 shrink-0"+(jr?"":" ml-auto"),children:[Mt&&q&&(q.editing?/* @__PURE__ */we(F,{variant:"secondary",size:"sm","data-modal-discard":"",onClick:()=>{Er()},children:We.discard}):"object"==typeof q.state?/* @__PURE__ */we(F,{variant:"secondary",size:"sm","data-modal-edit":"","aria-disabled":!0,disabledReason:q.state.disabledReason,children:We.edit}):/* @__PURE__ */we(F,{variant:"secondary",size:"sm","data-modal-edit":"",onClick:()=>q.onEdit(),children:We.edit})),
|
|
69
|
+
/* @__PURE__ */we("div",{ref:pt,"data-modal-actions":!0,className:"flex items-center gap-2"}),R]})]}),!V&&!Me&&!Zt&&Ht&&!Tn&&/* @__PURE__ */pe(ye,{children:[
|
|
70
|
+
/* @__PURE__ */we("div",{onPointerDown:e=>Dr(e,"se"),className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize z-10"}),
|
|
71
|
+
/* @__PURE__ */we("div",{onPointerDown:e=>Dr(e,"sw"),className:"absolute bottom-0 left-0 w-3 h-3 cursor-nesw-resize z-10"}),
|
|
72
|
+
/* @__PURE__ */we("div",{onPointerDown:e=>Dr(e,"ne"),className:"absolute top-0 right-0 w-3 h-3 cursor-nesw-resize z-10"}),
|
|
73
|
+
/* @__PURE__ */we("div",{onPointerDown:e=>Dr(e,"nw"),className:"absolute top-0 left-0 w-3 h-3 cursor-nwse-resize z-10"}),
|
|
74
|
+
/* @__PURE__ */we("div",{onPointerDown:e=>Dr(e,"n"),className:"absolute top-0 left-3 right-3 h-1 cursor-ns-resize"}),
|
|
75
|
+
/* @__PURE__ */we("div",{onPointerDown:e=>Dr(e,"s"),className:"absolute bottom-0 left-3 right-3 h-1 cursor-ns-resize"}),
|
|
76
|
+
/* @__PURE__ */we("div",{onPointerDown:e=>Dr(e,"e"),className:"absolute top-3 bottom-3 right-0 w-1 cursor-ew-resize"}),
|
|
77
|
+
/* @__PURE__ */we("div",{onPointerDown:e=>Dr(e,"w"),className:"absolute top-3 bottom-3 left-0 w-1 cursor-ew-resize"})]}),Zt&&/* @__PURE__ */we("div",{className:"absolute inset-0",style:{zIndex:H.hint,cursor:"pointer",background:"transparent"},onMouseEnter:()=>tn(!0),onMouseLeave:()=>tn(!1),onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),cr(Ot),qr(!1)},onClick:e=>{e.stopPropagation(),e.preventDefault()},children:Qt&&/* @__PURE__ */we("button",{type:"button","data-expose-close":!0,"aria-label":$e.taskbar.closeWindow,title:"Close",className:"absolute flex items-center justify-center rounded-full bg-black/55 text-on-accent shadow-lg ring-1 ring-white/40 transition-colors hover:bg-red-500",style:{top:8,right:8,width:30,height:30,transform:`scale(${1/vo})`,transformOrigin:"top right",zIndex:H.raised},onMouseDown:e=>{e.stopPropagation(),e.preventDefault()},onClick:e=>{e.stopPropagation(),e.preventDefault(),vr()},children:/* @__PURE__ */we(B,{name:"close",className:"h-4 w-4",strokeWidth:2.2})})})]}),Zt&&go&&/* @__PURE__ */we("div",{className:"fixed pointer-events-none select-none truncate text-center",style:{left:go.x,top:go.y+go.h+4,width:go.w,zIndex:H.expose+(Qt?21:11),color:"white",fontSize:"var(--text-xs)",fontWeight:500,textShadow:"0 1px 2px rgba(0,0,0,0.6)"},children:pn(Re)})]}),Eo=Ge&&/* @__PURE__ */pe($,{style:{left:Ge.x,top:Ge.y},onClose:()=>Je(null),minWidth:160,children:[!V&&!_&&!zn&&/* @__PURE__ */pe(ye,{children:[
|
|
78
|
+
/* @__PURE__ */pe(W,{onClick:()=>{ur(Ot),Je(null)},children:[
|
|
79
|
+
/* @__PURE__ */we(B,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),We.minimize]}),!Tn&&/* @__PURE__ */pe(W,Rn?{onClick:()=>{On(!1),kn(wn()),Je(null)},children:[
|
|
80
|
+
/* @__PURE__ */we(B,{name:"collapse",className:"h-4 w-4",strokeWidth:1.5}),We.windowed]}:{onClick:()=>{ho(),Je(null)},children:[
|
|
81
|
+
/* @__PURE__ */we(B,{name:"expand",className:"h-4 w-4",strokeWidth:1.5}),We.maximize]})]}),U&&!zn&&/* @__PURE__ */pe(W,{onClick:()=>{Ve(e=>!e),Je(null)},children:[
|
|
82
|
+
/* @__PURE__ */we(B,{name:"bookmark-square",className:"h-4 w-4 "+(Xe?"text-blue-600":""),fill:Xe?"currentColor":"none",strokeWidth:1.5}),Xe?We.unpin:We.pinOnTop]}),_e&&/* @__PURE__ */pe(W,{onClick:()=>{Je(null),ot()},children:[
|
|
83
|
+
/* @__PURE__ */we(B,{name:"star",className:"h-4 w-4",fill:rt?"currentColor":"none",strokeWidth:1.5}),rt?$e.taskbar.removeFromDesktop:$e.taskbar.addToDesktop]}),(gn[Ot]||[]).length>0&&/* @__PURE__ */we(ye,{children:(gn[Ot]||[]).map((e,t)=>/* @__PURE__ */pe(W,{onClick:()=>{Je(null),e.onClick()},children:[e.icon,e.label]},t))}),!(zn&&Ze?.home)&&/* @__PURE__ */pe(ye,{children:[
|
|
84
|
+
/* @__PURE__ */we(K,{}),
|
|
85
|
+
/* @__PURE__ */pe(W,{danger:!0,onClick:()=>{Je(null),vr()},children:[
|
|
86
|
+
/* @__PURE__ */we(B,{name:"close",className:"h-4 w-4"}),We.close]})]})]}),Mo=!!fe&&Rt.some(e=>e.id===fe),Co=!Xt||Mo||V?null:/* @__PURE__ */pe("div",{"data-modal-restore-tab":!0,"data-modal-id":Ot,className:"fixed left-1/2 z-(--z-restore-tab) flex -translate-x-1/2 items-center gap-1 rounded-lg border border-line-strong bg-surface px-2 py-1 shadow-lg",style:{bottom:"calc(var(--taskbar-height, 0px) + 12px)"},children:[
|
|
87
|
+
/* @__PURE__ */we("button",{type:"button",onClick:()=>cr(Ot),title:We.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:Ke||We.windowSuffix}),
|
|
88
|
+
/* @__PURE__ */we("button",{type:"button",onClick:()=>cr(Ot),title:We.restore,"aria-label":We.restore,className:"rounded px-2 py-0.5 text-xs leading-none text-ink-faintest hover:bg-gray-100 hover:text-gray-600",children:"▴"}),
|
|
89
|
+
/* @__PURE__ */we("button",{type:"button",onClick:()=>{vr()},title:We.close,"aria-label":We.close,className:"rounded px-2 py-0.5 text-xs leading-none text-ink-faintest hover:bg-gray-100 hover:text-gray-600",children:"✕"})]});return ge(
|
|
90
|
+
/* @__PURE__ */pe(dn.Provider,{value:null,children:[ko,Eo,Co]}),document.body)}"undefined"!=typeof window&&window.addEventListener("keydown",e=>{Kr&&"Escape"===e.key&&(to(null),qr(!1))});var ao=100,so={past:[],future:[]};function lo(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>ao?r.slice(r.length-ao):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:so}}var co=/* @__PURE__ */new Set(["INPUT","TEXTAREA","SELECT"]);var uo=500,ho=250;function mo({children:e,canEdit:t=!0,perms:n,windowId:r}){const[o,i]=me(lo,so),a=ne(/* @__PURE__ */new Map),[s,l]=oe(0),c=s>0,[u,d]=oe(0),[h,m]=oe(0),f=h>0,{hasAnyPerm:p}=A(),w=t&&0===u&&(!(n&&n.length>0)||p(n)),y=ne(null),g=ne(!1),v=ae(()=>{const e={};for(const[t,n]of a.current)e[t]=n.getLast();return e},[]),b=ae((e,t)=>{a.current.has(e)||l(e=>e+1),a.current.set(e,t)},[]),x=ae(e=>{a.current.delete(e)&&l(e=>e-1)},[]),k=ae(e=>{d(t=>t+(e?1:-1))},[]),E=ae(e=>{m(t=>t+(e?1:-1))},[]),[M,C]=oe(0),S=M>0,N=ae(e=>{C(t=>t+(e?1:-1))},[]),z=Q(qe),T=z?.claimReadOnly;re(()=>{if(T&&!w)return T(!0),()=>T(!1)},[T,w]);const D=z?.claimOwnMount;re(()=>{if(D&&S)return D(!0),()=>D(!1)},[D,S]);const I=ne({last:0,count:0,tripped:!1}),P=ne(!1),R=ae((e,t,n)=>{if(g.current)return void(n&&function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(Array.isArray(e)!==Array.isArray(t))return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}(n.prev,n.next)||(P.current=!0));if(!w||y.current)return;const r=I.current;if(r.tripped)return;const o=Date.now();if(o-r.last>ho&&(r.count=0),r.last=o,++r.count>uo)return r.tripped=!0,void console.error(`[efficient-shell] UndoProvider: "${e}" recorded ${uo} 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.`);y.current={values:v(),label:e,coalesceKey:t},queueMicrotask(()=>{const e=y.current;y.current=null,e&&i({type:"record",step:e})})},[w,v]),O=ae(e=>{for(const[t,n]of Object.entries(e)){const e=a.current.get(t);e&&(e.setLast(n),e.apply(n))}},[]),$=ae(()=>{const e=o.past[o.past.length-1];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};O(e.values),i({type:"undo",redoStep:t})},[o.past,v,O]),W=ae(()=>{const e=o.future[0];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};O(e.values),i({type:"redo",undoStep:t})},[o.future,v,O]),[K,j]=oe(0),F=ne(0),B=ne(0),q=ne(!1),H=ae(()=>{g.current=!0,P.current=!1,y.current=null,F.current+=1,B.current=F.current,j(F.current)},[]),U=ne(void 0),Y=ae(e=>{void 0!==e&&(void 0!==U.current&&e!==U.current&&(q.current=!0),U.current=e),H()},[H]);re(()=>{g.current&&K===B.current&&(g.current=!1,y.current=null,(P.current||q.current)&&i({type:"clear"}),P.current=!1,q.current=!1)},[K]);const X=ae(()=>{q.current=!0,i({type:"clear"}),H()},[H]),V=w&&o.past.length>0,G=w&&o.future.length>0,J=Wr(r),_=ne({undo:$,redo:W,canUndo:V,canRedo:G});_.current={undo:$,redo:W,canUndo:V,canRedo:G},re(()=>{if(!J||!w)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&&co.has(r.tagName.toUpperCase())?null:n}(e);if(!t)return;const n=_.current;("undo"===t?n.canUndo:n.canRedo)&&(e.preventDefault(),"undo"===t?n.undo():n.redo())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[J,w]);const Z=de(()=>({register:b,unregister:x,record:R,undo:$,redo:W,clear:X,baseline:Y,canUndo:V,canRedo:G,enabled:w,hasState:c,handMounted:S,claimOwnMount:N,claimReadOnly:k,declaredEditable:f,claimEditable:E,undoLabel:V?o.past[o.past.length-1].label:null,redoLabel:G?o.future[0].label:null}),[b,x,R,$,W,X,Y,V,G,w,c,S,N,k,f,E,o.past,o.future]),ee=""!==kn(),te=Q(L)?.footerOpen??!1,ie=ee&&w&&c&&!S&&te;/* @__PURE__ */
|
|
91
|
+
return pe(qe.Provider,{value:Z,children:[ie&&/* @__PURE__ */we(En,{position:"left",quiet:!0,children:/* @__PURE__ */we(Ue,{auto:!0})}),e]})}function fo(){const e=Q(qe),t=ae(()=>{},[]);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 po(e){const t=Q(qe),n=t?.claimReadOnly,r=t?.claimEditable;re(()=>{const t=e?r:n;if(t)return t(!0),()=>t(!1)},[n,r,e])}function wo(e,t,n){const r=Q(qe),o=he(),i=ne(e),a=ne(t);a.current=t,re(()=>{if(r)return r.register(o,{getLast:()=>i.current,setLast:e=>{i.current=e},apply:e=>a.current(e)}),()=>r.unregister(o)},[r,o]);const{label:s,coalesceKey:l=null}=n,c=ne(r);c.current=r;const u=ne({label:s,coalesceKey:l});u.current={label:s,coalesceKey:l},re(()=>{const t=c.current;t&&(Object.is(e,i.current)||(t.record(u.current.label,u.current.coalesceKey,{prev:i.current,next:e}),i.current=e))},[e])}function yo(e,t){const[n,r]=oe(e);return wo(n,e=>r(()=>e),t),[n,r]}export{Mn as CancelButton,Te as DesktopHostProvider,ft as DocFavStar,nt as EntityWindowFallback,et as EntityWindowLoading,rt as EntityWindowState,fn as MODAL_SUBMIT_SELECTOR,io as Modal,En as ModalActions,Ue as UndoControls,mo as UndoProvider,Se as WINDOW_REGISTRY,Fe as WindowCrashedFallback,Be as WindowErrorBoundary,Rt as WindowManagerProvider,bn as WindowTitle,bt as activateWindowById,Vt as beginWindowGesture,ir as cancelWindowFront,Ne as client_default,no as commitExposeHighlight,or as confirmWindowDiscard,Gt as drainPerfEvents,Ur as exitExposeMode,On as forgetMaximizedWindowBoxes,Et as getActiveWindowRoute,eo as getExposeHighlight,cn as getWindowChromeVersion,Pn as getWindowPosition,it as isDraftEntityId,at as isDraftEntityWindow,Ee as isEntityEntry,ke as isPageEntry,Le as isShellApiClientConfigured,Je as isTabWindow,Xt as markMenuOpen,sn as readWindowChrome,tr as requestWindowFront,to as setExposeHighlight,Yt as setPerfCollecting,Oe as setShellHomeRoute,je as setShellTabStrip,Ce as setShellWindowRegistry,In as setWindowDefaultPosition,Rn as setWindowPosition,en as splitTitle,Qr as subscribeExposeHighlight,ln as subscribeWindowChrome,_e as tabGroupOf,Hr as toggleExposeMode,_n as useCurrentTabKey,Ae as useDesktopHost,kn as useEnclosingModalId,Wr as useIsActiveWindow,Ie as usePageSearch,fo as useUndo,po as useUndoCanEdit,wo as useUndoable,yo as useUndoableState,yn as useWidgetSettings,ct as useWindowDirty,dt as useWindowManager,vn as useWindowMenuItem,xn as useWindowTitle,rr as windowHoldsChanges};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{useClickOutside as e}from"./chunk-SI26KESU.js";import{useColumnConfig as t}from"./chunk-C5OPAULN.js";import{useShellAuth as r}from"./chunk-2QY5BJLA.js";import{useIsMobile as o}from"./chunk-UGTRSRIW.js";import{Icon as l}from"./chunk-ISVODSRP.js";import{TH_ONE_LINE as n}from"./chunk-TD3ZQD5R.js";import{shellHttp as a}from"./chunk-STKJA4PV.js";import{glassStyle as s}from"./chunk-5FYDNH4Y.js";import{useShellStrings as i}from"./chunk-IUVGHHR3.js";import{useState as c,useMemo as d,useRef as m,useCallback as h}from"react";import{jsxs as u,jsx as p}from"react/jsx-runtime";function f({tableId:f,columns:g,sort:x,onSort:y,footer:b,afterBody:v,saveDefaultPerms:k=["change_numberingconfig"],children:N}){const w=o(),[D,j]=c(!1),S=d(()=>w&&!D?g.filter(e=>"_select"!==e.key):g,[g,w,D]),{orderedColumns:C,allColumns:_,onResizeStart:z,onDragStart:R,onDragOver:I,onDrop:P,onDragEnd:$,toggleColumn:L,resetColumns:T,draggedIdx:A,dropGap:O}=t(f,S),{hasAnyPerm:U}=r(),E=i().columns,[G,H]=c(!1),[V,W]=c(!1),[Y,B]=c(!1),F=m(null),J=k.length>0&&U(k);e(F,h(()=>{G&&H(!1)},[G]));const K=C.reduce((e,t)=>e+t.width,0),Q=C.map(e=>`${e.width}px`),M={tableLayout:"fixed",width:K,minWidth:"100%"},Z=m(null),q=h(e=>{const t=Z.current;t&&(t.scrollLeft=e.currentTarget.scrollLeft)},[]),X=d(()=>g.some(e=>"_select"===e.key),[g]);/* @__PURE__ */
|
|
2
2
|
return u("div",{className:"flex flex-col flex-1 min-h-0 "+(w?"-mx-4":""),children:[
|
|
3
3
|
/* @__PURE__ */p("div",{ref:Z,className:"shrink-0 overflow-x-hidden",children:/* @__PURE__ */u("table",{className:"divide-y divide-gray-200",style:M,children:[
|
|
4
4
|
/* @__PURE__ */p("colgroup",{children:C.map((e,t)=>/* @__PURE__ */p("col",{style:{width:Q[t]}},e.key))}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{setBoundaryErrorReporter as e}from"./chunk-KNUR2UEG.js";import{VERSION as t}from"./chunk-JYESSDBZ.js";var n=-1,i=()=>n,a=e=>{addEventListener("pageshow",t=>{t.persisted&&(n=t.timeStamp,e(t))},!0)},r=(e,t,n,i)=>{let a,r;return o=>{var s,c;t.value>=0&&(o||i)&&(r=t.value-(a??0),(r||void 0===a)&&(a=t.value,t.delta=r,t.rating=(s=t.value)>(c=n)[1]?"poor":s>c[0]?"needs-improvement":"good",e(t)))}},o=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},s=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},c=()=>s()?.activationStart??0,d=-1,l=/* @__PURE__ */new Set,u=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,f=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of l)e();isFinite(d)||(d="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",f,!0))}},h=(e=!1)=>{if(e&&(d=1/0),d<0){const e=c(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;d=t??u(),addEventListener("visibilitychange",f,!0),addEventListener("prerenderingchange",f,!0),a(()=>{setTimeout(()=>{d=u()})})}return{get firstHiddenTime(){return d},onHidden(e){l.add(e)}}},g=(e,t=-1,n,a=0,r,o,d)=>{const l=s(),u=l?.navigationId||0;let f="navigate";return n?f=n:i()>=0?f="back-forward-cache":l&&(document.prerendering||c()>0?f="prerender":document.wasDiscarded?f="restore":l.type&&(f=l.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:f,navigationId:a||u,navigationInteractionId:r,navigationURL:o||l?.name,navigationStartTime:d||0}},v=/* @__PURE__ */new WeakMap;function p(e,t){let n=v.get(t);return n||(n=/* @__PURE__ */new WeakMap,v.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}var m,y=class{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},T=(e,t,n={})=>{try{const i=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(i.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const n=e.getEntries();i.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(const t of i)e.observe({type:t,buffered:!0,...n});return e}}catch{}},w=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,I=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},b=e=>{let t=!1;return()=>{t||(e(),t=!0)}},E=class{l},C=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},L=[1800,3e3],P=(e,t={})=>{const n=w(t);C(()=>{const s=p(t,E),d=h();let l,u=g("FCP");const f=T(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(f.disconnect(),t.startTime<d.firstHiddenTime&&(u.value=Math.max(t.startTime-c(),0),u.entries.push(t),u.navigationId=t.navigationId||u.navigationId,l(!0)))});f&&(l=r(e,u,L,t.reportAllChanges),a(n=>{u=g("FCP",-1,"back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),l=r(e,u,L,t.reportAllChanges),o(()=>{u.value=performance.now()-n.timeStamp,l(!0)})})),n&&T(["soft-navigation"],n=>{n.forEach(n=>{s.l&&n.navigationId&&I(s.l,n);const i=Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0);u=g("FCP",i,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),l=r(e,u,L,t.reportAllChanges),l(!0)})},t)})},A=[.1,.25],k=0,S=1/0,z=0,M=e=>{for(const t of e)t.interactionId&&(S=Math.min(S,t.interactionId),z=Math.max(z,t.interactionId),k=z?(z-S)/7+1:0)},$=()=>m?k:performance.interactionCount??0,Z=class{u=0;v=[];m=/* @__PURE__ */new Map;p;T;_(){return $()-this.u}M(){this.u=$(),this.v.length=0,this.m.clear()}L(e){const t=this._(),n=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==n||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[n]:{P:8,id:-1,entries:[]}}h(e){if(this.p?.(e),!e.interactionId)return;const t=this.v.at(-1);let n=this.m.get(e.interactionId);if(n||this.v.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}this.T?.(n)}}},_=e=>{const t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const a=b(e);let r=-1;const o=()=>{i(r),a()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=n(()=>{removeEventListener("visibilitychange",o,{capture:!0}),a()},{timeout:t})}},F=[200,500],R=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=h();C(()=>{"interactionCount"in performance||m||(m=T(["event"],M,{durationThreshold:0}));let o,s=g("INP");const c=p(t,Z),d=(n,i,a,d,l)=>{c.M(),s=g("INP",-1,n,i,a,d,l),o=r(e,s,F,t.reportAllChanges)},l=()=>{const e=c.L(s.navigationType);e&&e.P!==s.value&&(s.value=e.P,s.entries=e.entries,o())},u=e=>{l(),o(!0),d("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},f=(e,t=!1)=>{_(()=>{for(const t of e)"soft-navigation"!==t.entryType?c.h(t):u(t);l(),t&&o(!0)})},h=["event","first-input"];w(t)&&h.push("soft-navigation");const v=T(h,f,{...t,durationThreshold:t.durationThreshold??40});o=r(e,s,F,t.reportAllChanges),v&&(n.onHidden(()=>{f(v.takeRecords(),!0)}),a(()=>{d("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,i())}))})},j=class{p;l;h(e){this.p?.(e)}},x=[2500,4e3],B=[800,1800],N=e=>{document.prerendering?C(()=>N(e)):"complete"!==document.readyState?addEventListener("load",()=>N(e),!0):setTimeout(e)};var U=/^[A-Za-z0-9/_:.\-[\]{}*@~]+$/,O=/^[A-Za-z_$][A-Za-z0-9_$.]*$/,H=/^[A-Za-z0-9][A-Za-z0-9.+_-]*$/;var q=class{constructor(e){this.head=e}head;events=[];waiting=/* @__PURE__ */new Map;seen=/* @__PURE__ */new Set;get size(){return this.events.length}addVital(e){this.events.push(e)}addError(e){const t=function(e){return e.frames.length?`${e.name}|${e.frames.join("|")}`:`${e.name}|${e.message.replace(/\d/g,"0")}`}(e),n=this.waiting.get(t);return n?(n.count=Math.min(1e3,n.count+e.count),!0):!(this.seen.has(t)||this.seen.size>=20)&&(this.seen.add(t),this.waiting.set(t,e),this.events.push(e),!0)}drain(){const e=this.events;this.events=[],this.waiting.clear();const t=[],n=JSON.stringify({...this.head,events:[]}).length;let i=[],a=n;for(const r of e){const e=JSON.stringify(r).length+1;n+e>30720||((50===i.length||a+e>30720)&&(t.push({...this.head,events:i}),i=[],a=n),i.push(r),a+=e)}return i.length&&t.push({...this.head,events:i}),t}},J=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,K=/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*)?|\b[Bb]earer\s+[A-Za-z0-9._~+/=-]{8,}/g,D=/\b[a-z][a-z0-9+.-]*:\/\/\S+/gi,V=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,W=/\d{4,}/g,G=/(^|[/:])(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,})(?=$|[/:])/gi,Y=/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,Q=/(?:\(|@|\bat\s+)?((?:[a-z][a-z0-9+.-]*:\/\/|\/)[^\s()@]*?):(\d+):(\d+)\)?\s*$/i;function X(e,t,n){const i=e.replace(Y,"").split(/[?#]/,1)[0];return i?`${i}:${t}:${n}`.slice(0,256):null}function ee(e){if("string"!=typeof e)return[];const t=[];for(const n of e.split("\n")){const e=Q.exec(n.trim()),i=e&&X(e[1],e[2],e[3]);if(i&&t.push(i),5===t.length)break}return t}function te(e){const t=e instanceof Error?e.name:void 0;return"string"==typeof t&&t.length<=64&&O.test(t)?t:"Error"}function ne(e){if("string"!=typeof e)return"unknown";const t=e.trim().replace(Y,"").split(/[?#]/,1)[0].replace(G,(e,t)=>":"===t?":id":`${t}:id`);return t&&t.length<=128&&!t.includes("//")&&U.test(t)?t:"unknown"}var ie={flush(){},reportError(){},stop(){}},ae=null,re=/* @__PURE__ */new Set(["LCP","FCP","TTFB"]);function oe(e,t,n){const i=function(e){if(e.anonymous)return{credentials:"omit",headers:{"Content-Type":"application/json"}};const t=e.getAccessToken();return t?{credentials:"same-origin",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}}:null}(t);if(!i)return;const a=t.anonymous?"/api/storefront-analytics/web-vitals/":"/api/client-telemetry/web-batches/";n(t.endpoint??a,{...i,method:"POST",keepalive:!0,body:JSON.stringify(e)}).catch(e=>{console.debug("[efficient-shell] client telemetry batch dropped:",e)})}function se(e){((e,t={})=>{let n=!1;const s=w(t);C(()=>{let d,l=h(),u=g("LCP");const f=p(t,j),v=(i,a,o,s,c)=>{u=g("LCP",-1,i,a,o,s,c),d=r(e,u,x,t.reportAllChanges),n=!1,"soft-navigation"===i&&(l=h(!0))},m=e=>{f.l&&e.navigationId&&I(f.l,e),n||d(!0),v("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const t=e.getLargestInteractionContentfulPaint?.();t&&y([t])},y=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){m(t);continue}let e=0,n=[],i=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-c(),0),f.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){const a=t;if(!u.navigationId)continue;if("interactionId"in a&&a.interactionId!=u.navigationInteractionId)continue;i=a.largestContentfulPaint?.renderTime||0,e=Math.max(i-t.startTime,0),a.largestContentfulPaint&&(f.h(a.largestContentfulPaint),n=[a.largestContentfulPaint])}i<l.firstHiddenTime&&(u.value=e,u.entries=n,d())}},w=["largest-contentful-paint"];s&&w.push("interaction-contentful-paint","soft-navigation");const b=T(w,y);if(b){d=r(e,u,x,t.reportAllChanges);const c=["keydown","click","visibilitychange"],l=e=>{if(e.isTrusted&&!n){const e=u.id;_(()=>{if(!n){if(!s){b.disconnect();for(const e of c)removeEventListener(e,l,{capture:!0})}e===u.id&&(n=!0,d(!0))}})}};for(const e of c)addEventListener(e,l,{capture:!0});a(a=>{v("back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),d=r(e,u,x,t.reportAllChanges),o(()=>{u.value=performance.now()-a.timeStamp,n=!0,d(!0)})})}})})(e),R(e),((e,t={})=>{const n=h();P(b(()=>{let s,c=g("CLS",0);const d=p(t,y),l=(n,i,a,o,l)=>{c=g("CLS",0,n,i,a,o,l),d.i=0,s=r(e,c,A,t.reportAllChanges)},u=(e=!1)=>{d.i>c.value&&(c.value=d.i,c.entries=d.o),s(e)},f=e=>{u(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},h=e=>{for(const t of e)"soft-navigation"!==t.entryType?d.h(t):f(t);u()},v=["layout-shift"];w(t)&&v.push("soft-navigation");const m=T(v,h);m&&(s=r(e,c,A,t.reportAllChanges),n.onHidden(()=>{h(m.takeRecords()),s(!0)}),a(()=>{l("back-forward-cache",c.navigationId,c.navigationInteractionId,c.navigationURL,i()),o(s)}),setTimeout(s))}))})(e),P(e),((e,t={})=>{const n=w(t);let o=g("TTFB"),d=r(e,o,B,t.reportAllChanges);N(()=>{const l=s();if(l){const s=l.responseStart;o.value=Math.max(s-c(),0),o.entries=[l],d(!0),a(()=>{o=g("TTFB",0,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,i()),d=r(e,o,B,t.reportAllChanges),d(!0)}),n&&T(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&(o=g("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),o.entries=[n],d=r(e,o,B,t.reportAllChanges),d(!0))})},t)}})})(e)}function ce(n){if(ae?.stop(),ae=null,!1===n.enabled||"undefined"==typeof window||"undefined"==typeof document)return ie;if(!function(e){const t="string"==typeof e.app&&H.test(e.app),n="string"==typeof e.release&&H.test(e.release);return t&&n||console.warn("[efficient-shell] client telemetry not started: `app` and `release` must be version-like strings."),t&&n}(n))return ie;const i=function(e){const t=e.vitalsSampleRate??1;return t>0&&(t>=1||(e.random??Math.random)()<t)}(n);if(n.anonymous&&!i)return ie;const a=n.fetch??window.fetch.bind(window),r=new q({app:n.app,release:n.release,shell_version:H.test(t)?t:""}),o=ne(n.routeKey()),s=function(e=("undefined"==typeof window?void 0:window)){if(!e)return"desktop";const t="function"==typeof e.matchMedia&&e.matchMedia("(pointer: coarse)").matches,n=e.innerWidth;return n<600?"mobile":t&&n<1280?"tablet":"desktop"}(window);let c=!1;const d=()=>{for(const e of r.drain())oe(e,n,a)},l=e=>{c||n.anonymous||(r.addError(e),r.size>=50&&d())},u=(e,t)=>{return{type:"error",source:t,name:te(e),message:(a=e,i=a instanceof Error?a.message:"string"==typeof a?a:a&&"object"==typeof a&&"string"==typeof a.message?a.message:"",i.slice(0,640).replace(J,"[redacted]").replace(K,"[redacted]").replace(D,"[url]").replace(V,"[id]").replace(W,"[n]").replace(/\s+/g," ").trim().slice(0,160)),frames:ee(e instanceof Error?e.stack:void 0),route:ne(n.routeKey()),count:1};var i,a};i&&(n.observeVitals??se)(e=>{c||(r.addVital(function(e,t,n,i){return{type:"vital",name:e.name,value:e.value,route:re.has(e.name)?t:n(),navigation:e.navigationType??"navigate",device:i}}(e,o,()=>ne(n.routeKey()),s)),r.size>=50&&d())});const f=n.anonymous?()=>{}:function(t,n){const i=e=>{const{error:i,message:a,filename:r,lineno:o,colno:s}=e;if(null!=i)return void t(n(i,"onerror"));const c=r?ee(`at ${r}:${o??0}:${s??0}`):[];t({...n(a??"","onerror"),frames:c})},a=e=>t(n(e.reason,"unhandledrejection"));window.addEventListener("error",i),window.addEventListener("unhandledrejection",a);const r=e(e=>t(n(e,"boundary")));return()=>{window.removeEventListener("error",i),window.removeEventListener("unhandledrejection",a),r()}}(l,u),h=()=>{"hidden"===document.visibilityState&&d()};document.addEventListener("visibilitychange",h),window.addEventListener("pagehide",d);const g=window.setInterval(d,n.flushIntervalMs??6e4),v={flush:d,reportError:e=>l(u(e,"boundary")),stop(){c||(d(),c=!0,f(),document.removeEventListener("visibilitychange",h),window.removeEventListener("pagehide",d),window.clearInterval(g),ae===v&&(ae=null))}};return ae=v,v}export{ce as startClientTelemetry};
|
|
1
|
+
import{setBoundaryErrorReporter as e}from"./chunk-KNUR2UEG.js";import{VERSION as t}from"./chunk-VGUYAVDG.js";var n=-1,i=()=>n,a=e=>{addEventListener("pageshow",t=>{t.persisted&&(n=t.timeStamp,e(t))},!0)},r=(e,t,n,i)=>{let a,r;return o=>{var s,c;t.value>=0&&(o||i)&&(r=t.value-(a??0),(r||void 0===a)&&(a=t.value,t.delta=r,t.rating=(s=t.value)>(c=n)[1]?"poor":s>c[0]?"needs-improvement":"good",e(t)))}},o=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},s=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},c=()=>s()?.activationStart??0,d=-1,l=/* @__PURE__ */new Set,u=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,f=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of l)e();isFinite(d)||(d="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",f,!0))}},h=(e=!1)=>{if(e&&(d=1/0),d<0){const e=c(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;d=t??u(),addEventListener("visibilitychange",f,!0),addEventListener("prerenderingchange",f,!0),a(()=>{setTimeout(()=>{d=u()})})}return{get firstHiddenTime(){return d},onHidden(e){l.add(e)}}},g=(e,t=-1,n,a=0,r,o,d)=>{const l=s(),u=l?.navigationId||0;let f="navigate";return n?f=n:i()>=0?f="back-forward-cache":l&&(document.prerendering||c()>0?f="prerender":document.wasDiscarded?f="restore":l.type&&(f=l.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:f,navigationId:a||u,navigationInteractionId:r,navigationURL:o||l?.name,navigationStartTime:d||0}},v=/* @__PURE__ */new WeakMap;function p(e,t){let n=v.get(t);return n||(n=/* @__PURE__ */new WeakMap,v.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}var m,y=class{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},T=(e,t,n={})=>{try{const i=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(i.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const n=e.getEntries();i.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(const t of i)e.observe({type:t,buffered:!0,...n});return e}}catch{}},w=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,I=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},b=e=>{let t=!1;return()=>{t||(e(),t=!0)}},C=class{l},E=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},L=[1800,3e3],P=(e,t={})=>{const n=w(t);E(()=>{const s=p(t,C),d=h();let l,u=g("FCP");const f=T(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(f.disconnect(),t.startTime<d.firstHiddenTime&&(u.value=Math.max(t.startTime-c(),0),u.entries.push(t),u.navigationId=t.navigationId||u.navigationId,l(!0)))});f&&(l=r(e,u,L,t.reportAllChanges),a(n=>{u=g("FCP",-1,"back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),l=r(e,u,L,t.reportAllChanges),o(()=>{u.value=performance.now()-n.timeStamp,l(!0)})})),n&&T(["soft-navigation"],n=>{n.forEach(n=>{s.l&&n.navigationId&&I(s.l,n);const i=Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0);u=g("FCP",i,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),l=r(e,u,L,t.reportAllChanges),l(!0)})},t)})},A=[.1,.25],k=0,S=1/0,z=0,M=e=>{for(const t of e)t.interactionId&&(S=Math.min(S,t.interactionId),z=Math.max(z,t.interactionId),k=z?(z-S)/7+1:0)},$=()=>m?k:performance.interactionCount??0,_=class{u=0;v=[];m=/* @__PURE__ */new Map;p;T;_(){return $()-this.u}M(){this.u=$(),this.v.length=0,this.m.clear()}L(e){const t=this._(),n=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==n||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[n]:{P:8,id:-1,entries:[]}}h(e){if(this.p?.(e),!e.interactionId)return;const t=this.v.at(-1);let n=this.m.get(e.interactionId);if(n||this.v.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}this.T?.(n)}}},Z=e=>{const t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const a=b(e);let r=-1;const o=()=>{i(r),a()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=n(()=>{removeEventListener("visibilitychange",o,{capture:!0}),a()},{timeout:t})}},F=[200,500],R=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=h();E(()=>{"interactionCount"in performance||m||(m=T(["event"],M,{durationThreshold:0}));let o,s=g("INP");const c=p(t,_),d=(n,i,a,d,l)=>{c.M(),s=g("INP",-1,n,i,a,d,l),o=r(e,s,F,t.reportAllChanges)},l=()=>{const e=c.L(s.navigationType);e&&e.P!==s.value&&(s.value=e.P,s.entries=e.entries,o())},u=e=>{l(),o(!0),d("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},f=(e,t=!1)=>{Z(()=>{for(const t of e)"soft-navigation"!==t.entryType?c.h(t):u(t);l(),t&&o(!0)})},h=["event","first-input"];w(t)&&h.push("soft-navigation");const v=T(h,f,{...t,durationThreshold:t.durationThreshold??40});o=r(e,s,F,t.reportAllChanges),v&&(n.onHidden(()=>{f(v.takeRecords(),!0)}),a(()=>{d("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,i())}))})},j=class{p;l;h(e){this.p?.(e)}},x=[2500,4e3],U=[800,1800],B=e=>{document.prerendering?E(()=>B(e)):"complete"!==document.readyState?addEventListener("load",()=>B(e),!0):setTimeout(e)};var N=/^[A-Za-z0-9/_:.\-[\]{}*@~]+$/,O=/^[A-Za-z_$][A-Za-z0-9_$.]*$/,H=/^[A-Za-z0-9][A-Za-z0-9.+_-]*$/;var q=class{constructor(e){this.head=e}head;events=[];waiting=/* @__PURE__ */new Map;seen=/* @__PURE__ */new Set;get size(){return this.events.length}addVital(e){this.events.push(e)}addError(e){const t=function(e){return e.frames.length?`${e.name}|${e.frames.join("|")}`:`${e.name}|${e.message.replace(/\d/g,"0")}`}(e),n=this.waiting.get(t);return n?(n.count=Math.min(1e3,n.count+e.count),!0):!(this.seen.has(t)||this.seen.size>=20)&&(this.seen.add(t),this.waiting.set(t,e),this.events.push(e),!0)}drain(){const e=this.events;this.events=[],this.waiting.clear();const t=[],n=JSON.stringify({...this.head,events:[]}).length;let i=[],a=n;for(const r of e){const e=JSON.stringify(r).length+1;n+e>30720||((50===i.length||a+e>30720)&&(t.push({...this.head,events:i}),i=[],a=n),i.push(r),a+=e)}return i.length&&t.push({...this.head,events:i}),t}},V=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,J=/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*)?|\b[Bb]earer\s+[A-Za-z0-9._~+/=-]{8,}/g,K=/\b[a-z][a-z0-9+.-]*:\/\/\S+/gi,D=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,G=/\d{4,}/g,W=/(^|[/:])(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,})(?=$|[/:])/gi,Y=/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,Q=/(?:\(|@|\bat\s+)?((?:[a-z][a-z0-9+.-]*:\/\/|\/)[^\s()@]*?):(\d+):(\d+)\)?\s*$/i;function X(e,t,n){const i=e.replace(Y,"").split(/[?#]/,1)[0];return i?`${i}:${t}:${n}`.slice(0,256):null}function ee(e){if("string"!=typeof e)return[];const t=[];for(const n of e.split("\n")){const e=Q.exec(n.trim()),i=e&&X(e[1],e[2],e[3]);if(i&&t.push(i),5===t.length)break}return t}function te(e){const t=e instanceof Error?e.name:void 0;return"string"==typeof t&&t.length<=64&&O.test(t)?t:"Error"}function ne(e){if("string"!=typeof e)return"unknown";const t=e.trim().replace(Y,"").split(/[?#]/,1)[0].replace(W,(e,t)=>":"===t?":id":`${t}:id`);return t&&t.length<=128&&!t.includes("//")&&N.test(t)?t:"unknown"}var ie={flush(){},reportError(){},stop(){}},ae=null,re=/* @__PURE__ */new Set(["LCP","FCP","TTFB"]);function oe(e,t,n){const i=function(e){if(e.anonymous)return{credentials:"omit",headers:{"Content-Type":"application/json"}};const t=e.getAccessToken();return t?{credentials:"same-origin",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}}:null}(t);if(!i)return;const a=t.anonymous?"/api/storefront-analytics/web-vitals/":"/api/client-telemetry/web-batches/";n(t.endpoint??a,{...i,method:"POST",keepalive:!0,body:JSON.stringify(e)}).catch(e=>{console.debug("[efficient-shell] client telemetry batch dropped:",e)})}function se(e){((e,t={})=>{let n=!1;const s=w(t);E(()=>{let d,l=h(),u=g("LCP");const f=p(t,j),v=(i,a,o,s,c)=>{u=g("LCP",-1,i,a,o,s,c),d=r(e,u,x,t.reportAllChanges),n=!1,"soft-navigation"===i&&(l=h(!0))},m=e=>{f.l&&e.navigationId&&I(f.l,e),n||d(!0),v("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const t=e.getLargestInteractionContentfulPaint?.();t&&y([t])},y=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){m(t);continue}let e=0,n=[],i=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-c(),0),f.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){const a=t;if(!u.navigationId)continue;if("interactionId"in a&&a.interactionId!=u.navigationInteractionId)continue;i=a.largestContentfulPaint?.renderTime||0,e=Math.max(i-t.startTime,0),a.largestContentfulPaint&&(f.h(a.largestContentfulPaint),n=[a.largestContentfulPaint])}i<l.firstHiddenTime&&(u.value=e,u.entries=n,d())}},w=["largest-contentful-paint"];s&&w.push("interaction-contentful-paint","soft-navigation");const b=T(w,y);if(b){d=r(e,u,x,t.reportAllChanges);const c=["keydown","click","visibilitychange"],l=e=>{if(e.isTrusted&&!n){const e=u.id;Z(()=>{if(!n){if(!s){b.disconnect();for(const e of c)removeEventListener(e,l,{capture:!0})}e===u.id&&(n=!0,d(!0))}})}};for(const e of c)addEventListener(e,l,{capture:!0});a(a=>{v("back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),d=r(e,u,x,t.reportAllChanges),o(()=>{u.value=performance.now()-a.timeStamp,n=!0,d(!0)})})}})})(e),R(e),((e,t={})=>{const n=h();P(b(()=>{let s,c=g("CLS",0);const d=p(t,y),l=(n,i,a,o,l)=>{c=g("CLS",0,n,i,a,o,l),d.i=0,s=r(e,c,A,t.reportAllChanges)},u=(e=!1)=>{d.i>c.value&&(c.value=d.i,c.entries=d.o),s(e)},f=e=>{u(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},h=e=>{for(const t of e)"soft-navigation"!==t.entryType?d.h(t):f(t);u()},v=["layout-shift"];w(t)&&v.push("soft-navigation");const m=T(v,h);m&&(s=r(e,c,A,t.reportAllChanges),n.onHidden(()=>{h(m.takeRecords()),s(!0)}),a(()=>{l("back-forward-cache",c.navigationId,c.navigationInteractionId,c.navigationURL,i()),o(s)}),setTimeout(s))}))})(e),P(e),((e,t={})=>{const n=w(t);let o=g("TTFB"),d=r(e,o,U,t.reportAllChanges);B(()=>{const l=s();if(l){const s=l.responseStart;o.value=Math.max(s-c(),0),o.entries=[l],d(!0),a(()=>{o=g("TTFB",0,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,i()),d=r(e,o,U,t.reportAllChanges),d(!0)}),n&&T(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&(o=g("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),o.entries=[n],d=r(e,o,U,t.reportAllChanges),d(!0))})},t)}})})(e)}function ce(n){if(ae?.stop(),ae=null,!1===n.enabled||"undefined"==typeof window||"undefined"==typeof document)return ie;if(!function(e){const t="string"==typeof e.app&&H.test(e.app),n="string"==typeof e.release&&H.test(e.release);return t&&n||console.warn("[efficient-shell] client telemetry not started: `app` and `release` must be version-like strings."),t&&n}(n))return ie;const i=function(e){const t=e.vitalsSampleRate??1;return t>0&&(t>=1||(e.random??Math.random)()<t)}(n);if(n.anonymous&&!i)return ie;const a=n.fetch??window.fetch.bind(window),r=new q({app:n.app,release:n.release,shell_version:H.test(t)?t:""}),o=ne(n.routeKey()),s=function(e=("undefined"==typeof window?void 0:window)){if(!e)return"desktop";const t="function"==typeof e.matchMedia&&e.matchMedia("(pointer: coarse)").matches,n=e.innerWidth;return n<600?"mobile":t&&n<1280?"tablet":"desktop"}(window);let c=!1;const d=()=>{for(const e of r.drain())oe(e,n,a)},l=e=>{c||n.anonymous||(r.addError(e),r.size>=50&&d())},u=(e,t)=>{return{type:"error",source:t,name:te(e),message:(a=e,i=a instanceof Error?a.message:"string"==typeof a?a:a&&"object"==typeof a&&"string"==typeof a.message?a.message:"",i.slice(0,640).replace(V,"[redacted]").replace(J,"[redacted]").replace(K,"[url]").replace(D,"[id]").replace(G,"[n]").replace(/\s+/g," ").trim().slice(0,160)),frames:ee(e instanceof Error?e.stack:void 0),route:ne(n.routeKey()),count:1};var i,a};i&&(n.observeVitals??se)(e=>{c||(r.addVital(function(e,t,n,i){return{type:"vital",name:e.name,value:e.value,route:re.has(e.name)?t:n(),navigation:e.navigationType??"navigate",device:i}}(e,o,()=>ne(n.routeKey()),s)),r.size>=50&&d())});const f=n.anonymous?()=>{}:function(t,n){const i=e=>{const{error:i,message:a,filename:r,lineno:o,colno:s}=e;if(null!=i)return void t(n(i,"onerror"));const c=r?ee(`at ${r}:${o??0}:${s??0}`):[];t({...n(a??"","onerror"),frames:c})},a=e=>t(n(e.reason,"unhandledrejection"));window.addEventListener("error",i),window.addEventListener("unhandledrejection",a);const r=e(e=>t(n(e,"boundary")));return()=>{window.removeEventListener("error",i),window.removeEventListener("unhandledrejection",a),r()}}(l,u),h=()=>{"hidden"===document.visibilityState&&d()};document.addEventListener("visibilitychange",h),window.addEventListener("pagehide",d);const g=window.setInterval(d,n.flushIntervalMs??6e4),v={flush:d,reportError:e=>l(u(e,"boundary")),stop(){c||(d(),c=!0,f(),document.removeEventListener("visibilitychange",h),window.removeEventListener("pagehide",d),window.clearInterval(g),ae===v&&(ae=null))}};return ae=v,v}export{ce as startClientTelemetry};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import{AccessibleTable as e}from"./chunk-ZDFMYAQB.js";import{
|
|
1
|
+
import{AccessibleTable as e}from"./chunk-ZDFMYAQB.js";import{polygonPoints as t}from"./chunk-VFC6QUEN.js";import{ChartDefs as r,maskId as l}from"./chunk-465RRWBY.js";import{useHighlight as a}from"./chunk-CNYAHYE6.js";import{angleScale as o}from"./chunk-2JWPNR2U.js";import{ChartTooltip as n}from"./chunk-WDQI3FV6.js";import{CHART_INK as i,resolveSeriesColorWithin as s}from"./chunk-TZFACUMR.js";import{useShellStrings as m,useShellLocale as c}from"./chunk-IUVGHHR3.js";import{formatPlain as h}from"./chunk-C3QOHMR6.js";import{useId as p,useState as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";var k=3,g=e=>`${e.map(([e,t],r)=>`${0===r?"M":"L"}${e.toFixed(2)},${t.toFixed(2)}`).join(" ")} Z`;function x({axes:k,series:x,size:y=300,mode:b="area",grid:v="polygon",rings:M=4,formatValue:N,animate:j=!0,className:$,emptyLabel:F}){const W=m().charts,C=c(),R=N??(e=>h(e,C)),w=F??W.nothingToCompare,A=p(),[H,L]=u(null),{highlighted:Q}=a(),U=x;if(k.length<3||0===U.length)/* @__PURE__ */
|
|
2
2
|
return d("p",{className:`text-sm text-gray-500 ${$??""}`,children:w});const V=y/2,Y=y/2,z=y/2-46,B=o(k.length),E=k.map((e,t)=>null!=e.max&&Number.isFinite(e.max)&&e.max>0?e.max:Math.max(1,...U.map(e=>e.values[t]??0).filter(Number.isFinite))),T=(e,t)=>{const r=Math.max(0,Math.min(1,t/E[e])),l=B.center(e)-B.step/2;return[V+z*r*Math.cos(l),Y+z*r*Math.sin(l)]},Z=(e,t)=>null!==H?H!==e:null!==Q&&Q!==t,D=null!==H?U[H]:void 0;/* @__PURE__ */
|
|
3
3
|
return f("div",{className:`relative ${$??""}`,children:[
|
|
4
4
|
/* @__PURE__ */f("svg",{width:"100%",height:y,viewBox:`0 0 ${y} ${y}`,role:"img","aria-labelledby":A,onMouseLeave:()=>L(null),children:[
|
|
5
|
-
/* @__PURE__ */d("title",{id:A,children:W.acrossMeasures(U.map(e=>e.label),k.length)}),Array.from({length:M},(e,
|
|
5
|
+
/* @__PURE__ */d("title",{id:A,children:W.acrossMeasures(U.map(e=>e.label),k.length)}),Array.from({length:M},(e,r)=>{const l=z*(r+1)/M;return"circle"===v?/* @__PURE__ */d("circle",{cx:V,cy:Y,r:l,fill:"none",stroke:i.grid,strokeWidth:1},r):/* @__PURE__ */d("path",{d:g(t(V,Y,l,k.length)),fill:"none",stroke:i.grid,strokeWidth:1},r)}),k.map((e,t)=>{const[r,l]=T(t,E[t]);/* @__PURE__ */
|
|
6
6
|
return f("g",{children:[
|
|
7
7
|
/* @__PURE__ */d("line",{x1:V,y1:Y,x2:r,y2:l,stroke:i.grid,strokeWidth:1}),
|
|
8
8
|
/* @__PURE__ */d("text",{x:V+(z+18)*Math.cos(B.center(t)-B.step/2),y:Y+(z+18)*Math.sin(B.center(t)-B.step/2)+4,textAnchor:"middle",fontSize:11,fill:i.label,children:e.label})]},e.key)}),
|
|
9
|
-
/* @__PURE__ */d(
|
|
10
|
-
return f("g",{opacity:Z(t,e.key)?.3:1,onMouseEnter:()=>L(t),mask:j?`url(#${
|
|
11
|
-
/* @__PURE__ */d("path",{d:g(a),fill:"none",stroke:
|
|
9
|
+
/* @__PURE__ */d(r,{id:A,reveal:!!j&&"center-out"}),U.map((e,t)=>{const r=s(t,3,e.color,e.tone),a=k.map((t,r)=>T(r,e.values[r]??0));/* @__PURE__ */
|
|
10
|
+
return f("g",{opacity:Z(t,e.key)?.3:1,onMouseEnter:()=>L(t),mask:j?`url(#${l(A)})`:void 0,children:["area"===b&&/* @__PURE__ */d("path",{d:g(a),fill:r,fillOpacity:.18,stroke:"none"}),
|
|
11
|
+
/* @__PURE__ */d("path",{d:g(a),fill:"none",stroke:r,strokeWidth:2,strokeLinejoin:"round"}),a.map(([e,t],l)=>/* @__PURE__ */d("circle",{cx:e,cy:t,r:3.5,fill:r,stroke:i.surface,strokeWidth:1.5},l))]},e.key)})]}),D&&/* @__PURE__ */d("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */d(n,{title:D.label,rows:k.map((e,t)=>({key:e.key,label:e.label,color:s(H,3,D.color,D.tone),value:R(D.values[t]??0)}))})}),
|
|
12
12
|
/* @__PURE__ */d("ul",{className:"m-0 mt-3 grid gap-1 p-0",style:{gridTemplateColumns:"repeat(auto-fit,minmax(140px,1fr))"},children:U.map((e,t)=>/* @__PURE__ */f("li",{className:"flex list-none items-center gap-2 text-xs text-gray-600",children:[
|
|
13
13
|
/* @__PURE__ */d("span",{className:"h-2.5 w-2.5 shrink-0 rounded-sm",style:{backgroundColor:s(t,3,e.color,e.tone)}}),
|
|
14
14
|
/* @__PURE__ */d("span",{className:"flex-1 truncate",children:e.label})]},e.key))}),
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import{copyToClipboard as e,selectionAt as t}from"./chunk-UFX7F3KG.js";import{useTableNav as n}from"./chunk-ATMJ5ZPK.js";import{escapeHtml as r}from"./chunk-G6DKCCWH.js";import{ListFooter as o}from"./chunk-DO3DSSAW.js";import{ListLoadError as l}from"./chunk-MVOYVN3S.js";import{ResizableTable as i}from"./chunk-
|
|
2
|
-
return x(l,{title:
|
|
3
|
-
/* @__PURE__ */x("div",{ref:
|
|
1
|
+
import{copyToClipboard as e,selectionAt as t}from"./chunk-UFX7F3KG.js";import{useTableNav as n}from"./chunk-ATMJ5ZPK.js";import{escapeHtml as r}from"./chunk-G6DKCCWH.js";import{ListFooter as o}from"./chunk-DO3DSSAW.js";import{ListLoadError as l}from"./chunk-MVOYVN3S.js";import{ResizableTable as i}from"./chunk-J4CVYOY3.js";import{Checkbox_default as a}from"./chunk-CGZBDI6C.js";import{LoadingSpinner as c}from"./chunk-4U5M37SF.js";import{PopupMenu as d,PopupMenuLabel as s,PopupMenuItem as h,PopupMenuDivider as m}from"./chunk-THAPVKEJ.js";import{keepsNativeMenu as u}from"./chunk-5QFPTDQF.js";import{LoadingSpinner as p}from"./chunk-R2VKEMZH.js";import{shellHttp as f}from"./chunk-STKJA4PV.js";import{toast_default as g}from"./chunk-VQ35LXDC.js";import{useShellStrings as y}from"./chunk-IUVGHHR3.js";import{useState as k,useRef as b}from"react";import{jsx as x,Fragment as w,jsxs as C}from"react/jsx-runtime";function j(e){return Array.from(e.children).filter(e=>void 0!==e.dataset?.colKey&&"_select"!==e.dataset.colKey)}function v(e){return("string"==typeof e.innerText?e.innerText:e.textContent??"").replace(/\s+/g," ").trim()}function S(S){const{items:R,isLoading:N,emptyState:L,totalCount:$,isError:A,onRetry:T,errorTitle:K,errorMessage:M,tableId:E,columns:F,renderCell:D,getRowId:P=e=>e.id,sort:U,onSort:V,selected:H,setSelected:I,onRowClick:O,onRowHover:J,getRowClassName:W,footerLabel:G,footerExtra:Y,footerExtraAfter:_,sentinelRef:B,isFetchingNextPage:Q,saveDefaultPerms:X,exportEndpoint:Z,exportFilename:z="export.csv",contextActions:q}=S,[ee,te]=k(null),ne=b(null),re=y(),oe=re.entityList,le=e=>{I(t=>{const n=new Set(t),r=P(e);return n.has(r)?n.delete(r):n.add(r),n})},ie=()=>{I(e=>{const t=R.map(P),n=new Set(e);return t.every(t=>e.has(t))?t.forEach(e=>n.delete(e)):t.forEach(e=>n.add(e)),n})},ae=n(R,O,le,ie,(e,t)=>{I(n=>{const r=new Set(n);for(let n=e;n<=t;n++)r.add(P(R[n]));return r})},ne),ce=R.filter(e=>H.has(P(e))),de=()=>{const e=[...ne.current?.querySelectorAll("tr[data-row-idx]")??[]].filter(e=>{const t=R[Number(e.dataset.rowIdx)];return void 0!==t&&H.has(P(t))}),t=e.length?j(e[0]).map(e=>e.dataset.colKey??""):[],n=new Map(F.map(e=>[e.key,e.label]));return{keys:t,header:t.map(e=>n.get(e)??e),body:e.map(e=>j(e).map(v))}},se=()=>{te(null);const{header:t,body:n}=de();if(!n.length)return;const o=[t,...n].map(e=>e.join("\t")).join("\n"),l="<table><thead><tr>"+t.map(e=>`<th>${r(e)}</th>`).join("")+"</tr></thead><tbody>"+n.map(e=>`<tr>${e.map(e=>`<td>${r(e)}</td>`).join("")}</tr>`).join("")+"</tbody></table>";e(oe.copiedRows(n.length),o,l)},he=async()=>{te(null);const e=ce.map(P);if(!e.length||!Z)return;const t=new URLSearchParams({ids:e.join(",")}),n=(()=>{const e=new Map(F.map(e=>[e.key,e.exportLabel??e.label]));try{const t=localStorage.getItem(`col-config-${E}`);if(t){const n=JSON.parse(t).filter(t=>!t.hidden&&"_select"!==t.key&&e.has(t.key)).map(t=>`${t.key}|${e.get(t.key)}`);if(n.length)return n.join(",")}}catch{}return F.filter(e=>!e.defaultHidden).map(e=>`${e.key}|${e.exportLabel??e.label}`).join(",")})();n&&t.set("cols",n);const r=Z.includes("?")?"&":"?";try{const n=await f.get(`${Z}${r}${t}`,{responseType:"blob"}),o=window.URL.createObjectURL(new Blob([n.data],{type:"text/csv"})),l=document.createElement("a");l.href=o,l.download=z,l.click(),window.URL.revokeObjectURL(o);const i=n.headers??{},a=Number(i["x-row-count"]);if("true"===String(i["x-truncated"]))return void g.notify(Number.isFinite(a)?oe.exportTruncated(a,e.length):oe.exportTruncatedUnknown(e.length));g.success(oe.exported(e.length))}catch{g.error(oe.exportFailed)}};if(N)/* @__PURE__ */return x(c,{});if(A&&0===R.length)/* @__PURE__ */
|
|
2
|
+
return x(l,{title:K,message:M,onRetry:T});if(0===R.length)/* @__PURE__ */return x(w,{children:L});const me=R.length>0&&ce.length===R.length,ue=ce.length>0&&!me,pe=H.size-ce.length,fe=[{key:"_select",label:"",defaultWidth:52,minWidth:52,headerNode:/* @__PURE__ */x(a,{"aria-label":re.table.selectAll,checked:me,indeterminate:ue,onChange:ie,style:{height:14,width:14}})},...F],ge=/* @__PURE__ */x(o,{selectedCount:ce.length,hiddenSelectedCount:pe,loadedCount:R.length,totalCount:$,label:G,isFetchingMore:Q,extra:Y,extraAfter:_}),ye=B?/* @__PURE__ */C(w,{children:[
|
|
3
|
+
/* @__PURE__ */x("div",{ref:B}),Q&&/* @__PURE__ */x(p,{size:"sm",padding:"py-3",label:re.list.loadingMore})]}):void 0;let ke=null;if(ee){const{x:t,y:n,item:r,text:o,firstColumn:l}=ee,i=q?q(ce):[],a=ce.length,c=()=>te(null),u=void 0!==$&&$>R.length;ke=/* @__PURE__ */C(d,{portal:!0,style:{left:t,top:n},onClose:c,minWidth:210,children:[
|
|
4
4
|
/* @__PURE__ */x(s,{children:pe>0?re.list.selectedNotShown(a,pe):re.list.selected(a)}),
|
|
5
5
|
/* @__PURE__ */x(h,{className:"font-medium",onClick:()=>{c(),O(r)},children:oe.open}),
|
|
6
6
|
/* @__PURE__ */x(m,{}),o&&/* @__PURE__ */x(h,{onClick:()=>{c(),e(oe.copiedText,o.text,o.html)},children:oe.copy}),l&&/* @__PURE__ */x(h,{onClick:()=>(t=>{te(null);const{keys:n,body:r}=de(),o=n.indexOf(t.key);o<0||!r.length||e(t.label,r.map(e=>e[o]).join("\n"))})(l),children:oe.copyColumn(l.label)}),
|
|
7
7
|
/* @__PURE__ */x(h,{disabled:0===a,onClick:se,children:oe.copyRows(a)}),Z&&/* @__PURE__ */x(h,{onClick:he,children:oe.exportSelected}),i.map((e,t)=>/* @__PURE__ */C("div",{children:[(e.divider||0===t)&&/* @__PURE__ */x(m,{}),
|
|
8
8
|
/* @__PURE__ */x(h,{danger:e.danger,disabled:e.disabled,onClick:()=>{c(),e.onClick(ce)},children:e.label})]},t)),
|
|
9
|
-
/* @__PURE__ */x(m,{}),!me&&/* @__PURE__ */x(h,{onClick:()=>{c(),
|
|
10
|
-
/* @__PURE__ */x(h,{onClick:()=>{c(),
|
|
9
|
+
/* @__PURE__ */x(m,{}),!me&&/* @__PURE__ */x(h,{onClick:()=>{c(),I(e=>/* @__PURE__ */new Set([...e,...R.map(P)]))},children:u?oe.selectAllLoaded(R.length):oe.selectAll}),
|
|
10
|
+
/* @__PURE__ */x(h,{onClick:()=>{c(),I(/* @__PURE__ */new Set)},children:oe.clearSelection}),T&&/* @__PURE__ */x(h,{onClick:()=>{c(),T()},children:oe.refresh})]})}/* @__PURE__ */
|
|
11
11
|
return C("div",{className:"flex-1 flex flex-col mb-1 bg-white rounded-lg shadow overflow-hidden",children:[
|
|
12
|
-
/* @__PURE__ */x("div",{className:"flex-1 min-h-0 flex flex-col",children:/* @__PURE__ */x(i,{tableId:
|
|
13
|
-
return x("tr",{"data-row-idx":r,className:`cursor-pointer ${ae===r?"bg-blue-50 ring-1 ring-inset ring-blue-300":
|
|
12
|
+
/* @__PURE__ */x("div",{className:"flex-1 min-h-0 flex flex-col",children:/* @__PURE__ */x(i,{tableId:E,columns:fe,sort:U,onSort:V,footer:ge,afterBody:ye,saveDefaultPerms:X,children:e=>/* @__PURE__ */x("tbody",{ref:ne,className:"divide-y divide-gray-100",children:R.map((n,r)=>{const o=P(n);/* @__PURE__ */
|
|
13
|
+
return x("tr",{"data-row-idx":r,className:`cursor-pointer ${ae===r?"bg-blue-50 ring-1 ring-inset ring-blue-300":H.has(o)?"bg-blue-50 hover:bg-blue-100":"hover:bg-gray-50"} ${W?.(n)??""}`,onClick:()=>O(n),onContextMenu:e=>((e,n)=>{if(e.shiftKey||u(e.target))return;e.preventDefault();const r=P(n);H.has(r)||I(/* @__PURE__ */new Set([r]));const o=j(e.currentTarget)[0]?.dataset.colKey,l=o?F.find(e=>e.key===o)?.label:void 0;te({x:e.clientX,y:e.clientY,item:n,text:t(e.target),firstColumn:o&&l?{key:o,label:l}:null})})(e,n),onMouseEnter:J?()=>J(n):void 0,children:e.map(e=>/* @__PURE__ */x("td",{"data-col-key":e.key,className:"px-4 py-3 whitespace-nowrap text-sm overflow-hidden",children:"_select"===e.key?/* @__PURE__ */x(a,{"aria-label":re.table.selectRow,checked:H.has(o),onChange:()=>le(n),onClick:e=>e.stopPropagation(),style:{height:14,width:14}}):D(n,e.key)},e.key))},o)})})})}),ke]})}export{S as EntityList};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{CountBadge as e}from"./chunk-5HFKVEWW.js";import{
|
|
1
|
+
import{CountBadge as e}from"./chunk-5HFKVEWW.js";import{isShown as i}from"./chunk-HCP7WOAL.js";import{SettingRowNameContext as n,SettingAutoContext as a}from"./chunk-2NMW66P5.js";import{useShellStrings as t}from"./chunk-IUVGHHR3.js";import{isValidElement as l}from"react";import{jsx as s,jsxs as r,Fragment as d}from"react/jsx-runtime";var c={pad:"p-4",gap:"gap-4",text:"text-sm",bodyTop:"mt-4",bodyPad:"pt-3"},m=e=>Array.isArray(e)?e.some(m):l(e);function o({label:l,icon:o,action:h,value:u,readout:f,changed:p=!1,description:x,children:N,controlId:v,labelId:g,unknownText:b="—",quiet:y=!1,size:k="default",viewState:w,divider:$=!0,showWhen:j,values:P,context:W,className:H=""}){const V=t();if(!i(j,P,W))return null;const A="auto"===w?/* @__PURE__ */s("span",{"data-setting-auto":"","aria-hidden":"true",className:"shrink-0 rounded-sm border border-line px-1 text-2xs font-normal leading-4 text-ink-faint",children:V.settingView.auto}):"edited"===w?/* @__PURE__ */r("span",{"data-setting-edited":"",className:"inline-flex shrink-0 items-center",children:[
|
|
2
2
|
/* @__PURE__ */s("span",{"aria-hidden":"true",className:"inline-flex",children:/* @__PURE__ */s(e,{dot:!0,tone:"accent"})}),
|
|
3
|
-
/* @__PURE__ */s("span",{className:"sr-only",children:V.settingView.edited})]}):null,F=null!=f&&!1!==f;if("compact"===k){const e=m(u),
|
|
4
|
-
/* @__PURE__ */s("span",{className:"es-field-label",id:t,children:l}),A]}),y=e=>/* @__PURE__ */s(
|
|
3
|
+
/* @__PURE__ */s("span",{className:"sr-only",children:V.settingView.edited})]}):null,F=null!=f&&!1!==f;if("compact"===k){const e=m(u),i=m(h);if(!e&&!i)return null;const t=g,c=["es-field"];e||c.push("is-inline"),p&&c.push("is-changed"),H&&c.push(H);const b=/* @__PURE__ */r(d,{children:[null!=o&&/* @__PURE__ */s("span",{className:"es-field-icon","aria-hidden":"true",children:o}),
|
|
4
|
+
/* @__PURE__ */s("span",{className:"es-field-label",id:t,children:l}),A]}),y=e=>/* @__PURE__ */s(n.Provider,{value:t,children:/* @__PURE__ */s(a.Provider,{value:"auto"===w,children:e})});/* @__PURE__ */
|
|
5
5
|
return r("div",{className:c.join(" "),children:[
|
|
6
|
-
/* @__PURE__ */r("div",{className:"es-field-head",children:[v?/* @__PURE__ */s("label",{className:"es-field-name",htmlFor:v,children:b}):/* @__PURE__ */s("span",{className:"es-field-name",children:b}),F&&/* @__PURE__ */s("span",{className:"es-field-value",children:f}),
|
|
6
|
+
/* @__PURE__ */r("div",{className:"es-field-head",children:[v?/* @__PURE__ */s("label",{className:"es-field-name",htmlFor:v,children:b}):/* @__PURE__ */s("span",{className:"es-field-name",children:b}),F&&/* @__PURE__ */s("span",{className:"es-field-value",children:f}),i&&y(h)]}),e&&/* @__PURE__ */s("div",{className:"es-field-ctl",children:y(u)}),x?/* @__PURE__ */s("p",{className:"es-field-hint",children:x}):null,N]})}const I=c,T=void 0!==u||void 0===N&&null==h,q=null==u||""===u,z=y?"text-gray-500":"text-gray-800",B=q?"text-gray-400":y?"text-gray-500":"text-gray-900",C=`${I.text} font-medium ${z}`,E=v?/* @__PURE__ */s("label",{htmlFor:v,id:g,className:C,children:l}):/* @__PURE__ */s("span",{id:g,className:C,children:l}),G=/* @__PURE__ */s(n.Provider,{value:g,children:/* @__PURE__ */s(a.Provider,{value:"auto"===w,children:q?b:u})}),K=[$?"border-t border-line-subtle first:border-t-0":"",I.pad,H].filter(Boolean).join(" "),L=null!=N&&!1!==N&&/* @__PURE__ */s("div",{className:`${I.bodyTop} border-t border-line-subtle ${I.bodyPad}`,children:N});/* @__PURE__ */
|
|
7
7
|
return r("div",F?{className:K,children:[
|
|
8
8
|
/* @__PURE__ */r("div",{"data-setting-line":"",className:"flex flex-wrap items-center justify-between gap-x-2 gap-y-2",children:[
|
|
9
9
|
/* @__PURE__ */s("div",{className:"flex-1 basis-0",children:/* @__PURE__ */r("div",{className:`flex min-w-0 items-center gap-2 ${z}`,children:[null!=o&&/* @__PURE__ */s("span",{"aria-hidden":"true",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:o}),E,A]})}),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r="13.20.0",a=r;export{a as APP_VERSION,r as VERSION};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{SidebarLayout as e}from"./chunk-
|
|
1
|
+
import{SidebarLayout as e}from"./chunk-2TXQCA4C.js";import{Avatar as t}from"./chunk-W2TPXKCV.js";import{ItemCount as r}from"./chunk-SXHV5OLA.js";import{Button_default as a}from"./chunk-UTISUEO4.js";import{useState as i}from"react";import{jsx as l,jsxs as n}from"react/jsx-runtime";var s=[{id:"inbox",label:"Inbox",count:12},{id:"starred",label:"Starred",count:3},{id:"sent",label:"Sent"},{id:"drafts",label:"Drafts",count:1},{id:"archive",label:"Archive"},{id:"trash",label:"Trash"}],d=[{id:1,from:"Marco Reyes",subject:"Q3 roadmap review",preview:"Sharing the deck ahead of Thursday — let me know what you think before the review.",time:"9:14",unread:!0},{id:2,from:"Priya Patel",subject:"Design handoff",preview:"The Figma file is ready for engineering. I exported every icon at 1x and 2x.",time:"8:02",unread:!0},{id:3,from:"GitHub",subject:"[acme/web] PR #482 merged",preview:"Your pull request was merged into main by the release bot after all checks passed.",time:"Yest"},{id:4,from:"Sara Lind",subject:"Lunch Friday?",preview:"A few of us are heading to the new place on 5th at noon if you want to join.",time:"Yest"}];function c(){const[c,o]=i(1),m=d.find(e=>e.id===c)??d[0];/* @__PURE__ */
|
|
2
2
|
return l("div",{className:"h-full",children:/* @__PURE__ */l(e,{side:"left",defaultWidth:200,sidebar:/* @__PURE__ */n("div",{className:"flex h-full flex-col p-2",children:[
|
|
3
3
|
/* @__PURE__ */l(a,{block:!0,className:"mb-2",children:"Compose"}),s.map((e,t)=>/* @__PURE__ */n("button",{className:"flex items-center justify-between rounded-md px-3 py-2 text-left text-sm "+(0===t?"bg-blue-50 font-medium text-blue-700":"text-gray-700 hover:bg-gray-100"),children:[
|
|
4
4
|
/* @__PURE__ */l("span",{children:e.label}),null!=e.count&&/* @__PURE__ */l(r,{count:e.count,active:0===t})]},e.id))]}),children:/* @__PURE__ */n("div",{className:"flex h-full",children:[
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{formatMoney as e}from"./chunk-OJI4ROSD.js";import{EMPTY_VALUE as r}from"./chunk-36BRD5J3.js";import{TimeSeriesChart as t}from"./chunk-
|
|
1
|
+
import{formatMoney as e}from"./chunk-OJI4ROSD.js";import{EMPTY_VALUE as r}from"./chunk-36BRD5J3.js";import{TimeSeriesChart as t}from"./chunk-ABPVCVCT.js";import{ChartFrame as a}from"./chunk-G5UGCAWN.js";import{ColumnChart as l}from"./chunk-G7SILKUY.js";import{TH_ONE_LINE as s}from"./chunk-TD3ZQD5R.js";import{jsxs as o,jsx as i}from"react/jsx-runtime";function n({spec:n,height:c=200,width:m,animate:d=!0,className:h}){const u=function(r){if(r.currency)return t=>e(t,r.currency);const t=r.unit?` ${r.unit}`:"";return e=>`${e.toLocaleString("en-US",{maximumFractionDigits:2})}${t}`}(n),p=n.currency?r=>e(r,n.currency,{whole:!0}):u,b=n.series.map((e,r)=>({key:`s${r}`,label:e.name,data:e.values})),y=n.title??n.series.map(e=>e.name).join(", "),f=/* @__PURE__ */o("table",{className:"w-full border-collapse text-sm",children:[
|
|
2
2
|
/* @__PURE__ */i("thead",{children:/* @__PURE__ */o("tr",{children:[
|
|
3
3
|
/* @__PURE__ */i("td",{className:"border-b border-gray-200"}),n.series.map((e,r)=>/* @__PURE__ */i("th",{scope:"col",className:`${s} border-b border-gray-200 px-2 py-1 text-right font-semibold text-gray-700`,children:e.name},r))]})}),
|
|
4
4
|
/* @__PURE__ */i("tbody",{children:n.x.map((e,t)=>/* @__PURE__ */o("tr",{children:[
|
|
5
5
|
/* @__PURE__ */i("th",{scope:"row",className:`${s} border-t border-gray-100 px-2 py-1 text-left font-normal text-gray-700`,children:e}),n.series.map((e,a)=>{const l=e.values[t];/* @__PURE__ */
|
|
6
6
|
return i("td",{className:"border-t border-gray-100 px-2 py-1 text-right tabular-nums text-gray-700",children:null===l?r:u(l)},a)})]},t))})]});/* @__PURE__ */
|
|
7
|
-
return i(
|
|
7
|
+
return i(a,{title:y,legend:b.map(e=>({key:e.key,label:e.label,swatch:"line"===n.type?"bar":"square"})),table:f,className:h,children:"line"===n.type?/* @__PURE__ */i(t,{series:b,labels:n.x,height:c,width:m,animate:d,dots:"all",formatValue:p,formatTooltipValue:u}):/* @__PURE__ */i(l,{series:b,labels:n.x,stacked:n.stacked,height:c,width:m,animate:d,formatValue:p,formatTooltipValue:u})})}export{n as SpecChart};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{client_default as a}from"./chunk-
|
|
1
|
+
import{client_default as a}from"./chunk-IXJIHTUI.js";var t=()=>a.get("/auth/numbering-configs/").then(a=>a.data?.results??a.data??[]),e="uploaded:wallpaper";function r(a,t){return"string"!=typeof a||!a||"none"===a||a.startsWith("#")?"":a===e?t||"":a}var l=()=>a.get("/auth/me/wallpaper/").then(a=>a.data),n=(t,e)=>{const r=new FormData;r.append("wallpaper",t);const l=e?{onUploadProgress:a=>e(a.total?Math.round(a.loaded/a.total*100):null)}:void 0;return a.post("/auth/me/wallpaper/",r,l).then(a=>a.data)},p=()=>a.delete("/auth/me/wallpaper/").then(a=>a.data);function o(a){const t=a?.response?.status,e=a?.response?.data,r=Array.isArray(e?.wallpaper)?e.wallpaper[0]:void 0;return r||(413===t?"That picture is too large to use as a wallpaper.":415===t?"That file is not a picture this can use as a wallpaper.":"The wallpaper could not be saved. Please try again.")}export{e as WALLPAPER_PREF_TOKEN,p as deleteWallpaper,t as getNumberingConfigs,l as getWallpaper,n as uploadWallpaper,r as wallpaperSrc,o as wallpaperUploadError};
|