efficient-shell 15.6.0 → 15.9.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 +12 -6
- package/dist/{Browser-MBT76EKF.js → Browser-FEZ2X7B5.js} +13 -13
- package/dist/Calculator-MBHZSFJ6.js +29 -0
- package/dist/CurrencyConverter-7FPB7WJE.js +21 -0
- package/dist/{Files-G5VBN3GD.js → Files-DHTF6LGF.js} +61 -61
- package/dist/Notepad-KS37VSPL.js +24 -0
- package/dist/{PdfViewer-AIAVQYZ6.js → PdfViewer-KS2BCFSA.js} +1 -1
- package/dist/PomodoroTimer-TYSJOYDJ.js +91 -0
- package/dist/{Preview-4VKAQ4TY.js → Preview-NXCA3X4S.js} +24 -24
- package/dist/Sidebar-IU4EG3D3.js +44 -0
- package/dist/{Stock-6YYK6VWP.js → Stock-Y74YC25V.js} +6 -6
- package/dist/{Weather-2OU3LEWQ.js → Weather-EO4LYAPA.js} +22 -22
- package/dist/{WorldClock-PYJ4762U.js → WorldClock-3E3KLHSD.js} +7 -7
- package/dist/ai/index.js +35 -35
- package/dist/apps/ImageAnnotator.js +1 -1
- package/dist/apps/index.js +1 -1
- package/dist/bin/browser-check.js +1 -1
- package/dist/bin/media-host-check.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/brand.css +1 -1
- package/dist/charts/FlowChart.js +1 -1
- package/dist/{chunk-LFUXWZV7.js → chunk-2EBHJGMM.js} +1 -1
- package/dist/chunk-37FQVY2O.js +2 -0
- package/dist/chunk-3AUPCKBR.js +1 -0
- package/dist/{chunk-VHBRVW5O.js → chunk-3OK5VZOU.js} +3 -3
- package/dist/{chunk-UYM7562M.js → chunk-43YU7YWL.js} +2 -2
- package/dist/{chunk-XYVFJLAU.js → chunk-452LT77I.js} +1 -1
- package/dist/chunk-4YH7U7WL.js +1 -0
- package/dist/{chunk-KERCZSIA.js → chunk-54WCVNJJ.js} +1 -1
- package/dist/{chunk-OK2J6WSC.js → chunk-6ZQC6XFU.js} +1 -1
- package/dist/{chunk-A3RD7AQ2.js → chunk-7AF5JGRM.js} +1 -1
- package/dist/{chunk-RIA6KKIB.js → chunk-7EPCBDS5.js} +6 -6
- package/dist/{chunk-4NTAZLT3.js → chunk-7KUHILEA.js} +3 -3
- package/dist/{chunk-N3T5BE2T.js → chunk-ATTQTQJI.js} +9 -9
- package/dist/chunk-AYTGYEOI.js +8 -0
- package/dist/{chunk-S6C7X6CR.js → chunk-AZANUXJT.js} +16 -16
- package/dist/{chunk-QSFQTMWV.js → chunk-BGLUOC7W.js} +1 -1
- package/dist/{chunk-D7MRZZVV.js → chunk-BYTQRQ5P.js} +1 -1
- package/dist/{chunk-DVKOVZJ2.js → chunk-DFI5EHSV.js} +12 -12
- package/dist/{chunk-GUUBFQ6L.js → chunk-DYJQIZX2.js} +2 -2
- package/dist/{chunk-KTI4ZJVX.js → chunk-GNB6KUCT.js} +1 -1
- package/dist/chunk-GURLMAZM.js +3 -0
- package/dist/{chunk-NICH2O4C.js → chunk-GYY7GS2I.js} +1 -1
- package/dist/chunk-GZ4AMXEU.js +1 -0
- package/dist/{chunk-GUOAPXUY.js → chunk-GZ57F6PN.js} +4 -4
- package/dist/{chunk-OQAGCYR7.js → chunk-HPDNKHIO.js} +3 -3
- package/dist/chunk-IDH323EU.js +6 -0
- package/dist/{chunk-5OXQ5M5S.js → chunk-JKO4JZPO.js} +1 -1
- package/dist/{chunk-YEDAXZYO.js → chunk-JU6VBLTU.js} +1 -1
- package/dist/{chunk-ZVKUOJNS.js → chunk-JUGRSO5J.js} +1 -1
- package/dist/{chunk-PCNFY6EK.js → chunk-LH7ZKPHJ.js} +12 -12
- package/dist/{chunk-5QHNDAZ6.js → chunk-LLXI57MB.js} +1 -1
- package/dist/chunk-LRASKGEZ.js +4 -0
- package/dist/chunk-LYGIOJ3J.js +1 -0
- package/dist/{chunk-V62FEHS4.js → chunk-MDXZ7YAC.js} +1 -1
- package/dist/{chunk-62UNBUTU.js → chunk-NO5BMPT5.js} +1 -1
- package/dist/{chunk-3AVXNZY5.js → chunk-NPBRNEMR.js} +1 -1
- package/dist/chunk-OHRKENEP.js +69 -0
- package/dist/{chunk-JRKD7SD3.js → chunk-OLXUMB2V.js} +16 -16
- package/dist/chunk-ONUNFTZD.js +11 -0
- package/dist/{chunk-KIIZNION.js → chunk-OX7Q5PPR.js} +5 -5
- package/dist/{chunk-ASNRA3ZL.js → chunk-P7X4PWJJ.js} +1 -1
- package/dist/chunk-PLJB4H3G.js +1 -0
- package/dist/{chunk-UMIRPFQJ.js → chunk-QD7IODP2.js} +1 -1
- package/dist/{chunk-NM7U42KL.js → chunk-QO2CN2ND.js} +8 -8
- package/dist/{chunk-QSOBETAI.js → chunk-QY2DGLCJ.js} +6 -6
- package/dist/chunk-R7OZ2AQD.js +6 -0
- package/dist/{chunk-U7PA4KNZ.js → chunk-RBOGLXMV.js} +8 -8
- package/dist/{chunk-OEWBWKKD.js → chunk-SWH3IEUT.js} +9 -9
- package/dist/{chunk-LGVVXYW7.js → chunk-SYASK4QG.js} +1 -1
- package/dist/{chunk-YXMXATYP.js → chunk-THVE54FN.js} +1 -1
- package/dist/{chunk-TEYG2W7A.js → chunk-TM5NQTFA.js} +2 -2
- package/dist/{chunk-FQ3SYDKI.js → chunk-US7F3NC3.js} +1 -1
- package/dist/{chunk-OZNCUWYB.js → chunk-V77UETV3.js} +1 -1
- package/dist/{chunk-I2NVBDKH.js → chunk-VLT4ZEHT.js} +1 -1
- package/dist/chunk-WUNZBM53.js +28 -0
- package/dist/chunk-XNPCOWOO.js +89 -0
- package/dist/{chunk-EULBBS5L.js → chunk-XOEYCDWT.js} +1 -1
- package/dist/{chunk-QJ3X2PHY.js → chunk-YCA2XXAB.js} +1 -1
- package/dist/{chunk-AKEED2BC.js → chunk-YQKNRT7L.js} +1 -1
- package/dist/{chunk-QYOIS4BN.js → chunk-ZKWAWQ74.js} +3 -3
- package/dist/chunk-ZLB5GRL6.js +1 -0
- package/dist/{chunk-3C2VY2VF.js → chunk-ZV2ZAHZV.js} +1 -1
- package/dist/data/EntityList.js +1 -1
- package/dist/data/ListLoadError.js +1 -1
- package/dist/format/index.d.ts +15 -1
- package/dist/format/index.js +1 -1
- package/dist/forms/BorderInput.js +1 -1
- package/dist/forms/BrandAssetEditor.js +1 -1
- package/dist/forms/Button.d.ts +1 -0
- package/dist/forms/Button.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/DateRangePicker.js +1 -1
- package/dist/forms/IconButton.js +1 -1
- package/dist/forms/IconPicker.js +1 -1
- package/dist/forms/Input.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/MediaUsedInList.js +1 -1
- package/dist/forms/NumericKeypad.js +1 -1
- package/dist/forms/PositionInput.js +1 -1
- package/dist/forms/RenameField.js +1 -1
- package/dist/forms/SearchInput.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/buttonStyles.d.ts +8 -1
- package/dist/forms/buttonStyles.js +1 -1
- package/dist/hooks/index.d.ts +42 -1
- package/dist/hooks/index.js +1 -1
- package/dist/index.d.ts +117 -75
- package/dist/index.js +662 -662
- package/dist/map/index.js +3 -3
- package/dist/motion.css +9 -4
- package/dist/page-tabs/index.js +5 -5
- package/dist/pdf/index.js +1 -1
- package/dist/routine-index.json +1 -1
- package/dist/shell/AppUpdateBanner.js +1 -1
- package/dist/shell/ConfirmDialog.js +1 -1
- package/dist/shell/Dialog.js +1 -1
- package/dist/shell/Drawer.js +1 -1
- package/dist/shell/HelpCenter.js +1 -1
- package/dist/shell/ImageLightbox.js +1 -1
- package/dist/shell/Markdown.js +1 -1
- package/dist/shell/Popover.js +1 -1
- package/dist/shell/SearchableSelect.js +1 -1
- package/dist/shell/discardGuard.js +1 -1
- package/dist/shell/toast.js +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/templates/AuthScreen.js +1 -1
- package/dist/templates/ChatTemplate.js +1 -1
- package/dist/templates/CheckoutTemplate.js +1 -1
- package/dist/templates/DashboardTemplate.js +1 -1
- package/dist/templates/DataTablePage.js +1 -1
- package/dist/templates/EmailTemplate.js +1 -1
- package/dist/templates/ErrorBoundary.js +1 -1
- package/dist/templates/FormLayoutPage.js +1 -1
- package/dist/templates/GalleryTemplate.js +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/value-index.json +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/Calculator-PAMITD4N.js +0 -29
- package/dist/CurrencyConverter-UAZYLLHT.js +0 -21
- package/dist/Notepad-23YBRLDH.js +0 -24
- package/dist/PomodoroTimer-QFF2FTAG.js +0 -91
- package/dist/Sidebar-KAALEIIX.js +0 -44
- package/dist/chunk-345FP3IX.js +0 -4
- package/dist/chunk-5RCKE4X2.js +0 -6
- package/dist/chunk-6ZNJ6JU5.js +0 -28
- package/dist/chunk-A4ROXNUF.js +0 -2
- package/dist/chunk-APFDZ2HG.js +0 -1
- package/dist/chunk-DEV3ZHPP.js +0 -8
- package/dist/chunk-IN36HWJK.js +0 -1
- package/dist/chunk-MQNSKFZY.js +0 -11
- package/dist/chunk-QXEZBS3H.js +0 -6
- package/dist/chunk-R6YVKP6D.js +0 -3
- package/dist/chunk-TDUOBP55.js +0 -69
- package/dist/chunk-UQYNPYF4.js +0 -1
- package/dist/chunk-XRWUNOI3.js +0 -92
- /package/dist/{chunk-TEQ5ZPAL.js → chunk-NQWORKZD.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{resolveColumnShares as e,COLUMN_SHARES_EQUAL as r,COLUMN_SHARE_MIN as t,COLUMN_COUNT_MAX as n}from"./chunk-PLGJOHEG.js";import{InputNumber_default as o}from"./chunk-
|
|
1
|
+
import{resolveColumnShares as e,COLUMN_SHARES_EQUAL as r,COLUMN_SHARE_MIN as t,COLUMN_COUNT_MAX as n}from"./chunk-PLGJOHEG.js";import{InputNumber_default as o}from"./chunk-TM5NQTFA.js";import{textWidth as l}from"./chunk-UVCMV2TL.js";import{Tooltip as i}from"./chunk-CIZAUBWA.js";import{useShellStrings as a}from"./chunk-NRHG4R2Q.js";import{useId as s,useRef as c,useState as u,useEffect as d,Fragment as h}from"react";import{jsxs as f,jsx as m}from"react/jsx-runtime";var p=(e,r,t)=>Math.min(t,Math.max(r,e)),g=e=>e.reduce((e,r)=>e+r,0),v=(e,r)=>e.length===r.length&&e.every((e,t)=>e===r[t]);var b="w-0.5",y=`${b} group-hover/widths:w-1 group-focus-visible/widths:w-1`;var w=["text-blue-700","text-gray-600"];function x({count:x,value:$,onChange:k,label:C,"aria-labelledby":N,readOnly:P=!1,disabled:M=!1,className:R=""}){const j=a().widths,A=s(),z=p(Math.round(x)||1,1,n),B=e($,z),T=B??[...r[z]??[]],S=[...T,100-g(T)],D=P||M,K=c(null),O=c({onChange:k,shown:T,locked:D,n:z,stored:B});O.current={onChange:k,shown:T,locked:D,n:z,stored:B};const H=r=>{const{onChange:t,shown:n,locked:o,n:l}=O.current;if(o)return!1;const i=e(r,l);return!(!i||v(i,n))&&(t(i),!0)},I=(e,r,n)=>{const o=e[r]+e[r+1],l=[...e];l[r]=p(Math.round(n),t,o-t),l[r+1]=o-l[r],H(l.slice(0,-1))&&(ne.current=null)},L=e=>r=>{if(r.altKey||r.ctrlKey||r.metaKey)return;const n=r.shiftKey?10:1,o=S[e]+S[e+1],l="ArrowRight"===r.key?S[e]+n:"ArrowLeft"===r.key?S[e]-n:"PageUp"===r.key?S[e]+10:"PageDown"===r.key?S[e]-10:"Home"===r.key?t:"End"===r.key?o-t:null;null!==l&&(r.preventDefault(),I(S,e,l))},U=c(null),[E,F]=u(null),G=()=>{U.current=null,F(null),document.body.style.removeProperty("cursor"),document.body.style.removeProperty("user-select")};d(()=>G,[]);const V=e=>r=>{if(0!==r.button||D)return;r.preventDefault();const t=K.current?.getBoundingClientRect().width??0;t<=0||(U.current={i:e,x:r.clientX,width:t,from:S,moved:!1,pointer:r.pointerId},F(e),r.currentTarget.setPointerCapture?.(r.pointerId),document.body.style.cursor="col-resize",document.body.style.userSelect="none")},W=e=>{const r=U.current;if(!r)return;if(0===e.buttons)return void G();const t=e.clientX-r.x;if(!r.moved){if(Math.abs(t)<3)return;r.moved=!0}I(r.from,r.i,r.from[r.i]+t/r.width*100)},Q=e=>{const r=U.current;r&&(e.currentTarget.hasPointerCapture?.(r.pointer)&&e.currentTarget.releasePointerCapture(r.pointer),G())},X=(e,r)=>{const{shown:n}=O.current,o=function(e,r,n){const o=e.length,l=[...e];if(o<2)return l;const i=p(Math.round(n),t,100-(o-1)*t);let a=i-l[r];l[r]=i;const s=[...Array.from({length:o-1-r},(e,t)=>r+1+t),...Array.from({length:r},(e,t)=>r-1-t)];if(a<0)return l[s[0]]-=a,l;for(const e of s){if(a<=0)break;const r=Math.min(a,l[e]-t);l[e]-=r,a-=r}return l}([...n,100-g(n)],e,r);return H(o.slice(0,-1))?o:null},[q,J]=u(0);d(()=>{const e=K.current;if(!e||"undefined"==typeof ResizeObserver)return;const r=new ResizeObserver(()=>J(e.getBoundingClientRect().width));return r.observe(e),()=>r.disconnect()},[]);const Z=c(null),[Y,_]=u(null),[ee,re]=u([]),te=(e,r)=>_(t=>r?e:t===e?null:t),ne=c(null),oe=(e,r)=>{const t=ne.current;if(!t||t.column!==e||t.share!==r)return!1;const{onChange:n,locked:o,stored:l}=O.current;var i,a;return o||(i=l,a=t.stored,void 0===i||void 0===a?i===a:v(i,a))||n(t.stored),!0},le=S.join(",");d(()=>{const e=null===Y?[]:function(e,r){if(!e)return[];const t=Array.from(e.querySelectorAll("input[data-widths-label]")),n=t[r]?.getBoundingClientRect();return n&&0!==n.width?null===l("","12px sans-serif")?[]:t.flatMap((e,t)=>{if(t===r)return[];const o=e.getBoundingClientRect(),i=getComputedStyle(e),a=(l(e.value,`${i.fontWeight} ${i.fontSize} ${i.fontFamily}`)??0)/2,s=(o.left+o.right)/2;return s+a>n.left&&s-a<n.right?[t]:[]}):[]}(Z.current,Y);re(r=>v(r,e)?r:e)},[Y,le,q]);const ie=j.hint(z,t),ae=S.slice(0,-1).map((e,r)=>g(S.slice(0,r+1)));/* @__PURE__ */
|
|
2
2
|
return f("div",{role:"group","aria-label":N?void 0:C,"aria-labelledby":N,"aria-describedby":z>1?A:void 0,className:`flex w-full min-w-0 flex-col gap-2 ${M?"opacity-60":""} ${R}`.trim(),children:[
|
|
3
|
-
/* @__PURE__ */f("div",{ref:
|
|
4
|
-
/* @__PURE__ */m("div",{ref:K,"data-widths-track":"",className:"flex h-full w-full overflow-hidden rounded-(--radius-control) bg-surface",children:
|
|
5
|
-
/* @__PURE__ */m("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 rounded-(--radius-control) border border-line-strong"}),z>1&&
|
|
6
|
-
return m("div",{"data-widths-tip":"",className:"absolute inset-y-0 "+(n?"z-20":""),style:{left:`clamp(0px, calc(${l+e/2}% - ${a} / 2), calc(100% - ${a}))`,width:a},children:/* @__PURE__ */m(i,{content:ie,delay:600,describe:!1,className:"absolute inset-0",children:/* @__PURE__ */m(o,{appearance:"bare",value:e,display:()=>(e=>
|
|
3
|
+
/* @__PURE__ */f("div",{ref:Z,"data-widths-bar":"",className:"relative h-8",children:[
|
|
4
|
+
/* @__PURE__ */m("div",{ref:K,"data-widths-track":"",className:"flex h-full w-full overflow-hidden rounded-(--radius-control) bg-surface",children:S.map((e,r)=>/* @__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 ${w[r%2]} ${r%2==0?"bg-accent-tint":""}`,children:1===z&&/* @__PURE__ */m("span",{"data-widths-label":"",children:`${e}%`})},r))}),
|
|
5
|
+
/* @__PURE__ */m("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 rounded-(--radius-control) border border-line-strong"}),z>1&&S.map((e,r)=>/* @__PURE__ */f(h,{children:[(()=>{const n=Y===r,l=g(S.slice(0,r)),a=n?`max(${e}%, 40px)`:`${e}%`;/* @__PURE__ */
|
|
6
|
+
return m("div",{"data-widths-tip":"",className:"absolute inset-y-0 "+(n?"z-20":""),style:{left:`clamp(0px, calc(${l+e/2}% - ${a} / 2), calc(100% - ${a}))`,width:a},children:/* @__PURE__ */m(i,{content:ie,delay:600,describe:!1,className:"absolute inset-0",children:/* @__PURE__ */m(o,{appearance:"bare",value:e,display:()=>(e=>q>0&&q*e/100<36?String(e):`${e}%`)(e),suffix:"%",min:t,max:100-(z-1)*t,step:1,shiftStep:10,precision:0,allowEmpty:!1,reportWhileTyping:!1,readOnly:P,disabled:M,"aria-label":j.column(r+1),"aria-describedby":A,"data-widths-label":"",onChange:e=>{null===e||oe(r,e)||X(r,e)},onRevert:e=>((e,r)=>{O.current.locked||null===r||oe(e,r)||X(e,r)})(r,e),onFocus:()=>{ne.current={column:r,share:e,stored:O.current.stored},te(r,!0)},onBlur:()=>te(r,!1),className:`absolute inset-0 text-xs font-medium ${w[r%2]} ${ee.includes(r)&&!n?"opacity-0":""}`})})})})(),r<z-1&&/* @__PURE__ */m("div",{className:"absolute inset-y-0 z-10 w-3 -translate-x-1/2",style:{left:`${ae[r]}%`},children:/* @__PURE__ */m(i,{content:j.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":j.divider(r+1,r+2),"aria-valuenow":S[r],"aria-valuemin":t,"aria-valuemax":S[r]+S[r+1]-t,"aria-valuetext":j.dividerValue(r+1,S[r],r+2,S[r+1]),"aria-disabled":D||void 0,onKeyDown:D?void 0:L(r),onPointerDown:V(r),onPointerMove:W,onPointerUp:Q,onPointerCancel:Q,onLostPointerCapture:()=>{U.current&&G()},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)] "+(D?"cursor-default":"cursor-col-resize"),children:/* @__PURE__ */m("span",{"aria-hidden":"true","data-widths-line":"",className:"h-full rounded-full "+(D?`${b} bg-gray-300`:`bg-accent-fill transition-[width,background-color] duration-(--motion-fast) group-hover/widths:bg-blue-700 ${E===r?"w-1":y}`)})})})})]},r))]}),z>1&&/* @__PURE__ */m("span",{id:A,className:"sr-only",children:ie})]})}export{x as WidthsBar};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ErrorPage as r}from"./chunk-6NXPOZ6X.js";import{reportBoundaryError as e}from"./chunk-KNUR2UEG.js";import{Button_default as t}from"./chunk-
|
|
1
|
+
import{ErrorPage as r}from"./chunk-6NXPOZ6X.js";import{reportBoundaryError as e}from"./chunk-KNUR2UEG.js";import{Button_default as t}from"./chunk-37FQVY2O.js";import{useShellStrings as s}from"./chunk-NRHG4R2Q.js";import{Component as o}from"react";import{jsxs as i,jsx as a,Fragment as n}from"react/jsx-runtime";function c({pick:r}){/* @__PURE__ */
|
|
2
2
|
return a(n,{children:r(s().errors)})}var l=class extends o{state={error:null};static getDerivedStateFromError(r){return{error:r}}componentDidCatch(r,t){console.error("ErrorBoundary caught an error:",r,t),e(r),this.props.onError?.(r,t)}componentDidUpdate(r){if(!this.state.error)return;const e=r.resetKeys??[],t=this.props.resetKeys??[];(e.length!==t.length||e.some((r,e)=>!Object.is(r,t[e])))&&this.reset()}reset=()=>this.setState({error:null});render(){const{error:e}=this.state;return e?this.props.fallback?this.props.fallback(e,this.reset):
|
|
3
3
|
/* @__PURE__ */i("div",{className:"flex h-full flex-col",children:[
|
|
4
4
|
/* @__PURE__ */a("div",{role:"alert",className:"min-h-0 flex-1",children:/* @__PURE__ */a(r,{code:500,actions:/* @__PURE__ */i(n,{children:[
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r="15.9.0",a=r;export{a as APP_VERSION,r as VERSION};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getFilesStore as e,setSpreadsheetPreview as t}from"./chunk-KGRJSTPM.js";import{setPdfPreview as n}from"./chunk-I4RJAMLJ.js";import{toast_default as i}from"./chunk-
|
|
1
|
+
import{getFilesStore as e,setSpreadsheetPreview as t}from"./chunk-KGRJSTPM.js";import{setPdfPreview as n}from"./chunk-I4RJAMLJ.js";import{toast_default as i}from"./chunk-VLT4ZEHT.js";var o="react-os-shell:preview-opened";async function a(a){const{filePath:r,filename:l,kind:c,onStaged:s,load:d}=a;try{const a=d?d():e().readShortcut?.(r)??null;let f;if(a)f=await a;else{const e=await fetch(`${("undefined"!=typeof window&&window.__REACT_OS_SHELL_FILE_SERVER__||"http://localhost:4000").replace(/\/$/,"")}/api/file?path=${encodeURIComponent(r)}`,{credentials:"include"});if(!e.ok)return i.error(`Download failed (${e.status})`),!1;f=await e.blob()}if("csv"===c){const e=await f.text();t({csv:e,filename:l}),s?.("/spreadsheet")}else{const e=URL.createObjectURL(f);n({url:e,filename:l,kind:c}),s?.("/preview")}return"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent(o,{detail:{filePath:r,filename:l,kind:c}})),!0}catch(e){return i.error(e?.message||"Open failed"),!1}}export{o as PREVIEW_OPENED_EVENT,a as openPreviewFile};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import{copyToClipboard as e,selectionAt as t}from"./chunk-
|
|
2
|
-
return x(a,{title:K,message:P,onRetry:A});if(0===R.length)/* @__PURE__ */return x(w,{children:
|
|
3
|
-
/* @__PURE__ */x("div",{ref:
|
|
1
|
+
import{copyToClipboard as e,selectionAt as t}from"./chunk-452LT77I.js";import{ResizableTable as n}from"./chunk-TXGVSWH6.js";import{useTableNav as r}from"./chunk-ATMJ5ZPK.js";import{escapeHtml as o}from"./chunk-G6DKCCWH.js";import{Checkbox_default as l}from"./chunk-CGZBDI6C.js";import{ListFooter as i}from"./chunk-U73K3ICC.js";import{ListLoadError as a}from"./chunk-SYASK4QG.js";import{LoadingSpinner as c}from"./chunk-4PJFL26P.js";import{PopupMenu as s,PopupMenuLabel as d,PopupMenuItem as h,PopupMenuDivider as m}from"./chunk-P56YLT73.js";import{keepsNativeMenu as u}from"./chunk-5QFPTDQF.js";import{LoadingSpinner as p}from"./chunk-R2VKEMZH.js";import{shellHttp as f}from"./chunk-STKJA4PV.js";import{toast_default as g}from"./chunk-VLT4ZEHT.js";import{useShellStrings as y}from"./chunk-NRHG4R2Q.js";import{useState as k,useRef as b}from"react";import{jsx as x,Fragment as w,jsxs as C}from"react/jsx-runtime";function j(e){return Array.from(e.children).filter(e=>void 0!==e.dataset?.colKey&&"_select"!==e.dataset.colKey)}function v(e){return("string"==typeof e.innerText?e.innerText:e.textContent??"").replace(/\s+/g," ").trim()}function S(S){const{items:R,isLoading:L,emptyState:T,totalCount:N,isError:$,onRetry:A,errorTitle:K,errorMessage:P,tableId:E,columns:M,renderCell:F,getRowId:I=e=>e.id,sort:H,onSort:U,selected:D,setSelected:G,onRowClick:W,onRowHover:J,getRowClassName:O,footerLabel:Q,footerExtra:V,footerExtraAfter:Z,sentinelRef:_,isFetchingNextPage:B,saveDefaultPerms:Y,exportEndpoint:z,exportFilename:X="export.csv",contextActions:q}=S,[ee,te]=k(null),ne=b(null),re=y(),oe=re.entityList,le=e=>{G(t=>{const n=new Set(t),r=I(e);return n.has(r)?n.delete(r):n.add(r),n})},ie=()=>{G(e=>{const t=R.map(I),n=new Set(e);return t.every(t=>e.has(t))?t.forEach(e=>n.delete(e)):t.forEach(e=>n.add(e)),n})},ae=r(R,W,le,ie,(e,t)=>{G(n=>{const r=new Set(n);for(let n=e;n<=t;n++)r.add(I(R[n]));return r})},ne),ce=R.filter(e=>D.has(I(e))),se=()=>{const e=[...ne.current?.querySelectorAll("tr[data-row-idx]")??[]].filter(e=>{const t=R[Number(e.dataset.rowIdx)];return void 0!==t&&D.has(I(t))}),t=e.length?j(e[0]).map(e=>e.dataset.colKey??""):[],n=new Map(M.map(e=>[e.key,e.label]));return{keys:t,header:t.map(e=>n.get(e)??e),body:e.map(e=>j(e).map(v))}},de=()=>{te(null);const{header:t,body:n}=se();if(!n.length)return;const r=[t,...n].map(e=>e.join("\t")).join("\n"),l="<table><thead><tr>"+t.map(e=>`<th>${o(e)}</th>`).join("")+"</tr></thead><tbody>"+n.map(e=>`<tr>${e.map(e=>`<td>${o(e)}</td>`).join("")}</tr>`).join("")+"</tbody></table>";e(oe.copiedRows(n.length),r,l)},he=async()=>{te(null);const e=ce.map(I);if(!e.length||!z)return;const t=new URLSearchParams({ids:e.join(",")}),n=(()=>{const e=new Map(M.map(e=>[e.key,e.exportLabel??e.label]));try{const t=localStorage.getItem(`col-config-${E}`);if(t){const n=JSON.parse(t).filter(t=>!t.hidden&&"_select"!==t.key&&e.has(t.key)).map(t=>`${t.key}|${e.get(t.key)}`);if(n.length)return n.join(",")}}catch{}return M.filter(e=>!e.defaultHidden).map(e=>`${e.key}|${e.exportLabel??e.label}`).join(",")})();n&&t.set("cols",n);const r=z.includes("?")?"&":"?";try{const n=await f.get(`${z}${r}${t}`,{responseType:"blob"}),o=window.URL.createObjectURL(new Blob([n.data],{type:"text/csv"})),l=document.createElement("a");l.href=o,l.download=X,l.click(),window.URL.revokeObjectURL(o);const i=n.headers??{},a=Number(i["x-row-count"]);if("true"===String(i["x-truncated"]))return void g.notify(Number.isFinite(a)?oe.exportTruncated(a,e.length):oe.exportTruncatedUnknown(e.length));g.success(oe.exported(e.length))}catch{g.error(oe.exportFailed)}};if(L)/* @__PURE__ */return x(c,{});if($&&0===R.length)/* @__PURE__ */
|
|
2
|
+
return x(a,{title:K,message:P,onRetry:A});if(0===R.length)/* @__PURE__ */return x(w,{children:T});const me=R.length>0&&ce.length===R.length,ue=ce.length>0&&!me,pe=D.size-ce.length,fe=[{key:"_select",label:"",defaultWidth:52,minWidth:52,headerNode:/* @__PURE__ */x(l,{"aria-label":re.table.selectAll,checked:me,indeterminate:ue,onChange:ie,style:{height:14,width:14}})},...M],ge=/* @__PURE__ */x(i,{selectedCount:ce.length,hiddenSelectedCount:pe,loadedCount:R.length,totalCount:N,label:Q,isFetchingMore:B,extra:V,extraAfter:Z}),ye=_?/* @__PURE__ */C(w,{children:[
|
|
3
|
+
/* @__PURE__ */x("div",{ref:_}),B&&/* @__PURE__ */x(p,{size:"sm",padding:"py-3",label:re.list.loadingMore})]}):void 0;let ke=null;if(ee){const{x:t,y:n,item:r,text:o,firstColumn:l}=ee,i=q?q(ce):[],a=ce.length,c=()=>te(null),u=void 0!==N&&N>R.length;ke=/* @__PURE__ */C(s,{portal:!0,style:{left:t,top:n},onClose:c,minWidth:210,children:[
|
|
4
4
|
/* @__PURE__ */x(d,{children:pe>0?re.list.selectedNotShown(a,pe):re.list.selected(a)}),
|
|
5
5
|
/* @__PURE__ */x(h,{className:"font-medium",onClick:()=>{c(),W(r)},children:oe.open}),
|
|
6
6
|
/* @__PURE__ */x(m,{}),o&&/* @__PURE__ */x(h,{onClick:()=>{c(),e(oe.copiedText,o.text,o.html)},children:oe.copy}),l&&/* @__PURE__ */x(h,{onClick:()=>(t=>{te(null);const{keys:n,body:r}=se(),o=n.indexOf(t.key);o<0||!r.length||e(t.label,r.map(e=>e[o]).join("\n"))})(l),children:oe.copyColumn(l.label)}),
|
|
7
|
-
/* @__PURE__ */x(h,{disabled:0===a,onClick:de,children:oe.copyRows(a)}),
|
|
7
|
+
/* @__PURE__ */x(h,{disabled:0===a,onClick:de,children:oe.copyRows(a)}),z&&/* @__PURE__ */x(h,{onClick:he,children:oe.exportSelected}),i.map((e,t)=>/* @__PURE__ */C("div",{children:[(e.divider||0===t)&&/* @__PURE__ */x(m,{}),
|
|
8
8
|
/* @__PURE__ */x(h,{danger:e.danger,disabled:e.disabled,onClick:()=>{c(),e.onClick(ce)},children:e.label})]},t)),
|
|
9
|
-
/* @__PURE__ */x(m,{}),!me&&/* @__PURE__ */x(h,{onClick:()=>{c(),
|
|
10
|
-
/* @__PURE__ */x(h,{onClick:()=>{c(),
|
|
9
|
+
/* @__PURE__ */x(m,{}),!me&&/* @__PURE__ */x(h,{onClick:()=>{c(),G(e=>/* @__PURE__ */new Set([...e,...R.map(I)]))},children:u?oe.selectAllLoaded(R.length):oe.selectAll}),
|
|
10
|
+
/* @__PURE__ */x(h,{onClick:()=>{c(),G(/* @__PURE__ */new Set)},children:oe.clearSelection}),A&&/* @__PURE__ */x(h,{onClick:()=>{c(),A()},children:oe.refresh})]})}
|
|
11
11
|
/* @__PURE__ */
|
|
12
12
|
return C("div",{className:"flex-1 flex flex-col bg-surface overflow-hidden",children:[
|
|
13
|
-
/* @__PURE__ */x("div",{className:"flex-1 min-h-0 flex flex-col",children:/* @__PURE__ */x(n,{tableId:E,columns:fe,sort:
|
|
14
|
-
return x("tr",{"data-row-idx":r,className:`cursor-pointer ${ae===r?"bg-blue-50 ring-1 ring-inset ring-blue-300":
|
|
13
|
+
/* @__PURE__ */x("div",{className:"flex-1 min-h-0 flex flex-col",children:/* @__PURE__ */x(n,{tableId:E,columns:fe,sort:H,onSort:U,footer:ge,afterBody:ye,saveDefaultPerms:Y,children:e=>/* @__PURE__ */x("tbody",{ref:ne,children:R.map((n,r)=>{const o=I(n);/* @__PURE__ */
|
|
14
|
+
return x("tr",{"data-row-idx":r,className:`cursor-pointer ${ae===r?"bg-blue-50 ring-1 ring-inset ring-blue-300":D.has(o)?"bg-blue-50 hover:bg-blue-100":(r%2==1?"bg-row-stripe ":"")+"hover:bg-line"} ${O?.(n)??""}`,onClick:()=>W(n),onContextMenu:e=>((e,n)=>{if(e.shiftKey||u(e.target))return;e.preventDefault();const r=I(n);D.has(r)||G(/* @__PURE__ */new Set([r]));const o=j(e.currentTarget)[0]?.dataset.colKey,l=o?M.find(e=>e.key===o)?.label:void 0;te({x:e.clientX,y:e.clientY,item:n,text:t(e.target),firstColumn:o&&l?{key:o,label:l}:null})})(e,n),onMouseEnter:J?()=>J(n):void 0,children:e.map(e=>/* @__PURE__ */x("td",{"data-col-key":e.key,className:"px-4 py-3 whitespace-nowrap text-sm overflow-hidden",children:"_select"===e.key?/* @__PURE__ */x(l,{"aria-label":re.table.selectRow,checked:D.has(o),onChange:()=>le(n),onClick:e=>e.stopPropagation(),style:{height:14,width:14}}):F(n,e.key)},e.key))},o)})})})}),ke]})}export{S as EntityList};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{writeClipboard as e}from"./chunk-
|
|
1
|
+
import{writeClipboard as e}from"./chunk-452LT77I.js";import{IconButton_default as r}from"./chunk-4YH7U7WL.js";import{Icon as t}from"./chunk-ISVODSRP.js";import{toast_default as n}from"./chunk-VLT4ZEHT.js";import{useShellStrings as a}from"./chunk-NRHG4R2Q.js";import{useState as i,useRef as o,useEffect as c,useCallback as l}from"react";import{jsxs as m,jsx as s,Fragment as d}from"react/jsx-runtime";var u={bordered:"border border-gray-300 bg-white",flat:"bg-gray-100"},p={sm:{box:"gap-2 px-3 py-1 text-xs",button:"-my-1"},md:{box:"gap-2 px-3 min-h-8 py-1 text-sm",button:"-my-0.5"}};function b(){/* @__PURE__ */
|
|
2
2
|
return s(t,{name:"copy",className:"h-4 w-4","aria-hidden":"true"})}function h(){/* @__PURE__ */
|
|
3
|
-
return s(t,{name:"check",className:"h-4 w-4 text-green-600","aria-hidden":"true"})}function y({value:t,children:y,symbol:f,label:x,size:g="md",variant:
|
|
4
|
-
return m("div",{id:
|
|
5
|
-
/* @__PURE__ */s("span",{className:"min-w-0 font-mono text-gray-800 "+(w?"whitespace-pre-wrap break-all":"truncate"),title:w?void 0:t,children:y??t}),!
|
|
6
|
-
/* @__PURE__ */s(r,{id:j,"aria-label":x?
|
|
7
|
-
/* @__PURE__ */s("span",{"aria-live":"polite",className:"sr-only",children:
|
|
3
|
+
return s(t,{name:"check",className:"h-4 w-4 text-green-600","aria-hidden":"true"})}function y({value:t,children:y,symbol:f,label:x,size:g="md",variant:k="bordered",hideCopyButton:N=!1,onCopy:v,multiline:w=!1,id:j,"aria-describedby":T,className:L=""}){const[C,H]=i(!1),R=o(null),B=a().copy;c(()=>()=>{R.current&&clearTimeout(R.current)},[]);const I=l(async()=>{await e(t)?(H(!0),R.current&&clearTimeout(R.current),R.current=setTimeout(()=>{H(!1),R.current=null},2e3),v?.(t)):n.error(B.failed)},[t,v,B]),{box:S,button:V}=p[g],z=!N;/* @__PURE__ */
|
|
4
|
+
return m("div",{id:z?void 0:j,"aria-describedby":z?void 0:T,className:["inline-flex max-w-full items-center rounded-md",u[k],S,L].filter(Boolean).join(" "),children:[null!=f&&""!==f&&/* @__PURE__ */s("span",{"aria-hidden":"true",className:"shrink-0 select-none font-mono text-gray-400",children:f}),
|
|
5
|
+
/* @__PURE__ */s("span",{className:"min-w-0 font-mono text-gray-800 "+(w?"whitespace-pre-wrap break-all":"truncate"),title:w?void 0:t,children:y??t}),!N&&/* @__PURE__ */m(d,{children:[
|
|
6
|
+
/* @__PURE__ */s(r,{id:j,"aria-label":x?B.copyLabel(x):B.copy,"aria-describedby":T,onClick:I,className:`${V} text-gray-400`,children:/* @__PURE__ */s(C?h:b,{})}),
|
|
7
|
+
/* @__PURE__ */s("span",{"aria-live":"polite",className:"sr-only",children:C?B.copied:""})]})]})}export{y as Snippet};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{useOverlayTarget as e,usePopupAnchor as r,usePanelPosition as l,usePopupLevel as t,usePopupLevelBindings as i,windowScrimStyle as a,OverlayLayerProvider as o,scrimHasCorners as n,popupLayerStyle as s,POPUP_GUTTER as d}from"./chunk-CJ4OEY3T.js";import{CloseButton as c}from"./chunk-LLXI57MB.js";import{useDiscardGuard as m}from"./chunk-NQWORKZD.js";import{dialogA11y as p}from"./chunk-VWGWZY7A.js";import{useDismissPopupsOnOpen as u}from"./chunk-DBQNYJZ6.js";import{useFocusTrap as f,useScrollLock as h}from"./chunk-DWGYC7OD.js";import{HEADING_TEXT as x,DESCRIPTION_TEXT as v,PANEL_SURFACE as b}from"./chunk-BWJZTHZ6.js";import{createShellPortal as w}from"./chunk-5QRHQCRG.js";import{useHydrated as y}from"./chunk-KEFNQEXZ.js";import{registerModalEscapeInterceptor as $}from"./chunk-TWVUQUUD.js";import{useShellStrings as g}from"./chunk-NRHG4R2Q.js";import{useRef as N,useId as j,useState as k,useEffect as C}from"react";import{jsxs as Q,Fragment as W,jsx as Z}from"react/jsx-runtime";var B=`calc(100% - ${2*d}px)`,D="grid grid-cols-[minmax(0,1fr)_auto]",E="bg-black/30 backdrop-blur-sm",R={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-4xl","2xl":"max-w-6xl",full:"max-w-none"};function G({open:d,onClose:G,title:H,description:T,role:Y="dialog",children:J,footer:O,headerActions:U,blocking:_=!1,size:A="md",aside:F=!1,dirty:I=!1,initialFocus:K,"aria-label":L,"aria-labelledby":V,"aria-describedby":X,className:z=""}){const M=N(null),q=j(),P=j(),S=!_,ee="full"===A,re=ee||null!=U,le=Boolean(H||T),te=j();g().dialog;const ie=e(y()),[ae,oe]=k(null),ne=m({open:d,dirty:I,onClose:G,title:H,layer:ae}),se=N(null),de=r(d&&null!==ie,se),ce=l(de,M),me=t(d&&null!==ie,se),pe=i(me,ae),ue=a(me),fe=null!==me.host;if(u(d),f(M,d&&null!==ie,K,pe),h(d),C(()=>{if(d)return $(()=>!pe.current?.(document.activeElement)&&(_||ne(),!0),()=>M.current)},[d,_,ne,pe]),!d||!ie)return null;/* @__PURE__ */
|
|
2
|
+
return Q(W,{children:[/* @__PURE__ */Z("span",{ref:se,hidden:!0,"data-popup-anchor":""}),w(
|
|
3
|
+
/* @__PURE__ */Z(o,{value:ae,children:/* @__PURE__ */Q("div",{ref:oe,className:"fixed inset-0"+(F?" pointer-events-none opacity-0":fe?" pointer-events-none":""),style:s(me),role:"presentation","data-overlay-layer":"","data-aside":F?"":void 0,children:[!fe&&/* @__PURE__ */Z("div",{className:`fixed inset-0 ${E}`,"aria-hidden":"true","data-popup-scrim":"system"}),ue&&/* @__PURE__ */Z("div",{className:`fixed ${E}${F?"":" pointer-events-auto"}${n(me)?" rounded-(--radius-window)":""}`,style:ue,onClick:_?void 0:ne,"aria-hidden":"true","data-popup-scrim":"window"}),
|
|
4
|
+
/* @__PURE__ */Z("div",{className:de?"fixed inset-0":"fixed inset-0 flex items-center justify-center p-4",onClick:_||fe?void 0:e=>{e.target===e.currentTarget&&ne()},children:/* @__PURE__ */Q("div",{ref:M,"data-popup-panel":"",style:de?{left:ce?.left??0,top:ce?.top??0,visibility:ce?void 0:"hidden",width:B,[ee?"height":"maxHeight"]:B}:void 0,...p({role:Y,modal:!0,titleId:H?te:void 0,labelledBy:V,label:L}),"aria-describedby":X??(T?P:J?q:void 0),className:(ee?`${de?"absolute":"relative h-full w-full max-h-full"} ${R[A]} ${D} grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden rounded-(--radius-popup) ${b}`:`${de?"absolute":"relative max-h-full w-full"} ${R[A]}${re?` ${D} content-start gap-x-2`:""} overflow-y-auto overscroll-contain rounded-(--radius-card) ${b} p-6`)+`${fe&&!F?" pointer-events-auto":""} ${z}`.trimEnd(),children:[ee?le&&
|
|
5
|
+
/* @__PURE__ */Q("div",{className:"col-start-1 row-start-1 flex min-h-(--row-height-window-bar) flex-col justify-center border-b border-line py-2 pl-6 pr-4",children:[H&&/* @__PURE__ */Z("h2",{id:te,className:x,children:H}),T&&/* @__PURE__ */Z("p",{id:P,className:`${H?"mt-1 ":""}${v}`,children:T})]}):H&&/* @__PURE__ */Z("h2",{id:te,className:`${re?"col-start-1 row-start-1 ":S?"pr-8 ":""}${x}`,children:H}),!ee&&T&&/* @__PURE__ */Z("p",{id:P,className:`${re?"col-start-1 ":""}${H?"mt-1":S&&!re?"pr-8":""} ${v}`.trim(),children:T}),J&&/* @__PURE__ */Z("div",{id:q,className:ee?"col-span-2 row-start-2 min-h-0 overflow-auto":(re?"col-span-2 ":"")+"mt-2 text-sm text-gray-600",children:J}),O&&/* @__PURE__ */Z("div",{className:ee?"col-span-2 row-start-3 flex flex-wrap justify-end gap-3 border-t border-line px-6 py-4":(re?"col-span-2 ":"")+"mt-6 flex flex-wrap justify-end gap-3",children:O}),re?
|
|
6
|
+
/* @__PURE__ */Q("div",{className:"col-start-2 row-start-1 flex items-center gap-1 "+(ee?(le?"border-b border-line ":"")+"pr-3":"-mr-3 -mt-3 self-start"),children:[U,S&&/* @__PURE__ */Z(c,{onClose:ne})]}):S&&/* @__PURE__ */Z(c,{onClose:ne,className:"absolute right-3 top-3"})]})})]})}),ie)]})}export{G as Dialog};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Markdown as e}from"./chunk-
|
|
1
|
+
import{Markdown as e}from"./chunk-NPBRNEMR.js";import{PLACEHOLDER_INK as t}from"./chunk-AYZY3YNC.js";import{Icon as l}from"./chunk-ISVODSRP.js";import{LoadingSpinner as r}from"./chunk-R2VKEMZH.js";import{useShellStrings as s}from"./chunk-NRHG4R2Q.js";import{useState as a,useMemo as n}from"react";import{jsxs as i,jsx as o,Fragment as c}from"react/jsx-runtime";var d=({open:e})=>/* @__PURE__ */o(l,{name:"chevron-right",look:"mini",className:"h-3.5 w-3.5 shrink-0 transition-transform "+(e?"rotate-90":""),"aria-hidden":"true"});function h({docs:h,loading:m=!1,categoryOrder:p,canEdit:u=!1,onNew:g,onEdit:x,renderBody:f,emptyMessage:b}){const y=s(),[N,v]=a(""),[w,k]=a(null),[C,j]=a({}),R=N.trim().toLowerCase(),M=n(()=>{const e=/* @__PURE__ */new Map;for(const t of h){let l=e.get(t.category);l||(l={key:t.category,label:t.category_label||t.category,docs:[]},e.set(t.category,l)),l.docs.push(t)}if(!p?.length)return[...e.values()];const t=new Map(p.map((e,t)=>[e,t]));return[...e.values()].sort((e,l)=>(t.get(e.key)??1/0)-(t.get(l.key)??1/0))},[h,p]),_=e=>!R||e.title.toLowerCase().includes(R)||e.body.toLowerCase().includes(R)||e.category_label.toLowerCase().includes(R),E=n(()=>M.map(e=>({...e,docs:e.docs.filter(_)})).filter(e=>e.docs.length>0),[M,R]),L=n(()=>E.flatMap(e=>e.docs),[E]),A=(w?L.find(e=>e.slug===w):void 0)??L[0]??null,B=e=>!!R||(C[e]??e===A?.category);/* @__PURE__ */
|
|
2
2
|
return i("div",{className:"flex h-full gap-4 px-4 py-3 min-h-0",children:[
|
|
3
3
|
/* @__PURE__ */i("aside",{className:"w-64 shrink-0 flex flex-col bg-white rounded-lg shadow overflow-hidden",children:[
|
|
4
4
|
/* @__PURE__ */i("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[
|
|
@@ -6,16 +6,16 @@ return i("div",{className:"flex h-full gap-4 px-4 py-3 min-h-0",children:[
|
|
|
6
6
|
/* @__PURE__ */o("div",{className:"px-3 py-2 border-b border-line-subtle shrink-0",children:/* @__PURE__ */i("div",{className:"relative",children:[
|
|
7
7
|
/* @__PURE__ */o(l,{name:"search",look:"mini",className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 ${t}`,"aria-hidden":"true"}),
|
|
8
8
|
/* @__PURE__ */o("input",{type:"text",value:N,onChange:e=>v(e.target.value),placeholder:y.help.searchPlaceholder,className:"w-full rounded-md border border-line-strong bg-surface h-8 pl-8 pr-2 text-sm shadow-sm focus:border-blue-500 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-accent)]"})]})}),
|
|
9
|
-
/* @__PURE__ */o("div",{className:"flex-1 overflow-y-auto py-1",children:m?/* @__PURE__ */o(r,{size:"sm",padding:"py-6",label:y.help.loading}):0===
|
|
9
|
+
/* @__PURE__ */o("div",{className:"flex-1 overflow-y-auto py-1",children:m?/* @__PURE__ */o(r,{size:"sm",padding:"py-6",label:y.help.loading}):0===E.length?/* @__PURE__ */o("p",{className:"px-3 py-6 text-center text-xs text-gray-500",children:R?y.help.noResults:b??y.help.empty}):E.map(e=>{const t=B(e.key);/* @__PURE__ */
|
|
10
10
|
return i("div",{className:"py-0.5",children:[
|
|
11
|
-
/* @__PURE__ */i("button",{type:"button",onClick:()=>{return t=e.key,j(e=>({...e,[t]:!
|
|
11
|
+
/* @__PURE__ */i("button",{type:"button",onClick:()=>{return t=e.key,j(e=>({...e,[t]:!B(t)}));var t},className:"w-full flex items-center gap-2 h-8 px-3 text-left text-3xs font-semibold uppercase tracking-wide text-ink-faintest hover:text-gray-600",children:[
|
|
12
12
|
/* @__PURE__ */o(d,{open:t}),
|
|
13
|
-
/* @__PURE__ */o("span",{className:"truncate",children:e.label})]}),t&&e.docs.map(e=>{const t=
|
|
13
|
+
/* @__PURE__ */o("span",{className:"truncate",children:e.label})]}),t&&e.docs.map(e=>{const t=A?.slug===e.slug;/* @__PURE__ */
|
|
14
14
|
return i("button",{type:"button",onClick:()=>k(e.slug),className:"w-full text-left pl-8 pr-3 min-h-(--row-height-menu) py-2 text-sm flex items-center gap-2 transition-colors "+(t?"bg-blue-50 text-blue-700 font-medium":"text-gray-700 hover:bg-gray-50"),children:[
|
|
15
15
|
/* @__PURE__ */o("span",{className:"truncate",children:e.title}),!1===e.is_published&&/* @__PURE__ */o("span",{className:"ml-auto shrink-0 text-2xs text-amber-600",children:y.help.draft})]},e.slug)})]},e.key)})})]}),
|
|
16
|
-
/* @__PURE__ */o("main",{className:"flex-1 min-w-0 bg-white rounded-lg shadow overflow-hidden flex flex-col",children:
|
|
16
|
+
/* @__PURE__ */o("main",{className:"flex-1 min-w-0 bg-white rounded-lg shadow overflow-hidden flex flex-col",children:A?/* @__PURE__ */i(c,{children:[
|
|
17
17
|
/* @__PURE__ */i("div",{className:"flex items-start justify-between gap-4 px-5 py-3 border-b border-gray-200 bg-gray-50 shrink-0",children:[
|
|
18
18
|
/* @__PURE__ */i("div",{className:"min-w-0",children:[
|
|
19
|
-
/* @__PURE__ */o("h1",{className:"text-lg font-semibold text-gray-900 truncate",children:
|
|
20
|
-
/* @__PURE__ */i("p",{className:"text-xs text-gray-500 mt-0.5",children:[
|
|
21
|
-
/* @__PURE__ */o("div",{className:"flex-1 overflow-auto px-5 py-4",children:f?f(
|
|
19
|
+
/* @__PURE__ */o("h1",{className:"text-lg font-semibold text-gray-900 truncate",children:A.title}),
|
|
20
|
+
/* @__PURE__ */i("p",{className:"text-xs text-gray-500 mt-0.5",children:[A.category_label,!1===A.is_published&&/* @__PURE__ */i("span",{className:"ml-2 text-amber-600",children:["· ",y.help.draft]})]})]}),u&&x&&/* @__PURE__ */o("button",{type:"button",onClick:()=>x(A),className:"shrink-0 text-sm text-blue-600 hover:underline",children:y.help.edit})]}),
|
|
21
|
+
/* @__PURE__ */o("div",{className:"flex-1 overflow-auto px-5 py-4",children:f?f(A):A.body?/* @__PURE__ */o(e,{children:A.body}):/* @__PURE__ */o("p",{className:"text-sm text-gray-500 italic",children:y.help.noBody})})]}):/* @__PURE__ */o("div",{className:"flex-1 flex items-center justify-center px-6 text-center",children:m?/* @__PURE__ */o(r,{size:"sm",padding:"",label:y.help.loading}):/* @__PURE__ */o("p",{className:"text-sm text-ink-faint",children:y.help.pickArticle})})})]})}export{h as HelpCenter};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import{Icon as e}from"./chunk-ISVODSRP.js";import{LoadingSpinner as t}from"./chunk-R2VKEMZH.js";import{createShellPortal as n}from"./chunk-5QRHQCRG.js";import{fitBoxScale as r,fitScale as a}from"./chunk-M6UKCZHT.js";import{toast_default as o}from"./chunk-
|
|
2
|
-
/* @__PURE__ */m("div",{className:"flex shrink-0 flex-wrap items-center gap-1 border-b border-gray-200 bg-gray-50 px-3 py-2 text-xs",children:e})}"undefined"==typeof window||h.GlobalWorkerOptions.workerSrc||(h.GlobalWorkerOptions.workerSrc=`https://unpkg.com/pdfjs-dist@${h.version}/build/pdf.worker.min.mjs`);var y={"jbig2.wasm":new URL("pdfjs-dist/wasm/jbig2.wasm",import.meta.url).href,"openjpeg.wasm":new URL("pdfjs-dist/wasm/openjpeg.wasm",import.meta.url).href},v=class{async fetch({kind:e,filename:t}){if("wasmUrl"!==e)throw new Error(`Ensure that the \`${e}\` API parameter is provided.`);const n=y[t];if(!n)throw new Error(`No bundled pdf.js wasm module for "${t}".`);const r=await fetch(n);if(!r.ok)throw new Error(`Unable to load wasm data at: ${n}`);const a=new Uint8Array(await r.arrayBuffer());if(!function(e){return e.length>=4&&0===e[0]&&97===e[1]&&115===e[2]&&109===e[3]}(a))throw f(n,t,a);return a}};function b(e){const t=e||("undefined"!=typeof window?window.__REACT_OS_SHELL_PDF_WASM__:void 0);return"string"==typeof t&&t?{wasmUrl:t.endsWith("/")?t:`${t}/`}:{BinaryDataFactory:v}}var x=[50,75,100,125,150,200,300,400];function k(e,t,n){const o={width:t.width-40,height:t.height-40};if(o.width<=0||"page"===e&&o.height<=0)return.3;const i="page"===e?r(o,n):a(o.width,n.width);return Math.min(Math.max(i,.3),4)}function C({url:n,filename:r,fit:a="width",onDownload:s,onEmail:l,workerSrc:f,wasmUrl:g}){const y=i().pdf,v=c(null),C=c(null),N=c(null),[j,
|
|
1
|
+
import{Icon as e}from"./chunk-ISVODSRP.js";import{LoadingSpinner as t}from"./chunk-R2VKEMZH.js";import{createShellPortal as n}from"./chunk-5QRHQCRG.js";import{fitBoxScale as r,fitScale as a}from"./chunk-M6UKCZHT.js";import{toast_default as o}from"./chunk-VLT4ZEHT.js";import{useShellStrings as i}from"./chunk-NRHG4R2Q.js";import{createContext as s,useContext as l,useRef as c,useState as d,useEffect as u}from"react";import*as h from"pdfjs-dist";import{jsx as m,jsxs as p}from"react/jsx-runtime";function f(e,t,n){return new Error(`The response for ${e} is not a WebAssembly module (got ${function(e){if(0===e.length)return"an empty response";const t=Array.from(e.subarray(0,24)).map(e=>e>=32&&e<127?String.fromCharCode(e):".").join("");return`${e.length} bytes starting "${t}"`}(n)}). The bundler did not emit "${t}" as an asset, and the host answered with a fallback page instead of a 404. Serve pdfjs-dist/wasm/ yourself and point window.__REACT_OS_SHELL_PDF_WASM__ at it.`)}var g=s(null);function w({children:e}){const t=l(g);return t?n(e,t):
|
|
2
|
+
/* @__PURE__ */m("div",{className:"flex shrink-0 flex-wrap items-center gap-1 border-b border-gray-200 bg-gray-50 px-3 py-2 text-xs",children:e})}"undefined"==typeof window||h.GlobalWorkerOptions.workerSrc||(h.GlobalWorkerOptions.workerSrc=`https://unpkg.com/pdfjs-dist@${h.version}/build/pdf.worker.min.mjs`);var y={"jbig2.wasm":new URL("pdfjs-dist/wasm/jbig2.wasm",import.meta.url).href,"openjpeg.wasm":new URL("pdfjs-dist/wasm/openjpeg.wasm",import.meta.url).href},v=class{async fetch({kind:e,filename:t}){if("wasmUrl"!==e)throw new Error(`Ensure that the \`${e}\` API parameter is provided.`);const n=y[t];if(!n)throw new Error(`No bundled pdf.js wasm module for "${t}".`);const r=await fetch(n);if(!r.ok)throw new Error(`Unable to load wasm data at: ${n}`);const a=new Uint8Array(await r.arrayBuffer());if(!function(e){return e.length>=4&&0===e[0]&&97===e[1]&&115===e[2]&&109===e[3]}(a))throw f(n,t,a);return a}};function b(e){const t=e||("undefined"!=typeof window?window.__REACT_OS_SHELL_PDF_WASM__:void 0);return"string"==typeof t&&t?{wasmUrl:t.endsWith("/")?t:`${t}/`}:{BinaryDataFactory:v}}var x=[50,75,100,125,150,200,300,400];function k(e,t,n){const o={width:t.width-40,height:t.height-40};if(o.width<=0||"page"===e&&o.height<=0)return.3;const i="page"===e?r(o,n):a(o.width,n.width);return Math.min(Math.max(i,.3),4)}function C({url:n,filename:r,fit:a="width",onDownload:s,onEmail:l,workerSrc:f,wasmUrl:g}){const y=i().pdf,v=c(null),C=c(null),N=c(null),[j,E]=d(null),[M,P]=d(1),[z,_]=d(0),[D,S]=d(1),[T,L]=d(!0),[W,$]=d(!0),H=c(y.loadFailed);H.current=y.loadFailed,u(()=>{let e=!1;return $(!0),P(1),f&&(h.GlobalWorkerOptions.workerSrc=f),h.getDocument({url:n,...b(g)}).promise.then(t=>{e||(E(t),_(t.numPages),$(!1))}).catch(()=>{e||(o.error(H.current),$(!1))}),()=>{e=!0}},[n,f,g]),u(()=>{if(!j||!T||!N.current)return;const e=()=>{const e=N.current;e&&j.getPage(M).then(t=>{if(!N.current)return;const n=t.getViewport({scale:1}),r=k(a,{width:e.clientWidth,height:e.clientHeight},{width:n.width,height:n.height});S(e=>Math.abs(e-r)<.005?e:r)})};e();const t=new ResizeObserver(e);return t.observe(N.current),()=>t.disconnect()},[j,M,T,a]),u(()=>{if(!j||!v.current)return;let e=!1,t=null,n=null;return j.getPage(M).then(r=>{if(e||!v.current)return;const a=r.getViewport({scale:D}),o=v.current;o.width=a.width,o.height=a.height,o.style.width=`${a.width}px`,o.style.height=`${a.height}px`;const i=o.getContext("2d");t=r.render({canvas:o,canvasContext:i,viewport:a}),t.promise.catch(()=>{});const s=C.current;s&&(s.replaceChildren(),s.style.setProperty("--total-scale-factor",String(a.scale)),n=new h.TextLayer({textContentSource:r.streamTextContent(),container:s,viewport:a}),n.render().then(()=>{if(e)return;const t=document.createElement("div");t.className="endOfContent",s.append(t)}).catch(()=>{}))}),()=>{e=!0,t?.cancel(),n?.cancel()}},[j,M,D]),u(()=>{const e=()=>C.current?.classList.remove("selecting");return window.addEventListener("pointerup",e),()=>window.removeEventListener("pointerup",e)},[]);const O="page"===a?y.fitPage:y.fitWidth,R="px-2 py-1 rounded hover:bg-gray-200 transition-colors text-gray-600 flex items-center gap-1";/* @__PURE__ */
|
|
3
3
|
return p("div",{className:"flex flex-col h-full",children:[
|
|
4
4
|
/* @__PURE__ */p(w,{children:[
|
|
5
|
-
/* @__PURE__ */m("button",{type:"button","aria-label":y.previousPage,onClick:()=>P(e=>Math.max(1,e-1)),disabled:
|
|
6
|
-
/* @__PURE__ */m("span",{className:"text-gray-600 font-medium tabular-nums whitespace-nowrap",children:y.pageOf(
|
|
7
|
-
/* @__PURE__ */m("button",{type:"button","aria-label":y.nextPage,onClick:()=>P(e=>Math.min(z,e+1)),disabled:
|
|
5
|
+
/* @__PURE__ */m("button",{type:"button","aria-label":y.previousPage,onClick:()=>P(e=>Math.max(1,e-1)),disabled:M<=1,className:"px-1 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",children:/* @__PURE__ */m(e,{name:"chevron-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
|
|
6
|
+
/* @__PURE__ */m("span",{className:"text-gray-600 font-medium tabular-nums whitespace-nowrap",children:y.pageOf(M,z)}),
|
|
7
|
+
/* @__PURE__ */m("button",{type:"button","aria-label":y.nextPage,onClick:()=>P(e=>Math.min(z,e+1)),disabled:M>=z,className:"px-1 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",children:/* @__PURE__ */m(e,{name:"chevron-right",className:"h-3.5 w-3.5",strokeWidth:2})}),
|
|
8
8
|
/* @__PURE__ */m("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
9
9
|
/* @__PURE__ */m("button",{type:"button","aria-label":y.zoomOut,title:y.zoomOut,onClick:()=>{L(!1),S(e=>Math.max(.3,Math.round(100*(e-.25))/100))},className:R,children:/* @__PURE__ */m("span",{"aria-hidden":"true",children:"−"})}),
|
|
10
|
-
/* @__PURE__ */p("select",{value:
|
|
11
|
-
/* @__PURE__ */m("option",{value:"fit",children:O}),!
|
|
10
|
+
/* @__PURE__ */p("select",{value:T?"fit":x.includes(Math.round(100*D))?Math.round(100*D):"custom",onChange:e=>{const t=e.target.value;"fit"!==t?"custom"!==t&&(L(!1),S(Number(t)/100)):L(!0)},className:"bg-transparent hover:bg-gray-200 rounded px-1 py-1 text-gray-600 tabular-nums cursor-pointer focus:outline-none focus:ring-1 focus:ring-blue-400","aria-label":y.zoom,title:y.zoom,children:[
|
|
11
|
+
/* @__PURE__ */m("option",{value:"fit",children:O}),!T&&!x.includes(Math.round(100*D))&&/* @__PURE__ */p("option",{value:"custom",children:[Math.round(100*D),"%"]}),x.map(e=>/* @__PURE__ */p("option",{value:e,children:[e,"%"]},e))]}),
|
|
12
12
|
/* @__PURE__ */m("button",{type:"button","aria-label":y.zoomIn,title:y.zoomIn,onClick:()=>{L(!1),S(e=>Math.min(4,Math.round(100*(e+.25))/100))},className:R,children:/* @__PURE__ */m("span",{"aria-hidden":"true",children:"+"})}),
|
|
13
|
-
/* @__PURE__ */m("button",{type:"button",onClick:()=>L(!0),"aria-pressed":
|
|
13
|
+
/* @__PURE__ */m("button",{type:"button",onClick:()=>L(!0),"aria-pressed":T,className:R+(T?" bg-gray-200 text-gray-900":""),title:y.fitHint,children:y.fit}),
|
|
14
14
|
/* @__PURE__ */m("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
15
15
|
/* @__PURE__ */p("button",{type:"button",onClick:()=>{if(!j)return;const e=window.open("","_blank");if(!e)return void o.error(y.allowPopups);const t=[];for(let e=1;e<=z;e++)t.push(j.getPage(e).then(e=>{const t=e.getViewport({scale:2}),n=document.createElement("canvas");return n.width=t.width,n.height=t.height,e.render({canvas:n,canvasContext:n.getContext("2d"),viewport:t}).promise.then(()=>n.toDataURL())}));Promise.all(t).then(t=>{var n;e.document.write(`<html><head><title>${n=r,n.replace(/[&<>"]/g,e=>({"&":"&","<":"<",">":">",'"':"""}[e]))}</title><style>@media print{body{margin:0}img{width:100%;page-break-after:always}}</style></head><body>`),e.document.write(t.map(e=>`<img src="${e}"/>`).join("")),e.document.write("</body></html>"),e.document.close(),setTimeout(()=>{e.print(),e.close()},300)})},className:R,children:[
|
|
16
16
|
/* @__PURE__ */m(e,{name:"print",className:"h-3.5 w-3.5",strokeWidth:1.5}),y.print]}),
|
|
17
17
|
/* @__PURE__ */p("button",{type:"button",onClick:s??(()=>{const e=document.createElement("a");e.href=n,e.download=r,e.click()}),className:R,children:[
|
|
18
18
|
/* @__PURE__ */m(e,{name:"download",className:"h-3.5 w-3.5",strokeWidth:1.5}),y.download]}),l&&/* @__PURE__ */p("button",{type:"button",onClick:l,className:R,children:[
|
|
19
19
|
/* @__PURE__ */m(e,{name:"email",className:"h-3.5 w-3.5",strokeWidth:1.5}),y.email]})]}),
|
|
20
|
-
/* @__PURE__ */m("div",{ref:N,className:"flex-1 overflow-auto bg-gray-100 outline-none",tabIndex:0,onWheel:e=>{if(!j)return;if(e.ctrlKey||e.metaKey)return;const t=N.current;if(!t)return;const n=t.scrollTop<=0,r=t.scrollTop+t.clientHeight>=t.scrollHeight-1;e.deltaY>0&&r&&
|
|
20
|
+
/* @__PURE__ */m("div",{ref:N,className:"flex-1 overflow-auto bg-gray-100 outline-none",tabIndex:0,onWheel:e=>{if(!j)return;if(e.ctrlKey||e.metaKey)return;const t=N.current;if(!t)return;const n=t.scrollTop<=0,r=t.scrollTop+t.clientHeight>=t.scrollHeight-1;e.deltaY>0&&r&&M<z?(e.preventDefault(),P(e=>Math.min(z,e+1)),requestAnimationFrame(()=>{N.current&&(N.current.scrollTop=0)})):e.deltaY<0&&n&&M>1&&(e.preventDefault(),P(e=>Math.max(1,e-1)),requestAnimationFrame(()=>{N.current&&(N.current.scrollTop=N.current.scrollHeight)}))},onKeyDown:e=>{if(!j)return;if(e.defaultPrevented)return;const t=(document.activeElement?.tagName||"").toLowerCase();"input"===t||"textarea"===t||document.activeElement?.isContentEditable||("PageDown"===e.key||"ArrowRight"===e.key?M<z&&(e.preventDefault(),P(e=>Math.min(z,e+1))):"PageUp"===e.key||"ArrowLeft"===e.key?M>1&&(e.preventDefault(),P(e=>Math.max(1,e-1))):"Home"===e.key?(e.preventDefault(),P(1)):"End"===e.key&&(e.preventDefault(),P(z)))},children:W?/* @__PURE__ */m(t,{size:"sm",padding:"",className:"h-full",label:y.loading}):/* @__PURE__ */p("div",{className:"min-h-full flex items-center justify-center p-4",children:[
|
|
21
21
|
/* @__PURE__ */m("style",{children:'\n.preview-pdf-textlayer {\n position: absolute;\n inset: 0;\n overflow: clip;\n line-height: 1;\n text-align: initial;\n text-size-adjust: none;\n forced-color-adjust: none;\n transform-origin: 0 0;\n caret-color: CanvasText;\n --min-font-size: 1;\n --text-scale-factor: calc(var(--total-scale-factor, 1) * var(--min-font-size));\n --min-font-size-inv: calc(1 / var(--min-font-size));\n}\n.preview-pdf-textlayer :is(span, br) {\n color: transparent;\n position: absolute;\n white-space: pre;\n cursor: text;\n transform-origin: 0% 0%;\n}\n.preview-pdf-textlayer > :not(.markedContent),\n.preview-pdf-textlayer .markedContent span:not(.markedContent) {\n z-index: 1;\n --font-height: 0;\n font-size: calc(var(--text-scale-factor) * var(--font-height));\n --scale-x: 1;\n --rotate: 0deg;\n transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv));\n}\n.preview-pdf-textlayer .markedContent {\n display: contents;\n}\n.preview-pdf-textlayer span[role="img"] {\n user-select: none;\n cursor: default;\n}\n.preview-pdf-textlayer ::selection {\n background: rgba(0, 80, 255, 0.25);\n}\n.preview-pdf-textlayer br::selection {\n background: transparent;\n}\n.preview-pdf-textlayer .endOfContent {\n display: block;\n position: absolute;\n inset: 100% 0 0;\n z-index: 0;\n cursor: default;\n user-select: none;\n}\n.preview-pdf-textlayer.selecting .endOfContent {\n top: 0;\n}\n'}),
|
|
22
22
|
/* @__PURE__ */p("div",{className:"relative shadow-lg rounded",children:[
|
|
23
23
|
/* @__PURE__ */m("canvas",{ref:v,className:"block rounded"}),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Button_default as e}from"./chunk-
|
|
1
|
+
import{Button_default as e}from"./chunk-37FQVY2O.js";import{Icon as r}from"./chunk-ISVODSRP.js";import{useShellStrings as t}from"./chunk-NRHG4R2Q.js";import{jsxs as a,jsx as d}from"react/jsx-runtime";function n({title:n,message:o,onRetry:s,variant:i="dashed"}){const m=t().list;/* @__PURE__ */
|
|
2
2
|
return a("div",{className:`flex flex-col items-center justify-center text-center ${"card"===i?"rounded-md border border-gray-200 bg-white px-6 py-12":"none"===i?"px-6 py-12":"rounded-lg border-2 border-dashed border-red-200 px-6 py-12"}`,role:"alert",children:[
|
|
3
3
|
/* @__PURE__ */d(r,{name:"warning",className:"h-10 w-10 text-red-300 mb-3",strokeWidth:1,"aria-hidden":"true"}),
|
|
4
4
|
/* @__PURE__ */d("h3",{className:"text-sm font-medium text-gray-900",children:n??m.loadError}),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Card as e}from"./chunk-RKSCB5BJ.js";import{FormField as t}from"./chunk-6KBDNYRW.js";import{Checkbox_default as r}from"./chunk-CGZBDI6C.js";import{Input_default as l}from"./chunk-
|
|
1
|
+
import{Card as e}from"./chunk-RKSCB5BJ.js";import{FormField as t}from"./chunk-6KBDNYRW.js";import{Checkbox_default as r}from"./chunk-CGZBDI6C.js";import{Input_default as l}from"./chunk-BYTQRQ5P.js";import{Button_default as a}from"./chunk-37FQVY2O.js";import{useState as i}from"react";import{jsx as c,jsxs as n,Fragment as s}from"react/jsx-runtime";var o={login:{title:"Welcome back",subtitle:"Sign in to your account",cta:"Sign in"},register:{title:"Create your account",subtitle:"Start your 14-day free trial",cta:"Create account"},forgot:{title:"Reset password",subtitle:"We'll email you a reset link",cta:"Send reset link"}};function m({mode:m="login"}){const[u,d]=i(!0),h=o[m];/* @__PURE__ */
|
|
2
2
|
return c("div",{className:"flex h-full items-center justify-center overflow-auto bg-gray-50 p-6",children:/* @__PURE__ */n("div",{className:"w-full max-w-sm",children:[
|
|
3
3
|
/* @__PURE__ */n("div",{className:"mb-6 text-center",children:[
|
|
4
4
|
/* @__PURE__ */c("div",{className:"mx-auto mb-3 flex h-10 w-10 items-center justify-center rounded-lg bg-blue-600 text-sm font-bold text-white",children:"A"}),
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{unitBox as e}from"./chunk-4MDSZSLC.js";import{useSettingAuto as r}from"./chunk-2NMW66P5.js";import{inputClasses as t}from"./chunk-AYZY3YNC.js";import{IconButton_default as n}from"./chunk-
|
|
2
|
-
return v("div",{className:"relative","data-number-box":"",style
|
|
1
|
+
import{unitBox as e}from"./chunk-4MDSZSLC.js";import{useSettingAuto as r}from"./chunk-2NMW66P5.js";import{inputClasses as t}from"./chunk-AYZY3YNC.js";import{IconButton_default as n}from"./chunk-4YH7U7WL.js";import{Icon as o}from"./chunk-ISVODSRP.js";import{useBrowserLayoutEffect as i}from"./chunk-PU2GJVMG.js";import{registerModalEscapeInterceptor as a}from"./chunk-TWVUQUUD.js";import{useShellStrings as l}from"./chunk-NRHG4R2Q.js";import{forwardRef as c,useId as s,useState as u,useRef as d,useCallback as p,useEffect as f}from"react";import{jsx as m,jsxs as v,Fragment as h}from"react/jsx-runtime";function b(e){const r=String(e),t=/e-(\d+)$/.exec(r);return t?Number(t[1]):r.split(".")[1]?.length??0}function g(e){return 0===b(e)?{precision:0}:{snap:!0}}var x=(e,r)=>null==e?"":null!=r?e.toFixed(r):String(e),y={compact:{right:"var(--space-16)",least:"var(--space-32)"},steppers:{right:"calc(var(--space-40) + var(--space-20))",least:"calc(var(--space-48) * 2)"},plain:{right:"var(--space-8)",least:"var(--space-40)"}};function w(e){const r=d(null),[t,n]=u(0);return i(()=>{const e=r.current;if(!e)return;const t=()=>n(Math.ceil(e.getBoundingClientRect().width));if(t(),"undefined"==typeof ResizeObserver)return;const o=new ResizeObserver(t);return o.observe(e),()=>o.disconnect()},[e]),[r,t]}function k(e,r,t){if(!r)return e;const n=e.trimEnd();for(let e=r.length;e>(t?0:r.length-1);e--)if(n.endsWith(r.slice(0,e)))return n.slice(0,-e).trimEnd();return e}function N({dir:e,compact:r,label:t,disabled:i,onStep:a}){const l=d(a);l.current=a;const c=d({}),s=p(()=>{const e=c.current;void 0!==e.wait&&clearTimeout(e.wait),void 0!==e.every&&clearInterval(e.every),e.off?.(),c.current={}},[]);f(()=>s,[s]),f(()=>{i&&s()},[i,s]);const u=/* @__PURE__ */m(o,{name:e>0?"chevron-up":"chevron-down","aria-hidden":"true",focusable:"false",className:r?"h-2.5 w-2.5":"h-3.5 w-3.5",strokeWidth:r?2.6:2}),v={tabIndex:-1,"aria-label":t,disabled:i,onPointerDown:e=>{if(0!==e.button||i)return;e.preventDefault(),s();const r=e.shiftKey;l.current(r);const t=e.currentTarget.ownerDocument.defaultView??window;t.addEventListener("pointerup",s),c.current={off:()=>t.removeEventListener("pointerup",s),wait:setTimeout(()=>{c.current.every=setInterval(()=>l.current(r),60)},400)}},onPointerLeave:s,onPointerCancel:s,onClick:e=>{0===e.detail&&l.current(e.shiftKey)}};return r?/* @__PURE__ */m("button",{type:"button",...v,className:"flex min-h-0 flex-1 items-center justify-center text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900 disabled:cursor-not-allowed disabled:opacity-40",children:u}):/* @__PURE__ */m(n,{size:"sm",...v,children:u})}var j=c(function({value:n,onChange:o,min:i,max:c,precision:g,step:j,shiftStep:D,disabled:E,readOnly:B,invalid:S,placeholder:C,size:M,prefix:$,suffix:O,suffixControl:P,units:U,id:F,name:L,className:R="",onBlur:W,onFocus:K,steppers:z,stepFrom:T,snap:V=!1,allowEmpty:Y=!0,appearance:I="box",display:A,reportWhileTyping:G=!0,onRevert:H,"aria-label":Q,"aria-labelledby":Z,"aria-describedby":J,auto:X,...q},_){const ee="bare"===I,re=P??("string"==typeof O?e(O,U,E||B):void 0),te=r(),ne=X??te,oe=s(),ie="string"==typeof O&&""!==O.trim()?O.trim():void 0,ae=e=>function(e,r,t=!1){let n=k(e.trim(),r,t);if(n=n.replace(",","."),""===n||"-"===n||"."===n||"-."===n)return null;const o=Number(n);return Number.isFinite(o)?o:null}(e,ie,Boolean(re)),le=Boolean(O||re),ce=Object.fromEntries(Object.entries(q).filter(([e])=>e.startsWith("data-"))),se=l(),[ue,de]=u(()=>x(n,g)),pe=d(ue);pe.current=ue;const fe=d(null),me=p(e=>{fe.current=e,"function"==typeof _?_(e):_&&(_.current=e)},[_]),ve=d(n),he=d(n);he.current=n;const be=Boolean(E||B),ge=z??!1,xe="compact"===ge,[ye,we]=w($),[ke,Ne]=w(Boolean(re)),je=xe?y.compact:ge?y.steppers:y.plain;f(()=>{ae(pe.current)!==n&&de(x(n,g))},[n,g]);const De=e=>{if(be)return;let r=(ae(pe.current)??T??(C?ae(C):null)??0)+e;null!=i&&r<i&&(r=i),null!=c&&r>c&&(r=c);const t=g??String(j??1).split(".")[1]?.length??0;r=Number(r.toFixed(t));const n=x(r,g);pe.current=n,de(n),o(r),Oe()},Ee=d(De);Ee.current=De;const Be=d({unit:j??1,big:D??10*(j??1),locked:be});Be.current={unit:j??1,big:D??10*(j??1),locked:be},f(()=>{const e=fe.current;if(!e)return;const r=r=>{const{unit:t,big:n,locked:o}=Be.current;if(o||e.ownerDocument.activeElement!==e)return;const i=r.deltaY||r.deltaX;i&&(r.preventDefault(),Ee.current((i<0?1:-1)*(r.shiftKey?n:t)))};return e.addEventListener("wheel",r,{passive:!1}),()=>e.removeEventListener("wheel",r)},[]);const[Se,Ce]=u(!1),[Me,$e]=u(0),Oe=()=>{ee&&$e(e=>e+1)};f(()=>{ee&&Se&&document.activeElement===fe.current&&fe.current?.select()},[ee,Se,Me]);const Pe=d(!1);f(()=>{if(Se&&!be)return a(e=>{if("Escape"!==e.key||document.activeElement!==fe.current)return!1;const r=ve.current;if(ae(pe.current)===r)return!1;const t=x(r,g);return pe.current=t,de(t),he.current!==r&&(H??o)(r),Oe(),!0})},[Se,be,g,o,H]);const Ue=()=>{const e=ae(pe.current);if(null==e){if(!Y){const e=x(he.current,g);return pe.current=e,de(e),he.current}return pe.current="",de(""),null!==he.current&&o(null),null}let r=e;const t=g??(V?Math.max(b(j??1),b(i??0)):void 0);V&&(r=function(e,r,t){const n=(e-t)/r;return t+Math.round(n+1e-9*Math.sign(e))*r}(r,j??1,i??0)),null!=i&&r<i&&(r=i),null!=c&&r>c&&(r=c),null!=t&&(r=Number(r.toFixed(t)));const n=x(r,g);return pe.current=n,de(n),r===e&&r===he.current||o(r),r},Fe=/* @__PURE__ */m("input",{ref:me,id:F,"data-number-input":"",name:L,type:"text",inputMode:0===g?"numeric":"decimal",value:!Se&&A?A(n):ue,disabled:E,readOnly:B,placeholder:C,step:j,role:"spinbutton","aria-valuenow":n??void 0,"aria-valuemin":i,"aria-valuemax":c,"aria-valuetext":null==n?C||void 0:`${x(n,g)}${ee&&ie?ie:""}`,"aria-describedby":[J,ne?oe:void 0].filter(Boolean).join(" ")||void 0,"data-appearance":ee?"bare":void 0,...ce,autoComplete:ee?"off":void 0,spellCheck:!ee&&void 0,"aria-invalid":S||void 0,"aria-label":Q,"aria-labelledby":Z,onChange:e=>(e=>{if(B)return;const r=k(e,ie,Boolean(re));if(""!==r&&!/^-?\d*[.,]?\d*$/.test(r))return;if(de(e),!G)return;const t=ae(e);(null!==t||Y)&&o(t)})(e.target.value),onKeyDown:e=>{if("Enter"===e.key&&!be)return ve.current=Ue(),void Oe();const r=j??1,t=D??10*r,n="ArrowUp"===e.key?e.shiftKey?t:r:"ArrowDown"===e.key?-(e.shiftKey?t:r):"PageUp"===e.key?10*r:"PageDown"===e.key?10*-r:null;null===n||be||(e.preventDefault(),De(n))},onFocus:()=>{ve.current=he.current,Ce(!0),Pe.current=!0,K?.()},onMouseUp:ee?e=>{Pe.current&&(Pe.current=!1,e.preventDefault())}:void 0,onBlur:()=>{Ce(!1),Pe.current=!1,Ue(),W?.()},className:ee?["block min-w-0 m-0 rounded-(--radius-control) border-0 p-0 text-center tabular-nums","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",Se?"bg-surface":"bg-transparent",be?"cursor-default":"cursor-text",R].filter(Boolean).join(" "):t({invalid:S,size:M,readOnly:B,auto:ne,className:[$?"pl-[max(var(--space-24),calc(var(--space-control-x-sm)+var(--rosh-number-prefix-width)+var(--space-icon-gap-sm)))]":"",re?"pr-(--rosh-number-suffix-room)":xe?le?"pr-10":"pr-6":ge?le?"pr-24":"pr-16":le?"pr-10":"","text-left tabular-nums",re&&!Se?"text-ellipsis":"",R].filter(Boolean).join(" ")})}),Le=ne?/* @__PURE__ */m("span",{id:oe,hidden:!0,children:se.settingView.auto}):null;if(ee||!$&&!le&&!ge)return Le?/* @__PURE__ */v(h,{children:[Fe,Le]}):Fe;const Re=ae(ue);/* @__PURE__ */
|
|
2
|
+
return v("div",{className:"relative","data-number-box":"",style:$||re?{...$?{"--rosh-number-prefix-width":`${we}px`}:{},...re?{"--rosh-number-suffix-room":`max(${je.least}, calc(${je.right} + ${Ne}px))`}:{}}:void 0,children:[$&&/* @__PURE__ */m("span",{ref:ye,className:"pointer-events-none absolute left-(--space-control-x-sm) top-1/2 -translate-y-1/2 whitespace-nowrap text-sm text-ink-faint",children:$}),Fe,Le,re?/* @__PURE__ */m("span",{ref:ke,className:"absolute top-1/2 flex -translate-y-1/2",style:{right:je.right},children:re}):O&&/* @__PURE__ */m("span",{className:`pointer-events-none absolute ${xe?"right-6":ge?"right-16":"right-3"} top-1/2 -translate-y-1/2 text-xs text-ink-faint`,children:O}),ge&&(()=>{const e=/* @__PURE__ */m(N,{dir:-1,compact:xe,label:se.number.decrease,disabled:be||null!=i&&null!=Re&&Re<=i,onStep:e=>Ee.current(-(e?D??10*(j??1):j??1))}),r=/* @__PURE__ */m(N,{dir:1,compact:xe,label:se.number.increase,disabled:be||null!=c&&null!=Re&&Re>=c,onStep:e=>Ee.current(e?D??10*(j??1):j??1)});/* @__PURE__ */
|
|
3
3
|
return v("span",xe?{"data-steppers":"compact",className:"absolute inset-y-px right-px flex w-4 flex-col overflow-hidden rounded-r-(--radius-control)",children:[r,e]}:{className:"absolute right-1 top-1/2 flex -translate-y-1/2 items-center gap-0.5",children:[e,r]})})()]})});export{j as InputNumber_default,g as stepRounding};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{SidebarLayout as e}from"./chunk-FUUUPTVN.js";import{Avatar as t}from"./chunk-SCNQK5NF.js";import{Input_default as a}from"./chunk-
|
|
1
|
+
import{SidebarLayout as e}from"./chunk-FUUUPTVN.js";import{Avatar as t}from"./chunk-SCNQK5NF.js";import{Input_default as a}from"./chunk-BYTQRQ5P.js";import{Button_default as i}from"./chunk-37FQVY2O.js";import{useState as s}from"react";import{jsx as n,jsxs as l}from"react/jsx-runtime";var r=[{id:1,name:"Priya Patel",last:"Sounds good — shipping it now",time:"9:41",status:"online"},{id:2,name:"Design team",last:"Marco: updated the tokens",time:"9:12",status:"away"},{id:3,name:"Tom Becker",last:"Thanks!",time:"Yest",status:"offline"},{id:4,name:"Sara Lind",last:"See you Friday 🎉",time:"Yest",status:"busy"}],m=[{mine:!1,text:"Hey! Did the latest build go out?"},{mine:!0,text:"Just merged — deploying now."},{mine:!1,text:"Nice. Any breaking changes for the portal?"},{mine:!0,text:"Nope, fully additive. New components only."},{mine:!1,text:"Sounds good — shipping it now"}];function d(){const[d,o]=s(1),c=r.find(e=>e.id===d)??r[0];/* @__PURE__ */
|
|
2
2
|
return n("div",{className:"h-full",children:/* @__PURE__ */n(e,{side:"left",defaultWidth:260,sidebar:/* @__PURE__ */n("div",{className:"h-full overflow-auto",children:r.map(e=>/* @__PURE__ */l("button",{onClick:()=>o(e.id),className:"flex w-full items-center gap-3 border-b border-gray-100 px-3 py-3 text-left hover:bg-gray-50 "+(e.id===d?"bg-blue-50/50":""),children:[
|
|
3
3
|
/* @__PURE__ */n(t,{name:e.name,status:e.status}),
|
|
4
4
|
/* @__PURE__ */l("div",{className:"min-w-0 flex-1",children:[
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{client_default as a}from"./chunk-
|
|
1
|
+
import{client_default as a}from"./chunk-XNPCOWOO.js";var t=()=>a.get("/auth/numbering-configs/").then(a=>a.data?.results??a.data??[]),e="uploaded:wallpaper";function r(a,t){return"string"!=typeof a||!a||"none"===a||a.startsWith("#")?"":a===e?t||"":a}var l=()=>a.get("/auth/me/wallpaper/").then(a=>a.data),n=(t,e)=>{const r=new FormData;r.append("wallpaper",t);const l=e?{onUploadProgress:a=>e(a.total?Math.round(a.loaded/a.total*100):null)}:void 0;return a.post("/auth/me/wallpaper/",r,l).then(a=>a.data)},p=()=>a.delete("/auth/me/wallpaper/").then(a=>a.data);function o(a){const t=a?.response?.status,e=a?.response?.data,r=Array.isArray(e?.wallpaper)?e.wallpaper[0]:void 0;return r||(413===t?"That picture is too large to use as a wallpaper.":415===t?"That file is not a picture this can use as a wallpaper.":"The wallpaper could not be saved. Please try again.")}export{e as WALLPAPER_PREF_TOKEN,p as deleteWallpaper,t as getNumberingConfigs,l as getWallpaper,n as uploadWallpaper,r as wallpaperSrc,o as wallpaperUploadError};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{buttonClasses as t}from"./chunk-
|
|
1
|
+
import{buttonClasses as t}from"./chunk-LYGIOJ3J.js";import{SPINNER_RING as e}from"./chunk-MRJKZWWV.js";import{currentShellStrings as n}from"./chunk-NRHG4R2Q.js";var o="http://www.w3.org/2000/svg",s={},r=/* @__PURE__ */new Map;function i(t,e){let n=document.getElementById(t);return n||(n=document.createElement("div"),n.id=t,n.className=e,document.body.appendChild(n)),n}var a={success:"M5 13l4 4L19 7",error:"M6 18L18 6M6 6l12 12",warning:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z",info:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z",bell:"M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75v-.7V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0"};function c(t,e){const n=document.createElementNS(o,"svg");n.setAttribute("class",e),n.setAttribute("fill","none"),n.setAttribute("viewBox","0 0 24 24"),n.setAttribute("stroke","currentColor"),n.setAttribute("stroke-width","2");const s=document.createElementNS(o,"path");return s.setAttribute("stroke-linecap","round"),s.setAttribute("stroke-linejoin","round"),s.setAttribute("d",a[t]),n.appendChild(s),n}function l(t,e){const n=document.createElement("div");return n.className=t,void 0!==e&&(n.textContent=e),n}function d(n,o,a){const d={...s,...a},u=d.placement??"top",m=d.sticky??!1,p=`${u}|${n}|${o}`;if(d.dedupe){const t=r.get(p);if(t)return t.restart(),{dismiss:t.dismiss}}"loading"!==n&&!1!==d.sound&&import("./sounds-E5OTSJLX.js").then(t=>{"success"===n?t.playSuccess():"error"===n?t.playError():t.playNotification()}).catch(()=>{});const f="bottom"===u?i("toast-container-bottom","fixed bottom-4 left-1/2 -translate-x-1/2 z-(--z-toast) flex flex-col-reverse gap-2 items-center pointer-events-none"):i("toast-container","fixed top-4 left-1/2 -translate-x-1/2 z-(--z-toast) flex flex-col gap-2 items-center pointer-events-none"),h="bottom"===u?"translateY(10px)":"translateY(-10px)",y=l("pointer-events-auto cursor-pointer rosh-toast");if(y.style.opacity="0",y.style.transform=`${h} scale(0.95)`,y.setAttribute("role","error"===n?"alert":"status"),y.setAttribute("aria-atomic","true"),"loading"===n){const t=document.createElement("span");t.setAttribute("aria-hidden","true"),t.className=`${e} h-4 w-4 rosh-tone-loading`,y.appendChild(t)}else y.appendChild(c(n,`h-4 w-4 rosh-tone-${n}`));const v=document.createElement("span");if(v.textContent=o,y.appendChild(v),d.action){const{label:e,onClick:n}=d.action,o=document.createElement("button");o.type="button",o.className=t({variant:"link",size:"sm"}),o.textContent=e,o.addEventListener("click",t=>{t.stopPropagation(),g||(n(),x("action"))}),y.appendChild(o)}let b;f.appendChild(y),requestAnimationFrame(()=>{y.style.opacity="1",y.style.transform="translateY(0) scale(1)"});let g=!1;const x=t=>{g||(g=!0,b&&clearTimeout(b),r.delete(p),y.style.opacity="0",y.style.transform=`${h} scale(0.95)`,setTimeout(()=>y.remove(),300),d.onClose?.(t))},w=()=>x("dismissed"),E=d.duration??("info"===n?4500:3e3),C=()=>{b&&clearTimeout(b),m||(b=setTimeout(()=>x("timeout"),E))};return C(),y.addEventListener("mouseenter",()=>{b&&clearTimeout(b)}),y.addEventListener("mouseleave",()=>{g||C()}),y.addEventListener("click",w),r.set(p,{el:y,restart:C,dismiss:w}),{dismiss:w}}var u=8e3,m=/* @__PURE__ */new Map,p=!1;var f={success:(t,e)=>d("success",t,e),error:(t,e)=>d("error",t,e),warning:(t,e)=>d("warning",t,e),info:(t,e)=>d("info",t,e),notify:(t,e)=>function(t,e){!1!==(e?.sound??s.sound)&&import("./sounds-E5OTSJLX.js").then(t=>t.playNotification()).catch(()=>{});const o=i("notif-container","fixed top-4 right-4 z-(--z-toast) flex flex-col gap-3 items-end pointer-events-none"),r=l("pointer-events-auto cursor-pointer rosh-notif");r.style.opacity="0",r.style.transform="translateX(30px) scale(0.95)";const a=l("rosh-notif-badge");a.appendChild(c("bell","h-5 w-5"));const d=l("rosh-notif-body");d.append(l("rosh-notif-title",n().toast.notification),l("notif-msg rosh-notif-msg",t));const u=document.createElement("button");u.className="rosh-notif-close",u.textContent="×",r.append(a,d,u);const m=()=>{r.style.opacity="0",r.style.transform="translateX(30px) scale(0.95)",setTimeout(()=>r.remove(),300)};u.addEventListener("click",t=>{t.stopPropagation(),m()}),r.addEventListener("click",m),o.appendChild(r),requestAnimationFrame(()=>{r.style.opacity="1",r.style.transform="translateX(0) scale(1)"}),setTimeout(m,e?.duration??1e4)}(t,e),promise:(t,e,n)=>{const o=d("loading",e.loading,{...n,sticky:!0});return t.then(t=>{o.dismiss(),d("success","function"==typeof e.success?e.success(t):e.success,n)},t=>{o.dismiss(),d("error","function"==typeof e.error?e.error(t):e.error,n)}),t},configure:t=>{s={...t}},undoable:function(t,e){p||"undefined"==typeof window||(p=!0,window.addEventListener("pagehide",()=>{const t=[...m.values()];m.clear();for(const e of t)e.run({keepalive:!0})}));const o=/* @__PURE__ */Symbol("undoable");let s=!1,r=null;const i=async t=>{if(!s){s=!0,m.delete(o);try{await(t?e.commit(t):e.commit())}catch(t){e.onFail?.(t)}}},a=()=>!s&&(s=!0,m.delete(o),e.undo(),!0);return m.set(o,{run:i}),r=d("success",t,{sound:!1,placement:e.placement,duration:e.duration??8e3,action:{label:e.actionLabel??n().toast.undo,onClick:()=>{a()}},onClose:t=>{"action"!==t&&i()}}),{undo:()=>{const t=a();return t&&r?.dismiss(),t},commit:async()=>{if(s)return;const t=i();r?.dismiss(),await t}}}};export{u as UNDOABLE_MS,f as toast_default};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import{Tree as e,TreeRow as n,TreeGroup as l}from"./chunk-BTMZ5MUY.js";import{ImageLightbox as r}from"./chunk-ONUNFTZD.js";import{MarqueeBox as a}from"./chunk-IC72MGON.js";import{Drawer as i}from"./chunk-AYTGYEOI.js";import{EmptyState as t}from"./chunk-W3454ZES.js";import{DescriptionList as o}from"./chunk-SACUSHVN.js";import{Breadcrumbs as d}from"./chunk-WREUA43Q.js";import{ROOT_KEY as s,mediaLibraryMenu as c}from"./chunk-UFJR63AO.js";import{useMediaMoveItems as u}from"./chunk-GRAFJD3L.js";import{RenameField as m}from"./chunk-6ZQC6XFU.js";import{MediaUploadGrid as p}from"./chunk-B4Y5NGHR.js";import{MediaUsedInList as h}from"./chunk-XOEYCDWT.js";import{NativeSelect as f}from"./chunk-W7HTHKN2.js";import{useGridSelection as g}from"./chunk-VLKDWKVR.js";import{useMarquee as v}from"./chunk-OLFYNMTD.js";import{copyToClipboard as k}from"./chunk-452LT77I.js";import{Checkbox_default as y}from"./chunk-CGZBDI6C.js";import{Segmented as b}from"./chunk-TALQMTCE.js";import{useContextMenu as w,ContextMenu as N}from"./chunk-MF7OELXP.js";import{Banner as x}from"./chunk-OSMRYND3.js";import{Input_default as C}from"./chunk-BYTQRQ5P.js";import{useFileIntake as I,FileIntakeAlert as D}from"./chunk-TNGIXSTM.js";import{setModalDragAside as S,modalIdHolding as T}from"./chunk-EIFNESXS.js";import{ColoredBadge as j}from"./chunk-L2WQOJ3T.js";import{DropdownMenu as L}from"./chunk-NJY4HPNB.js";import{IconButton_default as z}from"./chunk-4YH7U7WL.js";import{Button_default as O}from"./chunk-37FQVY2O.js";import{Icon as F}from"./chunk-ISVODSRP.js";import{Tooltip as E}from"./chunk-CIZAUBWA.js";import{buttonClasses as A}from"./chunk-LYGIOJ3J.js";import{usePlotWidth as P}from"./chunk-MAFUXCPZ.js";import{useShellStrings as M}from"./chunk-NRHG4R2Q.js";import{useRef as R,useMemo as U,useCallback as B,useState as Y,useEffect as W}from"react";import{jsxs as G,Fragment as H,jsx as J}from"react/jsx-runtime";var K="application/x-efficient-media-files",Q="application/x-efficient-media-folder",V="application/x-efficient-media-file";function Z(e){if(!e||!Array.from(e.types).includes(V))return null;try{const n=JSON.parse(e.getData(V));if(n&&"string"==typeof n.id&&"string"==typeof n.url&&"string"==typeof n.name&&("image"===n.kind||"video"===n.kind))return{id:n.id,url:n.url,kind:n.kind,name:n.name}}catch{}return null}var $={type:"all",use:"any",sort:"newest"},X={lock:/* @__PURE__ */J(F,{name:"lock","aria-hidden":"true",className:"h-4 w-4"}),folder:/* @__PURE__ */J(F,{name:"folder","aria-hidden":"true",className:"h-4 w-4"}),folderOpen:/* @__PURE__ */J(F,{name:"folder-open","aria-hidden":"true",className:"h-4 w-4"}),folderPlus:/* @__PURE__ */J(F,{name:"folder-plus","aria-hidden":"true",className:"h-4 w-4"}),trash:/* @__PURE__ */J(F,{name:"trash","aria-hidden":"true",className:"h-4 w-4"}),upload:/* @__PURE__ */J(F,{name:"upload","aria-hidden":"true",className:"h-4 w-4"}),search:/* @__PURE__ */J(F,{name:"search","aria-hidden":"true",className:"h-4 w-4"}),grid:/* @__PURE__ */J(F,{name:"grid","aria-hidden":"true",className:"h-4 w-4"}),list:/* @__PURE__ */J(F,{name:"list","aria-hidden":"true",className:"h-4 w-4"}),more:/* @__PURE__ */J(F,{name:"more","aria-hidden":"true",className:"h-4 w-4"}),copy:/* @__PURE__ */J(F,{name:"copy","aria-hidden":"true",className:"h-4 w-4"}),edit:/* @__PURE__ */J(F,{name:"edit","aria-hidden":"true",className:"h-4 w-4"}),swap:/* @__PURE__ */J(F,{name:"swap","aria-hidden":"true",className:"h-4 w-4"}),crop:/* @__PURE__ */J(F,{name:"crop","aria-hidden":"true",className:"h-4 w-4"}),external:/* @__PURE__ */J(F,{name:"external","aria-hidden":"true",className:"h-4 w-4"}),undo:/* @__PURE__ */J(F,{name:"undo","aria-hidden":"true",className:"h-4 w-4"})},q={link:/* @__PURE__ */J(F,{name:"link","aria-hidden":"true",className:"h-3 w-3"}),email:/* @__PURE__ */J(F,{name:"email","aria-hidden":"true",className:"h-3 w-3"}),lock:/* @__PURE__ */J(F,{name:"lock","aria-hidden":"true",className:"h-3 w-3"}),clock:/* @__PURE__ */J(F,{name:"clock","aria-hidden":"true",className:"h-3 w-3"})};function _(F){const{mode:Z="manage",layout:_="auto",location:ee,onLocationChange:ne,folders:le,products:re,allFilesCount:ae,trashCount:ie,files:te,query:oe,onQueryChange:de,filters:se=$,onFiltersChange:ce,extraFilters:ue,view:me="grid",onViewChange:pe,selectedIds:he,onSelectionChange:fe,usedIn:ge,denied:ve={},accept:ke="image/*,video/*",maxSizeBytes:ye,busy:be,progress:we,onUpload:Ne,onNewFolder:xe,onRename:Ce,onMove:Ie,onTrash:De,onDeleteFolder:Se,onRestore:Te,onDeleteForever:je,onEmptyTrash:Le,onReplace:ze,onCropEdit:Oe,onOpenInDesign:Fe,onChoose:Ee,onCancel:Ae,pickNote:Pe,onDragOut:Me,className:Re=""}=F,Ue=M().mediaLibrary,Be=M().media,Ye="pick"===Z,We=!Ye,Ge=R(null),He=P(Ge,"phone"===_?343:1200),Je="phone"===_||"auto"===_&&He<640,Ke=U(()=>function(e=[]){const n=/* @__PURE__ */new Map,l=(e,r)=>{for(const a of e){const e=[...r,a];n.set(a.id,{node:a,path:e}),a.children&&l(a.children,e)}};return l(e,[]),n}(re),[re]),Qe=U(()=>new Map(le.map(e=>[e.id,e])),[le]),Ve=U(()=>{const e=/* @__PURE__ */new Map;for(const n of le){const l=n.parentId&&Qe.has(n.parentId)?n.parentId:null;e.set(l,[...e.get(l)??[],n])}return e},[le,Qe]),Ze=B(e=>{const n=[];for(let l=e?Qe.get(e):void 0;l&&(n.unshift(l),!(n.length>le.length));l=l.parentId?Qe.get(l.parentId):void 0);return n},[Qe,le.length]),$e=B((e,n)=>Ze(e).some(e=>e.id===n),[Ze]),[Xe,qe]=Y(()=>/* @__PURE__ */new Set(["@files"])),_e=e=>qe(n=>{const l=new Set(n);return l.has(e)?l.delete(e):l.add(e),l}),en=B(e=>{qe(n=>e.every(e=>n.has(e))?n:/* @__PURE__ */new Set([...n,...e]))},[]),nn="files"===(ln=ee).place?`files:${ln.folderId??""}`:"products"===ln.place?`products:${ln.nodeId??""}`:"trash";var ln;W(()=>{if("files"===ee.place)en(["@files",...Ze(ee.folderId).slice(0,-1).map(e=>e.id)]);else if("products"===ee.place){const e=ee.nodeId?Ke.get(ee.nodeId)?.path??[]:[];en(["@products",...e.slice(0,-1).map(e=>`p:${e.id}`)])}},[nn]);const rn="products"===ee.place,an="trash"===ee.place,tn="files"===ee.place,on=tn?ee.folderId:null,dn=rn&&ee.nodeId?Ke.get(ee.nodeId)?.path[0]:void 0,sn=e=>e?.sharedFrom?`${Ue.readOnly} ${Ue.editedAtHq(e.sharedFrom)}`:Ue.readOnly,cn=U(()=>te.map(e=>e.id),[te]),un=U(()=>new Map(te.map(e=>[e.id,e])),[te]),mn=g(cn),pn=U(()=>cn.filter(e=>mn.selected.has(e)),[cn,mn.selected]),hn=1===pn.length?un.get(pn[0]):void 0,fn=R(!0);W(()=>{fn.current?fn.current=!1:mn.clear()},[nn]);const gn=he?.join("\0");W(()=>{he&&mn.setSelection(he)},[gn]);const vn=R(gn??""),kn=pn.join("\0");W(()=>{vn.current!==kn&&(vn.current=kn,fe?.(pn))},[kn]);const yn=(e,n={})=>{Ye?mn.select(e):mn.select(e,{ctrl:!(!n.ctrlKey&&!n.metaKey),shift:!!n.shiftKey})},[bn,wn]=Y(null),Nn=e=>{const n=bn;if(wn(null),!n||null==e)return;e!==("folder"===n.kind?Qe.get(n.id)?.name:un.get(n.id)?.name)&&Ce?.(n,e)},xn=async e=>{if(!xe)return;const n=await xe(e);en(["@files",...e?[e]:[]]),"string"==typeof n&&wn({kind:"folder",id:n})},Cn=B(e=>{const n=[],l=n=>{if("files"===e.kind)return n===on&&tn?Ue.alreadyHere:void 0;const l=Qe.get(e.id);return n===e.id||n&&$e(n,e.id)?Ue.notIntoItself:(l?.parentId??null)===n?Ue.folderAlreadyHere:void 0};n.push({key:s,label:Ue.allFiles,disabledReason:l(null)});const r=(e,a)=>{for(const i of Ve.get(e)??[])n.push({key:i.id,label:i.name,depth:a,disabledReason:l(i.id)}),r(i.id,a+1)};return r(null,1),n},[Ve,Qe,tn,$e,on,Ue]),In=B(e=>{const n=new Set(e.map(e=>un.get(e)?.kind??"image"));return 1===n.size?[...n][0]:"file"},[un]),[Dn,Sn]=Y(null),Tn={words:Ue,media:Be,denied:ve,moveTargets:Cn,kindOf:In,urlOf:e=>un.get(e)?.url,newSubfolder:xe&&We?e=>{xn(e)}:void 0,rename:Ce&&We?e=>{"file"!==e.kind||mn.isSelected(e.id)||mn.select(e.id),wn(e)}:void 0,move:Ie&&We?Ie:void 0,trash:De&&We?De:void 0,deleteFolder:Se&&We?Se:void 0,folderNotEmpty:e=>!!Qe.get(e)?.notEmpty,replace:ze&&We?ze:void 0,copyUrl:e=>{const n=un.get(e)?.url;n&&k(Ue.urlLabel,n)},openInDesign:Fe,restore:Te,deleteForever:je},jn=e=>c(e,Tn),Ln=w(),zn=(e,n)=>{Ye||(mn.isSelected(e)||mn.select(e),Ln.open(n,(e=>{const n=mn.isSelected(e)?pn:[e];return rn?{kind:"render",id:e}:an?{kind:"trashed",ids:n}:{kind:"files",ids:n}})(e)))},[On,Fn]=Y(null),[En,An]=Y(null),[Pn,Mn]=Y(null);W(()=>{if(!En&&!On)return;const e=()=>{An(null),Fn(null)};return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[En,On]);const Rn=(e,n)=>Array.from(e.dataTransfer?.types??[]).includes(n),Un=(e,n)=>!(!Ie||ve.move||Ye)&&(!!Rn(e,K)||!(!Rn(e,Q)||!Pn)&&(n!==Pn&&!(n&&$e(n,Pn)))),Bn=(e,n)=>({onDragEnter:l=>{Un(l,n)&&(l.preventDefault(),Fn(e))},onDragOver:l=>{Un(l,n)&&(l.preventDefault(),l.dataTransfer.dropEffect="move",On!==e&&Fn(e))},onDragLeave:n=>{const l=n.relatedTarget;l&&n.currentTarget.contains(l)||Fn(n=>n===e?null:n)},onDrop:e=>{if(Un(e,n))if(e.preventDefault(),Fn(null),Rn(e,K)){let l;try{l=JSON.parse(e.dataTransfer.getData(K))}catch{l=null}Array.isArray(l)&&l.length&&Ie({kind:"files",ids:l.map(String)},n)}else Pn&&(Ie({kind:"folder",id:Pn},n),Mn(null))}}),Yn=e=>{const n=e=>Rn(e,K)||Rn(e,Q)||Rn(e,"Files");return{onDragEnter:l=>{n(l)&&An(e)},onDragOver:l=>{n(l)&&En!==e&&An(e)},onDragLeave:n=>{const l=n.relatedTarget;l&&n.currentTarget.contains(l)||An(n=>n===e?null:n)}}},Wn=(e,n,l)=>/* @__PURE__ */J(E,{side:"right",content:En===e?Ue.noDropProducts:sn(l),open:En===e||!En&&void 0,children:/* @__PURE__ */J("span",{children:n})}),Gn=e=>({onContextMenu:n=>{Ln.open(n,e)}}),Hn=(e,r,a)=>e.map(e=>{const i=`p:${e.id}`,t=a??e,o=Xe.has(i),d=e.children?.length?e.children:null;/* @__PURE__ */
|
|
2
|
+
return G("div",{role:"none",className:"contents",children:[
|
|
3
|
+
/* @__PURE__ */J(n,{label:Wn(i,e.name,t),level:r,icon:d&&o?X.folderOpen:X.folder,count:e.count,countLabel:null!=e.count?e.countLabel??Ue.fileCount(e.count):void 0,selected:rn&&ee.nodeId===e.id,expanded:d?o:void 0,onToggle:d?()=>_e(i):void 0,onSelect:()=>ne({place:"products",nodeId:e.id}),rowProps:{"data-media-row":i,...Yn(i),...We?Gn({kind:"product-node",id:e.id}):{}}}),d&&o&&/* @__PURE__ */J(l,{children:Hn(d,r+1,t)})]},e.id)}),Jn=(e,r)=>(Ve.get(e)??[]).map(e=>{const a=Ve.get(e.id),i=Xe.has(e.id),t="folder"===bn?.kind&&bn.id===e.id,o=jn({kind:"folder",id:e.id});/* @__PURE__ */
|
|
4
|
+
return G("div",{role:"none",className:"contents",children:[
|
|
5
|
+
/* @__PURE__ */J(n,{label:e.name,level:r,icon:a&&i?X.folderOpen:X.folder,count:e.count,countLabel:null!=e.count?e.countLabel??Ue.fileCount(e.count):void 0,selected:t||tn&&ee.folderId===e.id,expanded:a?i:void 0,onToggle:a?()=>_e(e.id):void 0,onSelect:()=>ne({place:"files",folderId:e.id}),drop:On===e.id?"into":void 0,dragging:Pn===e.id,draggable:We&&!!Ie&&!ve.move,rename:t?/* @__PURE__ */J(m,{value:e.name,label:Ue.folderName,onDone:Nn}):void 0,actions:We&&o.length?/* @__PURE__ */J(L,{align:"end","aria-label":Ue.folderActions,trigger:X.more,items:o}):void 0,rowProps:{"data-media-row":e.id,...Bn(e.id,e.id),...We?Gn({kind:"folder",id:e.id}):{},...We&&Ie&&!ve.move?{draggable:!0,onDragStart:n=>{n.dataTransfer.effectAllowed="move",n.dataTransfer.setData(Q,e.id),Mn(e.id)},onDragEnd:()=>{Mn(null),Fn(null)}}:{}}}),a&&i&&/* @__PURE__ */J(l,{children:Jn(e.id,r+1)})]},e.id)}),Kn=Xe.has("@files"),Qn=Xe.has("@products"),Vn=/* @__PURE__ */G(e,{"aria-label":Ue.folders,children:[re&&/* @__PURE__ */G(H,{children:[
|
|
6
|
+
/* @__PURE__ */J(n,{label:Wn("@products",Ue.products),level:1,icon:X.lock,badge:{label:Ue.readOnlyBadge,tone:"neutral"},expanded:re.length?Qn:void 0,onToggle:()=>_e("@products"),selected:rn&&null==ee.nodeId,onSelect:()=>ne({place:"products",nodeId:null}),rowProps:{"data-media-row":"@products",...Yn("@products")}}),Qn&&re.length>0&&/* @__PURE__ */J(l,{children:Hn(re,2)})]}),
|
|
7
|
+
/* @__PURE__ */J(n,{label:Ue.allFiles,level:1,icon:Kn?X.folderOpen:X.folder,count:ae,countLabel:null!=ae?Ue.fileCount(ae):void 0,expanded:Ve.get(null)?.length?Kn:void 0,onToggle:()=>_e("@files"),selected:tn&&null==ee.folderId,onSelect:()=>ne({place:"files",folderId:null}),drop:"@files"===On?"into":void 0,rowProps:{"data-media-row":"@files",...Bn("@files",null)}}),Kn&&(Ve.get(null)?.length??0)>0&&/* @__PURE__ */J(l,{children:Jn(null,2)}),We&&/* @__PURE__ */J(n,{label:Ue.trash,level:1,icon:X.trash,count:ie,countLabel:null!=ie?Ue.fileCount(ie):void 0,selected:an,onSelect:()=>ne({place:"trash"}),rowProps:{"data-media-row":"@trash"}})]}),Zn=(()=>{if(an)return[{label:Ue.trash}];if(rn){const e=ee.nodeId?Ke.get(ee.nodeId)?.path??[]:[];return[{label:Ue.products,onClick:e.length?()=>ne({place:"products",nodeId:null}):void 0},...e.map((n,l)=>({label:n.name,onClick:l<e.length-1?()=>ne({place:"products",nodeId:n.id}):void 0}))]}const e=Ze(on);return[{label:Ue.allFiles,onClick:e.length?()=>ne({place:"files",folderId:null}):void 0},...e.map((n,l)=>({label:n.name,onClick:l<e.length-1?()=>ne({place:"files",folderId:n.id}):void 0}))]})(),$n=rn?Ue.readOnly:ve.upload,Xn=!!Ne&&!an&&!$n,qn=I({accept:ke,maxSizeBytes:ye,multiple:!0,disabled:!Xn,onAccept:e=>Ne?.(e,on)}),_n=rn?Ue.noProductFolder:ve.newFolder,el=e=>e?{"aria-disabled":!0,disabledReason:e}:{},nl=/* @__PURE__ */G("div",{className:"flex flex-wrap items-center gap-2",children:[We&&xe&&!an&&/* @__PURE__ */J(O,{variant:"secondary",size:"sm",leftIcon:X.folderPlus,onClick:()=>{xn(on)},...el(_n),children:Ue.newFolder}),Ne&&!an&&/* @__PURE__ */J(O,{variant:"primary",size:"sm",leftIcon:X.upload,onClick:()=>qn.open(),...el($n),children:Ue.upload}),We&&an&&Le&&te.length>0&&/* @__PURE__ */J(O,{variant:"danger",size:"sm",onClick:Le,...el(ve.deleteForever),children:Ue.emptyTrash})]}),ll=(e,n,l,r,a)=>/* @__PURE__ */J("div",{style:{width:Je?void 0:a,flex:Je?"1 1 120px":"0 0 auto",minWidth:0},children:/* @__PURE__ */J(f,{size:"sm","aria-label":e,value:n,onChange:r,options:l})},e),rl=e=>n=>ce?.({...se,[e]:n}),al=/* @__PURE__ */G("div",{className:"flex flex-wrap items-center gap-2",children:[de&&/* @__PURE__ */J("div",{style:{flex:"1 1 200px",minWidth:0},children:/* @__PURE__ */J(C,{size:"sm",type:"search",leftIcon:X.search,placeholder:rn?Ue.searchProducts:Ue.search,"aria-label":rn?Ue.searchProducts:Ue.search,value:oe??"",onChange:e=>de(e.target.value)})}),ce&&ll(Ue.mediaType,se.type,[{value:"all",label:Ue.allTypes},{value:"image",label:Ue.images},{value:"video",label:Ue.videos},{value:"svg",label:"SVG"},{value:"gif",label:"GIF"}],rl("type"),130),ce&&!rn&&!an&&ll(Ue.use,se.use,[{value:"any",label:Ue.anyUse},{value:"email",label:Ue.emailOnly},{value:"website",label:Ue.websiteOnly},{value:"unused",label:Ue.notUsed}],rl("use"),130),ce&&We&&ll(Ue.sort,se.sort,[{value:"newest",label:Ue.newest},{value:"name",label:Ue.byName},{value:"size",label:Ue.bySize}],rl("sort"),110),ue?.map(e=>ll(e.label,e.value,e.options,e.onChange,120)),pe&&/* @__PURE__ */J(b,{size:"sm",label:Ue.view,value:me,onChange:pe,options:[{value:"grid",label:Ue.grid,icon:X.grid},{value:"list",label:Ue.list,icon:X.list}]})]}),il=e=>{const n=[];return null!=e.trashedDaysAgo&&n.push({key:"t",label:Ue.daysAgo(e.trashedDaysAgo),count:e.trashedDaysAgo,icon:q.clock,tone:"neutral"}),e.usedCount&&n.push({key:"u",label:Ue.used(e.usedCount),count:e.usedCount,icon:q.link,tone:"active"}),e.email&&n.push({key:"e",label:Ue.email,icon:q.email,tone:"queued"}),e.private&&n.push({key:"p",label:Ue.private,icon:q.lock,tone:"neutral"}),n},tl=e=>il(e).map(e=>/* @__PURE__ */J(j,{tone:e.tone,size:"xs",children:e.label},e.key)),ol=We&&tn&&!!Ie&&!ve.move,dl=!!Me&&!an,sl=R(""),cl=R(null),ul=()=>cl.current?.dropped?"dropped":"cancelled",ml=R(Me);ml.current=Me;const pl=B(e=>{const n=cl.current;n&&(cl.current=null,n.stop(),S(sl.current,!1),e&&ml.current?.(e))},[]),hl=B(e=>{pl(ul());const n=Ge.current?.ownerDocument;if(!n)return;sl.current=T(Ge.current);const l=Ge.current?.closest("[data-modal-panel]"),r=e=>{sl.current&&!l?.contains(e.target)&&S(sl.current,!0)},a=()=>!!e&&!e.isConnected,i=()=>{const e=cl.current;if(e){if(a())return pl("dropped");e.dropped=!0,S(sl.current,!1)}},t=e=>{const n=e.dataTransfer?.dropEffect;pl(n&&"none"!==n?"dropped":a()?ul():"cancelled")},o=()=>{a()&&pl(ul())},d=["pointermove","pointerdown","mousemove","mousedown"];n.addEventListener("dragover",r,!0),n.addEventListener("drop",i,!0),n.addEventListener("dragend",t,!0);for(const e of d)n.addEventListener(e,o,!0);cl.current={dropped:!1,stop:()=>{n.removeEventListener("dragover",r,!0),n.removeEventListener("drop",i,!0),n.removeEventListener("dragend",t,!0);for(const e of d)n.removeEventListener(e,o,!0)}}},[pl]);W(()=>()=>pl(ul()),[pl]);const fl=(e,n,l)=>{if("start"!==e)return;const r=un.get(n);r&&gl(r)&&(hl(l??null),Me(e))},gl=e=>!dl||e.private||e.pickDisabledReason?void 0:JSON.stringify({id:e.id,url:e.url,kind:"video"===e.kind?"video":"image",name:e.name}),vl=te.map(e=>({id:e.id,url:e.thumbUrl??e.url,name:e.name,kind:e.kind,caption:e.name,badges:il(e),dragData:ol?JSON.stringify(mn.isSelected(e.id)?pn:[e.id]):gl(e),...ol&&gl(e)?{dragAlso:{[V]:gl(e)}}:{}})),kl=Je?Math.max(72,Math.floor((He-24-16-1)/3)):112,yl=R(null),bl=v({containerRef:yl,enabled:We&&!Je&&te.length>0,selected:mn.selected,setSelection:e=>mn.setSelection(e),clearSelection:mn.clear}),wl=e=>{if(Ye){const n=un.get(e);return void(!n||n.private||n.pickDisabledReason||Ee?.(n))}const n=cn.indexOf(e);n>=0&&Sn(n)},Nl=te.length?null:oe?/* @__PURE__ */J(t,{variant:"dashed",title:Ue.noMatches}):rn?/* @__PURE__ */J(t,{variant:"dashed",title:Ue.emptyProducts,description:sn(dn)}):an?/* @__PURE__ */J(t,{variant:"dashed",title:Ue.trashEmpty}):!Xn||Ye?/* @__PURE__ */J(t,{variant:"dashed",title:Ue.emptyFolder}):null,xl="list"===me&&te.length>0,Cl=Nl??(xl?/* @__PURE__ */J("ul",{role:"listbox","aria-multiselectable":We||void 0,"aria-label":Ue.folders,className:"flex flex-col gap-1",children:te.map(e=>/* @__PURE__ */G("li",{role:"option","aria-selected":mn.isSelected(e.id),tabIndex:0,"data-grid-item":"","data-grid-id":e.id,onClick:n=>yn(e.id,n),onDoubleClick:()=>wl(e.id),onContextMenu:n=>zn(e.id,n),draggable:!!gl(e)||void 0,onDragStart:gl(e)?n=>{n.dataTransfer.effectAllowed="link",n.dataTransfer.setData(V,gl(e)),fl("start",e.id,n.currentTarget)}:void 0,onKeyDown:n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),yn(e.id,n))},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)] "+(mn.isSelected(e.id)?"bg-accent-tint text-blue-700":"text-ink hover:bg-gray-100"),children:[
|
|
8
|
+
/* @__PURE__ */J("img",{src:e.thumbUrl??e.url,alt:"",className:"h-10 w-10 shrink-0 rounded bg-gray-100 object-contain"}),
|
|
9
|
+
/* @__PURE__ */J("span",{className:"min-w-0 flex-1 truncate",children:e.name}),
|
|
10
|
+
/* @__PURE__ */J("span",{className:"flex shrink-0 items-center gap-1",children:tl(e)}),e.sizeLabel&&/* @__PURE__ */J("span",{className:"w-16 shrink-0 text-right text-xs text-ink-faint",children:e.sizeLabel})]},e.id))}):/* @__PURE__ */J(p,{items:vl,readOnly:!Xn||Ye,onFiles:Xn&&!Ye?e=>Ne(e,on):void 0,accept:ke,maxSizeBytes:ye,busy:be,progress:we,fit:"contain",thumbSize:kl,dragType:ol?K:dl?V:void 0,onDragOutChange:dl?(e,n,l)=>fl(e,n,l):void 0,selected:mn.selected,onItemClick:yn,onItemDoubleClick:wl,onItemContextMenu:We?zn:void 0,menuOnMedia:We})),Il=u({count:pn.length,kind:In(pn),targets:Cn({kind:"files",ids:pn}),onPick:e=>Ie?.({kind:"files",ids:pn},e.key===s?null:e.key)}),Dl=A({variant:"secondary",size:"sm"}),Sl=/* @__PURE__ */J(L,{align:"start",triggerClassName:Dl,trigger:/* @__PURE__ */G(H,{children:[X.folder,Ue.moveTo]}),items:Il,disabled:!!ve.move}),Tl=We&&pn.length>1&&!rn?/* @__PURE__ */G("div",{"data-media-bulk":"",className:"flex flex-wrap items-center gap-2 rounded-lg border border-line px-3 py-2",children:[
|
|
11
|
+
/* @__PURE__ */J(y,{checked:pn.length===te.length,indeterminate:pn.length<te.length,onChange:e=>e?mn.selectAll():mn.clear(),label:Ue.selected(pn.length)}),/* @__PURE__ */G(H,an?{children:[Te&&/* @__PURE__ */J(O,{variant:"secondary",size:"sm",leftIcon:X.undo,onClick:()=>Te(pn),...el(ve.restore),children:Ue.restore}),je&&/* @__PURE__ */J(O,{variant:"secondary-danger",size:"sm",onClick:()=>je(pn),...el(ve.deleteForever),children:Ue.deleteForever})]}:{children:[Ie&&Sl,Ce&&/* @__PURE__ */J(O,{variant:"secondary",size:"sm",leftIcon:X.edit,disabled:!0,children:Ue.rename}),De&&/* @__PURE__ */J(O,{variant:"secondary",size:"sm",leftIcon:X.trash,onClick:()=>De({kind:"files",ids:pn}),...el(ve.trash),children:Ue.moveFilesToTrash(pn.length)})]}),
|
|
12
|
+
/* @__PURE__ */J(O,{variant:"ghost",size:"sm",onClick:mn.clear,children:Ue.clearSelection})]}):null,jl=e=>{const n=[],l=(e,l,r)=>{null!=r&&""!==r&&n.push({key:e,label:l,value:r})},r="file"===bn?.kind&&bn.id===e.id;l("name",Ue.name,r?/* @__PURE__ */J(m,{value:e.name,label:Ue.fileName,onDone:Nn}):e.name),l("type",Ue.type,e.typeLabel),l("size",Ue.size,e.sizeLabel),l("resolution",Ue.resolution,e.resolution),rn?(l("design",Ue.design,e.design),l("finish",Ue.finish,e.finish),l("angle",Ue.angleLug,e.angleLug),l("owner",Ue.owner,e.owner)):(l("added",Ue.addedBy,e.addedBy),l("folder",Ue.folder,e.folderPath)),l("used",Ue.usedIn,null!=e.usedCount?Ue.places(e.usedCount):void 0);const a=c({kind:"files",ids:[e.id]},Tn).find(e=>"submenu"===e.type);/* @__PURE__ */
|
|
13
|
+
return G("div",{"data-media-details":"",className:"flex flex-col gap-3",children:[
|
|
14
|
+
/* @__PURE__ */J("img",{src:e.url,alt:e.name,className:"aspect-square w-full rounded-lg bg-gray-100 object-contain"}),rn&&/* @__PURE__ */J(x,{tone:"neutral",title:Ue.readOnlyBadge,children:sn(dn)}),
|
|
15
|
+
/* @__PURE__ */J(o,{size:"sm",columns:1,items:n}),!an&&/* @__PURE__ */G("div",{className:"flex gap-2",children:[
|
|
16
|
+
/* @__PURE__ */J("div",{style:{flex:"1 1 0",minWidth:0},children:/* @__PURE__ */J(C,{size:"sm",readOnly:!0,value:e.url,"aria-label":Ue.fileUrl,onFocus:e=>e.currentTarget.select()})}),
|
|
17
|
+
/* @__PURE__ */J(O,{variant:"secondary",size:"sm",leftIcon:X.copy,onClick:()=>Tn.copyUrl(e.id),children:Ue.copyUrl})]}),tn&&We&&/* @__PURE__ */G("div",{className:"flex flex-wrap gap-2",children:[ze&&/* @__PURE__ */J(O,{variant:"secondary",size:"sm",leftIcon:X.swap,onClick:()=>ze(e.id),...el(ve.replace),children:Ue.replace}),Oe&&/* @__PURE__ */J(O,{variant:"secondary",size:"sm",leftIcon:X.crop,onClick:()=>Oe(e.id),children:Ue.cropEdit}),Ie&&"submenu"===a?.type&&/* @__PURE__ */J(L,{align:"start",triggerClassName:Dl,trigger:/* @__PURE__ */G(H,{children:[X.folder,Ue.moveTo]}),items:a.items,disabled:!!ve.move}),Ce&&/* @__PURE__ */J(O,{variant:"secondary",size:"sm",leftIcon:X.edit,onClick:()=>wn({kind:"file",id:e.id}),...el(ve.rename),children:Ue.rename}),De&&/* @__PURE__ */J(z,{"aria-label":Ue.moveToTrash,size:"sm",onClick:()=>De({kind:"files",ids:[e.id]}),disabledReason:ve.trash,"aria-disabled":!!ve.trash||void 0,children:X.trash})]}),an&&We&&/* @__PURE__ */G("div",{className:"flex flex-wrap gap-2",children:[Te&&/* @__PURE__ */J(O,{variant:"primary",size:"sm",leftIcon:X.undo,onClick:()=>Te([e.id]),...el(ve.restore),children:Ue.restore}),je&&/* @__PURE__ */J(O,{variant:"danger",size:"sm",onClick:()=>je([e.id]),...el(ve.deleteForever),children:Ue.deleteForever})]}),rn&&Fe&&/* @__PURE__ */J(O,{variant:"secondary",size:"sm",leftIcon:X.external,onClick:()=>Fe({kind:"render",id:e.id}),children:Ue.openInDesign}),ge&&/* @__PURE__ */J(h,{items:ge})]})},Ll=hn?hn.private?Ue.privateNoPick:hn.pickDisabledReason:void 0,zl=Ye?/* @__PURE__ */G("div",{"data-media-picker-footer":"",className:"flex flex-wrap items-center justify-between gap-2 border-t border-line px-3 py-2",children:[
|
|
18
|
+
/* @__PURE__ */J("span",{className:"min-w-0 truncate text-sm text-ink-faint",children:hn?Ue.oneChosen(hn.name):Ue.noneChosen}),
|
|
19
|
+
/* @__PURE__ */G("div",{className:"flex gap-2",children:[Ae&&/* @__PURE__ */J(O,{variant:"secondary",size:"sm",onClick:Ae,children:Ue.cancel}),
|
|
20
|
+
/* @__PURE__ */J(O,{variant:"primary",size:"sm",disabled:!hn,...el(Ll),onClick:()=>{hn&&!Ll&&Ee?.(hn)},children:Ue.chooseImage})]})]}):null,Ol=We&&!!hn,Fl=/* @__PURE__ */G("div",{className:"flex min-w-0 flex-col gap-3",children:[Pe&&/* @__PURE__ */J(x,{tone:"neutral",children:Pe}),
|
|
21
|
+
/* @__PURE__ */G("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[
|
|
22
|
+
/* @__PURE__ */J(d,{items:Zn}),nl]}),al,Tl,
|
|
23
|
+
/* @__PURE__ */G("div",{ref:yl,className:"relative",onPointerDown:bl.onPointerDown,onKeyDown:e=>{We&&(e.ctrlKey||e.metaKey)&&"a"===e.key.toLowerCase()?(e.preventDefault(),mn.selectAll()):"Escape"===e.key&&mn.size&&mn.clear()},children:[Cl,
|
|
24
|
+
/* @__PURE__ */J(a,{rect:bl.rect})]}),Xn&&/* @__PURE__ */J("input",{...qn.inputProps}),
|
|
25
|
+
/* @__PURE__ */J(D,{rejections:qn.rejections})]});/* @__PURE__ */
|
|
26
|
+
return G("div",{ref:Ge,"data-media-library":"","data-layout":Je?"phone":"wide",className:`flex h-full min-h-0 min-w-0 flex-col ${Re}`.trim(),children:[/* @__PURE__ */G("div",Je?{className:"flex flex-col gap-3 p-3",children:[Vn,Fl]}:{className:"flex min-h-0 min-w-0 flex-1",children:[
|
|
27
|
+
/* @__PURE__ */J("div",{className:"shrink-0 overflow-y-auto border-r border-line p-3",style:{width:280,"--rosh-tree-ground":"var(--surface)"},children:Vn}),
|
|
28
|
+
/* @__PURE__ */J("div",{className:"min-w-0 flex-1 overflow-y-auto p-3",children:Fl}),Ol&&/* @__PURE__ */J("div",{className:"shrink-0 overflow-y-auto border-l border-line p-3",style:{width:300},children:jl(hn)})]}),zl,Je&&/* @__PURE__ */J(i,{open:Ol,onClose:mn.clear,side:"bottom",title:hn?.name,children:hn&&jl(hn)}),Ln.state&&/* @__PURE__ */J(N,{...Ln.props,items:jn(Ln.state.data)}),null!=Dn&&te.length>0&&/* @__PURE__ */J(r,{images:te.map(e=>({url:e.url,caption:e.name})),startIndex:Math.min(Dn,te.length-1),onClose:()=>Sn(null)})]})}export{K as MEDIA_FILES_DRAG_TYPE,V as MEDIA_FILE_DRAG_TYPE,Q as MEDIA_FOLDER_DRAG_TYPE,_ as MediaLibrary,Z as readMediaFileDrag};
|