efficient-shell 7.18.1 → 7.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/{Browser-K4DQBJWS.js → Browser-62T2OSLK.js} +15 -15
- package/dist/{Calculator-NGSHZWOR.js → Calculator-YSHOGYHB.js} +22 -22
- package/dist/{ConfirmDialog-JMQI6CGW.js → ConfirmDialog-AVFQGXKL.js} +1 -1
- package/dist/{CurrencyConverter-PICVES6A.js → CurrencyConverter-V6LH7VQP.js} +9 -9
- package/dist/{Documents-QEPM2X7B.js → Documents-R6IE64IZ.js} +13 -13
- package/dist/{Files-S45MKBYC.js → Files-RVESLH5D.js} +26 -26
- package/dist/{Notepad-XEROGOZT.js → Notepad-2QJH5T7B.js} +11 -11
- package/dist/{PomodoroTimer-OCAJKGQU.js → PomodoroTimer-M7BLRWTH.js} +4 -4
- package/dist/{Preview-S4UIOU43.js → Preview-3ZQ7SSHV.js} +24 -24
- package/dist/{Spreadsheet-L7QG3LGD.js → Spreadsheet-OBFCMT3L.js} +13 -13
- package/dist/{Stock-74K5L75A.js → Stock-XDKUT7RW.js} +6 -6
- package/dist/{Weather-QTRJYIPS.js → Weather-XGIJGO23.js} +16 -16
- package/dist/{WorldClock-L6PSFBLE.js → WorldClock-V6S6QEXK.js} +6 -6
- package/dist/apps/index.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/{chunk-23C25QZV.js → chunk-3FLFIKAL.js} +1 -1
- package/dist/{chunk-NXYHRDRD.js → chunk-3LEHVM4D.js} +4 -4
- package/dist/chunk-76VCH7N6.js +29 -0
- package/dist/{chunk-QWSVX6OP.js → chunk-7JN73EKI.js} +1 -1
- package/dist/{chunk-BIYMQKF3.js → chunk-AJCAZNBF.js} +1 -1
- package/dist/chunk-FTZ5WHJM.js +1 -0
- package/dist/chunk-NUCPJVKD.js +108 -0
- package/dist/chunk-Q2HEVH2C.js +1025 -0
- package/dist/index.js +76 -76
- package/dist/page-tabs/index.js +5 -5
- package/dist/telemetry/index.js +1 -1
- package/dist/ui/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-ERDQLQVK.js +0 -1
- package/dist/chunk-IBGEW3OA.js +0 -108
- package/dist/chunk-L5YNA4NS.js +0 -1025
- package/dist/chunk-QBXX5A7U.js +0 -29
|
@@ -1 +1 @@
|
|
|
1
|
-
import{VERSION as e}from"./chunk-ERDQLQVK.js";import{setBoundaryErrorReporter as t}from"./chunk-KNUR2UEG.js";var n=-1,i=()=>n,a=e=>{addEventListener("pageshow",t=>{t.persisted&&(n=t.timeStamp,e(t))},!0)},r=(e,t,n,i)=>{let a,r;return o=>{var s,c;t.value>=0&&(o||i)&&(r=t.value-(a??0),(r||void 0===a)&&(a=t.value,t.delta=r,t.rating=(s=t.value)>(c=n)[1]?"poor":s>c[0]?"needs-improvement":"good",e(t)))}},o=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},s=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},c=()=>s()?.activationStart??0,d=-1,l=/* @__PURE__ */new Set,u=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,f=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of l)e();isFinite(d)||(d="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",f,!0))}},h=(e=!1)=>{if(e&&(d=1/0),d<0){const e=c(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;d=t??u(),addEventListener("visibilitychange",f,!0),addEventListener("prerenderingchange",f,!0),a(()=>{setTimeout(()=>{d=u()})})}return{get firstHiddenTime(){return d},onHidden(e){l.add(e)}}},g=(e,t=-1,n,a=0,r,o,d)=>{const l=s(),u=l?.navigationId||0;let f="navigate";return n?f=n:i()>=0?f="back-forward-cache":l&&(document.prerendering||c()>0?f="prerender":document.wasDiscarded?f="restore":l.type&&(f=l.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:f,navigationId:a||u,navigationInteractionId:r,navigationURL:o||l?.name,navigationStartTime:d||0}},v=/* @__PURE__ */new WeakMap;function p(e,t){let n=v.get(t);return n||(n=/* @__PURE__ */new WeakMap,v.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}var m,y=class{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},T=(e,t,n={})=>{try{const i=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(i.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const n=e.getEntries();i.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(const t of i)e.observe({type:t,buffered:!0,...n});return e}}catch{}},w=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,I=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},b=e=>{let t=!1;return()=>{t||(e(),t=!0)}},E=class{l},C=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},L=[1800,3e3],P=(e,t={})=>{const n=w(t);C(()=>{const s=p(t,E),d=h();let l,u=g("FCP");const f=T(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(f.disconnect(),t.startTime<d.firstHiddenTime&&(u.value=Math.max(t.startTime-c(),0),u.entries.push(t),u.navigationId=t.navigationId||u.navigationId,l(!0)))});f&&(l=r(e,u,L,t.reportAllChanges),a(n=>{u=g("FCP",-1,"back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),l=r(e,u,L,t.reportAllChanges),o(()=>{u.value=performance.now()-n.timeStamp,l(!0)})})),n&&T(["soft-navigation"],n=>{n.forEach(n=>{s.l&&n.navigationId&&I(s.l,n);const i=Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0);u=g("FCP",i,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),l=r(e,u,L,t.reportAllChanges),l(!0)})},t)})},A=[.1,.25],k=0,S=1/0,z=0,M=e=>{for(const t of e)t.interactionId&&(S=Math.min(S,t.interactionId),z=Math.max(z,t.interactionId),k=z?(z-S)/7+1:0)},$=()=>m?k:performance.interactionCount??0,_=class{u=0;v=[];m=/* @__PURE__ */new Map;p;T;_(){return $()-this.u}M(){this.u=$(),this.v.length=0,this.m.clear()}L(e){const t=this._(),n=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==n||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[n]:{P:8,id:-1,entries:[]}}h(e){if(this.p?.(e),!e.interactionId)return;const t=this.v.at(-1);let n=this.m.get(e.interactionId);if(n||this.v.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}this.T?.(n)}}},R=e=>{const t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const a=b(e);let r=-1;const o=()=>{i(r),a()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=n(()=>{removeEventListener("visibilitychange",o,{capture:!0}),a()},{timeout:t})}},Z=[200,500],F=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=h();C(()=>{"interactionCount"in performance||m||(m=T(["event"],M,{durationThreshold:0}));let o,s=g("INP");const c=p(t,_),d=(n,i,a,d,l)=>{c.M(),s=g("INP",-1,n,i,a,d,l),o=r(e,s,Z,t.reportAllChanges)},l=()=>{const e=c.L(s.navigationType);e&&e.P!==s.value&&(s.value=e.P,s.entries=e.entries,o())},u=e=>{l(),o(!0),d("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},f=(e,t=!1)=>{R(()=>{for(const t of e)"soft-navigation"!==t.entryType?c.h(t):u(t);l(),t&&o(!0)})},h=["event","first-input"];w(t)&&h.push("soft-navigation");const v=T(h,f,{...t,durationThreshold:t.durationThreshold??40});o=r(e,s,Z,t.reportAllChanges),v&&(n.onHidden(()=>{f(v.takeRecords(),!0)}),a(()=>{d("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,i())}))})},x=class{p;l;h(e){this.p?.(e)}},j=[2500,4e3],B=[800,1800],N=e=>{document.prerendering?C(()=>N(e)):"complete"!==document.readyState?addEventListener("load",()=>N(e),!0):setTimeout(e)};var U=/^[A-Za-z0-9/_:.\-[\]{}*@~]+$/,O=/^[A-Za-z_$][A-Za-z0-9_$.]*$/,H=/^[A-Za-z0-9][A-Za-z0-9.+_-]*$/;var q=class{constructor(e){this.head=e}head;events=[];waiting=/* @__PURE__ */new Map;seen=/* @__PURE__ */new Set;get size(){return this.events.length}addVital(e){this.events.push(e)}addError(e){const t=function(e){return e.frames.length?`${e.name}|${e.frames.join("|")}`:`${e.name}|${e.message.replace(/\d/g,"0")}`}(e),n=this.waiting.get(t);return n?(n.count=Math.min(1e3,n.count+e.count),!0):!(this.seen.has(t)||this.seen.size>=20)&&(this.seen.add(t),this.waiting.set(t,e),this.events.push(e),!0)}drain(){const e=this.events;this.events=[],this.waiting.clear();const t=[],n=JSON.stringify({...this.head,events:[]}).length;let i=[],a=n;for(const r of e){const e=JSON.stringify(r).length+1;n+e>30720||((50===i.length||a+e>30720)&&(t.push({...this.head,events:i}),i=[],a=n),i.push(r),a+=e)}return i.length&&t.push({...this.head,events:i}),t}},K=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,J=/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*)?|\b[Bb]earer\s+[A-Za-z0-9._~+/=-]{8,}/g,D=/\b[a-z][a-z0-9+.-]*:\/\/\S+/gi,V=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,W=/\d{4,}/g,Q=/(^|[/:])(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,})(?=$|[/:])/gi,G=/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,X=/(?:\(|@|\bat\s+)?((?:[a-z][a-z0-9+.-]*:\/\/|\/)[^\s()@]*?):(\d+):(\d+)\)?\s*$/i;function Y(e,t,n){const i=e.replace(G,"").split(/[?#]/,1)[0];return i?`${i}:${t}:${n}`.slice(0,256):null}function ee(e){if("string"!=typeof e)return[];const t=[];for(const n of e.split("\n")){const e=X.exec(n.trim()),i=e&&Y(e[1],e[2],e[3]);if(i&&t.push(i),5===t.length)break}return t}function te(e){const t=e instanceof Error?e.name:void 0;return"string"==typeof t&&t.length<=64&&O.test(t)?t:"Error"}function ne(e){if("string"!=typeof e)return"unknown";const t=e.trim().replace(G,"").split(/[?#]/,1)[0].replace(Q,(e,t)=>":"===t?":id":`${t}:id`);return t&&t.length<=128&&!t.includes("//")&&U.test(t)?t:"unknown"}var ie={flush(){},reportError(){},stop(){}},ae=null,re=/* @__PURE__ */new Set(["LCP","FCP","TTFB"]);function oe(e,t,n){const i=t.getAccessToken();i&&n(t.endpoint??"/api/client-telemetry/web-batches/",{method:"POST",keepalive:!0,credentials:"same-origin",headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`},body:JSON.stringify(e)}).catch(e=>{console.debug("[efficient-shell] client telemetry batch dropped:",e)})}function se(n){if(ae?.stop(),ae=null,!1===n.enabled||"undefined"==typeof window||"undefined"==typeof document)return ie;if(!function(e){const t="string"==typeof e.app&&H.test(e.app),n="string"==typeof e.release&&H.test(e.release);return t&&n||console.warn("[efficient-shell] client telemetry not started: `app` and `release` must be version-like strings."),t&&n}(n))return ie;const d=n.fetch??window.fetch.bind(window),l=new q({app:n.app,release:n.release,shell_version:H.test(e)?e:""}),u=ne(n.routeKey()),f=function(e=("undefined"==typeof window?void 0:window)){if(!e)return"desktop";const t="function"==typeof e.matchMedia&&e.matchMedia("(pointer: coarse)").matches,n=e.innerWidth;return n<600?"mobile":t&&n<1280?"tablet":"desktop"}(window);let v=!1;const m=()=>{for(const e of l.drain())oe(e,n,d)},E=e=>{v||(l.addError(e),l.size>=50&&m())},L=(e,t)=>{return{type:"error",source:t,name:te(e),message:(a=e,i=a instanceof Error?a.message:"string"==typeof a?a:a&&"object"==typeof a&&"string"==typeof a.message?a.message:"",i.slice(0,640).replace(K,"[redacted]").replace(J,"[redacted]").replace(D,"[url]").replace(V,"[id]").replace(W,"[n]").replace(/\s+/g," ").trim().slice(0,160)),frames:ee(e instanceof Error?e.stack:void 0),route:ne(n.routeKey()),count:1};var i,a},k=e=>{v||(l.addVital(function(e,t,n,i){return{type:"vital",name:e.name,value:e.value,route:re.has(e.name)?t:n(),navigation:e.navigationType??"navigate",device:i}}(e,u,()=>ne(n.routeKey()),f)),l.size>=50&&m())},S=n.vitalsSampleRate??1;S>0&&(S>=1||(n.random??Math.random)()<S)&&(((e,t={})=>{let n=!1;const s=w(t);C(()=>{let d,l=h(),u=g("LCP");const f=p(t,x),v=(i,a,o,s,c)=>{u=g("LCP",-1,i,a,o,s,c),d=r(e,u,j,t.reportAllChanges),n=!1,"soft-navigation"===i&&(l=h(!0))},m=e=>{f.l&&e.navigationId&&I(f.l,e),n||d(!0),v("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const t=e.getLargestInteractionContentfulPaint?.();t&&y([t])},y=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){m(t);continue}let e=0,n=[],i=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-c(),0),f.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){const a=t;if(!u.navigationId)continue;if("interactionId"in a&&a.interactionId!=u.navigationInteractionId)continue;i=a.largestContentfulPaint?.renderTime||0,e=Math.max(i-t.startTime,0),a.largestContentfulPaint&&(f.h(a.largestContentfulPaint),n=[a.largestContentfulPaint])}i<l.firstHiddenTime&&(u.value=e,u.entries=n,d())}},w=["largest-contentful-paint"];s&&w.push("interaction-contentful-paint","soft-navigation");const b=T(w,y);if(b){d=r(e,u,j,t.reportAllChanges);const c=["keydown","click","visibilitychange"],l=e=>{if(e.isTrusted&&!n){const e=u.id;R(()=>{if(!n){if(!s){b.disconnect();for(const e of c)removeEventListener(e,l,{capture:!0})}e===u.id&&(n=!0,d(!0))}})}};for(const e of c)addEventListener(e,l,{capture:!0});a(a=>{v("back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),d=r(e,u,j,t.reportAllChanges),o(()=>{u.value=performance.now()-a.timeStamp,n=!0,d(!0)})})}})})(k),F(k),((e,t={})=>{const n=h();P(b(()=>{let s,c=g("CLS",0);const d=p(t,y),l=(n,i,a,o,l)=>{c=g("CLS",0,n,i,a,o,l),d.i=0,s=r(e,c,A,t.reportAllChanges)},u=(e=!1)=>{d.i>c.value&&(c.value=d.i,c.entries=d.o),s(e)},f=e=>{u(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},h=e=>{for(const t of e)"soft-navigation"!==t.entryType?d.h(t):f(t);u()},v=["layout-shift"];w(t)&&v.push("soft-navigation");const m=T(v,h);m&&(s=r(e,c,A,t.reportAllChanges),n.onHidden(()=>{h(m.takeRecords()),s(!0)}),a(()=>{l("back-forward-cache",c.navigationId,c.navigationInteractionId,c.navigationURL,i()),o(s)}),setTimeout(s))}))})(k),P(k),((e,t={})=>{const n=w(t);let o=g("TTFB"),d=r(e,o,B,t.reportAllChanges);N(()=>{const l=s();if(l){const s=l.responseStart;o.value=Math.max(s-c(),0),o.entries=[l],d(!0),a(()=>{o=g("TTFB",0,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,i()),d=r(e,o,B,t.reportAllChanges),d(!0)}),n&&T(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&(o=g("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),o.entries=[n],d=r(e,o,B,t.reportAllChanges),d(!0))})},t)}})})(k));const z=e=>{const{error:t,message:n,filename:i,lineno:a,colno:r}=e;if(null!=t)return void E(L(t,"onerror"));const o=i?ee(`at ${i}:${a??0}:${r??0}`):[];E({...L(n??"","onerror"),frames:o})},M=e=>E(L(e.reason,"unhandledrejection")),$=()=>{"hidden"===document.visibilityState&&m()};window.addEventListener("error",z),window.addEventListener("unhandledrejection",M),document.addEventListener("visibilitychange",$),window.addEventListener("pagehide",m);const _=window.setInterval(m,n.flushIntervalMs??6e4),Z=t(e=>E(L(e,"boundary"))),U={flush:m,reportError:e=>E(L(e,"boundary")),stop(){v||(m(),v=!0,window.removeEventListener("error",z),window.removeEventListener("unhandledrejection",M),document.removeEventListener("visibilitychange",$),window.removeEventListener("pagehide",m),window.clearInterval(_),Z(),ae===U&&(ae=null))}};return ae=U,U}export{se as startClientTelemetry};
|
|
1
|
+
import{VERSION as e}from"./chunk-FTZ5WHJM.js";import{setBoundaryErrorReporter as t}from"./chunk-KNUR2UEG.js";var n=-1,i=()=>n,a=e=>{addEventListener("pageshow",t=>{t.persisted&&(n=t.timeStamp,e(t))},!0)},r=(e,t,n,i)=>{let a,r;return o=>{var s,c;t.value>=0&&(o||i)&&(r=t.value-(a??0),(r||void 0===a)&&(a=t.value,t.delta=r,t.rating=(s=t.value)>(c=n)[1]?"poor":s>c[0]?"needs-improvement":"good",e(t)))}},o=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},s=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},c=()=>s()?.activationStart??0,d=-1,l=/* @__PURE__ */new Set,u=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,f=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of l)e();isFinite(d)||(d="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",f,!0))}},h=(e=!1)=>{if(e&&(d=1/0),d<0){const e=c(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;d=t??u(),addEventListener("visibilitychange",f,!0),addEventListener("prerenderingchange",f,!0),a(()=>{setTimeout(()=>{d=u()})})}return{get firstHiddenTime(){return d},onHidden(e){l.add(e)}}},g=(e,t=-1,n,a=0,r,o,d)=>{const l=s(),u=l?.navigationId||0;let f="navigate";return n?f=n:i()>=0?f="back-forward-cache":l&&(document.prerendering||c()>0?f="prerender":document.wasDiscarded?f="restore":l.type&&(f=l.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:f,navigationId:a||u,navigationInteractionId:r,navigationURL:o||l?.name,navigationStartTime:d||0}},v=/* @__PURE__ */new WeakMap;function p(e,t){let n=v.get(t);return n||(n=/* @__PURE__ */new WeakMap,v.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}var m,y=class{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},T=(e,t,n={})=>{try{const i=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(i.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const n=e.getEntries();i.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(const t of i)e.observe({type:t,buffered:!0,...n});return e}}catch{}},w=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,I=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},b=e=>{let t=!1;return()=>{t||(e(),t=!0)}},E=class{l},C=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},L=[1800,3e3],P=(e,t={})=>{const n=w(t);C(()=>{const s=p(t,E),d=h();let l,u=g("FCP");const f=T(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(f.disconnect(),t.startTime<d.firstHiddenTime&&(u.value=Math.max(t.startTime-c(),0),u.entries.push(t),u.navigationId=t.navigationId||u.navigationId,l(!0)))});f&&(l=r(e,u,L,t.reportAllChanges),a(n=>{u=g("FCP",-1,"back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),l=r(e,u,L,t.reportAllChanges),o(()=>{u.value=performance.now()-n.timeStamp,l(!0)})})),n&&T(["soft-navigation"],n=>{n.forEach(n=>{s.l&&n.navigationId&&I(s.l,n);const i=Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0);u=g("FCP",i,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),l=r(e,u,L,t.reportAllChanges),l(!0)})},t)})},A=[.1,.25],k=0,S=1/0,z=0,M=e=>{for(const t of e)t.interactionId&&(S=Math.min(S,t.interactionId),z=Math.max(z,t.interactionId),k=z?(z-S)/7+1:0)},$=()=>m?k:performance.interactionCount??0,Z=class{u=0;v=[];m=/* @__PURE__ */new Map;p;T;_(){return $()-this.u}M(){this.u=$(),this.v.length=0,this.m.clear()}L(e){const t=this._(),n=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==n||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[n]:{P:8,id:-1,entries:[]}}h(e){if(this.p?.(e),!e.interactionId)return;const t=this.v.at(-1);let n=this.m.get(e.interactionId);if(n||this.v.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}this.T?.(n)}}},_=e=>{const t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const a=b(e);let r=-1;const o=()=>{i(r),a()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=n(()=>{removeEventListener("visibilitychange",o,{capture:!0}),a()},{timeout:t})}},F=[200,500],R=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=h();C(()=>{"interactionCount"in performance||m||(m=T(["event"],M,{durationThreshold:0}));let o,s=g("INP");const c=p(t,Z),d=(n,i,a,d,l)=>{c.M(),s=g("INP",-1,n,i,a,d,l),o=r(e,s,F,t.reportAllChanges)},l=()=>{const e=c.L(s.navigationType);e&&e.P!==s.value&&(s.value=e.P,s.entries=e.entries,o())},u=e=>{l(),o(!0),d("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},f=(e,t=!1)=>{_(()=>{for(const t of e)"soft-navigation"!==t.entryType?c.h(t):u(t);l(),t&&o(!0)})},h=["event","first-input"];w(t)&&h.push("soft-navigation");const v=T(h,f,{...t,durationThreshold:t.durationThreshold??40});o=r(e,s,F,t.reportAllChanges),v&&(n.onHidden(()=>{f(v.takeRecords(),!0)}),a(()=>{d("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,i())}))})},x=class{p;l;h(e){this.p?.(e)}},j=[2500,4e3],B=[800,1800],N=e=>{document.prerendering?C(()=>N(e)):"complete"!==document.readyState?addEventListener("load",()=>N(e),!0):setTimeout(e)};var U=/^[A-Za-z0-9/_:.\-[\]{}*@~]+$/,H=/^[A-Za-z_$][A-Za-z0-9_$.]*$/,O=/^[A-Za-z0-9][A-Za-z0-9.+_-]*$/;var q=class{constructor(e){this.head=e}head;events=[];waiting=/* @__PURE__ */new Map;seen=/* @__PURE__ */new Set;get size(){return this.events.length}addVital(e){this.events.push(e)}addError(e){const t=function(e){return e.frames.length?`${e.name}|${e.frames.join("|")}`:`${e.name}|${e.message.replace(/\d/g,"0")}`}(e),n=this.waiting.get(t);return n?(n.count=Math.min(1e3,n.count+e.count),!0):!(this.seen.has(t)||this.seen.size>=20)&&(this.seen.add(t),this.waiting.set(t,e),this.events.push(e),!0)}drain(){const e=this.events;this.events=[],this.waiting.clear();const t=[],n=JSON.stringify({...this.head,events:[]}).length;let i=[],a=n;for(const r of e){const e=JSON.stringify(r).length+1;n+e>30720||((50===i.length||a+e>30720)&&(t.push({...this.head,events:i}),i=[],a=n),i.push(r),a+=e)}return i.length&&t.push({...this.head,events:i}),t}},J=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,K=/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*)?|\b[Bb]earer\s+[A-Za-z0-9._~+/=-]{8,}/g,W=/\b[a-z][a-z0-9+.-]*:\/\/\S+/gi,D=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,V=/\d{4,}/g,G=/(^|[/:])(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,})(?=$|[/:])/gi,Q=/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,X=/(?:\(|@|\bat\s+)?((?:[a-z][a-z0-9+.-]*:\/\/|\/)[^\s()@]*?):(\d+):(\d+)\)?\s*$/i;function Y(e,t,n){const i=e.replace(Q,"").split(/[?#]/,1)[0];return i?`${i}:${t}:${n}`.slice(0,256):null}function ee(e){if("string"!=typeof e)return[];const t=[];for(const n of e.split("\n")){const e=X.exec(n.trim()),i=e&&Y(e[1],e[2],e[3]);if(i&&t.push(i),5===t.length)break}return t}function te(e){const t=e instanceof Error?e.name:void 0;return"string"==typeof t&&t.length<=64&&H.test(t)?t:"Error"}function ne(e){if("string"!=typeof e)return"unknown";const t=e.trim().replace(Q,"").split(/[?#]/,1)[0].replace(G,(e,t)=>":"===t?":id":`${t}:id`);return t&&t.length<=128&&!t.includes("//")&&U.test(t)?t:"unknown"}var ie={flush(){},reportError(){},stop(){}},ae=null,re=/* @__PURE__ */new Set(["LCP","FCP","TTFB"]);function oe(e,t,n){const i=t.getAccessToken();i&&n(t.endpoint??"/api/client-telemetry/web-batches/",{method:"POST",keepalive:!0,credentials:"same-origin",headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`},body:JSON.stringify(e)}).catch(e=>{console.debug("[efficient-shell] client telemetry batch dropped:",e)})}function se(n){if(ae?.stop(),ae=null,!1===n.enabled||"undefined"==typeof window||"undefined"==typeof document)return ie;if(!function(e){const t="string"==typeof e.app&&O.test(e.app),n="string"==typeof e.release&&O.test(e.release);return t&&n||console.warn("[efficient-shell] client telemetry not started: `app` and `release` must be version-like strings."),t&&n}(n))return ie;const d=n.fetch??window.fetch.bind(window),l=new q({app:n.app,release:n.release,shell_version:O.test(e)?e:""}),u=ne(n.routeKey()),f=function(e=("undefined"==typeof window?void 0:window)){if(!e)return"desktop";const t="function"==typeof e.matchMedia&&e.matchMedia("(pointer: coarse)").matches,n=e.innerWidth;return n<600?"mobile":t&&n<1280?"tablet":"desktop"}(window);let v=!1;const m=()=>{for(const e of l.drain())oe(e,n,d)},E=e=>{v||(l.addError(e),l.size>=50&&m())},L=(e,t)=>{return{type:"error",source:t,name:te(e),message:(a=e,i=a instanceof Error?a.message:"string"==typeof a?a:a&&"object"==typeof a&&"string"==typeof a.message?a.message:"",i.slice(0,640).replace(J,"[redacted]").replace(K,"[redacted]").replace(W,"[url]").replace(D,"[id]").replace(V,"[n]").replace(/\s+/g," ").trim().slice(0,160)),frames:ee(e instanceof Error?e.stack:void 0),route:ne(n.routeKey()),count:1};var i,a},k=e=>{v||(l.addVital(function(e,t,n,i){return{type:"vital",name:e.name,value:e.value,route:re.has(e.name)?t:n(),navigation:e.navigationType??"navigate",device:i}}(e,u,()=>ne(n.routeKey()),f)),l.size>=50&&m())},S=n.vitalsSampleRate??1;S>0&&(S>=1||(n.random??Math.random)()<S)&&(((e,t={})=>{let n=!1;const s=w(t);C(()=>{let d,l=h(),u=g("LCP");const f=p(t,x),v=(i,a,o,s,c)=>{u=g("LCP",-1,i,a,o,s,c),d=r(e,u,j,t.reportAllChanges),n=!1,"soft-navigation"===i&&(l=h(!0))},m=e=>{f.l&&e.navigationId&&I(f.l,e),n||d(!0),v("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const t=e.getLargestInteractionContentfulPaint?.();t&&y([t])},y=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){m(t);continue}let e=0,n=[],i=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-c(),0),f.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){const a=t;if(!u.navigationId)continue;if("interactionId"in a&&a.interactionId!=u.navigationInteractionId)continue;i=a.largestContentfulPaint?.renderTime||0,e=Math.max(i-t.startTime,0),a.largestContentfulPaint&&(f.h(a.largestContentfulPaint),n=[a.largestContentfulPaint])}i<l.firstHiddenTime&&(u.value=e,u.entries=n,d())}},w=["largest-contentful-paint"];s&&w.push("interaction-contentful-paint","soft-navigation");const b=T(w,y);if(b){d=r(e,u,j,t.reportAllChanges);const c=["keydown","click","visibilitychange"],l=e=>{if(e.isTrusted&&!n){const e=u.id;_(()=>{if(!n){if(!s){b.disconnect();for(const e of c)removeEventListener(e,l,{capture:!0})}e===u.id&&(n=!0,d(!0))}})}};for(const e of c)addEventListener(e,l,{capture:!0});a(a=>{v("back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),d=r(e,u,j,t.reportAllChanges),o(()=>{u.value=performance.now()-a.timeStamp,n=!0,d(!0)})})}})})(k),R(k),((e,t={})=>{const n=h();P(b(()=>{let s,c=g("CLS",0);const d=p(t,y),l=(n,i,a,o,l)=>{c=g("CLS",0,n,i,a,o,l),d.i=0,s=r(e,c,A,t.reportAllChanges)},u=(e=!1)=>{d.i>c.value&&(c.value=d.i,c.entries=d.o),s(e)},f=e=>{u(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},h=e=>{for(const t of e)"soft-navigation"!==t.entryType?d.h(t):f(t);u()},v=["layout-shift"];w(t)&&v.push("soft-navigation");const m=T(v,h);m&&(s=r(e,c,A,t.reportAllChanges),n.onHidden(()=>{h(m.takeRecords()),s(!0)}),a(()=>{l("back-forward-cache",c.navigationId,c.navigationInteractionId,c.navigationURL,i()),o(s)}),setTimeout(s))}))})(k),P(k),((e,t={})=>{const n=w(t);let o=g("TTFB"),d=r(e,o,B,t.reportAllChanges);N(()=>{const l=s();if(l){const s=l.responseStart;o.value=Math.max(s-c(),0),o.entries=[l],d(!0),a(()=>{o=g("TTFB",0,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,i()),d=r(e,o,B,t.reportAllChanges),d(!0)}),n&&T(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&(o=g("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),o.entries=[n],d=r(e,o,B,t.reportAllChanges),d(!0))})},t)}})})(k));const z=e=>{const{error:t,message:n,filename:i,lineno:a,colno:r}=e;if(null!=t)return void E(L(t,"onerror"));const o=i?ee(`at ${i}:${a??0}:${r??0}`):[];E({...L(n??"","onerror"),frames:o})},M=e=>E(L(e.reason,"unhandledrejection")),$=()=>{"hidden"===document.visibilityState&&m()};window.addEventListener("error",z),window.addEventListener("unhandledrejection",M),document.addEventListener("visibilitychange",$),window.addEventListener("pagehide",m);const Z=window.setInterval(m,n.flushIntervalMs??6e4),F=t(e=>E(L(e,"boundary"))),U={flush:m,reportError:e=>E(L(e,"boundary")),stop(){v||(m(),v=!0,window.removeEventListener("error",z),window.removeEventListener("unhandledrejection",M),document.removeEventListener("visibilitychange",$),window.removeEventListener("pagehide",m),window.clearInterval(Z),F(),ae===U&&(ae=null))}};return ae=U,U}export{se as startClientTelemetry};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{useWindowMenuItem as e,Modal as t}from"./chunk-
|
|
1
|
+
import{useWindowMenuItem as e,Modal as t}from"./chunk-NUCPJVKD.js";import{navIcons as r}from"./chunk-DSSLOQDW.js";import{VERSION as s}from"./chunk-FTZ5WHJM.js";import{DEFAULT_SHELL_STRINGS as o,useShellStrings as n,splitAround as i}from"./chunk-QRCDQPJA.js";import{Icon as a}from"./chunk-ZGUQLVY4.js";import{useState as m,useCallback as c,isValidElement as l,cloneElement as d}from"react";import{jsx as p,jsxs as h}from"react/jsx-runtime";var u=o.aboutApp,f={spreadsheet:{name:"Spreadsheets",version:"1.1.3",route:"/spreadsheet",description:u.spreadsheet},notepad:{name:"Notepad",version:"1.0.2",route:"/notepad",description:u.notepad},documents:{name:"Documents",version:"1.1.1",route:"/documents",description:u.documents},preview:{name:"Preview",version:"1.4.3",route:"/preview",description:u.preview},files:{name:"Files",version:"1.1.3",route:"/files",description:u.files},browser:{name:"Browser",version:"1.0.2",route:"/browser",description:u.browser}},x=/* @__PURE__ */p(a,{name:"info",className:"h-4 w-4",strokeWidth:1.5}),v=/* @__PURE__ */p(a,{name:"window",className:"h-9 w-9",strokeWidth:1.5});function w({app:o}){const a=f[o],[u,w]=m(!1),N=c(()=>w(!0),[]),g=n().aboutApp,b=g.title(a.name);if(e(b,N,x),!u)return null;const y=r[a.route],k=l(y)?d(y,{className:"h-9 w-9"}):v,[j,D]=i(g.partOf);/* @__PURE__ */
|
|
2
2
|
return p(t,{open:!0,onClose:()=>w(!1),title:b,size:"sm",compact:!0,bodyScroll:!1,autoHeight:!0,dimensions:[320,320],children:/* @__PURE__ */h("div",{className:"flex flex-col items-center text-center px-5 pt-5 pb-4",children:[
|
|
3
3
|
/* @__PURE__ */p("div",{className:"flex h-16 w-16 items-center justify-center rounded-2xl bg-gray-100 text-gray-600 shrink-0",children:k}),
|
|
4
4
|
/* @__PURE__ */p("h2",{className:"mt-3 text-lg font-bold text-gray-900",children:a.name}),
|
|
5
|
-
/* @__PURE__ */p("p",{className:"text-2xs font-mono text-gray-400",children:
|
|
6
|
-
/* @__PURE__ */p("p",{className:"mt-2 text-xs text-gray-500 leading-relaxed",children:
|
|
5
|
+
/* @__PURE__ */p("p",{className:"text-2xs font-mono text-gray-400",children:g.version(a.version)}),
|
|
6
|
+
/* @__PURE__ */p("p",{className:"mt-2 text-xs text-gray-500 leading-relaxed",children:g[o]}),
|
|
7
7
|
/* @__PURE__ */h("div",{className:"mt-4 pt-3 border-t border-gray-200 w-full",children:[
|
|
8
8
|
/* @__PURE__ */h("p",{className:"text-2xs text-gray-500",children:[j,
|
|
9
|
-
/* @__PURE__ */p("span",{className:"font-medium text-gray-700",children:"efficient-shell"}),
|
|
9
|
+
/* @__PURE__ */p("span",{className:"font-medium text-gray-700",children:"efficient-shell"}),D]}),s&&/* @__PURE__ */p("p",{className:"mt-0.5 text-2xs font-mono text-gray-400",children:g.shellVersion(s)})]})]})})}export{w as AboutApp,f as BUILTIN_APP_INFO};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import{useDismissPopupsOnOpen as e}from"./chunk-UVBK6YSR.js";import{buttonClasses as t}from"./chunk-JTNKC4CR.js";import{registerModalEscapeInterceptor as n,Z_LAYERS as r}from"./chunk-FIEA5CGB.js";import{useShellStrings as l,splitAround as o}from"./chunk-QRCDQPJA.js";import{Icon as i}from"./chunk-ZGUQLVY4.js";import{createContext as a,useEffect as s,useRef as c,useId as d,useContext as u,useState as m,useCallback as f}from"react";import{jsxs as h,jsx as b,Fragment as g}from"react/jsx-runtime";var v=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");function p(e){return Array.from(e.querySelectorAll(v)).filter(e=>null!==e.offsetParent||e===document.activeElement)}var y=[];function x(e){const t=y.findIndex(t=>t!==e&&e.contains(t));-1===t?y.push(e):y.splice(t,0,e)}function w(e){const t=y.lastIndexOf(e);-1!==t&&y.splice(t,1)}var N=/* @__PURE__ */new WeakSet;function k(e){return p(e)}function C(e,t){s(()=>{if(!t)return;const n=e.current;return n?(N.add(n),x(n),()=>{w(n),N.delete(n)}):void 0},[e,t])}function E(e,t){const n=y.lastIndexOf(t),r=n>0?y[n-1]:-1===n?y[y.length-1]??null:null,l=p(r??e.ownerDocument.body).filter(n=>!t.contains(n)&&!e.contains(n)),o=l.find(t=>0!==(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING));return o||(r&&!N.has(r)?l[0]??null:null)}function L(e,t,n){s(()=>{if(!t)return;const r=e.current;if(!r)return;const l=document.activeElement,o=n?.current??p(r)[0]??r;o!==r||r.hasAttribute("tabindex")||r.setAttribute("tabindex","-1"),o.focus();const i=e=>{if("Tab"!==e.key)return;if(y[y.length-1]!==r)return;const t=p(r);if(0===t.length)return void e.preventDefault();const n=t[0],l=t[t.length-1],o=document.activeElement;!e.shiftKey||o!==n&&r.contains(o)?e.shiftKey||o!==l&&r.contains(o)||(e.preventDefault(),n.focus()):(e.preventDefault(),l.focus())};return x(r),document.addEventListener("keydown",i,!0),()=>{w(r),document.removeEventListener("keydown",i,!0),(r.contains(document.activeElement)||document.activeElement===document.body)&&l?.focus?.()}},[e,t,n])}var P=0,j=null;function I(e){s(()=>{if(!e)return;const t=document.body;if(0===P){j={overflow:t.style.overflow,paddingRight:t.style.paddingRight};const e=window.innerWidth-document.documentElement.clientWidth;t.style.overflow="hidden",e>0&&(t.style.paddingRight=`${e}px`)}return P+=1,()=>{0===(P-=1)&&j&&(t.style.overflow=j.overflow,t.style.paddingRight=j.paddingRight,j=null)}},[e])}function D({role:e="dialog",modal:t,titleId:n,labelledBy:r,label:l}){const o=n??r;return{role:e,"aria-modal":!!t||void 0,"aria-labelledby":o,"aria-label":o?void 0:l}}var T={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-4xl"};function F({open:t,onClose:o,title:a,description:u,role:m="dialog",children:f,footer:g,blocking:v=!1,size:p="md",initialFocus:y,"aria-label":x,"aria-labelledby":w,"aria-describedby":N,className:k=""}){const C=c(null),E=d(),P=d(),j=!v&&!g,F=d(),R=l().dialog;return e(t),L(C,t,y),I(t),s(()=>{if(t)return n(()=>(v||o(),!0),()=>C.current)},[t,v,o]),t?/* @__PURE__ */h("div",{className:"fixed inset-0",style:{zIndex:r.overlay},role:"presentation",children:[
|
|
2
|
+
/* @__PURE__ */b("div",{className:"fixed inset-0 bg-black/30","aria-hidden":"true"}),
|
|
3
|
+
/* @__PURE__ */b("div",{className:"fixed inset-0 flex items-center justify-center p-4",onClick:v?void 0:e=>{e.target===e.currentTarget&&o()},children:/* @__PURE__ */h("div",{ref:C,...D({role:m,modal:!0,titleId:a?F:void 0,labelledBy:w,label:x}),"aria-describedby":N??(u?P:f?E:void 0),className:`relative max-h-full w-full ${T[p]} overflow-y-auto overscroll-contain rounded-(--radius-card) bg-white p-6 shadow-xl ${k}`.trim(),children:[a&&/* @__PURE__ */b("h2",{id:F,className:(j?"pr-8 ":"")+"text-base font-semibold text-gray-900",children:a}),u&&/* @__PURE__ */b("p",{id:P,className:((a?"mt-1":j?"pr-8":"")+" text-sm text-gray-500").trim(),children:u}),f&&/* @__PURE__ */b("div",{id:E,className:"mt-2 text-sm text-gray-600",children:f}),g&&/* @__PURE__ */b("div",{className:"mt-6 flex flex-wrap justify-end gap-3",children:g}),j&&/* @__PURE__ */b("button",{type:"button",onClick:o,"aria-label":R.close,className:"absolute right-3 top-3 rounded-(--radius-control) p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:/* @__PURE__ */b(i,{name:"close",className:"h-5 w-5",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true"})})]})})]}):null}var R=a(()=>Promise.resolve(!1)),W=()=>u(R),O=()=>Promise.resolve(!1),$=e=>O(e),A=()=>Promise.resolve(!1),K=e=>A(e),B=()=>Promise.resolve(null),S=e=>B(e),G={danger:{icon:"text-red-600 bg-red-100",button:t({variant:"danger"})},warning:{icon:"text-yellow-600 bg-yellow-100",button:t({variant:"warning"})},info:{icon:"text-blue-600 bg-blue-100",button:t({variant:"primary"})}},Q=t({variant:"secondary"}),U=t({variant:"primary"}),V="w-full rounded-md border border-gray-300 h-8 px-3 text-sm";function z(){/* @__PURE__ */
|
|
4
|
+
return b(i,{name:"warning",className:"h-5 w-5",strokeWidth:1.5,"aria-hidden":"true"})}function J(){/* @__PURE__ */
|
|
5
|
+
return b(i,{name:"close",className:"h-5 w-5",strokeWidth:1.5,"aria-hidden":"true"})}function Y({children:e}){const[t,n]=m(!1),[r,i]=m({message:""}),[a,d]=m(0),u=c(),v=c(null),p=c(0),y=c([]),x=c(null),w=c(null),N=f(e=>{v.current=e.id,u.current=e.resolve,d(e.id),i(e.options),n(!0)},[]),k=f(e=>{const t="string"==typeof e?{message:e}:e;return new Promise(e=>{const n={id:++p.current,options:t,resolve:e};null===v.current?N(n):y.current.push(n)})},[N]),[C,E]=m(!1),[L,P]=m({message:""}),[j,I]=m(""),D=c(),T=f(e=>(P(e),I(""),E(!0),new Promise(e=>{D.current=e})),[]),[W,$]=m(!1),[K,S]=m({}),[Y,_]=m(""),q=c(),M=f(e=>{const t="string"==typeof e?{message:e}:e;return S(t),_(t.defaultValue??""),$(!0),new Promise(e=>{q.current=e})},[]);s(()=>{O=k,A=T,B=M},[k,T,M]);const Z=(e,t)=>{if(v.current!==e)return;const r=u.current,l=y.current.shift();l?N(l):(v.current=null,u.current=void 0,n(!1)),r?.(t)},H=e=>{E(!1),I(""),D.current?.(e)},X=e=>{if(e){const e=Y.trim();if(!e&&!K.allowEmpty)return $(!1),void q.current?.(null);$(!1),q.current?.(e)}else $(!1),q.current?.(null)},ee=r.variant||(r.confirmLabel?.toLowerCase().includes("delete")||r.message.toLowerCase().includes("delete")?"danger":"info"),te=G[ee],ne=G["warning"===L.variant?"warning":"danger"],re=L.confirmWord,le=null==re||j===re,oe=l().dialog,[ie,ae]=o(oe.typeToConfirm);/* @__PURE__ */
|
|
6
|
+
return h(R.Provider,{value:k,children:[e,
|
|
7
|
+
/* @__PURE__ */b(F,{open:t,onClose:()=>Z(a,!1),initialFocus:x,footer:/* @__PURE__ */h(g,{children:[
|
|
8
|
+
/* @__PURE__ */b("button",{ref:x,type:"button",onClick:()=>Z(a,!1),className:Q,children:r.cancelLabel||oe.cancel}),
|
|
9
|
+
/* @__PURE__ */b("button",{type:"button",onClick:()=>Z(a,!0),className:te.button,children:r.confirmLabel||oe.ok})]}),children:/* @__PURE__ */h("div",{className:"flex gap-4",children:[
|
|
10
|
+
/* @__PURE__ */b("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${te.icon}`,children:/* @__PURE__ */b(z,{})}),
|
|
11
|
+
/* @__PURE__ */h("div",{className:"flex-1",children:[
|
|
12
|
+
/* @__PURE__ */b("h2",{className:"text-base font-semibold text-gray-900",children:r.title||oe.confirmTitle}),
|
|
13
|
+
/* @__PURE__ */b("p",{className:"mt-2 text-sm text-gray-600",children:r.message})]})]})}),
|
|
14
|
+
/* @__PURE__ */h(F,{open:C,onClose:()=>H(!1),initialFocus:null!=re?void 0:w,footer:/* @__PURE__ */h(g,{children:[
|
|
15
|
+
/* @__PURE__ */b("button",{ref:w,type:"button",onClick:()=>H(!1),className:Q,children:L.cancelLabel||oe.destructiveCancel}),
|
|
16
|
+
/* @__PURE__ */b("button",{type:"button",onClick:()=>H(!0),disabled:!le,className:ne.button,children:re??L.confirmLabel??oe.destructiveConfirm})]}),children:[
|
|
17
|
+
/* @__PURE__ */b("button",{type:"button",onClick:()=>H(!1),"aria-label":oe.close,className:"absolute right-4 top-4 rounded-md p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:/* @__PURE__ */b(J,{})}),
|
|
18
|
+
/* @__PURE__ */h("div",{className:"flex gap-4",children:[
|
|
19
|
+
/* @__PURE__ */b("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${ne.icon}`,children:/* @__PURE__ */b(z,{})}),
|
|
20
|
+
/* @__PURE__ */h("div",{className:"flex-1",children:[
|
|
21
|
+
/* @__PURE__ */b("h2",{className:"text-base font-semibold text-gray-900 pr-6",children:L.title||oe.destructiveTitle}),
|
|
22
|
+
/* @__PURE__ */b("p",{className:"mt-2 text-sm text-gray-600",children:L.message}),null!=re&&/* @__PURE__ */h(g,{children:[
|
|
23
|
+
/* @__PURE__ */h("p",{className:"mt-3 text-sm text-gray-700",children:[ie,
|
|
24
|
+
/* @__PURE__ */b("kbd",{className:"rounded border border-gray-300 bg-gray-50 px-2 py-0.5 text-xs font-bold text-red-600 font-mono",children:re}),ae]}),
|
|
25
|
+
/* @__PURE__ */b("input",{autoFocus:!0,type:"text",value:j,onChange:e=>I(e.target.value),onKeyDown:e=>{"Enter"===e.key&&j===re&&H(!0)},placeholder:re,className:`mt-2 ${V} focus:border-red-500`})]})]})]})]}),
|
|
26
|
+
/* @__PURE__ */h(F,{open:W,onClose:()=>X(!1),title:K.title||oe.promptTitle,footer:/* @__PURE__ */h(g,{children:[
|
|
27
|
+
/* @__PURE__ */b("button",{type:"button",onClick:()=>X(!1),className:Q,children:K.cancelLabel||oe.cancel}),
|
|
28
|
+
/* @__PURE__ */b("button",{type:"button",onClick:()=>X(!0),disabled:!K.allowEmpty&&!Y.trim(),className:U,children:K.confirmLabel||oe.ok})]}),children:[K.message&&/* @__PURE__ */b("p",{className:"text-sm text-gray-600",children:K.message}),
|
|
29
|
+
/* @__PURE__ */b("input",{autoFocus:!0,type:"text",value:Y,onChange:e=>_(e.target.value),onKeyDown:e=>{"Enter"===e.key?X(!0):"Escape"===e.key&&X(!1)},onFocus:e=>e.target.select(),placeholder:K.placeholder,className:`mt-3 ${V} focus:border-blue-500 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-accent)]`})]})]})}export{Y as ConfirmProvider,F as Dialog,$ as confirm,K as confirmDestructive,D as dialogA11y,k as focusableIn,S as prompt,E as stopAfter,W as useConfirm,L as useFocusTrap,I as useScrollLock,C as useTabLayer};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Modal as e}from"./chunk-
|
|
1
|
+
import{Modal as e}from"./chunk-NUCPJVKD.js";import{keepsNativeMenu as a}from"./chunk-IQDY2YFN.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
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
3
|
/* @__PURE__ */n("div",{children:[
|
|
4
4
|
/* @__PURE__ */i("h3",{className:"text-sm font-semibold text-gray-700 mb-3",children:"Appearance"}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{client_default as a}from"./chunk-
|
|
1
|
+
import{client_default as a}from"./chunk-NUCPJVKD.js";var e=()=>a.get("/auth/numbering-configs/").then(a=>a.data?.results??a.data??[]),t="uploaded:wallpaper";function r(a,e){return"string"!=typeof a||!a||"none"===a||a.startsWith("#")?"":a===t?e||"":a}var p=()=>a.get("/auth/me/wallpaper/").then(a=>a.data),n=e=>{const t=new FormData;return t.append("wallpaper",e),a.post("/auth/me/wallpaper/",t).then(a=>a.data)},l=()=>a.delete("/auth/me/wallpaper/").then(a=>a.data);function s(a){const e=a?.response?.status,t=a?.response?.data,r=Array.isArray(t?.wallpaper)?t.wallpaper[0]:void 0;return r||(413===e?"That picture is too large to use as a wallpaper.":415===e?"That file is not a picture this can use as a wallpaper.":"The wallpaper could not be saved. Please try again.")}export{t as WALLPAPER_PREF_TOKEN,l as deleteWallpaper,e as getNumberingConfigs,p as getWallpaper,n as uploadWallpaper,r as wallpaperSrc,s as wallpaperUploadError};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r="7.19.0",a=r;export{a as APP_VERSION,r as VERSION};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import{computeMaximizedBox as e,isSidebarStripReserved as t,boxFillsWorkArea as n,readAlwaysMaximizedFlag as r,WORK_AREA_CHANGED_EVENT as o,useShellAuth as i,scrollerIsFluid as a,growBoxToWidth as s,widthToFit as l,navIcons as c}from"./chunk-DSSLOQDW.js";import{CopyButton as d}from"./chunk-SCJT2XXU.js";import{isStaleChunkError as u,CMD_Z as h,CMD_SHIFT_Z as m,LoadingSpinner as p,Result as f,useIsMobile as w,useShellPrefs as y}from"./chunk-ZRU5F2XT.js";import{Button_default as g}from"./chunk-WYNQLAKD.js";import{confirm as b,dialogA11y as v}from"./chunk-76VCH7N6.js";import{PopupMenu as x,PopupMenuItem as k,PopupMenuDivider as E,PopupMenuLabel as C}from"./chunk-IQDY2YFN.js";import{Z_LAYERS as M,runEscapeInterceptors as N}from"./chunk-FIEA5CGB.js";import{reportBoundaryError as S}from"./chunk-KNUR2UEG.js";import{useShellStrings as L}from"./chunk-QRCDQPJA.js";import{Icon as T}from"./chunk-ZGUQLVY4.js";import{createContext as z,useContext as A,Component as D,useLayoutEffect as P,useRef as I,useEffect as $,useState as K,useSyncExternalStore as W,useCallback as O,isValidElement as R,Fragment as F,Children as q,cloneElement as j,useMemo as B,useId as H,useReducer as Y,Suspense as U}from"react";import{jsxs as X,jsx as V,Fragment as _}from"react/jsx-runtime";import{createPortal as J}from"react-dom";import{useLocation as Q}from"react-router-dom";import{useQueryClient as G,useQuery as Z}from"@tanstack/react-query";function ee(e){return"component"in e}function te(e){return"endpoint"in e}var ne={};function re(e){ne=e}var oe=new Proxy({},{get:(e,t)=>ne[t],has:(e,t)=>t in ne,ownKeys:()=>Object.keys(ne),getOwnPropertyDescriptor(e,t){if(t in ne)return{configurable:!0,enumerable:!0,value:ne[t]}}}),ie=null;function ae(e){ie=e}function se(){return null!==ie}var le=/* @__PURE__ */new Set(["get","post","put","patch","delete","head","options","request"]),ce=new Proxy({},{get:(e,t)=>ie?ie[t]:"string"==typeof t&&le.has(t)?()=>Promise.resolve({data:null,status:0,statusText:"",headers:{},config:{}}):void 0}),de=z(null);function ue(){return A(de)?.pageSearch??""}var he=null,me=/* @__PURE__ */new Set;function pe(e){he!==e&&(he=e,me.forEach(e=>e()))}function fe(){return he}function we(e){return me.add(e),()=>{me.delete(e)}}function ye({error:e,onReload:t}){const n=u(e);/* @__PURE__ */
|
|
2
|
+
return X("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 py-12 text-center",children:[
|
|
3
|
+
/* @__PURE__ */V(T,{name:"warning",className:"h-8 w-8 text-amber-500",strokeWidth:1.5}),
|
|
4
|
+
/* @__PURE__ */X("div",{className:"min-w-0",children:[
|
|
5
|
+
/* @__PURE__ */V("p",{className:"text-sm font-medium text-gray-700",children:n?"This window needs the latest version of the app":"This window crashed"}),
|
|
6
|
+
/* @__PURE__ */V("p",{className:"mt-1 text-xs text-gray-400 max-w-sm break-words",children:n?"A new version was deployed while this tab was open. Reload the page to pick it up.":e.message||String(e)})]}),
|
|
7
|
+
/* @__PURE__ */V("button",{type:"button",onClick:n?()=>window.location.reload():t,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 text-sm font-medium rounded-lg",children:n?"Reload page":"Reload window"})]})}var ge=class extends D{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),S(e)}reset=()=>this.setState({error:null});render(){const{error:e}=this.state;return e?this.props.fallback?this.props.fallback(e,this.reset):/* @__PURE__ */V(ye,{error:e,onReload:this.reset}):this.props.children}},be=z(null),ve="text-xs text-gray-500 hover:text-gray-700 disabled:opacity-40 disabled:hover:text-gray-500 disabled:cursor-default";function xe({className:e="",auto:t=!1}){const n=A(be),r=L().undo,o=n?.claimOwnMount;if(P(()=>{if(!t&&o)return o(!0),()=>o(!1)},[t,o]),!n||!n.enabled)return null;const{undo:i,redo:a,canUndo:s,canRedo:l,undoLabel:c,redoLabel:d}=n;/* @__PURE__ */
|
|
8
|
+
return X("div",{className:`flex items-center gap-2 ${e}`,"data-undo-controls":t?"shell":"form",children:[
|
|
9
|
+
/* @__PURE__ */V("button",{type:"button",onClick:i,disabled:!s,title:s?r.undoStep(c??"",h):r.nothingToUndo,className:ve,children:r.undo}),
|
|
10
|
+
/* @__PURE__ */V("button",{type:"button",onClick:a,disabled:!l,title:l?r.redoStep(d??"",m):r.nothingToRedo,className:ve,children:r.redo})]})}var ke=/* @__PURE__ */new Set([408,429]);function Ee(e){const t=e?.response?.status;return"number"==typeof t?t:void 0}function Ce(e){const t=Ee(e);return null!=t&&(t>=400&&t<500&&!ke.has(t))}function Me(e,t){return!Ce(t)&&e<3}function Ne(){const e=L().loading;/* @__PURE__ */
|
|
11
|
+
return V("div",{className:"flex items-center justify-center p-8 text-sm text-gray-400",children:e.label})}var Se="flex-1 min-h-0";function Le(){const e=L().record;/* @__PURE__ */
|
|
12
|
+
return V(p,{label:e.loading,padding:"",className:Se})}function Te(e){return e??void 0}function ze({isPending:e,isFetching:t,enabled:n=!0,error:r,onRetry:o}){const i=L().record;if(t||e&&n)/* @__PURE__ */return V(Le,{});if(r){const e=Ee(r);if(401===e)/* @__PURE__ */
|
|
13
|
+
return V(f,{status:"warning",title:i.signInRequired,subTitle:i.signInBody,className:Se});if(403===e)/* @__PURE__ */
|
|
14
|
+
return V(f,{status:"403",className:Se});if(404===e||410===e)/* @__PURE__ */
|
|
15
|
+
return V(f,{status:"404",title:i.notFound,className:Se});const t=null==e||408===e||429===e||e>=500;/* @__PURE__ */
|
|
16
|
+
return V(f,{status:"500",title:i.loadFailed,subTitle:t?i.checkConnection:i.rejected,extra:t?/* @__PURE__ */V(g,{variant:"secondary",size:"sm",onClick:o,children:i.retry}):void 0,className:Se})}/* @__PURE__ */
|
|
17
|
+
return V(f,{status:"404",title:i.notFound,className:Se})}function Ae({entity:e,children:t,...n}){return null!=e?/* @__PURE__ */V(_,{children:t(e)}):/* @__PURE__ */V(ze,{...n})}var De=/^[a-z]+(?:-[a-z]+)*-\d{13}$/;function Pe(e){return"string"==typeof e&&(e.startsWith("new-")||De.test(e))}function Ie(e){if(Pe(e.entityId))return!0;const t=e.entitySnapshot;return!(!t||"object"!=typeof t||!t._new&&!t._duplicate)}var $e=z({openWindows:[],openEntity:()=>{},openPage:()=>{},closeEntity:()=>{},minimize:()=>{},items:[],restore:()=>{},remove:()=>{},restoreIfMinimized:()=>!1,openItems:[]}),Ke=z(null);function We(e){const t=A(Ke),n=I(null);null===n.current&&(n.current=/* @__PURE__ */Symbol("window-dirty")),P(()=>{if(t)return t(n.current,e)},[t,e]),$(()=>{if(!t||!e)return;const n=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[t,e])}function Oe(){const e=I(/* @__PURE__ */new Map),[t,n]=K(!1);return{dirty:t,registerDirty:O((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 Re(){return A($e)}function Fe(e){if("page"!==e.type&&Ie(e))return null;const t="page"===e.type?"page":e.entityType||"",n="page"===e.type?e.route||"":e.entityId||"";return t&&n?{entityType:t,entityId:n,label:e.label}:null}function qe({item:e,onClose:t,accentRgb:n}){const{dirty:r,registerDirty:o}=Oe(),i=oe[e.route];if(!i||!ee(i))return null;const a=i,s=a.component;/* @__PURE__ */
|
|
18
|
+
return V(zr,{open:!0,onClose:t,icon:c[e.route],title:a.label,size:a.size||"2xl",dirty:r,allowPinOnTop:a.allowPinOnTop,initialPosition:a.initialPosition,widget:a.widget,compact:a.compact,appStyle:a.appStyle,flushBody:a.flushBody,autoHeight:a.autoHeight,autoMinHeight:a.autoMinHeight,autoWidth:a.autoWidth,dimensions:a.dimensions,windowKey:e.id,openedFromKey:e.openedFrom,accentRgb:n,children:/* @__PURE__ */V(Ke.Provider,{value:o,children:/* @__PURE__ */V(U,{fallback:/* @__PURE__ */V("div",{className:"flex items-center justify-center py-12",children:/* @__PURE__ */V(Ne,{})}),children:/* @__PURE__ */V(s,{})})})})}function je({entityType:e,entityId:t,label:n}){const r=L(),o=G(),{data:i}=Z({queryKey:["my-profile-sidebar"],enabled:se(),queryFn:()=>ce.get("/auth/me/").then(e=>e.data)}),a=(i?.preferences||{}).favorite_documents||[],s=a.some(n=>n.entityType===e&&n.entityId===t);/* @__PURE__ */
|
|
19
|
+
return V("button",{onClick:()=>{const r=s?a.filter(n=>!(n.entityType===e&&n.entityId===t)):[...a,{entityType:e,entityId:t,label:n}];ce.patch("/auth/me/",{preferences:{favorite_documents:r}}).then(()=>{o.invalidateQueries({queryKey:["my-profile-sidebar"]})})},title:s?r.taskbar.removeFromDesktop:r.taskbar.addToDesktop,className:"shrink-0 transition-colors "+(s?"text-yellow-500 hover:text-yellow-600":"text-gray-300 hover:text-yellow-400"),children:/* @__PURE__ */V(T,{name:"star",className:"h-4 w-4",fill:s?"currentColor":"none",strokeWidth:1.5})})}var Be=/* @__PURE__ */new Set;function He({item:e,onClose:t,onMinimize:n,accentRgb:r}){const o=oe[e.entityType];if(!o||!te(o))return null;const i=o,[a,s]=K(!1),{dirty:l,registerDirty:d}=Oe(),u=i.queryKey||i.endpoint.replace(/^\/|\/$/g,"").split("/").pop()||e.entityType,h=e.entitySnapshot?._duplicate,m=Pe(e.entityId),p=!i.selfFetching&&!h&&!m&&se(),f=Z({queryKey:[u,e.entityId],queryFn:()=>{return ce.get((t=i.endpoint,n=String(e.entityId),`${t}${encodeURIComponent(n)}/`)).then(e=>e.data);var t,n},initialData:Te(e.entitySnapshot),initialDataUpdatedAt:0,enabled:p,staleTime:0,refetchOnWindowFocus:!0,refetchOnMount:"always",refetchInterval:e=>!Ce(e.state.error)&&6e4,refetchIntervalInBackground:!1,retry:Me}),w=f.data,y=f.refetch;$(()=>{var t;if(p)return t=t=>{t!==e.id||Be.has(t)||y({cancelRefetch:!1})},In.add(t),()=>{In.delete(t)}},[y,e.id,p]);const g=O(()=>{a&&!l?s(!1):t()},[a,l,t]),b=i.selfFetching?e.label:w?i.title(w,a,s):e.label,v=i.icon,x=v?c[v]:null,k=b,E=!i.selfFetching&&w&&i.footer&&!h?i.footer(w):void 0;return i.rendersOwnModal?i.selfFetching?/* @__PURE__ */V(U,{fallback:/* @__PURE__ */V(Ne,{}),children:i.render(w??e.entitySnapshot,t,e.entityId,a,s)}):null!=w?/* @__PURE__ */V(U,{fallback:/* @__PURE__ */V(zr,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */V(Le,{})}),children:i.render(w,t,e.entityId,a,s)}):/* @__PURE__ */V(zr,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */V(ze,{isPending:f.isPending,isFetching:f.isFetching,enabled:p,error:f.error,onRetry:y})}):/* @__PURE__ */V(zr,{open:!0,onClose:g,onMinimize:n,initialBox:e.savedBox,icon:x,title:k,footer:E,copyText:e.label,windowKey:e.id,openedFromKey:e.openedFrom,size:i.size||"2xl",dirty:l,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__ */V(Ke.Provider,{value:d,children:/* @__PURE__ */V(U,{fallback:/* @__PURE__ */V(Le,{}),children:i.selfFetching?i.render(null,t,e.entityId,a,s):/* @__PURE__ */V(Ae,{entity:w,isPending:f.isPending,isFetching:f.isFetching,enabled:p,error:f.error,onRetry:y,children:n=>i.render(n,t,e.entityId,a,s)})})})})}function Ye(e){return document.querySelector(`[data-modal-panel][data-window-key="${e}"]`)}function Ue(e){return document.querySelector(`[data-modal-panel][data-window-root][data-window-owner="${e}"]`)}function Xe(e){const t=Ye(e),n=t??Ue(e);if(!n)return;if(t&&!Un(t))return r=e,void window.dispatchEvent(new CustomEvent("modal-reveal",{detail:{windowKey:r}}));var r;const o=n.getAttribute("data-modal-id");o&&$n(o)}function Ve(e){if("page"!==e.type)return!0;const t=e.route?oe[e.route]:void 0;if(!t||!ee(t))return!0;const n=t;return!n.widget&&!n.utility}function _e(){const e=ar();if(!e)return;const t=document.querySelector(`[data-modal-panel][data-modal-id="${e}"]`);return t?.getAttribute("data-window-key")??void 0}var Je=/* @__PURE__ */new Map;function Qe(){const e=_e();if(e)return Je.get(e)}function Ge(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 Ze="rosh-peek-style",et=M.peek,tt=M.taskbarPreview;function nt(e){"undefined"!=typeof document&&(!function(){if("undefined"==typeof document||document.getElementById(Ze))return;const e=document.createElement("style");e.id=Ze,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:${et}!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 rt(){"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 ot({id:e,label:t,maxW:n,maxH:r,titleAbove:o=!1,onClick:i,onClose:a}){const s=L(),l=I(null),[c,d]=K({w:n,h:Math.round(.75*r)}),[u,h]=K(!1);return P(()=>{const o=l.current;if(!o)return;const i=Ye(e)??Ge(t);if(!i)return void h(!1);const a=i.getBoundingClientRect();if(0===a.width||0===a.height)return void h(!1);const s=Math.min(n/a.width,r/a.height),c=Math.max(80,Math.round(a.width*s)),u=Math.max(60,Math.round(a.height*s));d({w:c,h:u}),h(!0);const m=i.cloneNode(!0);return m.style.position="absolute",m.style.top="0",m.style.left="0",m.style.right="auto",m.style.bottom="auto",m.style.width=a.width+"px",m.style.height=a.height+"px",m.style.transform=`scale(${s})`,m.style.transformOrigin="top left",m.style.pointerEvents="none",m.style.animation="none",m.style.zIndex="auto",m.removeAttribute("data-modal-panel"),m.removeAttribute("data-modal-id"),m.removeAttribute("data-window-key"),m.querySelectorAll('[role="dialog"], [data-portal]').forEach(e=>{e.style.display="none"}),o.innerHTML="",o.appendChild(m),()=>{o.innerHTML=""}},[e,t,n,r]),/* @__PURE__ */X("div",{style:{width:c.w,height:c.h},className:"relative rounded-md overflow-hidden bg-white/95 border border-gray-300 shadow-(--elevation-panel) cursor-pointer ring-2 ring-transparent group-hover:ring-blue-400 transition shrink-0",onClick:i,children:[
|
|
20
|
+
/* @__PURE__ */V("div",{ref:l,className:"absolute inset-0 z-0 overflow-hidden"}),!u&&/* @__PURE__ */X("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-gray-400 bg-gray-50",children:[
|
|
21
|
+
/* @__PURE__ */V(T,{name:"window",className:"h-6 w-6",strokeWidth:1.5}),
|
|
22
|
+
/* @__PURE__ */V("span",{className:"mt-1 text-3xs uppercase tracking-wide",children:"Hidden"})]}),!o&&/* @__PURE__ */V("div",{className:"absolute bottom-0 left-0 right-0 z-10 px-2 py-1 text-2xs font-medium text-white bg-gradient-to-t from-black/80 to-transparent truncate pointer-events-none",children:t}),a&&/* @__PURE__ */V("button",{onClick:e=>{e.stopPropagation(),a()},className:"absolute top-1 right-1 z-20 h-5 w-5 rounded-full bg-gray-900/90 ring-1 ring-white/80 shadow-sm hover:bg-red-500 text-white flex items-center justify-center",title:s.taskbar.closeWindow,children:/* @__PURE__ */V(T,{name:"close",className:"h-3 w-3",strokeWidth:3})})]})}function it({items:e,anchorEl:t,onActivate:n,onClose:r,onMouseEnter:o,onMouseLeave:i}){const a=L(),s=e.length>1,l=I(null),[c,d]=K({left:-9999,top:-9999,ready:!1}),[u,h]=K(()=>"undefined"!=typeof document&&getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom");P(()=>{const e=l.current;if(!e)return;const n=()=>{const n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),o=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom";h(o);let i,a=n.left+n.width/2-r.width/2;"top"===o?i=n.bottom+8:"left"===o?(a=n.right+8,i=n.top+n.height/2-r.height/2):"right"===o?(a=n.left-r.width-8,i=n.top+n.height/2-r.height/2):i=n.top-r.height-8,a=Math.max(8,Math.min(a,window.innerWidth-r.width-8)),i=Math.max(8,Math.min(i,window.innerHeight-r.height-8)),d({left:a,top:i,ready:!0})};n();const r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[t,e.length]),$(()=>rt,[]);const m="top"===u,p=(m?"mt-1":"mb-1")+" max-w-[240px] truncate text-2xs font-medium text-gray-900 bg-white/80 px-2 py-0.5 rounded shadow-sm ring-2 ring-transparent transition group-hover:ring-blue-400";return J(
|
|
23
|
+
/* @__PURE__ */V("div",{ref:l,"data-taskbar-preview":"",style:{position:"fixed",left:c.left,top:c.top,zIndex:tt,maxWidth:"calc(100vw - 16px)",opacity:c.ready?1:0},className:s?"flex gap-2 flex-wrap":"",onMouseEnter:o,onMouseLeave:()=>{rt(),i()},children:e.map(e=>{const t=Ye(e.id)??Ge(e.label),o=t?function(e){if(Un(e))return null;const t=e.getBoundingClientRect(),n=Fn(),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 X("div",{className:"group flex flex-col items-center",onMouseEnter:()=>nt(t),children:[!m&&/* @__PURE__ */V("span",{className:p,children:e.label}),
|
|
25
|
+
/* @__PURE__ */V(ot,{id:e.id,label:e.label,maxW:240,maxH:160,titleAbove:!0,onClick:()=>n(e.id),onClose:()=>r(e.id)}),m&&/* @__PURE__ */V("span",{className:p,children:e.label}),null!==o&&/* @__PURE__ */X("span",{title:a.taskbar.offscreenHint,className:"mt-1 inline-flex items-center gap-1 rounded bg-amber-500 px-2 py-0.5 text-2xs font-semibold text-white shadow-sm",children:[
|
|
26
|
+
/* @__PURE__ */V(T,{name:"arrow-right",className:"h-3 w-3",style:{transform:`rotate(${o}deg)`},strokeWidth:3}),"Off screen"]})]},e.id)})}),document.body)}function at(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 st({openWindows:e,onRemove:t,onSplitView:n,onActivate:r,onActivateById:o}){const i=L(),[a,s]=K(null);$(()=>{let e,t;const n=()=>{clearInterval(e),clearTimeout(t),e=void 0},r=()=>{const e=document.getElementById("taskbar-windows");return s(t=>t===e?t:e),!!e},o=()=>{n(),r()||(e=setInterval(()=>{r()&&n()},100),t=setTimeout(n,5e3))};return o(),window.addEventListener("react-os-shell:layout-mode-changed",o),()=>{n(),window.removeEventListener("react-os-shell:layout-mode-changed",o)}},[]);const l=W(sr,ar),[,d]=K(0);$(()=>{const e=()=>d(e=>e+1);return window.addEventListener("modal-geometry",e),window.addEventListener("resize",e),()=>{window.removeEventListener("modal-geometry",e),window.removeEventListener("resize",e)}},[]);const[,u]=K(0);$(()=>{const e=()=>u(e=>e+1);return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[]);const h=e=>{const t=Ge(e),n=t?.querySelector("[data-window-title]");return n?.textContent?.trim()||e},[m,p]=K(null),[f,w]=K(null),[y,g]=K(null),b=I(null),v=()=>{b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{p(null),w(null)},150)},M=e.filter(e=>!e.route||!oe[e.route]?.utility);if(!a||!a.isConnected||0===M.length)return null;const N=[],S=/* @__PURE__ */new Map;for(const e of M){const t=e.route?oe[e.route]:void 0,n=t?.taskbarGroup,r=n?.key??e.route??`entity:${e.id}`,o=S.get(r);if(void 0!==o)N[o].items.push(e);else{S.set(r,N.length);const o=n?.label??t?.label??e.label;N.push({key:r,route:n?.icon??e.route,label:o,items:[e]})}}return J(
|
|
27
|
+
/* @__PURE__ */X(_,{children:[N.map(e=>{const n=e.route?c[e.route]:null,r=e.items[e.items.length-1];let a=!1;if(l){const t=document.querySelector(`[data-modal-id="${l}"]`);if(t){const n=t.querySelector("[data-window-title]"),r=n?.textContent??"";a=e.items.some(e=>r.includes(e.label))}}const s=e.items.length>1,d=e.items.some(e=>{const t=Ye(e.id)??Ge(e.label);return!!t&&!Un(t)});/* @__PURE__ */
|
|
28
|
+
return X("button",{onClick:()=>o(r.id),onMouseEnter:t=>{return n=e.items,r=t.currentTarget,void(y||(b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{p(n),w(r)},350)));var n,r},onMouseLeave:v,onDoubleClick:e=>{e.stopPropagation(),window.dispatchEvent(new CustomEvent("modal-center",{detail:{windowKey:r.id,label:r.label}}))},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),b.current&&(clearTimeout(b.current),b.current=null),p(null),w(null),s?g({x:t.clientX,y:t.clientY,items:e.items,label:e.label}):window.dispatchEvent(new CustomEvent("modal-context-menu",{detail:{windowKey:r.id,label:r.label,x:t.clientX,y:t.clientY}}))},style:{width:"var(--window-tab-width, 200px)",fontSize:"var(--window-tab-font-size, 12px)"},"data-tab-group":e.key,className:"group relative flex items-center gap-2 rounded-lg px-3 py-2 font-medium transition-all min-w-0 shrink "+(a?"bg-blue-100/60 border border-blue-400/60 text-blue-700":"bg-gray-50/40 border border-gray-200/40 text-gray-700 hover:bg-gray-200/40"),children:[n&&R(n)?j(n,{className:"h-3.5 w-3.5 shrink-0"}):/* @__PURE__ */V(T,{name:"expand",className:"h-3.5 w-3.5 shrink-0",strokeWidth:2}),
|
|
29
|
+
/* @__PURE__ */V("span",{className:"truncate flex-1",children:s?e.label:h(r.label)}),d&&/* @__PURE__ */V("span",{title:i.taskbar.offscreenDot,className:"shrink-0 h-1.5 w-1.5 rounded-full bg-amber-500"}),s&&/* @__PURE__ */V("span",{className:"shrink-0 px-2 py-0.5 rounded-full bg-blue-500/80 text-white text-2xs font-bold leading-none",children:e.items.length}),!s&&/* @__PURE__ */V("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__ */V(T,{name:"close",className:"h-3 w-3",strokeWidth:2})})]},e.key)}),
|
|
30
|
+
/* @__PURE__ */V("div",{className:"flex-1"}),M.length>=2&&/* @__PURE__ */X("button",{onClick:n,title:i.taskbar.expose,className:"flex items-center gap-1 rounded px-2 py-1 text-2xs font-medium text-blue-600 border border-blue-300 hover:bg-blue-50 transition-colors shrink-0",children:[
|
|
31
|
+
/* @__PURE__ */V(T,{name:"grid",className:"h-3 w-3",strokeWidth:2}),"Exposé"]}),y&&/* @__PURE__ */X(x,{portal:!0,minWidth:200,style:at(y.x,y.y),onClose:()=>g(null),children:[
|
|
32
|
+
/* @__PURE__ */V(C,{children:y.label}),
|
|
33
|
+
/* @__PURE__ */X(k,{onClick:()=>{g(null),y.items.forEach(e=>function(e){const t=kn.get(e);t&&Kn(t)}(e.id))},children:[
|
|
34
|
+
/* @__PURE__ */V(T,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),i.taskbar.minimizeAllWindows]}),
|
|
35
|
+
/* @__PURE__ */X(k,{onClick:()=>{g(null),y.items.forEach(e=>o(e.id))},children:[
|
|
36
|
+
/* @__PURE__ */V("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */V("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75h6.5v6.5h-6.5zM13.75 8.75h6.5v6.5h-6.5z"})}),i.taskbar.restoreAllWindows]}),
|
|
37
|
+
/* @__PURE__ */V(E,{}),
|
|
38
|
+
/* @__PURE__ */X(k,{danger:!0,onClick:()=>{g(null),y.items.forEach(e=>t(e.id))},children:[
|
|
39
|
+
/* @__PURE__ */V(T,{name:"close",className:"h-4 w-4",strokeWidth:2}),`${i.taskbar.closeAllWindows} (${y.items.length})`]})]}),m&&f&&/* @__PURE__ */V(it,{items:m,anchorEl:f,onActivate:e=>{o(e),p(null),w(null)},onClose:e=>{t(e),p(null),w(null)},onMouseEnter:()=>{b.current&&(clearTimeout(b.current),b.current=null)},onMouseLeave:v})]}),a)}var lt=["/login","/forgot-password","/reset-password","/force-change-password"];function ct({children:e,windowAccentForRoute:t}){const n=Q(),r=lt.some(e=>n.pathname.startsWith(e)),[o,i]=K([]),a=I(o);P(()=>{a.current=o},[o]);const s=W(we,fe,fe),l=I(/* @__PURE__ */new Map),c=e=>{const t=Ve(e),n=!!s&&"page"===e.type&&e.route===s,r=e.pageSearch||void 0,o=l.current.get(e.id);if(o&&o.tab===t&&o.home===n&&o.pageSearch===r)return o;const i={key:e.id,tab:t,home:n,...r?{pageSearch:r}:{}};return l.current.set(e.id,i),i};$(()=>{Je.clear();for(const e of o)e.route&&Je.set(e.id,e.route)},[o]);const d=O(e=>{i(t=>t.filter(t=>t.id!==e))},[]),u=O(e=>{var t;Ye(e)||Ue(e)?(t=e,window.dispatchEvent(new CustomEvent(lr,{detail:{windowKey:t}}))):d(e)},[d]),h=(e,t=!1)=>{const n=yn;t&&Be.add(e),setTimeout(()=>{const r=document.querySelector(`[data-modal-panel][data-window-key="${e}"]`),o=r?.getAttribute("data-modal-id");var i,a;!o||(i=o,a=n,(gn.get(i)??-1)>a)||$n(o),t&&Be.delete(e)},50)},m=O((e,t,n,r,o)=>{if(!oe[e]||!te(oe[e]))return;const a=`${e}:${t}`,s=_e();i(i=>{const l=i.find(n=>n.entityType===e&&String(n.entityId)===String(t));return l?(h(l.id),i):(h(a,!0),[...i,{id:a,type:"modal",label:r||t,route:o||window.location.pathname,entityType:e,entityId:t,entitySnapshot:Te(n),openedFrom:s}])})},[]),p=O((e,t={})=>{if(!oe[e]||!ee(oe[e]))return;const n=oe[e],{reuse:r=!1,background:o=!1,shellOwned:s,search:l}=t,c=e=>{var t;o?(t=e,Sn.add(t)):h(e)};if(n.widget){const t=a.current.find(t=>"page"===t.type&&t.route===e);if(t)return void u(t.id)}const d=_e();i(t=>{if(n.multiInstance){const i=t.filter(t=>"page"===t.type&&t.route===e);if(r&&!l&&i.length>0)return o||h(i[i.length-1].id),t;const a=`page:${e}:${Math.random().toString(36).slice(2,8)}`;return c(a),[...t,{id:a,type:"page",label:n.label,route:e,openedFrom:d,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}}]}const i=t.find(t=>"page"===t.type&&t.route===e);if(i)return n.widget?t:(o||h(i.id),l&&i.pageSearch!==l?t.map(e=>e===i?{...e,pageSearch:l}:e):t);const a=`page:${e}`;return c(a),[...t,{id:a,type:"page",label:n.label,route:e,openedFrom:d,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}}]})},[u]),f=O(()=>{},[]),w=O(()=>{},[]),y=u,g=u;/* @__PURE__ */
|
|
40
|
+
return X($e.Provider,{value:{openWindows:o,openEntity:m,openPage:p,closeEntity:y,minimize:f,items:[],openItems:o,restore:w,remove:g,restoreIfMinimized:()=>!1},children:[e,
|
|
41
|
+
/* @__PURE__ */V(st,{openWindows:o,onRemove:u,onSplitView:Lr,onActivate:e=>{document.querySelectorAll("[data-modal-panel]").forEach(t=>{const n=t.querySelector("[data-window-title]");if(n?.textContent?.includes(e)){const e=t.getAttribute("data-modal-id");e&&$n(e)}})},onActivateById:Xe}),
|
|
42
|
+
/* @__PURE__ */V(Tr,{}),!r&&o.map(e=>{const n=e.route?t?.(e.route):void 0;
|
|
43
|
+
/* @__PURE__ */
|
|
44
|
+
return V(de.Provider,{value:c(e),children:/* @__PURE__ */V(ge,{fallback:(t,n)=>/* @__PURE__ */V(zr,{open:!0,onClose:()=>d(e.id),title:e.label,size:"md",autoHeight:!0,windowKey:e.id,children:/* @__PURE__ */V(ye,{error:t,onReload:n})}),children:/* @__PURE__ */V($t,{spec:Fe(e),children:/* @__PURE__ */V(Wr,{windowId:e.id,children:"page"===e.type?/* @__PURE__ */V(qe,{item:e,onClose:()=>d(e.id),accentRgb:n}):/* @__PURE__ */V(He,{item:e,onClose:()=>d(e.id),onMinimize:()=>{},accentRgb:n})})})})},e.id)})]})}var dt=null,ut=/* @__PURE__ */new Set;function ht(){return dt}function mt(e){if(dt!==e){dt=e;for(const e of ut)e()}}function pt(e){return ut.add(e),()=>{ut.delete(e)}}var ft=!1,wt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},yt=()=>{};function gt(e){ft=e,wt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0}}function bt(e,t){ft&&("submenu"===e?wt.submenus++:wt.menus++,wt.menuKey=t)}function vt(e){if(!ft)return yt;const t=performance.now();let n=!1;return()=>{if(n)return;if(n=!0,!ft)return;const r=performance.now()-t;"move"===e?wt.moveMs+=r:wt.resizeMs+=r}}function xt(){const e=wt;return wt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},e}var kt=/* @__PURE__ */new Set(["button","a","input","select","textarea","kbd"]),Et=/* @__PURE__ */new Set(["svg"]);function Ct(e){const t=[],n={text:"",accessories:[]};return Mt(e,n,t),n.text=t.join("").replace(/\s+/g," ").trim(),n}function Mt(e,t,n){if(null==e||"boolean"==typeof e)return;if("string"==typeof e||"number"==typeof e)return void n.push(String(e));if(Array.isArray(e))return void e.forEach(e=>Mt(e,t,n));if(!R(e))return;const r=e;if(r.type!==d)if(r.type!==F){if("string"==typeof r.type){if(Et.has(r.type))return;if(!kt.has(r.type))return n.push(" "),q.toArray(r.props.children).forEach(e=>Mt(e,t,n)),void n.push(" ")}t.accessories.push(j(r,{key:`title-part-${t.accessories.length}`}))}else q.toArray(r.props.children).forEach(e=>Mt(e,t,n));else void 0===t.copy&&"string"==typeof r.props.text&&r.props.text&&(t.copy=r.props.text)}var Nt=/* @__PURE__ */new Map,St=/* @__PURE__ */new Set,Lt=0;function Tt(){Lt++,St.forEach(e=>e())}function zt(e){return Nt.get(e)}function At(e){return St.add(e),()=>{St.delete(e)}}function Dt(){return Lt}var Pt=z(""),It=z(null);function $t({spec:e,children:t}){/* @__PURE__ */
|
|
45
|
+
return V(It.Provider,{value:e,children:t})}var Kt=/* @__PURE__ */new Set(["button","input","textarea","select","kbd","svg"]),Wt='button[type="submit"], button[data-submit], button.btn-submit, button.bg-green-600, button.bg-blue-600',Ot='button, a[href], summary, [role="button"], [role="link"], [role="menuitem"], select';function Rt(e){return Ft(e).replace(/\s+/g," ").trim()}function Ft(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(Ft).join("");if(R(e)){const t=e,n="string"==typeof t.type?t.type:"";return Kt.has(n)?"":` ${Ft(t.props?.children)} `}return""}function qt(e){const t=A(Pt);$(()=>{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 jt={};function Bt(e,t,n){const r=A(Pt);$(()=>{if(!r)return;jt[r]||(jt[r]=[]);const o={label:e,icon:n,onClick:t};return jt[r].push(o),()=>{jt[r]=(jt[r]||[]).filter(e=>e!==o)}},[r,e,t,n])}function Ht({title:e}){const t=I(null);return $(()=>{const n=setTimeout(()=>{const n=t.current?.closest("[data-modal-id]"),r=n?.getAttribute("data-modal-id");r&&window.dispatchEvent(new CustomEvent("window-title-update",{detail:{id:r,title:e}}))},0);return()=>clearTimeout(n)},[e]),/* @__PURE__ */V("span",{ref:t,style:{display:"none"},"aria-hidden":"true"})}function Yt(e){}var Ut=z(null);function Xt(){return A(Pt)}function Vt(){const e=W(sr,ar),t=A(Ut);return t?.active??(pn.length<=1||null!=e)}function _t({children:e,position:t="right",quiet:n=!1}){const r=A(Ut),[o,i]=K(null);return $(()=>{if(!r)return;const e="left"===t?r.leftRef:r.rightRef,o=()=>!!e.current&&(i(e.current),n||r.notify(),!0);if(o())return;const a=setInterval(()=>{o()&&clearInterval(a)},50),s=setTimeout(()=>clearInterval(a),2e3);return()=>{clearInterval(a),clearTimeout(s)}},[r,t,n]),o?J(e,o):null}function Jt({onClick:e,children:t,className:n}){const r=A(Ut);/* @__PURE__ */
|
|
46
|
+
return V("button",{type:"button",onClick:async()=>{if(r?.isDirty){const{confirm:e}=await(import("./ConfirmDialog-AVFQGXKL.js"));if(!await e({title:"Discard changes?",message:"You have unsaved changes. Are you sure you want to cancel? All changes will be lost.",confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"}))return}e()},className:n||"bg-white text-gray-700 border border-gray-300 px-4 py-2 text-sm font-medium rounded-lg hover:bg-gray-50",children:t||"Cancel"})}var Qt="erp_window_positions",Gt={};try{const e=localStorage.getItem(Qt);e&&(Gt=JSON.parse(e))}catch{}var Zt=null;function en(){Zt&&clearTimeout(Zt),Zt=setTimeout(()=>{try{localStorage.setItem(Qt,JSON.stringify(Gt))}catch{}},500)}var tn="erp_activation_order",nn=[];try{const e=localStorage.getItem(tn),t=e?JSON.parse(e):null;Array.isArray(t)&&t.every(e=>"string"==typeof e)&&(nn=t)}catch{}var rn=null;function on(){rn&&clearTimeout(rn),rn=setTimeout(()=>{try{localStorage.setItem(tn,JSON.stringify(nn))}catch{}},500)}function an(e,t){Gt[e]||(Gt[e]=t,en())}function sn(e){return Gt[e]?{...Gt[e]}:null}function ln(e,t){Gt[e]=t,en()}function cn(){const r=e(),o=t();let i=!1;for(const e of Object.keys(Gt))n(Gt[e],r,o)&&(delete Gt[e],i=!0);i&&en()}var dn={sm:384,md:512,lg:672,xl:896,"2xl":1152,"3xl":1408},un=4e3,hn=()=>{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"},mn={small:.8,medium:1,large:1.25,maximized:1.25},pn=[],fn=/* @__PURE__ */new Set,wn=/* @__PURE__ */new Set,yn=0,gn=/* @__PURE__ */new Map;var bn=0;function vn(){return bn}function xn(){bn++,fn.forEach(e=>e())}var kn=/* @__PURE__ */new Map,En=/* @__PURE__ */new Map,Cn=/* @__PURE__ */new Map;function Mn(){for(let e=pn.length-1;e>=0;e--){const t=Cn.get(pn[e]);if(t?.tab)return t.owner}return null}function Nn(){return W(sr,Mn,()=>null)}var Sn=/* @__PURE__ */new Set;var Ln=null;function Tn(e){Ln=null,$n(e)}function zn(e){Ln=e;const t=kn.get(e);t&&Tn(t)}function An(e){Ln===e&&(Ln=null)}function Dn(e,t,n){if(n&&Cn.set(e,n),t)if(kn.set(t,e),En.set(e,t),Sn.delete(t)){pn.unshift(e);const n=nn.indexOf(t);-1!==n&&nn.splice(n,1),nn.unshift(t),on()}else!function(e,t){const n=nn.indexOf(t);if(-1===n)return void pn.push(e);let r=pn.length;for(let e=0;e<pn.length;e++){const t=En.get(pn[e]);if(t&&nn.indexOf(t)>n){r=e;break}}pn.splice(r,0,e)}(e,t),-1===nn.indexOf(t)&&(nn.push(t),on());else pn.push(e);xn(),window.dispatchEvent(new CustomEvent("modal-reorder")),t&&Ln===t&&Tn(e)}function Pn(e){return e?Cn.get(e)?.owner??En.get(e)??null:null}var In=/* @__PURE__ */new Set;function $n(e){const t=Pn(ar()),n=pn.indexOf(e);-1!==n&&pn.splice(n,1),pn.push(e);const o=Cn.get(e);if(o?.root&&o.tab&&r()){const e=pn.filter(e=>{const t=Cn.get(e);return!!t&&!t.root&&t.owner===o.owner});for(const t of e)pn.splice(pn.indexOf(t),1),pn.push(t)}wn.delete(e);const i=En.get(e);if(i){const e=nn.indexOf(i);-1!==e&&nn.splice(e,1),nn.push(i),on(),Ln&&Ln!==i&&(Ln=null)}xn(),window.dispatchEvent(new CustomEvent("modal-reorder"));const a=Pn(ar());a&&a!==t&&In.forEach(e=>e(a))}function Kn(e){const t=pn.indexOf(e);-1!==t&&pn.splice(t,1),wn.add(e),gn.set(e,++yn);const n=En.get(e);if(n){const e=nn.indexOf(n);-1!==e&&(nn.splice(e,1),on())}xn(),window.dispatchEvent(new CustomEvent("modal-reorder"))}var Wn=/* @__PURE__ */new Set;var On=8,Rn=32;function Fn(){return e()}var qn=40,jn=80,Bn=384,Hn=400;function Yn(e,t=Fn()){const n=Math.min(Math.max(e.x,t.x+jn-e.w),t.x+t.w-jn),r=Math.min(Math.max(e.y,t.y),t.y+t.h-qn);return n===e.x&&r===e.y?e:{...e,x:n,y:r}}function Un(e){const t=e.getBoundingClientRect();if(0===t.width||0===t.height)return!0;const n=Fn();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 Xn(e){const t=Fn(),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 Vn=null;function _n(e){const t=(Vn||((Vn=document.createElement("div")).style.cssText=["position: fixed","pointer-events: none",`z-index: ${M.snapPreview}`,"border-radius: 8px","background: rgba(59, 130, 246, 0.18)","border: 2px solid rgb(59, 130, 246)","transition: left 120ms ease, top 120ms ease, width 120ms ease, height 120ms ease, opacity 120ms ease","opacity: 0","display: none"].join(";"),document.body.appendChild(Vn)),Vn);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 Jn(){Vn&&(Vn.style.opacity="0",Vn.style.display="none")}var Qn=[{zone:"left",labelKey:"snapLeft",region:"inset-y-0 left-0 w-1/2"},{zone:"right",labelKey:"snapRight",region:"inset-y-0 right-0 w-1/2"},{zone:"tl",labelKey:"snapTopLeft",region:"top-0 left-0 h-1/2 w-1/2"},{zone:"tr",labelKey:"snapTopRight",region:"top-0 right-0 h-1/2 w-1/2"},{zone:"bl",labelKey:"snapBottomLeft",region:"bottom-0 left-0 h-1/2 w-1/2"},{zone:"br",labelKey:"snapBottomRight",region:"bottom-0 right-0 h-1/2 w-1/2"}],Gn=350,Zn=200;function er({maximized:e,onToggleMax:t,onSnap:n,buttonClassName:r,strings:o}){const[i,a]=K(!1),s=I(void 0),l=I(void 0);$(()=>()=>{clearTimeout(s.current),clearTimeout(l.current)},[]);const c=()=>{clearTimeout(l.current),s.current=setTimeout(()=>a(!0),Gn)},d=()=>{clearTimeout(s.current),l.current=setTimeout(()=>a(!1),Zn)};/* @__PURE__ */
|
|
47
|
+
return X("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:d,children:[
|
|
48
|
+
/* @__PURE__ */V("button",{onClick:t,onFocus:c,onBlur:d,title:e?o.windowed:o.maximize,className:r,children:e?"❐":"⤢"}),i&&/* @__PURE__ */V("div",{role:"group","aria-label":o.snapLayouts,onMouseEnter:()=>clearTimeout(l.current),onMouseLeave:d,className:"absolute right-0 top-full z-30 mt-1 grid w-max grid-cols-2 gap-1 rounded-lg border border-gray-200 bg-white p-2 shadow-lg",children:Qn.map(({zone:e,labelKey:t,region:r})=>/* @__PURE__ */V("button",{type:"button","aria-label":o[t],title:o[t],onClick:()=>{a(!1),n(e)},onFocus:()=>clearTimeout(l.current),onBlur:d,className:"relative h-7 w-11 rounded border border-gray-300 bg-gray-50 hover:border-blue-400 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400",children:/* @__PURE__ */V("span",{"aria-hidden":"true",className:`absolute rounded-sm bg-blue-500/70 ${r}`,style:{margin:2}})},e))})]})}var tr="rosh-gesture-style";var nr={se:"nwse-resize",nw:"nwse-resize",sw:"nesw-resize",ne:"nesw-resize",n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize"},rr=4;function or(e,t,n,r){!function(){if("undefined"==typeof document||document.getElementById(tr))return;const e=document.createElement("style");e.id=tr,e.textContent="body.rosh-gesturing [data-modal-panel]{will-change:transform}",document.head.appendChild(e)}();try{e.setPointerCapture(t)}catch{}document.body.classList.add("rosh-gesturing");const o=document.createElement("div");o.setAttribute("data-drag-shield",""),o.style.cssText=`position:fixed;inset:0;z-index:2147483647;cursor:${n};background:transparent;touch-action:none`,document.body.appendChild(o);const i=vt(r);let a=!1;return()=>{if(!a){a=!0,i();try{e.releasePointerCapture(t)}catch{}o.remove(),document.body.classList.remove("rosh-gesturing")}}}function ir(e){const t=pn.indexOf(e);if(-1===t)return-1;const n=M.window+t*M.windowStep,o=Cn.get(e);if(!o||o.root||!o.tab||!r())return n;let i=-1;for(const[e,t]of Cn){if(!t.root||t.owner!==o.owner)continue;const n=pn.indexOf(e);-1!==n&&(i=Math.max(i,M.window+n*M.windowStep))}return i>=n?i+2+Math.min(t,7):n}function ar(){return pn[pn.length-1]||null}function sr(e){return fn.add(e),()=>{fn.delete(e)}}"undefined"!=typeof window&&window.addEventListener("deactivate-all-modals",function(){for(let e=pn.length-1;e>=0;e--)Wn.has(pn[e])||pn.splice(e,1);nn=nn.filter(e=>{const t=kn.get(e);return null!=t&&Wn.has(t)}),on(),xn(),window.dispatchEvent(new CustomEvent("modal-reorder"))});var lr="modal-close-request";function cr(e){W(sr,vn);const t=A(Ut);if(pn.length<=1)return!0;if(e){const t=kn.get(e);if(null!=t)return ar()===t}return t?.active??null!=ar()}var dr=!1,ur=/* @__PURE__ */new Set;function hr(e){return ur.add(e),()=>ur.delete(e)}function mr(){return dr}function pr(e){dr!==e&&(dr=e,ur.forEach(e=>e()))}function fr(){pr(!dr)}function wr(){pr(!1)}var yr=null,gr=/* @__PURE__ */new Set;function br(e){return gr.add(e),()=>gr.delete(e)}function vr(){return yr}function xr(e){yr!==e&&(yr=e,gr.forEach(e=>e()))}var kr=null,Er=/* @__PURE__ */new Set;function Cr(e){return Er.add(e),()=>Er.delete(e)}function Mr(){return kr}function Nr(e){kr!==e&&(kr=e,Er.forEach(e=>e()))}function Sr(){if(!kr)return void pr(!1);xr(kr),Nr(null),pr(!1)}function Lr(){pr(!dr),window.dispatchEvent(new CustomEvent("modal-split-view"))}function Tr(){const e=W(hr,mr),[t,n]=K(e),[r,o]=K(e);return $(()=>{if(e){n(!0);const e=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(e)}o(!1);const t=setTimeout(()=>n(!1),280);return()=>clearTimeout(t)},[e]),t&&"undefined"!=typeof document?J(
|
|
49
|
+
/* @__PURE__ */V("div",{onMouseDown:e=>{e.stopPropagation(),pr(!1)},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",zIndex:M.expose,cursor:"pointer",opacity:r?1:0,transition:"opacity 260ms cubic-bezier(0.2, 0.8, 0.2, 1)",pointerEvents:r?"auto":"none"}}),document.body):null}function zr({open:t,onClose:i,title:c,icon:d,copyText:u,size:h="lg",dirty:m=!1,onNext:p,onPrev:f,footer:g,bodyScroll:C,onMinimize:S,initialBox:z,actions:D,actionsLeft:F,editing:q=!1,allowPinOnTop:Y,initialPosition:U,widget:Q,compact:G,appStyle:Z,flushBody:ee,autoHeight:te,autoMinHeight:ne,autoWidth:re,widgetMenu:oe,dimensions:ie,windowKey:ae,openedFromKey:se,accentRgb:le,children:ce}){const ue=w(),[he,me]=K(0),[pe,fe]=K(!1),we=I(null),ye=I(0);$(()=>{ye.current=he},[he]);const ve=O(e=>{ue&&(we.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},fe(!0),mt(se??null))},[ue,se]),ke=W(pt,ht);$(()=>{if(!pe)return;const e=e=>{if(!we.current)return;const t=e.clientX-we.current.startX;if(Math.abs(e.clientY-we.current.startY)>Math.abs(t)+12)return we.current=null,fe(!1),me(0),void mt(null);me(Math.max(0,t))},t=()=>{if(!we.current)return;const e=.3*window.innerWidth,t=ye.current>e;we.current=null,fe(!1),t?(me(window.innerWidth),setTimeout(()=>{i(),me(0),mt(null)},180)):(me(0),mt(null))};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t),window.addEventListener("pointercancel",t),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t),window.removeEventListener("pointercancel",t)}},[pe]);const[Ee,Ce]=K(c),Me=L(),Ne=Me.window;$(()=>{Ce(c)},[c]);const Se=B(()=>Rt(Ee).trim()||void 0,[Ee]),Le=H(),[Te,ze]=K(!1),Ae=I(!1),[De,Pe]=K(!1),[Ie,$e]=K(null),Ke=A(It),Oe=A(de),{prefs:Fe,save:qe}=y(),je=!!Fe.window_accent_stripe,Be=Fe.favorite_documents||[],He=!!Ke&&Be.some(e=>e.entityType===Ke.entityType&&e.entityId===Ke.entityId),Ye=O(()=>{if(!Ke)return;const e=He?Be.filter(e=>!(e.entityType===Ke.entityType&&e.entityId===Ke.entityId)):[...Be,{entityType:Ke.entityType,entityId:Ke.entityId,label:Ke.label}];qe({favorite_documents:e})},[Ke,He,Be,qe]),[Ue,Xe]=K(null),[Ve,_e]=K("top-right"===U?"right":"left"),Je=I(!1),Qe=I(null);P(()=>{const e=Qe.current;e&&(le?e.style.setProperty("--window-accent-rgb",le):e.style.removeProperty("--window-accent-rgb"))},[le]);const Ge=I(!1),Ze=I(null),et=I(null),tt=I(null),[nt,rt]=K(!1),ot=I(null),it=!!(g||D||F)||nt,at=A(be),st=""!==A(Pt),lt=I(null);lt.current=Oe?{owner:Oe.key,tab:Oe.tab,root:!st}:null;const ct=ae||(Oe&&!st?Oe.key:null),dt=!!at&&!st&&at.enabled&&at.hasState&&(q||at.declaredEditable)&&!at.handMounted&&it&&!Q&&!G&&!Z&&!ue,ut=/* @__PURE__ */V(T,{name:"window",className:"h-4 w-4",strokeWidth:1.5}),ft=d&&R(d)?j(d,{className:`h-4 w-4 ${d.props?.className??""}`.trim()}):d??ut,wt=()=>/* @__PURE__ */V("button",{onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();$e(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:ft}),yt=40,{minimize:gt,items:bt,restoreIfMinimized:vt,openWindows:xt}=Re(),kt=I(`modal-${Math.random().toString(36).slice(2,8)}`).current;$(()=>{if(Q)return Wn.add(kt),()=>{Wn.delete(kt)}},[Q,kt]),$(()=>{const e=e=>{const t=e.detail;t?.id===kt&&Ce(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[kt]);const[Et,Mt]=K(M.window),St=function(e){const t=W(sr,ar);return pn.length<=1||t===e}(kt),Lt=function(e){return W(sr,()=>wn.has(e))}(kt),zt=W(hr,mr),At=W(br,vr),Dt=W(Cr,Mr),$t=!Y&&!Q,Kt=zt&&$t,[Ft,qt]=K(!1),Bt=Kt&&Dt===kt,[Ht,Yt]=K(!1),Xt=Ht&&$t&&At===kt?"picked":null,Vt=I(Kt);$(()=>{if(Vt.current&&!Kt){Yt(!0);const e=setTimeout(()=>{Yt(!1),yr===kt&&xr(null)},700);return Vt.current=Kt,()=>clearTimeout(e)}Vt.current=Kt},[Kt,kt]),$(()=>{Kt||qt(!1)},[Kt]),$(()=>{const e=et.current,t=tt.current;if(!e&&!t)return;const n=e=>e?Array.from(e.children).filter(e=>"shell"!==e.dataset.undoControls).length:0,r=()=>rt(n(e)+n(t)>0);r();const o=new MutationObserver(r);return e&&o.observe(e,{childList:!0}),t&&o.observe(t,{childList:!0}),()=>o.disconnect()},[t]),$(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&Qe.current){const t=Qe.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=et.current,n=tt.current;return t&&t.addEventListener("click",e),n&&n.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e),n&&n.removeEventListener("click",e)}},[t]);const _t=I(!1),Jt=O(e,[]),Qt=O(()=>{const t=e(),n=ie?ie[0]:dn[h]||672,o=t.w-80,i=t.h-80,a=Math.min(n,o),s=mn[hn()],l=ie?Math.min(ie[1],i):(()=>{const e=("sm"===h?500:"md"===h?600:"lg"===h?700:"xl"===h?800:920)*s;return Math.max(320,Math.min(e,t.h-80))})(),c="cascade"!==(getComputedStyle(document.documentElement).getPropertyValue("--window-position")?.trim()||"cascade")||r()?0:30*(pn.length-1),d=Math.max(yt,(i-l)/2),u=(o-a)/2,m=t.h-yt-l-d;return"top-right"===U?{x:t.x+t.w-a-yt,y:t.y+yt,w:a,h:l}:"top-left"===U?{x:t.x+yt,y:t.y+yt,w:a,h:l}:{x:t.x+Math.max(yt,(o-a)/2+yt)+Math.min(c,Math.max(0,u)),y:t.y+d+Math.min(c,Math.max(0,m)),w:a,h:l}},[h]),Zt=I(!1);t||(Zt.current=!1);const tn=ae||u||null;$(()=>{if(!t)return;Dn(kt,tn,lt.current??void 0),ae||$n(kt),_t.current=!1,Mt(ir(kt));const e=()=>{Mt(ir(kt))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===ae;if(!e.label)return!1;const t=Qe.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if($n(kt),Mn.current)return;const t=Fn(),n=Math.min(An.current.w,t.w-40),o=Math.min(An.current.h,t.h-40),i=t.x+(t.w-n)/2,a=t.y+(t.h-o)/2;on({x:i,y:a,w:n,h:o}),zn(!1)},i=e=>{const t=e.detail;r(t)&&($n(kt),$e({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==ae)return;$n(kt);const t=An.current,n=function(e,t=Fn()){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=Qe.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)}on(n)};return window.addEventListener("modal-reorder",e),window.addEventListener("modal-split-view",n),window.addEventListener("modal-center",o),window.addEventListener("modal-reveal",a),window.addEventListener("modal-context-menu",i),()=>{!function(e){const t=pn.indexOf(e);-1!==t&&(pn.splice(t,1),xn()),wn.delete(e),gn.delete(e),Cn.delete(e);const n=En.get(e);n&&(En.delete(e),kn.delete(n))}(kt),window.removeEventListener("modal-reorder",e),window.removeEventListener("modal-split-view",n),window.removeEventListener("modal-center",o),window.removeEventListener("modal-reveal",a),window.removeEventListener("modal-context-menu",i),window.dispatchEvent(new CustomEvent("modal-reorder"))}},[t,kt,tn,Jt]);const nn=!Q&&"maximized"===hn(),[rn,on]=K(()=>{if(tn&&Gt[tn]){const e={...Gt[tn]};return ie&&(e.w=ie[0],te||(e.h=ie[1])),Yn(e)}return z?{x:z.x,y:z.y,w:z.w,h:z.h}:nn?Jt():Qt()}),[an,sn]=K(()=>!te),[ln,cn]=K(()=>r()),fn=I(ln),yn=I(null);$(()=>{const e=()=>{const e=r();e!==fn.current&&yn.current?.(e),fn.current=e,cn(e),Mt(ir(kt))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[kt]);const bn=ln&&!!Oe?.tab&&!st&&!Q&&!ue,vn=bn,Mn=I(vn);Mn.current=vn;const Sn=Nn(),Ln=ln&&!!Oe?.tab&&!Q&&!ue&&!zt&&Sn!==Oe.key,[Tn,zn]=K(()=>tn&&Gt[tn]||z?vn:vn||nn),An=I(rn);An.current=rn;const Pn=I(Tn);P(()=>{Pn.current=Tn},[Tn]),P(()=>{if(an||bn)return;const e=Qe.current,t=Ze.current;if(!e||!t)return;const n=ne??(Q?0:240),r=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0;let o=0,i=null,a=null;const s=()=>{const c=t.firstElementChild;if(!c||e.offsetHeight<=0)return;c!==a&&(a&&l.unobserve(a),l.observe(c),a=c);const d=e.offsetHeight-t.offsetHeight,u=t.style.flex,h=t.style.overflowY,m=t.style.height;t.style.flex="0 0 auto",t.style.height="auto",t.style.overflowY="visible";const p=t.offsetHeight,f=c.offsetHeight;t.style.flex=u,t.style.height=m,t.style.overflowY=h;const w=c.offsetHeight>f+4,y=Math.max(n,window.innerHeight-r-Math.max(0,An.current.y)-24),g=w?Math.min(An.current.h,y):Math.min(Math.max(n,d+p),y),b=Math.abs(g-o)>1;b&&(o=g,on(e=>Math.abs(e.h-g)>1?{...e,h:g}:e)),Q||(g<=n?i&&(clearTimeout(i),i=null):(b||null===i)&&(i&&clearTimeout(i),i=setTimeout(()=>{const e=o;s(),o===e&&sn(!0)},160)))},l=new ResizeObserver(s);s(),ot.current&&l.observe(ot.current);const c=new MutationObserver(s);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{l.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[an,Q,ne,it,bn]),P(()=>{if(!te||!an||Q||!t)return;const e=ot.current;if(!e)return;let n=e.offsetHeight;const r=new ResizeObserver(()=>{if(!e.isConnected)return;const t=e.offsetHeight,r=t-n,o=t>0!=n>0;if(n=t,!o||0===r||Tn)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=ne??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,s=Math.max(i,window.innerHeight-a-Math.max(0,An.current.y)-24);on(e=>({...e,h:Math.min(Math.max(i,e.h+r),s)}))});return r.observe(e),()=>r.disconnect()},[te,an,Q,t,Tn,ne]);const In=!1!==re&&!Q&&!Z&&!ue,[qn,jn]=K(()=>!In);P(()=>{if(qn||!t)return;if(!In||Tn)return void jn(!0);const n=Qe.current,r=Ze.current;if(!n||!r)return;const o=/* @__PURE__ */new WeakSet;let i=An.current.w,c=0;const d=()=>jn(!0),u=()=>{c=0;const t=An.current;if(Math.abs(t.w-i)>1||document.body.classList.contains("rosh-gesturing"))return void d();const u=e(),h=u.w-80;if(t.w>=h)return void d();const m=[],p=[];for(const e of[r,...Array.from(r.querySelectorAll("*"))]){const t=e.scrollWidth-e.clientWidth;if(t<=4||o.has(e))continue;const n=getComputedStyle(e).overflowX;"auto"!==n&&"scroll"!==n||(m.push(e),p.push(t))}if(!m.length)return;const f=Math.min(h,t.w+Math.max(...p)),w=f-t.w,y=n.style.width;n.style.width=`${f}px`;const g=m.map((e,t)=>({over:p[t],residual:e.scrollWidth-e.clientWidth}));n.style.width=y,g.forEach((e,t)=>{a(e,w)||o.add(m[t])});const b=s(t,l(t.w,w,g),u,yt);b!==t&&(i=b.w,on(b))};u();const h=new MutationObserver(()=>{c||(c=requestAnimationFrame(u))});h.observe(r,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["style","class","hidden"]});const m=setTimeout(d,un);return()=>{h.disconnect(),c&&cancelAnimationFrame(c),clearTimeout(m)}},[qn,t,In,Tn]);const Un=I(null),Vn=!(!Oe?.tab||st||Q||ue);yn.current=t=>{if(!Vn)return;if(t)return Un.current||(Un.current={box:{...An.current},maximized:Pn.current}),void(Pn.current=!0);const r=Un.current;Un.current=null;const o=e();if(r?.maximized)return Pn.current=!0,zn(!0),void on(o);const i=r?.box??(tn?Gt[tn]:void 0);if(Pn.current=!1,zn(!1),i&&!n(i,o,!1)){const e={...i};ie&&(e.w=ie[0],te||(e.h=ie[1])),on(Yn(e))}else on(Qt())},$(()=>{vn&&(Pn.current=!0,zn(!0),on(Jt()))},[vn,Jt]),$(()=>{if(Q)return;const e=()=>{const e=tn?Gt[tn]:void 0;if(Pn.current=!1,zn(!1),e){const t={...e};ie&&(t.w=ie[0],te||(t.h=ie[1])),on(Yn(t))}else on(Qt())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[Q,Qt,tn]),$(()=>{t&&tn&&!bn&&(Gt[tn]=rn,en()),t&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[rn,t,tn,bn]),$(()=>{if(!t)return;const e=()=>{Pn.current?on(Jt()):document.body.classList.contains("rosh-gesturing")||on(Yn)};window.addEventListener("resize",e),window.addEventListener(o,e);let n=null;return Tn&&(n=new MutationObserver(e),n.observe(document.body,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["class"]})),()=>{window.removeEventListener("resize",e),window.removeEventListener(o,e),n?.disconnect()}},[t,Tn,Jt]),$(()=>{if(t&&(ze(!1),Ae.current=!1,Je.current=!1,jn(!In),!Mn.current)){if(tn&&Gt[tn]){const e=Gt[tn];return void on(t=>Yn({...e,...te?{h:t.h}:{},...In?{x:t.x,w:t.w}:{}}))}z&&(on({x:z.x,y:z.y,w:z.w,h:z.h}),zn(z.maximized))}},[t]),$(()=>{if(!t||"auto"!==m)return;let e;const n=t=>{Qe.current?.contains(t.target)&&!Ae.current&&(Ae.current=!0,e=setTimeout(()=>ze(!0),0))};return document.addEventListener("input",n,!0),document.addEventListener("change",n,!0),()=>{clearTimeout(e),document.removeEventListener("input",n,!0),document.removeEventListener("change",n,!0)}},[t,m]);const Qn="auto"===m?Te:!0===m,Gn=Oe&&!st?Oe.key:null,Zn=B(()=>Ct(Ee),[Ee]),tr=I({shortcutSpec:Ke,isOnDesktop:He,toggleDesktopShortcut:Ye,taskbarStrings:Me.taskbar});P(()=>{tr.current={shortcutSpec:Ke,isOnDesktop:He,toggleDesktopShortcut:Ye,taskbarStrings:Me.taskbar}});const cr=I(null);cr.current||(cr.current={open:(e,t)=>$e({x:e,y:t}),items:()=>{const e=tr.current,t=[];e.shortcutSpec&&t.push({label:e.isOnDesktop?e.taskbarStrings.removeFromDesktop:e.taskbarStrings.addToDesktop,onSelect:e.toggleDesktopShortcut});for(const e of jt[kt]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),$(()=>{t&&Gn&&function(e,t){const n=Nt.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.menu===t.menu||(Nt.set(e,t),Tt())}(Gn,{title:Zn.text||Se,dirty:Qn,copy:Zn.copy,menu:cr.current??void 0})},[t,Gn,Se,Qn,Zn.text,Zn.copy]),$(()=>{if(t&&Gn)return()=>{return e=Gn,void(Nt.delete(e)&&Tt());var e}},[t,Gn]),We(!(ae||!t)&&Qn);const dr=O(async()=>{if(!Je.current){if(Qn||"auto"===m&&Ae.current){Je.current=!0;const e=Se,t=await b({title:"Discard changes?",message:e?`“${e}” has unsaved changes. Are you sure you want to close? All changes will be lost.`:"You have unsaved changes. Are you sure you want to close? All changes will be lost.",confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"});if(Je.current=!1,!t)return}i()}},[Qn,m,i,Se]);P(()=>{if(!t||!ct)return;const e=e=>{e.detail?.windowKey===ct&&dr()};return window.addEventListener(lr,e),()=>window.removeEventListener(lr,e)},[t,ct,dr]);const ur=I(null),fr=O(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if($e(null),$n(kt),Mn.current)return void e.preventDefault();e.preventDefault();const t=e.currentTarget,n=e.pointerId;let r=null;const o=e.clientX,i=e.clientY,a=Qe.current,s=a?.getBoundingClientRect();let l,c,d,u;if(ur.current){const t=ur.current;ur.current=null,u=t.w,d=t.h;const n=s?Math.min(Math.max(20,e.clientX-s.left),t.w-20):t.w/2;l=e.clientX-n,c=e.clientY-12,a&&(a.style.width=`${u}px`,a.style.height=`${d}px`,a.style.left=`${l}px`,a.style.top=`${c}px`)}else l=s?s.left:An.current.x,c=s?s.top:An.current.y,d=s?s.height:An.current.h,u=s?s.width:An.current.w;zn(!1),on(e=>({...e,x:l,y:c,w:u,h:d}));let h=null;const m=e=>{if(!r){if(Math.abs(e.clientX-o)<rr&&Math.abs(e.clientY-i)<rr)return;r=or(t,n,"move","move"),a&&(a.style.transition="none")}const s=l+e.clientX-o,d=Math.max(0,c+e.clientY-i);if(a&&(a.style.transform=`translate(${s-l}px, ${d-c}px)`),An.current={...An.current,x:s,y:d},!Q){const t=function(e,t){const n=Fn(),r=e<=n.x+On,o=e>=n.x+n.w-On,i=t<=n.y+On,a=t>=n.y+n.h-On,s=e<=n.x+Rn,l=e>=n.x+n.w-Rn,c=t<=n.y+Rn,d=t>=n.y+n.h-Rn;return i&&s?"tl":i&&l?"tr":a&&s?"bl":a&&l?"br":c&&r?"tl":c&&o?"tr":d&&r?"bl":d&&o?"br":i?"top":r?"left":o?"right":null}(e.clientX,e.clientY);t!==h&&(h=t,t?_n(Xn(t)):Jn())}},p=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",p),r?.(),Jn();const e=Yn({...An.current});if(An.current=e,!Q&&h){ur.current={x:l,y:c,w:u,h:d};const e=Xn(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 on(e)}if(Q){const t=e.x+e.w/2,n=window.innerWidth/2;_e(t>n?"right":"left")}a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.transform="",a.style.transition=""),on(e)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",p)},[]),wr=O((e,t)=>{if(0!==e.button)return;e.preventDefault(),e.stopPropagation();const n=e.currentTarget,r=e.pointerId;let o=null;const i=e.clientX,a=e.clientY,s=Qe.current,l=s?.getBoundingClientRect(),c=l?l.left:An.current.x,d=l?l.top:An.current.y,u=l?l.width:An.current.w,h=l?l.height:An.current.h,m="sw"===t||"nw"===t||"w"===t,p="ne"===t||"nw"===t||"n"===t,f="se"===t||"ne"===t||"e"===t,w="se"===t||"sw"===t||"s"===t;zn(!1),on({x:c,y:d,w:u,h:h}),An.current={x:c,y:d,w:u,h:h};let y=0,g=null;const b=()=>{if(y=0,!g)return;const e=g;g=null,An.current=e,s&&(s.style.left=`${e.x}px`,s.style.top=`${e.y}px`,s.style.width=`${e.w}px`,s.style.height=`${e.h}px`)},v=e=>{if(!o){if(Math.abs(e.clientX-i)<rr&&Math.abs(e.clientY-a)<rr)return;o=or(n,r,nr[t],"resize")}g=((e,t)=>{let n=c,r=d,o=u,i=h;if(f&&(o=Math.max(Bn,u+e)),w&&(i=Math.max(Hn,h+t)),m){const t=Math.max(Bn,u-e);n=c+u-t,o=t}if(p){const e=Math.max(Hn,h-t);r=d+h-e,i=e}return{x:n,y:r,w:o,h:i}})(e.clientX-i,e.clientY-a),y||(y=requestAnimationFrame(b))},x=()=>{window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",x),y&&cancelAnimationFrame(y),b(),o?.(),on({...An.current})};window.addEventListener("pointermove",v),window.addEventListener("pointerup",x)},[]),gr=O(e=>{if(e.target.closest("button, input, a, kbd, select, textarea"))return;const t={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[e.key];if(!t&&"Enter"!==e.key)return;if(e.preventDefault(),e.stopPropagation(),$n(kt),"Enter"===e.key)return void(Tn?(zn(!1),on(Qt())):(zn(!0),on(Jt())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{ur.current||(ur.current={...An.current})};if(r<0)return e(),zn(!0),void on(Jt());if(r>0){if(Tn)return zn(!1),void on(Qt());if(ur.current){const e=Yn(ur.current);return ur.current=null,An.current=e,void on(e)}return void Kn(kt)}e(),zn(!1);const t=Xn(n<0?"left":"right");return An.current=t,void on(t)}if(Tn)return;const o=An.current,i=e.shiftKey?{...o,w:Math.max(Bn,o.w+24*n),h:Math.max(Hn,o.h+24*r)}:Yn({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});An.current=i,on(i)},[kt,Tn,Qt,Jt]),kr=O(e=>{ur.current||(ur.current={...An.current}),zn(!1);const t=Xn(e);An.current=t,on(t),$n(kt)},[kt]),Er=vn||Kt?{}:{tabIndex:0,role:"group","aria-label":Se?`${Se} — ${Ne.windowSuffix}`:Ne.windowSuffix,"aria-keyshortcuts":"ArrowUp ArrowDown ArrowLeft ArrowRight Shift+ArrowUp Shift+ArrowDown Shift+ArrowLeft Shift+ArrowRight Control+ArrowUp Control+ArrowDown Control+ArrowLeft Control+ArrowRight Enter",onKeyDown:gr},Nr=()=>{zn(!0),on(Jt())},Sr=O(()=>{const e=Qe.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(Wt);t&&!t.disabled&&t.click()}},[]);$(()=>{if(!t)return;if(Q)return;const e=e=>{if(pn[pn.length-1]===kt&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),Sr();else{if("INPUT"===t.tagName&&t.closest("form"))return;if(!(t instanceof Element&&Qe.current?.contains(t)))return;if(t.closest(Ot))return;e.preventDefault()}}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Sr,kt,Q]),$(()=>{if(!t)return;const e=e=>{pn[pn.length-1]===kt&&((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:kt}})),Ae.current=!1,ze(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:kt}}))))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]),$(()=>{if(!t)return;if(Q)return;const e=e=>{if("Escape"===e.key&&pn[pn.length-1]===kt){if(N(e))return e.preventDefault(),void e.stopPropagation();if(bn&&!q)return;e.preventDefault(),e.stopPropagation(),dr()}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,dr,kt,Q,bn,q]);const Lr=t&&(void 0!==p||void 0!==f),Tr=O(e=>{const t=document.getElementById("nav-boundary-toast");t&&t.remove();const n="bottom"===e?["That's the last one, chief.","You've hit rock bottom... of the list.","End of the line, buddy.","Nothing left. Go outside.","Congratulations, you scrolled to the void.","There's no more. I checked.","You've reached the edge of the known universe.","Plot twist: there is no next one.","Even scrolling has limits. Unlike your ambition.","Last one. Time to touch grass."]:["Already at the top. Overachiever.","There is no item above this. Trust me.","You're #1. Literally.","Can't go higher. You've peaked.","This is it. The summit. The top.","First item. No VIP lounge above this.","Going up? Nope. Elevator's broken.","You want negative indexes? Bold.","Top of the list. Top of the world.","The only way is down from here."],r=n[Math.floor(Math.random()*n.length)],o=document.createElement("div");o.id="nav-boundary-toast",o.className="fixed bottom-6 left-1/2 -translate-x-1/2 z-(--z-toast) bg-gray-900 text-white flex min-h-10 items-center px-5 py-3 rounded-lg shadow-lg text-sm font-medium transition-opacity duration-300",o.textContent=r,document.body.appendChild(o),setTimeout(()=>{o.style.opacity="0",setTimeout(()=>o.remove(),300)},2e3)},[]);if($(()=>{if(!t)return;const e=e=>{if(pn[pn.length-1]!==kt)return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&Lr&&(e.preventDefault(),p?p():Tr("bottom")),"k"===e.key&&Lr&&(e.preventDefault(),f?f():Tr("top"))))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,p,f,Lr,Tr,kt]),!t||Zt.current)return null;const zr=Kt?function(e){if("undefined"==typeof document)return null;const t=Array.from(document.querySelectorAll("[data-modal-panel]")).filter(e=>{const t=e;return!t.hasAttribute("data-utility")&&!t.hasAttribute("data-widget")&&"none"!==t.style.display});t.sort((e,t)=>(e.getAttribute("data-modal-id")||"").localeCompare(t.getAttribute("data-modal-id")||""));const n=t.findIndex(t=>t.getAttribute("data-modal-id")===e),r=t.length;if(n<0||r<1)return null;const o=Math.ceil(Math.sqrt(r)),i=Math.ceil(r/o),a=Math.floor(n/o),s=n%o,l=r-o*(i-1),c=a===i-1&&l<o,d=Fn(),u=(d.w-20*(o+1))/o,h=(d.h-14*(i+1)-22*i)/i,m=c?(o-l)*(u+20)/2:0;return{x:d.x+20+s*(u+20)+m,y:d.y+14+a*(h+14+22),w:u,h:h}}(kt):null,Ar=Kt&&zr?Math.min(zr.w/rn.w,zr.h/rn.h):1,Dr=(()=>{if(Kt&&zr){const e=Ar,t=rn.w*e,n=rn.h*e,r=zr.x+(zr.w-t)/2-rn.x,o=zr.y+(zr.h-n)/2-rn.y,i=Ft||Bt;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:M.expose+(i?20:10),boxShadow:i?"0 24px 72px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.55), 0 0 36px 12px rgba(96,165,250,0.85), 0 0 96px 28px rgba(96,165,250,0.55)":"0 16px 48px rgba(0,0,0,0.55)",pointerEvents:"auto"}}if(Ht&&$t){const e="picked"===Xt;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:M.expose+30}:{}}}return null})(),Pr=v({modal:!1,titleId:!Q&&(bn?!Oe?.home:!ue)?Le:void 0,label:Zn.text||Se}),Ir=/* @__PURE__ */X("div",{children:[
|
|
50
|
+
/* @__PURE__ */X("div",{ref:Qe,"data-modal-panel":!0,"data-modal-id":kt,"data-window-key":ae||void 0,...Y?{"data-utility":""}:{},...De?{"data-pinned-top":""}:{},...Q?{"data-widget":""}:{},...Oe?{"data-window-owner":Oe.key}:{},...Oe&&!st?{"data-window-root":""}:{},...bn?{"data-window-tab":""}:{},...Pr,className:bn?"fixed flex flex-col overflow-hidden":"fixed rounded-(--radius-window) flex flex-col overflow-hidden "+(Q?St?"shadow-xl":"shadow-lg":"border "+(St?"shadow-xl border-gray-200":"shadow-lg border-gray-300")),onMouseDownCapture:e=>{if(Ge.current=!1,Kt){if(e.target.closest("[data-expose-close]"))return;return e.preventDefault(),e.stopPropagation(),xr(kt),pr(!1),void $n(kt)}if(!St&&!Q&&!De&&0===e.button){const t=e.target;t.closest("[data-modal-panel]")===Qe.current&&t.closest("button, input, a, select, textarea")&&!t.closest("[data-window-chrome]")&&(e.preventDefault(),e.stopPropagation(),Ge.current=!0,$e(null),$n(kt),window.addEventListener("mouseup",()=>{setTimeout(()=>{Ge.current=!1},0)},{once:!0}))}},onClickCapture:e=>{Ge.current&&(Ge.current=!1,e.preventDefault(),e.stopPropagation())},onMouseDown:e=>{if(Kt)return;$e(null);e.target.closest("[data-modal-panel]")===Qe.current&&(e.target.closest("button, input, a, select, textarea")||$n(kt))},style:ue?{zIndex:Et+1,top:0,left:0,right:0,bottom:"var(--mobile-bottom-nav, 56px)",width:"auto",height:"auto",transform:`translateX(${he}px)`,transition:pe?"none":"transform 180ms ease-out",...Q?{display:"none"}:{},...Et<0?{display:"none"}:{},...St||De||ke&&ae===ke?{}:{display:"none"}}:{zIndex:De?M.pinnedWindow:Et+1,width:rn.w,height:rn.h,top:rn.y,...Q&&"right"===Ve?{right:window.innerWidth-rn.x-rn.w}:{left:rn.x},...Et<0&&!De?{display:"none"}:{},...Ln?{visibility:"hidden",pointerEvents:"none"}:{},...Dr??{}},children:[ue&&!Q&&/* @__PURE__ */V("div",{onPointerDown:ve,className:"absolute top-0 bottom-0 left-0 w-[22px] z-[5]",style:{touchAction:"pan-y"},"aria-hidden":"true"}),Q?null:bn?Oe?.home?null:/* @__PURE__ */X(_,{children:[
|
|
51
|
+
/* @__PURE__ */V("h2",{id:Le,"data-window-title":!0,className:"sr-only",children:Zn.text||Se}),(Zn.accessories.length>0||Lr)&&/* @__PURE__ */X("div",{"data-window-chrome":"","data-record-bar":"",className:"flex h-9 shrink-0 select-none items-center gap-3 border-b border-gray-200 px-4",style:{backgroundColor:"rgb(var(--window-content-rgb))"},children:[
|
|
52
|
+
/* @__PURE__ */V("div",{className:"flex min-w-0 flex-1 items-center gap-2 overflow-hidden",children:Zn.accessories}),Lr&&/* @__PURE__ */X("span",{className:"flex items-center gap-1 shrink-0 text-2xs text-gray-400",children:[
|
|
53
|
+
/* @__PURE__ */V("kbd",{className:"rounded border border-gray-300 bg-gray-100 px-2 py-0.5 font-medium text-gray-500",children:"K"}),
|
|
54
|
+
/* @__PURE__ */V("span",{children:Ne.prev}),
|
|
55
|
+
/* @__PURE__ */V("kbd",{className:"rounded border border-gray-300 bg-gray-100 px-2 py-0.5 font-medium ml-1 text-gray-500",children:"J"}),
|
|
56
|
+
/* @__PURE__ */V("span",{children:Ne.next})]})]})]}):ue?null:
|
|
57
|
+
/* @__PURE__ */X("div",G?{onPointerDown:fr,"data-window-chrome":"",...Er,className:"flex items-center justify-between h-(--row-height-compact-bar) px-3 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(St?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:St?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
58
|
+
/* @__PURE__ */X("div",{"data-window-title":!0,title:Se,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:St?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Kt&&wt(),
|
|
59
|
+
/* @__PURE__ */V("span",{id:Le,className:"truncate",children:Kt?Rt(Ee):Ee})]}),!Kt&&/* @__PURE__ */X("div",{className:"flex items-center gap-1 shrink-0 ml-2",children:[Y&&/* @__PURE__ */V("button",{onClick:()=>Pe(e=>!e),title:De?Ne.unpin:Ne.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+(De?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */V(T,{name:"bookmark-square",className:"h-3 w-3",fill:De?"currentColor":"none",strokeWidth:1.5})}),
|
|
60
|
+
/* @__PURE__ */V("button",{type:"button",onClick:dr,className:"rounded p-0.5 text-gray-400 hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */V(T,{name:"close",className:"h-4 w-4"})})]})]}:Z?{onPointerDown:fr,"data-window-chrome":"",...Er,className:"flex items-center justify-between h-(--row-height-compact-bar) px-3 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(St?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:St?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
61
|
+
/* @__PURE__ */X("div",{"data-window-title":!0,title:Se,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:St?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Kt&&wt(),
|
|
62
|
+
/* @__PURE__ */V("span",{id:Le,className:"truncate",children:Kt?Rt(Ee):Ee})]}),!Kt&&/* @__PURE__ */X("div",{className:"flex items-center gap-0.5 shrink-0 ml-2",children:[Y&&/* @__PURE__ */V("button",{onClick:()=>Pe(e=>!e),title:De?Ne.unpin:Ne.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+(De?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */V(T,{name:"bookmark-square",className:"h-3 w-3",fill:De?"currentColor":"none",strokeWidth:1.5})}),
|
|
63
|
+
/* @__PURE__ */V("button",{onClick:()=>Kn(kt),title:Ne.minimize,className:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",children:"─"}),!vn&&/* @__PURE__ */V(er,{maximized:Tn,onToggleMax:()=>{Tn?(zn(!1),on(Qt())):Nr()},onSnap:kr,buttonClassName:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",strings:Ne}),
|
|
64
|
+
/* @__PURE__ */V("button",{type:"button",onClick:dr,className:"rounded p-0.5 text-gray-400 hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */V(T,{name:"close",className:"h-4 w-4"})})]})]}:{onPointerDown:fr,"data-window-chrome":"",...Er,className:"flex items-center justify-between h-(--row-height-window-bar) px-4 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(St?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:St?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
65
|
+
/* @__PURE__ */X("div",{"data-window-title":!0,title:Se,className:"text-base font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:St?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!Kt&&wt(),
|
|
66
|
+
/* @__PURE__ */V("span",{id:Le,className:"truncate",children:Kt?Rt(Ee):Ee})]}),!Kt&&/* @__PURE__ */X("div",{className:"flex items-center gap-2 shrink-0 ml-4",children:[Lr&&/* @__PURE__ */X("span",{className:"flex items-center gap-1 mr-1 text-2xs text-gray-400",children:[
|
|
67
|
+
/* @__PURE__ */V("kbd",{className:"rounded border border-gray-300 bg-gray-200 px-2 py-0.5 font-medium text-gray-500",children:"K"}),
|
|
68
|
+
/* @__PURE__ */V("span",{children:Ne.prev}),
|
|
69
|
+
/* @__PURE__ */V("kbd",{className:"rounded border border-gray-300 bg-gray-200 px-2 py-0.5 font-medium ml-1 text-gray-500",children:"J"}),
|
|
70
|
+
/* @__PURE__ */V("span",{children:Ne.next})]}),Y&&/* @__PURE__ */V("button",{onClick:()=>Pe(e=>!e),title:De?Ne.unpin:Ne.pinOnTop,className:"text-xs px-2 py-1 rounded hover:bg-gray-200 "+(De?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */V(T,{name:"bookmark-square",className:"h-3.5 w-3.5",fill:De?"currentColor":"none",strokeWidth:1.5})}),
|
|
71
|
+
/* @__PURE__ */V("button",{onClick:()=>Kn(kt),title:Ne.minimize,className:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",children:"─"}),!vn&&/* @__PURE__ */V(er,{maximized:Tn,onToggleMax:()=>{Tn?(zn(!1),on(Qt())):Nr()},onSnap:kr,buttonClassName:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",strings:Ne}),
|
|
72
|
+
/* @__PURE__ */V("kbd",{className:"rounded border border-gray-300 bg-gray-200 px-2 py-0.5 text-2xs font-medium text-gray-400",children:"ESC"}),
|
|
73
|
+
/* @__PURE__ */V("button",{type:"button",onClick:dr,className:"rounded-(--radius-control) text-gray-400 hover:text-gray-600",children:/* @__PURE__ */V(T,{name:"close",className:"h-5 w-5"})})]})]}),le&&je&&!Q&&!ue&&/* @__PURE__ */V("div",{"aria-hidden":"true",className:"h-[3px] shrink-0 pointer-events-none",style:{backgroundColor:`rgb(var(--window-accent-rgb) / ${St?.9:.55})`}}),
|
|
74
|
+
/* @__PURE__ */V(Pt.Provider,{value:kt,children:/* @__PURE__ */V(Ut.Provider,{value:{rightRef:et,leftRef:tt,notify:()=>rt(!0),active:St,isDirty:Qn,footerOpen:it&&!Q&&!G&&!Z&&!ue},children:/* @__PURE__ */V("div",{ref:Ze,...Q?{onPointerDown:fr,onContextMenu:e=>{e.preventDefault(),Xe({x:e.clientX,y:e.clientY})}}:{},className:`flex-1 min-h-0 flex flex-col ${Q?"p-0 cursor-move":Z||ee?"p-0":G?"p-2":"p-4"} ${Q||bn?"":"backdrop-blur-sm"} ${!1===C||Z||ee?"overflow-hidden":"overflow-y-auto overscroll-contain"} ${Q?"rounded-2xl select-none":""}`,style:{...Q?{touchAction:"none"}:{},backgroundColor:Q?"transparent":bn?"rgb(var(--window-content-rgb))":St?"rgb(var(--window-content-rgb) / var(--active-content-opacity, 0.9))":"rgb(var(--window-content-rgb) / var(--inactive-content-opacity, 0.8))"},children:/* @__PURE__ */V(ge,{children:ce})})})}),Q&&Ue&&/* @__PURE__ */X(x,{minWidth:160,style:{left:Ue.x,top:Ue.y},onClose:()=>Xe(null),children:[
|
|
75
|
+
/* @__PURE__ */V(k,{onClick:()=>{Xe(null),window.dispatchEvent(new CustomEvent("widget-open-settings",{detail:kt}))},children:"Settings"}),
|
|
76
|
+
/* @__PURE__ */V(E,{}),oe&&/* @__PURE__ */X(_,{children:[oe,
|
|
77
|
+
/* @__PURE__ */V(E,{})]}),
|
|
78
|
+
/* @__PURE__ */X(k,{onClick:()=>{Xe(null),Pe(e=>!e)},children:[
|
|
79
|
+
/* @__PURE__ */V("span",{className:"flex-1",children:"Always on Top"}),De&&/* @__PURE__ */V(T,{name:"check",className:"h-4 w-4 text-blue-600 shrink-0",strokeWidth:2})]}),
|
|
80
|
+
/* @__PURE__ */V(E,{}),
|
|
81
|
+
/* @__PURE__ */V(k,{onClick:()=>{Xe(null),dr()},children:"Close"})]}),
|
|
82
|
+
/* @__PURE__ */X("div",{onPointerDown:fr,ref:ot,className:`px-4 py-2 border-t border-gray-200 shrink-0 flex items-center justify-between text-xs select-none${bn?"":" cursor-move"}${St&&!bn?" backdrop-blur-sm":""}${Q||G||Z||ue||!it?" hidden":""}`,style:{touchAction:"none",backgroundColor:bn?"rgb(var(--window-footer-rgb))":St?"rgb(var(--window-footer-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-footer-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
83
|
+
/* @__PURE__ */X("div",{className:"flex items-center gap-2 min-w-0",children:[dt&&/* @__PURE__ */V(xe,{auto:!0}),F,
|
|
84
|
+
/* @__PURE__ */V("div",{ref:tt,"data-modal-actions-left":!0,className:"flex items-center gap-2"}),g]}),
|
|
85
|
+
/* @__PURE__ */X("div",{className:"flex items-center gap-2 ml-auto",children:[
|
|
86
|
+
/* @__PURE__ */V("div",{ref:et,"data-modal-actions":!0,className:"flex items-center gap-2"}),D]})]}),!Q&&!ue&&!Kt&&St&&!vn&&/* @__PURE__ */X(_,{children:[
|
|
87
|
+
/* @__PURE__ */V("div",{onPointerDown:e=>wr(e,"se"),className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize z-10"}),
|
|
88
|
+
/* @__PURE__ */V("div",{onPointerDown:e=>wr(e,"sw"),className:"absolute bottom-0 left-0 w-3 h-3 cursor-nesw-resize z-10"}),
|
|
89
|
+
/* @__PURE__ */V("div",{onPointerDown:e=>wr(e,"ne"),className:"absolute top-0 right-0 w-3 h-3 cursor-nesw-resize z-10"}),
|
|
90
|
+
/* @__PURE__ */V("div",{onPointerDown:e=>wr(e,"nw"),className:"absolute top-0 left-0 w-3 h-3 cursor-nwse-resize z-10"}),
|
|
91
|
+
/* @__PURE__ */V("div",{onPointerDown:e=>wr(e,"n"),className:"absolute top-0 left-3 right-3 h-1 cursor-ns-resize"}),
|
|
92
|
+
/* @__PURE__ */V("div",{onPointerDown:e=>wr(e,"s"),className:"absolute bottom-0 left-3 right-3 h-1 cursor-ns-resize"}),
|
|
93
|
+
/* @__PURE__ */V("div",{onPointerDown:e=>wr(e,"e"),className:"absolute top-3 bottom-3 right-0 w-1 cursor-ew-resize"}),
|
|
94
|
+
/* @__PURE__ */V("div",{onPointerDown:e=>wr(e,"w"),className:"absolute top-3 bottom-3 left-0 w-1 cursor-ew-resize"})]}),Kt&&/* @__PURE__ */V("div",{className:"absolute inset-0",style:{zIndex:M.hint,cursor:"pointer",background:"transparent"},onMouseEnter:()=>qt(!0),onMouseLeave:()=>qt(!1),onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),$n(kt),pr(!1)},onClick:e=>{e.stopPropagation(),e.preventDefault()},children:Ft&&/* @__PURE__ */V("button",{type:"button","data-expose-close":!0,"aria-label":Me.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/Ar})`,transformOrigin:"top right",zIndex:M.raised},onMouseDown:e=>{e.stopPropagation(),e.preventDefault()},onClick:e=>{e.stopPropagation(),e.preventDefault(),dr()},children:/* @__PURE__ */V(T,{name:"close",className:"h-4 w-4",strokeWidth:2.2})})})]}),Kt&&zr&&/* @__PURE__ */V("div",{className:"fixed pointer-events-none select-none truncate text-center",style:{left:zr.x,top:zr.y+zr.h+4,width:zr.w,zIndex:M.expose+(Ft?21:11),color:"white",fontSize:"var(--text-xs)",fontWeight:500,textShadow:"0 1px 2px rgba(0,0,0,0.6)"},children:Rt(Ee)})]}),$r=Ie&&/* @__PURE__ */X(x,{style:{left:Ie.x,top:Ie.y},onClose:()=>$e(null),minWidth:160,children:[!Q&&!G&&!bn&&/* @__PURE__ */X(_,{children:[
|
|
95
|
+
/* @__PURE__ */X(k,{onClick:()=>{Kn(kt),$e(null)},children:[
|
|
96
|
+
/* @__PURE__ */V(T,{name:"remove",className:"h-4 w-4",strokeWidth:1.5}),Ne.minimize]}),!vn&&/* @__PURE__ */X(k,Tn?{onClick:()=>{zn(!1),on(Qt()),$e(null)},children:[
|
|
97
|
+
/* @__PURE__ */V("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */V("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 4.5v15m6-15v15M4.5 9h15M4.5 15h15"})}),Ne.windowed]}:{onClick:()=>{Nr(),$e(null)},children:[
|
|
98
|
+
/* @__PURE__ */V(T,{name:"expand",className:"h-4 w-4",strokeWidth:1.5}),Ne.maximize]})]}),Y&&!bn&&/* @__PURE__ */X(k,{onClick:()=>{Pe(e=>!e),$e(null)},children:[
|
|
99
|
+
/* @__PURE__ */V(T,{name:"bookmark-square",className:"h-4 w-4 "+(De?"text-blue-600":""),fill:De?"currentColor":"none",strokeWidth:1.5}),De?Ne.unpin:Ne.pinOnTop]}),Ke&&/* @__PURE__ */X(k,{onClick:()=>{$e(null),Ye()},children:[
|
|
100
|
+
/* @__PURE__ */V(T,{name:"star",className:"h-4 w-4",fill:He?"currentColor":"none",strokeWidth:1.5}),He?Me.taskbar.removeFromDesktop:Me.taskbar.addToDesktop]}),(jt[kt]||[]).length>0&&/* @__PURE__ */V(_,{children:(jt[kt]||[]).map((e,t)=>/* @__PURE__ */X(k,{onClick:()=>{$e(null),e.onClick()},children:[e.icon,e.label]},t))}),!(bn&&Oe?.home)&&/* @__PURE__ */X(_,{children:[
|
|
101
|
+
/* @__PURE__ */V(E,{}),
|
|
102
|
+
/* @__PURE__ */X(k,{danger:!0,onClick:()=>{$e(null),dr()},children:[
|
|
103
|
+
/* @__PURE__ */V(T,{name:"close",className:"h-4 w-4"}),Ne.close]})]})]}),Kr=!!ae&&xt.some(e=>e.id===ae),Wr=!Lt||Kr||Q?null:/* @__PURE__ */X("div",{"data-modal-restore-tab":!0,"data-modal-id":kt,className:"fixed left-1/2 z-(--z-restore-tab) flex -translate-x-1/2 items-center gap-1 rounded-lg border border-gray-300 bg-white px-2 py-1 shadow-lg",style:{bottom:"calc(var(--taskbar-height, 0px) + 12px)"},children:[
|
|
104
|
+
/* @__PURE__ */V("button",{type:"button",onClick:()=>$n(kt),title:Ne.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:Se||Ne.windowSuffix}),
|
|
105
|
+
/* @__PURE__ */V("button",{type:"button",onClick:()=>$n(kt),title:Ne.restore,"aria-label":Ne.restore,className:"rounded px-2 py-0.5 text-xs leading-none text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:"▴"}),
|
|
106
|
+
/* @__PURE__ */V("button",{type:"button",onClick:()=>{dr()},title:Ne.close,"aria-label":Ne.close,className:"rounded px-2 py-0.5 text-xs leading-none text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:"✕"})]});return J(
|
|
107
|
+
/* @__PURE__ */X(It.Provider,{value:null,children:[Ir,$r,Wr]}),document.body)}"undefined"!=typeof window&&window.addEventListener("keydown",e=>{dr&&"Escape"===e.key&&(Nr(null),pr(!1))});var Ar=100,Dr={past:[],future:[]};function Pr(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>Ar?r.slice(r.length-Ar):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:Dr}}var Ir=/* @__PURE__ */new Set(["INPUT","TEXTAREA","SELECT"]);var $r=500,Kr=250;function Wr({children:e,canEdit:t=!0,perms:n,windowId:r}){const[o,a]=Y(Pr,Dr),s=I(/* @__PURE__ */new Map),[l,c]=K(0),d=l>0,[u,h]=K(0),[m,p]=K(0),f=m>0,{hasAnyPerm:w}=i(),y=t&&0===u&&(!(n&&n.length>0)||w(n)),g=I(null),b=I(!1),v=O(()=>{const e={};for(const[t,n]of s.current)e[t]=n.getLast();return e},[]),x=O((e,t)=>{s.current.has(e)||c(e=>e+1),s.current.set(e,t)},[]),k=O(e=>{s.current.delete(e)&&c(e=>e-1)},[]),E=O(e=>{h(t=>t+(e?1:-1))},[]),C=O(e=>{p(t=>t+(e?1:-1))},[]),[M,N]=K(0),S=M>0,L=O(e=>{N(t=>t+(e?1:-1))},[]),T=A(be),z=T?.claimReadOnly;$(()=>{if(z&&!y)return z(!0),()=>z(!1)},[z,y]);const D=T?.claimOwnMount;$(()=>{if(D&&S)return D(!0),()=>D(!1)},[D,S]);const P=I({last:0,count:0,tripped:!1}),W=I(!1),R=O((e,t,n)=>{if(b.current)return void(n&&function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(Array.isArray(e)!==Array.isArray(t))return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}(n.prev,n.next)||(W.current=!0));if(!y||g.current)return;const r=P.current;if(r.tripped)return;const o=Date.now();if(o-r.last>Kr&&(r.count=0),r.last=o,++r.count>$r)return r.tripped=!0,void console.error(`[efficient-shell] UndoProvider: "${e}" recorded ${$r} undo steps with no pause between them, which no user action can do. The value passed to useUndoable for this slice is almost certainly rebuilt on every render (a .map/.filter/object literal in the call) rather than held in state, so it reads as changed every time — and since recording a step re-renders the form, that is a loop. Undo recording is now off for this form to keep the tab responsive.`);g.current={values:v(),label:e,coalesceKey:t},queueMicrotask(()=>{const e=g.current;g.current=null,e&&a({type:"record",step:e})})},[y,v]),F=O(e=>{for(const[t,n]of Object.entries(e)){const e=s.current.get(t);e&&(e.setLast(n),e.apply(n))}},[]),q=O(()=>{const e=o.past[o.past.length-1];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};F(e.values),a({type:"undo",redoStep:t})},[o.past,v,F]),j=O(()=>{const e=o.future[0];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};F(e.values),a({type:"redo",undoStep:t})},[o.future,v,F]),[H,U]=K(0),_=I(0),J=I(0),Q=I(!1),G=O(()=>{b.current=!0,W.current=!1,g.current=null,_.current+=1,J.current=_.current,U(_.current)},[]),Z=I(void 0),ee=O(e=>{void 0!==e&&(void 0!==Z.current&&e!==Z.current&&(Q.current=!0),Z.current=e),G()},[G]);$(()=>{b.current&&H===J.current&&(b.current=!1,g.current=null,(W.current||Q.current)&&a({type:"clear"}),W.current=!1,Q.current=!1)},[H]);const te=O(()=>{Q.current=!0,a({type:"clear"}),G()},[G]),ne=y&&o.past.length>0,re=y&&o.future.length>0,oe=cr(r),ie=I({undo:q,redo:j,canUndo:ne,canRedo:re});ie.current={undo:q,redo:j,canUndo:ne,canRedo:re},$(()=>{if(!oe||!y)return;const e=e=>{const t=function(e){if(!e.metaKey&&!e.ctrlKey||e.altKey)return null;const t=e.key.toLowerCase(),n="z"===t?e.shiftKey?"redo":"undo":"y"!==t||!e.ctrlKey||e.metaKey||e.shiftKey?null:"redo";if(!n)return null;const r=e.target;return r?.isContentEditable||r?.tagName&&Ir.has(r.tagName.toUpperCase())?null:n}(e);if(!t)return;const n=ie.current;("undo"===t?n.canUndo:n.canRedo)&&(e.preventDefault(),"undo"===t?n.undo():n.redo())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[oe,y]);const ae=B(()=>({register:x,unregister:k,record:R,undo:q,redo:j,clear:te,baseline:ee,canUndo:ne,canRedo:re,enabled:y,hasState:d,handMounted:S,claimOwnMount:L,claimReadOnly:E,declaredEditable:f,claimEditable:C,undoLabel:ne?o.past[o.past.length-1].label:null,redoLabel:re?o.future[0].label:null}),[x,k,R,q,j,te,ee,ne,re,y,d,S,L,E,f,C,o.past,o.future]),se=""!==Xt(),le=A(Ut)?.footerOpen??!1,ce=se&&y&&d&&!S&≤/* @__PURE__ */
|
|
108
|
+
return X(be.Provider,{value:ae,children:[ce&&/* @__PURE__ */V(_t,{position:"left",quiet:!0,children:/* @__PURE__ */V(xe,{auto:!0})}),e]})}function Or(){const e=A(be),t=O(()=>{},[]);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 Rr(e){const t=A(be),n=t?.claimReadOnly,r=t?.claimEditable;$(()=>{const t=e?r:n;if(t)return t(!0),()=>t(!1)},[n,r,e])}function Fr(e,t,n){const r=A(be),o=H(),i=I(e),a=I(t);a.current=t,$(()=>{if(r)return r.register(o,{getLast:()=>i.current,setLast:e=>{i.current=e},apply:e=>a.current(e)}),()=>r.unregister(o)},[r,o]);const{label:s,coalesceKey:l=null}=n,c=I(r);c.current=r;const d=I({label:s,coalesceKey:l});d.current={label:s,coalesceKey:l},$(()=>{const t=c.current;t&&(Object.is(e,i.current)||(t.record(d.current.label,d.current.coalesceKey,{prev:i.current,next:e}),i.current=e))},[e])}function qr(e,t){const[n,r]=K(e);return Fr(n,e=>r(()=>e),t),[n,r]}export{Jt as CancelButton,je as DocFavStar,ze as EntityWindowFallback,Le as EntityWindowLoading,Ae as EntityWindowState,Ot as KEY_ACTIVATED_SELECTOR,Ne as LoadingSpinner,Wt as MODAL_SUBMIT_SELECTOR,zr as Modal,_t as ModalActions,xe as UndoControls,Wr as UndoProvider,oe as WINDOW_REGISTRY,ye as WindowCrashedFallback,ge as WindowErrorBoundary,ct as WindowManagerProvider,Ht as WindowTitle,Xe as activateWindowById,vt as beginWindowGesture,An as cancelWindowFront,ce as client_default,Sr as commitExposeHighlight,xt as drainPerfEvents,wr as exitExposeMode,cn as forgetMaximizedWindowBoxes,ar as getActiveModalId,Qe as getActiveWindowRoute,Mr as getExposeHighlight,Dt as getWindowChromeVersion,sn as getWindowPosition,Pe as isDraftEntityId,Ie as isDraftEntityWindow,te as isEntityEntry,ee as isPageEntry,se as isShellApiClientConfigured,Ve as isTabWindow,bt as markMenuOpen,zt as readWindowChrome,zn as requestWindowFront,Nr as setExposeHighlight,gt as setPerfCollecting,ae as setShellApiClient,pe as setShellHomeRoute,re as setShellWindowRegistry,an as setWindowDefaultPosition,ln as setWindowPosition,Ct as splitTitle,Cr as subscribeExposeHighlight,At as subscribeWindowChrome,fr as toggleExposeMode,Nn as useCurrentTabKey,Xt as useEnclosingModalId,cr as useIsActiveWindow,Vt as useModalActive,ue as usePageSearch,Or as useUndo,Rr as useUndoCanEdit,Fr as useUndoable,qr as useUndoableState,qt as useWidgetSettings,We as useWindowDirty,Re as useWindowManager,Bt as useWindowMenuItem,Yt as useWindowTitle};
|