efficient-shell 16.6.0 → 16.7.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 +17 -4
- package/dist/{Browser-UHT6QSUN.js → Browser-XCKNVOAU.js} +14 -14
- package/dist/{Calculator-ZG5RX2HX.js → Calculator-VOZDVOYE.js} +22 -22
- package/dist/{CurrencyConverter-AHGYTGKM.js → CurrencyConverter-AMGFHBJE.js} +5 -5
- package/dist/{Files-4HJWEYDE.js → Files-FACH4PUV.js} +62 -62
- package/dist/{Notepad-GXKGVTNG.js → Notepad-4H26PYBU.js} +7 -7
- package/dist/{PomodoroTimer-GN2OSLJ6.js → PomodoroTimer-77VMHGDE.js} +4 -4
- package/dist/{Preview-EN4YCUH5.js → Preview-RVVXOMRS.js} +14 -14
- package/dist/{Stock-44BSCZOL.js → Stock-PXLNR6A6.js} +3 -3
- package/dist/{Weather-GNGUF6A4.js → Weather-WGLPPZPX.js} +16 -16
- package/dist/{WorldClock-EBZJRH5F.js → WorldClock-UY4B5VKZ.js} +7 -7
- package/dist/ai/index.d.ts +1 -1
- package/dist/ai/index.js +8 -8
- package/dist/apps/index.js +1 -1
- package/dist/bin/browser-check.js +1 -1
- package/dist/bin/media-host-check.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/{chunk-3C7JKJGL.js → chunk-2SOK37OP.js} +1 -1
- package/dist/{chunk-N7EZ2BFE.js → chunk-AG2DEQYB.js} +6 -6
- package/dist/{chunk-H6JJAVYL.js → chunk-EC6XKOAE.js} +1 -1
- package/dist/chunk-EJFJOHPZ.js +1 -0
- package/dist/{chunk-UQPVUPSS.js → chunk-FFCVC4ES.js} +1 -1
- package/dist/{chunk-MS6IZF6E.js → chunk-KTZGG242.js} +1 -1
- package/dist/{chunk-HOTIZZXC.js → chunk-LBXKYVM3.js} +1 -1
- package/dist/chunk-MHKTBQ53.js +5 -0
- package/dist/{chunk-EJTAPBGB.js → chunk-MIHPFJCP.js} +13 -13
- package/dist/chunk-MWJNMENV.js +2 -0
- package/dist/chunk-OYB2ZLJ3.js +1 -0
- package/dist/{chunk-DX24Q5OR.js → chunk-RWOBYP7Q.js} +1 -1
- package/dist/{chunk-ATTQTQJI.js → chunk-S24LTOBM.js} +4 -4
- package/dist/chunk-S3TQ3VOK.js +2 -0
- package/dist/chunk-XCTS44UZ.js +1 -0
- package/dist/{chunk-YYGA4Y6E.js → chunk-YAVIKKIQ.js} +1 -1
- package/dist/format/index.d.ts +24 -6
- package/dist/format/index.js +1 -1
- package/dist/forms/LinkPicker.js +1 -1
- package/dist/forms/MediaLibrary.js +1 -1
- package/dist/forms/Select.d.ts +1 -1
- package/dist/forms/TextToolbar.d.ts +1 -1
- package/dist/forms/textAlign.d.ts +1 -1
- package/dist/icons/efficient-glyphs.d.ts +1 -0
- package/dist/icons/efficient-glyphs.js +1 -1
- package/dist/icons/efficient-looks.d.ts +2 -0
- package/dist/icons/efficient-looks.js +1 -1
- package/dist/icons/efficient-meanings.d.ts +1 -0
- package/dist/icons/efficient-meanings.js +1 -1
- package/dist/icons/efficient.d.ts +1 -0
- package/dist/icons/efficient.js +1 -1
- package/dist/icons/glyphs/ScrollExpandIcon.d.ts +8 -0
- package/dist/icons/glyphs/ScrollExpandIcon.js +1 -0
- package/dist/icons/index.d.ts +2 -2
- package/dist/icons/index.js +1 -1
- package/dist/icons/looks/ScrollExpandMiniIcon.d.ts +8 -0
- package/dist/icons/looks/ScrollExpandMiniIcon.js +1 -0
- package/dist/icons/looks/ScrollExpandSolidIcon.d.ts +8 -0
- package/dist/icons/looks/ScrollExpandSolidIcon.js +1 -0
- package/dist/icons/looks/map.js +1 -1
- package/dist/icons/sets.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +162 -162
- package/dist/motion/entrance.js +1 -1
- package/dist/motion/values.d.ts +7 -2
- package/dist/motion/values.js +1 -1
- package/dist/motion.css +28 -5
- package/dist/{names-CpcmfUzD.d.ts → names-Bw6ChIJl.d.ts} +1 -1
- package/dist/routine-index.json +1 -1
- package/dist/shell/LanguageSelect.js +1 -1
- package/dist/shell/Markdown.d.ts +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/value-index.json +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-AIJ3G6BD.js +0 -1
- package/dist/chunk-OMOAD5LL.js +0 -1
- package/dist/chunk-YVXF7L66.js +0 -1
- /package/dist/{chunk-OQOWFHRZ.js → chunk-4B54NLXF.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{setBoundaryErrorReporter as e}from"./chunk-KNUR2UEG.js";import{VERSION as t}from"./chunk-YVXF7L66.js";var n=-1,i=()=>n,a=e=>{addEventListener("pageshow",t=>{t.persisted&&(n=t.timeStamp,e(t))},!0)},r=(e,t,n,i)=>{let a,r;return o=>{var s,c;t.value>=0&&(o||i)&&(r=t.value-(a??0),(r||void 0===a)&&(a=t.value,t.delta=r,t.rating=(s=t.value)>(c=n)[1]?"poor":s>c[0]?"needs-improvement":"good",e(t)))}},o=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},s=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},c=()=>s()?.activationStart??0,d=-1,l=/* @__PURE__ */new Set,u=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,f=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of l)e();isFinite(d)||(d="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",f,!0))}},h=(e=!1)=>{if(e&&(d=1/0),d<0){const e=c(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;d=t??u(),addEventListener("visibilitychange",f,!0),addEventListener("prerenderingchange",f,!0),a(()=>{setTimeout(()=>{d=u()})})}return{get firstHiddenTime(){return d},onHidden(e){l.add(e)}}},g=(e,t=-1,n,a=0,r,o,d)=>{const l=s(),u=l?.navigationId||0;let f="navigate";return n?f=n:i()>=0?f="back-forward-cache":l&&(document.prerendering||c()>0?f="prerender":document.wasDiscarded?f="restore":l.type&&(f=l.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:f,navigationId:a||u,navigationInteractionId:r,navigationURL:o||l?.name,navigationStartTime:d||0}},v=/* @__PURE__ */new WeakMap;function p(e,t){let n=v.get(t);return n||(n=/* @__PURE__ */new WeakMap,v.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}var m,y=class{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},T=(e,t,n={})=>{try{const i=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(i.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const n=e.getEntries();i.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(const t of i)e.observe({type:t,buffered:!0,...n});return e}}catch{}},w=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,I=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},b=e=>{let t=!1;return()=>{t||(e(),t=!0)}},C=class{l},E=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},L=[1800,3e3],P=(e,t={})=>{const n=w(t);E(()=>{const s=p(t,C),d=h();let l,u=g("FCP");const f=T(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(f.disconnect(),t.startTime<d.firstHiddenTime&&(u.value=Math.max(t.startTime-c(),0),u.entries.push(t),u.navigationId=t.navigationId||u.navigationId,l(!0)))});f&&(l=r(e,u,L,t.reportAllChanges),a(n=>{u=g("FCP",-1,"back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),l=r(e,u,L,t.reportAllChanges),o(()=>{u.value=performance.now()-n.timeStamp,l(!0)})})),n&&T(["soft-navigation"],n=>{n.forEach(n=>{s.l&&n.navigationId&&I(s.l,n);const i=Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0);u=g("FCP",i,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),l=r(e,u,L,t.reportAllChanges),l(!0)})},t)})},A=[.1,.25],k=0,S=1/0,z=0,M=e=>{for(const t of e)t.interactionId&&(S=Math.min(S,t.interactionId),z=Math.max(z,t.interactionId),k=z?(z-S)/7+1:0)},$=()=>m?k:performance.interactionCount??0,_=class{u=0;v=[];m=/* @__PURE__ */new Map;p;T;_(){return $()-this.u}M(){this.u=$(),this.v.length=0,this.m.clear()}L(e){const t=this._(),n=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==n||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[n]:{P:8,id:-1,entries:[]}}h(e){if(this.p?.(e),!e.interactionId)return;const t=this.v.at(-1);let n=this.m.get(e.interactionId);if(n||this.v.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}this.T?.(n)}}},F=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],R=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=h();E(()=>{"interactionCount"in performance||m||(m=T(["event"],M,{durationThreshold:0}));let o,s=g("INP");const c=p(t,_),d=(n,i,a,d,l)=>{c.M(),s=g("INP",-1,n,i,a,d,l),o=r(e,s,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)=>{F(()=>{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())}))})},j=class{p;l;h(e){this.p?.(e)}},x=[2500,4e3],B=[800,1800],N=e=>{document.prerendering?E(()=>N(e)):"complete"!==document.readyState?addEventListener("load",()=>N(e),!0):setTimeout(e)};var U=/^[A-Za-z0-9/_:.\-[\]{}*@~]+$/,O=/^[A-Za-z_$][A-Za-z0-9_$.]*$/,H=/^[A-Za-z0-9][A-Za-z0-9.+_-]*$/;var q=class{constructor(e){this.head=e}head;events=[];waiting=/* @__PURE__ */new Map;seen=/* @__PURE__ */new Set;get size(){return this.events.length}addVital(e){this.events.push(e)}addError(e){const t=function(e){return e.frames.length?`${e.name}|${e.frames.join("|")}`:`${e.name}|${e.message.replace(/\d/g,"0")}`}(e),n=this.waiting.get(t);return n?(n.count=Math.min(1e3,n.count+e.count),!0):!(this.seen.has(t)||this.seen.size>=20)&&(this.seen.add(t),this.waiting.set(t,e),this.events.push(e),!0)}drain(){const e=this.events;this.events=[],this.waiting.clear();const t=[],n=JSON.stringify({...this.head,events:[]}).length;let i=[],a=n;for(const r of e){const e=JSON.stringify(r).length+1;n+e>30720||((50===i.length||a+e>30720)&&(t.push({...this.head,events:i}),i=[],a=n),i.push(r),a+=e)}return i.length&&t.push({...this.head,events:i}),t}},J=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,K=/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*)?|\b[Bb]earer\s+[A-Za-z0-9._~+/=-]{8,}/g,V=/\b[a-z][a-z0-9+.-]*:\/\/\S+/gi,W=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,D=/\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,X=/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,Y=/(?:\(|@|\bat\s+)?((?:[a-z][a-z0-9+.-]*:\/\/|\/)[^\s()@]*?):(\d+):(\d+)\)?\s*$/i;function Q(e,t,n){const i=e.replace(X,"").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=Y.exec(n.trim()),i=e&&Q(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(X,"").split(/[?#]/,1)[0].replace(G,(e,t)=>":"===t?":id":`${t}:id`);return t&&t.length<=128&&!t.includes("//")&&U.test(t)?t:"unknown"}var ie={flush(){},reportError(){},stop(){}},ae=null,re=/* @__PURE__ */new Set(["LCP","FCP","TTFB"]);function oe(e,t,n){const i=function(e){if(e.anonymous)return{credentials:"omit",headers:{"Content-Type":"application/json"}};const t=e.getAccessToken();return t?{credentials:"same-origin",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}}:null}(t);if(!i)return;const a=t.anonymous?"/api/storefront-analytics/web-vitals/":"/api/client-telemetry/web-batches/";n(t.endpoint??a,{...i,method:"POST",keepalive:!0,body:JSON.stringify(e)}).catch(e=>{console.debug("[efficient-shell] client telemetry batch dropped:",e)})}function se(e){((e,t={})=>{let n=!1;const s=w(t);E(()=>{let d,l=h(),u=g("LCP");const f=p(t,j),v=(i,a,o,s,c)=>{u=g("LCP",-1,i,a,o,s,c),d=r(e,u,x,t.reportAllChanges),n=!1,"soft-navigation"===i&&(l=h(!0))},m=e=>{f.l&&e.navigationId&&I(f.l,e),n||d(!0),v("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const t=e.getLargestInteractionContentfulPaint?.();t&&y([t])},y=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){m(t);continue}let e=0,n=[],i=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-c(),0),f.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){const a=t;if(!u.navigationId)continue;if("interactionId"in a&&a.interactionId!=u.navigationInteractionId)continue;i=a.largestContentfulPaint?.renderTime||0,e=Math.max(i-t.startTime,0),a.largestContentfulPaint&&(f.h(a.largestContentfulPaint),n=[a.largestContentfulPaint])}i<l.firstHiddenTime&&(u.value=e,u.entries=n,d())}},w=["largest-contentful-paint"];s&&w.push("interaction-contentful-paint","soft-navigation");const b=T(w,y);if(b){d=r(e,u,x,t.reportAllChanges);const c=["keydown","click","visibilitychange"],l=e=>{if(e.isTrusted&&!n){const e=u.id;F(()=>{if(!n){if(!s){b.disconnect();for(const e of c)removeEventListener(e,l,{capture:!0})}e===u.id&&(n=!0,d(!0))}})}};for(const e of c)addEventListener(e,l,{capture:!0});a(a=>{v("back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),d=r(e,u,x,t.reportAllChanges),o(()=>{u.value=performance.now()-a.timeStamp,n=!0,d(!0)})})}})})(e),R(e),((e,t={})=>{const n=h();P(b(()=>{let s,c=g("CLS",0);const d=p(t,y),l=(n,i,a,o,l)=>{c=g("CLS",0,n,i,a,o,l),d.i=0,s=r(e,c,A,t.reportAllChanges)},u=(e=!1)=>{d.i>c.value&&(c.value=d.i,c.entries=d.o),s(e)},f=e=>{u(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},h=e=>{for(const t of e)"soft-navigation"!==t.entryType?d.h(t):f(t);u()},v=["layout-shift"];w(t)&&v.push("soft-navigation");const m=T(v,h);m&&(s=r(e,c,A,t.reportAllChanges),n.onHidden(()=>{h(m.takeRecords()),s(!0)}),a(()=>{l("back-forward-cache",c.navigationId,c.navigationInteractionId,c.navigationURL,i()),o(s)}),setTimeout(s))}))})(e),P(e),((e,t={})=>{const n=w(t);let o=g("TTFB"),d=r(e,o,B,t.reportAllChanges);N(()=>{const l=s();if(l){const s=l.responseStart;o.value=Math.max(s-c(),0),o.entries=[l],d(!0),a(()=>{o=g("TTFB",0,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,i()),d=r(e,o,B,t.reportAllChanges),d(!0)}),n&&T(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&(o=g("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),o.entries=[n],d=r(e,o,B,t.reportAllChanges),d(!0))})},t)}})})(e)}function ce(n){if(ae?.stop(),ae=null,!1===n.enabled||"undefined"==typeof window||"undefined"==typeof document)return ie;if(!function(e){const t="string"==typeof e.app&&H.test(e.app),n="string"==typeof e.release&&H.test(e.release);return t&&n||console.warn("[efficient-shell] client telemetry not started: `app` and `release` must be version-like strings."),t&&n}(n))return ie;const i=function(e){const t=e.vitalsSampleRate??1;return t>0&&(t>=1||(e.random??Math.random)()<t)}(n);if(n.anonymous&&!i)return ie;const a=n.fetch??window.fetch.bind(window),r=new q({app:n.app,release:n.release,shell_version:H.test(t)?t:""}),o=ne(n.routeKey()),s=function(e=("undefined"==typeof window?void 0:window)){if(!e)return"desktop";const t="function"==typeof e.matchMedia&&e.matchMedia("(pointer: coarse)").matches,n=e.innerWidth;return n<600?"mobile":t&&n<1280?"tablet":"desktop"}(window);let c=!1;const d=()=>{for(const e of r.drain())oe(e,n,a)},l=e=>{c||n.anonymous||(r.addError(e),r.size>=50&&d())},u=(e,t)=>{return{type:"error",source:t,name:te(e),message:(a=e,i=a instanceof Error?a.message:"string"==typeof a?a:a&&"object"==typeof a&&"string"==typeof a.message?a.message:"",i.slice(0,640).replace(J,"[redacted]").replace(K,"[redacted]").replace(V,"[url]").replace(W,"[id]").replace(D,"[n]").replace(/\s+/g," ").trim().slice(0,160)),frames:ee(e instanceof Error?e.stack:void 0),route:ne(n.routeKey()),count:1};var i,a};i&&(n.observeVitals??se)(e=>{c||(r.addVital(function(e,t,n,i){return{type:"vital",name:e.name,value:e.value,route:re.has(e.name)?t:n(),navigation:e.navigationType??"navigate",device:i}}(e,o,()=>ne(n.routeKey()),s)),r.size>=50&&d())});const f=n.anonymous?()=>{}:function(t,n){const i=e=>{const{error:i,message:a,filename:r,lineno:o,colno:s}=e;if(null!=i)return void t(n(i,"onerror"));const c=r?ee(`at ${r}:${o??0}:${s??0}`):[];t({...n(a??"","onerror"),frames:c})},a=e=>t(n(e.reason,"unhandledrejection"));window.addEventListener("error",i),window.addEventListener("unhandledrejection",a);const r=e(e=>t(n(e,"boundary")));return()=>{window.removeEventListener("error",i),window.removeEventListener("unhandledrejection",a),r()}}(l,u),h=()=>{"hidden"===document.visibilityState&&d()};document.addEventListener("visibilitychange",h),window.addEventListener("pagehide",d);const g=window.setInterval(d,n.flushIntervalMs??6e4),v={flush:d,reportError:e=>l(u(e,"boundary")),stop(){c||(d(),c=!0,f(),document.removeEventListener("visibilitychange",h),window.removeEventListener("pagehide",d),window.clearInterval(g),ae===v&&(ae=null))}};return ae=v,v}export{ce as startClientTelemetry};
|
|
1
|
+
import{setBoundaryErrorReporter as e}from"./chunk-KNUR2UEG.js";import{VERSION as t}from"./chunk-OYB2ZLJ3.js";var n=-1,i=()=>n,a=e=>{addEventListener("pageshow",t=>{t.persisted&&(n=t.timeStamp,e(t))},!0)},r=(e,t,n,i)=>{let a,r;return o=>{var s,c;t.value>=0&&(o||i)&&(r=t.value-(a??0),(r||void 0===a)&&(a=t.value,t.delta=r,t.rating=(s=t.value)>(c=n)[1]?"poor":s>c[0]?"needs-improvement":"good",e(t)))}},o=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},s=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},c=()=>s()?.activationStart??0,d=-1,l=/* @__PURE__ */new Set,u=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,f=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of l)e();isFinite(d)||(d="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",f,!0))}},h=(e=!1)=>{if(e&&(d=1/0),d<0){const e=c(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;d=t??u(),addEventListener("visibilitychange",f,!0),addEventListener("prerenderingchange",f,!0),a(()=>{setTimeout(()=>{d=u()})})}return{get firstHiddenTime(){return d},onHidden(e){l.add(e)}}},g=(e,t=-1,n,a=0,r,o,d)=>{const l=s(),u=l?.navigationId||0;let f="navigate";return n?f=n:i()>=0?f="back-forward-cache":l&&(document.prerendering||c()>0?f="prerender":document.wasDiscarded?f="restore":l.type&&(f=l.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:f,navigationId:a||u,navigationInteractionId:r,navigationURL:o||l?.name,navigationStartTime:d||0}},v=/* @__PURE__ */new WeakMap;function p(e,t){let n=v.get(t);return n||(n=/* @__PURE__ */new WeakMap,v.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}var m,y=class{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},T=(e,t,n={})=>{try{const i=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(i.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const n=e.getEntries();i.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(const t of i)e.observe({type:t,buffered:!0,...n});return e}}catch{}},w=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,I=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},b=e=>{let t=!1;return()=>{t||(e(),t=!0)}},C=class{l},E=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},L=[1800,3e3],P=(e,t={})=>{const n=w(t);E(()=>{const s=p(t,C),d=h();let l,u=g("FCP");const f=T(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(f.disconnect(),t.startTime<d.firstHiddenTime&&(u.value=Math.max(t.startTime-c(),0),u.entries.push(t),u.navigationId=t.navigationId||u.navigationId,l(!0)))});f&&(l=r(e,u,L,t.reportAllChanges),a(n=>{u=g("FCP",-1,"back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),l=r(e,u,L,t.reportAllChanges),o(()=>{u.value=performance.now()-n.timeStamp,l(!0)})})),n&&T(["soft-navigation"],n=>{n.forEach(n=>{s.l&&n.navigationId&&I(s.l,n);const i=Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0);u=g("FCP",i,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),l=r(e,u,L,t.reportAllChanges),l(!0)})},t)})},A=[.1,.25],k=0,S=1/0,z=0,M=e=>{for(const t of e)t.interactionId&&(S=Math.min(S,t.interactionId),z=Math.max(z,t.interactionId),k=z?(z-S)/7+1:0)},$=()=>m?k:performance.interactionCount??0,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();E(()=>{"interactionCount"in performance||m||(m=T(["event"],M,{durationThreshold:0}));let o,s=g("INP");const c=p(t,Z),d=(n,i,a,d,l)=>{c.M(),s=g("INP",-1,n,i,a,d,l),o=r(e,s,F,t.reportAllChanges)},l=()=>{const e=c.L(s.navigationType);e&&e.P!==s.value&&(s.value=e.P,s.entries=e.entries,o())},u=e=>{l(),o(!0),d("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},f=(e,t=!1)=>{_(()=>{for(const t of e)"soft-navigation"!==t.entryType?c.h(t):u(t);l(),t&&o(!0)})},h=["event","first-input"];w(t)&&h.push("soft-navigation");const v=T(h,f,{...t,durationThreshold:t.durationThreshold??40});o=r(e,s,F,t.reportAllChanges),v&&(n.onHidden(()=>{f(v.takeRecords(),!0)}),a(()=>{d("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,i())}))})},j=class{p;l;h(e){this.p?.(e)}},x=[2500,4e3],B=[800,1800],N=e=>{document.prerendering?E(()=>N(e)):"complete"!==document.readyState?addEventListener("load",()=>N(e),!0):setTimeout(e)};var O=/^[A-Za-z0-9/_:.\-[\]{}*@~]+$/,U=/^[A-Za-z_$][A-Za-z0-9_$.]*$/,H=/^[A-Za-z0-9][A-Za-z0-9.+_-]*$/;var q=class{constructor(e){this.head=e}head;events=[];waiting=/* @__PURE__ */new Map;seen=/* @__PURE__ */new Set;get size(){return this.events.length}addVital(e){this.events.push(e)}addError(e){const t=function(e){return e.frames.length?`${e.name}|${e.frames.join("|")}`:`${e.name}|${e.message.replace(/\d/g,"0")}`}(e),n=this.waiting.get(t);return n?(n.count=Math.min(1e3,n.count+e.count),!0):!(this.seen.has(t)||this.seen.size>=20)&&(this.seen.add(t),this.waiting.set(t,e),this.events.push(e),!0)}drain(){const e=this.events;this.events=[],this.waiting.clear();const t=[],n=JSON.stringify({...this.head,events:[]}).length;let i=[],a=n;for(const r of e){const e=JSON.stringify(r).length+1;n+e>30720||((50===i.length||a+e>30720)&&(t.push({...this.head,events:i}),i=[],a=n),i.push(r),a+=e)}return i.length&&t.push({...this.head,events:i}),t}},J=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,K=/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*)?|\b[Bb]earer\s+[A-Za-z0-9._~+/=-]{8,}/g,V=/\b[a-z][a-z0-9+.-]*:\/\/\S+/gi,W=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,D=/\d{4,}/g,G=/(^|[/:])(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,})(?=$|[/:])/gi,Y=/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,Q=/(?:\(|@|\bat\s+)?((?:[a-z][a-z0-9+.-]*:\/\/|\/)[^\s()@]*?):(\d+):(\d+)\)?\s*$/i;function X(e,t,n){const i=e.replace(Y,"").split(/[?#]/,1)[0];return i?`${i}:${t}:${n}`.slice(0,256):null}function ee(e){if("string"!=typeof e)return[];const t=[];for(const n of e.split("\n")){const e=Q.exec(n.trim()),i=e&&X(e[1],e[2],e[3]);if(i&&t.push(i),5===t.length)break}return t}function te(e){const t=e instanceof Error?e.name:void 0;return"string"==typeof t&&t.length<=64&&U.test(t)?t:"Error"}function ne(e){if("string"!=typeof e)return"unknown";const t=e.trim().replace(Y,"").split(/[?#]/,1)[0].replace(G,(e,t)=>":"===t?":id":`${t}:id`);return t&&t.length<=128&&!t.includes("//")&&O.test(t)?t:"unknown"}var ie={flush(){},reportError(){},stop(){}},ae=null,re=/* @__PURE__ */new Set(["LCP","FCP","TTFB"]);function oe(e,t,n){const i=function(e){if(e.anonymous)return{credentials:"omit",headers:{"Content-Type":"application/json"}};const t=e.getAccessToken();return t?{credentials:"same-origin",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}}:null}(t);if(!i)return;const a=t.anonymous?"/api/storefront-analytics/web-vitals/":"/api/client-telemetry/web-batches/";n(t.endpoint??a,{...i,method:"POST",keepalive:!0,body:JSON.stringify(e)}).catch(e=>{console.debug("[efficient-shell] client telemetry batch dropped:",e)})}function se(e){((e,t={})=>{let n=!1;const s=w(t);E(()=>{let d,l=h(),u=g("LCP");const f=p(t,j),v=(i,a,o,s,c)=>{u=g("LCP",-1,i,a,o,s,c),d=r(e,u,x,t.reportAllChanges),n=!1,"soft-navigation"===i&&(l=h(!0))},m=e=>{f.l&&e.navigationId&&I(f.l,e),n||d(!0),v("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const t=e.getLargestInteractionContentfulPaint?.();t&&y([t])},y=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){m(t);continue}let e=0,n=[],i=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-c(),0),f.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){const a=t;if(!u.navigationId)continue;if("interactionId"in a&&a.interactionId!=u.navigationInteractionId)continue;i=a.largestContentfulPaint?.renderTime||0,e=Math.max(i-t.startTime,0),a.largestContentfulPaint&&(f.h(a.largestContentfulPaint),n=[a.largestContentfulPaint])}i<l.firstHiddenTime&&(u.value=e,u.entries=n,d())}},w=["largest-contentful-paint"];s&&w.push("interaction-contentful-paint","soft-navigation");const b=T(w,y);if(b){d=r(e,u,x,t.reportAllChanges);const c=["keydown","click","visibilitychange"],l=e=>{if(e.isTrusted&&!n){const e=u.id;_(()=>{if(!n){if(!s){b.disconnect();for(const e of c)removeEventListener(e,l,{capture:!0})}e===u.id&&(n=!0,d(!0))}})}};for(const e of c)addEventListener(e,l,{capture:!0});a(a=>{v("back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),d=r(e,u,x,t.reportAllChanges),o(()=>{u.value=performance.now()-a.timeStamp,n=!0,d(!0)})})}})})(e),R(e),((e,t={})=>{const n=h();P(b(()=>{let s,c=g("CLS",0);const d=p(t,y),l=(n,i,a,o,l)=>{c=g("CLS",0,n,i,a,o,l),d.i=0,s=r(e,c,A,t.reportAllChanges)},u=(e=!1)=>{d.i>c.value&&(c.value=d.i,c.entries=d.o),s(e)},f=e=>{u(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},h=e=>{for(const t of e)"soft-navigation"!==t.entryType?d.h(t):f(t);u()},v=["layout-shift"];w(t)&&v.push("soft-navigation");const m=T(v,h);m&&(s=r(e,c,A,t.reportAllChanges),n.onHidden(()=>{h(m.takeRecords()),s(!0)}),a(()=>{l("back-forward-cache",c.navigationId,c.navigationInteractionId,c.navigationURL,i()),o(s)}),setTimeout(s))}))})(e),P(e),((e,t={})=>{const n=w(t);let o=g("TTFB"),d=r(e,o,B,t.reportAllChanges);N(()=>{const l=s();if(l){const s=l.responseStart;o.value=Math.max(s-c(),0),o.entries=[l],d(!0),a(()=>{o=g("TTFB",0,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,i()),d=r(e,o,B,t.reportAllChanges),d(!0)}),n&&T(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&(o=g("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),o.entries=[n],d=r(e,o,B,t.reportAllChanges),d(!0))})},t)}})})(e)}function ce(n){if(ae?.stop(),ae=null,!1===n.enabled||"undefined"==typeof window||"undefined"==typeof document)return ie;if(!function(e){const t="string"==typeof e.app&&H.test(e.app),n="string"==typeof e.release&&H.test(e.release);return t&&n||console.warn("[efficient-shell] client telemetry not started: `app` and `release` must be version-like strings."),t&&n}(n))return ie;const i=function(e){const t=e.vitalsSampleRate??1;return t>0&&(t>=1||(e.random??Math.random)()<t)}(n);if(n.anonymous&&!i)return ie;const a=n.fetch??window.fetch.bind(window),r=new q({app:n.app,release:n.release,shell_version:H.test(t)?t:""}),o=ne(n.routeKey()),s=function(e=("undefined"==typeof window?void 0:window)){if(!e)return"desktop";const t="function"==typeof e.matchMedia&&e.matchMedia("(pointer: coarse)").matches,n=e.innerWidth;return n<600?"mobile":t&&n<1280?"tablet":"desktop"}(window);let c=!1;const d=()=>{for(const e of r.drain())oe(e,n,a)},l=e=>{c||n.anonymous||(r.addError(e),r.size>=50&&d())},u=(e,t)=>{return{type:"error",source:t,name:te(e),message:(a=e,i=a instanceof Error?a.message:"string"==typeof a?a:a&&"object"==typeof a&&"string"==typeof a.message?a.message:"",i.slice(0,640).replace(J,"[redacted]").replace(K,"[redacted]").replace(V,"[url]").replace(W,"[id]").replace(D,"[n]").replace(/\s+/g," ").trim().slice(0,160)),frames:ee(e instanceof Error?e.stack:void 0),route:ne(n.routeKey()),count:1};var i,a};i&&(n.observeVitals??se)(e=>{c||(r.addVital(function(e,t,n,i){return{type:"vital",name:e.name,value:e.value,route:re.has(e.name)?t:n(),navigation:e.navigationType??"navigate",device:i}}(e,o,()=>ne(n.routeKey()),s)),r.size>=50&&d())});const f=n.anonymous?()=>{}:function(t,n){const i=e=>{const{error:i,message:a,filename:r,lineno:o,colno:s}=e;if(null!=i)return void t(n(i,"onerror"));const c=r?ee(`at ${r}:${o??0}:${s??0}`):[];t({...n(a??"","onerror"),frames:c})},a=e=>t(n(e.reason,"unhandledrejection"));window.addEventListener("error",i),window.addEventListener("unhandledrejection",a);const r=e(e=>t(n(e,"boundary")));return()=>{window.removeEventListener("error",i),window.removeEventListener("unhandledrejection",a),r()}}(l,u),h=()=>{"hidden"===document.visibilityState&&d()};document.addEventListener("visibilitychange",h),window.addEventListener("pagehide",d);const g=window.setInterval(d,n.flushIntervalMs??6e4),v={flush:d,reportError:e=>l(u(e,"boundary")),stop(){c||(d(),c=!0,f(),document.removeEventListener("visibilitychange",h),window.removeEventListener("pagehide",d),window.clearInterval(g),ae===v&&(ae=null))}};return ae=v,v}export{ce as startClientTelemetry};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Modal as e}from"./chunk-
|
|
1
|
+
import{Modal as e}from"./chunk-MIHPFJCP.js";import{keepsNativeMenu as a}from"./chunk-5QFPTDQF.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"}),
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{jsxs as r,jsx as e}from"react/jsx-runtime";function t({size:t=18,...i}){/* @__PURE__ */
|
|
2
|
+
return r("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...i,children:[
|
|
3
|
+
/* @__PURE__ */e("path",{d:"M9 4.5h6a1.5 1.5 0 0 1 1.5 1.5v12a1.5 1.5 0 0 1 -1.5 1.5h-6a1.5 1.5 0 0 1 -1.5 -1.5v-12a1.5 1.5 0 0 1 1.5 -1.5Z"}),
|
|
4
|
+
/* @__PURE__ */e("path",{d:"M5.25 12H2.25M3.75 10.5L2.25 12L3.75 13.5"}),
|
|
5
|
+
/* @__PURE__ */e("path",{d:"M18.75 12H21.75M20.25 10.5L21.75 12L20.25 13.5"})]})}export{t as ScrollExpandIcon};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{computeMaximizedBox as e,isSidebarStripReserved as t,boxFillsWorkArea as n,readAlwaysMaximizedFlag as r,WORK_AREA_CHANGED_EVENT as o,boxIsSnapped as i,squareCorners as a,scrollerIsFluid as s,growBoxToWidth as l,widthToFit as c,navIcons as d,snapZoneBox as u}from"./chunk-VIPNHDD3.js";import{reportBoundaryError as m}from"./chunk-KNUR2UEG.js";import{isStaleChunkError as h}from"./chunk-JDCM2VHG.js";import{Result as f}from"./chunk-PSVGB7KT.js";import{WindowInsetContext as p,NO_WINDOW_DRAG as w}from"./chunk-YI4T5I5D.js";import{CopyButton as g}from"./chunk-TJ5YMXVB.js";import{confirm as y}from"./chunk-OLXUMB2V.js";import{
|
|
1
|
+
import{computeMaximizedBox as e,isSidebarStripReserved as t,boxFillsWorkArea as n,readAlwaysMaximizedFlag as r,WORK_AREA_CHANGED_EVENT as o,boxIsSnapped as i,squareCorners as a,scrollerIsFluid as s,growBoxToWidth as l,widthToFit as c,navIcons as d,snapZoneBox as u}from"./chunk-VIPNHDD3.js";import{reportBoundaryError as m}from"./chunk-KNUR2UEG.js";import{isStaleChunkError as h}from"./chunk-JDCM2VHG.js";import{Result as f}from"./chunk-PSVGB7KT.js";import{WindowInsetContext as p,NO_WINDOW_DRAG as w}from"./chunk-YI4T5I5D.js";import{CopyButton as g}from"./chunk-TJ5YMXVB.js";import{confirm as y}from"./chunk-OLXUMB2V.js";import{undoReducer as v,emptyUndoState as b,sameValue as x,matchUndoHotkey as k}from"./chunk-ZLB5GRL6.js";import{useModalDragAside as E}from"./chunk-EIFNESXS.js";import{ItemCount as C}from"./chunk-PO2KNVCC.js";import{isInOverlayOver as M}from"./chunk-CJ4OEY3T.js";import{dialogA11y as S}from"./chunk-VWGWZY7A.js";import{ColoredBadge as L}from"./chunk-L2WQOJ3T.js";import{ROW_HEIGHTS as N}from"./chunk-5VJVEKVM.js";import{parseOption as z}from"./chunk-YPXONNBV.js";import{LoadingSpinner as T}from"./chunk-4PJFL26P.js";import{useShellAuth as A}from"./chunk-2QY5BJLA.js";import{useIsMobile as D,useIsPhone as P}from"./chunk-UGTRSRIW.js";import{useShellPrefs as I}from"./chunk-POBVGDZP.js";import{activationOrder as R,activeListeners as W,ModalActionsContext as $,subscribeActive as O,getActiveModalId as K,KEY_ACTIVATED_SELECTOR as j}from"./chunk-F3ZOO23R.js";import{DropdownMenu as F}from"./chunk-NJY4HPNB.js";import{focusableIn as B}from"./chunk-DWGYC7OD.js";import{StatusBadge as H}from"./chunk-ABIWAS5K.js";import{PopupMenu as Y,PopupMenuItem as q,PopupMenuDivider as U,PopupMenuLabel as V}from"./chunk-P56YLT73.js";import{Button_default as X}from"./chunk-37FQVY2O.js";import{Icon as G}from"./chunk-ISVODSRP.js";import{LoadingSpinner as J}from"./chunk-R2VKEMZH.js";import{createShellPortal as _}from"./chunk-5QRHQCRG.js";import{Z_LAYERS as Q}from"./chunk-62LW225J.js";import{shellHttp as Z,isShellHttpConfigured as ee}from"./chunk-STKJA4PV.js";import{fitBoxScale as te,fitFrameStyle as ne}from"./chunk-M6UKCZHT.js";import{UndoContext as re}from"./chunk-3AUPCKBR.js";import{buttonClasses as oe}from"./chunk-LYGIOJ3J.js";import{runEscapeInterceptors as ie}from"./chunk-TWVUQUUD.js";import{useShellStrings as ae}from"./chunk-NRHG4R2Q.js";import{createContext as se,createElement as le,useContext as ce,Component as de,useRef as ue,useLayoutEffect as me,useEffect as he,useState as fe,useSyncExternalStore as pe,useCallback as we,isValidElement as ge,Fragment as ye,Children as ve,cloneElement as be,useMemo as xe,useId as ke,useReducer as Ee,Suspense as Ce}from"react";import{jsxs as Me,jsx as Se,Fragment as Le}from"react/jsx-runtime";import{useLocation as Ne}from"react-router-dom";import{useQueryClient as ze,useQuery as Te}from"@tanstack/react-query";function Ae(e){return"component"in e}function De(e){return"endpoint"in e}var Pe={};function Ie(e){Pe=e}var Re=new Proxy({},{get:(e,t)=>Pe[t],has:(e,t)=>t in Pe,ownKeys:()=>Object.keys(Pe),getOwnPropertyDescriptor(e,t){if(t in Pe)return{configurable:!0,enumerable:!0,value:Pe[t]}}});function We(){return ee()}var $e=Z,Oe=se({});function Ke({value:e,children:t}){return le(Oe.Provider,{value:e},t)}function je(){return ce(Oe)}var Fe=se(null);function Be(){return ce(Fe)?.pageSearch??""}var He=null,Ye=/* @__PURE__ */new Set;function qe(e){He!==e&&(He=e,Ye.forEach(e=>e()))}function Ue(){return He}function Ve(e){return Ye.add(e),()=>{Ye.delete(e)}}var Xe=null;function Ge(e){Xe=e}function Je({error:e,onReload:t}){const n=h(e);/* @__PURE__ */
|
|
2
2
|
return Me("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 py-12 text-center",children:[
|
|
3
3
|
/* @__PURE__ */Se(G,{name:"warning",className:"h-8 w-8 text-amber-500",strokeWidth:1.5}),
|
|
4
4
|
/* @__PURE__ */Me("div",{className:"min-w-0",children:[
|
|
@@ -19,11 +19,11 @@ return Se("button",{onClick:()=>{const r=s?a.filter(n=>!(n.entityType===e&&n.ent
|
|
|
19
19
|
/* @__PURE__ */Se("div",{ref:l,"data-taskbar-preview":"",style:{position:"fixed",left:c.left,top:c.top,zIndex:Pt,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=Ct(e.id)??Tt(e.label),o=t?function(e){if(Dr(e))return null;const t=e.getBoundingClientRect(),n=Er(),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__ */
|
|
20
20
|
return Me("div",{className:"group flex flex-col items-center",onMouseEnter:()=>It(t),children:[!h&&/* @__PURE__ */Se("span",{className:f,children:e.label}),
|
|
21
21
|
/* @__PURE__ */Se(Wt,{id:e.id,label:e.label,maxW:240,maxH:160,titleAbove:!0,onClick:()=>n(e.id),onClose:()=>r(e.id)}),h&&/* @__PURE__ */Se("span",{className:f,children:e.label}),null!==o&&/* @__PURE__ */Me("span",{title:a.taskbar.offscreenHint,className:"mt-1 inline-flex items-center gap-1 rounded bg-amber-500 px-2 py-0.5 text-2xs font-semibold text-on-accent shadow-sm",children:[
|
|
22
|
-
/* @__PURE__ */Se(G,{name:"arrow-right",className:"h-3 w-3",style:{transform:`rotate(${o}deg)`},strokeWidth:3}),"Off screen"]})]},e.id)})}),document.body)}function Ot(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 Kt({openWindows:e,onRemove:t,onSplitView:n,onActivate:r,onActivateById:o}){const i=ae(),[a,s]=fe(null);he(()=>{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=pe(O,K),[,c]=fe(0);he(()=>{const e=()=>c(e=>e+1);return window.addEventListener("modal-geometry",e),window.addEventListener("resize",e),()=>{window.removeEventListener("modal-geometry",e),window.removeEventListener("resize",e)}},[]);const[,u]=fe(0);he(()=>{const e=()=>u(e=>e+1);return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[]);const m=e=>{const t=Tt(e),n=t?.querySelector("[data-window-title]");return n?.textContent?.trim()||e},[h,f]=fe(null),[p,w]=fe(null),[g,y]=fe(null),v=ue(null),
|
|
23
|
-
/* @__PURE__ */Me(Le,{children:[
|
|
24
|
-
return Me("button",{onClick:()=>o(r.id),onMouseEnter:t=>{return n=e.items,r=t.currentTarget,void(g||(v.current&&(clearTimeout(v.current),v.current=null),v.current=setTimeout(()=>{f(n),w(r)},350)));var n,r},onMouseLeave:
|
|
25
|
-
/* @__PURE__ */Se("span",{className:"truncate flex-1",children:s?e.label:m(r.label)}),c&&/* @__PURE__ */Se("span",{title:i.taskbar.offscreenDot,className:"shrink-0 h-1.5 w-1.5 rounded-full bg-amber-500"}),s&&/* @__PURE__ */Se(
|
|
26
|
-
/* @__PURE__ */Se("div",{className:"flex-1"}),
|
|
22
|
+
/* @__PURE__ */Se(G,{name:"arrow-right",className:"h-3 w-3",style:{transform:`rotate(${o}deg)`},strokeWidth:3}),"Off screen"]})]},e.id)})}),document.body)}function Ot(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 Kt({openWindows:e,onRemove:t,onSplitView:n,onActivate:r,onActivateById:o}){const i=ae(),[a,s]=fe(null);he(()=>{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=pe(O,K),[,c]=fe(0);he(()=>{const e=()=>c(e=>e+1);return window.addEventListener("modal-geometry",e),window.addEventListener("resize",e),()=>{window.removeEventListener("modal-geometry",e),window.removeEventListener("resize",e)}},[]);const[,u]=fe(0);he(()=>{const e=()=>u(e=>e+1);return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[]);const m=e=>{const t=Tt(e),n=t?.querySelector("[data-window-title]");return n?.textContent?.trim()||e},[h,f]=fe(null),[p,w]=fe(null),[g,y]=fe(null),v=ue(null),b=()=>{v.current&&(clearTimeout(v.current),v.current=null),v.current=setTimeout(()=>{f(null),w(null)},150)},x=e.filter(e=>!e.route||!Re[e.route]?.utility);if(!a||!a.isConnected||0===x.length)return null;const k=[],E=/* @__PURE__ */new Map;for(const e of x){const t=e.route?Re[e.route]:void 0,n=t?.taskbarGroup,r=n?.key??e.route??`entity:${e.id}`,o=E.get(r);if(void 0!==o)k[o].items.push(e);else{E.set(r,k.length);const o=n?.label??t?.label??e.label;k.push({key:r,route:n?.icon??e.route,label:o,items:[e]})}}return _(
|
|
23
|
+
/* @__PURE__ */Me(Le,{children:[k.map(e=>{const n=e.route?d[e.route]:null,r=e.items[e.items.length-1];let a=!1;if(l){const t=document.querySelector(`[data-modal-id="${l}"]`);if(t){const n=t.querySelector("[data-window-title]"),r=n?.textContent??"";a=e.items.some(e=>r.includes(e.label))}}const s=e.items.length>1,c=e.items.some(e=>{const t=Ct(e.id)??Tt(e.label);return!!t&&!Dr(t)});/* @__PURE__ */
|
|
24
|
+
return Me("button",{onClick:()=>o(r.id),onMouseEnter:t=>{return n=e.items,r=t.currentTarget,void(g||(v.current&&(clearTimeout(v.current),v.current=null),v.current=setTimeout(()=>{f(n),w(r)},350)));var n,r},onMouseLeave:b,onDoubleClick:e=>{e.stopPropagation(),window.dispatchEvent(new CustomEvent("modal-center",{detail:{windowKey:r.id,label:r.label}}))},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),v.current&&(clearTimeout(v.current),v.current=null),f(null),w(null),s?y({x:t.clientX,y:t.clientY,items:e.items,label:e.label}):window.dispatchEvent(new CustomEvent("modal-context-menu",{detail:{windowKey:r.id,label:r.label,x:t.clientX,y:t.clientY}}))},style:{width:"var(--window-tab-width, 200px)",fontSize:"var(--window-tab-font-size, 12px)"},"data-tab-group":e.key,className:"group relative flex items-center gap-2 rounded-lg px-3 py-2 font-medium transition-all min-w-0 shrink "+(a?"bg-blue-100/60 border border-blue-400/60 text-blue-700":"bg-gray-50/40 border border-gray-200/40 text-gray-700 hover:bg-gray-200/40"),children:[n&&ge(n)?be(n,{className:"h-3.5 w-3.5 shrink-0"}):/* @__PURE__ */Se(G,{name:"expand",className:"h-3.5 w-3.5 shrink-0",strokeWidth:2}),
|
|
25
|
+
/* @__PURE__ */Se("span",{className:"truncate flex-1",children:s?e.label:m(r.label)}),c&&/* @__PURE__ */Se("span",{title:i.taskbar.offscreenDot,className:"shrink-0 h-1.5 w-1.5 rounded-full bg-amber-500"}),s&&/* @__PURE__ */Se(C,{count:e.items.length,label:i.count.windows(e.items.length)}),!s&&/* @__PURE__ */Se("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__ */Se(G,{name:"close",className:"h-3 w-3",strokeWidth:2})})]},e.key)}),
|
|
26
|
+
/* @__PURE__ */Se("div",{className:"flex-1"}),x.length>=2&&/* @__PURE__ */Me("button",{onClick:n,title:i.taskbar.expose,className:"flex items-center gap-1 rounded px-2 py-1 text-2xs font-medium text-blue-600 border border-blue-300 hover:bg-accent-tint transition-colors shrink-0",children:[
|
|
27
27
|
/* @__PURE__ */Se(G,{name:"grid",className:"h-3 w-3",strokeWidth:2}),"Exposé"]}),g&&/* @__PURE__ */Me(Y,{portal:!0,minWidth:200,style:Ot(g.x,g.y),onClose:()=>y(null),children:[
|
|
28
28
|
/* @__PURE__ */Se(V,{children:g.label}),
|
|
29
29
|
/* @__PURE__ */Me(q,{onClick:()=>{y(null),g.items.forEach(e=>function(e){const t=nr.get(e);t&&vr(t)}(e.id))},children:[
|
|
@@ -32,18 +32,18 @@ return Me("button",{onClick:()=>o(r.id),onMouseEnter:t=>{return n=e.items,r=t.cu
|
|
|
32
32
|
/* @__PURE__ */Se("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */Se("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75h6.5v6.5h-6.5zM13.75 8.75h6.5v6.5h-6.5z"})}),i.taskbar.restoreAllWindows]}),
|
|
33
33
|
/* @__PURE__ */Se(U,{}),
|
|
34
34
|
/* @__PURE__ */Me(q,{danger:!0,onClick:()=>{y(null),g.items.forEach(e=>t(e.id))},children:[
|
|
35
|
-
/* @__PURE__ */Se(G,{name:"close",className:"h-4 w-4",strokeWidth:2}),`${i.taskbar.closeAllWindows} (${g.items.length})`]})]}),h&&p&&/* @__PURE__ */Se($t,{items:h,anchorEl:p,onActivate:e=>{o(e),f(null),w(null)},onClose:e=>{t(e),f(null),w(null)},onMouseEnter:()=>{v.current&&(clearTimeout(v.current),v.current=null)},onMouseLeave:
|
|
35
|
+
/* @__PURE__ */Se(G,{name:"close",className:"h-4 w-4",strokeWidth:2}),`${i.taskbar.closeAllWindows} (${g.items.length})`]})]}),h&&p&&/* @__PURE__ */Se($t,{items:h,anchorEl:p,onActivate:e=>{o(e),f(null),w(null)},onClose:e=>{t(e),f(null),w(null)},onMouseEnter:()=>{v.current&&(clearTimeout(v.current),v.current=null)},onMouseLeave:b})]}),a)}var jt=["/login","/forgot-password","/reset-password","/force-change-password"];function Ft({children:e,windowAccentForRoute:t}){const n=Ne(),r=jt.some(e=>n.pathname.startsWith(e)),[o,i]=fe([]),a=ue(o);me(()=>{a.current=o},[o]);const s=pe(Ve,Ue,Ue),l=ue(/* @__PURE__ */new Map),c=e=>{const t=nt(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};he(()=>{Nt.clear();for(const e of o)e.route&&Nt.set(e.id,e.route)},[o]);const d=we(e=>{i(t=>t.filter(t=>t.id!==e))},[]),u=we(e=>{var t;Ct(e)||Mt(e)?(t=e,window.dispatchEvent(new CustomEvent(Qr,{detail:{windowKey:t}}))):d(e)},[d]),m=(e,t=!1)=>{const n=_n;t&&xt.add(e),setTimeout(()=>{const r=Ct(e)??Mt(e),o=r?.getAttribute("data-modal-id");var i,a;!o||(i=o,a=n,(Qn.get(i)??-1)>a)||yr(o),t&&xt.delete(e)},50)},h=(e,t,n)=>{const r=Xe;if(n||!r)return[...e,t];const o=function(e,t,n){if(!nt(t))return e.length;if(t.shellOwned&&ot(t,n.home))return 0;const r=ot(t,n.home)?void 0:rt(t)?.key;if(r){let t=-1;if(e.forEach((e,o)=>{nt(e)&&!ot(e,n.home)&&rt(e)?.key===r&&(t=o)}),t>=0)return t+1}if("page"===t.type&&t.route&&!ot(t,n.home)&&n.favorites.includes(t.route))return e.length>0&&ot(e[0],n.home)?1:0;const o=t.openedFrom?e.findIndex(e=>e.id===t.openedFrom):-1;if(o>=0){const t=/* @__PURE__ */new Set([e[o].id]);let r=o+1;for(;r<e.length&&e[r].openedFrom&&t.has(e[r].openedFrom);)t.add(e[r].id),r++;const i=t=>nt(e[t])&&!ot(e[t],n.home)?rt(e[t])?.key:void 0;for(;r>0&&r<e.length&&void 0!==i(r)&&i(r)===i(r-1);)r++;return r}return e.length}(e,t,{home:Ue(),favorites:r.favorites});return[...e.slice(0,o),t,...e.slice(o)]},f=we(e=>{i(t=>function(e,t){const n=new Set(t),r=new Map(e.map(e=>[e.id,e])),o=t.map(e=>r.get(e)).filter(e=>!!e);if(o.length!==n.size)return e;let i=0;const a=e.map(e=>n.has(e.id)?o[i++]:e);return a.every((t,n)=>t===e[n])?e:a}(t,e))},[]),p=we((e,t,n,r,o,a={})=>{if(!Re[e]||!De(Re[e]))return;const s=`${e}:${t}`,l=Lt();i(i=>{const c=i.find(n=>n.entityType===e&&String(n.entityId)===String(t));return c?(m(c.id),i):(m(s,!0),h(i,{id:s,type:"modal",label:r||t,route:o||window.location.pathname,entityType:e,entityId:t,entitySnapshot:st(n),openedFrom:l},!!a.append))})},[]),w=we((e,t={})=>{if(!Re[e]||!Ae(Re[e]))return;const n=Re[e],{reuse:r=!1,background:o=!1,shellOwned:s,search:l,append:c=!1}=t,d=e=>{var t;o?(t=e,sr.add(t)):m(e)};if(n.widget){const t=a.current.find(t=>"page"===t.type&&t.route===e);if(t)return void u(t.id)}const f=Lt();i(t=>{if(n.multiInstance){const i=t.filter(t=>"page"===t.type&&t.route===e);if(s&&i.length>0)return t;if(r&&!l&&i.length>0)return o||m(i[i.length-1].id),t;const a=`page:${e}:${Math.random().toString(36).slice(2,8)}`;return d(a),h(t,{id:a,type:"page",label:n.label,route:e,openedFrom:f,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}},c)}const i=t.find(t=>"page"===t.type&&t.route===e);if(i)return n.widget?t:(o||m(i.id),l&&i.pageSearch!==l?t.map(e=>e===i?{...e,pageSearch:l}:e):t);const a=`page:${e}`;return d(a),h(t,{id:a,type:"page",label:n.label,route:e,openedFrom:f,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}},c)})},[u]),g=we(()=>{},[]),y=we(()=>{},[]),v=u,b=u;/* @__PURE__ */
|
|
36
36
|
return Me(ht.Provider,{value:{openWindows:o,openEntity:p,openPage:w,reorderWindows:f,closeEntity:v,minimize:g,items:[],openItems:o,restore:y,remove:b,restoreIfMinimized:()=>!1},children:[e,
|
|
37
37
|
/* @__PURE__ */Se(Kt,{openWindows:o,onRemove:u,onSplitView:vo,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&&yr(e)}})},onActivateById:St}),
|
|
38
38
|
/* @__PURE__ */Se(bo,{}),!r&&o.map(e=>{const n=e.route?t?.(e.route):void 0;
|
|
39
39
|
/* @__PURE__ */
|
|
40
|
-
return Se(Fe.Provider,{value:c(e),children:/* @__PURE__ */Se(_e,{fallback:(t,n)=>/* @__PURE__ */Se(xo,{open:!0,onClose:()=>d(e.id),title:e.label,size:"md",autoHeight:!0,windowKey:e.id,children:/* @__PURE__ */Se(Je,{error:t,onReload:n})}),children:/* @__PURE__ */Se(yn,{spec:yt(e),children:/* @__PURE__ */Se(Co,{windowId:e.id,children:"page"===e.type?/* @__PURE__ */Se(vt,{item:e,onClose:()=>d(e.id),accentRgb:n}):/* @__PURE__ */Se(Et,{item:e,onClose:()=>d(e.id),onMinimize:()=>{},accentRgb:n})})})})},e.id)})]})}var Bt=400;function Ht({panelRef:e,bodyRef:t,open:n,widget:r,active:o,minimized:i}){const a=ue(null),s=ue(!1);n&&!s.current&&(a.current="undefined"==typeof document?null:document.activeElement),s.current=n;const l=ue(!1),c=ue(void 0),d=ue(i),u=d.current&&!i;d.current=i;const m=()=>{l.current=!0,clearTimeout(c.current),c.current=setTimeout(()=>{l.current=!1},Bt)};he(()=>{n&&!r&&m()},[n,r]),he(()=>{u&&n&&!r&&m()},[u]),he(()=>()=>clearTimeout(c.current),[]),he(()=>{if(!n||r||!o||i||!l.current)return;l.current=!1;const a=e.current;if(!a||a.contains(document.activeElement))return;if(document.activeElement?.closest('[aria-modal="true"]'))return;const s=t.current?B(t.current)[0]:void 0;s?s.focus():(a.hasAttribute("tabindex")||a.setAttribute("tabindex","-1"),a.focus())},[n,r,o,i,e,t]),me(()=>{if(!n||r)return;const t=e.current;return()=>{const e=a.current,n=document.activeElement;(!n||n===document.body||!!t?.contains(n))&&e&&e.isConnected&&!t?.contains(e)&&e.focus?.()}},[n,r,e])}var Yt=null,qt=/* @__PURE__ */new Set;function Ut(){return Yt}function Vt(e){if(Yt!==e){Yt=e;for(const e of qt)e()}}function Xt(e){return qt.add(e),()=>{qt.delete(e)}}var Gt=!1,Jt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},_t=()=>{};function Qt(e){Gt=e,Jt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0}}function Zt(e,t){Gt&&("submenu"===e?Jt.submenus++:Jt.menus++,Jt.menuKey=t)}function en(e){if(!Gt)return _t;const t=performance.now();let n=!1;return()=>{if(n)return;if(n=!0,!Gt)return;const r=performance.now()-t;"move"===e?Jt.moveMs+=r:Jt.resizeMs+=r}}function tn(){const e=Jt;return Jt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},e}var nn=/* @__PURE__ */new Set([H,
|
|
40
|
+
return Se(Fe.Provider,{value:c(e),children:/* @__PURE__ */Se(_e,{fallback:(t,n)=>/* @__PURE__ */Se(xo,{open:!0,onClose:()=>d(e.id),title:e.label,size:"md",autoHeight:!0,windowKey:e.id,children:/* @__PURE__ */Se(Je,{error:t,onReload:n})}),children:/* @__PURE__ */Se(yn,{spec:yt(e),children:/* @__PURE__ */Se(Co,{windowId:e.id,children:"page"===e.type?/* @__PURE__ */Se(vt,{item:e,onClose:()=>d(e.id),accentRgb:n}):/* @__PURE__ */Se(Et,{item:e,onClose:()=>d(e.id),onMinimize:()=>{},accentRgb:n})})})})},e.id)})]})}var Bt=400;function Ht({panelRef:e,bodyRef:t,open:n,widget:r,active:o,minimized:i}){const a=ue(null),s=ue(!1);n&&!s.current&&(a.current="undefined"==typeof document?null:document.activeElement),s.current=n;const l=ue(!1),c=ue(void 0),d=ue(i),u=d.current&&!i;d.current=i;const m=()=>{l.current=!0,clearTimeout(c.current),c.current=setTimeout(()=>{l.current=!1},Bt)};he(()=>{n&&!r&&m()},[n,r]),he(()=>{u&&n&&!r&&m()},[u]),he(()=>()=>clearTimeout(c.current),[]),he(()=>{if(!n||r||!o||i||!l.current)return;l.current=!1;const a=e.current;if(!a||a.contains(document.activeElement))return;if(document.activeElement?.closest('[aria-modal="true"]'))return;const s=t.current?B(t.current)[0]:void 0;s?s.focus():(a.hasAttribute("tabindex")||a.setAttribute("tabindex","-1"),a.focus())},[n,r,o,i,e,t]),me(()=>{if(!n||r)return;const t=e.current;return()=>{const e=a.current,n=document.activeElement;(!n||n===document.body||!!t?.contains(n))&&e&&e.isConnected&&!t?.contains(e)&&e.focus?.()}},[n,r,e])}var Yt=null,qt=/* @__PURE__ */new Set;function Ut(){return Yt}function Vt(e){if(Yt!==e){Yt=e;for(const e of qt)e()}}function Xt(e){return qt.add(e),()=>{qt.delete(e)}}var Gt=!1,Jt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},_t=()=>{};function Qt(e){Gt=e,Jt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0}}function Zt(e,t){Gt&&("submenu"===e?Jt.submenus++:Jt.menus++,Jt.menuKey=t)}function en(e){if(!Gt)return _t;const t=performance.now();let n=!1;return()=>{if(n)return;if(n=!0,!Gt)return;const r=performance.now()-t;"move"===e?Jt.moveMs+=r:Jt.resizeMs+=r}}function tn(){const e=Jt;return Jt={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},e}var nn=/* @__PURE__ */new Set([H,L]),rn=e=>nn.has(e)||"function"==typeof e&&"badge"===e.titleRole,on=/* @__PURE__ */new Set(["button","a","input","select","textarea","kbd"]),an=/* @__PURE__ */new Set(["svg"]);function sn(e){const t=[],n={text:"",accessories:[],badges:[],actions:[]};return ln(e,n,t),n.text=t.join("").replace(/\s+/g," ").trim(),n}function ln(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=>ln(e,t,n));if(!ge(e))return;const r=e;if(r.type===g)return void(void 0===t.copy&&"string"==typeof r.props.text&&r.props.text&&(t.copy=r.props.text));if(r.type===ye)return void ve.toArray(r.props.children).forEach(e=>ln(e,t,n));if("string"==typeof r.type){if(an.has(r.type))return;if(!on.has(r.type))return n.push(" "),ve.toArray(r.props.children).forEach(e=>ln(e,t,n)),void n.push(" ")}const o=be(r,{key:`title-part-${t.accessories.length}`});t.accessories.push(o),(rn(r.type)?t.badges:t.actions).push(o)}var cn=/* @__PURE__ */new Map,dn=/* @__PURE__ */new Set,un=0;function mn(){un++,dn.forEach(e=>e())}function hn(e){return cn.get(e)}function fn(e){return dn.add(e),()=>{dn.delete(e)}}function pn(){return un}var wn=se(""),gn=se(null);function yn({spec:e,children:t}){/* @__PURE__ */
|
|
41
41
|
return Se(gn.Provider,{value:e,children:t})}var vn=/* @__PURE__ */new Set(["button","input","textarea","select","kbd","svg"]),bn='button[type="submit"], button[data-submit], button.btn-submit, button.bg-green-600, button.bg-blue-600';function xn(e){return kn(e).replace(/\s+/g," ").trim()}function kn(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(kn).join("");if(ge(e)){const t=e,n="string"==typeof t.type?t.type:"";return vn.has(n)?"":` ${kn(t.props?.children)} `}return""}function En(e){const t=ce(wn);he(()=>{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 Cn={};function Mn(e,t,n){const r=ce(wn);he(()=>{if(!r)return;Cn[r]||(Cn[r]=[]);const o={label:e,icon:n,onClick:t};return Cn[r].push(o),()=>{Cn[r]=(Cn[r]||[]).filter(e=>e!==o)}},[r,e,t,n])}function Sn({title:e}){const t=ue(null);return he(()=>{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__ */Se("span",{ref:t,style:{display:"none"},"aria-hidden":"true"})}function Ln(e){}function Nn(){return ce(wn)}function zn({className:e=""}){const t=ce($)?.setEditSlot,n=we(e=>{t?.(e)},[t]);return t?/* @__PURE__ */Se("span",{ref:n,"data-window-edit-slot":"",className:`inline-flex items-center empty:hidden ${e}`.trim()}):null}function Tn({items:e,label:t}){const n=ae().window.more;return 0===e.length?null:/* @__PURE__ */Se(F,{side:"top",items:e,triggerClassName:oe({variant:"secondary",size:"sm"}),trigger:/* @__PURE__ */Me(Le,{children:[t??n,
|
|
42
42
|
/* @__PURE__ */Se(G,{name:"chevron-down",className:"size-3.5",strokeWidth:2,"aria-hidden":"true"})]})})}function An({children:e,position:t="right",quiet:n=!1}){const r=ce($),[o,i]=fe(null);return he(()=>{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?_(e,o):null}function Dn({onClick:e,children:t,className:n}){const r=ce($);/* @__PURE__ */
|
|
43
43
|
return Se("button",{type:"button",onClick:async()=>{if(r?.isDirty){const{confirm:e}=await(import("./shell/ConfirmDialog.js"));if(!await e({title:"Discard changes?",message:"You have unsaved changes. Are you sure you want to cancel? All changes will be lost.",confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"}))return}e()},className:n||"bg-white text-gray-700 border border-gray-300 px-4 py-2 text-sm font-medium rounded-lg hover:bg-gray-50",children:t||"Cancel"})}var Pn="erp_window_positions",In={};try{const e=localStorage.getItem(Pn);e&&(In=JSON.parse(e))}catch{}var Rn=null;function Wn(){Rn&&clearTimeout(Rn),Rn=setTimeout(()=>{try{localStorage.setItem(Pn,JSON.stringify(In))}catch{}},500)}var $n="erp_activation_order",On=[];try{const e=localStorage.getItem($n),t=e?JSON.parse(e):null;Array.isArray(t)&&t.every(e=>"string"==typeof e)&&(On=t)}catch{}var Kn=null;function jn(){Kn&&clearTimeout(Kn),Kn=setTimeout(()=>{try{localStorage.setItem($n,JSON.stringify(On))}catch{}},500)}function Fn(e,t){In[e]||(In[e]=t,Wn())}function Bn(e){return In[e]?{...In[e]}:null}function Hn(e,t){In[e]=t,Wn()}function Yn(){const r=e(),o=t();let i=!1;for(const e of Object.keys(In))n(In[e],r,o)&&(delete In[e],i=!0);i&&Wn()}var qn={sm:384,md:512,lg:672,xl:896,"2xl":1152,"3xl":1408},Un=4e3,Vn=["small","medium","large","maximized"],Xn=()=>{if("undefined"==typeof document)return"large";const e=getComputedStyle(document.documentElement).getPropertyValue("--default-window-size")?.trim();return z(Vn,"large",e)},Gn={small:.8,medium:1,large:1.25,maximized:1.25},Jn=/* @__PURE__ */new Set,_n=0,Qn=/* @__PURE__ */new Map;var Zn=0;function er(){return Zn}function tr(){Zn++,W.forEach(e=>e())}var nr=/* @__PURE__ */new Map,rr=/* @__PURE__ */new Map,or=/* @__PURE__ */new Map;function ir(){for(let e=R.length-1;e>=0;e--){const t=or.get(R[e]);if(t?.tab)return t.owner}return null}function ar(){return pe(O,ir,()=>null)}var sr=/* @__PURE__ */new Set;var lr=null;function cr(e){lr=null,yr(e)}function dr(e){lr=e;const t=nr.get(e);t&&cr(t)}var ur=/* @__PURE__ */new Map;function mr(e){return ur.get(e)?.holdsChanges()??!1}function hr(e){const t=ur.get(e);return t?t.ask():Promise.resolve(!0)}function fr(e){lr===e&&(lr=null)}function pr(e,t,n){if(n&&or.set(e,n),t)if(nr.set(t,e),rr.set(e,t),sr.delete(t)){R.unshift(e);const n=On.indexOf(t);-1!==n&&On.splice(n,1),On.unshift(t),jn()}else!function(e,t){const n=On.indexOf(t);if(-1===n)return void R.push(e);let r=R.length;for(let e=0;e<R.length;e++){const t=rr.get(R[e]);if(t&&On.indexOf(t)>n){r=e;break}}R.splice(r,0,e)}(e,t),-1===On.indexOf(t)&&(On.push(t),jn());else R.push(e);tr(),window.dispatchEvent(new CustomEvent("modal-reorder")),t&&lr===t&&cr(e)}function wr(e){return e?or.get(e)?.owner??rr.get(e)??null:null}var gr=/* @__PURE__ */new Set;function yr(e){const t=wr(K()),n=R.indexOf(e);-1!==n&&R.splice(n,1),R.push(e);const r=or.get(e);if(r?.root)for(const[e,t]of or){if(t.root||t.owner!==r.owner||Jn.has(e))continue;const n=R.indexOf(e);-1!==n&&R.splice(n,1),R.push(e)}Jn.delete(e);const o=rr.get(e);if(o){const e=On.indexOf(o);-1!==e&&On.splice(e,1),On.push(o),jn(),lr&&lr!==o&&(lr=null)}tr(),window.dispatchEvent(new CustomEvent("modal-reorder"));const i=wr(K());i&&i!==t&&gr.forEach(e=>e(i))}function vr(e){const t=R.indexOf(e);-1!==t&&R.splice(t,1),Jn.add(e),Qn.set(e,++_n);const n=rr.get(e);if(n){const e=On.indexOf(n);-1!==e&&(On.splice(e,1),jn())}tr(),window.dispatchEvent(new CustomEvent("modal-reorder"))}var br=/* @__PURE__ */new Set;var xr=8,kr=32;function Er(){return e()}var Cr="flex size-6 shrink-0 items-center justify-center rounded-full focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400",Mr="flex size-3 items-center justify-center rounded-full text-gray-900/70",Sr="size-2 opacity-0 group-hover/controls:opacity-100 group-focus-within/controls:opacity-100",Lr=N.windowBar,Nr=80,zr=384,Tr=400;function Ar(e,t=Er()){const n=Math.min(Math.max(e.x,t.x+Nr-e.w),t.x+t.w-Nr),r=Math.min(Math.max(e.y,t.y),t.y+t.h-Lr);return n===e.x&&r===e.y?e:{...e,x:n,y:r}}function Dr(e){const t=e.getBoundingClientRect();if(0===t.width||0===t.height)return!0;const n=Er();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 Pr(e){return u(e,Er())}var Ir=/* @__PURE__ */new Map,Rr=0,Wr=/* @__PURE__ */new Set;function $r(e,t){const n=Ir.get(e);t&&n&&n.x===t.x&&n.y===t.y&&n.w===t.w&&n.h===t.h||(t||n)&&(t?Ir.set(e,{x:t.x,y:t.y,w:t.w,h:t.h}):Ir.delete(e),Rr+=1,Wr.forEach(e=>e()))}function Or(e){return Wr.add(e),()=>{Wr.delete(e)}}var Kr=()=>Rr;var jr=null;function Fr(e){const t=(jr||((jr=document.createElement("div")).style.cssText=["position: fixed","pointer-events: none",`z-index: ${Q.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(jr)),jr);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 Br(){jr&&(jr.style.opacity="0",jr.style.display="none")}var Hr=[{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"}],Yr=350,qr=200;function Ur({maximized:e,onToggleMax:t,onSnap:n,buttonClassName:r,strings:o,children:i}){const[a,s]=fe(!1),l=ue(void 0),c=ue(void 0);he(()=>()=>{clearTimeout(l.current),clearTimeout(c.current)},[]);const d=()=>{clearTimeout(c.current),l.current=setTimeout(()=>s(!0),Yr)},u=()=>{clearTimeout(l.current),c.current=setTimeout(()=>s(!1),qr)};/* @__PURE__ */
|
|
44
44
|
return Me("span",{className:"relative inline-flex",onMouseEnter:d,onMouseLeave:u,children:[
|
|
45
45
|
/* @__PURE__ */Se("button",{onClick:t,onFocus:d,onBlur:u,"aria-label":e?o.windowed:o.maximize,title:e?o.windowed:o.maximize,className:r,children:i}),a&&/* @__PURE__ */Se("div",{role:"group","aria-label":o.snapLayouts,onMouseEnter:()=>clearTimeout(c.current),onMouseLeave:u,className:"absolute left-0 top-full z-30 mt-1 grid w-max grid-cols-2 gap-1 rounded-lg border border-line bg-surface p-2 shadow-lg",children:Hr.map(({zone:e,labelKey:t,region:r})=>/* @__PURE__ */Se("button",{type:"button","aria-label":o[t],title:o[t],onClick:()=>{s(!1),n(e)},onFocus:()=>clearTimeout(c.current),onBlur:u,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__ */Se("span",{"aria-hidden":"true",className:`absolute rounded-sm bg-blue-500/70 ${r}`,style:{margin:2}})},e))})]})}var Vr="rosh-gesture-style";var Xr={se:"nwse-resize",nw:"nwse-resize",sw:"nesw-resize",ne:"nesw-resize",n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize"},Gr=4;function Jr(e,t,n,r){!function(){if("undefined"==typeof document||document.getElementById(Vr))return;const e=document.createElement("style");e.id=Vr,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=en(r);let a=!1;return()=>{if(!a){a=!0,i();try{e.releasePointerCapture(t)}catch{}o.remove(),document.body.classList.remove("rosh-gesturing")}}}function _r(e){const t=R.indexOf(e);if(-1===t)return-1;const n=Q.window+t*Q.windowStep,r=or.get(e);if(!r||r.root)return n;let o=-1;for(const[e,t]of or){if(!t.root||t.owner!==r.owner)continue;const n=R.indexOf(e);-1!==n&&(o=Math.max(o,Q.window+n*Q.windowStep))}return o>=n?o+2+Math.min(t,7):n}"undefined"!=typeof window&&window.addEventListener("deactivate-all-modals",function(){for(let e=R.length-1;e>=0;e--)br.has(R[e])||R.splice(e,1);On=On.filter(e=>{const t=nr.get(e);return null!=t&&br.has(t)}),jn(),tr(),window.dispatchEvent(new CustomEvent("modal-reorder"))});var Qr="modal-close-request";function Zr(e){pe(O,er);const t=ce($);if(R.length<=1)return!0;if(e){const t=nr.get(e);if(null!=t)return K()===t}return t?.active??null!=K()}var eo=!1,to=/* @__PURE__ */new Set;function no(e){return to.add(e),()=>to.delete(e)}function ro(){return eo}function oo(e){eo!==e&&(eo=e,to.forEach(e=>e()))}function io(){oo(!eo)}function ao(){oo(!1)}var so=null,lo=/* @__PURE__ */new Set;function co(e){return lo.add(e),()=>lo.delete(e)}function uo(){return so}function mo(e){so!==e&&(so=e,lo.forEach(e=>e()))}var ho=null,fo=/* @__PURE__ */new Set;function po(e){return fo.add(e),()=>fo.delete(e)}function wo(){return ho}function go(e){ho!==e&&(ho=e,fo.forEach(e=>e()))}function yo(){if(!ho)return void oo(!1);mo(ho),go(null),oo(!1)}function vo(){oo(!eo),window.dispatchEvent(new CustomEvent("modal-split-view"))}function bo(){const e=pe(no,ro),[t,n]=fe(e),[r,o]=fe(e);return he(()=>{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?_(
|
|
46
|
-
/* @__PURE__ */Se("div",{onMouseDown:e=>{e.stopPropagation(),oo(!1)},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",zIndex:Q.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 xo({open:t,onClose:d,title:u,icon:m,copyText:h,size:f="lg",dirty:g=!1,onNext:b,onPrev:E,footer:C,bodyScroll:M,onMinimize:S,initialBox:L,actions:z,actionsLeft:T,editing:A=!1,edit:W,allowPinOnTop:F,initialPosition:B,widget:H,compact:V,appStyle:J,flushBody:Z,autoHeight:ee,autoMinHeight:ne,autoWidth:re,widgetMenu:oe,dimensions:se,windowKey:le,openedFromKey:de,accentRgb:ge,children:ye}){const[ve,be]=fe(()=>r()),Ee=D()&&!ve,Ce=P()&&!!H,[Ne,ze]=fe(0),[Te,Ae]=fe(!1),De=ue(null),Pe=ue(0);he(()=>{Pe.current=Ne},[Ne]);const Ie=we(e=>{Ee&&(De.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},Ae(!0),Vt(de??null))},[Ee,de]),Re=pe(Xt,Ut);he(()=>{if(!Te)return;const e=e=>{if(!De.current)return;const t=e.clientX-De.current.startX;if(Math.abs(e.clientY-De.current.startY)>Math.abs(t)+12)return De.current=null,Ae(!1),ze(0),void Vt(null);ze(Math.max(0,t))},t=()=>{if(!De.current)return;const e=.3*window.innerWidth,t=Pe.current>e;De.current=null,Ae(!1),t?(ze(window.innerWidth),setTimeout(()=>{d(),ze(0),Vt(null)},180)):(ze(0),Vt(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)}},[Te]);const[We,$e]=fe(u),Oe=ae(),Ke=Oe.window;he(()=>{$e(u)},[u]);const je=xe(()=>xn(We).trim()||void 0,[We]),Be=ke(),[He,Ye]=fe(!1),qe=ue(!1),[Ue,Ve]=fe(!1),[Xe,Ge]=fe(null),Je=ce(gn),Qe=ce(Fe),{prefs:Ze,save:et}=I(),tt=!!Ze.window_accent_stripe,nt=Ze.favorite_documents||[],rt=!!Je&&nt.some(e=>e.entityType===Je.entityType&&e.entityId===Je.entityId),ot=we(()=>{if(!Je)return;const e=rt?nt.filter(e=>!(e.entityType===Je.entityType&&e.entityId===Je.entityId)):[...nt,{entityType:Je.entityType,entityId:Je.entityId,label:Je.label}];et({favorite_documents:e})},[Je,rt,nt,et]),[it,at]=fe(null),[st,lt]=fe("top-right"===B?"right":"left"),ct=ue(!1),dt=ue(null);me(()=>{const e=dt.current;e&&(ge?e.style.setProperty("--window-accent-rgb",ge):e.style.removeProperty("--window-accent-rgb"))},[ge]);const ut=ue(!1),mt=ue(null),ht=ue(null),ft=ue(null),[wt,yt]=fe(!1),vt=ue(null),bt=ue(null),xt=ue(null),[kt,Et]=fe(!1);me(()=>{const e=bt.current,t=xt.current;if(!e||!t)return;const n=()=>Et(function(e,t){return e.scrollWidth>t.clientWidth}(t,e));if(n(),"undefined"==typeof ResizeObserver)return;const r=new ResizeObserver(n);return r.observe(e),r.observe(t),()=>r.disconnect()},[null!=C&&!1!==C]);const Ct=!!W&&!H&&!V&&!J&&(W.editing||"hidden"!==W.state),[Mt,St]=fe(null),Lt=Ct&&(!!W?.editing||!Mt),Nt=!!(C||z||T)||wt||Lt,zt=""!==ce(wn),Tt=ue(null);Tt.current=Qe?{owner:Qe.key,tab:Qe.tab,root:!zt}:null;const At=le||(Qe&&!zt?Qe.key:null),Dt=40,{minimize:Pt,items:It,restoreIfMinimized:Rt,openWindows:Wt}=gt(),$t=ue(`modal-${Math.random().toString(36).slice(2,8)}`).current,Ot=v($t);he(()=>{if(H)return br.add($t),()=>{br.delete($t)}},[H,$t]),he(()=>{const e=e=>{const t=e.detail;t?.id===$t&&$e(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[$t]);const[Kt,jt]=fe(Q.window),Ft=function(e){const t=pe(O,K);return R.length<=1||t===e}($t),Bt=ue(W);Bt.current=W;const Yt=!!W&&!W.editing&&"enabled"===W.state;he(()=>{if(!t||!Ft||!Yt)return;const e=e=>{("KeyE"===e.code||"E"===e.key||"e"===e.key)&&e.altKey&&e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(x(e.target,dt.current)||(e.preventDefault(),e.stopPropagation(),Bt.current?.onEdit()))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Ft,Yt]);const qt=function(e){return pe(O,()=>Jn.has(e))}($t);Ht({panelRef:dt,bodyRef:mt,open:t,widget:!!H,active:Ft,minimized:qt});const Gt=pe(no,ro),Jt=pe(co,uo),_t=pe(po,wo),Qt=!F&&!H,Zt=Gt&&Qt,[en,tn]=fe(!1),nn=Zt&&_t===$t,[rn,on]=fe(!1),an=rn&&Qt&&Jt===$t?"picked":null,ln=ue(Zt);he(()=>{if(ln.current&&!Zt){on(!0);const e=setTimeout(()=>{on(!1),so===$t&&mo(null)},700);return ln.current=Zt,()=>clearTimeout(e)}ln.current=Zt},[Zt,$t]),he(()=>{Zt||tn(!1)},[Zt]),he(()=>{const e=ht.current,t=ft.current;if(!e&&!t)return;const n=e=>e?Array.from(e.children).filter(e=>"shell"!==e.dataset.undoControls).length:0,r=()=>yt(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]),he(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&dt.current){const t=dt.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=ht.current,n=ft.current;return t&&t.addEventListener("click",e),n&&n.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e),n&&n.removeEventListener("click",e)}},[t]);const dn=ue(!1),un=we(e,[]),hn=we(()=>{const t=e(),n=se?se[0]:qn[f]||672,o=t.w-80,i=t.h-80,a=Math.min(n,o),s=Gn[Xn()],l=se?Math.min(se[1],i):(()=>{const e=("sm"===f?500:"md"===f?600:"lg"===f?700:"xl"===f?800:920)*s;return Math.max(320,Math.min(e,t.h-80))})(),c="cascade"!==(getComputedStyle(document.documentElement).getPropertyValue("--window-position")?.trim()||"cascade")||r()?0:30*(R.length-1),d=Math.max(Dt,(i-l)/2),u=(o-a)/2,m=t.h-Dt-l-d;return"top-right"===B?{x:t.x+t.w-a-Dt,y:t.y+Dt,w:a,h:l}:"top-left"===B?{x:t.x+Dt,y:t.y+Dt,w:a,h:l}:{x:t.x+Math.max(Dt,(o-a)/2+Dt)+Math.min(c,Math.max(0,u)),y:t.y+d+Math.min(c,Math.max(0,m)),w:a,h:l}},[f]),fn=ue(!1);t||(fn.current=!1);const pn=le||h||null;he(()=>{if(!t)return;pr($t,pn,Tt.current??void 0),le||yr($t),dn.current=!1,jt(_r($t));const e=()=>{jt(_r($t))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===le;if(!e.label)return!1;const t=dt.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if(yr($t),Tn.current)return;const t=Er(),n=Math.min(On.current.w,t.w-40),o=Math.min(On.current.h,t.h-40),i=t.x+(t.w-n)/2,a=t.y+(t.h-o)/2;kn({x:i,y:a,w:n,h:o}),$n(!1)},i=e=>{const t=e.detail;r(t)&&(yr($t),Ge({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==le)return;yr($t);const t=On.current,n=function(e,t=Er()){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=dt.current,o="function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(r&&!o){let e=!1;const t=()=>{e||(e=!0,r.style.transition="",window.dispatchEvent(new CustomEvent("modal-geometry")))};r.style.transition="left .28s ease, top .28s ease, width .28s ease, height .28s ease",r.addEventListener("transitionend",t,{once:!0}),window.setTimeout(t,400)}kn(n)};return window.addEventListener("modal-reorder",e),window.addEventListener("modal-split-view",n),window.addEventListener("modal-center",o),window.addEventListener("modal-reveal",a),window.addEventListener("modal-context-menu",i),()=>{!function(e){const t=R.indexOf(e);-1!==t&&(R.splice(t,1),tr()),Jn.delete(e),Qn.delete(e),or.delete(e);const n=rr.get(e);n&&(rr.delete(e),nr.delete(n))}($t),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,$t,pn,un]);const yn=!H&&"maximized"===Xn(),[vn,kn]=fe(()=>{if(pn&&In[pn]){const e={...In[pn]};return se&&(e.w=se[0],ee||(e.h=se[1])),Ar(e)}return L?{x:L.x,y:L.y,w:L.w,h:L.h}:yn?un():hn()}),[En,Mn]=fe(()=>!ee),Sn=ue(ve),Ln=ue(null);he(()=>{const e=()=>{const e=r();e!==Sn.current&&Ln.current?.(e),Sn.current=e,be(e),jt(_r($t))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[$t]);const Nn=ve&&!!Qe?.tab&&!zt&&!H&&!Ee,zn=Nn,Tn=ue(zn);Tn.current=zn;const An=ar(),Dn=ve&&!!Qe?.tab&&!H&&!Ee&&!Gt&&An!==Qe.key,Pn=!!H&&ve&&!Gt&&null!==An,[Rn,$n]=fe(()=>pn&&In[pn]||L?zn:zn||yn),On=ue(vn);On.current=vn;const Kn=ue(Rn);me(()=>{Kn.current=Rn},[Rn]),me(()=>{if(En||Nn)return;const e=dt.current,t=mt.current;if(!e||!t)return;const n=ne??(H?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,m=t.style.overflowY,h=t.style.height;t.style.flex="0 0 auto",t.style.height="auto",t.style.overflowY="visible";const f=t.offsetHeight,p=c.offsetHeight;t.style.flex=u,t.style.height=h,t.style.overflowY=m;const w=c.offsetHeight>p+4,g=Math.max(n,window.innerHeight-r-Math.max(0,On.current.y)-24),y=w?Math.min(On.current.h,g):Math.min(Math.max(n,d+f),g),v=Math.abs(y-o)>1;v&&(o=y,kn(e=>Math.abs(e.h-y)>1?{...e,h:y}:e)),H||(y<=n?i&&(clearTimeout(i),i=null):(v||null===i)&&(i&&clearTimeout(i),i=setTimeout(()=>{const e=o;s(),o===e&&Mn(!0)},160)))},l=new ResizeObserver(s);s(),vt.current&&l.observe(vt.current);const c=new MutationObserver(s);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{l.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[En,H,ne,Nt,Nn]),me(()=>{if(!ee||!En||H||!t)return;const e=vt.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||Rn)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,On.current.y)-24);kn(e=>({...e,h:Math.min(Math.max(i,e.h+r),s)}))});return r.observe(e),()=>r.disconnect()},[ee,En,H,t,Rn,ne]);const jn=!1!==re&&!H&&!J&&!Ee,[Fn,Bn]=fe(()=>!jn);me(()=>{if(Fn||!t)return;if(!jn||Rn)return void Bn(!0);const n=dt.current,r=mt.current;if(!n||!r)return;const o=/* @__PURE__ */new WeakSet;let i=On.current.w,a=0;const d=()=>Bn(!0),u=()=>{a=0;const t=On.current;if(Math.abs(t.w-i)>1||document.body.classList.contains("rosh-gesturing"))return void d();const u=e(),m=u.w-80;if(t.w>=m)return void d();const h=[],f=[];for(const e of[r,...Array.from(r.querySelectorAll("*"))]){const t=e.scrollWidth-e.clientWidth;if(t<=4||o.has(e))continue;const n=getComputedStyle(e).overflowX;"auto"!==n&&"scroll"!==n||(h.push(e),f.push(t))}if(!h.length)return;const p=Math.min(m,t.w+Math.max(...f)),w=p-t.w,g=n.style.width;n.style.width=`${p}px`;const y=h.map((e,t)=>({over:f[t],residual:e.scrollWidth-e.clientWidth}));n.style.width=g,y.forEach((e,t)=>{s(e,w)||o.add(h[t])});const v=l(t,c(t.w,w,y),u,Dt);v!==t&&(i=v.w,kn(v))};u();const m=new MutationObserver(()=>{a||(a=requestAnimationFrame(u))});m.observe(r,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["style","class","hidden"]});const h=setTimeout(d,Un);return()=>{m.disconnect(),a&&cancelAnimationFrame(a),clearTimeout(h)}},[Fn,t,jn,Rn]);const Hn=ue(null),Yn=!(!Qe?.tab||zt||H||Ee);Ln.current=t=>{if(!Yn)return;if(t)return Hn.current||(Hn.current={box:{...On.current},maximized:Kn.current}),void(Kn.current=!0);const r=Hn.current;Hn.current=null;const o=e();if(r?.maximized)return Kn.current=!0,$n(!0),void kn(o);const i=r?.box??(pn?In[pn]:void 0);if(Kn.current=!1,$n(!1),i&&!n(i,o,!1)){const e={...i};se&&(e.w=se[0],ee||(e.h=se[1])),kn(Ar(e))}else kn(hn())},he(()=>{zn&&(Kn.current=!0,$n(!0),kn(un()))},[zn,un]),he(()=>{if(H)return;const e=()=>{const e=pn?In[pn]:void 0;if(Kn.current=!1,$n(!1),e){const t={...e};se&&(t.w=se[0],ee||(t.h=se[1])),kn(Ar(t))}else kn(hn())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[H,hn,pn]),he(()=>{t&&pn&&!Nn&&(In[pn]=vn,Wn()),t&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[vn,t,pn,Nn]),he(()=>{if(!t)return;const e=()=>{Kn.current?kn(un()):document.body.classList.contains("rosh-gesturing")||kn(Ar)};window.addEventListener("resize",e),window.addEventListener(o,e);let n=null;return Rn&&(n=new MutationObserver(e),n.observe(document.body,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["class"]})),()=>{window.removeEventListener("resize",e),window.removeEventListener(o,e),n?.disconnect()}},[t,Rn,un]),he(()=>{if(t&&(Ye(!1),qe.current=!1,ct.current=!1,Bn(!jn),!Tn.current)){if(pn&&In[pn]){const e=In[pn];return void kn(t=>Ar({...e,...ee?{h:t.h}:{},...jn?{x:t.x,w:t.w}:{}}))}L&&(kn({x:L.x,y:L.y,w:L.w,h:L.h}),$n(L.maximized))}},[t]),he(()=>{if(!t||"auto"!==g)return;let e;const n=t=>{dt.current?.contains(t.target)&&!qe.current&&(qe.current=!0,e=setTimeout(()=>Ye(!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,g]);const Vn="auto"===g?He:!0===g,_n=Qe&&!zt?Qe.key:null,Zn=xe(()=>sn(We),[We]),er=ue({shortcutSpec:Je,isOnDesktop:rt,toggleDesktopShortcut:ot,taskbarStrings:Oe.taskbar});me(()=>{er.current={shortcutSpec:Je,isOnDesktop:rt,toggleDesktopShortcut:ot,taskbarStrings:Oe.taskbar}});const ir=ue(null);ir.current||(ir.current={open:(e,t)=>Ge({x:e,y:t}),items:()=>{const e=er.current,t=[];e.shortcutSpec&&t.push({label:e.isOnDesktop?e.taskbarStrings.removeFromDesktop:e.taskbarStrings.addToDesktop,onSelect:e.toggleDesktopShortcut});for(const e of Cn[$t]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),he(()=>{if(t&&_n)return()=>{return e=_n,void(cn.delete(e)&&mn());var e}},[t,_n]),pt(!(le||!t)&&Vn);const sr=we(()=>Vn||"auto"===g&&qe.current,[Vn,g]),lr=we(async e=>{if(ct.current)return!1;if(!sr())return!0;ct.current=!0;const t=je,n="close"===e?"Are you sure you want to close?":"discard"===e?"Are you sure you want to stop editing?":"Are you sure you want to continue?",r=await y({title:"Discard changes?",message:t?`“${t}” has unsaved changes. ${n} All changes will be lost.`:`You have unsaved changes. ${n} All changes will be lost.`,confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"});return ct.current=!1,r},[sr,je]),cr=we(()=>ct.current?Promise.resolve():sr()?lr("close").then(e=>{e&&d()}):(d(),Promise.resolve()),[sr,lr,d]),dr=we(async()=>{await lr("discard")&&(qe.current=!1,Ye(!1),Bt.current?.onDiscard())},[lr]),mr=we(async()=>{const e=await lr("switch");return e&&(qe.current=!1,Ye(!1)),e},[lr]),hr=ue(()=>!1);me(()=>{hr.current=sr}),me(()=>{if(!t||!le)return;const e={holdsChanges:()=>hr.current(),ask:mr};return ur.set(le,e),()=>{ur.get(le)===e&&ur.delete(le)}},[t,le,mr]),me(()=>{if(!t||!At)return;const e=e=>{e.detail?.windowKey===At&&cr()};return window.addEventListener(Qr,e),()=>window.removeEventListener(Qr,e)},[t,At,cr]);const fr=ue(null),wr=we(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(Ge(null),yr($t),Tn.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=dt.current,s=a?.getBoundingClientRect();let l,c,d,u;if(fr.current){const t=fr.current;fr.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:On.current.x,c=s?s.top:On.current.y,d=s?s.height:On.current.h,u=s?s.width:On.current.w;$n(!1),kn(e=>({...e,x:l,y:c,w:u,h:d}));let m=null;const h=e=>{if(!r){if(Math.abs(e.clientX-o)<Gr&&Math.abs(e.clientY-i)<Gr)return;r=Jr(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)`),On.current={...On.current,x:s,y:d},!H){const t=function(e,t){const n=Er(),r=e<=n.x+xr,o=e>=n.x+n.w-xr,i=t<=n.y+xr,a=t>=n.y+n.h-xr,s=e<=n.x+kr,l=e>=n.x+n.w-kr,c=t<=n.y+kr,d=t>=n.y+n.h-kr;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!==m&&(m=t,t?Fr(Pr(t)):Br())}},f=()=>{window.removeEventListener("pointermove",h),window.removeEventListener("pointerup",f),r?.(),Br();const e=Ar({...On.current});if(On.current=e,!H&&m){fr.current={x:l,y:c,w:u,h:d};const e=Pr(m);return a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.width=`${e.w}px`,a.style.height=`${e.h}px`,a.style.transform="",a.style.transition=""),void kn(e)}if(H){const t=e.x+e.w/2,n=window.innerWidth/2;lt(t>n?"right":"left")}a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.transform="",a.style.transition=""),kn(e)};window.addEventListener("pointermove",h),window.addEventListener("pointerup",f)},[]),gr=we((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=dt.current,l=s?.getBoundingClientRect(),c=l?l.left:On.current.x,d=l?l.top:On.current.y,u=l?l.width:On.current.w,m=l?l.height:On.current.h,h="sw"===t||"nw"===t||"w"===t,f="ne"===t||"nw"===t||"n"===t,p="se"===t||"ne"===t||"e"===t,w="se"===t||"sw"===t||"s"===t;$n(!1),kn({x:c,y:d,w:u,h:m}),On.current={x:c,y:d,w:u,h:m};let g=0,y=null;const v=()=>{if(g=0,!y)return;const e=y;y=null,On.current=e,s&&(s.style.left=`${e.x}px`,s.style.top=`${e.y}px`,s.style.width=`${e.w}px`,s.style.height=`${e.h}px`)},b=e=>{if(!o){if(Math.abs(e.clientX-i)<Gr&&Math.abs(e.clientY-a)<Gr)return;o=Jr(n,r,Xr[t],"resize")}y=((e,t)=>{let n=c,r=d,o=u,i=m;if(p&&(o=Math.max(zr,u+e)),w&&(i=Math.max(Tr,m+t)),h){const t=Math.max(zr,u-e);n=c+u-t,o=t}if(f){const e=Math.max(Tr,m-t);r=d+m-e,i=e}return{x:n,y:r,w:o,h:i}})(e.clientX-i,e.clientY-a),g||(g=requestAnimationFrame(v))},x=()=>{window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",x),g&&cancelAnimationFrame(g),v(),o?.(),kn({...On.current})};window.addEventListener("pointermove",b),window.addEventListener("pointerup",x)},[]),Lr=we(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(),yr($t),"Enter"===e.key)return void(Rn?($n(!1),kn(hn())):($n(!0),kn(un())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{fr.current||(fr.current={...On.current})};if(r<0)return e(),$n(!0),void kn(un());if(r>0){if(Rn)return $n(!1),void kn(hn());if(fr.current){const e=Ar(fr.current);return fr.current=null,On.current=e,void kn(e)}return void vr($t)}e(),$n(!1);const t=Pr(n<0?"left":"right");return On.current=t,void kn(t)}if(Rn)return;const o=On.current,i=e.shiftKey?{...o,w:Math.max(zr,o.w+24*n),h:Math.max(Tr,o.h+24*r)}:Ar({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});On.current=i,kn(i)},[$t,Rn,hn,un]),Nr=we(e=>{fr.current||(fr.current={...On.current}),$n(!1);const t=Pr(e);On.current=t,kn(t),yr($t)},[$t]),Dr=!H&&!Nn&&!Ee,[Rr,Wr]=fe(0),jr=Dr&&!V&&!J&&(!!z||!!T||wt||Lt),Hr=Dr&&Rr>0,Yr=ue(Hr);Yr.current=Hr;const qr=!!V||!!J,Vr=qr?"h-(--row-height-compact-bar)":"h-(--row-height-window-bar)",Zr=Dr&&!qr&&!Hr&&!Z?"h-(--row-height-window-row)":Vr,eo=we(e=>{const t=e.closest("[data-window-body]");if(!t)return null;const n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return Math.abs(n.left-r.left)>2||Math.abs(n.top-r.top)>2?null:(Wr(e=>e+1),()=>Wr(e=>Math.max(0,e-1)))},[]),to=xe(()=>Dr?{compact:qr,over:Hr,claim:eo,title:je,active:Ft}:null,[Dr,qr,Hr,eo,je,Ft]),io=we(e=>{if(Zt)return;e.preventDefault(),e.stopPropagation();const t=0===e.clientX&&0===e.clientY,n=e.currentTarget.getBoundingClientRect();Ge(t?{x:n.left,y:n.bottom+4}:{x:e.clientX,y:e.clientY})},[Zt]),ao=!!ge&&tt&&!H&&!Ee,lo=zn||Zt?{}:{tabIndex:0,role:"group","aria-label":je?`${je} — ${Ke.windowSuffix}`:Ke.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:Lr},ho=()=>{$n(!0),kn(un())},fo=we(()=>{const e=dt.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(bn);t&&!t.disabled&&t.click()}},[]);he(()=>{if(!t)return;if(H)return;const e=e=>{if(R[R.length-1]===$t&&!x(e.target,dt.current)&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),fo();else{if("INPUT"===t.tagName&&t.closest("form"))return;if(!(t instanceof Element&&dt.current?.contains(t)))return;if(t.closest(j))return;e.preventDefault()}}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,fo,$t,H]),he(()=>{if(!t)return;const e=e=>{R[R.length-1]===$t&&(x(e.target,dt.current)||((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:$t}})),qe.current=!1,Ye(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:$t}})))))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]),he(()=>{if(!t)return;if(H)return;const e=e=>{if("Escape"===e.key&&R[R.length-1]===$t){if(ie(e))return e.preventDefault(),void e.stopPropagation();if(Nn&&!A)return;e.preventDefault(),e.stopPropagation(),cr()}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,cr,$t,H,Nn,A]);const go=t&&(void 0!==b||void 0!==E),[yo]=fe(()=>{if("undefined"==typeof document)return null;const e=document.createElement("span");return e.className="flex shrink-0 items-center gap-2",e.setAttribute("data-tab-actions",""),e}),vo=Nn&&!Qe?.home&&Zn.actions.length>0;he(()=>{t&&_n&&function(e,t){const n=cn.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.actions===t.actions&&n.menu===t.menu||(cn.set(e,t),mn())}(_n,{title:Zn.text||je,dirty:Vn,copy:Zn.copy,actions:vo&&yo?yo:void 0,menu:ir.current??void 0})},[t,_n,je,Vn,Zn.text,Zn.copy,vo,yo]);const bo=we(e=>{const t=document.getElementById("nav-boundary-toast");t&&t.remove();const n="bottom"===e?["That's the last one, chief.","You've hit rock bottom... of the list.","End of the line, buddy.","Nothing left. Go outside.","Congratulations, you scrolled to the void.","There's no more. I checked.","You've reached the edge of the known universe.","Plot twist: there is no next one.","Even scrolling has limits. Unlike your ambition.","Last one. Time to touch grass."]:["Already at the top. Overachiever.","There is no item above this. Trust me.","You're #1. Literally.","Can't go higher. You've peaked.","This is it. The summit. The top.","First item. No VIP lounge above this.","Going up? Nope. Elevator's broken.","You want negative indexes? Bold.","Top of the list. Top of the world.","The only way is down from here."],r=n[Math.floor(Math.random()*n.length)],o=document.createElement("div");o.id="nav-boundary-toast",o.className="fixed bottom-6 left-1/2 -translate-x-1/2 z-(--z-toast) bg-gray-900 text-on-accent flex min-h-10 items-center px-5 py-3 rounded-lg shadow-lg text-sm font-medium transition-opacity duration-300",o.textContent=r,document.body.appendChild(o),setTimeout(()=>{o.style.opacity="0",setTimeout(()=>o.remove(),300)},2e3)},[]);he(()=>{if(!t)return;const e=e=>{if(R[R.length-1]!==$t)return;if(x(e.target,dt.current))return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&go&&(e.preventDefault(),b?b():bo("bottom")),"k"===e.key&&go&&(e.preventDefault(),E?E():bo("top"))))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,b,E,go,bo,$t]);const xo=pe(Or,Kr,Kr),ko=Er(),Eo=t&&!H&&!Nn&&!Ee&&!qt&&Kt>=0&&(Rn||i(vn,ko));me(()=>{$r($t,Eo?vn:null)},[$t,Eo,vn]),he(()=>()=>$r($t,null),[$t]);const Co=xe(()=>{if(!Eo)return null;if(Rn)return{tl:!0,tr:!0,bl:!0,br:!0};const e=[];return Ir.forEach((t,n)=>{n!==$t&&e.push(t)}),a(vn,ko,e)},[Eo,Rn,vn,$t,xo,ko.x,ko.y,ko.w,ko.h]);if(!t||fn.current)return null;const Mo=Zt?function(e){if("undefined"==typeof document)return null;const t=Array.from(document.querySelectorAll("[data-modal-panel]")).filter(e=>{const t=e;return!t.hasAttribute("data-utility")&&!t.hasAttribute("data-widget")&&"none"!==t.style.display});t.sort((e,t)=>(e.getAttribute("data-modal-id")||"").localeCompare(t.getAttribute("data-modal-id")||""));const n=t.findIndex(t=>t.getAttribute("data-modal-id")===e),r=t.length;if(n<0||r<1)return null;const o=Math.ceil(Math.sqrt(r)),i=Math.ceil(r/o),a=Math.floor(n/o),s=n%o,l=r-o*(i-1),c=a===i-1&&l<o,d=Er(),u=(d.w-20*(o+1))/o,m=(d.h-14*(i+1)-22*i)/i,h=c?(o-l)*(u+20)/2:0;return{x:d.x+20+s*(u+20)+h,y:d.y+14+a*(m+14+22),w:u,h:m}}($t):null,So=Zt&&Mo?te({width:Mo.w,height:Mo.h},{width:vn.w,height:vn.h}):1,Lo=(()=>{if(Zt&&Mo){const e=So,t=vn.w*e,n=vn.h*e,r=Mo.x+(Mo.w-t)/2-vn.x,o=Mo.y+(Mo.h-n)/2-vn.y,i=en||nn;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:Q.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(rn&&Qt){const e="picked"===an;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:Q.expose+30}:{}}}return null})(),No=k({modal:!1,titleId:!H&&(Nn?!Qe?.home:!Ee)?Be:void 0,label:Zn.text||je}),zo=Ct&&W&&!W.editing?"object"==typeof W.state?/* @__PURE__ */Se(X,{variant:"secondary",size:"sm","data-modal-edit":"","aria-disabled":!0,disabledReason:W.state.disabledReason,children:Ke.edit}):/* @__PURE__ */Se(X,{variant:"secondary",size:"sm","data-modal-edit":"",onClick:()=>W.onEdit(),children:Ke.edit}):null,To=/* @__PURE__ */Me("div",{children:[
|
|
46
|
+
/* @__PURE__ */Se("div",{onMouseDown:e=>{e.stopPropagation(),oo(!1)},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",zIndex:Q.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 xo({open:t,onClose:d,title:u,icon:m,copyText:h,size:f="lg",dirty:g=!1,onNext:v,onPrev:b,footer:x,bodyScroll:k,onMinimize:C,initialBox:L,actions:z,actionsLeft:T,editing:A=!1,edit:W,allowPinOnTop:F,initialPosition:B,widget:H,compact:V,appStyle:J,flushBody:Z,autoHeight:ee,autoMinHeight:ne,autoWidth:re,widgetMenu:oe,dimensions:se,windowKey:le,openedFromKey:de,accentRgb:ge,children:ye}){const[ve,be]=fe(()=>r()),Ee=D()&&!ve,Ce=P()&&!!H,[Ne,ze]=fe(0),[Te,Ae]=fe(!1),De=ue(null),Pe=ue(0);he(()=>{Pe.current=Ne},[Ne]);const Ie=we(e=>{Ee&&(De.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},Ae(!0),Vt(de??null))},[Ee,de]),Re=pe(Xt,Ut);he(()=>{if(!Te)return;const e=e=>{if(!De.current)return;const t=e.clientX-De.current.startX;if(Math.abs(e.clientY-De.current.startY)>Math.abs(t)+12)return De.current=null,Ae(!1),ze(0),void Vt(null);ze(Math.max(0,t))},t=()=>{if(!De.current)return;const e=.3*window.innerWidth,t=Pe.current>e;De.current=null,Ae(!1),t?(ze(window.innerWidth),setTimeout(()=>{d(),ze(0),Vt(null)},180)):(ze(0),Vt(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)}},[Te]);const[We,$e]=fe(u),Oe=ae(),Ke=Oe.window;he(()=>{$e(u)},[u]);const je=xe(()=>xn(We).trim()||void 0,[We]),Be=ke(),[He,Ye]=fe(!1),qe=ue(!1),[Ue,Ve]=fe(!1),[Xe,Ge]=fe(null),Je=ce(gn),Qe=ce(Fe),{prefs:Ze,save:et}=I(),tt=!!Ze.window_accent_stripe,nt=Ze.favorite_documents||[],rt=!!Je&&nt.some(e=>e.entityType===Je.entityType&&e.entityId===Je.entityId),ot=we(()=>{if(!Je)return;const e=rt?nt.filter(e=>!(e.entityType===Je.entityType&&e.entityId===Je.entityId)):[...nt,{entityType:Je.entityType,entityId:Je.entityId,label:Je.label}];et({favorite_documents:e})},[Je,rt,nt,et]),[it,at]=fe(null),[st,lt]=fe("top-right"===B?"right":"left"),ct=ue(!1),dt=ue(null);me(()=>{const e=dt.current;e&&(ge?e.style.setProperty("--window-accent-rgb",ge):e.style.removeProperty("--window-accent-rgb"))},[ge]);const ut=ue(!1),mt=ue(null),ht=ue(null),ft=ue(null),[wt,yt]=fe(!1),vt=ue(null),bt=ue(null),xt=ue(null),[kt,Et]=fe(!1);me(()=>{const e=bt.current,t=xt.current;if(!e||!t)return;const n=()=>Et(function(e,t){return e.scrollWidth>t.clientWidth}(t,e));if(n(),"undefined"==typeof ResizeObserver)return;const r=new ResizeObserver(n);return r.observe(e),r.observe(t),()=>r.disconnect()},[null!=x&&!1!==x]);const Ct=!!W&&!H&&!V&&!J&&(W.editing||"hidden"!==W.state),[Mt,St]=fe(null),Lt=Ct&&(!!W?.editing||!Mt),Nt=!!(x||z||T)||wt||Lt,zt=""!==ce(wn),Tt=ue(null);Tt.current=Qe?{owner:Qe.key,tab:Qe.tab,root:!zt}:null;const At=le||(Qe&&!zt?Qe.key:null),Dt=40,{minimize:Pt,items:It,restoreIfMinimized:Rt,openWindows:Wt}=gt(),$t=ue(`modal-${Math.random().toString(36).slice(2,8)}`).current,Ot=E($t);he(()=>{if(H)return br.add($t),()=>{br.delete($t)}},[H,$t]),he(()=>{const e=e=>{const t=e.detail;t?.id===$t&&$e(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[$t]);const[Kt,jt]=fe(Q.window),Ft=function(e){const t=pe(O,K);return R.length<=1||t===e}($t),Bt=ue(W);Bt.current=W;const Yt=!!W&&!W.editing&&"enabled"===W.state;he(()=>{if(!t||!Ft||!Yt)return;const e=e=>{("KeyE"===e.code||"E"===e.key||"e"===e.key)&&e.altKey&&e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(M(e.target,dt.current)||(e.preventDefault(),e.stopPropagation(),Bt.current?.onEdit()))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,Ft,Yt]);const qt=function(e){return pe(O,()=>Jn.has(e))}($t);Ht({panelRef:dt,bodyRef:mt,open:t,widget:!!H,active:Ft,minimized:qt});const Gt=pe(no,ro),Jt=pe(co,uo),_t=pe(po,wo),Qt=!F&&!H,Zt=Gt&&Qt,[en,tn]=fe(!1),nn=Zt&&_t===$t,[rn,on]=fe(!1),an=rn&&Qt&&Jt===$t?"picked":null,ln=ue(Zt);he(()=>{if(ln.current&&!Zt){on(!0);const e=setTimeout(()=>{on(!1),so===$t&&mo(null)},700);return ln.current=Zt,()=>clearTimeout(e)}ln.current=Zt},[Zt,$t]),he(()=>{Zt||tn(!1)},[Zt]),he(()=>{const e=ht.current,t=ft.current;if(!e&&!t)return;const n=e=>e?Array.from(e.children).filter(e=>"shell"!==e.dataset.undoControls).length:0,r=()=>yt(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]),he(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&dt.current){const t=dt.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=ht.current,n=ft.current;return t&&t.addEventListener("click",e),n&&n.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e),n&&n.removeEventListener("click",e)}},[t]);const dn=ue(!1),un=we(e,[]),hn=we(()=>{const t=e(),n=se?se[0]:qn[f]||672,o=t.w-80,i=t.h-80,a=Math.min(n,o),s=Gn[Xn()],l=se?Math.min(se[1],i):(()=>{const e=("sm"===f?500:"md"===f?600:"lg"===f?700:"xl"===f?800:920)*s;return Math.max(320,Math.min(e,t.h-80))})(),c="cascade"!==(getComputedStyle(document.documentElement).getPropertyValue("--window-position")?.trim()||"cascade")||r()?0:30*(R.length-1),d=Math.max(Dt,(i-l)/2),u=(o-a)/2,m=t.h-Dt-l-d;return"top-right"===B?{x:t.x+t.w-a-Dt,y:t.y+Dt,w:a,h:l}:"top-left"===B?{x:t.x+Dt,y:t.y+Dt,w:a,h:l}:{x:t.x+Math.max(Dt,(o-a)/2+Dt)+Math.min(c,Math.max(0,u)),y:t.y+d+Math.min(c,Math.max(0,m)),w:a,h:l}},[f]),fn=ue(!1);t||(fn.current=!1);const pn=le||h||null;he(()=>{if(!t)return;pr($t,pn,Tt.current??void 0),le||yr($t),dn.current=!1,jt(_r($t));const e=()=>{jt(_r($t))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===le;if(!e.label)return!1;const t=dt.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if(yr($t),Tn.current)return;const t=Er(),n=Math.min(On.current.w,t.w-40),o=Math.min(On.current.h,t.h-40),i=t.x+(t.w-n)/2,a=t.y+(t.h-o)/2;kn({x:i,y:a,w:n,h:o}),$n(!1)},i=e=>{const t=e.detail;r(t)&&(yr($t),Ge({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==le)return;yr($t);const t=On.current,n=function(e,t=Er()){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=dt.current,o="function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(r&&!o){let e=!1;const t=()=>{e||(e=!0,r.style.transition="",window.dispatchEvent(new CustomEvent("modal-geometry")))};r.style.transition="left .28s ease, top .28s ease, width .28s ease, height .28s ease",r.addEventListener("transitionend",t,{once:!0}),window.setTimeout(t,400)}kn(n)};return window.addEventListener("modal-reorder",e),window.addEventListener("modal-split-view",n),window.addEventListener("modal-center",o),window.addEventListener("modal-reveal",a),window.addEventListener("modal-context-menu",i),()=>{!function(e){const t=R.indexOf(e);-1!==t&&(R.splice(t,1),tr()),Jn.delete(e),Qn.delete(e),or.delete(e);const n=rr.get(e);n&&(rr.delete(e),nr.delete(n))}($t),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,$t,pn,un]);const yn=!H&&"maximized"===Xn(),[vn,kn]=fe(()=>{if(pn&&In[pn]){const e={...In[pn]};return se&&(e.w=se[0],ee||(e.h=se[1])),Ar(e)}return L?{x:L.x,y:L.y,w:L.w,h:L.h}:yn?un():hn()}),[En,Mn]=fe(()=>!ee),Sn=ue(ve),Ln=ue(null);he(()=>{const e=()=>{const e=r();e!==Sn.current&&Ln.current?.(e),Sn.current=e,be(e),jt(_r($t))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[$t]);const Nn=ve&&!!Qe?.tab&&!zt&&!H&&!Ee,zn=Nn,Tn=ue(zn);Tn.current=zn;const An=ar(),Dn=ve&&!!Qe?.tab&&!H&&!Ee&&!Gt&&An!==Qe.key,Pn=!!H&&ve&&!Gt&&null!==An,[Rn,$n]=fe(()=>pn&&In[pn]||L?zn:zn||yn),On=ue(vn);On.current=vn;const Kn=ue(Rn);me(()=>{Kn.current=Rn},[Rn]),me(()=>{if(En||Nn)return;const e=dt.current,t=mt.current;if(!e||!t)return;const n=ne??(H?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,m=t.style.overflowY,h=t.style.height;t.style.flex="0 0 auto",t.style.height="auto",t.style.overflowY="visible";const f=t.offsetHeight,p=c.offsetHeight;t.style.flex=u,t.style.height=h,t.style.overflowY=m;const w=c.offsetHeight>p+4,g=Math.max(n,window.innerHeight-r-Math.max(0,On.current.y)-24),y=w?Math.min(On.current.h,g):Math.min(Math.max(n,d+f),g),v=Math.abs(y-o)>1;v&&(o=y,kn(e=>Math.abs(e.h-y)>1?{...e,h:y}:e)),H||(y<=n?i&&(clearTimeout(i),i=null):(v||null===i)&&(i&&clearTimeout(i),i=setTimeout(()=>{const e=o;s(),o===e&&Mn(!0)},160)))},l=new ResizeObserver(s);s(),vt.current&&l.observe(vt.current);const c=new MutationObserver(s);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{l.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[En,H,ne,Nt,Nn]),me(()=>{if(!ee||!En||H||!t)return;const e=vt.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||Rn)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,On.current.y)-24);kn(e=>({...e,h:Math.min(Math.max(i,e.h+r),s)}))});return r.observe(e),()=>r.disconnect()},[ee,En,H,t,Rn,ne]);const jn=!1!==re&&!H&&!J&&!Ee,[Fn,Bn]=fe(()=>!jn);me(()=>{if(Fn||!t)return;if(!jn||Rn)return void Bn(!0);const n=dt.current,r=mt.current;if(!n||!r)return;const o=/* @__PURE__ */new WeakSet;let i=On.current.w,a=0;const d=()=>Bn(!0),u=()=>{a=0;const t=On.current;if(Math.abs(t.w-i)>1||document.body.classList.contains("rosh-gesturing"))return void d();const u=e(),m=u.w-80;if(t.w>=m)return void d();const h=[],f=[];for(const e of[r,...Array.from(r.querySelectorAll("*"))]){const t=e.scrollWidth-e.clientWidth;if(t<=4||o.has(e))continue;const n=getComputedStyle(e).overflowX;"auto"!==n&&"scroll"!==n||(h.push(e),f.push(t))}if(!h.length)return;const p=Math.min(m,t.w+Math.max(...f)),w=p-t.w,g=n.style.width;n.style.width=`${p}px`;const y=h.map((e,t)=>({over:f[t],residual:e.scrollWidth-e.clientWidth}));n.style.width=g,y.forEach((e,t)=>{s(e,w)||o.add(h[t])});const v=l(t,c(t.w,w,y),u,Dt);v!==t&&(i=v.w,kn(v))};u();const m=new MutationObserver(()=>{a||(a=requestAnimationFrame(u))});m.observe(r,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["style","class","hidden"]});const h=setTimeout(d,Un);return()=>{m.disconnect(),a&&cancelAnimationFrame(a),clearTimeout(h)}},[Fn,t,jn,Rn]);const Hn=ue(null),Yn=!(!Qe?.tab||zt||H||Ee);Ln.current=t=>{if(!Yn)return;if(t)return Hn.current||(Hn.current={box:{...On.current},maximized:Kn.current}),void(Kn.current=!0);const r=Hn.current;Hn.current=null;const o=e();if(r?.maximized)return Kn.current=!0,$n(!0),void kn(o);const i=r?.box??(pn?In[pn]:void 0);if(Kn.current=!1,$n(!1),i&&!n(i,o,!1)){const e={...i};se&&(e.w=se[0],ee||(e.h=se[1])),kn(Ar(e))}else kn(hn())},he(()=>{zn&&(Kn.current=!0,$n(!0),kn(un()))},[zn,un]),he(()=>{if(H)return;const e=()=>{const e=pn?In[pn]:void 0;if(Kn.current=!1,$n(!1),e){const t={...e};se&&(t.w=se[0],ee||(t.h=se[1])),kn(Ar(t))}else kn(hn())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[H,hn,pn]),he(()=>{t&&pn&&!Nn&&(In[pn]=vn,Wn()),t&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[vn,t,pn,Nn]),he(()=>{if(!t)return;const e=()=>{Kn.current?kn(un()):document.body.classList.contains("rosh-gesturing")||kn(Ar)};window.addEventListener("resize",e),window.addEventListener(o,e);let n=null;return Rn&&(n=new MutationObserver(e),n.observe(document.body,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["class"]})),()=>{window.removeEventListener("resize",e),window.removeEventListener(o,e),n?.disconnect()}},[t,Rn,un]),he(()=>{if(t&&(Ye(!1),qe.current=!1,ct.current=!1,Bn(!jn),!Tn.current)){if(pn&&In[pn]){const e=In[pn];return void kn(t=>Ar({...e,...ee?{h:t.h}:{},...jn?{x:t.x,w:t.w}:{}}))}L&&(kn({x:L.x,y:L.y,w:L.w,h:L.h}),$n(L.maximized))}},[t]),he(()=>{if(!t||"auto"!==g)return;let e;const n=t=>{dt.current?.contains(t.target)&&!qe.current&&(qe.current=!0,e=setTimeout(()=>Ye(!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,g]);const Vn="auto"===g?He:!0===g,_n=Qe&&!zt?Qe.key:null,Zn=xe(()=>sn(We),[We]),er=ue({shortcutSpec:Je,isOnDesktop:rt,toggleDesktopShortcut:ot,taskbarStrings:Oe.taskbar});me(()=>{er.current={shortcutSpec:Je,isOnDesktop:rt,toggleDesktopShortcut:ot,taskbarStrings:Oe.taskbar}});const ir=ue(null);ir.current||(ir.current={open:(e,t)=>Ge({x:e,y:t}),items:()=>{const e=er.current,t=[];e.shortcutSpec&&t.push({label:e.isOnDesktop?e.taskbarStrings.removeFromDesktop:e.taskbarStrings.addToDesktop,onSelect:e.toggleDesktopShortcut});for(const e of Cn[$t]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),he(()=>{if(t&&_n)return()=>{return e=_n,void(cn.delete(e)&&mn());var e}},[t,_n]),pt(!(le||!t)&&Vn);const sr=we(()=>Vn||"auto"===g&&qe.current,[Vn,g]),lr=we(async e=>{if(ct.current)return!1;if(!sr())return!0;ct.current=!0;const t=je,n="close"===e?"Are you sure you want to close?":"discard"===e?"Are you sure you want to stop editing?":"Are you sure you want to continue?",r=await y({title:"Discard changes?",message:t?`“${t}” has unsaved changes. ${n} All changes will be lost.`:`You have unsaved changes. ${n} All changes will be lost.`,confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"});return ct.current=!1,r},[sr,je]),cr=we(()=>ct.current?Promise.resolve():sr()?lr("close").then(e=>{e&&d()}):(d(),Promise.resolve()),[sr,lr,d]),dr=we(async()=>{await lr("discard")&&(qe.current=!1,Ye(!1),Bt.current?.onDiscard())},[lr]),mr=we(async()=>{const e=await lr("switch");return e&&(qe.current=!1,Ye(!1)),e},[lr]),hr=ue(()=>!1);me(()=>{hr.current=sr}),me(()=>{if(!t||!le)return;const e={holdsChanges:()=>hr.current(),ask:mr};return ur.set(le,e),()=>{ur.get(le)===e&&ur.delete(le)}},[t,le,mr]),me(()=>{if(!t||!At)return;const e=e=>{e.detail?.windowKey===At&&cr()};return window.addEventListener(Qr,e),()=>window.removeEventListener(Qr,e)},[t,At,cr]);const fr=ue(null),wr=we(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(Ge(null),yr($t),Tn.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=dt.current,s=a?.getBoundingClientRect();let l,c,d,u;if(fr.current){const t=fr.current;fr.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:On.current.x,c=s?s.top:On.current.y,d=s?s.height:On.current.h,u=s?s.width:On.current.w;$n(!1),kn(e=>({...e,x:l,y:c,w:u,h:d}));let m=null;const h=e=>{if(!r){if(Math.abs(e.clientX-o)<Gr&&Math.abs(e.clientY-i)<Gr)return;r=Jr(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)`),On.current={...On.current,x:s,y:d},!H){const t=function(e,t){const n=Er(),r=e<=n.x+xr,o=e>=n.x+n.w-xr,i=t<=n.y+xr,a=t>=n.y+n.h-xr,s=e<=n.x+kr,l=e>=n.x+n.w-kr,c=t<=n.y+kr,d=t>=n.y+n.h-kr;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!==m&&(m=t,t?Fr(Pr(t)):Br())}},f=()=>{window.removeEventListener("pointermove",h),window.removeEventListener("pointerup",f),r?.(),Br();const e=Ar({...On.current});if(On.current=e,!H&&m){fr.current={x:l,y:c,w:u,h:d};const e=Pr(m);return a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.width=`${e.w}px`,a.style.height=`${e.h}px`,a.style.transform="",a.style.transition=""),void kn(e)}if(H){const t=e.x+e.w/2,n=window.innerWidth/2;lt(t>n?"right":"left")}a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.transform="",a.style.transition=""),kn(e)};window.addEventListener("pointermove",h),window.addEventListener("pointerup",f)},[]),gr=we((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=dt.current,l=s?.getBoundingClientRect(),c=l?l.left:On.current.x,d=l?l.top:On.current.y,u=l?l.width:On.current.w,m=l?l.height:On.current.h,h="sw"===t||"nw"===t||"w"===t,f="ne"===t||"nw"===t||"n"===t,p="se"===t||"ne"===t||"e"===t,w="se"===t||"sw"===t||"s"===t;$n(!1),kn({x:c,y:d,w:u,h:m}),On.current={x:c,y:d,w:u,h:m};let g=0,y=null;const v=()=>{if(g=0,!y)return;const e=y;y=null,On.current=e,s&&(s.style.left=`${e.x}px`,s.style.top=`${e.y}px`,s.style.width=`${e.w}px`,s.style.height=`${e.h}px`)},b=e=>{if(!o){if(Math.abs(e.clientX-i)<Gr&&Math.abs(e.clientY-a)<Gr)return;o=Jr(n,r,Xr[t],"resize")}y=((e,t)=>{let n=c,r=d,o=u,i=m;if(p&&(o=Math.max(zr,u+e)),w&&(i=Math.max(Tr,m+t)),h){const t=Math.max(zr,u-e);n=c+u-t,o=t}if(f){const e=Math.max(Tr,m-t);r=d+m-e,i=e}return{x:n,y:r,w:o,h:i}})(e.clientX-i,e.clientY-a),g||(g=requestAnimationFrame(v))},x=()=>{window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",x),g&&cancelAnimationFrame(g),v(),o?.(),kn({...On.current})};window.addEventListener("pointermove",b),window.addEventListener("pointerup",x)},[]),Lr=we(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(),yr($t),"Enter"===e.key)return void(Rn?($n(!1),kn(hn())):($n(!0),kn(un())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{fr.current||(fr.current={...On.current})};if(r<0)return e(),$n(!0),void kn(un());if(r>0){if(Rn)return $n(!1),void kn(hn());if(fr.current){const e=Ar(fr.current);return fr.current=null,On.current=e,void kn(e)}return void vr($t)}e(),$n(!1);const t=Pr(n<0?"left":"right");return On.current=t,void kn(t)}if(Rn)return;const o=On.current,i=e.shiftKey?{...o,w:Math.max(zr,o.w+24*n),h:Math.max(Tr,o.h+24*r)}:Ar({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});On.current=i,kn(i)},[$t,Rn,hn,un]),Nr=we(e=>{fr.current||(fr.current={...On.current}),$n(!1);const t=Pr(e);On.current=t,kn(t),yr($t)},[$t]),Dr=!H&&!Nn&&!Ee,[Rr,Wr]=fe(0),jr=Dr&&!V&&!J&&(!!z||!!T||wt||Lt),Hr=Dr&&Rr>0,Yr=ue(Hr);Yr.current=Hr;const qr=!!V||!!J,Vr=qr?"h-(--row-height-compact-bar)":"h-(--row-height-window-bar)",Zr=Dr&&!qr&&!Hr&&!Z?"h-(--row-height-window-row)":Vr,eo=we(e=>{const t=e.closest("[data-window-body]");if(!t)return null;const n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return Math.abs(n.left-r.left)>2||Math.abs(n.top-r.top)>2?null:(Wr(e=>e+1),()=>Wr(e=>Math.max(0,e-1)))},[]),to=xe(()=>Dr?{compact:qr,over:Hr,claim:eo,title:je,active:Ft}:null,[Dr,qr,Hr,eo,je,Ft]),io=we(e=>{if(Zt)return;e.preventDefault(),e.stopPropagation();const t=0===e.clientX&&0===e.clientY,n=e.currentTarget.getBoundingClientRect();Ge(t?{x:n.left,y:n.bottom+4}:{x:e.clientX,y:e.clientY})},[Zt]),ao=!!ge&&tt&&!H&&!Ee,lo=zn||Zt?{}:{tabIndex:0,role:"group","aria-label":je?`${je} — ${Ke.windowSuffix}`:Ke.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:Lr},ho=()=>{$n(!0),kn(un())},fo=we(()=>{const e=dt.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector(bn);t&&!t.disabled&&t.click()}},[]);he(()=>{if(!t)return;if(H)return;const e=e=>{if(R[R.length-1]===$t&&!M(e.target,dt.current)&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),fo();else{if("INPUT"===t.tagName&&t.closest("form"))return;if(!(t instanceof Element&&dt.current?.contains(t)))return;if(t.closest(j))return;e.preventDefault()}}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,fo,$t,H]),he(()=>{if(!t)return;const e=e=>{R[R.length-1]===$t&&(M(e.target,dt.current)||((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:$t}})),qe.current=!1,Ye(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:$t}})))))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]),he(()=>{if(!t)return;if(H)return;const e=e=>{if("Escape"===e.key&&R[R.length-1]===$t){if(ie(e))return e.preventDefault(),void e.stopPropagation();if(Nn&&!A)return;e.preventDefault(),e.stopPropagation(),cr()}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,cr,$t,H,Nn,A]);const go=t&&(void 0!==v||void 0!==b),[yo]=fe(()=>{if("undefined"==typeof document)return null;const e=document.createElement("span");return e.className="flex shrink-0 items-center gap-2",e.setAttribute("data-tab-actions",""),e}),vo=Nn&&!Qe?.home&&Zn.actions.length>0;he(()=>{t&&_n&&function(e,t){const n=cn.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.actions===t.actions&&n.menu===t.menu||(cn.set(e,t),mn())}(_n,{title:Zn.text||je,dirty:Vn,copy:Zn.copy,actions:vo&&yo?yo:void 0,menu:ir.current??void 0})},[t,_n,je,Vn,Zn.text,Zn.copy,vo,yo]);const bo=we(e=>{const t=document.getElementById("nav-boundary-toast");t&&t.remove();const n="bottom"===e?["That's the last one, chief.","You've hit rock bottom... of the list.","End of the line, buddy.","Nothing left. Go outside.","Congratulations, you scrolled to the void.","There's no more. I checked.","You've reached the edge of the known universe.","Plot twist: there is no next one.","Even scrolling has limits. Unlike your ambition.","Last one. Time to touch grass."]:["Already at the top. Overachiever.","There is no item above this. Trust me.","You're #1. Literally.","Can't go higher. You've peaked.","This is it. The summit. The top.","First item. No VIP lounge above this.","Going up? Nope. Elevator's broken.","You want negative indexes? Bold.","Top of the list. Top of the world.","The only way is down from here."],r=n[Math.floor(Math.random()*n.length)],o=document.createElement("div");o.id="nav-boundary-toast",o.className="fixed bottom-6 left-1/2 -translate-x-1/2 z-(--z-toast) bg-gray-900 text-on-accent flex min-h-10 items-center px-5 py-3 rounded-lg shadow-lg text-sm font-medium transition-opacity duration-300",o.textContent=r,document.body.appendChild(o),setTimeout(()=>{o.style.opacity="0",setTimeout(()=>o.remove(),300)},2e3)},[]);he(()=>{if(!t)return;const e=e=>{if(R[R.length-1]!==$t)return;if(M(e.target,dt.current))return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&go&&(e.preventDefault(),v?v():bo("bottom")),"k"===e.key&&go&&(e.preventDefault(),b?b():bo("top"))))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,v,b,go,bo,$t]);const xo=pe(Or,Kr,Kr),ko=Er(),Eo=t&&!H&&!Nn&&!Ee&&!qt&&Kt>=0&&(Rn||i(vn,ko));me(()=>{$r($t,Eo?vn:null)},[$t,Eo,vn]),he(()=>()=>$r($t,null),[$t]);const Co=xe(()=>{if(!Eo)return null;if(Rn)return{tl:!0,tr:!0,bl:!0,br:!0};const e=[];return Ir.forEach((t,n)=>{n!==$t&&e.push(t)}),a(vn,ko,e)},[Eo,Rn,vn,$t,xo,ko.x,ko.y,ko.w,ko.h]);if(!t||fn.current)return null;const Mo=Zt?function(e){if("undefined"==typeof document)return null;const t=Array.from(document.querySelectorAll("[data-modal-panel]")).filter(e=>{const t=e;return!t.hasAttribute("data-utility")&&!t.hasAttribute("data-widget")&&"none"!==t.style.display});t.sort((e,t)=>(e.getAttribute("data-modal-id")||"").localeCompare(t.getAttribute("data-modal-id")||""));const n=t.findIndex(t=>t.getAttribute("data-modal-id")===e),r=t.length;if(n<0||r<1)return null;const o=Math.ceil(Math.sqrt(r)),i=Math.ceil(r/o),a=Math.floor(n/o),s=n%o,l=r-o*(i-1),c=a===i-1&&l<o,d=Er(),u=(d.w-20*(o+1))/o,m=(d.h-14*(i+1)-22*i)/i,h=c?(o-l)*(u+20)/2:0;return{x:d.x+20+s*(u+20)+h,y:d.y+14+a*(m+14+22),w:u,h:m}}($t):null,So=Zt&&Mo?te({width:Mo.w,height:Mo.h},{width:vn.w,height:vn.h}):1,Lo=(()=>{if(Zt&&Mo){const e=So,t=vn.w*e,n=vn.h*e,r=Mo.x+(Mo.w-t)/2-vn.x,o=Mo.y+(Mo.h-n)/2-vn.y,i=en||nn;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:Q.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(rn&&Qt){const e="picked"===an;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:Q.expose+30}:{}}}return null})(),No=S({modal:!1,titleId:!H&&(Nn?!Qe?.home:!Ee)?Be:void 0,label:Zn.text||je}),zo=Ct&&W&&!W.editing?"object"==typeof W.state?/* @__PURE__ */Se(X,{variant:"secondary",size:"sm","data-modal-edit":"","aria-disabled":!0,disabledReason:W.state.disabledReason,children:Ke.edit}):/* @__PURE__ */Se(X,{variant:"secondary",size:"sm","data-modal-edit":"",onClick:()=>W.onEdit(),children:Ke.edit}):null,To=/* @__PURE__ */Me("div",{children:[
|
|
47
47
|
/* @__PURE__ */Me("div",{ref:dt,"data-modal-panel":!0,"data-modal-id":$t,"data-window-key":le||void 0,...F?{"data-utility":""}:{},...Ue?{"data-pinned-top":""}:{},...H?{"data-widget":""}:{},...Qe?{"data-window-owner":Qe.key}:{},...Qe&&!zt?{"data-window-root":""}:{},...Nn?{"data-window-tab":""}:{},...No,className:Nn?"fixed flex flex-col overflow-hidden":"fixed rounded-(--radius-window) flex flex-col overflow-hidden "+(H?Ft?"shadow-xl":"shadow-lg":"border "+(Ft?"shadow-xl border-line":"shadow-lg border-line-strong")),onPointerDown:e=>{if(!Yr.current||Zt||0!==e.button)return;const t=e.target;if(t.closest("[data-modal-panel]")!==dt.current)return;if(t.closest("[data-window-chrome]"))return;if(t.closest("[data-sidebar-rail]"))return void(t.closest(w)||wr(e));const n=e.currentTarget.getBoundingClientRect(),r=n.height/(e.currentTarget.offsetHeight||n.height),o=(qr?N.compactBar:N.windowBar)*r;e.clientY-n.top>o||t.closest(w)||wr(e)},onContextMenu:e=>{const t=e.target;t.closest("[data-window-strip]")&&t.closest("[data-modal-panel]")===dt.current&&io(e)},onMouseDownCapture:e=>{if(ut.current=!1,Zt){if(e.target.closest("[data-expose-close]"))return;return e.preventDefault(),e.stopPropagation(),mo($t),oo(!1),void yr($t)}if(!Ft&&!H&&!Ue&&0===e.button){const t=e.target;t.closest("[data-modal-panel]")===dt.current&&t.closest("button, input, a, select, textarea")&&!t.closest("[data-window-chrome]")&&(e.preventDefault(),e.stopPropagation(),ut.current=!0,Ge(null),yr($t),window.addEventListener("mouseup",()=>{setTimeout(()=>{ut.current=!1},0)},{once:!0}))}},onClickCapture:e=>{ut.current&&(ut.current=!1,e.preventDefault(),e.stopPropagation())},onMouseDown:e=>{if(Zt)return;Ge(null);e.target.closest("[data-modal-panel]")===dt.current&&(e.target.closest("button, input, a, select, textarea")||yr($t))},style:Ee?{zIndex:Kt+1,top:0,left:0,right:0,bottom:"var(--mobile-bottom-nav, 56px)",width:"auto",height:"auto",transform:`translateX(${Ne}px)`,transition:Te?"none":"transform 180ms ease-out",...H?{display:"none"}:{},...Kt<0?{display:"none"}:{},...Ft||Ue||Re&&le===Re?{}:{display:"none"},...Ot?{visibility:"hidden",pointerEvents:"none"}:{}}:{zIndex:Ue?Q.pinnedWindow:Kt+1,width:vn.w,height:vn.h,top:vn.y,...Co?{borderTopLeftRadius:Co.tl?0:void 0,borderTopRightRadius:Co.tr?0:void 0,borderBottomLeftRadius:Co.bl?0:void 0,borderBottomRightRadius:Co.br?0:void 0}:{},...H&&"right"===st?{right:window.innerWidth-vn.x-vn.w}:{left:vn.x},...Kt<0&&!Ue?{display:"none"}:{},...Ce?{display:"none"}:{},...Dn||Pn||Ot?{visibility:"hidden",pointerEvents:"none"}:{},...Lo??{}},children:[Ee&&!H&&/* @__PURE__ */Se("div",{onPointerDown:Ie,className:"absolute top-0 bottom-0 left-0 w-[22px] z-[5]",style:{touchAction:"pan-y"},"aria-hidden":"true"}),
|
|
48
48
|
/* @__PURE__ */Me("div",{"data-window-surface":"",className:"flex min-h-0 flex-1 flex-col "+(Dr?"backdrop-blur-sm":""),style:Dr?{backgroundColor:Ft?"rgb(var(--window-content-rgb) / var(--active-content-opacity, 0.9))":"rgb(var(--window-content-rgb) / var(--inactive-content-opacity, 0.8))"}:void 0,children:[H?null:Nn?Qe?.home?null:/* @__PURE__ */Me(Le,{children:[
|
|
49
49
|
/* @__PURE__ */Se("h2",{id:Be,"data-window-title":!0,className:"sr-only",children:Zn.text||je}),vo&&yo&&_(
|
|
@@ -51,7 +51,7 @@ return Me("span",{className:"relative inline-flex",onMouseEnter:d,onMouseLeave:u
|
|
|
51
51
|
/* @__PURE__ */Me("div",{onPointerDown:wr,onContextMenu:io,"data-window-chrome":"",...Hr?{"data-window-controls-over":""}:{},...lo,className:Hr?`absolute left-0 z-10 flex ${Vr} items-center px-3 select-none focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400`:`flex items-center gap-3 ${Zr} px-3 shrink-0 cursor-move select-none focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400`,style:{touchAction:"none",...Hr?{top:ao?3:0}:{}},children:[!Zt&&/* @__PURE__ */Me("div",{"data-window-controls":"",className:"group/controls flex shrink-0 items-center",children:[
|
|
52
52
|
/* @__PURE__ */Se("button",{type:"button",onClick:cr,"aria-label":Ke.close,title:Ke.close,className:Cr,children:/* @__PURE__ */Se("span",{"aria-hidden":"true",className:`${Mr} ${Ft?"bg-red-500":"bg-gray-300 group-hover/controls:bg-red-500"}`,children:/* @__PURE__ */Se(G,{name:"close",className:Sr,strokeWidth:3})})}),!V&&/* @__PURE__ */Se("button",{type:"button",onClick:()=>vr($t),"aria-label":Ke.minimize,title:Ke.minimize,className:Cr,children:/* @__PURE__ */Se("span",{"aria-hidden":"true",className:`${Mr} ${Ft?"bg-amber-400":"bg-gray-300 group-hover/controls:bg-amber-400"}`,children:/* @__PURE__ */Se("span",{className:"h-0.5 w-2 rounded-full bg-current opacity-0 group-hover/controls:opacity-100 group-focus-within/controls:opacity-100"})})}),!V&&/* @__PURE__ */Se(Ur,{maximized:Rn,onToggleMax:()=>{Rn?($n(!1),kn(hn())):ho()},onSnap:Nr,buttonClassName:Cr,strings:Ke,children:/* @__PURE__ */Se("span",{"aria-hidden":"true",className:`${Mr} ${Ft?"bg-green-500":"bg-gray-300 group-hover/controls:bg-green-500"}`,children:/* @__PURE__ */Se(G,{name:Rn?"collapse":"expand",className:Sr,strokeWidth:3})})}),F&&/* @__PURE__ */Se("button",{type:"button",onClick:()=>Ve(e=>!e),"aria-label":Ue?Ke.unpin:Ke.pinOnTop,title:Ue?Ke.unpin:Ke.pinOnTop,className:"ml-1 p-0.5 rounded hover:bg-gray-200 "+(Ue?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */Se(G,{name:"bookmark-square",className:"h-3.5 w-3.5",fill:Ue?"currentColor":"none",strokeWidth:1.5})})]}),Hr?
|
|
53
53
|
/* @__PURE__ */Se("h2",{id:Be,"data-window-title":!0,className:"sr-only",children:Zn.text||je}):/* @__PURE__ */Se("div",{"data-window-title":!0,title:je,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:Ft?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:/* @__PURE__ */Se("span",{id:Be,className:"truncate",children:Zt?xn(We):We})})]}),ao&&/* @__PURE__ */Se("div",{"aria-hidden":"true",className:"h-[3px] shrink-0 pointer-events-none",style:{backgroundColor:`rgb(var(--window-accent-rgb) / ${Ft?.9:.55})`}}),
|
|
54
|
-
/* @__PURE__ */Se(wn.Provider,{value:$t,children:/* @__PURE__ */Se(p.Provider,{value:to,children:/* @__PURE__ */Se($.Provider,{value:{rightRef:ht,leftRef:ft,notify:()=>yt(!0),setEditSlot:St,active:Ft,isDirty:Vn,footerOpen:Nt&&!H&&!V&&!J&&!Ee},children:/* @__PURE__ */Se("div",{ref:mt,"data-window-body":"",...H?{onPointerDown:wr,onContextMenu:e=>{e.preventDefault(),at({x:e.clientX,y:e.clientY})}}:{},className:`flex-1 min-h-0 flex flex-col ${H?"p-0 cursor-move":J||Z?"p-0":V?"p-2":Dr?"px-4 pb-4":"p-4"} ${H||Nn||Dr?"":"backdrop-blur-sm"} ${!1===
|
|
54
|
+
/* @__PURE__ */Se(wn.Provider,{value:$t,children:/* @__PURE__ */Se(p.Provider,{value:to,children:/* @__PURE__ */Se($.Provider,{value:{rightRef:ht,leftRef:ft,notify:()=>yt(!0),setEditSlot:St,active:Ft,isDirty:Vn,footerOpen:Nt&&!H&&!V&&!J&&!Ee},children:/* @__PURE__ */Se("div",{ref:mt,"data-window-body":"",...H?{onPointerDown:wr,onContextMenu:e=>{e.preventDefault(),at({x:e.clientX,y:e.clientY})}}:{},className:`flex-1 min-h-0 flex flex-col ${H?"p-0 cursor-move":J||Z?"p-0":V?"p-2":Dr?"px-4 pb-4":"p-4"} ${H||Nn||Dr?"":"backdrop-blur-sm"} ${!1===k||J||Z?"overflow-hidden":"overflow-y-auto overscroll-contain"+(Dr?jr?" mr-1":" mb-2 mr-1":"")} ${H?"rounded-2xl select-none":""}`,style:{...H?{touchAction:"none"}:{},backgroundColor:H||Dr?"transparent":Nn?"rgb(var(--window-content-rgb))":Ft?"rgb(var(--window-content-rgb) / var(--active-content-opacity, 0.9))":"rgb(var(--window-content-rgb) / var(--inactive-content-opacity, 0.8))"},children:/* @__PURE__ */Se(_e,{children:ye})})})})}),H&&it&&/* @__PURE__ */Me(Y,{minWidth:160,style:{left:it.x,top:it.y},onClose:()=>at(null),children:[
|
|
55
55
|
/* @__PURE__ */Se(q,{onClick:()=>{at(null),window.dispatchEvent(new CustomEvent("widget-open-settings",{detail:$t}))},children:"Settings"}),
|
|
56
56
|
/* @__PURE__ */Se(U,{}),oe&&/* @__PURE__ */Me(Le,{children:[oe,
|
|
57
57
|
/* @__PURE__ */Se(U,{})]}),
|
|
@@ -61,8 +61,8 @@ return Me("span",{className:"relative inline-flex",onMouseEnter:d,onMouseLeave:u
|
|
|
61
61
|
/* @__PURE__ */Se(q,{onClick:()=>{at(null),cr()},children:"Close"})]}),
|
|
62
62
|
/* @__PURE__ */Me("div",{onPointerDown:wr,ref:vt,"data-modal-footer":"",...Dr?{"data-modal-footer-bare":""}:{},className:Dr?"h-(--row-height-window-row) px-4 py-1 shrink-0 flex items-center justify-between text-xs select-none cursor-move"+(jr?"":" hidden"):`px-4 py-2 border-t border-gray-200 shrink-0 flex items-center justify-between text-xs select-none${Nn?"":" cursor-move"}${Ft&&!Nn?" backdrop-blur-sm":""}${H||V||J||Ee||!Nt?" hidden":""}`,style:Dr?{touchAction:"none"}:{touchAction:"none",backgroundColor:Nn?"rgb(var(--window-footer-rgb))":Ft?"rgb(var(--window-footer-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-footer-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
63
63
|
/* @__PURE__ */Me("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[T,
|
|
64
|
-
/* @__PURE__ */Se("div",{ref:ft,"data-modal-actions-left":!0,className:"flex items-center gap-2 shrink-0"}),null!=
|
|
65
|
-
/* @__PURE__ */Se("div",{ref:bt,"data-modal-footer-facts":"",className:"min-w-0 flex-1 overflow-hidden",children:/* @__PURE__ */Se("div",{ref:xt,className:"inline-flex items-center gap-2 whitespace-nowrap"+(kt?" invisible":""),children:
|
|
64
|
+
/* @__PURE__ */Se("div",{ref:ft,"data-modal-actions-left":!0,className:"flex items-center gap-2 shrink-0"}),null!=x&&!1!==x&&!Dr&&
|
|
65
|
+
/* @__PURE__ */Se("div",{ref:bt,"data-modal-footer-facts":"",className:"min-w-0 flex-1 overflow-hidden",children:/* @__PURE__ */Se("div",{ref:xt,className:"inline-flex items-center gap-2 whitespace-nowrap"+(kt?" invisible":""),children:x})})]}),
|
|
66
66
|
/* @__PURE__ */Me("div",{"data-modal-footer-right":"",className:"flex items-center gap-2 ml-auto shrink-0",children:[Ct&&W&&(W.editing?/* @__PURE__ */Se(X,{variant:"secondary",size:"sm","data-modal-discard":"",onClick:()=>{dr()},children:Ke.discard}):Mt?_(zo,Mt):zo),
|
|
67
67
|
/* @__PURE__ */Se("div",{ref:ht,"data-modal-actions":!0,className:"flex items-center gap-2"}),z]})]})]}),!H&&!Ee&&!Zt&&Ft&&!zn&&/* @__PURE__ */Me(Le,{children:[
|
|
68
68
|
/* @__PURE__ */Se("div",{onPointerDown:e=>gr(e,"se"),className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize z-10"}),
|
|
@@ -85,5 +85,5 @@ return Me("span",{className:"relative inline-flex",onMouseEnter:d,onMouseLeave:u
|
|
|
85
85
|
/* @__PURE__ */Se("button",{type:"button",onClick:()=>yr($t),title:Ke.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:je||Ke.windowSuffix}),
|
|
86
86
|
/* @__PURE__ */Se("button",{type:"button",onClick:()=>yr($t),title:Ke.restore,"aria-label":Ke.restore,className:"rounded px-2 py-0.5 text-xs leading-none text-ink-faintest hover:bg-gray-100 hover:text-gray-600",children:"▴"}),
|
|
87
87
|
/* @__PURE__ */Se("button",{type:"button",onClick:()=>{cr()},title:Ke.close,"aria-label":Ke.close,className:"rounded px-2 py-0.5 text-xs leading-none text-ink-faintest hover:bg-gray-100 hover:text-gray-600",children:"✕"})]});return _(
|
|
88
|
-
/* @__PURE__ */Me(gn.Provider,{value:null,children:[To,Ao,Po]}),document.body)}"undefined"!=typeof window&&window.addEventListener("keydown",e=>{eo&&"Escape"===e.key&&(go(null),oo(!1))});var ko=500,Eo=250;function Co({children:e,canEdit:t=!0,perms:n,windowId:r}){const[o,i]=Ee(
|
|
88
|
+
/* @__PURE__ */Me(gn.Provider,{value:null,children:[To,Ao,Po]}),document.body)}"undefined"!=typeof window&&window.addEventListener("keydown",e=>{eo&&"Escape"===e.key&&(go(null),oo(!1))});var ko=500,Eo=250;function Co({children:e,canEdit:t=!0,perms:n,windowId:r}){const[o,i]=Ee(v,b),a=ue(/* @__PURE__ */new Map),[s,l]=fe(0),c=s>0,[d,u]=fe(0),[m,h]=fe(0),f=m>0,{hasAnyPerm:p}=A(),w=t&&0===d&&(!(n&&n.length>0)||p(n)),g=ue(null),y=ue(!1),E=we(()=>{const e={};for(const[t,n]of a.current)e[t]=n.getLast();return e},[]),C=we((e,t)=>{a.current.has(e)||l(e=>e+1),a.current.set(e,t)},[]),M=we(e=>{a.current.delete(e)&&l(e=>e-1)},[]),S=we(e=>{u(t=>t+(e?1:-1))},[]),L=we(e=>{h(t=>t+(e?1:-1))},[]),N=ce(re),z=N?.claimReadOnly;he(()=>{if(z&&!w)return z(!0),()=>z(!1)},[z,w]);const T=ue({last:0,count:0,tripped:!1}),D=ue(!1),P=we((e,t,n)=>{if(y.current)return void(n&&x(n.prev,n.next)||(D.current=!0));if(!w||g.current)return;const r=T.current;if(r.tripped)return;const o=Date.now();if(o-r.last>Eo&&(r.count=0),r.last=o,++r.count>ko)return r.tripped=!0,void console.error(`[efficient-shell] UndoProvider: "${e}" recorded ${ko} 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:E(),label:e,coalesceKey:t},queueMicrotask(()=>{const e=g.current;g.current=null,e&&i({type:"record",step:e})})},[w,E]),I=we(e=>{for(const[t,n]of Object.entries(e)){const e=a.current.get(t);e&&(e.setLast(n),e.apply(n))}},[]),R=we(()=>{const e=o.past[o.past.length-1];if(!e)return;const t={values:E(),label:e.label,coalesceKey:null};I(e.values),i({type:"undo",redoStep:t})},[o.past,E,I]),W=we(()=>{const e=o.future[0];if(!e)return;const t={values:E(),label:e.label,coalesceKey:null};I(e.values),i({type:"redo",undoStep:t})},[o.future,E,I]),[$,O]=fe(0),K=ue(0),j=ue(0),F=ue(!1),B=we(()=>{y.current=!0,D.current=!1,g.current=null,K.current+=1,j.current=K.current,O(K.current)},[]),H=ue(void 0),Y=we(e=>{void 0!==e&&(void 0!==H.current&&e!==H.current&&(F.current=!0),H.current=e),B()},[B]);he(()=>{y.current&&$===j.current&&(y.current=!1,g.current=null,(D.current||F.current)&&i({type:"clear"}),D.current=!1,F.current=!1)},[$]);const q=we(()=>{F.current=!0,i({type:"clear"}),B()},[B]),U=w&&o.past.length>0,V=w&&o.future.length>0,X=Zr(r),G=ue([]),J=ue({undo:R,redo:W,canUndo:U,canRedo:V});J.current={undo:R,redo:W,canUndo:U,canRedo:V};const _=ue(w);_.current=w;const Q=we(e=>{if(!_.current)return;const t=k(e);if(!t)return;const n=G.current[G.current.length-1],r=n?{undo:n.undo,redo:n.redo,canUndo:n.canUndo(),canRedo:n.canRedo()}:J.current;("undo"===t?r.canUndo:r.canRedo)&&(e.preventDefault(),"undo"===t?r.undo():r.redo())},[]);he(()=>{if(X&&w)return window.addEventListener("keydown",Q),()=>window.removeEventListener("keydown",Q)},[X,w,Q]);const Z=we(e=>(G.current=[...G.current,e],()=>{G.current=G.current.filter(t=>t!==e)}),[]),ee=we(e=>{const t=e=>Q(e);return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)},[Q]),te=xe(()=>({register:C,unregister:M,record:P,undo:R,redo:W,clear:q,baseline:Y,canUndo:U,canRedo:V,enabled:w,hasState:c,claimReadOnly:S,declaredEditable:f,claimEditable:L,addSource:Z,bindKeys:ee,undoLabel:U?o.past[o.past.length-1].label:null,redoLabel:V?o.future[0].label:null}),[C,M,P,R,W,q,Y,U,V,w,c,S,f,L,Z,ee,o.past,o.future]);/* @__PURE__ */
|
|
89
89
|
return Se(re.Provider,{value:te,children:e})}function Mo(){const e=ce(re),t=we(()=>{},[]);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 So(e){const t=ce(re),n=t?.claimReadOnly,r=t?.claimEditable;he(()=>{const t=e?r:n;if(t)return t(!0),()=>t(!1)},[n,r,e])}export{Dn as CancelButton,Ke as DesktopHostProvider,bt as DocFavStar,lt as EntityWindowFallback,at as EntityWindowLoading,ct as EntityWindowState,bn as MODAL_SUBMIT_SELECTOR,xo as Modal,An as ModalActions,Tn as ModalMoreActions,Co as UndoProvider,Re as WINDOW_REGISTRY,Je as WindowCrashedFallback,zn as WindowEditSlot,_e as WindowErrorBoundary,Ft as WindowManagerProvider,Sn as WindowTitle,St as activateWindowById,en as beginWindowGesture,fr as cancelWindowFront,$e as client_default,yo as commitExposeHighlight,hr as confirmWindowDiscard,tn as drainPerfEvents,ao as exitExposeMode,Yn as forgetMaximizedWindowBoxes,zt as getActiveWindowRoute,wo as getExposeHighlight,pn as getWindowChromeVersion,Bn as getWindowPosition,ut as isDraftEntityId,mt as isDraftEntityWindow,De as isEntityEntry,Ae as isPageEntry,We as isShellApiClientConfigured,nt as isTabWindow,Zt as markMenuOpen,hn as readWindowChrome,dr as requestWindowFront,go as setExposeHighlight,Qt as setPerfCollecting,qe as setShellHomeRoute,Ge as setShellTabStrip,Ie as setShellWindowRegistry,Fn as setWindowDefaultPosition,Hn as setWindowPosition,sn as splitTitle,po as subscribeExposeHighlight,fn as subscribeWindowChrome,rt as tabGroupOf,io as toggleExposeMode,ar as useCurrentTabKey,je as useDesktopHost,Nn as useEnclosingModalId,Zr as useIsActiveWindow,Be as usePageSearch,Mo as useUndo,So as useUndoCanEdit,En as useWidgetSettings,pt as useWindowDirty,gt as useWindowManager,Mn as useWindowMenuItem,Ln as useWindowTitle,mr as windowHoldsChanges};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as c}from"react/jsx-runtime";function e({size:e=18,...r}){/* @__PURE__ */
|
|
2
|
+
return c("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",...r,children:/* @__PURE__ */c("path",{fillRule:"evenodd",d:"M7.5,3h5c0.49841,0.03274 1.09349,0.26507 1.41421,0.58579c0.32072,0.32072 0.55305,0.9158 0.58579,1.41421v10c-0.03274,0.49841 -0.26507,1.09349 -0.58579,1.41421c-0.32072,0.32072 -0.9158,0.55305 -1.41421,0.58579h-5c-0.49841,-0.03274 -1.09349,-0.26507 -1.41421,-0.58579c-0.32072,-0.32072 -0.55305,-0.9158 -0.58579,-1.41421v-10c0.03274,-0.49841 0.26507,-1.09349 0.58579,-1.41421c0.32072,-0.32072 0.9158,-0.55305 1.41421,-0.58579zM4.375,9.25c-0.41421,0 -0.75,0.33579 -0.75,0.75c0,0.41421 0.33579,0.75 0.75,0.75l-0.69096,0c0.26384,0.29448 0.25427,0.74734 -0.02871,1.03033c-0.29289,0.29289 -0.76777,0.29289 -1.06066,0l-1.25,-1.25c-0.29289,-0.29289 -0.29289,-0.76777 0,-1.06066l1.25,-1.25c0.29289,-0.29289 0.76777,-0.29289 1.06066,0c0.28299,0.28299 0.29256,0.73585 0.02871,1.03033zM15.625,10.75c0.41421,0 0.75,-0.33579 0.75,-0.75c0,-0.41421 -0.33579,-0.75 -0.75,-0.75h0.69096c-0.26384,-0.29448 -0.25427,-0.74734 0.02871,-1.03033c0.29289,-0.29289 0.76777,-0.29289 1.06066,0l1.25,1.25c0.29289,0.29289 0.29289,0.76777 0,1.06066l-1.25,1.25c-0.29289,0.29289 -0.76777,0.29289 -1.06066,0c-0.28299,-0.28299 -0.29256,-0.73585 -0.02871,-1.03033z"})})}export{e as ScrollExpandMiniIcon};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r="16.7.0",a=r;export{a as APP_VERSION,r as VERSION};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useWindowMenuItem as e,Modal as t}from"./chunk-
|
|
1
|
+
import{useWindowMenuItem as e,Modal as t}from"./chunk-MIHPFJCP.js";import{navIcons as r}from"./chunk-VIPNHDD3.js";import{VERSION as n}from"./chunk-OYB2ZLJ3.js";import{Icon as s}from"./chunk-ISVODSRP.js";import{DEFAULT_SHELL_STRINGS as i,useShellStrings as o,splitAround as a}from"./chunk-NRHG4R2Q.js";import{useState as l,useCallback as m,isValidElement as c,cloneElement as p}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";var h=i.aboutApp,x={notepad:{name:"Notepad",version:"1.1.0",route:"/notepad",description:h.notepad},preview:{name:"Preview",version:"1.5.1",route:"/preview",description:h.preview},files:{name:"Files",version:"2.0.1",route:"/files",description:h.files},browser:{name:"Browser",version:"1.0.3",route:"/browser",description:h.browser}},u=/* @__PURE__ */d(s,{name:"info",className:"h-4 w-4",strokeWidth:1.5}),w=/* @__PURE__ */d(s,{name:"window",className:"h-9 w-9",strokeWidth:1.5});function N({app:s}){const i=x[s],[h,N]=l(!1),v=m(()=>N(!0),[]),b=o().aboutApp,k=b.title(i.name);if(e(k,v,u),!h)return null;const g=r[i.route],y=c(g)?p(g,{className:"h-9 w-9"}):w,[j,P]=a(b.partOf);/* @__PURE__ */
|
|
2
2
|
return d(t,{open:!0,onClose:()=>N(!1),title:k,size:"sm",compact:!0,bodyScroll:!1,autoHeight:!0,dimensions:[320,320],children:/* @__PURE__ */f("div",{className:"flex flex-col items-center text-center px-5 pt-5 pb-4",children:[
|
|
3
3
|
/* @__PURE__ */d("div",{className:"flex h-16 w-16 items-center justify-center rounded-2xl bg-gray-100 text-gray-600 shrink-0",children:y}),
|
|
4
4
|
/* @__PURE__ */d("h2",{className:"mt-3 text-lg font-bold text-gray-900",children:i.name}),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{SearchableSelect as e}from"./chunk-DFI5EHSV.js";import{
|
|
2
|
-
return f(e,{"aria-label":
|
|
3
|
-
return f(
|
|
1
|
+
import{SearchableSelect as e}from"./chunk-DFI5EHSV.js";import{Select_default as a}from"./chunk-W7HTHKN2.js";import{labelClasses as l}from"./chunk-EQKUFYX6.js";import{isSafeLinkHref as t}from"./chunk-Z5TE3MEG.js";import{Input_default as r}from"./chunk-BYTQRQ5P.js";import{INPUT_SIZES as n}from"./chunk-AYZY3YNC.js";import{Button_default as i}from"./chunk-37FQVY2O.js";import{Icon as o}from"./chunk-ISVODSRP.js";import{registerModalEscapeInterceptor as s}from"./chunk-TWVUQUUD.js";import{useShellStrings as u}from"./chunk-NRHG4R2Q.js";import{useId as d,useRef as c,useState as p,useEffect as m}from"react";import{jsx as f,jsxs as v,Fragment as g}from"react/jsx-runtime";function h(e){return"select"===e.type?e.options:"groups"===e.type?e.groups.flatMap(e=>e.options):[]}var b="address",x={kindOf:()=>b,targetOf:e=>e,readFilter:()=>null,withFilter:e=>e},k=e=>t(e.trim());function y(t){const{value:n,kinds:o,rules:y=x,filtersFor:w,label:N,readOnly:C,placeholder:F,className:O="",tidyAddress:j,addressAddon:E}=t,T=void 0!==t.onApply,$=u().link,z=y.isSafe??k,A=d(),D=c(null),Q=c(null),[R,Y]=p({url:n}),H=T?R.url:n,[P,S]=p(!1),[K,U]=p(null),[V,W]=p(null),[B,M]=p(!1),G=c(null),I=c(()=>{});I.current=T?t.onCancel:()=>{},m(()=>{if(T)return s(e=>{const a=D.current;return!!("Escape"===e.key&&a&&e.target instanceof Node&&a.contains(e.target))&&(I.current(),!0)},()=>D.current)},[T]),m(()=>{if(!T)return;const e=Q.current;e?(e.focus(),e.select()):D.current?.querySelector("button, input")?.focus()},[]);const L=o??[{value:b,label:$.address,target:{type:"text"}}],Z=K&&K.against===H?K.kind:y.kindOf(H),q=L.filter(e=>!e.hideWhenEmpty||h(e.target).length>0||e.value===Z),X=q.find(e=>"text"===e.target.type),J=q.find(e=>e.value===Z)??X??q[0];if(!J)return null;const _="text"!==J.target.type,ee=_?y.targetOf(H):H,ae=h(J.target),le=ae.find(e=>e.value===ee),te=e=>({value:e,label:$.unavailable(e)}),re="select"===J.target.type&&ee&&w?w(ee):null,ne=re?y.readFilter(H):null,ie=ne?re?.find(e=>e.param===ne.param):void 0,oe=V&&V.against===H?V.text:H,se=_?H:j?j(oe.trim()).trim():oe.trim(),ue=T&&j?se:oe,de=!_&&""!==ue.trim()&&!z(ue),ce=de&&(!T||P);_&&B&&M(!1);const pe=(e,a)=>{T?Y({url:e,name:a}):void 0===a?t.onChange(e):t.onChange(e,a)},me=(e,a)=>{U(a=>a?{...a,against:e}:a),pe(e,a)},fe=e=>{if(!e)return me("");const a=ae.find(a=>a.value===e);me(e,a?.label)},ve=e=>{S(!1);const a=e.trim();a?z(e)?(W({text:e,against:a}),me(a)):W({text:e,against:H}):(W({text:e,against:""}),me(""))},ge=e=>{const a=e.relatedTarget;if(a&&(a===Q.current||G.current?.contains(a)))return;if(M(!1),T||!j||C)return;const l=j(oe.trim());l.trim()!==oe.trim()&&ve(l)},he=()=>{if(!T||!se)return;if(!_&&de)return void S(!0);const e=_&&R.url===se?R.name:void 0,a=t.onApply;void 0===e?a(se):a(se,e)},be=(e,a)=>a&&!e.some(e=>e.value===a)?[te(a),...e]:[...e],xe=(l,t,r,n,i)=>{const o=[];for(const e of r){const a=o[o.length-1],l={value:e.value,label:e.label};e.group?a&&"options"in a&&a.label===e.group?a.options.push(l):o.push({label:e.group,options:[l]}):o.push(l)}if(i){const a=r.some(e=>""===e.value);/* @__PURE__ */
|
|
2
|
+
return f(e,{"aria-label":l,value:t,options:o,disabled:C,clearable:a,placeholder:r.find(e=>""===e.value)?.label,onChange:n})}/* @__PURE__ */
|
|
3
|
+
return f(a,{size:"sm","aria-label":l,value:t,options:o,readOnly:C,onChange:n})};let ke;if("text"===J.target.type)ke=/* @__PURE__ */f(r,{ref:Q,id:`${A}-address`,size:"sm",type:"text",invalid:ce,"aria-label":$.address,"aria-describedby":ce?`${A}-why`:void 0,placeholder:F??$.addressPlaceholder,spellCheck:!1,autoComplete:"off",value:oe,readOnly:C,onChange:e=>ve(e.target.value),onFocus:()=>M(!0),onBlur:ge,onKeyDown:j&&!T?e=>{"Enter"===e.key&&e.currentTarget.blur()}:void 0});else{const e="groups"===J.target.type?J.target.groups.flatMap(e=>e.options.map(a=>({value:a.value,label:a.label,group:e.label}))):J.target.options.map(e=>({value:e.value,label:e.label})),a=[{value:"",label:J.target.placeholder},...be(e,ee)];ke=xe(J.label,ee,a,fe,e.length>10)}const ye=/* @__PURE__ */v(g,{children:[o&&xe($.linkType,J.value,q.map(e=>({value:e.value,label:e.label})),e=>{W(null),S(!1);const a=q.find(a=>a.value===e);if(!a||"text"===a.target.type)return void U({kind:e,against:H});const l=h(a.target)[0];U({kind:e,against:l?l.value:""}),l?pe(l.value,l.label):pe("")},!1),ke,E&&B&&!C&&"text"===J.target.type&&/* @__PURE__ */f("div",{ref:G,onBlur:ge,children:E({url:oe,onChange:ve})}),re&&xe($.filter,ne?.param??"",[{value:"",label:$.noFilter},...ne&&!ie?[te(ne.param)]:[],...re.map(e=>({value:e.param,label:e.label}))],e=>{if(!e)return me(ee,le?.label);const a=re?.find(a=>a.param===e),l=a?.values[0];l&&me(y.withFilter(ee,{param:e,value:l.value}),l.label)},!1),re&&ne&&xe($.value,ne.value,be((ie?.values??[]).map(e=>({value:e.value,label:e.label})),ne.value),e=>{if(!ne)return;const a=ie?.values.find(a=>a.value===e);me(y.withFilter(ee,{param:ne.param,value:e}),a?.label)},(ie?.values.length??0)>10),ce&&/* @__PURE__ */f("p",{id:`${A}-why`,role:"alert",className:"text-2xs leading-4 text-red-600",children:$.unsafe}),J.hint&&/* @__PURE__ */f("p",{className:"text-2xs leading-4 text-ink-faintest",children:J.hint}),re&&/* @__PURE__ */f("p",{className:"text-2xs leading-4 text-ink-faintest",children:$.filterHint})]});if(!T)/* @__PURE__ */
|
|
4
4
|
return f("div",{ref:D,className:`flex min-w-0 flex-auto flex-col gap-2 ${O}`.trim(),role:N?"group":void 0,"aria-label":N,children:ye});const we=t.onRemove;/* @__PURE__ */
|
|
5
|
-
return v("div",{ref:D,role:"dialog","aria-label":N??$.title,className:`flex min-w-0 flex-col gap-2 rounded-xl border border-line bg-surface p-3 shadow-lg ${O}`.trim(),onKeyDown:e=>{"Enter"!==e.key||e.defaultPrevented||e.target instanceof Element&&e.target.closest("button")||(e.preventDefault(),he())},children:[_?/* @__PURE__ */f("span",{className:
|
|
5
|
+
return v("div",{ref:D,role:"dialog","aria-label":N??$.title,className:`flex min-w-0 flex-col gap-2 rounded-xl border border-line bg-surface p-3 shadow-lg ${O}`.trim(),onKeyDown:e=>{"Enter"!==e.key||e.defaultPrevented||e.target instanceof Element&&e.target.closest("button")||(e.preventDefault(),he())},children:[_?/* @__PURE__ */f("span",{className:l({inline:!0}),children:$.title}):/* @__PURE__ */f("label",{htmlFor:`${A}-address`,className:l({inline:!0}),children:$.title}),ye,
|
|
6
6
|
/* @__PURE__ */v("div",{className:"flex items-center justify-between gap-2",children:[we?/* @__PURE__ */f(i,{variant:"ghost-danger",size:"sm","data-window-action":"remove",onClick:we,children:$.remove}):null,
|
|
7
7
|
/* @__PURE__ */v("span",{className:"ml-auto flex gap-1",children:[
|
|
8
8
|
/* @__PURE__ */f(i,{variant:"secondary",size:"sm","data-window-action":"cancel",onClick:()=>I.current(),children:$.cancel}),
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as c}from"react/jsx-runtime";function l({size:l=18,...e}){/* @__PURE__ */
|
|
2
|
+
return c("svg",{width:l,height:l,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...e,children:/* @__PURE__ */c("path",{fillRule:"evenodd",d:"M9,3.75h6c0.56745,0.03274 1.22503,0.29305 1.59099,0.65901c0.36596,0.36596 0.62627,1.02354 0.65901,1.59099v12c-0.03274,0.56745 -0.29305,1.22503 -0.65901,1.59099c-0.36596,0.36596 -1.02354,0.62627 -1.59099,0.65901h-6c-0.56745,-0.03274 -1.22503,-0.29305 -1.59099,-0.65901c-0.36596,-0.36596 -0.62627,-1.02354 -0.65901,-1.59099v-12c0.03274,-0.56745 0.29305,-1.22503 0.65901,-1.59099c0.36596,-0.36596 1.02354,-0.62627 1.59099,-0.65901zM6,12c0,0.41421 -0.33579,0.75 -0.75,0.75h-1.18934l0.21967,0.21967c0.29289,0.29289 0.29289,0.76777 0,1.06066c-0.29289,0.29289 -0.76777,0.29289 -1.06066,0l-1.5,-1.5c-0.07191,-0.07191 -0.12616,-0.15478 -0.16276,-0.24324c-0.03667,-0.08843 -0.05691,-0.1854 -0.05691,-0.28709c0,-0.10169 0.02024,-0.19866 0.05691,-0.28709c0.0366,-0.08846 0.09085,-0.17134 0.16276,-0.24324l1.5,-1.5c0.29289,-0.29289 0.76777,-0.29289 1.06066,0c0.29289,0.29289 0.29289,0.76777 0,1.06066l-0.21967,0.21967h1.18934c0.41421,0 0.75,0.33579 0.75,0.75zM18,12c0,-0.41421 0.33579,-0.75 0.75,-0.75h1.18934l-0.21967,-0.21967c-0.29289,-0.29289 -0.29289,-0.76777 0,-1.06066c0.29289,-0.29289 0.76777,-0.29289 1.06066,0l1.5,1.5c0.07191,0.07191 0.12616,0.15478 0.16276,0.24324c0.03667,0.08843 0.05691,0.1854 0.05691,0.28709c0,0.10169 -0.02024,0.19866 -0.05691,0.28709c-0.0366,0.08846 -0.09085,0.17134 -0.16276,0.24324l-1.5,1.5c-0.29289,0.29289 -0.76777,0.29289 -1.06066,0c-0.29289,-0.29289 -0.29289,-0.76777 0,-1.06066l0.21967,-0.21967h-1.18934c-0.41421,0 -0.75,-0.33579 -0.75,-0.75z"})})}export{l as ScrollExpandSolidIcon};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=["entrance","hover","scroll","loop","click","mouse","webgl","countUp"],t=(e,t,o,r)=>({default:e,min:t,max:o,step:r}),o={entrance:{duration:t(.6,0,4,.1),delay:t(0,0,4,.1)},hover:{duration:t(.7,0,2,.1),delay:t(0,0,2,.1)},loop:{duration:t(50,1,120,1),delay:t(0,0,10,.1)},click:{duration:t(.3,0,2,.1),delay:t(0,0,2,.1)},countUp:{duration:t(1.4,0,4,.1),delay:t(0,0,4,.1)}},r=/^\s*-?\d+(\.\d+)?\s*$/;function a(e,t,a){const n=o[e][t],i="number"==typeof a?a:"string"==typeof a&&r.test(a)?Number(a):Number.NaN;if(Number.isNaN(i))return n.default;const u=Math.min(n.max,Math.max(n.min,i)),c=Math.round(Number((u/n.step).toFixed(6)));return Number((c*n.step).toFixed(3))}var n={arrive:"cubic-bezier(0.22, 1, 0.36, 1)",loop:"linear",media:"cubic-bezier(0.2, 0.6, 0.2, 1)",smooth:"cubic-bezier(0.45, 0, 0.25, 1)"},i={zoom:1.04,liftPx:3,rotateFallbackDeg:72};function u(e){return"number"==typeof e&&Number.isInteger(e)&&e>=2?Number((360/e).toFixed(3)):i.rotateFallbackDeg}var c=e=>`--page-ease-${e}`;function l(){const e={};for(const t of Object.keys(o)){const r=t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);e[`--page-motion-${r}-duration`]=`${o[t].duration.default}s`,e[`--page-motion-${r}-delay`]=`${o[t].delay.default}s`}for(const[t,o]of Object.entries(n))e[c(t)]=o;return e["--page-hover-zoom"]=String(i.zoom),e["--page-hover-lift"]=`${i.liftPx}px`,e["--page-hover-rotate"]=`${i.rotateFallbackDeg}deg`,e}export{i as HOVER_MOTION,n as MOTION_EASING,e as MOTION_GROUPS,o as MOTION_TIMING,l as motionCustomProperties,a as motionSeconds,c as pageEaseVar,u as rotateDegrees};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{motionSeconds as t}from"./chunk-
|
|
1
|
+
import{motionSeconds as t}from"./chunk-XCTS44UZ.js";import{parseOption as e}from"./chunk-YPXONNBV.js";var n=["none","fade","rise","scale","glide","bounce","flip","reveal","spin"],r=["glide","bounce","flip","reveal"],o=["top","bottom","left","right"],i="bottom",a="data-motion-entrance",d="--motion-entrance-duration",s="--motion-entrance-delay",u="data-motion-from",c="data-motion-state";function f(a,d,s,u){const c=e(n,"none",a),f=(t=>r.includes(t))(c)?e(o,i,d):null;return{kind:c,from:f,duration:t("entrance","duration",s),delay:t("entrance","delay",u)}}function m(t){if("none"===t.kind)return{attrs:{},style:{}};const e={[a]:t.kind};t.from&&(e[u]=t.from);const n={},r=f("fade");return t.duration!==r.duration&&(n[d]=`${t.duration}s`),t.delay!==r.delay&&(n[s]=`${t.delay}s`),{attrs:e,style:n}}function l(t){const e=()=>{};if("undefined"==typeof IntersectionObserver)return e;if(!t.getAttribute(a))return e;const n=window.innerHeight||document.documentElement.clientHeight;if(t.getBoundingClientRect().top<n)return e;t.setAttribute(c,"armed");const r=new IntersectionObserver(e=>{for(const n of e)if(n.isIntersecting){r.disconnect(),b(t);break}},{threshold:0});return r.observe(t),()=>{r.disconnect(),t.removeAttribute(c)}}function b(t){if(!t.getAttribute(a))return;t.removeAttribute(c),t.offsetWidth,t.setAttribute(c,"play");const e=n=>{n.target===t&&(t.removeAttribute(c),t.removeEventListener("animationend",e))};t.addEventListener("animationend",e)}export{a as ENTRANCE_ATTR,s as ENTRANCE_DELAY_VAR,d as ENTRANCE_DURATION_VAR,o as ENTRANCE_FROM,u as ENTRANCE_FROM_ATTR,i as ENTRANCE_FROM_DEFAULT,n as ENTRANCE_KINDS,r as ENTRANCE_KINDS_WITH_FROM,c as ENTRANCE_STATE_ATTR,l as armEntrance,m as entranceAttrs,b as playEntrance,f as readEntrance};
|