efficient-shell 8.24.0 → 8.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/README.md +14 -0
  2. package/dist/{Browser-NYGNSRS3.js → Browser-RJEKM63G.js} +13 -13
  3. package/dist/Calculator-OFKUHJMM.js +29 -0
  4. package/dist/{CurrencyConverter-ET6QOMC6.js → CurrencyConverter-LUDRYE35.js} +5 -5
  5. package/dist/{Documents-76QU7XPF.js → Documents-JBPK256V.js} +11 -11
  6. package/dist/{Files-WBRBACPC.js → Files-CWO6JJRY.js} +87 -87
  7. package/dist/{Notepad-G4EQGYQB.js → Notepad-P32DNQV3.js} +9 -9
  8. package/dist/{PomodoroTimer-R3SOUADN.js → PomodoroTimer-773FYTGF.js} +68 -68
  9. package/dist/{Preview-UMQ6DJIP.js → Preview-C56RWJL7.js} +19 -19
  10. package/dist/{Sidebar-YB4OVUG5.js → Sidebar-3HM646LN.js} +34 -34
  11. package/dist/{Spreadsheet-EFCVA5SM.js → Spreadsheet-F3UZ7I6T.js} +9 -9
  12. package/dist/{Stock-T2VMQMOG.js → Stock-US3UN5TD.js} +3 -3
  13. package/dist/{Weather-UKIN7EGC.js → Weather-TOY4CXLT.js} +17 -17
  14. package/dist/{WorldClock-GWQIZZML.js → WorldClock-6JV67SYH.js} +6 -6
  15. package/dist/ai/index.d.ts +25 -2
  16. package/dist/ai/index.js +36 -37
  17. package/dist/apps/index.js +1 -1
  18. package/dist/bin/media-host-check.js +1 -1
  19. package/dist/bin/ui-check.js +1 -1
  20. package/dist/charts/BoxPlotChart.js +1 -1
  21. package/dist/charts/CandlestickChart.js +1 -1
  22. package/dist/charts/CartesianPlot.js +1 -1
  23. package/dist/charts/ChordChart.js +1 -1
  24. package/dist/charts/ColumnChart.js +1 -1
  25. package/dist/charts/HeatmapChart.js +1 -1
  26. package/dist/charts/HistogramChart.js +1 -1
  27. package/dist/charts/RadarChart.js +1 -1
  28. package/dist/charts/RangeChart.js +1 -1
  29. package/dist/charts/SankeyChart.js +1 -1
  30. package/dist/charts/ScatterChart.js +1 -1
  31. package/dist/charts/SpecChart.js +1 -1
  32. package/dist/charts/SunburstChart.js +1 -1
  33. package/dist/charts/TimeSeriesChart.js +1 -1
  34. package/dist/charts/TreemapChart.js +1 -1
  35. package/dist/charts/WaterfallChart.js +1 -1
  36. package/dist/{chunk-Z2YGQBLZ.js → chunk-2C6IG7LG.js} +1 -1
  37. package/dist/{chunk-TXS6JKFV.js → chunk-35YON46D.js} +1 -1
  38. package/dist/{chunk-EYX6KLCZ.js → chunk-37CCKGHU.js} +1 -1
  39. package/dist/{chunk-YGZMD6TZ.js → chunk-3IYMTPGR.js} +12 -12
  40. package/dist/{chunk-MTXTJLFK.js → chunk-4SQNLU2Q.js} +1 -1
  41. package/dist/{chunk-B55IXYDR.js → chunk-53ROHXAV.js} +2 -2
  42. package/dist/{chunk-QFA5COE6.js → chunk-6YH7JKRE.js} +2 -2
  43. package/dist/{chunk-KZEQJVBO.js → chunk-7FI6NVC7.js} +3 -3
  44. package/dist/{chunk-L4EH3ZYS.js → chunk-7IMJJT2K.js} +3 -3
  45. package/dist/{chunk-XHBQPVNG.js → chunk-BDCMFW5N.js} +1 -1
  46. package/dist/chunk-BF7NTCLU.js +1 -0
  47. package/dist/{chunk-NHCRQ7SW.js → chunk-BGLKEWVR.js} +1 -1
  48. package/dist/{chunk-TFMC2WAS.js → chunk-BKZGI76S.js} +1 -1
  49. package/dist/chunk-DJCC3WBR.js +14 -0
  50. package/dist/chunk-EMXR74QM.js +7 -0
  51. package/dist/{chunk-W5M6P4DZ.js → chunk-ETF7LAYZ.js} +5 -5
  52. package/dist/{chunk-GWIPZKZJ.js → chunk-ETNNJUAX.js} +3 -3
  53. package/dist/{chunk-WJRBDHXD.js → chunk-F4GLNQIX.js} +1 -1
  54. package/dist/{chunk-KWMMIOHD.js → chunk-FOLZVO2Z.js} +1 -1
  55. package/dist/{chunk-LLLAIPFX.js → chunk-GECH6THP.js} +1 -1
  56. package/dist/{chunk-3WC6ITJ3.js → chunk-H33Z4ZIY.js} +6 -6
  57. package/dist/chunk-HJH4WIBC.js +19 -0
  58. package/dist/{chunk-RSO67DWS.js → chunk-I4VD5D43.js} +4 -4
  59. package/dist/{chunk-BIYL7CEI.js → chunk-IFDW5QW6.js} +2 -2
  60. package/dist/{chunk-VX6V3B3N.js → chunk-IFLIGOSU.js} +3 -3
  61. package/dist/{chunk-ZF3QKPTL.js → chunk-IYZO6ADE.js} +1 -1
  62. package/dist/{chunk-LBLV64XG.js → chunk-JUGPTBMS.js} +1 -1
  63. package/dist/{chunk-TS2Q55PK.js → chunk-K4BEWZBI.js} +1 -1
  64. package/dist/{chunk-ZEKM6HAA.js → chunk-M2AIC7IK.js} +2 -2
  65. package/dist/{chunk-RUHFXBDS.js → chunk-MXVJHVVI.js} +5 -5
  66. package/dist/{chunk-PJCVNFWM.js → chunk-O6JX6RDX.js} +7 -7
  67. package/dist/{chunk-X7XJBK2E.js → chunk-OVVXSAGE.js} +4 -4
  68. package/dist/{chunk-CUT7PAXL.js → chunk-Q2YDR6GF.js} +1 -1
  69. package/dist/{chunk-QZXJHRFI.js → chunk-Q4TGK2K6.js} +6 -6
  70. package/dist/{chunk-KPTC2JPT.js → chunk-QR6V44P5.js} +1 -1
  71. package/dist/{chunk-JXZIBQ4V.js → chunk-REOSJZED.js} +24 -24
  72. package/dist/chunk-U6BEF6GQ.js +5 -0
  73. package/dist/{chunk-OS4CR7EE.js → chunk-V4KQUOUP.js} +4 -4
  74. package/dist/{chunk-UX6HNRFV.js → chunk-VP3CMJTT.js} +7 -7
  75. package/dist/{chunk-DISSJYKV.js → chunk-VV37BGSY.js} +11 -11
  76. package/dist/{chunk-S4DCWKIY.js → chunk-WISGY2OI.js} +47 -47
  77. package/dist/{chunk-AX7KPMDV.js → chunk-WSODT2L5.js} +2 -2
  78. package/dist/{chunk-OSA24YH6.js → chunk-WSPO4N72.js} +14 -14
  79. package/dist/{chunk-FRPNTDP4.js → chunk-ZNCU3UIW.js} +4 -4
  80. package/dist/{chunk-ZOSIPTXM.js → chunk-ZNXBKFV7.js} +5 -5
  81. package/dist/{chunk-NFR4QZL2.js → chunk-ZZNOQQWE.js} +4 -4
  82. package/dist/data/ListLoadError.js +1 -1
  83. package/dist/forms/BorderInput.js +1 -1
  84. package/dist/forms/BrandAssetEditor.js +1 -1
  85. package/dist/forms/ColorPicker.js +1 -1
  86. package/dist/forms/ComposerAttachments.js +1 -1
  87. package/dist/forms/CornersInput.js +1 -1
  88. package/dist/forms/DisplayChips.js +1 -1
  89. package/dist/forms/IconPicker.js +1 -1
  90. package/dist/forms/InputNumber.js +1 -1
  91. package/dist/forms/LinkPicker.js +1 -1
  92. package/dist/forms/MediaLibrary.js +1 -1
  93. package/dist/forms/MediaUploadField.js +1 -1
  94. package/dist/forms/MediaUploadGrid.js +1 -1
  95. package/dist/forms/MediaUsedInList.js +1 -1
  96. package/dist/forms/PositionInput.js +1 -1
  97. package/dist/forms/Select.d.ts +16 -1
  98. package/dist/forms/Select.js +1 -1
  99. package/dist/forms/SidesInput.js +1 -1
  100. package/dist/forms/Slider.js +1 -1
  101. package/dist/forms/Snippet.js +1 -1
  102. package/dist/forms/SplitButton.js +1 -1
  103. package/dist/forms/TextToolbar.js +1 -1
  104. package/dist/forms/WidthsBar.js +1 -1
  105. package/dist/icons/index.js +1 -1
  106. package/dist/index.js +190 -190
  107. package/dist/map/index.js +1 -1
  108. package/dist/page-tabs/index.js +5 -5
  109. package/dist/shell/AppUpdateBanner.js +1 -1
  110. package/dist/shell/ContextMenu.js +1 -1
  111. package/dist/shell/DropdownMenu.js +1 -1
  112. package/dist/shell/ImageLightbox.js +1 -1
  113. package/dist/shell/LanguageSelect.js +1 -1
  114. package/dist/shell/PopupMenu.js +1 -1
  115. package/dist/shell/SearchableSelect.js +1 -1
  116. package/dist/shell/SettingReset.js +1 -1
  117. package/dist/shell/SettingRow.js +1 -1
  118. package/dist/shell/TopNav.js +1 -1
  119. package/dist/telemetry/index.js +1 -1
  120. package/dist/templates/ChatTemplate.js +1 -1
  121. package/dist/templates/CheckoutTemplate.js +1 -1
  122. package/dist/templates/DashboardTemplate.js +1 -1
  123. package/dist/templates/DataTablePage.js +1 -1
  124. package/dist/templates/EmailTemplate.js +1 -1
  125. package/dist/templates/FormLayoutPage.js +1 -1
  126. package/dist/ui/index.js +1 -1
  127. package/dist/version.js +1 -1
  128. package/package.json +1 -1
  129. package/dist/Calculator-EN6VDDRG.js +0 -29
  130. package/dist/chunk-6WSTN5A3.js +0 -14
  131. package/dist/chunk-NT26CWMZ.js +0 -5
  132. package/dist/chunk-RNJ3MNO5.js +0 -1
  133. package/dist/chunk-VTVOQS5L.js +0 -20
  134. package/dist/chunk-WDXJWC3Y.js +0 -7
