efficient-shell 5.6.1 → 6.4.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 +184 -44
- package/THIRD_PARTY_NOTICES.md +212 -0
- package/dist/Browser-USPZWDYH.js +43 -0
- package/dist/Calculator-FP5HUWCW.js +29 -0
- package/dist/ConfirmDialog-3TIHKJRT.js +1 -0
- package/dist/{CurrencyConverter-2IGOOR3I.js → CurrencyConverter-XD5LYOCD.js} +8 -8
- package/dist/Documents-ADFEHEUW.js +52 -0
- package/dist/Files-BVUVRNC5.js +87 -0
- package/dist/Notepad-WJI5ODGS.js +25 -0
- package/dist/PdfViewer-226I3LSD.js +1 -0
- package/dist/PomodoroTimer-GEMQHIPJ.js +91 -0
- package/dist/Preview-HNSEYNZL.js +182 -0
- package/dist/Sidebar-PVHZPNIY.js +44 -0
- package/dist/{Spreadsheet-SRAUU3OA.js → Spreadsheet-6Z5ACGTT.js} +14 -14
- package/dist/{Stock-7EKOAQ7C.js → Stock-X3LIU4ZX.js} +4 -4
- package/dist/{Weather-RWI6NKB2.js → Weather-BLO354GM.js} +14 -14
- package/dist/{WorldClock-CEHWDFEO.js → WorldClock-BAH7QFRG.js} +7 -7
- package/dist/apps/index.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/brand.css +1 -1
- package/dist/chunk-2SSRFEOZ.js +91 -0
- package/dist/{chunk-TFETN2GI.js → chunk-4JZZLUGG.js} +1 -1
- package/dist/{chunk-GG7AE6OC.js → chunk-5K76RQML.js} +1 -1
- package/dist/chunk-5LUN632W.js +5 -0
- package/dist/chunk-5MDQNFOG.js +9 -0
- package/dist/chunk-7IQ3B77H.js +1 -0
- package/dist/{chunk-SKB6L53D.js → chunk-7PGHRG6J.js} +9 -9
- package/dist/chunk-CXJQ42XT.js +21 -0
- package/dist/chunk-DBXZS7OA.js +29 -0
- package/dist/{chunk-X4FJ54PP.js → chunk-FIEA5CGB.js} +1 -1
- package/dist/chunk-GJ37JCC2.js +1 -0
- package/dist/{chunk-KXAUDC3A.js → chunk-GWDVD3VQ.js} +27 -27
- package/dist/chunk-HQLAISFX.js +11 -0
- package/dist/chunk-I2H2CKID.js +3 -0
- package/dist/{chunk-YIH6JLMV.js → chunk-I534M65N.js} +2 -2
- package/dist/{chunk-WWF2EQXF.js → chunk-IHZL3GJU.js} +1 -1
- package/dist/chunk-K6DKX55N.js +1 -0
- package/dist/chunk-KNUR2UEG.js +1 -0
- package/dist/{chunk-JXAAZGLJ.js → chunk-MORDXCV6.js} +1 -1
- package/dist/chunk-PFKMIPZH.js +1028 -0
- package/dist/chunk-PJPK2ADX.js +1 -0
- package/dist/chunk-Q5O5UMJY.js +6 -0
- package/dist/chunk-QJHWLDEN.js +108 -0
- package/dist/chunk-R5VRLW5Z.js +1 -0
- package/dist/chunk-S3LGKIZ3.js +12 -0
- package/dist/chunk-SBF5A6XV.js +1 -0
- package/dist/chunk-SK5DL6JX.js +24 -0
- package/dist/{chunk-CLPJDJH4.js → chunk-UUYPUKP7.js} +1 -1
- package/dist/{chunk-AFYQTVZO.js → chunk-UVBK6YSR.js} +1 -1
- package/dist/chunk-VR6TR575.js +13 -0
- package/dist/{chunk-7WC3EOFS.js → chunk-XO2AMGVU.js} +1 -1
- package/dist/{chunk-N3A3GWJI.js → chunk-YX2IMURA.js} +12 -12
- package/dist/chunk-ZEIKSMFR.js +10 -0
- package/dist/client-DLm3Fvbc.d.ts +65 -0
- package/dist/file-intake/index.js +1 -1
- package/dist/i18n/index.d.ts +1 -1
- package/dist/icons/efficient-looks.d.ts +1 -1
- package/dist/icons/efficient.d.ts +1 -1
- package/dist/icons/index.d.ts +12 -12
- package/dist/icons/index.js +1 -1
- package/dist/{index-ZI6vl2Wq.d.ts → index-D5bms_uA.d.ts} +186 -76
- package/dist/index.d.ts +6 -4
- package/dist/index.js +639 -639
- package/dist/locales/zh-Hans.d.ts +1 -1
- package/dist/locales/zh-Hans.js +1 -1
- package/dist/map/index.js +22 -22
- package/dist/markdown/index.js +6 -6
- package/dist/markup/index.d.ts +460 -36
- package/dist/markup/index.js +1 -1
- package/dist/page-tabs/index.js +5 -5
- package/dist/pdf/index.js +1 -1
- package/dist/{registry-J-TU7zKx.d.ts → registry-Dw6QO2Ch.d.ts} +12 -9
- package/dist/{strings-BVB64Nck.d.ts → strings-fYzxZPn4.d.ts} +5 -0
- package/dist/telemetry/index.d.ts +39 -0
- package/dist/telemetry/index.js +1 -0
- package/dist/ui/index.d.ts +4 -3
- package/dist/ui/index.js +1 -1
- package/dist/ui.css +62 -21
- package/package.json +7 -21
- package/dist/Browser-RXGEZ77D.js +0 -43
- package/dist/Calculator-MVPKTZZF.js +0 -29
- package/dist/ConfirmDialog-XOYCYFA7.js +0 -1
- package/dist/Documents-YBLR7WVX.js +0 -52
- package/dist/Files-7XNR5IL2.js +0 -87
- package/dist/Notepad-ZQYQXV75.js +0 -25
- package/dist/PdfViewer-SQVMMA7B.js +0 -1
- package/dist/PomodoroTimer-XIUN4M73.js +0 -91
- package/dist/Preview-YCOA5JPP.js +0 -182
- package/dist/Sidebar-VI7E3EKI.js +0 -44
- package/dist/chunk-3HJTOINK.js +0 -1
- package/dist/chunk-4SWPNARR.js +0 -5
- package/dist/chunk-5ABLFFC5.js +0 -24
- package/dist/chunk-6LTDJKIL.js +0 -138
- package/dist/chunk-F6B3J3GW.js +0 -6
- package/dist/chunk-HZZNJHRH.js +0 -1
- package/dist/chunk-IMMHJIV5.js +0 -29
- package/dist/chunk-OGXU7QFW.js +0 -12
- package/dist/chunk-P4CIOJHP.js +0 -3
- package/dist/chunk-RBDGN4YU.js +0 -9
- package/dist/chunk-RC2EG6P4.js +0 -1026
- package/dist/chunk-RL626E7Q.js +0 -13
- package/dist/chunk-RMJZOKHY.js +0 -10
- package/dist/chunk-SFCDHHQP.js +0 -1
- package/dist/chunk-TNBCUZVE.js +0 -1
- package/dist/chunk-VWBQ2P5G.js +0 -108
- package/dist/chunk-XWSWYMGM.js +0 -2
- package/dist/chunk-YGC7AX3X.js +0 -11
- package/dist/chunk-Z7D6Y5WA.js +0 -21
- package/dist/icons/heroicons.d.ts +0 -6
- package/dist/icons/heroicons.js +0 -1
- package/dist/icons/lucide.d.ts +0 -6
- package/dist/icons/lucide.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={bold:{open:"**",close:"**",placeholder:"bold text"},italic:{open:"_",close:"_",placeholder:"italic text"},strike:{open:"~~",close:"~~",placeholder:"struck out"},code:{open:"`",close:"`",placeholder:"code"},highlight:{open:"==",close:"==",placeholder:"highlighted text"},quiet:{open:"^^",close:"^^",placeholder:"quiet text"},underline:{open:"[",close:"]{underline}",placeholder:"underlined text"},sup:{open:"[",close:"]{sup}",placeholder:"superscript"},sub:{open:"[",close:"]{sub}",placeholder:"subscript"}};function t(e){return/^[a-z][a-z0-9-]*$/.test(e)}function n(e){return t(e)||/^#[0-9a-fA-F]{6}$/.test(e)}function l(e){return n(e)?e.startsWith("#")?e.toLowerCase():e:null}function r(e,t){const n=/^\{(underline|sup|sub|color=([a-z][a-z0-9-]*|#[0-9a-fA-F]{6}))\}/.exec(e.slice(t,t+64));return n?void 0===n[2]?{kind:n[1],length:n[0].length}:{kind:"color",color:n[2],length:n[0].length}:null}var s={bold:e.bold.placeholder,italic:e.italic.placeholder,strike:e.strike.placeholder,code:e.code.placeholder,highlight:e.highlight.placeholder,quiet:e.quiet.placeholder,link:"link text",underline:e.underline.placeholder,sup:e.sup.placeholder,sub:e.sub.placeholder,color:"colored text"},i={bullet:()=>"- ",number:e=>`${e+1}. `,quote:()=>"> "};function o(t,n,l,r,o=k,c=s){if("clear"===r)return W(t,n,l,o);const u=t.slice(n,l);if("link"===r){const e=u||c.link,r=`[${e}](https://)`;return{text:t.slice(0,n)+r+t.slice(l),selectionStart:n+e.length+3,selectionEnd:n+r.length-1}}const h=i[r];if(h){const e=t.lastIndexOf("\n",Math.max(n-1,0))+1,r=t.indexOf("\n",l),s=-1===r?t.length:r,i=t.slice(e,s).split("\n"),o=i.every((e,t)=>e.startsWith(h(t))),c=i.map((e,t)=>o?e.slice(h(t).length):h(t)+e).join("\n");return{text:t.slice(0,e)+c+t.slice(s),selectionStart:e,selectionEnd:e+c.length}}const{open:f,close:d}=e[r],m=r,p=c[m]??s[m];if(a(t,n,l,r))return{text:t.slice(0,n-f.length)+u+t.slice(l+d.length),selectionStart:n-f.length,selectionEnd:n-f.length+u.length};const b=u||p;return{text:t.slice(0,n)+f+b+d+t.slice(l),selectionStart:n+f.length,selectionEnd:n+f.length+b.length}}function c(e,t,n,i,o=s){const c={text:e,selectionStart:t,selectionEnd:n};if(null!==i){const e=l(i);if(null===e)return c;i=e}const a=e.slice(t,n),u=t>=1&&"["===e[t-1]&&"]"===e[n]?r(e,n+1):null;if("color"===u?.kind){const l=t-1,r=e.slice(n+1+u.length);return null===i?{text:e.slice(0,l)+a+r,selectionStart:l,selectionEnd:l+a.length}:{text:`${e.slice(0,n)}]{color=${i}}${r}`,selectionStart:t,selectionEnd:n}}if(null===i)return c;const h=a||(o.color??s.color);return{text:`${e.slice(0,t)}[${h}]{color=${i}}${e.slice(n)}`,selectionStart:t+1,selectionEnd:t+1+h.length}}function a(t,n,l,r){const s=e[r];if(!s)return!1;const{open:i,close:o}=s;return n>=i.length&&t.slice(n-i.length,n)===i&&t.slice(l,l+o.length)===o}function u(e,t,n){const l=0===t?0:e.lastIndexOf("\n",t-1)+1;for(let r=e.lastIndexOf("[",t);r>=l;r=0===r?-1:e.lastIndexOf("[",r-1)){const t=B(e,r);if(t&&n<=t.end)return{start:r,end:t.end,label:t.label,href:t.href}}return null}function h(e,t,n,l){const r=u(e,t,n),s=r?r.start:t,i=r?r.end:n,o=`[${r?r.label:e.slice(t,n)||l}](${l})`,c=s+o.length;return{text:e.slice(0,s)+o+e.slice(i),selectionStart:c,selectionEnd:c}}function f(e,t){return{text:e.slice(0,t.start)+t.label+e.slice(t.end),selectionStart:t.start,selectionEnd:t.start+t.label.length}}var d=[{style:"bold",label:"B",name:"Strong",title:"Strong · **words** · ⌘B",shortcut:"b"},{style:"italic",label:"I",name:"Italic",title:"Italic · _words_ · ⌘I",shortcut:"i"},{style:"strike",label:"S",name:"Strikethrough",title:"Strikethrough · ~~words~~"},{style:"highlight",label:"◆",name:"Emphasis",title:"Emphasis · ==words=="},{style:"quiet",label:"a",name:"Quiet",title:"Quiet · ^^words^^"},{style:"code",label:"‹›",name:"Code",title:"Code"},{style:"link",label:"🔗",name:"Link",title:"Link · [words](https://…) · ⌘K",shortcut:"k"},{style:"bullet",label:"•",name:"Bulleted list",title:"Bulleted list"},{style:"number",label:"1.",name:"Numbered list",title:"Numbered list"},{style:"quote",label:"❝",name:"Quote",title:"Quote"},{style:"clear",label:"T×",name:"Clear marks",title:"Clear marks · ⌘⇧X",shortcut:"shift+x"}],m={bold:"Strong",highlight:"Emphasis",quiet:"Quiet"};function p(e){return d.filter(t=>e.includes(t.style))}var k=[{open:"**",close:"**",kind:"bold"},{open:"==",close:"==",kind:"highlight"},{open:"~~",close:"~~",kind:"strike"},{open:"_",close:"_",kind:"italic",wordBoundary:!0},{open:"^^",close:"^^",kind:"quiet"},{open:"@@",close:"@@",kind:"highlight"},{open:"++",close:"++",kind:"bold",wordStart:!0}],b=["highlight","quiet"],g=d.map(e=>e.style).filter(e=>k.some(t=>t.kind===e)).filter(e=>!b.includes(e)),x=[...k,{open:"*",close:"*",kind:"accent"}],S=[...k,{open:"*",close:"*",kind:"accent"},{open:"#",close:"#",kind:"bold",notBefore:"0123456789"},{open:"[",close:"]",kind:"italic",notBefore:"(",notBeforeBlock:!0}];function v(e){return!/\s/.test(e)&&!/[!-\/:-@[-`{-~]/.test(e)}function w(e,t){const n=[];let l="",r=0;for(;r<e.length;){const s=E(e,r,t);s?(n.push({kind:"text",text:l}),l="",n.push({kind:s.rule.kind,text:s.inner}),r=s.end):(l+=e[r],r+=1)}return n.push({kind:"text",text:l}),n}function E(e,t,n){for(const l of n){if(!e.startsWith(l.open,t))continue;if(l.wordBoundary&&t>0&&v(e[t-1]))continue;if(l.wordStart&&t>0&&/[\p{L}\p{N}]/u.test(e[t-1]))continue;const n=t+l.open.length,s=e.indexOf(l.close,n);if(s<n+1)continue;const i=e.slice(n,s);if(i.includes(l.close[0]))continue;if(i.includes("\n"))continue;const o=s+l.close.length,c=e[o];if((!l.notBefore||void 0===c||!l.notBefore.includes(c))&&!(l.notBeforeBlock&&r(e,o)||l.wordBoundary&&void 0!==c&&v(c)))return{rule:l,inner:i,end:o}}return null}function y(e,t){return w(e,t).map(e=>e.text).join("")}var M=["http","https","mailto","tel"];function $(e){if(""===e||/[\s\u0000-\u001f\u007f]/.test(e))return!1;const t=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!t||M.includes(t[1].toLowerCase())}function B(e,t){if("["!==e[t])return null;const n=e.indexOf("]",t+1);if(n<t+2||"("!==e[n+1])return null;const l=e.slice(t+1,n);if(l.includes("["))return null;const r=e.indexOf(")",n+2);if(-1===r)return null;const s=e.slice(n+2,r);return $(s)?{label:l,href:s,end:r+1}:null}function z(e,t){if("["!==e[t])return null;let n=0;for(let l=t;l<e.length;l+=1){const s=e[l];if("\n"===s)return null;if("["===s)n+=1;else if("]"===s){if(n-=1,n>0)continue;if(l===t+1)return null;const s=r(e,l+1);return s?{kind:s.kind,color:s.color,label:e.slice(t+1,l),close:e.slice(l,l+1+s.length),end:l+1+s.length}:null}}return null}var q=4;function I(e,t,n){const l=[];let r="";const s=()=>{r&&l.push({kind:"text",text:r}),r=""},i=e=>n+1<q?I(e,t,n+1):[{kind:"text",text:e}];let o=0;for(;o<e.length;){const n=B(e,o);if(n){s(),l.push({kind:"link",href:n.href,children:i(n.label)}),o=n.end;continue}const c=z(e,o);if(c){s(),l.push({kind:c.kind,open:"[",close:c.close,...void 0===c.color?{}:{color:c.color},children:i(c.label)}),o=c.end;continue}const a=E(e,o,t);a?(s(),l.push({kind:a.rule.kind,open:a.rule.open,close:a.rule.close,children:i(a.inner)}),o=a.end):(r+=e[o],o+=1)}return s(),l}function O(e,t){return e.split("\n").map(e=>{const{bullet:n,number:l,rest:r}=function(e){if(e.startsWith("- ")&&""!==e.slice(2).trim())return{bullet:!0,number:null,rest:e.slice(2)};const t=/^([0-9]{1,3})\. /.exec(e);return t&&""!==e.slice(t[0].length).trim()?{bullet:!1,number:t[1],rest:e.slice(t[0].length)}:{bullet:!1,number:null,rest:e}}(e);return{bullet:n,number:l,children:I(r,t,0)}})}function C(e){return null!=e.number?`${e.number}. `:e.bullet?"- ":""}function _(e){return e.map(e=>"text"===e.kind?e.text:"link"===e.kind?`[${_(e.children)}](${e.href})`:e.open+_(e.children)+e.close).join("")}function j(e){return e.map(e=>C(e)+_(e.children)).join("\n")}function L(t,n,r){if("link"===n)return void 0===r?null:{id:t,kind:"link",open:"[",close:`](${r})`,href:r};if("color"===n){const e=void 0===r?null:l(r);return null===e?null:{id:t,kind:"color",open:"[",close:`]{color=${e}}`,color:e}}const s=e[n];return s&&"code"!==n?{id:t,kind:n,open:s.open,close:s.close}:null}function Q(e,t){let n=0,l=0;return e.split("\n").map(e=>{const[r]=O(e,t);let s=l+C(r).length;l+=e.length+1;const i=[],o=(e,t)=>{for(const l of e){if("text"===l.kind){for(const e of l.text)i.push({ch:e,marks:t,at:s}),s+=e.length;continue}const e="link"===l.kind?L(++n,"link",l.href):{id:++n,kind:l.kind,open:l.open,close:l.close,...void 0===l.color?{}:{color:l.color}};s+=e.open.length,o(l.children,[...t,e]),s+=e.close.length}};return o(r.children,[]),{bullet:r.bullet,number:r.number??null,chars:i}})}function A(e){let t="";const n=[];return e.forEach((e,l)=>{l>0&&(t+="\n"),t+=C(e);const r=[],s=[];for(const n of e.chars){let e=0;for(;e<r.length&&e<n.marks.length&&r[e].id===n.marks[e].id;)e+=1;for(;r.length>e;)t+=r.pop().close;for(let l=e;l<n.marks.length;l+=1)t+=n.marks[l].open,r.push(n.marks[l]);s.push(t.length),t+=n.ch}for(;r.length>0;)t+=r.pop().close;n.push(s)}),{text:t,at:n}}function N(e,t){return e.length===t.length&&e.every((e,n)=>{const l=t[n];return e.bullet===l.bullet&&(e.number??null)===(l.number??null)&&(e.chars.length===l.chars.length&&e.chars.every((e,t)=>{const n=l.chars[t];return e.ch===n.ch&&e.marks.length===n.marks.length&&e.marks.every((e,t)=>e.kind===n.marks[t].kind&&e.href===n.marks[t].href&&e.color===n.marks[t].color)}))})}function W(e,t,n,l=k){const r=Q(e,l),s=r.flatMap(e=>e.chars),i={text:e,selectionStart:t,selectionEnd:n},o=e=>r.map(t=>({bullet:t.bullet,number:t.number,chars:t.chars.map(t=>({...t,marks:t.marks.filter(n=>"link"===n.kind||!e(t,n))}))})),c=e=>{const t=A(e);return N(e,Q(t.text,l))?t:null},a=(e,t)=>{let n=s.indexOf(t);for(let t=0;t<e.at.length;t+=1){if(n<e.at[t].length)return e.at[t][n];n-=e.at[t].length}return 0};if(t===n){const e=[...s].reverse().find(e=>e.at<t),n=s.find(e=>e.at>=t),l=new Set([...e?.marks??[],...n?.marks??[]].map(e=>e.id));if(![...l].some(e=>s.some(t=>t.marks.some(t=>t.id===e&&"link"!==t.kind))))return i;const r=c(o((e,t)=>l.has(t.id)));if(!r)return i;const u=n?a(r,n):e?a(r,e)+e.ch.length:0;return{text:r.text,selectionStart:u,selectionEnd:u}}const u=new Set(s.filter(e=>e.at>=t&&e.at<n));if(0===u.size)return i;const h=new Set([...u].flatMap(e=>e.marks.map(e=>e.id))),f=c(T(o(e=>u.has(e)),h))??c(o((e,t)=>h.has(t.id)));if(!f)return i;const d=s.find(e=>u.has(e)),m=[...s].reverse().find(e=>u.has(e));return{text:f.text,selectionStart:a(f,d),selectionEnd:a(f,m)+m.ch.length}}function F(e,t,n,l=k){if(t===n)return{text:e,selectionStart:t,selectionEnd:n};const r=Q(e,l),s=r.flatMap(e=>e.chars),i=new Set(s.filter(e=>e.at>=t&&e.at<n)),o=e=>"link"!==e.kind,c=new Set([...i].flatMap(e=>e.marks.filter(o).map(e=>e.id)));if(0===c.size)return{text:e,selectionStart:t,selectionEnd:n};const a=e=>r.map(t=>({bullet:t.bullet,number:t.number,chars:t.chars.map(t=>({...t,marks:e(t)}))})),u=a(e=>i.has(e)?e.marks.filter(e=>!o(e)):e.marks);u.forEach((e,t)=>{const n=e.chars,l=r[t].chars.map(e=>i.has(e)),s=e=>{n[e].marks=n[e].marks.filter(e=>!c.has(e.id))};n.forEach((e,t)=>{if(l[t]){if(0===t||!l[t-1])for(let e=t-1;e>=0&&/\s/.test(n[e].ch);e-=1)s(e);if(t===n.length-1||!l[t+1])for(let e=t+1;e<n.length&&/\s/.test(n[e].ch);e+=1)s(e)}})});const h=K(u,l)??K(a(e=>e.marks.filter(e=>!c.has(e.id))),l);return G(e,s,i,h,t,n)}function Z(e){return e.at.flat()}function K(e,t){const n=A(e);return N(e,Q(n.text,t))?n:null}function T(e,t){return e.map(e=>{const n=e.chars.map(e=>({...e}));for(const e of t){const t=t=>t.marks.some(t=>t.id===e),l=n.flatMap((e,n)=>t(e)?[n]:[]),r=t=>{n[t].marks=n[t].marks.filter(t=>t.id!==e)};for(let e=0;e<l.length&&/\s/.test(n[l[e]].ch);e+=1)r(l[e]);for(let e=l.length-1;e>=0&&/\s/.test(n[l[e]].ch)&&t(n[l[e]]);e-=1)r(l[e])}return{bullet:e.bullet,number:e.number,chars:n}})}function X(e,t){return t.kind===e||"highlight"===e&&"accent"===t.kind}function D(e,t,n){const l=e.findIndex(e=>n(e.id));return-1===l?[...e,t]:[...e.slice(0,l),t,...e.slice(l)]}function G(e,t,n,l,r,s){if(!l)return{text:e,selectionStart:r,selectionEnd:s};const i=Z(l),o=t.flatMap((e,t)=>n.has(e)?[t]:[]),c=o[0],a=o[o.length-1];return{text:l.text,selectionStart:i[c],selectionEnd:i[a]+t[a].ch.length}}function H(e,t,n,l,r=k){if(t===n||!L(0,l))return o(e,t,n,l,r);const s=Q(e,r),i=s.flatMap(e=>e.chars),c=new Set(i.filter(e=>e.at>=t&&e.at<n));if(0===c.size)return{text:e,selectionStart:t,selectionEnd:n};const a=e=>s.map(t=>({bullet:t.bullet,number:t.number,chars:t.chars.map(t=>({...t,marks:e(t)}))}));if([...c].every(e=>e.marks.some(e=>X(l,e)))){const s=new Set([...c].flatMap(e=>e.marks.filter(e=>X(l,e)).map(e=>e.id))),o=K(T(a(e=>c.has(e)?e.marks.filter(e=>!X(l,e)):e.marks),s),r)??K(a(e=>e.marks.filter(e=>!s.has(e.id))),r);return G(e,i,c,o,t,n)}const u=new Set([...c].flatMap(e=>e.marks.filter(e=>X(l,e)).map(e=>e.id))),h=new Set(i.filter(e=>c.has(e)||e.marks.some(e=>u.has(e.id)))),f=Math.max(0,...i.flatMap(e=>e.marks.map(e=>e.id)))+1,d=L(f,l),m=e=>i.every(t=>!t.marks.some(t=>t.id===e)||h.has(t)),p=K(T(a(e=>h.has(e)?D(e.marks.filter(e=>!X(l,e)),d,m):e.marks),/* @__PURE__ */new Set([f])),r);return G(e,i,c,p,t,n)}function J(e,t,n,l=k){const r=Q(e,l).flatMap(e=>e.chars);let s;if(t===n){const n=[...r].reverse().find(n=>n.at<t&&!e.slice(n.at,t).includes("\n"));s=n?[n]:[]}else s=r.filter(e=>e.at>=t&&e.at<n);if(0===s.length)/* @__PURE__ */return new Set;const i=s.map(e=>new Set(e.marks.map(e=>e.kind)));return new Set([...i[0]].filter(e=>i.every(t=>t.has(e))))}function P(e,t,n){const l=t===n?[[...e].reverse().find(e=>e.at<t),e.find(e=>e.at>=t)]:e.filter(e=>e.at>=t&&e.at<n);for(const e of l){const t=e?.marks.find(e=>"link"===e.kind);if(t)return t.id}return null}function R(e,t,n,l,r=k){const s=Q(e,r),i=s.flatMap(e=>e.chars),o=e=>s.map(t=>({bullet:t.bullet,number:t.number,chars:t.chars.map(t=>({...t,marks:e(t)}))})),c=(e,t,n)=>{const l=Z(e),r=i.reduce((e,n,l)=>t(n)?l:e,-1),s=l[r]+i[r].ch.length+n.close.length;return{text:e.text,selectionStart:s,selectionEnd:s}};if(t===n){const s=P(i,t,n);if(null===s)return h(e,t,n,l);const a=L(s,"link",l),u=K(o(e=>e.marks.map(e=>e.id===s?a:e)),r);return u?c(u,e=>e.marks.some(e=>e.id===s),a):{text:e,selectionStart:t,selectionEnd:n}}const a=new Set(i.filter(e=>e.at>=t&&e.at<n));if(0===a.size)return h(e,t,n,l);const u=L(Math.max(0,...i.flatMap(e=>e.marks.map(e=>e.id)))+1,"link",l),f=e=>i.every(t=>!t.marks.some(t=>t.id===e)||a.has(t)),d=K(o(e=>a.has(e)?D(e.marks.filter(e=>"link"!==e.kind),u,f):e.marks),r);return d?c(d,e=>a.has(e),u):{text:e,selectionStart:t,selectionEnd:n}}function U(e,t,n,l=k){const r=Q(e,l),s=r.flatMap(e=>e.chars),i=P(s,t,n);if(null===i)return{text:e,selectionStart:t,selectionEnd:n};const o=new Set(s.filter(e=>e.marks.some(e=>e.id===i)));return G(e,s,o,K(r.map(e=>({bullet:e.bullet,number:e.number,chars:e.chars.map(e=>({...e,marks:e.marks.filter(e=>e.id!==i)}))})),l),t,n)}function V(e,t,l,r,s=k){const i={text:e,selectionStart:t,selectionEnd:l};if(t===l||null!==r&&!n(r))return i;const o=Q(e,s),c=o.flatMap(e=>e.chars),a=new Set(c.filter(e=>e.at>=t&&e.at<l));if(0===a.size)return i;const u=e=>o.map(t=>({bullet:t.bullet,number:t.number,chars:t.chars.map(t=>({...t,marks:e(t)}))})),h=new Set([...a].flatMap(e=>e.marks.filter(e=>"color"===e.kind).map(e=>e.id)));if(null===r){const n=K(T(u(e=>a.has(e)?e.marks.filter(e=>"color"!==e.kind):e.marks),h),s)??K(u(e=>e.marks.filter(e=>!h.has(e.id))),s);return G(e,c,a,n,t,l)}const f=Math.max(0,...c.flatMap(e=>e.marks.map(e=>e.id)))+1,d=L(f,"color",r),m=e=>c.every(t=>!t.marks.some(t=>t.id===e)||a.has(t)),p=K(T(u(e=>a.has(e)?D(e.marks.filter(e=>"color"!==e.kind),d,m):e.marks),/* @__PURE__ */new Set([f,...h])),s);return G(e,c,a,p,t,l)}function Y(e,t,n,l=k){const r=Q(e,l).flatMap(e=>e.chars),s=t===n?[[...r].reverse().find(n=>n.at<t&&!e.slice(n.at,t).includes("\n"))].filter(e=>void 0!==e):r.filter(e=>e.at>=t&&e.at<n);if(0===s.length)return null;const i=e=>e.marks.filter(e=>"color"===e.kind).pop()?.color??null,o=i(s[0]);return null!==o&&s.every(e=>i(e)===o)?o:null}var ee=/^(?:- |([0-9]{1,3})\. )$/;function te(e,t,n){const l=e.split("\n"),r=[];let s=0;for(const e of l)r.push(s),s+=e.length+1;const i=e=>{let t=0;for(;t+1<r.length&&r[t+1]<=e;)t+=1;return t};return{first:i(t),last:i(Math.max(t,n)),starts:r}}function ne(e,t){if(null!=t.number)return"number";if(t.bullet)return"bullet";const n=ee.exec(e);return n?void 0===n[1]?"bullet":"number":null}function le(e,t,n,l,r=k){const s=e.split("\n"),i=Q(e,r),{first:o,last:c}=te(e,t,n),a=i.map((e,t)=>null===ne(s[t],e)||e.bullet||null!=e.number?{bullet:e.bullet,number:e.number??null,chars:e.chars}:{bullet:!1,number:null,chars:[]});let u=0;if("number"===l&&o>0&&"number"===ne(s[o-1],i[o-1])){const e=i[o-1].number??ee.exec(s[o-1])?.[1]??"0";u=Number(e)}const h=A(a.map((e,t)=>t<o||t>c?e:"bullet"===l?{bullet:!0,number:null,chars:e.chars}:"number"===l?{bullet:!1,number:String(u+=1),chars:e.chars}:{bullet:!1,number:null,chars:e.chars})).text.split("\n").map((e,t)=>t<o||t>c?s[t]:e),f=h.join("\n"),{starts:d}=te(e,0,0),m=t=>{const{first:n}=te(e,t,t);let l=0;for(let e=0;e<n;e+=1)l+=h[e].length-s[e].length;const r=null===ne(s[o=n],i[o])||i[o].bullet||null!=i[o].number?C(i[o]).length:s[o].length;var o;const c=h[n].length-(s[n].length-r),a=t-d[n];return d[n]+l+(a<r?c:a-r+c)};return{text:f,selectionStart:m(t),selectionEnd:m(n)}}function re(e,t,n,l=k){const r=e.split("\n"),s=Q(e,l),{first:i,last:o}=te(e,t,n),c=new Set(s.slice(i,o+1).map((e,t)=>ne(r[i+t],e)));return 1===c.size?[...c][0]:null}export{S as CAMPAIGN_MARKUP,g as COPY_FIELD_TOOLS,d as MARKUP_TOOLS,m as MARK_NAMES,s as MARK_PLACEHOLDERS,b as RETIRED_MARKS,k as STANDARD_MARKUP,x as STOREFRONT_MARKUP,c as applyColor,o as applyMark,W as clearMarks,F as clearStyle,Y as colorIn,V as colorOver,u as findLink,t as isColorName,n as isColorValue,$ as isSafeLinkHref,R as linkOver,re as listIn,a as markedAt,Q as markedLines,J as marksIn,p as markupTools,O as parseMarkup,f as removeLink,N as sameMarks,j as serializeMarkup,le as setList,L as spanFor,y as stripInline,H as toggleMark,w as tokenizeInline,U as unlinkAt,h as writeLink,A as writeMarkedLines};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{useShellStrings as e}from"./chunk-K6DKX55N.js";import{Icon as i}from"./chunk-2SSRFEOZ.js";import{Fragment as t}from"react";import{jsx as n,jsxs as a}from"react/jsx-runtime";var s=/* @__PURE__ */n(i,{name:"chevron-right",look:"mini",className:"h-3.5 w-3.5 shrink-0 text-gray-300","aria-hidden":!0}),r="inline-flex min-w-0 items-center gap-1 truncate rounded px-1 -mx-1 text-gray-500 transition-colors hover:text-gray-900 hover:underline rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]";function l({items:i,separator:l,maxItems:c=0,className:m}){const o=e().breadcrumbs;if(0===i.length)return null;const h=l??s,d=[],u=i.length-1;if(c>0&&i.length>c&&c>=2){const e=Math.max(1,c-1);d.push({kind:"item",item:i[0],isLast:!1}),d.push({kind:"ellipsis"});for(let t=i.length-e;t<=u;t++)d.push({kind:"item",item:i[t],isLast:t===u})}else i.forEach((e,i)=>d.push({kind:"item",item:e,isLast:i===u}));/* @__PURE__ */
|
|
2
|
+
return n("nav",{"aria-label":o.label,className:`min-w-0 ${m??""}`,children:/* @__PURE__ */n("ol",{className:"flex items-center gap-1.5 text-sm",children:d.map((e,i)=>/* @__PURE__ */a(t,{children:[i>0&&/* @__PURE__ */n("li",{"aria-hidden":!0,className:"flex items-center",children:h}),
|
|
3
|
+
/* @__PURE__ */n("li",{className:"flex min-w-0 items-center",children:"ellipsis"===e.kind?/* @__PURE__ */n("span",{className:"px-0.5 text-gray-400 select-none","aria-label":o.hidden,children:"…"}):e.isLast||!e.item.href&&!e.item.onClick?/* @__PURE__ */a("span",{"aria-current":e.isLast?"page":void 0,className:"inline-flex min-w-0 items-center gap-1 truncate "+(e.isLast?"font-medium text-gray-900":"text-gray-500"),children:[e.item.icon,
|
|
4
|
+
/* @__PURE__ */n("span",{className:"truncate",children:e.item.label})]}):e.item.href?/* @__PURE__ */a("a",{href:e.item.href,onClick:e.item.onClick,className:r,children:[e.item.icon,
|
|
5
|
+
/* @__PURE__ */n("span",{className:"truncate",children:e.item.label})]}):/* @__PURE__ */a("button",{type:"button",onClick:e.item.onClick,className:r,children:[e.item.icon,
|
|
6
|
+
/* @__PURE__ */n("span",{className:"truncate",children:e.item.label})]})})]},i))})})}export{l as Breadcrumbs};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import{computeMaximizedBox as e,isSidebarStripReserved as t,boxFillsWorkArea as n,readAlwaysMaximizedFlag as r,WORK_AREA_CHANGED_EVENT as o,useShellAuth as i,scrollerIsFluid as a,growBoxToWidth as s,widthToFit as l,navIcons as c}from"./chunk-DSSLOQDW.js";import{CopyButton as d}from"./chunk-I2H2CKID.js";import{isStaleChunkError as u,CMD_Z as h,CMD_SHIFT_Z as m,LoadingSpinner as p,Result as f,useIsMobile as w,useShellPrefs as y}from"./chunk-HQLAISFX.js";import{Button_default as g}from"./chunk-S3LGKIZ3.js";import{confirm as b}from"./chunk-DBXZS7OA.js";import{PopupMenu as v,PopupMenuItem as x,PopupMenuDivider as k,PopupMenuLabel as E}from"./chunk-ZEIKSMFR.js";import{Z_LAYERS as C,runEscapeInterceptors as M}from"./chunk-FIEA5CGB.js";import{reportBoundaryError as N}from"./chunk-KNUR2UEG.js";import{useShellStrings as S}from"./chunk-K6DKX55N.js";import{Icon as L}from"./chunk-2SSRFEOZ.js";import{createContext as T,useContext as z,Component as A,useLayoutEffect as D,useRef as I,useEffect as P,useState as K,useSyncExternalStore as $,useCallback as W,isValidElement as O,Fragment as R,Children as F,cloneElement as q,useMemo as j,useReducer as B,useId as H,Suspense as Y}from"react";import{jsxs as U,jsx as X,Fragment as _}from"react/jsx-runtime";import{createPortal as V}from"react-dom";import{useLocation as J}from"react-router-dom";import{useQueryClient as G,useQuery as Z}from"@tanstack/react-query";function Q(e){return"component"in e}function ee(e){return"endpoint"in e}var te={};function ne(e){te=e}var re=new Proxy({},{get:(e,t)=>te[t],has:(e,t)=>t in te,ownKeys:()=>Object.keys(te),getOwnPropertyDescriptor(e,t){if(t in te)return{configurable:!0,enumerable:!0,value:te[t]}}}),oe=null;function ie(e){oe=e}function ae(){return null!==oe}var se=/* @__PURE__ */new Set(["get","post","put","patch","delete","head","options","request"]),le=new Proxy({},{get:(e,t)=>oe?oe[t]:"string"==typeof t&&se.has(t)?()=>Promise.resolve({data:null,status:0,statusText:"",headers:{},config:{}}):void 0}),ce=T(null);function de(){return z(ce)?.pageSearch??""}var ue=null,he=/* @__PURE__ */new Set;function me(e){ue!==e&&(ue=e,he.forEach(e=>e()))}function pe(){return ue}function fe(e){return he.add(e),()=>{he.delete(e)}}function we({error:e,onReload:t}){const n=u(e);/* @__PURE__ */
|
|
2
|
+
return U("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 py-12 text-center",children:[
|
|
3
|
+
/* @__PURE__ */X(L,{name:"warning",className:"h-8 w-8 text-amber-500",strokeWidth:1.5}),
|
|
4
|
+
/* @__PURE__ */U("div",{className:"min-w-0",children:[
|
|
5
|
+
/* @__PURE__ */X("p",{className:"text-sm font-medium text-gray-700",children:n?"This window needs the latest version of the app":"This window crashed"}),
|
|
6
|
+
/* @__PURE__ */X("p",{className:"mt-1 text-xs text-gray-400 max-w-sm break-words",children:n?"A new version was deployed while this tab was open. Reload the page to pick it up.":e.message||String(e)})]}),
|
|
7
|
+
/* @__PURE__ */X("button",{type:"button",onClick:n?()=>window.location.reload():t,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 text-sm font-medium rounded-lg",children:n?"Reload page":"Reload window"})]})}var ye=class extends A{state={error:null};static getDerivedStateFromError(e){return{error:e instanceof Error?e:new Error(String(e))}}componentDidCatch(e,t){console.error("[efficient-shell] window content crashed:",e,t.componentStack),N(e)}reset=()=>this.setState({error:null});render(){const{error:e}=this.state;return e?this.props.fallback?this.props.fallback(e,this.reset):/* @__PURE__ */X(we,{error:e,onReload:this.reset}):this.props.children}},ge=T(null),be="text-xs text-gray-500 hover:text-gray-700 disabled:opacity-40 disabled:hover:text-gray-500 disabled:cursor-default";function ve({className:e="",auto:t=!1}){const n=z(ge),r=S().undo,o=n?.claimOwnMount;if(D(()=>{if(!t&&o)return o(!0),()=>o(!1)},[t,o]),!n||!n.enabled)return null;const{undo:i,redo:a,canUndo:s,canRedo:l,undoLabel:c,redoLabel:d}=n;/* @__PURE__ */
|
|
8
|
+
return U("div",{className:`flex items-center gap-2 ${e}`,"data-undo-controls":t?"shell":"form",children:[
|
|
9
|
+
/* @__PURE__ */X("button",{type:"button",onClick:i,disabled:!s,title:s?r.undoStep(c??"",h):r.nothingToUndo,className:be,children:r.undo}),
|
|
10
|
+
/* @__PURE__ */X("button",{type:"button",onClick:a,disabled:!l,title:l?r.redoStep(d??"",m):r.nothingToRedo,className:be,children:r.redo})]})}var xe=/* @__PURE__ */new Set([408,429]);function ke(e){const t=e?.response?.status;return"number"==typeof t?t:void 0}function Ee(e){const t=ke(e);return null!=t&&(t>=400&&t<500&&!xe.has(t))}function Ce(e,t){return!Ee(t)&&e<3}function Me(){const e=S().loading;/* @__PURE__ */
|
|
11
|
+
return X("div",{className:"flex items-center justify-center p-8 text-sm text-gray-400",children:e.label})}var Ne="flex-1 min-h-0";function Se(){const e=S().record;/* @__PURE__ */
|
|
12
|
+
return X(p,{label:e.loading,padding:"",className:Ne})}function Le(e){return e??void 0}function Te({isPending:e,isFetching:t,enabled:n=!0,error:r,onRetry:o}){const i=S().record;if(t||e&&n)/* @__PURE__ */return X(Se,{});if(r){const e=ke(r);if(401===e)/* @__PURE__ */
|
|
13
|
+
return X(f,{status:"warning",title:i.signInRequired,subTitle:i.signInBody,className:Ne});if(403===e)/* @__PURE__ */
|
|
14
|
+
return X(f,{status:"403",className:Ne});if(404===e||410===e)/* @__PURE__ */
|
|
15
|
+
return X(f,{status:"404",title:i.notFound,className:Ne});const t=null==e||408===e||429===e||e>=500;/* @__PURE__ */
|
|
16
|
+
return X(f,{status:"500",title:i.loadFailed,subTitle:t?i.checkConnection:i.rejected,extra:t?/* @__PURE__ */X(g,{variant:"secondary",size:"sm",onClick:o,children:i.retry}):void 0,className:Ne})}/* @__PURE__ */
|
|
17
|
+
return X(f,{status:"404",title:i.notFound,className:Ne})}function ze({entity:e,children:t,...n}){return null!=e?/* @__PURE__ */X(_,{children:t(e)}):/* @__PURE__ */X(Te,{...n})}var Ae=/^[a-z]+(?:-[a-z]+)*-\d{13}$/;function De(e){return"string"==typeof e&&(e.startsWith("new-")||Ae.test(e))}function Ie(e){if(De(e.entityId))return!0;const t=e.entitySnapshot;return!(!t||"object"!=typeof t||!t._new&&!t._duplicate)}var Pe=T({openWindows:[],openEntity:()=>{},openPage:()=>{},closeEntity:()=>{},minimize:()=>{},items:[],restore:()=>{},remove:()=>{},restoreIfMinimized:()=>!1,openItems:[]}),Ke=T(null);function $e(e){const t=z(Ke),n=I(null);null===n.current&&(n.current=/* @__PURE__ */Symbol("window-dirty")),D(()=>{if(t)return t(n.current,e)},[t,e]),P(()=>{if(!t||!e)return;const n=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[t,e])}function We(){const e=I(/* @__PURE__ */new Map),[t,n]=K(!1);return{dirty:t,registerDirty:W((t,r)=>{const o=()=>{const t=Array.from(e.current.values()).some(Boolean);n(e=>e===t?e:t)};return e.current.set(t,r),o(),()=>{e.current.delete(t),o()}},[])}}function Oe(){return z(Pe)}function Re(e){if("page"!==e.type&&Ie(e))return null;const t="page"===e.type?"page":e.entityType||"",n="page"===e.type?e.route||"":e.entityId||"";return t&&n?{entityType:t,entityId:n,label:e.label}:null}function Fe({item:e,onClose:t,accentRgb:n}){const{dirty:r,registerDirty:o}=We(),i=re[e.route];if(!i||!Q(i))return null;const a=i,s=a.component;/* @__PURE__ */
|
|
18
|
+
return X(Tr,{open:!0,onClose:t,icon:c[e.route],title:a.label,size:a.size||"2xl",dirty:r,allowPinOnTop:a.allowPinOnTop,initialPosition:a.initialPosition,widget:a.widget,compact:a.compact,appStyle:a.appStyle,flushBody:a.flushBody,autoHeight:a.autoHeight,autoMinHeight:a.autoMinHeight,autoWidth:a.autoWidth,dimensions:a.dimensions,windowKey:e.id,openedFromKey:e.openedFrom,accentRgb:n,children:/* @__PURE__ */X(Ke.Provider,{value:o,children:/* @__PURE__ */X(Y,{fallback:/* @__PURE__ */X("div",{className:"flex items-center justify-center py-12",children:/* @__PURE__ */X(Me,{})}),children:/* @__PURE__ */X(s,{})})})})}function qe({entityType:e,entityId:t,label:n}){const r=S(),o=G(),{data:i}=Z({queryKey:["my-profile-sidebar"],enabled:ae(),queryFn:()=>le.get("/auth/me/").then(e=>e.data)}),a=(i?.preferences||{}).favorite_documents||[],s=a.some(n=>n.entityType===e&&n.entityId===t);/* @__PURE__ */
|
|
19
|
+
return X("button",{onClick:()=>{const r=s?a.filter(n=>!(n.entityType===e&&n.entityId===t)):[...a,{entityType:e,entityId:t,label:n}];le.patch("/auth/me/",{preferences:{favorite_documents:r}}).then(()=>{o.invalidateQueries({queryKey:["my-profile-sidebar"]})})},title:s?r.taskbar.removeFromDesktop:r.taskbar.addToDesktop,className:"shrink-0 transition-colors "+(s?"text-yellow-500 hover:text-yellow-600":"text-gray-300 hover:text-yellow-400"),children:/* @__PURE__ */X(L,{name:"star",className:"h-4 w-4",fill:s?"currentColor":"none",strokeWidth:1.5})})}var je=/* @__PURE__ */new Set;function Be({item:e,onClose:t,onMinimize:n,accentRgb:r}){const o=re[e.entityType];if(!o||!ee(o))return null;const i=o,[a,s]=K(!1),{dirty:l,registerDirty:d}=We(),u=i.queryKey||i.endpoint.replace(/^\/|\/$/g,"").split("/").pop()||e.entityType,h=e.entitySnapshot?._duplicate,m=De(e.entityId),p=!i.selfFetching&&!h&&!m&&ae(),f=Z({queryKey:[u,e.entityId],queryFn:()=>{return le.get((t=i.endpoint,n=String(e.entityId),`${t}${encodeURIComponent(n)}/`)).then(e=>e.data);var t,n},initialData:Le(e.entitySnapshot),initialDataUpdatedAt:0,enabled:p,staleTime:0,refetchOnWindowFocus:!0,refetchOnMount:"always",refetchInterval:e=>!Ee(e.state.error)&&6e4,refetchIntervalInBackground:!1,retry:Ce}),w=f.data,y=f.refetch;P(()=>{var t;if(p)return t=t=>{t!==e.id||je.has(t)||y({cancelRefetch:!1})},In.add(t),()=>{In.delete(t)}},[y,e.id,p]);const g=W(()=>{a&&!l?s(!1):t()},[a,l,t]),b=i.selfFetching?e.label:w?i.title(w,a,s):e.label,v=i.icon,x=v?c[v]:null,k=b,E=!i.selfFetching&&w&&i.footer&&!h?i.footer(w):void 0;return i.rendersOwnModal?i.selfFetching?/* @__PURE__ */X(Y,{fallback:/* @__PURE__ */X(Me,{}),children:i.render(w??e.entitySnapshot,t,e.entityId,a,s)}):null!=w?/* @__PURE__ */X(Y,{fallback:/* @__PURE__ */X(Tr,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */X(Se,{})}),children:i.render(w,t,e.entityId,a,s)}):/* @__PURE__ */X(Tr,{open:!0,onClose:t,title:e.label,size:i.size||"2xl",children:/* @__PURE__ */X(Te,{isPending:f.isPending,isFetching:f.isFetching,enabled:p,error:f.error,onRetry:y})}):/* @__PURE__ */X(Tr,{open:!0,onClose:g,onMinimize:n,initialBox:e.savedBox,icon:x,title:k,footer:E,copyText:e.label,windowKey:e.id,openedFromKey:e.openedFrom,size:i.size||"2xl",dirty:l,editing:a||m||h,dimensions:i.dimensions,autoHeight:i.autoHeight,autoMinHeight:i.autoMinHeight,autoWidth:i.autoWidth,appStyle:i.appStyle,flushBody:i.flushBody,accentRgb:r,children:/* @__PURE__ */X(Ke.Provider,{value:d,children:/* @__PURE__ */X(Y,{fallback:/* @__PURE__ */X(Se,{}),children:i.selfFetching?i.render(null,t,e.entityId,a,s):/* @__PURE__ */X(ze,{entity:w,isPending:f.isPending,isFetching:f.isFetching,enabled:p,error:f.error,onRetry:y,children:n=>i.render(n,t,e.entityId,a,s)})})})})}function He(e){return document.querySelector(`[data-modal-panel][data-window-key="${e}"]`)}function Ye(e){return document.querySelector(`[data-modal-panel][data-window-root][data-window-owner="${e}"]`)}function Ue(e){const t=He(e),n=t??Ye(e);if(!n)return;if(t&&!Yn(t))return r=e,void window.dispatchEvent(new CustomEvent("modal-reveal",{detail:{windowKey:r}}));var r;const o=n.getAttribute("data-modal-id");o&&Pn(o)}function Xe(e){if("page"!==e.type)return!0;const t=e.route?re[e.route]:void 0;if(!t||!Q(t))return!0;const n=t;return!n.widget&&!n.utility}function _e(){const e=ir();if(!e)return;const t=document.querySelector(`[data-modal-panel][data-modal-id="${e}"]`);return t?.getAttribute("data-window-key")??void 0}var Ve=/* @__PURE__ */new Map;function Je(){const e=_e();if(e)return Ve.get(e)}function Ge(e){const t=document.querySelectorAll("[data-modal-panel]");for(const n of Array.from(t)){const t=n.querySelector("[data-window-title]");if(t?.textContent?.includes(e))return n}return null}var Ze="rosh-peek-style",Qe=C.peek,et=C.taskbarPreview;function tt(e){"undefined"!=typeof document&&(!function(){if("undefined"==typeof document||document.getElementById(Ze))return;const e=document.createElement("style");e.id=Ze,e.textContent=`body.rosh-peeking [data-modal-panel]{transition:opacity .18s ease}body.rosh-peeking [data-modal-panel]:not([data-peek-focus]){opacity:.4}body.rosh-peeking [data-modal-panel][data-peek-focus]{opacity:1}body.rosh-peeking [data-modal-panel][data-peek-focus]:not([data-pinned-top]){z-index:${Qe}!important}html.rosh-reduce-transparency body.rosh-peeking [data-modal-panel]:not([data-peek-focus]){opacity:.92}@media (prefers-reduced-motion:reduce){body.rosh-peeking [data-modal-panel]{transition:none}}`,document.head.appendChild(e)}(),document.querySelectorAll("[data-modal-panel][data-peek-focus]").forEach(e=>e.removeAttribute("data-peek-focus")),e&&e.setAttribute("data-peek-focus",""),document.body.classList.toggle("rosh-peeking",!!e))}function nt(){"undefined"!=typeof document&&(document.body.classList.remove("rosh-peeking"),document.querySelectorAll("[data-modal-panel][data-peek-focus]").forEach(e=>e.removeAttribute("data-peek-focus")))}function rt({id:e,label:t,maxW:n,maxH:r,titleAbove:o=!1,onClick:i,onClose:a}){const s=S(),l=I(null),[c,d]=K({w:n,h:Math.round(.75*r)}),[u,h]=K(!1);return D(()=>{const o=l.current;if(!o)return;const i=He(e)??Ge(t);if(!i)return void h(!1);const a=i.getBoundingClientRect();if(0===a.width||0===a.height)return void h(!1);const s=Math.min(n/a.width,r/a.height),c=Math.max(80,Math.round(a.width*s)),u=Math.max(60,Math.round(a.height*s));d({w:c,h:u}),h(!0);const m=i.cloneNode(!0);return m.style.position="absolute",m.style.top="0",m.style.left="0",m.style.right="auto",m.style.bottom="auto",m.style.width=a.width+"px",m.style.height=a.height+"px",m.style.transform=`scale(${s})`,m.style.transformOrigin="top left",m.style.pointerEvents="none",m.style.animation="none",m.style.zIndex="auto",m.removeAttribute("data-modal-panel"),m.removeAttribute("data-modal-id"),m.removeAttribute("data-window-key"),m.querySelectorAll('[role="dialog"], [data-portal]').forEach(e=>{e.style.display="none"}),o.innerHTML="",o.appendChild(m),()=>{o.innerHTML=""}},[e,t,n,r]),/* @__PURE__ */U("div",{style:{width:c.w,height:c.h},className:"relative rounded-md overflow-hidden bg-white/95 border border-gray-300 shadow-md cursor-pointer ring-2 ring-transparent group-hover:ring-blue-400 transition shrink-0",onClick:i,children:[
|
|
20
|
+
/* @__PURE__ */X("div",{ref:l,className:"absolute inset-0 z-0 overflow-hidden"}),!u&&/* @__PURE__ */U("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-gray-400 bg-gray-50",children:[
|
|
21
|
+
/* @__PURE__ */X(L,{name:"window",className:"h-6 w-6",strokeWidth:1.5}),
|
|
22
|
+
/* @__PURE__ */X("span",{className:"mt-1 text-[10px] uppercase tracking-wide",children:"Hidden"})]}),!o&&/* @__PURE__ */X("div",{className:"absolute bottom-0 left-0 right-0 z-10 px-2 py-1 text-[10px] font-medium text-white bg-gradient-to-t from-black/80 to-transparent truncate pointer-events-none",children:t}),a&&/* @__PURE__ */X("button",{onClick:e=>{e.stopPropagation(),a()},className:"absolute top-1 right-1 z-20 h-5 w-5 rounded-full bg-gray-900/90 ring-1 ring-white/80 shadow-sm hover:bg-red-500 text-white flex items-center justify-center",title:s.taskbar.closeWindow,children:/* @__PURE__ */X(L,{name:"close",className:"h-3 w-3",strokeWidth:3})})]})}function ot({items:e,anchorEl:t,onActivate:n,onClose:r,onMouseEnter:o,onMouseLeave:i}){const a=S(),s=e.length>1,l=I(null),[c,d]=K({left:-9999,top:-9999,ready:!1}),[u,h]=K(()=>"undefined"!=typeof document&&getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom");D(()=>{const e=l.current;if(!e)return;const n=()=>{const n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),o=getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim()||"bottom";h(o);let i,a=n.left+n.width/2-r.width/2;"top"===o?i=n.bottom+8:"left"===o?(a=n.right+8,i=n.top+n.height/2-r.height/2):"right"===o?(a=n.left-r.width-8,i=n.top+n.height/2-r.height/2):i=n.top-r.height-8,a=Math.max(8,Math.min(a,window.innerWidth-r.width-8)),i=Math.max(8,Math.min(i,window.innerHeight-r.height-8)),d({left:a,top:i,ready:!0})};n();const r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[t,e.length]),P(()=>nt,[]);const m="top"===u,p=(m?"mt-1":"mb-1")+" max-w-[240px] truncate text-[11px] font-medium text-gray-900 bg-white/80 px-2 py-0.5 rounded shadow-sm ring-2 ring-transparent transition group-hover:ring-blue-400";return V(
|
|
23
|
+
/* @__PURE__ */X("div",{ref:l,"data-taskbar-preview":"",style:{position:"fixed",left:c.left,top:c.top,zIndex:et,maxWidth:"calc(100vw - 16px)",opacity:c.ready?1:0},className:s?"flex gap-2 flex-wrap":"",onMouseEnter:o,onMouseLeave:()=>{nt(),i()},children:e.map(e=>{const t=He(e.id)??Ge(e.label),o=t?function(e){if(Yn(e))return null;const t=e.getBoundingClientRect(),n=Rn(),r=t.left+t.width/2-(n.x+n.w/2),o=t.top+t.height/2-(n.y+n.h/2);return 180*Math.atan2(o,r)/Math.PI}(t):null;/* @__PURE__ */
|
|
24
|
+
return U("div",{className:"group flex flex-col items-center",onMouseEnter:()=>tt(t),children:[!m&&/* @__PURE__ */X("span",{className:p,children:e.label}),
|
|
25
|
+
/* @__PURE__ */X(rt,{id:e.id,label:e.label,maxW:240,maxH:160,titleAbove:!0,onClick:()=>n(e.id),onClose:()=>r(e.id)}),m&&/* @__PURE__ */X("span",{className:p,children:e.label}),null!==o&&/* @__PURE__ */U("span",{title:a.taskbar.offscreenHint,className:"mt-1 inline-flex items-center gap-1 rounded bg-amber-500 px-1.5 py-0.5 text-[10px] font-semibold text-white shadow-sm",children:[
|
|
26
|
+
/* @__PURE__ */X(L,{name:"arrow-right",className:"h-3 w-3",style:{transform:`rotate(${o}deg)`},strokeWidth:3}),"Off screen"]})]},e.id)})}),document.body)}function it(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 at({openWindows:e,onRemove:t,onSplitView:n,onActivate:r,onActivateById:o}){const i=S(),[a,s]=K(null);P(()=>{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=$(ar,ir),[,d]=K(0);P(()=>{const e=()=>d(e=>e+1);return window.addEventListener("modal-geometry",e),window.addEventListener("resize",e),()=>{window.removeEventListener("modal-geometry",e),window.removeEventListener("resize",e)}},[]);const[,u]=K(0);P(()=>{const e=()=>u(e=>e+1);return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[]);const h=e=>{const t=Ge(e),n=t?.querySelector("[data-window-title]");return n?.textContent?.trim()||e},[m,p]=K(null),[f,w]=K(null),[y,g]=K(null),b=I(null),C=()=>{b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{p(null),w(null)},150)},M=e.filter(e=>!e.route||!re[e.route]?.utility);if(!a||!a.isConnected||0===M.length)return null;const N=[],T=/* @__PURE__ */new Map;for(const e of M){const t=e.route?re[e.route]:void 0,n=t?.taskbarGroup,r=n?.key??e.route??`entity:${e.id}`,o=T.get(r);if(void 0!==o)N[o].items.push(e);else{T.set(r,N.length);const o=n?.label??t?.label??e.label;N.push({key:r,route:n?.icon??e.route,label:o,items:[e]})}}return V(
|
|
27
|
+
/* @__PURE__ */U(_,{children:[N.map(e=>{const n=e.route?c[e.route]:null,r=e.items[e.items.length-1];let a=!1;if(l){const t=document.querySelector(`[data-modal-id="${l}"]`);if(t){const n=t.querySelector("[data-window-title]"),r=n?.textContent??"";a=e.items.some(e=>r.includes(e.label))}}const s=e.items.length>1,d=e.items.some(e=>{const t=He(e.id)??Ge(e.label);return!!t&&!Yn(t)});/* @__PURE__ */
|
|
28
|
+
return U("button",{onClick:()=>o(r.id),onMouseEnter:t=>{return n=e.items,r=t.currentTarget,void(y||(b.current&&(clearTimeout(b.current),b.current=null),b.current=setTimeout(()=>{p(n),w(r)},350)));var n,r},onMouseLeave:C,onDoubleClick:e=>{e.stopPropagation(),window.dispatchEvent(new CustomEvent("modal-center",{detail:{windowKey:r.id,label:r.label}}))},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),b.current&&(clearTimeout(b.current),b.current=null),p(null),w(null),s?g({x:t.clientX,y:t.clientY,items:e.items,label:e.label}):window.dispatchEvent(new CustomEvent("modal-context-menu",{detail:{windowKey:r.id,label:r.label,x:t.clientX,y:t.clientY}}))},style:{width:"var(--window-tab-width, 200px)",fontSize:"var(--window-tab-font-size, 12px)"},"data-tab-group":e.key,className:"group relative flex items-center gap-1.5 rounded-lg px-3 py-2 font-medium transition-all min-w-0 shrink "+(a?"bg-blue-100/60 border border-blue-400/60 text-blue-700":"bg-gray-50/40 border border-gray-200/40 text-gray-700 hover:bg-gray-200/40"),children:[n&&O(n)?q(n,{className:"h-3.5 w-3.5 shrink-0 "+(a?"text-blue-600":"text-gray-400")}):/* @__PURE__ */X(L,{name:"expand",className:"h-3.5 w-3.5 shrink-0 "+(a?"text-blue-600":"text-gray-400"),strokeWidth:2}),
|
|
29
|
+
/* @__PURE__ */X("span",{className:"truncate flex-1",children:s?e.label:h(r.label)}),d&&/* @__PURE__ */X("span",{title:i.taskbar.offscreenDot,className:"shrink-0 h-1.5 w-1.5 rounded-full bg-amber-500"}),s&&/* @__PURE__ */X("span",{className:"shrink-0 px-1.5 py-0.5 rounded-full bg-blue-500/80 text-white text-[10px] font-bold leading-none",children:e.items.length}),!s&&/* @__PURE__ */X("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__ */X(L,{name:"close",className:"h-3 w-3",strokeWidth:2})})]},e.key)}),
|
|
30
|
+
/* @__PURE__ */X("div",{className:"flex-1"}),M.length>=2&&/* @__PURE__ */U("button",{onClick:n,title:i.taskbar.expose,className:"flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium text-blue-600 border border-blue-300 hover:bg-blue-50 transition-colors shrink-0",children:[
|
|
31
|
+
/* @__PURE__ */X(L,{name:"grid",className:"h-3 w-3",strokeWidth:2}),"Exposé"]}),y&&/* @__PURE__ */U(v,{portal:!0,minWidth:200,style:it(y.x,y.y),onClose:()=>g(null),children:[
|
|
32
|
+
/* @__PURE__ */X(E,{children:y.label}),
|
|
33
|
+
/* @__PURE__ */U(x,{onClick:()=>{g(null),y.items.forEach(e=>function(e){const t=xn.get(e);t&&Kn(t)}(e.id))},children:[
|
|
34
|
+
/* @__PURE__ */X(L,{name:"remove",className:"h-4 w-4 text-gray-400",strokeWidth:1.5}),i.taskbar.minimizeAllWindows]}),
|
|
35
|
+
/* @__PURE__ */U(x,{onClick:()=>{g(null),y.items.forEach(e=>o(e.id))},children:[
|
|
36
|
+
/* @__PURE__ */X("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */X("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75h6.5v6.5h-6.5zM13.75 8.75h6.5v6.5h-6.5z"})}),i.taskbar.restoreAllWindows]}),
|
|
37
|
+
/* @__PURE__ */X(k,{}),
|
|
38
|
+
/* @__PURE__ */U(x,{danger:!0,onClick:()=>{g(null),y.items.forEach(e=>t(e.id))},children:[
|
|
39
|
+
/* @__PURE__ */X(L,{name:"close",className:"h-4 w-4",strokeWidth:2}),`${i.taskbar.closeAllWindows} (${y.items.length})`]})]}),m&&f&&/* @__PURE__ */X(ot,{items:m,anchorEl:f,onActivate:e=>{o(e),p(null),w(null)},onClose:e=>{t(e),p(null),w(null)},onMouseEnter:()=>{b.current&&(clearTimeout(b.current),b.current=null)},onMouseLeave:C})]}),a)}var st=["/login","/forgot-password","/reset-password","/force-change-password"];function lt({children:e,windowAccentForRoute:t}){const n=J(),r=st.some(e=>n.pathname.startsWith(e)),[o,i]=K([]),a=I(o);D(()=>{a.current=o},[o]);const s=$(fe,pe,pe),l=I(/* @__PURE__ */new Map),c=e=>{const t=Xe(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};P(()=>{Ve.clear();for(const e of o)e.route&&Ve.set(e.id,e.route)},[o]);const d=W(e=>{i(t=>t.filter(t=>t.id!==e))},[]),u=W(e=>{var t;He(e)||Ye(e)?(t=e,window.dispatchEvent(new CustomEvent(sr,{detail:{windowKey:t}}))):d(e)},[d]),h=(e,t=!1)=>{const n=wn;t&&je.add(e),setTimeout(()=>{const r=document.querySelector(`[data-modal-panel][data-window-key="${e}"]`),o=r?.getAttribute("data-modal-id");var i,a;!o||(i=o,a=n,(yn.get(i)??-1)>a)||Pn(o),t&&je.delete(e)},50)},m=W((e,t,n,r,o)=>{if(!re[e]||!ee(re[e]))return;const a=`${e}:${t}`,s=_e();i(i=>{const l=i.find(n=>n.entityType===e&&String(n.entityId)===String(t));return l?(h(l.id),i):(h(a,!0),[...i,{id:a,type:"modal",label:r||t,route:o||window.location.pathname,entityType:e,entityId:t,entitySnapshot:Le(n),openedFrom:s}])})},[]),p=W((e,t={})=>{if(!re[e]||!Q(re[e]))return;const n=re[e],{reuse:r=!1,background:o=!1,shellOwned:s,search:l}=t,c=e=>{var t;o?(t=e,Nn.add(t)):h(e)};if(n.widget){const t=a.current.find(t=>"page"===t.type&&t.route===e);if(t)return void u(t.id)}const d=_e();i(t=>{if(n.multiInstance){const i=t.filter(t=>"page"===t.type&&t.route===e);if(r&&!l&&i.length>0)return o||h(i[i.length-1].id),t;const a=`page:${e}:${Math.random().toString(36).slice(2,8)}`;return c(a),[...t,{id:a,type:"page",label:n.label,route:e,openedFrom:d,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}}]}const i=t.find(t=>"page"===t.type&&t.route===e);if(i)return n.widget?t:(o||h(i.id),l&&i.pageSearch!==l?t.map(e=>e===i?{...e,pageSearch:l}:e):t);const a=`page:${e}`;return c(a),[...t,{id:a,type:"page",label:n.label,route:e,openedFrom:d,...s?{shellOwned:s}:{},...l?{pageSearch:l}:{}}]})},[u]),f=W(()=>{},[]),w=W(()=>{},[]),y=u,g=u;/* @__PURE__ */
|
|
40
|
+
return U(Pe.Provider,{value:{openWindows:o,openEntity:m,openPage:p,closeEntity:y,minimize:f,items:[],openItems:o,restore:w,remove:g,restoreIfMinimized:()=>!1},children:[e,
|
|
41
|
+
/* @__PURE__ */X(at,{openWindows:o,onRemove:u,onSplitView:Sr,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&&Pn(e)}})},onActivateById:Ue}),
|
|
42
|
+
/* @__PURE__ */X(Lr,{}),!r&&o.map(e=>{const n=e.route?t?.(e.route):void 0;
|
|
43
|
+
/* @__PURE__ */
|
|
44
|
+
return X(ce.Provider,{value:c(e),children:/* @__PURE__ */X(ye,{fallback:(t,n)=>/* @__PURE__ */X(Tr,{open:!0,onClose:()=>d(e.id),title:e.label,size:"md",autoHeight:!0,windowKey:e.id,children:/* @__PURE__ */X(we,{error:t,onReload:n})}),children:/* @__PURE__ */X(Pt,{spec:Re(e),children:/* @__PURE__ */X($r,{windowId:e.id,children:"page"===e.type?/* @__PURE__ */X(Fe,{item:e,onClose:()=>d(e.id),accentRgb:n}):/* @__PURE__ */X(Be,{item:e,onClose:()=>d(e.id),onMinimize:()=>{},accentRgb:n})})})})},e.id)})]})}var ct=null,dt=/* @__PURE__ */new Set;function ut(){return ct}function ht(e){if(ct!==e){ct=e;for(const e of dt)e()}}function mt(e){return dt.add(e),()=>{dt.delete(e)}}var pt=!1,ft={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},wt=()=>{};function yt(e){pt=e,ft={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0}}function gt(e,t){pt&&("submenu"===e?ft.submenus++:ft.menus++,ft.menuKey=t)}function bt(e){if(!pt)return wt;const t=performance.now();let n=!1;return()=>{if(n)return;if(n=!0,!pt)return;const r=performance.now()-t;"move"===e?ft.moveMs+=r:ft.resizeMs+=r}}function vt(){const e=ft;return ft={menus:0,submenus:0,menuKey:null,moveMs:0,resizeMs:0},e}var xt=/* @__PURE__ */new Set(["button","a","input","select","textarea","kbd"]),kt=/* @__PURE__ */new Set(["svg"]);function Et(e){const t=[],n={text:"",accessories:[]};return Ct(e,n,t),n.text=t.join("").replace(/\s+/g," ").trim(),n}function Ct(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=>Ct(e,t,n));if(!O(e))return;const r=e;if(r.type!==d)if(r.type!==R){if("string"==typeof r.type){if(kt.has(r.type))return;if(!xt.has(r.type))return n.push(" "),F.toArray(r.props.children).forEach(e=>Ct(e,t,n)),void n.push(" ")}t.accessories.push(q(r,{key:`title-part-${t.accessories.length}`}))}else F.toArray(r.props.children).forEach(e=>Ct(e,t,n));else void 0===t.copy&&"string"==typeof r.props.text&&r.props.text&&(t.copy=r.props.text)}var Mt=/* @__PURE__ */new Map,Nt=/* @__PURE__ */new Set,St=0;function Lt(){St++,Nt.forEach(e=>e())}function Tt(e){return Mt.get(e)}function zt(e){return Nt.add(e),()=>{Nt.delete(e)}}function At(){return St}var Dt=T(""),It=T(null);function Pt({spec:e,children:t}){/* @__PURE__ */
|
|
45
|
+
return X(It.Provider,{value:e,children:t})}var Kt=/* @__PURE__ */new Set(["button","input","textarea","select","kbd","svg"]),$t='button[type="submit"], button[data-submit], button.btn-submit, button.bg-green-600, button.bg-blue-600',Wt='button, a[href], summary, [role="button"], [role="link"], [role="menuitem"], select';function Ot(e){return Rt(e).replace(/\s+/g," ").trim()}function Rt(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(Rt).join("");if(O(e)){const t=e,n="string"==typeof t.type?t.type:"";return Kt.has(n)?"":` ${Rt(t.props?.children)} `}return""}function Ft(e){const t=z(Dt);P(()=>{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 qt={};function jt(e,t,n){const r=z(Dt);P(()=>{if(!r)return;qt[r]||(qt[r]=[]);const o={label:e,icon:n,onClick:t};return qt[r].push(o),()=>{qt[r]=(qt[r]||[]).filter(e=>e!==o)}},[r,e,t,n])}function Bt({title:e}){const t=I(null);return P(()=>{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__ */X("span",{ref:t,style:{display:"none"},"aria-hidden":"true"})}function Ht(e){}var Yt=T(null);function Ut(){return z(Dt)}function Xt(){const e=$(ar,ir),t=z(Yt);return t?.active??(mn.length<=1||null!=e)}function _t({children:e,position:t="right",quiet:n=!1}){const r=z(Yt),[o,i]=K(null);return P(()=>{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?V(e,o):null}function Vt({onClick:e,children:t,className:n}){const r=z(Yt);/* @__PURE__ */
|
|
46
|
+
return X("button",{type:"button",onClick:async()=>{if(r?.isDirty){const{confirm:e}=await(import("./ConfirmDialog-3TIHKJRT.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 Jt="erp_window_positions",Gt={};try{const e=localStorage.getItem(Jt);e&&(Gt=JSON.parse(e))}catch{}var Zt=null;function Qt(){Zt&&clearTimeout(Zt),Zt=setTimeout(()=>{try{localStorage.setItem(Jt,JSON.stringify(Gt))}catch{}},500)}var en="erp_activation_order",tn=[];try{const e=localStorage.getItem(en),t=e?JSON.parse(e):null;Array.isArray(t)&&t.every(e=>"string"==typeof e)&&(tn=t)}catch{}var nn=null;function rn(){nn&&clearTimeout(nn),nn=setTimeout(()=>{try{localStorage.setItem(en,JSON.stringify(tn))}catch{}},500)}function on(e,t){Gt[e]||(Gt[e]=t,Qt())}function an(e){return Gt[e]?{...Gt[e]}:null}function sn(e,t){Gt[e]=t,Qt()}function ln(){const r=e(),o=t();let i=!1;for(const e of Object.keys(Gt))n(Gt[e],r,o)&&(delete Gt[e],i=!0);i&&Qt()}var cn={sm:384,md:512,lg:672,xl:896,"2xl":1152,"3xl":1408},dn=4e3,un=()=>{if("undefined"==typeof document)return"large";const e=getComputedStyle(document.documentElement).getPropertyValue("--default-window-size")?.trim();return"small"===e||"medium"===e||"maximized"===e?e:"large"},hn={small:.8,medium:1,large:1.25,maximized:1.25},mn=[],pn=/* @__PURE__ */new Set,fn=/* @__PURE__ */new Set,wn=0,yn=/* @__PURE__ */new Map;var gn=0;function bn(){return gn}function vn(){gn++,pn.forEach(e=>e())}var xn=/* @__PURE__ */new Map,kn=/* @__PURE__ */new Map,En=/* @__PURE__ */new Map;function Cn(){for(let e=mn.length-1;e>=0;e--){const t=En.get(mn[e]);if(t?.tab)return t.owner}return null}function Mn(){return $(ar,Cn,()=>null)}var Nn=/* @__PURE__ */new Set;var Sn=null;function Ln(e){Sn=null,Pn(e)}function Tn(e){Sn=e;const t=xn.get(e);t&&Ln(t)}function zn(e){Sn===e&&(Sn=null)}function An(e,t,n){if(n&&En.set(e,n),t)if(xn.set(t,e),kn.set(e,t),Nn.delete(t)){mn.unshift(e);const n=tn.indexOf(t);-1!==n&&tn.splice(n,1),tn.unshift(t),rn()}else!function(e,t){const n=tn.indexOf(t);if(-1===n)return void mn.push(e);let r=mn.length;for(let e=0;e<mn.length;e++){const t=kn.get(mn[e]);if(t&&tn.indexOf(t)>n){r=e;break}}mn.splice(r,0,e)}(e,t),-1===tn.indexOf(t)&&(tn.push(t),rn());else mn.push(e);vn(),window.dispatchEvent(new CustomEvent("modal-reorder")),t&&Sn===t&&Ln(e)}function Dn(e){return e?En.get(e)?.owner??kn.get(e)??null:null}var In=/* @__PURE__ */new Set;function Pn(e){const t=Dn(ir()),n=mn.indexOf(e);-1!==n&&mn.splice(n,1),mn.push(e);const o=En.get(e);if(o?.root&&o.tab&&r()){const e=mn.filter(e=>{const t=En.get(e);return!!t&&!t.root&&t.owner===o.owner});for(const t of e)mn.splice(mn.indexOf(t),1),mn.push(t)}fn.delete(e);const i=kn.get(e);if(i){const e=tn.indexOf(i);-1!==e&&tn.splice(e,1),tn.push(i),rn(),Sn&&Sn!==i&&(Sn=null)}vn(),window.dispatchEvent(new CustomEvent("modal-reorder"));const a=Dn(ir());a&&a!==t&&In.forEach(e=>e(a))}function Kn(e){const t=mn.indexOf(e);-1!==t&&mn.splice(t,1),fn.add(e),yn.set(e,++wn);const n=kn.get(e);if(n){const e=tn.indexOf(n);-1!==e&&(tn.splice(e,1),rn())}vn(),window.dispatchEvent(new CustomEvent("modal-reorder"))}var $n=/* @__PURE__ */new Set;var Wn=8,On=32;function Rn(){return e()}var Fn=40,qn=80,jn=384,Bn=400;function Hn(e,t=Rn()){const n=Math.min(Math.max(e.x,t.x+qn-e.w),t.x+t.w-qn),r=Math.min(Math.max(e.y,t.y),t.y+t.h-Fn);return n===e.x&&r===e.y?e:{...e,x:n,y:r}}function Yn(e){const t=e.getBoundingClientRect();if(0===t.width||0===t.height)return!0;const n=Rn();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 Un(e){const t=Rn(),n=Math.floor(t.w/2),r=Math.floor(t.h/2);switch(e){case"top":return{x:t.x,y:t.y,w:t.w,h:t.h};case"left":return{x:t.x,y:t.y,w:n,h:t.h};case"right":return{x:t.x+n,y:t.y,w:t.w-n,h:t.h};case"tl":return{x:t.x,y:t.y,w:n,h:r};case"tr":return{x:t.x+n,y:t.y,w:t.w-n,h:r};case"bl":return{x:t.x,y:t.y+r,w:n,h:t.h-r};case"br":return{x:t.x+n,y:t.y+r,w:t.w-n,h:t.h-r}}}var Xn=null;function _n(e){const t=(Xn||((Xn=document.createElement("div")).style.cssText=["position: fixed","pointer-events: none",`z-index: ${C.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(Xn)),Xn);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 Vn(){Xn&&(Xn.style.opacity="0",Xn.style.display="none")}var Jn=[{zone:"left",labelKey:"snapLeft",region:"inset-y-0 left-0 w-1/2"},{zone:"right",labelKey:"snapRight",region:"inset-y-0 right-0 w-1/2"},{zone:"tl",labelKey:"snapTopLeft",region:"top-0 left-0 h-1/2 w-1/2"},{zone:"tr",labelKey:"snapTopRight",region:"top-0 right-0 h-1/2 w-1/2"},{zone:"bl",labelKey:"snapBottomLeft",region:"bottom-0 left-0 h-1/2 w-1/2"},{zone:"br",labelKey:"snapBottomRight",region:"bottom-0 right-0 h-1/2 w-1/2"}],Gn=350,Zn=200;function Qn({maximized:e,onToggleMax:t,onSnap:n,buttonClassName:r,strings:o}){const[i,a]=K(!1),s=I(void 0),l=I(void 0);P(()=>()=>{clearTimeout(s.current),clearTimeout(l.current)},[]);const c=()=>{clearTimeout(l.current),s.current=setTimeout(()=>a(!0),Gn)},d=()=>{clearTimeout(s.current),l.current=setTimeout(()=>a(!1),Zn)};/* @__PURE__ */
|
|
47
|
+
return U("span",{className:"relative inline-flex",onMouseEnter:c,onMouseLeave:d,children:[
|
|
48
|
+
/* @__PURE__ */X("button",{onClick:t,onFocus:c,onBlur:d,title:e?o.windowed:o.maximize,className:r,children:e?"❐":"⤢"}),i&&/* @__PURE__ */X("div",{role:"group","aria-label":o.snapLayouts,onMouseEnter:()=>clearTimeout(l.current),onMouseLeave:d,className:"absolute right-0 top-full z-30 mt-1 grid w-max grid-cols-2 gap-1 rounded-lg border border-gray-200 bg-white p-1.5 shadow-lg",children:Jn.map(({zone:e,labelKey:t,region:r})=>/* @__PURE__ */X("button",{type:"button","aria-label":o[t],title:o[t],onClick:()=>{a(!1),n(e)},onFocus:()=>clearTimeout(l.current),onBlur:d,className:"relative h-7 w-11 rounded border border-gray-300 bg-gray-50 hover:border-blue-400 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400",children:/* @__PURE__ */X("span",{"aria-hidden":"true",className:`absolute rounded-sm bg-blue-500/70 ${r}`,style:{margin:2}})},e))})]})}var er="rosh-gesture-style";var tr={se:"nwse-resize",nw:"nwse-resize",sw:"nesw-resize",ne:"nesw-resize",n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize"},nr=4;function rr(e,t,n,r){!function(){if("undefined"==typeof document||document.getElementById(er))return;const e=document.createElement("style");e.id=er,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=bt(r);let a=!1;return()=>{if(!a){a=!0,i();try{e.releasePointerCapture(t)}catch{}o.remove(),document.body.classList.remove("rosh-gesturing")}}}function or(e){const t=mn.indexOf(e);if(-1===t)return-1;const n=C.window+t*C.windowStep,o=En.get(e);if(!o||o.root||!o.tab||!r())return n;let i=-1;for(const[e,t]of En){if(!t.root||t.owner!==o.owner)continue;const n=mn.indexOf(e);-1!==n&&(i=Math.max(i,C.window+n*C.windowStep))}return i>=n?i+2+Math.min(t,7):n}function ir(){return mn[mn.length-1]||null}function ar(e){return pn.add(e),()=>{pn.delete(e)}}"undefined"!=typeof window&&window.addEventListener("deactivate-all-modals",function(){for(let e=mn.length-1;e>=0;e--)$n.has(mn[e])||mn.splice(e,1);tn=tn.filter(e=>{const t=xn.get(e);return null!=t&&$n.has(t)}),rn(),vn(),window.dispatchEvent(new CustomEvent("modal-reorder"))});var sr="modal-close-request";function lr(e){$(ar,bn);const t=z(Yt);if(mn.length<=1)return!0;if(e){const t=xn.get(e);if(null!=t)return ir()===t}return t?.active??null!=ir()}var cr=!1,dr=/* @__PURE__ */new Set;function ur(e){return dr.add(e),()=>dr.delete(e)}function hr(){return cr}function mr(e){cr!==e&&(cr=e,dr.forEach(e=>e()))}function pr(){mr(!cr)}function fr(){mr(!1)}var wr=null,yr=/* @__PURE__ */new Set;function gr(e){return yr.add(e),()=>yr.delete(e)}function br(){return wr}function vr(e){wr!==e&&(wr=e,yr.forEach(e=>e()))}var xr=null,kr=/* @__PURE__ */new Set;function Er(e){return kr.add(e),()=>kr.delete(e)}function Cr(){return xr}function Mr(e){xr!==e&&(xr=e,kr.forEach(e=>e()))}function Nr(){if(!xr)return void mr(!1);vr(xr),Mr(null),mr(!1)}function Sr(){mr(!cr),window.dispatchEvent(new CustomEvent("modal-split-view"))}function Lr(){const e=$(ur,hr),[t,n]=K(e),[r,o]=K(e);return P(()=>{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?V(
|
|
49
|
+
/* @__PURE__ */X("div",{onMouseDown:e=>{e.stopPropagation(),mr(!1)},style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",zIndex:C.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 Tr({open:t,onClose:i,title:c,icon:d,copyText:u,size:h="lg",dirty:m=!1,onNext:p,onPrev:f,footer:g,bodyScroll:E,onMinimize:N,initialBox:T,actions:A,actionsLeft:R,editing:F=!1,allowPinOnTop:B,initialPosition:H,widget:Y,compact:J,appStyle:G,flushBody:Z,autoHeight:Q,autoMinHeight:ee,autoWidth:te,widgetMenu:ne,dimensions:re,windowKey:oe,openedFromKey:ie,accentRgb:ae,children:se}){const le=w(),[de,ue]=K(0),[he,me]=K(!1),pe=I(null),fe=I(0);P(()=>{fe.current=de},[de]);const we=W(e=>{le&&(pe.current={startX:e.clientX,startY:e.clientY,pointerId:e.pointerId},me(!0),ht(ie??null))},[le,ie]),be=$(mt,ut);P(()=>{if(!he)return;const e=e=>{if(!pe.current)return;const t=e.clientX-pe.current.startX;if(Math.abs(e.clientY-pe.current.startY)>Math.abs(t)+12)return pe.current=null,me(!1),ue(0),void ht(null);ue(Math.max(0,t))},t=()=>{if(!pe.current)return;const e=.3*window.innerWidth,t=fe.current>e;pe.current=null,me(!1),t?(ue(window.innerWidth),setTimeout(()=>{i(),ue(0),ht(null)},180)):(ue(0),ht(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)}},[he]);const[xe,ke]=K(c),Ee=S(),Ce=Ee.window;P(()=>{ke(c)},[c]);const Me=j(()=>Ot(xe).trim()||void 0,[xe]),[Ne,Se]=K(!1),Le=I(!1),[Te,ze]=K(!1),[Ae,De]=K(null),Ie=z(It),Pe=z(ce),{prefs:Ke,save:We}=y(),Re=!!Ke.window_accent_stripe,Fe=Ke.favorite_documents||[],qe=!!Ie&&Fe.some(e=>e.entityType===Ie.entityType&&e.entityId===Ie.entityId),je=W(()=>{if(!Ie)return;const e=qe?Fe.filter(e=>!(e.entityType===Ie.entityType&&e.entityId===Ie.entityId)):[...Fe,{entityType:Ie.entityType,entityId:Ie.entityId,label:Ie.label}];We({favorite_documents:e})},[Ie,qe,Fe,We]),[Be,He]=K(null),[Ye,Ue]=K("top-right"===H?"right":"left"),Xe=I(!1),_e=I(null);D(()=>{const e=_e.current;e&&(ae?e.style.setProperty("--window-accent-rgb",ae):e.style.removeProperty("--window-accent-rgb"))},[ae]);const Ve=I(!1),Je=I(null),Ge=I(null),Ze=I(null),[Qe,et]=K(!1),tt=I(null),nt=!!(g||A||R)||Qe,rt=z(ge),ot=""!==z(Dt),it=I(null);it.current=Pe?{owner:Pe.key,tab:Pe.tab,root:!ot}:null;const at=oe||(Pe&&!ot?Pe.key:null),st=!!rt&&!ot&&rt.enabled&&rt.hasState&&(F||rt.declaredEditable)&&!rt.handMounted&&nt&&!Y&&!J&&!G&&!le,lt=/* @__PURE__ */X(L,{name:"window",className:"h-4 w-4 text-gray-400",strokeWidth:1.5}),ct=d&&O(d)?q(d,{className:`h-4 w-4 ${d.props?.className??""}`.trim()}):d??lt,dt=()=>/* @__PURE__ */X("button",{onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();De(e=>e?null:{x:t.left,y:t.bottom+4})},className:"shrink-0 p-0.5 rounded hover:bg-gray-200/50 transition-colors",title:"Window menu",children:ct}),pt=40,{minimize:ft,items:wt,restoreIfMinimized:yt,openWindows:gt}=Oe(),bt=I(`modal-${Math.random().toString(36).slice(2,8)}`).current;P(()=>{if(Y)return $n.add(bt),()=>{$n.delete(bt)}},[Y,bt]),P(()=>{const e=e=>{const t=e.detail;t?.id===bt&&ke(t.title)};return window.addEventListener("window-title-update",e),()=>window.removeEventListener("window-title-update",e)},[bt]);const[vt,xt]=K(C.window),kt=function(e){const t=$(ar,ir);return mn.length<=1||t===e}(bt),Ct=function(e){return $(ar,()=>fn.has(e))}(bt),Nt=$(ur,hr),St=$(gr,br),Tt=$(Er,Cr),zt=!B&&!Y,At=Nt&&zt,[Pt,Kt]=K(!1),Rt=At&&Tt===bt,[Ft,jt]=K(!1),Bt=Ft&&zt&&St===bt?"picked":null,Ht=I(At);P(()=>{if(Ht.current&&!At){jt(!0);const e=setTimeout(()=>{jt(!1),wr===bt&&vr(null)},700);return Ht.current=At,()=>clearTimeout(e)}Ht.current=At},[At,bt]),P(()=>{At||Kt(!1)},[At]),P(()=>{const e=Ge.current,t=Ze.current;if(!e&&!t)return;const n=e=>e?Array.from(e.children).filter(e=>"shell"!==e.dataset.undoControls).length:0,r=()=>et(n(e)+n(t)>0);r();const o=new MutationObserver(r);return e&&o.observe(e,{childList:!0}),t&&o.observe(t,{childList:!0}),()=>o.disconnect()},[t]),P(()=>{const e=e=>{if(e.target.closest('button[type="submit"]')&&_e.current){const t=_e.current.querySelector("form");t&&(e.preventDefault(),t.requestSubmit())}},t=Ge.current,n=Ze.current;return t&&t.addEventListener("click",e),n&&n.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e),n&&n.removeEventListener("click",e)}},[t]);const Ut=I(!1),Xt=W(e,[]),_t=W(()=>{const t=e(),n=re?re[0]:cn[h]||672,o=t.w-80,i=t.h-80,a=Math.min(n,o),s=hn[un()],l=re?Math.min(re[1],i):(()=>{const e=("sm"===h?500:"md"===h?600:"lg"===h?700:"xl"===h?800:920)*s;return Math.max(320,Math.min(e,t.h-80))})(),c="cascade"!==(getComputedStyle(document.documentElement).getPropertyValue("--window-position")?.trim()||"cascade")||r()?0:30*(mn.length-1),d=Math.max(pt,(i-l)/2),u=(o-a)/2,m=t.h-pt-l-d;return"top-right"===H?{x:t.x+t.w-a-pt,y:t.y+pt,w:a,h:l}:"top-left"===H?{x:t.x+pt,y:t.y+pt,w:a,h:l}:{x:t.x+Math.max(pt,(o-a)/2+pt)+Math.min(c,Math.max(0,u)),y:t.y+d+Math.min(c,Math.max(0,m)),w:a,h:l}},[h]),Vt=I(!1);t||(Vt.current=!1);const Jt=oe||u||null;P(()=>{if(!t)return;An(bt,Jt,it.current??void 0),oe||Pn(bt),Ut.current=!1,xt(or(bt));const e=()=>{xt(or(bt))},n=()=>{},r=e=>{if(!e)return!1;if(e.windowKey)return e.windowKey===oe;if(!e.label)return!1;const t=_e.current?.querySelector("[data-window-title]");return!!t?.textContent?.includes(e.label)},o=e=>{if(!r(e.detail))return;if(Pn(bt),gn.current)return;const t=Rn(),n=Math.min(Ln.current.w,t.w-40),o=Math.min(Ln.current.h,t.h-40),i=t.x+(t.w-n)/2,a=t.y+(t.h-o)/2;tn({x:i,y:a,w:n,h:o}),Sn(!1)},i=e=>{const t=e.detail;r(t)&&(Pn(bt),De({x:t.x,y:t.y}))},a=e=>{if(e.detail?.windowKey!==oe)return;Pn(bt);const t=Ln.current,n=function(e,t=Rn()){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=_e.current,o="function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(r&&!o){let e=!1;const t=()=>{e||(e=!0,r.style.transition="",window.dispatchEvent(new CustomEvent("modal-geometry")))};r.style.transition="left .28s ease, top .28s ease, width .28s ease, height .28s ease",r.addEventListener("transitionend",t,{once:!0}),window.setTimeout(t,400)}tn(n)};return window.addEventListener("modal-reorder",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=mn.indexOf(e);-1!==t&&(mn.splice(t,1),vn()),fn.delete(e),yn.delete(e),En.delete(e);const n=kn.get(e);n&&(kn.delete(e),xn.delete(n))}(bt),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,bt,Jt,Xt]);const Zt=!Y&&"maximized"===un(),[en,tn]=K(()=>{if(Jt&&Gt[Jt]){const e={...Gt[Jt]};return re&&(e.w=re[0],Q||(e.h=re[1])),Hn(e)}return T?{x:T.x,y:T.y,w:T.w,h:T.h}:Zt?Xt():_t()}),[nn,rn]=K(()=>!Q),[on,an]=K(()=>r()),sn=I(on),ln=I(null);P(()=>{const e=()=>{const e=r();e!==sn.current&&ln.current?.(e),sn.current=e,an(e),xt(or(bt))};return window.addEventListener("react-os-shell:layout-mode-changed",e),()=>window.removeEventListener("react-os-shell:layout-mode-changed",e)},[bt]);const pn=on&&!!Pe?.tab&&!ot&&!Y&&!le,wn=pn,gn=I(wn);gn.current=wn;const bn=Mn(),Cn=on&&!!Pe?.tab&&!Y&&!le&&!Nt&&bn!==Pe.key,[Nn,Sn]=K(()=>Jt&&Gt[Jt]||T?wn:wn||Zt),Ln=I(en);Ln.current=en;const Tn=I(Nn);D(()=>{Tn.current=Nn},[Nn]),D(()=>{if(nn||pn)return;const e=_e.current,t=Je.current;if(!e||!t)return;const n=ee??(Y?0:240),r=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0;let o=0,i=null,a=null;const s=()=>{const c=t.firstElementChild;if(!c||e.offsetHeight<=0)return;c!==a&&(a&&l.unobserve(a),l.observe(c),a=c);const d=e.offsetHeight-t.offsetHeight,u=t.style.flex,h=t.style.overflowY,m=t.style.height;t.style.flex="0 0 auto",t.style.height="auto",t.style.overflowY="visible";const p=t.offsetHeight,f=c.offsetHeight;t.style.flex=u,t.style.height=m,t.style.overflowY=h;const w=c.offsetHeight>f+4,y=Math.max(n,window.innerHeight-r-Math.max(0,Ln.current.y)-24),g=w?Math.min(Ln.current.h,y):Math.min(Math.max(n,d+p),y),b=Math.abs(g-o)>1;b&&(o=g,tn(e=>Math.abs(e.h-g)>1?{...e,h:g}:e)),Y||(g<=n?i&&(clearTimeout(i),i=null):(b||null===i)&&(i&&clearTimeout(i),i=setTimeout(()=>{const e=o;s(),o===e&&rn(!0)},160)))},l=new ResizeObserver(s);s(),tt.current&&l.observe(tt.current);const c=new MutationObserver(s);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{l.disconnect(),c.disconnect(),i&&clearTimeout(i)}},[nn,Y,ee,nt,pn]),D(()=>{if(!Q||!nn||Y||!t)return;const e=tt.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||Nn)return;if(document.body.classList.contains("rosh-gesturing"))return;const i=ee??240,a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height"))||0,s=Math.max(i,window.innerHeight-a-Math.max(0,Ln.current.y)-24);tn(e=>({...e,h:Math.min(Math.max(i,e.h+r),s)}))});return r.observe(e),()=>r.disconnect()},[Q,nn,Y,t,Nn,ee]);const zn=!1!==te&&!Y&&!G&&!le,[Dn,In]=K(()=>!zn);D(()=>{if(Dn||!t)return;if(!zn||Nn)return void In(!0);const n=_e.current,r=Je.current;if(!n||!r)return;const o=/* @__PURE__ */new WeakSet;let i=Ln.current.w,c=0;const d=()=>In(!0),u=()=>{c=0;const t=Ln.current;if(Math.abs(t.w-i)>1||document.body.classList.contains("rosh-gesturing"))return void d();const u=e(),h=u.w-80;if(t.w>=h)return void d();const m=[],p=[];for(const e of[r,...Array.from(r.querySelectorAll("*"))]){const t=e.scrollWidth-e.clientWidth;if(t<=4||o.has(e))continue;const n=getComputedStyle(e).overflowX;"auto"!==n&&"scroll"!==n||(m.push(e),p.push(t))}if(!m.length)return;const f=Math.min(h,t.w+Math.max(...p)),w=f-t.w,y=n.style.width;n.style.width=`${f}px`;const g=m.map((e,t)=>({over:p[t],residual:e.scrollWidth-e.clientWidth}));n.style.width=y,g.forEach((e,t)=>{a(e,w)||o.add(m[t])});const b=s(t,l(t.w,w,g),u,pt);b!==t&&(i=b.w,tn(b))};u();const h=new MutationObserver(()=>{c||(c=requestAnimationFrame(u))});h.observe(r,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["style","class","hidden"]});const m=setTimeout(d,dn);return()=>{h.disconnect(),c&&cancelAnimationFrame(c),clearTimeout(m)}},[Dn,t,zn,Nn]);const Fn=I(null),qn=!(!Pe?.tab||ot||Y||le);ln.current=t=>{if(!qn)return;if(t)return Fn.current||(Fn.current={box:{...Ln.current},maximized:Tn.current}),void(Tn.current=!0);const r=Fn.current;Fn.current=null;const o=e();if(r?.maximized)return Tn.current=!0,Sn(!0),void tn(o);const i=r?.box??(Jt?Gt[Jt]:void 0);if(Tn.current=!1,Sn(!1),i&&!n(i,o,!1)){const e={...i};re&&(e.w=re[0],Q||(e.h=re[1])),tn(Hn(e))}else tn(_t())},P(()=>{wn&&(Tn.current=!0,Sn(!0),tn(Xt()))},[wn,Xt]),P(()=>{if(Y)return;const e=()=>{const e=Jt?Gt[Jt]:void 0;if(Tn.current=!1,Sn(!1),e){const t={...e};re&&(t.w=re[0],Q||(t.h=re[1])),tn(Hn(t))}else tn(_t())};return window.addEventListener("react-os-shell:restore-windowed",e),()=>window.removeEventListener("react-os-shell:restore-windowed",e)},[Y,_t,Jt]),P(()=>{t&&Jt&&!pn&&(Gt[Jt]=en,Qt()),t&&window.dispatchEvent(new CustomEvent("modal-geometry"))},[en,t,Jt,pn]),P(()=>{if(!t)return;const e=()=>{Tn.current?tn(Xt()):document.body.classList.contains("rosh-gesturing")||tn(Hn)};window.addEventListener("resize",e),window.addEventListener(o,e);let n=null;return Nn&&(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,Nn,Xt]),P(()=>{if(t&&(Se(!1),Le.current=!1,Xe.current=!1,In(!zn),!gn.current)){if(Jt&&Gt[Jt]){const e=Gt[Jt];return void tn(t=>Hn({...e,...Q?{h:t.h}:{},...zn?{x:t.x,w:t.w}:{}}))}T&&(tn({x:T.x,y:T.y,w:T.w,h:T.h}),Sn(T.maximized))}},[t]),P(()=>{if(!t||"auto"!==m)return;let e;const n=t=>{_e.current?.contains(t.target)&&!Le.current&&(Le.current=!0,e=setTimeout(()=>Se(!0),0))};return document.addEventListener("input",n,!0),document.addEventListener("change",n,!0),()=>{clearTimeout(e),document.removeEventListener("input",n,!0),document.removeEventListener("change",n,!0)}},[t,m]);const Yn="auto"===m?Ne:!0===m,Xn=Pe&&!ot?Pe.key:null,Jn=j(()=>Et(xe),[xe]),Gn=I({shortcutSpec:Ie,isOnDesktop:qe,toggleDesktopShortcut:je,taskbarStrings:Ee.taskbar});D(()=>{Gn.current={shortcutSpec:Ie,isOnDesktop:qe,toggleDesktopShortcut:je,taskbarStrings:Ee.taskbar}});const Zn=I(null);Zn.current||(Zn.current={open:(e,t)=>De({x:e,y:t}),items:()=>{const e=Gn.current,t=[];e.shortcutSpec&&t.push({label:e.isOnDesktop?e.taskbarStrings.removeFromDesktop:e.taskbarStrings.addToDesktop,onSelect:e.toggleDesktopShortcut});for(const e of qt[bt]||[])t.push({label:e.label,icon:e.icon,onSelect:e.onClick});return t}}),P(()=>{t&&Xn&&function(e,t){const n=Mt.get(e);n&&n.title===t.title&&n.dirty===t.dirty&&n.copy===t.copy&&n.menu===t.menu||(Mt.set(e,t),Lt())}(Xn,{title:Jn.text||Me,dirty:Yn,copy:Jn.copy,menu:Zn.current??void 0})},[t,Xn,Me,Yn,Jn.text,Jn.copy]),P(()=>{if(t&&Xn)return()=>{return e=Xn,void(Mt.delete(e)&&Lt());var e}},[t,Xn]),$e(!(oe||!t)&&Yn);const er=W(async()=>{if(!Xe.current){if(Yn||"auto"===m&&Le.current){Xe.current=!0;const e=Me,t=await b({title:"Discard changes?",message:e?`“${e}” has unsaved changes. Are you sure you want to close? All changes will be lost.`:"You have unsaved changes. Are you sure you want to close? All changes will be lost.",confirmLabel:"Discard",cancelLabel:"Keep Editing",variant:"warning"});if(Xe.current=!1,!t)return}i()}},[Yn,m,i,Me]);D(()=>{if(!t||!at)return;const e=e=>{e.detail?.windowKey===at&&er()};return window.addEventListener(sr,e),()=>window.removeEventListener(sr,e)},[t,at,er]);const lr=I(null),cr=W(e=>{if(0!==e.button)return;if(e.target.closest("button, input, a, kbd, select, textarea"))return;if(De(null),Pn(bt),gn.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=_e.current,s=a?.getBoundingClientRect();let l,c,d,u;if(lr.current){const t=lr.current;lr.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:Ln.current.x,c=s?s.top:Ln.current.y,d=s?s.height:Ln.current.h,u=s?s.width:Ln.current.w;Sn(!1),tn(e=>({...e,x:l,y:c,w:u,h:d}));let h=null;const m=e=>{if(!r){if(Math.abs(e.clientX-o)<nr&&Math.abs(e.clientY-i)<nr)return;r=rr(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)`),Ln.current={...Ln.current,x:s,y:d},!Y){const t=function(e,t){const n=Rn(),r=e<=n.x+Wn,o=e>=n.x+n.w-Wn,i=t<=n.y+Wn,a=t>=n.y+n.h-Wn,s=e<=n.x+On,l=e>=n.x+n.w-On,c=t<=n.y+On,d=t>=n.y+n.h-On;return i&&s?"tl":i&&l?"tr":a&&s?"bl":a&&l?"br":c&&r?"tl":c&&o?"tr":d&&r?"bl":d&&o?"br":i?"top":r?"left":o?"right":null}(e.clientX,e.clientY);t!==h&&(h=t,t?_n(Un(t)):Vn())}},p=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",p),r?.(),Vn();const e=Hn({...Ln.current});if(Ln.current=e,!Y&&h){lr.current={x:l,y:c,w:u,h:d};const e=Un(h);return a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.width=`${e.w}px`,a.style.height=`${e.h}px`,a.style.transform="",a.style.transition=""),void tn(e)}if(Y){const t=e.x+e.w/2,n=window.innerWidth/2;Ue(t>n?"right":"left")}a&&(a.style.left=`${e.x}px`,a.style.top=`${e.y}px`,a.style.transform="",a.style.transition=""),tn(e)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",p)},[]),dr=W((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=_e.current,l=s?.getBoundingClientRect(),c=l?l.left:Ln.current.x,d=l?l.top:Ln.current.y,u=l?l.width:Ln.current.w,h=l?l.height:Ln.current.h,m="sw"===t||"nw"===t||"w"===t,p="ne"===t||"nw"===t||"n"===t,f="se"===t||"ne"===t||"e"===t,w="se"===t||"sw"===t||"s"===t;Sn(!1),tn({x:c,y:d,w:u,h:h}),Ln.current={x:c,y:d,w:u,h:h};let y=0,g=null;const b=()=>{if(y=0,!g)return;const e=g;g=null,Ln.current=e,s&&(s.style.left=`${e.x}px`,s.style.top=`${e.y}px`,s.style.width=`${e.w}px`,s.style.height=`${e.h}px`)},v=e=>{if(!o){if(Math.abs(e.clientX-i)<nr&&Math.abs(e.clientY-a)<nr)return;o=rr(n,r,tr[t],"resize")}g=((e,t)=>{let n=c,r=d,o=u,i=h;if(f&&(o=Math.max(jn,u+e)),w&&(i=Math.max(Bn,h+t)),m){const t=Math.max(jn,u-e);n=c+u-t,o=t}if(p){const e=Math.max(Bn,h-t);r=d+h-e,i=e}return{x:n,y:r,w:o,h:i}})(e.clientX-i,e.clientY-a),y||(y=requestAnimationFrame(b))},x=()=>{window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",x),y&&cancelAnimationFrame(y),b(),o?.(),tn({...Ln.current})};window.addEventListener("pointermove",v),window.addEventListener("pointerup",x)},[]),pr=W(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(),Pn(bt),"Enter"===e.key)return void(Nn?(Sn(!1),tn(_t())):(Sn(!0),tn(Xt())));const[n,r]=t;if(e.ctrlKey||e.metaKey){const e=()=>{lr.current||(lr.current={...Ln.current})};if(r<0)return e(),Sn(!0),void tn(Xt());if(r>0){if(Nn)return Sn(!1),void tn(_t());if(lr.current){const e=Hn(lr.current);return lr.current=null,Ln.current=e,void tn(e)}return void Kn(bt)}e(),Sn(!1);const t=Un(n<0?"left":"right");return Ln.current=t,void tn(t)}if(Nn)return;const o=Ln.current,i=e.shiftKey?{...o,w:Math.max(jn,o.w+24*n),h:Math.max(Bn,o.h+24*r)}:Hn({...o,x:o.x+24*n,y:Math.max(0,o.y+24*r)});Ln.current=i,tn(i)},[bt,Nn,_t,Xt]),fr=W(e=>{lr.current||(lr.current={...Ln.current}),Sn(!1);const t=Un(e);Ln.current=t,tn(t),Pn(bt)},[bt]),yr=wn||At?{}:{tabIndex:0,role:"group","aria-label":Me?`${Me} — ${Ce.windowSuffix}`:Ce.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:pr},xr=()=>{Sn(!0),tn(Xt())},kr=W(()=>{const e=_e.current;if(!e)return;const t=e.querySelector("form");if(t)t.requestSubmit();else{const t=e.querySelector($t);t&&!t.disabled&&t.click()}},[]);P(()=>{if(!t)return;if(Y)return;const e=e=>{if(mn[mn.length-1]===bt&&"Enter"===e.key){const t=e.target;if("TEXTAREA"===t.tagName||t.isContentEditable)return;if(e.metaKey||e.ctrlKey)e.preventDefault(),kr();else{if("INPUT"===t.tagName&&t.closest("form"))return;if(!(t instanceof Element&&_e.current?.contains(t)))return;if(t.closest(Wt))return;e.preventDefault()}}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,kr,bt,Y]),P(()=>{if(!t)return;const e=e=>{mn[mn.length-1]===bt&&((e.metaKey||e.ctrlKey)&&"s"===e.key?(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-save",{detail:{modalId:bt}})),Le.current=!1,Se(!1)):e.altKey&&e.shiftKey&&("KeyD"===e.code||"D"===e.key||"d"===e.key)&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("modal-duplicate",{detail:{modalId:bt}}))))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]),P(()=>{if(!t)return;if(Y)return;const e=e=>{if("Escape"===e.key&&mn[mn.length-1]===bt){if(M(e))return e.preventDefault(),void e.stopPropagation();if(pn&&!F)return;e.preventDefault(),e.stopPropagation(),er()}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t,er,bt,Y,pn,F]);const Mr=t&&(void 0!==p||void 0!==f),Nr=W(e=>{const t=document.getElementById("nav-boundary-toast");t&&t.remove();const n="bottom"===e?["That's the last one, chief.","You've hit rock bottom... of the list.","End of the line, buddy.","Nothing left. Go outside.","Congratulations, you scrolled to the void.","There's no more. I checked.","You've reached the edge of the known universe.","Plot twist: there is no next one.","Even scrolling has limits. Unlike your ambition.","Last one. Time to touch grass."]:["Already at the top. Overachiever.","There is no item above this. Trust me.","You're #1. Literally.","Can't go higher. You've peaked.","This is it. The summit. The top.","First item. No VIP lounge above this.","Going up? Nope. Elevator's broken.","You want negative indexes? Bold.","Top of the list. Top of the world.","The only way is down from here."],r=n[Math.floor(Math.random()*n.length)],o=document.createElement("div");o.id="nav-boundary-toast",o.className="fixed bottom-6 left-1/2 -translate-x-1/2 z-(--z-toast) bg-gray-900 text-white px-5 py-2.5 rounded-lg shadow-lg text-sm font-medium transition-opacity duration-300",o.textContent=r,document.body.appendChild(o),setTimeout(()=>{o.style.opacity="0",setTimeout(()=>o.remove(),300)},2e3)},[]);if(P(()=>{if(!t)return;const e=e=>{if(mn[mn.length-1]!==bt)return;const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.target.isContentEditable||("j"===e.key&&Mr&&(e.preventDefault(),p?p():Nr("bottom")),"k"===e.key&&Mr&&(e.preventDefault(),f?f():Nr("top"))))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,p,f,Mr,Nr,bt]),!t||Vt.current)return null;const Sr=At?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=Rn(),u=(d.w-20*(o+1))/o,h=(d.h-14*(i+1)-22*i)/i,m=c?(o-l)*(u+20)/2:0;return{x:d.x+20+s*(u+20)+m,y:d.y+14+a*(h+14+22),w:u,h:h}}(bt):null,Lr=At&&Sr?Math.min(Sr.w/en.w,Sr.h/en.h):1,Tr=(()=>{if(At&&Sr){const e=Lr,t=en.w*e,n=en.h*e,r=Sr.x+(Sr.w-t)/2-en.x,o=Sr.y+(Sr.h-n)/2-en.y,i=Pt||Rt;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:C.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(Ft&&zt){const e="picked"===Bt;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:C.expose+30}:{}}}return null})(),zr=/* @__PURE__ */U("div",{children:[
|
|
50
|
+
/* @__PURE__ */U("div",{ref:_e,"data-modal-panel":!0,"data-modal-id":bt,"data-window-key":oe||void 0,...B?{"data-utility":""}:{},...Te?{"data-pinned-top":""}:{},...Y?{"data-widget":""}:{},...Pe?{"data-window-owner":Pe.key}:{},...Pe&&!ot?{"data-window-root":""}:{},...pn?{"data-window-tab":""}:{},className:pn?"fixed flex flex-col overflow-hidden":"fixed rounded-(--radius-window) flex flex-col overflow-hidden "+(Y?kt?"shadow-2xl":"shadow-lg":"border "+(kt?"shadow-2xl border-gray-200":"shadow-lg border-gray-300")),onMouseDownCapture:e=>{if(Ve.current=!1,At){if(e.target.closest("[data-expose-close]"))return;return e.preventDefault(),e.stopPropagation(),vr(bt),mr(!1),void Pn(bt)}if(!kt&&!Y&&!Te&&0===e.button){const t=e.target;t.closest("[data-modal-panel]")===_e.current&&t.closest("button, input, a, select, textarea")&&!t.closest("[data-window-chrome]")&&(e.preventDefault(),e.stopPropagation(),Ve.current=!0,De(null),Pn(bt),window.addEventListener("mouseup",()=>{setTimeout(()=>{Ve.current=!1},0)},{once:!0}))}},onClickCapture:e=>{Ve.current&&(Ve.current=!1,e.preventDefault(),e.stopPropagation())},onMouseDown:e=>{if(At)return;De(null);e.target.closest("[data-modal-panel]")===_e.current&&(e.target.closest("button, input, a, select, textarea")||Pn(bt))},style:le?{zIndex:vt+1,top:0,left:0,right:0,bottom:"var(--mobile-bottom-nav, 56px)",width:"auto",height:"auto",transform:`translateX(${de}px)`,transition:he?"none":"transform 180ms ease-out",...Y?{display:"none"}:{},...vt<0?{display:"none"}:{},...kt||Te||be&&oe===be?{}:{display:"none"}}:{zIndex:Te?C.pinnedWindow:vt+1,width:en.w,height:en.h,top:en.y,...Y&&"right"===Ye?{right:window.innerWidth-en.x-en.w}:{left:en.x},...vt<0&&!Te?{display:"none"}:{},...Cn?{visibility:"hidden",pointerEvents:"none"}:{},...Tr??{}},children:[le&&!Y&&/* @__PURE__ */X("div",{onPointerDown:we,className:"absolute top-0 bottom-0 left-0 w-[22px] z-[5]",style:{touchAction:"pan-y"},"aria-hidden":"true"}),Y?null:pn?Pe?.home?null:/* @__PURE__ */U(_,{children:[
|
|
51
|
+
/* @__PURE__ */X("h2",{"data-window-title":!0,className:"sr-only",children:Jn.text||Me}),(Jn.accessories.length>0||Mr)&&/* @__PURE__ */U("div",{"data-window-chrome":"","data-record-bar":"",className:"flex h-9 shrink-0 select-none items-center gap-3 border-b border-gray-200 px-4",style:{backgroundColor:"rgb(var(--window-content-rgb))"},children:[
|
|
52
|
+
/* @__PURE__ */X("div",{className:"flex min-w-0 flex-1 items-center gap-2 overflow-hidden",children:Jn.accessories}),Mr&&/* @__PURE__ */U("span",{className:"flex items-center gap-1 shrink-0 text-[10px] text-gray-400",children:[
|
|
53
|
+
/* @__PURE__ */X("kbd",{className:"rounded border border-gray-300 bg-gray-100 px-1.5 py-0.5 font-medium text-gray-500",children:"K"}),
|
|
54
|
+
/* @__PURE__ */X("span",{children:Ce.prev}),
|
|
55
|
+
/* @__PURE__ */X("kbd",{className:"rounded border border-gray-300 bg-gray-100 px-1.5 py-0.5 font-medium ml-1 text-gray-500",children:"J"}),
|
|
56
|
+
/* @__PURE__ */X("span",{children:Ce.next})]})]})]}):le?null:
|
|
57
|
+
/* @__PURE__ */U("div",J?{onPointerDown:cr,"data-window-chrome":"",...yr,className:"flex items-center justify-between px-3 py-1.5 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(kt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:kt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
58
|
+
/* @__PURE__ */U("div",{"data-window-title":!0,title:Me,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-1.5",style:{color:kt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!At&&dt(),
|
|
59
|
+
/* @__PURE__ */X("span",{className:"truncate",children:At?Ot(xe):xe})]}),!At&&/* @__PURE__ */U("div",{className:"flex items-center gap-1 shrink-0 ml-2",children:[B&&/* @__PURE__ */X("button",{onClick:()=>ze(e=>!e),title:Te?Ce.unpin:Ce.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+(Te?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */X(L,{name:"bookmark-square",className:"h-3 w-3",fill:Te?"currentColor":"none",strokeWidth:1.5})}),
|
|
60
|
+
/* @__PURE__ */X("button",{type:"button",onClick:er,className:"rounded p-0.5 text-gray-400 hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */X(L,{name:"close",className:"h-4 w-4"})})]})]}:G?{onPointerDown:cr,"data-window-chrome":"",...yr,className:"flex items-center justify-between px-3 py-1.5 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(kt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:kt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
61
|
+
/* @__PURE__ */U("div",{"data-window-title":!0,title:Me,className:"text-sm font-medium min-w-0 flex-1 truncate flex items-center gap-1.5",style:{color:kt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!At&&dt(),
|
|
62
|
+
/* @__PURE__ */X("span",{className:"truncate",children:At?Ot(xe):xe})]}),!At&&/* @__PURE__ */U("div",{className:"flex items-center gap-0.5 shrink-0 ml-2",children:[B&&/* @__PURE__ */X("button",{onClick:()=>ze(e=>!e),title:Te?Ce.unpin:Ce.pinOnTop,className:"p-0.5 rounded hover:bg-gray-200 "+(Te?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */X(L,{name:"bookmark-square",className:"h-3 w-3",fill:Te?"currentColor":"none",strokeWidth:1.5})}),
|
|
63
|
+
/* @__PURE__ */X("button",{onClick:()=>Kn(bt),title:Ce.minimize,className:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",children:"─"}),!wn&&/* @__PURE__ */X(Qn,{maximized:Nn,onToggleMax:()=>{Nn?(Sn(!1),tn(_t())):xr()},onSnap:fr,buttonClassName:"text-gray-400 hover:text-gray-600 px-1 py-0.5 rounded hover:bg-gray-200 text-xs leading-none",strings:Ce}),
|
|
64
|
+
/* @__PURE__ */X("button",{type:"button",onClick:er,className:"rounded p-0.5 text-gray-400 hover:text-gray-600 hover:bg-gray-200",children:/* @__PURE__ */X(L,{name:"close",className:"h-4 w-4"})})]})]}:{onPointerDown:cr,"data-window-chrome":"",...yr,className:"flex items-center justify-between px-4 py-2.5 border-b border-gray-200 shrink-0 cursor-move select-none rounded-t-(--radius-window) focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 "+(kt?"backdrop-blur-sm":""),style:{touchAction:"none",backgroundColor:kt?"rgb(var(--window-header-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-header-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
65
|
+
/* @__PURE__ */U("div",{"data-window-title":!0,title:Me,className:"text-base font-medium min-w-0 flex-1 truncate flex items-center gap-2",style:{color:kt?"var(--window-title-active, rgb(17 24 39))":"var(--window-title-inactive, rgb(156 163 175))"},children:[!At&&dt(),
|
|
66
|
+
/* @__PURE__ */X("span",{className:"truncate",children:At?Ot(xe):xe})]}),!At&&/* @__PURE__ */U("div",{className:"flex items-center gap-1.5 shrink-0 ml-4",children:[Mr&&/* @__PURE__ */U("span",{className:"flex items-center gap-1 mr-1 text-[10px] text-gray-400",children:[
|
|
67
|
+
/* @__PURE__ */X("kbd",{className:"rounded border border-gray-300 bg-gray-200 px-1.5 py-0.5 font-medium text-gray-500",children:"K"}),
|
|
68
|
+
/* @__PURE__ */X("span",{children:Ce.prev}),
|
|
69
|
+
/* @__PURE__ */X("kbd",{className:"rounded border border-gray-300 bg-gray-200 px-1.5 py-0.5 font-medium ml-1 text-gray-500",children:"J"}),
|
|
70
|
+
/* @__PURE__ */X("span",{children:Ce.next})]}),B&&/* @__PURE__ */X("button",{onClick:()=>ze(e=>!e),title:Te?Ce.unpin:Ce.pinOnTop,className:"text-xs px-2 py-1 rounded hover:bg-gray-200 "+(Te?"text-blue-600":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */X(L,{name:"bookmark-square",className:"h-3.5 w-3.5",fill:Te?"currentColor":"none",strokeWidth:1.5})}),
|
|
71
|
+
/* @__PURE__ */X("button",{onClick:()=>Kn(bt),title:Ce.minimize,className:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",children:"─"}),!wn&&/* @__PURE__ */X(Qn,{maximized:Nn,onToggleMax:()=>{Nn?(Sn(!1),tn(_t())):xr()},onSnap:fr,buttonClassName:"text-gray-400 hover:text-gray-600 text-xs px-2 py-1 rounded hover:bg-gray-200",strings:Ce}),
|
|
72
|
+
/* @__PURE__ */X("kbd",{className:"rounded border border-gray-300 bg-gray-200 px-1.5 py-0.5 text-[10px] font-medium text-gray-400",children:"ESC"}),
|
|
73
|
+
/* @__PURE__ */X("button",{type:"button",onClick:er,className:"rounded-(--radius-control) text-gray-400 hover:text-gray-600",children:/* @__PURE__ */X(L,{name:"close",className:"h-5 w-5"})})]})]}),ae&&Re&&!Y&&!le&&/* @__PURE__ */X("div",{"aria-hidden":"true",className:"h-[3px] shrink-0 pointer-events-none",style:{backgroundColor:`rgb(var(--window-accent-rgb) / ${kt?.9:.55})`}}),
|
|
74
|
+
/* @__PURE__ */X(Dt.Provider,{value:bt,children:/* @__PURE__ */X(Yt.Provider,{value:{rightRef:Ge,leftRef:Ze,notify:()=>et(!0),active:kt,isDirty:Yn,footerOpen:nt&&!Y&&!J&&!G&&!le},children:/* @__PURE__ */X("div",{ref:Je,...Y?{onPointerDown:cr,onContextMenu:e=>{e.preventDefault(),He({x:e.clientX,y:e.clientY})}}:{},className:`flex-1 min-h-0 flex flex-col ${Y?"p-0 cursor-move":G||Z?"p-0":J?"p-2":"p-4"} ${Y||pn?"":"backdrop-blur-sm"} ${!1===E||G||Z?"overflow-hidden":"overflow-y-auto overscroll-contain"} ${Y?"rounded-2xl select-none":""}`,style:{...Y?{touchAction:"none"}:{},backgroundColor:Y?"transparent":pn?"rgb(var(--window-content-rgb))":kt?"rgb(var(--window-content-rgb) / var(--active-content-opacity, 0.9))":"rgb(var(--window-content-rgb) / var(--inactive-content-opacity, 0.8))"},children:/* @__PURE__ */X(ye,{children:se})})})}),Y&&Be&&/* @__PURE__ */U(v,{minWidth:160,style:{left:Be.x,top:Be.y},onClose:()=>He(null),children:[
|
|
75
|
+
/* @__PURE__ */X(x,{onClick:()=>{He(null),window.dispatchEvent(new CustomEvent("widget-open-settings",{detail:bt}))},children:"Settings"}),
|
|
76
|
+
/* @__PURE__ */X(k,{}),ne&&/* @__PURE__ */U(_,{children:[ne,
|
|
77
|
+
/* @__PURE__ */X(k,{})]}),
|
|
78
|
+
/* @__PURE__ */U(x,{onClick:()=>{He(null),ze(e=>!e)},children:[
|
|
79
|
+
/* @__PURE__ */X("span",{className:"flex-1",children:"Always on Top"}),Te&&/* @__PURE__ */X(L,{name:"check",className:"h-4 w-4 text-blue-600 shrink-0",strokeWidth:2})]}),
|
|
80
|
+
/* @__PURE__ */X(k,{}),
|
|
81
|
+
/* @__PURE__ */X(x,{onClick:()=>{He(null),er()},children:"Close"})]}),
|
|
82
|
+
/* @__PURE__ */U("div",{onPointerDown:cr,ref:tt,className:`px-4 py-2 border-t border-gray-200 shrink-0 flex items-center justify-between text-xs select-none${pn?"":" cursor-move"}${kt&&!pn?" backdrop-blur-sm":""}${Y||J||G||le||!nt?" hidden":""}`,style:{touchAction:"none",backgroundColor:pn?"rgb(var(--window-footer-rgb))":kt?"rgb(var(--window-footer-rgb) / var(--active-header-opacity, 0.8))":"rgb(var(--window-footer-rgb) / var(--inactive-header-opacity, 0.7))"},children:[
|
|
83
|
+
/* @__PURE__ */U("div",{className:"flex items-center gap-2 min-w-0",children:[st&&/* @__PURE__ */X(ve,{auto:!0}),R,
|
|
84
|
+
/* @__PURE__ */X("div",{ref:Ze,"data-modal-actions-left":!0,className:"flex items-center gap-2"}),g]}),
|
|
85
|
+
/* @__PURE__ */U("div",{className:"flex items-center gap-2 ml-auto",children:[
|
|
86
|
+
/* @__PURE__ */X("div",{ref:Ge,"data-modal-actions":!0,className:"flex items-center gap-2"}),A]})]}),!Y&&!le&&!At&&kt&&!wn&&/* @__PURE__ */U(_,{children:[
|
|
87
|
+
/* @__PURE__ */X("div",{onPointerDown:e=>dr(e,"se"),className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize z-10"}),
|
|
88
|
+
/* @__PURE__ */X("div",{onPointerDown:e=>dr(e,"sw"),className:"absolute bottom-0 left-0 w-3 h-3 cursor-nesw-resize z-10"}),
|
|
89
|
+
/* @__PURE__ */X("div",{onPointerDown:e=>dr(e,"ne"),className:"absolute top-0 right-0 w-3 h-3 cursor-nesw-resize z-10"}),
|
|
90
|
+
/* @__PURE__ */X("div",{onPointerDown:e=>dr(e,"nw"),className:"absolute top-0 left-0 w-3 h-3 cursor-nwse-resize z-10"}),
|
|
91
|
+
/* @__PURE__ */X("div",{onPointerDown:e=>dr(e,"n"),className:"absolute top-0 left-3 right-3 h-1 cursor-ns-resize"}),
|
|
92
|
+
/* @__PURE__ */X("div",{onPointerDown:e=>dr(e,"s"),className:"absolute bottom-0 left-3 right-3 h-1 cursor-ns-resize"}),
|
|
93
|
+
/* @__PURE__ */X("div",{onPointerDown:e=>dr(e,"e"),className:"absolute top-3 bottom-3 right-0 w-1 cursor-ew-resize"}),
|
|
94
|
+
/* @__PURE__ */X("div",{onPointerDown:e=>dr(e,"w"),className:"absolute top-3 bottom-3 left-0 w-1 cursor-ew-resize"})]}),At&&/* @__PURE__ */X("div",{className:"absolute inset-0",style:{zIndex:9999,cursor:"pointer",background:"transparent"},onMouseEnter:()=>Kt(!0),onMouseLeave:()=>Kt(!1),onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),Pn(bt),mr(!1)},onClick:e=>{e.stopPropagation(),e.preventDefault()},children:Pt&&/* @__PURE__ */X("button",{type:"button","data-expose-close":!0,"aria-label":Ee.taskbar.closeWindow,title:"Close",className:"absolute flex items-center justify-center rounded-full bg-black/55 text-white shadow-lg ring-1 ring-white/40 transition-colors hover:bg-red-500",style:{top:8,right:8,width:30,height:30,transform:`scale(${1/Lr})`,transformOrigin:"top right",zIndex:1e4},onMouseDown:e=>{e.stopPropagation(),e.preventDefault()},onClick:e=>{e.stopPropagation(),e.preventDefault(),er()},children:/* @__PURE__ */X(L,{name:"close",className:"h-4 w-4",strokeWidth:2.2})})})]}),At&&Sr&&/* @__PURE__ */X("div",{className:"fixed pointer-events-none select-none truncate text-center",style:{left:Sr.x,top:Sr.y+Sr.h+4,width:Sr.w,zIndex:C.expose+(Pt?21:11),color:"white",fontSize:12,fontWeight:500,textShadow:"0 1px 2px rgba(0,0,0,0.6)"},children:Ot(xe)})]}),Ar=Ae&&/* @__PURE__ */U(v,{style:{left:Ae.x,top:Ae.y},onClose:()=>De(null),minWidth:160,children:[!Y&&!J&&!pn&&/* @__PURE__ */U(_,{children:[
|
|
95
|
+
/* @__PURE__ */U(x,{onClick:()=>{Kn(bt),De(null)},children:[
|
|
96
|
+
/* @__PURE__ */X(L,{name:"remove",className:"h-4 w-4 text-gray-400",strokeWidth:1.5}),Ce.minimize]}),!wn&&/* @__PURE__ */U(x,Nn?{onClick:()=>{Sn(!1),tn(_t()),De(null)},children:[
|
|
97
|
+
/* @__PURE__ */X("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */X("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 4.5v15m6-15v15M4.5 9h15M4.5 15h15"})}),Ce.windowed]}:{onClick:()=>{xr(),De(null)},children:[
|
|
98
|
+
/* @__PURE__ */X(L,{name:"expand",className:"h-4 w-4 text-gray-400",strokeWidth:1.5}),Ce.maximize]})]}),B&&!pn&&/* @__PURE__ */U(x,{onClick:()=>{ze(e=>!e),De(null)},children:[
|
|
99
|
+
/* @__PURE__ */X(L,{name:"bookmark-square",className:"h-4 w-4 "+(Te?"text-blue-600":"text-gray-400"),fill:Te?"currentColor":"none",strokeWidth:1.5}),Te?Ce.unpin:Ce.pinOnTop]}),Ie&&/* @__PURE__ */U(x,{onClick:()=>{De(null),je()},children:[
|
|
100
|
+
/* @__PURE__ */X(L,{name:"star",className:"h-4 w-4 "+(qe?"text-yellow-500":"text-gray-400"),fill:qe?"currentColor":"none",strokeWidth:1.5}),qe?Ee.taskbar.removeFromDesktop:Ee.taskbar.addToDesktop]}),(qt[bt]||[]).length>0&&/* @__PURE__ */X(_,{children:(qt[bt]||[]).map((e,t)=>/* @__PURE__ */U(x,{onClick:()=>{De(null),e.onClick()},children:[e.icon,e.label]},t))}),!(pn&&Pe?.home)&&/* @__PURE__ */U(_,{children:[
|
|
101
|
+
/* @__PURE__ */X(k,{}),
|
|
102
|
+
/* @__PURE__ */U(x,{danger:!0,onClick:()=>{De(null),er()},children:[
|
|
103
|
+
/* @__PURE__ */X(L,{name:"close",className:"h-4 w-4"}),Ce.close]})]})]}),Dr=!!oe&>.some(e=>e.id===oe),Ir=!Ct||Dr||Y?null:/* @__PURE__ */U("div",{"data-modal-restore-tab":!0,"data-modal-id":bt,className:"fixed left-1/2 z-(--z-restore-tab) flex -translate-x-1/2 items-center gap-1 rounded-lg border border-gray-300 bg-white px-1.5 py-1 shadow-lg",style:{bottom:"calc(var(--taskbar-height, 0px) + 12px)"},children:[
|
|
104
|
+
/* @__PURE__ */X("button",{type:"button",onClick:()=>Pn(bt),title:Ce.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:Me||Ce.windowSuffix}),
|
|
105
|
+
/* @__PURE__ */X("button",{type:"button",onClick:()=>Pn(bt),title:Ce.restore,"aria-label":Ce.restore,className:"rounded px-1.5 py-0.5 text-xs leading-none text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:"▴"}),
|
|
106
|
+
/* @__PURE__ */X("button",{type:"button",onClick:()=>{er()},title:Ce.close,"aria-label":Ce.close,className:"rounded px-1.5 py-0.5 text-xs leading-none text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:"✕"})]});return V(
|
|
107
|
+
/* @__PURE__ */U(It.Provider,{value:null,children:[zr,Ar,Ir]}),document.body)}"undefined"!=typeof window&&window.addEventListener("keydown",e=>{cr&&"Escape"===e.key&&(Mr(null),mr(!1))});var zr=100,Ar={past:[],future:[]};function Dr(e,t){switch(t.type){case"record":{const n=e.past[e.past.length-1];if(null!==t.step.coalesceKey&&n?.coalesceKey===t.step.coalesceKey)return 0===e.future.length?e:{...e,future:[]};const r=[...e.past,t.step];return{past:r.length>zr?r.slice(r.length-zr):r,future:[]}}case"undo":return 0===e.past.length?e:{past:e.past.slice(0,-1),future:[t.redoStep,...e.future]};case"redo":return 0===e.future.length?e:{past:[...e.past,t.undoStep],future:e.future.slice(1)};case"clear":return 0===e.past.length&&0===e.future.length?e:Ar}}var Ir=/* @__PURE__ */new Set(["INPUT","TEXTAREA","SELECT"]);var Pr=500,Kr=250;function $r({children:e,canEdit:t=!0,perms:n,windowId:r}){const[o,a]=B(Dr,Ar),s=I(/* @__PURE__ */new Map),[l,c]=K(0),d=l>0,[u,h]=K(0),[m,p]=K(0),f=m>0,{hasAnyPerm:w}=i(),y=t&&0===u&&(!(n&&n.length>0)||w(n)),g=I(null),b=I(!1),v=W(()=>{const e={};for(const[t,n]of s.current)e[t]=n.getLast();return e},[]),x=W((e,t)=>{s.current.has(e)||c(e=>e+1),s.current.set(e,t)},[]),k=W(e=>{s.current.delete(e)&&c(e=>e-1)},[]),E=W(e=>{h(t=>t+(e?1:-1))},[]),C=W(e=>{p(t=>t+(e?1:-1))},[]),[M,N]=K(0),S=M>0,L=W(e=>{N(t=>t+(e?1:-1))},[]),T=z(ge),A=T?.claimReadOnly;P(()=>{if(A&&!y)return A(!0),()=>A(!1)},[A,y]);const D=T?.claimOwnMount;P(()=>{if(D&&S)return D(!0),()=>D(!1)},[D,S]);const $=I({last:0,count:0,tripped:!1}),O=I(!1),R=W((e,t,n)=>{if(b.current)return void(n&&function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(Array.isArray(e)!==Array.isArray(t))return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}(n.prev,n.next)||(O.current=!0));if(!y||g.current)return;const r=$.current;if(r.tripped)return;const o=Date.now();if(o-r.last>Kr&&(r.count=0),r.last=o,++r.count>Pr)return r.tripped=!0,void console.error(`[efficient-shell] UndoProvider: "${e}" recorded ${Pr} undo steps with no pause between them, which no user action can do. The value passed to useUndoable for this slice is almost certainly rebuilt on every render (a .map/.filter/object literal in the call) rather than held in state, so it reads as changed every time — and since recording a step re-renders the form, that is a loop. Undo recording is now off for this form to keep the tab responsive.`);g.current={values:v(),label:e,coalesceKey:t},queueMicrotask(()=>{const e=g.current;g.current=null,e&&a({type:"record",step:e})})},[y,v]),F=W(e=>{for(const[t,n]of Object.entries(e)){const e=s.current.get(t);e&&(e.setLast(n),e.apply(n))}},[]),q=W(()=>{const e=o.past[o.past.length-1];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};F(e.values),a({type:"undo",redoStep:t})},[o.past,v,F]),H=W(()=>{const e=o.future[0];if(!e)return;const t={values:v(),label:e.label,coalesceKey:null};F(e.values),a({type:"redo",undoStep:t})},[o.future,v,F]),[Y,_]=K(0),V=I(0),J=I(0),G=I(!1),Z=W(()=>{b.current=!0,O.current=!1,g.current=null,V.current+=1,J.current=V.current,_(V.current)},[]),Q=I(void 0),ee=W(e=>{void 0!==e&&(void 0!==Q.current&&e!==Q.current&&(G.current=!0),Q.current=e),Z()},[Z]);P(()=>{b.current&&Y===J.current&&(b.current=!1,g.current=null,(O.current||G.current)&&a({type:"clear"}),O.current=!1,G.current=!1)},[Y]);const te=W(()=>{G.current=!0,a({type:"clear"}),Z()},[Z]),ne=y&&o.past.length>0,re=y&&o.future.length>0,oe=lr(r),ie=I({undo:q,redo:H,canUndo:ne,canRedo:re});ie.current={undo:q,redo:H,canUndo:ne,canRedo:re},P(()=>{if(!oe||!y)return;const e=e=>{const t=function(e){if(!e.metaKey&&!e.ctrlKey||e.altKey)return null;const t=e.key.toLowerCase(),n="z"===t?e.shiftKey?"redo":"undo":"y"!==t||!e.ctrlKey||e.metaKey||e.shiftKey?null:"redo";if(!n)return null;const r=e.target;return r?.isContentEditable||r?.tagName&&Ir.has(r.tagName.toUpperCase())?null:n}(e);if(!t)return;const n=ie.current;("undo"===t?n.canUndo:n.canRedo)&&(e.preventDefault(),"undo"===t?n.undo():n.redo())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[oe,y]);const ae=j(()=>({register:x,unregister:k,record:R,undo:q,redo:H,clear:te,baseline:ee,canUndo:ne,canRedo:re,enabled:y,hasState:d,handMounted:S,claimOwnMount:L,claimReadOnly:E,declaredEditable:f,claimEditable:C,undoLabel:ne?o.past[o.past.length-1].label:null,redoLabel:re?o.future[0].label:null}),[x,k,R,q,H,te,ee,ne,re,y,d,S,L,E,f,C,o.past,o.future]),se=""!==Ut(),le=z(Yt)?.footerOpen??!1,ce=se&&y&&d&&!S&≤/* @__PURE__ */
|
|
108
|
+
return U(ge.Provider,{value:ae,children:[ce&&/* @__PURE__ */X(_t,{position:"left",quiet:!0,children:/* @__PURE__ */X(ve,{auto:!0})}),e]})}function Wr(){const e=z(ge),t=W(()=>{},[]);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 Or(e){const t=z(ge),n=t?.claimReadOnly,r=t?.claimEditable;P(()=>{const t=e?r:n;if(t)return t(!0),()=>t(!1)},[n,r,e])}function Rr(e,t,n){const r=z(ge),o=H(),i=I(e),a=I(t);a.current=t,P(()=>{if(r)return r.register(o,{getLast:()=>i.current,setLast:e=>{i.current=e},apply:e=>a.current(e)}),()=>r.unregister(o)},[r,o]);const{label:s,coalesceKey:l=null}=n,c=I(r);c.current=r;const d=I({label:s,coalesceKey:l});d.current={label:s,coalesceKey:l},P(()=>{const t=c.current;t&&(Object.is(e,i.current)||(t.record(d.current.label,d.current.coalesceKey,{prev:i.current,next:e}),i.current=e))},[e])}function Fr(e,t){const[n,r]=K(e);return Rr(n,e=>r(()=>e),t),[n,r]}export{Vt as CancelButton,qe as DocFavStar,Te as EntityWindowFallback,Se as EntityWindowLoading,ze as EntityWindowState,Wt as KEY_ACTIVATED_SELECTOR,Me as LoadingSpinner,$t as MODAL_SUBMIT_SELECTOR,Tr as Modal,_t as ModalActions,ve as UndoControls,$r as UndoProvider,re as WINDOW_REGISTRY,we as WindowCrashedFallback,ye as WindowErrorBoundary,lt as WindowManagerProvider,Bt as WindowTitle,Ue as activateWindowById,bt as beginWindowGesture,zn as cancelWindowFront,le as client_default,Nr as commitExposeHighlight,vt as drainPerfEvents,fr as exitExposeMode,ln as forgetMaximizedWindowBoxes,ir as getActiveModalId,Je as getActiveWindowRoute,Cr as getExposeHighlight,At as getWindowChromeVersion,an as getWindowPosition,De as isDraftEntityId,Ie as isDraftEntityWindow,ee as isEntityEntry,Q as isPageEntry,ae as isShellApiClientConfigured,Xe as isTabWindow,gt as markMenuOpen,Tt as readWindowChrome,Tn as requestWindowFront,Mr as setExposeHighlight,yt as setPerfCollecting,ie as setShellApiClient,me as setShellHomeRoute,ne as setShellWindowRegistry,on as setWindowDefaultPosition,sn as setWindowPosition,Et as splitTitle,Er as subscribeExposeHighlight,zt as subscribeWindowChrome,pr as toggleExposeMode,Mn as useCurrentTabKey,Ut as useEnclosingModalId,lr as useIsActiveWindow,Xt as useModalActive,de as usePageSearch,Wr as useUndo,Or as useUndoCanEdit,Rr as useUndoable,Fr as useUndoableState,Ft as useWidgetSettings,$e as useWindowDirty,Oe as useWindowManager,jt as useWindowMenuItem,Ht as useWindowTitle};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{VERSION as e}from"./chunk-SBF5A6XV.js";import{setBoundaryErrorReporter as t}from"./chunk-KNUR2UEG.js";var n=-1,i=()=>n,a=e=>{addEventListener("pageshow",t=>{t.persisted&&(n=t.timeStamp,e(t))},!0)},r=(e,t,n,i)=>{let a,r;return o=>{var s,c;t.value>=0&&(o||i)&&(r=t.value-(a??0),(r||void 0===a)&&(a=t.value,t.delta=r,t.rating=(s=t.value)>(c=n)[1]?"poor":s>c[0]?"needs-improvement":"good",e(t)))}},o=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},s=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},c=()=>s()?.activationStart??0,d=-1,l=/* @__PURE__ */new Set,u=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,f=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of l)e();isFinite(d)||(d="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",f,!0))}},h=(e=!1)=>{if(e&&(d=1/0),d<0){const e=c(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;d=t??u(),addEventListener("visibilitychange",f,!0),addEventListener("prerenderingchange",f,!0),a(()=>{setTimeout(()=>{d=u()})})}return{get firstHiddenTime(){return d},onHidden(e){l.add(e)}}},g=(e,t=-1,n,a=0,r,o,d)=>{const l=s(),u=l?.navigationId||0;let f="navigate";return n?f=n:i()>=0?f="back-forward-cache":l&&(document.prerendering||c()>0?f="prerender":document.wasDiscarded?f="restore":l.type&&(f=l.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:f,navigationId:a||u,navigationInteractionId:r,navigationURL:o||l?.name,navigationStartTime:d||0}},v=/* @__PURE__ */new WeakMap;function p(e,t){let n=v.get(t);return n||(n=/* @__PURE__ */new WeakMap,v.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}var m,y=class{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},T=(e,t,n={})=>{try{const i=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(i.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const n=e.getEntries();i.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(const t of i)e.observe({type:t,buffered:!0,...n});return e}}catch{}},w=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,I=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},b=e=>{let t=!1;return()=>{t||(e(),t=!0)}},E=class{l},C=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},L=[1800,3e3],P=(e,t={})=>{const n=w(t);C(()=>{const s=p(t,E),d=h();let l,u=g("FCP");const f=T(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(f.disconnect(),t.startTime<d.firstHiddenTime&&(u.value=Math.max(t.startTime-c(),0),u.entries.push(t),u.navigationId=t.navigationId||u.navigationId,l(!0)))});f&&(l=r(e,u,L,t.reportAllChanges),a(n=>{u=g("FCP",-1,"back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),l=r(e,u,L,t.reportAllChanges),o(()=>{u.value=performance.now()-n.timeStamp,l(!0)})})),n&&T(["soft-navigation"],n=>{n.forEach(n=>{s.l&&n.navigationId&&I(s.l,n);const i=Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0);u=g("FCP",i,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),l=r(e,u,L,t.reportAllChanges),l(!0)})},t)})},A=[.1,.25],k=0,S=1/0,z=0,M=e=>{for(const t of e)t.interactionId&&(S=Math.min(S,t.interactionId),z=Math.max(z,t.interactionId),k=z?(z-S)/7+1:0)},$=()=>m?k:performance.interactionCount??0,_=class{u=0;v=[];m=/* @__PURE__ */new Map;p;T;_(){return $()-this.u}M(){this.u=$(),this.v.length=0,this.m.clear()}L(e){const t=this._(),n=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==n||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[n]:{P:8,id:-1,entries:[]}}h(e){if(this.p?.(e),!e.interactionId)return;const t=this.v.at(-1);let n=this.m.get(e.interactionId);if(n||this.v.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}this.T?.(n)}}},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();C(()=>{"interactionCount"in performance||m||(m=T(["event"],M,{durationThreshold:0}));let o,s=g("INP");const c=p(t,_),d=(n,i,a,d,l)=>{c.M(),s=g("INP",-1,n,i,a,d,l),o=r(e,s,Z,t.reportAllChanges)},l=()=>{const e=c.L(s.navigationType);e&&e.P!==s.value&&(s.value=e.P,s.entries=e.entries,o())},u=e=>{l(),o(!0),d("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},f=(e,t=!1)=>{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())}))})},x=class{p;l;h(e){this.p?.(e)}},B=[2500,4e3],j=[800,1800],N=e=>{document.prerendering?C(()=>N(e)):"complete"!==document.readyState?addEventListener("load",()=>N(e),!0):setTimeout(e)};var U=/^[A-Za-z0-9/_:.\-[\]{}*@~]+$/,O=/^[A-Za-z_$][A-Za-z0-9_$.]*$/,H=/^[A-Za-z0-9][A-Za-z0-9.+_-]*$/;var q=class{constructor(e){this.head=e}head;events=[];waiting=/* @__PURE__ */new Map;seen=/* @__PURE__ */new Set;get size(){return this.events.length}addVital(e){this.events.push(e)}addError(e){const t=function(e){return e.frames.length?`${e.name}|${e.frames.join("|")}`:`${e.name}|${e.message.replace(/\d/g,"0")}`}(e),n=this.waiting.get(t);return n?(n.count=Math.min(1e3,n.count+e.count),!0):!(this.seen.has(t)||this.seen.size>=20)&&(this.seen.add(t),this.waiting.set(t,e),this.events.push(e),!0)}drain(){const e=this.events;this.events=[],this.waiting.clear();const t=[],n=JSON.stringify({...this.head,events:[]}).length;let i=[],a=n;for(const r of e){const e=JSON.stringify(r).length+1;n+e>30720||((50===i.length||a+e>30720)&&(t.push({...this.head,events:i}),i=[],a=n),i.push(r),a+=e)}return i.length&&t.push({...this.head,events:i}),t}},J=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,K=/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*)?|\b[Bb]earer\s+[A-Za-z0-9._~+/=-]{8,}/g,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,Q=/(?:\(|@|\bat\s+)?((?:[a-z][a-z0-9+.-]*:\/\/|\/)[^\s()@]*?):(\d+):(\d+)\)?\s*$/i;function Y(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=Q.exec(n.trim()),i=e&&Y(e[1],e[2],e[3]);if(i&&t.push(i),5===t.length)break}return t}function te(e){const t=e instanceof Error?e.name:void 0;return"string"==typeof t&&t.length<=64&&O.test(t)?t:"Error"}function ne(e){if("string"!=typeof e)return"unknown";const t=e.trim().replace(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=t.getAccessToken();i&&n(t.endpoint??"/api/client-telemetry/web-batches/",{method:"POST",keepalive:!0,credentials:"same-origin",headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`},body:JSON.stringify(e)}).catch(e=>{console.debug("[efficient-shell] client telemetry batch dropped:",e)})}function se(n){if(ae?.stop(),ae=null,!1===n.enabled||"undefined"==typeof window||"undefined"==typeof document)return ie;if(!function(e){const t="string"==typeof e.app&&H.test(e.app),n="string"==typeof e.release&&H.test(e.release);return t&&n||console.warn("[efficient-shell] client telemetry not started: `app` and `release` must be version-like strings."),t&&n}(n))return ie;const d=n.fetch??window.fetch.bind(window),l=new q({app:n.app,release:n.release,shell_version:H.test(e)?e:""}),u=ne(n.routeKey()),f=function(e=("undefined"==typeof window?void 0:window)){if(!e)return"desktop";const t="function"==typeof e.matchMedia&&e.matchMedia("(pointer: coarse)").matches,n=e.innerWidth;return n<600?"mobile":t&&n<1280?"tablet":"desktop"}(window);let v=!1;const m=()=>{for(const e of l.drain())oe(e,n,d)},E=e=>{v||(l.addError(e),l.size>=50&&m())},L=(e,t)=>{return{type:"error",source:t,name:te(e),message:(a=e,i=a instanceof Error?a.message:"string"==typeof a?a:a&&"object"==typeof a&&"string"==typeof a.message?a.message:"",i.slice(0,640).replace(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},k=e=>{v||(l.addVital(function(e,t,n,i){return{type:"vital",name:e.name,value:e.value,route:re.has(e.name)?t:n(),navigation:e.navigationType??"navigate",device:i}}(e,u,()=>ne(n.routeKey()),f)),l.size>=50&&m())},S=n.vitalsSampleRate??1;S>0&&(S>=1||(n.random??Math.random)()<S)&&(((e,t={})=>{let n=!1;const s=w(t);C(()=>{let d,l=h(),u=g("LCP");const f=p(t,x),v=(i,a,o,s,c)=>{u=g("LCP",-1,i,a,o,s,c),d=r(e,u,B,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,B,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,B,t.reportAllChanges),o(()=>{u.value=performance.now()-a.timeStamp,n=!0,d(!0)})})}})})(k),R(k),((e,t={})=>{const n=h();P(b(()=>{let s,c=g("CLS",0);const d=p(t,y),l=(n,i,a,o,l)=>{c=g("CLS",0,n,i,a,o,l),d.i=0,s=r(e,c,A,t.reportAllChanges)},u=(e=!1)=>{d.i>c.value&&(c.value=d.i,c.entries=d.o),s(e)},f=e=>{u(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},h=e=>{for(const t of e)"soft-navigation"!==t.entryType?d.h(t):f(t);u()},v=["layout-shift"];w(t)&&v.push("soft-navigation");const m=T(v,h);m&&(s=r(e,c,A,t.reportAllChanges),n.onHidden(()=>{h(m.takeRecords()),s(!0)}),a(()=>{l("back-forward-cache",c.navigationId,c.navigationInteractionId,c.navigationURL,i()),o(s)}),setTimeout(s))}))})(k),P(k),((e,t={})=>{const n=w(t);let o=g("TTFB"),d=r(e,o,j,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,j,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,j,t.reportAllChanges),d(!0))})},t)}})})(k));const z=e=>{const{error:t,message:n,filename:i,lineno:a,colno:r}=e;if(null!=t)return void E(L(t,"onerror"));const o=i?ee(`at ${i}:${a??0}:${r??0}`):[];E({...L(n??"","onerror"),frames:o})},M=e=>E(L(e.reason,"unhandledrejection")),$=()=>{"hidden"===document.visibilityState&&m()};window.addEventListener("error",z),window.addEventListener("unhandledrejection",M),document.addEventListener("visibilitychange",$),window.addEventListener("pagehide",m);const _=window.setInterval(m,n.flushIntervalMs??6e4),Z=t(e=>E(L(e,"boundary"))),U={flush:m,reportError:e=>E(L(e,"boundary")),stop(){v||(m(),v=!0,window.removeEventListener("error",z),window.removeEventListener("unhandledrejection",M),document.removeEventListener("visibilitychange",$),window.removeEventListener("pagehide",m),window.clearInterval(_),Z(),ae===U&&(ae=null))}};return ae=U,U}export{se as startClientTelemetry};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{solidSurfaceStyle as t}from"./chunk-7IQ3B77H.js";import{registerModalEscapeInterceptor as e,escapeSurfaceAbove as o,onOverlayOpen as i,Z_LAYERS as r}from"./chunk-FIEA5CGB.js";import{useBrowserLayoutEffect as n}from"./chunk-D65T4H6J.js";import{forwardRef as a,useId as l,useState as s,useRef as h,useEffect as c,isValidElement as d,cloneElement as m}from"react";import{createPortal as u}from"react-dom";import{jsxs as f,jsx as g,Fragment as p}from"react/jsx-runtime";var b="aria-disabled:cursor-not-allowed aria-disabled:opacity-60",x="inline-flex items-center justify-center rounded-(--radius-control) font-medium transition-colors rosh-focus-ring focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-60 "+b,w={primary:"bg-blue-600 text-white shadow-sm hover:bg-blue-700 focus-visible:ring-[color:var(--rosh-focus-ring-strong)]",secondary:"border border-gray-300 bg-white text-gray-700 shadow-sm hover:bg-gray-50 focus-visible:ring-[color:var(--rosh-focus-ring)]","secondary-danger":"border border-red-300 bg-white text-red-600 shadow-sm hover:bg-red-50 focus-visible:ring-[color:var(--rosh-focus-ring-invalid)]",ghost:"text-gray-700 hover:bg-gray-100 focus-visible:ring-[color:var(--rosh-focus-ring)]","ghost-danger":"text-red-600 hover:bg-red-50 focus-visible:ring-[color:var(--rosh-focus-ring-invalid)]",danger:"bg-red-600 text-white shadow-sm hover:bg-red-700 focus-visible:ring-[color:var(--rosh-focus-ring-invalid-strong)]",link:"text-blue-600 underline-offset-4 hover:underline focus-visible:ring-[color:var(--rosh-focus-ring)]"},v={sm:"gap-1 px-2.5 py-1 text-xs",md:"gap-1.5 px-3 py-1.5 text-sm",lg:"gap-2 px-4 py-2.5 text-sm","touch-sm":"gap-1.5 h-11 px-4 text-base",touch:"gap-2 h-14 px-5 text-base","touch-lg":"gap-2 h-16 px-6 text-lg","touch-xl":"gap-3 h-20 px-8 text-2xl"},y="inline-flex items-center font-medium transition-colors rosh-focus-ring focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-60 "+b,M={sm:"gap-1 text-xs",md:"gap-1.5 text-sm",lg:"gap-2 text-sm","touch-sm":"gap-1.5 text-base",touch:"gap-2 text-base","touch-lg":"gap-2 text-lg","touch-xl":"gap-3 text-2xl"},N={sm:"h-6 w-6",md:"h-8 w-8",lg:"h-10 w-10","touch-sm":"h-11 w-11",touch:"h-14 w-14","touch-lg":"h-16 w-16","touch-xl":"h-20 w-20"};function W({variant:t="primary",size:e="md",block:o=!1,className:i=""}={}){const r="link"===t;return[r?y:x,w[t],r?M[e]:v[e],o?"w-full":"",i].filter(Boolean).join(" ")}function k({variant:t="ghost",size:e="md",pressed:o=!1,className:i=""}={}){const r=!o||"ghost"!==t&&"secondary"!==t?w[t]:"bg-blue-50 text-blue-700 hover:bg-blue-100 focus-visible:ring-[color:var(--rosh-focus-ring)]";return[x,r,N[e],"shrink-0 p-0",i].filter(Boolean).join(" ")}var B=448,C=240,H=8,E=()=>({left:0,right:window.innerWidth,top:0,bottom:window.innerHeight});function j(t){const e=E(),o=t?.closest?.("[data-modal-panel]");if(!o)return e;const i=o.getBoundingClientRect();return i.width<=0||i.height<=0?e:{left:Math.max(e.left,i.left),right:Math.min(e.right,i.right),top:Math.max(e.top,i.top),bottom:Math.min(e.bottom,i.bottom)}}var z=/* @__PURE__ */new Set(["hidden","clip","auto","scroll"]);var R={top:"bottom",bottom:"top",left:"right",right:"left"},T={top:["right","left"],bottom:["right","left"],left:["top","bottom"],right:["top","bottom"]};function F(t,e,o){return{top:t.top-o-(e.top+8),bottom:e.bottom-8-(t.bottom+o),left:t.left-o-(e.left+8),right:e.right-8-(t.right+o)}}var I=(t,e,o)=>Math.max(e,Math.min(t,o));function L(t,e,o){let i=NaN,r=NaN,n=NaN,a=NaN,l=NaN;const s=()=>{const e=t()?.getBoundingClientRect();if(!e)return!1;const s=o?o():NaN,h=e.left!==i||e.top!==r||e.right!==n||e.bottom!==a||s!==l&&!(Number.isNaN(s)&&Number.isNaN(l));return i=e.left,r=e.top,n=e.right,a=e.bottom,l=s,h};s();const h=()=>{s(),e()};let c=requestAnimationFrame(function t(){s()&&e(),c=requestAnimationFrame(t)});return window.addEventListener("scroll",h,!0),window.addEventListener("resize",h),()=>{cancelAnimationFrame(c),window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h)}}function A({trigger:t,menu:e,bounds:o,align:i,side:r}){const n=F(t,o,4),a="bottom"===r?"top":"bottom",l=e.height>n[r]&&(e.height<=n[a]||n[a]>n[r])?a:r,s=Math.max(Math.min(e.height,96),n[l]),h=Math.min(e.height,s),c=I("bottom"===l?t.bottom+4:t.top-4-h,o.top+8,o.bottom-8-h),d=Math.max(0,o.right-o.left-16),m=Math.min(e.width,d);return{left:I("start"===i?t.left:t.right-m,o.left+8,o.right-8-m),top:c,side:l,maxHeight:s,maxWidth:d}}function D(t,e,o={}){const{matchTriggerWidth:i=!1,preferredMaxWidth:r=B,preferredMaxHeight:a=C,popupRef:l}=o,[h,c]=s(null);return n(()=>{if(!e)return void c(null);const o=()=>{const e=t.current,o=e?.getBoundingClientRect();if(!o)return;const n=j(e),s=n.bottom-o.bottom-4-8,h=o.top-n.top-4-8,d=s<Math.min(a,160)&&h>s,m=Math.max(96,Math.min(a,d?h:s)),u=Math.max(0,n.right-n.left-16),f={minWidth:o.width,maxWidth:Math.min(r,u),maxHeight:m};if(i){const t=Math.min(o.width,u);f.width=t,f.maxWidth=t,f.left=Math.min(Math.max(n.left+8,o.left),n.right-8-t)}else if(l&&n.right-8-o.left<f.maxWidth&&Math.min(o.right,n.right-8)-n.left-8<f.maxWidth){const t=l.current?.offsetWidth??0,e=t>0?Math.min(t,f.maxWidth):f.maxWidth;f.left=Math.max(n.left+8,Math.min(o.left,n.right-8-e))}else if(n.right-8-o.left<f.maxWidth){const t=Math.min(o.right,n.right-8);f.right=window.innerWidth-t,f.maxWidth=Math.min(f.maxWidth,Math.max(0,t-n.left-8))}else f.left=Math.max(n.left+8,o.left);d?f.bottom=window.innerHeight-o.top+4:f.top=o.bottom+4,c(f)};return o(),L(()=>t.current,o,l?()=>l.current?.offsetWidth??NaN:void 0)},[e,t,i,r,a,l]),h}function S({point:t,menu:e,bounds:o}){const i={left:t.x,right:t.x,top:t.y,bottom:t.y},r=o.right-8-t.x,n=t.x-(o.left+8);return A({trigger:i,menu:e,bounds:o,align:e.width<=r||r>=n?"start":"end",side:"bottom"})}var $={top:"bottom-full left-1/2 -translate-x-1/2 mb-3",bottom:"top-full left-1/2 -translate-x-1/2 mt-3",left:"right-full top-1/2 -translate-y-1/2 mr-3",right:"left-full top-1/2 -translate-y-1/2 ml-3"};function q({content:a,side:p="top",delay:b=200,children:x,className:w="relative inline-flex",describe:v=!0}){const[y,M]=s(!1),N=y&&!(null==a||!1===a||""===a),[W,k]=s(null),B=h(void 0),C=h(null),H=h(null),A=l(),D=h(!1),S=()=>{window.clearTimeout(B.current),D.current||(B.current=window.setTimeout(()=>M(!0),b))},q=()=>{window.clearTimeout(B.current),M(!1)},P=()=>{D.current=!0,q()},G=()=>{D.current=!1,q()};c(()=>()=>window.clearTimeout(B.current),[]),n(()=>{if(!N)return void k(null);const t=()=>{const t=C.current,e=H.current;if(!t||!e)return;const o=j(t),i=Math.max(0,o.right-o.left-16),r=Math.max(0,o.bottom-o.top-16);e.style.maxWidth=`${i}px`,e.style.maxHeight=`${r}px`;const n=e.getBoundingClientRect();if(n.width<=0||n.height<=0)return;const a=t.getBoundingClientRect();if(!function(t){const e=t.getBoundingClientRect();if(e.width<=0&&e.height<=0&&0===e.left&&0===e.top)return null;const o=E(),i={left:Math.max(o.left,e.left),right:Math.min(o.right,e.right),top:Math.max(o.top,e.top),bottom:Math.min(o.bottom,e.bottom)};let r=getComputedStyle(t).position;for(let e=t.parentElement;e&&e!==document.documentElement&&"fixed"!==r;e=e.parentElement){const t=getComputedStyle(e);if("absolute"===r&&"static"===t.position)continue;r=t.position;const o=z.has(t.overflowX),n=z.has(t.overflowY);if(!o&&!n)continue;const a=e.getBoundingClientRect();a.width<=0&&a.height<=0||(o&&(i.left=Math.max(i.left,a.left),i.right=Math.min(i.right,a.right)),n&&(i.top=Math.max(i.top,a.top),i.bottom=Math.min(i.bottom,a.bottom)))}return i.right>=i.left&&i.bottom>=i.top?i:null}(t))return void q();const l=function(t,e,o,i,r){const n=F(t,i,r),a=t=>n[t]-("top"===t||"bottom"===t?e.height:e.width),l=[o,R[o],...T[o]],s=l.find(t=>a(t)>=0)??l.reduce((t,e)=>a(e)>a(t)?e:t),h=(t.left+t.right)/2,c=(t.top+t.bottom)/2;let d,m;switch(s){case"top":d=h-e.width/2,m=t.top-r-e.height;break;case"bottom":d=h-e.width/2,m=t.bottom+r;break;case"left":d=t.left-r-e.width,m=c-e.height/2;break;case"right":d=t.right+r,m=c-e.height/2}return{side:s,left:I(d,i.left+8,i.right-8-e.width),top:I(m,i.top+8,i.bottom-8-e.height)}}(a,n,p,o,12),s=function(t,e,o,i,r){const{side:n,left:a,top:l}=e,s=a+o.width,h=l+o.height;if({top:t.top-h,bottom:l-t.bottom,left:t.left-s,right:a-t.right}[n]<r)return null;const c=(t,e,o)=>o<2*i?e+o/2:Math.max(e+i,Math.min(t,e+o-i)),d=(t.left+t.right)/2,m=(t.top+t.bottom)/2;switch(n){case"top":return{side:n,x:c(d,a,o.width),y:h};case"bottom":return{side:n,x:c(d,a,o.width),y:l};case"left":return{side:n,x:s,y:c(m,l,o.height)};case"right":return{side:n,x:a,y:c(m,l,o.height)}}}(a,l,n,16,6),h={anchor:{left:a.left,top:a.top,width:a.width,height:a.height},left:l.left-a.left,top:l.top-a.top,maxWidth:i,maxHeight:r,side:l.side,arrow:s&&{left:s.x-a.left,top:s.y-a.top}};k(t=>{return t&&(o=h,(e=t).anchor.left===o.anchor.left&&e.anchor.top===o.anchor.top&&e.anchor.width===o.anchor.width&&e.anchor.height===o.anchor.height&&e.left===o.left&&e.top===o.top&&e.maxWidth===o.maxWidth&&e.maxHeight===o.maxHeight&&e.side===o.side&&e.arrow?.left===o.arrow?.left&&e.arrow?.top===o.arrow?.top)?t:h;var e,o})};return t(),L(()=>C.current,t)},[N,p,a]),c(()=>{if(!N)return;const t=e(t=>"Escape"===t.key&&(q(),!o(C.current))),r=i(q);return()=>{t(),r()}},[N]);const J=N&&v?A:void 0,Q=d(x)?m(x,{"aria-describedby":[x.props["aria-describedby"],J].filter(Boolean).join(" ")||void 0}):x,X=N?t():void 0;/* @__PURE__ */
|
|
2
|
+
return f("span",{ref:C,className:w,"aria-describedby":d(x)?void 0:J,onMouseEnter:S,onMouseLeave:G,onFocus:S,onBlur:G,onPointerDown:P,onClick:P,children:[Q,N&&u(
|
|
3
|
+
/* @__PURE__ */f("span",{className:"pointer-events-none fixed left-0 top-0",style:{zIndex:r.hint,...W?.anchor},children:[
|
|
4
|
+
/* @__PURE__ */g("span",{ref:H,id:A,role:"tooltip",className:`pointer-events-none absolute z-[300] box-border w-max overflow-hidden whitespace-normal break-words text-start rounded-md px-2 py-1 text-xs text-gray-800 ${W?"":$[p]}`,style:{...X,...W&&{left:W.left,top:W.top,maxWidth:W.maxWidth,maxHeight:W.maxHeight}},children:a}),(!W||W.arrow)&&
|
|
5
|
+
/* @__PURE__ */g("span",{"aria-hidden":"true",className:"rosh-tooltip-arrow","data-side":W?.side??p,style:{background:X?.background,"--rosh-tooltip-edge":X?.border,...W?.arrow&&{left:W.arrow.left,top:W.arrow.top}}})]}),document.body)]})}var P=t=>!0===t||"true"===t;function G(t){t.preventDefault(),t.stopPropagation()}var J=(t,e)=>[t,e].filter(Boolean).join(" ")||void 0;function Q({reason:t,id:e,block:o=!1,children:i}){/* @__PURE__ */
|
|
6
|
+
return f(p,{children:[
|
|
7
|
+
/* @__PURE__ */g(q,{content:t,describe:!1,className:o?"relative flex w-full":"relative inline-flex",children:i}),
|
|
8
|
+
/* @__PURE__ */g("span",{id:e,className:"sr-only",children:t})]})}function X(){/* @__PURE__ */
|
|
9
|
+
return f("svg",{className:"h-3.5 w-3.5 animate-spin",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[
|
|
10
|
+
/* @__PURE__ */g("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),
|
|
11
|
+
/* @__PURE__ */g("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"})]})}var Y=a(function({variant:t="primary",size:e="md",loading:o=!1,leftIcon:i,rightIcon:r,block:n=!1,disabled:a,type:s="button",children:h,className:c="",disabledReason:d,onClick:m,"aria-disabled":u,"aria-describedby":p,...b},x){const w=l(),v=a||o,y=null!=d&&""!==d,M=v&&y,N=!v&&P(u),k=N&&y,B=M||k?w:void 0,C=/* @__PURE__ */f("button",{ref:x,type:s,disabled:v,"aria-busy":o||void 0,"aria-disabled":!!N||u,"aria-describedby":J(p,B),onClick:N?G:m,className:W({variant:t,size:e,block:n,className:c}),...b,children:[o?/* @__PURE__ */g(X,{}):i,h,!o&&r]});return k?/* @__PURE__ */g(Q,{reason:d,id:w,block:n,children:C}):M?/* @__PURE__ */f("span",{className:n?"flex w-full flex-col gap-1":"inline-flex flex-col items-start gap-1",children:[C,
|
|
12
|
+
/* @__PURE__ */g("span",{id:B,className:"text-xs text-red-600",children:d})]}):C});export{Y as Button_default,C as MENU_MAX_HEIGHT,Q as OffWithReason,B as POPUP_MAX_WIDTH,q as Tooltip,H as VIEWPORT_MARGIN,W as buttonClasses,J as describedByWith,L as followAnchor,k as iconButtonClasses,P as isAriaDisabled,S as placeAtPoint,A as placeMenu,j as popupBounds,G as swallowPress,D as useDropdownPosition};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r="6.4.0",a=r;export{a as APP_VERSION,r as VERSION};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import{toast_default as e}from"./chunk-GJ37JCC2.js";import{useShellStrings as t}from"./chunk-K6DKX55N.js";import{Icon as n}from"./chunk-2SSRFEOZ.js";import{createContext as r,useContext as a,useRef as o,useState as i,useEffect as s}from"react";import*as l from"pdfjs-dist";import{createPortal as c}from"react-dom";import{jsx as d,jsxs as u}from"react/jsx-runtime";function m(e,t,n){return new Error(`The response for ${e} is not a WebAssembly module (got ${function(e){if(0===e.length)return"an empty response";const t=Array.from(e.subarray(0,24)).map(e=>e>=32&&e<127?String.fromCharCode(e):".").join("");return`${e.length} bytes starting "${t}"`}(n)}). The bundler did not emit "${t}" as an asset, and the host answered with a fallback page instead of a 404. Serve pdfjs-dist/wasm/ yourself and point window.__REACT_OS_SHELL_PDF_WASM__ at it.`)}var h=r(null);function p({children:e}){const t=a(h);return t?c(e,t):
|
|
2
|
+
/* @__PURE__ */d("div",{className:"flex shrink-0 flex-wrap items-center gap-1 border-b border-gray-200 bg-gray-50 px-3 py-2 text-xs",children:e})}"undefined"==typeof window||l.GlobalWorkerOptions.workerSrc||(l.GlobalWorkerOptions.workerSrc=`https://unpkg.com/pdfjs-dist@${l.version}/build/pdf.worker.min.mjs`);var f={"jbig2.wasm":new URL("pdfjs-dist/wasm/jbig2.wasm",import.meta.url).href,"openjpeg.wasm":new URL("pdfjs-dist/wasm/openjpeg.wasm",import.meta.url).href},g=class{async fetch({kind:e,filename:t}){if("wasmUrl"!==e)throw new Error(`Ensure that the \`${e}\` API parameter is provided.`);const n=f[t];if(!n)throw new Error(`No bundled pdf.js wasm module for "${t}".`);const r=await fetch(n);if(!r.ok)throw new Error(`Unable to load wasm data at: ${n}`);const a=new Uint8Array(await r.arrayBuffer());if(!function(e){return e.length>=4&&0===e[0]&&97===e[1]&&115===e[2]&&109===e[3]}(a))throw m(n,t,a);return a}};function w(e){const t=e||("undefined"!=typeof window?window.__REACT_OS_SHELL_PDF_WASM__:void 0);return"string"==typeof t&&t?{wasmUrl:t.endsWith("/")?t:`${t}/`}:{BinaryDataFactory:g}}var y=[50,75,100,125,150,200,300,400];function v(e,t,n){const r=(t.width-40)/n.width,a="page"===e?Math.min(r,(t.height-40)/n.height):r;return Math.min(Math.max(a,.3),4)}function b({url:r,filename:a,fit:c="width",onDownload:m,onEmail:h,workerSrc:f,wasmUrl:g}){const b=t().pdf,x=o(null),k=o(null),C=o(null),[N,j]=i(null),[E,M]=i(1),[_,z]=i(0),[D,P]=i(1),[S,W]=i(!0),[L,$]=i(!0),O=o(b.loadFailed);O.current=b.loadFailed,s(()=>{let t=!1;return $(!0),M(1),f&&(l.GlobalWorkerOptions.workerSrc=f),l.getDocument({url:r,...w(g)}).promise.then(e=>{t||(j(e),z(e.numPages),$(!1))}).catch(()=>{t||(e.error(O.current),$(!1))}),()=>{t=!0}},[r,f,g]),s(()=>{if(!N||!S||!C.current)return;const e=()=>{const e=C.current;e&&N.getPage(E).then(t=>{if(!C.current)return;const n=t.getViewport({scale:1}),r=v(c,{width:e.clientWidth,height:e.clientHeight},{width:n.width,height:n.height});P(e=>Math.abs(e-r)<.005?e:r)})};e();const t=new ResizeObserver(e);return t.observe(C.current),()=>t.disconnect()},[N,E,S,c]),s(()=>{if(!N||!x.current)return;let e=!1,t=null,n=null;return N.getPage(E).then(r=>{if(e||!x.current)return;const a=r.getViewport({scale:D}),o=x.current;o.width=a.width,o.height=a.height,o.style.width=`${a.width}px`,o.style.height=`${a.height}px`;const i=o.getContext("2d");t=r.render({canvas:o,canvasContext:i,viewport:a}),t.promise.catch(()=>{});const s=k.current;s&&(s.replaceChildren(),s.style.setProperty("--total-scale-factor",String(a.scale)),n=new l.TextLayer({textContentSource:r.streamTextContent(),container:s,viewport:a}),n.render().then(()=>{if(e)return;const t=document.createElement("div");t.className="endOfContent",s.append(t)}).catch(()=>{}))}),()=>{e=!0,t?.cancel(),n?.cancel()}},[N,E,D]),s(()=>{const e=()=>k.current?.classList.remove("selecting");return window.addEventListener("pointerup",e),()=>window.removeEventListener("pointerup",e)},[]);const T="page"===c?b.fitPage:b.fitWidth,A="px-2 py-1 rounded hover:bg-gray-200 transition-colors text-gray-600 flex items-center gap-1";/* @__PURE__ */
|
|
3
|
+
return u("div",{className:"flex flex-col h-full",children:[
|
|
4
|
+
/* @__PURE__ */u(p,{children:[
|
|
5
|
+
/* @__PURE__ */d("button",{type:"button","aria-label":b.previousPage,onClick:()=>M(e=>Math.max(1,e-1)),disabled:E<=1,className:"px-1 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",children:/* @__PURE__ */d(n,{name:"chevron-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
|
|
6
|
+
/* @__PURE__ */d("span",{className:"text-gray-600 font-medium tabular-nums whitespace-nowrap",children:b.pageOf(E,_)}),
|
|
7
|
+
/* @__PURE__ */d("button",{type:"button","aria-label":b.nextPage,onClick:()=>M(e=>Math.min(_,e+1)),disabled:E>=_,className:"px-1 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",children:/* @__PURE__ */d(n,{name:"chevron-right",className:"h-3.5 w-3.5",strokeWidth:2})}),
|
|
8
|
+
/* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
9
|
+
/* @__PURE__ */d("button",{type:"button","aria-label":b.zoomOut,title:b.zoomOut,onClick:()=>{W(!1),P(e=>Math.max(.3,Math.round(100*(e-.25))/100))},className:A,children:/* @__PURE__ */d("span",{"aria-hidden":"true",children:"−"})}),
|
|
10
|
+
/* @__PURE__ */u("select",{value:S?"fit":y.includes(Math.round(100*D))?Math.round(100*D):"custom",onChange:e=>{const t=e.target.value;"fit"!==t?"custom"!==t&&(W(!1),P(Number(t)/100)):W(!0)},className:"bg-transparent hover:bg-gray-200 rounded px-1 py-1 text-gray-600 tabular-nums cursor-pointer focus:outline-none focus:ring-1 focus:ring-blue-400","aria-label":b.zoom,title:b.zoom,children:[
|
|
11
|
+
/* @__PURE__ */d("option",{value:"fit",children:T}),!S&&!y.includes(Math.round(100*D))&&/* @__PURE__ */u("option",{value:"custom",children:[Math.round(100*D),"%"]}),y.map(e=>/* @__PURE__ */u("option",{value:e,children:[e,"%"]},e))]}),
|
|
12
|
+
/* @__PURE__ */d("button",{type:"button","aria-label":b.zoomIn,title:b.zoomIn,onClick:()=>{W(!1),P(e=>Math.min(4,Math.round(100*(e+.25))/100))},className:A,children:/* @__PURE__ */d("span",{"aria-hidden":"true",children:"+"})}),
|
|
13
|
+
/* @__PURE__ */d("button",{type:"button",onClick:()=>W(!0),"aria-pressed":S,className:A+(S?" bg-gray-200 text-gray-900":""),title:b.fitHint,children:b.fit}),
|
|
14
|
+
/* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
15
|
+
/* @__PURE__ */u("button",{type:"button",onClick:()=>{if(!N)return;const t=window.open("","_blank");if(!t)return void e.error(b.allowPopups);const n=[];for(let e=1;e<=_;e++)n.push(N.getPage(e).then(e=>{const t=e.getViewport({scale:2}),n=document.createElement("canvas");return n.width=t.width,n.height=t.height,e.render({canvas:n,canvasContext:n.getContext("2d"),viewport:t}).promise.then(()=>n.toDataURL())}));Promise.all(n).then(e=>{var n;t.document.write(`<html><head><title>${n=a,n.replace(/[&<>"]/g,e=>({"&":"&","<":"<",">":">",'"':"""}[e]))}</title><style>@media print{body{margin:0}img{width:100%;page-break-after:always}}</style></head><body>`),t.document.write(e.map(e=>`<img src="${e}"/>`).join("")),t.document.write("</body></html>"),t.document.close(),setTimeout(()=>{t.print(),t.close()},300)})},className:A,children:[
|
|
16
|
+
/* @__PURE__ */d(n,{name:"print",className:"h-3.5 w-3.5",strokeWidth:1.5}),b.print]}),
|
|
17
|
+
/* @__PURE__ */u("button",{type:"button",onClick:m??(()=>{const e=document.createElement("a");e.href=r,e.download=a,e.click()}),className:A,children:[
|
|
18
|
+
/* @__PURE__ */d(n,{name:"download",className:"h-3.5 w-3.5",strokeWidth:1.5}),b.download]}),h&&/* @__PURE__ */u("button",{type:"button",onClick:h,className:A,children:[
|
|
19
|
+
/* @__PURE__ */d(n,{name:"email",className:"h-3.5 w-3.5",strokeWidth:1.5}),b.email]})]}),
|
|
20
|
+
/* @__PURE__ */d("div",{ref:C,className:"flex-1 overflow-auto bg-gray-100 outline-none",tabIndex:0,onWheel:e=>{if(!N)return;if(e.ctrlKey||e.metaKey)return;const t=C.current;if(!t)return;const n=t.scrollTop<=0,r=t.scrollTop+t.clientHeight>=t.scrollHeight-1;e.deltaY>0&&r&&E<_?(e.preventDefault(),M(e=>Math.min(_,e+1)),requestAnimationFrame(()=>{C.current&&(C.current.scrollTop=0)})):e.deltaY<0&&n&&E>1&&(e.preventDefault(),M(e=>Math.max(1,e-1)),requestAnimationFrame(()=>{C.current&&(C.current.scrollTop=C.current.scrollHeight)}))},onKeyDown:e=>{if(!N)return;const t=(document.activeElement?.tagName||"").toLowerCase();"input"===t||"textarea"===t||document.activeElement?.isContentEditable||("PageDown"===e.key||"ArrowRight"===e.key?E<_&&(e.preventDefault(),M(e=>Math.min(_,e+1))):"PageUp"===e.key||"ArrowLeft"===e.key?E>1&&(e.preventDefault(),M(e=>Math.max(1,e-1))):"Home"===e.key?(e.preventDefault(),M(1)):"End"===e.key&&(e.preventDefault(),M(_)))},children:L?/* @__PURE__ */d("div",{className:"flex items-center justify-center h-full text-gray-500 text-sm",role:"status",children:b.loading}):/* @__PURE__ */u("div",{className:"min-h-full flex items-center justify-center p-4",children:[
|
|
21
|
+
/* @__PURE__ */d("style",{children:'\n.preview-pdf-textlayer {\n position: absolute;\n inset: 0;\n overflow: clip;\n line-height: 1;\n text-align: initial;\n text-size-adjust: none;\n forced-color-adjust: none;\n transform-origin: 0 0;\n caret-color: CanvasText;\n --min-font-size: 1;\n --text-scale-factor: calc(var(--total-scale-factor, 1) * var(--min-font-size));\n --min-font-size-inv: calc(1 / var(--min-font-size));\n}\n.preview-pdf-textlayer :is(span, br) {\n color: transparent;\n position: absolute;\n white-space: pre;\n cursor: text;\n transform-origin: 0% 0%;\n}\n.preview-pdf-textlayer > :not(.markedContent),\n.preview-pdf-textlayer .markedContent span:not(.markedContent) {\n z-index: 1;\n --font-height: 0;\n font-size: calc(var(--text-scale-factor) * var(--font-height));\n --scale-x: 1;\n --rotate: 0deg;\n transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv));\n}\n.preview-pdf-textlayer .markedContent {\n display: contents;\n}\n.preview-pdf-textlayer span[role="img"] {\n user-select: none;\n cursor: default;\n}\n.preview-pdf-textlayer ::selection {\n background: rgba(0, 80, 255, 0.25);\n}\n.preview-pdf-textlayer br::selection {\n background: transparent;\n}\n.preview-pdf-textlayer .endOfContent {\n display: block;\n position: absolute;\n inset: 100% 0 0;\n z-index: 0;\n cursor: default;\n user-select: none;\n}\n.preview-pdf-textlayer.selecting .endOfContent {\n top: 0;\n}\n'}),
|
|
22
|
+
/* @__PURE__ */u("div",{className:"relative shadow-lg rounded",children:[
|
|
23
|
+
/* @__PURE__ */d("canvas",{ref:x,className:"block rounded"}),
|
|
24
|
+
/* @__PURE__ */d("div",{ref:k,className:"preview-pdf-textlayer",onPointerDown:e=>e.currentTarget.classList.add("selecting")})]})]})})]})}export{p as PanelActions,b as PdfViewer,h as ToolbarSlotContext,v as fitScale,w as pdfWasmParams};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DEFAULT_SHELL_STRINGS as e,useShellStrings as t}from"./chunk-
|
|
1
|
+
import{DEFAULT_SHELL_STRINGS as e,useShellStrings as t}from"./chunk-K6DKX55N.js";import{useRef as r,useState as n,useCallback as s}from"react";import{jsx as a}from"react/jsx-runtime";function o(e,t){const r=(t??"").split(",").map(e=>e.trim().toLocaleLowerCase()).filter(Boolean);if(0===r.length||r.includes("*")||r.includes("*/*"))return!0;const n=e.name.toLocaleLowerCase(),s=e.type.toLocaleLowerCase();return r.some(e=>e.startsWith(".")?n.endsWith(e):e.endsWith("/*")?s.startsWith(e.slice(0,-1)):s===e)}var l=(t,r=e.files)=>t<1024?r.bytes(t):t<1048576?r.kilobytes(Math.round(t/1024)):r.megabytes(t/1048576),i=e=>Array.from(e.dataTransfer?.types??[]).includes("Files");function c({onAccept:e,accept:a,maxSizeBytes:c,maxFiles:u,multiple:f=!0,currentCount:p=0,acceptHint:m,disabled:d=!1}){const h=t().files,g=r(null),[y,x]=n(!1),[v,D]=n([]),L=r(0),b="string"==typeof m?m:"",A=s(t=>{if(d||!t)return;const r=Array.from(t);if(0===r.length)return;const n=[],s=[];for(const e of f?r:r.slice(0,1))o(e,a)?null!=c&&e.size>c?s.push({file:e,reason:"size",message:h.tooLarge(e.name,l(e.size,h),l(c,h))}):f&&null!=u&&p+n.length>=u?s.push({file:e,reason:"count",message:h.tooMany(e.name,u)}):n.push(e):s.push({file:e,reason:"type",message:h.notAccepted(e.name,b)});D(s),n.length&&e(n),g.current&&(g.current.value="")},[d,f,a,b,c,u,p,e,h]),j=s(()=>{d||g.current?.click()},[d]),k=s(()=>D([]),[]);return{inputRef:g,inputProps:{ref:g,type:"file",accept:a||void 0,multiple:f,disabled:d,tabIndex:-1,"aria-hidden":!0,className:"hidden",onChange:e=>A(e.target.files)},zoneProps:d?{}:{onDragEnter:e=>{i(e)&&(e.preventDefault(),L.current+=1,x(!0))},onDragOver:e=>{i(e)&&(e.preventDefault(),y||x(!0))},onDragLeave:e=>{i(e)&&(L.current=Math.max(0,L.current-1),0===L.current&&x(!1))},onDrop:e=>{i(e)&&(e.preventDefault(),L.current=0,x(!1),A(e.dataTransfer.files))}},pasteProps:d?{}:{onPaste:e=>{const t=function(e){const t=e.clipboardData;if(!t)return[];if(t.files&&t.files.length>0)return Array.from(t.files);const r=[];for(const e of Array.from(t.items??[]))if("file"===e.kind){const t=e.getAsFile();t&&r.push(t)}return r}(e);0!==t.length&&(e.preventDefault(),A(t))}},open:j,take:A,dragOver:y,rejections:v,clearRejections:k}}function u({rejections:e,className:t="mt-2"}){return 0===e.length?null:/* @__PURE__ */a("ul",{role:"alert",className:`${t} flex flex-col gap-0.5`,children:e.map(({file:e,message:t},r)=>/* @__PURE__ */a("li",{className:"text-xs text-red-600",children:t},`${e.name}-${r}`))})}export{u as FileIntakeAlert,o as acceptsFile,l as humanSize,c as useFileIntake};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dismissPopups as o}from"./chunk-
|
|
1
|
+
import{dismissPopups as o}from"./chunk-FIEA5CGB.js";import{useEffect as r,useLayoutEffect as t}from"react";var e="undefined"==typeof document?r:t;function n(r){e(()=>{r&&o()},[r])}export{n as useDismissPopupsOnOpen};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{navIcons as e}from"./chunk-DSSLOQDW.js";import{Icon as t}from"./chunk-2SSRFEOZ.js";import{isValidElement as r,cloneElement as n}from"react";import{jsx as o,jsxs as i}from"react/jsx-runtime";var l=["from-blue-500 to-blue-700","from-indigo-500 to-purple-600","from-purple-500 to-pink-600","from-pink-500 to-rose-600","from-red-500 to-rose-600","from-orange-500 to-red-600","from-amber-500 to-orange-600","from-yellow-500 to-amber-500","from-lime-500 to-green-600","from-green-500 to-emerald-600","from-emerald-500 to-teal-600","from-teal-500 to-cyan-600","from-cyan-500 to-sky-600","from-sky-500 to-blue-600","from-violet-500 to-fuchsia-600"];function a(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r);return l[Math.abs(t)%l.length]}var d={order:"text-blue-600",purchase_order:"text-purple-600",invoice:"text-green-600",client:"text-indigo-600",manufacturer:"text-orange-600",shipment:"text-teal-600",part_number:"text-gray-600",project:"text-pink-600",mould:"text-red-600",design:"text-cyan-600",brand:"text-amber-600",price_sheet:"text-emerald-600",folder:"text-yellow-600",page:"text-blue-500"},s={order:"SO",purchase_order:"PO",invoice:"INV",client:"CLI",manufacturer:"MFR",shipment:"DN",part_number:"PN",project:"PRJ",mould:"MLD",design:"DSN",brand:"BRD",price_sheet:"PS",vendor_invoice:"VI",vendor_payment:"VP",warranty_claim:"WC",qc_report:"QC",vendor_shipment:"GRN",bank_account:"BA",wheel_finish:"WF",weight_log:"WL",production_progress:"PP",vendor_price_sheet:"VPS",proposal:"PR",folder:"FLD"},c={pdf:"PDF",dxf:"DXF","3d":"STP",image:"IMG",csv:"CSV"},f={pdf:"text-red-600",dxf:"text-blue-600","3d":"text-purple-600",image:"text-emerald-600",csv:"text-green-600"};function p({className:e}){/* @__PURE__ */
|
|
2
|
+
return o(t,{name:"folder",look:"solid",className:e})}function u(t,r){return r&&e[r]||(t?e[t]:void 0)}var m=/* @__PURE__ */o("svg",{className:"h-7 w-7",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */o("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6A2.25 2.25 0 016 3.75h2.25A2.25 2.25 0 0110.5 6v2.25a2.25 2.25 0 01-2.25 2.25H6a2.25 2.25 0 01-2.25-2.25V6z"})});function h({entityType:e,isSelected:t,entityId:l,label:h,fileKind:w}){const g="preview-file"===e&&w,y=g?f[w]:null,x=g?c[w]:null;if("folder"===e)/* @__PURE__ */
|
|
3
|
+
return o("div",{className:"w-12 h-12 flex items-center justify-center "+(t?"rounded-lg bg-blue-400/30 ring-2 ring-blue-500":""),children:/* @__PURE__ */o(p,{className:"h-12 w-12 text-amber-500 drop-shadow-[0_2px_3px_rgba(0,0,0,0.3)]"})});if("page"===e){const e=u(l,h),i=a(l||h||"page");/* @__PURE__ */
|
|
4
|
+
return o("div",{className:"w-12 h-12 flex items-center justify-center "+(t?"rounded-lg bg-blue-400/30 ring-2 ring-blue-500":""),children:/* @__PURE__ */o("span",{className:`h-11 w-11 rounded-xl bg-gradient-to-br ${i} flex items-center justify-center text-white border border-white/30 drop-shadow-[0_2px_3px_rgba(0,0,0,0.3)]`,children:e&&r(e)?n(e,{className:"h-7 w-7 text-white"}):m})})}/* @__PURE__ */
|
|
5
|
+
return i("div",{className:"w-12 h-12 relative flex items-center justify-center "+(t?"rounded-lg bg-blue-400/30 ring-2 ring-blue-500":""),children:[
|
|
6
|
+
/* @__PURE__ */i("svg",{className:`w-10 h-12 drop-shadow-[0_2px_3px_rgba(0,0,0,0.3)] ${y??d[e]??"text-gray-500"}`,viewBox:"0 0 40 48",fill:"none",children:[
|
|
7
|
+
/* @__PURE__ */o("path",{d:"M4 0h22l10 10v34a4 4 0 01-4 4H4a4 4 0 01-4-4V4a4 4 0 014-4z",fill:"white",fillOpacity:"0.92"}),
|
|
8
|
+
/* @__PURE__ */o("path",{d:"M26 0l10 10H30a4 4 0 01-4-4V0z",fill:"currentColor",fillOpacity:"0.2"}),
|
|
9
|
+
/* @__PURE__ */o("path",{d:"M4 0h22l10 10v34a4 4 0 01-4 4H4a4 4 0 01-4-4V4a4 4 0 014-4z",stroke:"currentColor",strokeWidth:"1.5",strokeOpacity:"0.5"})]}),
|
|
10
|
+
/* @__PURE__ */o("span",{className:`absolute inset-0 flex items-center justify-center text-[9px] font-bold pt-2 ${y??d[e]??"text-gray-600"}`,children:x??s[e]??e.slice(0,3).toUpperCase()})]})}function w({item:e}){if("folder"===e.entityType)/* @__PURE__ */
|
|
11
|
+
return o(p,{className:"h-4 w-4 shrink-0 text-amber-500"});if("page"===e.entityType){const t=u(e.entityId,e.label);/* @__PURE__ */
|
|
12
|
+
return o("span",{className:`h-4 w-4 rounded bg-gradient-to-br ${a(e.entityId||e.label||"page")} flex items-center justify-center text-white shrink-0`,children:t&&r(t)?n(t,{className:"h-3 w-3 text-white"}):/* @__PURE__ */o("span",{className:"h-1.5 w-1.5 rounded-[2px] border border-white/80"})})}const i=("preview-file"===e.entityType&&e.fileKind?f[e.fileKind]:d[e.entityType])??"text-gray-400";/* @__PURE__ */
|
|
13
|
+
return o(t,{name:"page",className:`h-4 w-4 shrink-0 ${i}`,strokeWidth:1.5})}function g(e){return"preview-file"===e.entityType&&e.fileKind?c[e.fileKind]:"page"===e.entityType?"App":"folder"===e.entityType?"Folder":s[e.entityType]??e.entityType.slice(0,3).toUpperCase()}var y=null,x=/* @__PURE__ */new Set;function b(e){y=e,x.forEach(e=>e())}function v(e){return x.add(e),()=>{x.delete(e)}}function _(){return y}var k="__REACT_OS_SHELL_FILES_VIEW__",N="react-os-shell:files-show-trash",S="react-os-shell:files-open-desktop-folder";function j(){"undefined"!=typeof window&&(window[k]="trash",window.dispatchEvent(new CustomEvent(N)))}function C(e){"undefined"!=typeof window&&(window[k]={view:"desktop-folder",folderId:e},window.dispatchEvent(new CustomEvent(S,{detail:{folderId:e}})))}function I(){if("undefined"==typeof window)return null;const e=window[k];return"trash"===e?"trash":e&&"object"==typeof e&&"desktop-folder"===e.view&&"string"==typeof e.folderId?e:null}function T(){const e=I();return"undefined"!=typeof window&&(window[k]=null),e}export{w as DesktopItemMiniIcon,S as FILES_OPEN_DESKTOP_FOLDER_EVENT,N as FILES_SHOW_TRASH_EVENT,h as FileIconTile,p as FolderGlyph,T as consumeFilesViewRequest,g as desktopItemTypeLabel,_ as getDesktopFoldersSnapshot,I as peekFilesViewRequest,b as publishDesktopFolders,C as requestFilesDesktopFolderView,j as requestFilesTrashView,v as subscribeDesktopFolders};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Modal as e}from"./chunk-
|
|
1
|
+
import{Modal as e}from"./chunk-QJHWLDEN.js";import{keepsNativeMenu as a}from"./chunk-ZEIKSMFR.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"}),
|