efficient-shell 12.16.0 → 12.17.1

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.
Files changed (46) hide show
  1. package/README.md +11 -4
  2. package/dist/{Browser-7JNZKYCH.js → Browser-A3JCQ6WZ.js} +13 -13
  3. package/dist/{Files-2CUER7VQ.js → Files-O5ZUWY44.js} +26 -26
  4. package/dist/{Notepad-S2COZUMR.js → Notepad-ZIWRLVG5.js} +8 -8
  5. package/dist/{Preview-C3JK6FBV.js → Preview-G2BMJF76.js} +27 -27
  6. package/dist/ai/index.js +29 -29
  7. package/dist/apps/index.js +1 -1
  8. package/dist/bin/media-host-check.js +1 -1
  9. package/dist/bin/ui-check.js +1 -1
  10. package/dist/brand.css +1 -1
  11. package/dist/charts/PieChart.js +1 -1
  12. package/dist/charts/RadarChart.js +1 -1
  13. package/dist/charts/RadialBarChart.js +1 -1
  14. package/dist/charts/SpecChart.js +1 -1
  15. package/dist/charts/TimeSeriesChart.js +1 -1
  16. package/dist/{chunk-XU3YOWEG.js → chunk-2DQHXJPM.js} +1 -1
  17. package/dist/{chunk-UHK4MAFE.js → chunk-2I7M4DCA.js} +1 -1
  18. package/dist/{chunk-YC42NCCA.js → chunk-B7EVVJHY.js} +1 -1
  19. package/dist/{chunk-XQWHKXLS.js → chunk-F37II2EH.js} +13 -13
  20. package/dist/chunk-I76W4ZNU.js +6 -0
  21. package/dist/{chunk-DG2TGWXI.js → chunk-JUFCEWE3.js} +5 -5
  22. package/dist/chunk-LAOG7AED.js +1 -0
  23. package/dist/{chunk-2NZ7CVMW.js → chunk-OALFCXD6.js} +1 -1
  24. package/dist/{chunk-VP2GI3UP.js → chunk-OHSRZLRD.js} +2 -2
  25. package/dist/{chunk-FVKXDF2Q.js → chunk-RB7IU7ZK.js} +5 -5
  26. package/dist/{chunk-IFGNAY56.js → chunk-S3OCHYGE.js} +7 -7
  27. package/dist/{chunk-EEB5XPWP.js → chunk-VXDW6ZPG.js} +2 -2
  28. package/dist/{chunk-EGCHJHRR.js → chunk-YK64FFLW.js} +8 -8
  29. package/dist/chunk-Z5TE3MEG.js +1 -0
  30. package/dist/forms/LinkPicker.js +1 -1
  31. package/dist/forms/Slider.d.ts +5 -4
  32. package/dist/forms/Slider.js +1 -1
  33. package/dist/forms/linkHref.js +1 -1
  34. package/dist/index.js +112 -112
  35. package/dist/markup/index.d.ts +22 -2
  36. package/dist/markup/index.js +1 -1
  37. package/dist/shell/HelpCenter.js +1 -1
  38. package/dist/shell/Markdown.js +1 -1
  39. package/dist/telemetry/index.js +1 -1
  40. package/dist/templates/DashboardTemplate.js +1 -1
  41. package/dist/ui/index.js +1 -1
  42. package/dist/version.js +1 -1
  43. package/package.json +1 -1
  44. package/dist/chunk-24JKQX2N.js +0 -4
  45. package/dist/chunk-3W4JUMFI.js +0 -1
  46. package/dist/chunk-Q5Z3KHT2.js +0 -1
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export{PieChart as default}from"../chunk-VP2GI3UP.js";import"../chunk-VFC6QUEN.js";import"../chunk-465RRWBY.js";import"../chunk-CNYAHYE6.js";import"../chunk-MAFUXCPZ.js";import"../chunk-2JWPNR2U.js";import"../chunk-WDQI3FV6.js";import"../chunk-TZFACUMR.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-JSHMIMAJ.js";import"../chunk-C3QOHMR6.js";
2
+ export{PieChart as default}from"../chunk-OHSRZLRD.js";import"../chunk-465RRWBY.js";import"../chunk-VFC6QUEN.js";import"../chunk-CNYAHYE6.js";import"../chunk-MAFUXCPZ.js";import"../chunk-2JWPNR2U.js";import"../chunk-WDQI3FV6.js";import"../chunk-TZFACUMR.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-JSHMIMAJ.js";import"../chunk-C3QOHMR6.js";
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export{RADAR_SERIES_CAP,RadarChart as default}from"../chunk-DG2TGWXI.js";import"../chunk-HY6CBG4M.js";import"../chunk-VFC6QUEN.js";import"../chunk-465RRWBY.js";import"../chunk-CNYAHYE6.js";import"../chunk-G67CJAQ2.js";import"../chunk-SOZCWT6I.js";import"../chunk-PGN5ME7B.js";import"../chunk-62LW225J.js";import"../chunk-GLUJS42B.js";import"../chunk-D65T4H6J.js";import"../chunk-2JWPNR2U.js";import"../chunk-WDQI3FV6.js";import"../chunk-TZFACUMR.js";import"../chunk-TWVUQUUD.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-JSHMIMAJ.js";import"../chunk-C3QOHMR6.js";
2
+ export{RADAR_SERIES_CAP,RadarChart as default}from"../chunk-JUFCEWE3.js";import"../chunk-HY6CBG4M.js";import"../chunk-465RRWBY.js";import"../chunk-VFC6QUEN.js";import"../chunk-CNYAHYE6.js";import"../chunk-G67CJAQ2.js";import"../chunk-SOZCWT6I.js";import"../chunk-PGN5ME7B.js";import"../chunk-62LW225J.js";import"../chunk-GLUJS42B.js";import"../chunk-D65T4H6J.js";import"../chunk-2JWPNR2U.js";import"../chunk-WDQI3FV6.js";import"../chunk-TZFACUMR.js";import"../chunk-TWVUQUUD.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-JSHMIMAJ.js";import"../chunk-C3QOHMR6.js";
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export{RadialBarChart as default}from"../chunk-FVKXDF2Q.js";import"../chunk-VFC6QUEN.js";import"../chunk-465RRWBY.js";import"../chunk-CNYAHYE6.js";import"../chunk-2JWPNR2U.js";import"../chunk-WDQI3FV6.js";import"../chunk-TZFACUMR.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-JSHMIMAJ.js";import"../chunk-C3QOHMR6.js";
2
+ export{RadialBarChart as default}from"../chunk-RB7IU7ZK.js";import"../chunk-465RRWBY.js";import"../chunk-VFC6QUEN.js";import"../chunk-CNYAHYE6.js";import"../chunk-2JWPNR2U.js";import"../chunk-WDQI3FV6.js";import"../chunk-TZFACUMR.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-JSHMIMAJ.js";import"../chunk-C3QOHMR6.js";
@@ -1 +1 @@
1
- export{SpecChart as default}from"../chunk-EEB5XPWP.js";import"../chunk-GEYM4WN3.js";import"../chunk-Y3JW2GW5.js";import"../chunk-36BRD5J3.js";import"../chunk-LF27WIN2.js";import"../chunk-XQWHKXLS.js";import"../chunk-TU2L7NW3.js";import"../chunk-CK2YOGUS.js";import"../chunk-RBS3AWE7.js";import"../chunk-VFC6QUEN.js";import"../chunk-GC4N4UQM.js";import"../chunk-465RRWBY.js";import"../chunk-WXZZGHET.js";import"../chunk-CNYAHYE6.js";import"../chunk-G67CJAQ2.js";import"../chunk-SOZCWT6I.js";import"../chunk-PGN5ME7B.js";import"../chunk-62LW225J.js";import"../chunk-GLUJS42B.js";import"../chunk-D65T4H6J.js";import"../chunk-ENFXDIIZ.js";import"../chunk-2DYVVHZA.js";import"../chunk-MAFUXCPZ.js";import"../chunk-2JWPNR2U.js";import"../chunk-WDQI3FV6.js";import"../chunk-TZFACUMR.js";import"../chunk-TWVUQUUD.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-JSHMIMAJ.js";import"../chunk-C3QOHMR6.js";
1
+ export{SpecChart as default}from"../chunk-VXDW6ZPG.js";import"../chunk-GEYM4WN3.js";import"../chunk-Y3JW2GW5.js";import"../chunk-36BRD5J3.js";import"../chunk-LF27WIN2.js";import"../chunk-F37II2EH.js";import"../chunk-GC4N4UQM.js";import"../chunk-465RRWBY.js";import"../chunk-TU2L7NW3.js";import"../chunk-CK2YOGUS.js";import"../chunk-RBS3AWE7.js";import"../chunk-WXZZGHET.js";import"../chunk-VFC6QUEN.js";import"../chunk-CNYAHYE6.js";import"../chunk-G67CJAQ2.js";import"../chunk-SOZCWT6I.js";import"../chunk-PGN5ME7B.js";import"../chunk-62LW225J.js";import"../chunk-GLUJS42B.js";import"../chunk-D65T4H6J.js";import"../chunk-ENFXDIIZ.js";import"../chunk-2DYVVHZA.js";import"../chunk-MAFUXCPZ.js";import"../chunk-2JWPNR2U.js";import"../chunk-WDQI3FV6.js";import"../chunk-TZFACUMR.js";import"../chunk-TWVUQUUD.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-JSHMIMAJ.js";import"../chunk-C3QOHMR6.js";
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export{TimeSeriesChart as default}from"../chunk-XQWHKXLS.js";import"../chunk-TU2L7NW3.js";import"../chunk-CK2YOGUS.js";import"../chunk-VFC6QUEN.js";import"../chunk-465RRWBY.js";import"../chunk-WXZZGHET.js";import"../chunk-CNYAHYE6.js";import"../chunk-2DYVVHZA.js";import"../chunk-MAFUXCPZ.js";import"../chunk-2JWPNR2U.js";import"../chunk-WDQI3FV6.js";import"../chunk-TZFACUMR.js";import"../chunk-TWVUQUUD.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-JSHMIMAJ.js";import"../chunk-C3QOHMR6.js";
2
+ export{TimeSeriesChart as default}from"../chunk-F37II2EH.js";import"../chunk-465RRWBY.js";import"../chunk-TU2L7NW3.js";import"../chunk-CK2YOGUS.js";import"../chunk-WXZZGHET.js";import"../chunk-VFC6QUEN.js";import"../chunk-CNYAHYE6.js";import"../chunk-2DYVVHZA.js";import"../chunk-MAFUXCPZ.js";import"../chunk-2JWPNR2U.js";import"../chunk-WDQI3FV6.js";import"../chunk-TZFACUMR.js";import"../chunk-TWVUQUUD.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-JSHMIMAJ.js";import"../chunk-C3QOHMR6.js";
@@ -1,4 +1,4 @@
1
- import{isSafeLinkHref as e}from"./chunk-Q5Z3KHT2.js";import{Button_default as t}from"./chunk-EVYD6UFQ.js";import{Icon as n}from"./chunk-JOAKKXTL.js";import{useShellStrings as r}from"./chunk-JSHMIMAJ.js";import{createContext as l,useContext as s}from"react";import{jsx as a,jsxs as i}from"react/jsx-runtime";var c=/!\[([^\]]*)\]\(([^)]+)\)|\[([^\]]+)\]\(([^)]+)\)|\*\*([^*]+)\*\*|`([^`]+)`|\*([^*]+)\*/g,o=l(void 0);function d({href:t,children:n}){const r=s(o),l=(t=>e(t.trim()))(t)?t:void 0;/* @__PURE__ */
1
+ import{isSafeLinkHref as e}from"./chunk-Z5TE3MEG.js";import{Button_default as t}from"./chunk-EVYD6UFQ.js";import{Icon as n}from"./chunk-JOAKKXTL.js";import{useShellStrings as r}from"./chunk-JSHMIMAJ.js";import{createContext as l,useContext as s}from"react";import{jsx as a,jsxs as i}from"react/jsx-runtime";var c=/!\[([^\]]*)\]\(([^)]+)\)|\[([^\]]+)\]\(([^)]+)\)|\*\*([^*]+)\*\*|`([^`]+)`|\*([^*]+)\*/g,o=l(void 0);function d({href:t,children:n}){const r=s(o),l=(t=>e(t.trim()))(t)?t:void 0;/* @__PURE__ */
2
2
  return a("a",{href:l,target:"_blank",rel:"noreferrer",className:"text-blue-600 hover:underline",onClick:l&&r?e=>{(e=>!(0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey))(e)&&r(l)&&e.preventDefault()}:void 0,children:n})}function u(e){const t=[];let n,r=0,l=0;const s=new RegExp(c.source,"g");for(;null!==(n=s.exec(e));)n.index>r&&t.push(e.slice(r,n.index)),void 0!==n[1]?t.push(
3
3
  /* @__PURE__ */i("span",{className:"text-gray-400",children:["[",n[1],"]"]},l++)):void 0!==n[3]?t.push(
4
4
  /* @__PURE__ */a(d,{href:n[4],children:n[3]},l++)):void 0!==n[5]?t.push(
@@ -1 +1 @@
1
- import{setBoundaryErrorReporter as e}from"./chunk-KNUR2UEG.js";import{VERSION as t}from"./chunk-3W4JUMFI.js";var n=-1,i=()=>n,a=e=>{addEventListener("pageshow",t=>{t.persisted&&(n=t.timeStamp,e(t))},!0)},r=(e,t,n,i)=>{let a,r;return o=>{var s,c;t.value>=0&&(o||i)&&(r=t.value-(a??0),(r||void 0===a)&&(a=t.value,t.delta=r,t.rating=(s=t.value)>(c=n)[1]?"poor":s>c[0]?"needs-improvement":"good",e(t)))}},o=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},s=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},c=()=>s()?.activationStart??0,d=-1,l=/* @__PURE__ */new Set,u=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,f=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of l)e();isFinite(d)||(d="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",f,!0))}},h=(e=!1)=>{if(e&&(d=1/0),d<0){const e=c(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;d=t??u(),addEventListener("visibilitychange",f,!0),addEventListener("prerenderingchange",f,!0),a(()=>{setTimeout(()=>{d=u()})})}return{get firstHiddenTime(){return d},onHidden(e){l.add(e)}}},g=(e,t=-1,n,a=0,r,o,d)=>{const l=s(),u=l?.navigationId||0;let f="navigate";return n?f=n:i()>=0?f="back-forward-cache":l&&(document.prerendering||c()>0?f="prerender":document.wasDiscarded?f="restore":l.type&&(f=l.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:f,navigationId:a||u,navigationInteractionId:r,navigationURL:o||l?.name,navigationStartTime:d||0}},v=/* @__PURE__ */new WeakMap;function p(e,t){let n=v.get(t);return n||(n=/* @__PURE__ */new WeakMap,v.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}var m,y=class{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},T=(e,t,n={})=>{try{const i=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(i.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const n=e.getEntries();i.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(const t of i)e.observe({type:t,buffered:!0,...n});return e}}catch{}},w=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,I=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},b=e=>{let t=!1;return()=>{t||(e(),t=!0)}},C=class{l},E=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},L=[1800,3e3],P=(e,t={})=>{const n=w(t);E(()=>{const s=p(t,C),d=h();let l,u=g("FCP");const f=T(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(f.disconnect(),t.startTime<d.firstHiddenTime&&(u.value=Math.max(t.startTime-c(),0),u.entries.push(t),u.navigationId=t.navigationId||u.navigationId,l(!0)))});f&&(l=r(e,u,L,t.reportAllChanges),a(n=>{u=g("FCP",-1,"back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),l=r(e,u,L,t.reportAllChanges),o(()=>{u.value=performance.now()-n.timeStamp,l(!0)})})),n&&T(["soft-navigation"],n=>{n.forEach(n=>{s.l&&n.navigationId&&I(s.l,n);const i=Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0);u=g("FCP",i,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),l=r(e,u,L,t.reportAllChanges),l(!0)})},t)})},A=[.1,.25],k=0,S=1/0,z=0,M=e=>{for(const t of e)t.interactionId&&(S=Math.min(S,t.interactionId),z=Math.max(z,t.interactionId),k=z?(z-S)/7+1:0)},$=()=>m?k:performance.interactionCount??0,_=class{u=0;v=[];m=/* @__PURE__ */new Map;p;T;_(){return $()-this.u}M(){this.u=$(),this.v.length=0,this.m.clear()}L(e){const t=this._(),n=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==n||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[n]:{P:8,id:-1,entries:[]}}h(e){if(this.p?.(e),!e.interactionId)return;const t=this.v.at(-1);let n=this.m.get(e.interactionId);if(n||this.v.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}this.T?.(n)}}},F=e=>{const t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const a=b(e);let r=-1;const o=()=>{i(r),a()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=n(()=>{removeEventListener("visibilitychange",o,{capture:!0}),a()},{timeout:t})}},Z=[200,500],R=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=h();E(()=>{"interactionCount"in performance||m||(m=T(["event"],M,{durationThreshold:0}));let o,s=g("INP");const c=p(t,_),d=(n,i,a,d,l)=>{c.M(),s=g("INP",-1,n,i,a,d,l),o=r(e,s,Z,t.reportAllChanges)},l=()=>{const e=c.L(s.navigationType);e&&e.P!==s.value&&(s.value=e.P,s.entries=e.entries,o())},u=e=>{l(),o(!0),d("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},f=(e,t=!1)=>{F(()=>{for(const t of e)"soft-navigation"!==t.entryType?c.h(t):u(t);l(),t&&o(!0)})},h=["event","first-input"];w(t)&&h.push("soft-navigation");const v=T(h,f,{...t,durationThreshold:t.durationThreshold??40});o=r(e,s,Z,t.reportAllChanges),v&&(n.onHidden(()=>{f(v.takeRecords(),!0)}),a(()=>{d("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,i())}))})},j=class{p;l;h(e){this.p?.(e)}},x=[2500,4e3],U=[800,1800],B=e=>{document.prerendering?E(()=>B(e)):"complete"!==document.readyState?addEventListener("load",()=>B(e),!0):setTimeout(e)};var N=/^[A-Za-z0-9/_:.\-[\]{}*@~]+$/,O=/^[A-Za-z_$][A-Za-z0-9_$.]*$/,H=/^[A-Za-z0-9][A-Za-z0-9.+_-]*$/;var q=class{constructor(e){this.head=e}head;events=[];waiting=/* @__PURE__ */new Map;seen=/* @__PURE__ */new Set;get size(){return this.events.length}addVital(e){this.events.push(e)}addError(e){const t=function(e){return e.frames.length?`${e.name}|${e.frames.join("|")}`:`${e.name}|${e.message.replace(/\d/g,"0")}`}(e),n=this.waiting.get(t);return n?(n.count=Math.min(1e3,n.count+e.count),!0):!(this.seen.has(t)||this.seen.size>=20)&&(this.seen.add(t),this.waiting.set(t,e),this.events.push(e),!0)}drain(){const e=this.events;this.events=[],this.waiting.clear();const t=[],n=JSON.stringify({...this.head,events:[]}).length;let i=[],a=n;for(const r of e){const e=JSON.stringify(r).length+1;n+e>30720||((50===i.length||a+e>30720)&&(t.push({...this.head,events:i}),i=[],a=n),i.push(r),a+=e)}return i.length&&t.push({...this.head,events:i}),t}},J=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,K=/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*)?|\b[Bb]earer\s+[A-Za-z0-9._~+/=-]{8,}/g,W=/\b[a-z][a-z0-9+.-]*:\/\/\S+/gi,V=/\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,Q=/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,X=/(?:\(|@|\bat\s+)?((?:[a-z][a-z0-9+.-]*:\/\/|\/)[^\s()@]*?):(\d+):(\d+)\)?\s*$/i;function Y(e,t,n){const i=e.replace(Q,"").split(/[?#]/,1)[0];return i?`${i}:${t}:${n}`.slice(0,256):null}function ee(e){if("string"!=typeof e)return[];const t=[];for(const n of e.split("\n")){const e=X.exec(n.trim()),i=e&&Y(e[1],e[2],e[3]);if(i&&t.push(i),5===t.length)break}return t}function te(e){const t=e instanceof Error?e.name:void 0;return"string"==typeof t&&t.length<=64&&O.test(t)?t:"Error"}function ne(e){if("string"!=typeof e)return"unknown";const t=e.trim().replace(Q,"").split(/[?#]/,1)[0].replace(G,(e,t)=>":"===t?":id":`${t}:id`);return t&&t.length<=128&&!t.includes("//")&&N.test(t)?t:"unknown"}var ie={flush(){},reportError(){},stop(){}},ae=null,re=/* @__PURE__ */new Set(["LCP","FCP","TTFB"]);function oe(e,t,n){const i=function(e){if(e.anonymous)return{credentials:"omit",headers:{"Content-Type":"application/json"}};const t=e.getAccessToken();return t?{credentials:"same-origin",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}}:null}(t);if(!i)return;const a=t.anonymous?"/api/storefront-analytics/web-vitals/":"/api/client-telemetry/web-batches/";n(t.endpoint??a,{...i,method:"POST",keepalive:!0,body:JSON.stringify(e)}).catch(e=>{console.debug("[efficient-shell] client telemetry batch dropped:",e)})}function se(e){((e,t={})=>{let n=!1;const s=w(t);E(()=>{let d,l=h(),u=g("LCP");const f=p(t,j),v=(i,a,o,s,c)=>{u=g("LCP",-1,i,a,o,s,c),d=r(e,u,x,t.reportAllChanges),n=!1,"soft-navigation"===i&&(l=h(!0))},m=e=>{f.l&&e.navigationId&&I(f.l,e),n||d(!0),v("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const t=e.getLargestInteractionContentfulPaint?.();t&&y([t])},y=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){m(t);continue}let e=0,n=[],i=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-c(),0),f.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){const a=t;if(!u.navigationId)continue;if("interactionId"in a&&a.interactionId!=u.navigationInteractionId)continue;i=a.largestContentfulPaint?.renderTime||0,e=Math.max(i-t.startTime,0),a.largestContentfulPaint&&(f.h(a.largestContentfulPaint),n=[a.largestContentfulPaint])}i<l.firstHiddenTime&&(u.value=e,u.entries=n,d())}},w=["largest-contentful-paint"];s&&w.push("interaction-contentful-paint","soft-navigation");const b=T(w,y);if(b){d=r(e,u,x,t.reportAllChanges);const c=["keydown","click","visibilitychange"],l=e=>{if(e.isTrusted&&!n){const e=u.id;F(()=>{if(!n){if(!s){b.disconnect();for(const e of c)removeEventListener(e,l,{capture:!0})}e===u.id&&(n=!0,d(!0))}})}};for(const e of c)addEventListener(e,l,{capture:!0});a(a=>{v("back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),d=r(e,u,x,t.reportAllChanges),o(()=>{u.value=performance.now()-a.timeStamp,n=!0,d(!0)})})}})})(e),R(e),((e,t={})=>{const n=h();P(b(()=>{let s,c=g("CLS",0);const d=p(t,y),l=(n,i,a,o,l)=>{c=g("CLS",0,n,i,a,o,l),d.i=0,s=r(e,c,A,t.reportAllChanges)},u=(e=!1)=>{d.i>c.value&&(c.value=d.i,c.entries=d.o),s(e)},f=e=>{u(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},h=e=>{for(const t of e)"soft-navigation"!==t.entryType?d.h(t):f(t);u()},v=["layout-shift"];w(t)&&v.push("soft-navigation");const m=T(v,h);m&&(s=r(e,c,A,t.reportAllChanges),n.onHidden(()=>{h(m.takeRecords()),s(!0)}),a(()=>{l("back-forward-cache",c.navigationId,c.navigationInteractionId,c.navigationURL,i()),o(s)}),setTimeout(s))}))})(e),P(e),((e,t={})=>{const n=w(t);let o=g("TTFB"),d=r(e,o,U,t.reportAllChanges);B(()=>{const l=s();if(l){const s=l.responseStart;o.value=Math.max(s-c(),0),o.entries=[l],d(!0),a(()=>{o=g("TTFB",0,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,i()),d=r(e,o,U,t.reportAllChanges),d(!0)}),n&&T(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&(o=g("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),o.entries=[n],d=r(e,o,U,t.reportAllChanges),d(!0))})},t)}})})(e)}function ce(n){if(ae?.stop(),ae=null,!1===n.enabled||"undefined"==typeof window||"undefined"==typeof document)return ie;if(!function(e){const t="string"==typeof e.app&&H.test(e.app),n="string"==typeof e.release&&H.test(e.release);return t&&n||console.warn("[efficient-shell] client telemetry not started: `app` and `release` must be version-like strings."),t&&n}(n))return ie;const i=function(e){const t=e.vitalsSampleRate??1;return t>0&&(t>=1||(e.random??Math.random)()<t)}(n);if(n.anonymous&&!i)return ie;const a=n.fetch??window.fetch.bind(window),r=new q({app:n.app,release:n.release,shell_version:H.test(t)?t:""}),o=ne(n.routeKey()),s=function(e=("undefined"==typeof window?void 0:window)){if(!e)return"desktop";const t="function"==typeof e.matchMedia&&e.matchMedia("(pointer: coarse)").matches,n=e.innerWidth;return n<600?"mobile":t&&n<1280?"tablet":"desktop"}(window);let c=!1;const d=()=>{for(const e of r.drain())oe(e,n,a)},l=e=>{c||n.anonymous||(r.addError(e),r.size>=50&&d())},u=(e,t)=>{return{type:"error",source:t,name:te(e),message:(a=e,i=a instanceof Error?a.message:"string"==typeof a?a:a&&"object"==typeof a&&"string"==typeof a.message?a.message:"",i.slice(0,640).replace(J,"[redacted]").replace(K,"[redacted]").replace(W,"[url]").replace(V,"[id]").replace(D,"[n]").replace(/\s+/g," ").trim().slice(0,160)),frames:ee(e instanceof Error?e.stack:void 0),route:ne(n.routeKey()),count:1};var i,a};i&&(n.observeVitals??se)(e=>{c||(r.addVital(function(e,t,n,i){return{type:"vital",name:e.name,value:e.value,route:re.has(e.name)?t:n(),navigation:e.navigationType??"navigate",device:i}}(e,o,()=>ne(n.routeKey()),s)),r.size>=50&&d())});const f=n.anonymous?()=>{}:function(t,n){const i=e=>{const{error:i,message:a,filename:r,lineno:o,colno:s}=e;if(null!=i)return void t(n(i,"onerror"));const c=r?ee(`at ${r}:${o??0}:${s??0}`):[];t({...n(a??"","onerror"),frames:c})},a=e=>t(n(e.reason,"unhandledrejection"));window.addEventListener("error",i),window.addEventListener("unhandledrejection",a);const r=e(e=>t(n(e,"boundary")));return()=>{window.removeEventListener("error",i),window.removeEventListener("unhandledrejection",a),r()}}(l,u),h=()=>{"hidden"===document.visibilityState&&d()};document.addEventListener("visibilitychange",h),window.addEventListener("pagehide",d);const g=window.setInterval(d,n.flushIntervalMs??6e4),v={flush:d,reportError:e=>l(u(e,"boundary")),stop(){c||(d(),c=!0,f(),document.removeEventListener("visibilitychange",h),window.removeEventListener("pagehide",d),window.clearInterval(g),ae===v&&(ae=null))}};return ae=v,v}export{ce as startClientTelemetry};
1
+ import{setBoundaryErrorReporter as e}from"./chunk-KNUR2UEG.js";import{VERSION as t}from"./chunk-LAOG7AED.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],A=(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)})},P=[.1,.25],k=0,S=1/0,z=0,M=e=>{for(const t of e)t.interactionId&&(S=Math.min(S,t.interactionId),z=Math.max(z,t.interactionId),k=z?(z-S)/7+1:0)},$=()=>m?k:performance.interactionCount??0,_=class{u=0;v=[];m=/* @__PURE__ */new Map;p;T;_(){return $()-this.u}M(){this.u=$(),this.v.length=0,this.m.clear()}L(e){const t=this._(),n=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==n||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[n]:{P:8,id:-1,entries:[]}}h(e){if(this.p?.(e),!e.interactionId)return;const t=this.v.at(-1);let n=this.m.get(e.interactionId);if(n||this.v.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}this.T?.(n)}}},Z=e=>{const t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const a=b(e);let r=-1;const o=()=>{i(r),a()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=n(()=>{removeEventListener("visibilitychange",o,{capture:!0}),a()},{timeout:t})}},F=[200,500],R=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=h();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,F,t.reportAllChanges)},l=()=>{const e=c.L(s.navigationType);e&&e.P!==s.value&&(s.value=e.P,s.entries=e.entries,o())},u=e=>{l(),o(!0),d("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},f=(e,t=!1)=>{Z(()=>{for(const t of e)"soft-navigation"!==t.entryType?c.h(t):u(t);l(),t&&o(!0)})},h=["event","first-input"];w(t)&&h.push("soft-navigation");const v=T(h,f,{...t,durationThreshold:t.durationThreshold??40});o=r(e,s,F,t.reportAllChanges),v&&(n.onHidden(()=>{f(v.takeRecords(),!0)}),a(()=>{d("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,i())}))})},j=class{p;l;h(e){this.p?.(e)}},x=[2500,4e3],B=[800,1800],N=e=>{document.prerendering?C(()=>N(e)):"complete"!==document.readyState?addEventListener("load",()=>N(e),!0):setTimeout(e)};var O=/^[A-Za-z0-9/_:.\-[\]{}*@~]+$/,U=/^[A-Za-z_$][A-Za-z0-9_$.]*$/,H=/^[A-Za-z0-9][A-Za-z0-9.+_-]*$/;var q=class{constructor(e){this.head=e}head;events=[];waiting=/* @__PURE__ */new Map;seen=/* @__PURE__ */new Set;get size(){return this.events.length}addVital(e){this.events.push(e)}addError(e){const t=function(e){return e.frames.length?`${e.name}|${e.frames.join("|")}`:`${e.name}|${e.message.replace(/\d/g,"0")}`}(e),n=this.waiting.get(t);return n?(n.count=Math.min(1e3,n.count+e.count),!0):!(this.seen.has(t)||this.seen.size>=20)&&(this.seen.add(t),this.waiting.set(t,e),this.events.push(e),!0)}drain(){const e=this.events;this.events=[],this.waiting.clear();const t=[],n=JSON.stringify({...this.head,events:[]}).length;let i=[],a=n;for(const r of e){const e=JSON.stringify(r).length+1;n+e>30720||((50===i.length||a+e>30720)&&(t.push({...this.head,events:i}),i=[],a=n),i.push(r),a+=e)}return i.length&&t.push({...this.head,events:i}),t}},J=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,K=/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*)?|\b[Bb]earer\s+[A-Za-z0-9._~+/=-]{8,}/g,D=/\b[a-z][a-z0-9+.-]*:\/\/\S+/gi,V=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,W=/\d{4,}/g,G=/(^|[/:])(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,})(?=$|[/:])/gi,Q=/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,X=/(?:\(|@|\bat\s+)?((?:[a-z][a-z0-9+.-]*:\/\/|\/)[^\s()@]*?):(\d+):(\d+)\)?\s*$/i;function Y(e,t,n){const i=e.replace(Q,"").split(/[?#]/,1)[0];return i?`${i}:${t}:${n}`.slice(0,256):null}function ee(e){if("string"!=typeof e)return[];const t=[];for(const n of e.split("\n")){const e=X.exec(n.trim()),i=e&&Y(e[1],e[2],e[3]);if(i&&t.push(i),5===t.length)break}return t}function te(e){const t=e instanceof Error?e.name:void 0;return"string"==typeof t&&t.length<=64&&U.test(t)?t:"Error"}function ne(e){if("string"!=typeof e)return"unknown";const t=e.trim().replace(Q,"").split(/[?#]/,1)[0].replace(G,(e,t)=>":"===t?":id":`${t}:id`);return t&&t.length<=128&&!t.includes("//")&&O.test(t)?t:"unknown"}var ie={flush(){},reportError(){},stop(){}},ae=null,re=/* @__PURE__ */new Set(["LCP","FCP","TTFB"]);function oe(e,t,n){const i=function(e){if(e.anonymous)return{credentials:"omit",headers:{"Content-Type":"application/json"}};const t=e.getAccessToken();return t?{credentials:"same-origin",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}}:null}(t);if(!i)return;const a=t.anonymous?"/api/storefront-analytics/web-vitals/":"/api/client-telemetry/web-batches/";n(t.endpoint??a,{...i,method:"POST",keepalive:!0,body:JSON.stringify(e)}).catch(e=>{console.debug("[efficient-shell] client telemetry batch dropped:",e)})}function se(e){((e,t={})=>{let n=!1;const s=w(t);C(()=>{let d,l=h(),u=g("LCP");const f=p(t,j),v=(i,a,o,s,c)=>{u=g("LCP",-1,i,a,o,s,c),d=r(e,u,x,t.reportAllChanges),n=!1,"soft-navigation"===i&&(l=h(!0))},m=e=>{f.l&&e.navigationId&&I(f.l,e),n||d(!0),v("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const t=e.getLargestInteractionContentfulPaint?.();t&&y([t])},y=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){m(t);continue}let e=0,n=[],i=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-c(),0),f.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){const a=t;if(!u.navigationId)continue;if("interactionId"in a&&a.interactionId!=u.navigationInteractionId)continue;i=a.largestContentfulPaint?.renderTime||0,e=Math.max(i-t.startTime,0),a.largestContentfulPaint&&(f.h(a.largestContentfulPaint),n=[a.largestContentfulPaint])}i<l.firstHiddenTime&&(u.value=e,u.entries=n,d())}},w=["largest-contentful-paint"];s&&w.push("interaction-contentful-paint","soft-navigation");const b=T(w,y);if(b){d=r(e,u,x,t.reportAllChanges);const c=["keydown","click","visibilitychange"],l=e=>{if(e.isTrusted&&!n){const e=u.id;Z(()=>{if(!n){if(!s){b.disconnect();for(const e of c)removeEventListener(e,l,{capture:!0})}e===u.id&&(n=!0,d(!0))}})}};for(const e of c)addEventListener(e,l,{capture:!0});a(a=>{v("back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),d=r(e,u,x,t.reportAllChanges),o(()=>{u.value=performance.now()-a.timeStamp,n=!0,d(!0)})})}})})(e),R(e),((e,t={})=>{const n=h();A(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,P,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,P,t.reportAllChanges),n.onHidden(()=>{h(m.takeRecords()),s(!0)}),a(()=>{l("back-forward-cache",c.navigationId,c.navigationInteractionId,c.navigationURL,i()),o(s)}),setTimeout(s))}))})(e),A(e),((e,t={})=>{const n=w(t);let o=g("TTFB"),d=r(e,o,B,t.reportAllChanges);N(()=>{const l=s();if(l){const s=l.responseStart;o.value=Math.max(s-c(),0),o.entries=[l],d(!0),a(()=>{o=g("TTFB",0,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,i()),d=r(e,o,B,t.reportAllChanges),d(!0)}),n&&T(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&(o=g("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),o.entries=[n],d=r(e,o,B,t.reportAllChanges),d(!0))})},t)}})})(e)}function ce(n){if(ae?.stop(),ae=null,!1===n.enabled||"undefined"==typeof window||"undefined"==typeof document)return ie;if(!function(e){const t="string"==typeof e.app&&H.test(e.app),n="string"==typeof e.release&&H.test(e.release);return t&&n||console.warn("[efficient-shell] client telemetry not started: `app` and `release` must be version-like strings."),t&&n}(n))return ie;const i=function(e){const t=e.vitalsSampleRate??1;return t>0&&(t>=1||(e.random??Math.random)()<t)}(n);if(n.anonymous&&!i)return ie;const a=n.fetch??window.fetch.bind(window),r=new q({app:n.app,release:n.release,shell_version:H.test(t)?t:""}),o=ne(n.routeKey()),s=function(e=("undefined"==typeof window?void 0:window)){if(!e)return"desktop";const t="function"==typeof e.matchMedia&&e.matchMedia("(pointer: coarse)").matches,n=e.innerWidth;return n<600?"mobile":t&&n<1280?"tablet":"desktop"}(window);let c=!1;const d=()=>{for(const e of r.drain())oe(e,n,a)},l=e=>{c||n.anonymous||(r.addError(e),r.size>=50&&d())},u=(e,t)=>{return{type:"error",source:t,name:te(e),message:(a=e,i=a instanceof Error?a.message:"string"==typeof a?a:a&&"object"==typeof a&&"string"==typeof a.message?a.message:"",i.slice(0,640).replace(J,"[redacted]").replace(K,"[redacted]").replace(D,"[url]").replace(V,"[id]").replace(W,"[n]").replace(/\s+/g," ").trim().slice(0,160)),frames:ee(e instanceof Error?e.stack:void 0),route:ne(n.routeKey()),count:1};var i,a};i&&(n.observeVitals??se)(e=>{c||(r.addVital(function(e,t,n,i){return{type:"vital",name:e.name,value:e.value,route:re.has(e.name)?t:n(),navigation:e.navigationType??"navigate",device:i}}(e,o,()=>ne(n.routeKey()),s)),r.size>=50&&d())});const f=n.anonymous?()=>{}:function(t,n){const i=e=>{const{error:i,message:a,filename:r,lineno:o,colno:s}=e;if(null!=i)return void t(n(i,"onerror"));const c=r?ee(`at ${r}:${o??0}:${s??0}`):[];t({...n(a??"","onerror"),frames:c})},a=e=>t(n(e.reason,"unhandledrejection"));window.addEventListener("error",i),window.addEventListener("unhandledrejection",a);const r=e(e=>t(n(e,"boundary")));return()=>{window.removeEventListener("error",i),window.removeEventListener("unhandledrejection",a),r()}}(l,u),h=()=>{"hidden"===document.visibilityState&&d()};document.addEventListener("visibilitychange",h),window.addEventListener("pagehide",d);const g=window.setInterval(d,n.flushIntervalMs??6e4),v={flush:d,reportError:e=>l(u(e,"boundary")),stop(){c||(d(),c=!0,f(),document.removeEventListener("visibilitychange",h),window.removeEventListener("pagehide",d),window.clearInterval(g),ae===v&&(ae=null))}};return ae=v,v}export{ce as startClientTelemetry};
@@ -1,4 +1,4 @@
1
- import{useWindowMenuItem as e,Modal as t}from"./chunk-TKPUYQ3Q.js";import{navIcons as r}from"./chunk-4LXCCZDM.js";import{VERSION as n}from"./chunk-3W4JUMFI.js";import{Icon as s}from"./chunk-JOAKKXTL.js";import{DEFAULT_SHELL_STRINGS as i,useShellStrings as o,splitAround as a}from"./chunk-JSHMIMAJ.js";import{useState as l,useCallback as m,isValidElement as c,cloneElement as p}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";var h=i.aboutApp,x={notepad:{name:"Notepad",version:"1.1.0",route:"/notepad",description:h.notepad},preview:{name:"Preview",version:"1.4.3",route:"/preview",description:h.preview},files:{name:"Files",version:"2.0.0",route:"/files",description:h.files},browser:{name:"Browser",version:"1.0.3",route:"/browser",description:h.browser}},u=/* @__PURE__ */d(s,{name:"info",className:"h-4 w-4",strokeWidth:1.5}),w=/* @__PURE__ */d(s,{name:"window",className:"h-9 w-9",strokeWidth:1.5});function v({app:s}){const i=x[s],[h,v]=l(!1),N=m(()=>v(!0),[]),b=o().aboutApp,k=b.title(i.name);if(e(k,N,u),!h)return null;const g=r[i.route],y=c(g)?p(g,{className:"h-9 w-9"}):w,[j,A]=a(b.partOf);/* @__PURE__ */
1
+ import{useWindowMenuItem as e,Modal as t}from"./chunk-TKPUYQ3Q.js";import{navIcons as r}from"./chunk-4LXCCZDM.js";import{VERSION as n}from"./chunk-LAOG7AED.js";import{Icon as s}from"./chunk-JOAKKXTL.js";import{DEFAULT_SHELL_STRINGS as i,useShellStrings as o,splitAround as a}from"./chunk-JSHMIMAJ.js";import{useState as l,useCallback as m,isValidElement as c,cloneElement as p}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";var h=i.aboutApp,x={notepad:{name:"Notepad",version:"1.1.0",route:"/notepad",description:h.notepad},preview:{name:"Preview",version:"1.4.3",route:"/preview",description:h.preview},files:{name:"Files",version:"2.0.0",route:"/files",description:h.files},browser:{name:"Browser",version:"1.0.3",route:"/browser",description:h.browser}},u=/* @__PURE__ */d(s,{name:"info",className:"h-4 w-4",strokeWidth:1.5}),w=/* @__PURE__ */d(s,{name:"window",className:"h-9 w-9",strokeWidth:1.5});function v({app:s}){const i=x[s],[h,v]=l(!1),N=m(()=>v(!0),[]),b=o().aboutApp,k=b.title(i.name);if(e(k,N,u),!h)return null;const g=r[i.route],y=c(g)?p(g,{className:"h-9 w-9"}):w,[j,A]=a(b.partOf);/* @__PURE__ */
2
2
  return d(t,{open:!0,onClose:()=>v(!1),title:k,size:"sm",compact:!0,bodyScroll:!1,autoHeight:!0,dimensions:[320,320],children:/* @__PURE__ */f("div",{className:"flex flex-col items-center text-center px-5 pt-5 pb-4",children:[
3
3
  /* @__PURE__ */d("div",{className:"flex h-16 w-16 items-center justify-center rounded-2xl bg-gray-100 text-gray-600 shrink-0",children:y}),
4
4
  /* @__PURE__ */d("h2",{className:"mt-3 text-lg font-bold text-gray-900",children:i.name}),
@@ -1,22 +1,22 @@
1
- import{ChartBrush as t}from"./chunk-TU2L7NW3.js";import{ChartDot as e}from"./chunk-CK2YOGUS.js";import{stepPath as a,curvePath as r,areaBetween as o,areaFrom as l}from"./chunk-VFC6QUEN.js";import{ChartDefs as n,MOTION as i,stagger as s,fillFor as c,dashFor as d,maskId as m}from"./chunk-465RRWBY.js";import{ChartSkeleton as h}from"./chunk-WXZZGHET.js";import{useHighlight as u,highlightOpacity as f}from"./chunk-CNYAHYE6.js";import{useDragZoom as p,DragBand as g,ChartZoomSummary as y,tooltipBesideBand as k}from"./chunk-2DYVVHZA.js";import{usePlotWidth as x}from"./chunk-MAFUXCPZ.js";import{pairedAxes as v,niceAxis as b,niceMax as M,linearScale as N,axisGutter as w,bandScale as j,ladderScale as $}from"./chunk-2JWPNR2U.js";import{ChartTooltip as V}from"./chunk-WDQI3FV6.js";import{resolveSeriesColor as A,CHART_INK as W,STATUS_VARS as z}from"./chunk-TZFACUMR.js";import{registerModalEscapeInterceptor as L}from"./chunk-TWVUQUUD.js";import{useShellStrings as S,useShellLocale as D}from"./chunk-JSHMIMAJ.js";import{formatPercent as E,formatPlain as R}from"./chunk-C3QOHMR6.js";import{useRef as C,useState as T,useId as U,useEffect as I}from"react";import{jsx as P,jsxs as F}from"react/jsx-runtime";var H=12,O=16,Y=26,Z=52,B=t=>"number"==typeof t&&Number.isFinite(t);function Q({series:Q,labels:J,height:G=200,stacked:K=!1,stackMode:X="value",levels:q,curve:_="linear",tension:tt=0,max:et,yTickCount:at=4,formatValue:rt,formatTooltipValue:ot,tooltipLabels:lt,yAxisLabel:nt,referenceLines:it,labelEndpoints:st=!1,dots:ct,dotVariant:dt="border",pulse:mt=!1,brush:ht=!1,range:ut,onRangeChange:ft,zoomable:pt=!0,columnStrip:gt,onSelect:yt,loading:kt=!1,animate:xt=!0,reveal:vt="left-to-right",fillVariant:bt="gradient",gridStyle:Mt="solid",width:Nt,className:wt,emptyLabel:jt}){const $t=S().charts,Vt=D(),At=rt??(t=>R(t,Vt)),Wt=ot??At,zt=jt??$t.noData,Lt=C(null),St=x(Lt),Dt=Nt??St,[Et,Rt]=T(null),[Ct,Tt]=T(null),{highlighted:Ut}=u(),It=U(),Pt=ut??Ct,Ft=p(ht&&Pt?Pt[1]-Pt[0]+1:J.length,pt);if(I(()=>{if(null!==Et)return L(t=>"Escape"===t.key&&(Rt(null),!0))},[Et]),kt)/* @__PURE__ */
2
- return P("div",{className:wt,ref:Lt,children:/* @__PURE__ */P(h,{height:G,width:Nt??St})});const Ht=J,Ot=ut??Ct??[0,Math.max(0,Ht.length-1)],[Yt,Zt]=Ot,Bt=t=>Ft.slice(ht?t.slice(Yt,Zt+1):t),Qt=lt?Bt(lt):void 0,Jt=Q.map((t,e)=>({...t,slot:e})).filter(t=>t.data.some(B)).map(t=>({...t,data:Bt(t.data),pointTones:t.pointTones?Bt(t.pointTones):void 0})),Gt=t=>(ht?Yt:0)+(Ft.view?.[0]??0)+t;if(J=Bt(Ht),0===Jt.length||0===J.length)/* @__PURE__ */
1
+ import{ChartDefs as t,MOTION as e,stagger as a,fillFor as r,dashFor as o,maskId as l}from"./chunk-465RRWBY.js";import{ChartBrush as n}from"./chunk-TU2L7NW3.js";import{ChartDot as i}from"./chunk-CK2YOGUS.js";import{ChartSkeleton as s}from"./chunk-WXZZGHET.js";import{stepPath as c,curvePath as d,areaBetween as m,areaFrom as h}from"./chunk-VFC6QUEN.js";import{useHighlight as u,highlightOpacity as f}from"./chunk-CNYAHYE6.js";import{useDragZoom as p,DragBand as g,ChartZoomSummary as y,tooltipBesideBand as k}from"./chunk-2DYVVHZA.js";import{usePlotWidth as x}from"./chunk-MAFUXCPZ.js";import{pairedAxes as v,niceAxis as b,niceMax as M,linearScale as N,axisGutter as w,bandScale as j,ladderScale as $}from"./chunk-2JWPNR2U.js";import{ChartTooltip as V}from"./chunk-WDQI3FV6.js";import{resolveSeriesColor as A,CHART_INK as W,STATUS_VARS as z}from"./chunk-TZFACUMR.js";import{registerModalEscapeInterceptor as L}from"./chunk-TWVUQUUD.js";import{useShellStrings as S,useShellLocale as D}from"./chunk-JSHMIMAJ.js";import{formatPercent as E,formatPlain as R}from"./chunk-C3QOHMR6.js";import{useRef as C,useState as T,useId as U,useEffect as I}from"react";import{jsx as P,jsxs as F}from"react/jsx-runtime";var H=12,O=16,Y=26,Z=52,B=t=>"number"==typeof t&&Number.isFinite(t);function Q({series:Q,labels:J,height:G=200,stacked:K=!1,stackMode:X="value",levels:q,curve:_="linear",tension:tt=0,max:et,yTickCount:at=4,formatValue:rt,formatTooltipValue:ot,tooltipLabels:lt,yAxisLabel:nt,referenceLines:it,labelEndpoints:st=!1,dots:ct,dotVariant:dt="border",pulse:mt=!1,brush:ht=!1,range:ut,onRangeChange:ft,zoomable:pt=!0,columnStrip:gt,onSelect:yt,loading:kt=!1,animate:xt=!0,reveal:vt="left-to-right",fillVariant:bt="gradient",gridStyle:Mt="solid",width:Nt,className:wt,emptyLabel:jt}){const $t=S().charts,Vt=D(),At=rt??(t=>R(t,Vt)),Wt=ot??At,zt=jt??$t.noData,Lt=C(null),St=x(Lt),Dt=Nt??St,[Et,Rt]=T(null),[Ct,Tt]=T(null),{highlighted:Ut}=u(),It=U(),Pt=ut??Ct,Ft=p(ht&&Pt?Pt[1]-Pt[0]+1:J.length,pt);if(I(()=>{if(null!==Et)return L(t=>"Escape"===t.key&&(Rt(null),!0))},[Et]),kt)/* @__PURE__ */
2
+ return P("div",{className:wt,ref:Lt,children:/* @__PURE__ */P(s,{height:G,width:Nt??St})});const Ht=J,Ot=ut??Ct??[0,Math.max(0,Ht.length-1)],[Yt,Zt]=Ot,Bt=t=>Ft.slice(ht?t.slice(Yt,Zt+1):t),Qt=lt?Bt(lt):void 0,Jt=Q.map((t,e)=>({...t,slot:e})).filter(t=>t.data.some(B)).map(t=>({...t,data:Bt(t.data),pointTones:t.pointTones?Bt(t.pointTones):void 0})),Gt=t=>(ht?Yt:0)+(Ft.view?.[0]??0)+t;if(J=Bt(Ht),0===Jt.length||0===J.length)/* @__PURE__ */
3
3
  return P("div",{className:wt,ref:Lt,children:/* @__PURE__ */P("p",{className:"flex items-center justify-center text-sm text-gray-500",style:{height:G},children:zt})});const Kt=J.map((t,e)=>Jt.reduce((t,a)=>t+(B(a.data[e])?a.data[e]:0),0)),Xt=(t,e)=>Kt[e]>0?t/Kt[e]:null,qt=[];if(K){let t=J.map(()=>0);for(const e of Jt)t=t.map((t,a)=>t+(B(e.data[a])?e.data[a]:0)),qt.push("percent"===X?t.map((t,e)=>Xt(t,e)):[...t])}const _t=!!q&&q.length>0,te=t=>"right"===t.axis,ee=!K&&!_t&&void 0===et&&Jt.some(te)&&Jt.some(t=>!te(t)),ae=gt&&!K?gt:null,re=t=>!!ae&&"column"===t.mode,oe=(ee?Jt.filter(t=>!te(t)):Jt).filter(t=>!re(t)),le=ee?Jt.filter(te).flatMap(t=>t.data.filter(B)):[],ne=K?(qt.at(-1)??[]).filter(B):oe.flatMap(t=>t.data.filter(B)),ie=ee?v([Math.min(0,...ne),Math.max(0,...ne)],[Math.min(0,...le),Math.max(0,...le)],{intervals:at+1,integerLeft:ne.every(Number.isInteger),integerRight:le.every(Number.isInteger)}):null,se=ie?ie.left:K&&"percent"===X||_t||void 0!==et?null:b(K?0:Math.min(0,...ne),Math.max(0,...ne),{intervals:at+1,integer:ne.every(Number.isInteger)}),ce=se?se.lo:0,de=K&&"percent"===X?1:se?se.hi:et??M(Math.max(...ne,0)),me=K&&"percent"===X?t=>E(Math.round(100*t),0,Vt):At,he=_t?q:se?se.ticks:N([ce,de],{from:0,to:1}).ticks(at+1),ue=w(he.map(me),Z),fe=ie?w(ie.right.ticks.map(At),O):O,pe={left:ue,right:Math.max(ue+1,Dt-fe),top:H,bottom:G-Y},ge=j(J.length,{from:pe.left,to:pe.right}),ye=_t?$(q,{from:pe.bottom,to:pe.top}):null,ke=N([ce,de],{from:pe.bottom,to:pe.top}),xe=ke(Math.max(ce,0)),ve=t=>ye?ye(t):ke(t),be=Jt.filter(re),Me=Math.max(0,...J.map((t,e)=>be.reduce((t,a)=>t+Math.max(0,B(a.data[e])?a.data[e]:0),0))),Ne=t=>xe-(Me>0?t/Me:0)*(pe.bottom-pe.top)*(ae??0),we=ie?N([ie.right.lo,ie.right.hi],{from:pe.bottom,to:pe.top}):null,je=t=>we&&te(t)?we:ve,$e=ye?ye.levels.map(t=>({value:t,y:ye(t)})):he.map(t=>({value:t,y:ke(t)})),Ve=t=>e=>{e.preventDefault(),Rt(e=>{const a=(e??0)+t;return Math.min(J.length-1,Math.max(0,a))})},Ae=Math.max(1,Math.ceil(J.length/Math.max(1,Math.floor(Dt/96))));/* @__PURE__ */
4
4
  return F("div",{className:`relative ${wt??""}`,ref:Lt,children:[
5
5
  /* @__PURE__ */F("svg",{width:"100%",height:G,viewBox:`0 0 ${Dt} ${G}`,role:"img","aria-label":$t.overIntervals(Jt.map(t=>t.label),J.length),tabIndex:0,className:"rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-deep)]",onMouseLeave:()=>Rt(null),onBlur:()=>Rt(null),style:pt?{userSelect:"none",touchAction:"pan-y"}:void 0,onKeyDown:t=>{if(yt&&null!==Et&&("Enter"===t.key||" "===t.key))return t.preventDefault(),void yt(Gt(Et));"ArrowRight"===t.key&&Ve(1)(t),"ArrowLeft"===t.key&&Ve(-1)(t)},children:[
6
6
  /* @__PURE__ */P("defs",{children:/* @__PURE__ */P("clipPath",{id:It,children:/* @__PURE__ */P("rect",{x:pe.left,y:pe.top,width:pe.right-pe.left,height:pe.bottom-pe.top})})}),
7
- /* @__PURE__ */P(n,{id:It,fills:Jt.map((t,e)=>({color:A(t.slot,t.color,t.tone),variant:t.fillVariant??bt})),fadeFrom:K?.42:.3,reveal:!!xt&&vt}),$e.map(t=>/* @__PURE__ */P("line",{x1:pe.left,y1:t.y,x2:pe.right,y2:t.y,stroke:W.grid,strokeWidth:1,shapeRendering:"crispEdges",strokeDasharray:"dashed"===Mt?"3 3":void 0},`grid-${t.value}`)),
7
+ /* @__PURE__ */P(t,{id:It,fills:Jt.map((t,e)=>({color:A(t.slot,t.color,t.tone),variant:t.fillVariant??bt})),fadeFrom:K?.42:.3,reveal:!!xt&&vt}),$e.map(t=>/* @__PURE__ */P("line",{x1:pe.left,y1:t.y,x2:pe.right,y2:t.y,stroke:W.grid,strokeWidth:1,shapeRendering:"crispEdges",strokeDasharray:"dashed"===Mt?"3 3":void 0},`grid-${t.value}`)),
8
8
  /* @__PURE__ */P("line",{x1:pe.left,y1:xe,x2:pe.right,y2:xe,stroke:W.axis,strokeWidth:1,shapeRendering:"crispEdges"}),$e.map(t=>/* @__PURE__ */P("text",{x:pe.left-8,y:t.y+4,textAnchor:"end","data-axis-tick":"true",fontSize:11,fill:W.label,style:{fontVariantNumeric:"tabular-nums"},children:me(t.value)},`ytick-${t.value}`)),ie&&$e.map((t,e)=>/* @__PURE__ */P("text",{x:pe.right+8,y:t.y+4,textAnchor:"start","data-axis-tick":"true",fontSize:11,fill:W.label,style:{fontVariantNumeric:"tabular-nums"},children:At(ie.right.ticks[e])},`ytick-r-${t.value}`)),nt&&/* @__PURE__ */P("text",{x:12,y:(pe.top+pe.bottom)/2,transform:`rotate(-90 12 ${(pe.top+pe.bottom)/2})`,textAnchor:"middle",fontSize:11,fill:W.label,children:nt}),
9
- /* @__PURE__ */P("g",{clipPath:`url(#${It})`,mask:xt&&vt?`url(#${m(It)})`:void 0,children:Jt.map((t,e)=>{const n=A(t.slot,t.color,t.tone),m=t.mode??(K?"area":"line"),h=f(t.key,Ut);if("step"===m){const e=J.map((e,a)=>({start:ge(a),end:ge.end(a),value:t.data[a]})).filter(t=>B(t.value)).map(e=>({start:e.start,end:e.end,y:je(t)(e.value)}));/* @__PURE__ */
10
- return P("path",{d:a(e),fill:"none",stroke:n,strokeWidth:2.5,strokeLinecap:"butt",strokeLinejoin:"miter",opacity:h??void 0,className:"rosh-viz-mark"},t.key)}const u=J.map((a,r)=>{const o=K?qt[e]?.[r]:t.data[r];return B(o)?[ge.center(r),je(t)(o)]:null}).filter(t=>null!==t);if(0===u.length)return null;if("column"===m){const a=Math.max(1,.62*ge.bandwidth),r="solid"===t.fillVariant,o=je(t);return re(t)?/* @__PURE__ */P("g",{opacity:h??void 0,className:"rosh-viz-mark",children:J.map((o,l)=>{const i=t.data[l];if(!B(i)||i<=0)return null;const s=((t,e)=>be.slice(0,be.findIndex(e=>e.key===Jt[t]?.key)).reduce((t,a)=>t+Math.max(0,B(a.data[e])?a.data[e]:0),0))(e,l),c=Ne(s+i),d=Ne(s)-(s>0?1:0);/* @__PURE__ */
11
- return P("rect",{x:ge.center(l)-a/2,y:c,width:a,height:Math.max(0,d-c),rx:2,fill:t.pointTones?.[l]?z[t.pointTones[l]]:n,fillOpacity:r?1:.55},l)})},t.key):/* @__PURE__ */P("g",{opacity:h??void 0,className:"rosh-viz-mark",children:J.map((l,c)=>{const d=K?qt[e]?.[c]:t.data[c];if(!B(d))return null;const m=o(d);/* @__PURE__ */
12
- return P("rect",{x:ge.center(c)-a/2,y:Math.min(m,xe),width:a,height:Math.abs(xe-m),rx:2,fill:n,fillOpacity:r?1:.35,className:xt?i.rise:void 0,style:xt?s(c,26):void 0},c)})},t.key)}const p=r(u,_,tt),g=K&&e>0?J.map((t,a)=>[ge.center(a),ve(qt[e-1]?.[a]??0)-2]):null,y=g?o(p,g):l(p,u,xe);/* @__PURE__ */
13
- return F("g",{opacity:h??void 0,className:"rosh-viz-mark",children:[("area"===m||K)&&
14
- /* @__PURE__ */P("path",{d:y,fill:c(It,e,t.fillVariant??bt,n),stroke:"none"}),
15
- /* @__PURE__ */P("path",{d:p,fill:"none",stroke:n,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",strokeDasharray:d(t.stroke??(t.forecast?"animated-dashed":"solid")),className:xt&&("animated-dashed"===t.stroke||t.forecast&&!t.stroke)?i.march:void 0})]},t.key)})}),it?.map((t,e)=>{const a=t.color??z[t.tone??"critical"],r=ve(t.value);/* @__PURE__ */
9
+ /* @__PURE__ */P("g",{clipPath:`url(#${It})`,mask:xt&&vt?`url(#${l(It)})`:void 0,children:Jt.map((t,l)=>{const n=A(t.slot,t.color,t.tone),i=t.mode??(K?"area":"line"),s=f(t.key,Ut);if("step"===i){const e=J.map((e,a)=>({start:ge(a),end:ge.end(a),value:t.data[a]})).filter(t=>B(t.value)).map(e=>({start:e.start,end:e.end,y:je(t)(e.value)}));/* @__PURE__ */
10
+ return P("path",{d:c(e),fill:"none",stroke:n,strokeWidth:2.5,strokeLinecap:"butt",strokeLinejoin:"miter",opacity:s??void 0,className:"rosh-viz-mark"},t.key)}const u=J.map((e,a)=>{const r=K?qt[l]?.[a]:t.data[a];return B(r)?[ge.center(a),je(t)(r)]:null}).filter(t=>null!==t);if(0===u.length)return null;if("column"===i){const r=Math.max(1,.62*ge.bandwidth),o="solid"===t.fillVariant,i=je(t);return re(t)?/* @__PURE__ */P("g",{opacity:s??void 0,className:"rosh-viz-mark",children:J.map((e,a)=>{const i=t.data[a];if(!B(i)||i<=0)return null;const s=((t,e)=>be.slice(0,be.findIndex(e=>e.key===Jt[t]?.key)).reduce((t,a)=>t+Math.max(0,B(a.data[e])?a.data[e]:0),0))(l,a),c=Ne(s+i),d=Ne(s)-(s>0?1:0);/* @__PURE__ */
11
+ return P("rect",{x:ge.center(a)-r/2,y:c,width:r,height:Math.max(0,d-c),rx:2,fill:t.pointTones?.[a]?z[t.pointTones[a]]:n,fillOpacity:o?1:.55},a)})},t.key):/* @__PURE__ */P("g",{opacity:s??void 0,className:"rosh-viz-mark",children:J.map((s,c)=>{const d=K?qt[l]?.[c]:t.data[c];if(!B(d))return null;const m=i(d);/* @__PURE__ */
12
+ return P("rect",{x:ge.center(c)-r/2,y:Math.min(m,xe),width:r,height:Math.abs(xe-m),rx:2,fill:n,fillOpacity:o?1:.35,className:xt?e.rise:void 0,style:xt?a(c,26):void 0},c)})},t.key)}const p=d(u,_,tt),g=K&&l>0?J.map((t,e)=>[ge.center(e),ve(qt[l-1]?.[e]??0)-2]):null,y=g?m(p,g):h(p,u,xe);/* @__PURE__ */
13
+ return F("g",{opacity:s??void 0,className:"rosh-viz-mark",children:[("area"===i||K)&&
14
+ /* @__PURE__ */P("path",{d:y,fill:r(It,l,t.fillVariant??bt,n),stroke:"none"}),
15
+ /* @__PURE__ */P("path",{d:p,fill:"none",stroke:n,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",strokeDasharray:o(t.stroke??(t.forecast?"animated-dashed":"solid")),className:xt&&("animated-dashed"===t.stroke||t.forecast&&!t.stroke)?e.march:void 0})]},t.key)})}),it?.map((t,e)=>{const a=t.color??z[t.tone??"critical"],r=ve(t.value);/* @__PURE__ */
16
16
  return F("g",{children:[
17
- /* @__PURE__ */P("line",{x1:pe.left,y1:r,x2:pe.right,y2:r,stroke:a,strokeWidth:1,strokeDasharray:"5 4"}),t.label&&/* @__PURE__ */P("text",{x:pe.right-4,y:r-5,textAnchor:"end",fontSize:11,fontWeight:600,fill:a,children:t.label})]},`rule-${e}`)}),"none"!==(ct??(st?"last":"none"))&&Jt.map((t,a)=>{if("column"===t.mode)return null;const r=ct??(st?"last":"none"),o=A(t.slot,t.color,t.tone),l=[...t.data].map(B).lastIndexOf(!0),n="all"===r?J.map((t,e)=>e).filter(e=>B(K?qt[a]?.[e]:t.data[e])):l>=0?[l]:[];/* @__PURE__ */
18
- return F("g",{children:[n.map(r=>{const n=K?qt[a]?.[r]:t.data[r];return B(n)?/* @__PURE__ */P(e,{cx:ge.center(r),cy:je(t)(n),color:o,variant:dt,pulse:mt&&r===l,title:`${J[r]}: ${t.label} ${At(n)}`},r):null}),st&&l>=0&&B(K?qt[a]?.[l]:t.data[l])&&/* @__PURE__ */P("text",{x:ge.center(l)-10,y:je(t)(K?qt[a]?.[l]:t.data[l])-9,textAnchor:"end",fontSize:12,fontWeight:600,fill:W.label,style:{fontVariantNumeric:"tabular-nums"},children:At(K?qt[a]?.[l]:t.data[l])})]},`dots-${t.key}`)}),J.map((t,e)=>e%Ae===0?/* @__PURE__ */P("text",{x:ge.center(e),y:G-8,textAnchor:"middle",fontSize:11,fill:W.label,style:{fontVariantNumeric:"tabular-nums"},children:t},`xtick-${e}`):null),null!==Et&&/* @__PURE__ */P("line",{x1:ge.center(Et),y1:pe.top,x2:ge.center(Et),y2:pe.bottom,stroke:W.axis,strokeWidth:1}),ae&&Me>0&&
17
+ /* @__PURE__ */P("line",{x1:pe.left,y1:r,x2:pe.right,y2:r,stroke:a,strokeWidth:1,strokeDasharray:"5 4"}),t.label&&/* @__PURE__ */P("text",{x:pe.right-4,y:r-5,textAnchor:"end",fontSize:11,fontWeight:600,fill:a,children:t.label})]},`rule-${e}`)}),"none"!==(ct??(st?"last":"none"))&&Jt.map((t,e)=>{if("column"===t.mode)return null;const a=ct??(st?"last":"none"),r=A(t.slot,t.color,t.tone),o=[...t.data].map(B).lastIndexOf(!0),l="all"===a?J.map((t,e)=>e).filter(a=>B(K?qt[e]?.[a]:t.data[a])):o>=0?[o]:[];/* @__PURE__ */
18
+ return F("g",{children:[l.map(a=>{const l=K?qt[e]?.[a]:t.data[a];return B(l)?/* @__PURE__ */P(i,{cx:ge.center(a),cy:je(t)(l),color:r,variant:dt,pulse:mt&&a===o,title:`${J[a]}: ${t.label} ${At(l)}`},a):null}),st&&o>=0&&B(K?qt[e]?.[o]:t.data[o])&&/* @__PURE__ */P("text",{x:ge.center(o)-10,y:je(t)(K?qt[e]?.[o]:t.data[o])-9,textAnchor:"end",fontSize:12,fontWeight:600,fill:W.label,style:{fontVariantNumeric:"tabular-nums"},children:At(K?qt[e]?.[o]:t.data[o])})]},`dots-${t.key}`)}),J.map((t,e)=>e%Ae===0?/* @__PURE__ */P("text",{x:ge.center(e),y:G-8,textAnchor:"middle",fontSize:11,fill:W.label,style:{fontVariantNumeric:"tabular-nums"},children:t},`xtick-${e}`):null),null!==Et&&/* @__PURE__ */P("line",{x1:ge.center(Et),y1:pe.top,x2:ge.center(Et),y2:pe.bottom,stroke:W.axis,strokeWidth:1}),ae&&Me>0&&
19
19
  /* @__PURE__ */F("g",{pointerEvents:"none","data-column-strip":"true",children:[
20
20
  /* @__PURE__ */P("line",{x1:pe.left,y1:Ne(Me),x2:pe.right,y2:Ne(Me),stroke:W.grid,strokeWidth:1,strokeDasharray:"2 3",shapeRendering:"crispEdges"}),
21
- /* @__PURE__ */P("text",{x:pe.left+4,y:Ne(Me)-4,fontSize:11,fill:W.label,style:{fontVariantNumeric:"tabular-nums"},children:At(Me)})]}),Ft.drag&&/* @__PURE__ */P(g,{x0:ge(Ft.drag[0]),x1:ge(Ft.drag[1])+ge.bandwidth,top:pe.top,bottom:pe.bottom}),J.map((t,e)=>/* @__PURE__ */P("rect",{x:ge(e),y:pe.top,width:Math.max(1,ge.bandwidth),height:pe.bottom-pe.top,fill:"transparent",onMouseEnter:()=>Rt(e),onPointerDown:()=>Ft.press(e),onPointerEnter:()=>Ft.over(e),onPointerUp:Ft.release,onClick:yt?()=>yt(Gt(e)):void 0,style:yt?{cursor:"pointer"}:void 0},`hit-${e}`))]}),Ft.view&&/* @__PURE__ */P(y,{from:Qt?.[0]??J[0],to:Qt?.at(-1)??J[J.length-1],count:J.length,total:K&&"percent"!==X?Wt(Kt.reduce((t,e)=>t+e,0)):ae?Wt(be.reduce((t,e)=>t+e.data.filter(B).reduce((t,e)=>t+e,0),0)):void 0,rows:(ae?be:Jt).filter(t=>t.data.some(B)).map(t=>{const e=t.data.filter(B),a=A(t.slot,t.color,t.tone);if(0===e.length)return{key:t.key,label:t.label,color:a,value:"—"};const r=e.reduce((t,e)=>t+e,0),o=K||"column"===t.mode?Wt(r):$t.zoomLevel(Wt(r/e.length),Wt(Math.max(...e)));return{key:t.key,label:t.label,color:a,value:o}}),onClear:Ft.clear}),ht&&Ht.length>2&&/* @__PURE__ */P(t,{className:"mt-1",labels:Ht,width:Dt,data:Q[0]?.data??[],range:Ot,onRangeChange:t=>{ft?ft(t):Tt(t)}}),null!==Et&&
21
+ /* @__PURE__ */P("text",{x:pe.left+4,y:Ne(Me)-4,fontSize:11,fill:W.label,style:{fontVariantNumeric:"tabular-nums"},children:At(Me)})]}),Ft.drag&&/* @__PURE__ */P(g,{x0:ge(Ft.drag[0]),x1:ge(Ft.drag[1])+ge.bandwidth,top:pe.top,bottom:pe.bottom}),J.map((t,e)=>/* @__PURE__ */P("rect",{x:ge(e),y:pe.top,width:Math.max(1,ge.bandwidth),height:pe.bottom-pe.top,fill:"transparent",onMouseEnter:()=>Rt(e),onPointerDown:()=>Ft.press(e),onPointerEnter:()=>Ft.over(e),onPointerUp:Ft.release,onClick:yt?()=>yt(Gt(e)):void 0,style:yt?{cursor:"pointer"}:void 0},`hit-${e}`))]}),Ft.view&&/* @__PURE__ */P(y,{from:Qt?.[0]??J[0],to:Qt?.at(-1)??J[J.length-1],count:J.length,total:K&&"percent"!==X?Wt(Kt.reduce((t,e)=>t+e,0)):ae?Wt(be.reduce((t,e)=>t+e.data.filter(B).reduce((t,e)=>t+e,0),0)):void 0,rows:(ae?be:Jt).filter(t=>t.data.some(B)).map(t=>{const e=t.data.filter(B),a=A(t.slot,t.color,t.tone);if(0===e.length)return{key:t.key,label:t.label,color:a,value:"—"};const r=e.reduce((t,e)=>t+e,0),o=K||"column"===t.mode?Wt(r):$t.zoomLevel(Wt(r/e.length),Wt(Math.max(...e)));return{key:t.key,label:t.label,color:a,value:o}}),onClear:Ft.clear}),ht&&Ht.length>2&&/* @__PURE__ */P(n,{className:"mt-1",labels:Ht,width:Dt,data:Q[0]?.data??[],range:Ot,onRangeChange:t=>{ft?ft(t):Tt(t)}}),null!==Et&&
22
22
  /* @__PURE__ */P("div",{className:"pointer-events-none absolute top-2 z-10",style:k(ge.center(Et),ge.bandwidth,Dt),children:/* @__PURE__ */P(V,{title:Qt?.[Et]??J[Et],rows:Jt.map((t,e)=>({key:t.key,label:t.label,color:A(t.slot,t.color,t.tone),value:B(t.data[Et])?K&&"percent"===X?`${E(100*(Xt(t.data[Et],Et)??0),1,Vt)} · ${Wt(t.data[Et])}`:Wt(t.data[Et]):void 0})),footnote:K&&"percent"===X?$t.inBucket(Wt(Kt[Et])):void 0})})]})}export{Q as TimeSeriesChart};
@@ -0,0 +1,6 @@
1
+ import{InputNumber_default as e}from"./chunk-RMDVKQJE.js";import{useSettingAuto as t}from"./chunk-2NMW66P5.js";import{Tooltip as n}from"./chunk-SOZCWT6I.js";import{useBrowserLayoutEffect as i}from"./chunk-D65T4H6J.js";import{useShellStrings as r}from"./chunk-JSHMIMAJ.js";import{createContext as o,useState as l,useMemo as a,useId as d,useRef as s,useContext as u,useEffect as c}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";var m=(e,t,n)=>Math.min(n,Math.max(t,e));function h(e){const t=String(e),n=/e-(\d+)$/.exec(t);return n?Number(n[1]):t.split(".")[1]?.length??0}var x={sm:{left:10,plain:8,unit:40,text:"text-xs"},md:{left:14,plain:12,unit:40,text:"text-sm"}},v={"--rosh-slider-gap":"var(--space-12)","--rosh-slider-floor":"4rem"},b={position:"absolute",left:0,top:0,width:"max-content",height:0,overflow:"hidden",visibility:"hidden",pointerEvents:"none",whiteSpace:"pre"},g={display:"block",width:"max-content"},w=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u;function y(e){return Math.max(1,...e.map(e=>[...e??""].reduce((e,t)=>e+(w.test(t)?2:1),0)))}function S(e,t,n,i){return Number(m(e,t,n).toFixed(i))}var z=o(null);function F({children:e}){const[t,n]=l({}),i=a(()=>(e,t)=>n(n=>{if(null===t){if(!(e in n))return n;const t={...n};return delete t[e],t}return n[e]===t?n:{...n,[e]:t}}),[]),r=a(()=>{const e=Object.values(t);return{set:i,width:e.length?`max(${e.join(", ")})`:null}},[t,i]);/* @__PURE__ */
2
+ return f(z.Provider,{value:r,children:e})}function k({value:o,onChange:a,min:w,max:F,step:k=1,shiftStep:N,precision:M,inputMin:R,inputMax:j,suffix:L,showInput:$=!0,emptyLabel:C,placeholderValue:E,stepFrom:K,label:W,"aria-labelledby":O,valueText:A,id:B,disabled:D,size:H="md",boxSize:V="sm",className:q="",auto:J}){const I=r(),T=d(),P=t(),Q=J??P,U=d(),Z=B??T,G=M??h(k),X=R??w,Y=j??F,_=void 0!==C||void 0!==E,ee=K??E,te=m(o??E??w,w,F),ne=[w.toFixed(G),F.toFixed(G),o?.toFixed(G),C,E?.toFixed(G)],ie=null!=o?o.toFixed(G):C||(null!=E?E.toFixed(G):void 0),re=s(null),oe=s(null),[le,ae]=l(null),de=s(null),se=Boolean(L);i(()=>{if(!$)return;const e=()=>{const e=re.current?.querySelector("input"),t=oe.current;if(!e||!t)return;const n=getComputedStyle(e),i=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"].reduce((e,t)=>e+(parseFloat(n[t])||0),0);if(i<=0)return;Object.assign(t.style,{fontFamily:n.fontFamily,fontSize:n.fontSize,fontWeight:n.fontWeight,fontVariantNumeric:n.fontVariantNumeric,letterSpacing:n.letterSpacing});const r=Math.ceil(t.getBoundingClientRect().width);if(r<=0)return;const o=t.querySelector("[data-shown]"),l=e.clientWidth-(parseFloat(n.paddingLeft)||0)-(parseFloat(n.paddingRight)||0),a=!!o&&o.getBoundingClientRect().width>l+.5,d=de.current;if(de.current={box:d?.box??{frame:i,fontSize:n.fontSize,text:r,cut:a},room:l},d&&d.box.frame===i&&d.box.fontSize===n.fontSize&&d.box.text===r&&d.box.cut===a)return;const s={frame:i,fontSize:n.fontSize,text:r,cut:a};de.current={box:s,room:l},ae(s)};e(),window.addEventListener("resize",e);const t="undefined"!=typeof document?document.fonts:void 0;t?.addEventListener?.("loadingdone",e);let n=null;if("undefined"!=typeof ResizeObserver){n=new ResizeObserver(()=>e());const t=re.current?.querySelector("input");t&&n.observe(t),oe.current&&n.observe(oe.current)}return()=>{window.removeEventListener("resize",e),t?.removeEventListener?.("loadingdone",e),n?.disconnect()}},[se,$,V]),i(()=>{const e=de.current;if(!e)return;const t=e.box.text<=e.room+.5?null:oe.current?.querySelector("[data-shown]"),n=!!t&&t.getBoundingClientRect().width>e.room+.5;if(n===e.box.cut)return;const i={...e.box,cut:n};de.current={box:i,room:e.room},ae(i)},[ie]);const ue=e=>A?A(e):"string"==typeof L?`${e.toFixed(G)} ${L}`:void 0,ce=null==o?C??(null!=E?ue(E)??String(E):void 0):ue(o),fe=x[V],pe=ne.filter(e=>Boolean(e)),me=void 0===ie?-1:pe.indexOf(ie),he=le?`${le.text+le.frame+2}px`:`calc(${y(ne)}ch + ${fe.left+(se?fe.unit:fe.plain)+2}px)`,xe=u(z),ve=d(),be=xe?.set;return i(()=>{be&&be(ve,$?he:null)},[be,ve,he,$]),c(()=>()=>be?.(ve,null),[be,ve]),/* @__PURE__ */p("div",{"data-slider":"",className:`flex w-full min-w-0 items-center gap-(--rosh-slider-gap) ${q}`.trim(),style:v,children:[
3
+ /* @__PURE__ */f("input",{id:Z,type:"range",min:w,max:F,step:k,value:te,disabled:D,"aria-label":O?void 0:W,"aria-labelledby":O,"aria-valuetext":ce,"aria-describedby":Q?U:void 0,onKeyDown:e=>{const t="ArrowUp"===e.key||"ArrowRight"===e.key?1:"ArrowDown"===e.key||"ArrowLeft"===e.key?-1:0;if(!t||e.altKey||e.ctrlKey||e.metaKey)return;const n=e.shiftKey&&null!=N;if(!n&&!(null==o&&null!=ee))return;e.preventDefault();a(S((o??ee??te)+t*(n?N??k:k),w,F,G))},onChange:e=>a(S(Number(e.target.value),w,F,G)),className:"min-w-(--rosh-slider-floor) flex-1 cursor-pointer accent-blue-600 disabled:cursor-not-allowed disabled:opacity-60 "+("sm"===H?"h-1":"h-1.5")}),$&&
4
+ /* @__PURE__ */f(n,{content:le?.cut?ie:null,className:"relative flex min-w-0 max-w-[calc(100%-var(--rosh-slider-floor)-var(--rosh-slider-gap))] shrink-0",describe:!1,children:/* @__PURE__ */p("div",{ref:re,"data-slider-box":"",className:`relative min-w-0 max-w-full shrink-0 ${fe.text}`,style:{position:"relative",width:xe?.width??he,...le?{fontSize:le.fontSize}:{}},children:[
5
+ /* @__PURE__ */f("span",{ref:oe,"data-slider-sizer":"","aria-hidden":"true",style:b,children:pe.map((e,t)=>/* @__PURE__ */f("span",{"data-shown":t===me?"":void 0,style:g,children:e},t))}),
6
+ /* @__PURE__ */f(e,{value:o,onChange:e=>{null!=e?e<X||e>Y||a(e):_&&a(null)},min:X,max:Y,step:k,shiftStep:N,stepFrom:ee,precision:G,snap:!0,allowEmpty:_,suffix:L,disabled:D,placeholder:C??(null!=E?E.toFixed(G):void 0),size:V,auto:Q,"aria-label":W?I.slider.value(W):void 0,"aria-labelledby":W?void 0:O})]})}),Q&&/* @__PURE__ */f("span",{id:U,hidden:!0,children:I.settingView.auto})]})}export{k as Slider,F as SliderGroup,S as settleSliderValue,y as sliderBoxChars,h as stepDecimals};
@@ -1,14 +1,14 @@
1
- import{AccessibleTable as e}from"./chunk-HY6CBG4M.js";import{polygonPoints as t}from"./chunk-VFC6QUEN.js";import{ChartDefs as r,maskId as l}from"./chunk-465RRWBY.js";import{useHighlight as a}from"./chunk-CNYAHYE6.js";import{angleScale as o}from"./chunk-2JWPNR2U.js";import{ChartTooltip as n}from"./chunk-WDQI3FV6.js";import{CHART_INK as i,resolveSeriesColorWithin as s}from"./chunk-TZFACUMR.js";import{useShellStrings as m,useShellLocale as c}from"./chunk-JSHMIMAJ.js";import{formatPlain as h}from"./chunk-C3QOHMR6.js";import{useId as p,useState as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";var k=3,g=e=>`${e.map(([e,t],r)=>`${0===r?"M":"L"}${e.toFixed(2)},${t.toFixed(2)}`).join(" ")} Z`;function x({axes:k,series:x,size:y=300,mode:b="area",grid:M="polygon",rings:v=4,formatValue:N,animate:j=!0,className:$,emptyLabel:C}){const W=m().charts,F=c(),w=N??(e=>h(e,F)),A=C??W.nothingToCompare,R=p(),[H,L]=u(null),{highlighted:Y}=a(),z=x;if(k.length<3||0===z.length)/* @__PURE__ */
1
+ import{AccessibleTable as e}from"./chunk-HY6CBG4M.js";import{ChartDefs as t,maskId as r}from"./chunk-465RRWBY.js";import{polygonPoints as l}from"./chunk-VFC6QUEN.js";import{useHighlight as a}from"./chunk-CNYAHYE6.js";import{angleScale as o}from"./chunk-2JWPNR2U.js";import{ChartTooltip as n}from"./chunk-WDQI3FV6.js";import{CHART_INK as i,resolveSeriesColorWithin as s}from"./chunk-TZFACUMR.js";import{useShellStrings as m,useShellLocale as c}from"./chunk-JSHMIMAJ.js";import{formatPlain as h}from"./chunk-C3QOHMR6.js";import{useId as p,useState as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";var k=3,g=e=>`${e.map(([e,t],r)=>`${0===r?"M":"L"}${e.toFixed(2)},${t.toFixed(2)}`).join(" ")} Z`;function x({axes:k,series:x,size:y=300,mode:b="area",grid:M="polygon",rings:v=4,formatValue:N,animate:j=!0,className:$,emptyLabel:C}){const W=m().charts,F=c(),w=N??(e=>h(e,F)),A=C??W.nothingToCompare,R=p(),[H,L]=u(null),{highlighted:Y}=a(),z=x;if(k.length<3||0===z.length)/* @__PURE__ */
2
2
  return d("p",{className:`text-sm text-gray-500 ${$??""}`,children:A});const B=y/2,E=y/2,J=y/2-46,Q=o(k.length),S=k.map((e,t)=>null!=e.max&&Number.isFinite(e.max)&&e.max>0?e.max:Math.max(1,...z.map(e=>e.values[t]??0).filter(Number.isFinite))),T=(e,t)=>{const r=Math.max(0,Math.min(1,t/S[e])),l=Q.center(e)-Q.step/2;return[B+J*r*Math.cos(l),E+J*r*Math.sin(l)]},U=(e,t)=>null!==H?H!==e:null!==Y&&Y!==t,V=null!==H?z[H]:void 0;/* @__PURE__ */
3
3
  return f("div",{className:`relative ${$??""}`,children:[
4
4
  /* @__PURE__ */f("svg",{width:"100%",height:y,viewBox:`0 0 ${y} ${y}`,role:"img","aria-labelledby":R,onMouseLeave:()=>L(null),children:[
5
- /* @__PURE__ */d("title",{id:R,children:W.acrossMeasures(z.map(e=>e.label),k.length)}),Array.from({length:v},(e,r)=>{const l=J*(r+1)/v;return"circle"===M?/* @__PURE__ */d("circle",{cx:B,cy:E,r:l,fill:"none",stroke:i.grid,strokeWidth:1},r):/* @__PURE__ */d("path",{d:g(t(B,E,l,k.length)),fill:"none",stroke:i.grid,strokeWidth:1},r)}),k.map((e,t)=>{const[r,l]=T(t,S[t]);/* @__PURE__ */
5
+ /* @__PURE__ */d("title",{id:R,children:W.acrossMeasures(z.map(e=>e.label),k.length)}),Array.from({length:v},(e,t)=>{const r=J*(t+1)/v;return"circle"===M?/* @__PURE__ */d("circle",{cx:B,cy:E,r:r,fill:"none",stroke:i.grid,strokeWidth:1},t):/* @__PURE__ */d("path",{d:g(l(B,E,r,k.length)),fill:"none",stroke:i.grid,strokeWidth:1},t)}),k.map((e,t)=>{const[r,l]=T(t,S[t]);/* @__PURE__ */
6
6
  return f("g",{children:[
7
7
  /* @__PURE__ */d("line",{x1:B,y1:E,x2:r,y2:l,stroke:i.grid,strokeWidth:1}),
8
8
  /* @__PURE__ */d("text",{x:B+(J+18)*Math.cos(Q.center(t)-Q.step/2),y:E+(J+18)*Math.sin(Q.center(t)-Q.step/2)+4,textAnchor:"middle",fontSize:11,fill:i.label,children:e.label})]},e.key)}),
9
- /* @__PURE__ */d(r,{id:R,reveal:!!j&&"center-out"}),z.map((e,t)=>{const r=s(t,3,e.color,e.tone),a=k.map((t,r)=>T(r,e.values[r]??0));/* @__PURE__ */
10
- return f("g",{opacity:U(t,e.key)?.3:1,onMouseEnter:()=>L(t),mask:j?`url(#${l(R)})`:void 0,children:["area"===b&&/* @__PURE__ */d("path",{d:g(a),fill:r,fillOpacity:.18,stroke:"none"}),
11
- /* @__PURE__ */d("path",{d:g(a),fill:"none",stroke:r,strokeWidth:2,strokeLinejoin:"round"}),a.map(([e,t],l)=>/* @__PURE__ */d("circle",{cx:e,cy:t,r:3.5,fill:r,stroke:i.surface,strokeWidth:1.5},l))]},e.key)})]}),V&&/* @__PURE__ */d("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */d(n,{title:V.label,rows:k.map((e,t)=>({key:e.key,label:e.label,color:s(H,3,V.color,V.tone),value:w(V.values[t]??0)}))})}),
9
+ /* @__PURE__ */d(t,{id:R,reveal:!!j&&"center-out"}),z.map((e,t)=>{const l=s(t,3,e.color,e.tone),a=k.map((t,r)=>T(r,e.values[r]??0));/* @__PURE__ */
10
+ return f("g",{opacity:U(t,e.key)?.3:1,onMouseEnter:()=>L(t),mask:j?`url(#${r(R)})`:void 0,children:["area"===b&&/* @__PURE__ */d("path",{d:g(a),fill:l,fillOpacity:.18,stroke:"none"}),
11
+ /* @__PURE__ */d("path",{d:g(a),fill:"none",stroke:l,strokeWidth:2,strokeLinejoin:"round"}),a.map(([e,t],r)=>/* @__PURE__ */d("circle",{cx:e,cy:t,r:3.5,fill:l,stroke:i.surface,strokeWidth:1.5},r))]},e.key)})]}),V&&/* @__PURE__ */d("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */d(n,{title:V.label,rows:k.map((e,t)=>({key:e.key,label:e.label,color:s(H,3,V.color,V.tone),value:w(V.values[t]??0)}))})}),
12
12
  /* @__PURE__ */d("ul",{className:"m-0 mt-3 grid gap-1 p-0",style:{gridTemplateColumns:"repeat(auto-fit,minmax(140px,1fr))"},children:z.map((e,t)=>/* @__PURE__ */f("li",{className:"flex list-none items-center gap-2 text-xs text-gray-600",children:[
13
13
  /* @__PURE__ */d("span",{className:"h-2.5 w-2.5 shrink-0 rounded-sm",style:{backgroundColor:s(t,3,e.color,e.tone)}}),
14
14
  /* @__PURE__ */d("span",{className:"flex-1 truncate",children:e.label})]},e.key))}),
@@ -0,0 +1 @@
1
+ var r="12.17.1",a=r;export{a as APP_VERSION,r as VERSION};
@@ -1,4 +1,4 @@
1
- import{Avatar as e}from"./chunk-WESNFWM4.js";import{StatCard as a,Card as t}from"./chunk-CEIIQRK5.js";import{Sparkline as r}from"./chunk-CKCDGSTC.js";import{PieChart as s}from"./chunk-VP2GI3UP.js";import{ColumnChart as l}from"./chunk-GC4N4UQM.js";import{StatusBadgeProvider as i,StatusBadge as d}from"./chunk-JMGDGNM7.js";import{Button_default as c}from"./chunk-EVYD6UFQ.js";import{TH_ONE_LINE as n}from"./chunk-G67CJAQ2.js";import{jsx as o,jsxs as m}from"react/jsx-runtime";var u={paid:"success",shipped:"active",processing:"queued",refunded:"neutral",overdue:"danger"},h=[12,18,14,22,19,27,24,31,28,35,30,38],p=["J","F","M","A","M","J","J","A","S","O","N","D"],g=[{key:"direct",label:"Direct",value:45},{key:"search",label:"Search",value:30},{key:"social",label:"Social",value:15},{key:"email",label:"Email",value:10}],x=[{id:"#3201",customer:"Alice Nguyen",total:"$1,204",status:"paid"},{id:"#3202",customer:"Marco Reyes",total:"$642",status:"shipped"},{id:"#3203",customer:"Priya Patel",total:"$2,980",status:"processing"},{id:"#3204",customer:"Tom Becker",total:"$318",status:"overdue"},{id:"#3205",customer:"Sara Lind",total:"$540",status:"refunded"}];function v(){/* @__PURE__ */
1
+ import{Avatar as e}from"./chunk-WESNFWM4.js";import{StatCard as a,Card as t}from"./chunk-CEIIQRK5.js";import{Sparkline as r}from"./chunk-CKCDGSTC.js";import{PieChart as s}from"./chunk-OHSRZLRD.js";import{ColumnChart as l}from"./chunk-GC4N4UQM.js";import{StatusBadgeProvider as i,StatusBadge as d}from"./chunk-JMGDGNM7.js";import{Button_default as c}from"./chunk-EVYD6UFQ.js";import{TH_ONE_LINE as n}from"./chunk-G67CJAQ2.js";import{jsx as o,jsxs as m}from"react/jsx-runtime";var u={paid:"success",shipped:"active",processing:"queued",refunded:"neutral",overdue:"danger"},h=[12,18,14,22,19,27,24,31,28,35,30,38],p=["J","F","M","A","M","J","J","A","S","O","N","D"],g=[{key:"direct",label:"Direct",value:45},{key:"search",label:"Search",value:30},{key:"social",label:"Social",value:15},{key:"email",label:"Email",value:10}],x=[{id:"#3201",customer:"Alice Nguyen",total:"$1,204",status:"paid"},{id:"#3202",customer:"Marco Reyes",total:"$642",status:"shipped"},{id:"#3203",customer:"Priya Patel",total:"$2,980",status:"processing"},{id:"#3204",customer:"Tom Becker",total:"$318",status:"overdue"},{id:"#3205",customer:"Sara Lind",total:"$540",status:"refunded"}];function v(){/* @__PURE__ */
2
2
  return o(i,{groups:u,children:/* @__PURE__ */o("div",{className:"h-full overflow-auto bg-gray-50 p-6",children:/* @__PURE__ */m("div",{className:"mx-auto max-w-6xl space-y-6",children:[
3
3
  /* @__PURE__ */m("div",{className:"flex items-center justify-between gap-4",children:[
4
4
  /* @__PURE__ */m("div",{children:[
@@ -1,8 +1,8 @@
1
- import{arcPath as e}from"./chunk-VFC6QUEN.js";import{MOTION as t,stagger as l}from"./chunk-465RRWBY.js";import{useHighlight as a}from"./chunk-CNYAHYE6.js";import{usePlotWidth as r}from"./chunk-MAFUXCPZ.js";import{angleScale as n}from"./chunk-2JWPNR2U.js";import{ChartTooltip as o}from"./chunk-WDQI3FV6.js";import{CHART_INK as s,resolveSeriesColor as i}from"./chunk-TZFACUMR.js";import{useShellStrings as h,useShellLocale as c}from"./chunk-JSHMIMAJ.js";import{formatPercent as m,formatPlain as u}from"./chunk-C3QOHMR6.js";import{useId as d,useState as f,useRef as y}from"react";import{jsx as p,jsxs as g}from"react/jsx-runtime";function x({segments:x,variant:v="pie",size:M=280,innerRadius:k,padAngle:b=.012,maxSegments:N=6,otherLabel:I,formatValue:$,centerLabel:j,animate:F=!0,labels:S="none",labelMinShare:w=.04,className:A,emptyLabel:P}){const C=h().charts,W=c(),R=$??(e=>u(e,W)),z=I??C.other,E=P??C.nothingToBreakDown,T=d(),[V,_]=f(null),{highlighted:L}=a(),U=y(null),Y=r(U,Number.POSITIVE_INFINITY),B=x.map((e,t)=>({...e,slot:t})).filter(e=>e.value>0);if(0===B.length)/* @__PURE__ */return p("p",{className:`text-sm text-gray-500 ${A??""}`,children:E});const H=[...B].sort((e,t)=>t.value-e.value),J=H.slice(0,N),O=H.slice(N),Q=O.length>0?[...J,{key:"__other__",label:z,value:O.reduce((e,t)=>e+t.value,0),slot:-1,color:s.muted}]:J,D=e=>i(e.slot,e.color,e.tone),Z=Q.reduce((e,t)=>e+t.value,0),q=Math.ceil(.62*Math.max(...Q.map(e=>String(e.label).length),4)*11)+24,X="outside"===S&&Y>=120+2*q,G=X?q:0,K=X?Math.max(120,Math.min(M,Y-2*G)):M,ee=K+2*G,te=G+K/2,le=K/2,ae=K/2-12,re=k??("ring"===v?.58*ae:0),ne=n(Q.length,b),oe=Math.max(...Q.map(e=>e.value)),se=e=>re+(ae-re)*Math.sqrt(Math.max(0,e)/oe);let ie=-Math.PI/2;const he=(()=>{if(!X)return[];let e=-Math.PI/2;const t=Q.map((t,l)=>{const a="rose"===v?n(Q.length,b).step:t.value/Z*Math.PI*2,r="rose"===v?n(Q.length,b).center(l):e+a/2;e+=a;const o="rose"===v?se(t.value):ae;return{key:t.key,label:t.label,share:t.value/Z,right:Math.cos(r)>=0,anchor:[te+o*Math.cos(r),le+o*Math.sin(r)],y:le+(o+14)*Math.sin(r),index:l}}).filter(e=>e.share>=w),l=Math.max(1,Math.floor((K-11-13)/26)+1),a=/* @__PURE__ */new Set;for(const e of[!0,!1]){const r=t.filter(t=>t.right===e).sort((e,t)=>t.share-e.share).slice(0,l).sort((e,t)=>e.y-t.y);for(let e=1;e<r.length;e+=1)r[e].y-r[e-1].y<26&&(r[e].y=r[e-1].y+26);for(let e=r.length-1;e>=0;e-=1){const t=e===r.length-1?K-13:r[e+1].y-26;r[e].y=Math.min(r[e].y,t)}r.forEach((e,t)=>{e.y=Math.max(e.y,0===t?11:r[t-1].y+26),a.add(e.key)})}return t.filter(e=>a.has(e.key))})(),ce=(e,t)=>null!==V?V!==e:null!==L&&L!==t,me=null!==V?Q[V]:void 0;/* @__PURE__ */
1
+ import{MOTION as e,stagger as t}from"./chunk-465RRWBY.js";import{arcPath as l}from"./chunk-VFC6QUEN.js";import{useHighlight as a}from"./chunk-CNYAHYE6.js";import{usePlotWidth as r}from"./chunk-MAFUXCPZ.js";import{angleScale as n}from"./chunk-2JWPNR2U.js";import{ChartTooltip as o}from"./chunk-WDQI3FV6.js";import{CHART_INK as s,resolveSeriesColor as i}from"./chunk-TZFACUMR.js";import{useShellStrings as h,useShellLocale as c}from"./chunk-JSHMIMAJ.js";import{formatPercent as m,formatPlain as u}from"./chunk-C3QOHMR6.js";import{useId as d,useState as f,useRef as y}from"react";import{jsx as p,jsxs as g}from"react/jsx-runtime";function x({segments:x,variant:v="pie",size:M=280,innerRadius:k,padAngle:b=.012,maxSegments:N=6,otherLabel:I,formatValue:$,centerLabel:j,animate:F=!0,labels:S="none",labelMinShare:w=.04,className:A,emptyLabel:P}){const C=h().charts,W=c(),R=$??(e=>u(e,W)),z=I??C.other,E=P??C.nothingToBreakDown,T=d(),[V,_]=f(null),{highlighted:L}=a(),U=y(null),Y=r(U,Number.POSITIVE_INFINITY),B=x.map((e,t)=>({...e,slot:t})).filter(e=>e.value>0);if(0===B.length)/* @__PURE__ */return p("p",{className:`text-sm text-gray-500 ${A??""}`,children:E});const H=[...B].sort((e,t)=>t.value-e.value),J=H.slice(0,N),O=H.slice(N),Q=O.length>0?[...J,{key:"__other__",label:z,value:O.reduce((e,t)=>e+t.value,0),slot:-1,color:s.muted}]:J,D=e=>i(e.slot,e.color,e.tone),Z=Q.reduce((e,t)=>e+t.value,0),q=Math.ceil(.62*Math.max(...Q.map(e=>String(e.label).length),4)*11)+24,X="outside"===S&&Y>=120+2*q,G=X?q:0,K=X?Math.max(120,Math.min(M,Y-2*G)):M,ee=K+2*G,te=G+K/2,le=K/2,ae=K/2-12,re=k??("ring"===v?.58*ae:0),ne=n(Q.length,b),oe=Math.max(...Q.map(e=>e.value)),se=e=>re+(ae-re)*Math.sqrt(Math.max(0,e)/oe);let ie=-Math.PI/2;const he=(()=>{if(!X)return[];let e=-Math.PI/2;const t=Q.map((t,l)=>{const a="rose"===v?n(Q.length,b).step:t.value/Z*Math.PI*2,r="rose"===v?n(Q.length,b).center(l):e+a/2;e+=a;const o="rose"===v?se(t.value):ae;return{key:t.key,label:t.label,share:t.value/Z,right:Math.cos(r)>=0,anchor:[te+o*Math.cos(r),le+o*Math.sin(r)],y:le+(o+14)*Math.sin(r),index:l}}).filter(e=>e.share>=w),l=Math.max(1,Math.floor((K-11-13)/26)+1),a=/* @__PURE__ */new Set;for(const e of[!0,!1]){const r=t.filter(t=>t.right===e).sort((e,t)=>t.share-e.share).slice(0,l).sort((e,t)=>e.y-t.y);for(let e=1;e<r.length;e+=1)r[e].y-r[e-1].y<26&&(r[e].y=r[e-1].y+26);for(let e=r.length-1;e>=0;e-=1){const t=e===r.length-1?K-13:r[e+1].y-26;r[e].y=Math.min(r[e].y,t)}r.forEach((e,t)=>{e.y=Math.max(e.y,0===t?11:r[t-1].y+26),a.add(e.key)})}return t.filter(e=>a.has(e.key))})(),ce=(e,t)=>null!==V?V!==e:null!==L&&L!==t,me=null!==V?Q[V]:void 0;/* @__PURE__ */
2
2
  return g("div",{className:`relative ${A??""}`,ref:U,children:[
3
3
  /* @__PURE__ */g("svg",{width:"100%",height:K,viewBox:`0 0 ${ee} ${K}`,role:"img","aria-labelledby":T,onMouseLeave:()=>_(null),children:[
4
4
  /* @__PURE__ */p("title",{id:T,children:C.breakdown(R(Z),Q.length)}),Q.map((a,r)=>{const n=D(a),o="rose"===v?ne(r):ie,i="rose"===v?ne.step:a.value/Z*Math.PI*2-b;"rose"!==v&&(ie+=a.value/Z*Math.PI*2);const h=o+Math.max(.001,i),c="rose"===v?se(a.value):ae;/* @__PURE__ */
5
- return p("path",{d:e(te,le,re,c,o,h),fill:n,fillOpacity:ce(r,a.key)?.4:1,stroke:s.surface,strokeWidth:1,className:F?t.sweep:void 0,style:F?l(r,55):void 0,onMouseEnter:()=>_(r)},a.key)}),he.map(e=>{const t=e.right?ee-6:6,l=e.right?te+ae+14:te-ae-14;/* @__PURE__ */
5
+ return p("path",{d:l(te,le,re,c,o,h),fill:n,fillOpacity:ce(r,a.key)?.4:1,stroke:s.surface,strokeWidth:1,className:F?e.sweep:void 0,style:F?t(r,55):void 0,onMouseEnter:()=>_(r)},a.key)}),he.map(e=>{const t=e.right?ee-6:6,l=e.right?te+ae+14:te-ae-14;/* @__PURE__ */
6
6
  return g("g",{children:[
7
7
  /* @__PURE__ */p("polyline",{points:`${e.anchor[0].toFixed(1)},${e.anchor[1].toFixed(1)} ${l},${e.y.toFixed(1)} ${t},${e.y.toFixed(1)}`,fill:"none",stroke:s.grid,strokeWidth:1}),
8
8
  /* @__PURE__ */p("text",{x:t,y:e.y-2,fontSize:11,fill:s.label,textAnchor:e.right?"end":"start",children:e.label}),
@@ -1,11 +1,11 @@
1
- import{arcPath as e}from"./chunk-VFC6QUEN.js";import{MOTION as t,stagger as a}from"./chunk-465RRWBY.js";import{useHighlight as l}from"./chunk-CNYAHYE6.js";import{angleScale as r}from"./chunk-2JWPNR2U.js";import{ChartTooltip as n}from"./chunk-WDQI3FV6.js";import{resolveSeriesColor as o,CHART_INK as i}from"./chunk-TZFACUMR.js";import{useShellStrings as s,useShellLocale as c}from"./chunk-JSHMIMAJ.js";import{formatPlain as m}from"./chunk-C3QOHMR6.js";import{useId as h,useState as u}from"react";import{jsx as p,jsxs as d}from"react/jsx-runtime";var f=300*Math.PI/180;function g({rows:g,variant:k="track",size:v=300,max:x,formatValue:M,animate:y=!0,className:N,emptyLabel:b,trackGap:j=6}){const C=s().charts,w=c(),R=M??(e=>m(e,w)),E=b??C.nothingToPlot,I=h(),[P,T]=u(null),{highlighted:$}=l();if(0===g.length)/* @__PURE__ */return p("p",{className:`text-sm text-gray-500 ${N??""}`,children:E});const A=v/2,F=v/2,H=v/2-10,J=x??Math.max(...g.map(e=>e.value),1),Q="track"===k?Math.max(6,(H-.16*v)/g.length):0,U=Math.max(1,Math.floor((H-.16*v)/Q||1)),V="track"===k?g.slice(0,U):g,W=Math.min(j,Math.max(1,Q-2)),Y=r(V.length,.03),z=null!==P?V[P]:void 0;/* @__PURE__ */
1
+ import{MOTION as e,stagger as t}from"./chunk-465RRWBY.js";import{arcPath as a}from"./chunk-VFC6QUEN.js";import{useHighlight as l}from"./chunk-CNYAHYE6.js";import{angleScale as r}from"./chunk-2JWPNR2U.js";import{ChartTooltip as n}from"./chunk-WDQI3FV6.js";import{resolveSeriesColor as o,CHART_INK as i}from"./chunk-TZFACUMR.js";import{useShellStrings as s,useShellLocale as c}from"./chunk-JSHMIMAJ.js";import{formatPlain as m}from"./chunk-C3QOHMR6.js";import{useId as h,useState as u}from"react";import{jsx as p,jsxs as d}from"react/jsx-runtime";var f=300*Math.PI/180;function g({rows:g,variant:k="track",size:v=300,max:x,formatValue:M,animate:y=!0,className:N,emptyLabel:b,trackGap:j=6}){const C=s().charts,w=c(),R=M??(e=>m(e,w)),E=b??C.nothingToPlot,I=h(),[P,T]=u(null),{highlighted:$}=l();if(0===g.length)/* @__PURE__ */return p("p",{className:`text-sm text-gray-500 ${N??""}`,children:E});const A=v/2,F=v/2,H=v/2-10,J=x??Math.max(...g.map(e=>e.value),1),Q="track"===k?Math.max(6,(H-.16*v)/g.length):0,U=Math.max(1,Math.floor((H-.16*v)/Q||1)),V="track"===k?g.slice(0,U):g,W=Math.min(j,Math.max(1,Q-2)),Y=r(V.length,.03),z=null!==P?V[P]:void 0;/* @__PURE__ */
2
2
  return d("div",{className:`relative ${N??""}`,children:[
3
3
  /* @__PURE__ */d("svg",{width:"100%",height:v,viewBox:`0 0 ${v} ${v}`,role:"img","aria-labelledby":I,onMouseLeave:()=>T(null),children:[
4
4
  /* @__PURE__ */p("title",{id:I,children:"track"===k?C.radialTrack(V.length):C.radialCycle(V.length)}),V.map((l,r)=>{const n=o(r,l.color,l.tone),s=Math.max(0,Math.min(1,l.value/J)),c=((e,t)=>null!==P?P!==e:null!==$&&$!==t)(r,l.key);if("track"===k){const o=H-r*Q,m=o-Q+W,h=-Math.PI/2;/* @__PURE__ */
5
- return d("g",{opacity:c?.4:1,onMouseEnter:()=>T(r),className:y?t.sweep:void 0,style:y?a(r,70):void 0,children:[
6
- /* @__PURE__ */p("path",{d:e(A,F,m,o,h,h+f),fill:i.grid}),
7
- /* @__PURE__ */p("path",{d:e(A,F,m,o,h,h+f*s),fill:n})]},l.key)}const m=.14*v;/* @__PURE__ */
8
- return p("g",{opacity:c?.4:1,onMouseEnter:()=>T(r),children:/* @__PURE__ */p("path",{d:e(A,F,m,m+(H-m)*s,Y(r),Y(r)+Y.step),fill:n})},l.key)})]}),z&&null!==P&&/* @__PURE__ */p("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */p(n,{title:z.label,rows:[{key:"value",label:C.value,color:o(P,z.color,z.tone),value:R(z.value)}]})}),
5
+ return d("g",{opacity:c?.4:1,onMouseEnter:()=>T(r),className:y?e.sweep:void 0,style:y?t(r,70):void 0,children:[
6
+ /* @__PURE__ */p("path",{d:a(A,F,m,o,h,h+f),fill:i.grid}),
7
+ /* @__PURE__ */p("path",{d:a(A,F,m,o,h,h+f*s),fill:n})]},l.key)}const m=.14*v;/* @__PURE__ */
8
+ return p("g",{opacity:c?.4:1,onMouseEnter:()=>T(r),children:/* @__PURE__ */p("path",{d:a(A,F,m,m+(H-m)*s,Y(r),Y(r)+Y.step),fill:n})},l.key)})]}),z&&null!==P&&/* @__PURE__ */p("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */p(n,{title:z.label,rows:[{key:"value",label:C.value,color:o(P,z.color,z.tone),value:R(z.value)}]})}),
9
9
  /* @__PURE__ */p("ul",{className:"m-0 mt-3 grid gap-1 p-0",style:{gridTemplateColumns:"repeat(auto-fit,minmax(150px,1fr))"},children:g.map((e,t)=>/* @__PURE__ */d("li",{className:"flex list-none items-center gap-2 text-xs text-gray-600",children:[
10
10
  /* @__PURE__ */p("span",{className:"h-2.5 w-2.5 shrink-0 rounded-sm",style:{backgroundColor:o(t,e.color,e.tone)}}),
11
11
  /* @__PURE__ */p("span",{className:"flex-1 truncate",children:e.label}),
@@ -1,12 +1,12 @@
1
- import{SearchableSelect as e}from"./chunk-25QDSYH5.js";import{Select_default as a}from"./chunk-VJXPT53M.js";import{labelClasses as l}from"./chunk-EQKUFYX6.js";import{isSafeLinkHref as t}from"./chunk-Q5Z3KHT2.js";import{Input_default as r}from"./chunk-ZKGUBIBT.js";import{INPUT_SIZES as n}from"./chunk-AYZY3YNC.js";import{Button_default as i}from"./chunk-EVYD6UFQ.js";import{Icon as o}from"./chunk-JOAKKXTL.js";import{registerModalEscapeInterceptor as s}from"./chunk-TWVUQUUD.js";import{useShellStrings as u}from"./chunk-JSHMIMAJ.js";import{useId as d,useRef as c,useState as p,useEffect as m}from"react";import{jsx as f,jsxs as v,Fragment as g}from"react/jsx-runtime";function h(e){return"select"===e.type?e.options:"groups"===e.type?e.groups.flatMap(e=>e.options):[]}var b="address",x={kindOf:()=>b,targetOf:e=>e,readFilter:()=>null,withFilter:e=>e},k=e=>t(e.trim());function y(t){const{value:n,kinds:o,rules:y=x,filtersFor:w,label:N,readOnly:C,placeholder:F,className:j="",tidyAddress:O,addressAddon:T}=t,A=void 0!==t.onApply,$=u().link,E=y.isSafe??k,K=d(),z=c(null),D=c(null),[U,Y]=p({url:n}),M=A?U.url:n,[Q,B]=p(!1),[H,J]=p(null),[P,S]=p(null),[L,V]=p(!1),W=c(null),X=c(()=>{});X.current=A?t.onCancel:()=>{},m(()=>{if(A)return s(e=>{const a=z.current;return!!("Escape"===e.key&&a&&e.target instanceof Node&&a.contains(e.target))&&(X.current(),!0)},()=>z.current)},[A]),m(()=>{if(!A)return;const e=D.current;e?(e.focus(),e.select()):z.current?.querySelector("button, input")?.focus()},[]);const Z=o??[{value:b,label:$.address,target:{type:"text"}}],I=H&&H.against===M?H.kind:y.kindOf(M),R=Z.filter(e=>!e.hideWhenEmpty||h(e.target).length>0||e.value===I),q=R.find(e=>"text"===e.target.type),G=R.find(e=>e.value===I)??q??R[0];if(!G)return null;const _="text"!==G.target.type,ee=_?y.targetOf(M):M,ae=h(G.target),le=ae.find(e=>e.value===ee),te=e=>({value:e,label:$.unavailable(e)}),re="select"===G.target.type&&ee&&w?w(ee):null,ne=re?y.readFilter(M):null,ie=ne?re?.find(e=>e.param===ne.param):void 0,oe=P&&P.against===M?P.text:M,se=_?M:O?O(oe.trim()).trim():oe.trim(),ue=A&&O?se:oe,de=!_&&""!==ue.trim()&&!E(ue),ce=de&&(!A||Q);_&&L&&V(!1);const pe=(e,a)=>{A?Y({url:e,name:a}):void 0===a?t.onChange(e):t.onChange(e,a)},me=(e,a)=>{J(a=>a?{...a,against:e}:a),pe(e,a)},fe=e=>{if(!e)return me("");const a=ae.find(a=>a.value===e);me(e,a?.label)},ve=e=>{B(!1);const a=e.trim();a?E(e)?(S({text:e,against:a}),me(a)):S({text:e,against:M}):(S({text:e,against:""}),me(""))},ge=e=>{const a=e.relatedTarget;if(a&&(a===D.current||W.current?.contains(a)))return;if(V(!1),A||!O||C)return;const l=O(oe.trim());l.trim()!==oe.trim()&&ve(l)},he=()=>{if(!A||!se)return;if(!_&&de)return void B(!0);const e=_&&U.url===se?U.name:void 0,a=t.onApply;void 0===e?a(se):a(se,e)},be=(e,a)=>a&&!e.some(e=>e.value===a)?[te(a),...e]:[...e],xe=(l,t,r,n,i)=>{const o=[];for(const e of r){const a=o[o.length-1],l={value:e.value,label:e.label};e.group?a&&"options"in a&&a.label===e.group?a.options.push(l):o.push({label:e.group,options:[l]}):o.push(l)}if(i){const a=r.some(e=>""===e.value);/* @__PURE__ */
1
+ import{SearchableSelect as e}from"./chunk-25QDSYH5.js";import{Select_default as a}from"./chunk-VJXPT53M.js";import{labelClasses as l}from"./chunk-EQKUFYX6.js";import{isSafeLinkHref as t}from"./chunk-Z5TE3MEG.js";import{Input_default as r}from"./chunk-ZKGUBIBT.js";import{INPUT_SIZES as n}from"./chunk-AYZY3YNC.js";import{Button_default as i}from"./chunk-EVYD6UFQ.js";import{Icon as o}from"./chunk-JOAKKXTL.js";import{registerModalEscapeInterceptor as s}from"./chunk-TWVUQUUD.js";import{useShellStrings as u}from"./chunk-JSHMIMAJ.js";import{useId as d,useRef as c,useState as p,useEffect as m}from"react";import{jsx as f,jsxs as v,Fragment as g}from"react/jsx-runtime";function h(e){return"select"===e.type?e.options:"groups"===e.type?e.groups.flatMap(e=>e.options):[]}var b="address",x={kindOf:()=>b,targetOf:e=>e,readFilter:()=>null,withFilter:e=>e},k=e=>t(e.trim());function y(t){const{value:n,kinds:o,rules:y=x,filtersFor:w,label:N,readOnly:C,placeholder:F,className:j="",tidyAddress:O,addressAddon:E}=t,T=void 0!==t.onApply,A=u().link,$=y.isSafe??k,z=d(),D=c(null),K=c(null),[M,U]=p({url:n}),Y=T?M.url:n,[B,J]=p(!1),[P,Q]=p(null),[S,H]=p(null),[L,V]=p(!1),W=c(null),X=c(()=>{});X.current=T?t.onCancel:()=>{},m(()=>{if(T)return s(e=>{const a=D.current;return!!("Escape"===e.key&&a&&e.target instanceof Node&&a.contains(e.target))&&(X.current(),!0)},()=>D.current)},[T]),m(()=>{if(!T)return;const e=K.current;e?(e.focus(),e.select()):D.current?.querySelector("button, input")?.focus()},[]);const Z=o??[{value:b,label:A.address,target:{type:"text"}}],G=P&&P.against===Y?P.kind:y.kindOf(Y),I=Z.filter(e=>!e.hideWhenEmpty||h(e.target).length>0||e.value===G),R=I.find(e=>"text"===e.target.type),q=I.find(e=>e.value===G)??R??I[0];if(!q)return null;const _="text"!==q.target.type,ee=_?y.targetOf(Y):Y,ae=h(q.target),le=ae.find(e=>e.value===ee),te=e=>({value:e,label:A.unavailable(e)}),re="select"===q.target.type&&ee&&w?w(ee):null,ne=re?y.readFilter(Y):null,ie=ne?re?.find(e=>e.param===ne.param):void 0,oe=S&&S.against===Y?S.text:Y,se=_?Y:O?O(oe.trim()).trim():oe.trim(),ue=T&&O?se:oe,de=!_&&""!==ue.trim()&&!$(ue),ce=de&&(!T||B);_&&L&&V(!1);const pe=(e,a)=>{T?U({url:e,name:a}):void 0===a?t.onChange(e):t.onChange(e,a)},me=(e,a)=>{Q(a=>a?{...a,against:e}:a),pe(e,a)},fe=e=>{if(!e)return me("");const a=ae.find(a=>a.value===e);me(e,a?.label)},ve=e=>{J(!1);const a=e.trim();a?$(e)?(H({text:e,against:a}),me(a)):H({text:e,against:Y}):(H({text:e,against:""}),me(""))},ge=e=>{const a=e.relatedTarget;if(a&&(a===K.current||W.current?.contains(a)))return;if(V(!1),T||!O||C)return;const l=O(oe.trim());l.trim()!==oe.trim()&&ve(l)},he=()=>{if(!T||!se)return;if(!_&&de)return void J(!0);const e=_&&M.url===se?M.name:void 0,a=t.onApply;void 0===e?a(se):a(se,e)},be=(e,a)=>a&&!e.some(e=>e.value===a)?[te(a),...e]:[...e],xe=(l,t,r,n,i)=>{const o=[];for(const e of r){const a=o[o.length-1],l={value:e.value,label:e.label};e.group?a&&"options"in a&&a.label===e.group?a.options.push(l):o.push({label:e.group,options:[l]}):o.push(l)}if(i){const a=r.some(e=>""===e.value);/* @__PURE__ */
2
2
  return f(e,{"aria-label":l,value:t,options:o,disabled:C,clearable:a,placeholder:r.find(e=>""===e.value)?.label,onChange:n})}/* @__PURE__ */
3
- return f(a,{size:"sm","aria-label":l,value:t,options:o,readOnly:C,onChange:n})};let ke;if("text"===G.target.type)ke=/* @__PURE__ */f(r,{ref:D,id:`${K}-address`,size:"sm",type:"text",invalid:ce,"aria-label":$.address,"aria-describedby":ce?`${K}-why`:void 0,placeholder:F??$.addressPlaceholder,spellCheck:!1,autoComplete:"off",value:oe,readOnly:C,onChange:e=>ve(e.target.value),onFocus:()=>V(!0),onBlur:ge,onKeyDown:O&&!A?e=>{"Enter"===e.key&&e.currentTarget.blur()}:void 0});else{const e="groups"===G.target.type?G.target.groups.flatMap(e=>e.options.map(a=>({value:a.value,label:a.label,group:e.label}))):G.target.options.map(e=>({value:e.value,label:e.label})),a=[{value:"",label:G.target.placeholder},...be(e,ee)];ke=xe(G.label,ee,a,fe,e.length>10)}const ye=/* @__PURE__ */v(g,{children:[o&&xe($.linkType,G.value,R.map(e=>({value:e.value,label:e.label})),e=>{S(null),B(!1);const a=R.find(a=>a.value===e);if(!a||"text"===a.target.type)return void J({kind:e,against:M});const l=h(a.target)[0];J({kind:e,against:l?l.value:""}),l?pe(l.value,l.label):pe("")},!1),ke,T&&L&&!C&&"text"===G.target.type&&/* @__PURE__ */f("div",{ref:W,onBlur:ge,children:T({url:oe,onChange:ve})}),re&&xe($.filter,ne?.param??"",[{value:"",label:$.noFilter},...ne&&!ie?[te(ne.param)]:[],...re.map(e=>({value:e.param,label:e.label}))],e=>{if(!e)return me(ee,le?.label);const a=re?.find(a=>a.param===e),l=a?.values[0];l&&me(y.withFilter(ee,{param:e,value:l.value}),l.label)},!1),re&&ne&&xe($.value,ne.value,be((ie?.values??[]).map(e=>({value:e.value,label:e.label})),ne.value),e=>{if(!ne)return;const a=ie?.values.find(a=>a.value===e);me(y.withFilter(ee,{param:ne.param,value:e}),a?.label)},(ie?.values.length??0)>10),ce&&/* @__PURE__ */f("p",{id:`${K}-why`,role:"alert",className:"text-2xs leading-4 text-red-600",children:$.unsafe}),G.hint&&/* @__PURE__ */f("p",{className:"text-2xs leading-4 text-ink-faintest",children:G.hint}),re&&/* @__PURE__ */f("p",{className:"text-2xs leading-4 text-ink-faintest",children:$.filterHint})]});if(!A)/* @__PURE__ */
4
- return f("div",{ref:z,className:`flex min-w-0 flex-auto flex-col gap-2 ${j}`.trim(),role:N?"group":void 0,"aria-label":N,children:ye});const we=t.onRemove;/* @__PURE__ */
5
- return v("div",{ref:z,role:"dialog","aria-label":N??$.title,className:`flex min-w-0 flex-col gap-2 rounded-xl border border-line bg-surface p-3 shadow-lg ${j}`.trim(),onKeyDown:e=>{"Enter"!==e.key||e.defaultPrevented||e.target instanceof Element&&e.target.closest("button")||(e.preventDefault(),he())},children:[_?/* @__PURE__ */f("span",{className:l({inline:!0}),children:$.title}):/* @__PURE__ */f("label",{htmlFor:`${K}-address`,className:l({inline:!0}),children:$.title}),ye,
6
- /* @__PURE__ */v("div",{className:"flex items-center justify-between gap-2",children:[we?/* @__PURE__ */f(i,{variant:"ghost-danger",size:"sm","data-window-action":"remove",onClick:we,children:$.remove}):null,
3
+ return f(a,{size:"sm","aria-label":l,value:t,options:o,readOnly:C,onChange:n})};let ke;if("text"===q.target.type)ke=/* @__PURE__ */f(r,{ref:K,id:`${z}-address`,size:"sm",type:"text",invalid:ce,"aria-label":A.address,"aria-describedby":ce?`${z}-why`:void 0,placeholder:F??A.addressPlaceholder,spellCheck:!1,autoComplete:"off",value:oe,readOnly:C,onChange:e=>ve(e.target.value),onFocus:()=>V(!0),onBlur:ge,onKeyDown:O&&!T?e=>{"Enter"===e.key&&e.currentTarget.blur()}:void 0});else{const e="groups"===q.target.type?q.target.groups.flatMap(e=>e.options.map(a=>({value:a.value,label:a.label,group:e.label}))):q.target.options.map(e=>({value:e.value,label:e.label})),a=[{value:"",label:q.target.placeholder},...be(e,ee)];ke=xe(q.label,ee,a,fe,e.length>10)}const ye=/* @__PURE__ */v(g,{children:[o&&xe(A.linkType,q.value,I.map(e=>({value:e.value,label:e.label})),e=>{H(null),J(!1);const a=I.find(a=>a.value===e);if(!a||"text"===a.target.type)return void Q({kind:e,against:Y});const l=h(a.target)[0];Q({kind:e,against:l?l.value:""}),l?pe(l.value,l.label):pe("")},!1),ke,E&&L&&!C&&"text"===q.target.type&&/* @__PURE__ */f("div",{ref:W,onBlur:ge,children:E({url:oe,onChange:ve})}),re&&xe(A.filter,ne?.param??"",[{value:"",label:A.noFilter},...ne&&!ie?[te(ne.param)]:[],...re.map(e=>({value:e.param,label:e.label}))],e=>{if(!e)return me(ee,le?.label);const a=re?.find(a=>a.param===e),l=a?.values[0];l&&me(y.withFilter(ee,{param:e,value:l.value}),l.label)},!1),re&&ne&&xe(A.value,ne.value,be((ie?.values??[]).map(e=>({value:e.value,label:e.label})),ne.value),e=>{if(!ne)return;const a=ie?.values.find(a=>a.value===e);me(y.withFilter(ee,{param:ne.param,value:e}),a?.label)},(ie?.values.length??0)>10),ce&&/* @__PURE__ */f("p",{id:`${z}-why`,role:"alert",className:"text-2xs leading-4 text-red-600",children:A.unsafe}),q.hint&&/* @__PURE__ */f("p",{className:"text-2xs leading-4 text-ink-faintest",children:q.hint}),re&&/* @__PURE__ */f("p",{className:"text-2xs leading-4 text-ink-faintest",children:A.filterHint})]});if(!T)/* @__PURE__ */
4
+ return f("div",{ref:D,className:`flex min-w-0 flex-auto flex-col gap-2 ${j}`.trim(),role:N?"group":void 0,"aria-label":N,children:ye});const we=t.onRemove;/* @__PURE__ */
5
+ return v("div",{ref:D,role:"dialog","aria-label":N??A.title,className:`flex min-w-0 flex-col gap-2 rounded-xl border border-line bg-surface p-3 shadow-lg ${j}`.trim(),onKeyDown:e=>{"Enter"!==e.key||e.defaultPrevented||e.target instanceof Element&&e.target.closest("button")||(e.preventDefault(),he())},children:[_?/* @__PURE__ */f("span",{className:l({inline:!0}),children:A.title}):/* @__PURE__ */f("label",{htmlFor:`${z}-address`,className:l({inline:!0}),children:A.title}),ye,
6
+ /* @__PURE__ */v("div",{className:"flex items-center justify-between gap-2",children:[we?/* @__PURE__ */f(i,{variant:"ghost-danger",size:"sm","data-window-action":"remove",onClick:we,children:A.remove}):null,
7
7
  /* @__PURE__ */v("span",{className:"ml-auto flex gap-1",children:[
8
- /* @__PURE__ */f(i,{variant:"secondary",size:"sm","data-window-action":"cancel",onClick:()=>X.current(),children:$.cancel}),
9
- /* @__PURE__ */f(i,{variant:"primary",size:"sm","data-window-action":"apply",onClick:he,disabled:C||""===se,children:$.apply})]})]})]})}function w({label:e,text:a,onTextChange:l,link:t,onLinkChange:i,kinds:s,rules:m,filtersFor:g,textPlaceholder:h,readOnly:b,className:x=""}){const k=u().link,[w,N]=p(!1),C=c(null),F=d(),j=()=>{N(!1),C.current?.focus()};/* @__PURE__ */
8
+ /* @__PURE__ */f(i,{variant:"secondary",size:"sm","data-window-action":"cancel",onClick:()=>X.current(),children:A.cancel}),
9
+ /* @__PURE__ */f(i,{variant:"primary",size:"sm","data-window-action":"apply",onClick:he,disabled:C||""===se,children:A.apply})]})]})]})}function w({label:e,text:a,onTextChange:l,link:t,onLinkChange:i,kinds:s,rules:m,filtersFor:g,textPlaceholder:h,readOnly:b,className:x=""}){const k=u().link,[w,N]=p(!1),C=c(null),F=d(),j=()=>{N(!1),C.current?.focus()};/* @__PURE__ */
10
10
  return v("div",{className:`flex min-w-0 flex-auto flex-col ${x}`.trim(),children:[
11
11
  /* @__PURE__ */f(r,{size:"md",type:"text",className:"rounded-b-none","aria-label":k.text(e),placeholder:h,value:a,readOnly:b,onChange:e=>l(e.target.value)}),
12
12
  /* @__PURE__ */v("button",{ref:C,type:"button","aria-label":k.linkOf(e,t),"aria-expanded":w,"aria-controls":w?F:void 0,disabled:b,onClick:()=>N(e=>!e),className:`flex w-full min-w-0 items-center gap-2 rounded-b-(--radius-control) border border-t-0 border-line-strong bg-surface-sunken ${n.md} text-left hover:bg-gray-100 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring)] disabled:cursor-not-allowed disabled:opacity-60`,children:[
@@ -1,7 +1,7 @@
1
- import{formatMoney as e}from"./chunk-GEYM4WN3.js";import{EMPTY_VALUE as r}from"./chunk-36BRD5J3.js";import{TimeSeriesChart as t}from"./chunk-XQWHKXLS.js";import{ChartFrame as a}from"./chunk-RBS3AWE7.js";import{ColumnChart as l}from"./chunk-GC4N4UQM.js";import{TH_ONE_LINE as s}from"./chunk-G67CJAQ2.js";import{jsxs as o,jsx as i}from"react/jsx-runtime";function n({spec:n,height:c=200,width:m,animate:d=!0,className:h}){const u=function(r){if(r.currency)return t=>e(t,r.currency);const t=r.unit?` ${r.unit}`:"";return e=>`${e.toLocaleString("en-US",{maximumFractionDigits:2})}${t}`}(n),p=n.currency?r=>e(r,n.currency,{whole:!0}):u,b=n.series.map((e,r)=>({key:`s${r}`,label:e.name,data:e.values})),y=n.title??n.series.map(e=>e.name).join(", "),f=/* @__PURE__ */o("table",{className:"w-full border-collapse text-sm",children:[
1
+ import{formatMoney as e}from"./chunk-GEYM4WN3.js";import{EMPTY_VALUE as r}from"./chunk-36BRD5J3.js";import{TimeSeriesChart as t}from"./chunk-F37II2EH.js";import{ColumnChart as a}from"./chunk-GC4N4UQM.js";import{ChartFrame as l}from"./chunk-RBS3AWE7.js";import{TH_ONE_LINE as s}from"./chunk-G67CJAQ2.js";import{jsxs as o,jsx as i}from"react/jsx-runtime";function n({spec:n,height:c=200,width:m,animate:d=!0,className:h}){const u=function(r){if(r.currency)return t=>e(t,r.currency);const t=r.unit?` ${r.unit}`:"";return e=>`${e.toLocaleString("en-US",{maximumFractionDigits:2})}${t}`}(n),p=n.currency?r=>e(r,n.currency,{whole:!0}):u,b=n.series.map((e,r)=>({key:`s${r}`,label:e.name,data:e.values})),y=n.title??n.series.map(e=>e.name).join(", "),f=/* @__PURE__ */o("table",{className:"w-full border-collapse text-sm",children:[
2
2
  /* @__PURE__ */i("thead",{children:/* @__PURE__ */o("tr",{children:[
3
3
  /* @__PURE__ */i("td",{className:"border-b border-gray-200"}),n.series.map((e,r)=>/* @__PURE__ */i("th",{scope:"col",className:`${s} border-b border-gray-200 px-2 py-1 text-right font-semibold text-gray-700`,children:e.name},r))]})}),
4
4
  /* @__PURE__ */i("tbody",{children:n.x.map((e,t)=>/* @__PURE__ */o("tr",{children:[
5
5
  /* @__PURE__ */i("th",{scope:"row",className:`${s} border-t border-gray-100 px-2 py-1 text-left font-normal text-gray-700`,children:e}),n.series.map((e,a)=>{const l=e.values[t];/* @__PURE__ */
6
6
  return i("td",{className:"border-t border-gray-100 px-2 py-1 text-right tabular-nums text-gray-700",children:null===l?r:u(l)},a)})]},t))})]});/* @__PURE__ */
7
- return i(a,{title:y,legend:b.map(e=>({key:e.key,label:e.label,swatch:"line"===n.type?"bar":"square"})),table:f,className:h,children:"line"===n.type?/* @__PURE__ */i(t,{series:b,labels:n.x,height:c,width:m,animate:d,dots:"all",formatValue:p,formatTooltipValue:u}):/* @__PURE__ */i(l,{series:b,labels:n.x,stacked:n.stacked,height:c,width:m,animate:d,formatValue:p,formatTooltipValue:u})})}export{n as SpecChart};
7
+ return i(l,{title:y,legend:b.map(e=>({key:e.key,label:e.label,swatch:"line"===n.type?"bar":"square"})),table:f,className:h,children:"line"===n.type?/* @__PURE__ */i(t,{series:b,labels:n.x,height:c,width:m,animate:d,dots:"all",formatValue:p,formatTooltipValue:u}):/* @__PURE__ */i(a,{series:b,labels:n.x,stacked:n.stacked,height:c,width:m,animate:d,formatValue:p,formatTooltipValue:u})})}export{n as SpecChart};
@@ -1,4 +1,4 @@
1
- import{Markdown as e}from"./chunk-XU3YOWEG.js";import{PLACEHOLDER_INK as t}from"./chunk-AYZY3YNC.js";import{Icon as l}from"./chunk-JOAKKXTL.js";import{LoadingSpinner as r}from"./chunk-R2VKEMZH.js";import{useShellStrings as s}from"./chunk-JSHMIMAJ.js";import{useState as a,useMemo as n}from"react";import{jsxs as i,jsx as o,Fragment as c}from"react/jsx-runtime";var d=({open:e})=>/* @__PURE__ */o(l,{name:"chevron-right",look:"mini",className:"h-3.5 w-3.5 shrink-0 transition-transform "+(e?"rotate-90":""),"aria-hidden":"true"});function h({docs:h,loading:m=!1,categoryOrder:p,canEdit:u=!1,onNew:g,onEdit:x,renderBody:f,emptyMessage:b}){const y=s(),[v,N]=a(""),[w,k]=a(null),[C,j]=a({}),M=v.trim().toLowerCase(),A=n(()=>{const e=/* @__PURE__ */new Map;for(const t of h){let l=e.get(t.category);l||(l={key:t.category,label:t.category_label||t.category,docs:[]},e.set(t.category,l)),l.docs.push(t)}if(!p?.length)return[...e.values()];const t=new Map(p.map((e,t)=>[e,t]));return[...e.values()].sort((e,l)=>(t.get(e.key)??1/0)-(t.get(l.key)??1/0))},[h,p]),L=e=>!M||e.title.toLowerCase().includes(M)||e.body.toLowerCase().includes(M)||e.category_label.toLowerCase().includes(M),_=n(()=>A.map(e=>({...e,docs:e.docs.filter(L)})).filter(e=>e.docs.length>0),[A,M]),E=n(()=>_.flatMap(e=>e.docs),[_]),Y=(w?E.find(e=>e.slug===w):void 0)??E[0]??null,J=e=>!!M||(C[e]??e===Y?.category);/* @__PURE__ */
1
+ import{Markdown as e}from"./chunk-2DQHXJPM.js";import{PLACEHOLDER_INK as t}from"./chunk-AYZY3YNC.js";import{Icon as l}from"./chunk-JOAKKXTL.js";import{LoadingSpinner as r}from"./chunk-R2VKEMZH.js";import{useShellStrings as s}from"./chunk-JSHMIMAJ.js";import{useState as a,useMemo as n}from"react";import{jsxs as i,jsx as o,Fragment as c}from"react/jsx-runtime";var d=({open:e})=>/* @__PURE__ */o(l,{name:"chevron-right",look:"mini",className:"h-3.5 w-3.5 shrink-0 transition-transform "+(e?"rotate-90":""),"aria-hidden":"true"});function h({docs:h,loading:m=!1,categoryOrder:p,canEdit:u=!1,onNew:g,onEdit:x,renderBody:f,emptyMessage:b}){const y=s(),[v,N]=a(""),[w,k]=a(null),[C,j]=a({}),M=v.trim().toLowerCase(),A=n(()=>{const e=/* @__PURE__ */new Map;for(const t of h){let l=e.get(t.category);l||(l={key:t.category,label:t.category_label||t.category,docs:[]},e.set(t.category,l)),l.docs.push(t)}if(!p?.length)return[...e.values()];const t=new Map(p.map((e,t)=>[e,t]));return[...e.values()].sort((e,l)=>(t.get(e.key)??1/0)-(t.get(l.key)??1/0))},[h,p]),L=e=>!M||e.title.toLowerCase().includes(M)||e.body.toLowerCase().includes(M)||e.category_label.toLowerCase().includes(M),_=n(()=>A.map(e=>({...e,docs:e.docs.filter(L)})).filter(e=>e.docs.length>0),[A,M]),J=n(()=>_.flatMap(e=>e.docs),[_]),E=(w?J.find(e=>e.slug===w):void 0)??J[0]??null,H=e=>!!M||(C[e]??e===E?.category);/* @__PURE__ */
2
2
  return i("div",{className:"flex h-full gap-4 px-4 py-3 min-h-0",children:[
3
3
  /* @__PURE__ */i("aside",{className:"w-64 shrink-0 flex flex-col bg-white rounded-lg shadow overflow-hidden",children:[
4
4
  /* @__PURE__ */i("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[
@@ -6,16 +6,16 @@ return i("div",{className:"flex h-full gap-4 px-4 py-3 min-h-0",children:[
6
6
  /* @__PURE__ */o("div",{className:"px-3 py-2 border-b border-line-subtle shrink-0",children:/* @__PURE__ */i("div",{className:"relative",children:[
7
7
  /* @__PURE__ */o(l,{name:"search",look:"mini",className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 ${t}`,"aria-hidden":"true"}),
8
8
  /* @__PURE__ */o("input",{type:"text",value:v,onChange:e=>N(e.target.value),placeholder:y.help.searchPlaceholder,className:"w-full rounded-md border border-line-strong bg-surface h-8 pl-8 pr-2 text-sm shadow-sm focus:border-blue-500 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-accent)]"})]})}),
9
- /* @__PURE__ */o("div",{className:"flex-1 overflow-y-auto py-1",children:m?/* @__PURE__ */o(r,{size:"sm",padding:"py-6",label:y.help.loading}):0===_.length?/* @__PURE__ */o("p",{className:"px-3 py-6 text-center text-xs text-gray-500",children:M?y.help.noResults:b??y.help.empty}):_.map(e=>{const t=J(e.key);/* @__PURE__ */
9
+ /* @__PURE__ */o("div",{className:"flex-1 overflow-y-auto py-1",children:m?/* @__PURE__ */o(r,{size:"sm",padding:"py-6",label:y.help.loading}):0===_.length?/* @__PURE__ */o("p",{className:"px-3 py-6 text-center text-xs text-gray-500",children:M?y.help.noResults:b??y.help.empty}):_.map(e=>{const t=H(e.key);/* @__PURE__ */
10
10
  return i("div",{className:"py-0.5",children:[
11
- /* @__PURE__ */i("button",{type:"button",onClick:()=>{return t=e.key,j(e=>({...e,[t]:!J(t)}));var t},className:"w-full flex items-center gap-2 h-8 px-3 text-left text-3xs font-semibold uppercase tracking-wide text-ink-faintest hover:text-gray-600",children:[
11
+ /* @__PURE__ */i("button",{type:"button",onClick:()=>{return t=e.key,j(e=>({...e,[t]:!H(t)}));var t},className:"w-full flex items-center gap-2 h-8 px-3 text-left text-3xs font-semibold uppercase tracking-wide text-ink-faintest hover:text-gray-600",children:[
12
12
  /* @__PURE__ */o(d,{open:t}),
13
- /* @__PURE__ */o("span",{className:"truncate",children:e.label})]}),t&&e.docs.map(e=>{const t=Y?.slug===e.slug;/* @__PURE__ */
13
+ /* @__PURE__ */o("span",{className:"truncate",children:e.label})]}),t&&e.docs.map(e=>{const t=E?.slug===e.slug;/* @__PURE__ */
14
14
  return i("button",{type:"button",onClick:()=>k(e.slug),className:"w-full text-left pl-8 pr-3 min-h-(--row-height-menu) py-2 text-sm flex items-center gap-2 transition-colors "+(t?"bg-blue-50 text-blue-700 font-medium":"text-gray-700 hover:bg-gray-50"),children:[
15
15
  /* @__PURE__ */o("span",{className:"truncate",children:e.title}),!1===e.is_published&&/* @__PURE__ */o("span",{className:"ml-auto shrink-0 text-2xs text-amber-600",children:y.help.draft})]},e.slug)})]},e.key)})})]}),
16
- /* @__PURE__ */o("main",{className:"flex-1 min-w-0 bg-white rounded-lg shadow overflow-hidden flex flex-col",children:Y?/* @__PURE__ */i(c,{children:[
16
+ /* @__PURE__ */o("main",{className:"flex-1 min-w-0 bg-white rounded-lg shadow overflow-hidden flex flex-col",children:E?/* @__PURE__ */i(c,{children:[
17
17
  /* @__PURE__ */i("div",{className:"flex items-start justify-between gap-4 px-5 py-3 border-b border-gray-200 bg-gray-50 shrink-0",children:[
18
18
  /* @__PURE__ */i("div",{className:"min-w-0",children:[
19
- /* @__PURE__ */o("h1",{className:"text-lg font-semibold text-gray-900 truncate",children:Y.title}),
20
- /* @__PURE__ */i("p",{className:"text-xs text-gray-500 mt-0.5",children:[Y.category_label,!1===Y.is_published&&/* @__PURE__ */i("span",{className:"ml-2 text-amber-600",children:["· ",y.help.draft]})]})]}),u&&x&&/* @__PURE__ */o("button",{type:"button",onClick:()=>x(Y),className:"shrink-0 text-sm text-blue-600 hover:underline",children:y.help.edit})]}),
21
- /* @__PURE__ */o("div",{className:"flex-1 overflow-auto px-5 py-4",children:f?f(Y):Y.body?/* @__PURE__ */o(e,{children:Y.body}):/* @__PURE__ */o("p",{className:"text-sm text-gray-500 italic",children:y.help.noBody})})]}):/* @__PURE__ */o("div",{className:"flex-1 flex items-center justify-center px-6 text-center",children:m?/* @__PURE__ */o(r,{size:"sm",padding:"",label:y.help.loading}):/* @__PURE__ */o("p",{className:"text-sm text-ink-faint",children:y.help.pickArticle})})})]})}export{h as HelpCenter};
19
+ /* @__PURE__ */o("h1",{className:"text-lg font-semibold text-gray-900 truncate",children:E.title}),
20
+ /* @__PURE__ */i("p",{className:"text-xs text-gray-500 mt-0.5",children:[E.category_label,!1===E.is_published&&/* @__PURE__ */i("span",{className:"ml-2 text-amber-600",children:["· ",y.help.draft]})]})]}),u&&x&&/* @__PURE__ */o("button",{type:"button",onClick:()=>x(E),className:"shrink-0 text-sm text-blue-600 hover:underline",children:y.help.edit})]}),
21
+ /* @__PURE__ */o("div",{className:"flex-1 overflow-auto px-5 py-4",children:f?f(E):E.body?/* @__PURE__ */o(e,{children:E.body}):/* @__PURE__ */o("p",{className:"text-sm text-gray-500 italic",children:y.help.noBody})})]}):/* @__PURE__ */o("div",{className:"flex-1 flex items-center justify-center px-6 text-center",children:m?/* @__PURE__ */o(r,{size:"sm",padding:"",label:y.help.loading}):/* @__PURE__ */o("p",{className:"text-sm text-ink-faint",children:y.help.pickArticle})})})]})}export{h as HelpCenter};
@@ -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}var r=["main","text","background","muted"],s=[...r,"surface"];function i(e){return r.includes(e)?{kind:"slot",slot:e}:/^#[0-9a-fA-F]{6}$/.test(e)?{kind:"hex",hex:e.toLowerCase()}:null}function o(e){return"surface"===e?{kind:"slot",slot:"surface"}:i(e)}function c(e){return/^[a-z]+-[0-9]+$/.test(e)}function u(e,t){const n=/^\{(underline|sup|sub|color=([a-z][a-z0-9-]*|#[0-9a-fA-F]{6})|style=([a-z]+-[0-9]+))\}/.exec(e.slice(t,t+64));return n?void 0!==n[2]?{kind:"color",color:n[2],length:n[0].length}:void 0!==n[3]?{kind:"style",style:n[3],length:n[0].length}:{kind:n[1],length:n[0].length}:null}var a={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",style:"styled text"},h={bullet:()=>"- ",number:e=>`${e+1}. `,quote:()=>"> "};function f(t,n,l,r,s=y,i=a){if("clear"===r)return X(t,n,l,s);const o=t.slice(n,l);if("link"===r){const e=o||i.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 c=h[r];if(c){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(c(t))),u=i.map((e,t)=>o?e.slice(c(t).length):c(t)+e).join("\n");return{text:t.slice(0,e)+u+t.slice(s),selectionStart:e,selectionEnd:e+u.length}}const{open:u,close:f}=e[r],d=r,p=i[d]??a[d];if(m(t,n,l,r))return{text:t.slice(0,n-u.length)+o+t.slice(l+f.length),selectionStart:n-u.length,selectionEnd:n-u.length+o.length};const k=o||p;return{text:t.slice(0,n)+u+k+f+t.slice(l),selectionStart:n+u.length,selectionEnd:n+u.length+k.length}}function d(e,t,n,r,s=a){const i={text:e,selectionStart:t,selectionEnd:n};if(null!==r){const e=l(r);if(null===e)return i;r=e}const o=e.slice(t,n),c=t>=1&&"["===e[t-1]&&"]"===e[n]?u(e,n+1):null;if("color"===c?.kind){const l=t-1,s=e.slice(n+1+c.length);return null===r?{text:e.slice(0,l)+o+s,selectionStart:l,selectionEnd:l+o.length}:{text:`${e.slice(0,n)}]{color=${r}}${s}`,selectionStart:t,selectionEnd:n}}if(null===r)return i;const h=o||(s.color??a.color);return{text:`${e.slice(0,t)}[${h}]{color=${r}}${e.slice(n)}`,selectionStart:t+1,selectionEnd:t+1+h.length}}function m(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 p(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=C(e,r);if(t&&n<=t.end)return{start:r,end:t.end,label:t.label,href:t.href}}return null}function k(e,t,n,l){const r=p(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 b(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 g=[{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"}],x={bold:"Strong",highlight:"Emphasis",quiet:"Quiet"};function S(e){return g.filter(t=>e.includes(t.style))}var y=[{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}],v=["highlight","quiet"],w=g.map(e=>e.style).filter(e=>y.some(t=>t.kind===e)).filter(e=>!v.includes(e)),E=[...y,{open:"*",close:"*",kind:"accent"}],M=[...y,{open:"*",close:"*",kind:"accent"},{open:"#",close:"#",kind:"bold",notBefore:"0123456789"},{open:"[",close:"]",kind:"italic",notBefore:"(",notBeforeBlock:!0}];function $(e){return!/\s/.test(e)&&!/[!-\/:-@[-`{-~]/.test(e)}function B(e,t){const n=[];let l="",r=0;for(;r<e.length;){const s=z(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 z(e,t,n){for(const l of n){if(!e.startsWith(l.open,t))continue;if(l.wordBoundary&&t>0&&$(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,r=e.indexOf(l.close,n);if(r<n+1)continue;const s=e.slice(n,r);if(s.includes(l.close[0]))continue;if(s.includes("\n"))continue;const i=r+l.close.length,o=e[i];if((!l.notBefore||void 0===o||!l.notBefore.includes(o))&&!(l.notBeforeBlock&&u(e,i)||l.wordBoundary&&void 0!==o&&$(o)))return{rule:l,inner:s,end:i}}return null}function q(e,t){return B(e,t).map(e=>e.text).join("")}var I=["http","https","mailto","tel"];function O(e){if(""===e||/[\s\u0000-\u001f\u007f]/.test(e))return!1;const t=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!t||I.includes(t[1].toLowerCase())}function C(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 O(s)?{label:l,href:s,end:r+1}:null}function L(e,t){if("["!==e[t])return null;let n=0;for(let l=t;l<e.length;l+=1){const r=e[l];if("\n"===r)return null;if("["===r)n+=1;else if("]"===r){if(n-=1,n>0)continue;if(l===t+1)return null;const r=u(e,l+1);return r?{kind:r.kind,color:r.color,style:r.style,label:e.slice(t+1,l),close:e.slice(l,l+1+r.length),end:l+1+r.length}:null}}return null}var _=4;function j(e,t,n){const l=[];let r="";const s=()=>{r&&l.push({kind:"text",text:r}),r=""},i=e=>n+1<_?j(e,t,n+1):[{kind:"text",text:e}];let o=0;for(;o<e.length;){const n=C(e,o);if(n){s(),l.push({kind:"link",href:n.href,children:i(n.label)}),o=n.end;continue}const c=L(e,o);if(c){s(),l.push({kind:c.kind,open:"[",close:c.close,...void 0===c.color?{}:{color:c.color},...void 0===c.style?{}:{style:c.style},children:i(c.label)}),o=c.end;continue}const u=z(e,o,t);u?(s(),l.push({kind:u.rule.kind,open:u.rule.open,close:u.rule.close,children:i(u.inner)}),o=u.end):(r+=e[o],o+=1)}return s(),l}function A(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:j(r,t,0)}})}function Q(e){return null!=e.number?`${e.number}. `:e.bullet?"- ":""}function N(e){return e.map(e=>"text"===e.kind?e.text:"link"===e.kind?`[${N(e.children)}](${e.href})`:e.open+N(e.children)+e.close).join("")}function W(e){return e.map(e=>Q(e)+N(e.children)).join("\n")}function F(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}}if("style"===n)return void 0!==r&&c(r)?{id:t,kind:"style",open:"[",close:`]{style=${r}}`,style:r}:null;const s=e[n];return s&&"code"!==n?{id:t,kind:n,open:s.open,close:s.close}:null}function Z(e,t){let n=0,l=0;return e.split("\n").map(e=>{const[r]=A(e,t);let s=l+Q(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?F(++n,"link",l.href):{id:++n,kind:l.kind,open:l.open,close:l.close,...void 0===l.color?{}:{color:l.color},...void 0===l.style?{}:{style:l.style}};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 K(e){let t="";const n=[];return e.forEach((e,l)=>{l>0&&(t+="\n"),t+=Q(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 T(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&&e.style===n.marks[t].style)}))})}function X(e,t,n,l=y){const r=Z(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=K(e);return T(e,Z(t.text,l))?t:null},u=(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 a=n?u(r,n):e?u(r,e)+e.ch.length:0;return{text:r.text,selectionStart:a,selectionEnd:a}}const a=new Set(s.filter(e=>e.at>=t&&e.at<n));if(0===a.size)return i;const h=new Set([...a].flatMap(e=>e.marks.map(e=>e.id))),f=c(J(o(e=>a.has(e)),h))??c(o((e,t)=>h.has(t.id)));if(!f)return i;const d=s.find(e=>a.has(e)),m=[...s].reverse().find(e=>a.has(e));return{text:f.text,selectionStart:u(f,d),selectionEnd:u(f,m)+m.ch.length}}function D(e,t,n,l=y){if(t===n)return{text:e,selectionStart:t,selectionEnd:n};const r=Z(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 u=e=>r.map(t=>({bullet:t.bullet,number:t.number,chars:t.chars.map(t=>({...t,marks:e(t)}))})),a=u(e=>i.has(e)?e.marks.filter(e=>!o(e)):e.marks);a.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=H(a,l)??H(u(e=>e.marks.filter(e=>!c.has(e.id))),l);return U(e,s,i,h,t,n)}function G(e){return e.at.flat()}function H(e,t){const n=K(e);return T(e,Z(n.text,t))?n:null}function J(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 P(e,t){return t.kind===e||"highlight"===e&&"accent"===t.kind}function R(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 U(e,t,n,l,r,s){if(!l)return{text:e,selectionStart:r,selectionEnd:s};const i=G(l),o=t.flatMap((e,t)=>n.has(e)?[t]:[]),c=o[0],u=o[o.length-1];return{text:l.text,selectionStart:i[c],selectionEnd:i[u]+t[u].ch.length}}function V(e,t,n,l,r=y){if(t===n||!F(0,l))return f(e,t,n,l,r);const s=Z(e,r),i=s.flatMap(e=>e.chars),o=new Set(i.filter(e=>e.at>=t&&e.at<n));if(0===o.size)return{text:e,selectionStart:t,selectionEnd:n};const c=e=>s.map(t=>({bullet:t.bullet,number:t.number,chars:t.chars.map(t=>({...t,marks:e(t)}))}));if([...o].every(e=>e.marks.some(e=>P(l,e)))){const s=new Set([...o].flatMap(e=>e.marks.filter(e=>P(l,e)).map(e=>e.id))),u=H(J(c(e=>o.has(e)?e.marks.filter(e=>!P(l,e)):e.marks),s),r)??H(c(e=>e.marks.filter(e=>!s.has(e.id))),r);return U(e,i,o,u,t,n)}const u=new Set([...o].flatMap(e=>e.marks.filter(e=>P(l,e)).map(e=>e.id))),a=new Set(i.filter(e=>o.has(e)||e.marks.some(e=>u.has(e.id)))),h=Math.max(0,...i.flatMap(e=>e.marks.map(e=>e.id)))+1,d=F(h,l),m=e=>i.every(t=>!t.marks.some(t=>t.id===e)||a.has(t)),p=H(J(c(e=>a.has(e)?R(e.marks.filter(e=>!P(l,e)),d,m):e.marks),/* @__PURE__ */new Set([h])),r);return U(e,i,o,p,t,n)}function Y(e,t,n,l=y){const r=Z(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 ee(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 te(e,t,n,l,r=y){const s=Z(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=G(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=ee(i,t,n);if(null===s)return k(e,t,n,l);const u=F(s,"link",l),a=H(o(e=>e.marks.map(e=>e.id===s?u:e)),r);return a?c(a,e=>e.marks.some(e=>e.id===s),u):{text:e,selectionStart:t,selectionEnd:n}}const u=new Set(i.filter(e=>e.at>=t&&e.at<n));if(0===u.size)return k(e,t,n,l);const a=F(Math.max(0,...i.flatMap(e=>e.marks.map(e=>e.id)))+1,"link",l),h=e=>i.every(t=>!t.marks.some(t=>t.id===e)||u.has(t)),f=H(o(e=>u.has(e)?R(e.marks.filter(e=>"link"!==e.kind),a,h):e.marks),r);return f?c(f,e=>u.has(e),a):{text:e,selectionStart:t,selectionEnd:n}}function ne(e,t,n,l=y){const r=Z(e,l),s=r.flatMap(e=>e.chars),i=ee(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 U(e,s,o,H(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 le(e,t,n,l,r,s){const i={text:t,selectionStart:n,selectionEnd:l};if(n===l||null!==r&&null===F(0,e,r))return i;const o=Z(t,s),c=o.flatMap(e=>e.chars),u=new Set(c.filter(e=>e.at>=n&&e.at<l));if(0===u.size)return i;const a=e=>o.map(t=>({bullet:t.bullet,number:t.number,chars:t.chars.map(t=>({...t,marks:e(t)}))})),h=new Set([...u].flatMap(t=>t.marks.filter(t=>t.kind===e).map(e=>e.id)));if(null===r){const r=H(J(a(t=>u.has(t)?t.marks.filter(t=>t.kind!==e):t.marks),h),s)??H(a(e=>e.marks.filter(e=>!h.has(e.id))),s);return U(t,c,u,r,n,l)}const f=Math.max(0,...c.flatMap(e=>e.marks.map(e=>e.id)))+1,d=F(f,e,r),m=e=>c.every(t=>!t.marks.some(t=>t.id===e)||u.has(t)),p=H(J(a(t=>u.has(t)?R(t.marks.filter(t=>t.kind!==e),d,m):t.marks),/* @__PURE__ */new Set([f,...h])),s);return U(t,c,u,p,n,l)}function re(e,t,n,l,r){const s=Z(t,r).flatMap(e=>e.chars),i=n===l?[[...s].reverse().find(e=>e.at<n&&!t.slice(e.at,n).includes("\n"))].filter(e=>void 0!==e):s.filter(e=>e.at>=n&&e.at<l);if(0===i.length)return null;const o=t=>t.marks.filter(t=>t.kind===e).pop()?.[e]??null,c=o(i[0]);return null!==c&&i.every(e=>o(e)===c)?c:null}function se(e,t,n,l,r=y){return le("color",e,t,n,l,r)}function ie(e,t,n,l=y){return re("color",e,t,n,l)}function oe(e,t,n,l,r=y){return le("style",e,t,n,l,r)}function ce(e,t,n,l=y){return re("style",e,t,n,l)}var ue=/^(?:- |([0-9]{1,3})\. )$/;function ae(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 he(e,t){if(null!=t.number)return"number";if(t.bullet)return"bullet";const n=ue.exec(e);return n?void 0===n[1]?"bullet":"number":null}function fe(e,t,n,l,r=y){const s=e.split("\n"),i=Z(e,r),{first:o,last:c}=ae(e,t,n),u=i.map((e,t)=>null===he(s[t],e)||e.bullet||null!=e.number?{bullet:e.bullet,number:e.number??null,chars:e.chars}:{bullet:!1,number:null,chars:[]});let a=0;if("number"===l&&o>0&&"number"===he(s[o-1],i[o-1])){const e=i[o-1].number??ue.exec(s[o-1])?.[1]??"0";a=Number(e)}const h=K(u.map((e,t)=>t<o||t>c?e:"bullet"===l?{bullet:!0,number:null,chars:e.chars}:"number"===l?{bullet:!1,number:String(a+=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}=ae(e,0,0),m=t=>{const{first:n}=ae(e,t,t);let l=0;for(let e=0;e<n;e+=1)l+=h[e].length-s[e].length;const r=null===he(s[o=n],i[o])||i[o].bullet||null!=i[o].number?Q(i[o]).length:s[o].length;var o;const c=h[n].length-(s[n].length-r),u=t-d[n];return d[n]+l+(u<r?c:u-r+c)};return{text:f,selectionStart:m(t),selectionEnd:m(n)}}function de(e,t,n,l=y){const r=e.split("\n"),s=Z(e,l),{first:i,last:o}=ae(e,t,n),c=new Set(s.slice(i,o+1).map((e,t)=>he(r[i+t],e)));return 1===c.size?[...c][0]:null}export{M as CAMPAIGN_MARKUP,r as COLOR_SLOTS,w as COPY_FIELD_TOOLS,s as FILL_COLOR_SLOTS,g as MARKUP_TOOLS,x as MARK_NAMES,a as MARK_PLACEHOLDERS,v as RETIRED_MARKS,y as STANDARD_MARKUP,E as STOREFRONT_MARKUP,d as applyColor,f as applyMark,X as clearMarks,D as clearStyle,ie as colorIn,se as colorOver,i as colorRole,o as fillColorRole,p as findLink,t as isColorName,n as isColorValue,O as isSafeLinkHref,c as isStyleId,te as linkOver,de as listIn,m as markedAt,Z as markedLines,Y as marksIn,S as markupTools,A as parseMarkup,b as removeLink,T as sameMarks,W as serializeMarkup,fe as setList,F as spanFor,q as stripInline,ce as styleIn,oe as styleOver,V as toggleMark,B as tokenizeInline,ne as unlinkAt,k as writeLink,K as writeMarkedLines};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export{TextLinkField,LinkPicker as default}from"../chunk-IFGNAY56.js";import"../chunk-25QDSYH5.js";import"../chunk-VJXPT53M.js";import"../chunk-EO5RLFRX.js";import"../chunk-RAOM3WIQ.js";import"../chunk-EQKUFYX6.js";import"../chunk-2NMW66P5.js";import"../chunk-UJUTS6LJ.js";import"../chunk-Q5Z3KHT2.js";import"../chunk-ZKGUBIBT.js";import"../chunk-QBWMWK2W.js";import"../chunk-W7DYKTHE.js";import"../chunk-SV5RRBVA.js";import"../chunk-AYZY3YNC.js";import"../chunk-UGTRSRIW.js";import"../chunk-DWGYC7OD.js";import"../chunk-ZICGXJUB.js";import"../chunk-URHGHXDN.js";import"../chunk-5QFPTDQF.js";import"../chunk-EVYD6UFQ.js";import"../chunk-M5K4AX4E.js";import"../chunk-JOAKKXTL.js";import"../chunk-J75ZT2JQ.js";import"../chunk-R2VKEMZH.js";import"../chunk-SOZCWT6I.js";import"../chunk-PGN5ME7B.js";import"../chunk-62LW225J.js";import"../chunk-GLUJS42B.js";import"../chunk-D65T4H6J.js";import"../chunk-UQYNPYF4.js";import"../chunk-MRJKZWWV.js";import"../chunk-TWVUQUUD.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-JSHMIMAJ.js";import"../chunk-C3QOHMR6.js";
2
+ export{TextLinkField,LinkPicker as default}from"../chunk-S3OCHYGE.js";import"../chunk-25QDSYH5.js";import"../chunk-VJXPT53M.js";import"../chunk-EO5RLFRX.js";import"../chunk-RAOM3WIQ.js";import"../chunk-EQKUFYX6.js";import"../chunk-2NMW66P5.js";import"../chunk-UJUTS6LJ.js";import"../chunk-Z5TE3MEG.js";import"../chunk-ZKGUBIBT.js";import"../chunk-QBWMWK2W.js";import"../chunk-W7DYKTHE.js";import"../chunk-SV5RRBVA.js";import"../chunk-AYZY3YNC.js";import"../chunk-UGTRSRIW.js";import"../chunk-DWGYC7OD.js";import"../chunk-ZICGXJUB.js";import"../chunk-URHGHXDN.js";import"../chunk-5QFPTDQF.js";import"../chunk-EVYD6UFQ.js";import"../chunk-M5K4AX4E.js";import"../chunk-JOAKKXTL.js";import"../chunk-J75ZT2JQ.js";import"../chunk-R2VKEMZH.js";import"../chunk-SOZCWT6I.js";import"../chunk-PGN5ME7B.js";import"../chunk-62LW225J.js";import"../chunk-GLUJS42B.js";import"../chunk-D65T4H6J.js";import"../chunk-UQYNPYF4.js";import"../chunk-MRJKZWWV.js";import"../chunk-TWVUQUUD.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-JSHMIMAJ.js";import"../chunk-C3QOHMR6.js";
@@ -79,10 +79,11 @@ interface SliderProps {
79
79
  /** Decimals in a step — 0.05 has two — so a value off the range carries no float dust. */
80
80
  declare function stepDecimals(step: number): number;
81
81
  /**
82
- * How many characters the box must hold: the widest of what this slider can
83
- * show — its min and its max with the step's decimals, the number it holds
84
- * now (a typed number may go past the range), and its empty word ("Auto") or
85
- * the number it follows.
82
+ * How many digit widths (`ch`) the box must hold before its text is measured:
83
+ * the widest of what this slider can show — its min and its max with the
84
+ * step's decimals, the number it holds now (a typed number may go past the
85
+ * range), and its empty word ("Auto") or the number it follows. A wide
86
+ * character (a translated "Auto" in Chinese) counts two.
86
87
  */
87
88
  declare function sliderBoxChars(texts: readonly (string | undefined)[]): number;
88
89
  declare function settleSliderValue(value: number, lo: number, hi: number, places: number): number;