@stlite/desktop 0.91.0 → 0.91.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/build/assets/{ErrorOutline.esm-5cmZjQRC-icYL4BM5.js → ErrorOutline.esm-BLjkDUgO-BiXylF9Q.js} +1 -1
- package/build/assets/{FileDownload.esm-rDRR6AEq-DjpuiBZc.js → FileDownload.esm-BP6Yw6Mo-BauI2spi.js} +1 -1
- package/build/assets/{FileHelper-DDgj8qUb-DZYWXyeE.js → FileHelper-BCkX4r3T-DFMmrw88.js} +1 -1
- package/build/assets/{FormClearHelper-Bi1RDDCw-CUfvtGEu.js → FormClearHelper-Dgu5Halt-BxICjxpW.js} +1 -1
- package/build/assets/{Hooks-BLb3umpI-D_n25nUE.js → Hooks-BLb3umpI-9FUxV5o-.js} +1 -1
- package/build/assets/{InputInstructions-DK4vKQJt-CxHQuxCq.js → InputInstructions-yTnPUqJo-CoOBrVL7.js} +1 -1
- package/build/assets/{Particles-CVTDiAXz-DxW9qGxs.js → Particles-Dlshfcc8-CNq_pZlo.js} +1 -1
- package/build/assets/{ProgressBar-DBzTytnw-KD3bOGNH.js → ProgressBar-bzD0ionS-CaMxdV67.js} +1 -1
- package/build/assets/{Toolbar-C79vGzHM-4gREjS-R.js → Toolbar-Ba82LOXi-C-TMlOex.js} +1 -1
- package/build/assets/{base-input-DqwZ6cLM-CfKARdZH.js → base-input-DjjpNP8Y-DtsTHlXD.js} +1 -1
- package/build/assets/{checkbox-DSLjv1hz-C5dTTEJn.js → checkbox-i_07yegq-B7N8fYE1.js} +1 -1
- package/build/assets/{createSuper-B3kpwht8-vR1ZxlfE.js → createSuper-Bj1hzAgo-DTBN9Cdm.js} +1 -1
- package/build/assets/{data-grid-overlay-editor-DlwBF2tR-B5qTFESv.js → data-grid-overlay-editor-BiH9JogL-SwK5dD6O.js} +1 -1
- package/build/assets/{downloader-DcCTL3Wz-B8zcxQVm.js → downloader-DcCTL3Wz-szZSaHY-.js} +1 -1
- package/build/assets/{es6--XPcqeHG-Ct8fR_QW.js → es6--XPcqeHG-B7r8Rb2B.js} +2 -2
- package/build/assets/{iframeResizer.contentWindow-BYeUxEkG-BGHgpKaO.js → iframeResizer.contentWindow-D_iySM1B-C8GQUol2.js} +1 -1
- package/build/assets/{index-B77TIzH--_sfHBOLj.js → index-0Kn1AVK2-CFHLqZQv.js} +1 -1
- package/build/assets/{index-DJv86VV6-BxF_m0zQ.js → index-B-TfdrsK-M9kXXCZC.js} +1 -1
- package/build/assets/{index-CFJPpmiv-DJLEtKZ0.js → index-B-p8cwea-D1OIlg5n.js} +1 -1
- package/build/assets/{index-fJZU9fvL-CKGTaTkl.js → index-B3KILbqX-BzOz8wK5.js} +1 -1
- package/build/assets/{index-DfmwwL-F-BtkRVq0J.js → index-BB-Jchwk-Bom7C4Yg.js} +1 -1
- package/build/assets/{index-p30tlBB--Bny4OpXe.js → index-BPtHoAnG-Bw2wANqW.js} +1 -1
- package/build/assets/{index-fUOYudAa-DwvNVa4q.js → index-B_WoYQrI-DzwQulx6.js} +1 -1
- package/build/assets/{index-DpgEDPmz-DJh9zWZb.js → index-BhasphER-CtCV9cV8.js} +1 -1
- package/build/assets/{index-BFxpMDN6-DR2ES9VX.js → index-Bo7cn_f6-DkJNz7_c.js} +1 -1
- package/build/assets/{index-j0zTFwH2-B6bjwCqo.js → index-BxHa0gYF-QN3i1uRA.js} +1 -1
- package/build/assets/{index-B7QM9sAr-BJJ9a1xS.js → index-CATwv37T-B7vouX3Y.js} +1 -1
- package/build/assets/{index-CQ0SOKgT-K7zOmyHq.js → index-CAzavyuT-BhYS_U-d.js} +1 -1
- package/build/assets/{index-xHja9EuR-BJAq-yTR.js → index-CSKWQlNk-CT5sDNrq.js} +1 -1
- package/build/assets/{index-DUxsAr3N-YOYvjsWo.js → index-CTwTw5ms-DakzaYYn.js} +1 -1
- package/build/assets/{index-CK3GkxeH-D2XBcs5n.js → index-C_q9gQa7-DDnyjQrF.js} +1 -1
- package/build/assets/{index-CKLXnSph-0c1m_tEn.js → index-Ct4am237-CcMxDLpd.js} +1 -1
- package/build/assets/{index-D6seXbqB-BPSqxK2r.js → index-CugHuPaw-BlbAJDrs.js} +1 -1
- package/build/assets/{index-DdN7bQv1-B-kAc3Ut.js → index-CvM3pTat-B8q07d1y.js} +1 -1
- package/build/assets/{index-DlIOBmG6-fWsA1K6o.js → index-D0GcWpyX--juTltdu.js} +1 -1
- package/build/assets/{index-BUGX2TMK.js → index-D3uELfdo.js} +44 -44
- package/build/assets/{index-BV9PPylv-DWAKeZC_.js → index-D5JbiLwX-CJBgVo_3.js} +1 -1
- package/build/assets/{index-CqUzXpnq-BkRqyTZ-.js → index-DDqIvyop-CtB9mW2T.js} +1 -1
- package/build/assets/{index-BkEF79ga-BDywftDb.js → index-DMjPNVEr-D5adQnea.js} +1 -1
- package/build/assets/{index-CZG1F3wS-BFc-W9r-.js → index-DOzur6Jw-BNtjcqTY.js} +1 -1
- package/build/assets/{index-BacWTAj2-C6QHLACm.js → index-DU9g9Sd6-Daa3488f.js} +1 -1
- package/build/assets/{index-BPsr3GBY-CJGmhZ4p.js → index-DUaAy90Q-XjKFsjy5.js} +1 -1
- package/build/assets/{index-0V3zFawH-dk2qSnUj.js → index-DhLLbarZ-JEJ3GjGo.js} +1 -1
- package/build/assets/{index-CxQBvv94-C1cgCYzN.js → index-DmB3SAP2-X6jwpSIv.js} +1 -1
- package/build/assets/{index-zCpSIFXF-CNWD8XSX.js → index-EaQvJARH-BtsSVy_Q.js} +1 -1
- package/build/assets/{index-D--Ibtdf-DP7qoXbQ.js → index-Fts1z9_x-20UUj5MC.js} +1 -1
- package/build/assets/{index-DDzvi540-BP83xTE8.js → index-GJmmE3rK-9unNgOON.js} +1 -1
- package/build/assets/{index-Cwu3avS4-DiDBV46w.js → index-GLEJ4uEg-Df22L041.js} +16 -16
- package/build/assets/{index-BQabGVla-C_9TU-y1.js → index-NlD3wxQH-BRnDRGJG.js} +1 -1
- package/build/assets/{index-pBZdYFXV-CISZ02sQ.js → index-X1p_3J78-Vt5ccOoW.js} +1 -1
- package/build/assets/index-kYeUTGL3-OTlUcjkG.js +1 -0
- package/build/assets/{index-Ng0C2pop-CzH2RCjT.js → index-p-pTZlQx-8zFcur2d.js} +1 -1
- package/build/assets/{index-Hwxwzkvz-BrKybKu3.js → index-vYM99bZC-_qzTrUih.js} +1 -1
- package/build/assets/{inherits-V2B09WF6-BfQai87E.js → inherits-Rx5YJbse-DVYurFFp.js} +1 -1
- package/build/assets/{input-0QG8D109-QEdIPUBc.js → input-BDVeiWWL-DMiIFeVV.js} +1 -1
- package/build/assets/{memory-B3L1Fctl-DNNZq00W.js → memory-B3L1Fctl-Bm8c-YGK.js} +1 -1
- package/build/assets/{number-overlay-editor-CQf9AWEA-RmKnGQqj.js → number-overlay-editor-BGJ9OD_Z-DIBxtO2v.js} +1 -1
- package/build/assets/{sandbox-ChAzL-i--Bt92ucFR.js → sandbox-ChAzL-i--D3ngLCsZ.js} +1 -1
- package/build/assets/{slicedToArray-bXF_q2D_-C8JYb8qs.js → slicedToArray-DCtO1hP1-DNgLFFIn.js} +1 -1
- package/build/assets/{timepicker-BaiGCRZ1-Sm9ehMNI.js → timepicker-BTEFSiul-BiCu9n-C.js} +1 -1
- package/build/assets/{uniqueId-DEZw4fCm-ChV-p6H5.js → uniqueId-DFKpdKNq-BgvPpMK3.js} +1 -1
- package/build/assets/{useBasicWidgetState-gAw0WJ0t-BlUmDiku.js → useBasicWidgetState-DqA4I-I_-DtgK63iS.js} +1 -1
- package/build/assets/{useTextInputAutoExpand-CrQdinCr-BiEwhNXe.js → useTextInputAutoExpand-Di5cdshf-IDsnD2RC.js} +1 -1
- package/build/assets/{useUpdateUiValue-Bz-Z5Int-0QBs3uQx.js → useUpdateUiValue-09I2_X1f-DW6jbCsf.js} +1 -1
- package/build/assets/{withFullScreenWrapper-BKnfDWJg-dLKoL1-0.js → withFullScreenWrapper-WW0e_nhm-CAjrnrPK.js} +1 -1
- package/build/index.html +1 -1
- package/package.json +2 -2
- package/wheels/streamlit-1.50.0-cp313-none-any.whl +0 -0
- package/build/assets/index-BaDPYxKb-eLNjgO02.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,f as U,m as B,bV as S,j as s,c as _,aI as G,aJ as y,b0 as J,aK as K,ap as N,bW as O}from"./index-
|
|
1
|
+
import{r as a,f as U,m as B,bV as S,j as s,c as _,aI as G,aJ as y,b0 as J,aK as K,ap as N,bW as O}from"./index-D3uELfdo.js";import{I as X}from"./uniqueId-DFKpdKNq-BgvPpMK3.js";import{e as Z}from"./InputInstructions-yTnPUqJo-CoOBrVL7.js";import{S as q}from"./useBasicWidgetState-DqA4I-I_-DtgK63iS.js";import{v as Q,a as Y,c as $}from"./useUpdateUiValue-09I2_X1f-DW6jbCsf.js";import{p as ee,r as te}from"./useTextInputAutoExpand-Di5cdshf-IDsnD2RC.js";import"./FormClearHelper-Dgu5Halt-BxICjxpW.js";import"./inputUtils-DCYiajnz-DsrlAoKH.js";import"./base-input-DjjpNP8Y-DtsTHlXD.js";const ie=(t,e)=>{let l="auto";if(t.heightConfig?.useStretch)l="100%";else if(t.heightConfig?.pixelHeight&&t.heightConfig.pixelHeight>0){const r=y(e.labelVisibility?.value)===O.Collapsed?2:30;l=`${t.heightConfig.pixelHeight-r}px`}return l},le=_("div",{target:"ezh4s2r0"})({name:"kdbhus",styles:"height:100%;display:flex;flex-direction:column"}),W=(t,e)=>t.getStringValue(e)??e.default??null,ae=t=>t.default??null,re=t=>t.value??null,oe=(t,e,l,r)=>{e.setStringValue(t,l.value,{fromUi:l.fromUi},r)},se=({disabled:t,element:e,widgetMgr:l,fragmentId:r,outerElement:m})=>{const c=a.useRef(X("text_area_")).current,{width:I,elementRef:T}=U(),[o,u]=a.useState(!1),[v,b]=a.useState(!1),d=m.heightConfig?.useContent??!1,H=m.heightConfig?.useStretch??!1,R=ie(m,e),x=a.useRef(null),[n,h]=a.useState(()=>W(l,e)??null),V=a.useCallback(()=>{h(e.default??null),u(!0)},[e]),[E,g]=q({getStateFromWidgetMgr:W,getDefaultStateFromProto:ae,getCurrStateFromProto:re,updateWidgetMgrState:oe,element:e,widgetMgr:l,fragmentId:r,onFormCleared:V});Q(E,n,h,o);const i=B(),{height:F,maxHeight:j,updateScrollHeight:C}=ee({textareaRef:x,dependencies:[e.placeholder]}),f=a.useCallback(()=>{u(!1),g({value:n,fromUi:!0})},[n,g]),z=a.useCallback(()=>{o&&f(),b(!1)},[o,f]),k=a.useCallback(()=>{b(!0)},[]),w=a.useCallback(()=>{d&&C()},[d,C]),L=Y({formId:e.formId,maxChars:e.maxChars,setDirty:u,setUiValue:h,setValueWithSource:g,additionalAction:w}),A=$(e.formId,f,o,l,r,!0),{placeholder:D,formId:p}=e,M=S({formId:p})?l.allowFormEnterToSubmit(p):o,P=v&&I>i.breakpoints.hideWidgetDetails;return s.jsxs(le,{className:"stTextArea","data-testid":"stTextArea",ref:T,children:[s.jsx(G,{label:e.label,disabled:t,labelVisibility:y(e.labelVisibility?.value),htmlFor:c,children:e.help&&s.jsx(J,{children:s.jsx(K,{content:e.help,placement:N.TOP_RIGHT})})}),s.jsx(te,{inputRef:d?x:void 0,value:n??"",placeholder:D,onBlur:z,onFocus:k,onChange:L,onKeyDown:A,"aria-label":e.label,disabled:t,id:c,overrides:{Input:{style:{fontWeight:i.fontWeights.normal,lineHeight:i.lineHeights.inputWidget,height:d?F:R,maxHeight:d?j:"",minHeight:i.sizes.largestElementHeight,resize:H?"none":"vertical",paddingRight:i.spacing.md,paddingLeft:i.spacing.md,paddingBottom:i.spacing.md,paddingTop:i.spacing.md,"::placeholder":{color:i.colors.fadedText60}}},Root:{props:{"data-testid":"stTextAreaRootElement"},style:{borderLeftWidth:i.sizes.borderWidth,borderRightWidth:i.sizes.borderWidth,borderTopWidth:i.sizes.borderWidth,borderBottomWidth:i.sizes.borderWidth,flexGrow:1}}}}),P&&s.jsx(Z,{dirty:o,value:n??"",maxLength:e.maxChars,type:"multiline",inForm:S({formId:p}),allowEnterToSubmit:M})]})},be=a.memo(se);export{be as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,m as pe,f as me,bV as fe,x as G,c7 as w,v as b,aB as O,j as l,aI as ge,aJ as he,b0 as be,aK as ye,ap as ve,c as S,F as we,aR as _,l as xe,E as J,_ as q}from"./index-
|
|
1
|
+
import{r as a,m as pe,f as me,bV as fe,x as G,c7 as w,v as b,aB as O,j as l,aI as ge,aJ as he,b0 as be,aK as ye,ap as ve,c as S,F as we,aR as _,l as xe,E as J,_ as q}from"./index-D3uELfdo.js";import{I as Te}from"./uniqueId-DFKpdKNq-BgvPpMK3.js";import{e as Ie}from"./InputInstructions-yTnPUqJo-CoOBrVL7.js";import{m as Ce}from"./FormClearHelper-Dgu5Halt-BxICjxpW.js";import{_ as ke}from"./sprintf-D5E86llw-6tzWM3a-.js";import{a as Re}from"./input-BDVeiWWL-DMiIFeVV.js";import"./base-input-DjjpNP8Y-DtsTHlXD.js";var Q=a.forwardRef(function(e,t){var n={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return a.createElement(J,q({iconAttrs:n,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},e,{ref:t}),a.createElement("path",{d:"M0 3v2h8V3H0z"}))});Q.displayName="Minus";var Y=a.forwardRef(function(e,t){var n={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return a.createElement(J,q({iconAttrs:n,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},e,{ref:t}),a.createElement("path",{d:"M3 0v3H0v2h3v3h2V5h3V3H5V0H3z"}))});Y.displayName="Plus";const Ee=S("div",{target:"e116k4er3"})(({theme:e})=>({display:"flex",flexDirection:"row",flexWrap:"nowrap",alignItems:"center",height:e.sizes.minElementHeight,borderWidth:e.sizes.borderWidth,borderStyle:"solid",borderColor:e.colors.widgetBorderColor??e.colors.secondaryBg,transitionDuration:"200ms",transitionProperty:"border",transitionTimingFunction:"cubic-bezier(0.2, 0.8, 0.4, 1)",borderRadius:e.radii.default,overflow:"hidden","&.focused":{borderColor:e.colors.primary},input:{MozAppearance:"textfield","&::-webkit-inner-spin-button, &::-webkit-outer-spin-button":{WebkitAppearance:"none",margin:e.spacing.none}}}),""),Se=S("div",{target:"e116k4er2"})({name:"76z9jo",styles:"display:flex;flex-direction:row;align-self:stretch"}),K=S("button",{target:"e116k4er1"})(({theme:e})=>({margin:e.spacing.none,border:"none",height:e.sizes.full,display:"flex",alignItems:"center",width:e.sizes.numberInputControlsWidth,justifyContent:"center",color:e.colors.bodyText,transition:"color 300ms, backgroundColor 300ms",backgroundColor:e.colors.secondaryBg,"&:hover:enabled, &:focus:enabled":{color:e.colors.white,backgroundColor:e.colors.primary,transition:"none",outline:"none"},"&:active":{outline:"none",border:"none"},"&:disabled":{cursor:"not-allowed",color:e.colors.fadedText40}}),""),Ve=S("div",{target:"e116k4er0"})(({theme:e,clearable:t})=>({position:"absolute",marginRight:e.spacing.twoXS,left:0,right:`calc(${e.sizes.numberInputControlsWidth} * 2 + ${t?"1em":"0em"})`}),""),Ne=xe.getLogger("NumberInput");function ze(e){return b(e)||e===""?void 0:e}const E=({value:e,format:t,step:n,dataType:f})=>{if(b(e))return null;let r=ze(t);if(b(r)&&G(n)){const i=n.toString();f===w.DataType.FLOAT&&n!==0&&i.includes(".")&&(r=`%0.${i.split(".")[1].length}f`)}if(b(r))return e.toString();try{return ke.sprintf(r,e)}catch(i){return Ne.warn(`Error in sprintf(${r}, ${e}): ${i}`),String(e)}},je=(e,t,n)=>b(e)?!1:e-t>=n,De=(e,t,n)=>b(e)?!1:e+t<=n,We=e=>(e.element.dataType===w.DataType.INT?e.widgetMgr.getIntValue(e.element):e.widgetMgr.getDoubleValue(e.element))??e.element.default??null,X=({step:e,dataType:t})=>e||(t===w.DataType.INT?1:.01),Fe=({disabled:e,element:t,widgetMgr:n,fragmentId:f})=>{const r=pe(),{dataType:i,id:V,formId:m,default:W,format:g,icon:N,min:y,max:v}=t,{width:F,elementRef:Z}=me(),[s,ee]=a.useState(()=>X(t)),L=We({element:t,widgetMgr:n}),[h,x]=a.useState(!1),[d,T]=a.useState(L),[B,U]=a.useState(!1),C=a.useRef(null),M=a.useRef(Te("number_input_")),[A,I]=a.useState(()=>E({value:L,dataType:i,format:g,step:s})),k=je(d,s,y),R=De(d,s,v),H=fe({formId:m}),te=H?n.allowFormEnterToSubmit(m):h,re=B&&F>r.breakpoints.hideWidgetDetails;a.useEffect(()=>{ee(X({step:t.step,dataType:t.dataType}))},[t.dataType,t.step]),a.useEffect(()=>{h||I(E({value:d,dataType:i,format:g,step:s}))},[i,g,s]);const c=a.useCallback(({value:o,source:u})=>{if(G(o)&&(y>o||o>v))C.current?.reportValidity();else{const p=o??W??null;switch(i){case w.DataType.INT:n.setIntValue({id:V,formId:m},p,u,f);break;case w.DataType.FLOAT:n.setDoubleValue({id:V,formId:m},p,u,f);break;default:throw new Error("Invalid data type")}x(!1),T(p),I(E({value:p,dataType:i,format:g,step:s}))}},[y,v,C,n,f,s,i,V,m,W,g]),ae=a.useCallback(()=>{h&&c({value:d,source:{fromUi:!0}}),U(!1)},[h,d,c]),oe=a.useCallback(()=>{U(!0)},[]),$=a.useCallback(()=>{const{value:o}=t;t.setValue=!1,T(o??null),I(E({value:o??null,dataType:i,format:g,step:s})),c({value:o??null,source:{fromUi:!1}})},[t,s,c,i,g]);a.useEffect(()=>{t.setValue?$():c({value:d,source:{fromUi:!1}});const o=C.current;if(o){const u=p=>{p.preventDefault()};return o.addEventListener("wheel",u),()=>{o.removeEventListener("wheel",u)}}},[]),t.setValue&&$();const z=b(t.default)&&!e,ne=a.useCallback(()=>{const o=t.default??null;T(o),c({value:o,source:{fromUi:!0}})},[t]);Ce({element:t,widgetMgr:n,onFormCleared:ne});const se=o=>{const{value:u}=o.target;if(u==="")x(!0),T(null),I(null);else{let p;t.dataType===w.DataType.INT?p=parseInt(u,10):p=parseFloat(u),x(!0),T(p),I(u)}},j=a.useCallback(()=>{R&&(x(!0),c({value:(d??y)+s,source:{fromUi:!0}}))},[d,y,s,R]),D=a.useCallback(()=>{k&&(x(!0),c({value:(d??v)-s,source:{fromUi:!0}}))},[d,v,s,k]),le=a.useCallback(o=>{const{key:u}=o;switch(u){case"ArrowUp":o.preventDefault(),j();break;case"ArrowDown":o.preventDefault(),D();break}},[j,D]),ie=a.useCallback(o=>{o.key==="Enter"&&(h&&c({value:d,source:{fromUi:!0}}),n.allowFormEnterToSubmit(m)&&n.submitForm(m,f))},[h,d,c,n,m,f]),P=N?.startsWith(":material"),de=P?"lg":"base",ue=O(r.iconSizes.lg)+2*O(r.spacing.twoXS),ce=N?r.breakpoints.hideNumberInputControls+ue:r.breakpoints.hideNumberInputControls;return l.jsxs("div",{className:"stNumberInput","data-testid":"stNumberInput",ref:Z,children:[l.jsx(ge,{label:t.label,disabled:e,labelVisibility:he(t.labelVisibility?.value),htmlFor:M.current,children:t.help&&l.jsx(be,{children:l.jsx(ye,{content:t.help,placement:ve.TOP_RIGHT})})}),l.jsxs(Ee,{className:B?"focused":"","data-testid":"stNumberInputContainer",children:[l.jsx(Re,{type:"number",inputRef:C,value:A??"",placeholder:t.placeholder,onBlur:ae,onFocus:oe,onChange:se,onKeyPress:ie,onKeyDown:le,clearable:z,clearOnEscape:z,disabled:e,"aria-label":t.label,startEnhancer:t.icon&&l.jsx(we,{"data-testid":"stNumberInputIcon",iconValue:t.icon,size:de}),id:M.current,overrides:{ClearIconContainer:{style:{padding:0}},ClearIcon:{props:{overrides:{Svg:{style:{color:r.colors.grayTextColor,padding:r.spacing.threeXS,height:r.sizes.clearIconSize,width:r.sizes.clearIconSize,":hover":{fill:r.colors.bodyText}}}}}},Input:{props:{"data-testid":"stNumberInputField",step:s,min:y,max:v,type:"number",inputMode:""},style:{fontWeight:r.fontWeights.normal,lineHeight:r.lineHeights.inputWidget,paddingRight:r.spacing.sm,paddingLeft:r.spacing.md,paddingBottom:r.spacing.sm,paddingTop:r.spacing.sm,"::placeholder":{color:r.colors.fadedText60}}},InputContainer:{style:()=>({borderTopRightRadius:0,borderBottomRightRadius:0})},Root:{style:{borderTopRightRadius:0,borderBottomRightRadius:0,borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeftWidth:0,borderRightWidth:0,borderTopWidth:0,borderBottomWidth:0,paddingRight:0,paddingLeft:N?r.spacing.sm:0}},StartEnhancer:{style:{paddingLeft:0,paddingRight:0,minWidth:r.iconSizes.lg,color:P?r.colors.fadedText60:"inherit"}}}}),F>ce&&l.jsxs(Se,{children:[l.jsx(K,{"data-testid":"stNumberInputStepDown",onClick:D,disabled:!k||e,tabIndex:-1,children:l.jsx(_,{content:Q,size:"xs",color:k?"inherit":r.colors.fadedText40})}),l.jsx(K,{"data-testid":"stNumberInputStepUp",onClick:j,disabled:!R||e,tabIndex:-1,children:l.jsx(_,{content:Y,size:"xs",color:R?"inherit":r.colors.fadedText40})})]})]}),re&&l.jsx(Ve,{clearable:z,children:l.jsx(Ie,{dirty:h,value:A??"",inForm:H,allowEnterToSubmit:te})})]})},Pe=a.memo(Fe);export{Pe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as C,ah as b,e as y,j as i,c as h,a as E,H as I,l as L}from"./index-
|
|
1
|
+
import{r as C,ah as b,e as y,j as i,c as h,a as E,H as I,l as L}from"./index-D3uELfdo.js";import{v as M,d as W}from"./withFullScreenWrapper-WW0e_nhm-CAjrnrPK.js";import{R as p,y as R}from"./Toolbar-Ba82LOXi-C-TMlOex.js";const v=h("div",{target:"e115fcil2"})(({theme:e,shouldStretch:t})=>({display:"flex",flexDirection:"row",flexWrap:"wrap",rowGap:e.spacing.lg,maxWidth:"100%",width:t?"100%":"fit-content"}),""),H=h("div",{target:"e115fcil1"})(({theme:e,shouldStretch:t})=>({display:"flex",flexDirection:"column",alignItems:"stretch",width:t?"100%":"auto",flexGrow:t?1:0,">img":{borderRadius:e.radii.default}}),""),T=h("div",{target:"e115fcil0"})(({theme:e})=>({textAlign:"center",marginTop:e.spacing.xs,wordWrap:"break-word",padding:e.spacing.threeXS}),""),F=L.getLogger("ImageList");function $(e,t,r){if(e){if(e.useStretch)return r;if(e.useContent)return;if(e.pixelWidth)return e.pixelWidth}if(t!=null)switch(t){case-1:case-3:case-4:return;case-2:case-5:return r;default:return t>0?t:void 0}}const G=({itemKey:e,image:t,imgStyle:r,buildMediaURL:n,handleImageError:d,shouldStretch:s})=>{const l=E(t.url);return i.jsxs(H,{"data-testid":"stImageContainer",shouldStretch:s,children:[i.jsx("img",{style:r,src:n(t.url),alt:e,onError:d,crossOrigin:l}),t.caption&&i.jsx(T,{"data-testid":"stImageCaption",style:r,children:i.jsx(I,{source:t.caption,allowHTML:!1,isCaption:!0,isLabel:!0})})]})};function O({element:e,endpoints:t,widthConfig:r,disableFullscreenMode:n}){const d=b(e.imgs),{expanded:s,width:l,height:c,expand:x,collapse:f}=y(W),g=l||0,w=$(r,e.width,g),m=r?.useStretch||e.width===-5,a={};c&&s?(a.maxHeight=c,a.objectFit="contain",a.width="100%"):(a.width=w??"100%",a.maxWidth="100%");const S=u=>{const o=u.currentTarget.src;F.error(`Client Error: Image source error - ${o}`),t.sendClientErrorToHost("Image","Image source failed to load","onerror triggered",o)};return i.jsxs(p,{width:g,height:c,useContainerWidth:s,topCentered:!0,children:[i.jsx(R,{target:p,isFullScreen:s,onExpand:x,onCollapse:f,disableFullscreenMode:n}),i.jsx(v,{className:"stImage","data-testid":"stImage",shouldStretch:m,children:d.map((u,o)=>i.jsx(G,{itemKey:o.toString(),image:u,imgStyle:a,buildMediaURL:j=>t.buildMediaURL(j),handleImageError:S,shouldStretch:m},o))})]})}const U=M(O),K=C.memo(U);export{K as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a$ as k,r as d,y as $,aL as X,v as g,b as f,aN as O,aM as q,j as a,c as p,aI as _,aJ as J,b0 as Q,aK as K,ap as Y,aB as Z,aQ as u,al as G,ai as x,aE as ee,aR as m,E as y,_ as b}from"./index-BUGX2TMK.js";import{d as te}from"./FormClearHelper-Bi1RDDCw-CUfvtGEu.js";import{C as ie,q as se,E as le,S as ae,f as z,A as w,P as re,_ as oe}from"./FileHelper-DDgj8qUb-DZYWXyeE.js";import{q as ne,U as de}from"./ProgressBar-DBzTytnw-KD3bOGNH.js";import{o as pe}from"./Hooks-BLb3umpI-D_n25nUE.js";import{t as F}from"./UploadFileInfo-B5SttewO-BfvME59S.js";var U=d.forwardRef(function(e,s){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return d.createElement(y,b({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:s}),d.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),d.createElement("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12l4.58-4.59z"}))});U.displayName="ChevronLeft";var v=d.forwardRef(function(e,s){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return d.createElement(y,b({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:s}),d.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),d.createElement("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6-6-6z"}))});v.displayName="ChevronRight";var I=d.forwardRef(function(e,s){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return d.createElement(y,b({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:s}),d.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),d.createElement("path",{d:"M19.35 10.04A7.49 7.49 0 0012 4C9.11 4 6.6 5.64 5.35 8.04A5.994 5.994 0 000 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM19 18H6c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97l1.07-.11.5-.95A5.469 5.469 0 0112 6c2.62 0 4.88 1.86 5.39 4.43l.3 1.5 1.53.11A2.98 2.98 0 0122 15c0 1.65-1.35 3-3 3zM8 13h2.55v3h2.9v-3H16l-4-4z"}))});I.displayName="CloudUpload";var C=d.forwardRef(function(e,s){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return d.createElement(y,b({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:s}),d.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}))});C.displayName="Error";const B=p("section",{target:"e1b2p2ww17"})(({isDisabled:e,theme:s})=>({display:"flex",gap:s.spacing.lg,alignItems:"center",padding:s.spacing.lg,backgroundColor:s.colors.secondaryBg,borderRadius:s.radii.default,border:s.colors.widgetBorderColor?`${s.sizes.borderWidth} solid ${s.colors.widgetBorderColor}`:void 0,height:s.sizes.largestElementHeight,":focus":{outline:"none"},":focus-visible":{boxShadow:`0 0 0 1px ${s.colors.primary}`},cursor:e?"not-allowed":"pointer"}),""),ce=p("div",{target:"e1b2p2ww16"})(({theme:e})=>({marginRight:"auto",alignItems:"center",display:"flex",gap:e.spacing.lg,minWidth:0,width:"100%"}),""),M=p("span",{target:"e1b2p2ww15"})(({theme:e})=>({color:e.colors.darkenedBgMix100}),""),E=p("span",{target:"e1b2p2ww14"})(({theme:e,disabled:s})=>({color:s?e.colors.fadedText40:e.colors.bodyText}),""),he=p("span",{target:"e1b2p2ww13"})(({theme:e,disabled:s})=>({fontSize:e.fontSizes.sm,color:s?e.colors.fadedText40:e.colors.fadedText60,display:"block",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",maxWidth:"100%"}),""),ge=p("div",{target:"e1b2p2ww12"})({name:"1s8jot1",styles:"display:flex;flex-direction:column;min-width:0;max-width:100%"}),me=p("span",{target:"e1b2p2ww11"})({name:"1bmnxg7",styles:"white-space:nowrap"}),D=p("div",{target:"e1b2p2ww10"})(({theme:e})=>({left:0,right:0,lineHeight:e.lineHeights.tight,paddingTop:e.spacing.md,paddingLeft:e.spacing.lg,paddingRight:e.spacing.lg}),""),fe=p("ul",{target:"e1b2p2ww9"})(({theme:e})=>({listStyleType:"none",margin:e.spacing.none,padding:e.spacing.none}),""),L=p("li",{target:"e1b2p2ww8"})(({theme:e})=>({margin:e.spacing.none,padding:e.spacing.none}),""),A=p("div",{target:"e1b2p2ww7"})(({theme:e})=>({display:"flex",alignItems:"baseline",flex:1,paddingLeft:e.spacing.lg,overflow:"hidden"}),""),V=p("div",{target:"e1b2p2ww6"})(({theme:e,disabled:s})=>({marginRight:e.spacing.sm,marginBottom:e.spacing.twoXS,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:s?e.colors.fadedText40:e.colors.bodyText}),""),R=p("div",{target:"e1b2p2ww5"})(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing.twoXS}),""),ue=p("span",{target:"e1b2p2ww4"})(({theme:e})=>({marginRight:e.spacing.twoXS}),""),xe=p("div",{target:"e1b2p2ww3"})(({theme:e,disabled:s})=>({display:"flex",padding:e.spacing.twoXS,color:s?e.colors.fadedText40:e.colors.darkenedBgMix100}),""),T=p("small",{target:"e1b2p2ww2"})(({theme:e})=>({color:e.colors.redTextColor,fontSize:e.fontSizes.sm,height:e.fontSizes.sm,lineHeight:e.fontSizes.sm,display:"flex",alignItems:"center",whiteSpace:"nowrap"}),""),N=p("span",{target:"e1b2p2ww1"})({name:"0",styles:""}),we=e=>({[B]:{display:"flex",flexDirection:"column",alignItems:"flex-start",height:"auto",gap:e.spacing.sm},[M]:{display:"none"},[E]:{marginBottom:e.spacing.twoXS},[D]:{paddingRight:e.spacing.lg},[R]:{maxWidth:"inherit",flex:1,alignItems:"flex-start",marginBottom:e.spacing.sm},[V]:{width:e.sizes.full},[A]:{flexDirection:"column"},[T]:{height:"auto",whiteSpace:"initial"},[N]:{display:"none"},[L]:{margin:e.spacing.none,padding:e.spacing.none}}),ye=p("div",{target:"e1b2p2ww0"})(({theme:e,width:s})=>{if(s<Z("23rem"))return we(e)},""),be=({multiple:e,acceptedExtensions:s,maxSizeBytes:t,acceptDirectory:i=!1,disabled:l})=>{const o=()=>i?"directories":e?"files":"file",r=()=>s.length?` • ${s.map(c=>c.replace(/^\./,"").toUpperCase()).join(", ")}`:null,n=()=>`Limit ${z(t,w.Byte,0)} per file`;return a.jsxs(ce,{"data-testid":"stFileUploaderDropzoneInstructions",children:[a.jsx(M,{children:a.jsx(m,{content:I,size:"threeXL"})}),a.jsxs(ge,{children:[a.jsxs(E,{disabled:l,children:["Drag and drop ",o()," here"]}),a.jsxs(he,{disabled:l,children:[n(),r()]})]})]})},Se=d.memo(be),Fe=({onDrop:e,multiple:s,acceptedExtensions:t,maxSizeBytes:i,disabled:l,label:o,acceptDirectory:r=!1})=>a.jsx(le,{onDrop:e,multiple:s,accept:ae(t),maxSize:i,disabled:l,useFsAccessApi:!1,children:({getRootProps:n,getInputProps:c})=>{const h=c({multiple:s||!!r});return a.jsxs(B,{...n(),"data-testid":"stFileUploaderDropzone",isDisabled:l,"aria-label":o,"aria-disabled":l,children:[a.jsx("input",{"data-testid":"stFileUploaderDropzoneInput",...h,...r&&{webkitdirectory:""}}),a.jsx(Se,{multiple:s,acceptedExtensions:t,maxSizeBytes:i,acceptDirectory:r,disabled:l}),a.jsx(me,{children:a.jsx(u,{kind:x.SECONDARY,disabled:l,size:G.SMALL,children:r?"Browse directories":"Browse files"})})]})}}),je=d.memo(Fe),W=p("small",{target:"e1bju1570"})(({kind:e,disabled:s,theme:t})=>{const{redTextColor:i,fadedText60:l,fadedText40:o}=t.colors;let r=l;return s&&(r=o),e==="danger"&&(r=i),{color:r,fontSize:t.fontSizes.sm,lineHeight:t.lineHeights.tight}},""),ze=({fileInfo:e,disabled:s})=>e.status.type==="uploading"?a.jsx(ne,{value:e.status.progress,size:de.SMALL}):e.status.type==="error"?a.jsxs(T,{children:[a.jsx(ue,{"data-testid":"stFileUploaderFileErrorMessage",children:e.status.errorMessage}),a.jsx(N,{children:a.jsx(m,{content:C,size:"lg"})})]}):e.status.type==="uploaded"?a.jsx(W,{disabled:s,children:z(e.size,w.Byte)}):null,Ue=({fileInfo:e,onDelete:s,disabled:t})=>a.jsxs(R,{className:"stFileUploaderFile","data-testid":"stFileUploaderFile",children:[a.jsx(xe,{disabled:t,children:a.jsx(m,{content:re,size:"twoXL"})}),a.jsxs(A,{className:"stFileUploaderFileData",children:[a.jsx(V,{className:"stFileUploaderFileName","data-testid":"stFileUploaderFileName",title:e.name,disabled:t,children:e.name}),a.jsx(ze,{fileInfo:e,disabled:t})]}),a.jsx("div",{"data-testid":"stFileUploaderDeleteBtn",children:a.jsx(u,{onClick:()=>s(e.id),kind:x.MINIMAL,disabled:t,"aria-label":`Remove ${e.name}`,children:a.jsx(m,{content:oe,size:"lg"})})})]}),ve=d.memo(Ue),Ie=p("div",{target:"e1nlpozb1"})(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:e.spacing.twoXS,marginBottom:e.spacing.twoXS}),""),Ce=p("div",{target:"e1nlpozb0"})(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",color:e.colors.fadedText40}),""),Be=({currentPage:e,totalPages:s,onNext:t,onPrevious:i})=>a.jsxs(Ie,{"data-testid":"stFileUploaderPagination",children:[a.jsx(W,{children:`Showing page ${e} of ${s}`}),a.jsxs(Ce,{children:[a.jsx(u,{onClick:i,kind:x.MINIMAL,children:a.jsx(m,{content:U,size:"xl"})}),a.jsx(u,{onClick:t,kind:x.MINIMAL,children:a.jsx(m,{content:v,size:"xl"})})]})]}),Me=d.memo(Be),j=(e,s)=>Math.ceil(e.length/s),Ee=e=>ee(({pageSize:s,items:t,resetOnAdd:i,...l})=>{const[o,r]=d.useState(0),[n,c]=d.useState(()=>j(t,s)),h=pe(t);d.useEffect(()=>{h&&h.length!==t.length&&c(j(t,s)),h&&h.length<t.length?i&&r(0):o+1>=n&&r(n-1)},[t,o,s,h,i,n]);const S=()=>{r(Math.min(o+1,n-1))},H=()=>{r(Math.max(0,o-1))},P=t.slice(o*s,o*s+s);return a.jsxs(a.Fragment,{children:[a.jsx(e,{items:P,...l}),t.length>s?a.jsx(Me,{pageSize:s,totalPages:n,currentPage:o+1,onNext:S,onPrevious:H}):null]})},e),De=({items:e,onDelete:s,disabled:t})=>a.jsx(fe,{children:e.map(i=>a.jsx(L,{children:a.jsx(ve,{fileInfo:i,onDelete:s,disabled:t})},i.id))}),Le=Ee(De),Ae=e=>a.jsx(D,{children:a.jsx(Le,{...e})}),Ve=d.memo(Ae);class Re extends d.PureComponent{constructor(s){super(s),this.formClearHelper=new te,this.localFileIdCounter=1,this.forceUpdatingStatus=!1,this.componentDidUpdate=()=>{if(this.status!=="ready")return;const t=this.createWidgetValue(),{element:i,widgetMgr:l,fragmentId:o}=this.props,r=l.getFileUploaderStateValue(i);$(t,r)||l.setFileUploaderStateValue(i,t,{fromUi:!0},o)},this.isFileTypeAllowed=t=>{const{element:i}=this.props,{type:l}=i;if(!l||l.length===0)return!0;const o=t.name.toLowerCase();return l.some(r=>o.endsWith(r.toLowerCase()))},this.filterDirectoryFiles=t=>{const i=[],l=[];return t.forEach(o=>{this.isFileTypeAllowed(o)?i.push(o):l.push({file:o,errors:[{code:"file-invalid-type",message:`${o.type} files are not allowed.`}]})}),{accepted:i,rejected:l}},this.dropHandler=(t,i)=>{const{element:l}=this.props,{multipleFiles:o}=l;if(l.acceptDirectory&&t.length>0){const{accepted:r,rejected:n}=this.filterDirectoryFiles(t);t=r,i=[...i,...n]}if(!o&&t.length===0&&i.length>1){const r=i.findIndex(n=>n.errors.length===1&&n.errors[0].code==="too-many-files");r>=0&&(t.push(i[r].file),i.splice(r,1))}if(this.props.uploadClient.fetchFileURLs(t).then(r=>{if(!o&&t.length>0){const n=this.state.files.find(c=>c.status.type!=="error");n&&(this.forceUpdatingStatus=!0,this.deleteFile(n.id),this.forceUpdatingStatus=!1)}X(r,t).forEach(([n,c])=>{this.uploadFile(n,c)})}).catch(r=>{this.addFiles(t.map(n=>new F(n.name,n.size,this.nextLocalFileId(),{type:"error",errorMessage:r})))}),i.length>0){const r=i.map(n=>ie(n,this.nextLocalFileId(),this.maxUploadSizeInBytes));this.addFiles(r)}},this.uploadFile=(t,i)=>{const l=new AbortController,o=i.webkitRelativePath||i.name,r=new F(o,i.size,this.nextLocalFileId(),{type:"uploading",abortController:l,progress:1});this.addFile(r),this.props.uploadClient.uploadFile(this.props.element,t.uploadUrl,i,n=>this.onUploadProgress(n,r.id),l.signal).then(()=>this.onUploadComplete(r.id,t)).catch(n=>{n instanceof DOMException&&n.name==="AbortError"||this.updateFile(r.id,r.setStatus({type:"error",errorMessage:n?n.toString():"Unknown error"}))})},this.onUploadComplete=(t,i)=>{const l=this.getFile(t);g(l)||l.status.type!=="uploading"||this.updateFile(l.id,l.setStatus({type:"uploaded",fileId:i.fileId,fileUrls:i}))},this.deleteFile=t=>{if(this.props.disabled)return;const i=this.getFile(t);g(i)||(i.status.type==="uploading"&&i.status.abortController.abort(),i.status.type==="uploaded"&&i.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(i.status.fileUrls.deleteUrl),this.removeFile(t))},this.addFile=t=>{f.flushSync(()=>{this.setState(i=>({files:[...i.files,t]}))})},this.addFiles=t=>{f.flushSync(()=>{this.setState(i=>({files:[...i.files,...t]}))})},this.removeFile=t=>{f.flushSync(()=>{this.setState(i=>({files:i.files.filter(l=>l.id!==t)}))})},this.getFile=t=>this.state.files.find(i=>i.id===t),this.updateFile=(t,i)=>{f.flushSync(()=>{this.setState(l=>({files:l.files.map(o=>o.id===t?i:o)}))})},this.onUploadProgress=(t,i)=>{const l=this.getFile(i);if(g(l)||l.status.type!=="uploading")return;const o=Math.round(t.loaded*100/t.total);l.status.progress!==o&&this.updateFile(i,l.setStatus({type:"uploading",abortController:l.status.abortController,progress:o}))},this.onFormCleared=()=>{f.flushSync(()=>{this.setState({files:[]},()=>{const t=this.createWidgetValue();if(g(t))return;const{widgetMgr:i,element:l,fragmentId:o}=this.props;i.setFileUploaderStateValue(l,t,{fromUi:!0},o)})})},this.state=this.initialValue}get initialValue(){const s={files:[]},{widgetMgr:t,element:i}=this.props,l=t.getFileUploaderStateValue(i);if(g(l))return s;const{uploadedFileInfo:o}=l;return g(o)||o.length===0?s:{files:o.map(r=>{const n=r.name,c=r.size,h=r.fileId,S=r.fileUrls;return new F(n,c,this.nextLocalFileId(),{type:"uploaded",fileId:h,fileUrls:S})})}}componentWillUnmount(){this.formClearHelper.disconnect()}get maxUploadSizeInBytes(){const s=this.props.element.maxUploadSizeMb;return se(s,w.Megabyte,w.Byte)}get status(){const s=t=>t.status.type==="uploading";return this.state.files.some(s)||this.forceUpdatingStatus?"updating":"ready"}componentDidMount(){const s=this.createWidgetValue(),{element:t,widgetMgr:i,fragmentId:l}=this.props;i.getFileUploaderStateValue(t)===void 0&&i.setFileUploaderStateValue(t,s,{fromUi:!1},l)}createWidgetValue(){const s=this.state.files.filter(t=>t.status.type==="uploaded").map(t=>{const{name:i,size:l,status:o}=t,{fileId:r,fileUrls:n}=o;return new O({fileId:r,fileUrls:n,name:i,size:l})});return new q({uploadedFileInfo:s})}render(){const{files:s}=this.state,{element:t,disabled:i,widgetMgr:l,width:o}=this.props,r=t.type;this.formClearHelper.manageFormClearListener(l,t.formId,this.onFormCleared);const n=s.slice().reverse();return a.jsxs(ye,{className:"stFileUploader","data-testid":"stFileUploader",width:o,children:[a.jsx(_,{label:t.label,disabled:i,labelVisibility:J(t.labelVisibility?.value),children:t.help&&a.jsx(Q,{children:a.jsx(K,{content:t.help,placement:Y.TOP_RIGHT})})}),a.jsx(je,{onDrop:this.dropHandler,multiple:t.multipleFiles,acceptedExtensions:r,maxSizeBytes:this.maxUploadSizeInBytes,label:t.label,disabled:i,acceptDirectory:!!t.acceptDirectory}),n.length>0&&a.jsx(Ve,{items:n,pageSize:3,onDelete:this.deleteFile,resetOnAdd:!0,disabled:i})]})}nextLocalFileId(){return this.localFileIdCounter++}}const $e=k(d.memo(Re));export{$e as default};
|
|
1
|
+
import{a$ as k,r as d,y as $,aL as X,v as g,b as f,aN as O,aM as q,j as a,c as p,aI as _,aJ as J,b0 as Q,aK as K,ap as Y,aB as Z,aQ as u,al as G,ai as x,aE as ee,aR as m,E as y,_ as b}from"./index-D3uELfdo.js";import{d as te}from"./FormClearHelper-Dgu5Halt-BxICjxpW.js";import{C as ie,q as se,E as le,S as ae,f as z,A as w,P as re,_ as oe}from"./FileHelper-BCkX4r3T-DFMmrw88.js";import{q as ne,U as de}from"./ProgressBar-bzD0ionS-CaMxdV67.js";import{o as pe}from"./Hooks-BLb3umpI-9FUxV5o-.js";import{t as F}from"./UploadFileInfo-B5SttewO-BfvME59S.js";var U=d.forwardRef(function(e,s){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return d.createElement(y,b({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:s}),d.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),d.createElement("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12l4.58-4.59z"}))});U.displayName="ChevronLeft";var v=d.forwardRef(function(e,s){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return d.createElement(y,b({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:s}),d.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),d.createElement("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6-6-6z"}))});v.displayName="ChevronRight";var I=d.forwardRef(function(e,s){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return d.createElement(y,b({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:s}),d.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),d.createElement("path",{d:"M19.35 10.04A7.49 7.49 0 0012 4C9.11 4 6.6 5.64 5.35 8.04A5.994 5.994 0 000 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM19 18H6c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97l1.07-.11.5-.95A5.469 5.469 0 0112 6c2.62 0 4.88 1.86 5.39 4.43l.3 1.5 1.53.11A2.98 2.98 0 0122 15c0 1.65-1.35 3-3 3zM8 13h2.55v3h2.9v-3H16l-4-4z"}))});I.displayName="CloudUpload";var C=d.forwardRef(function(e,s){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return d.createElement(y,b({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:s}),d.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}))});C.displayName="Error";const B=p("section",{target:"e1b2p2ww17"})(({isDisabled:e,theme:s})=>({display:"flex",gap:s.spacing.lg,alignItems:"center",padding:s.spacing.lg,backgroundColor:s.colors.secondaryBg,borderRadius:s.radii.default,border:s.colors.widgetBorderColor?`${s.sizes.borderWidth} solid ${s.colors.widgetBorderColor}`:void 0,height:s.sizes.largestElementHeight,":focus":{outline:"none"},":focus-visible":{boxShadow:`0 0 0 1px ${s.colors.primary}`},cursor:e?"not-allowed":"pointer"}),""),ce=p("div",{target:"e1b2p2ww16"})(({theme:e})=>({marginRight:"auto",alignItems:"center",display:"flex",gap:e.spacing.lg,minWidth:0,width:"100%"}),""),M=p("span",{target:"e1b2p2ww15"})(({theme:e})=>({color:e.colors.darkenedBgMix100}),""),E=p("span",{target:"e1b2p2ww14"})(({theme:e,disabled:s})=>({color:s?e.colors.fadedText40:e.colors.bodyText}),""),he=p("span",{target:"e1b2p2ww13"})(({theme:e,disabled:s})=>({fontSize:e.fontSizes.sm,color:s?e.colors.fadedText40:e.colors.fadedText60,display:"block",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",maxWidth:"100%"}),""),ge=p("div",{target:"e1b2p2ww12"})({name:"1s8jot1",styles:"display:flex;flex-direction:column;min-width:0;max-width:100%"}),me=p("span",{target:"e1b2p2ww11"})({name:"1bmnxg7",styles:"white-space:nowrap"}),D=p("div",{target:"e1b2p2ww10"})(({theme:e})=>({left:0,right:0,lineHeight:e.lineHeights.tight,paddingTop:e.spacing.md,paddingLeft:e.spacing.lg,paddingRight:e.spacing.lg}),""),fe=p("ul",{target:"e1b2p2ww9"})(({theme:e})=>({listStyleType:"none",margin:e.spacing.none,padding:e.spacing.none}),""),L=p("li",{target:"e1b2p2ww8"})(({theme:e})=>({margin:e.spacing.none,padding:e.spacing.none}),""),A=p("div",{target:"e1b2p2ww7"})(({theme:e})=>({display:"flex",alignItems:"baseline",flex:1,paddingLeft:e.spacing.lg,overflow:"hidden"}),""),V=p("div",{target:"e1b2p2ww6"})(({theme:e,disabled:s})=>({marginRight:e.spacing.sm,marginBottom:e.spacing.twoXS,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:s?e.colors.fadedText40:e.colors.bodyText}),""),R=p("div",{target:"e1b2p2ww5"})(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing.twoXS}),""),ue=p("span",{target:"e1b2p2ww4"})(({theme:e})=>({marginRight:e.spacing.twoXS}),""),xe=p("div",{target:"e1b2p2ww3"})(({theme:e,disabled:s})=>({display:"flex",padding:e.spacing.twoXS,color:s?e.colors.fadedText40:e.colors.darkenedBgMix100}),""),T=p("small",{target:"e1b2p2ww2"})(({theme:e})=>({color:e.colors.redTextColor,fontSize:e.fontSizes.sm,height:e.fontSizes.sm,lineHeight:e.fontSizes.sm,display:"flex",alignItems:"center",whiteSpace:"nowrap"}),""),N=p("span",{target:"e1b2p2ww1"})({name:"0",styles:""}),we=e=>({[B]:{display:"flex",flexDirection:"column",alignItems:"flex-start",height:"auto",gap:e.spacing.sm},[M]:{display:"none"},[E]:{marginBottom:e.spacing.twoXS},[D]:{paddingRight:e.spacing.lg},[R]:{maxWidth:"inherit",flex:1,alignItems:"flex-start",marginBottom:e.spacing.sm},[V]:{width:e.sizes.full},[A]:{flexDirection:"column"},[T]:{height:"auto",whiteSpace:"initial"},[N]:{display:"none"},[L]:{margin:e.spacing.none,padding:e.spacing.none}}),ye=p("div",{target:"e1b2p2ww0"})(({theme:e,width:s})=>{if(s<Z("23rem"))return we(e)},""),be=({multiple:e,acceptedExtensions:s,maxSizeBytes:t,acceptDirectory:i=!1,disabled:l})=>{const o=()=>i?"directories":e?"files":"file",r=()=>s.length?` • ${s.map(c=>c.replace(/^\./,"").toUpperCase()).join(", ")}`:null,n=()=>`Limit ${z(t,w.Byte,0)} per file`;return a.jsxs(ce,{"data-testid":"stFileUploaderDropzoneInstructions",children:[a.jsx(M,{children:a.jsx(m,{content:I,size:"threeXL"})}),a.jsxs(ge,{children:[a.jsxs(E,{disabled:l,children:["Drag and drop ",o()," here"]}),a.jsxs(he,{disabled:l,children:[n(),r()]})]})]})},Se=d.memo(be),Fe=({onDrop:e,multiple:s,acceptedExtensions:t,maxSizeBytes:i,disabled:l,label:o,acceptDirectory:r=!1})=>a.jsx(le,{onDrop:e,multiple:s,accept:ae(t),maxSize:i,disabled:l,useFsAccessApi:!1,children:({getRootProps:n,getInputProps:c})=>{const h=c({multiple:s||!!r});return a.jsxs(B,{...n(),"data-testid":"stFileUploaderDropzone",isDisabled:l,"aria-label":o,"aria-disabled":l,children:[a.jsx("input",{"data-testid":"stFileUploaderDropzoneInput",...h,...r&&{webkitdirectory:""}}),a.jsx(Se,{multiple:s,acceptedExtensions:t,maxSizeBytes:i,acceptDirectory:r,disabled:l}),a.jsx(me,{children:a.jsx(u,{kind:x.SECONDARY,disabled:l,size:G.SMALL,children:r?"Browse directories":"Browse files"})})]})}}),je=d.memo(Fe),W=p("small",{target:"e1bju1570"})(({kind:e,disabled:s,theme:t})=>{const{redTextColor:i,fadedText60:l,fadedText40:o}=t.colors;let r=l;return s&&(r=o),e==="danger"&&(r=i),{color:r,fontSize:t.fontSizes.sm,lineHeight:t.lineHeights.tight}},""),ze=({fileInfo:e,disabled:s})=>e.status.type==="uploading"?a.jsx(ne,{value:e.status.progress,size:de.SMALL}):e.status.type==="error"?a.jsxs(T,{children:[a.jsx(ue,{"data-testid":"stFileUploaderFileErrorMessage",children:e.status.errorMessage}),a.jsx(N,{children:a.jsx(m,{content:C,size:"lg"})})]}):e.status.type==="uploaded"?a.jsx(W,{disabled:s,children:z(e.size,w.Byte)}):null,Ue=({fileInfo:e,onDelete:s,disabled:t})=>a.jsxs(R,{className:"stFileUploaderFile","data-testid":"stFileUploaderFile",children:[a.jsx(xe,{disabled:t,children:a.jsx(m,{content:re,size:"twoXL"})}),a.jsxs(A,{className:"stFileUploaderFileData",children:[a.jsx(V,{className:"stFileUploaderFileName","data-testid":"stFileUploaderFileName",title:e.name,disabled:t,children:e.name}),a.jsx(ze,{fileInfo:e,disabled:t})]}),a.jsx("div",{"data-testid":"stFileUploaderDeleteBtn",children:a.jsx(u,{onClick:()=>s(e.id),kind:x.MINIMAL,disabled:t,"aria-label":`Remove ${e.name}`,children:a.jsx(m,{content:oe,size:"lg"})})})]}),ve=d.memo(Ue),Ie=p("div",{target:"e1nlpozb1"})(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:e.spacing.twoXS,marginBottom:e.spacing.twoXS}),""),Ce=p("div",{target:"e1nlpozb0"})(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",color:e.colors.fadedText40}),""),Be=({currentPage:e,totalPages:s,onNext:t,onPrevious:i})=>a.jsxs(Ie,{"data-testid":"stFileUploaderPagination",children:[a.jsx(W,{children:`Showing page ${e} of ${s}`}),a.jsxs(Ce,{children:[a.jsx(u,{onClick:i,kind:x.MINIMAL,children:a.jsx(m,{content:U,size:"xl"})}),a.jsx(u,{onClick:t,kind:x.MINIMAL,children:a.jsx(m,{content:v,size:"xl"})})]})]}),Me=d.memo(Be),j=(e,s)=>Math.ceil(e.length/s),Ee=e=>ee(({pageSize:s,items:t,resetOnAdd:i,...l})=>{const[o,r]=d.useState(0),[n,c]=d.useState(()=>j(t,s)),h=pe(t);d.useEffect(()=>{h&&h.length!==t.length&&c(j(t,s)),h&&h.length<t.length?i&&r(0):o+1>=n&&r(n-1)},[t,o,s,h,i,n]);const S=()=>{r(Math.min(o+1,n-1))},H=()=>{r(Math.max(0,o-1))},P=t.slice(o*s,o*s+s);return a.jsxs(a.Fragment,{children:[a.jsx(e,{items:P,...l}),t.length>s?a.jsx(Me,{pageSize:s,totalPages:n,currentPage:o+1,onNext:S,onPrevious:H}):null]})},e),De=({items:e,onDelete:s,disabled:t})=>a.jsx(fe,{children:e.map(i=>a.jsx(L,{children:a.jsx(ve,{fileInfo:i,onDelete:s,disabled:t})},i.id))}),Le=Ee(De),Ae=e=>a.jsx(D,{children:a.jsx(Le,{...e})}),Ve=d.memo(Ae);class Re extends d.PureComponent{constructor(s){super(s),this.formClearHelper=new te,this.localFileIdCounter=1,this.forceUpdatingStatus=!1,this.componentDidUpdate=()=>{if(this.status!=="ready")return;const t=this.createWidgetValue(),{element:i,widgetMgr:l,fragmentId:o}=this.props,r=l.getFileUploaderStateValue(i);$(t,r)||l.setFileUploaderStateValue(i,t,{fromUi:!0},o)},this.isFileTypeAllowed=t=>{const{element:i}=this.props,{type:l}=i;if(!l||l.length===0)return!0;const o=t.name.toLowerCase();return l.some(r=>o.endsWith(r.toLowerCase()))},this.filterDirectoryFiles=t=>{const i=[],l=[];return t.forEach(o=>{this.isFileTypeAllowed(o)?i.push(o):l.push({file:o,errors:[{code:"file-invalid-type",message:`${o.type} files are not allowed.`}]})}),{accepted:i,rejected:l}},this.dropHandler=(t,i)=>{const{element:l}=this.props,{multipleFiles:o}=l;if(l.acceptDirectory&&t.length>0){const{accepted:r,rejected:n}=this.filterDirectoryFiles(t);t=r,i=[...i,...n]}if(!o&&t.length===0&&i.length>1){const r=i.findIndex(n=>n.errors.length===1&&n.errors[0].code==="too-many-files");r>=0&&(t.push(i[r].file),i.splice(r,1))}if(this.props.uploadClient.fetchFileURLs(t).then(r=>{if(!o&&t.length>0){const n=this.state.files.find(c=>c.status.type!=="error");n&&(this.forceUpdatingStatus=!0,this.deleteFile(n.id),this.forceUpdatingStatus=!1)}X(r,t).forEach(([n,c])=>{this.uploadFile(n,c)})}).catch(r=>{this.addFiles(t.map(n=>new F(n.name,n.size,this.nextLocalFileId(),{type:"error",errorMessage:r})))}),i.length>0){const r=i.map(n=>ie(n,this.nextLocalFileId(),this.maxUploadSizeInBytes));this.addFiles(r)}},this.uploadFile=(t,i)=>{const l=new AbortController,o=i.webkitRelativePath||i.name,r=new F(o,i.size,this.nextLocalFileId(),{type:"uploading",abortController:l,progress:1});this.addFile(r),this.props.uploadClient.uploadFile(this.props.element,t.uploadUrl,i,n=>this.onUploadProgress(n,r.id),l.signal).then(()=>this.onUploadComplete(r.id,t)).catch(n=>{n instanceof DOMException&&n.name==="AbortError"||this.updateFile(r.id,r.setStatus({type:"error",errorMessage:n?n.toString():"Unknown error"}))})},this.onUploadComplete=(t,i)=>{const l=this.getFile(t);g(l)||l.status.type!=="uploading"||this.updateFile(l.id,l.setStatus({type:"uploaded",fileId:i.fileId,fileUrls:i}))},this.deleteFile=t=>{if(this.props.disabled)return;const i=this.getFile(t);g(i)||(i.status.type==="uploading"&&i.status.abortController.abort(),i.status.type==="uploaded"&&i.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(i.status.fileUrls.deleteUrl),this.removeFile(t))},this.addFile=t=>{f.flushSync(()=>{this.setState(i=>({files:[...i.files,t]}))})},this.addFiles=t=>{f.flushSync(()=>{this.setState(i=>({files:[...i.files,...t]}))})},this.removeFile=t=>{f.flushSync(()=>{this.setState(i=>({files:i.files.filter(l=>l.id!==t)}))})},this.getFile=t=>this.state.files.find(i=>i.id===t),this.updateFile=(t,i)=>{f.flushSync(()=>{this.setState(l=>({files:l.files.map(o=>o.id===t?i:o)}))})},this.onUploadProgress=(t,i)=>{const l=this.getFile(i);if(g(l)||l.status.type!=="uploading")return;const o=Math.round(t.loaded*100/t.total);l.status.progress!==o&&this.updateFile(i,l.setStatus({type:"uploading",abortController:l.status.abortController,progress:o}))},this.onFormCleared=()=>{f.flushSync(()=>{this.setState({files:[]},()=>{const t=this.createWidgetValue();if(g(t))return;const{widgetMgr:i,element:l,fragmentId:o}=this.props;i.setFileUploaderStateValue(l,t,{fromUi:!0},o)})})},this.state=this.initialValue}get initialValue(){const s={files:[]},{widgetMgr:t,element:i}=this.props,l=t.getFileUploaderStateValue(i);if(g(l))return s;const{uploadedFileInfo:o}=l;return g(o)||o.length===0?s:{files:o.map(r=>{const n=r.name,c=r.size,h=r.fileId,S=r.fileUrls;return new F(n,c,this.nextLocalFileId(),{type:"uploaded",fileId:h,fileUrls:S})})}}componentWillUnmount(){this.formClearHelper.disconnect()}get maxUploadSizeInBytes(){const s=this.props.element.maxUploadSizeMb;return se(s,w.Megabyte,w.Byte)}get status(){const s=t=>t.status.type==="uploading";return this.state.files.some(s)||this.forceUpdatingStatus?"updating":"ready"}componentDidMount(){const s=this.createWidgetValue(),{element:t,widgetMgr:i,fragmentId:l}=this.props;i.getFileUploaderStateValue(t)===void 0&&i.setFileUploaderStateValue(t,s,{fromUi:!1},l)}createWidgetValue(){const s=this.state.files.filter(t=>t.status.type==="uploaded").map(t=>{const{name:i,size:l,status:o}=t,{fileId:r,fileUrls:n}=o;return new O({fileId:r,fileUrls:n,name:i,size:l})});return new q({uploadedFileInfo:s})}render(){const{files:s}=this.state,{element:t,disabled:i,widgetMgr:l,width:o}=this.props,r=t.type;this.formClearHelper.manageFormClearListener(l,t.formId,this.onFormCleared);const n=s.slice().reverse();return a.jsxs(ye,{className:"stFileUploader","data-testid":"stFileUploader",width:o,children:[a.jsx(_,{label:t.label,disabled:i,labelVisibility:J(t.labelVisibility?.value),children:t.help&&a.jsx(Q,{children:a.jsx(K,{content:t.help,placement:Y.TOP_RIGHT})})}),a.jsx(je,{onDrop:this.dropHandler,multiple:t.multipleFiles,acceptedExtensions:r,maxSizeBytes:this.maxUploadSizeInBytes,label:t.label,disabled:i,acceptDirectory:!!t.acceptDirectory}),n.length>0&&a.jsx(Ve,{items:n,pageSize:3,onDelete:this.deleteFile,resetOnAdd:!0,disabled:i})]})}nextLocalFileId(){return this.localFileIdCounter++}}const $e=k(d.memo(Re));export{$e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,v as i,j as S,bB as V,aJ as h}from"./index-
|
|
1
|
+
import{r,v as i,j as S,bB as V,aJ as h}from"./index-D3uELfdo.js";import{S as v}from"./useBasicWidgetState-DqA4I-I_-DtgK63iS.js";import"./FormClearHelper-Dgu5Halt-BxICjxpW.js";const w=(e,t)=>e.getStringValue(t),x=e=>e.options.length===0||i(e.default)?null:e.options[e.default],U=e=>e.rawValue??null,j=(e,t,l,a)=>{t.setStringValue(e,l.value,{fromUi:l.fromUi},a)},y=({disabled:e,element:t,widgetMgr:l,fragmentId:a})=>{const{options:s,help:n,label:u,labelVisibility:m,placeholder:p,acceptNewOptions:d}=t,[g,o]=v({getStateFromWidgetMgr:w,getDefaultStateFromProto:x,getCurrStateFromProto:U,updateWidgetMgrState:j,element:t,widgetMgr:l,fragmentId:a}),f=r.useCallback(c=>{o({value:c,fromUi:!0})},[o]),b=i(t.default)&&!e;return S.jsx(V,{label:u,labelVisibility:h(m?.value),options:s,disabled:e,onChange:f,value:g,help:n,placeholder:p,clearable:b,acceptNewOptions:d??!1})},E=r.memo(y);export{E as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as p,ai as t,j as a,aj as f,ak as x,al as i,am as v,c as n,an as s,ao as k}from"./index-
|
|
1
|
+
import{r as p,ai as t,j as a,aj as f,ak as x,al as i,am as v,c as n,an as s,ao as k}from"./index-D3uELfdo.js";function y(o,e){switch(o){case i.XSMALL:return{padding:`${e.spacing.twoXS} ${e.spacing.sm}`,fontSize:e.fontSizes.sm};case i.SMALL:return{padding:`${e.spacing.twoXS} ${e.spacing.md}`};case i.LARGE:return{padding:`${e.spacing.md} ${e.spacing.md}`};default:return{padding:`${e.spacing.xs} ${e.spacing.md}`}}}const u=n("a",{target:"e16zdaao3"})(({containerWidth:o,size:e,theme:r})=>({display:"inline-flex",alignItems:"center",justifyContent:"center",fontWeight:r.fontWeights.normal,padding:`${r.spacing.xs} ${r.spacing.md}`,borderRadius:r.radii.button,minHeight:r.sizes.minElementHeight,margin:0,lineHeight:r.lineHeights.base,color:r.colors.primary,textDecoration:"none",width:o?"100%":"auto",userSelect:"none","&:visited":{color:r.colors.primary},"&:focus":{outline:"none"},"&:focus-visible":{boxShadow:`0 0 0 0.2rem ${k(r.colors.primary,.5)}`},"&:hover":{textDecoration:"none"},"&:active":{textDecoration:"none"},...y(e,r)}),""),C=n(u,{target:"e16zdaao2"})(({theme:o})=>({backgroundColor:o.colors.primary,color:o.colors.white,border:`${o.sizes.borderWidth} solid ${o.colors.primary}`,"&:hover, &:focus-visible":{backgroundColor:s(o.colors.primary,.15),borderColor:s(o.colors.primary,.15)},"&:active":{backgroundColor:o.colors.primary,borderColor:s(o.colors.primary,.15)},"&:visited:not(:active)":{color:o.colors.white},"&[disabled], &[disabled]:hover, &[disabled]:active, &[disabled]:visited":{borderColor:o.colors.borderColor,backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}}),""),$=n(u,{target:"e16zdaao1"})(({theme:o})=>({backgroundColor:o.colors.lightenedBg05,color:o.colors.bodyText,border:`${o.sizes.borderWidth} solid ${o.colors.borderColor}`,"&:visited":{color:o.colors.bodyText},"&:hover, &:focus-visible":{backgroundColor:o.colors.darkenedBgMix15},"&:active":{backgroundColor:o.colors.darkenedBgMix25},"&[disabled], &[disabled]:hover, &[disabled]:active":{borderColor:o.colors.borderColor,backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}}),""),z=n(u,{target:"e16zdaao0"})(({theme:o})=>({padding:o.spacing.none,backgroundColor:o.colors.transparent,color:o.colors.bodyText,border:"none","&:visited":{color:o.colors.bodyText},"&:hover, &:focus-visible":{color:o.colors.primary},"&:hover:not([disabled]), &:focus-visible:not([disabled])":{"span.stMarkdownColoredText":{color:"inherit !important"}},"&:active":{color:s(o.colors.primary,.25)},"&[disabled], &[disabled]:hover, &[disabled]:active":{backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}}),"");function B({kind:o,size:e,disabled:r,children:d,autoFocus:l,href:m,rel:h,target:g,onClick:b}){let c=C;return o===t.SECONDARY?c=$:o===t.TERTIARY&&(c=z),a.jsx(c,{kind:o,size:e||i.MEDIUM,containerWidth:!0,disabled:r||!1,autoFocus:l||!1,href:m,target:g,rel:h,onClick:b,tabIndex:r?-1:0,"data-testid":`stBaseLinkButton-${o}`,children:d})}const S=p.memo(B);function T(o){const{element:e}=o;let r=t.SECONDARY;e.type==="primary"?r=t.PRIMARY:e.type==="tertiary"&&(r=t.TERTIARY);const d=l=>{e.disabled&&l.preventDefault()};return a.jsx(f,{className:"stLinkButton","data-testid":"stLinkButton",children:a.jsx(x,{help:e.help,containerWidth:!0,children:a.jsx(S,{kind:r,size:i.SMALL,disabled:e.disabled,onClick:d,href:e.url,target:"_blank",rel:"noreferrer","aria-disabled":e.disabled,children:a.jsx(v,{icon:e.icon,label:e.label})})})})}const L=p.memo(T);export{L as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as h,m as Zt,x as _,aH as Q,v as ut,aB as Jt,y as Kt,j as v,c as I,aI as Qt,aJ as te,aK as ee,ap as ie,l as re,as as Rt,aL as se,aM as ne,aN as oe,L as ae,aO as le,aP as de,aQ as ce,ai as he,aR as ue,E as Y,_ as Z}from"./index-BUGX2TMK.js";import{y as pe,X as St}from"./Toolbar-C79vGzHM-4gREjS-R.js";import{d as me,m as fe}from"./FormClearHelper-Bi1RDDCw-CUfvtGEu.js";import{a as ge}from"./createDownloadLinkElement-CbRjLJ8e-NbV49OP9.js";import{o as ve}from"./Hooks-BLb3umpI-D_n25nUE.js";import{i as be,o as ye}from"./FileDownload.esm-rDRR6AEq-DjpuiBZc.js";var Tt=h.forwardRef(function(r,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement(Y,Z({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},r,{ref:t}),h.createElement("g",{fill:"none"},h.createElement("rect",{width:24,height:24}),h.createElement("rect",{width:24,height:24}),h.createElement("rect",{width:24,height:24})),h.createElement("path",{d:"M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"}),h.createElement("path",{d:"M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"}))});Tt.displayName="Mic";var It=h.forwardRef(function(r,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement(Y,Z({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},r,{ref:t}),h.createElement("rect",{width:24,height:24,fill:"none"}),h.createElement("path",{d:"M8 19c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2v10c0 1.1.9 2 2 2zm6-12v10c0 1.1.9 2 2 2s2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2z"}))});It.displayName="Pause";var At=h.forwardRef(function(r,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement(Y,Z({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},r,{ref:t}),h.createElement("rect",{width:24,height:24,fill:"none"}),h.createElement("path",{d:"M8 6.82v10.36c0 .79.87 1.27 1.54.84l8.14-5.18a1 1 0 000-1.69L9.54 5.98A.998.998 0 008 6.82z"}))});At.displayName="PlayArrow";var Lt=h.forwardRef(function(r,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement(Y,Z({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},r,{ref:t}),h.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),h.createElement("path",{d:"M17.65 6.35a7.95 7.95 0 00-6.48-2.31c-3.67.37-6.69 3.35-7.1 7.02C3.52 15.91 7.27 20 12 20a7.98 7.98 0 007.21-4.56c.32-.67-.16-1.44-.9-1.44-.37 0-.72.2-.88.53a5.994 5.994 0 01-6.8 3.31c-2.22-.49-4.01-2.3-4.48-4.52A6.002 6.002 0 0112 6c1.66 0 3.14.69 4.22 1.78l-1.51 1.51c-.63.63-.19 1.71.7 1.71H19c.55 0 1-.45 1-1V6.41c0-.89-1.08-1.34-1.71-.71l-.64.65z"}))});Lt.displayName="Refresh";var Ot=h.forwardRef(function(r,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement(Y,Z({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},r,{ref:t}),h.createElement("g",{fill:"none"},h.createElement("rect",{width:24,height:24}),h.createElement("rect",{width:24,height:24})),h.createElement("path",{fillRule:"evenodd",d:"M9 16h6c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1H9c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1zm3-14C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z"}))});Ot.displayName="StopCircle";function T(r,t,e,i){return new(e||(e=Promise))(function(s,n){function d(a){try{c(i.next(a))}catch(o){n(o)}}function l(a){try{c(i.throw(a))}catch(o){n(o)}}function c(a){var o;a.done?s(a.value):(o=a.value,o instanceof e?o:new e(function(m){m(o)})).then(d,l)}c((i=i.apply(r,t||[])).next())})}let J=class{constructor(){this.listeners={}}on(r,t,e){if(this.listeners[r]||(this.listeners[r]=new Set),e?.once){const i=(...s)=>{this.un(r,i),t(...s)};return this.listeners[r].add(i),()=>this.un(r,i)}return this.listeners[r].add(t),()=>this.un(r,t)}un(r,t){var e;(e=this.listeners[r])===null||e===void 0||e.delete(t)}once(r,t){return this.on(r,t,{once:!0})}unAll(){this.listeners={}}emit(r,...t){this.listeners[r]&&this.listeners[r].forEach(e=>e(...t))}};const tt={decode:function(r,t){return T(this,void 0,void 0,function*(){const e=new AudioContext({sampleRate:t});try{return yield e.decodeAudioData(r)}finally{e.close()}})},createBuffer:function(r,t){if(!r||r.length===0)throw new Error("channelData must be a non-empty array");if(t<=0)throw new Error("duration must be greater than 0");if(typeof r[0]=="number"&&(r=[r]),!r[0]||r[0].length===0)throw new Error("channelData must contain non-empty channel arrays");(function(i){const s=i[0];if(s.some(n=>n>1||n<-1)){const n=s.length;let d=0;for(let l=0;l<n;l++){const c=Math.abs(s[l]);c>d&&(d=c)}for(const l of i)for(let c=0;c<n;c++)l[c]/=d}})(r);const e=r.map(i=>i instanceof Float32Array?i:Float32Array.from(i));return{duration:t,length:e[0].length,sampleRate:e[0].length/t,numberOfChannels:e.length,getChannelData:i=>{const s=e[i];if(!s)throw new Error(`Channel ${i} not found`);return s},copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};function jt(r,t){const e=t.xmlns?document.createElementNS(t.xmlns,r):document.createElement(r);for(const[i,s]of Object.entries(t))if(i==="children"&&s)for(const[n,d]of Object.entries(s))d instanceof Node?e.appendChild(d):typeof d=="string"?e.appendChild(document.createTextNode(d)):e.appendChild(jt(n,d));else i==="style"?Object.assign(e.style,s):i==="textContent"?e.textContent=s:e.setAttribute(i,s.toString());return e}function Et(r,t,e){const i=jt(r,t||{});return e?.appendChild(i),i}var we=Object.freeze({__proto__:null,createElement:Et,default:Et});const Ce={fetchBlob:function(r,t,e){return T(this,void 0,void 0,function*(){const i=yield fetch(r,e);if(i.status>=400)throw new Error(`Failed to fetch ${r}: ${i.status} (${i.statusText})`);return(function(s,n){T(this,void 0,void 0,function*(){if(!s.body||!s.headers)return;const d=s.body.getReader(),l=Number(s.headers.get("Content-Length"))||0;let c=0;const a=o=>{c+=o?.length||0;const m=Math.round(c/l*100);n(m)};try{for(;;){const o=yield d.read();if(o.done)break;a(o.value)}}catch(o){console.warn("Progress tracking error:",o)}})})(i.clone(),t),i.blob()})}};class xe extends J{constructor(t){super(),this.isExternalMedia=!1,t.media?(this.media=t.media,this.isExternalMedia=!0):this.media=document.createElement("audio"),t.mediaControls&&(this.media.controls=!0),t.autoplay&&(this.media.autoplay=!0),t.playbackRate!=null&&this.onMediaEvent("canplay",()=>{t.playbackRate!=null&&(this.media.playbackRate=t.playbackRate)},{once:!0})}onMediaEvent(t,e,i){return this.media.addEventListener(t,e,i),()=>this.media.removeEventListener(t,e,i)}getSrc(){return this.media.currentSrc||this.media.src||""}revokeSrc(){const t=this.getSrc();t.startsWith("blob:")&&URL.revokeObjectURL(t)}canPlayType(t){return this.media.canPlayType(t)!==""}setSrc(t,e){const i=this.getSrc();if(t&&i===t)return;this.revokeSrc();const s=e instanceof Blob&&(this.canPlayType(e.type)||!t)?URL.createObjectURL(e):t;if(i&&this.media.removeAttribute("src"),s||t)try{this.media.src=s}catch{this.media.src=t}}destroy(){this.isExternalMedia||(this.media.pause(),this.revokeSrc(),this.media.removeAttribute("src"),this.media.load(),this.media.remove())}setMediaElement(t){this.media=t}play(){return T(this,void 0,void 0,function*(){try{return yield this.media.play()}catch(t){if(t instanceof DOMException&&t.name==="AbortError")return;throw t}})}pause(){this.media.pause()}isPlaying(){return!this.media.paused&&!this.media.ended}setTime(t){this.media.currentTime=Math.max(0,Math.min(t,this.getDuration()))}getDuration(){return this.media.duration}getCurrentTime(){return this.media.currentTime}getVolume(){return this.media.volume}setVolume(t){this.media.volume=t}getMuted(){return this.media.muted}setMuted(t){this.media.muted=t}getPlaybackRate(){return this.media.playbackRate}isSeeking(){return this.media.seeking}setPlaybackRate(t,e){e!=null&&(this.media.preservesPitch=e),this.media.playbackRate=t}getMediaElement(){return this.media}setSinkId(t){return this.media.setSinkId(t)}}function ot(r){return r<0?0:r>1?1:r}function Re({maxTop:r,maxBottom:t,halfHeight:e,vScale:i}){const s=Math.round(r*e*i);return{topHeight:s,totalHeight:s+Math.round(t*e*i)||1}}function Se({barAlign:r,halfHeight:t,topHeight:e,totalHeight:i,canvasHeight:s}){return r==="top"?0:r==="bottom"?s-i:t-e}function Pt(r,t,e){const i=t-r.left,s=e-r.top;return[i/r.width,s/r.height]}function Ut(r){return!!(r.barWidth||r.barGap||r.barAlign)}function Wt(r,t){if(!Ut(t))return r;const e=t.barWidth||.5,i=e+(t.barGap||e/2);return i===0?r:Math.floor(r/i)*i}function kt({scrollLeft:r,totalWidth:t,numCanvases:e}){if(t===0)return[0];const i=r/t,s=Math.floor(i*e);return[s-1,s,s+1]}function Dt({scrollLeft:r,clientWidth:t,scrollWidth:e}){return e===0?{startX:0,endX:0}:{startX:r/e,endX:(r+t)/e}}class Ee extends J{constructor(t,e){super(),this.timeouts=[],this.isScrollable=!1,this.audioData=null,this.resizeObserver=null,this.lastContainerWidth=0,this.isDragging=!1,this.subscriptions=[],this.unsubscribeOnScroll=[],this.dragUnsubscribe=null,this.subscriptions=[],this.options=t;const i=this.parentFromOptionsContainer(t.container);this.parent=i;const[s,n]=this.initHtml();i.appendChild(s),this.container=s,this.scrollContainer=n.querySelector(".scroll"),this.wrapper=n.querySelector(".wrapper"),this.canvasWrapper=n.querySelector(".canvases"),this.progressWrapper=n.querySelector(".progress"),this.cursor=n.querySelector(".cursor"),e&&n.appendChild(e),this.initEvents()}parentFromOptionsContainer(t){let e;if(typeof t=="string"?e=document.querySelector(t):t instanceof HTMLElement&&(e=t),!e)throw new Error("Container not found");return e}initEvents(){if(this.wrapper.addEventListener("click",t=>{const e=this.wrapper.getBoundingClientRect(),[i,s]=Pt(e,t.clientX,t.clientY);this.emit("click",i,s)}),this.wrapper.addEventListener("dblclick",t=>{const e=this.wrapper.getBoundingClientRect(),[i,s]=Pt(e,t.clientX,t.clientY);this.emit("dblclick",i,s)}),this.options.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.scrollContainer.addEventListener("scroll",()=>{const{scrollLeft:t,scrollWidth:e,clientWidth:i}=this.scrollContainer,{startX:s,endX:n}=Dt({scrollLeft:t,scrollWidth:e,clientWidth:i});this.emit("scroll",s,n,t,t+i)}),typeof ResizeObserver=="function"){const t=this.createDelay(100);this.resizeObserver=new ResizeObserver(()=>{t().then(()=>this.onContainerResize()).catch(()=>{})}),this.resizeObserver.observe(this.scrollContainer)}}onContainerResize(){const t=this.parent.clientWidth;t===this.lastContainerWidth&&this.options.height!=="auto"||(this.lastContainerWidth=t,this.reRender(),this.emit("resize"))}initDrag(){this.dragUnsubscribe||(this.dragUnsubscribe=(function(t,e,i,s,n=3,d=0,l=100){if(!t)return()=>{};const c=new Map,a=matchMedia("(pointer: coarse)").matches;let o=()=>{};const m=f=>{if(f.button!==d||(c.set(f.pointerId,f),c.size>1))return;let u=f.clientX,p=f.clientY,b=!1;const g=Date.now(),D=y=>{if(y.defaultPrevented||c.size>1||a&&Date.now()-g<l)return;const C=y.clientX,E=y.clientY,A=C-u,j=E-p;if(b||Math.abs(A)>n||Math.abs(j)>n){y.preventDefault(),y.stopPropagation();const F=t.getBoundingClientRect(),{left:L,top:N}=F;b||(i?.(u-L,p-N),b=!0),e(A,j,C-L,E-N),u=C,p=E}},W=y=>{if(c.delete(y.pointerId),b){const C=y.clientX,E=y.clientY,A=t.getBoundingClientRect(),{left:j,top:F}=A;s?.(C-j,E-F)}o()},k=y=>{c.delete(y.pointerId),y.relatedTarget&&y.relatedTarget!==document.documentElement||W(y)},R=y=>{b&&(y.stopPropagation(),y.preventDefault())},S=y=>{y.defaultPrevented||c.size>1||b&&y.preventDefault()};document.addEventListener("pointermove",D),document.addEventListener("pointerup",W),document.addEventListener("pointerout",k),document.addEventListener("pointercancel",k),document.addEventListener("touchmove",S,{passive:!1}),document.addEventListener("click",R,{capture:!0}),o=()=>{document.removeEventListener("pointermove",D),document.removeEventListener("pointerup",W),document.removeEventListener("pointerout",k),document.removeEventListener("pointercancel",k),document.removeEventListener("touchmove",S),setTimeout(()=>{document.removeEventListener("click",R,{capture:!0})},10)}};return t.addEventListener("pointerdown",m),()=>{o(),t.removeEventListener("pointerdown",m),c.clear()}})(this.wrapper,(t,e,i)=>{const s=this.wrapper.getBoundingClientRect().width;this.emit("drag",ot(i/s))},t=>{this.isDragging=!0;const e=this.wrapper.getBoundingClientRect().width;this.emit("dragstart",ot(t/e))},t=>{this.isDragging=!1;const e=this.wrapper.getBoundingClientRect().width;this.emit("dragend",ot(t/e))}),this.subscriptions.push(this.dragUnsubscribe))}initHtml(){const t=document.createElement("div"),e=t.attachShadow({mode:"open"}),i=this.options.cspNonce&&typeof this.options.cspNonce=="string"?this.options.cspNonce.replace(/"/g,""):"";return e.innerHTML=`
|
|
1
|
+
import{r as h,m as Zt,x as _,aH as Q,v as ut,aB as Jt,y as Kt,j as v,c as I,aI as Qt,aJ as te,aK as ee,ap as ie,l as re,as as Rt,aL as se,aM as ne,aN as oe,L as ae,aO as le,aP as de,aQ as ce,ai as he,aR as ue,E as Y,_ as Z}from"./index-D3uELfdo.js";import{y as pe,X as St}from"./Toolbar-Ba82LOXi-C-TMlOex.js";import{d as me,m as fe}from"./FormClearHelper-Dgu5Halt-BxICjxpW.js";import{a as ge}from"./createDownloadLinkElement-CbRjLJ8e-NbV49OP9.js";import{o as ve}from"./Hooks-BLb3umpI-9FUxV5o-.js";import{i as be,o as ye}from"./FileDownload.esm-BP6Yw6Mo-BauI2spi.js";var Tt=h.forwardRef(function(r,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement(Y,Z({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},r,{ref:t}),h.createElement("g",{fill:"none"},h.createElement("rect",{width:24,height:24}),h.createElement("rect",{width:24,height:24}),h.createElement("rect",{width:24,height:24})),h.createElement("path",{d:"M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"}),h.createElement("path",{d:"M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"}))});Tt.displayName="Mic";var It=h.forwardRef(function(r,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement(Y,Z({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},r,{ref:t}),h.createElement("rect",{width:24,height:24,fill:"none"}),h.createElement("path",{d:"M8 19c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2v10c0 1.1.9 2 2 2zm6-12v10c0 1.1.9 2 2 2s2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2z"}))});It.displayName="Pause";var At=h.forwardRef(function(r,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement(Y,Z({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},r,{ref:t}),h.createElement("rect",{width:24,height:24,fill:"none"}),h.createElement("path",{d:"M8 6.82v10.36c0 .79.87 1.27 1.54.84l8.14-5.18a1 1 0 000-1.69L9.54 5.98A.998.998 0 008 6.82z"}))});At.displayName="PlayArrow";var Lt=h.forwardRef(function(r,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement(Y,Z({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},r,{ref:t}),h.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),h.createElement("path",{d:"M17.65 6.35a7.95 7.95 0 00-6.48-2.31c-3.67.37-6.69 3.35-7.1 7.02C3.52 15.91 7.27 20 12 20a7.98 7.98 0 007.21-4.56c.32-.67-.16-1.44-.9-1.44-.37 0-.72.2-.88.53a5.994 5.994 0 01-6.8 3.31c-2.22-.49-4.01-2.3-4.48-4.52A6.002 6.002 0 0112 6c1.66 0 3.14.69 4.22 1.78l-1.51 1.51c-.63.63-.19 1.71.7 1.71H19c.55 0 1-.45 1-1V6.41c0-.89-1.08-1.34-1.71-.71l-.64.65z"}))});Lt.displayName="Refresh";var Ot=h.forwardRef(function(r,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement(Y,Z({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},r,{ref:t}),h.createElement("g",{fill:"none"},h.createElement("rect",{width:24,height:24}),h.createElement("rect",{width:24,height:24})),h.createElement("path",{fillRule:"evenodd",d:"M9 16h6c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1H9c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1zm3-14C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z"}))});Ot.displayName="StopCircle";function T(r,t,e,i){return new(e||(e=Promise))(function(s,n){function d(a){try{c(i.next(a))}catch(o){n(o)}}function l(a){try{c(i.throw(a))}catch(o){n(o)}}function c(a){var o;a.done?s(a.value):(o=a.value,o instanceof e?o:new e(function(m){m(o)})).then(d,l)}c((i=i.apply(r,t||[])).next())})}let J=class{constructor(){this.listeners={}}on(r,t,e){if(this.listeners[r]||(this.listeners[r]=new Set),e?.once){const i=(...s)=>{this.un(r,i),t(...s)};return this.listeners[r].add(i),()=>this.un(r,i)}return this.listeners[r].add(t),()=>this.un(r,t)}un(r,t){var e;(e=this.listeners[r])===null||e===void 0||e.delete(t)}once(r,t){return this.on(r,t,{once:!0})}unAll(){this.listeners={}}emit(r,...t){this.listeners[r]&&this.listeners[r].forEach(e=>e(...t))}};const tt={decode:function(r,t){return T(this,void 0,void 0,function*(){const e=new AudioContext({sampleRate:t});try{return yield e.decodeAudioData(r)}finally{e.close()}})},createBuffer:function(r,t){if(!r||r.length===0)throw new Error("channelData must be a non-empty array");if(t<=0)throw new Error("duration must be greater than 0");if(typeof r[0]=="number"&&(r=[r]),!r[0]||r[0].length===0)throw new Error("channelData must contain non-empty channel arrays");(function(i){const s=i[0];if(s.some(n=>n>1||n<-1)){const n=s.length;let d=0;for(let l=0;l<n;l++){const c=Math.abs(s[l]);c>d&&(d=c)}for(const l of i)for(let c=0;c<n;c++)l[c]/=d}})(r);const e=r.map(i=>i instanceof Float32Array?i:Float32Array.from(i));return{duration:t,length:e[0].length,sampleRate:e[0].length/t,numberOfChannels:e.length,getChannelData:i=>{const s=e[i];if(!s)throw new Error(`Channel ${i} not found`);return s},copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};function jt(r,t){const e=t.xmlns?document.createElementNS(t.xmlns,r):document.createElement(r);for(const[i,s]of Object.entries(t))if(i==="children"&&s)for(const[n,d]of Object.entries(s))d instanceof Node?e.appendChild(d):typeof d=="string"?e.appendChild(document.createTextNode(d)):e.appendChild(jt(n,d));else i==="style"?Object.assign(e.style,s):i==="textContent"?e.textContent=s:e.setAttribute(i,s.toString());return e}function Et(r,t,e){const i=jt(r,t||{});return e?.appendChild(i),i}var we=Object.freeze({__proto__:null,createElement:Et,default:Et});const Ce={fetchBlob:function(r,t,e){return T(this,void 0,void 0,function*(){const i=yield fetch(r,e);if(i.status>=400)throw new Error(`Failed to fetch ${r}: ${i.status} (${i.statusText})`);return(function(s,n){T(this,void 0,void 0,function*(){if(!s.body||!s.headers)return;const d=s.body.getReader(),l=Number(s.headers.get("Content-Length"))||0;let c=0;const a=o=>{c+=o?.length||0;const m=Math.round(c/l*100);n(m)};try{for(;;){const o=yield d.read();if(o.done)break;a(o.value)}}catch(o){console.warn("Progress tracking error:",o)}})})(i.clone(),t),i.blob()})}};class xe extends J{constructor(t){super(),this.isExternalMedia=!1,t.media?(this.media=t.media,this.isExternalMedia=!0):this.media=document.createElement("audio"),t.mediaControls&&(this.media.controls=!0),t.autoplay&&(this.media.autoplay=!0),t.playbackRate!=null&&this.onMediaEvent("canplay",()=>{t.playbackRate!=null&&(this.media.playbackRate=t.playbackRate)},{once:!0})}onMediaEvent(t,e,i){return this.media.addEventListener(t,e,i),()=>this.media.removeEventListener(t,e,i)}getSrc(){return this.media.currentSrc||this.media.src||""}revokeSrc(){const t=this.getSrc();t.startsWith("blob:")&&URL.revokeObjectURL(t)}canPlayType(t){return this.media.canPlayType(t)!==""}setSrc(t,e){const i=this.getSrc();if(t&&i===t)return;this.revokeSrc();const s=e instanceof Blob&&(this.canPlayType(e.type)||!t)?URL.createObjectURL(e):t;if(i&&this.media.removeAttribute("src"),s||t)try{this.media.src=s}catch{this.media.src=t}}destroy(){this.isExternalMedia||(this.media.pause(),this.revokeSrc(),this.media.removeAttribute("src"),this.media.load(),this.media.remove())}setMediaElement(t){this.media=t}play(){return T(this,void 0,void 0,function*(){try{return yield this.media.play()}catch(t){if(t instanceof DOMException&&t.name==="AbortError")return;throw t}})}pause(){this.media.pause()}isPlaying(){return!this.media.paused&&!this.media.ended}setTime(t){this.media.currentTime=Math.max(0,Math.min(t,this.getDuration()))}getDuration(){return this.media.duration}getCurrentTime(){return this.media.currentTime}getVolume(){return this.media.volume}setVolume(t){this.media.volume=t}getMuted(){return this.media.muted}setMuted(t){this.media.muted=t}getPlaybackRate(){return this.media.playbackRate}isSeeking(){return this.media.seeking}setPlaybackRate(t,e){e!=null&&(this.media.preservesPitch=e),this.media.playbackRate=t}getMediaElement(){return this.media}setSinkId(t){return this.media.setSinkId(t)}}function ot(r){return r<0?0:r>1?1:r}function Re({maxTop:r,maxBottom:t,halfHeight:e,vScale:i}){const s=Math.round(r*e*i);return{topHeight:s,totalHeight:s+Math.round(t*e*i)||1}}function Se({barAlign:r,halfHeight:t,topHeight:e,totalHeight:i,canvasHeight:s}){return r==="top"?0:r==="bottom"?s-i:t-e}function Pt(r,t,e){const i=t-r.left,s=e-r.top;return[i/r.width,s/r.height]}function Ut(r){return!!(r.barWidth||r.barGap||r.barAlign)}function Wt(r,t){if(!Ut(t))return r;const e=t.barWidth||.5,i=e+(t.barGap||e/2);return i===0?r:Math.floor(r/i)*i}function kt({scrollLeft:r,totalWidth:t,numCanvases:e}){if(t===0)return[0];const i=r/t,s=Math.floor(i*e);return[s-1,s,s+1]}function Dt({scrollLeft:r,clientWidth:t,scrollWidth:e}){return e===0?{startX:0,endX:0}:{startX:r/e,endX:(r+t)/e}}class Ee extends J{constructor(t,e){super(),this.timeouts=[],this.isScrollable=!1,this.audioData=null,this.resizeObserver=null,this.lastContainerWidth=0,this.isDragging=!1,this.subscriptions=[],this.unsubscribeOnScroll=[],this.dragUnsubscribe=null,this.subscriptions=[],this.options=t;const i=this.parentFromOptionsContainer(t.container);this.parent=i;const[s,n]=this.initHtml();i.appendChild(s),this.container=s,this.scrollContainer=n.querySelector(".scroll"),this.wrapper=n.querySelector(".wrapper"),this.canvasWrapper=n.querySelector(".canvases"),this.progressWrapper=n.querySelector(".progress"),this.cursor=n.querySelector(".cursor"),e&&n.appendChild(e),this.initEvents()}parentFromOptionsContainer(t){let e;if(typeof t=="string"?e=document.querySelector(t):t instanceof HTMLElement&&(e=t),!e)throw new Error("Container not found");return e}initEvents(){if(this.wrapper.addEventListener("click",t=>{const e=this.wrapper.getBoundingClientRect(),[i,s]=Pt(e,t.clientX,t.clientY);this.emit("click",i,s)}),this.wrapper.addEventListener("dblclick",t=>{const e=this.wrapper.getBoundingClientRect(),[i,s]=Pt(e,t.clientX,t.clientY);this.emit("dblclick",i,s)}),this.options.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.scrollContainer.addEventListener("scroll",()=>{const{scrollLeft:t,scrollWidth:e,clientWidth:i}=this.scrollContainer,{startX:s,endX:n}=Dt({scrollLeft:t,scrollWidth:e,clientWidth:i});this.emit("scroll",s,n,t,t+i)}),typeof ResizeObserver=="function"){const t=this.createDelay(100);this.resizeObserver=new ResizeObserver(()=>{t().then(()=>this.onContainerResize()).catch(()=>{})}),this.resizeObserver.observe(this.scrollContainer)}}onContainerResize(){const t=this.parent.clientWidth;t===this.lastContainerWidth&&this.options.height!=="auto"||(this.lastContainerWidth=t,this.reRender(),this.emit("resize"))}initDrag(){this.dragUnsubscribe||(this.dragUnsubscribe=(function(t,e,i,s,n=3,d=0,l=100){if(!t)return()=>{};const c=new Map,a=matchMedia("(pointer: coarse)").matches;let o=()=>{};const m=f=>{if(f.button!==d||(c.set(f.pointerId,f),c.size>1))return;let u=f.clientX,p=f.clientY,b=!1;const g=Date.now(),D=y=>{if(y.defaultPrevented||c.size>1||a&&Date.now()-g<l)return;const C=y.clientX,E=y.clientY,A=C-u,j=E-p;if(b||Math.abs(A)>n||Math.abs(j)>n){y.preventDefault(),y.stopPropagation();const F=t.getBoundingClientRect(),{left:L,top:N}=F;b||(i?.(u-L,p-N),b=!0),e(A,j,C-L,E-N),u=C,p=E}},W=y=>{if(c.delete(y.pointerId),b){const C=y.clientX,E=y.clientY,A=t.getBoundingClientRect(),{left:j,top:F}=A;s?.(C-j,E-F)}o()},k=y=>{c.delete(y.pointerId),y.relatedTarget&&y.relatedTarget!==document.documentElement||W(y)},R=y=>{b&&(y.stopPropagation(),y.preventDefault())},S=y=>{y.defaultPrevented||c.size>1||b&&y.preventDefault()};document.addEventListener("pointermove",D),document.addEventListener("pointerup",W),document.addEventListener("pointerout",k),document.addEventListener("pointercancel",k),document.addEventListener("touchmove",S,{passive:!1}),document.addEventListener("click",R,{capture:!0}),o=()=>{document.removeEventListener("pointermove",D),document.removeEventListener("pointerup",W),document.removeEventListener("pointerout",k),document.removeEventListener("pointercancel",k),document.removeEventListener("touchmove",S),setTimeout(()=>{document.removeEventListener("click",R,{capture:!0})},10)}};return t.addEventListener("pointerdown",m),()=>{o(),t.removeEventListener("pointerdown",m),c.clear()}})(this.wrapper,(t,e,i)=>{const s=this.wrapper.getBoundingClientRect().width;this.emit("drag",ot(i/s))},t=>{this.isDragging=!0;const e=this.wrapper.getBoundingClientRect().width;this.emit("dragstart",ot(t/e))},t=>{this.isDragging=!1;const e=this.wrapper.getBoundingClientRect().width;this.emit("dragend",ot(t/e))}),this.subscriptions.push(this.dragUnsubscribe))}initHtml(){const t=document.createElement("div"),e=t.attachShadow({mode:"open"}),i=this.options.cspNonce&&typeof this.options.cspNonce=="string"?this.options.cspNonce.replace(/"/g,""):"";return e.innerHTML=`
|
|
2
2
|
<style${i?` nonce="${i}"`:""}>
|
|
3
3
|
:host {
|
|
4
4
|
user-select: none;
|