@@ -1,11 +1,11 @@
1
- import{ChartTooltip as e}from"./chunk-P5BOTIJU.js";import{usePlotWidth as t}from"./chunk-MAFUXCPZ.js";import{registerModalEscapeInterceptor as l}from"./chunk-TWVUQUUD.js";import{resolveSeriesColor as r,CHART_INK as n}from"./chunk-TZFACUMR.js";import{useShellStrings as i,useShellLocale as a}from"./chunk-E6UCGCOC.js";import{formatPlain as o}from"./chunk-C3QOHMR6.js";import{useRef as h,useId as c,useState as s,useEffect as m}from"react";import{jsx as f,jsxs as u}from"react/jsx-runtime";function x({rows:x,columns:d,cells:p,height:M,width:g,color:y,max:v,formatValue:$,label:b,className:k,emptyLabel:w,cellGap:A=2,cellRadius:C=2}){const N=i().charts,U=a(),j=$??(e=>o(e,U)),z=b??N.intensity,D=w??N.noActivity,F=h(null),R=t(F),S=g??R,B=c(),[E,G]=s(null);if(m(()=>{if(null!==E)return l(e=>"Escape"===e.key&&(G(null),!0))},[E]),0===x.length||0===d.length)/* @__PURE__ */
2
- return f("div",{className:k,ref:F,children:/* @__PURE__ */f("p",{className:"py-8 text-center text-sm text-gray-500",children:D})});const L=y??r(0),O=v??Math.max(1,...p.flat().filter(Number.isFinite)),T=96,V=26*x.length,I=M??V+26+26,P=Math.max(2,(Math.max(97,S)-T)/d.length),Q=e=>{const t=O>0?Math.max(0,Math.min(1,e/O)):0;return`color-mix(in oklab, ${L} ${(8+92*t).toFixed(1)}%, ${n.surface})`};/* @__PURE__ */
1
+ import{ChartTooltip as e}from"./chunk-P5BOTIJU.js";import{usePlotWidth as t}from"./chunk-MAFUXCPZ.js";import{resolveSeriesColor as l,CHART_INK as r}from"./chunk-TZFACUMR.js";import{registerModalEscapeInterceptor as n}from"./chunk-TWVUQUUD.js";import{useShellStrings as i,useShellLocale as a}from"./chunk-E6UCGCOC.js";import{formatPlain as o}from"./chunk-C3QOHMR6.js";import{useRef as h,useId as c,useState as s,useEffect as m}from"react";import{jsx as f,jsxs as u}from"react/jsx-runtime";function x({rows:x,columns:d,cells:p,height:M,width:g,color:y,max:v,formatValue:$,label:b,className:k,emptyLabel:w,cellGap:A=2,cellRadius:C=2}){const N=i().charts,U=a(),j=$??(e=>o(e,U)),z=b??N.intensity,D=w??N.noActivity,F=h(null),R=t(F),S=g??R,B=c(),[E,G]=s(null);if(m(()=>{if(null!==E)return n(e=>"Escape"===e.key&&(G(null),!0))},[E]),0===x.length||0===d.length)/* @__PURE__ */
2
+ return f("div",{className:k,ref:F,children:/* @__PURE__ */f("p",{className:"py-8 text-center text-sm text-gray-500",children:D})});const L=y??l(0),O=v??Math.max(1,...p.flat().filter(Number.isFinite)),T=96,V=26*x.length,I=M??V+26+26,P=Math.max(2,(Math.max(97,S)-T)/d.length),Q=e=>{const t=O>0?Math.max(0,Math.min(1,e/O)):0;return`color-mix(in oklab, ${L} ${(8+92*t).toFixed(1)}%, ${r.surface})`};/* @__PURE__ */
3
3
  return u("div",{className:`relative ${k??""}`,ref:F,children:[
4
4
  /* @__PURE__ */u("svg",{width:"100%",height:I,viewBox:`0 0 ${S} ${I}`,role:"img","aria-label":N.heatmap(z,x.length,d.length),tabIndex:0,className:"rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-deep)]",onMouseLeave:()=>G(null),onBlur:()=>G(null),onKeyDown:e=>{const t="ArrowDown"===e.key?1:"ArrowUp"===e.key?-1:0,l="ArrowRight"===e.key?1:"ArrowLeft"===e.key?-1:0;0===t&&0===l||(e.preventDefault(),G(e=>({r:Math.min(x.length-1,Math.max(0,(e?.r??0)+t)),c:Math.min(d.length-1,Math.max(0,(e?.c??0)+l))})))},children:[
5
5
  /* @__PURE__ */f("defs",{children:/* @__PURE__ */u("linearGradient",{id:B,x1:"0",x2:"1",children:[
6
6
  /* @__PURE__ */f("stop",{offset:"0",stopColor:Q(0)}),
7
- /* @__PURE__ */f("stop",{offset:"1",stopColor:Q(O)})]})}),x.map((e,t)=>/* @__PURE__ */f("text",{x:86,y:26*t+13+4,textAnchor:"end",fontSize:11,fill:n.label,children:e},`r${t}`)),x.map((e,t)=>d.map((l,r)=>{const n=p[t]?.[r]??0,i=E&&(E.r!==t||E.c!==r);/* @__PURE__ */
8
- return f("rect",{x:T+r*P+A/2,y:26*t+A/2,width:Math.max(1,P-A),height:26-A,rx:C,fill:Q(n),opacity:i?.55:1,onMouseEnter:()=>G({r:t,c:r}),children:/* @__PURE__ */f("title",{children:`${e} · ${l}: ${j(n)}`})},`${t}-${r}`)})),d.map((e,t)=>t%Math.max(1,Math.ceil(d.length/Math.max(1,Math.floor((S-T)/56))))===0?/* @__PURE__ */f("text",{x:T+t*P+P/2,y:V+15,textAnchor:"middle",fontSize:11,fill:n.label,children:e},`c${t}`):null),
7
+ /* @__PURE__ */f("stop",{offset:"1",stopColor:Q(O)})]})}),x.map((e,t)=>/* @__PURE__ */f("text",{x:86,y:26*t+13+4,textAnchor:"end",fontSize:11,fill:r.label,children:e},`r${t}`)),x.map((e,t)=>d.map((l,r)=>{const n=p[t]?.[r]??0,i=E&&(E.r!==t||E.c!==r);/* @__PURE__ */
8
+ return f("rect",{x:T+r*P+A/2,y:26*t+A/2,width:Math.max(1,P-A),height:26-A,rx:C,fill:Q(n),opacity:i?.55:1,onMouseEnter:()=>G({r:t,c:r}),children:/* @__PURE__ */f("title",{children:`${e} · ${l}: ${j(n)}`})},`${t}-${r}`)})),d.map((e,t)=>t%Math.max(1,Math.ceil(d.length/Math.max(1,Math.floor((S-T)/56))))===0?/* @__PURE__ */f("text",{x:T+t*P+P/2,y:V+15,textAnchor:"middle",fontSize:11,fill:r.label,children:e},`c${t}`):null),
9
9
  /* @__PURE__ */f("rect",{x:T,y:V+26,width:Math.min(180,Math.max(40,S-T)),height:8,rx:4,fill:`url(#${B})`}),
10
- /* @__PURE__ */f("text",{x:T,y:V+48,fontSize:11,fill:n.label,children:"0"}),
11
- /* @__PURE__ */f("text",{x:T+Math.min(180,Math.max(40,S-T)),y:V+48,textAnchor:"end",fontSize:11,fill:n.label,style:{fontVariantNumeric:"tabular-nums"},children:j(O)})]}),E&&/* @__PURE__ */f("div",{className:"pointer-events-none absolute top-1 right-1 z-10",children:/* @__PURE__ */f(e,{title:`${x[E.r]} · ${d[E.c]}`,rows:[{key:"v",label:z,color:L,value:null==p[E.r]?.[E.c]?void 0:j(p[E.r][E.c])}]})})]})}export{x as HeatmapChart};
10
+ /* @__PURE__ */f("text",{x:T,y:V+48,fontSize:11,fill:r.label,children:"0"}),
11
+ /* @__PURE__ */f("text",{x:T+Math.min(180,Math.max(40,S-T)),y:V+48,textAnchor:"end",fontSize:11,fill:r.label,style:{fontVariantNumeric:"tabular-nums"},children:j(O)})]}),E&&/* @__PURE__ */f("div",{className:"pointer-events-none absolute top-1 right-1 z-10",children:/* @__PURE__ */f(e,{title:`${x[E.r]} · ${d[E.c]}`,rows:[{key:"v",label:z,color:L,value:null==p[E.r]?.[E.c]?void 0:j(p[E.r][E.c])}]})})]})}export{x as HeatmapChart};
@@ -0,0 +1,19 @@
1
+ import{firstEnabledIndex as e,matchTypeahead as t,lastEnabledIndex as r,nextEnabledIndex as i}from"./chunk-EO5RLFRX.js";import{flattenOptionItems as n,groupedRows as a,isOptionGroup as l,OptionCheck as o}from"./chunk-UQBPKZUR.js";import{useSettingAuto as d}from"./chunk-E4Z5OXBI.js";import{inputClasses as s,PLACEHOLDER_INK as c}from"./chunk-JFSYWEHD.js";import{useIsMobile as u}from"./chunk-UGTRSRIW.js";import{optionNoteClass as p}from"./chunk-QR4RM7PO.js";import{Icon as m}from"./chunk-KIBL6M3T.js";import{onOverlayOpen as v}from"./chunk-PGN5ME7B.js";import{Z_LAYERS as h}from"./chunk-62LW225J.js";import{useDropdownPosition as f,MENU_MAX_HEIGHT as b}from"./chunk-GLUJS42B.js";import{solidSurfaceStyle as g}from"./chunk-DTJRIWFR.js";import{registerModalEscapeInterceptor as y}from"./chunk-TWVUQUUD.js";import{useShellStrings as x}from"./chunk-E6UCGCOC.js";import{forwardRef as w,useId as k,useState as N,useRef as $,useMemo as D,useCallback as j,useEffect as S,useLayoutEffect as E}from"react";import{createPortal as T}from"react-dom";import{jsxs as C,jsx as I,Fragment as O}from"react/jsx-runtime";var H=e=>e.labelStyle?{lineHeight:1.25,...e.labelStyle}:void 0,R=w(function({value:e,onChange:t,options:r,placeholder:i,invalid:n,className:a="",size:l,touchSize:o,renderOption:c,renderValue:u,valueText:p,readOnly:m,footer:v,changed:h,auto:f,multiple:b,"aria-describedby":g,...y},w){const N=t,$=x(),D=d(),j=f??D,S=k(),E=/* @__PURE__ */C("select",{ref:w,value:e,multiple:b||void 0,onChange:e=>N(b?Array.from(e.target.selectedOptions,e=>e.value):e.target.value),"aria-invalid":n||void 0,"aria-describedby":[g,j?S:void 0].filter(Boolean).join(" ")||void 0,className:s({invalid:n,size:l,auto:j,className:`pr-8 ${a}`.trim()}),...y,children:[void 0!==i&&!b&&/* @__PURE__ */I("option",{value:"",disabled:!0,children:i}),
2
+ /* @__PURE__ */I(z,{items:r})]});return j?/* @__PURE__ */C(O,{children:[E,
3
+ /* @__PURE__ */I("span",{id:S,hidden:!0,children:$.settingView.auto})]}):E});function z({items:e}){const t=e=>/* @__PURE__ */I("option",{value:e.value,disabled:e.disabled,lang:e.lang,children:e.label},e.value);/* @__PURE__ */
4
+ return I(O,{children:e.map((e,r)=>(e=>l(e))(e)?/* @__PURE__ */I("optgroup",{label:e.label,children:e.options.map(t)},`group-${r}`):t(e))})}var B=w(function({value:l,onChange:u,options:w,placeholder:R,invalid:B,className:U="",id:K,disabled:A,size:P,touchSize:V,title:W,multiple:F,renderOption:L,renderValue:M,valueText:G,readOnly:J=!1,footer:Q,changed:q=!1,auto:X,"aria-describedby":Y,"aria-label":Z,"aria-labelledby":_,...ee},te){const[re,ie]=N(!1),[ne,ae]=N(-1),le=$(null),oe=$(null),de=$(null),se=$(null),ce=$([]),ue=()=>se.current??de.current,pe=!!Q?.length,me="sm"===P,ve=me?"min-h-7 px-3 py-1 text-xs leading-4":"min-h-(--row-height-menu) px-3 py-2 text-sm leading-5",he=p(me),[fe,be]=N(null),ge=x(),ye=$(re);ye.current=re;const xe=$({buffer:"",timer:null}),we=k(),ke=`${we}-listbox`,Ne=K??`${we}-trigger`,$e=e=>`${we}-opt-${e}`,De=`${we}-changed`,je=d(),Se=X??je,Ee=`${we}-auto`,Te=[Y,q?De:void 0,Se?Ee:void 0].filter(Boolean).join(" ")||void 0,Ce=D(()=>n(w),[w]),Ie=F?l:[],Oe=u,He=f(oe,re,{matchTriggerWidth:!0,...Q?.length?{preferredMaxHeight:Number.POSITIVE_INFINITY}:{}}),Re="undefined"==typeof window?S:E,ze=`${re}|${He?.top}|${He?.bottom}|${He?.maxHeight}|${w.length}`;Re(()=>{be(null)},[ze]),Re(()=>{const e=de.current;if(!re||!e||null!==fe)return;if(e.scrollHeight<=e.clientHeight+1)return;const t=getComputedStyle(e),r=parseFloat(t.paddingTop)||0;parseFloat(t.paddingBottom);const i=e.getBoundingClientRect().top;let n=0;for(const t of e.querySelectorAll('[role="option"]')){const r=t.getBoundingClientRect().bottom-i+e.scrollTop;if(!(r<=e.clientHeight+.5))break;n=r}n>r&&be(Math.floor(n))},[re,fe,ze]);const Be=F?Ce.findIndex(e=>Ie.includes(e.value)):Ce.findIndex(e=>e.value===l),Ue=F?Ce.filter(e=>Ie.includes(e.value)).map(e=>e.label).join(", ")||void 0:Be>=0?Ce[Be].label:void 0,Ke=!F&&Be>=0?Ce[Be].lang:void 0,Ae=F?Ce.filter(e=>Ie.includes(e.value)):Be>=0?[Ce[Be]]:[],Pe=M&&Ae.length?M(Ae):void 0,Ve=void 0!==Pe&&G?G(Ae):void 0,We=j((e=!0)=>{ie(!1),ae(-1),e&&oe.current?.focus()},[]),Fe=j(()=>{A||J||(ae(Be>=0?Be:e(Ce)),ie(!0))},[A,J,Ce,Be]),Le=j(e=>{const t=Ce[e];if(t&&!t.disabled){if(F){const r=l;return Oe(r.includes(t.value)?r.filter(e=>e!==t.value):[...r,t.value]),void ae(e)}Oe(t.value),We()}},[Ce,F,l,Oe,We]);S(()=>{if(!re)return;return y(e=>!("Escape"!==e.key||!ye.current)&&(We(),!0),ue)},[re,We]),S(()=>{if(!re)return;const e=e=>{const t=e.target;le.current?.contains(t)||ue()?.contains(t)||We(!1)};document.addEventListener("pointerdown",e);const t=v(()=>We(!1));return()=>{document.removeEventListener("pointerdown",e),t()}},[re,We]),S(()=>{!re||ne<0||de.current?.querySelector(`#${CSS.escape($e(ne))}`)?.scrollIntoView({block:"nearest"})},[re,ne]);const Me=j(e=>{const r=xe.current;r.timer&&clearTimeout(r.timer),r.buffer+=e,r.timer=setTimeout(()=>{r.buffer="",r.timer=null},500);const i=re?ne:Be,n=t(Ce,r.buffer,i);n<0||(re?ae(n):F?(ae(n),ie(!0)):Le(n))},[re,ne,Be,Ce,Le,F]),Ge=re?a(w,(e,t)=>{const r=(i=e.value,F?Ie.includes(i):l===i);var i;const n=t===ne;/* @__PURE__ */
5
+ return C("div",{id:$e(t),role:"option",lang:e.description||e.labelStyle||L?void 0:e.lang,"aria-selected":r,"aria-disabled":e.disabled||void 0,onPointerEnter:()=>{e.disabled||ae(t)},onClick:()=>Le(t),className:`mx-1 cursor-pointer truncate rounded-lg ${ve}${F?" flex items-center gap-2":""}\n ${e.disabled?"cursor-not-allowed text-gray-400":n?"bg-blue-50 text-blue-700":r?"font-medium text-blue-600":"text-gray-700"}`,children:[F&&/* @__PURE__ */I(o,{selected:r}),L?/* @__PURE__ */I("span",{className:"block min-w-0 flex-1 truncate",children:L(e,{selected:r,active:n})}):F?/* @__PURE__ */C("span",{className:"block min-w-0 flex-1",children:[
6
+ /* @__PURE__ */I("span",{lang:e.lang,className:"block truncate",style:H(e),children:e.label}),e.description&&/* @__PURE__ */I("span",{className:he,children:e.description})]}):e.description||e.labelStyle?
7
+ /* @__PURE__ */C(O,{children:[
8
+ /* @__PURE__ */I("span",{lang:e.lang,className:"block truncate",style:H(e),children:e.label}),e.description&&/* @__PURE__ */I("span",{className:he,children:e.description})]}):e.label]},e.value)},we,"mx-1"):null,Je=void 0!==Pe?
9
+ /* @__PURE__ */C("span",{className:"relative block min-w-0 truncate",children:[
10
+ /* @__PURE__ */I("span",{"aria-hidden":"true","data-select-value":"",className:"flex min-w-0 items-center gap-2 truncate",children:Pe}),
11
+ /* @__PURE__ */I("span",{lang:void 0===Ve?Ke:void 0,className:"sr-only",children:Ve??Ue})]}):/* @__PURE__ */I("span",{lang:Ke,className:"block truncate "+(void 0===Ue?"text-gray-400":""),children:Ue??R??" "}),Qe={zIndex:h.popup,left:He?.left,top:He?.top,bottom:He?.bottom,width:He?.width,maxHeight:He?.maxHeight??b,visibility:He?void 0:"hidden",...g()},qe=/* @__PURE__ */I("div",{ref:de,id:ke,role:"listbox","aria-labelledby":_??(Z?void 0:Ne),"aria-label":_?void 0:Z,"aria-multiselectable":F||void 0,className:pe?"min-h-0 shrink overflow-y-auto py-1":"fixed overflow-y-auto rounded-(--radius-popup) py-1",style:pe?null!==fe?{maxHeight:fe}:void 0:null!==fe?{...Qe,maxHeight:fe}:Qe,children:Ge}),Xe=pe?/* @__PURE__ */C("div",{ref:se,className:"fixed flex flex-col overflow-hidden rounded-(--radius-popup)",style:Qe,children:[qe,
12
+ /* @__PURE__ */I("div",{className:"shrink-0 border-t border-(--rosh-glass-solid-border) px-1 py-1",children:Q.map((e,t)=>/* @__PURE__ */C("button",{ref:e=>{ce.current[t]=e},type:"button","data-select-action":"","aria-disabled":e.disabled||void 0,onClick:()=>(e=>{e.disabled||(We(),e.onSelect())})(e),onKeyDown:e=>((e,t)=>{const r=(Q?.length??0)-1,i=t=>{e.preventDefault(),ce.current[t]?.focus()},n=()=>{e.preventDefault(),oe.current?.focus()};switch(e.key){case"ArrowDown":return void i(Math.min(t+1,r));case"ArrowUp":return void(0===t?n():i(t-1));case"Home":return void i(0);case"End":return void i(r);case"Tab":return e.shiftKey?void(0===t?n():i(t-1)):t<r?void i(t+1):(e.preventDefault(),void We());case"Escape":return e.preventDefault(),e.stopPropagation(),void We()}})(e,t),className:`flex w-full items-center gap-2 rounded-lg ${ve} text-left rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)] ${e.disabled?"cursor-not-allowed text-gray-400":"cursor-pointer text-gray-700 hover:bg-blue-50 hover:text-blue-700"}`,children:[e.icon&&/* @__PURE__ */I(m,{name:e.icon,"aria-hidden":"true",className:"h-4 w-4 shrink-0"}),
13
+ /* @__PURE__ */I("span",{className:"min-w-0 flex-1 truncate",children:e.label})]},e.label))})]}):qe;/* @__PURE__ */
14
+ return C("div",{ref:le,className:"relative",children:[
15
+ /* @__PURE__ */I("button",{ref:oe,id:Ne,type:"button",role:"combobox","aria-haspopup":"listbox","aria-expanded":re,"aria-controls":re?ke:void 0,"aria-activedescendant":re&&ne>=0?$e(ne):void 0,"aria-invalid":B||void 0,"aria-describedby":Te,"aria-label":Z,"aria-labelledby":_,title:W,disabled:A,"aria-readonly":J||void 0,onClick:()=>re?We():Fe(),onKeyDown:t=>{if(!A&&!J)switch(t.key){case"ArrowDown":return t.preventDefault(),void(re?ae(e=>i(Ce,e,1)):Fe());case"ArrowUp":return t.preventDefault(),void(re?ae(e=>i(Ce,e,-1)):Fe());case"Home":return void(re&&(t.preventDefault(),ae(e(Ce))));case"End":return void(re&&(t.preventDefault(),ae(r(Ce))));case"Enter":return void(re&&(t.preventDefault(),Le(ne)));case" ":return t.preventDefault(),void(re?Le(ne):Fe());case"Escape":return void(re&&(t.preventDefault(),t.stopPropagation(),We()));case"Tab":return re&&pe&&!t.shiftKey?(t.preventDefault(),void ce.current[0]?.focus()):void(re&&We(!1));default:1!==t.key.length||t.metaKey||t.ctrlKey||t.altKey||(t.preventDefault(),Me(t.key))}},className:s({invalid:B,size:P,readOnly:J,auto:Se,className:`${J?"":"pr-8 "}text-left ${U}`.trim()}),children:q?
16
+ /* @__PURE__ */C("span",{className:"flex min-w-0 items-center gap-1",children:[Je,
17
+ /* @__PURE__ */I("span",{"aria-hidden":"true","data-select-changed":"",className:"shrink-0",children:"*"})]}):Je}),q&&/* @__PURE__ */I("span",{id:De,hidden:!0,children:ge.select.changed}),Se&&/* @__PURE__ */I("span",{id:Ee,hidden:!0,children:ge.settingView.auto}),!J&&/* @__PURE__ */I(m,{name:"chevron-up-down","aria-hidden":"true",className:`pointer-events-none absolute right-2.5 top-1/2 h-4 w-4 -translate-y-1/2 ${c}`,strokeWidth:2}),
18
+ /* @__PURE__ */C("select",{ref:te,value:l,multiple:F||void 0,onChange:e=>Oe(F?Array.from(e.target.selectedOptions,e=>e.value):e.target.value),disabled:A,"aria-hidden":"true",tabIndex:-1,className:"sr-only",...ee,children:[void 0!==R&&!F&&/* @__PURE__ */I("option",{value:"",disabled:!0,children:R}),
19
+ /* @__PURE__ */I(z,{items:w})]}),re&&T(Xe,document.body)]})}),U=w(function({touchSize:e="touch",...t},r){const i=u();return!i||void 0===t.footer&&void 0===t.changed||t.readOnly?i&&!t.readOnly?/* @__PURE__ */I(R,{ref:r,...t,size:e}):/* @__PURE__ */I(B,{ref:r,...t}):/* @__PURE__ */I(B,{ref:r,...t,size:e})});export{R as NativeSelect,U as Select_default};
@@ -1,8 +1,8 @@
1
- import{tooltipBesideBand as t}from"./chunk-MG7A3R75.js";import{niceAxis as e,niceMax as i,linearScale as r,axisGutter as n,bandScale as l}from"./chunk-2JWPNR2U.js";import{usePlotWidth as o}from"./chunk-MAFUXCPZ.js";import{registerModalEscapeInterceptor as a}from"./chunk-TWVUQUUD.js";import{CHART_INK as h}from"./chunk-TZFACUMR.js";import{useShellStrings as s,useShellLocale as c}from"./chunk-E6UCGCOC.js";import{formatPlain as m}from"./chunk-C3QOHMR6.js";import{useRef as d,useState as u,useId as f,useEffect as x}from"react";import{jsx as g,jsxs as p}from"react/jsx-runtime";function y({labels:y,values:v,height:b=220,width:k,bandPadding:M=.24,min:w,max:N,yTickCount:A=4,formatValue:$,yAxisLabel:j,xTickAnchor:C="center",children:R,overlay:E,tooltip:U,onSelect:z,ariaLabel:D,className:L,emptyLabel:P}){const F=s().charts,I=c(),S=$??(t=>m(t,I)),T=P??F.noData,V=d(null),W=o(V),B=k??W,[G,O]=u(null),Q=f();if(x(()=>{if(null!==G)return a(t=>"Escape"===t.key&&(O(null),!0))},[G]),0===y.length||!v.some(Number.isFinite))/* @__PURE__ */
1
+ import{tooltipBesideBand as t}from"./chunk-MG7A3R75.js";import{niceAxis as e,niceMax as i,linearScale as r,axisGutter as n,bandScale as l}from"./chunk-2JWPNR2U.js";import{usePlotWidth as o}from"./chunk-MAFUXCPZ.js";import{CHART_INK as a}from"./chunk-TZFACUMR.js";import{registerModalEscapeInterceptor as h}from"./chunk-TWVUQUUD.js";import{useShellStrings as s,useShellLocale as c}from"./chunk-E6UCGCOC.js";import{formatPlain as m}from"./chunk-C3QOHMR6.js";import{useRef as d,useState as u,useId as f,useEffect as x}from"react";import{jsx as g,jsxs as p}from"react/jsx-runtime";function y({labels:y,values:v,height:b=220,width:k,bandPadding:M=.24,min:w,max:N,yTickCount:A=4,formatValue:$,yAxisLabel:j,xTickAnchor:C="center",children:R,overlay:E,tooltip:U,onSelect:z,ariaLabel:D,className:L,emptyLabel:P}){const F=s().charts,I=c(),S=$??(t=>m(t,I)),T=P??F.noData,V=d(null),W=o(V),B=k??W,[G,O]=u(null),Q=f();if(x(()=>{if(null!==G)return h(t=>"Escape"===t.key&&(O(null),!0))},[G]),0===y.length||!v.some(Number.isFinite))/* @__PURE__ */
2
2
  return g("div",{className:L,ref:V,children:/* @__PURE__ */g("p",{className:"flex items-center justify-center text-sm text-gray-500",style:{height:b},children:T})});const Z=v.filter(Number.isFinite),H=Z.every(Number.isInteger),J=void 0===w&&void 0===N?e(Math.min(0,...Z),Math.max(0,...Z),{intervals:A+1,integer:H}):null,K=void 0!==w&&void 0===N?e(w,Math.max(w,...Z),{intervals:A+1,integer:H,zero:!1}):null,X=J?J.lo:w??Math.min(0,...Z),q=J?J.hi:K?K.hi:N??i(Math.max(...Z,0)),Y=J?J.ticks:K?[X,...K.ticks.filter(t=>t>X)]:r([X,q],{from:0,to:1}).ticks(A+1),_={top:12,right:16,bottom:26,left:n(Y.map(S),48)+(j?10:0)},tt=_.left,et=Math.max(tt+1,B-_.right),it=_.top,rt=b-_.bottom,nt=r([X,q],{from:rt,to:it}),lt=l(y.length,{from:tt,to:et},M),ot=(et-tt)/Math.max(1,y.length),at=ot>=48,ht=at?1:Math.max(1,Math.ceil(y.length/Math.max(1,Math.floor(B/84)))),st=Math.max(2,Math.floor((ot-6)/6.6)),ct=t=>at&&t.length>st?`${t.slice(0,st-1).trimEnd()}…`:t;/* @__PURE__ */
3
3
  return p("div",{className:`relative ${L??""}`,ref:V,children:[
4
4
  /* @__PURE__ */p("svg",{width:"100%",height:b,viewBox:`0 0 ${B} ${b}`,role:"img","aria-label":D,tabIndex:0,className:"rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-deep)]",onMouseLeave:()=>O(null),onBlur:()=>O(null),onKeyDown:t=>{if(z&&null!==G&&("Enter"===t.key||" "===t.key))return t.preventDefault(),void z(G);if("ArrowRight"!==t.key&&"ArrowLeft"!==t.key)return;t.preventDefault();const e="ArrowRight"===t.key?1:-1;O(t=>Math.min(y.length-1,Math.max(0,(t??0)+e)))},children:[
5
- /* @__PURE__ */g("defs",{children:/* @__PURE__ */g("clipPath",{id:Q,children:/* @__PURE__ */g("rect",{x:tt,y:it,width:et-tt,height:rt-it})})}),Y.map(t=>/* @__PURE__ */g("line",{x1:tt,y1:nt(t),x2:et,y2:nt(t),stroke:h.grid,strokeWidth:1,shapeRendering:"crispEdges"},`g${t}`)),
6
- /* @__PURE__ */g("line",{x1:tt,y1:nt(Math.max(X,0)),x2:et,y2:nt(Math.max(X,0)),stroke:h.axis,strokeWidth:1,shapeRendering:"crispEdges"}),Y.map(t=>/* @__PURE__ */g("text",{x:tt-8,y:nt(t)+4,textAnchor:"end",fontSize:11,fill:h.label,style:{fontVariantNumeric:"tabular-nums"},children:S(t)},`t${t}`)),j&&/* @__PURE__ */g("text",{x:14,y:(it+rt)/2,transform:`rotate(-90 14 ${(it+rt)/2})`,textAnchor:"middle",fontSize:11,fill:h.label,children:j}),
7
- /* @__PURE__ */g("g",{clipPath:`url(#${Q})`,children:R({x:lt,y:nt,left:tt,right:et,top:it,bottom:rt,width:B,height:b,clipId:Q,active:G})}),E?.({x:lt,y:nt,left:tt,right:et,top:it,bottom:rt,width:B,height:b,clipId:Q,active:G}),y.map((t,e)=>e%ht===0?/* @__PURE__ */g("text",{x:"start"===C?lt(e):lt.center(e),y:b-8,textAnchor:"middle",fontSize:11,fill:h.label,style:{fontVariantNumeric:"tabular-nums"},children:ct(t)},`x${e}`):null),y.map((t,e)=>/* @__PURE__ */g("rect",{x:lt.center(e)-(et-tt)/y.length/2,y:it,width:(et-tt)/y.length,height:rt-it,fill:"transparent",onMouseEnter:()=>O(e),onClick:z?()=>z(e):void 0,style:z?{cursor:"pointer"}:void 0},`h${e}`))]}),U&&null!==G&&
5
+ /* @__PURE__ */g("defs",{children:/* @__PURE__ */g("clipPath",{id:Q,children:/* @__PURE__ */g("rect",{x:tt,y:it,width:et-tt,height:rt-it})})}),Y.map(t=>/* @__PURE__ */g("line",{x1:tt,y1:nt(t),x2:et,y2:nt(t),stroke:a.grid,strokeWidth:1,shapeRendering:"crispEdges"},`g${t}`)),
6
+ /* @__PURE__ */g("line",{x1:tt,y1:nt(Math.max(X,0)),x2:et,y2:nt(Math.max(X,0)),stroke:a.axis,strokeWidth:1,shapeRendering:"crispEdges"}),Y.map(t=>/* @__PURE__ */g("text",{x:tt-8,y:nt(t)+4,textAnchor:"end",fontSize:11,fill:a.label,style:{fontVariantNumeric:"tabular-nums"},children:S(t)},`t${t}`)),j&&/* @__PURE__ */g("text",{x:14,y:(it+rt)/2,transform:`rotate(-90 14 ${(it+rt)/2})`,textAnchor:"middle",fontSize:11,fill:a.label,children:j}),
7
+ /* @__PURE__ */g("g",{clipPath:`url(#${Q})`,children:R({x:lt,y:nt,left:tt,right:et,top:it,bottom:rt,width:B,height:b,clipId:Q,active:G})}),E?.({x:lt,y:nt,left:tt,right:et,top:it,bottom:rt,width:B,height:b,clipId:Q,active:G}),y.map((t,e)=>e%ht===0?/* @__PURE__ */g("text",{x:"start"===C?lt(e):lt.center(e),y:b-8,textAnchor:"middle",fontSize:11,fill:a.label,style:{fontVariantNumeric:"tabular-nums"},children:ct(t)},`x${e}`):null),y.map((t,e)=>/* @__PURE__ */g("rect",{x:lt.center(e)-(et-tt)/y.length/2,y:it,width:(et-tt)/y.length,height:rt-it,fill:"transparent",onMouseEnter:()=>O(e),onClick:z?()=>z(e):void 0,style:z?{cursor:"pointer"}:void 0},`h${e}`))]}),U&&null!==G&&
8
8
  /* @__PURE__ */g("div",{className:"pointer-events-none absolute top-2 z-10",style:t(lt.center(G),lt.bandwidth,B),children:U(G)})]})}export{y as CartesianPlot};
