streamlit-nightly 1.46.2.dev20250702__py3-none-any.whl → 1.46.2.dev20250704__py3-none-any.whl
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.
- streamlit/auth_util.py +1 -1
- streamlit/elements/lib/column_types.py +9 -0
- streamlit/errors.py +6 -0
- streamlit/runtime/secrets.py +7 -2
- streamlit/static/index.html +1 -1
- streamlit/static/manifest.json +214 -214
- streamlit/static/static/js/{ErrorOutline.esm.MhIoYdvl.js → ErrorOutline.esm.Dl5aYA7P.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.MFVQ8TeX.js → FileDownload.esm.b9aAtFUL.js} +1 -1
- streamlit/static/static/js/{FileHelper.4MaelLoM.js → FileHelper.CZ-fo3AT.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.B0jg0hVR.js → FormClearHelper.X_JAWIDE.js} +1 -1
- streamlit/static/static/js/{Hooks.BRUa3Uwi.js → Hooks.DgDu8WWe.js} +1 -1
- streamlit/static/static/js/{InputInstructions.DIDrjUfW.js → InputInstructions.DRcWCO4-.js} +1 -1
- streamlit/static/static/js/{ProgressBar.D5j4Grse.js → ProgressBar.TfYA4ywP.js} +1 -1
- streamlit/static/static/js/{RenderInPortalIfExists.DSEpNV6C.js → RenderInPortalIfExists.DdXJh4rR.js} +1 -1
- streamlit/static/static/js/{Toolbar.CQcJmHso.js → Toolbar.Vgf9NeBF.js} +1 -1
- streamlit/static/static/js/{base-input.BnnSlzQu.js → base-input.DVejzOG3.js} +1 -1
- streamlit/static/static/js/{checkbox.C3U3kKA7.js → checkbox.CHzUs1FT.js} +1 -1
- streamlit/static/static/js/{createSuper.Cy5MeyJ7.js → createSuper.DtVUSUG3.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.DfB1NFlz.js → data-grid-overlay-editor.0g3IWOH4.js} +1 -1
- streamlit/static/static/js/{downloader.DJTt16dd.js → downloader.C1bmi7_d.js} +1 -1
- streamlit/static/static/js/{es6.wyhZ4wJk.js → es6.DB9CkkEz.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.DFyVP9Ig.js → iframeResizer.contentWindow.BUdo9Eut.js} +1 -1
- streamlit/static/static/js/{index.Dr7_LGVT.js → index.B7_hmluD.js} +1 -1
- streamlit/static/static/js/{index.B-X33K52.js → index.BFvFGupf.js} +1 -1
- streamlit/static/static/js/{index.CG52VtIR.js → index.BGQkiO_L.js} +1 -1
- streamlit/static/static/js/{index.CvEUwmm2.js → index.BLe8vNj1.js} +1 -1
- streamlit/static/static/js/{index.DJzsQdj5.js → index.BPv94ryA.js} +1 -1
- streamlit/static/static/js/{index.DT8f2xQ9.js → index.BSU3uPDy.js} +1 -1
- streamlit/static/static/js/{index.C2ZYRKqZ.js → index.BYDy3exs.js} +1 -1
- streamlit/static/static/js/{index.B22EHN7-.js → index.Bxl-lvf7.js} +1 -1
- streamlit/static/static/js/{index.Cipw6ZXy.js → index.Bz1rmVZY.js} +1 -1
- streamlit/static/static/js/{index.DyTIPa0F.js → index.C6lv7LZF.js} +1 -1
- streamlit/static/static/js/{index.DynUmaAG.js → index.CL2tKcqp.js} +1 -1
- streamlit/static/static/js/{index.Cx59kXcb.js → index.CUgLUHzz.js} +1 -1
- streamlit/static/static/js/{index.BMd4yctQ.js → index.Ca71cNwT.js} +1 -1
- streamlit/static/static/js/{index.lQYpmexK.js → index.ChFrryup.js} +1 -1
- streamlit/static/static/js/{index.DLQQdwIj.js → index.CsowBPbe.js} +1 -1
- streamlit/static/static/js/{index.DsdPm0SS.js → index.D9G9SbyS.js} +1 -1
- streamlit/static/static/js/{index.DEc9e9_6.js → index.D9lVoZ0g.js} +1 -1
- streamlit/static/static/js/{index.gMS0zlRZ.js → index.D9m0XlZY.js} +1 -1
- streamlit/static/static/js/{index.DtbQuv3u.js → index.DBSP2Mzg.js} +1 -1
- streamlit/static/static/js/{index.B465_5qO.js → index.DJFU0ONs.js} +1 -1
- streamlit/static/static/js/{index.C4H2pObU.js → index.DJM4CJwf.js} +1 -1
- streamlit/static/static/js/{index.Do1oo2Dl.js → index.DQtc0wgD.js} +1 -1
- streamlit/static/static/js/{index.DzC4L_Us.js → index.DYOc3lvA.js} +1 -1
- streamlit/static/static/js/index.DkDMkGP_.js +197 -0
- streamlit/static/static/js/{index.C_ub2Pfc.js → index.DlvTB7Ab.js} +1 -1
- streamlit/static/static/js/{index.BHoorvVC.js → index.Dmsp2dPx.js} +64 -64
- streamlit/static/static/js/index.MJ13AaAl.js +1 -0
- streamlit/static/static/js/{index.z241Yt9a.js → index.Vqz4Rf-H.js} +1 -1
- streamlit/static/static/js/{index.BNiT2b3M.js → index.WCZtB2fX.js} +1 -1
- streamlit/static/static/js/{index.Dsil7y_J.js → index.ZDNW54LS.js} +1 -1
- streamlit/static/static/js/{index.D-doFAXM.js → index.bBcPxeDg.js} +1 -1
- streamlit/static/static/js/{index.CLg6_EPb.js → index.ffsleSUc.js} +1 -1
- streamlit/static/static/js/{index.UFChjuC3.js → index.fnZJbfUF.js} +1 -1
- streamlit/static/static/js/{index.CDk53kDT.js → index.lM0dtLa7.js} +1 -1
- streamlit/static/static/js/{index.CDhJdsJ-.js → index.pxx1WhzW.js} +1 -1
- streamlit/static/static/js/{index.DcEV00Pn.js → index.rSXfDs8E.js} +1 -1
- streamlit/static/static/js/{index.BSHRz8-s.js → index.zmzbyDg-.js} +1 -1
- streamlit/static/static/js/{input.C8HOZnEd.js → input.zZ5PCHhH.js} +1 -1
- streamlit/static/static/js/{memory.8fc2LDiK.js → memory.BGxwio87.js} +1 -1
- streamlit/static/static/js/{mergeWith.xmxP-tqn.js → mergeWith.CAjjDs4h.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.DtoLRumH.js → number-overlay-editor.D6O6Urda.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.DqUCGXEg.js → possibleConstructorReturn.Bv3kil8b.js} +1 -1
- streamlit/static/static/js/{sandbox.de7mpc93.js → sandbox.DqowwceX.js} +1 -1
- streamlit/static/static/js/{textarea.9dU6cbLz.js → textarea.mjUutfC5.js} +1 -1
- streamlit/static/static/js/{timepicker.DANyzCwb.js → timepicker.D5asOTRg.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.Bja4AaDo.js → toConsumableArray.CbOloveN.js} +1 -1
- streamlit/static/static/js/{uniqueId.q5r0gCRd.js → uniqueId.DldNV5wM.js} +1 -1
- streamlit/static/static/js/{useBasicWidgetState.B0oxOutH.js → useBasicWidgetState.DILnXvLY.js} +1 -1
- streamlit/static/static/js/{useOnInputChange.XxzVJXCy.js → useOnInputChange.Bpbev6mM.js} +1 -1
- streamlit/static/static/js/withFullScreenWrapper.Dgyv-A2q.js +1 -0
- streamlit/watcher/event_based_path_watcher.py +76 -44
- streamlit/watcher/local_sources_watcher.py +22 -19
- streamlit/watcher/polling_path_watcher.py +29 -18
- streamlit/watcher/util.py +7 -8
- {streamlit_nightly-1.46.2.dev20250702.dist-info → streamlit_nightly-1.46.2.dev20250704.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.46.2.dev20250702.dist-info → streamlit_nightly-1.46.2.dev20250704.dist-info}/RECORD +82 -82
- streamlit/static/static/js/index.DFtXcE7L.js +0 -197
- streamlit/static/static/js/index.DRodAgy0.js +0 -1
- streamlit/static/static/js/withFullScreenWrapper.eXXoswSf.js +0 -1
- {streamlit_nightly-1.46.2.dev20250702.data → streamlit_nightly-1.46.2.dev20250704.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.46.2.dev20250702.dist-info → streamlit_nightly-1.46.2.dev20250704.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.46.2.dev20250702.dist-info → streamlit_nightly-1.46.2.dev20250704.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.46.2.dev20250702.dist-info → streamlit_nightly-1.46.2.dev20250704.dist-info}/top_level.txt +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
import{r as i,E as Z,_ as tt,s as g,B as mt,z as W,j as n,ba as et,bv as yt,C as F,bq as ot,b5 as nt,bp as T,a$ as Ct,bJ as It,bH as Q,bk as bt,bK as v,bt as vt,F as at,aQ as xt,bh as St,bL as wt,M as $,bm as Ft,bl as Et}from"./index.Dmsp2dPx.js";import{g as Ut,C as zt,I as Tt,F as N,E as Ht,a as Bt,s as Dt,u as Lt,b as Rt}from"./FileHelper.CZ-fo3AT.js";import{I as $t}from"./InputInstructions.DRcWCO4-.js";import{i as kt}from"./inputUtils.CQWz5UKz.js";import{E as Mt}from"./ErrorOutline.esm.Dl5aYA7P.js";import{U as rt}from"./UploadFileInfo.C-jY39rj.js";import{T as Vt}from"./textarea.mjUutfC5.js";import"./base-input.DVejzOG3.js";var it=i.forwardRef(function(t,e){var s={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return i.createElement(Z,tt({iconAttrs:s,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),i.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),i.createElement("path",{d:"M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5a2.5 2.5 0 015 0v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5a2.5 2.5 0 005 0V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z"}))});it.displayName="AttachFile";var st=i.forwardRef(function(t,e){var s={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return i.createElement(Z,tt({iconAttrs:s,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),i.createElement("rect",{width:24,height:24,fill:"none"}),i.createElement("path",{d:"M3 5.51v3.71c0 .46.31.86.76.97L11 12l-7.24 1.81c-.45.11-.76.51-.76.97v3.71c0 .72.73 1.2 1.39.92l15.42-6.49c.82-.34.82-1.5 0-1.84L4.39 4.58C3.73 4.31 3 4.79 3 5.51z"}))});st.displayName="Send";const Nt=g("div",{target:"e1togvvn0"})("border:none;position:relative;display:flex;"),Wt=g("div",{target:"e1togvvn1"})(({theme:t,extended:e})=>({border:`${t.sizes.borderWidth} solid`,borderColor:t.colors.widgetBorderColor??t.colors.transparent,borderRadius:t.radii.chatInput,backgroundColor:t.colors.secondaryBg,position:"relative",flexGrow:1,display:"flex",alignItems:"center",paddingLeft:t.spacing.lg,maxHeight:e?"none":t.sizes.minElementHeight,gap:t.spacing.sm,overflow:"hidden",":focus-within":{borderColor:t.colors.primary}})),At=g("button",{target:"e1togvvn2"})(({theme:t,disabled:e,extended:s})=>{const p=mt(t),[f,u]=p?[t.colors.gray60,t.colors.gray80]:[t.colors.gray80,t.colors.gray40];return{border:"none",backgroundColor:t.colors.transparent,borderTopRightRadius:s?"0":t.radii.chatInput,borderTopLeftRadius:s?t.radii.default:"0",borderBottomRightRadius:t.radii.chatInput,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:t.lineHeights.none,margin:t.spacing.none,padding:t.spacing.sm,color:e?f:u,pointerEvents:"auto","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{backgroundColor:p?t.colors.gray10:t.colors.gray90},"&:hover":{color:t.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{backgroundColor:t.colors.transparent,borderColor:t.colors.transparent,color:t.colors.gray,cursor:"not-allowed"}}}),Pt=g("div",{target:"e1togvvn3"})(({theme:t})=>({display:"flex",alignItems:"flex-end",height:"100%",position:"absolute",right:0,marginBottom:`-${t.sizes.borderWidth}`,pointerEvents:"none"})),Kt=g("div",{target:"e1togvvn4"})(({theme:t})=>({position:"absolute",bottom:"0px",right:`calc(${t.iconSizes.xl} + 2 * ${t.spacing.sm} + ${t.spacing.sm})`})),Ot=g("div",{target:"e15560op0"})(({theme:t,height:e})=>({backgroundColor:t.colors.transparent,position:"absolute",left:0,bottom:0,minHeight:`max(${t.sizes.emptyDropdownHeight}, ${e})`,width:"100%",zIndex:t.zIndices.priority})),_t=g("div",{target:"e15560op1"})(({theme:t,height:e})=>({border:`${t.sizes.borderWidth} solid`,borderColor:t.colors.primary,borderRadius:t.radii.chatInput,backgroundColor:t.colors.secondaryBg,color:t.colors.primary,display:"flex",alignItems:"center",justifyContent:"center",height:e,width:"100%",fontWeight:t.fontWeights.bold})),Xt=g("div",{target:"e15560op2"})(({theme:t,disabled:e})=>({display:"flex",alignItems:"top",height:"100%",marginTop:`-${t.sizes.borderWidth}`,cursor:e?"not-allowed":"auto"})),Gt=g("div",{target:"e15560op3"})(({disabled:t})=>({pointerEvents:t?"none":"auto"})),jt=g("div",{target:"e15560op4"})(({theme:t})=>({marginTop:"0.625em",marginLeft:t.spacing.sm,height:t.spacing.xl,width:t.sizes.borderWidth,backgroundColor:t.colors.fadedText20})),Yt=g("div",{target:"e15560op5"})(({theme:t})=>({left:0,right:0,lineHeight:t.lineHeights.tight,paddingLeft:t.spacing.sm,paddingRight:t.spacing.sm,overflowX:"auto"})),qt=g("div",{target:"e15560op6"})({display:"flex"}),Jt=g("div",{target:"e15560op7"})({flex:"0 0 auto"}),Qt=g("div",{target:"e15560op8"})(({theme:t})=>({display:"flex",alignItems:"center",padding:t.spacing.sm,gap:t.spacing.twoXS})),Zt=g("div",{target:"e15560op9"})(({theme:t})=>({color:t.colors.fadedText60})),te=g("div",{target:"e15560op10"})(({theme:t,fileStatus:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:e.type==="uploaded"?t.colors.bodyText:t.colors.fadedText60})),ee=g("div",{target:"e15560op11"})(({theme:t})=>({marginRight:t.spacing.md,color:t.colors.fadedText60})),oe=g("small",{target:"e15560op12"})(({theme:t})=>({display:"flex",alignItems:"center",maxHeight:t.sizes.smallElementHeight,color:t.colors.fadedText60,"& :hover":{color:t.colors.bodyText}}));function ne({children:t,content:e}){const s=W();return n(yt,{content:e,placement:et.TOP,overrides:{Body:{style:{top:`-${s.sizes.minElementHeight}`}}},children:t})}const ae=({fileInfo:t})=>{const e=W(),{type:s}=t.status;switch(s){case"uploading":return n(It,{usingCustomTheme:!1,"data-testid":"stChatInputFileIconSpinner",size:"lg",margin:"0",padding:"0"});case"error":return n(ne,{content:t.status.errorMessage,children:n(T,{color:e.colors.red,content:Mt,size:"lg"})});case"uploaded":return n(T,{content:Tt,size:"lg"});default:return Ct(s),null}},re=({fileInfo:t,onDelete:e})=>F(Qt,{className:"stChatInputFile","data-testid":"stChatInputFile",children:[n(Zt,{children:n(ae,{fileInfo:t})}),n(te,{className:"stChatInputFileName","data-testid":"stChatInputFileName",title:t.name,fileStatus:t.status,children:t.name}),n(ee,{children:Ut(t.size,N.Byte)}),n(oe,{"data-testid":"stChatInputDeleteBtn",children:n(ot,{onClick:()=>e(t.id),kind:nt.MINIMAL,children:n(T,{content:zt,size:"lg"})})})]}),ie=i.memo(re),se=({items:t,onDelete:e})=>n(Yt,{"data-testid":"stChatUploadedFiles",children:n(qt,{children:t.map(s=>n(Jt,{children:n(ie,{fileInfo:s,onDelete:e})},s.id))})}),le=i.memo(se),de=({getNextLocalFileId:t,addFiles:e,updateFile:s,uploadClient:p,element:f,onUploadProgress:u,onUploadComplete:I})=>(y,d)=>{const m=Q.CancelToken.source(),c=new rt(d.name,d.size,t(),{type:"uploading",cancelToken:m,progress:1});e([c]),p.uploadFile({formId:"",...f},y.uploadUrl,d,h=>u(h,c.id),m.token).then(()=>I(c.id,y)).catch(h=>{Q.isCancel(h)||s(c.id,c.setStatus({type:"error",errorMessage:h?h.toString():"Unknown error"}))})},ce=({acceptMultipleFiles:t,maxFileSize:e,uploadClient:s,uploadFile:p,addFiles:f,getNextLocalFileId:u,deleteExistingFiles:I,onUploadComplete:y})=>(d,m)=>{if(!t&&d.length===0&&m.length>1){const c=m.findIndex(h=>{var x;return((x=h.errors)==null?void 0:x[0].code)===Ht.TooManyFiles});c>=0&&(d.push(m[c].file),m.splice(c,1))}if(!t&&d.length>0&&I(),s.fetchFileURLs(d).then(c=>{bt(c,d).forEach(([h,x])=>{p(h,x)})}).catch(c=>{f(d.map(h=>new rt(h.name,h.size,u(),{type:"error",errorMessage:c})))}),m.length>0){const c=m.map(h=>Bt(h,u(),e));f(c)}y()},pe=({getRootProps:t,getInputProps:e,acceptFile:s,disabled:p,theme:f})=>F(Xt,{disabled:p,children:[F(Gt,{"data-testid":"stChatInputFileUploadButton",disabled:p,...t(),children:[n("input",{...e()}),n(vt,{content:`Upload or drag and drop ${s===v.Multiple?"files":"a file"}`,placement:et.TOP,onMouseEnterDelay:500,children:n(ot,{kind:nt.MINIMAL,disabled:p,children:n(T,{content:it,size:"lg",color:p?f.colors.fadedText40:f.colors.fadedText60})})})]}),n(jt,{})]}),ue=i.memo(pe),ge=({getRootProps:t,getInputProps:e,acceptFile:s,inputHeight:p})=>F(at,{children:[n(Ot,{height:p,...t(),children:n("input",{...e()})}),n(_t,{height:p,children:`Drag and drop ${s===v.Multiple?"files":"a file"} here`})]}),he=i.memo(ge),fe=6.5,k=1,M=(t,e,s)=>s.map(p=>p.id===t?e:p),V=(t,e)=>e.find(s=>s.id===t);function me({disabled:t,element:e,widgetMgr:s,fragmentId:p,uploadClient:f}){const u=W(),{placeholder:I,maxChars:y}=e,d=i.useRef(null),m=i.useRef(0),c=i.useRef({minHeight:0,maxHeight:0}),[h,x]=xt(),{innerWidth:A,innerHeight:P}=St(),[E,B]=i.useState(e.default),[U,D]=i.useState(0),[H,lt]=i.useState(!1),[S,w]=i.useState([]),[z,L]=i.useState(!1),R=i.useMemo(()=>S.some(o=>o.status.type==="uploading")?!1:E!==""||S.length>0,[S,E]),b=wt(e.acceptFile),K=Dt(e.maxUploadSizeMb,N.Megabyte,N.Byte),O=i.useCallback(o=>w(a=>[...a,...o]),[]),_=i.useCallback(o=>{w(a=>{const l=V(o,a);return $(l)?a:(l.status.type==="uploading"&&l.status.cancelToken.cancel(),l.status.type==="uploaded"&&l.status.fileUrls.deleteUrl&&f.deleteFile(l.status.fileUrls.deleteUrl),a.filter(r=>r.id!==o))})},[f]),dt=()=>{const o=S.filter(a=>a.status.type==="uploaded").map(a=>{const{name:l,size:r,status:C}=a,{fileId:ht,fileUrls:ft}=C;return new Ft({fileId:ht,fileUrls:ft,name:l,size:r})});return new Et({uploadedFileInfo:o})},X=()=>m.current++,ct=ce({acceptMultipleFiles:b===v.Multiple,maxFileSize:K,uploadClient:f,uploadFile:de({getNextLocalFileId:X,addFiles:O,updateFile:(o,a)=>{w(l=>M(o,a,l))},uploadClient:f,element:e,onUploadProgress:(o,a)=>{w(l=>{const r=V(a,l);if($(r)||r.status.type!=="uploading")return l;const C=Math.round(o.loaded*100/o.total);return r.status.progress===C?l:M(a,r.setStatus({type:"uploading",cancelToken:r.status.cancelToken,progress:C}),l)})},onUploadComplete:(o,a)=>{w(l=>{const r=V(o,l);return $(r)||r.status.type!=="uploading"?l:M(r.id,r.setStatus({type:"uploaded",fileId:a.fileId,fileUrls:a}),l)})}}),addFiles:O,getNextLocalFileId:X,deleteExistingFiles:()=>S.forEach(o=>_(o.id)),onUploadComplete:()=>{d.current&&d.current.focus()}}),{getRootProps:G,getInputProps:j}=Lt({onDrop:ct,multiple:b===v.Multiple,accept:Rt(e.fileType),maxSize:K}),Y=()=>{let o=0;const{current:a}=d;return a&&(a.style.height="auto",o=a.scrollHeight,a.style.height=""),o},q=()=>{if(d.current&&d.current.focus(),!R||t)return;const o={data:E,fileUploaderState:dt()};s.setChatInputValue(e,o,{fromUi:!0},p),w([]),B(""),D(0)},pt=o=>{const{metaKey:a,ctrlKey:l,shiftKey:r}=o;kt(o)&&!r&&!l&&!a&&(o.preventDefault(),q())},ut=o=>{const{value:a}=o.target;y!==0&&a.length>y||(B(a),D(Y()))};i.useEffect(()=>{if(e.setValue){e.setValue=!1;const o=e.value||"";B(o)}},[e]),i.useLayoutEffect(()=>{if(d.current){const{offsetHeight:o}=d.current;c.current.minHeight=o,c.current.maxHeight=o*fe}},[d]),i.useEffect(()=>{const o=r=>{var C;r.preventDefault(),r.stopPropagation(),!z&&((C=r.dataTransfer)!=null&&C.types.includes("Files"))&&L(!0)},a=r=>{r.preventDefault(),r.stopPropagation(),z&&(r.clientX<=0&&r.clientY<=0||r.clientX>=A&&r.clientY>=P)&&L(!1)},l=r=>{r.preventDefault(),r.stopPropagation(),z&&L(!1)};return window.addEventListener("dragover",o),window.addEventListener("drop",l),window.addEventListener("dragleave",a),()=>{window.removeEventListener("dragover",o),window.removeEventListener("drop",l),window.removeEventListener("dragleave",a)}},[z,A,P]),i.useLayoutEffect(()=>{const{minHeight:o}=c.current;lt(U>0&&d.current?Math.abs(U-o)>k:!1)},[U]),i.useLayoutEffect(()=>{D(Y())},[I]);const{maxHeight:J}=c.current,gt=b!==v.None&&z;return F(at,{children:[b===v.None?null:n(le,{items:[...S],onDelete:_}),n(Nt,{className:"stChatInput","data-testid":"stChatInput",ref:x,children:gt?n(he,{getRootProps:G,getInputProps:j,acceptFile:b,inputHeight:H?`${U+k}px`:u.sizes.minElementHeight}):F(Wt,{extended:H,children:[b===v.None?null:n(ue,{getRootProps:G,getInputProps:j,acceptFile:b,disabled:t,theme:u}),n(Vt,{inputRef:d,value:E,placeholder:I,onChange:ut,onKeyDown:pt,"aria-label":I,disabled:t,rows:1,overrides:{Root:{style:{minHeight:u.sizes.minElementHeight,outline:"none",borderLeftWidth:"0",borderRightWidth:"0",borderTopWidth:"0",borderBottomWidth:"0",borderTopLeftRadius:"0",borderTopRightRadius:"0",borderBottomRightRadius:"0",borderBottomLeftRadius:"0"}},Input:{props:{"data-testid":"stChatInputTextArea"},style:{lineHeight:u.lineHeights.inputWidget,"::placeholder":{color:u.colors.fadedText60},height:H?`${U+k}px`:"auto",maxHeight:J?`${J}px`:"none",paddingLeft:u.spacing.none,paddingBottom:u.spacing.sm,paddingTop:u.spacing.sm,paddingRight:`calc(${u.iconSizes.xl} + 2 * ${u.spacing.sm} + ${u.spacing.sm})`}}}}),h>u.breakpoints.hideWidgetDetails&&n(Kt,{children:n($t,{dirty:R,value:E,maxLength:y,type:"chat",inForm:!1})}),n(Pt,{children:n(At,{onClick:q,disabled:!R||t,extended:H,"data-testid":"stChatInputSubmitButton",children:n(T,{content:st,size:"xl",color:"inherit"})})})]})})]})}const Fe=i.memo(me);export{Fe as default};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import{r as h,E as $,_ as H,bb as pt,bk as _t,bl as $t,bm as Ht,M as X,O as q,aI as Vt,s as P,bn as jt,C as N,j as v,bo as Gt,b5 as Xt,bp as qt,bq as Yt,l as Kt,z as Jt,br as tt,H as Qt,aE as Zt,bs as te,bt as ee,ba as ie,bu as se}from"./index.BHoorvVC.js";import{u as ne,F as re}from"./FormClearHelper.B0jg0hVR.js";import{T as oe,a as mt}from"./Toolbar.CQcJmHso.js";import{u as ae}from"./Hooks.BRUa3Uwi.js";import{c as le}from"./createDownloadLinkElement.DZMwyjvU.js";import{F as ce,D as de}from"./FileDownload.esm.MFVQ8TeX.js";var yt=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{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"}))});yt.displayName="Mic";var bt=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{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"}))});bt.displayName="Pause";var wt=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{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"}))});wt.displayName="PlayArrow";var St=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{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"}))});St.displayName="Refresh";var Ct=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{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"}))});Ct.displayName="StopCircle";function R(s,t,e,i){return new(e||(e=Promise))(function(n,r){function a(c){try{d(i.next(c))}catch(l){r(l)}}function o(c){try{d(i.throw(c))}catch(l){r(l)}}function d(c){var l;c.done?n(c.value):(l=c.value,l instanceof e?l:new e(function(p){p(l)})).then(a,o)}d((i=i.apply(s,t||[])).next())})}let V=class{constructor(){this.listeners={}}on(t,e,i){if(this.listeners[t]||(this.listeners[t]=new Set),this.listeners[t].add(e),i==null?void 0:i.once){const n=()=>{this.un(t,n),this.un(t,e)};return this.on(t,n),n}return()=>this.un(t,e)}un(t,e){var i;(i=this.listeners[t])===null||i===void 0||i.delete(e)}once(t,e){return this.on(t,e,{once:!0})}unAll(){this.listeners={}}emit(t,...e){this.listeners[t]&&this.listeners[t].forEach(i=>i(...e))}};const j={decode:function(s,t){return R(this,void 0,void 0,function*(){const e=new AudioContext({sampleRate:t});return e.decodeAudioData(s).finally(()=>e.close())})},createBuffer:function(s,t){return typeof s[0]=="number"&&(s=[s]),function(e){const i=e[0];if(i.some(n=>n>1||n<-1)){const n=i.length;let r=0;for(let a=0;a<n;a++){const o=Math.abs(i[a]);o>r&&(r=o)}for(const a of e)for(let o=0;o<n;o++)a[o]/=r}}(s),{duration:t,length:s[0].length,sampleRate:s[0].length/t,numberOfChannels:s.length,getChannelData:e=>s==null?void 0:s[e],copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};function Et(s,t){const e=t.xmlns?document.createElementNS(t.xmlns,s):document.createElement(s);for(const[i,n]of Object.entries(t))if(i==="children")for(const[r,a]of Object.entries(t))typeof a=="string"?e.appendChild(document.createTextNode(a)):e.appendChild(Et(r,a));else i==="style"?Object.assign(e.style,n):i==="textContent"?e.textContent=n:e.setAttribute(i,n.toString());return e}function ft(s,t,e){const i=Et(s,t||{});return e==null||e.appendChild(i),i}var he=Object.freeze({__proto__:null,createElement:ft,default:ft});const ue={fetchBlob:function(s,t,e){return R(this,void 0,void 0,function*(){const i=yield fetch(s,e);if(i.status>=400)throw new Error(`Failed to fetch ${s}: ${i.status} (${i.statusText})`);return function(n,r){R(this,void 0,void 0,function*(){if(!n.body||!n.headers)return;const a=n.body.getReader(),o=Number(n.headers.get("Content-Length"))||0;let d=0;const c=p=>R(this,void 0,void 0,function*(){d+=(p==null?void 0:p.length)||0;const u=Math.round(d/o*100);r(u)}),l=()=>R(this,void 0,void 0,function*(){let p;try{p=yield a.read()}catch{return}p.done||(c(p.value),yield l())});l()})}(i.clone(),t),i.blob()})}};class pe extends V{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 n=e instanceof Blob&&(this.canPlayType(e.type)||!t)?URL.createObjectURL(e):t;i&&(this.media.src="");try{this.media.src=n}catch{this.media.src=t}}destroy(){this.isExternalMedia||(this.media.pause(),this.media.remove(),this.revokeSrc(),this.media.src="",this.media.load())}setMediaElement(t){this.media=t}play(){return R(this,void 0,void 0,function*(){return this.media.play()})}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)}}class U extends V{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.subscriptions=[],this.options=t;const i=this.parentFromOptionsContainer(t.container);this.parent=i;const[n,r]=this.initHtml();i.appendChild(n),this.container=n,this.scrollContainer=r.querySelector(".scroll"),this.wrapper=r.querySelector(".wrapper"),this.canvasWrapper=r.querySelector(".canvases"),this.progressWrapper=r.querySelector(".progress"),this.cursor=r.querySelector(".cursor"),e&&r.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(){const t=e=>{const i=this.wrapper.getBoundingClientRect(),n=e.clientX-i.left,r=e.clientY-i.top;return[n/i.width,r/i.height]};if(this.wrapper.addEventListener("click",e=>{const[i,n]=t(e);this.emit("click",i,n)}),this.wrapper.addEventListener("dblclick",e=>{const[i,n]=t(e);this.emit("dblclick",i,n)}),this.options.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.scrollContainer.addEventListener("scroll",()=>{const{scrollLeft:e,scrollWidth:i,clientWidth:n}=this.scrollContainer,r=e/i,a=(e+n)/i;this.emit("scroll",r,a,e,e+n)}),typeof ResizeObserver=="function"){const e=this.createDelay(100);this.resizeObserver=new ResizeObserver(()=>{e().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())}initDrag(){this.subscriptions.push(function(t,e,i,n,r=3,a=0,o=100){if(!t)return()=>{};const d=matchMedia("(pointer: coarse)").matches;let c=()=>{};const l=p=>{if(p.button!==a)return;p.preventDefault(),p.stopPropagation();let u=p.clientX,m=p.clientY,f=!1;const y=Date.now(),g=w=>{if(w.preventDefault(),w.stopPropagation(),d&&Date.now()-y<o)return;const A=w.clientX,D=w.clientY,k=A-u,W=D-m;if(f||Math.abs(k)>r||Math.abs(W)>r){const O=t.getBoundingClientRect(),{left:F,top:L}=O;f||(i==null||i(u-F,m-L),f=!0),e(k,W,A-F,D-L),u=A,m=D}},S=w=>{if(f){const A=w.clientX,D=w.clientY,k=t.getBoundingClientRect(),{left:W,top:O}=k;n==null||n(A-W,D-O)}c()},b=w=>{w.relatedTarget&&w.relatedTarget!==document.documentElement||S(w)},x=w=>{f&&(w.stopPropagation(),w.preventDefault())},T=w=>{f&&w.preventDefault()};document.addEventListener("pointermove",g),document.addEventListener("pointerup",S),document.addEventListener("pointerout",b),document.addEventListener("pointercancel",b),document.addEventListener("touchmove",T,{passive:!1}),document.addEventListener("click",x,{capture:!0}),c=()=>{document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",S),document.removeEventListener("pointerout",b),document.removeEventListener("pointercancel",b),document.removeEventListener("touchmove",T),setTimeout(()=>{document.removeEventListener("click",x,{capture:!0})},10)}};return t.addEventListener("pointerdown",l),()=>{c(),t.removeEventListener("pointerdown",l)}}(this.wrapper,(t,e,i)=>{this.emit("drag",Math.max(0,Math.min(1,i/this.wrapper.getBoundingClientRect().width)))},t=>{this.isDragging=!0,this.emit("dragstart",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))},t=>{this.isDragging=!1,this.emit("dragend",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))}))}getHeight(t,e){var i;const n=((i=this.audioData)===null||i===void 0?void 0:i.numberOfChannels)||1;if(t==null)return 128;if(!isNaN(Number(t)))return Number(t);if(t==="auto"){const r=this.parent.clientHeight||128;return e!=null&&e.every(a=>!a.overlay)?r/n:r}return 128}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,E as $,_ as H,bb as pt,bk as _t,bl as $t,bm as Ht,M as X,O as q,aI as Vt,s as P,bn as jt,C as N,j as v,bo as Gt,b5 as Xt,bp as qt,bq as Yt,l as Kt,z as Jt,br as tt,H as Qt,aE as Zt,bs as te,bt as ee,ba as ie,bu as se}from"./index.Dmsp2dPx.js";import{u as ne,F as re}from"./FormClearHelper.X_JAWIDE.js";import{T as oe,a as mt}from"./Toolbar.Vgf9NeBF.js";import{u as ae}from"./Hooks.DgDu8WWe.js";import{c as le}from"./createDownloadLinkElement.DZMwyjvU.js";import{F as ce,D as de}from"./FileDownload.esm.b9aAtFUL.js";var yt=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{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"}))});yt.displayName="Mic";var bt=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{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"}))});bt.displayName="Pause";var wt=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{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"}))});wt.displayName="PlayArrow";var St=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{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"}))});St.displayName="Refresh";var Ct=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{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"}))});Ct.displayName="StopCircle";function R(s,t,e,i){return new(e||(e=Promise))(function(n,r){function a(c){try{d(i.next(c))}catch(l){r(l)}}function o(c){try{d(i.throw(c))}catch(l){r(l)}}function d(c){var l;c.done?n(c.value):(l=c.value,l instanceof e?l:new e(function(p){p(l)})).then(a,o)}d((i=i.apply(s,t||[])).next())})}let V=class{constructor(){this.listeners={}}on(t,e,i){if(this.listeners[t]||(this.listeners[t]=new Set),this.listeners[t].add(e),i==null?void 0:i.once){const n=()=>{this.un(t,n),this.un(t,e)};return this.on(t,n),n}return()=>this.un(t,e)}un(t,e){var i;(i=this.listeners[t])===null||i===void 0||i.delete(e)}once(t,e){return this.on(t,e,{once:!0})}unAll(){this.listeners={}}emit(t,...e){this.listeners[t]&&this.listeners[t].forEach(i=>i(...e))}};const j={decode:function(s,t){return R(this,void 0,void 0,function*(){const e=new AudioContext({sampleRate:t});return e.decodeAudioData(s).finally(()=>e.close())})},createBuffer:function(s,t){return typeof s[0]=="number"&&(s=[s]),function(e){const i=e[0];if(i.some(n=>n>1||n<-1)){const n=i.length;let r=0;for(let a=0;a<n;a++){const o=Math.abs(i[a]);o>r&&(r=o)}for(const a of e)for(let o=0;o<n;o++)a[o]/=r}}(s),{duration:t,length:s[0].length,sampleRate:s[0].length/t,numberOfChannels:s.length,getChannelData:e=>s==null?void 0:s[e],copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};function Et(s,t){const e=t.xmlns?document.createElementNS(t.xmlns,s):document.createElement(s);for(const[i,n]of Object.entries(t))if(i==="children")for(const[r,a]of Object.entries(t))typeof a=="string"?e.appendChild(document.createTextNode(a)):e.appendChild(Et(r,a));else i==="style"?Object.assign(e.style,n):i==="textContent"?e.textContent=n:e.setAttribute(i,n.toString());return e}function ft(s,t,e){const i=Et(s,t||{});return e==null||e.appendChild(i),i}var he=Object.freeze({__proto__:null,createElement:ft,default:ft});const ue={fetchBlob:function(s,t,e){return R(this,void 0,void 0,function*(){const i=yield fetch(s,e);if(i.status>=400)throw new Error(`Failed to fetch ${s}: ${i.status} (${i.statusText})`);return function(n,r){R(this,void 0,void 0,function*(){if(!n.body||!n.headers)return;const a=n.body.getReader(),o=Number(n.headers.get("Content-Length"))||0;let d=0;const c=p=>R(this,void 0,void 0,function*(){d+=(p==null?void 0:p.length)||0;const u=Math.round(d/o*100);r(u)}),l=()=>R(this,void 0,void 0,function*(){let p;try{p=yield a.read()}catch{return}p.done||(c(p.value),yield l())});l()})}(i.clone(),t),i.blob()})}};class pe extends V{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 n=e instanceof Blob&&(this.canPlayType(e.type)||!t)?URL.createObjectURL(e):t;i&&(this.media.src="");try{this.media.src=n}catch{this.media.src=t}}destroy(){this.isExternalMedia||(this.media.pause(),this.media.remove(),this.revokeSrc(),this.media.src="",this.media.load())}setMediaElement(t){this.media=t}play(){return R(this,void 0,void 0,function*(){return this.media.play()})}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)}}class U extends V{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.subscriptions=[],this.options=t;const i=this.parentFromOptionsContainer(t.container);this.parent=i;const[n,r]=this.initHtml();i.appendChild(n),this.container=n,this.scrollContainer=r.querySelector(".scroll"),this.wrapper=r.querySelector(".wrapper"),this.canvasWrapper=r.querySelector(".canvases"),this.progressWrapper=r.querySelector(".progress"),this.cursor=r.querySelector(".cursor"),e&&r.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(){const t=e=>{const i=this.wrapper.getBoundingClientRect(),n=e.clientX-i.left,r=e.clientY-i.top;return[n/i.width,r/i.height]};if(this.wrapper.addEventListener("click",e=>{const[i,n]=t(e);this.emit("click",i,n)}),this.wrapper.addEventListener("dblclick",e=>{const[i,n]=t(e);this.emit("dblclick",i,n)}),this.options.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.scrollContainer.addEventListener("scroll",()=>{const{scrollLeft:e,scrollWidth:i,clientWidth:n}=this.scrollContainer,r=e/i,a=(e+n)/i;this.emit("scroll",r,a,e,e+n)}),typeof ResizeObserver=="function"){const e=this.createDelay(100);this.resizeObserver=new ResizeObserver(()=>{e().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())}initDrag(){this.subscriptions.push(function(t,e,i,n,r=3,a=0,o=100){if(!t)return()=>{};const d=matchMedia("(pointer: coarse)").matches;let c=()=>{};const l=p=>{if(p.button!==a)return;p.preventDefault(),p.stopPropagation();let u=p.clientX,m=p.clientY,f=!1;const y=Date.now(),g=w=>{if(w.preventDefault(),w.stopPropagation(),d&&Date.now()-y<o)return;const A=w.clientX,D=w.clientY,k=A-u,W=D-m;if(f||Math.abs(k)>r||Math.abs(W)>r){const O=t.getBoundingClientRect(),{left:F,top:L}=O;f||(i==null||i(u-F,m-L),f=!0),e(k,W,A-F,D-L),u=A,m=D}},S=w=>{if(f){const A=w.clientX,D=w.clientY,k=t.getBoundingClientRect(),{left:W,top:O}=k;n==null||n(A-W,D-O)}c()},b=w=>{w.relatedTarget&&w.relatedTarget!==document.documentElement||S(w)},x=w=>{f&&(w.stopPropagation(),w.preventDefault())},T=w=>{f&&w.preventDefault()};document.addEventListener("pointermove",g),document.addEventListener("pointerup",S),document.addEventListener("pointerout",b),document.addEventListener("pointercancel",b),document.addEventListener("touchmove",T,{passive:!1}),document.addEventListener("click",x,{capture:!0}),c=()=>{document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",S),document.removeEventListener("pointerout",b),document.removeEventListener("pointercancel",b),document.removeEventListener("touchmove",T),setTimeout(()=>{document.removeEventListener("click",x,{capture:!0})},10)}};return t.addEventListener("pointerdown",l),()=>{c(),t.removeEventListener("pointerdown",l)}}(this.wrapper,(t,e,i)=>{this.emit("drag",Math.max(0,Math.min(1,i/this.wrapper.getBoundingClientRect().width)))},t=>{this.isDragging=!0,this.emit("dragstart",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))},t=>{this.isDragging=!1,this.emit("dragend",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))}))}getHeight(t,e){var i;const n=((i=this.audioData)===null||i===void 0?void 0:i.numberOfChannels)||1;if(t==null)return 128;if(!isNaN(Number(t)))return Number(t);if(t==="auto"){const r=this.parent.clientHeight||128;return e!=null&&e.every(a=>!a.overlay)?r/n:r}return 128}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;
|
@@ -1 +1 @@
|
|
1
|
-
import{r as l,b5 as a,j as e,b6 as d,bq as u,b4 as c,b7 as B,b8 as b}from"./index.
|
1
|
+
import{r as l,b5 as a,j as e,b6 as d,bq as u,b4 as c,b7 as B,b8 as b}from"./index.Dmsp2dPx.js";function m(i){const{disabled:o,element:t,widgetMgr:s,fragmentId:r}=i;let n=a.SECONDARY;return t.type==="primary"?n=a.PRIMARY:t.type==="tertiary"&&(n=a.TERTIARY),e(b,{className:"stButton","data-testid":"stButton",children:e(d,{help:t.help,containerWidth:t.useContainerWidth,children:e(u,{kind:n,size:c.SMALL,disabled:o,containerWidth:t.useContainerWidth,onClick:()=>s.setTriggerValue(t,{fromUi:!0},r),children:e(B,{icon:t.icon,label:t.label})})})})}const p=l.memo(m);export{p as default};
|