efficient-shell 8.24.0 → 8.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -1
- package/dist/{Browser-NYGNSRS3.js → Browser-5DL5WHEM.js} +13 -13
- package/dist/Calculator-WW7WTG43.js +29 -0
- package/dist/{CurrencyConverter-ET6QOMC6.js → CurrencyConverter-XBC732QI.js} +5 -5
- package/dist/{Documents-76QU7XPF.js → Documents-7MFHD73Z.js} +11 -11
- package/dist/{Files-WBRBACPC.js → Files-4DKRC3S2.js} +34 -34
- package/dist/{Notepad-G4EQGYQB.js → Notepad-BCK4LMG2.js} +9 -9
- package/dist/{PomodoroTimer-R3SOUADN.js → PomodoroTimer-KH4PYCYQ.js} +6 -6
- package/dist/{Preview-UMQ6DJIP.js → Preview-FP6XMPQR.js} +18 -18
- package/dist/{Sidebar-YB4OVUG5.js → Sidebar-3HM646LN.js} +34 -34
- package/dist/{Spreadsheet-EFCVA5SM.js → Spreadsheet-FSDGQCKT.js} +13 -13
- package/dist/{Stock-T2VMQMOG.js → Stock-M4EEWA57.js} +3 -3
- package/dist/{Weather-UKIN7EGC.js → Weather-WLAS7FBY.js} +19 -19
- package/dist/{WorldClock-GWQIZZML.js → WorldClock-WRD7DV2S.js} +4 -4
- package/dist/ai/index.d.ts +61 -3
- package/dist/ai/index.js +37 -37
- package/dist/ai.css +1 -1
- package/dist/apps/index.d.ts +6 -2
- package/dist/apps/index.js +1 -1
- package/dist/bin/media-host-check.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/chunk-24AL3CDS.js +1 -0
- package/dist/{chunk-DISSJYKV.js → chunk-2OLSY4GE.js} +12 -12
- package/dist/{chunk-PPFMXLEX.js → chunk-2RBWQVDC.js} +8 -8
- package/dist/{chunk-TXS6JKFV.js → chunk-35YON46D.js} +1 -1
- package/dist/{chunk-VX6V3B3N.js → chunk-3H74IBFS.js} +3 -3
- package/dist/{chunk-YGZMD6TZ.js → chunk-3IYMTPGR.js} +12 -12
- package/dist/{chunk-L4EH3ZYS.js → chunk-3ZRZWOFZ.js} +3 -3
- package/dist/{chunk-MTXTJLFK.js → chunk-4SQNLU2Q.js} +1 -1
- package/dist/{chunk-B55IXYDR.js → chunk-53ROHXAV.js} +2 -2
- package/dist/{chunk-TS2Q55PK.js → chunk-6CNFVUT6.js} +1 -1
- package/dist/{chunk-QFA5COE6.js → chunk-6YH7JKRE.js} +2 -2
- package/dist/{chunk-KZEQJVBO.js → chunk-7FI6NVC7.js} +3 -3
- package/dist/{chunk-XHBQPVNG.js → chunk-BDCMFW5N.js} +1 -1
- package/dist/{chunk-NHCRQ7SW.js → chunk-BGLKEWVR.js} +1 -1
- package/dist/chunk-CUZQVBPC.js +1 -0
- package/dist/chunk-DJCC3WBR.js +14 -0
- package/dist/chunk-DPDA3AJL.js +1 -0
- package/dist/{chunk-ZF3QKPTL.js → chunk-E6ZXYTTQ.js} +1 -1
- package/dist/chunk-EMXR74QM.js +7 -0
- package/dist/{chunk-GWIPZKZJ.js → chunk-ETNNJUAX.js} +3 -3
- package/dist/{chunk-WJRBDHXD.js → chunk-F4GLNQIX.js} +1 -1
- package/dist/{chunk-LLLAIPFX.js → chunk-GECH6THP.js} +1 -1
- package/dist/chunk-HJH4WIBC.js +19 -0
- package/dist/{chunk-ATX4N3L4.js → chunk-I62MCTYI.js} +4 -4
- package/dist/{chunk-ZEKM6HAA.js → chunk-M2AIC7IK.js} +2 -2
- package/dist/{chunk-RUHFXBDS.js → chunk-MXVJHVVI.js} +5 -5
- package/dist/{chunk-PJCVNFWM.js → chunk-O6JX6RDX.js} +7 -7
- package/dist/{chunk-X7XJBK2E.js → chunk-OVVXSAGE.js} +4 -4
- package/dist/{chunk-QZXJHRFI.js → chunk-Q4TGK2K6.js} +6 -6
- package/dist/{chunk-JXZIBQ4V.js → chunk-REOSJZED.js} +24 -24
- package/dist/chunk-S6OB6HJB.js +1 -0
- package/dist/chunk-U6BEF6GQ.js +5 -0
- package/dist/chunk-V3UIAX5G.js +21 -0
- package/dist/{chunk-OS4CR7EE.js → chunk-V4KQUOUP.js} +4 -4
- package/dist/{chunk-KPTC2JPT.js → chunk-VEO34YZK.js} +1 -1
- package/dist/{chunk-UX6HNRFV.js → chunk-VP3CMJTT.js} +7 -7
- package/dist/{chunk-S4DCWKIY.js → chunk-WPTG7ZC5.js} +51 -51
- package/dist/{chunk-AX7KPMDV.js → chunk-WSODT2L5.js} +2 -2
- package/dist/chunk-WZNGOA4Z.js +1 -0
- package/dist/chunk-Z37R2OCE.js +10 -0
- package/dist/{chunk-NFR4QZL2.js → chunk-ZZNOQQWE.js} +4 -4
- package/dist/data/ListLoadError.js +1 -1
- package/dist/format/index.d.ts +3 -0
- package/dist/format/index.js +1 -1
- package/dist/forms/BorderInput.js +1 -1
- package/dist/forms/BrandAssetEditor.js +1 -1
- package/dist/forms/ColorPicker.js +1 -1
- package/dist/forms/ComposerAttachments.js +1 -1
- package/dist/forms/CornersInput.js +1 -1
- package/dist/forms/DisplayChips.js +1 -1
- package/dist/forms/IconPicker.js +1 -1
- package/dist/forms/InputNumber.js +1 -1
- package/dist/forms/LinkPicker.js +1 -1
- package/dist/forms/MediaLibrary.js +1 -1
- package/dist/forms/MediaUploadField.js +1 -1
- package/dist/forms/MediaUploadGrid.js +1 -1
- package/dist/forms/MediaUsedInList.js +1 -1
- package/dist/forms/PositionInput.js +1 -1
- package/dist/forms/Select.d.ts +16 -1
- package/dist/forms/Select.js +1 -1
- package/dist/forms/SidesInput.js +1 -1
- package/dist/forms/Slider.js +1 -1
- package/dist/forms/Snippet.js +1 -1
- package/dist/forms/SplitButton.js +1 -1
- package/dist/forms/TextToolbar.js +1 -1
- package/dist/forms/WidthsBar.js +1 -1
- package/dist/forms/color.d.ts +35 -1
- package/dist/forms/color.js +1 -1
- package/dist/hooks/useTheme.js +1 -1
- package/dist/icons/efficient-glyphs.js +1 -1
- package/dist/icons/efficient-looks.js +1 -1
- package/dist/icons/efficient.js +1 -1
- package/dist/icons/index.js +1 -1
- package/dist/icons/looks/map.js +1 -1
- package/dist/icons/sets.js +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +241 -241
- package/dist/map/index.js +1 -1
- package/dist/map-site.css +43 -0
- package/dist/page-tabs/index.js +5 -5
- package/dist/shell/AppUpdateBanner.js +1 -1
- package/dist/shell/ContextMenu.js +1 -1
- package/dist/shell/DropdownMenu.js +1 -1
- package/dist/shell/EditableGrid.js +1 -1
- package/dist/shell/HelpCenter.js +1 -1
- package/dist/shell/ImageLightbox.js +1 -1
- package/dist/shell/LanguageSelect.js +1 -1
- package/dist/shell/Markdown.d.ts +26 -2
- package/dist/shell/Markdown.js +1 -1
- package/dist/shell/PopupMenu.js +1 -1
- package/dist/shell/SearchableSelect.js +1 -1
- package/dist/shell/SettingReset.js +1 -1
- package/dist/shell/SettingRow.js +1 -1
- package/dist/shell/TopNav.d.ts +3 -1
- package/dist/shell/TopNav.js +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/templates/ChatTemplate.js +1 -1
- package/dist/templates/CheckoutTemplate.js +1 -1
- package/dist/templates/DataTablePage.js +1 -1
- package/dist/templates/EmailTemplate.js +1 -1
- package/dist/templates/FormLayoutPage.js +1 -1
- package/dist/ui/index.d.ts +4 -2
- package/dist/ui/index.js +1 -1
- package/dist/utils/escapeHtml.d.ts +14 -0
- package/dist/utils/escapeHtml.js +1 -0
- package/dist/utils/slugify.d.ts +16 -0
- package/dist/utils/slugify.js +1 -0
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/Calculator-EN6VDDRG.js +0 -29
- package/dist/chunk-4DAN4Q6P.js +0 -21
- package/dist/chunk-4LXH6DCN.js +0 -1
- package/dist/chunk-6WSTN5A3.js +0 -14
- package/dist/chunk-CUT7PAXL.js +0 -7
- package/dist/chunk-H245LLX4.js +0 -1
- package/dist/chunk-KBGC53FI.js +0 -1
- package/dist/chunk-NT26CWMZ.js +0 -5
- package/dist/chunk-RNJ3MNO5.js +0 -1
- package/dist/chunk-VTVOQS5L.js +0 -20
- package/dist/chunk-WDXJWC3Y.js +0 -7
- /package/dist/{chunk-A5ALFLWZ.js → chunk-2HDDCXTW.js} +0 -0
- /package/dist/{chunk-BR22X7E5.js → chunk-G6DKCCWH.js} +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import{CountBadge as e}from"./chunk-MAOJENIB.js";import{
|
|
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(
|
|
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(
|
|
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(
|
|
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,11 +1,11 @@
|
|
|
1
|
-
import{MediaUploadField as e}from"./chunk-
|
|
2
|
-
return n("section",{"aria-label":
|
|
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
|
|
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&&!
|
|
7
|
-
/* @__PURE__ */c("h3",{className:"text-sm font-semibold text-gray-900",children:
|
|
8
|
-
/* @__PURE__ */c("div",{className:"mt-3 grid gap-3",children:w.map(e=>{const a=/* @__PURE__ */c(r,{src:G,alt:
|
|
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,29 +1,29 @@
|
|
|
1
|
-
import{Tree as e,TreeRow as l,TreeGroup as n}from"./chunk-G433MKIN.js";import{MarqueeBox as a}from"./chunk-IC72MGON.js";import{ImageLightbox as r}from"./chunk-RGBX3EVC.js";import{DescriptionList as i}from"./chunk-SACUSHVN.js";import{Drawer as t}from"./chunk-YW2DH6YQ.js";import{EmptyState as o}from"./chunk-KDZUWQEG.js";import{Breadcrumbs as d}from"./chunk-WJ3XSJ6B.js";import{
|
|
2
|
-
return W(
|
|
3
|
-
return
|
|
4
|
-
/* @__PURE__ */W(l,{label:
|
|
5
|
-
return
|
|
6
|
-
/* @__PURE__ */W(l,{label:e.name,level:a,icon:r&&i?
|
|
7
|
-
/* @__PURE__ */W(l,{label:
|
|
8
|
-
/* @__PURE__ */W(l,{label:Le.allFiles,level:1,icon:
|
|
1
|
+
import{Tree as e,TreeRow as l,TreeGroup as n}from"./chunk-G433MKIN.js";import{MarqueeBox as a}from"./chunk-IC72MGON.js";import{ImageLightbox as r}from"./chunk-RGBX3EVC.js";import{DescriptionList as i}from"./chunk-SACUSHVN.js";import{Drawer as t}from"./chunk-YW2DH6YQ.js";import{EmptyState as o}from"./chunk-KDZUWQEG.js";import{Breadcrumbs as d}from"./chunk-WJ3XSJ6B.js";import{ROOT_KEY as s,mediaLibraryMenu as c}from"./chunk-7CFH6Y4T.js";import{useMediaMoveItems as m}from"./chunk-DFDDRKIJ.js";import{copyToClipboard as u}from"./chunk-5PY4H4ZJ.js";import{DropdownMenu as h}from"./chunk-EMXR74QM.js";import{MediaUploadGrid as p}from"./chunk-V4KQUOUP.js";import{MediaUsedInList as f}from"./chunk-EZGY6CFN.js";import{NativeSelect as g}from"./chunk-HJH4WIBC.js";import{Input_default as v}from"./chunk-UNEJ2ABD.js";import{Segmented as y}from"./chunk-N6DTTOB6.js";import{useFileIntake as k,FileIntakeAlert as b}from"./chunk-YDYDR72S.js";import{useGridSelection as w}from"./chunk-VLKDWKVR.js";import{useMarquee as x}from"./chunk-OLFYNMTD.js";import{Checkbox_default as C}from"./chunk-CGZBDI6C.js";import{useContextMenu as N,ContextMenu as I}from"./chunk-WSODT2L5.js";import{Banner as D}from"./chunk-WTY3SXO7.js";import{IconButton_default as S}from"./chunk-4CANQ3B3.js";import{ColoredBadge as j}from"./chunk-XWLWG4HS.js";import{Button_default as z}from"./chunk-4IU5BSVE.js";import{buttonClasses as T}from"./chunk-K7U4RWXJ.js";import{Icon as F}from"./chunk-KIBL6M3T.js";import{Tooltip as O}from"./chunk-22S6LG6D.js";import{usePlotWidth as E}from"./chunk-MAFUXCPZ.js";import{useShellStrings as P}from"./chunk-E6UCGCOC.js";import{useRef as L,useMemo as M,useCallback as A,useState as U,useEffect as B}from"react";import{jsxs as K,Fragment as R,jsx as W}from"react/jsx-runtime";var G="application/x-efficient-media-files",H="application/x-efficient-media-folder",J={type:"all",use:"any",sort:"newest"},Y={lock:/* @__PURE__ */W(F,{name:"lock","aria-hidden":"true",className:"h-4 w-4"}),folder:/* @__PURE__ */W(F,{name:"folder","aria-hidden":"true",className:"h-4 w-4"}),folderOpen:/* @__PURE__ */W(F,{name:"folder-open","aria-hidden":"true",className:"h-4 w-4"}),folderPlus:/* @__PURE__ */W(F,{name:"folder-plus","aria-hidden":"true",className:"h-4 w-4"}),trash:/* @__PURE__ */W(F,{name:"trash","aria-hidden":"true",className:"h-4 w-4"}),upload:/* @__PURE__ */W(F,{name:"upload","aria-hidden":"true",className:"h-4 w-4"}),search:/* @__PURE__ */W(F,{name:"search","aria-hidden":"true",className:"h-4 w-4"}),grid:/* @__PURE__ */W(F,{name:"grid","aria-hidden":"true",className:"h-4 w-4"}),list:/* @__PURE__ */W(F,{name:"list","aria-hidden":"true",className:"h-4 w-4"}),more:/* @__PURE__ */W(F,{name:"more","aria-hidden":"true",className:"h-4 w-4"}),copy:/* @__PURE__ */W(F,{name:"copy","aria-hidden":"true",className:"h-4 w-4"}),edit:/* @__PURE__ */W(F,{name:"edit","aria-hidden":"true",className:"h-4 w-4"}),swap:/* @__PURE__ */W(F,{name:"swap","aria-hidden":"true",className:"h-4 w-4"}),crop:/* @__PURE__ */W(F,{name:"crop","aria-hidden":"true",className:"h-4 w-4"}),external:/* @__PURE__ */W(F,{name:"external","aria-hidden":"true",className:"h-4 w-4"}),undo:/* @__PURE__ */W(F,{name:"undo","aria-hidden":"true",className:"h-4 w-4"})},V={link:/* @__PURE__ */W(F,{name:"link","aria-hidden":"true",className:"h-3 w-3"}),email:/* @__PURE__ */W(F,{name:"email","aria-hidden":"true",className:"h-3 w-3"}),lock:/* @__PURE__ */W(F,{name:"lock","aria-hidden":"true",className:"h-3 w-3"}),clock:/* @__PURE__ */W(F,{name:"clock","aria-hidden":"true",className:"h-3 w-3"})};function X({value:e,label:l,onDone:n}){const[a,r]=U(e),i=L(!1),t=e=>{i.current||(i.current=!0,n(e))};/* @__PURE__ */
|
|
2
|
+
return W(v,{size:"sm",autoFocus:!0,"aria-label":l,value:a,onChange:e=>r(e.target.value),onFocus:e=>e.currentTarget.select(),onKeyDown:l=>{l.stopPropagation(),"Enter"===l.key?(l.preventDefault(),t(a.trim()||e)):"Escape"===l.key&&(l.preventDefault(),t(null))},onBlur:()=>t(a.trim()||e),onClick:e=>e.stopPropagation()})}function $(F){const{mode:$="manage",layout:Q="auto",location:Z,onLocationChange:q,folders:_,products:ee,allFilesCount:le,trashCount:ne,files:ae,query:re,onQueryChange:ie,filters:te=J,onFiltersChange:oe,extraFilters:de,view:se="grid",onViewChange:ce,selectedIds:me,onSelectionChange:ue,usedIn:he,denied:pe={},accept:fe="image/*,video/*",maxSizeBytes:ge,busy:ve,progress:ye,onUpload:ke,onNewFolder:be,onRename:we,onMove:xe,onTrash:Ce,onDeleteFolder:Ne,onRestore:Ie,onDeleteForever:De,onEmptyTrash:Se,onReplace:je,onCropEdit:ze,onOpenInDesign:Te,onChoose:Fe,onCancel:Oe,pickNote:Ee,className:Pe=""}=F,Le=P().mediaLibrary,Me=P().media,Ae="pick"===$,Ue=!Ae,Be=L(null),Ke=E(Be,"phone"===Q?343:1200),Re="phone"===Q||"auto"===Q&&Ke<640,We=M(()=>function(e=[]){const l=/* @__PURE__ */new Map,n=(e,a)=>{for(const r of e){const e=[...a,r];l.set(r.id,{node:r,path:e}),r.children&&n(r.children,e)}};return n(e,[]),l}(ee),[ee]),Ge=M(()=>new Map(_.map(e=>[e.id,e])),[_]),He=M(()=>{const e=/* @__PURE__ */new Map;for(const l of _){const n=l.parentId&&Ge.has(l.parentId)?l.parentId:null;e.set(n,[...e.get(n)??[],l])}return e},[_,Ge]),Je=A(e=>{const l=[];for(let n=e?Ge.get(e):void 0;n&&(l.unshift(n),!(l.length>_.length));n=n.parentId?Ge.get(n.parentId):void 0);return l},[Ge,_.length]),Ye=A((e,l)=>Je(e).some(e=>e.id===l),[Je]),[Ve,Xe]=U(()=>/* @__PURE__ */new Set(["@files"])),$e=e=>Xe(l=>{const n=new Set(l);return n.has(e)?n.delete(e):n.add(e),n}),Qe=A(e=>{Xe(l=>e.every(e=>l.has(e))?l:/* @__PURE__ */new Set([...l,...e]))},[]),Ze="files"===(qe=Z).place?`files:${qe.folderId??""}`:"products"===qe.place?`products:${qe.nodeId??""}`:"trash";var qe;B(()=>{if("files"===Z.place)Qe(["@files",...Je(Z.folderId).slice(0,-1).map(e=>e.id)]);else if("products"===Z.place){const e=Z.nodeId?We.get(Z.nodeId)?.path??[]:[];Qe(["@products",...e.slice(0,-1).map(e=>`p:${e.id}`)])}},[Ze]);const _e="products"===Z.place,el="trash"===Z.place,ll="files"===Z.place,nl=ll?Z.folderId:null,al=_e&&Z.nodeId?We.get(Z.nodeId)?.path[0]:void 0,rl=e=>e?.sharedFrom?`${Le.readOnly} ${Le.editedAtHq(e.sharedFrom)}`:Le.readOnly,il=M(()=>ae.map(e=>e.id),[ae]),tl=M(()=>new Map(ae.map(e=>[e.id,e])),[ae]),ol=w(il),dl=M(()=>il.filter(e=>ol.selected.has(e)),[il,ol.selected]),sl=1===dl.length?tl.get(dl[0]):void 0,cl=L(!0);B(()=>{cl.current?cl.current=!1:ol.clear()},[Ze]);const ml=me?.join("\0");B(()=>{me&&ol.setSelection(me)},[ml]);const ul=L(ml??""),hl=dl.join("\0");B(()=>{ul.current!==hl&&(ul.current=hl,ue?.(dl))},[hl]);const pl=(e,l={})=>{Ae?ol.select(e):ol.select(e,{ctrl:!(!l.ctrlKey&&!l.metaKey),shift:!!l.shiftKey})},[fl,gl]=U(null),vl=e=>{const l=fl;if(gl(null),!l||null==e)return;e!==("folder"===l.kind?Ge.get(l.id)?.name:tl.get(l.id)?.name)&&we?.(l,e)},yl=async e=>{if(!be)return;const l=await be(e);Qe(["@files",...e?[e]:[]]),"string"==typeof l&&gl({kind:"folder",id:l})},kl=A(e=>{const l=[],n=l=>{if("files"===e.kind)return l===nl&&ll?Le.alreadyHere:void 0;const n=Ge.get(e.id);return l===e.id||l&&Ye(l,e.id)?Le.notIntoItself:(n?.parentId??null)===l?Le.folderAlreadyHere:void 0};l.push({key:s,label:Le.allFiles,disabledReason:n(null)});const a=(e,r)=>{for(const i of He.get(e)??[])l.push({key:i.id,label:i.name,depth:r,disabledReason:n(i.id)}),a(i.id,r+1)};return a(null,1),l},[He,Ge,ll,Ye,nl,Le]),bl=A(e=>{const l=new Set(e.map(e=>tl.get(e)?.kind??"image"));return 1===l.size?[...l][0]:"file"},[tl]),[wl,xl]=U(null),Cl={words:Le,media:Me,denied:pe,moveTargets:kl,kindOf:bl,urlOf:e=>tl.get(e)?.url,newSubfolder:be&&Ue?e=>{yl(e)}:void 0,rename:we&&Ue?e=>{"file"!==e.kind||ol.isSelected(e.id)||ol.select(e.id),gl(e)}:void 0,move:xe&&Ue?xe:void 0,trash:Ce&&Ue?Ce:void 0,deleteFolder:Ne&&Ue?Ne:void 0,folderNotEmpty:e=>!!Ge.get(e)?.notEmpty,replace:je&&Ue?je:void 0,copyUrl:e=>{const l=tl.get(e)?.url;l&&u(Le.urlLabel,l)},openInDesign:Te,restore:Ie,deleteForever:De},Nl=e=>c(e,Cl),Il=N(),Dl=(e,l)=>{Ae||(ol.isSelected(e)||ol.select(e),Il.open(l,(e=>{const l=ol.isSelected(e)?dl:[e];return _e?{kind:"render",id:e}:el?{kind:"trashed",ids:l}:{kind:"files",ids:l}})(e)))},[Sl,jl]=U(null),[zl,Tl]=U(null),[Fl,Ol]=U(null);B(()=>{if(!zl&&!Sl)return;const e=()=>{Tl(null),jl(null)};return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[zl,Sl]);const El=(e,l)=>Array.from(e.dataTransfer?.types??[]).includes(l),Pl=(e,l)=>!(!xe||pe.move||Ae)&&(!!El(e,G)||!(!El(e,H)||!Fl)&&(l!==Fl&&!(l&&Ye(l,Fl)))),Ll=(e,l)=>({onDragEnter:n=>{Pl(n,l)&&(n.preventDefault(),jl(e))},onDragOver:n=>{Pl(n,l)&&(n.preventDefault(),n.dataTransfer.dropEffect="move",Sl!==e&&jl(e))},onDragLeave:l=>{const n=l.relatedTarget;n&&l.currentTarget.contains(n)||jl(l=>l===e?null:l)},onDrop:e=>{if(Pl(e,l))if(e.preventDefault(),jl(null),El(e,G)){let n;try{n=JSON.parse(e.dataTransfer.getData(G))}catch{n=null}Array.isArray(n)&&n.length&&xe({kind:"files",ids:n.map(String)},l)}else Fl&&(xe({kind:"folder",id:Fl},l),Ol(null))}}),Ml=e=>{const l=e=>El(e,G)||El(e,H)||El(e,"Files");return{onDragEnter:n=>{l(n)&&Tl(e)},onDragOver:n=>{l(n)&&zl!==e&&Tl(e)},onDragLeave:l=>{const n=l.relatedTarget;n&&l.currentTarget.contains(n)||Tl(l=>l===e?null:l)}}},Al=(e,l,n)=>/* @__PURE__ */W(O,{side:"right",content:zl===e?Le.noDropProducts:rl(n),open:zl===e||!zl&&void 0,children:/* @__PURE__ */W("span",{children:l})}),Ul=e=>({onContextMenu:l=>{Il.open(l,e)}}),Bl=(e,a,r)=>e.map(e=>{const i=`p:${e.id}`,t=r??e,o=Ve.has(i),d=e.children?.length?e.children:null;/* @__PURE__ */
|
|
3
|
+
return K("div",{role:"none",className:"contents",children:[
|
|
4
|
+
/* @__PURE__ */W(l,{label:Al(i,e.name,t),level:a,icon:d&&o?Y.folderOpen:Y.folder,badge:null!=e.count?e.count:void 0,selected:_e&&Z.nodeId===e.id,expanded:d?o:void 0,onToggle:d?()=>$e(i):void 0,onSelect:()=>q({place:"products",nodeId:e.id}),rowProps:{"data-media-row":i,...Ml(i),...Ue?Ul({kind:"product-node",id:e.id}):{}}}),d&&o&&/* @__PURE__ */W(n,{children:Bl(d,a+1,t)})]},e.id)}),Kl=(e,a)=>(He.get(e)??[]).map(e=>{const r=He.get(e.id),i=Ve.has(e.id),t="folder"===fl?.kind&&fl.id===e.id,o=Nl({kind:"folder",id:e.id});/* @__PURE__ */
|
|
5
|
+
return K("div",{role:"none",className:"contents",children:[
|
|
6
|
+
/* @__PURE__ */W(l,{label:e.name,level:a,icon:r&&i?Y.folderOpen:Y.folder,badge:null!=e.count?e.count:void 0,selected:t||ll&&Z.folderId===e.id,expanded:r?i:void 0,onToggle:r?()=>$e(e.id):void 0,onSelect:()=>q({place:"files",folderId:e.id}),drop:Sl===e.id?"into":void 0,dragging:Fl===e.id,draggable:Ue&&!!xe&&!pe.move,rename:t?/* @__PURE__ */W(X,{value:e.name,label:Le.folderName,onDone:vl}):void 0,actions:Ue&&o.length?/* @__PURE__ */W(h,{align:"end","aria-label":Le.folderActions,trigger:Y.more,items:o}):void 0,rowProps:{"data-media-row":e.id,...Ll(e.id,e.id),...Ue?Ul({kind:"folder",id:e.id}):{},...Ue&&xe&&!pe.move?{draggable:!0,onDragStart:l=>{l.dataTransfer.effectAllowed="move",l.dataTransfer.setData(H,e.id),Ol(e.id)},onDragEnd:()=>{Ol(null),jl(null)}}:{}}}),r&&i&&/* @__PURE__ */W(n,{children:Kl(e.id,a+1)})]},e.id)}),Rl=Ve.has("@files"),Wl=Ve.has("@products"),Gl=/* @__PURE__ */K(e,{"aria-label":Le.folders,children:[ee&&/* @__PURE__ */K(R,{children:[
|
|
7
|
+
/* @__PURE__ */W(l,{label:Al("@products",Le.products),level:1,icon:Y.lock,badge:{label:Le.readOnlyBadge,tone:"neutral"},expanded:ee.length?Wl:void 0,onToggle:()=>$e("@products"),selected:_e&&null==Z.nodeId,onSelect:()=>q({place:"products",nodeId:null}),rowProps:{"data-media-row":"@products",...Ml("@products")}}),Wl&&ee.length>0&&/* @__PURE__ */W(n,{children:Bl(ee,2)})]}),
|
|
8
|
+
/* @__PURE__ */W(l,{label:Le.allFiles,level:1,icon:Rl?Y.folderOpen:Y.folder,badge:null!=le?le:void 0,expanded:He.get(null)?.length?Rl:void 0,onToggle:()=>$e("@files"),selected:ll&&null==Z.folderId,onSelect:()=>q({place:"files",folderId:null}),drop:"@files"===Sl?"into":void 0,rowProps:{"data-media-row":"@files",...Ll("@files",null)}}),Rl&&(He.get(null)?.length??0)>0&&/* @__PURE__ */W(n,{children:Kl(null,2)}),Ue&&/* @__PURE__ */W(l,{label:Le.trash,level:1,icon:Y.trash,badge:null!=ne?ne:void 0,selected:el,onSelect:()=>q({place:"trash"}),rowProps:{"data-media-row":"@trash"}})]}),Hl=(()=>{if(el)return[{label:Le.trash}];if(_e){const e=Z.nodeId?We.get(Z.nodeId)?.path??[]:[];return[{label:Le.products,onClick:e.length?()=>q({place:"products",nodeId:null}):void 0},...e.map((l,n)=>({label:l.name,onClick:n<e.length-1?()=>q({place:"products",nodeId:l.id}):void 0}))]}const e=Je(nl);return[{label:Le.allFiles,onClick:e.length?()=>q({place:"files",folderId:null}):void 0},...e.map((l,n)=>({label:l.name,onClick:n<e.length-1?()=>q({place:"files",folderId:l.id}):void 0}))]})(),Jl=_e?Le.readOnly:pe.upload,Yl=!!ke&&!el&&!Jl,Vl=k({accept:fe,maxSizeBytes:ge,multiple:!0,disabled:!Yl,onAccept:e=>ke?.(e,nl)}),Xl=_e?Le.noProductFolder:pe.newFolder,$l=e=>e?{"aria-disabled":!0,disabledReason:e}:{},Ql=/* @__PURE__ */K("div",{className:"flex flex-wrap items-center gap-2",children:[Ue&&be&&!el&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:Y.folderPlus,onClick:()=>{yl(nl)},...$l(Xl),children:Le.newFolder}),ke&&!el&&/* @__PURE__ */W(z,{variant:"primary",size:"sm",leftIcon:Y.upload,onClick:()=>Vl.open(),...$l(Jl),children:Le.upload}),Ue&&el&&Se&&ae.length>0&&/* @__PURE__ */W(z,{variant:"danger",size:"sm",onClick:Se,...$l(pe.deleteForever),children:Le.emptyTrash})]}),Zl=(e,l,n,a,r)=>/* @__PURE__ */W("div",{style:{width:Re?void 0:r,flex:Re?"1 1 120px":"0 0 auto",minWidth:0},children:/* @__PURE__ */W(g,{size:"sm","aria-label":e,value:l,onChange:a,options:n})},e),ql=e=>l=>oe?.({...te,[e]:l}),_l=/* @__PURE__ */K("div",{className:"flex flex-wrap items-center gap-2",children:[ie&&/* @__PURE__ */W("div",{style:{flex:"1 1 200px",minWidth:0},children:/* @__PURE__ */W(v,{size:"sm",type:"search",leftIcon:Y.search,placeholder:_e?Le.searchProducts:Le.search,"aria-label":_e?Le.searchProducts:Le.search,value:re??"",onChange:e=>ie(e.target.value)})}),oe&&Zl(Le.mediaType,te.type,[{value:"all",label:Le.allTypes},{value:"image",label:Le.images},{value:"video",label:Le.videos},{value:"svg",label:"SVG"},{value:"gif",label:"GIF"}],ql("type"),130),oe&&!_e&&!el&&Zl(Le.use,te.use,[{value:"any",label:Le.anyUse},{value:"email",label:Le.emailOnly},{value:"website",label:Le.websiteOnly},{value:"unused",label:Le.notUsed}],ql("use"),130),oe&&Ue&&Zl(Le.sort,te.sort,[{value:"newest",label:Le.newest},{value:"name",label:Le.byName},{value:"size",label:Le.bySize}],ql("sort"),110),de?.map(e=>Zl(e.label,e.value,e.options,e.onChange,120)),ce&&/* @__PURE__ */W(y,{size:"sm",label:Le.view,value:se,onChange:ce,options:[{value:"grid",label:Le.grid,icon:Y.grid},{value:"list",label:Le.list,icon:Y.list}]})]}),en=e=>{const l=[];return null!=e.trashedDaysAgo&&l.push({key:"t",label:Le.daysAgo(e.trashedDaysAgo),count:e.trashedDaysAgo,icon:V.clock,tone:"neutral"}),e.usedCount&&l.push({key:"u",label:Le.used(e.usedCount),count:e.usedCount,icon:V.link,tone:"active"}),e.email&&l.push({key:"e",label:Le.email,icon:V.email,tone:"queued"}),e.private&&l.push({key:"p",label:Le.private,icon:V.lock,tone:"neutral"}),l},ln=e=>en(e).map(e=>/* @__PURE__ */W(j,{tone:e.tone,size:"xs",children:e.label},e.key)),nn=Ue&&ll&&!!xe&&!pe.move,an=ae.map(e=>({id:e.id,url:e.thumbUrl??e.url,name:e.name,kind:e.kind,caption:e.name,badges:en(e),dragData:nn?JSON.stringify(ol.isSelected(e.id)?dl:[e.id]):void 0})),rn=Re?Math.max(72,Math.floor((Ke-24-16-1)/3)):112,tn=L(null),on=x({containerRef:tn,enabled:Ue&&!Re&&ae.length>0,selected:ol.selected,setSelection:e=>ol.setSelection(e),clearSelection:ol.clear}),dn=e=>{if(Ae){const l=tl.get(e);return void(!l||l.private||l.pickDisabledReason||Fe?.(l))}const l=il.indexOf(e);l>=0&&xl(l)},sn=ae.length?null:re?/* @__PURE__ */W(o,{variant:"dashed",title:Le.noMatches}):_e?/* @__PURE__ */W(o,{variant:"dashed",title:Le.emptyProducts,description:rl(al)}):el?/* @__PURE__ */W(o,{variant:"dashed",title:Le.trashEmpty}):!Yl||Ae?/* @__PURE__ */W(o,{variant:"dashed",title:Le.emptyFolder}):null,cn="list"===se&&ae.length>0,mn=sn??(cn?/* @__PURE__ */W("ul",{role:"listbox","aria-multiselectable":Ue||void 0,"aria-label":Le.folders,className:"flex flex-col gap-1",children:ae.map(e=>/* @__PURE__ */K("li",{role:"option","aria-selected":ol.isSelected(e.id),tabIndex:0,"data-grid-item":"","data-grid-id":e.id,onClick:l=>pl(e.id,l),onDoubleClick:()=>dn(e.id),onContextMenu:l=>Dl(e.id,l),onKeyDown:l=>{"Enter"!==l.key&&" "!==l.key||(l.preventDefault(),pl(e.id,l))},className:"flex h-12 cursor-pointer items-center gap-3 rounded-md px-2 text-sm rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)] "+(ol.isSelected(e.id)?"bg-blue-50 text-blue-700":"text-gray-700 hover:bg-gray-100"),children:[
|
|
9
9
|
/* @__PURE__ */W("img",{src:e.thumbUrl??e.url,alt:"",className:"h-10 w-10 shrink-0 rounded bg-gray-100 object-contain"}),
|
|
10
10
|
/* @__PURE__ */W("span",{className:"min-w-0 flex-1 truncate",children:e.name}),
|
|
11
|
-
/* @__PURE__ */W("span",{className:"flex shrink-0 items-center gap-1",children:ln(e)}),e.sizeLabel&&/* @__PURE__ */W("span",{className:"w-16 shrink-0 text-right text-xs text-gray-500",children:e.sizeLabel})]},e.id))}):/* @__PURE__ */W(
|
|
12
|
-
/* @__PURE__ */W(
|
|
13
|
-
/* @__PURE__ */W(z,{variant:"ghost",size:"sm",onClick:ol.clear,children:Le.clearSelection})]}):null,gn=e=>{const l=[],n=(e,n,a)=>{null!=a&&""!==a&&l.push({key:e,label:n,value:a})},a="file"===fl?.kind&&fl.id===e.id;n("name",Le.name,a?/* @__PURE__ */W(X,{value:e.name,label:Le.fileName,onDone:vl}):e.name),n("type",Le.type,e.typeLabel),n("size",Le.size,e.sizeLabel),n("resolution",Le.resolution,e.resolution),_e?(n("design",Le.design,e.design),n("finish",Le.finish,e.finish),n("angle",Le.angleLug,e.angleLug),n("owner",Le.owner,e.owner)):(n("added",Le.addedBy,e.addedBy),n("folder",Le.folder,e.folderPath)),n("used",Le.usedIn,null!=e.usedCount?Le.places(e.usedCount):void 0);const r=
|
|
14
|
-
return
|
|
11
|
+
/* @__PURE__ */W("span",{className:"flex shrink-0 items-center gap-1",children:ln(e)}),e.sizeLabel&&/* @__PURE__ */W("span",{className:"w-16 shrink-0 text-right text-xs text-gray-500",children:e.sizeLabel})]},e.id))}):/* @__PURE__ */W(p,{items:an,readOnly:!Yl||Ae,onFiles:Yl&&!Ae?e=>ke(e,nl):void 0,accept:fe,maxSizeBytes:ge,busy:ve,progress:ye,fit:"contain",thumbSize:rn,dragType:nn?G:void 0,selected:ol.selected,onItemClick:pl,onItemDoubleClick:dn,onItemContextMenu:Ue?Dl:void 0,menuOnMedia:Ue})),un=m({count:dl.length,kind:bl(dl),targets:kl({kind:"files",ids:dl}),onPick:e=>xe?.({kind:"files",ids:dl},e.key===s?null:e.key)}),hn=T({variant:"secondary",size:"sm"}),pn=/* @__PURE__ */W(h,{align:"start",triggerClassName:hn,trigger:/* @__PURE__ */K(R,{children:[Y.folder,Le.moveTo]}),items:un,disabled:!!pe.move}),fn=Ue&&dl.length>1&&!_e?/* @__PURE__ */K("div",{"data-media-bulk":"",className:"flex flex-wrap items-center gap-2 rounded-lg border border-gray-200 px-3 py-2",children:[
|
|
12
|
+
/* @__PURE__ */W(C,{checked:dl.length===ae.length,indeterminate:dl.length<ae.length,onChange:e=>e?ol.selectAll():ol.clear(),label:Le.selected(dl.length)}),/* @__PURE__ */K(R,el?{children:[Ie&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:Y.undo,onClick:()=>Ie(dl),...$l(pe.restore),children:Le.restore}),De&&/* @__PURE__ */W(z,{variant:"secondary-danger",size:"sm",onClick:()=>De(dl),...$l(pe.deleteForever),children:Le.deleteForever})]}:{children:[xe&&pn,we&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:Y.edit,disabled:!0,children:Le.rename}),Ce&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:Y.trash,onClick:()=>Ce({kind:"files",ids:dl}),...$l(pe.trash),children:Le.moveFilesToTrash(dl.length)})]}),
|
|
13
|
+
/* @__PURE__ */W(z,{variant:"ghost",size:"sm",onClick:ol.clear,children:Le.clearSelection})]}):null,gn=e=>{const l=[],n=(e,n,a)=>{null!=a&&""!==a&&l.push({key:e,label:n,value:a})},a="file"===fl?.kind&&fl.id===e.id;n("name",Le.name,a?/* @__PURE__ */W(X,{value:e.name,label:Le.fileName,onDone:vl}):e.name),n("type",Le.type,e.typeLabel),n("size",Le.size,e.sizeLabel),n("resolution",Le.resolution,e.resolution),_e?(n("design",Le.design,e.design),n("finish",Le.finish,e.finish),n("angle",Le.angleLug,e.angleLug),n("owner",Le.owner,e.owner)):(n("added",Le.addedBy,e.addedBy),n("folder",Le.folder,e.folderPath)),n("used",Le.usedIn,null!=e.usedCount?Le.places(e.usedCount):void 0);const r=c({kind:"files",ids:[e.id]},Cl).find(e=>"submenu"===e.type);/* @__PURE__ */
|
|
14
|
+
return K("div",{"data-media-details":"",className:"flex flex-col gap-3",children:[
|
|
15
15
|
/* @__PURE__ */W("img",{src:e.url,alt:e.name,className:"aspect-square w-full rounded-lg bg-gray-100 object-contain"}),_e&&/* @__PURE__ */W(D,{tone:"neutral",title:Le.readOnlyBadge,children:rl(al)}),
|
|
16
|
-
/* @__PURE__ */W(i,{size:"sm",columns:1,items:l}),!el&&/* @__PURE__ */
|
|
17
|
-
/* @__PURE__ */W("div",{style:{flex:"1 1 0",minWidth:0},children:/* @__PURE__ */W(
|
|
18
|
-
/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:
|
|
16
|
+
/* @__PURE__ */W(i,{size:"sm",columns:1,items:l}),!el&&/* @__PURE__ */K("div",{className:"flex gap-2",children:[
|
|
17
|
+
/* @__PURE__ */W("div",{style:{flex:"1 1 0",minWidth:0},children:/* @__PURE__ */W(v,{size:"sm",readOnly:!0,value:e.url,"aria-label":Le.fileUrl,onFocus:e=>e.currentTarget.select()})}),
|
|
18
|
+
/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:Y.copy,onClick:()=>Cl.copyUrl(e.id),children:Le.copyUrl})]}),ll&&Ue&&/* @__PURE__ */K("div",{className:"flex flex-wrap gap-2",children:[je&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:Y.swap,onClick:()=>je(e.id),...$l(pe.replace),children:Le.replace}),ze&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:Y.crop,onClick:()=>ze(e.id),children:Le.cropEdit}),xe&&"submenu"===r?.type&&/* @__PURE__ */W(h,{align:"start",triggerClassName:hn,trigger:/* @__PURE__ */K(R,{children:[Y.folder,Le.moveTo]}),items:r.items,disabled:!!pe.move}),we&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:Y.edit,onClick:()=>gl({kind:"file",id:e.id}),...$l(pe.rename),children:Le.rename}),Ce&&/* @__PURE__ */W(S,{"aria-label":Le.moveToTrash,size:"sm",onClick:()=>Ce({kind:"files",ids:[e.id]}),disabledReason:pe.trash,"aria-disabled":!!pe.trash||void 0,children:Y.trash})]}),el&&Ue&&/* @__PURE__ */K("div",{className:"flex flex-wrap gap-2",children:[Ie&&/* @__PURE__ */W(z,{variant:"primary",size:"sm",leftIcon:Y.undo,onClick:()=>Ie([e.id]),...$l(pe.restore),children:Le.restore}),De&&/* @__PURE__ */W(z,{variant:"danger",size:"sm",onClick:()=>De([e.id]),...$l(pe.deleteForever),children:Le.deleteForever})]}),_e&&Te&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:Y.external,onClick:()=>Te({kind:"render",id:e.id}),children:Le.openInDesign}),he&&/* @__PURE__ */W(f,{items:he})]})},vn=sl?sl.private?Le.privateNoPick:sl.pickDisabledReason:void 0,yn=Ae?/* @__PURE__ */K("div",{"data-media-picker-footer":"",className:"flex flex-wrap items-center justify-between gap-2 border-t border-gray-200 px-3 py-2",children:[
|
|
19
19
|
/* @__PURE__ */W("span",{className:"min-w-0 truncate text-sm text-gray-500",children:sl?Le.oneChosen(sl.name):Le.noneChosen}),
|
|
20
|
-
/* @__PURE__ */
|
|
21
|
-
/* @__PURE__ */W(z,{variant:"primary",size:"sm",disabled:!sl,...$l(vn),onClick:()=>{sl&&!vn&&Fe?.(sl)},children:Le.chooseImage})]})]}):null,kn=
|
|
22
|
-
/* @__PURE__ */
|
|
23
|
-
/* @__PURE__ */W(d,{items:
|
|
24
|
-
/* @__PURE__ */
|
|
25
|
-
/* @__PURE__ */W(a,{rect:on.rect})]}),
|
|
26
|
-
/* @__PURE__ */W(
|
|
27
|
-
return
|
|
20
|
+
/* @__PURE__ */K("div",{className:"flex gap-2",children:[Oe&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",onClick:Oe,children:Le.cancel}),
|
|
21
|
+
/* @__PURE__ */W(z,{variant:"primary",size:"sm",disabled:!sl,...$l(vn),onClick:()=>{sl&&!vn&&Fe?.(sl)},children:Le.chooseImage})]})]}):null,kn=Ue&&!!sl,bn=/* @__PURE__ */K("div",{className:"flex min-w-0 flex-col gap-3",children:[Ee&&/* @__PURE__ */W(D,{tone:"neutral",children:Ee}),
|
|
22
|
+
/* @__PURE__ */K("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[
|
|
23
|
+
/* @__PURE__ */W(d,{items:Hl}),Ql]}),_l,fn,
|
|
24
|
+
/* @__PURE__ */K("div",{ref:tn,className:"relative",onPointerDown:on.onPointerDown,onKeyDown:e=>{Ue&&(e.ctrlKey||e.metaKey)&&"a"===e.key.toLowerCase()?(e.preventDefault(),ol.selectAll()):"Escape"===e.key&&ol.size&&ol.clear()},children:[mn,
|
|
25
|
+
/* @__PURE__ */W(a,{rect:on.rect})]}),Yl&&/* @__PURE__ */W("input",{...Vl.inputProps}),
|
|
26
|
+
/* @__PURE__ */W(b,{rejections:Vl.rejections})]});/* @__PURE__ */
|
|
27
|
+
return K("div",{ref:Be,"data-media-library":"","data-layout":Re?"phone":"wide",className:`flex h-full min-h-0 min-w-0 flex-col ${Pe}`.trim(),children:[/* @__PURE__ */K("div",Re?{className:"flex flex-col gap-3 p-3",children:[Gl,bn]}:{className:"flex min-h-0 min-w-0 flex-1",children:[
|
|
28
28
|
/* @__PURE__ */W("div",{className:"shrink-0 overflow-y-auto border-r border-gray-200 p-3",style:{width:280,"--rosh-tree-ground":"var(--surface)"},children:Gl}),
|
|
29
|
-
/* @__PURE__ */W("div",{className:"min-w-0 flex-1 overflow-y-auto p-3",children:bn}),kn&&/* @__PURE__ */W("div",{className:"shrink-0 overflow-y-auto border-l border-gray-200 p-3",style:{width:300},children:gn(sl)})]}),yn,
|
|
29
|
+
/* @__PURE__ */W("div",{className:"min-w-0 flex-1 overflow-y-auto p-3",children:bn}),kn&&/* @__PURE__ */W("div",{className:"shrink-0 overflow-y-auto border-l border-gray-200 p-3",style:{width:300},children:gn(sl)})]}),yn,Re&&/* @__PURE__ */W(t,{open:kn,onClose:ol.clear,side:"bottom",title:sl?.name,children:sl&&gn(sl)}),Il.state&&/* @__PURE__ */W(I,{...Il.props,items:Nl(Il.state.data)}),null!=wl&&ae.length>0&&/* @__PURE__ */W(r,{images:ae.map(e=>({url:e.url,caption:e.name})),startIndex:Math.min(wl,ae.length-1),onClose:()=>xl(null)})]})}export{G as MEDIA_FILES_DRAG_TYPE,H as MEDIA_FOLDER_DRAG_TYPE,$ as MediaLibrary};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t=/^(?:[0-9a-f]{3}|[0-9a-f]{6})$/i,n=7;function r(n){const r=n.trim().replace(/^#/,"");if(!t.test(r))return null;return`#${(3===r.length?[...r].map(t=>t+t).join(""):r).toLowerCase()}`}var e=t=>t.toUpperCase(),i=(t,n,r)=>Math.min(r,Math.max(n,t));function o(t){const n=r(t);if(!n)return{h:0,s:0,v:0};const e=parseInt(n.slice(1,3),16)/255,i=parseInt(n.slice(3,5),16)/255,o=parseInt(n.slice(5,7),16)/255,s=Math.max(e,i,o),u=s-Math.min(e,i,o);let a=0;return 0!==u&&(a=s===e?(i-o)/u%6*60:s===i?60*((o-e)/u+2):60*((e-i)/u+4)),{h:(a+360)%360,s:0===s?0:u/s,v:s}}function s({h:t,s:n,v:r}){const e=(t%360+360)%360,o=i(n,0,1),s=i(r,0,1),u=s*o,a=u*(1-Math.abs(e/60%2-1)),c=s-u,[l,f,h]=e<60?[u,a,0]:e<120?[a,u,0]:e<180?[0,u,a]:e<240?[0,a,u]:e<300?[a,0,u]:[u,0,a],p=t=>Math.round(255*(t+c)).toString(16).padStart(2,"0");return`#${p(l)}${p(f)}${p(h)}`}function u(t,n,r){return{s:r.width>0?i((t-r.left)/r.width,0,1):0,v:r.height>0?1-i((n-r.top)/r.height,0,1):0}}function a(t,n){return n.width>0?Math.min(359,360*i((t-n.left)/n.width,0,1)):0}var c=`linear-gradient(to right, ${[0,60,120,180,240,300,360].map(t=>s({h:t%360,s:1,v:1})).join(", ")})`,l=/^#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i;function f(t){const n=t.trim();if(!l.test(n))return null;let r=n.slice(1);3===r.length&&(r=[...r].map(t=>t+t).join(""));const e=parseInt(r.slice(0,6),16);return{r:e>>16&255,g:e>>8&255,b:255&e}}function h(t){const n="string"==typeof t?f(t):t;if(!n)return null;const r=t=>{const n=t/255;return n<=.04045?n/12.92:((n+.055)/1.055)**2.4};return.2126*r(n.r)+.7152*r(n.g)+.0722*r(n.b)}function p(t,n){const r=h(t),e=h(n);if(null===r||null===e)return null;const[i,o]=r>=e?[r,e]:[e,r];return(i+.05)/(o+.05)}function g(t,n=[s({h:0,s:0,v:0}),s({h:0,s:0,v:1})]){let r=n[0],e=-1;for(const i of n){const o=p(t,i);if(null===o)return n[0];o>e&&(e=o,r=i)}return r}export{n as HEX_MAX_LENGTH,c as HUE_GRADIENT,p as contrastRatio,e as hexReadout,o as hexToHsv,f as hexToRgb,s as hsvToHex,a as hueFromPoint,r as parseHexColor,g as readableInk,h as relativeLuminance,u as svFromPoint};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{InputNumber_default as e}from"./chunk-4SQNLU2Q.js";import{useSettingAuto as t,useInSettingRow as i}from"./chunk-E4Z5OXBI.js";import{useShellStrings as n}from"./chunk-E6UCGCOC.js";import{createContext as r,useState as l,useMemo as a,useId as o,useRef as d,useContext as s,useEffect as u,useLayoutEffect as c}from"react";import{jsx as m,jsxs as f}from"react/jsx-runtime";var p=(e,t,i)=>Math.min(i,Math.max(t,e));function h(e){const t=String(e),i=/e-(\d+)$/.exec(t);return i?Number(i[1]):t.split(".")[1]?.length??0}var v=8,x=40;function b(e){return Math.max(1,...e.map(e=>(e??"").length))}var w="undefined"==typeof window?u:c;function y(e,t,i,n){return Number(p(e,t,i).toFixed(n))}var g=r(null);function S({children:e}){const[t,i]=l({}),n=a(()=>(e,t)=>i(i=>{if(null===t){if(!(e in i))return i;const t={...i};return delete t[e],t}return i[e]===t?i:{...i,[e]:t}}),[]),r=a(()=>{const e=Object.values(t);return{set:n,width:e.length?`max(${e.join(", ")})`:null}},[t,n]);/* @__PURE__ */
|
|
2
|
+
return m(g.Provider,{value:r,children:e})}function z({value:r,onChange:a,min:c,max:S,step:z=1,shiftStep:F,precision:$,inputMin:k,inputMax:N,suffix:C,showInput:L=!0,emptyLabel:j,placeholderValue:E,stepFrom:K,label:M,"aria-labelledby":A,valueText:D,id:O,disabled:R,size:U="md",className:B="",auto:I}){const Q=n(),V=o(),W=t(),q=I??W,G=o(),P=O??V,T=$??h(z),X=k??c,Z=N??S,H=void 0!==j||void 0!==E,J=K??E,Y=p(r??E??c,c,S),_=d(null),[ee,te]=l(null),ie=Boolean(C);w(()=>{const e=()=>{const e=_.current?.querySelector("input");if(!e)return;const t=getComputedStyle(e),i=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"].reduce((e,i)=>e+(parseFloat(t[i])||0),0);i<=0||te(e=>e&&e.frame===i&&e.fontSize===t.fontSize?e:{frame:i,fontSize:t.fontSize})};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[ie,L]);const ne=e=>D?D(e):"string"==typeof C?`${e.toFixed(T)} ${C}`:void 0,re=null==r?j??(null!=E?ne(E)??String(E):void 0):ne(r),le=`calc(${b([c.toFixed(T),S.toFixed(T),r?.toFixed(T),j,E?.toFixed(T)])}ch + ${(ee?.frame??10+(ie?x:v))+2}px)`,ae=s(g),oe=o(),de=ae?.set;w(()=>{de&&de(oe,L?le:null)},[de,oe,le,L]),u(()=>()=>de?.(oe,null),[de,oe]);const se=i();/* @__PURE__ */
|
|
3
|
+
return f("div",{"data-slider":"",className:`flex w-full min-w-0 items-center ${se?"flex-wrap gap-2":"gap-3"} ${B}`.trim(),children:[
|
|
4
|
+
/* @__PURE__ */m("input",{id:P,type:"range",min:c,max:S,step:z,value:Y,disabled:R,"aria-label":A?void 0:M,"aria-labelledby":A,"aria-valuetext":re,"aria-describedby":q?G:void 0,onKeyDown:e=>{const t="ArrowUp"===e.key||"ArrowRight"===e.key?1:"ArrowDown"===e.key||"ArrowLeft"===e.key?-1:0;if(!t||e.altKey||e.ctrlKey||e.metaKey)return;const i=e.shiftKey&&null!=F;if(!i&&!(null==r&&null!=J))return;e.preventDefault();a(y((r??J??Y)+t*(i?F??z:z),c,S,T))},onChange:e=>a(y(Number(e.target.value),c,S,T)),className:`min-w-24 flex-1 ${se?"basis-24":""} cursor-pointer accent-blue-600 disabled:cursor-not-allowed disabled:opacity-60 ${"sm"===U?"h-1":"h-1.5"}`}),L&&
|
|
5
|
+
/* @__PURE__ */m("div",{ref:_,"data-slider-box":"",className:se?"ml-auto shrink-0":"shrink-0 text-xs",style:se?void 0:{width:ae?.width??le,...ee?{fontSize:ee.fontSize}:{}},children:/* @__PURE__ */m(e,{value:r,onChange:e=>{null!=e?e<X||e>Z||a(e):H&&a(null)},min:X,max:Z,step:z,shiftStep:F,stepFrom:J,precision:T,snap:!0,allowEmpty:H,suffix:C,disabled:R,placeholder:j??(null!=E?E.toFixed(T):void 0),size:se?void 0:"sm",auto:q,"aria-label":M?Q.slider.value(M):void 0,"aria-labelledby":M?void 0:A})}),q&&/* @__PURE__ */m("span",{id:G,hidden:!0,children:Q.settingView.auto})]})}export{z as Slider,S as SliderGroup,y as settleSliderValue,b as sliderBoxChars,h as stepDecimals};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{isSafeLinkHref as e}from"./chunk-PJPK2ADX.js";import{Button_default as t}from"./chunk-4IU5BSVE.js";import{Icon as r}from"./chunk-KIBL6M3T.js";import{useShellStrings as n}from"./chunk-E6UCGCOC.js";import{jsx as l,jsxs as s}from"react/jsx-runtime";var a=/!\[([^\]]*)\]\(([^)]+)\)|\[([^\]]+)\]\(([^)]+)\)|\*\*([^*]+)\*\*|`([^`]+)`|\*([^*]+)\*/g,c=t=>e(t.trim());function o(e){const t=[];let r,n=0,o=0;for(a.lastIndex=0;null!==(r=a.exec(e));)r.index>n&&t.push(e.slice(n,r.index)),void 0!==r[1]?t.push(
|
|
2
|
+
/* @__PURE__ */s("span",{className:"text-gray-400",children:["[",r[1],"]"]},o++)):void 0!==r[3]?t.push(
|
|
3
|
+
/* @__PURE__ */l("a",{href:c(r[4])?r[4]:void 0,target:"_blank",rel:"noreferrer",className:"text-blue-600 hover:underline",children:r[3]},o++)):void 0!==r[5]?t.push(
|
|
4
|
+
/* @__PURE__ */l("strong",{className:"font-semibold text-gray-900",children:r[5]},o++)):void 0!==r[6]?t.push(
|
|
5
|
+
/* @__PURE__ */l("code",{className:"rounded bg-gray-200 px-1 py-0.5 font-mono text-[0.85em] text-gray-800",children:r[6]},o++)):void 0!==r[7]&&t.push(/* @__PURE__ */l("em",{children:r[7]},o++)),n=a.lastIndex;return n<e.length&&t.push(e.slice(n)),t}function i({alt:e}){const t=e.replace(/^screenshot:\s*/i,""),a=n().markdown;/* @__PURE__ */
|
|
6
|
+
return s("div",{className:"my-1 flex items-start gap-2 rounded-lg border border-dashed border-gray-300 bg-gray-50 px-3 py-3 text-gray-500",children:[
|
|
7
|
+
/* @__PURE__ */l(r,{name:"camera",look:"mini",className:"mt-0.5 h-4 w-4 shrink-0","aria-hidden":"true"}),
|
|
8
|
+
/* @__PURE__ */s("span",{className:"text-xs",children:[
|
|
9
|
+
/* @__PURE__ */l("span",{className:"font-medium text-gray-600",children:`${a.screenshot} — `}),t]})]})}function d(e,t){const r=[];for(const n of e){const e=t.exec(n);e?r.push(e[1]):r.length&&(r[r.length-1]+=" "+n.trim())}return r}var m=e=>e.replace(/^\s*\|/,"").replace(/\|\s*$/,"").split("|").map(e=>e.trim());function u(e){return e.length>=2&&e[0].includes("|")&&/^\s*\|?[\s:|-]*-[\s:|-]*\|?\s*$/.test(e[1])&&e[1].includes("-")}function h(e){return e.replace(a,(e,t,r,n,l,s,a,c)=>t??n??s??a??c??"").trim()}function p({header:e,rows:t}){const r=e=>/[",\r\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e;return[e,...t].map(e=>e.map(r).join(",")).join("\r\n")}function g(e,n,a){const c=m(e[0]),i=e.slice(2).map(m),d=/* @__PURE__ */l("div",{className:"my-1 overflow-x-auto rounded-lg border border-gray-200",children:/* @__PURE__ */s("table",{className:"w-full border-collapse text-sm",children:[
|
|
10
|
+
/* @__PURE__ */l("thead",{children:/* @__PURE__ */l("tr",{className:"bg-gray-50",children:c.map((e,t)=>/* @__PURE__ */l("th",{className:"border-b border-gray-200 px-3 py-2 text-left font-semibold text-gray-700",children:o(e)},t))})}),
|
|
11
|
+
/* @__PURE__ */l("tbody",{children:i.map((e,t)=>/* @__PURE__ */l("tr",{className:"even:bg-gray-50/50",children:e.map((e,t)=>/* @__PURE__ */l("td",{className:"border-t border-gray-100 px-3 h-8 align-top text-gray-700",children:o(e)},t))},t))})]})},n);return a?.length?/* @__PURE__ */s("div",{children:[d,
|
|
12
|
+
/* @__PURE__ */l("div",{className:"flex flex-wrap justify-end gap-1",children:a.map(e=>/* @__PURE__ */l(t,{size:"sm",variant:"secondary",leftIcon:e.icon?/* @__PURE__ */l(r,{name:e.icon,look:"mini",className:"h-4 w-4","aria-hidden":"true"}):void 0,onClick:()=>e.onSelect({header:c.map(h),rows:i.map(e=>e.map(h))}),children:e.label},e.label))})]},n):d}var f=/^( {0,3})(`{3,}|~{3,})[ \t]*(.*?)[ \t]*$/,x=/^[-*]\s+/,b=/^\d+\.\s+/,y=/^#{2,4}\s+/;function N(e){const t=e.split("\n"),r=[];let n=null;for(let e=0;e<t.length;e+=1){const l=t[e];let s=null;y.test(l)?s="heading":"table"!==n&&u(t.slice(e,e+2))?s="table":"bullet"!==n&&x.test(l)?s="bullet":"ordered"!==n&&b.test(l)&&("text"!==n||/^1\./.test(l))?s="ordered":"table"!==n||l.includes("|")?"heading"===n&&(s="text"):s="text",null!==s||null===n?(r.push([l]),n=s??"text"):r[r.length-1].push(l)}return r.map(e=>e.join("\n"))}function v(e){const t=e.replace(/\r\n/g,"\n").split("\n"),r=[];let n=[];const l=()=>{for(const e of n.join("\n").split(/\n{2,}/))for(const t of N(e.replace(/\s+$/,"")))""!==t.trim()&&r.push({text:t});n=[]};for(let e=0;e<t.length;e+=1){const s=f.exec(t[e]);if(!(null!==s&&!("`"===s[2][0]&&s[3].includes("`")))){n.push(t[e]);continue}l();const[,a,c,o]=s,i=[];let d=!1;for(e+=1;e<t.length;e+=1){const r=f.exec(t[e]);if(null!==r&&r[2][0]===c[0]&&r[2].length>=c.length&&""===r[3]){d=!0;break}i.push(a?t[e].replace(new RegExp(`^ {0,${a.length}}`),""):t[e])}r.push({fence:{lang:o.split(/[ \t]/)[0],code:i.join("\n"),closed:d}})}return l(),r}function k(e,t,r){if(r){let n=null;try{n=r(e)}catch{n=null}if(null!=n)/* @__PURE__ */return l("div",{children:n},t)}return function({lang:e,code:t},r){/* @__PURE__ */
|
|
13
|
+
return l("pre",{"data-language":e||void 0,className:"my-1 overflow-x-auto rounded-lg border border-gray-200 bg-gray-50 p-3 font-mono text-xs text-gray-800",children:/* @__PURE__ */l("code",{children:t})},r)}(e,t)}function $({children:e,className:t,renderFence:r,tableActions:n}){/* @__PURE__ */
|
|
14
|
+
return l("div",{className:`space-y-3 text-sm leading-relaxed text-gray-700 ${t??""}`.trim(),children:v(e??"").map((e,t)=>"fence"in e?k(e.fence,t,r):function(e,t,r){const n=e.split("\n"),s=n[0],a=/^(#{2,4})\s+(.*)$/.exec(s);if(a&&1===n.length){const e=a[1].length;/* @__PURE__ */
|
|
15
|
+
return l(`h${e}`,{className:2===e?"mt-2 text-sm font-semibold uppercase tracking-wide text-gray-500":3===e?"mt-1 text-base font-semibold text-gray-900":"mt-1 text-sm font-semibold text-gray-900",children:o(a[2])},t)}if(1===n.length&&/^---+$/.test(s))/* @__PURE__ */
|
|
16
|
+
return l("hr",{className:"border-gray-200"},t);if(u(n))return g(n,t,r);if(/^>\s?/.test(s)){const e=n.map(e=>e.replace(/^>\s?/,"")).join(" ");/* @__PURE__ */
|
|
17
|
+
return l("div",{className:"my-1 rounded-r-lg border-l-4 border-blue-300 bg-blue-50/60 px-3 py-2 text-gray-700",children:o(e)},t)}const c=/^!\[([^\]]*)\]\(([^)]+)\)$/.exec(s);if(c&&1===n.length)/* @__PURE__ */
|
|
18
|
+
return l(i,{alt:c[1]},t);if(/^[-*]\s+/.test(s)){const e=d(n,/^[-*]\s+(.*)$/);/* @__PURE__ */
|
|
19
|
+
return l("ul",{className:"list-disc space-y-1 pl-5 marker:text-gray-400",children:e.map((e,t)=>/* @__PURE__ */l("li",{children:o(e)},t))},t)}const m=/^(\d+)\.\s+/.exec(s);if(m){const e=d(n,/^\d+\.\s+(.*)$/);/* @__PURE__ */
|
|
20
|
+
return l("ol",{start:Number(m[1]),className:"list-decimal space-y-1 pl-5 marker:text-gray-400",children:e.map((e,t)=>/* @__PURE__ */l("li",{className:"pl-1",children:o(e)},t))},t)}/* @__PURE__ */
|
|
21
|
+
return l("p",{children:o(n.join(" "))},t)}(e.text,t,n))})}export{$ as Markdown,h as plainCell,p as tableToCsv};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{FormField as e}from"./chunk-MVQBVPWP.js";import{zoneFocusClass as r,mediaPromptLine as t,UploadGlyph as a,dropzoneClass as n,BusyOverlay as l,isVideoUrl as i,mediaFileName as o,FilenameBadge as s}from"./chunk-DTSCO7VM.js";import{useFileIntake as d,FileIntakeAlert as c}from"./chunk-YDYDR72S.js";import{
|
|
2
|
-
return v("div",{...Ce?{"data-grid-item":"","data-grid-id":e.id,role:"option"}:{},..._?{[
|
|
1
|
+
import{FormField as e}from"./chunk-MVQBVPWP.js";import{zoneFocusClass as r,mediaPromptLine as t,UploadGlyph as a,dropzoneClass as n,BusyOverlay as l,isVideoUrl as i,mediaFileName as o,FilenameBadge as s}from"./chunk-DTSCO7VM.js";import{useFileIntake as d,FileIntakeAlert as c}from"./chunk-YDYDR72S.js";import{ColoredBadge as m}from"./chunk-XWLWG4HS.js";import{MENU_ON_MEDIA_ATTR as u}from"./chunk-5QFPTDQF.js";import{Icon as p}from"./chunk-KIBL6M3T.js";import{Tooltip as h}from"./chunk-22S6LG6D.js";import{useShellStrings as f}from"./chunk-E6UCGCOC.js";import{useId as g,useState as b,useRef as y}from"react";import{jsxs as v,jsx as x}from"react/jsx-runtime";var k=112,D=/* @__PURE__ */x(p,{name:"close",strokeWidth:2,strokeLinecap:"round","aria-hidden":"true",className:"h-3 w-3"});function w({items:p,onPick:k,onFiles:w,onRemove:N,onReorder:j,dragType:C,dropType:K,onDropData:T,label:S,hint:L,error:I,required:P,className:A,accept:F="image/*",maxSizeBytes:M,maxFiles:O,fit:z="cover",thumbSize:$=96,placeholder:E,cta:H,acceptHint:W,showCover:B=!1,coverLabel:R,busy:G=!1,busyLabel:Q,progress:V,disabled:q=!1,readOnly:U=!1,selected:Y,onItemClick:X,onItemDoubleClick:J,onItemContextMenu:Z,menuOnMedia:_=!1}){const ee=f().media,re=H??ee.cta,te=R??ee.cover,ae=Q??ee.uploading,ne=g(),[le,ie]=b(null),oe=q||G,se=!(!k&&!w||oe||U),de=!!N&&!oe&&!U,ce=!!j&&!oe&&!U,me=!!C&&!q&&!ce,ue=!(!K||!T||oe||U),pe=r(oe),he=E??t(F,ee),fe=d({accept:F,maxSizeBytes:M,maxFiles:O,acceptHint:W,multiple:!0,disabled:!se,currentCount:p.length,onAccept:e=>{if(w)w(e);else for(const r of e)k(r)}}),[ge,be]=b(!1),ye=y(0),ve=e=>ue&&Array.from(e.dataTransfer?.types??[]).includes(K),xe=fe.zoneProps,ke={onDragEnter:e=>{if(!ve(e))return xe.onDragEnter?.(e);e.preventDefault(),ye.current+=1,be(!0)},onDragOver:e=>{if(!ve(e))return xe.onDragOver?.(e);e.preventDefault(),e.dataTransfer.dropEffect="link",ge||be(!0)},onDragLeave:e=>{if(!ve(e))return xe.onDragLeave?.(e);ye.current=Math.max(0,ye.current-1),0===ye.current&&be(!1)},onDrop:e=>{if(!ve(e))return xe.onDrop?.(e);e.preventDefault(),ye.current=0,be(!1);const r=e.dataTransfer.getData(K);r&&T(r)}},De=fe.dragOver||ge,we=()=>{se&&(k?k():fe.open())},Ne={width:$,height:$},je=null==Y?null:new Set(Y),Ce=!!X,Ke=$<112,Te=(e,r)=>{const t=e.kind?"video"===e.kind:i(e.url,F),a=e.name??o(e.url),n=B&&(e.cover??0===r);/* @__PURE__ */
|
|
2
|
+
return v("div",{...Ce?{"data-grid-item":"","data-grid-id":e.id,role:"option"}:{},..._?{[u]:""}:{},"aria-selected":je?je.has(e.id):void 0,onClick:Ce?r=>{r.target.closest?.("button")||X(e.id,{ctrlKey:r.ctrlKey,metaKey:r.metaKey,shiftKey:r.shiftKey})}:void 0,onDoubleClick:J?()=>J(e.id):void 0,onContextMenu:Z?r=>Z(e.id,r):void 0,draggable:ce||me&&!!e.dragData||void 0,onDragStart:ce?e=>{e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",String(r)),ie(r)}:me&&e.dragData?r=>{r.dataTransfer.effectAllowed="link",r.dataTransfer.setData(C,e.dragData)}:void 0,onDragEnd:ce?()=>ie(null):void 0,onDragOver:ce?e=>{null!=le&&(e.preventDefault(),e.stopPropagation())}:void 0,onDrop:ce?e=>{null!=le&&(e.preventDefault(),e.stopPropagation(),le!==r&&j(le,r),ie(null))}:void 0,tabIndex:ce||Ce?0:void 0,"aria-label":ce?ee.reorder(a,r+1,p.length):Ce?a:void 0,onKeyDown:Ce&&!ce?r=>{r.target!==r.currentTarget||"Enter"!==r.key&&" "!==r.key||(r.preventDefault(),X(e.id,{ctrlKey:r.ctrlKey,metaKey:r.metaKey,shiftKey:r.shiftKey}))}:ce?e=>{"ArrowLeft"===e.key||"ArrowUp"===e.key?r>0&&(e.preventDefault(),j(r,r-1)):"ArrowRight"!==e.key&&"ArrowDown"!==e.key||r<p.length-1&&(e.preventDefault(),j(r,r+1))}:void 0,className:["relative shrink-0 overflow-hidden rounded-md border border-gray-200 bg-gray-100",pe,le===r?"opacity-50":"",je?.has(e.id)?"ring-2 ring-blue-500 ring-offset-1":"",Ce?"cursor-pointer":""].join(" "),style:{...Ne,cursor:ce?"move":void 0},children:[t?/* @__PURE__ */x("video",{src:e.url,muted:!0,playsInline:!0,preload:"metadata","aria-label":a,className:"h-full w-full",style:{objectFit:z}}):/* @__PURE__ */x("img",{src:e.url,alt:a,className:"h-full w-full",style:{objectFit:z}}),n&&/* @__PURE__ */x("span",{className:"absolute left-1 top-1 rounded bg-blue-600 px-2 py-0.5 text-xs font-medium text-white",children:te}),!n&&null!=e.mark&&/* @__PURE__ */x("span",{className:"absolute left-1 top-1 inline-flex items-center gap-1 rounded px-2 py-0.5 text-xs font-medium text-white",style:{background:"var(--rosh-media-scrim)"},children:e.mark}),!n&&null==e.mark&&!!e.badges?.length&&
|
|
3
3
|
/* @__PURE__ */x("span",{"data-tile-badges":"",className:"absolute left-1 top-1 flex flex-nowrap items-center gap-1 overflow-hidden rounded-md bg-white p-0.5 shadow-sm",style:{maxWidth:"calc(100% - 8px)"},children:e.badges.map(e=>/* @__PURE__ */x("span",{"data-tile-badge":"",className:"flex min-w-0",children:Ke?
|
|
4
|
-
/* @__PURE__ */x(h,{content:e.label,children:/* @__PURE__ */x("span",{tabIndex:0,"aria-label":e.label,className:`flex rounded-full ${pe}`,children:/* @__PURE__ */x(
|
|
5
|
-
/* @__PURE__ */x("span",{className:"inline-flex h-3 w-3 shrink-0 items-center justify-center",children:e.icon}),null!=e.count&&/* @__PURE__ */x("span",{children:e.count})]})})})}):/* @__PURE__ */x(
|
|
4
|
+
/* @__PURE__ */x(h,{content:e.label,children:/* @__PURE__ */x("span",{tabIndex:0,"aria-label":e.label,className:`flex rounded-full ${pe}`,children:/* @__PURE__ */x(m,{tone:e.tone,size:"xs",children:/* @__PURE__ */v("span",{"aria-hidden":"true",className:"inline-flex items-center gap-0.5",children:[
|
|
5
|
+
/* @__PURE__ */x("span",{className:"inline-flex h-3 w-3 shrink-0 items-center justify-center",children:e.icon}),null!=e.count&&/* @__PURE__ */x("span",{children:e.count})]})})})}):/* @__PURE__ */x(m,{tone:e.tone,size:"xs",children:e.label})},e.key))}),null!=e.caption&&/* @__PURE__ */x(s,{children:e.caption}),de&&/* @__PURE__ */x("button",{type:"button",onClick:()=>N(e.id),"aria-label":e.removeLabel??ee.removeItem(a),className:`absolute right-1 top-1 flex h-5 w-5 items-center justify-center rounded-full text-white ${pe}`,style:{background:"var(--rosh-media-scrim-button)"},children:D})]},e.id)},Se=se&&/* @__PURE__ */v("button",{type:"button",onClick:()=>we(),"aria-label":ee.addMedia,className:`flex shrink-0 flex-col items-center justify-center gap-1 rounded-md border-2 border-dashed border-gray-300 bg-gray-50 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-500 ${pe}`,style:Ne,children:[
|
|
6
6
|
/* @__PURE__ */x(a,{className:"h-5 w-5"}),
|
|
7
7
|
/* @__PURE__ */x("span",{className:"text-xs font-medium text-gray-500",children:ee.add})]}),Le=se?/* @__PURE__ */v("button",{type:"button",onClick:()=>we(),"aria-label":"string"==typeof he?he:ee.upload,className:n(De,!1,pe),style:{minHeight:$+32},children:[
|
|
8
8
|
/* @__PURE__ */x("span",{className:"text-gray-400",children:/* @__PURE__ */x(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-DPDA3AJL.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)}}},Z=e=>{const t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const a=b(e);let r=-1;const o=()=>{i(r),a()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=n(()=>{removeEventListener("visibilitychange",o,{capture:!0}),a()},{timeout:t})}},F=[200,500],R=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=h();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,F,t.reportAllChanges)},l=()=>{const e=c.L(s.navigationType);e&&e.P!==s.value&&(s.value=e.P,s.entries=e.entries,o())},u=e=>{l(),o(!0),d("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},f=(e,t=!1)=>{Z(()=>{for(const t of e)"soft-navigation"!==t.entryType?c.h(t):u(t);l(),t&&o(!0)})},h=["event","first-input"];w(t)&&h.push("soft-navigation");const v=T(h,f,{...t,durationThreshold:t.durationThreshold??40});o=r(e,s,F,t.reportAllChanges),v&&(n.onHidden(()=>{f(v.takeRecords(),!0)}),a(()=>{d("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,i())}))})},j=class{p;l;h(e){this.p?.(e)}},x=[2500,4e3],B=[800,1800],N=e=>{document.prerendering?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,D=/\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,K=/\b[a-z][a-z0-9+.-]*:\/\/\S+/gi,V=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,W=/\d{4,}/g,G=/(^|[/:])(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,})(?=$|[/:])/gi,Q=/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,X=/(?:\(|@|\bat\s+)?((?:[a-z][a-z0-9+.-]*:\/\/|\/)[^\s()@]*?):(\d+):(\d+)\)?\s*$/i;function Y(e,t,n){const i=e.replace(Q,"").split(/[?#]/,1)[0];return i?`${i}:${t}:${n}`.slice(0,256):null}function ee(e){if("string"!=typeof e)return[];const t=[];for(const n of e.split("\n")){const e=X.exec(n.trim()),i=e&&Y(e[1],e[2],e[3]);if(i&&t.push(i),5===t.length)break}return t}function te(e){const t=e instanceof Error?e.name:void 0;return"string"==typeof t&&t.length<=64&&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;Z(()=>{if(!n){if(!s){b.disconnect();for(const e of c)removeEventListener(e,l,{capture:!0})}e===u.id&&(n=!0,d(!0))}})}};for(const e of c)addEventListener(e,l,{capture:!0});a(a=>{v("back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),d=r(e,u,x,t.reportAllChanges),o(()=>{u.value=performance.now()-a.timeStamp,n=!0,d(!0)})})}})})(e),R(e),((e,t={})=>{const n=h();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(D,"[redacted]").replace(K,"[url]").replace(V,"[id]").replace(W,"[n]").replace(/\s+/g," ").trim().slice(0,160)),frames:ee(e instanceof Error?e.stack:void 0),route:ne(n.routeKey()),count:1};var i,a};i&&(n.observeVitals??se)(e=>{c||(r.addVital(function(e,t,n,i){return{type:"vital",name:e.name,value:e.value,route:re.has(e.name)?t:n(),navigation:e.navigationType??"navigate",device:i}}(e,o,()=>ne(n.routeKey()),s)),r.size>=50&&d())});const f=n.anonymous?()=>{}:function(t,n){const i=e=>{const{error:i,message:a,filename:r,lineno:o,colno:s}=e;if(null!=i)return void t(n(i,"onerror"));const c=r?ee(`at ${r}:${o??0}:${s??0}`):[];t({...n(a??"","onerror"),frames:c})},a=e=>t(n(e.reason,"unhandledrejection"));window.addEventListener("error",i),window.addEventListener("unhandledrejection",a);const r=e(e=>t(n(e,"boundary")));return()=>{window.removeEventListener("error",i),window.removeEventListener("unhandledrejection",a),r()}}(l,u),h=()=>{"hidden"===document.visibilityState&&d()};document.addEventListener("visibilitychange",h),window.addEventListener("pagehide",d);const g=window.setInterval(d,n.flushIntervalMs??6e4),v={flush:d,reportError:e=>l(u(e,"boundary")),stop(){c||(d(),c=!0,f(),document.removeEventListener("visibilitychange",h),window.removeEventListener("pagehide",d),window.clearInterval(g),ae===v&&(ae=null))}};return ae=v,v}export{ce as startClientTelemetry};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{resolveColumnShares as e,COLUMN_SHARES_EQUAL as t,COLUMN_SHARE_MIN as r,COLUMN_COUNT_MAX as n}from"./chunk-PLGJOHEG.js";import{InputNumber_default as o}from"./chunk-
|
|
2
|
-
return f("div",{role:"group","aria-label":P?void 0:N,"aria-labelledby":P,"aria-describedby":
|
|
1
|
+
import{resolveColumnShares as e,COLUMN_SHARES_EQUAL as t,COLUMN_SHARE_MIN as r,COLUMN_COUNT_MAX as n}from"./chunk-PLGJOHEG.js";import{InputNumber_default as o}from"./chunk-4SQNLU2Q.js";import{Button_default as i}from"./chunk-4IU5BSVE.js";import{Tooltip as l}from"./chunk-22S6LG6D.js";import{useShellStrings as a}from"./chunk-E6UCGCOC.js";import{useId as s,useRef as c,useState as d,useEffect as u,Fragment as h}from"react";import{jsxs as f,jsx as m}from"react/jsx-runtime";var p=(e,t,r)=>Math.min(r,Math.max(t,e)),v=e=>e.reduce((e,t)=>e+t,0),g=(e,t)=>e.length===t.length&&e.every((e,r)=>e===t[r]);var y,b="w-0.5",w=`${b} group-hover/widths:w-1 group-focus-visible/widths:w-1`;var x=["text-blue-700","text-gray-600"];function k({count:k,value:C,onChange:$,label:N,"aria-labelledby":P,readOnly:j=!1,disabled:M=!1,footer:S=!0,className:z=""}){const R=a().widths,B=s(),A=p(Math.round(k)||1,1,n),D=e(C,A),E=D??[...t[A]??[]],O=[...E,100-v(E)],K=j||M,L=c(null),T=c({onChange:$,shown:E,locked:K,n:A,stored:D});T.current={onChange:$,shown:E,locked:K,n:A,stored:D};const U=t=>{const{onChange:r,shown:n,locked:o,n:i}=T.current;if(o)return!1;const l=e(t,i);return!(!l||g(l,n))&&(r(l),!0)},G=(e,t,n)=>{const o=e[t]+e[t+1],i=[...e];i[t]=p(Math.round(n),r,o-r),i[t+1]=o-i[t],U(i.slice(0,-1))&&(ie.current=null)},I=e=>t=>{if(t.altKey||t.ctrlKey||t.metaKey)return;const n=t.shiftKey?10:1,o=O[e]+O[e+1],i="ArrowRight"===t.key?O[e]+n:"ArrowLeft"===t.key?O[e]-n:"PageUp"===t.key?O[e]+10:"PageDown"===t.key?O[e]-10:"Home"===t.key?r:"End"===t.key?o-r:null;null!==i&&(t.preventDefault(),G(O,e,i))},H=c(null),[F,Q]=d(null),V=()=>{H.current=null,Q(null),document.body.style.removeProperty("cursor"),document.body.style.removeProperty("user-select")};u(()=>V,[]);const W=e=>t=>{if(0!==t.button||K)return;t.preventDefault();const r=L.current?.getBoundingClientRect().width??0;r<=0||(H.current={i:e,x:t.clientX,width:r,from:O,moved:!1,pointer:t.pointerId},Q(e),t.currentTarget.setPointerCapture?.(t.pointerId),document.body.style.cursor="col-resize",document.body.style.userSelect="none")},X=e=>{const t=H.current;if(!t)return;if(0===e.buttons)return void V();const r=e.clientX-t.x;if(!t.moved){if(Math.abs(r)<3)return;t.moved=!0}G(t.from,t.i,t.from[t.i]+r/t.width*100)},q=e=>{const t=H.current;t&&(e.currentTarget.hasPointerCapture?.(t.pointer)&&e.currentTarget.releasePointerCapture(t.pointer),V())},J=(e,t)=>{const{shown:n}=T.current,o=function(e,t,n){const o=e.length,i=[...e];if(o<2)return i;const l=p(Math.round(n),r,100-(o-1)*r);let a=l-i[t];i[t]=l;const s=[...Array.from({length:o-1-t},(e,r)=>t+1+r),...Array.from({length:t},(e,r)=>t-1-r)];if(a<0)return i[s[0]]-=a,i;for(const e of s){if(a<=0)break;const t=Math.min(a,i[e]-r);i[e]-=t,a-=t}return i}([...n,100-v(n)],e,t);return U(o.slice(0,-1))?o:null},[Y,Z]=d(0);u(()=>{const e=L.current;if(!e||"undefined"==typeof ResizeObserver)return;const t=new ResizeObserver(()=>Z(e.getBoundingClientRect().width));return t.observe(e),()=>t.disconnect()},[]);const _=c(null),[ee,te]=d(null),[re,ne]=d([]),oe=(e,t)=>te(r=>t?e:r===e?null:r),ie=c(null),le=(e,t)=>{const r=ie.current;if(!r||r.column!==e||r.share!==t)return!1;const{onChange:n,locked:o,stored:i}=T.current;var l,a;return o||(l=i,a=r.stored,void 0===l||void 0===a?l===a:g(l,a))||n(r.stored),!0},ae=O.join(",");u(()=>{const e=null===ee?[]:function(e,t){if(!e)return[];const r=Array.from(e.querySelectorAll("input[data-widths-label]")),n=r[t]?.getBoundingClientRect();if(!n||0===n.width)return[];if(void 0===y&&(y=document.createElement("canvas").getContext("2d")),!y)return[];const o=y;return r.flatMap((e,r)=>{if(r===t)return[];const i=e.getBoundingClientRect(),l=getComputedStyle(e);o.font=`${l.fontWeight} ${l.fontSize} ${l.fontFamily}`;const a=o.measureText(e.value).width/2,s=(i.left+i.right)/2;return s+a>n.left&&s-a<n.right?[r]:[]})}(_.current,ee);ne(t=>g(t,e)?t:e)},[ee,ae,Y]);const se=O.slice(0,-1).map((e,t)=>v(O.slice(0,t+1)));/* @__PURE__ */
|
|
2
|
+
return f("div",{role:"group","aria-label":P?void 0:N,"aria-labelledby":P,"aria-describedby":A>1?B:void 0,className:`flex w-full min-w-0 flex-col gap-2 ${M?"opacity-60":""} ${z}`.trim(),children:[
|
|
3
3
|
/* @__PURE__ */f("div",{ref:_,"data-widths-bar":"",className:"relative h-8",children:[
|
|
4
|
-
/* @__PURE__ */m("div",{ref:
|
|
5
|
-
/* @__PURE__ */m("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 rounded-(--radius-control) border border-gray-300"}),
|
|
6
|
-
return m("div",{className:"absolute inset-y-0 "+(n?"z-20":""),style:{left:`clamp(0px, calc(${i+e/2}% - ${l} / 2), calc(100% - ${l}))`,width:l},children:/* @__PURE__ */m(o,{appearance:"bare",value:e,display:()=>(e=>Y>0&&Y*e/100<36?String(e):`${e}%`)(e),suffix:"%",min:r,max:100-(
|
|
7
|
-
/* @__PURE__ */m("span",{id:B,"data-widths-hint":"",className:"text-2xs leading-tight text-gray-500 @max-[264px]:self-stretch",children:
|
|
8
|
-
/* @__PURE__ */m(i,{variant:"secondary",size:"sm",disabled:K,onClick:()=>{K||void 0===C||$(void 0)},className:"shrink-0",children:
|
|
4
|
+
/* @__PURE__ */m("div",{ref:L,"data-widths-track":"",className:"flex h-full w-full overflow-hidden rounded-(--radius-control) bg-white",children:O.map((e,t)=>/* @__PURE__ */m("div",{"data-widths-segment":"",style:{flexBasis:`${e}%`},className:`flex min-w-0 shrink-0 grow-0 items-center justify-center overflow-hidden whitespace-nowrap text-xs font-medium tabular-nums ${x[t%2]} ${t%2==0?"bg-blue-50":""}`,children:1===A&&/* @__PURE__ */m("span",{"data-widths-label":"",children:`${e}%`})},t))}),
|
|
5
|
+
/* @__PURE__ */m("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 rounded-(--radius-control) border border-gray-300"}),A>1&&O.map((e,t)=>/* @__PURE__ */f(h,{children:[(()=>{const n=ee===t,i=v(O.slice(0,t)),l=n?`max(${e}%, 40px)`:`${e}%`;/* @__PURE__ */
|
|
6
|
+
return m("div",{className:"absolute inset-y-0 "+(n?"z-20":""),style:{left:`clamp(0px, calc(${i+e/2}% - ${l} / 2), calc(100% - ${l}))`,width:l},children:/* @__PURE__ */m(o,{appearance:"bare",value:e,display:()=>(e=>Y>0&&Y*e/100<36?String(e):`${e}%`)(e),suffix:"%",min:r,max:100-(A-1)*r,step:1,shiftStep:10,precision:0,allowEmpty:!1,reportWhileTyping:!1,readOnly:j,disabled:M,"aria-label":R.column(t+1),"aria-describedby":B,"data-widths-label":"",onChange:e=>{null===e||le(t,e)||J(t,e)},onRevert:e=>((e,t)=>{T.current.locked||null===t||le(e,t)||J(e,t)})(t,e),onFocus:()=>{ie.current={column:t,share:e,stored:T.current.stored},oe(t,!0)},onBlur:()=>oe(t,!1),className:`absolute inset-0 text-xs font-medium ${x[t%2]} ${re.includes(t)&&!n?"opacity-0":""}`})})})(),t<A-1&&/* @__PURE__ */m("div",{className:"absolute inset-y-0 z-10 w-3 -translate-x-1/2",style:{left:`${se[t]}%`},children:/* @__PURE__ */m(l,{content:R.dragHint,delay:600,className:"relative flex h-full w-full",children:/* @__PURE__ */m("div",{role:"separator",tabIndex:M?-1:0,"aria-orientation":"vertical","aria-label":R.divider(t+1,t+2),"aria-valuenow":O[t],"aria-valuemin":r,"aria-valuemax":O[t]+O[t+1]-r,"aria-valuetext":R.dividerValue(t+1,O[t],t+2,O[t+1]),"aria-disabled":K||void 0,onKeyDown:K?void 0:I(t),onPointerDown:W(t),onPointerMove:X,onPointerUp:q,onPointerCancel:q,onLostPointerCapture:()=>{H.current&&V()},className:"group/widths flex h-full w-full touch-none justify-center rounded-(--radius-control) rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)] "+(K?"cursor-default":"cursor-col-resize"),children:/* @__PURE__ */m("span",{"aria-hidden":"true","data-widths-line":"",className:"h-full rounded-full "+(K?`${b} bg-gray-300`:`bg-blue-600 transition-[width,background-color] duration-(--motion-fast) group-hover/widths:bg-blue-700 ${F===t?"w-1":w}`)})})})})]},t))]}),A>1&&!S&&/* @__PURE__ */m("span",{id:B,className:"sr-only",children:R.hint(A,r)}),A>1&&S&&/* @__PURE__ */m("div",{"data-widths-footer":"",className:"@container",children:/* @__PURE__ */f("div",{className:"flex items-center justify-between gap-2 @max-[264px]:flex-col @max-[264px]:items-end",children:[
|
|
7
|
+
/* @__PURE__ */m("span",{id:B,"data-widths-hint":"",className:"text-2xs leading-tight text-gray-500 @max-[264px]:self-stretch",children:R.hint(A,r)}),
|
|
8
|
+
/* @__PURE__ */m(i,{variant:"secondary",size:"sm",disabled:K,onClick:()=>{K||void 0===C||$(void 0)},className:"shrink-0",children:R.reset})]})})]})}export{k as WidthsBar};
|