@@ -1,2 +1,2 @@
1
- import{ChartTooltip as t}from"./chunk-P5BOTIJU.js";import{CartesianPlot as o}from"./chunk-RSO67DWS.js";import{binValues as r}from"./chunk-2JWPNR2U.js";import{resolveSeriesColor as a}from"./chunk-TZFACUMR.js";import{useShellStrings as e,useShellLocale as i}from"./chunk-E6UCGCOC.js";import{formatPlain as m,formatFixed as n}from"./chunk-C3QOHMR6.js";import{jsx as l}from"react/jsx-runtime";function c({values:c,bins:s=10,precomputed:h,height:u=220,width:p,color:b,tone:f,formatBound:d,formatCount:x,yAxisLabel:g,label:k,className:y,emptyLabel:j}){const C=e().charts,v=i(),w=d??(t=>Number.isInteger(t)?m(t,v):n(t,1,v)),A=x??(t=>m(t,v)),L=g??C.countAxis,O=k??C.distribution,M=h??r(c??[],s),N=a(0,b,f),R=M.map(t=>w(t.from)),U=M.map(t=>t.count);/* @__PURE__ */
2
- return l(o,{labels:R,values:U,height:u,width:p,bandPadding:0,xTickAnchor:"start",formatValue:A,yAxisLabel:L,className:y,emptyLabel:j,ariaLabel:C.histogram(O,M.length,(c??[]).length),tooltip:o=>/* @__PURE__ */l(t,{title:`${w(M[o].from)} – ${w(M[o].to)}`,rows:[{key:"count",label:C.observations,color:N,value:A(M[o].count)}]}),children:({x:t,y:o,bottom:r,active:a})=>/* @__PURE__ */l("g",{children:M.map((e,i)=>/* @__PURE__ */l("rect",{x:t(i)+.5,y:o(e.count),width:Math.max(1,t.bandwidth-1),height:Math.max(0,r-o(e.count)),fill:N,fillOpacity:null===a||a===i?.85:.42},i))})})}export{c as HistogramChart};
1
+ import{ChartTooltip as t}from"./chunk-P5BOTIJU.js";import{CartesianPlot as o}from"./chunk-I4VD5D43.js";import{binValues as r}from"./chunk-2JWPNR2U.js";import{resolveSeriesColor as a}from"./chunk-TZFACUMR.js";import{useShellStrings as e,useShellLocale as i}from"./chunk-E6UCGCOC.js";import{formatPlain as m,formatFixed as n}from"./chunk-C3QOHMR6.js";import{jsx as l}from"react/jsx-runtime";function c({values:c,bins:s=10,precomputed:h,height:u=220,width:p,color:b,tone:f,formatBound:d,formatCount:x,yAxisLabel:g,label:k,className:y,emptyLabel:j}){const C=e().charts,v=i(),w=d??(t=>Number.isInteger(t)?m(t,v):n(t,1,v)),A=x??(t=>m(t,v)),L=g??C.countAxis,M=k??C.distribution,N=h??r(c??[],s),O=a(0,b,f),U=N.map(t=>w(t.from)),I=N.map(t=>t.count);/* @__PURE__ */
2
+ return l(o,{labels:U,values:I,height:u,width:p,bandPadding:0,xTickAnchor:"start",formatValue:A,yAxisLabel:L,className:y,emptyLabel:j,ariaLabel:C.histogram(M,N.length,(c??[]).length),tooltip:o=>/* @__PURE__ */l(t,{title:`${w(N[o].from)} – ${w(N[o].to)}`,rows:[{key:"count",label:C.observations,color:O,value:A(N[o].count)}]}),children:({x:t,y:o,bottom:r,active:a})=>/* @__PURE__ */l("g",{children:N.map((e,i)=>/* @__PURE__ */l("rect",{x:t(i)+.5,y:o(e.count),width:Math.max(1,t.bandwidth-1),height:Math.max(0,r-o(e.count)),fill:O,fillOpacity:null===a||a===i?.85:.42},i))})})}export{c as HistogramChart};
@@ -1,4 +1,4 @@
1
- import{ColorPicker as e}from"./chunk-DISSJYKV.js";import{InputNumber_default as t}from"./chunk-MTXTJLFK.js";import{Segmented as l}from"./chunk-N6DTTOB6.js";import{Icon as r}from"./chunk-KIBL6M3T.js";import{jsxs as a,Fragment as o,jsx as s}from"react/jsx-runtime";var i=["solid","dashed","dotted"],n=["top","right","bottom","left"];function d(e){const t=e??{},l="number"==typeof t.width?t.width:0;return Object.fromEntries(n.map(e=>[e,"number"==typeof t[e]?t[e]:l]))}function m(e,t){const l=e??{},r=d(t),a=n.some(e=>"number"==typeof l[e]),o=n.map(e=>"number"==typeof l[e]?l[e]:"number"==typeof l.width?l.width:a?0:r[e]);return!o.every(e=>e===o[0])}var c="h-3.5 w-3.5",h={all:/* @__PURE__ */s(r,{name:"border-all","aria-hidden":"true",className:c}),top:/* @__PURE__ */s(r,{name:"border-top","aria-hidden":"true",className:c}),right:/* @__PURE__ */s(r,{name:"border-right","aria-hidden":"true",className:c}),bottom:/* @__PURE__ */s(r,{name:"border-bottom","aria-hidden":"true",className:c}),left:/* @__PURE__ */s(r,{name:"border-left","aria-hidden":"true",className:c})},p={solid:/* @__PURE__ */s(r,{name:"line-solid","aria-hidden":"true",className:c}),dashed:/* @__PURE__ */s(r,{name:"line-dashed","aria-hidden":"true",className:c}),dotted:/* @__PURE__ */s(r,{name:"line-dotted","aria-hidden":"true",className:c})};function u({label:r,value:d,onChange:m,each:c,placeholder:u,presets:f,words:b,widths:w=!0,styles:y=!0,min:g=0,max:v=20,step:N=1,readOnly:x}){const S=e=>"number"==typeof d[e]?d[e]:null,j=(e,t)=>{const l={...d};if("number"==typeof d.width)for(const e of n)null===S(e)&&(l[e]=d.width);l[e]=t,delete l.width,m(l)},k=(e,l,r,a,o,i)=>/* @__PURE__ */s("div",{"data-side":e,className:"all"===e?"col-span-2 min-w-0":"min-w-0",children:/* @__PURE__ */s(t,{value:a,onChange:i,min:g,max:v,step:N,precision:0,steppers:"compact",readOnly:x,placeholder:o,prefix:r,suffix:b.unit,"aria-label":l})}),T=n.map(S),C="number"==typeof d.width?d.width:T.every(e=>null!==e&&e===T[0])?T[0]:null,O=null===C&&T.some(e=>null!==e),I=n.every(e=>u.sides[e]===u.sides.top)?String(u.sides.top):"–",K=e=>S(e)??("number"==typeof d.width?d.width:null),z=d.style??u.style;/* @__PURE__ */
2
- return a("div",{role:"group","aria-label":r,"data-border":c?"each":"all",className:"grid w-full min-w-0 grid-cols-2 gap-2",children:[w?c?/* @__PURE__ */a(o,{children:[k("left",b.sides.left,h.left,K("left"),String(u.sides.left),e=>j("left",e)),k("top",b.sides.top,h.top,K("top"),String(u.sides.top),e=>j("top",e)),k("right",b.sides.right,h.right,K("right"),String(u.sides.right),e=>j("right",e)),k("bottom",b.sides.bottom,h.bottom,K("bottom"),String(u.sides.bottom),e=>j("bottom",e))]}):k("all",b.width,h.all,C,O?"–":I,e=>{const t={...d,width:e};for(const e of n)delete t[e];m(t)}):null,y&&/* @__PURE__ */s("div",{"data-border-style":"",className:"col-span-2 min-w-0",children:/* @__PURE__ */s(l,{block:!0,size:"sm",label:b.style,value:z,onChange:e=>{x||m({...d,style:e})},options:i.map(e=>({value:e,label:/* @__PURE__ */a(o,{children:[p[e],
1
+ import{Segmented as e}from"./chunk-N6DTTOB6.js";import{ColorPicker as t}from"./chunk-VV37BGSY.js";import{InputNumber_default as l}from"./chunk-4SQNLU2Q.js";import{Icon as r}from"./chunk-KIBL6M3T.js";import{jsxs as a,Fragment as o,jsx as s}from"react/jsx-runtime";var i=["solid","dashed","dotted"],n=["top","right","bottom","left"];function d(e){const t=e??{},l="number"==typeof t.width?t.width:0;return Object.fromEntries(n.map(e=>[e,"number"==typeof t[e]?t[e]:l]))}function m(e,t){const l=e??{},r=d(t),a=n.some(e=>"number"==typeof l[e]),o=n.map(e=>"number"==typeof l[e]?l[e]:"number"==typeof l.width?l.width:a?0:r[e]);return!o.every(e=>e===o[0])}var c="h-3.5 w-3.5",h={all:/* @__PURE__ */s(r,{name:"border-all","aria-hidden":"true",className:c}),top:/* @__PURE__ */s(r,{name:"border-top","aria-hidden":"true",className:c}),right:/* @__PURE__ */s(r,{name:"border-right","aria-hidden":"true",className:c}),bottom:/* @__PURE__ */s(r,{name:"border-bottom","aria-hidden":"true",className:c}),left:/* @__PURE__ */s(r,{name:"border-left","aria-hidden":"true",className:c})},p={solid:/* @__PURE__ */s(r,{name:"line-solid","aria-hidden":"true",className:c}),dashed:/* @__PURE__ */s(r,{name:"line-dashed","aria-hidden":"true",className:c}),dotted:/* @__PURE__ */s(r,{name:"line-dotted","aria-hidden":"true",className:c})};function u({label:r,value:d,onChange:m,each:c,placeholder:u,presets:f,words:b,widths:w=!0,styles:y=!0,min:g=0,max:N=20,step:v=1,readOnly:x}){const S=e=>"number"==typeof d[e]?d[e]:null,j=(e,t)=>{const l={...d};if("number"==typeof d.width)for(const e of n)null===S(e)&&(l[e]=d.width);l[e]=t,delete l.width,m(l)},k=(e,t,r,a,o,i)=>/* @__PURE__ */s("div",{"data-side":e,className:"all"===e?"col-span-2 min-w-0":"min-w-0",children:/* @__PURE__ */s(l,{value:a,onChange:i,min:g,max:N,step:v,precision:0,steppers:"compact",readOnly:x,placeholder:o,prefix:r,suffix:b.unit,"aria-label":t})}),C=n.map(S),O="number"==typeof d.width?d.width:C.every(e=>null!==e&&e===C[0])?C[0]:null,B=null===O&&C.some(e=>null!==e),T=n.every(e=>u.sides[e]===u.sides.top)?String(u.sides.top):"–",z=e=>S(e)??("number"==typeof d.width?d.width:null),I=d.style??u.style;/* @__PURE__ */
2
+ return a("div",{role:"group","aria-label":r,"data-border":c?"each":"all",className:"grid w-full min-w-0 grid-cols-2 gap-2",children:[w?c?/* @__PURE__ */a(o,{children:[k("left",b.sides.left,h.left,z("left"),String(u.sides.left),e=>j("left",e)),k("top",b.sides.top,h.top,z("top"),String(u.sides.top),e=>j("top",e)),k("right",b.sides.right,h.right,z("right"),String(u.sides.right),e=>j("right",e)),k("bottom",b.sides.bottom,h.bottom,z("bottom"),String(u.sides.bottom),e=>j("bottom",e))]}):k("all",b.width,h.all,O,B?"–":T,e=>{const t={...d,width:e};for(const e of n)delete t[e];m(t)}):null,y&&/* @__PURE__ */s("div",{"data-border-style":"",className:"col-span-2 min-w-0",children:/* @__PURE__ */s(e,{block:!0,size:"sm",label:b.style,value:I,onChange:e=>{x||m({...d,style:e})},options:i.map(e=>({value:e,label:/* @__PURE__ */a(o,{children:[p[e],
3
3
  /* @__PURE__ */s("span",{className:"sr-only",children:b.styles[e]})]}),title:b.styles[e]}))})}),
4
- /* @__PURE__ */s("div",{"data-border-color":"",className:"col-span-2 flex min-w-0 items-center",children:/* @__PURE__ */s(e,{value:d.color??"",onChange:e=>{x||m({...d,color:e})},label:b.color,presets:f,fallback:u.color,showHexInput:!0,size:"sm",disabled:x})})]})}export{i as BORDER_LINE_STYLES,u as BorderInput,d as borderSides,m as borderStartEach};
4
+ /* @__PURE__ */s("div",{"data-border-color":"",className:"col-span-2 flex min-w-0 items-center",children:/* @__PURE__ */s(t,{value:d.color??"",onChange:e=>{x||m({...d,color:e})},label:b.color,presets:f,fallback:u.color,showHexInput:!0,size:"sm",disabled:x})})]})}export{i as BORDER_LINE_STYLES,u as BorderInput,d as borderSides,m as borderStartEach};
@@ -1,4 +1,4 @@
1
- import{Modal as e}from"./chunk-S4DCWKIY.js";import{keepsNativeMenu as a}from"./chunk-5QFPTDQF.js";import{jsx as i,jsxs as n}from"react/jsx-runtime";var t={activeOpacity:70,inactiveOpacity:50,activeBlur:0,inactiveBlur:0};function r(e){try{const a=JSON.parse(localStorage.getItem(e)||"");return null!=a.blur&&null==a.activeBlur&&(a.activeBlur=a.blur,a.inactiveBlur=a.blur,delete a.blur),{...t,...a}}catch{return t}}function l({open:t,onClose:r,title:l,appearance:c,onAppearanceChange:s,onSave:d,children:o}){if(!t)return null;const u="w-full h-1.5 rounded-full appearance-none bg-gray-200 cursor-pointer accent-blue-500",p="flex items-center justify-between text-xs text-gray-500";/* @__PURE__ */
1
+ import{Modal as e}from"./chunk-WISGY2OI.js";import{keepsNativeMenu as a}from"./chunk-5QFPTDQF.js";import{jsx as i,jsxs as n}from"react/jsx-runtime";var t={activeOpacity:70,inactiveOpacity:50,activeBlur:0,inactiveBlur:0};function r(e){try{const a=JSON.parse(localStorage.getItem(e)||"");return null!=a.blur&&null==a.activeBlur&&(a.activeBlur=a.blur,a.inactiveBlur=a.blur,delete a.blur),{...t,...a}}catch{return t}}function l({open:t,onClose:r,title:l,appearance:c,onAppearanceChange:s,onSave:d,children:o}){if(!t)return null;const u="w-full h-1.5 rounded-full appearance-none bg-gray-200 cursor-pointer accent-blue-500",p="flex items-center justify-between text-xs text-gray-500";/* @__PURE__ */
2
2
  return i("div",{onPointerDown:e=>e.stopPropagation(),onContextMenu:e=>{e.stopPropagation(),a(e.target)||e.preventDefault()},children:/* @__PURE__ */i(e,{open:t,onClose:r,title:l,size:"sm",children:/* @__PURE__ */n("div",{className:"space-y-4",children:[o,
3
3
  /* @__PURE__ */n("div",{children:[
4
4
  /* @__PURE__ */i("h3",{className:"text-sm font-semibold text-gray-700 mb-3",children:"Appearance"}),
@@ -1,4 +1,4 @@
1
- import{ChartTooltip as e}from"./chunk-P5BOTIJU.js";import{CartesianPlot as l}from"./chunk-RSO67DWS.js";import{STATUS_VARS as o}from"./chunk-TZFACUMR.js";import{useShellStrings as t,useShellLocale as a}from"./chunk-E6UCGCOC.js";import{formatPlain as i,formatFixed as r}from"./chunk-C3QOHMR6.js";import{jsx as c,jsxs as n,Fragment as s}from"react/jsx-runtime";function h({candles:h,variant:m="candle",height:p=260,width:d,formatValue:u,yAxisLabel:b,label:y,className:x,emptyLabel:k}){const g=t().charts,f=a(),w=u??(e=>Number.isInteger(e)?i(e,f):r(e,2,f)),M=y??g.price,v=h.flatMap(e=>[e.low,e.high]).filter(Number.isFinite),j=Math.min(...v),C=Math.max(...v),L=.08*(C-j)||1;/* @__PURE__ */
1
+ import{ChartTooltip as e}from"./chunk-P5BOTIJU.js";import{CartesianPlot as l}from"./chunk-I4VD5D43.js";import{STATUS_VARS as o}from"./chunk-TZFACUMR.js";import{useShellStrings as t,useShellLocale as a}from"./chunk-E6UCGCOC.js";import{formatPlain as i,formatFixed as r}from"./chunk-C3QOHMR6.js";import{jsx as c,jsxs as n,Fragment as s}from"react/jsx-runtime";function h({candles:h,variant:m="candle",height:p=260,width:d,formatValue:u,yAxisLabel:b,label:y,className:x,emptyLabel:k}){const g=t().charts,f=a(),w=u??(e=>Number.isInteger(e)?i(e,f):r(e,2,f)),M=y??g.price,v=h.flatMap(e=>[e.low,e.high]).filter(Number.isFinite),j=Math.min(...v),C=Math.max(...v),L=.08*(C-j)||1;/* @__PURE__ */
2
2
  return c(l,{labels:h.map(e=>e.label),values:v,height:p,width:d,min:j-L,max:C+L,bandPadding:.42,formatValue:w,yAxisLabel:b,className:x,emptyLabel:k,ariaLabel:g.ohlc(M,h.length),tooltip:l=>{const t=h[l],a=t.close>=t.open,i=a?o.good:o.critical;/* @__PURE__ */
3
3
  return c(e,{title:t.label,rows:[{key:"open",label:g.open,color:i,value:w(t.open)},{key:"high",label:g.high,color:i,value:w(t.high)},{key:"low",label:g.low,color:i,value:w(t.low)},{key:"close",label:g.close,color:i,value:w(t.close)}],emphasisKey:"close",footnote:a?g.closedAbove:g.closedBelow})},children:({x:e,y:l,active:t})=>/* @__PURE__ */c("g",{children:h.map((a,i)=>{const r=a.close>=a.open,h=r?o.good:o.critical,p=e.center(i),d=Math.max(3,e.bandwidth),u=null!==t&&t!==i,b=l(Math.max(a.open,a.close)),y=Math.max(1,Math.abs(l(a.close)-l(a.open)));/* @__PURE__ */
4
4
  return n("g",{opacity:u?.45:1,children:[
@@ -1 +1 @@
1
- import{client_default as a}from"./chunk-S4DCWKIY.js";var t=()=>a.get("/auth/numbering-configs/").then(a=>a.data?.results??a.data??[]),e="uploaded:wallpaper";function r(a,t){return"string"!=typeof a||!a||"none"===a||a.startsWith("#")?"":a===e?t||"":a}var l=()=>a.get("/auth/me/wallpaper/").then(a=>a.data),n=(t,e)=>{const r=new FormData;r.append("wallpaper",t);const l=e?{onUploadProgress:a=>e(a.total?Math.round(a.loaded/a.total*100):null)}:void 0;return a.post("/auth/me/wallpaper/",r,l).then(a=>a.data)},p=()=>a.delete("/auth/me/wallpaper/").then(a=>a.data);function o(a){const t=a?.response?.status,e=a?.response?.data,r=Array.isArray(e?.wallpaper)?e.wallpaper[0]:void 0;return r||(413===t?"That picture is too large to use as a wallpaper.":415===t?"That file is not a picture this can use as a wallpaper.":"The wallpaper could not be saved. Please try again.")}export{e as WALLPAPER_PREF_TOKEN,p as deleteWallpaper,t as getNumberingConfigs,l as getWallpaper,n as uploadWallpaper,r as wallpaperSrc,o as wallpaperUploadError};
1
+ import{client_default as a}from"./chunk-WISGY2OI.js";var t=()=>a.get("/auth/numbering-configs/").then(a=>a.data?.results??a.data??[]),e="uploaded:wallpaper";function r(a,t){return"string"!=typeof a||!a||"none"===a||a.startsWith("#")?"":a===e?t||"":a}var l=()=>a.get("/auth/me/wallpaper/").then(a=>a.data),n=(t,e)=>{const r=new FormData;r.append("wallpaper",t);const l=e?{onUploadProgress:a=>e(a.total?Math.round(a.loaded/a.total*100):null)}:void 0;return a.post("/auth/me/wallpaper/",r,l).then(a=>a.data)},p=()=>a.delete("/auth/me/wallpaper/").then(a=>a.data);function o(a){const t=a?.response?.status,e=a?.response?.data,r=Array.isArray(e?.wallpaper)?e.wallpaper[0]:void 0;return r||(413===t?"That picture is too large to use as a wallpaper.":415===t?"That file is not a picture this can use as a wallpaper.":"The wallpaper could not be saved. Please try again.")}export{e as WALLPAPER_PREF_TOKEN,p as deleteWallpaper,t as getNumberingConfigs,l as getWallpaper,n as uploadWallpaper,r as wallpaperSrc,o as wallpaperUploadError};
@@ -1,2 +1,2 @@
1
- import{useShellPrefs as t}from"./chunk-KC3EX26K.js";import{toast_default as e}from"./chunk-4NXMMWL6.js";import{useSyncExternalStore as n,useCallback as o,useMemo as a}from"react";var r=[{id:"bell",label:"Bell",description:"Soft bell with one harmonic"},{id:"chime",label:"Chime",description:"Two-note ascending chime"},{id:"bowl",label:"Singing Bowl",description:"Long-decay meditation tone"},{id:"wind-chimes",label:"Wind Chimes",description:"Four soft tones in succession"},{id:"off",label:"Off (silent)",description:"No sound — only desktop notification"}],i=[{id:"none",label:"None"},{id:"tick-fast",label:"Ticking Fast"},{id:"tick-slow",label:"Ticking Slow"},{id:"rain",label:"Rain"},{id:"fireplace",label:"Fireplace"},{id:"white",label:"White Noise"},{id:"pink",label:"Pink Noise"},{id:"brown",label:"Brown Noise"}],c=()=>`pomodoro-${/* @__PURE__ */(new Date).toISOString().slice(0,10)}`,l={focus:1500,short:300,long:900},s="bell",u=100,d=1,f="none",m=50,h={autoStartBreaks:!1,autoStartPomodoros:!1,longBreakInterval:4},g={running:!1,remaining:l.focus,mode:"focus",total:l.focus,streak:0,count:"undefined"!=typeof localStorage?(()=>{try{return parseInt(localStorage.getItem(c())||"0",10)||0}catch{return 0}})():0},p=null,k=/* @__PURE__ */new Set,w=t=>{g={...g,...t},k.forEach(t=>t())};function M(){return g}function S(t){return k.add(t),()=>{k.delete(t)}}function b(t){l=t,g.running||g.remaining!==g.total||w({remaining:t[g.mode],total:t[g.mode]})}function y(t){s=t}function v(t,e){u=Math.max(0,Math.min(100,Math.round(t))),d=Math.max(1,Math.min(5,Math.round(e)))}function T(t){h={autoStartBreaks:!!t.autoStartBreaks,autoStartPomodoros:!!t.autoStartPomodoros,longBreakInterval:Math.max(1,Math.min(20,Math.round(t.longBreakInterval||4)))}}function A(t,e){f=t,m=Math.max(0,Math.min(100,Math.round(e))),g.running&&"focus"===g.mode?(F(),R()):"none"!==t&&0!==m||F()}function I(){g.running||(w({running:!0}),p=setInterval(C,1e3),"focus"===g.mode&&R())}function x(){(g.running||null!==p)&&(null!==p&&(clearInterval(p),p=null),w({running:!1}),F())}function B(t){x(),w({mode:t,remaining:l[t],total:l[t]})}function C(){g.remaining<=1?function(){null!==p&&(clearInterval(p),p=null);F(),N(s,{volume:u,repeat:d});const t="focus"===g.mode?"Pomodoro complete — time for a break! 🍅":"Break's over — back to work!";if("undefined"!=typeof Notification&&"granted"===Notification.permission)try{new Notification(t)}catch{}try{e.info(t)}catch{}if("focus"===g.mode){const t=g.streak+1,e=g.count+1;(t=>{try{localStorage.setItem(c(),String(t))}catch{}})(e);const n=t%h.longBreakInterval===0?"long":"short";w({running:!1,streak:t,count:e,mode:n,remaining:l[n],total:l[n]}),h.autoStartBreaks&&setTimeout(()=>I(),50)}else w({running:!1,mode:"focus",remaining:l.focus,total:l.focus}),h.autoStartPomodoros&&setTimeout(()=>I(),50)}():w({remaining:g.remaining-1})}function N(t=s,e={}){if("off"===t)return;const n=Math.max(0,Math.min(100,e.volume??100))/100;if(0===n)return;const o=Math.max(1,Math.min(5,e.repeat??1));for(let e=0;e<o;e++)setTimeout(()=>P(t,n),2500*e)}function P(t,e){try{const n=window.AudioContext||window.webkitAudioContext;if(!n)return;const o=new n,a=(t,n,a,r=.22,i="sine")=>{const c=o.createOscillator(),l=o.createGain();c.connect(l),l.connect(o.destination),c.type=i,c.frequency.value=t;const s=o.currentTime+n;l.gain.setValueAtTime(0,s),l.gain.linearRampToValueAtTime(r*e,s+.03),l.gain.exponentialRampToValueAtTime(1e-4,s+a),c.start(s),c.stop(s+a)};let r=2;"bell"===t?(a(880,0,1.8),a(1320,0,1.4,.1),r=2):"chime"===t?(a(659.25,0,.7),a(880,.2,1.3),r=2):"bowl"===t?(a(440,0,3.4,.22),a(660,0,3,.08),a(880,.05,2.8,.05),r=4):"wind-chimes"===t&&(a(1175,0,1.1,.16),a(880,.15,1.3,.16),a(1318,.3,1.5,.16),a(1047,.5,1.7,.13),r=3),setTimeout(()=>{try{o.close()}catch{}},1e3*r+500)}catch{}}var D=null,_={none:0,white:.3,pink:.3,brown:.3,"tick-fast":.6,"tick-slow":.6,rain:.4,fireplace:.5};function O(t,e){if("none"===e)return null;const n=t.sampleRate,o="white"===e||"pink"===e||"brown"===e?2:4,a=n*o,r=t.createBuffer(1,a,n),i=r.getChannelData(0);if("white"===e)for(let t=0;t<a;t++)i[t]=.5*(2*Math.random()-1);else if("pink"===e){let t=0,e=0,n=0,o=0,r=0,c=0,l=0;for(let s=0;s<a;s++){const a=2*Math.random()-1;t=.99886*t+.0555179*a,e=.99332*e+.0750759*a,n=.969*n+.153852*a,o=.8665*o+.3104856*a,r=.55*r+.5329522*a,c=-.7616*c-.016898*a,i[s]=.11*(t+e+n+o+r+c+l+.5362*a)*.55,l=.115926*a}}else if("brown"===e){let t=0;for(let e=0;e<a;e++){t=(t+.02*(2*Math.random()-1))/1.02,i[e]=3.5*t*.5}}else if("tick-fast"===e||"tick-slow"===e){const t="tick-fast"===e?.5:1,r=Math.floor(.045*n);for(let e=0;e<o;e+=t){const t=Math.floor(e*n);for(let e=0;e<r&&t+e<a;e++){const o=Math.exp(-e/n*180),a=2*Math.random()-1,r=Math.sin(2*Math.PI*1100*(e/n));i[t+e]+=(.7*a+.25*r)*o*.55}}}else if("rain"===e){let t=0;for(let e=0;e<a;e++){const o=2*Math.random()-1,a=o-.93*t;t=o;const r=.7+.3*Math.sin(e/n*2*Math.PI*.25);i[e]=a*r*.4}}else if("fireplace"===e){let t=0;for(let e=0;e<a;e++){t=(t+.02*(2*Math.random()-1))/1.02,i[e]=1.6*t}let e=.4*Math.random()*n;for(;e<a;){const t=Math.floor((.012+.05*Math.random())*n),o=.35+.45*Math.random(),r=Math.floor(e);for(let e=0;e<t&&r+e<a;e++){const t=Math.exp(-e/n*90);i[r+e]+=(2*Math.random()-1)*t*o}e+=(.08+.62*Math.random())*n}}return r}function R(){if(!D&&"none"!==f&&0!==m)try{const t=window.AudioContext||window.webkitAudioContext;if(!t)return;const e=new t,n=O(e,f);if(!n){try{e.close()}catch{}return}const o=e.createBufferSource();o.buffer=n,o.loop=!0;const a=e.createGain();a.gain.value=m/100*_[f],o.connect(a).connect(e.destination),o.start(),D={ctx:e,src:o,gain:a}}catch{}}function F(){if(D){try{D.src.stop()}catch{}try{D.ctx.close()}catch{}D=null}}function G(t,e){if("none"!==t&&0!==e)try{const n=window.AudioContext||window.webkitAudioContext;if(!n)return;const o=new n,a=O(o,t);if(!a){try{o.close()}catch{}return}const r=o.createBufferSource();r.buffer=a,r.loop=!0;const i=o.createGain();i.gain.value=e/100*_[t],r.connect(i).connect(o.destination),r.start(),setTimeout(()=>{try{r.stop()}catch{}try{o.close()}catch{}},3e3)}catch{}}var V="pomodoro_tasks",W="pomodoro_tasks_migrated";function j(){return Math.random().toString(36).slice(2,11)}function E(){/* @__PURE__ */
2
- return(new Date).toISOString()}var K=null,L=[],X=!1,q=null,J=/* @__PURE__ */new Set;function $(){for(const t of J)t()}function z(t){L=t,$()}function H(){const t=K;return t?q=t.list().then(e=>{K===t&&(L=e,X=!0,$())}).catch(()=>{K===t&&(X=!0,$())}).finally(()=>{q=null}):(L=[],X=!0,$(),Promise.resolve())}function Q(t){K=t,L=[],X=!1,t?H():$()}function U(t){return J.add(t),!K||X||q||H(),()=>{J.delete(t)}}function Y(){return L}function Z(){const e=function(){const{prefs:e,save:n}=t(),r=a(()=>{const t=e.todo_tasks;return Array.isArray(t)?t:[]},[e.todo_tasks]),i=o(t=>{n({todo_tasks:t})},[n]),c=o(t=>{const e=j(),n=E(),o={done:!1,...t,name:t.name.trim(),id:e,createdAt:n,updatedAt:n};return i([...r,o]),e},[r,i]),l=o((t,e)=>{i(r.map(n=>n.id===t?{...n,...e,id:n.id,updatedAt:E()}:n))},[r,i]),s=o(t=>{i(r.filter(e=>e.id!==t))},[r,i]),u=o(t=>{const e=r.find(e=>e.id===t);e&&l(t,{done:!e.done})},[r,l]);return{tasks:r,addTask:c,updateTask:l,removeTask:s,toggleDone:u,setAllTasks:i}}(),r=n(U,Y,Y),i=o(t=>{const n=K;if(!n)return e.addTask(t);const o="tmp-"+j(),a=E(),r={done:!1,...t,name:t.name.trim(),id:o,createdAt:a,updatedAt:a};return z([...L,r]),n.create({...t,name:t.name.trim()}).then(t=>z(L.map(e=>e.id===o?{...r,...t}:e))).catch(()=>z(L.filter(t=>t.id!==o))),o},[e]),c=o((t,n)=>{const o=K;if(!o)return e.updateTask(t,n);z(L.map(e=>e.id===t?{...e,...n,id:t,updatedAt:E()}:e)),o.update(t,n).catch(()=>{H()})},[e]),l=o(t=>{const n=K;if(!n)return e.removeTask(t);const o=L;z(L.filter(e=>e.id!==t)),n.remove(t).catch(()=>z(o))},[e]),s=o(t=>{if(!K)return e.toggleDone(t);const n=L.find(e=>e.id===t);n&&c(t,{done:!n.done})},[e,c]),u=o(t=>{K||e.setAllTasks(t)},[e]);return null===K?e:{tasks:r,addTask:i,updateTask:c,removeTask:l,toggleDone:s,setAllTasks:u}}function tt(t,e){try{if(localStorage.getItem(W))return;const n=localStorage.getItem(V);if(!n)return void localStorage.setItem(W,"1");const o=JSON.parse(n);if(!Array.isArray(o)||0===o.length)return localStorage.removeItem(V),void localStorage.setItem(W,"1");const a=E(),r=o.filter(t=>"string"==typeof t?.name).map(t=>({id:t.id||j(),name:String(t.name),done:!!t.done,estimated:"number"==typeof t.estimated?t.estimated:void 0,completed:"number"==typeof t.completed?t.completed:void 0,createdAt:a,updatedAt:a})),i=new Set(t.map(t=>t.id));e([...r.filter(t=>!i.has(t.id)),...t]),localStorage.removeItem(V),localStorage.setItem(W,"1")}catch{try{localStorage.setItem(W,"1")}catch{}}}export{r as ALARM_OPTIONS,i as FOCUS_SOUND_OPTIONS,M as getPomoSnapshot,tt as migratePomodoroTasksOnce,N as playAlarm,x as pomoPause,I as pomoStart,B as pomoSwitchMode,G as previewFocusSound,y as setPomoAlarm,v as setPomoAlarmConfig,T as setPomoBehaviour,b as setPomoDurations,A as setPomoFocusSound,Q as setShellTodoProvider,S as subscribePomo,Z as useTodoTasks};
1
+ import{toast_default as t}from"./chunk-4NXMMWL6.js";import{useShellPrefs as e}from"./chunk-KC3EX26K.js";import{useSyncExternalStore as n,useCallback as o,useMemo as a}from"react";var r=[{id:"bell",label:"Bell",description:"Soft bell with one harmonic"},{id:"chime",label:"Chime",description:"Two-note ascending chime"},{id:"bowl",label:"Singing Bowl",description:"Long-decay meditation tone"},{id:"wind-chimes",label:"Wind Chimes",description:"Four soft tones in succession"},{id:"off",label:"Off (silent)",description:"No sound — only desktop notification"}],i=[{id:"none",label:"None"},{id:"tick-fast",label:"Ticking Fast"},{id:"tick-slow",label:"Ticking Slow"},{id:"rain",label:"Rain"},{id:"fireplace",label:"Fireplace"},{id:"white",label:"White Noise"},{id:"pink",label:"Pink Noise"},{id:"brown",label:"Brown Noise"}],c=()=>`pomodoro-${/* @__PURE__ */(new Date).toISOString().slice(0,10)}`,l={focus:1500,short:300,long:900},s="bell",u=100,d=1,f="none",m=50,h={autoStartBreaks:!1,autoStartPomodoros:!1,longBreakInterval:4},g={running:!1,remaining:l.focus,mode:"focus",total:l.focus,streak:0,count:"undefined"!=typeof localStorage?(()=>{try{return parseInt(localStorage.getItem(c())||"0",10)||0}catch{return 0}})():0},p=null,k=/* @__PURE__ */new Set,w=t=>{g={...g,...t},k.forEach(t=>t())};function M(){return g}function S(t){return k.add(t),()=>{k.delete(t)}}function b(t){l=t,g.running||g.remaining!==g.total||w({remaining:t[g.mode],total:t[g.mode]})}function y(t){s=t}function v(t,e){u=Math.max(0,Math.min(100,Math.round(t))),d=Math.max(1,Math.min(5,Math.round(e)))}function T(t){h={autoStartBreaks:!!t.autoStartBreaks,autoStartPomodoros:!!t.autoStartPomodoros,longBreakInterval:Math.max(1,Math.min(20,Math.round(t.longBreakInterval||4)))}}function A(t,e){f=t,m=Math.max(0,Math.min(100,Math.round(e))),g.running&&"focus"===g.mode?(F(),R()):"none"!==t&&0!==m||F()}function I(){g.running||(w({running:!0}),p=setInterval(C,1e3),"focus"===g.mode&&R())}function x(){(g.running||null!==p)&&(null!==p&&(clearInterval(p),p=null),w({running:!1}),F())}function B(t){x(),w({mode:t,remaining:l[t],total:l[t]})}function C(){g.remaining<=1?function(){null!==p&&(clearInterval(p),p=null);F(),N(s,{volume:u,repeat:d});const e="focus"===g.mode?"Pomodoro complete — time for a break! 🍅":"Break's over — back to work!";if("undefined"!=typeof Notification&&"granted"===Notification.permission)try{new Notification(e)}catch{}try{t.info(e)}catch{}if("focus"===g.mode){const t=g.streak+1,e=g.count+1;(t=>{try{localStorage.setItem(c(),String(t))}catch{}})(e);const n=t%h.longBreakInterval===0?"long":"short";w({running:!1,streak:t,count:e,mode:n,remaining:l[n],total:l[n]}),h.autoStartBreaks&&setTimeout(()=>I(),50)}else w({running:!1,mode:"focus",remaining:l.focus,total:l.focus}),h.autoStartPomodoros&&setTimeout(()=>I(),50)}():w({remaining:g.remaining-1})}function N(t=s,e={}){if("off"===t)return;const n=Math.max(0,Math.min(100,e.volume??100))/100;if(0===n)return;const o=Math.max(1,Math.min(5,e.repeat??1));for(let e=0;e<o;e++)setTimeout(()=>P(t,n),2500*e)}function P(t,e){try{const n=window.AudioContext||window.webkitAudioContext;if(!n)return;const o=new n,a=(t,n,a,r=.22,i="sine")=>{const c=o.createOscillator(),l=o.createGain();c.connect(l),l.connect(o.destination),c.type=i,c.frequency.value=t;const s=o.currentTime+n;l.gain.setValueAtTime(0,s),l.gain.linearRampToValueAtTime(r*e,s+.03),l.gain.exponentialRampToValueAtTime(1e-4,s+a),c.start(s),c.stop(s+a)};let r=2;"bell"===t?(a(880,0,1.8),a(1320,0,1.4,.1),r=2):"chime"===t?(a(659.25,0,.7),a(880,.2,1.3),r=2):"bowl"===t?(a(440,0,3.4,.22),a(660,0,3,.08),a(880,.05,2.8,.05),r=4):"wind-chimes"===t&&(a(1175,0,1.1,.16),a(880,.15,1.3,.16),a(1318,.3,1.5,.16),a(1047,.5,1.7,.13),r=3),setTimeout(()=>{try{o.close()}catch{}},1e3*r+500)}catch{}}var D=null,_={none:0,white:.3,pink:.3,brown:.3,"tick-fast":.6,"tick-slow":.6,rain:.4,fireplace:.5};function O(t,e){if("none"===e)return null;const n=t.sampleRate,o="white"===e||"pink"===e||"brown"===e?2:4,a=n*o,r=t.createBuffer(1,a,n),i=r.getChannelData(0);if("white"===e)for(let t=0;t<a;t++)i[t]=.5*(2*Math.random()-1);else if("pink"===e){let t=0,e=0,n=0,o=0,r=0,c=0,l=0;for(let s=0;s<a;s++){const a=2*Math.random()-1;t=.99886*t+.0555179*a,e=.99332*e+.0750759*a,n=.969*n+.153852*a,o=.8665*o+.3104856*a,r=.55*r+.5329522*a,c=-.7616*c-.016898*a,i[s]=.11*(t+e+n+o+r+c+l+.5362*a)*.55,l=.115926*a}}else if("brown"===e){let t=0;for(let e=0;e<a;e++){t=(t+.02*(2*Math.random()-1))/1.02,i[e]=3.5*t*.5}}else if("tick-fast"===e||"tick-slow"===e){const t="tick-fast"===e?.5:1,r=Math.floor(.045*n);for(let e=0;e<o;e+=t){const t=Math.floor(e*n);for(let e=0;e<r&&t+e<a;e++){const o=Math.exp(-e/n*180),a=2*Math.random()-1,r=Math.sin(2*Math.PI*1100*(e/n));i[t+e]+=(.7*a+.25*r)*o*.55}}}else if("rain"===e){let t=0;for(let e=0;e<a;e++){const o=2*Math.random()-1,a=o-.93*t;t=o;const r=.7+.3*Math.sin(e/n*2*Math.PI*.25);i[e]=a*r*.4}}else if("fireplace"===e){let t=0;for(let e=0;e<a;e++){t=(t+.02*(2*Math.random()-1))/1.02,i[e]=1.6*t}let e=.4*Math.random()*n;for(;e<a;){const t=Math.floor((.012+.05*Math.random())*n),o=.35+.45*Math.random(),r=Math.floor(e);for(let e=0;e<t&&r+e<a;e++){const t=Math.exp(-e/n*90);i[r+e]+=(2*Math.random()-1)*t*o}e+=(.08+.62*Math.random())*n}}return r}function R(){if(!D&&"none"!==f&&0!==m)try{const t=window.AudioContext||window.webkitAudioContext;if(!t)return;const e=new t,n=O(e,f);if(!n){try{e.close()}catch{}return}const o=e.createBufferSource();o.buffer=n,o.loop=!0;const a=e.createGain();a.gain.value=m/100*_[f],o.connect(a).connect(e.destination),o.start(),D={ctx:e,src:o,gain:a}}catch{}}function F(){if(D){try{D.src.stop()}catch{}try{D.ctx.close()}catch{}D=null}}function G(t,e){if("none"!==t&&0!==e)try{const n=window.AudioContext||window.webkitAudioContext;if(!n)return;const o=new n,a=O(o,t);if(!a){try{o.close()}catch{}return}const r=o.createBufferSource();r.buffer=a,r.loop=!0;const i=o.createGain();i.gain.value=e/100*_[t],r.connect(i).connect(o.destination),r.start(),setTimeout(()=>{try{r.stop()}catch{}try{o.close()}catch{}},3e3)}catch{}}var V="pomodoro_tasks",W="pomodoro_tasks_migrated";function j(){return Math.random().toString(36).slice(2,11)}function E(){/* @__PURE__ */
2
+ return(new Date).toISOString()}var K=null,L=[],X=!1,q=null,J=/* @__PURE__ */new Set;function $(){for(const t of J)t()}function z(t){L=t,$()}function H(){const t=K;return t?q=t.list().then(e=>{K===t&&(L=e,X=!0,$())}).catch(()=>{K===t&&(X=!0,$())}).finally(()=>{q=null}):(L=[],X=!0,$(),Promise.resolve())}function Q(t){K=t,L=[],X=!1,t?H():$()}function U(t){return J.add(t),!K||X||q||H(),()=>{J.delete(t)}}function Y(){return L}function Z(){const t=function(){const{prefs:t,save:n}=e(),r=a(()=>{const e=t.todo_tasks;return Array.isArray(e)?e:[]},[t.todo_tasks]),i=o(t=>{n({todo_tasks:t})},[n]),c=o(t=>{const e=j(),n=E(),o={done:!1,...t,name:t.name.trim(),id:e,createdAt:n,updatedAt:n};return i([...r,o]),e},[r,i]),l=o((t,e)=>{i(r.map(n=>n.id===t?{...n,...e,id:n.id,updatedAt:E()}:n))},[r,i]),s=o(t=>{i(r.filter(e=>e.id!==t))},[r,i]),u=o(t=>{const e=r.find(e=>e.id===t);e&&l(t,{done:!e.done})},[r,l]);return{tasks:r,addTask:c,updateTask:l,removeTask:s,toggleDone:u,setAllTasks:i}}(),r=n(U,Y,Y),i=o(e=>{const n=K;if(!n)return t.addTask(e);const o="tmp-"+j(),a=E(),r={done:!1,...e,name:e.name.trim(),id:o,createdAt:a,updatedAt:a};return z([...L,r]),n.create({...e,name:e.name.trim()}).then(t=>z(L.map(e=>e.id===o?{...r,...t}:e))).catch(()=>z(L.filter(t=>t.id!==o))),o},[t]),c=o((e,n)=>{const o=K;if(!o)return t.updateTask(e,n);z(L.map(t=>t.id===e?{...t,...n,id:e,updatedAt:E()}:t)),o.update(e,n).catch(()=>{H()})},[t]),l=o(e=>{const n=K;if(!n)return t.removeTask(e);const o=L;z(L.filter(t=>t.id!==e)),n.remove(e).catch(()=>z(o))},[t]),s=o(e=>{if(!K)return t.toggleDone(e);const n=L.find(t=>t.id===e);n&&c(e,{done:!n.done})},[t,c]),u=o(e=>{K||t.setAllTasks(e)},[t]);return null===K?t:{tasks:r,addTask:i,updateTask:c,removeTask:l,toggleDone:s,setAllTasks:u}}function tt(t,e){try{if(localStorage.getItem(W))return;const n=localStorage.getItem(V);if(!n)return void localStorage.setItem(W,"1");const o=JSON.parse(n);if(!Array.isArray(o)||0===o.length)return localStorage.removeItem(V),void localStorage.setItem(W,"1");const a=E(),r=o.filter(t=>"string"==typeof t?.name).map(t=>({id:t.id||j(),name:String(t.name),done:!!t.done,estimated:"number"==typeof t.estimated?t.estimated:void 0,completed:"number"==typeof t.completed?t.completed:void 0,createdAt:a,updatedAt:a})),i=new Set(t.map(t=>t.id));e([...r.filter(t=>!i.has(t.id)),...t]),localStorage.removeItem(V),localStorage.setItem(W,"1")}catch{try{localStorage.setItem(W,"1")}catch{}}}export{r as ALARM_OPTIONS,i as FOCUS_SOUND_OPTIONS,M as getPomoSnapshot,tt as migratePomodoroTasksOnce,N as playAlarm,x as pomoPause,I as pomoStart,B as pomoSwitchMode,G as previewFocusSound,y as setPomoAlarm,v as setPomoAlarmConfig,T as setPomoBehaviour,b as setPomoDurations,A as setPomoFocusSound,Q as setShellTodoProvider,S as subscribePomo,Z as useTodoTasks};
@@ -1,9 +1,9 @@
1
- import{ImageFocusPoint as e}from"./chunk-GATKJSGL.js";import{FormField as a}from"./chunk-MVQBVPWP.js";import{isVideoUrl as i,mediaPromptLine as t,mediaFileName as r,FilenameBadge as o,BusyOverlay as n,UploadGlyph as l,dropzoneClass as s,zoneFocusClass as c}from"./chunk-DTSCO7VM.js";import{TransferProgress as d}from"./chunk-S7VSXUKS.js";import{useFileIntake as u,FileIntakeAlert as m}from"./chunk-YDYDR72S.js";import{Segmented as h}from"./chunk-N6DTTOB6.js";import{Icon as p}from"./chunk-KIBL6M3T.js";import{useShellStrings as b}from"./chunk-E6UCGCOC.js";import{useState as g,useRef as v,useEffect as f,useId as y}from"react";import{jsxs as k,jsx as j,Fragment as x}from"react/jsx-runtime";var N=["flex h-8 items-center justify-center rounded-(--radius-control) text-(--status-on-solid)","not-disabled:hover:bg-white/10 disabled:cursor-not-allowed disabled:opacity-60","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]"].join(" ");function w({value:w,onChange:L,onPick:C,onFile:R,label:U,hint:F,error:O,required:S,className:P,accept:$="image/*",maxSizeBytes:z,fit:B="cover",height:T=112,placeholder:V,cta:D,acceptHint:K,showFilename:q=!0,allowReplace:G=!0,allowRemove:H=!0,replaceLabel:I,removeLabel:M,busy:A=!1,busyLabel:W,choosingLabel:Y,pickFailedLabel:_,progress:E,disabled:J=!1,kind:Q,onKindChange:X,focus:Z,onFocusChange:ee,focusLabel:ae}){const ie=b().media,te=D??ie.cta,re=Q??(/video/.test($)&&!/image/.test($)?"video":"image"),oe="string"==typeof M&&M?M:ie.remove,[ne,le]=g(!1),[se,ce]=g(!1),de=v(!0);f(()=>()=>{de.current=!1},[]);const ue=A||ne,me=ne&&!A?Y??ie.choosing:W??ie.uploading,he=O??(se?_??ie.pickFailed:void 0),pe=e=>{if(!C)return;ce(!1);const a=C(e);a&&"function"==typeof a.then&&(le(!0),a.then(e=>{de.current&&(le(!1),"string"==typeof e&&e&&L(e))},()=>{de.current&&(le(!1),ce(!0))}))},be=y(),ge=v(null),[ve,fe]=g(null);f(()=>()=>{ge.current&&URL.revokeObjectURL(ge.current)},[]);const ye=J||ue,ke=!!w&&(i(w,$)||w===ve),je=V??t($,ie),xe=I??(ke||"video"===re?ie.changeVideo:ie.changeImage),Ne=e=>{C?pe(e):R?R(e):(e=>{ge.current&&URL.revokeObjectURL(ge.current);const a=URL.createObjectURL(e);ge.current=a,fe(e.type.startsWith("video/")?a:null),L(a)})(e)},we=u({accept:$,maxSizeBytes:z,acceptHint:K,multiple:!1,disabled:ye,onAccept:([e])=>Ne(e)}),{dragOver:Le}=we,Ce=()=>{ye||(C?pe():we.open())},Re=w?r(w):"",Ue=!ke&&!!ee,Fe=J||!G&&!H?null:/* @__PURE__ */k("div",{"data-media-bar":"",className:["absolute inset-x-0 bottom-0 flex items-center gap-1 p-1 text-(--status-on-solid)","opacity-0 transition-opacity duration-(--motion-fast)","group-hover/media:opacity-100 group-focus-within/media:opacity-100 [@media(hover:none)]:opacity-100"].join(" "),style:{background:"var(--rosh-media-scrim-button)"},children:[G&&/* @__PURE__ */k("button",{id:Ue?void 0:be,type:"button","aria-labelledby":`${be}-change`,onClick:()=>Ce(),disabled:ue,className:`min-w-0 flex-1 gap-1 px-2 text-sm font-medium ${N}`,children:[
1
+ import{ImageFocusPoint as e}from"./chunk-GATKJSGL.js";import{FormField as a}from"./chunk-MVQBVPWP.js";import{Segmented as i}from"./chunk-N6DTTOB6.js";import{isVideoUrl as t,mediaPromptLine as r,mediaFileName as o,FilenameBadge as n,BusyOverlay as l,UploadGlyph as s,dropzoneClass as c,zoneFocusClass as d}from"./chunk-DTSCO7VM.js";import{TransferProgress as u}from"./chunk-S7VSXUKS.js";import{useFileIntake as m,FileIntakeAlert as h}from"./chunk-YDYDR72S.js";import{Icon as p}from"./chunk-KIBL6M3T.js";import{useShellStrings as b}from"./chunk-E6UCGCOC.js";import{useState as g,useRef as v,useEffect as f,useId as y}from"react";import{jsxs as k,jsx as j,Fragment as x}from"react/jsx-runtime";var N=["flex h-8 items-center justify-center rounded-(--radius-control) text-(--status-on-solid)","not-disabled:hover:bg-white/10 disabled:cursor-not-allowed disabled:opacity-60","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]"].join(" ");function w({value:w,onChange:L,onPick:C,onFile:R,label:U,hint:F,error:O,required:S,className:P,accept:$="image/*",maxSizeBytes:z,fit:B="cover",height:T=112,placeholder:V,cta:D,acceptHint:K,showFilename:q=!0,allowReplace:G=!0,allowRemove:H=!0,replaceLabel:I,removeLabel:M,busy:A=!1,busyLabel:W,choosingLabel:Y,pickFailedLabel:_,progress:E,disabled:J=!1,kind:Q,onKindChange:X,focus:Z,onFocusChange:ee,focusLabel:ae}){const ie=b().media,te=D??ie.cta,re=Q??(/video/.test($)&&!/image/.test($)?"video":"image"),oe="string"==typeof M&&M?M:ie.remove,[ne,le]=g(!1),[se,ce]=g(!1),de=v(!0);f(()=>()=>{de.current=!1},[]);const ue=A||ne,me=ne&&!A?Y??ie.choosing:W??ie.uploading,he=O??(se?_??ie.pickFailed:void 0),pe=e=>{if(!C)return;ce(!1);const a=C(e);a&&"function"==typeof a.then&&(le(!0),a.then(e=>{de.current&&(le(!1),"string"==typeof e&&e&&L(e))},()=>{de.current&&(le(!1),ce(!0))}))},be=y(),ge=v(null),[ve,fe]=g(null);f(()=>()=>{ge.current&&URL.revokeObjectURL(ge.current)},[]);const ye=J||ue,ke=!!w&&(t(w,$)||w===ve),je=V??r($,ie),xe=I??(ke||"video"===re?ie.changeVideo:ie.changeImage),Ne=e=>{C?pe(e):R?R(e):(e=>{ge.current&&URL.revokeObjectURL(ge.current);const a=URL.createObjectURL(e);ge.current=a,fe(e.type.startsWith("video/")?a:null),L(a)})(e)},we=m({accept:$,maxSizeBytes:z,acceptHint:K,multiple:!1,disabled:ye,onAccept:([e])=>Ne(e)}),{dragOver:Le}=we,Ce=()=>{ye||(C?pe():we.open())},Re=w?o(w):"",Ue=!ke&&!!ee,Fe=J||!G&&!H?null:/* @__PURE__ */k("div",{"data-media-bar":"",className:["absolute inset-x-0 bottom-0 flex items-center gap-1 p-1 text-(--status-on-solid)","opacity-0 transition-opacity duration-(--motion-fast)","group-hover/media:opacity-100 group-focus-within/media:opacity-100 [@media(hover:none)]:opacity-100"].join(" "),style:{background:"var(--rosh-media-scrim-button)"},children:[G&&/* @__PURE__ */k("button",{id:Ue?void 0:be,type:"button","aria-labelledby":`${be}-change`,onClick:()=>Ce(),disabled:ue,className:`min-w-0 flex-1 gap-1 px-2 text-sm font-medium ${N}`,children:[
2
2
  /* @__PURE__ */j(p,{name:"swap","aria-hidden":"true",className:"h-4 w-4 shrink-0"}),
3
3
  /* @__PURE__ */j("span",{id:`${be}-change`,className:"truncate",children:xe})]}),H&&/* @__PURE__ */j("button",{type:"button","aria-label":oe,onClick:()=>{ge.current&&(URL.revokeObjectURL(ge.current),ge.current=null),fe(null),L("")},disabled:ue,className:`ml-auto w-8 shrink-0 ${N}`,children:/* @__PURE__ */j(p,{name:"trash","aria-hidden":"true",className:"h-4 w-4"})})]}),Oe=/* @__PURE__ */k("div",{...we.zoneProps,"data-media-frame":"",className:["group/media relative overflow-hidden rounded-(--radius-control) border transition-colors",Ue?"":"bg-gray-100",Le?"border-blue-500":"border-gray-200"].join(" "),style:Ue?void 0:{height:T},children:[Ue?
4
- /* @__PURE__ */j(e,{value:Z??"",onChange:e=>ee?.(e),label:ae??ie.focus,image:w,hint:null,id:be,disabled:ye,className:"[&_[data-image-focus-picture]]:rounded-none [&_[data-image-focus-picture]]:border-0"}):ke?/* @__PURE__ */j("video",{src:w??void 0,muted:!0,playsInline:!0,preload:"metadata","aria-label":Re||void 0,className:"h-full w-full",style:{objectFit:B}}):/* @__PURE__ */j("img",{src:w??void 0,alt:Re,className:"h-full w-full",style:{objectFit:B,objectPosition:Z||void 0}}),q&&w&&/* @__PURE__ */j(o,{children:Re}),Fe,ue&&/* @__PURE__ */j(n,{label:me,progress:E,rounded:"rounded-md"})]}),Se=/* @__PURE__ */j("button",{type:"button",id:be,onClick:()=>Ce(),disabled:ye,"aria-label":"string"==typeof je?je:ie.upload,"aria-busy":ue||void 0,"aria-invalid":!!he||void 0,"aria-required":S||void 0,"aria-describedby":he?`${be}-error`:F?`${be}-hint`:void 0,...we.zoneProps,className:s(Le,ye,c(ye)),style:{minHeight:T},children:ue?/* @__PURE__ */j(d,{state:"busy",verb:me,pct:E}):/* @__PURE__ */k(x,{children:[
5
- /* @__PURE__ */j("span",{className:"text-gray-400",children:/* @__PURE__ */j(l,{})}),
4
+ /* @__PURE__ */j(e,{value:Z??"",onChange:e=>ee?.(e),label:ae??ie.focus,image:w,hint:null,id:be,disabled:ye,className:"[&_[data-image-focus-picture]]:rounded-none [&_[data-image-focus-picture]]:border-0"}):ke?/* @__PURE__ */j("video",{src:w??void 0,muted:!0,playsInline:!0,preload:"metadata","aria-label":Re||void 0,className:"h-full w-full",style:{objectFit:B}}):/* @__PURE__ */j("img",{src:w??void 0,alt:Re,className:"h-full w-full",style:{objectFit:B,objectPosition:Z||void 0}}),q&&w&&/* @__PURE__ */j(n,{children:Re}),Fe,ue&&/* @__PURE__ */j(l,{label:me,progress:E,rounded:"rounded-md"})]}),Se=/* @__PURE__ */j("button",{type:"button",id:be,onClick:()=>Ce(),disabled:ye,"aria-label":"string"==typeof je?je:ie.upload,"aria-busy":ue||void 0,"aria-invalid":!!he||void 0,"aria-required":S||void 0,"aria-describedby":he?`${be}-error`:F?`${be}-hint`:void 0,...we.zoneProps,className:c(Le,ye,d(ye)),style:{minHeight:T},children:ue?/* @__PURE__ */j(u,{state:"busy",verb:me,pct:E}):/* @__PURE__ */k(x,{children:[
5
+ /* @__PURE__ */j("span",{className:"text-gray-400",children:/* @__PURE__ */j(s,{})}),
6
6
  /* @__PURE__ */j("span",{className:"px-3 text-xs text-gray-500",children:je}),
7
7
  /* @__PURE__ */j("span",{className:"text-sm font-medium text-blue-600",children:te}),K&&/* @__PURE__ */j("span",{className:"text-xs text-gray-400",children:K})]})});/* @__PURE__ */
8
- return k(a,{label:U,htmlFor:be,hint:F,error:he,required:S,className:P,children:[X&&/* @__PURE__ */j("div",{"data-media-kind":"",className:"mb-2",children:/* @__PURE__ */j(h,{value:re,onChange:e=>X(e),options:[{value:"image",label:ie.image,icon:/* @__PURE__ */j(p,{name:"image","aria-hidden":"true",className:"h-4 w-4"}),disabled:ye},{value:"video",label:ie.video,icon:/* @__PURE__ */j(p,{name:"play","aria-hidden":"true",className:"h-4 w-4"}),disabled:ye}],block:!0,size:"md",label:"string"==typeof U&&U?U:ie.upload})}),w?Oe:Se,!C&&/* @__PURE__ */j("input",{...we.inputProps}),
9
- /* @__PURE__ */j(m,{rejections:we.rejections})]})}export{w as MediaUploadField};
8
+ return k(a,{label:U,htmlFor:be,hint:F,error:he,required:S,className:P,children:[X&&/* @__PURE__ */j("div",{"data-media-kind":"",className:"mb-2",children:/* @__PURE__ */j(i,{value:re,onChange:e=>X(e),options:[{value:"image",label:ie.image,icon:/* @__PURE__ */j(p,{name:"image","aria-hidden":"true",className:"h-4 w-4"}),disabled:ye},{value:"video",label:ie.video,icon:/* @__PURE__ */j(p,{name:"play","aria-hidden":"true",className:"h-4 w-4"}),disabled:ye}],block:!0,size:"md",label:"string"==typeof U&&U?U:ie.upload})}),w?Oe:Se,!C&&/* @__PURE__ */j("input",{...we.inputProps}),
9
+ /* @__PURE__ */j(h,{rejections:we.rejections})]})}export{w as MediaUploadField};
@@ -1,15 +1,15 @@
1
- import{optionNoteClass as e}from"./chunk-QR4RM7PO.js";import{keepsNativeMenu as t}from"./chunk-5QFPTDQF.js";import{Icon as n}from"./chunk-KIBL6M3T.js";import{onOverlayOpen as r}from"./chunk-PGN5ME7B.js";import{Z_LAYERS as o}from"./chunk-62LW225J.js";import{useHydrated as i,useBrowserLayoutEffect as a}from"./chunk-D65T4H6J.js";import{glassStyle as l,GLASS_DIVIDER as c}from"./chunk-DTJRIWFR.js";import{registerModalEscapeInterceptor as s}from"./chunk-TWVUQUUD.js";import{createContext as u,forwardRef as d,useContext as p,useId as m,useRef as h,useState as f,useEffect as g,useMemo as y,useCallback as b}from"react";import{createPortal as w}from"react-dom";import{jsxs as x,jsx as k,Fragment as v}from"react/jsx-runtime";function N(e,t,n){return e.length===t+1&&e[t].key===n.key?e:[...e.slice(0,t),n]}function C(e,t){const n=Math.max(0,t);return e.length>n?e.slice(0,n):e}function T(e,t,n){if(0===t.length||0===e.length)return[];const r=[e];for(let e=1;e<t.length;e++){const o=r[e-1].find(n=>n.to===t[e].key),i=o?n(o):[];if(0===i.length)break;r.push(i)}return r}function M(e,t,n,r){const o=Math.max(0,r-n),i=Math.min(t,o),a=e-i/2;return a<n?n:a+i>r?Math.max(n,r-i):a}function E(e,t,n,r,o,i=!1,a=8){const l=t+o,c=e-o-n,s=c>=a;return i&&s?{left:c,flipped:!0}:l+n<=r-a?{left:l,flipped:!1}:s?{left:c,flipped:!0}:i?{left:a,flipped:!0}:{left:Math.max(a,r-a-n),flipped:!1}}function W(){try{return getComputedStyle(document.documentElement).getPropertyValue("--menu-density")?.trim()||"normal"}catch{return"normal"}}var L=u(null),$=u(!1);function B({children:e,style:n,className:a="",onClose:c,minWidth:u=180,portal:d=!1}){const p=h(null),b=m(),[x,v]=f([]),T=h();g(()=>()=>clearTimeout(T.current),[]);const M=i(),E=y(()=>{const e=()=>clearTimeout(T.current);return{id:b,depth:0,path:x,open:(t,n)=>{e(),v(e=>N(e,t,n))},scheduleClose:t=>{e(),T.current=setTimeout(()=>v(e=>C(e,t)),200)},closeBelow:t=>{e(),v(e=>C(e,t))},cancelClose:e,closeTree:()=>{e(),v([]),c?.()},root:p}},[b,x,c]);g(()=>{if(!c)return;const e=e=>{e.target.closest("[data-menu-toggle]")||e.target.closest?.(`[data-popup-menu-tree="${b}"]`)||p.current&&!p.current.contains(e.target)&&c()},t=e=>{"Escape"===e.key&&c()};window.addEventListener("pointerdown",e),window.addEventListener("keydown",t);const n=r(c),o=s(()=>!1,()=>p.current);return()=>{window.removeEventListener("pointerdown",e),window.removeEventListener("keydown",t),n(),o()}},[c,b]),g(()=>{const e=p.current;e&&requestAnimationFrame(()=>{const t=e.getBoundingClientRect();if(t.right>window.innerWidth-8){const n=t.right-window.innerWidth+8;e.style.left?e.style.left=parseFloat(e.style.left)-n+"px":e.style.right||(e.style.left=t.left-n+"px")}if(t.left<8&&(e.style.left?e.style.left="8px":e.style.right&&(e.style.right=window.innerWidth-t.width-8+"px")),t.bottom>window.innerHeight-8){const n=t.bottom-window.innerHeight+8;e.style.top?e.style.top=parseFloat(e.style.top)-n+"px":e.style.bottom?e.style.bottom="8px":e.style.top=t.top-n+"px"}t.top<8&&(e.style.top?e.style.top="8px":e.style.bottom&&(e.style.bottom=window.innerHeight-t.height-8+"px"))})});const $=W(),B=/(^|[\s:])!?z-/.test(a),R=/* @__PURE__ */k("div",{ref:p,"data-popup-menu-tree":b,className:`fixed rounded-(--radius-popup) ${"tight"===$?"py-1":"large"===$?"py-2":"py-1"} ${a}`,onContextMenu:e=>{t(e.target)||e.preventDefault()},style:{...B?{}:{zIndex:o.menu},minWidth:u,animation:"popup-in 0.12s ease-out",...l(),...n},children:/* @__PURE__ */k(L.Provider,{value:E,children:e})});return d?M?w(R,document.body):null:R}function R(e,t,n,r=!1){const o=W(),i="tight"===o?"0.25rem":"large"===o?"0.6rem":0;return{className:`w-full flex items-center gap-2 text-left transition-colors rounded-lg mx-auto\n ${e?"text-red-600 not-disabled:not-aria-disabled:hover:bg-red-50":r?"bg-blue-50 text-blue-700":"text-gray-700 not-disabled:not-aria-disabled:hover:bg-blue-50 not-disabled:not-aria-disabled:hover:text-blue-700"}\n ${t?"opacity-40 cursor-not-allowed":""}\n ${n}`,style:{width:"calc(100% - 8px)",marginLeft:4,marginRight:4,fontSize:"var(--menu-font-size, 14px)",paddingLeft:"var(--menu-padding-x, 1rem)",paddingRight:"var(--menu-padding-x, 1rem)",paddingTop:i,paddingBottom:i,..."normal"===o?{minHeight:"calc(var(--row-height-menu, 2.25rem) + 2 * (var(--menu-padding-y, 0.5rem) - 0.5rem))"}:{}}}}var j=/* @__PURE__ */k(n,{name:"check","aria-hidden":!0,className:"h-4 w-4",strokeWidth:2});function D({kind:e,checked:t}){/* @__PURE__ */
2
- return k("span","checkbox"===e?{"aria-hidden":!0,"data-menu-check":"",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded border "+(t?"border-blue-600 bg-blue-600 text-white":"border-gray-400"),children:t&&j}:{"aria-hidden":!0,"data-menu-check":"",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:t&&j})}var P=d(function({onClick:t,children:n,className:r="",danger:o,disabled:i,role:a,checked:l,icon:c,description:s,tabIndex:u,id:d,onMouseEnter:h},f){const g=p(L),y=m(),b=null!=s&&!1!==s,w=`${d??y}-label`,N=`${d??y}-note`,C=p($),T=R(o,i,r),M=void 0===l?null:"menuitemradio"===a?"radio":"checkbox";/* @__PURE__ */
3
- return x("button",{ref:f,id:d,role:"radio"===M?"menuitemradio":"checkbox"===M?"menuitemcheckbox":a??(C?"menuitem":void 0),"aria-checked":M?l:void 0,"aria-labelledby":b?w:void 0,"aria-describedby":b?N:void 0,tabIndex:u,onClick:()=>{t?.(),g&&g.depth>0&&"checkbox"!==M&&g.closeTree()},onMouseEnter:()=>{g?.scheduleClose(g.depth),h?.()},disabled:i,className:T.className,style:T.style,children:[M&&/* @__PURE__ */k(D,{kind:M,checked:!!l}),b?
1
+ import{keepsNativeMenu as e}from"./chunk-5QFPTDQF.js";import{optionNoteClass as t}from"./chunk-QR4RM7PO.js";import{Icon as n}from"./chunk-KIBL6M3T.js";import{onOverlayOpen as r}from"./chunk-PGN5ME7B.js";import{Z_LAYERS as o}from"./chunk-62LW225J.js";import{useHydrated as i,useBrowserLayoutEffect as a}from"./chunk-D65T4H6J.js";import{glassStyle as l,GLASS_DIVIDER as c}from"./chunk-DTJRIWFR.js";import{registerModalEscapeInterceptor as s}from"./chunk-TWVUQUUD.js";import{createContext as u,forwardRef as d,useContext as p,useId as m,useRef as h,useState as f,useEffect as g,useMemo as y,useCallback as b}from"react";import{createPortal as w}from"react-dom";import{jsxs as x,jsx as k,Fragment as v}from"react/jsx-runtime";function N(e,t,n){return e.length===t+1&&e[t].key===n.key?e:[...e.slice(0,t),n]}function C(e,t){const n=Math.max(0,t);return e.length>n?e.slice(0,n):e}function T(e,t,n){if(0===t.length||0===e.length)return[];const r=[e];for(let e=1;e<t.length;e++){const o=r[e-1].find(n=>n.to===t[e].key),i=o?n(o):[];if(0===i.length)break;r.push(i)}return r}function M(e,t,n,r){const o=Math.max(0,r-n),i=Math.min(t,o),a=e-i/2;return a<n?n:a+i>r?Math.max(n,r-i):a}function E(e,t,n,r,o,i=!1,a=8){const l=t+o,c=e-o-n,s=c>=a;return i&&s?{left:c,flipped:!0}:l+n<=r-a?{left:l,flipped:!1}:s?{left:c,flipped:!0}:i?{left:a,flipped:!0}:{left:Math.max(a,r-a-n),flipped:!1}}function W(){try{return getComputedStyle(document.documentElement).getPropertyValue("--menu-density")?.trim()||"normal"}catch{return"normal"}}var L=u(null),$=u(!1);function B({children:t,style:n,className:a="",onClose:c,minWidth:u=180,portal:d=!1}){const p=h(null),b=m(),[x,v]=f([]),T=h();g(()=>()=>clearTimeout(T.current),[]);const M=i(),E=y(()=>{const e=()=>clearTimeout(T.current);return{id:b,depth:0,path:x,open:(t,n)=>{e(),v(e=>N(e,t,n))},scheduleClose:t=>{e(),T.current=setTimeout(()=>v(e=>C(e,t)),200)},closeBelow:t=>{e(),v(e=>C(e,t))},cancelClose:e,closeTree:()=>{e(),v([]),c?.()},root:p}},[b,x,c]);g(()=>{if(!c)return;const e=e=>{e.target.closest("[data-menu-toggle]")||e.target.closest?.(`[data-popup-menu-tree="${b}"]`)||p.current&&!p.current.contains(e.target)&&c()},t=e=>{"Escape"===e.key&&c()};window.addEventListener("pointerdown",e),window.addEventListener("keydown",t);const n=r(c),o=s(()=>!1,()=>p.current);return()=>{window.removeEventListener("pointerdown",e),window.removeEventListener("keydown",t),n(),o()}},[c,b]),g(()=>{const e=p.current;e&&requestAnimationFrame(()=>{const t=e.getBoundingClientRect();if(t.right>window.innerWidth-8){const n=t.right-window.innerWidth+8;e.style.left?e.style.left=parseFloat(e.style.left)-n+"px":e.style.right||(e.style.left=t.left-n+"px")}if(t.left<8&&(e.style.left?e.style.left="8px":e.style.right&&(e.style.right=window.innerWidth-t.width-8+"px")),t.bottom>window.innerHeight-8){const n=t.bottom-window.innerHeight+8;e.style.top?e.style.top=parseFloat(e.style.top)-n+"px":e.style.bottom?e.style.bottom="8px":e.style.top=t.top-n+"px"}t.top<8&&(e.style.top?e.style.top="8px":e.style.bottom&&(e.style.bottom=window.innerHeight-t.height-8+"px"))})});const $=W(),B=/(^|[\s:])!?z-/.test(a),R=/* @__PURE__ */k("div",{ref:p,"data-popup-menu-tree":b,className:`fixed rounded-(--radius-popup) ${"tight"===$?"py-1":"large"===$?"py-2":"py-1"} ${a}`,onContextMenu:t=>{e(t.target)||t.preventDefault()},style:{...B?{}:{zIndex:o.menu},minWidth:u,animation:"popup-in 0.12s ease-out",...l(),...n},children:/* @__PURE__ */k(L.Provider,{value:E,children:t})});return d?M?w(R,document.body):null:R}function R(e,t,n,r=!1){const o=W(),i="tight"===o?"0.25rem":"large"===o?"0.6rem":0;return{className:`w-full flex items-center gap-2 text-left transition-colors rounded-lg mx-auto\n ${e?"text-red-600 not-disabled:not-aria-disabled:hover:bg-red-50":r?"bg-blue-50 text-blue-700":"text-gray-700 not-disabled:not-aria-disabled:hover:bg-blue-50 not-disabled:not-aria-disabled:hover:text-blue-700"}\n ${t?"opacity-40 cursor-not-allowed":""}\n ${n}`,style:{width:"calc(100% - 8px)",marginLeft:4,marginRight:4,fontSize:"var(--menu-font-size, 14px)",paddingLeft:"var(--menu-padding-x, 1rem)",paddingRight:"var(--menu-padding-x, 1rem)",paddingTop:i,paddingBottom:i,..."normal"===o?{minHeight:"calc(var(--row-height-menu, 2.25rem) + 2 * (var(--menu-padding-y, 0.5rem) - 0.5rem))"}:{}}}}var j=/* @__PURE__ */k(n,{name:"check","aria-hidden":!0,className:"h-4 w-4",strokeWidth:2});function D({kind:e,checked:t}){/* @__PURE__ */
2
+ return k("span","checkbox"===e?{"aria-hidden":!0,"data-menu-check":"",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded border "+(t?"border-blue-600 bg-blue-600 text-white":"border-gray-400"),children:t&&j}:{"aria-hidden":!0,"data-menu-check":"",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:t&&j})}var P=d(function({onClick:e,children:n,className:r="",danger:o,disabled:i,role:a,checked:l,icon:c,description:s,tabIndex:u,id:d,onMouseEnter:h},f){const g=p(L),y=m(),b=null!=s&&!1!==s,w=`${d??y}-label`,N=`${d??y}-note`,C=p($),T=R(o,i,r),M=void 0===l?null:"menuitemradio"===a?"radio":"checkbox";/* @__PURE__ */
3
+ return x("button",{ref:f,id:d,role:"radio"===M?"menuitemradio":"checkbox"===M?"menuitemcheckbox":a??(C?"menuitem":void 0),"aria-checked":M?l:void 0,"aria-labelledby":b?w:void 0,"aria-describedby":b?N:void 0,tabIndex:u,onClick:()=>{e?.(),g&&g.depth>0&&"checkbox"!==M&&g.closeTree()},onMouseEnter:()=>{g?.scheduleClose(g.depth),h?.()},disabled:i,className:T.className,style:T.style,children:[M&&/* @__PURE__ */k(D,{kind:M,checked:!!l}),b?
4
4
  /* @__PURE__ */x("span",{className:"block min-w-0 flex-1 py-2",children:[
5
5
  /* @__PURE__ */x("span",{className:"flex items-center gap-2",children:[null!=c&&/* @__PURE__ */k(A,{children:c}),
6
6
  /* @__PURE__ */k("span",{id:w,className:"min-w-0",children:n})]}),
7
- /* @__PURE__ */k("span",{id:N,"data-menu-note":"",className:e(),style:null!=c?{paddingLeft:"1.5rem"}:void 0,children:s})]}):/* @__PURE__ */x(v,{children:[null!=c&&/* @__PURE__ */k(A,{children:c}),n]})]})});function A({children:e}){/* @__PURE__ */
8
- return k("span",{"aria-hidden":"true","data-menu-icon":"",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:e})}var F=/* @__PURE__ */k(n,{name:"chevron-right","aria-hidden":!0,className:"h-3.5 w-3.5 shrink-0 ml-auto",strokeWidth:2});function H(e){let t=o.menu;for(let n=e;n&&n!==document.body;n=n.parentElement){const e=parseInt(getComputedStyle(n).zIndex,10);Number.isNaN(e)||(t=e)}return t}function I(e){return e?[...e.querySelectorAll("button:not([disabled]), a[href]")].filter(t=>t.closest("[data-popup-submenu-panel]")===e):[]}function z({label:e,icon:n,children:r,disabled:o,className:i="",minWidth:c=180,maxHeight:u,rowProps:d}){const f=p(L),N=m(),C=h(null),T=h(null),$=h(),B=h(!1),j=`${N}-menu`;g(()=>()=>clearTimeout($.current),[]);const D=f?.depth??0,P=f?.path[D],A=!!P&&P.key===N&&!o,z=b(e=>{if(!f||o||!C.current)return;clearTimeout($.current),B.current=e;const t=C.current.getBoundingClientRect(),n=C.current.closest("[data-popup-submenu-panel]")??C.current.closest("[data-popup-menu-tree]"),r=n?.getBoundingClientRect()??t,i=D>0&&(f.path[D-1]?.flipped??!1),a=E(r.left,r.right,c,window.innerWidth,4,i);f.open(D,{key:N,y:t.top,...a})},[f,o,D,N,c]),S=e=>{f?.closeBelow(D),C.current?.focus()};g(()=>{if(A)return s(e=>"Escape"===e.key&&(!(f&&f.path.length>D+1)&&(S(),!0)),()=>T.current)}),a(()=>{if(!A||!P)return;const e=()=>{const e=T.current;if(!e||!C.current)return;const t=C.current.closest("[data-popup-submenu-panel]")??C.current.closest("[data-popup-menu-tree]"),n=t?.getBoundingClientRect()??C.current.getBoundingClientRect(),r=D>0&&(f?.path[D-1]?.flipped??!1),o=e.offsetWidth||c,i=E(n.left,n.right,o,window.innerWidth,4,r,8),a=e.offsetHeight,l=M(C.current.getBoundingClientRect().top+a/2,a,8,window.innerHeight-8);e.style.left=`${i.left}px`,e.style.top=`${l}px`,e.dataset.flipped=String(i.flipped)};e();let t=0;const n=requestAnimationFrame(()=>{t=requestAnimationFrame(e)});return()=>{cancelAnimationFrame(n),cancelAnimationFrame(t)}}),g(()=>{A&&B.current&&(B.current=!1,I(T.current)[0]?.focus())},[A]);const q=y(()=>f&&{...f,depth:D+1},[f,D]);if(!f)throw new Error("PopupSubmenu must be rendered inside a PopupMenu");const Q=R(!1,o,i,A),U=W();/* @__PURE__ */
7
+ /* @__PURE__ */k("span",{id:N,"data-menu-note":"",className:t(),style:null!=c?{paddingLeft:"1.5rem"}:void 0,children:s})]}):/* @__PURE__ */x(v,{children:[null!=c&&/* @__PURE__ */k(A,{children:c}),n]})]})});function A({children:e}){/* @__PURE__ */
8
+ return k("span",{"aria-hidden":"true","data-menu-icon":"",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:e})}var F=/* @__PURE__ */k(n,{name:"chevron-right","aria-hidden":!0,className:"h-3.5 w-3.5 shrink-0 ml-auto",strokeWidth:2});function H(e){let t=o.menu;for(let n=e;n&&n!==document.body;n=n.parentElement){const e=parseInt(getComputedStyle(n).zIndex,10);Number.isNaN(e)||(t=e)}return t}function I(e){return e?[...e.querySelectorAll("button:not([disabled]), a[href]")].filter(t=>t.closest("[data-popup-submenu-panel]")===e):[]}function z({label:t,icon:n,children:r,disabled:o,className:i="",minWidth:c=180,maxHeight:u,rowProps:d}){const f=p(L),N=m(),C=h(null),T=h(null),$=h(),B=h(!1),j=`${N}-menu`;g(()=>()=>clearTimeout($.current),[]);const D=f?.depth??0,P=f?.path[D],A=!!P&&P.key===N&&!o,z=b(e=>{if(!f||o||!C.current)return;clearTimeout($.current),B.current=e;const t=C.current.getBoundingClientRect(),n=C.current.closest("[data-popup-submenu-panel]")??C.current.closest("[data-popup-menu-tree]"),r=n?.getBoundingClientRect()??t,i=D>0&&(f.path[D-1]?.flipped??!1),a=E(r.left,r.right,c,window.innerWidth,4,i);f.open(D,{key:N,y:t.top,...a})},[f,o,D,N,c]),S=e=>{f?.closeBelow(D),C.current?.focus()};g(()=>{if(A)return s(e=>"Escape"===e.key&&(!(f&&f.path.length>D+1)&&(S(),!0)),()=>T.current)}),a(()=>{if(!A||!P)return;const e=()=>{const e=T.current;if(!e||!C.current)return;const t=C.current.closest("[data-popup-submenu-panel]")??C.current.closest("[data-popup-menu-tree]"),n=t?.getBoundingClientRect()??C.current.getBoundingClientRect(),r=D>0&&(f?.path[D-1]?.flipped??!1),o=e.offsetWidth||c,i=E(n.left,n.right,o,window.innerWidth,4,r,8),a=e.offsetHeight,l=M(C.current.getBoundingClientRect().top+a/2,a,8,window.innerHeight-8);e.style.left=`${i.left}px`,e.style.top=`${l}px`,e.dataset.flipped=String(i.flipped)};e();let t=0;const n=requestAnimationFrame(()=>{t=requestAnimationFrame(e)});return()=>{cancelAnimationFrame(n),cancelAnimationFrame(t)}}),g(()=>{A&&B.current&&(B.current=!1,I(T.current)[0]?.focus())},[A]);const q=y(()=>f&&{...f,depth:D+1},[f,D]);if(!f)throw new Error("PopupSubmenu must be rendered inside a PopupMenu");const Q=R(!1,o,i,A),U=W();/* @__PURE__ */
9
9
  return x(v,{children:[
10
10
  /* @__PURE__ */x("button",{ref:C,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":A,"aria-controls":A?j:void 0,disabled:o,"data-popup-submenu-row":!0,className:Q.className,style:Q.style,onClick:e=>{const t=0===e.detail;A?t&&I(T.current)[0]?.focus():z(t)},...d,onKeyDown:e=>{"ArrowRight"===e.key&&(e.preventDefault(),e.stopPropagation(),z(!0))},onMouseEnter:()=>{d?.onMouseEnter?.(),o||(f.cancelClose(),A?f.closeBelow(D+1):(clearTimeout($.current),$.current=setTimeout(()=>z(!1),120)))},onMouseLeave:()=>{clearTimeout($.current),f.scheduleClose(D)},children:[n,
11
- /* @__PURE__ */k("span",{className:"min-w-0 flex-1 truncate",children:e}),F]}),A&&w(
12
- /* @__PURE__ */k("div",{ref:T,id:j,role:"menu","data-popup-menu-tree":f.id,"data-popup-submenu-panel":!0,className:"fixed rounded-(--radius-popup) overflow-x-hidden overflow-y-auto overscroll-contain "+("tight"===U?"py-1":"large"===U?"py-2":"py-1"),style:{left:P.left,top:P.y,minWidth:c,maxHeight:void 0===u?"calc(100vh - 16px)":`min(${"number"==typeof u?`${u}px`:u}, calc(100vh - 16px))`,zIndex:H(f.root.current)+D+1,animation:(P.flipped?"popup-submenu-in-left":"popup-submenu-in")+" 0.1s ease-out",...l()},onKeyDown:e=>{if(e.target.closest("[data-popup-submenu-panel]")!==e.currentTarget)return;const t=I(T.current),n=t.indexOf(document.activeElement),r=n=>{e.preventDefault(),e.stopPropagation(),t[(n+t.length)%t.length]?.focus()};"ArrowDown"===e.key?r(n+1):"ArrowUp"===e.key?r(n<0?t.length-1:n-1):"Home"===e.key?r(0):"End"===e.key?r(t.length-1):"ArrowLeft"===e.key&&(e.preventDefault(),e.stopPropagation(),S())},onMouseEnter:()=>{f.cancelClose(),clearTimeout($.current)},onMouseLeave:()=>f.scheduleClose(D+1),onContextMenu:e=>{t(e.target)||e.preventDefault()},children:/* @__PURE__ */k(L.Provider,{value:q,children:r})}),document.body)]})}function S(){const e=W();/* @__PURE__ */
11
+ /* @__PURE__ */k("span",{className:"min-w-0 flex-1 truncate",children:t}),F]}),A&&w(
12
+ /* @__PURE__ */k("div",{ref:T,id:j,role:"menu","data-popup-menu-tree":f.id,"data-popup-submenu-panel":!0,className:"fixed rounded-(--radius-popup) overflow-x-hidden overflow-y-auto overscroll-contain "+("tight"===U?"py-1":"large"===U?"py-2":"py-1"),style:{left:P.left,top:P.y,minWidth:c,maxHeight:void 0===u?"calc(100vh - 16px)":`min(${"number"==typeof u?`${u}px`:u}, calc(100vh - 16px))`,zIndex:H(f.root.current)+D+1,animation:(P.flipped?"popup-submenu-in-left":"popup-submenu-in")+" 0.1s ease-out",...l()},onKeyDown:e=>{if(e.target.closest("[data-popup-submenu-panel]")!==e.currentTarget)return;const t=I(T.current),n=t.indexOf(document.activeElement),r=n=>{e.preventDefault(),e.stopPropagation(),t[(n+t.length)%t.length]?.focus()};"ArrowDown"===e.key?r(n+1):"ArrowUp"===e.key?r(n<0?t.length-1:n-1):"Home"===e.key?r(0):"End"===e.key?r(t.length-1):"ArrowLeft"===e.key&&(e.preventDefault(),e.stopPropagation(),S())},onMouseEnter:()=>{f.cancelClose(),clearTimeout($.current)},onMouseLeave:()=>f.scheduleClose(D+1),onContextMenu:t=>{e(t.target)||t.preventDefault()},children:/* @__PURE__ */k(L.Provider,{value:q,children:r})}),document.body)]})}function S(){const e=W();/* @__PURE__ */
13
13
  return k("div",{className:`border-t ${c} ${"tight"===e?"my-0.5":"large"===e?"my-2":"my-1"} mx-3`})}function q(){const e=W(),t="tight"===e?"0.125rem":"large"===e?"0.375rem":"0.25rem";return{color:"var(--ink-muted)",paddingLeft:"var(--menu-padding-x, 1rem)",paddingRight:"var(--menu-padding-x, 1rem)",paddingTop:t,paddingBottom:t}}function Q({children:e}){/* @__PURE__ */
14
14
  return k("div",{className:"text-xs font-medium uppercase tracking-wide",style:q(),children:e})}function U({d:e,className:t="h-4 w-4"}){/* @__PURE__ */
15
15
  return k("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */k("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})})}export{D as MenuCheckMark,U as MenuIcon,$ as MenuSemanticsContext,B as PopupMenu,S as PopupMenuDivider,P as PopupMenuItem,Q as PopupMenuLabel,z as PopupSubmenu,M as clampMenuTop,C as closeMenuBelow,R as itemLook,E as menuPanelLeft,q as menuTextRowStyle,N as openMenuLevel,T as resolveMenuLevels};
@@ -1,14 +1,14 @@
1
- import{CountBadge as e}from"./chunk-MAOJENIB.js";import{isShown as t}from"./chunk-HCP7WOAL.js";import{SettingAutoContext as a,InSettingRowContext as i}from"./chunk-E4Z5OXBI.js";import{useShellStrings as n}from"./chunk-E6UCGCOC.js";import{jsx as s,jsxs as r}from"react/jsx-runtime";var l={default:{pad:"p-4",gap:"gap-4",text:"text-sm",bodyTop:"mt-4",bodyPad:"pt-3"},compact:{pad:"py-2",gap:"gap-2",text:"text-sm",bodyTop:"mt-2",bodyPad:"pt-2"}};function d({label:d,icon:c,action:m,value:o,readout:p,description:h,children:x,controlId:u,unknownText:g="—",quiet:f=!1,size:v="default",viewState:y,divider:N=!0,showWhen:w,values:b,context:$,className:j=""}){const k=n();if(!t(w,b,$))return null;const P=l[v],C=void 0!==o||void 0===x&&null==m,O=null==o||""===o,T=f?"text-gray-500":"text-gray-800",B=O?"text-gray-400":f?"text-gray-500":"text-gray-900",E=null!=p&&!1!==p,I=`${P.text} font-medium ${T}${"compact"===v?" whitespace-nowrap":""}`,A=u?/* @__PURE__ */s("label",{htmlFor:u,className:I,children:d}):/* @__PURE__ */s("span",{className:I,children:d}),V="auto"===y?/* @__PURE__ */s("span",{"data-setting-auto":"","aria-hidden":"true",className:"shrink-0 rounded-sm border border-gray-200 px-1 text-2xs font-normal leading-4 text-gray-500",children:k.settingView.auto}):"edited"===y?/* @__PURE__ */r("span",{"data-setting-edited":"",className:"inline-flex shrink-0 items-center",children:[
1
+ import{CountBadge as e}from"./chunk-MAOJENIB.js";import{SettingAutoContext as t,InSettingRowContext as a}from"./chunk-E4Z5OXBI.js";import{isShown as i}from"./chunk-HCP7WOAL.js";import{useShellStrings as n}from"./chunk-E6UCGCOC.js";import{jsx as s,jsxs as r}from"react/jsx-runtime";var l={default:{pad:"p-4",gap:"gap-4",text:"text-sm",bodyTop:"mt-4",bodyPad:"pt-3"},compact:{pad:"py-2",gap:"gap-2",text:"text-sm",bodyTop:"mt-2",bodyPad:"pt-2"}};function d({label:d,icon:c,action:m,value:o,readout:p,description:h,children:x,controlId:u,unknownText:g="—",quiet:f=!1,size:v="default",viewState:y,divider:N=!0,showWhen:w,values:b,context:$,className:j=""}){const k=n();if(!i(w,b,$))return null;const P=l[v],C=void 0!==o||void 0===x&&null==m,O=null==o||""===o,T=f?"text-gray-500":"text-gray-800",B=O?"text-gray-400":f?"text-gray-500":"text-gray-900",E=null!=p&&!1!==p,I=`${P.text} font-medium ${T}${"compact"===v?" whitespace-nowrap":""}`,A=u?/* @__PURE__ */s("label",{htmlFor:u,className:I,children:d}):/* @__PURE__ */s("span",{className:I,children:d}),V="auto"===y?/* @__PURE__ */s("span",{"data-setting-auto":"","aria-hidden":"true",className:"shrink-0 rounded-sm border border-gray-200 px-1 text-2xs font-normal leading-4 text-gray-500",children:k.settingView.auto}):"edited"===y?/* @__PURE__ */r("span",{"data-setting-edited":"",className:"inline-flex shrink-0 items-center",children:[
2
2
  /* @__PURE__ */s("span",{"aria-hidden":"true",className:"inline-flex",children:/* @__PURE__ */s(e,{dot:!0,tone:"accent"})}),
3
- /* @__PURE__ */s("span",{className:"sr-only",children:k.settingView.edited})]}):null,W=/* @__PURE__ */s(a.Provider,{value:"auto"===y,children:O?g:o}),q=[N?"border-t border-gray-100 first:border-t-0":"",P.pad,j].filter(Boolean).join(" "),z=null!=x&&!1!==x&&/* @__PURE__ */s("div",{className:`${P.bodyTop} border-t border-gray-100 ${P.bodyPad}`,children:x});/* @__PURE__ */
3
+ /* @__PURE__ */s("span",{className:"sr-only",children:k.settingView.edited})]}):null,W=/* @__PURE__ */s(t.Provider,{value:"auto"===y,children:O?g:o}),q=[N?"border-t border-gray-100 first:border-t-0":"",P.pad,j].filter(Boolean).join(" "),z=null!=x&&!1!==x&&/* @__PURE__ */s("div",{className:`${P.bodyTop} border-t border-gray-100 ${P.bodyPad}`,children:x});/* @__PURE__ */
4
4
  return r("div",E?{className:q,"data-setting-row":"compact"===v?v:void 0,children:[
5
5
  /* @__PURE__ */r("div",{"data-setting-line":"",className:"flex flex-wrap items-center justify-between gap-x-2 gap-y-2",children:[
6
6
  /* @__PURE__ */s("div",{"data-setting-name":"compact"===v?"":void 0,className:"flex-1 basis-0",children:/* @__PURE__ */r("div",{className:`flex min-w-0 items-center gap-2 ${T}`,children:[null!=c&&/* @__PURE__ */s("span",{"aria-hidden":"true",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:c}),A,V]})}),
7
7
  /* @__PURE__ */r("div",{"data-setting-end":"",className:"ml-auto flex shrink-0 items-center gap-1",children:[
8
- /* @__PURE__ */s("span",{"data-setting-readout":"",className:`whitespace-nowrap ${P.text} ${f?"text-gray-500":"text-gray-900"}`,children:p}),("compact"===v||null!=m)&&/* @__PURE__ */s("span",{"data-setting-reset":"",className:"inline-flex h-6 w-6 shrink-0 items-center justify-center",children:m})]})]}),h&&/* @__PURE__ */s("p",{className:"mt-0.5 text-xs text-gray-500",children:h}),void 0!==o&&/* @__PURE__ */s("div",{"data-setting-value":"",className:`mt-2 flex justify-end ${P.text} ${B}`,children:/* @__PURE__ */s(i.Provider,{value:"compact"===v,children:W})}),z]}:{className:q,"data-setting-row":"compact"===v?v:void 0,children:[
8
+ /* @__PURE__ */s("span",{"data-setting-readout":"",className:`whitespace-nowrap ${P.text} ${f?"text-gray-500":"text-gray-900"}`,children:p}),("compact"===v||null!=m)&&/* @__PURE__ */s("span",{"data-setting-reset":"",className:"inline-flex h-6 w-6 shrink-0 items-center justify-center",children:m})]})]}),h&&/* @__PURE__ */s("p",{className:"mt-0.5 text-xs text-gray-500",children:h}),void 0!==o&&/* @__PURE__ */s("div",{"data-setting-value":"",className:`mt-2 flex justify-end ${P.text} ${B}`,children:/* @__PURE__ */s(a.Provider,{value:"compact"===v,children:W})}),z]}:{className:q,"data-setting-row":"compact"===v?v:void 0,children:[
9
9
  /* @__PURE__ */r("div",{className:"compact"===v?"flex flex-wrap items-center justify-between gap-x-2 gap-y-2":`flex items-center justify-between ${P.gap}`,children:[
10
10
  /* @__PURE__ */r("div",{"data-setting-name":"compact"===v?"":void 0,className:"compact"===v?"flex-1 basis-0":"min-w-0 flex-1",children:[null!=c?
11
11
  /* @__PURE__ */r("div",{className:`flex min-w-0 items-center gap-2 ${T}`,children:[
12
12
  /* @__PURE__ */s("span",{"aria-hidden":"true",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:c}),A,V]}):V?/* @__PURE__ */r("div",{className:"flex min-w-0 items-center gap-2",children:[A,V]}):A,h&&/* @__PURE__ */s("p",{className:"mt-0.5 text-xs text-gray-500",children:h})]}),"compact"===v?
13
- /* @__PURE__ */r("div",{"data-setting-end":"",className:"ml-auto flex shrink-0 items-center gap-1",children:[C&&/* @__PURE__ */s("div",{"data-setting-value":"",className:`flex items-center justify-end ${P.text} ${B}`,children:/* @__PURE__ */s(i.Provider,{value:!0,children:W})}),
13
+ /* @__PURE__ */r("div",{"data-setting-end":"",className:"ml-auto flex shrink-0 items-center gap-1",children:[C&&/* @__PURE__ */s("div",{"data-setting-value":"",className:`flex items-center justify-end ${P.text} ${B}`,children:/* @__PURE__ */s(a.Provider,{value:!0,children:W})}),
14
14
  /* @__PURE__ */s("span",{"data-setting-reset":"",className:"inline-flex h-6 w-6 shrink-0 items-center justify-center",children:m})]}):null!=m?/* @__PURE__ */r("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[C&&/* @__PURE__ */s("div",{className:`${P.text} ${B}`,children:W}),m]}):C&&/* @__PURE__ */s("div",{className:`shrink-0 ${P.text} ${B}`,children:W})]}),z]})}export{d as SettingRow};
@@ -1,4 +1,4 @@
1
- import{DropdownMenu as e}from"./chunk-WDXJWC3Y.js";import{jsxs as t,jsx as a,Fragment as i}from"react/jsx-runtime";var r="relative inline-flex items-center gap-2 px-3 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-40",n="text-blue-600",s="text-gray-600 hover:text-gray-900";function l({item:e,active:r,caret:n}){/* @__PURE__ */
1
+ import{DropdownMenu as e}from"./chunk-EMXR74QM.js";import{jsxs as t,jsx as a,Fragment as i}from"react/jsx-runtime";var r="relative inline-flex items-center gap-2 px-3 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-40",n="text-blue-600",s="text-gray-600 hover:text-gray-900";function l({item:e,active:r,caret:n}){/* @__PURE__ */
2
2
  return t(i,{children:[e.icon&&/* @__PURE__ */a("span",{className:"h-4 w-4 shrink-0",children:e.icon}),
3
3
  /* @__PURE__ */a("span",{className:"whitespace-nowrap",children:e.label}),null!=e.badge&&/* @__PURE__ */a("span",{className:"ml-0.5 inline-flex min-w-[1.25rem] items-center justify-center rounded-full bg-gray-100 px-2 text-2xs font-semibold leading-5 text-gray-600",children:e.badge}),n&&/* @__PURE__ */a("span",{className:"-ml-1 text-xs","aria-hidden":!0,children:"▾"}),r&&/* @__PURE__ */a("span",{className:"absolute inset-x-2 -bottom-px h-0.5 rounded-full bg-blue-600","aria-hidden":!0})]})}function c({items:i,activeKey:c,onSelect:m,brand:d,actions:o,linkAs:u,className:b}){/* @__PURE__ */
4
4
  return t("div",{className:`flex h-12 shrink-0 items-stretch gap-1 border-b border-gray-200 bg-white px-3 ${b??""}`,children:[d&&/* @__PURE__ */a("div",{className:"mr-1 flex items-center gap-2 pr-3 font-semibold text-gray-900",children:d}),
@@ -1,11 +1,11 @@
1
- import{MediaUploadField as e}from"./chunk-RUHFXBDS.js";import{BrandMark as r}from"./chunk-MI67DI3H.js";import{Button_default as a}from"./chunk-4IU5BSVE.js";import{useShellStrings as t}from"./chunk-E6UCGCOC.js";import{useRef as i,useState as l,useEffect as s}from"react";import{jsxs as n,jsx as c}from"react/jsx-runtime";function d({committedUrl:d,committedHasAlpha:o=null,committedIsLight:m=null,fallbackUrl:g,fallbackHasAlpha:h=null,fallbackIsLight:u=null,subjectName:b,assetName:p,onSave:x,onRemove:f,accept:v="image/png,image/x-icon,image/vnd.microsoft.icon,.ico,image/svg+xml,image/jpeg,image/webp",acceptHint:y="PNG · ICO · SVG · JPG · WEBP",maxBytes:N=5242880,previews:w=[],disabled:k=!1}){const j=i(null),[L,U]=l(null),[R,C]=l(""),[H,I]=l(""),[B,E]=l(!1),[F,O]=l(!1),S=function(e){return e.trim().toLocaleLowerCase().split(/\s+/).at(-1)||"image"}(p),A=t().brandAsset,G=R||d||g||"",P=L?null:d?o:h,$=L?null:d?m:u;s(()=>()=>{j.current&&URL.revokeObjectURL(j.current)},[]);const z=()=>{j.current&&(URL.revokeObjectURL(j.current),j.current=null)};/* @__PURE__ */
2
- return n("section",{"aria-label":A.region(p,b),className:"grid gap-4 lg:grid-cols-2",children:[
1
+ import{MediaUploadField as e}from"./chunk-MXVJHVVI.js";import{BrandMark as r}from"./chunk-MI67DI3H.js";import{Button_default as a}from"./chunk-4IU5BSVE.js";import{useShellStrings as t}from"./chunk-E6UCGCOC.js";import{useRef as i,useState as l,useEffect as s}from"react";import{jsxs as n,jsx as c}from"react/jsx-runtime";function d({committedUrl:d,committedHasAlpha:o=null,committedIsLight:m=null,fallbackUrl:g,fallbackHasAlpha:h=null,fallbackIsLight:u=null,subjectName:b,assetName:p,onSave:x,onRemove:f,accept:v="image/png,image/x-icon,image/vnd.microsoft.icon,.ico,image/svg+xml,image/jpeg,image/webp",acceptHint:y="PNG · ICO · SVG · JPG · WEBP",maxBytes:N=5242880,previews:w=[],disabled:k=!1}){const j=i(null),[L,U]=l(null),[C,R]=l(""),[I,H]=l(""),[E,O]=l(!1),[V,A]=l(!1),B=function(e){return e.trim().toLocaleLowerCase().split(/\s+/).at(-1)||"image"}(p),F=t().brandAsset,G=C||d||g||"",S=L?null:d?o:h,P=L?null:d?m:u;s(()=>()=>{j.current&&URL.revokeObjectURL(j.current)},[]);const $=()=>{j.current&&(URL.revokeObjectURL(j.current),j.current=null)};/* @__PURE__ */
2
+ return n("section",{"aria-label":F.region(p,b),className:"grid gap-4 lg:grid-cols-2",children:[
3
3
  /* @__PURE__ */n("div",{className:"rounded-lg border border-gray-200 bg-white p-4",children:[
4
- /* @__PURE__ */c(e,{value:G,onChange:()=>{},onFile:e=>{if(k)return;z();const r=URL.createObjectURL(e);j.current=r,U(e),C(r),I("")},label:p,hint:H||A.usedFor(b),error:H||void 0,accept:v,acceptHint:y,maxSizeBytes:N,fit:"contain",height:180,allowRemove:!1,busy:B||F,disabled:k}),
4
+ /* @__PURE__ */c(e,{value:G,onChange:()=>{},onFile:e=>{if(k)return;$();const r=URL.createObjectURL(e);j.current=r,U(e),R(r),H("")},label:p,hint:I||F.usedFor(b),error:I||void 0,accept:v,acceptHint:y,maxSizeBytes:N,fit:"contain",height:180,allowRemove:!1,busy:E||V,disabled:k}),
5
5
  /* @__PURE__ */n("div",{className:"mt-3 flex flex-wrap gap-2",children:[
6
- /* @__PURE__ */c(a,{onClick:async()=>{if(L&&!k&&!B){E(!0),I("");try{await x(L),z(),U(null),C("")}catch(e){I(e instanceof Error?e.message:A.saveFailed(S,p))}finally{E(!1)}}},disabled:!L||k,loading:B,children:A.save(S,p)}),(L||d)&&/* @__PURE__ */c(a,{variant:"ghost-danger",onClick:async()=>{if(!k&&!F){if(L)return z(),U(null),C(""),void I("");if(d){O(!0),I("");try{await f()}catch(e){I(e instanceof Error?e.message:A.removeFailed(S,p))}finally{O(!1)}}}},disabled:k,loading:F,children:L?A.discard:A.remove(S,p)})]})]}),w.length>0&&/* @__PURE__ */n("div",{className:"rounded-lg border border-gray-200 bg-white p-4","aria-label":A.previews(p),children:[
7
- /* @__PURE__ */c("h3",{className:"text-sm font-semibold text-gray-900",children:A.preview}),
8
- /* @__PURE__ */c("div",{className:"mt-3 grid gap-3",children:w.map(e=>{const a=/* @__PURE__ */c(r,{src:G,alt:A.alt(b,p),slot:e.slot,surface:e.surface,adaptive:!0,hasAlpha:P,isLight:$,size:"browser-tab"===e.kind?16:void 0});/* @__PURE__ */
6
+ /* @__PURE__ */c(a,{onClick:async()=>{if(L&&!k&&!E){O(!0),H("");try{await x(L),$(),U(null),R("")}catch(e){H(e instanceof Error?e.message:F.saveFailed(B,p))}finally{O(!1)}}},disabled:!L||k,loading:E,children:F.save(B,p)}),(L||d)&&/* @__PURE__ */c(a,{variant:"ghost-danger",onClick:async()=>{if(!k&&!V){if(L)return $(),U(null),R(""),void H("");if(d){A(!0),H("");try{await f()}catch(e){H(e instanceof Error?e.message:F.removeFailed(B,p))}finally{A(!1)}}}},disabled:k,loading:V,children:L?F.discard:F.remove(B,p)})]})]}),w.length>0&&/* @__PURE__ */n("div",{className:"rounded-lg border border-gray-200 bg-white p-4","aria-label":F.previews(p),children:[
7
+ /* @__PURE__ */c("h3",{className:"text-sm font-semibold text-gray-900",children:F.preview}),
8
+ /* @__PURE__ */c("div",{className:"mt-3 grid gap-3",children:w.map(e=>{const a=/* @__PURE__ */c(r,{src:G,alt:F.alt(b,p),slot:e.slot,surface:e.surface,adaptive:!0,hasAlpha:S,isLight:P,size:"browser-tab"===e.kind?16:void 0});/* @__PURE__ */
9
9
  return n("div",{"data-brand-preview":!0,className:"dark"===e.surface?"text-white":"text-gray-900",children:[
10
10
  /* @__PURE__ */c("div",{className:"mb-2 text-xs font-medium text-gray-500",children:e.label}),"browser-tab"===e.kind?/* @__PURE__ */n("div",{className:"flex items-end gap-1 border-b border-gray-200",children:[
11
11
  /* @__PURE__ */n("div",{className:"flex max-w-[220px] items-center gap-2 rounded-t-lg border border-b-0 border-gray-200 bg-white px-3 py-2",children:[a,
@@ -1 +1 @@
1
- import{setBoundaryErrorReporter as e}from"./chunk-KNUR2UEG.js";import{VERSION as t}from"./chunk-RNJ3MNO5.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)}}},R=e=>{const t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const a=b(e);let r=-1;const o=()=>{i(r),a()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=n(()=>{removeEventListener("visibilitychange",o,{capture:!0}),a()},{timeout:t})}},Z=[200,500],F=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=h();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)=>{R(()=>{for(const t of e)"soft-navigation"!==t.entryType?c.h(t):u(t);l(),t&&o(!0)})},h=["event","first-input"];w(t)&&h.push("soft-navigation");const v=T(h,f,{...t,durationThreshold:t.durationThreshold??40});o=r(e,s,Z,t.reportAllChanges),v&&(n.onHidden(()=>{f(v.takeRecords(),!0)}),a(()=>{d("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,i())}))})},N=class{p;l;h(e){this.p?.(e)}},j=[2500,4e3],x=[800,1800],B=e=>{document.prerendering?E(()=>B(e)):"complete"!==document.readyState?addEventListener("load",()=>B(e),!0):setTimeout(e)};var O=/^[A-Za-z0-9/_:.\-[\]{}*@~]+$/,U=/^[A-Za-z_$][A-Za-z0-9_$.]*$/,H=/^[A-Za-z0-9][A-Za-z0-9.+_-]*$/;var q=class{constructor(e){this.head=e}head;events=[];waiting=/* @__PURE__ */new Map;seen=/* @__PURE__ */new Set;get size(){return this.events.length}addVital(e){this.events.push(e)}addError(e){const t=function(e){return e.frames.length?`${e.name}|${e.frames.join("|")}`:`${e.name}|${e.message.replace(/\d/g,"0")}`}(e),n=this.waiting.get(t);return n?(n.count=Math.min(1e3,n.count+e.count),!0):!(this.seen.has(t)||this.seen.size>=20)&&(this.seen.add(t),this.waiting.set(t,e),this.events.push(e),!0)}drain(){const e=this.events;this.events=[],this.waiting.clear();const t=[],n=JSON.stringify({...this.head,events:[]}).length;let i=[],a=n;for(const r of e){const e=JSON.stringify(r).length+1;n+e>30720||((50===i.length||a+e>30720)&&(t.push({...this.head,events:i}),i=[],a=n),i.push(r),a+=e)}return i.length&&t.push({...this.head,events:i}),t}},J=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,K=/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*)?|\b[Bb]earer\s+[A-Za-z0-9._~+/=-]{8,}/g,V=/\b[a-z][a-z0-9+.-]*:\/\/\S+/gi,W=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,D=/\d{4,}/g,G=/(^|[/:])(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,})(?=$|[/:])/gi,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);E(()=>{let d,l=h(),u=g("LCP");const f=p(t,N),v=(i,a,o,s,c)=>{u=g("LCP",-1,i,a,o,s,c),d=r(e,u,j,t.reportAllChanges),n=!1,"soft-navigation"===i&&(l=h(!0))},m=e=>{f.l&&e.navigationId&&I(f.l,e),n||d(!0),v("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const t=e.getLargestInteractionContentfulPaint?.();t&&y([t])},y=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){m(t);continue}let e=0,n=[],i=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-c(),0),f.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){const a=t;if(!u.navigationId)continue;if("interactionId"in a&&a.interactionId!=u.navigationInteractionId)continue;i=a.largestContentfulPaint?.renderTime||0,e=Math.max(i-t.startTime,0),a.largestContentfulPaint&&(f.h(a.largestContentfulPaint),n=[a.largestContentfulPaint])}i<l.firstHiddenTime&&(u.value=e,u.entries=n,d())}},w=["largest-contentful-paint"];s&&w.push("interaction-contentful-paint","soft-navigation");const b=T(w,y);if(b){d=r(e,u,j,t.reportAllChanges);const c=["keydown","click","visibilitychange"],l=e=>{if(e.isTrusted&&!n){const e=u.id;R(()=>{if(!n){if(!s){b.disconnect();for(const e of c)removeEventListener(e,l,{capture:!0})}e===u.id&&(n=!0,d(!0))}})}};for(const e of c)addEventListener(e,l,{capture:!0});a(a=>{v("back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),d=r(e,u,j,t.reportAllChanges),o(()=>{u.value=performance.now()-a.timeStamp,n=!0,d(!0)})})}})})(e),F(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,x,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,x,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,x,t.reportAllChanges),d(!0))})},t)}})})(e)}function ce(n){if(ae?.stop(),ae=null,!1===n.enabled||"undefined"==typeof window||"undefined"==typeof document)return ie;if(!function(e){const t="string"==typeof e.app&&H.test(e.app),n="string"==typeof e.release&&H.test(e.release);return t&&n||console.warn("[efficient-shell] client telemetry not started: `app` and `release` must be version-like strings."),t&&n}(n))return ie;const i=function(e){const t=e.vitalsSampleRate??1;return t>0&&(t>=1||(e.random??Math.random)()<t)}(n);if(n.anonymous&&!i)return ie;const a=n.fetch??window.fetch.bind(window),r=new q({app:n.app,release:n.release,shell_version:H.test(t)?t:""}),o=ne(n.routeKey()),s=function(e=("undefined"==typeof window?void 0:window)){if(!e)return"desktop";const t="function"==typeof e.matchMedia&&e.matchMedia("(pointer: coarse)").matches,n=e.innerWidth;return n<600?"mobile":t&&n<1280?"tablet":"desktop"}(window);let c=!1;const d=()=>{for(const e of r.drain())oe(e,n,a)},l=e=>{c||n.anonymous||(r.addError(e),r.size>=50&&d())},u=(e,t)=>{return{type:"error",source:t,name:te(e),message:(a=e,i=a instanceof Error?a.message:"string"==typeof a?a:a&&"object"==typeof a&&"string"==typeof a.message?a.message:"",i.slice(0,640).replace(J,"[redacted]").replace(K,"[redacted]").replace(V,"[url]").replace(W,"[id]").replace(D,"[n]").replace(/\s+/g," ").trim().slice(0,160)),frames:ee(e instanceof Error?e.stack:void 0),route:ne(n.routeKey()),count:1};var i,a};i&&(n.observeVitals??se)(e=>{c||(r.addVital(function(e,t,n,i){return{type:"vital",name:e.name,value:e.value,route:re.has(e.name)?t:n(),navigation:e.navigationType??"navigate",device:i}}(e,o,()=>ne(n.routeKey()),s)),r.size>=50&&d())});const f=n.anonymous?()=>{}:function(t,n){const i=e=>{const{error:i,message:a,filename:r,lineno:o,colno:s}=e;if(null!=i)return void t(n(i,"onerror"));const c=r?ee(`at ${r}:${o??0}:${s??0}`):[];t({...n(a??"","onerror"),frames:c})},a=e=>t(n(e.reason,"unhandledrejection"));window.addEventListener("error",i),window.addEventListener("unhandledrejection",a);const r=e(e=>t(n(e,"boundary")));return()=>{window.removeEventListener("error",i),window.removeEventListener("unhandledrejection",a),r()}}(l,u),h=()=>{"hidden"===document.visibilityState&&d()};document.addEventListener("visibilitychange",h),window.addEventListener("pagehide",d);const g=window.setInterval(d,n.flushIntervalMs??6e4),v={flush:d,reportError:e=>l(u(e,"boundary")),stop(){c||(d(),c=!0,f(),document.removeEventListener("visibilitychange",h),window.removeEventListener("pagehide",d),window.clearInterval(g),ae===v&&(ae=null))}};return ae=v,v}export{ce as startClientTelemetry};
1
+ import{setBoundaryErrorReporter as e}from"./chunk-KNUR2UEG.js";import{VERSION as t}from"./chunk-BF7NTCLU.js";var n=-1,i=()=>n,a=e=>{addEventListener("pageshow",t=>{t.persisted&&(n=t.timeStamp,e(t))},!0)},r=(e,t,n,i)=>{let a,r;return o=>{var s,c;t.value>=0&&(o||i)&&(r=t.value-(a??0),(r||void 0===a)&&(a=t.value,t.delta=r,t.rating=(s=t.value)>(c=n)[1]?"poor":s>c[0]?"needs-improvement":"good",e(t)))}},o=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},s=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},c=()=>s()?.activationStart??0,d=-1,l=/* @__PURE__ */new Set,u=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,f=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of l)e();isFinite(d)||(d="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",f,!0))}},h=(e=!1)=>{if(e&&(d=1/0),d<0){const e=c(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;d=t??u(),addEventListener("visibilitychange",f,!0),addEventListener("prerenderingchange",f,!0),a(()=>{setTimeout(()=>{d=u()})})}return{get firstHiddenTime(){return d},onHidden(e){l.add(e)}}},g=(e,t=-1,n,a=0,r,o,d)=>{const l=s(),u=l?.navigationId||0;let f="navigate";return n?f=n:i()>=0?f="back-forward-cache":l&&(document.prerendering||c()>0?f="prerender":document.wasDiscarded?f="restore":l.type&&(f=l.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:f,navigationId:a||u,navigationInteractionId:r,navigationURL:o||l?.name,navigationStartTime:d||0}},v=/* @__PURE__ */new WeakMap;function p(e,t){let n=v.get(t);return n||(n=/* @__PURE__ */new WeakMap,v.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}var m,y=class{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},T=(e,t,n={})=>{try{const i=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(i.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const n=e.getEntries();i.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(const t of i)e.observe({type:t,buffered:!0,...n});return e}}catch{}},w=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,I=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},b=e=>{let t=!1;return()=>{t||(e(),t=!0)}},C=class{l},E=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},L=[1800,3e3],P=(e,t={})=>{const n=w(t);E(()=>{const s=p(t,C),d=h();let l,u=g("FCP");const f=T(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(f.disconnect(),t.startTime<d.firstHiddenTime&&(u.value=Math.max(t.startTime-c(),0),u.entries.push(t),u.navigationId=t.navigationId||u.navigationId,l(!0)))});f&&(l=r(e,u,L,t.reportAllChanges),a(n=>{u=g("FCP",-1,"back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),l=r(e,u,L,t.reportAllChanges),o(()=>{u.value=performance.now()-n.timeStamp,l(!0)})})),n&&T(["soft-navigation"],n=>{n.forEach(n=>{s.l&&n.navigationId&&I(s.l,n);const i=Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0);u=g("FCP",i,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),l=r(e,u,L,t.reportAllChanges),l(!0)})},t)})},A=[.1,.25],k=0,S=1/0,z=0,M=e=>{for(const t of e)t.interactionId&&(S=Math.min(S,t.interactionId),z=Math.max(z,t.interactionId),k=z?(z-S)/7+1:0)},$=()=>m?k:performance.interactionCount??0,_=class{u=0;v=[];m=/* @__PURE__ */new Map;p;T;_(){return $()-this.u}M(){this.u=$(),this.v.length=0,this.m.clear()}L(e){const t=this._(),n=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==n||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[n]:{P:8,id:-1,entries:[]}}h(e){if(this.p?.(e),!e.interactionId)return;const t=this.v.at(-1);let n=this.m.get(e.interactionId);if(n||this.v.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}this.T?.(n)}}},F=e=>{const t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const a=b(e);let r=-1;const o=()=>{i(r),a()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=n(()=>{removeEventListener("visibilitychange",o,{capture:!0}),a()},{timeout:t})}},Z=[200,500],R=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=h();E(()=>{"interactionCount"in performance||m||(m=T(["event"],M,{durationThreshold:0}));let o,s=g("INP");const c=p(t,_),d=(n,i,a,d,l)=>{c.M(),s=g("INP",-1,n,i,a,d,l),o=r(e,s,Z,t.reportAllChanges)},l=()=>{const e=c.L(s.navigationType);e&&e.P!==s.value&&(s.value=e.P,s.entries=e.entries,o())},u=e=>{l(),o(!0),d("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},f=(e,t=!1)=>{F(()=>{for(const t of e)"soft-navigation"!==t.entryType?c.h(t):u(t);l(),t&&o(!0)})},h=["event","first-input"];w(t)&&h.push("soft-navigation");const v=T(h,f,{...t,durationThreshold:t.durationThreshold??40});o=r(e,s,Z,t.reportAllChanges),v&&(n.onHidden(()=>{f(v.takeRecords(),!0)}),a(()=>{d("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,i())}))})},j=class{p;l;h(e){this.p?.(e)}},x=[2500,4e3],B=[800,1800],N=e=>{document.prerendering?E(()=>N(e)):"complete"!==document.readyState?addEventListener("load",()=>N(e),!0):setTimeout(e)};var U=/^[A-Za-z0-9/_:.\-[\]{}*@~]+$/,O=/^[A-Za-z_$][A-Za-z0-9_$.]*$/,H=/^[A-Za-z0-9][A-Za-z0-9.+_-]*$/;var q=class{constructor(e){this.head=e}head;events=[];waiting=/* @__PURE__ */new Map;seen=/* @__PURE__ */new Set;get size(){return this.events.length}addVital(e){this.events.push(e)}addError(e){const t=function(e){return e.frames.length?`${e.name}|${e.frames.join("|")}`:`${e.name}|${e.message.replace(/\d/g,"0")}`}(e),n=this.waiting.get(t);return n?(n.count=Math.min(1e3,n.count+e.count),!0):!(this.seen.has(t)||this.seen.size>=20)&&(this.seen.add(t),this.waiting.set(t,e),this.events.push(e),!0)}drain(){const e=this.events;this.events=[],this.waiting.clear();const t=[],n=JSON.stringify({...this.head,events:[]}).length;let i=[],a=n;for(const r of e){const e=JSON.stringify(r).length+1;n+e>30720||((50===i.length||a+e>30720)&&(t.push({...this.head,events:i}),i=[],a=n),i.push(r),a+=e)}return i.length&&t.push({...this.head,events:i}),t}},J=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,K=/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*)?|\b[Bb]earer\s+[A-Za-z0-9._~+/=-]{8,}/g,V=/\b[a-z][a-z0-9+.-]*:\/\/\S+/gi,W=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,D=/\d{4,}/g,G=/(^|[/:])(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,})(?=$|[/:])/gi,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("//")&&U.test(t)?t:"unknown"}var ie={flush(){},reportError(){},stop(){}},ae=null,re=/* @__PURE__ */new Set(["LCP","FCP","TTFB"]);function oe(e,t,n){const i=function(e){if(e.anonymous)return{credentials:"omit",headers:{"Content-Type":"application/json"}};const t=e.getAccessToken();return t?{credentials:"same-origin",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}}:null}(t);if(!i)return;const a=t.anonymous?"/api/storefront-analytics/web-vitals/":"/api/client-telemetry/web-batches/";n(t.endpoint??a,{...i,method:"POST",keepalive:!0,body:JSON.stringify(e)}).catch(e=>{console.debug("[efficient-shell] client telemetry batch dropped:",e)})}function se(e){((e,t={})=>{let n=!1;const s=w(t);E(()=>{let d,l=h(),u=g("LCP");const f=p(t,j),v=(i,a,o,s,c)=>{u=g("LCP",-1,i,a,o,s,c),d=r(e,u,x,t.reportAllChanges),n=!1,"soft-navigation"===i&&(l=h(!0))},m=e=>{f.l&&e.navigationId&&I(f.l,e),n||d(!0),v("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const t=e.getLargestInteractionContentfulPaint?.();t&&y([t])},y=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){m(t);continue}let e=0,n=[],i=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-c(),0),f.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){const a=t;if(!u.navigationId)continue;if("interactionId"in a&&a.interactionId!=u.navigationInteractionId)continue;i=a.largestContentfulPaint?.renderTime||0,e=Math.max(i-t.startTime,0),a.largestContentfulPaint&&(f.h(a.largestContentfulPaint),n=[a.largestContentfulPaint])}i<l.firstHiddenTime&&(u.value=e,u.entries=n,d())}},w=["largest-contentful-paint"];s&&w.push("interaction-contentful-paint","soft-navigation");const b=T(w,y);if(b){d=r(e,u,x,t.reportAllChanges);const c=["keydown","click","visibilitychange"],l=e=>{if(e.isTrusted&&!n){const e=u.id;F(()=>{if(!n){if(!s){b.disconnect();for(const e of c)removeEventListener(e,l,{capture:!0})}e===u.id&&(n=!0,d(!0))}})}};for(const e of c)addEventListener(e,l,{capture:!0});a(a=>{v("back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),d=r(e,u,x,t.reportAllChanges),o(()=>{u.value=performance.now()-a.timeStamp,n=!0,d(!0)})})}})})(e),R(e),((e,t={})=>{const n=h();P(b(()=>{let s,c=g("CLS",0);const d=p(t,y),l=(n,i,a,o,l)=>{c=g("CLS",0,n,i,a,o,l),d.i=0,s=r(e,c,A,t.reportAllChanges)},u=(e=!1)=>{d.i>c.value&&(c.value=d.i,c.entries=d.o),s(e)},f=e=>{u(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},h=e=>{for(const t of e)"soft-navigation"!==t.entryType?d.h(t):f(t);u()},v=["layout-shift"];w(t)&&v.push("soft-navigation");const m=T(v,h);m&&(s=r(e,c,A,t.reportAllChanges),n.onHidden(()=>{h(m.takeRecords()),s(!0)}),a(()=>{l("back-forward-cache",c.navigationId,c.navigationInteractionId,c.navigationURL,i()),o(s)}),setTimeout(s))}))})(e),P(e),((e,t={})=>{const n=w(t);let o=g("TTFB"),d=r(e,o,B,t.reportAllChanges);N(()=>{const l=s();if(l){const s=l.responseStart;o.value=Math.max(s-c(),0),o.entries=[l],d(!0),a(()=>{o=g("TTFB",0,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,i()),d=r(e,o,B,t.reportAllChanges),d(!0)}),n&&T(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&(o=g("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),o.entries=[n],d=r(e,o,B,t.reportAllChanges),d(!0))})},t)}})})(e)}function ce(n){if(ae?.stop(),ae=null,!1===n.enabled||"undefined"==typeof window||"undefined"==typeof document)return ie;if(!function(e){const t="string"==typeof e.app&&H.test(e.app),n="string"==typeof e.release&&H.test(e.release);return t&&n||console.warn("[efficient-shell] client telemetry not started: `app` and `release` must be version-like strings."),t&&n}(n))return ie;const i=function(e){const t=e.vitalsSampleRate??1;return t>0&&(t>=1||(e.random??Math.random)()<t)}(n);if(n.anonymous&&!i)return ie;const a=n.fetch??window.fetch.bind(window),r=new q({app:n.app,release:n.release,shell_version:H.test(t)?t:""}),o=ne(n.routeKey()),s=function(e=("undefined"==typeof window?void 0:window)){if(!e)return"desktop";const t="function"==typeof e.matchMedia&&e.matchMedia("(pointer: coarse)").matches,n=e.innerWidth;return n<600?"mobile":t&&n<1280?"tablet":"desktop"}(window);let c=!1;const d=()=>{for(const e of r.drain())oe(e,n,a)},l=e=>{c||n.anonymous||(r.addError(e),r.size>=50&&d())},u=(e,t)=>{return{type:"error",source:t,name:te(e),message:(a=e,i=a instanceof Error?a.message:"string"==typeof a?a:a&&"object"==typeof a&&"string"==typeof a.message?a.message:"",i.slice(0,640).replace(J,"[redacted]").replace(K,"[redacted]").replace(V,"[url]").replace(W,"[id]").replace(D,"[n]").replace(/\s+/g," ").trim().slice(0,160)),frames:ee(e instanceof Error?e.stack:void 0),route:ne(n.routeKey()),count:1};var i,a};i&&(n.observeVitals??se)(e=>{c||(r.addVital(function(e,t,n,i){return{type:"vital",name:e.name,value:e.value,route:re.has(e.name)?t:n(),navigation:e.navigationType??"navigate",device:i}}(e,o,()=>ne(n.routeKey()),s)),r.size>=50&&d())});const f=n.anonymous?()=>{}:function(t,n){const i=e=>{const{error:i,message:a,filename:r,lineno:o,colno:s}=e;if(null!=i)return void t(n(i,"onerror"));const c=r?ee(`at ${r}:${o??0}:${s??0}`):[];t({...n(a??"","onerror"),frames:c})},a=e=>t(n(e.reason,"unhandledrejection"));window.addEventListener("error",i),window.addEventListener("unhandledrejection",a);const r=e(e=>t(n(e,"boundary")));return()=>{window.removeEventListener("error",i),window.removeEventListener("unhandledrejection",a),r()}}(l,u),h=()=>{"hidden"===document.visibilityState&&d()};document.addEventListener("visibilitychange",h),window.addEventListener("pagehide",d);const g=window.setInterval(d,n.flushIntervalMs??6e4),v={flush:d,reportError:e=>l(u(e,"boundary")),stop(){c||(d(),c=!0,f(),document.removeEventListener("visibilitychange",h),window.removeEventListener("pagehide",d),window.clearInterval(g),ae===v&&(ae=null))}};return ae=v,v}export{ce as startClientTelemetry};