efficient-shell 4.137.0 → 4.145.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/LICENSE +6 -17
- package/README.md +80 -12
- package/dist/Browser-24YNRTKT.js +43 -0
- package/dist/Calculator-LER6KUQC.js +29 -0
- package/dist/ConfirmDialog-GAYETRMG.js +1 -0
- package/dist/CurrencyConverter-Y35GFDFF.js +21 -0
- package/dist/Documents-7FYX2CGT.js +52 -0
- package/dist/Files-RZOML2N6.js +89 -0
- package/dist/Notepad-VVDCBDUA.js +25 -0
- package/dist/PdfViewer-CvLb2j_l.d.ts +40 -0
- package/dist/PdfViewer-ZCT3PYXU.js +1 -0
- package/dist/PomodoroTimer-VAM3AJOX.js +99 -0
- package/dist/Preview-HZ37D7QJ.js +187 -0
- package/dist/Sidebar-CVF7C6BO.js +23 -0
- package/dist/Spreadsheet-6WX3P6AB.js +37 -0
- package/dist/Stock-AUWI3TUX.js +16 -0
- package/dist/Weather-HU75TH7T.js +60 -0
- package/dist/WorldClock-T64MDRMJ.js +32 -0
- package/dist/apps/index.d.ts +3 -23
- package/dist/apps/index.js +1 -151
- package/dist/brand.css +1 -1
- package/dist/chunk-2RHMSFZV.js +9 -0
- package/dist/chunk-4FS742BM.js +1 -0
- package/dist/chunk-57MIENLJ.js +1 -0
- package/dist/chunk-7DAQ3WVP.js +106 -0
- package/dist/chunk-BR22X7E5.js +1 -0
- package/dist/chunk-BUTSU7FO.js +1 -0
- package/dist/chunk-CVTOZCM3.js +24 -0
- package/dist/chunk-D65T4H6J.js +1 -0
- package/dist/chunk-ESL5TDNA.js +1 -0
- package/dist/chunk-FBDZGO3V.js +1 -0
- package/dist/chunk-FHTLC7HH.js +1 -0
- package/dist/chunk-GDSGXDET.js +34 -0
- package/dist/chunk-I55UMU3R.js +6 -0
- package/dist/chunk-KKOHUQPF.js +1 -0
- package/dist/chunk-L7TEFXIS.js +69 -0
- package/dist/chunk-LVDRBRYU.js +1 -0
- package/dist/chunk-LVFMK5OQ.js +29 -0
- package/dist/chunk-LWLCNQY7.js +1 -0
- package/dist/chunk-MAIHBBWT.js +1 -0
- package/dist/chunk-MU5H2CDL.js +2 -0
- package/dist/chunk-NBBOFQPL.js +947 -0
- package/dist/chunk-NPJH5MD7.js +13 -0
- package/dist/chunk-OCSOMMY2.js +1 -0
- package/dist/chunk-PH3PRIFP.js +5 -0
- package/dist/chunk-RJ4LACFH.js +9 -0
- package/dist/chunk-SLCR26NK.js +4 -0
- package/dist/chunk-TFKB2WEB.js +19 -0
- package/dist/chunk-TR6PLN7W.js +1 -0
- package/dist/chunk-TWV42Q3K.js +1 -0
- package/dist/chunk-UB22J6EF.js +1 -0
- package/dist/chunk-UB4JIOLD.js +2 -0
- package/dist/chunk-V453E4KU.js +11 -0
- package/dist/chunk-VTVSMRFX.js +1 -0
- package/dist/file-intake/index.js +1 -4
- package/dist/{index-DVI9DMSu.d.ts → index-NhR7frRu.d.ts} +189 -17
- package/dist/index.d.ts +2 -2
- package/dist/index.js +639 -7473
- package/dist/map/index.d.ts +266 -13
- package/dist/map/index.js +22 -540
- package/dist/markdown/index.js +6 -184
- package/dist/markup/index.js +1 -135
- package/dist/page-tabs/index.js +21 -709
- package/dist/pdf/index.d.ts +9 -0
- package/dist/pdf/index.js +2 -0
- package/dist/sounds-OMHXVVQ4.js +1 -0
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +1 -19
- package/dist/ui.css +7 -0
- package/package.json +9 -3
- package/dist/Browser-ZNX4WFUH.js +0 -482
- package/dist/Browser-ZNX4WFUH.js.map +0 -1
- package/dist/Calculator-6FGNKOXU.js +0 -192
- package/dist/Calculator-6FGNKOXU.js.map +0 -1
- package/dist/ConfirmDialog-NPQMIGUR.js +0 -4
- package/dist/ConfirmDialog-NPQMIGUR.js.map +0 -1
- package/dist/CurrencyConverter-FF7EXRYL.js +0 -236
- package/dist/CurrencyConverter-FF7EXRYL.js.map +0 -1
- package/dist/Documents-H3R7XSBH.js +0 -441
- package/dist/Documents-H3R7XSBH.js.map +0 -1
- package/dist/Files-ZHJIAUC2.js +0 -805
- package/dist/Files-ZHJIAUC2.js.map +0 -1
- package/dist/Notepad-VE7ISWRQ.js +0 -410
- package/dist/Notepad-VE7ISWRQ.js.map +0 -1
- package/dist/PdfViewer-SQBFYAGW.js +0 -5
- package/dist/PdfViewer-SQBFYAGW.js.map +0 -1
- package/dist/PomodoroTimer-IR3WREED.js +0 -633
- package/dist/PomodoroTimer-IR3WREED.js.map +0 -1
- package/dist/Preview-DAQGRNRM.js +0 -2959
- package/dist/Preview-DAQGRNRM.js.map +0 -1
- package/dist/Sidebar-YW6H4NDJ.js +0 -291
- package/dist/Sidebar-YW6H4NDJ.js.map +0 -1
- package/dist/Spreadsheet-HOCPHJOC.js +0 -519
- package/dist/Spreadsheet-HOCPHJOC.js.map +0 -1
- package/dist/Stock-LVRQPURG.js +0 -158
- package/dist/Stock-LVRQPURG.js.map +0 -1
- package/dist/Weather-LZQGVDJL.js +0 -431
- package/dist/Weather-LZQGVDJL.js.map +0 -1
- package/dist/WorldClock-XPD7WOZT.js +0 -202
- package/dist/WorldClock-XPD7WOZT.js.map +0 -1
- package/dist/apps/index.js.map +0 -1
- package/dist/chunk-5O42JXQE.js +0 -26
- package/dist/chunk-5O42JXQE.js.map +0 -1
- package/dist/chunk-5RPTS3BT.js +0 -70
- package/dist/chunk-5RPTS3BT.js.map +0 -1
- package/dist/chunk-6XJEJWNJ.js +0 -61
- package/dist/chunk-6XJEJWNJ.js.map +0 -1
- package/dist/chunk-7CCHEEYC.js +0 -94
- package/dist/chunk-7CCHEEYC.js.map +0 -1
- package/dist/chunk-BE7FZOFU.js +0 -17
- package/dist/chunk-BE7FZOFU.js.map +0 -1
- package/dist/chunk-COWYSHG2.js +0 -79
- package/dist/chunk-COWYSHG2.js.map +0 -1
- package/dist/chunk-D7PYW2QS.js +0 -265
- package/dist/chunk-D7PYW2QS.js.map +0 -1
- package/dist/chunk-DVZWYWSD.js +0 -26
- package/dist/chunk-DVZWYWSD.js.map +0 -1
- package/dist/chunk-E7TB6WD2.js +0 -153
- package/dist/chunk-E7TB6WD2.js.map +0 -1
- package/dist/chunk-FIHOGVUP.js +0 -416
- package/dist/chunk-FIHOGVUP.js.map +0 -1
- package/dist/chunk-GA35NEND.js +0 -56
- package/dist/chunk-GA35NEND.js.map +0 -1
- package/dist/chunk-HUBJAUGG.js +0 -316
- package/dist/chunk-HUBJAUGG.js.map +0 -1
- package/dist/chunk-I2TAAJHS.js +0 -465
- package/dist/chunk-I2TAAJHS.js.map +0 -1
- package/dist/chunk-ICTRCKUE.js +0 -3710
- package/dist/chunk-ICTRCKUE.js.map +0 -1
- package/dist/chunk-IPXN646P.js +0 -14
- package/dist/chunk-IPXN646P.js.map +0 -1
- package/dist/chunk-IRWSRJ4K.js +0 -48
- package/dist/chunk-IRWSRJ4K.js.map +0 -1
- package/dist/chunk-JOPU6WPY.js +0 -504
- package/dist/chunk-JOPU6WPY.js.map +0 -1
- package/dist/chunk-MGGY74RY.js +0 -14
- package/dist/chunk-MGGY74RY.js.map +0 -1
- package/dist/chunk-PVPPAWVM.js +0 -46
- package/dist/chunk-PVPPAWVM.js.map +0 -1
- package/dist/chunk-R7QGMK6N.js +0 -102
- package/dist/chunk-R7QGMK6N.js.map +0 -1
- package/dist/chunk-RT6DSB5Y.js +0 -143
- package/dist/chunk-RT6DSB5Y.js.map +0 -1
- package/dist/chunk-TRCWINHF.js +0 -105
- package/dist/chunk-TRCWINHF.js.map +0 -1
- package/dist/chunk-TW7LPMVR.js +0 -16
- package/dist/chunk-TW7LPMVR.js.map +0 -1
- package/dist/chunk-UTYKLGGT.js +0 -195
- package/dist/chunk-UTYKLGGT.js.map +0 -1
- package/dist/chunk-VNJJCH5A.js +0 -822
- package/dist/chunk-VNJJCH5A.js.map +0 -1
- package/dist/chunk-XJHZWSKV.js +0 -1103
- package/dist/chunk-XJHZWSKV.js.map +0 -1
- package/dist/chunk-Y3GYJ7YR.js +0 -549
- package/dist/chunk-Y3GYJ7YR.js.map +0 -1
- package/dist/chunk-YA4EE7ST.js +0 -14107
- package/dist/chunk-YA4EE7ST.js.map +0 -1
- package/dist/chunk-YDHXWCCJ.js +0 -145
- package/dist/chunk-YDHXWCCJ.js.map +0 -1
- package/dist/chunk-YE6GUDGP.js +0 -548
- package/dist/chunk-YE6GUDGP.js.map +0 -1
- package/dist/chunk-YNKK7NE3.js +0 -171
- package/dist/chunk-YNKK7NE3.js.map +0 -1
- package/dist/chunk-YPO6RDMX.js +0 -20
- package/dist/chunk-YPO6RDMX.js.map +0 -1
- package/dist/chunk-ZS7PMGUW.js +0 -7
- package/dist/chunk-ZS7PMGUW.js.map +0 -1
- package/dist/file-intake/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/map/index.js.map +0 -1
- package/dist/markdown/index.js.map +0 -1
- package/dist/markup/index.js.map +0 -1
- package/dist/page-tabs/index.js.map +0 -1
- package/dist/sounds-NT4DEZGD.js +0 -3
- package/dist/sounds-NT4DEZGD.js.map +0 -1
- package/dist/ui/index.js.map +0 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{onOverlayOpen as e,Z_LAYERS as t,registerModalEscapeInterceptor as n}from"./chunk-LVFMK5OQ.js";import{glassStyle as r,GLASS_DIVIDER as o}from"./chunk-57MIENLJ.js";import{useHydrated as i,useBrowserLayoutEffect as l}from"./chunk-D65T4H6J.js";import{createContext as a,forwardRef as u,useContext as s,useRef as c,useId as d,useState as p,useEffect as m,useMemo as f,useCallback as h}from"react";import{createPortal as g}from"react-dom";import{jsx as y,jsxs as x,Fragment as w}from"react/jsx-runtime";var v=/* @__PURE__ */new Set(["text","search","url","tel","email","password","number","date","datetime-local","month","week","time"]),b="data-native-context-menu";function k(e,t){return e&&"function"==typeof e.closest?e.closest(t):null}function C(e){const t=e;if(!t||"function"!=typeof t.closest)return!1;if(k(t,`[${b}]`))return!0;if(k(t,"textarea"))return!0;if(k(t,"img, picture, canvas, video, audio"))return!0;const n=k(t,"input");if(n){const e=(n.type||"text").toLowerCase();if(v.has(e))return!0}const r=k(t,"[contenteditable]");if(r){const e=(r.getAttribute("contenteditable")||"").toLowerCase();if(""===e||"true"===e||"plaintext-only"===e)return!0}return!1}var N=/* @__PURE__ */new Set(["http:","https:","mailto:","tel:","blob:"]);function L(e,t,n){const r=k(e,"a[href]"),o=(t||"").trim(),i=function(e,t){if(e&&"#"!==e)try{const n=new URL(e,t??("undefined"!=typeof document?document.baseURI:void 0));return N.has(n.protocol)?n.href:void 0}catch{return}}(r?.getAttribute("href"),n);return{kind:o?"selection":i?"link":"default",...o?{selectionText:o}:{},...i?{linkUrl:i}:{}}}function M(e,t,n){return e.length===t+1&&e[t].key===n.key?e:[...e.slice(0,t),n]}function E(e,t){const n=Math.max(0,t);return e.length>n?e.slice(0,n):e}function T(e,t,n){if(0===t.length||0===e.length)return[];const r=[e];for(let e=1;e<t.length;e++){const o=r[e-1].find(n=>n.to===t[e].key),i=o?n(o):[];if(0===i.length)break;r.push(i)}return r}function $(e,t,n,r){const o=Math.max(0,r-n),i=Math.min(t,o),l=e-i/2;return l<n?n:l+i>r?Math.max(n,r-i):l}function B(e,t,n,r,o,i=!1,l=8){const a=t+o,u=e-o-n,s=u>=l;return i&&s?{left:u,flipped:!0}:a+n<=r-l?{left:a,flipped:!1}:s?{left:u,flipped:!0}:i?{left:l,flipped:!0}:{left:Math.max(l,r-l-n),flipped:!1}}function A(){try{return getComputedStyle(document.documentElement).getPropertyValue("--menu-density")?.trim()||"normal"}catch{return"normal"}}var R=a(null);function W({children:n,style:o,className:l="",onClose:a,minWidth:u=180,portal:s=!1}){const h=c(null),x=d(),[w,v]=p([]),b=c();m(()=>()=>clearTimeout(b.current),[]);const k=i(),N=f(()=>{const e=()=>clearTimeout(b.current);return{id:x,depth:0,path:w,open:(t,n)=>{e(),v(e=>M(e,t,n))},scheduleClose:t=>{e(),b.current=setTimeout(()=>v(e=>E(e,t)),200)},closeBelow:t=>{e(),v(e=>E(e,t))},cancelClose:e,closeTree:()=>{e(),v([]),a?.()},root:h}},[x,w,a]);m(()=>{if(!a)return;const t=e=>{e.target.closest("[data-menu-toggle]")||e.target.closest?.(`[data-popup-menu-tree="${x}"]`)||h.current&&!h.current.contains(e.target)&&a()},n=e=>{"Escape"===e.key&&a()};window.addEventListener("pointerdown",t),window.addEventListener("keydown",n);const r=e(a);return()=>{window.removeEventListener("pointerdown",t),window.removeEventListener("keydown",n),r()}},[a,x]),m(()=>{const e=h.current;e&&requestAnimationFrame(()=>{const t=e.getBoundingClientRect();if(t.right>window.innerWidth-8){const n=t.right-window.innerWidth+8;e.style.left?e.style.left=parseFloat(e.style.left)-n+"px":e.style.right||(e.style.left=t.left-n+"px")}if(t.left<8&&(e.style.left?e.style.left="8px":e.style.right&&(e.style.right=window.innerWidth-t.width-8+"px")),t.bottom>window.innerHeight-8){const n=t.bottom-window.innerHeight+8;e.style.top?e.style.top=parseFloat(e.style.top)-n+"px":e.style.bottom?e.style.bottom="8px":e.style.top=t.top-n+"px"}t.top<8&&(e.style.top?e.style.top="8px":e.style.bottom&&(e.style.bottom=window.innerHeight-t.height-8+"px"))})});const L=A(),T=/(^|[\s:])!?z-/.test(l),$=/* @__PURE__ */y("div",{ref:h,"data-popup-menu-tree":x,className:`fixed rounded-2xl ${"tight"===L?"py-1":"large"===L?"py-2":"py-1.5"} ${l}`,onContextMenu:e=>{C(e.target)||e.preventDefault()},style:{...T?{}:{zIndex:t.menu},minWidth:u,animation:"popup-in 0.12s ease-out",...r(),...o},children:/* @__PURE__ */y(R.Provider,{value:N,children:n})});return s?k?g($,document.body):null:$}function D(e,t,n,r=!1){const o=A(),i="tight"===o?"0.25rem":"large"===o?"0.6rem":"max(0.25rem, calc(var(--menu-padding-y, 0.5rem) - 0.1rem))";return{className:`w-full flex items-center gap-2 text-left transition-colors rounded-lg mx-auto\n ${e?"text-red-600 hover:bg-red-50":r?"bg-blue-50 text-blue-700":"text-gray-700 hover:bg-blue-50 hover:text-blue-700"}\n ${t?"opacity-40 cursor-not-allowed":""}\n ${n}`,style:{width:"calc(100% - 8px)",marginLeft:4,marginRight:4,fontSize:"var(--menu-font-size, 14px)",paddingLeft:"var(--menu-padding-x, 1rem)",paddingRight:"var(--menu-padding-x, 1rem)",paddingTop:i,paddingBottom:i}}}var H=u(function({onClick:e,children:t,className:n="",danger:r,disabled:o,role:i,tabIndex:l,id:a,onMouseEnter:u},c){const d=s(R),p=D(r,o,n);/* @__PURE__ */
|
|
2
|
+
return y("button",{ref:c,id:a,role:i,tabIndex:l,onClick:()=>{e?.(),d&&d.depth>0&&d.closeTree()},onMouseEnter:()=>{d?.scheduleClose(d.depth),u?.()},disabled:o,className:p.className,style:p.style,children:t})}),F=/* @__PURE__ */y("svg",{"aria-hidden":!0,className:"h-3.5 w-3.5 shrink-0 ml-auto text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */y("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})});function I(e){let n=t.menu;for(let t=e;t&&t!==document.body;t=t.parentElement){const e=parseInt(getComputedStyle(t).zIndex,10);Number.isNaN(e)||(n=e)}return n}function P(e){return e?[...e.querySelectorAll("button:not([disabled])")].filter(t=>t.closest("[data-popup-submenu-panel]")===e):[]}function S({label:e,icon:t,children:o,disabled:i,className:a="",minWidth:u=180,maxHeight:p}){const v=s(R),b=d(),k=c(null),N=c(null),L=c(),M=c(!1),E=`${b}-menu`;m(()=>()=>clearTimeout(L.current),[]);const T=v?.depth??0,W=v?.path[T],H=!!W&&W.key===b&&!i,S=h(e=>{if(!v||i||!k.current)return;clearTimeout(L.current),M.current=e;const t=k.current.getBoundingClientRect(),n=k.current.closest("[data-popup-submenu-panel]")??k.current.closest("[data-popup-menu-tree]"),r=n?.getBoundingClientRect()??t,o=T>0&&(v.path[T-1]?.flipped??!1),l=B(r.left,r.right,u,window.innerWidth,4,o);v.open(T,{key:b,y:t.top,...l})},[v,i,T,b,u]),j=e=>{v?.closeBelow(T),k.current?.focus()};m(()=>{if(H)return n(e=>"Escape"===e.key&&(!(v&&v.path.length>T+1)&&(j(),!0)))}),l(()=>{if(!H||!W)return;const e=()=>{const e=N.current;if(!e||!k.current)return;const t=k.current.closest("[data-popup-submenu-panel]")??k.current.closest("[data-popup-menu-tree]"),n=t?.getBoundingClientRect()??k.current.getBoundingClientRect(),r=T>0&&(v?.path[T-1]?.flipped??!1),o=e.offsetWidth||u,i=B(n.left,n.right,o,window.innerWidth,4,r,8),l=e.offsetHeight,a=$(k.current.getBoundingClientRect().top+l/2,l,8,window.innerHeight-8);e.style.left=`${i.left}px`,e.style.top=`${a}px`,e.dataset.flipped=String(i.flipped)};e();let t=0;const n=requestAnimationFrame(()=>{t=requestAnimationFrame(e)});return()=>{cancelAnimationFrame(n),cancelAnimationFrame(t)}}),m(()=>{H&&M.current&&(M.current=!1,P(N.current)[0]?.focus())},[H]);const z=f(()=>v&&{...v,depth:T+1},[v,T]);if(!v)throw new Error("PopupSubmenu must be rendered inside a PopupMenu");const q=D(!1,i,a,H),U=A();/* @__PURE__ */
|
|
3
|
+
return x(w,{children:[
|
|
4
|
+
/* @__PURE__ */x("button",{ref:k,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":H,"aria-controls":H?E:void 0,disabled:i,"data-popup-submenu-row":!0,className:q.className,style:q.style,onClick:e=>{const t=0===e.detail;H?t&&P(N.current)[0]?.focus():S(t)},onKeyDown:e=>{"ArrowRight"===e.key&&(e.preventDefault(),e.stopPropagation(),S(!0))},onMouseEnter:()=>{i||(v.cancelClose(),H?v.closeBelow(T+1):(clearTimeout(L.current),L.current=setTimeout(()=>S(!1),120)))},onMouseLeave:()=>{clearTimeout(L.current),v.scheduleClose(T)},children:[t,
|
|
5
|
+
/* @__PURE__ */y("span",{className:"min-w-0 flex-1 truncate",children:e}),F]}),H&&g(
|
|
6
|
+
/* @__PURE__ */y("div",{ref:N,id:E,role:"menu","data-popup-menu-tree":v.id,"data-popup-submenu-panel":!0,className:"fixed rounded-2xl overflow-x-hidden overflow-y-auto overscroll-contain "+("tight"===U?"py-1":"large"===U?"py-2":"py-1.5"),style:{left:W.left,top:W.y,minWidth:u,maxHeight:void 0===p?"calc(100vh - 16px)":`min(${"number"==typeof p?`${p}px`:p}, calc(100vh - 16px))`,zIndex:I(v.root.current)+T+1,animation:(W.flipped?"popup-submenu-in-left":"popup-submenu-in")+" 0.1s ease-out",...r()},onKeyDown:e=>{if(e.target.closest("[data-popup-submenu-panel]")!==e.currentTarget)return;const t=P(N.current),n=t.indexOf(document.activeElement),r=n=>{e.preventDefault(),e.stopPropagation(),t[(n+t.length)%t.length]?.focus()};"ArrowDown"===e.key?r(n+1):"ArrowUp"===e.key?r(n<0?t.length-1:n-1):"Home"===e.key?r(0):"End"===e.key?r(t.length-1):"ArrowLeft"===e.key&&(e.preventDefault(),e.stopPropagation(),j())},onMouseEnter:()=>{v.cancelClose(),clearTimeout(L.current)},onMouseLeave:()=>v.scheduleClose(T+1),onContextMenu:e=>{C(e.target)||e.preventDefault()},children:/* @__PURE__ */y(R.Provider,{value:z,children:o})}),document.body)]})}function j(){const e=A();/* @__PURE__ */
|
|
7
|
+
return y("div",{className:`border-t ${o} ${"tight"===e?"my-0.5":"large"===e?"my-1.5":"my-1"} mx-3`})}function z({children:e}){const t=A(),n="tight"===t?"0.125rem":"large"===t?"0.375rem":"0.25rem";/* @__PURE__ */
|
|
8
|
+
return y("div",{className:"text-xs font-medium uppercase tracking-wide",style:{color:"var(--ink-muted)",paddingLeft:"var(--menu-padding-x, 1rem)",paddingRight:"var(--menu-padding-x, 1rem)",paddingTop:n,paddingBottom:n},children:e})}function q({d:e,className:t="h-4 w-4 text-gray-400"}){/* @__PURE__ */
|
|
9
|
+
return y("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */y("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})})}export{q as MenuIcon,b as NATIVE_MENU_ATTR,W as PopupMenu,j as PopupMenuDivider,H as PopupMenuItem,z as PopupMenuLabel,S as PopupSubmenu,$ as clampMenuTop,E as closeMenuBelow,L as describeContextTarget,D as itemLook,C as keepsNativeMenu,B as menuPanelLeft,M as openMenuLevel,T as resolveMenuLevels};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{setPdfPreview as e}from"./chunk-ESL5TDNA.js";import{toast_default as t}from"./chunk-KKOHUQPF.js";import{setSpreadsheetPreview as n}from"./chunk-VTVSMRFX.js";var i="react-os-shell:preview-opened";async function o(o){const{filePath:a,filename:r,kind:c,onStaged:s}=o;try{const o=await fetch(`${("undefined"!=typeof window&&window.__REACT_OS_SHELL_FILE_SERVER__||"http://localhost:4000").replace(/\/$/,"")}/api/file?path=${encodeURIComponent(a)}`,{credentials:"include"});if(!o.ok)return t.error(`Download failed (${o.status})`),!1;const d=await o.blob();if("csv"===c){const e=await d.text();n({csv:e,filename:r}),s?.("/spreadsheet")}else{const t=URL.createObjectURL(d);e({url:t,filename:r,kind:c}),s?.("/preview")}return"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent(i,{detail:{filePath:a,filename:r,kind:c}})),!0}catch(e){return t.error(e?.message||"Open failed"),!1}}export{i as PREVIEW_OPENED_EVENT,o as openPreviewFile};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{rootIsDark as r}from"./chunk-MAIHBBWT.js";function a(){try{const r=getComputedStyle(document.documentElement).getPropertyValue("--menu-opacity")?.trim();if(r)return parseFloat(r)}catch{}return.95}var s=r;function o(){try{return document.documentElement.classList.contains("rosh-reduce-transparency")}catch{return!1}}function t(r,a){return`color-mix(in srgb, ${r} ${+(Math.round(255*Math.min(1,Math.max(0,a)))/255*100).toFixed(4)}%, transparent)`}function e(r){const e=r??a();if(o())return{background:"var(--rosh-glass-surface)",border:"1px solid var(--rosh-glass-solid-border)",boxShadow:"var(--rosh-glass-solid-shadow)"};const n="var(--rosh-glass-surface)",u="var(--rosh-glass-surface-mid)";return s()?{background:`linear-gradient(135deg in srgb, ${t(n,.85*e)} 0%, ${t(u,.75*e)} 50%, ${t(n,.85*e)} 100%)`,backdropFilter:"blur(40px) saturate(1.6)",WebkitBackdropFilter:"blur(40px) saturate(1.6)",border:"1px solid var(--rosh-glass-border)",boxShadow:"var(--rosh-glass-shadow)"}:{background:`linear-gradient(135deg in srgb, ${t(n,.85*e)} 0%, ${t(u,.65*e)} 50%, ${t(n,.75*e)} 100%)`,backdropFilter:"blur(40px) saturate(1.8)",WebkitBackdropFilter:"blur(40px) saturate(1.8)",border:"1px solid var(--rosh-glass-border)",boxShadow:"var(--rosh-glass-shadow)"}}function n(r){return o()?"var(--rosh-glass-surface)":t("var(--rosh-glass-surface)",.85*(r??a()))}var u="border-white/20",d="glass-input-bg";export{u as GLASS_DIVIDER,d as GLASS_INPUT_BG,n as glassFill,e as glassStyle};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import{isStaleChunkError as e,CMD_Z as t,CMD_SHIFT_Z as n,LoadingSpinner as r,Result as o,useIsMobile as i,useShellPrefs as a}from"./chunk-V453E4KU.js";import{useShellAuth as l,navIcons as s}from"./chunk-UB4JIOLD.js";import{Button_default as c}from"./chunk-PH3PRIFP.js";import{PopupMenu as d,PopupMenuItem as u,PopupMenuDivider as h,PopupMenuLabel as m}from"./chunk-2RHMSFZV.js";import{Z_LAYERS as p,confirm as w,runEscapeInterceptors as f}from"./chunk-LVFMK5OQ.js";import{useShellStrings as y}from"./chunk-TR6PLN7W.js";import{createContext as g,Component as v,useContext as b,useLayoutEffect as x,useRef as k,useEffect as C,useState as E,useCallback as M,useSyncExternalStore as L,useMemo as N,isValidElement as S,cloneElement as T,useReducer as A,useId as z,Suspense as P}from"react";import{jsxs as I,jsx as D,Fragment as W}from"react/jsx-runtime";import{createPortal as $}from"react-dom";import{XMarkIcon as K}from"@heroicons/react/24/outline";import{useLocation as R}from"react-router-dom";import{useQueryClient as B,useQuery as j}from"@tanstack/react-query";function O(e){return"component"in e}function H(e){return"endpoint"in e}var V={};function F(e){V=e}var q=new Proxy({},{get:(e,t)=>V[t],has:(e,t)=>t in V,ownKeys:()=>Object.keys(V),getOwnPropertyDescriptor(e,t){if(t in V)return{configurable:!0,enumerable:!0,value:V[t]}}}),Y=null;function U(e){Y=e}function X(){return null!==Y}var _=/* @__PURE__ */new Set(["get","post","put","patch","delete","head","options","request"]),J=new Proxy({},{get:(e,t)=>Y?Y[t]:"string"==typeof t&&_.has(t)?()=>Promise.resolve({data:null,status:0,statusText:"",headers:{},config:{}}):void 0});function G({error:t,onReload:n}){const r=e(t);/* @__PURE__ */
|
|
2
|
+
return I("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 py-12 text-center",children:[
|
|
3
|
+
/* @__PURE__ */D("svg",{className:"h-8 w-8 text-amber-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"})}),
|
|
4
|
+
/* @__PURE__ */I("div",{className:"min-w-0",children:[
|
|
5
|
+
/* @__PURE__ */D("p",{className:"text-sm font-medium text-gray-700",children:r?"This window needs the latest version of the app":"This window crashed"}),
|
|
6
|
+
/* @__PURE__ */D("p",{className:"mt-1 text-xs text-gray-400 max-w-sm break-words",children:r?"A new version was deployed while this tab was open. Reload the page to pick it up.":t.message||String(t)})]}),
|
|
7
|
+
/* @__PURE__ */D("button",{type:"button",onClick:r?()=>window.location.reload():n,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 text-sm font-medium rounded-lg",children:r?"Reload page":"Reload window"})]})}var Q=class extends v{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)}reset=()=>this.setState({error:null});render(){const{error:e}=this.state;return e?this.props.fallback?this.props.fallback(e,this.reset):/* @__PURE__ */D(G,{error:e,onReload:this.reset}):this.props.children}},Z=g(null),ee="text-xs text-gray-500 hover:text-gray-700 disabled:opacity-40 disabled:hover:text-gray-500 disabled:cursor-default";function te({className:e="",auto:r=!1}){const o=b(Z),i=o?.claimOwnMount;if(x(()=>{if(!r&&i)return i(!0),()=>i(!1)},[r,i]),!o||!o.enabled)return null;const{undo:a,redo:l,canUndo:s,canRedo:c,undoLabel:d,redoLabel:u}=o;/* @__PURE__ */
|
|
8
|
+
return I("div",{className:`flex items-center gap-2 ${e}`,"data-undo-controls":r?"shell":"form",children:[
|
|
9
|
+
/* @__PURE__ */D("button",{type:"button",onClick:a,disabled:!s,title:s?`Undo ${d} (${t})`:"Nothing to undo",className:ee,children:"Undo"}),
|
|
10
|
+
/* @__PURE__ */D("button",{type:"button",onClick:l,disabled:!c,title:c?`Redo ${u} (${n})`:"Nothing to redo",className:ee,children:"Redo"})]})}var ne=/* @__PURE__ */new Set([408,429]);function re(e){const t=e?.response?.status;return"number"==typeof t?t:void 0}function oe(e){const t=re(e);return null!=t&&(t>=400&&t<500&&!ne.has(t))}function ie(e,t){return!oe(t)&&e<3}function ae(){/* @__PURE__ */
|
|
11
|
+
return D("div",{className:"flex items-center justify-center p-8 text-sm text-gray-400",children:"Loading..."})}var le="flex-1 min-h-0";function se(){/* @__PURE__ */
|
|
12
|
+
return D(r,{label:"Loading record…",padding:"",className:le})}function ce(e){return e??void 0}function de({isPending:e,isFetching:t,enabled:n=!0,error:r,onRetry:i}){if(t||e&&n)/* @__PURE__ */return D(se,{});if(r){const e=re(r);if(401===e)/* @__PURE__ */
|
|
13
|
+
return D(o,{status:"warning",title:"Sign in required",subTitle:"Your session may have expired. Sign in again to open this record.",className:le});if(403===e)/* @__PURE__ */
|
|
14
|
+
return D(o,{status:"403",className:le});if(404===e||410===e)/* @__PURE__ */
|
|
15
|
+
return D(o,{status:"404",title:"Record not found",className:le});const t=null==e||408===e||429===e||e>=500;/* @__PURE__ */
|
|
16
|
+
return D(o,{status:"500",title:"Couldn't load record",subTitle:t?"Check your connection and try again.":"The server rejected this request.",extra:t?/* @__PURE__ */D(c,{variant:"secondary",size:"sm",onClick:i,children:"Try again"}):void 0,className:le})}/* @__PURE__ */
|
|
17
|
+
return D(o,{status:"404",title:"Record not found",className:le})}function ue({entity:e,children:t,...n}){return null!=e?/* @__PURE__ */D(W,{children:t(e)}):/* @__PURE__ */D(de,{...n})}var he=/^[a-z]+(?:-[a-z]+)*-\d{13}$/;function me(e){return"string"==typeof e&&(e.startsWith("new-")||he.test(e))}function pe(e){if(me(e.entityId))return!0;const t=e.entitySnapshot;return!(!t||"object"!=typeof t||!t._new&&!t._duplicate)}var we=g({openWindows:[],openEntity:()=>{},openPage:()=>{},closeEntity:()=>{},minimize:()=>{},items:[],restore:()=>{},remove:()=>{},restoreIfMinimized:()=>!1,openItems:[]}),fe=g(null);function ye(e){const t=b(fe),n=k(null);null===n.current&&(n.current=/* @__PURE__ */Symbol("window-dirty")),x(()=>{if(t)return t(n.current,e)},[t,e]),C(()=>{if(!t||!e)return;const n=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[t,e])}function ge(){const e=k(/* @__PURE__ */new Map),[t,n]=E(!1);return{dirty:t,registerDirty:M((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 ve(){return b(we)}function be(e){if("page"!==e.type&&pe(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 xe({item:e,onClose:t,accentRgb:n}){const{dirty:r,registerDirty:o}=ge(),i=q[e.route];if(!i||!O(i))return null;const a=i,l=a.component;/* @__PURE__ */
|
|
18
|
+
return D(Vn,{open:!0,onClose:t,icon:s[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__ */D(fe.Provider,{value:o,children:/* @__PURE__ */D(P,{fallback:/* @__PURE__ */D("div",{className:"flex items-center justify-center py-12",children:/* @__PURE__ */D(ae,{})}),children:/* @__PURE__ */D(l,{})})})})}function ke({entityType:e,entityId:t,label:n}){const r=y(),o=B(),{data:i}=j({queryKey:["my-profile-sidebar"],enabled:X(),queryFn:()=>J.get("/auth/me/").then(e=>e.data)}),a=(i?.preferences||{}).favorite_documents||[],l=a.some(n=>n.entityType===e&&n.entityId===t);/* @__PURE__ */
|
|
19
|
+
return D("button",{onClick:()=>{const r=l?a.filter(n=>!(n.entityType===e&&n.entityId===t)):[...a,{entityType:e,entityId:t,label:n}];J.patch("/auth/me/",{preferences:{favorite_documents:r}}).then(()=>{o.invalidateQueries({queryKey:["my-profile-sidebar"]})})},title:l?r.taskbar.removeFromDesktop:r.taskbar.addToDesktop,className:"shrink-0 transition-colors "+(l?"text-yellow-500 hover:text-yellow-600":"text-gray-300 hover:text-yellow-400"),children:/* @__PURE__ */D("svg",{className:"h-4 w-4",fill:l?"currentColor":"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z"})})})}function Ce({item:e,onClose:t,onMinimize:n,accentRgb:r}){const o=q[e.entityType];if(!o||!H(o))return null;const i=o,[a,l]=E(!1),{dirty:c,registerDirty:d}=ge(),u=i.queryKey||i.endpoint.replace(/^\/|\/$/g,"").split("/").pop()||e.entityType,h=e.entitySnapshot?._duplicate,m=me(e.entityId),p=!i.selfFetching&&!h&&!m&&X(),w=j({queryKey:[u,e.entityId],queryFn:()=>{return J.get((t=i.endpoint,n=String(e.entityId),`${t}${encodeURIComponent(n)}/`)).then(e=>e.data);var t,n},initialData:ce(e.entitySnapshot),initialDataUpdatedAt:0,enabled:p,staleTime:0,refetchOnWindowFocus:!0,refetchOnMount:"always",refetchInterval:e=>!oe(e.state.error)&&6e4,refetchIntervalInBackground:!1,retry:ie}),f=w.data,y=w.refetch;C(()=>{if(i.selfFetching||h||m)return;const e=()=>{y()};return window.addEventListener("modal-reorder",e),()=>window.removeEventListener("modal-reorder",e)},[y,i.selfFetching,h,m]);const g=M(()=>{a&&!c?l(!1):t()},[a,c,t]),v=i.selfFetching?e.label:f?i.title(f,a,l):e.label,b=i.icon,x=b?s[b]:null,k=v,L=!i.selfFetching&&f&&i.footer&&!h?i.footer(f):void 0;return i.rendersOwnModal?i.selfFetching?/* @__PURE__ */D(P,{fallback:/* @__PURE__ */D(ae,{}),children:i.render(f??e.entitySnapshot,t,e.entityId,a,l)}):null!=f?/* @__PURE__ */D(P,{fallback:/* @__PURE__ */D(Vn,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */D(se,{})}),children:i.render(f,t,e.entityId,a,l)}):/* @__PURE__ */D(Vn,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */D(de,{isPending:w.isPending,isFetching:w.isFetching,enabled:p,error:w.error,onRetry:y})}):/* @__PURE__ */D(Vn,{open:!0,onClose:g,onMinimize:n,initialBox:e.savedBox,icon:x,title:k,footer:L,copyText:e.label,windowKey:e.id,openedFromKey:e.openedFrom,size:i.size||"2xl",dirty:c,editing:a||m||h,dimensions:i.dimensions,autoHeight:i.autoHeight,autoMinHeight:i.autoMinHeight,autoWidth:i.autoWidth,appStyle:i.appStyle,flushBody:i.flushBody,accentRgb:r,children:/* @__PURE__ */D(fe.Provider,{value:d,children:/* @__PURE__ */D(P,{fallback:/* @__PURE__ */D(se,{}),children:i.selfFetching?i.render(null,t,e.entityId,a,l):/* @__PURE__ */D(ue,{entity:f,isPending:w.isPending,isFetching:w.isFetching,enabled:p,error:w.error,onRetry:y,children:n=>i.render(n,t,e.entityId,a,l)})})})})}function Ee(e){return document.querySelector(`[data-modal-panel][data-window-key="${e}"]`)}function Me(){const e=vn();if(!e)return;const t=document.querySelector(`[data-modal-panel][data-modal-id="${e}"]`);return t?.getAttribute("data-window-key")??void 0}var Le=/* @__PURE__ */new Map;function Ne(){const e=Me();if(e)return Le.get(e)}function Se(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 Te="rosh-peek-style";function Ae(e){"undefined"!=typeof document&&(!function(){if("undefined"==typeof document||document.getElementById(Te))return;const e=document.createElement("style");e.id=Te,e.textContent="body.rosh-peeking [data-modal-panel]{transition:opacity .18s ease}body.rosh-peeking [data-modal-panel]:not([data-peek-focus]){opacity:.4}body.rosh-peeking [data-modal-panel][data-peek-focus]{opacity:1}body.rosh-peeking [data-modal-panel][data-peek-focus]:not([data-pinned-top]){z-index:249!important}html.rosh-reduce-transparency body.rosh-peeking [data-modal-panel]:not([data-peek-focus]){opacity:.92}@media (prefers-reduced-motion:reduce){body.rosh-peeking [data-modal-panel]{transition:none}}",document.head.appendChild(e)}(),document.querySelectorAll("[data-modal-panel][data-peek-focus]").forEach(e=>e.removeAttribute("data-peek-focus")),e&&e.setAttribute("data-peek-focus",""),document.body.classList.toggle("rosh-peeking",!!e))}function ze(){"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 Pe({id:e,label:t,maxW:n,maxH:r,titleAbove:o=!1,onClick:i,onClose:a}){const l=y(),s=k(null),[c,d]=E({w:n,h:Math.round(.75*r)}),[u,h]=E(!1);return x(()=>{const o=s.current;if(!o)return;const i=Ee(e)??Se(t);if(!i)return void h(!1);const a=i.getBoundingClientRect();if(0===a.width||0===a.height)return void h(!1);const l=Math.min(n/a.width,r/a.height),c=Math.max(80,Math.round(a.width*l)),u=Math.max(60,Math.round(a.height*l));d({w:c,h:u}),h(!0);const m=i.cloneNode(!0);return m.style.position="absolute",m.style.top="0",m.style.left="0",m.style.right="auto",m.style.bottom="auto",m.style.width=a.width+"px",m.style.height=a.height+"px",m.style.transform=`scale(${l})`,m.style.transformOrigin="top left",m.style.pointerEvents="none",m.style.animation="none",m.style.zIndex="auto",m.removeAttribute("data-modal-panel"),m.removeAttribute("data-modal-id"),m.removeAttribute("data-window-key"),m.querySelectorAll('[role="dialog"], [data-portal]').forEach(e=>{e.style.display="none"}),o.innerHTML="",o.appendChild(m),()=>{o.innerHTML=""}},[e,t,n,r]),/* @__PURE__ */I("div",{style:{width:c.w,height:c.h},className:"relative rounded-md overflow-hidden bg-white/95 border border-gray-300 shadow-md cursor-pointer ring-2 ring-transparent group-hover:ring-blue-400 transition shrink-0",onClick:i,children:[
|
|
20
|
+
/* @__PURE__ */D("div",{ref:s,className:"absolute inset-0 z-0 overflow-hidden"}),!u&&/* @__PURE__ */I("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-gray-400 bg-gray-50",children:[
|
|
21
|
+
/* @__PURE__ */D("svg",{className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6.75A2.25 2.25 0 016 4.5h12a2.25 2.25 0 012.25 2.25v10.5A2.25 2.25 0 0118 19.5H6a2.25 2.25 0 01-2.25-2.25V6.75z M3.75 9h16.5"})}),
|
|
22
|
+
/* @__PURE__ */D("span",{className:"mt-1 text-[10px] uppercase tracking-wide",children:"Hidden"})]}),!o&&/* @__PURE__ */D("div",{className:"absolute bottom-0 left-0 right-0 z-10 px-2 py-1 text-[10px] font-medium text-white bg-gradient-to-t from-black/80 to-transparent truncate pointer-events-none",children:t}),a&&/* @__PURE__ */D("button",{onClick:e=>{e.stopPropagation(),a()},className:"absolute top-1 right-1 z-20 h-5 w-5 rounded-full bg-gray-900/90 ring-1 ring-white/80 shadow-sm hover:bg-red-500 text-white flex items-center justify-center",title:l.taskbar.closeWindow,children:/* @__PURE__ */D("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}function Ie({items:e,anchorEl:t,onActivate:n,onClose:r,onMouseEnter:o,onMouseLeave:i}){const a=y(),l=e.length>1,s=k(null),[c,d]=E({left:-9999,top:-9999,ready:!1}),[u,h]=E(()=>"undefined"!=typeof document&&getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom");x(()=>{const e=s.current;if(!e)return;const n=()=>{const n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),o=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom";h(o);let i,a=n.left+n.width/2-r.width/2;"top"===o?i=n.bottom+8:"left"===o?(a=n.right+8,i=n.top+n.height/2-r.height/2):"right"===o?(a=n.left-r.width-8,i=n.top+n.height/2-r.height/2):i=n.top-r.height-8,a=Math.max(8,Math.min(a,window.innerWidth-r.width-8)),i=Math.max(8,Math.min(i,window.innerHeight-r.height-8)),d({left:a,top:i,ready:!0})};n();const r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[t,e.length]),C(()=>ze,[]);const m="top"===u,p=(m?"mt-1":"mb-1")+" max-w-[240px] truncate text-[11px] font-medium text-gray-900 bg-white/80 px-2 py-0.5 rounded shadow-sm ring-2 ring-transparent transition group-hover:ring-blue-400";return $(
|
|
23
|
+
/* @__PURE__ */D("div",{ref:s,"data-taskbar-preview":"",style:{position:"fixed",left:c.left,top:c.top,zIndex:300,maxWidth:"calc(100vw - 16px)",opacity:c.ready?1:0},className:l?"flex gap-2 flex-wrap":"",onMouseEnter:o,onMouseLeave:()=>{ze(),i()},children:e.map(e=>{const t=Ee(e.id)??Se(e.label),o=t?function(e){if(on(e))return null;const t=e.getBoundingClientRect(),n=Qt(),r=t.left+t.width/2-(n.x+n.w/2),o=t.top+t.height/2-(n.y+n.h/2);return 180*Math.atan2(o,r)/Math.PI}(t):null;/* @__PURE__ */
|
|
24
|
+
return I("div",{className:"group flex flex-col items-center",onMouseEnter:()=>Ae(t),children:[!m&&/* @__PURE__ */D("span",{className:p,children:e.label}),
|
|
25
|
+
/* @__PURE__ */D(Pe,{id:e.id,label:e.label,maxW:240,maxH:160,titleAbove:!0,onClick:()=>n(e.id),onClose:()=>r(e.id)}),m&&/* @__PURE__ */D("span",{className:p,children:e.label}),null!==o&&/* @__PURE__ */I("span",{title:a.taskbar.offscreenHint,className:"mt-1 inline-flex items-center gap-1 rounded bg-amber-500 px-1.5 py-0.5 text-[10px] font-semibold text-white shadow-sm",children:[
|
|
26
|
+
/* @__PURE__ */D("svg",{className:"h-3 w-3",style:{transform:`rotate(${o}deg)`},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14m0 0l-5-5m5 5l-5 5"})}),"Off screen"]})]},e.id)})}),document.body)}function De(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 We({openWindows:e,onRemove:t,onSplitView:n,onActivate:r,onActivateById:o}){const i=y(),[a,l]=E(null);C(()=>{const e=document.getElementById("taskbar-windows");if(!e){const e=setInterval(()=>{const t=document.getElementById("taskbar-windows");t&&(l(t),clearInterval(e))},100);return()=>clearInterval(e)}l(e)},[]);const c=L(bn,vn),[,p]=E(0);C(()=>{const e=()=>p(e=>e+1);return window.addEventListener("modal-geometry",e),window.addEventListener("resize",e),()=>{window.removeEventListener("modal-geometry",e),window.removeEventListener("resize",e)}},[]);const[,w]=E(0);C(()=>{const e=()=>w(e=>e+1);return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[]);const f=e=>{const t=Se(e),n=t?.querySelector("[data-window-title]");return n?.textContent?.trim()||e},[g,v]=E(null),[b,x]=E(null),[M,N]=E(null),A=k(null),z=()=>{A.current&&(clearTimeout(A.current),A.current=null),A.current=setTimeout(()=>{v(null),x(null)},150)},P=e.filter(e=>!e.route||!q[e.route]?.utility);if(!a||0===P.length)return null;const K=[],R=/* @__PURE__ */new Map;for(const e of P){const t=e.route?q[e.route]:void 0,n=t?.taskbarGroup,r=n?.key??e.route??`entity:${e.id}`,o=R.get(r);if(void 0!==o)K[o].items.push(e);else{R.set(r,K.length);const o=n?.label??t?.label??e.label;K.push({key:r,route:n?.icon??e.route,label:o,items:[e]})}}return $(
|
|
27
|
+
/* @__PURE__ */I(W,{children:[K.map(e=>{const n=e.route?s[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 l=e.items.length>1,d=e.items.some(e=>{const t=Ee(e.id)??Se(e.label);return!!t&&!on(t)});/* @__PURE__ */
|
|
28
|
+
return I("button",{onClick:()=>o(r.id),onMouseEnter:t=>{return n=e.items,r=t.currentTarget,void(M||(A.current&&(clearTimeout(A.current),A.current=null),A.current=setTimeout(()=>{v(n),x(r)},350)));var n,r},onMouseLeave:z,onDoubleClick:e=>{e.stopPropagation(),window.dispatchEvent(new CustomEvent("modal-center",{detail:{windowKey:r.id,label:r.label}}))},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),A.current&&(clearTimeout(A.current),A.current=null),v(null),x(null),l?N({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-1.5 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&&S(n)?T(n,{className:"h-3.5 w-3.5 shrink-0 "+(a?"text-blue-600":"text-gray-400")}):/* @__PURE__ */D("svg",{className:"h-3.5 w-3.5 shrink-0 "+(a?"text-blue-600":"text-gray-400"),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"})}),
|
|
29
|
+
/* @__PURE__ */D("span",{className:"truncate flex-1",children:l?e.label:f(r.label)}),d&&/* @__PURE__ */D("span",{title:i.taskbar.offscreenDot,className:"shrink-0 h-1.5 w-1.5 rounded-full bg-amber-500"}),l&&/* @__PURE__ */D("span",{className:"shrink-0 px-1.5 py-0.5 rounded-full bg-blue-500/80 text-white text-[10px] font-bold leading-none",children:e.items.length}),!l&&/* @__PURE__ */D("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__ */D("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},e.key)}),
|
|
30
|
+
/* @__PURE__ */D("div",{className:"flex-1"}),P.length>=2&&/* @__PURE__ */I("button",{onClick:n,title:i.taskbar.expose,className:"flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium text-blue-600 border border-blue-300 hover:bg-blue-50 transition-colors shrink-0",children:[
|
|
31
|
+
/* @__PURE__ */I("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[
|
|
32
|
+
/* @__PURE__ */D("rect",{x:"3.5",y:"3.5",width:"7",height:"7",rx:"1"}),
|
|
33
|
+
/* @__PURE__ */D("rect",{x:"13.5",y:"3.5",width:"7",height:"7",rx:"1"}),
|
|
34
|
+
/* @__PURE__ */D("rect",{x:"3.5",y:"13.5",width:"7",height:"7",rx:"1"}),
|
|
35
|
+
/* @__PURE__ */D("rect",{x:"13.5",y:"13.5",width:"7",height:"7",rx:"1"})]}),"Exposé"]}),M&&/* @__PURE__ */I(d,{portal:!0,minWidth:200,style:De(M.x,M.y),onClose:()=>N(null),children:[
|
|
36
|
+
/* @__PURE__ */D(m,{children:M.label}),
|
|
37
|
+
/* @__PURE__ */I(u,{onClick:()=>{N(null),M.items.forEach(e=>function(e){const t=jt.get(e);t&&Xt(t)}(e.id))},children:[
|
|
38
|
+
/* @__PURE__ */D("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 12h-15"})}),i.taskbar.minimizeAllWindows]}),
|
|
39
|
+
/* @__PURE__ */I(u,{onClick:()=>{N(null),M.items.forEach(e=>o(e.id))},children:[
|
|
40
|
+
/* @__PURE__ */D("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75h6.5v6.5h-6.5zM13.75 8.75h6.5v6.5h-6.5z"})}),i.taskbar.restoreAllWindows]}),
|
|
41
|
+
/* @__PURE__ */D(h,{}),
|
|
42
|
+
/* @__PURE__ */I(u,{danger:!0,onClick:()=>{N(null),M.items.forEach(e=>t(e.id))},children:[
|
|
43
|
+
/* @__PURE__ */D("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),`${i.taskbar.closeAllWindows} (${M.items.length})`]})]}),g&&b&&/* @__PURE__ */D(Ie,{items:g,anchorEl:b,onActivate:e=>{o(e),v(null),x(null)},onClose:e=>{t(e),v(null),x(null)},onMouseEnter:()=>{A.current&&(clearTimeout(A.current),A.current=null)},onMouseLeave:z})]}),a)}var $e=["/login","/forgot-password","/reset-password","/force-change-password"];function Ke({children:e,windowAccentForRoute:t}){const n=R(),r=$e.some(e=>n.pathname.startsWith(e)),[o,i]=E([]),a=k(o);x(()=>{a.current=o},[o]),C(()=>{Le.clear();for(const e of o)e.route&&Le.set(e.id,e.route)},[o]);const l=M(e=>{i(t=>t.filter(t=>t.id!==e))},[]),s=M(e=>{var t;Ee(e)?(t=e,window.dispatchEvent(new CustomEvent(xn,{detail:{windowKey:t}}))):l(e)},[l]),c=e=>{setTimeout(()=>{const t=document.querySelector(`[data-modal-panel][data-window-key="${e}"]`),n=t?.getAttribute("data-modal-id");n&&Ut(n)},50)},d=M((e,t,n,r,o)=>{if(!q[e]||!H(q[e]))return;const a=`${e}:${t}`,l=Me();i(i=>{const s=i.find(n=>n.entityType===e&&String(n.entityId)===String(t));return s?(c(s.id),i):(c(a),[...i,{id:a,type:"modal",label:r||t,route:o||window.location.pathname,entityType:e,entityId:t,entitySnapshot:ce(n),openedFrom:l}])})},[]),u=M(e=>{if(!q[e]||!O(q[e]))return;const t=q[e];if(t.widget){const t=a.current.find(t=>"page"===t.type&&t.route===e);if(t)return void s(t.id)}const n=Me();i(r=>{if(t.multiInstance){const o=`page:${e}:${Math.random().toString(36).slice(2,8)}`;return c(o),[...r,{id:o,type:"page",label:t.label,route:e,openedFrom:n}]}const o=r.find(t=>"page"===t.type&&t.route===e);if(o)return t.widget||c(o.id),r;const i=`page:${e}`;return c(i),[...r,{id:i,type:"page",label:t.label,route:e,openedFrom:n}]})},[s]),h=M(()=>{},[]),m=M(()=>{},[]),p=s,w=s;/* @__PURE__ */
|
|
44
|
+
return I(we.Provider,{value:{openWindows:o,openEntity:d,openPage:u,closeEntity:p,minimize:h,items:[],openItems:o,restore:m,remove:w,restoreIfMinimized:()=>!1},children:[e,
|
|
45
|
+
/* @__PURE__ */D(We,{openWindows:o,onRemove:s,onSplitView:On,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&&Ut(e)}})},onActivateById:e=>{const t=document.querySelector(`[data-modal-panel][data-window-key="${e}"]`);if(!t)return;if(!on(t))return n=e,void window.dispatchEvent(new CustomEvent("modal-reveal",{detail:{windowKey:n}}));var n;const r=t.getAttribute("data-modal-id");r&&Ut(r)}}),
|
|
46
|
+
/* @__PURE__ */D(Hn,{}),!r&&o.map(e=>{const n=e.route?t?.(e.route):void 0;/* @__PURE__ */
|
|
47
|
+
return D(Q,{fallback:(t,n)=>/* @__PURE__ */D(Vn,{open:!0,onClose:()=>l(e.id),title:e.label,size:"md",autoHeight:!0,windowKey:e.id,children:/* @__PURE__ */D(G,{error:t,onReload:n})}),children:/* @__PURE__ */D(rt,{spec:be(e),children:/* @__PURE__ */D(Jn,{windowId:e.id,children:"page"===e.type?/* @__PURE__ */D(xe,{item:e,onClose:()=>l(e.id),accentRgb:n}):/* @__PURE__ */D(Ce,{item:e,onClose:()=>l(e.id),onMinimize:()=>{},accentRgb:n})})})},e.id)})]})}var Re=null,Be=/* @__PURE__ */new Set;function je(){return Re}function Oe(e){if(Re!==e){Re=e;for(const e of Be)e()}}function He(e){return Be.add(e),()=>{Be.delete(e)}}var Ve=!1,Fe={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},qe=()=>{};function Ye(e){Ve=e,Fe={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0}}function Ue(e,t){Ve&&("submenu"===e?Fe.submenus++:Fe.menus++,Fe.menuKey=t)}function Xe(e){if(!Ve)return qe;const t=performance.now();let n=!1;return()=>{if(n)return;if(n=!0,!Ve)return;const r=performance.now()-t;"move"===e?Fe.moveMs+=r:Fe.resizeMs+=r}}function _e(){const e=Fe;return Fe={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},e}var Je=280;function Ge(){const e=getComputedStyle(document.documentElement),t=parseInt(e.getPropertyValue("--taskbar-height"))||0,n=parseInt(e.getPropertyValue("--taskbar-width"))||0,r=e.getPropertyValue("--taskbar-position")?.trim()||"bottom",o=parseInt(e.getPropertyValue("--sidebar-width"))||0;return{x:("left"===r?n:0)+o,y:"top"===r?t:0,w:window.innerWidth-("left"===r||"right"===r?n:0)-o,h:window.innerHeight-("top"===r||"bottom"===r?t:0)}}function Qe(e,t,n){const r=n?t.w+280:t.w-280,o=Math.abs(e.w-t.w)<=4||Math.abs(e.w-r)<=4;return Math.abs(e.h-t.h)<=4&&o}function Ze({over:e,residual:t},n){return t<=1||e-t>=n-2}function et(){return"undefined"!=typeof document&&"sidebar"===getComputedStyle(document.documentElement).getPropertyValue("--layout-mode")?.trim()}var tt=g(""),nt=g(null);function rt({spec:e,children:t}){/* @__PURE__ */
|
|
48
|
+
return D(nt.Provider,{value:e,children:t})}var ot=/* @__PURE__ */new Set(["button","input","textarea","select","kbd","svg"]),it='button[type="submit"], button[data-submit], button.btn-submit, button.bg-green-600, button.bg-blue-600';function at(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(at).join("");if(S(e)){const t=e,n="string"==typeof t.type?t.type:"";return ot.has(n)?"":at(t.props?.children)}return""}function lt(e){const t=b(tt);C(()=>{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 st={};function ct(e,t,n){const r=b(tt);C(()=>{if(!r)return;st[r]||(st[r]=[]);const o={label:e,icon:n,onClick:t};return st[r].push(o),()=>{st[r]=(st[r]||[]).filter(e=>e!==o)}},[r,e,t,n])}function dt({title:e}){const t=k(null);return C(()=>{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__ */D("span",{ref:t,style:{display:"none"},"aria-hidden":"true"})}function ut(e){}function ht({text:e}){const[t,n]=E(!1);/* @__PURE__ */
|
|
49
|
+
return D("button",{onClick:t=>{t.stopPropagation(),navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),1500)})},title:t?"Copied!":`Copy ${e}`,className:"shrink-0 text-gray-400 hover:text-gray-600 transition-colors",children:/* @__PURE__ */D("svg",t?{className:"w-4 h-4 text-green-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}:{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})}var mt=g(null);function pt(){return b(tt)}function wt(){const e=L(bn,vn),t=b(mt);return t?.active??(Dt.length<=1||null!=e)}function ft({children:e,position:t="right",quiet:n=!1}){const r=b(mt),[o,i]=E(null);return C(()=>{if(!r)return;const e="left"===t?r.leftRef:r.rightRef,o=()=>!!e.current&&(i(e.current),n||r.notify(),!0);if(o())return;const a=setInterval(()=>{o()&&clearInterval(a)},50),l=setTimeout(()=>clearInterval(a),2e3);return()=>{clearInterval(a),clearTimeout(l)}},[r,t,n]),o?$(e,o):null}function yt({onClick:e,children:t,className:n}){const r=b(mt);/* @__PURE__ */
|
|
50
|
+
return D("button",{type:"button",onClick:async()=>{if(r?.isDirty){const{confirm:e}=await(import("./ConfirmDialog-GAYETRMG.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 gt="erp_window_positions",vt={};try{const e=localStorage.getItem(gt);e&&(vt=JSON.parse(e))}catch{}var bt=null;function xt(){bt&&clearTimeout(bt),bt=setTimeout(()=>{try{localStorage.setItem(gt,JSON.stringify(vt))}catch{}},500)}var kt="erp_activation_order",Ct=[];try{const e=localStorage.getItem(kt),t=e?JSON.parse(e):null;Array.isArray(t)&&t.every(e=>"string"==typeof e)&&(Ct=t)}catch{}var Et=null;function Mt(){Et&&clearTimeout(Et),Et=setTimeout(()=>{try{localStorage.setItem(kt,JSON.stringify(Ct))}catch{}},500)}function Lt(e,t){vt[e]||(vt[e]=t,xt())}function Nt(e){return vt[e]?{...vt[e]}:null}function St(e,t){vt[e]=t,xt()}function Tt(){const e=Ge(),t=(parseInt(getComputedStyle(document.documentElement).getPropertyValue("--sidebar-width"))||0)>0;let n=!1;for(const r of Object.keys(vt))Qe(vt[r],e,t)&&(delete vt[r],n=!0);n&&xt()}var At={sm:384,md:512,lg:672,xl:896,"2xl":1152,"3xl":1408},zt=4e3,Pt=()=>{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"},It={small:.8,medium:1,large:1.25,maximized:1.25},Dt=[],Wt=/* @__PURE__ */new Set,$t=/* @__PURE__ */new Set,Kt=0;function Rt(){return Kt}function Bt(){Kt++,Wt.forEach(e=>e())}var jt=/* @__PURE__ */new Map,Ot=/* @__PURE__ */new Map;var Ht=null;function Vt(e){Ht=null,Ut(e)}function Ft(e){Ht=e;const t=jt.get(e);t&&Vt(t)}function qt(e){Ht===e&&(Ht=null)}function Yt(e,t){t?(jt.set(t,e),Ot.set(e,t),function(e,t){const n=Ct.indexOf(t);if(-1===n)return void Dt.push(e);let r=Dt.length;for(let e=0;e<Dt.length;e++){const t=Ot.get(Dt[e]);if(t&&Ct.indexOf(t)>n){r=e;break}}Dt.splice(r,0,e)}(e,t),-1===Ct.indexOf(t)&&(Ct.push(t),Mt())):Dt.push(e),Bt(),window.dispatchEvent(new CustomEvent("modal-reorder")),t&&Ht===t&&Vt(e)}function Ut(e){const t=Dt.indexOf(e);-1!==t&&Dt.splice(t,1),Dt.push(e),$t.delete(e);const n=Ot.get(e);if(n){const e=Ct.indexOf(n);-1!==e&&Ct.splice(e,1),Ct.push(n),Mt(),Ht&&Ht!==n&&(Ht=null)}Bt(),window.dispatchEvent(new CustomEvent("modal-reorder"))}function Xt(e){const t=Dt.indexOf(e);-1!==t&&Dt.splice(t,1),$t.add(e);const n=Ot.get(e);if(n){const e=Ct.indexOf(n);-1!==e&&(Ct.splice(e,1),Mt())}Bt(),window.dispatchEvent(new CustomEvent("modal-reorder"))}var _t=/* @__PURE__ */new Set;var Jt=8,Gt=32;function Qt(){const e=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,t=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-width"))||0,n=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom";return{x:"left"===n?t:0,y:"top"===n?e:0,w:window.innerWidth-("left"===n||"right"===n?t:0),h:window.innerHeight-("top"===n||"bottom"===n?e:0)}}var Zt=40,en=80,tn=384,nn=400;function rn(e,t=Qt()){const n=Math.min(Math.max(e.x,t.x+en-e.w),t.x+t.w-en),r=Math.min(Math.max(e.y,t.y),t.y+t.h-Zt);return n===e.x&&r===e.y?e:{...e,x:n,y:r}}function on(e){const t=e.getBoundingClientRect();if(0===t.width||0===t.height)return!0;const n=Qt();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 an(e){const t=Qt(),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 ln=null;function sn(e){const t=(ln||((ln=document.createElement("div")).style.cssText=["position: fixed","pointer-events: none","z-index: 40","border-radius: 8px","background: rgba(59, 130, 246, 0.18)","border: 2px solid rgb(59, 130, 246)","transition: left 120ms ease, top 120ms ease, width 120ms ease, height 120ms ease, opacity 120ms ease","opacity: 0","display: none"].join(";"),document.body.appendChild(ln)),ln);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 cn(){ln&&(ln.style.opacity="0",ln.style.display="none")}var dn=[{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"}],un=350,hn=200;function mn({maximized:e,onToggleMax:t,onSnap:n,buttonClassName:r,strings:o}){const[i,a]=E(!1),l=k(void 0),s=k(void 0);C(()=>()=>{clearTimeout(l.current),clearTimeout(s.current)},[]);const c=()=>{clearTimeout(s.current),l.current=setTimeout(()=>a(!0),un)},d=()=>{clearTimeout(l.current),s.current=setTimeout(()=>a(!1),hn)};/* @__PURE__ */
|
|
51
|
+
return I("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:d,children:[
|
|
52
|
+
/* @__PURE__ */D("button",{onClick:t,onFocus:c,onBlur:d,title:e?o.windowed:o.maximize,className:r,children:e?"❐":"⤢"}),i&&/* @__PURE__ */D("div",{role:"group","aria-label":o.snapLayouts,onMouseEnter:()=>clearTimeout(s.current),onMouseLeave:d,className:"absolute right-0 top-full z-30 mt-1 grid w-max grid-cols-2 gap-1 rounded-lg border border-gray-200 bg-white p-1.5 shadow-lg",children:dn.map(({zone:e,labelKey:t,region:r})=>/* @__PURE__ */D("button",{type:"button","aria-label":o[t],title:o[t],onClick:()=>{a(!1),n(e)},onFocus:()=>clearTimeout(s.current),onBlur:d,className:"relative h-7 w-11 rounded border border-gray-300 bg-gray-50 hover:border-blue-400 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400",children:/* @__PURE__ */D("span",{"aria-hidden":"true",className:`absolute rounded-sm bg-blue-500/70 ${r}`,style:{margin:2}})},e))})]})}var pn="rosh-gesture-style";var wn={se:"nwse-resize",nw:"nwse-resize",sw:"nesw-resize",ne:"nesw-resize",n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize"},fn=4;function yn(e,t,n,r){!function(){if("undefined"==typeof document||document.getElementById(pn))return;const e=document.createElement("style");e.id=pn,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=Xe(r);let a=!1;return()=>{if(!a){a=!0,i();try{e.releasePointerCapture(t)}catch{}o.remove(),document.body.classList.remove("rosh-gesturing")}}}function gn(e){const t=Dt.indexOf(e);return-1===t?-1:p.window+t*p.windowStep}function vn(){return Dt[Dt.length-1]||null}function bn(e){return Wt.add(e),()=>{Wt.delete(e)}}"undefined"!=typeof window&&window.addEventListener("deactivate-all-modals",function(){for(let e=Dt.length-1;e>=0;e--)_t.has(Dt[e])||Dt.splice(e,1);Ct=Ct.filter(e=>{const t=jt.get(e);return null!=t&&_t.has(t)}),Mt(),Bt(),window.dispatchEvent(new CustomEvent("modal-reorder"))});var xn="modal-close-request";function kn(e){L(bn,Rt);const t=b(mt);if(Dt.length<=1)return!0;if(e){const t=jt.get(e);if(null!=t)return vn()===t}return t?.active??null!=vn()}var Cn=!1,En=/* @__PURE__ */new Set;function Mn(e){return En.add(e),()=>En.delete(e)}function Ln(){return Cn}function Nn(e){Cn!==e&&(Cn=e,En.forEach(e=>e()))}function Sn(){Nn(!Cn)}function Tn(){Nn(!1)}var An=null,zn=/* @__PURE__ */new Set;function Pn(e){return zn.add(e),()=>zn.delete(e)}function In(){return An}function Dn(e){An!==e&&(An=e,zn.forEach(e=>e()))}var Wn=null,$n=/* @__PURE__ */new Set;function Kn(e){return $n.add(e),()=>$n.delete(e)}function Rn(){return Wn}function Bn(e){Wn!==e&&(Wn=e,$n.forEach(e=>e()))}function jn(){if(!Wn)return void Nn(!1);Dn(Wn),Bn(null),Nn(!1)}function On(){Nn(!Cn),window.dispatchEvent(new CustomEvent("modal-split-view"))}function Hn(){const e=L(Mn,Ln),[t,n]=E(e),[r,o]=E(e);return C(()=>{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?$(
|
|
53
|
+
/* @__PURE__ */D("div",{onMouseDown:e=>{e.stopPropagation(),Nn(!1)},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",zIndex:2e3,cursor:"pointer",opacity:r?1:0,transition:"opacity 260ms cubic-bezier(0.2, 0.8, 0.2, 1)",pointerEvents:r?"auto":"none"}}),document.body):null}function Vn({open:e,onClose:t,title:n,icon:r,copyText:o,size:l="lg",dirty:s=!1,onNext:c,onPrev:m,footer:g,bodyScroll:v,onMinimize:A,initialBox:z,actions:P,actionsLeft:R,editing:B=!1,allowPinOnTop:j,initialPosition:O,widget:H,compact:V,appStyle:F,flushBody:q,autoHeight:Y,autoMinHeight:U,autoWidth:X,widgetMenu:_,dimensions:J,windowKey:G,openedFromKey:ee,accentRgb:ne,children:re}){const oe=i(),[ie,ae]=E(0),[le,se]=E(!1),ce=k(null),de=k(0);C(()=>{de.current=ie},[ie]);const ue=M(e=>{oe&&(ce.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},se(!0),Oe(ee??null))},[oe,ee]),he=L(He,je);C(()=>{if(!le)return;const e=e=>{if(!ce.current)return;const t=e.clientX-ce.current.startX;if(Math.abs(e.clientY-ce.current.startY)>Math.abs(t)+12)return ce.current=null,se(!1),ae(0),void Oe(null);ae(Math.max(0,t))},n=()=>{if(!ce.current)return;const e=.3*window.innerWidth,n=de.current>e;ce.current=null,se(!1),n?(ae(window.innerWidth),setTimeout(()=>{t(),ae(0),Oe(null)},180)):(ae(0),Oe(null))};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",n),window.addEventListener("pointercancel",n),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",n),window.removeEventListener("pointercancel",n)}},[le]);const[me,pe]=E(n),we=y(),fe=we.window;C(()=>{pe(n)},[n]);const ge=N(()=>at(me).trim()||void 0,[me]),[be,xe]=E(!1),ke=k(!1),[Ce,Ee]=E(!1),[Me,Le]=E(null),Ne=b(nt),{prefs:Se,save:Te}=a(),Ae=!!Se.window_accent_stripe,ze=Se.favorite_documents||[],Pe=!!Ne&&ze.some(e=>e.entityType===Ne.entityType&&e.entityId===Ne.entityId),Ie=M(()=>{if(!Ne)return;const e=Pe?ze.filter(e=>!(e.entityType===Ne.entityType&&e.entityId===Ne.entityId)):[...ze,{entityType:Ne.entityType,entityId:Ne.entityId,label:Ne.label}];Te({favorite_documents:e})},[Ne,Pe,ze,Te]),[De,We]=E(null),[$e,Ke]=E("top-right"===O?"right":"left"),Re=k(!1),Be=k(null);x(()=>{const e=Be.current;e&&(ne?e.style.setProperty("--window-accent-rgb",ne):e.style.removeProperty("--window-accent-rgb"))},[ne]);const Ve=k(!1),Fe=k(null),qe=k(null),Ye=k(null),[Ue,Xe]=E(!1),_e=k(null),Je=!!(g||P||R)||Ue,Qe=b(Z),rt=""!==b(tt),ot=!!Qe&&!rt&&Qe.enabled&&Qe.hasState&&(B||Qe.declaredEditable)&&!Qe.handMounted&&Je&&!H&&!V&&!F&&!oe,lt=/* @__PURE__ */D("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6.75A2.25 2.25 0 016 4.5h12a2.25 2.25 0 012.25 2.25v10.5A2.25 2.25 0 0118 19.5H6a2.25 2.25 0 01-2.25-2.25V6.75z M3.75 9h16.5"})}),ct=r&&S(r)?T(r,{className:`h-4 w-4 ${r.props?.className??""}`.trim()}):r??lt,dt=()=>/* @__PURE__ */D("button",{onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();Le(e=>e?null:{x:t.left,y:t.bottom+4})},className:"shrink-0 p-0.5 rounded hover:bg-gray-200/50 transition-colors",title:"Window menu",children:ct}),ut=40,{minimize:ht,items:pt,restoreIfMinimized:wt,openWindows:ft}=ve(),yt=k(`modal-${Math.random().toString(36).slice(2,8)}`).current;C(()=>{if(H)return _t.add(yt),()=>{_t.delete(yt)}},[H,yt]),C(()=>{const e=e=>{const t=e.detail;t?.id===yt&&pe(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[yt]);const[gt,bt]=E(p.window),kt=function(e){const t=L(bn,vn);return Dt.length<=1||t===e}(yt),Ct=function(e){return L(bn,()=>$t.has(e))}(yt),Et=L(Mn,Ln),Mt=L(Pn,In),Lt=L(Kn,Rn),Nt=!j&&!H,St=Et&&Nt,[Tt,Wt]=E(!1),Kt=St&&Lt===yt,[Rt,Ht]=E(!1),Vt=Rt&&Nt&&Mt===yt?"picked":null,Ft=k(St);C(()=>{if(Ft.current&&!St){Ht(!0);const e=setTimeout(()=>{Ht(!1),An===yt&&Dn(null)},700);return Ft.current=St,()=>clearTimeout(e)}Ft.current=St},[St,yt]),C(()=>{St||Wt(!1)},[St]),C(()=>{const e=qe.current,t=Ye.current;if(!e&&!t)return;const n=e=>e?Array.from(e.children).filter(e=>"shell"!==e.dataset.undoControls).length:0,r=()=>Xe(n(e)+n(t)>0);r();const o=new MutationObserver(r);return e&&o.observe(e,{childList:!0}),t&&o.observe(t,{childList:!0}),()=>o.disconnect()},[e]),C(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&Be.current){const t=Be.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=qe.current,n=Ye.current;return t&&t.addEventListener("click",e),n&&n.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e),n&&n.removeEventListener("click",e)}},[e]);const qt=k(!1),Zt=M(Ge,[]),en=M(()=>{const e=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,t=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-width"))||0,n=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom",r="left"===n?t:0,o="right"===n?t:0,i=J?J[0]:At[l]||672,a=window.innerWidth-0-r-o-80,s=window.innerHeight-e-80,c=Math.min(i,a),d=It[Pt()],u=J?Math.min(J[1],s):(()=>{const t=("sm"===l?500:"md"===l?600:"lg"===l?700:"xl"===l?800:920)*d;return Math.max(320,Math.min(t,window.innerHeight-e-80))})(),h="cascade"===(getComputedStyle(document.documentElement).getPropertyValue("--window-position")?.trim()||"cascade")?30*(Dt.length-1):0,m=a-c,p=s-u;return"top-right"===O?{x:window.innerWidth-c-ut,y:ut,w:c,h:u}:"top-left"===O?{x:40,y:ut,w:c,h:u}:{x:0+Math.max(ut,(a-c)/2+ut)+Math.min(h,Math.max(0,m)),y:Math.max(ut,(s-u)/2)+Math.min(h,Math.max(0,p)),w:c,h:u}},[l]),on=k(!1);e||(on.current=!1);const ln=G||o||null;C(()=>{if(!e)return;Yt(yt,ln),G||Ut(yt),qt.current=!1,bt(gn(yt));const t=()=>{bt(gn(yt))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===G;if(!e.label)return!1;const t=Be.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;Ut(yt);const t=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,n=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-width"))||0,o=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom",i="left"===o?n:0,a="right"===o?n:0,l=window.innerWidth-i-a,s=window.innerHeight-t,c=Math.min(Wn.current.w,l-40),d=Math.min(Wn.current.h,s-40);hn({x:i+(l-c)/2,y:("top"===o?t:0)+(s-d)/2,w:c,h:d}),zn(!1)},i=e=>{const t=e.detail;r(t)&&(Ut(yt),Le({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==G)return;Ut(yt);const t=Wn.current,n=function(e,t=Qt()){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=Be.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)}hn(n)};return window.addEventListener("modal-reorder",t),window.addEventListener("modal-split-view",n),window.addEventListener("modal-center",o),window.addEventListener("modal-reveal",a),window.addEventListener("modal-context-menu",i),()=>{!function(e){const t=Dt.indexOf(e);-1!==t&&(Dt.splice(t,1),Bt()),$t.delete(e);const n=Ot.get(e);n&&(Ot.delete(e),jt.delete(n))}(yt),window.removeEventListener("modal-reorder",t),window.removeEventListener("modal-split-view",n),window.removeEventListener("modal-center",o),window.removeEventListener("modal-reveal",a),window.removeEventListener("modal-context-menu",i),window.dispatchEvent(new CustomEvent("modal-reorder"))}},[e,yt,ln,Zt]);const dn=!H&&"maximized"===Pt(),[un,hn]=E(()=>{if(ln&&vt[ln]){const e={...vt[ln]};return J&&(e.w=J[0],Y||(e.h=J[1])),rn(e)}return z?{x:z.x,y:z.y,w:z.w,h:z.h}:dn?Zt():en()}),[pn,kn]=E(()=>!Y),[Cn,En]=E(()=>et());C(()=>{const e=()=>En(et());return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[]);const Sn=Cn&&!H,[Tn,zn]=E(()=>ln&&vt[ln]||z?Sn:Sn||dn),Wn=k(un);Wn.current=un,x(()=>{if(pn)return;const e=Be.current,t=Fe.current;if(!e||!t)return;const n=U??(H?0:240),r=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0;let o=0,i=null,a=null;const l=()=>{const c=t.firstElementChild;if(!c||e.offsetHeight<=0)return;c!==a&&(a&&s.unobserve(a),s.observe(c),a=c);const d=e.offsetHeight-t.offsetHeight,u=t.style.flex,h=t.style.overflowY,m=t.style.height;t.style.flex="0 0 auto",t.style.height="auto",t.style.overflowY="visible";const p=t.offsetHeight,w=c.offsetHeight;t.style.flex=u,t.style.height=m,t.style.overflowY=h;const f=c.offsetHeight>w+4,y=Math.max(n,window.innerHeight-r-Math.max(0,Wn.current.y)-24),g=f?Math.min(Wn.current.h,y):Math.min(Math.max(n,d+p),y),v=Math.abs(g-o)>1;v&&(o=g,hn(e=>Math.abs(e.h-g)>1?{...e,h:g}:e)),H||(g<=n?i&&(clearTimeout(i),i=null):(v||null===i)&&(i&&clearTimeout(i),i=setTimeout(()=>{const e=o;l(),o===e&&kn(!0)},160)))},s=new ResizeObserver(l);l(),_e.current&&s.observe(_e.current);const c=new MutationObserver(l);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{s.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[pn,H,U,Je]),x(()=>{if(!Y||!pn||H||!e)return;const t=_e.current;if(!t)return;let n=t.offsetHeight;const r=new ResizeObserver(()=>{if(!t.isConnected)return;const e=t.offsetHeight,r=e-n,o=e>0!=n>0;if(n=e,!o||0===r||Tn)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=U??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,l=Math.max(i,window.innerHeight-a-Math.max(0,Wn.current.y)-24);hn(e=>({...e,h:Math.min(Math.max(i,e.h+r),l)}))});return r.observe(t),()=>r.disconnect()},[Y,pn,H,e,Tn,U]);const $n=!1!==X&&!H&&!F&&!oe,[Bn,jn]=E(()=>!$n);x(()=>{if(Bn||!e)return;if(!$n||Tn)return void jn(!0);const t=Be.current,n=Fe.current;if(!t||!n)return;const r=/* @__PURE__ */new WeakSet;let o=Wn.current.w,i=0;const a=()=>jn(!0),l=()=>{i=0;const e=Wn.current;if(Math.abs(e.w-o)>1||document.body.classList.contains("rosh-gesturing"))return void a();const l=Ge(),s=l.w-80;if(e.w>=s)return void a();const c=[],d=[];for(const e of[n,...Array.from(n.querySelectorAll("*"))]){const t=e.scrollWidth-e.clientWidth;if(t<=4||r.has(e))continue;const n=getComputedStyle(e).overflowX;"auto"!==n&&"scroll"!==n||(c.push(e),d.push(t))}if(!c.length)return;const u=Math.min(s,e.w+Math.max(...d)),h=u-e.w,m=t.style.width;t.style.width=`${u}px`;const p=c.map((e,t)=>({over:d[t],residual:e.scrollWidth-e.clientWidth}));t.style.width=m,p.forEach((e,t)=>{Ze(e,h)||r.add(c[t])});const w=function(e,t,n,r){const o=Math.min(t,n.w-2*r);if(o<=e.w+1)return e;const i=n.x+r,a=n.x+n.w-r-o,l=Math.min(Math.max(e.x-(o-e.w)/2,i),a);return{...e,x:Math.round(l),w:Math.round(o)}}(e,function(e,t,n){let r=e;for(const o of n)Ze(o,t)&&(r=Math.max(r,e+o.over));return Math.ceil(r)}(e.w,h,p),l,ut);w!==e&&(o=w.w,hn(w))};l();const s=new MutationObserver(()=>{i||(i=requestAnimationFrame(l))});s.observe(n,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["style","class","hidden"]});const c=setTimeout(a,zt);return()=>{s.disconnect(),i&&cancelAnimationFrame(i),clearTimeout(c)}},[Bn,e,$n,Tn]),C(()=>{Sn&&(zn(!0),hn(Zt()))},[Sn,Zt]),C(()=>{if(H)return;const e=()=>{zn(!1),hn(en())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[H,en]),C(()=>{e&&ln&&(vt[ln]=un,xt()),e&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[un,e,ln]),C(()=>{if(!e)return;const t=()=>{Tn?hn(Zt()):document.body.classList.contains("rosh-gesturing")||hn(rn)};window.addEventListener("resize",t);let n=null;return Tn&&(n=new MutationObserver(t),n.observe(document.body,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["class"]})),()=>{window.removeEventListener("resize",t),n?.disconnect()}},[e,Tn,Zt]),C(()=>{if(e){if(xe(!1),ke.current=!1,Re.current=!1,jn(!$n),ln&&vt[ln]){const e=vt[ln];return void hn(t=>rn({...e,...Y?{h:t.h}:{},...$n?{x:t.x,w:t.w}:{}}))}z&&(hn({x:z.x,y:z.y,w:z.w,h:z.h}),zn(z.maximized))}},[e]),C(()=>{if(!e||"auto"!==s)return;let t;const n=e=>{Be.current?.contains(e.target)&&!ke.current&&(ke.current=!0,t=setTimeout(()=>xe(!0),0))};return document.addEventListener("input",n,!0),document.addEventListener("change",n,!0),()=>{clearTimeout(t),document.removeEventListener("input",n,!0),document.removeEventListener("change",n,!0)}},[e,s]);const On="auto"===s?be:!0===s;ye(!(G||!e)&&On);const Hn=M(async()=>{if(!Re.current){if(On||"auto"===s&&ke.current){Re.current=!0;const e=ge,t=await w({title:"Discard changes?",message:e?`“${e}” has unsaved changes. Are you sure you want to close? All changes will be lost.`:"You have unsaved changes. Are you sure you want to close? All changes will be lost.",confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"});if(Re.current=!1,!t)return}t()}},[On,s,t,ge]);x(()=>{if(!e||!G)return;const t=e=>{e.detail?.windowKey===G&&Hn()};return window.addEventListener(xn,t),()=>window.removeEventListener(xn,t)},[e,G,Hn]);const Vn=k(null),Fn=M(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(Le(null),Ut(yt),Sn)return void e.preventDefault();e.preventDefault();const t=e.currentTarget,n=e.pointerId;let r=null;const o=e.clientX,i=e.clientY,a=Be.current,l=a?.getBoundingClientRect();let s,c,d,u;if(Vn.current){const t=Vn.current;Vn.current=null,u=t.w,d=t.h;const n=l?Math.min(Math.max(20,e.clientX-l.left),t.w-20):t.w/2;s=e.clientX-n,c=e.clientY-12,a&&(a.style.width=`${u}px`,a.style.height=`${d}px`,a.style.left=`${s}px`,a.style.top=`${c}px`)}else s=l?l.left:Wn.current.x,c=l?l.top:Wn.current.y,d=l?l.height:Wn.current.h,u=l?l.width:Wn.current.w;zn(!1),hn(e=>({...e,x:s,y:c,w:u,h:d}));let h=null;const m=e=>{if(!r){if(Math.abs(e.clientX-o)<fn&&Math.abs(e.clientY-i)<fn)return;r=yn(t,n,"move","move"),a&&(a.style.transition="none")}const l=s+e.clientX-o,d=Math.max(0,c+e.clientY-i);if(a&&(a.style.transform=`translate(${l-s}px, ${d-c}px)`),Wn.current={...Wn.current,x:l,y:d},!H){const t=function(e,t){const n=Qt(),r=e<=n.x+Jt,o=e>=n.x+n.w-Jt,i=t<=n.y+Jt,a=t>=n.y+n.h-Jt,l=e<=n.x+Gt,s=e>=n.x+n.w-Gt,c=t<=n.y+Gt,d=t>=n.y+n.h-Gt;return i&&l?"tl":i&&s?"tr":a&&l?"bl":a&&s?"br":c&&r?"tl":c&&o?"tr":d&&r?"bl":d&&o?"br":i?"top":r?"left":o?"right":null}(e.clientX,e.clientY);t!==h&&(h=t,t?sn(an(t)):cn())}},p=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",p),r?.(),cn();const e=rn({...Wn.current});if(Wn.current=e,!H&&h){Vn.current={x:s,y:c,w:u,h:d};const e=an(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 hn(e)}if(H){const t=e.x+e.w/2,n=window.innerWidth/2;Ke(t>n?"right":"left")}a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.transform="",a.style.transition=""),hn(e)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",p)},[]),qn=M((e,t)=>{if(0!==e.button)return;e.preventDefault(),e.stopPropagation();const n=e.currentTarget,r=e.pointerId;let o=null;const i=e.clientX,a=e.clientY,l=Be.current,s=l?.getBoundingClientRect(),c=s?s.left:Wn.current.x,d=s?s.top:Wn.current.y,u=s?s.width:Wn.current.w,h=s?s.height:Wn.current.h,m="sw"===t||"nw"===t||"w"===t,p="ne"===t||"nw"===t||"n"===t,w="se"===t||"ne"===t||"e"===t,f="se"===t||"sw"===t||"s"===t;zn(!1),hn({x:c,y:d,w:u,h:h}),Wn.current={x:c,y:d,w:u,h:h};let y=0,g=null;const v=()=>{if(y=0,!g)return;const e=g;g=null,Wn.current=e,l&&(l.style.left=`${e.x}px`,l.style.top=`${e.y}px`,l.style.width=`${e.w}px`,l.style.height=`${e.h}px`)},b=e=>{if(!o){if(Math.abs(e.clientX-i)<fn&&Math.abs(e.clientY-a)<fn)return;o=yn(n,r,wn[t],"resize")}g=((e,t)=>{let n=c,r=d,o=u,i=h;if(w&&(o=Math.max(tn,u+e)),f&&(i=Math.max(nn,h+t)),m){const t=Math.max(tn,u-e);n=c+u-t,o=t}if(p){const e=Math.max(nn,h-t);r=d+h-e,i=e}return{x:n,y:r,w:o,h:i}})(e.clientX-i,e.clientY-a),y||(y=requestAnimationFrame(v))},x=()=>{window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",x),y&&cancelAnimationFrame(y),v(),o?.(),hn({...Wn.current})};window.addEventListener("pointermove",b),window.addEventListener("pointerup",x)},[]),Yn=M(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(),Ut(yt),"Enter"===e.key)return void(Tn?(zn(!1),hn(en())):(zn(!0),hn(Zt())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{Vn.current||(Vn.current={...Wn.current})};if(r<0)return e(),zn(!0),void hn(Zt());if(r>0){if(Tn)return zn(!1),void hn(en());if(Vn.current){const e=rn(Vn.current);return Vn.current=null,Wn.current=e,void hn(e)}return void Xt(yt)}e(),zn(!1);const t=an(n<0?"left":"right");return Wn.current=t,void hn(t)}if(Tn)return;const o=Wn.current,i=e.shiftKey?{...o,w:Math.max(tn,o.w+24*n),h:Math.max(nn,o.h+24*r)}:rn({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});Wn.current=i,hn(i)},[yt,Tn,en,Zt]),Un=M(e=>{Vn.current||(Vn.current={...Wn.current}),zn(!1);const t=an(e);Wn.current=t,hn(t),Ut(yt)},[yt]),Xn=Sn||St?{}:{tabIndex:0,role:"group","aria-label":ge?`${ge} — ${fe.windowSuffix}`:fe.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:Yn},_n=()=>{zn(!0),hn(Zt())},Jn=M(()=>{const e=Be.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(it);t&&!t.disabled&&t.click()}},[]);C(()=>{if(!e)return;const t=e=>{if(Dt[Dt.length-1]===yt&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),Jn();else{if("INPUT"===t.tagName&&t.closest("form"))return;e.preventDefault()}}};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e,Jn,yt]),C(()=>{if(!e)return;const t=e=>{Dt[Dt.length-1]===yt&&((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:yt}})),ke.current=!1,xe(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:yt}}))))};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e]),C(()=>{if(!e)return;if(H)return;const t=e=>{if("Escape"===e.key&&Dt[Dt.length-1]===yt){if(f(e))return e.preventDefault(),void e.stopPropagation();e.preventDefault(),e.stopPropagation(),Hn()}};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e,Hn,yt,H]);const Gn=e&&(void 0!==c||void 0!==m),Qn=M(e=>{const t=document.getElementById("nav-boundary-toast");t&&t.remove();const n="bottom"===e?["That's the last one, chief.","You've hit rock bottom... of the list.","End of the line, buddy.","Nothing left. Go outside.","Congratulations, you scrolled to the void.","There's no more. I checked.","You've reached the edge of the known universe.","Plot twist: there is no next one.","Even scrolling has limits. Unlike your ambition.","Last one. Time to touch grass."]:["Already at the top. Overachiever.","There is no item above this. Trust me.","You're #1. Literally.","Can't go higher. You've peaked.","This is it. The summit. The top.","First item. No VIP lounge above this.","Going up? Nope. Elevator's broken.","You want negative indexes? Bold.","Top of the list. Top of the world.","The only way is down from here."],r=n[Math.floor(Math.random()*n.length)],o=document.createElement("div");o.id="nav-boundary-toast",o.className="fixed bottom-6 left-1/2 -translate-x-1/2 z-[9999] bg-gray-900 text-white px-5 py-2.5 rounded-lg shadow-lg text-sm font-medium transition-opacity duration-300",o.textContent=r,document.body.appendChild(o),setTimeout(()=>{o.style.opacity="0",setTimeout(()=>o.remove(),300)},2e3)},[]);if(C(()=>{if(!e)return;const t=e=>{if(Dt[Dt.length-1]!==yt)return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&Gn&&(e.preventDefault(),c?c():Qn("bottom")),"k"===e.key&&Gn&&(e.preventDefault(),m?m():Qn("top"))))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e,c,m,Gn,Qn,yt]),!e||on.current)return null;const Zn=St?function(e){if("undefined"==typeof document)return null;const t=Array.from(document.querySelectorAll("[data-modal-panel]")).filter(e=>{const t=e;return!t.hasAttribute("data-utility")&&!t.hasAttribute("data-widget")&&"none"!==t.style.display});t.sort((e,t)=>(e.getAttribute("data-modal-id")||"").localeCompare(t.getAttribute("data-modal-id")||""));const n=t.findIndex(t=>t.getAttribute("data-modal-id")===e),r=t.length;if(n<0||r<1)return null;const o=Math.ceil(Math.sqrt(r)),i=Math.ceil(r/o),a=Math.floor(n/o),l=n%o,s=r-o*(i-1),c=a===i-1&&s<o,d=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,u=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-width"))||0,h=(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")||"bottom").trim(),m="left"===h?u:0,p="right"===h?u:0,w="top"===h?d:0,f="top"===h||"left"===h||"right"===h?0:d,y=m,g=w,v=(window.innerWidth-m-p-20*(o+1))/o,b=(window.innerHeight-w-f-14*(i+1)-22*i)/i;return{x:y+20+l*(v+20)+(c?(o-s)*(v+20)/2:0),y:g+14+a*(b+14+22),w:v,h:b}}(yt):null,er=St&&Zn?Math.min(Zn.w/un.w,Zn.h/un.h):1,tr=(()=>{if(St&&Zn){const e=er,t=un.w*e,n=un.h*e,r=Zn.x+(Zn.w-t)/2-un.x,o=Zn.y+(Zn.h-n)/2-un.y,i=Tt||Kt;return{transform:`translate(${r}px, ${o}px) scale(${e})`,transformOrigin:"top left",transition:"transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 280ms",cursor:"pointer",zIndex:i?2020:2010,boxShadow:i?"0 24px 72px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.55), 0 0 36px 12px rgba(96,165,250,0.85), 0 0 96px 28px rgba(96,165,250,0.55)":"0 16px 48px rgba(0,0,0,0.55)",pointerEvents:"auto"}}if(Rt&&Nt){const e="picked"===Vt;return{transition:e?"transform 640ms cubic-bezier(0.34, 1.42, 0.64, 1), box-shadow 600ms":"transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 600ms",...e?{zIndex:2030}:{}}}return null})(),nr=/* @__PURE__ */I("div",{children:[
|
|
54
|
+
/* @__PURE__ */I("div",{ref:Be,"data-modal-panel":!0,"data-modal-id":yt,"data-window-key":G||void 0,...j?{"data-utility":""}:{},...Ce?{"data-pinned-top":""}:{},...H?{"data-widget":""}:{},className:"fixed rounded-2xl flex flex-col overflow-hidden "+(H?kt?"shadow-2xl":"shadow-lg":"border "+(kt?"shadow-2xl border-gray-200":"shadow-lg border-gray-300")),onMouseDownCapture:e=>{if(Ve.current=!1,St){if(e.target.closest("[data-expose-close]"))return;return e.preventDefault(),e.stopPropagation(),Dn(yt),Nn(!1),void Ut(yt)}if(!kt&&!H&&!Ce&&0===e.button){const t=e.target;t.closest("[data-modal-panel]")===Be.current&&t.closest("button, input, a, select, textarea")&&!t.closest("[data-window-chrome]")&&(e.preventDefault(),e.stopPropagation(),Ve.current=!0,Le(null),Ut(yt),window.addEventListener("mouseup",()=>{setTimeout(()=>{Ve.current=!1},0)},{once:!0}))}},onClickCapture:e=>{Ve.current&&(Ve.current=!1,e.preventDefault(),e.stopPropagation())},onMouseDown:e=>{if(St)return;Le(null);e.target.closest("[data-modal-panel]")===Be.current&&(e.target.closest("button, input, a, select, textarea")||Ut(yt))},style:oe?{zIndex:gt+1,top:0,left:0,right:0,bottom:"var(--mobile-bottom-nav, 56px)",width:"auto",height:"auto",transform:`translateX(${ie}px)`,transition:le?"none":"transform 180ms ease-out",...H?{display:"none"}:{},...gt<0?{display:"none"}:{},...kt||Ce||he&&G===he?{}:{display:"none"}}:{zIndex:Ce?p.pinnedWindow:gt+1,width:un.w,height:un.h,top:un.y,...H&&"right"===$e?{right:window.innerWidth-un.x-un.w}:{left:un.x},...gt<0&&!Ce?{display:"none"}:{},...tr??{}},children:[oe&&!H&&/* @__PURE__ */D("div",{onPointerDown:ue,className:"absolute top-0 bottom-0 left-0 w-[22px] z-[5]",style:{touchAction:"pan-y"},"aria-hidden":"true"}),H||oe?null:
|
|
55
|
+
/* @__PURE__ */I("div",V?{onPointerDown:Fn,"data-window-chrome":"",...Xn,className:"flex items-center justify-between px-3 py-1.5 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-2xl focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(kt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:kt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
56
|
+
/* @__PURE__ */I("div",{"data-window-title":!0,title:ge,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-1.5",style:{color:kt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!St&&dt(),
|
|
57
|
+
/* @__PURE__ */D("span",{className:"truncate",children:St?at(me):me})]}),!St&&/* @__PURE__ */I("div",{className:"flex items-center gap-1 shrink-0 ml-2",children:[j&&/* @__PURE__ */D("button",{onClick:()=>Ee(e=>!e),title:Ce?fe.unpin:fe.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+(Ce?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */D("svg",{className:"h-3 w-3",fill:Ce?"currentColor":"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 3.75V16.5L12 14.25 7.5 16.5V3.75m9 0H18A2.25 2.25 0 0120.25 6v12A2.25 2.25 0 0118 20.25H6A2.25 2.25 0 013.75 18V6A2.25 2.25 0 016 3.75h1.5m9 0h-9"})})}),
|
|
58
|
+
/* @__PURE__ */D("button",{type:"button",onClick:Hn,className:"rounded p-0.5 text-gray-400 hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */D(K,{className:"h-4 w-4"})})]})]}:F?{onPointerDown:Fn,"data-window-chrome":"",...Xn,className:"flex items-center justify-between px-3 py-1.5 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-2xl focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(kt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:kt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
59
|
+
/* @__PURE__ */I("div",{"data-window-title":!0,title:ge,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-1.5",style:{color:kt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!St&&dt(),
|
|
60
|
+
/* @__PURE__ */D("span",{className:"truncate",children:St?at(me):me})]}),!St&&/* @__PURE__ */I("div",{className:"flex items-center gap-0.5 shrink-0 ml-2",children:[j&&/* @__PURE__ */D("button",{onClick:()=>Ee(e=>!e),title:Ce?fe.unpin:fe.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+(Ce?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */D("svg",{className:"h-3 w-3",fill:Ce?"currentColor":"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 3.75V16.5L12 14.25 7.5 16.5V3.75m9 0H18A2.25 2.25 0 0120.25 6v12A2.25 2.25 0 0118 20.25H6A2.25 2.25 0 013.75 18V6A2.25 2.25 0 016 3.75h1.5m9 0h-9"})})}),
|
|
61
|
+
/* @__PURE__ */D("button",{onClick:()=>Xt(yt),title:fe.minimize,className:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",children:"─"}),!Sn&&/* @__PURE__ */D(mn,{maximized:Tn,onToggleMax:()=>{Tn?(zn(!1),hn(en())):_n()},onSnap:Un,buttonClassName:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",strings:fe}),
|
|
62
|
+
/* @__PURE__ */D("button",{type:"button",onClick:Hn,className:"rounded p-0.5 text-gray-400 hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */D(K,{className:"h-4 w-4"})})]})]}:{onPointerDown:Fn,"data-window-chrome":"",...Xn,className:"flex items-center justify-between px-4 py-2.5 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-2xl focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(kt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:kt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
63
|
+
/* @__PURE__ */I("div",{"data-window-title":!0,title:ge,className:"text-base font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:kt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!St&&dt(),
|
|
64
|
+
/* @__PURE__ */D("span",{className:"truncate",children:St?at(me):me})]}),!St&&/* @__PURE__ */I("div",{className:"flex items-center gap-1.5 shrink-0 ml-4",children:[Gn&&/* @__PURE__ */I("span",{className:"flex items-center gap-1 mr-1 text-[10px] text-gray-400",children:[
|
|
65
|
+
/* @__PURE__ */D("kbd",{className:"rounded border border-gray-300 bg-gray-200 px-1.5 py-0.5 font-medium text-gray-500",children:"K"}),
|
|
66
|
+
/* @__PURE__ */D("span",{children:fe.prev}),
|
|
67
|
+
/* @__PURE__ */D("kbd",{className:"rounded border border-gray-300 bg-gray-200 px-1.5 py-0.5 font-medium ml-1 text-gray-500",children:"J"}),
|
|
68
|
+
/* @__PURE__ */D("span",{children:fe.next})]}),j&&/* @__PURE__ */D("button",{onClick:()=>Ee(e=>!e),title:Ce?fe.unpin:fe.pinOnTop,className:"text-xs px-2 py-1 rounded hover:bg-gray-200 "+(Ce?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */D("svg",{className:"h-3.5 w-3.5",fill:Ce?"currentColor":"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 3.75V16.5L12 14.25 7.5 16.5V3.75m9 0H18A2.25 2.25 0 0120.25 6v12A2.25 2.25 0 0118 20.25H6A2.25 2.25 0 013.75 18V6A2.25 2.25 0 016 3.75h1.5m9 0h-9"})})}),
|
|
69
|
+
/* @__PURE__ */D("button",{onClick:()=>Xt(yt),title:fe.minimize,className:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",children:"─"}),!Sn&&/* @__PURE__ */D(mn,{maximized:Tn,onToggleMax:()=>{Tn?(zn(!1),hn(en())):_n()},onSnap:Un,buttonClassName:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",strings:fe}),
|
|
70
|
+
/* @__PURE__ */D("kbd",{className:"rounded border border-gray-300 bg-gray-200 px-1.5 py-0.5 text-[10px] font-medium text-gray-400",children:"ESC"}),
|
|
71
|
+
/* @__PURE__ */D("button",{type:"button",onClick:Hn,className:"rounded-md text-gray-400 hover:text-gray-600",children:/* @__PURE__ */D(K,{className:"h-5 w-5"})})]})]}),ne&&Ae&&!H&&!oe&&/* @__PURE__ */D("div",{"aria-hidden":"true",className:"h-[3px] shrink-0 pointer-events-none",style:{backgroundColor:`rgb(var(--window-accent-rgb) / ${kt?.9:.55})`}}),
|
|
72
|
+
/* @__PURE__ */D(tt.Provider,{value:yt,children:/* @__PURE__ */D(mt.Provider,{value:{rightRef:qe,leftRef:Ye,notify:()=>Xe(!0),active:kt,isDirty:On,footerOpen:Je&&!H&&!V&&!F&&!oe},children:/* @__PURE__ */D("div",{ref:Fe,...H?{onPointerDown:Fn,onContextMenu:e=>{e.preventDefault(),We({x:e.clientX,y:e.clientY})}}:{},className:`flex-1 min-h-0 flex flex-col ${H?"p-0 cursor-move":F||q?"p-0":V?"p-2":"p-4"} ${H?"":"backdrop-blur-sm"} ${!1===v||F||q?"overflow-hidden":"overflow-y-auto overscroll-contain"} ${H?"rounded-2xl select-none":""}`,style:{...H?{touchAction:"none"}:{},backgroundColor:H?"transparent":kt?"rgb(var(--window-content-rgb) / var(--active-content-opacity, 0.9))":"rgb(var(--window-content-rgb) / var(--inactive-content-opacity, 0.8))"},children:/* @__PURE__ */D(Q,{children:re})})})}),H&&De&&/* @__PURE__ */I(d,{minWidth:160,style:{left:De.x,top:De.y},onClose:()=>We(null),children:[
|
|
73
|
+
/* @__PURE__ */D(u,{onClick:()=>{We(null),window.dispatchEvent(new CustomEvent("widget-open-settings",{detail:yt}))},children:"Settings"}),
|
|
74
|
+
/* @__PURE__ */D(h,{}),_&&/* @__PURE__ */I(W,{children:[_,
|
|
75
|
+
/* @__PURE__ */D(h,{})]}),
|
|
76
|
+
/* @__PURE__ */I(u,{onClick:()=>{We(null),Ee(e=>!e)},children:[
|
|
77
|
+
/* @__PURE__ */D("span",{className:"flex-1",children:"Always on Top"}),Ce&&/* @__PURE__ */D("svg",{className:"h-4 w-4 text-blue-600 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]}),
|
|
78
|
+
/* @__PURE__ */D(h,{}),
|
|
79
|
+
/* @__PURE__ */D(u,{onClick:()=>{We(null),Hn()},children:"Close"})]}),
|
|
80
|
+
/* @__PURE__ */I("div",{onPointerDown:Fn,ref:_e,className:`px-4 py-2 border-t border-gray-200 shrink-0 flex items-center justify-between text-xs select-none cursor-move${kt?" backdrop-blur-sm":""}${H||V||F||oe||!Je?" hidden":""}`,style:{touchAction:"none",backgroundColor:kt?"rgb(var(--window-footer-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-footer-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
81
|
+
/* @__PURE__ */I("div",{className:"flex items-center gap-2 min-w-0",children:[ot&&/* @__PURE__ */D(te,{auto:!0}),R,
|
|
82
|
+
/* @__PURE__ */D("div",{ref:Ye,"data-modal-actions-left":!0,className:"flex items-center gap-2"}),g]}),
|
|
83
|
+
/* @__PURE__ */I("div",{className:"flex items-center gap-2 ml-auto",children:[
|
|
84
|
+
/* @__PURE__ */D("div",{ref:qe,"data-modal-actions":!0,className:"flex items-center gap-2"}),P]})]}),!H&&!oe&&!St&&kt&&/* @__PURE__ */I(W,{children:[
|
|
85
|
+
/* @__PURE__ */D("div",{onPointerDown:e=>qn(e,"se"),className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize z-10"}),
|
|
86
|
+
/* @__PURE__ */D("div",{onPointerDown:e=>qn(e,"sw"),className:"absolute bottom-0 left-0 w-3 h-3 cursor-nesw-resize z-10"}),
|
|
87
|
+
/* @__PURE__ */D("div",{onPointerDown:e=>qn(e,"ne"),className:"absolute top-0 right-0 w-3 h-3 cursor-nesw-resize z-10"}),
|
|
88
|
+
/* @__PURE__ */D("div",{onPointerDown:e=>qn(e,"nw"),className:"absolute top-0 left-0 w-3 h-3 cursor-nwse-resize z-10"}),
|
|
89
|
+
/* @__PURE__ */D("div",{onPointerDown:e=>qn(e,"n"),className:"absolute top-0 left-3 right-3 h-1 cursor-ns-resize"}),
|
|
90
|
+
/* @__PURE__ */D("div",{onPointerDown:e=>qn(e,"s"),className:"absolute bottom-0 left-3 right-3 h-1 cursor-ns-resize"}),
|
|
91
|
+
/* @__PURE__ */D("div",{onPointerDown:e=>qn(e,"e"),className:"absolute top-3 bottom-3 right-0 w-1 cursor-ew-resize"}),
|
|
92
|
+
/* @__PURE__ */D("div",{onPointerDown:e=>qn(e,"w"),className:"absolute top-3 bottom-3 left-0 w-1 cursor-ew-resize"})]}),St&&/* @__PURE__ */D("div",{className:"absolute inset-0",style:{zIndex:9999,cursor:"pointer",background:"transparent"},onMouseEnter:()=>Wt(!0),onMouseLeave:()=>Wt(!1),onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),Ut(yt),Nn(!1)},onClick:e=>{e.stopPropagation(),e.preventDefault()},children:Tt&&/* @__PURE__ */D("button",{type:"button","data-expose-close":!0,"aria-label":we.taskbar.closeWindow,title:"Close",className:"absolute flex items-center justify-center rounded-full bg-black/55 text-white shadow-lg ring-1 ring-white/40 transition-colors hover:bg-red-500",style:{top:8,right:8,width:30,height:30,transform:`scale(${1/er})`,transformOrigin:"top right",zIndex:1e4},onMouseDown:e=>{e.stopPropagation(),e.preventDefault()},onClick:e=>{e.stopPropagation(),e.preventDefault(),Hn()},children:/* @__PURE__ */D("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.2,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})})]}),St&&Zn&&/* @__PURE__ */D("div",{className:"fixed pointer-events-none select-none truncate text-center",style:{left:Zn.x,top:Zn.y+Zn.h+4,width:Zn.w,zIndex:Tt?2021:2011,color:"white",fontSize:12,fontWeight:500,textShadow:"0 1px 2px rgba(0,0,0,0.6)"},children:at(me)})]}),rr=Me&&/* @__PURE__ */I(d,{style:{left:Me.x,top:Me.y},onClose:()=>Le(null),minWidth:160,children:[!H&&!V&&/* @__PURE__ */I(W,{children:[
|
|
93
|
+
/* @__PURE__ */I(u,{onClick:()=>{Xt(yt),Le(null)},children:[
|
|
94
|
+
/* @__PURE__ */D("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 12h-15"})}),fe.minimize]}),!Sn&&/* @__PURE__ */I(u,Tn?{onClick:()=>{zn(!1),hn(en()),Le(null)},children:[
|
|
95
|
+
/* @__PURE__ */D("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 4.5v15m6-15v15M4.5 9h15M4.5 15h15"})}),fe.windowed]}:{onClick:()=>{_n(),Le(null)},children:[
|
|
96
|
+
/* @__PURE__ */D("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"})}),fe.maximize]})]}),j&&/* @__PURE__ */I(u,{onClick:()=>{Ee(e=>!e),Le(null)},children:[
|
|
97
|
+
/* @__PURE__ */D("svg",{className:"h-4 w-4 "+(Ce?"text-blue-600":"text-gray-400"),fill:Ce?"currentColor":"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 3.75V16.5L12 14.25 7.5 16.5V3.75m9 0H18A2.25 2.25 0 0120.25 6v12A2.25 2.25 0 0118 20.25H6A2.25 2.25 0 013.75 18V6A2.25 2.25 0 016 3.75h1.5m9 0h-9"})}),Ce?fe.unpin:fe.pinOnTop]}),Ne&&/* @__PURE__ */I(u,{onClick:()=>{Le(null),Ie()},children:[
|
|
98
|
+
/* @__PURE__ */D("svg",{className:"h-4 w-4 "+(Pe?"text-yellow-500":"text-gray-400"),fill:Pe?"currentColor":"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z"})}),Pe?we.taskbar.removeFromDesktop:we.taskbar.addToDesktop]}),(st[yt]||[]).length>0&&/* @__PURE__ */D(W,{children:(st[yt]||[]).map((e,t)=>/* @__PURE__ */I(u,{onClick:()=>{Le(null),e.onClick()},children:[e.icon,e.label]},t))}),
|
|
99
|
+
/* @__PURE__ */D(h,{}),
|
|
100
|
+
/* @__PURE__ */I(u,{danger:!0,onClick:()=>{Le(null),Hn()},children:[
|
|
101
|
+
/* @__PURE__ */D(K,{className:"h-4 w-4"}),fe.close]})]}),or=!!G&&ft.some(e=>e.id===G),ir=!Ct||or||H?null:/* @__PURE__ */I("div",{"data-modal-restore-tab":!0,"data-modal-id":yt,className:"fixed left-1/2 z-[1200] flex -translate-x-1/2 items-center gap-1 rounded-lg border border-gray-300 bg-white px-1.5 py-1 shadow-lg",style:{bottom:"calc(var(--taskbar-height, 0px) + 12px)"},children:[
|
|
102
|
+
/* @__PURE__ */D("button",{type:"button",onClick:()=>Ut(yt),title:fe.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:ge||fe.windowSuffix}),
|
|
103
|
+
/* @__PURE__ */D("button",{type:"button",onClick:()=>Ut(yt),title:fe.restore,"aria-label":fe.restore,className:"rounded px-1.5 py-0.5 text-xs leading-none text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:"▴"}),
|
|
104
|
+
/* @__PURE__ */D("button",{type:"button",onClick:()=>{Hn()},title:fe.close,"aria-label":fe.close,className:"rounded px-1.5 py-0.5 text-xs leading-none text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:"✕"})]});return $(
|
|
105
|
+
/* @__PURE__ */I(nt.Provider,{value:null,children:[nr,rr,ir]}),document.body)}"undefined"!=typeof window&&window.addEventListener("keydown",e=>{Cn&&"Escape"===e.key&&(Bn(null),Nn(!1))});var Fn=100,qn={past:[],future:[]};function Yn(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>Fn?r.slice(r.length-Fn):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:qn}}var Un=/* @__PURE__ */new Set(["INPUT","TEXTAREA","SELECT"]);var Xn=500,_n=250;function Jn({children:e,canEdit:t=!0,perms:n,windowId:r}){const[o,i]=A(Yn,qn),a=k(/* @__PURE__ */new Map),[s,c]=E(0),d=s>0,[u,h]=E(0),[m,p]=E(0),w=m>0,{hasAnyPerm:f}=l(),y=t&&0===u&&(!(n&&n.length>0)||f(n)),g=k(null),v=k(!1),x=M(()=>{const e={};for(const[t,n]of a.current)e[t]=n.getLast();return e},[]),L=M((e,t)=>{a.current.has(e)||c(e=>e+1),a.current.set(e,t)},[]),S=M(e=>{a.current.delete(e)&&c(e=>e-1)},[]),T=M(e=>{h(t=>t+(e?1:-1))},[]),z=M(e=>{p(t=>t+(e?1:-1))},[]),[P,W]=E(0),$=P>0,K=M(e=>{W(t=>t+(e?1:-1))},[]),R=b(Z),B=R?.claimReadOnly;C(()=>{if(B&&!y)return B(!0),()=>B(!1)},[B,y]);const j=R?.claimOwnMount;C(()=>{if(j&&$)return j(!0),()=>j(!1)},[j,$]);const O=k({last:0,count:0,tripped:!1}),H=k(!1),V=M((e,t,n)=>{if(v.current)return void(n&&function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(Array.isArray(e)!==Array.isArray(t))return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}(n.prev,n.next)||(H.current=!0));if(!y||g.current)return;const r=O.current;if(r.tripped)return;const o=Date.now();if(o-r.last>_n&&(r.count=0),r.last=o,++r.count>Xn)return r.tripped=!0,void console.error(`[efficient-shell] UndoProvider: "${e}" recorded ${Xn} undo steps with no pause between them, which no user action can do. The value passed to useUndoable for this slice is almost certainly rebuilt on every render (a .map/.filter/object literal in the call) rather than held in state, so it reads as changed every time — and since recording a step re-renders the form, that is a loop. Undo recording is now off for this form to keep the tab responsive.`);g.current={values:x(),label:e,coalesceKey:t},queueMicrotask(()=>{const e=g.current;g.current=null,e&&i({type:"record",step:e})})},[y,x]),F=M(e=>{for(const[t,n]of Object.entries(e)){const e=a.current.get(t);e&&(e.setLast(n),e.apply(n))}},[]),q=M(()=>{const e=o.past[o.past.length-1];if(!e)return;const t={values:x(),label:e.label,coalesceKey:null};F(e.values),i({type:"undo",redoStep:t})},[o.past,x,F]),Y=M(()=>{const e=o.future[0];if(!e)return;const t={values:x(),label:e.label,coalesceKey:null};F(e.values),i({type:"redo",undoStep:t})},[o.future,x,F]),[U,X]=E(0),_=k(0),J=k(0),G=k(!1),Q=M(()=>{v.current=!0,H.current=!1,g.current=null,_.current+=1,J.current=_.current,X(_.current)},[]),ee=k(void 0),ne=M(e=>{void 0!==e&&(void 0!==ee.current&&e!==ee.current&&(G.current=!0),ee.current=e),Q()},[Q]);C(()=>{v.current&&U===J.current&&(v.current=!1,g.current=null,(H.current||G.current)&&i({type:"clear"}),H.current=!1,G.current=!1)},[U]);const re=M(()=>{G.current=!0,i({type:"clear"}),Q()},[Q]),oe=y&&o.past.length>0,ie=y&&o.future.length>0,ae=kn(r),le=k({undo:q,redo:Y,canUndo:oe,canRedo:ie});le.current={undo:q,redo:Y,canUndo:oe,canRedo:ie},C(()=>{if(!ae||!y)return;const e=e=>{const t=function(e){if(!e.metaKey&&!e.ctrlKey||e.altKey)return null;const t=e.key.toLowerCase(),n="z"===t?e.shiftKey?"redo":"undo":"y"!==t||!e.ctrlKey||e.metaKey||e.shiftKey?null:"redo";if(!n)return null;const r=e.target;return r?.isContentEditable||r?.tagName&&Un.has(r.tagName.toUpperCase())?null:n}(e);if(!t)return;const n=le.current;("undo"===t?n.canUndo:n.canRedo)&&(e.preventDefault(),"undo"===t?n.undo():n.redo())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ae,y]);const se=N(()=>({register:L,unregister:S,record:V,undo:q,redo:Y,clear:re,baseline:ne,canUndo:oe,canRedo:ie,enabled:y,hasState:d,handMounted:$,claimOwnMount:K,claimReadOnly:T,declaredEditable:w,claimEditable:z,undoLabel:oe?o.past[o.past.length-1].label:null,redoLabel:ie?o.future[0].label:null}),[L,S,V,q,Y,re,ne,oe,ie,y,d,$,K,T,w,z,o.past,o.future]),ce=""!==pt(),de=b(mt)?.footerOpen??!1,ue=ce&&y&&d&&!$&&de;/* @__PURE__ */
|
|
106
|
+
return I(Z.Provider,{value:se,children:[ue&&/* @__PURE__ */D(ft,{position:"left",quiet:!0,children:/* @__PURE__ */D(te,{auto:!0})}),e]})}function Gn(){const e=b(Z),t=M(()=>{},[]);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 Qn(e){const t=b(Z),n=t?.claimReadOnly,r=t?.claimEditable;C(()=>{const t=e?r:n;if(t)return t(!0),()=>t(!1)},[n,r,e])}function Zn(e,t,n){const r=b(Z),o=z(),i=k(e),a=k(t);a.current=t,C(()=>{if(r)return r.register(o,{getLast:()=>i.current,setLast:e=>{i.current=e},apply:e=>a.current(e)}),()=>r.unregister(o)},[r,o]);const{label:l,coalesceKey:s=null}=n,c=k(r);c.current=r;const d=k({label:l,coalesceKey:s});d.current={label:l,coalesceKey:s},C(()=>{const t=c.current;t&&(Object.is(e,i.current)||(t.record(d.current.label,d.current.coalesceKey,{prev:i.current,next:e}),i.current=e))},[e])}function er(e,t){const[n,r]=E(e);return Zn(n,e=>r(()=>e),t),[n,r]}export{yt as CancelButton,ht as CopyButton,ke as DocFavStar,de as EntityWindowFallback,se as EntityWindowLoading,ue as EntityWindowState,ae as LoadingSpinner,it as MODAL_SUBMIT_SELECTOR,Vn as Modal,ft as ModalActions,Je as SIDEBAR_STRIP_W,te as UndoControls,Jn as UndoProvider,q as WINDOW_REGISTRY,G as WindowCrashedFallback,Q as WindowErrorBoundary,Ke as WindowManagerProvider,dt as WindowTitle,Xe as beginWindowGesture,qt as cancelWindowFront,J as client_default,jn as commitExposeHighlight,_e as drainPerfEvents,Tn as exitExposeMode,Tt as forgetMaximizedWindowBoxes,vn as getActiveModalId,Ne as getActiveWindowRoute,Rn as getExposeHighlight,Nt as getWindowPosition,me as isDraftEntityId,pe as isDraftEntityWindow,H as isEntityEntry,O as isPageEntry,X as isShellApiClientConfigured,Ue as markMenuOpen,Ft as requestWindowFront,Bn as setExposeHighlight,Ye as setPerfCollecting,U as setShellApiClient,F as setShellWindowRegistry,Lt as setWindowDefaultPosition,St as setWindowPosition,Kn as subscribeExposeHighlight,Sn as toggleExposeMode,pt as useEnclosingModalId,kn as useIsActiveWindow,wt as useModalActive,Gn as useUndo,Qn as useUndoCanEdit,Zn as useUndoable,er as useUndoableState,lt as useWidgetSettings,ye as useWindowDirty,ve as useWindowManager,ct as useWindowMenuItem,ut as useWindowTitle};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(t){return t.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"}[t]||t))}export{t as escapeHtml};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=null;function t(t,s,i="sine",o=.15){try{const n=(e||(e=new AudioContext),e),c=n.createOscillator(),r=n.createGain();c.type=i,c.frequency.value=t,r.gain.value=o,r.gain.exponentialRampToValueAtTime(.001,n.currentTime+s),c.connect(r),r.connect(n.destination),c.start(),c.stop(n.currentTime+s)}catch{}}var s={label:"Classic",success:()=>{t(523,.1,"sine",.1),setTimeout(()=>t(659,.1,"sine",.1),100),setTimeout(()=>t(784,.15,"sine",.1),200)},error:()=>{t(200,.15,"sawtooth",.08),setTimeout(()=>t(180,.15,"sawtooth",.08),150)},notification:()=>{t(880,.08,"sine",.12),setTimeout(()=>t(1100,.12,"sine",.1),100)},startup:()=>{t(392,.15,"sine",.08),setTimeout(()=>t(523,.15,"sine",.08),150),setTimeout(()=>t(659,.15,"sine",.08),300),setTimeout(()=>t(784,.25,"sine",.1),450)},logout:()=>{t(784,.15,"sine",.08),setTimeout(()=>t(659,.15,"sine",.08),150),setTimeout(()=>t(523,.15,"sine",.08),300),setTimeout(()=>t(392,.25,"sine",.06),450)},click:()=>{t(800,.05,"square",.05)},timerDone:()=>{for(let e=0;e<3;e++)setTimeout(()=>t(1e3,.15,"sine",.12),300*e),setTimeout(()=>t(800,.15,"sine",.1),300*e+150)}},i={classic:s,minimal:{label:"Minimal",success:()=>{t(1200,.06,"sine",.08)},error:()=>{t(300,.1,"triangle",.06)},notification:()=>{t(900,.06,"sine",.08)},startup:()=>{t(600,.12,"sine",.06),setTimeout(()=>t(900,.15,"sine",.06),120)},click:()=>{t(1e3,.03,"sine",.03)},timerDone:()=>{t(1e3,.2,"sine",.1),setTimeout(()=>t(1e3,.2,"sine",.1),400)},logout:()=>{t(900,.1,"sine",.06),setTimeout(()=>t(600,.15,"sine",.05),120)}},retro:{label:"Retro",success:()=>{t(440,.08,"square",.08),setTimeout(()=>t(550,.08,"square",.08),80),setTimeout(()=>t(660,.08,"square",.08),160),setTimeout(()=>t(880,.12,"square",.1),240)},error:()=>{t(150,.2,"square",.06),setTimeout(()=>t(100,.3,"square",.06),200)},notification:()=>{t(660,.06,"square",.08),setTimeout(()=>t(880,.06,"square",.08),80),setTimeout(()=>t(660,.06,"square",.08),160)},startup:()=>{[262,330,392,523].forEach((e,s)=>setTimeout(()=>t(e,.1,"square",.07),100*s))},click:()=>{t(600,.03,"square",.06)},timerDone:()=>{for(let e=0;e<4;e++)setTimeout(()=>t(880,.1,"square",.1),200*e)},logout:()=>{[523,392,330,262].forEach((e,s)=>setTimeout(()=>t(e,.1,"square",.07),100*s))}},soft:{label:"Soft",success:()=>{t(700,.2,"sine",.06),setTimeout(()=>t(900,.25,"sine",.06),200)},error:()=>{t(250,.2,"sine",.05)},notification:()=>{t(600,.15,"triangle",.06),setTimeout(()=>t(800,.2,"triangle",.05),180)},startup:()=>{t(400,.3,"sine",.05),setTimeout(()=>t(500,.3,"sine",.05),300),setTimeout(()=>t(600,.4,"sine",.06),600)},click:()=>{t(500,.04,"triangle",.03)},timerDone:()=>{t(700,.3,"triangle",.08),setTimeout(()=>t(700,.3,"triangle",.08),500),setTimeout(()=>t(900,.4,"triangle",.08),1e3)},logout:()=>{t(600,.3,"sine",.05),setTimeout(()=>t(400,.4,"sine",.04),300)}},arcade:{label:"Arcade",success:()=>{[523,659,784,1047].forEach((e,s)=>setTimeout(()=>t(e,.06,"square",.07),60*s))},error:()=>{t(100,.3,"sawtooth",.06),setTimeout(()=>t(80,.4,"sawtooth",.05),200)},notification:()=>{t(1047,.05,"square",.08),setTimeout(()=>t(784,.05,"square",.08),60),setTimeout(()=>t(1047,.08,"square",.1),120)},startup:()=>{[262,330,392,523,659,784].forEach((e,s)=>setTimeout(()=>t(e,.08,"square",.06),80*s))},click:()=>{t(1200,.02,"square",.05)},timerDone:()=>{for(let e=0;e<5;e++)setTimeout(()=>t(1200,.05,"square",.1),120*e)},logout:()=>{[784,659,523,392,262].forEach((e,s)=>setTimeout(()=>t(e,.06,"square",.06),60*s))}},silent:{label:"Silent",success:()=>{},error:()=>{},notification:()=>{},startup:()=>{},click:()=>{},timerDone:()=>{},logout:()=>{}}},o=Object.keys(i),n=["click","success","error","notification","startup","timerDone","logout"],c={click:"Click",success:"Success",error:"Error",notification:"Notification",startup:"Startup",timerDone:"Timer",logout:"Logout"},r="erp_sound_config";function u(){return"false"!==localStorage.getItem("erp_sounds")}function a(){const e=!u();return localStorage.setItem("erp_sounds",String(e)),e}function l(){try{const e=JSON.parse(localStorage.getItem(r)||"");if(e&&"object"==typeof e)return{click:"classic",success:"classic",error:"classic",notification:"classic",startup:"classic",timerDone:"classic",logout:"classic",...e}}catch{}return{click:"classic",success:"classic",error:"classic",notification:"classic",startup:"classic",timerDone:"classic",logout:"classic"}}function m(e,t){const s=l();s[e]=t,localStorage.setItem(r,JSON.stringify(s))}function f(e){const t={};n.forEach(s=>{t[s]=e}),localStorage.setItem(r,JSON.stringify(t))}function T(e){const t=l();return i[t[e]]||s}function g(){u()&&T("click").click()}function p(){u()&&T("success").success()}function q(){u()&&T("error").error()}function k(){u()&&T("notification").notification()}function S(){u()&&T("startup").startup()}function h(){u()&&T("timerDone").timerDone()}function D(){u()&&T("logout").logout()}function y(e,t){const s=i[e];s&&"function"==typeof s[t]&&s[t]()}export{i as SOUND_PACKS,o as SOUND_PACK_KEYS,n as SOUND_TYPES,c as SOUND_TYPE_LABELS,l as getSoundConfig,g as playClick,q as playError,D as playLogout,k as playNotification,S as playStartup,p as playSuccess,h as playTimerDone,y as previewSound,f as setAllSounds,m as setSoundForType,u as soundsEnabled,a as toggleSounds};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import{toast_default as e}from"./chunk-KKOHUQPF.js";import{useShellStrings as t}from"./chunk-TR6PLN7W.js";import{createContext as n,useContext as r,useRef as a,useState as o,useEffect as i}from"react";import*as s from"pdfjs-dist";import{createPortal as l}from"react-dom";import{jsx as c,jsxs as d}from"react/jsx-runtime";function u(e,t,n){return new Error(`The response for ${e} is not a WebAssembly module (got ${function(e){if(0===e.length)return"an empty response";const t=Array.from(e.subarray(0,24)).map(e=>e>=32&&e<127?String.fromCharCode(e):".").join("");return`${e.length} bytes starting "${t}"`}(n)}). The bundler did not emit "${t}" as an asset, and the host answered with a fallback page instead of a 404. Serve pdfjs-dist/wasm/ yourself and point window.__REACT_OS_SHELL_PDF_WASM__ at it.`)}var h=n(null);function m({children:e}){const t=r(h);return t?l(e,t):
|
|
2
|
+
/* @__PURE__ */c("div",{className:"flex shrink-0 flex-wrap items-center gap-1 border-b border-gray-200 bg-gray-50 px-3 py-2 text-xs",children:e})}"undefined"==typeof window||s.GlobalWorkerOptions.workerSrc||(s.GlobalWorkerOptions.workerSrc=`https://unpkg.com/pdfjs-dist@${s.version}/build/pdf.worker.min.mjs`);var p={"jbig2.wasm":new URL("pdfjs-dist/wasm/jbig2.wasm",import.meta.url).href,"openjpeg.wasm":new URL("pdfjs-dist/wasm/openjpeg.wasm",import.meta.url).href},f=class{async fetch({kind:e,filename:t}){if("wasmUrl"!==e)throw new Error(`Ensure that the \`${e}\` API parameter is provided.`);const n=p[t];if(!n)throw new Error(`No bundled pdf.js wasm module for "${t}".`);const r=await fetch(n);if(!r.ok)throw new Error(`Unable to load wasm data at: ${n}`);const a=new Uint8Array(await r.arrayBuffer());if(!function(e){return e.length>=4&&0===e[0]&&97===e[1]&&115===e[2]&&109===e[3]}(a))throw u(n,t,a);return a}};function g(e){const t=e||("undefined"!=typeof window?window.__REACT_OS_SHELL_PDF_WASM__:void 0);return"string"==typeof t&&t?{wasmUrl:t.endsWith("/")?t:`${t}/`}:{BinaryDataFactory:f}}var w=[50,75,100,125,150,200,300,400];function v(e,t,n){const r=(t.width-40)/n.width,a="page"===e?Math.min(r,(t.height-40)/n.height):r;return Math.min(Math.max(a,.3),4)}function y({url:n,filename:r,fit:l="width",onDownload:u,onEmail:h,workerSrc:p,wasmUrl:f}){const y=t().pdf,b=a(null),x=a(null),k=a(null),[C,L]=o(null),[N,M]=o(1),[j,E]=o(0),[z,P]=o(1),[A,_]=o(!0),[W,D]=o(!0),S=a(y.loadFailed);S.current=y.loadFailed,i(()=>{let t=!1;return D(!0),M(1),p&&(s.GlobalWorkerOptions.workerSrc=p),s.getDocument({url:n,...g(f)}).promise.then(e=>{t||(L(e),E(e.numPages),D(!1))}).catch(()=>{t||(e.error(S.current),D(!1))}),()=>{t=!0}},[n,p,f]),i(()=>{if(!C||!A||!k.current)return;const e=()=>{const e=k.current;e&&C.getPage(N).then(t=>{if(!k.current)return;const n=t.getViewport({scale:1}),r=v(l,{width:e.clientWidth,height:e.clientHeight},{width:n.width,height:n.height});P(e=>Math.abs(e-r)<.005?e:r)})};e();const t=new ResizeObserver(e);return t.observe(k.current),()=>t.disconnect()},[C,N,A,l]),i(()=>{if(!C||!b.current)return;let e=!1,t=null,n=null;return C.getPage(N).then(r=>{if(e||!b.current)return;const a=r.getViewport({scale:z}),o=b.current;o.width=a.width,o.height=a.height,o.style.width=`${a.width}px`,o.style.height=`${a.height}px`;const i=o.getContext("2d");t=r.render({canvas:o,canvasContext:i,viewport:a}),t.promise.catch(()=>{});const l=x.current;l&&(l.replaceChildren(),l.style.setProperty("--total-scale-factor",String(a.scale)),n=new s.TextLayer({textContentSource:r.streamTextContent(),container:l,viewport:a}),n.render().then(()=>{if(e)return;const t=document.createElement("div");t.className="endOfContent",l.append(t)}).catch(()=>{}))}),()=>{e=!0,t?.cancel(),n?.cancel()}},[C,N,z]),i(()=>{const e=()=>x.current?.classList.remove("selecting");return window.addEventListener("pointerup",e),()=>window.removeEventListener("pointerup",e)},[]);const T="page"===l?y.fitPage:y.fitWidth,$="px-2 py-1 rounded hover:bg-gray-200 transition-colors text-gray-600 flex items-center gap-1";/* @__PURE__ */
|
|
3
|
+
return d("div",{className:"flex flex-col h-full",children:[
|
|
4
|
+
/* @__PURE__ */d(m,{children:[
|
|
5
|
+
/* @__PURE__ */c("button",{type:"button","aria-label":y.previousPage,onClick:()=>M(e=>Math.max(1,e-1)),disabled:N<=1,className:"px-1 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",children:/* @__PURE__ */c("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5L8.25 12l7.5-7.5"})})}),
|
|
6
|
+
/* @__PURE__ */c("span",{className:"text-gray-600 font-medium tabular-nums whitespace-nowrap",children:y.pageOf(N,j)}),
|
|
7
|
+
/* @__PURE__ */c("button",{type:"button","aria-label":y.nextPage,onClick:()=>M(e=>Math.min(j,e+1)),disabled:N>=j,className:"px-1 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",children:/* @__PURE__ */c("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})})}),
|
|
8
|
+
/* @__PURE__ */c("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
9
|
+
/* @__PURE__ */c("button",{type:"button","aria-label":y.zoomOut,title:y.zoomOut,onClick:()=>{_(!1),P(e=>Math.max(.3,Math.round(100*(e-.25))/100))},className:$,children:/* @__PURE__ */c("span",{"aria-hidden":"true",children:"−"})}),
|
|
10
|
+
/* @__PURE__ */d("select",{value:A?"fit":w.includes(Math.round(100*z))?Math.round(100*z):"custom",onChange:e=>{const t=e.target.value;"fit"!==t?"custom"!==t&&(_(!1),P(Number(t)/100)):_(!0)},className:"bg-transparent hover:bg-gray-200 rounded px-1 py-1 text-gray-600 tabular-nums cursor-pointer focus:outline-none focus:ring-1 focus:ring-blue-400","aria-label":y.zoom,title:y.zoom,children:[
|
|
11
|
+
/* @__PURE__ */c("option",{value:"fit",children:T}),!A&&!w.includes(Math.round(100*z))&&/* @__PURE__ */d("option",{value:"custom",children:[Math.round(100*z),"%"]}),w.map(e=>/* @__PURE__ */d("option",{value:e,children:[e,"%"]},e))]}),
|
|
12
|
+
/* @__PURE__ */c("button",{type:"button","aria-label":y.zoomIn,title:y.zoomIn,onClick:()=>{_(!1),P(e=>Math.min(4,Math.round(100*(e+.25))/100))},className:$,children:/* @__PURE__ */c("span",{"aria-hidden":"true",children:"+"})}),
|
|
13
|
+
/* @__PURE__ */c("button",{type:"button",onClick:()=>_(!0),"aria-pressed":A,className:$+(A?" bg-gray-200 text-gray-900":""),title:y.fitHint,children:y.fit}),
|
|
14
|
+
/* @__PURE__ */c("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
15
|
+
/* @__PURE__ */d("button",{type:"button",onClick:()=>{if(!C)return;const t=window.open("","_blank");if(!t)return void e.error(y.allowPopups);const n=[];for(let e=1;e<=j;e++)n.push(C.getPage(e).then(e=>{const t=e.getViewport({scale:2}),n=document.createElement("canvas");return n.width=t.width,n.height=t.height,e.render({canvas:n,canvasContext:n.getContext("2d"),viewport:t}).promise.then(()=>n.toDataURL())}));Promise.all(n).then(e=>{var n;t.document.write(`<html><head><title>${n=r,n.replace(/[&<>"]/g,e=>({"&":"&","<":"<",">":">",'"':"""}[e]))}</title><style>@media print{body{margin:0}img{width:100%;page-break-after:always}}</style></head><body>`),t.document.write(e.map(e=>`<img src="${e}"/>`).join("")),t.document.write("</body></html>"),t.document.close(),setTimeout(()=>{t.print(),t.close()},300)})},className:$,children:[
|
|
16
|
+
/* @__PURE__ */c("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.72 13.829c-.24.03-.48.062-.72.096m.72-.096a42.415 42.415 0 0110.56 0m-10.56 0L6.34 18m10.94-4.171c.24.03.48.062.72.096m-.72-.096L17.66 18m0 0l.229 2.523a1.125 1.125 0 01-1.12 1.227H7.231c-.662 0-1.18-.568-1.12-1.227L6.34 18m11.318 0h1.091A2.25 2.25 0 0021 15.75V9.456c0-1.081-.768-2.015-1.837-2.175a48.055 48.055 0 00-1.913-.247M6.34 18H5.25A2.25 2.25 0 013 15.75V9.456c0-1.081.768-2.015 1.837-2.175a48.041 48.041 0 011.913-.247m10.5 0a48.536 48.536 0 00-10.5 0m10.5 0V3.375c0-.621-.504-1.125-1.125-1.125h-8.25c-.621 0-1.125.504-1.125 1.125v3.659M18 10.5h.008v.008H18V10.5zm-3 0h.008v.008H15V10.5z"})}),y.print]}),
|
|
17
|
+
/* @__PURE__ */d("button",{type:"button",onClick:u??(()=>{const e=document.createElement("a");e.href=n,e.download=r,e.click()}),className:$,children:[
|
|
18
|
+
/* @__PURE__ */c("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),y.download]}),h&&/* @__PURE__ */d("button",{type:"button",onClick:h,className:$,children:[
|
|
19
|
+
/* @__PURE__ */c("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21.75 6.75v10.5a2.25 2.25 0 01-2.25 2.25h-15a2.25 2.25 0 01-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25m19.5 0v.243a2.25 2.25 0 01-1.07 1.916l-7.5 4.615a2.25 2.25 0 01-2.36 0L3.32 8.91a2.25 2.25 0 01-1.07-1.916V6.75"})}),y.email]})]}),
|
|
20
|
+
/* @__PURE__ */c("div",{ref:k,className:"flex-1 overflow-auto bg-gray-100 outline-none",tabIndex:0,onWheel:e=>{if(!C)return;if(e.ctrlKey||e.metaKey)return;const t=k.current;if(!t)return;const n=t.scrollTop<=0,r=t.scrollTop+t.clientHeight>=t.scrollHeight-1;e.deltaY>0&&r&&N<j?(e.preventDefault(),M(e=>Math.min(j,e+1)),requestAnimationFrame(()=>{k.current&&(k.current.scrollTop=0)})):e.deltaY<0&&n&&N>1&&(e.preventDefault(),M(e=>Math.max(1,e-1)),requestAnimationFrame(()=>{k.current&&(k.current.scrollTop=k.current.scrollHeight)}))},onKeyDown:e=>{if(!C)return;const t=(document.activeElement?.tagName||"").toLowerCase();"input"===t||"textarea"===t||document.activeElement?.isContentEditable||("PageDown"===e.key||"ArrowRight"===e.key?N<j&&(e.preventDefault(),M(e=>Math.min(j,e+1))):"PageUp"===e.key||"ArrowLeft"===e.key?N>1&&(e.preventDefault(),M(e=>Math.max(1,e-1))):"Home"===e.key?(e.preventDefault(),M(1)):"End"===e.key&&(e.preventDefault(),M(j)))},children:W?/* @__PURE__ */c("div",{className:"flex items-center justify-center h-full text-gray-500 text-sm",role:"status",children:y.loading}):/* @__PURE__ */d("div",{className:"min-h-full flex items-center justify-center p-4",children:[
|
|
21
|
+
/* @__PURE__ */c("style",{children:'\n.preview-pdf-textlayer {\n position: absolute;\n inset: 0;\n overflow: clip;\n line-height: 1;\n text-align: initial;\n text-size-adjust: none;\n forced-color-adjust: none;\n transform-origin: 0 0;\n caret-color: CanvasText;\n --min-font-size: 1;\n --text-scale-factor: calc(var(--total-scale-factor, 1) * var(--min-font-size));\n --min-font-size-inv: calc(1 / var(--min-font-size));\n}\n.preview-pdf-textlayer :is(span, br) {\n color: transparent;\n position: absolute;\n white-space: pre;\n cursor: text;\n transform-origin: 0% 0%;\n}\n.preview-pdf-textlayer > :not(.markedContent),\n.preview-pdf-textlayer .markedContent span:not(.markedContent) {\n z-index: 1;\n --font-height: 0;\n font-size: calc(var(--text-scale-factor) * var(--font-height));\n --scale-x: 1;\n --rotate: 0deg;\n transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv));\n}\n.preview-pdf-textlayer .markedContent {\n display: contents;\n}\n.preview-pdf-textlayer span[role="img"] {\n user-select: none;\n cursor: default;\n}\n.preview-pdf-textlayer ::selection {\n background: rgba(0, 80, 255, 0.25);\n}\n.preview-pdf-textlayer br::selection {\n background: transparent;\n}\n.preview-pdf-textlayer .endOfContent {\n display: block;\n position: absolute;\n inset: 100% 0 0;\n z-index: 0;\n cursor: default;\n user-select: none;\n}\n.preview-pdf-textlayer.selecting .endOfContent {\n top: 0;\n}\n'}),
|
|
22
|
+
/* @__PURE__ */d("div",{className:"relative shadow-lg rounded",children:[
|
|
23
|
+
/* @__PURE__ */c("canvas",{ref:b,className:"block rounded"}),
|
|
24
|
+
/* @__PURE__ */c("div",{ref:x,className:"preview-pdf-textlayer",onPointerDown:e=>e.currentTarget.classList.add("selecting")})]})]})})]})}export{m as PanelActions,y as PdfViewer,h as ToolbarSlotContext,v as fitScale,g as pdfWasmParams};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useLayoutEffect as n,useEffect as r,useSyncExternalStore as t,useRef as e,useState as u,useCallback as c}from"react";var o="undefined"!=typeof window&&"undefined"!=typeof document?n:r,f=()=>()=>{},i=()=>!0,d=()=>!1;function p(){return t(f,i,d)}function a(n,r,e=f){return t(e,n,()=>r)}function l(n,r){const u=e(null);return t(f,()=>(u.current??={value:n()}).value,()=>r)}function m(n,r){const t=p(),[f,i]=u(()=>t?n():r),d=e(t),a=e(n);a.current=n,o(()=>{t&&!d.current&&(d.current=!0,i(a.current()))},[t]);return[f,c(n=>{d.current?i(n):(d.current=!0,i("function"==typeof n?n(a.current()):n))},[])]}export{o as useBrowserLayoutEffect,m as useBrowserState,a as useBrowserValue,l as useBrowserValueOnce,p as useHydrated};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t="react-os-shell:pdf-preview-update",n=null,e=0;function a(a){const d=++e,o={token:d,data:a};return n=o,{update(e){n===o&&(o.data=e),"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent(t,{detail:{token:d,data:e}}))}}}function d(){return n}function o(t){n===t&&(n=null)}export{t as PDF_PREVIEW_UPDATE_EVENT,o as claimPdfPreviewStage,d as peekPdfPreviewStage,a as setPdfPreview};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o={0:["Clear Sky","☀️","🌙","from-sky-400 to-blue-500","from-indigo-900 to-slate-950"],1:["Mainly Clear","🌤️","🌙","from-sky-400 to-blue-500","from-indigo-900 to-slate-950"],2:["Partly Cloudy","⛅","☁️","from-sky-400 to-blue-400","from-indigo-800 to-slate-900"],3:["Overcast","☁️","☁️","from-gray-400 to-gray-500","from-gray-700 to-slate-900"],45:["Foggy","🌫️","🌫️","from-gray-400 to-gray-500","from-gray-700 to-slate-800"],48:["Foggy","🌫️","🌫️","from-gray-400 to-gray-500","from-gray-700 to-slate-800"],51:["Light Drizzle","🌦️","🌧️","from-gray-400 to-blue-500","from-gray-700 to-indigo-900"],53:["Drizzle","🌧️","🌧️","from-gray-500 to-blue-600","from-gray-700 to-indigo-900"],55:["Heavy Drizzle","🌧️","🌧️","from-gray-500 to-blue-600","from-gray-700 to-indigo-900"],61:["Light Rain","🌦️","🌧️","from-gray-400 to-blue-500","from-gray-700 to-indigo-900"],63:["Rain","🌧️","🌧️","from-gray-500 to-blue-600","from-gray-700 to-indigo-900"],65:["Heavy Rain","🌧️","🌧️","from-gray-600 to-blue-700","from-gray-700 to-indigo-950"],71:["Light Snow","🌨️","🌨️","from-blue-200 to-blue-400","from-blue-800 to-slate-900"],73:["Snow","❄️","❄️","from-blue-300 to-blue-500","from-blue-800 to-slate-900"],75:["Heavy Snow","❄️","❄️","from-blue-400 to-blue-600","from-blue-800 to-slate-900"],80:["Rain Showers","🌧️","🌧️","from-gray-500 to-blue-600","from-gray-700 to-indigo-900"],82:["Heavy Showers","🌧️","🌧️","from-gray-600 to-blue-700","from-gray-700 to-indigo-950"],95:["Thunderstorm","⛈️","⛈️","from-gray-700 to-indigo-800","from-gray-800 to-indigo-950"],96:["Thunderstorm","⛈️","⛈️","from-gray-700 to-indigo-800","from-gray-800 to-indigo-950"],99:["Thunderstorm","⛈️","⛈️","from-gray-700 to-indigo-900","from-gray-800 to-indigo-950"]},t=(t,r=!0)=>{const a=o[t]||["Unknown","❓","❓","from-gray-400 to-gray-500","from-gray-700 to-slate-800"];return[a[0],r?a[1]:a[2],r?a[3]:a[4]]},r={Sydney:{lat:-33.8688,lon:151.2093,tz:"Australia/Sydney"},Melbourne:{lat:-37.8136,lon:144.9631,tz:"Australia/Melbourne"},Auckland:{lat:-36.8485,lon:174.7633,tz:"Pacific/Auckland"},Tokyo:{lat:35.6762,lon:139.6503,tz:"Asia/Tokyo"},Shanghai:{lat:31.2304,lon:121.4737,tz:"Asia/Shanghai"},"Hong Kong":{lat:22.3193,lon:114.1694,tz:"Asia/Hong_Kong"},Singapore:{lat:1.3521,lon:103.8198,tz:"Asia/Singapore"},Bangkok:{lat:13.7563,lon:100.5018,tz:"Asia/Bangkok"},Mumbai:{lat:19.076,lon:72.8777,tz:"Asia/Kolkata"},Dubai:{lat:25.2048,lon:55.2708,tz:"Asia/Dubai"},Berlin:{lat:52.52,lon:13.405,tz:"Europe/Berlin"},Paris:{lat:48.8566,lon:2.3522,tz:"Europe/Paris"},London:{lat:51.5074,lon:-.1278,tz:"Europe/London"},"New York":{lat:40.7128,lon:-74.006,tz:"America/New_York"},Miami:{lat:25.7617,lon:-80.1918,tz:"America/New_York"},Toronto:{lat:43.6532,lon:-79.3832,tz:"America/Toronto"},Chicago:{lat:41.8781,lon:-87.6298,tz:"America/Chicago"},"Los Angeles":{lat:34.0522,lon:-118.2437,tz:"America/Los_Angeles"}},a="weather_local_cache";function e(){try{return JSON.parse(localStorage.getItem(a)||"{}")}catch{return{}}}async function n(o,t=!1){const n=r[o];if(!n)return null;if(!t){const t=e()[o];if(t&&Date.now()-t.ts<18e5)return t.data}try{const t=await fetch(`https://api.open-meteo.com/v1/forecast?latitude=${n.lat}&longitude=${n.lon}¤t=temperature_2m,weather_code,is_day&daily=temperature_2m_max,temperature_2m_min&forecast_days=1&timezone=auto`),r=await t.json(),l={city:o,temp:Math.round(r.current.temperature_2m),code:r.current.weather_code,high:Math.round(r.daily.temperature_2m_max[0]),low:Math.round(r.daily.temperature_2m_min[0]),isDay:1===r.current.is_day,timezone:r.timezone||"UTC"},i=e();return i[o]={data:l,ts:Date.now()},function(o){try{localStorage.setItem(a,JSON.stringify(o))}catch{}}(i),l}catch{return null}}var l=o=>Math.round(9*o/5+32);export{r as AVAILABLE_CITIES,n as fetchCityWeather,t as getCondition,l as toFahrenheit};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{requestFilesTrashView as n}from"./chunk-NPJH5MD7.js";var o=null;function r(n){o=n}function t(){return o}function u(){n()}export{t as getFilesDemoTree,u as openFilesInTrashMode,r as setFilesDemoTree};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import{Modal as e}from"./chunk-7DAQ3WVP.js";import{keepsNativeMenu as a}from"./chunk-2RHMSFZV.js";import{jsx as i,jsxs as n}from"react/jsx-runtime";var t={activeOpacity:70,inactiveOpacity:50,activeBlur:0,inactiveBlur:0};function r(e){try{const a=JSON.parse(localStorage.getItem(e)||"");return null!=a.blur&&null==a.activeBlur&&(a.activeBlur=a.blur,a.inactiveBlur=a.blur,delete a.blur),{...t,...a}}catch{return t}}function l({open:t,onClose:r,title:l,appearance:c,onAppearanceChange:s,onSave:d,children:o}){if(!t)return null;const u="w-full h-1.5 rounded-full appearance-none bg-gray-200 cursor-pointer accent-blue-500",p="flex items-center justify-between text-xs text-gray-500";/* @__PURE__ */
|
|
2
|
+
return i("div",{onPointerDown:e=>e.stopPropagation(),onContextMenu:e=>{e.stopPropagation(),a(e.target)||e.preventDefault()},children:/* @__PURE__ */i(e,{open:t,onClose:r,title:l,size:"sm",children:/* @__PURE__ */n("div",{className:"space-y-4",children:[o,
|
|
3
|
+
/* @__PURE__ */n("div",{children:[
|
|
4
|
+
/* @__PURE__ */i("h3",{className:"text-sm font-semibold text-gray-700 mb-3",children:"Appearance"}),
|
|
5
|
+
/* @__PURE__ */n("div",{className:"grid grid-cols-2 gap-4",children:[
|
|
6
|
+
/* @__PURE__ */n("div",{children:[
|
|
7
|
+
/* @__PURE__ */i("div",{className:"text-xs font-medium text-gray-600 mb-2",children:"Active"}),
|
|
8
|
+
/* @__PURE__ */n("div",{className:"space-y-2",children:[
|
|
9
|
+
/* @__PURE__ */n("div",{children:[
|
|
10
|
+
/* @__PURE__ */n("div",{className:p,children:[
|
|
11
|
+
/* @__PURE__ */i("span",{children:"Opacity"}),
|
|
12
|
+
/* @__PURE__ */n("span",{children:[c.activeOpacity,"%"]})]}),
|
|
13
|
+
/* @__PURE__ */i("input",{type:"range",min:20,max:100,value:c.activeOpacity,onChange:e=>s({...c,activeOpacity:+e.target.value}),className:u})]}),
|
|
14
|
+
/* @__PURE__ */n("div",{children:[
|
|
15
|
+
/* @__PURE__ */n("div",{className:p,children:[
|
|
16
|
+
/* @__PURE__ */i("span",{children:"Blur"}),
|
|
17
|
+
/* @__PURE__ */n("span",{children:[c.activeBlur,"px"]})]}),
|
|
18
|
+
/* @__PURE__ */i("input",{type:"range",min:0,max:20,value:c.activeBlur,onChange:e=>s({...c,activeBlur:+e.target.value}),className:u})]})]})]}),
|
|
19
|
+
/* @__PURE__ */n("div",{children:[
|
|
20
|
+
/* @__PURE__ */i("div",{className:"text-xs font-medium text-gray-600 mb-2",children:"Inactive"}),
|
|
21
|
+
/* @__PURE__ */n("div",{className:"space-y-2",children:[
|
|
22
|
+
/* @__PURE__ */n("div",{children:[
|
|
23
|
+
/* @__PURE__ */n("div",{className:p,children:[
|
|
24
|
+
/* @__PURE__ */i("span",{children:"Opacity"}),
|
|
25
|
+
/* @__PURE__ */n("span",{children:[c.inactiveOpacity,"%"]})]}),
|
|
26
|
+
/* @__PURE__ */i("input",{type:"range",min:20,max:100,value:c.inactiveOpacity,onChange:e=>s({...c,inactiveOpacity:+e.target.value}),className:u})]}),
|
|
27
|
+
/* @__PURE__ */n("div",{children:[
|
|
28
|
+
/* @__PURE__ */n("div",{className:p,children:[
|
|
29
|
+
/* @__PURE__ */i("span",{children:"Blur"}),
|
|
30
|
+
/* @__PURE__ */n("span",{children:[c.inactiveBlur,"px"]})]}),
|
|
31
|
+
/* @__PURE__ */i("input",{type:"range",min:0,max:20,value:c.inactiveBlur,onChange:e=>s({...c,inactiveBlur:+e.target.value}),className:u})]})]})]})]})]}),
|
|
32
|
+
/* @__PURE__ */n("div",{className:"flex gap-2 pt-2",children:[
|
|
33
|
+
/* @__PURE__ */i("button",{onClick:d,className:"flex-1 text-sm font-medium py-2 rounded-lg bg-blue-600 text-white hover:bg-blue-700 transition",children:"Save"}),
|
|
34
|
+
/* @__PURE__ */i("button",{onClick:r,className:"flex-1 text-sm font-medium py-2 rounded-lg border border-gray-300 text-gray-600 hover:bg-gray-50 transition",children:"Cancel"})]})]})})})}export{l as WidgetSettingsModal,r as loadAppearance};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{useShellStrings as e}from"./chunk-TR6PLN7W.js";import{Fragment as i}from"react";import{jsx as t,jsxs as a}from"react/jsx-runtime";var n=/* @__PURE__ */t("svg",{className:"h-3.5 w-3.5 shrink-0 text-gray-300",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":!0,children:/* @__PURE__ */t("path",{fillRule:"evenodd",d:"M7.21 14.77a.75.75 0 0 1 .02-1.06L11.168 10 7.23 6.29a.75.75 0 1 1 1.04-1.08l4.5 4.25a.75.75 0 0 1 0 1.08l-4.5 4.25a.75.75 0 0 1-1.06-.02Z",clipRule:"evenodd"})}),l="inline-flex min-w-0 items-center gap-1 truncate rounded px-1 -mx-1 text-gray-500 transition-colors hover:text-gray-900 hover:underline rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]";function s({items:s,separator:r,maxItems:c=0,className:m}){const o=e().breadcrumbs;if(0===s.length)return null;const h=r??n,d=[],u=s.length-1;if(c>0&&s.length>c&&c>=2){const e=Math.max(1,c-1);d.push({kind:"item",item:s[0],isLast:!1}),d.push({kind:"ellipsis"});for(let i=s.length-e;i<=u;i++)d.push({kind:"item",item:s[i],isLast:i===u})}else s.forEach((e,i)=>d.push({kind:"item",item:e,isLast:i===u}));/* @__PURE__ */
|
|
2
|
+
return t("nav",{"aria-label":o.label,className:`min-w-0 ${m??""}`,children:/* @__PURE__ */t("ol",{className:"flex items-center gap-1.5 text-sm",children:d.map((e,n)=>/* @__PURE__ */a(i,{children:[n>0&&/* @__PURE__ */t("li",{"aria-hidden":!0,className:"flex items-center",children:h}),
|
|
3
|
+
/* @__PURE__ */t("li",{className:"flex min-w-0 items-center",children:"ellipsis"===e.kind?/* @__PURE__ */t("span",{className:"px-0.5 text-gray-400 select-none","aria-label":o.hidden,children:"…"}):e.isLast||!e.item.href&&!e.item.onClick?/* @__PURE__ */a("span",{"aria-current":e.isLast?"page":void 0,className:"inline-flex min-w-0 items-center gap-1 truncate "+(e.isLast?"font-medium text-gray-900":"text-gray-500"),children:[e.item.icon,
|
|
4
|
+
/* @__PURE__ */t("span",{className:"truncate",children:e.item.label})]}):e.item.href?/* @__PURE__ */a("a",{href:e.item.href,onClick:e.item.onClick,className:l,children:[e.item.icon,
|
|
5
|
+
/* @__PURE__ */t("span",{className:"truncate",children:e.item.label})]}):/* @__PURE__ */a("button",{type:"button",onClick:e.item.onClick,className:l,children:[e.item.icon,
|
|
6
|
+
/* @__PURE__ */t("span",{className:"truncate",children:e.item.label})]})})]},n))})})}export{s as Breadcrumbs};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{currentShellStrings as t}from"./chunk-TR6PLN7W.js";var e="http://www.w3.org/2000/svg",n={},o=/* @__PURE__ */new Map;function s(t,e){let n=document.getElementById(t);return n||(n=document.createElement("div"),n.id=t,n.className=e,document.body.appendChild(n)),n}var r={success:"M5 13l4 4L19 7",error:"M6 18L18 6M6 6l12 12",warning:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z",info:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z",loading:"M12 3a9 9 0 019 9",bell:"M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75v-.7V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0"};function i(t,n){const o=document.createElementNS(e,"svg");o.setAttribute("class",n),o.setAttribute("fill","none"),o.setAttribute("viewBox","0 0 24 24"),o.setAttribute("stroke","currentColor"),o.setAttribute("stroke-width","2");const s=document.createElementNS(e,"path");return s.setAttribute("stroke-linecap","round"),"loading"!==t&&s.setAttribute("stroke-linejoin","round"),s.setAttribute("d",r[t]),o.appendChild(s),o}function a(t,e){const n=document.createElement("div");return n.className=t,void 0!==e&&(n.textContent=e),n}function c(t,e,r){const c={...n,...r},l=c.placement??"top",d=c.sticky??!1,u=`${l}|${t}|${e}`;if(c.dedupe){const t=o.get(u);if(t)return t.restart(),{dismiss:t.dismiss}}"loading"!==t&&!1!==c.sound&&import("./sounds-OMHXVVQ4.js").then(e=>{"success"===t?e.playSuccess():"error"===t?e.playError():e.playNotification()}).catch(()=>{});const m="bottom"===l?s("toast-container-bottom","fixed bottom-4 left-1/2 -translate-x-1/2 z-[9999] flex flex-col-reverse gap-2 items-center pointer-events-none"):s("toast-container","fixed top-4 left-1/2 -translate-x-1/2 z-[9999] flex flex-col gap-2 items-center pointer-events-none"),p="bottom"===l?"translateY(10px)":"translateY(-10px)",f=a("pointer-events-auto cursor-pointer rosh-toast");f.style.opacity="0",f.style.transform=`${p} scale(0.95)`,f.setAttribute("role","error"===t?"alert":"status"),f.setAttribute("aria-atomic","true"),f.appendChild(i(t,`h-4 w-4 rosh-tone-${t}${"loading"===t?" animate-spin":""}`));const h=document.createElement("span");let y;h.textContent=e,f.appendChild(h),m.appendChild(f),requestAnimationFrame(()=>{f.style.opacity="1",f.style.transform="translateY(0) scale(1)"});let v=!1;const g=()=>{v||(v=!0,y&&clearTimeout(y),o.delete(u),f.style.opacity="0",f.style.transform=`${p} scale(0.95)`,setTimeout(()=>f.remove(),300))},b=c.duration??("info"===t?4500:3e3),x=()=>{y&&clearTimeout(y),d||(y=setTimeout(g,b))};return x(),f.addEventListener("mouseenter",()=>{y&&clearTimeout(y)}),f.addEventListener("mouseleave",()=>{v||x()}),f.addEventListener("click",g),o.set(u,{el:f,restart:x,dismiss:g}),{dismiss:g}}var l={success:(t,e)=>c("success",t,e),error:(t,e)=>c("error",t,e),warning:(t,e)=>c("warning",t,e),info:(t,e)=>c("info",t,e),notify:(e,o)=>function(e,o){!1!==(o?.sound??n.sound)&&import("./sounds-OMHXVVQ4.js").then(t=>t.playNotification()).catch(()=>{});const r=s("notif-container","fixed top-4 right-4 z-[9999] flex flex-col gap-3 items-end pointer-events-none"),c=a("pointer-events-auto cursor-pointer rosh-notif");c.style.opacity="0",c.style.transform="translateX(30px) scale(0.95)";const l=a("rosh-notif-badge");l.appendChild(i("bell","h-5 w-5"));const d=a("rosh-notif-body");d.append(a("rosh-notif-title",t().toast.notification),a("notif-msg rosh-notif-msg",e));const u=document.createElement("button");u.className="rosh-notif-close",u.textContent="×",c.append(l,d,u);const m=()=>{c.style.opacity="0",c.style.transform="translateX(30px) scale(0.95)",setTimeout(()=>c.remove(),300)};u.addEventListener("click",t=>{t.stopPropagation(),m()}),c.addEventListener("click",m),r.appendChild(c),requestAnimationFrame(()=>{c.style.opacity="1",c.style.transform="translateX(0) scale(1)"}),setTimeout(m,o?.duration??1e4)}(e,o),promise:(t,e,n)=>{const o=c("loading",e.loading,{...n,sticky:!0});return t.then(t=>{o.dismiss(),c("success","function"==typeof e.success?e.success(t):e.success,n)},t=>{o.dismiss(),c("error","function"==typeof e.error?e.error(t):e.error,n)}),t},configure:t=>{n={...t}}};export{l as toast_default};
|