streamlit-nightly 1.52.3.dev20260107__py3-none-any.whl → 1.52.3.dev20260108__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/connections/__init__.py +5 -1
- streamlit/connections/snowflake_connection.py +203 -57
- streamlit/runtime/connection_factory.py +25 -0
- streamlit/static/index.html +1 -1
- streamlit/static/manifest.json +300 -300
- streamlit/static/static/js/{ErrorOutline.esm.D2r71uaM.js → ErrorOutline.esm.j3b3OjAK.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.BWEHU45R.js → FileDownload.esm.DCizXv6Q.js} +1 -1
- streamlit/static/static/js/{FileHelper.bM5nEcHb.js → FileHelper.EpMV5UVe.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.DrhgNNta.js → FormClearHelper.lF7Ran5M.js} +1 -1
- streamlit/static/static/js/{InputInstructions.DPiGX0Th.js → InputInstructions.CMvqhPhy.js} +1 -1
- streamlit/static/static/js/{Particles.NjZlN0Ji.js → Particles.DsGe8psi.js} +1 -1
- streamlit/static/static/js/{ProgressBar.BC4DXqMl.js → ProgressBar.DzoKn4D-.js} +1 -1
- streamlit/static/static/js/{StreamlitSyntaxHighlighter.CbRgSaN7.js → StreamlitSyntaxHighlighter.CFab0b_b.js} +1 -1
- streamlit/static/static/js/{TableChart.esm.gttTfh7r.js → TableChart.esm.nZsTq1Sb.js} +1 -1
- streamlit/static/static/js/{Toolbar.DO2JfHk1.js → Toolbar.CFMvwQYl.js} +1 -1
- streamlit/static/static/js/{WidgetLabelHelpIconInline.NVlzvmTZ.js → WidgetLabelHelpIconInline.D2EEUEQX.js} +1 -1
- streamlit/static/static/js/{base-input.CmG3KTuv.js → base-input.DKTA2QNz.js} +1 -1
- streamlit/static/static/js/{checkbox.cfHeGdGI.js → checkbox.D9H9J-_W.js} +1 -1
- streamlit/static/static/js/{createDownloadLinkElement.B59a5_bn.js → createDownloadLinkElement.DCk6EhPM.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.DpTe47v0.js → data-grid-overlay-editor.DExrGdqs.js} +1 -1
- streamlit/static/static/js/{downloader.CYtKIJ9J.js → downloader.CLJ7BreF.js} +1 -1
- streamlit/static/static/js/{embed.Dfyy6eKR.js → embed.CxOHZWx2.js} +1 -1
- streamlit/static/static/js/{es6.x2A9auGg.js → es6.C99ebre4.js} +2 -2
- streamlit/static/static/js/{formatNumber.D8YUVHBi.js → formatNumber.D_w4fBsk.js} +1 -1
- streamlit/static/static/js/{iconPosition.C6Qxuo2L.js → iconPosition.Cfhw1RkE.js} +1 -1
- streamlit/static/static/js/{iframeResizer.contentWindow.Q0Cy4mzM.js → iframeResizer.contentWindow.BcWUIYOe.js} +1 -1
- streamlit/static/static/js/{index.WMC0NWRg.js → index.1AemKTSK.js} +1 -1
- streamlit/static/static/js/{index.DfXZgqLi.js → index.7Q3Iaebc.js} +1 -1
- streamlit/static/static/js/{index.DMtSM2QJ.js → index.ATP5607r.js} +1 -1
- streamlit/static/static/js/{index.Bs9bS4ZQ.js → index.BHx4Qw7z.js} +1 -1
- streamlit/static/static/js/{index.DlXiDt-m.js → index.BOGNGR9a.js} +1 -1
- streamlit/static/static/js/{index.BICn75_M.js → index.BWK_h3IL.js} +1 -1
- streamlit/static/static/js/{index.DzZhu8Ry.js → index.BXQNt1hj.js} +1 -1
- streamlit/static/static/js/{index.BtasgGzT.js → index.BXnQdCa5.js} +1 -1
- streamlit/static/static/js/{index.D2pbLWvp.js → index.BcbR2mbc.js} +1 -1
- streamlit/static/static/js/{index.mRYkGVRy.js → index.Bp_LrAiI.js} +1 -1
- streamlit/static/static/js/{index.Zffuf6-0.js → index.Bu3Lto_G.js} +1 -1
- streamlit/static/static/js/index.BzQChe4y.js +1 -0
- streamlit/static/static/js/{index.HTZptmDX.js → index.C-lnh8pI.js} +1 -1
- streamlit/static/static/js/{index.Bmo0a9c3.js → index.C0VFHmJN.js} +1 -1
- streamlit/static/static/js/{index.72U0nUaY.js → index.C7_5JMRC.js} +1 -1
- streamlit/static/static/js/index.C98anBCM.js +1 -0
- streamlit/static/static/js/{index.DFrG8naT.js → index.CBZQ_6AF.js} +1 -1
- streamlit/static/static/js/{index.CCkh_YSD.js → index.CFE-yHdT.js} +1 -1
- streamlit/static/static/js/{index.mUwcAQrC.js → index.CFtGP8pH.js} +1 -1
- streamlit/static/static/js/{index.DDUzbOzY.js → index.CGX2fllG.js} +1 -1
- streamlit/static/static/js/{index.DemMZEQt.js → index.COZICZL6.js} +1 -1
- streamlit/static/static/js/{index.WW20lmQl.js → index.COjurlZk.js} +1 -1
- streamlit/static/static/js/{index.BSULROGA.js → index.CPo5dtx7.js} +1 -1
- streamlit/static/static/js/{index.7BBVjqsx.js → index.Cg59Loqx.js} +1 -1
- streamlit/static/static/js/{index.CgFM5y1b.js → index.CiU2Tdcl.js} +1 -1
- streamlit/static/static/js/{index.CEB-gMZu.js → index.CrJ9KZpt.js} +1 -1
- streamlit/static/static/js/{index.BHzkSOU6.js → index.CrzXL2V8.js} +1 -1
- streamlit/static/static/js/{index.9i44yl-A.js → index.CyVBY8PG.js} +1 -1
- streamlit/static/static/js/{index.Dmaco99Q.js → index.D18KqoUa.js} +1 -1
- streamlit/static/static/js/{index.CzMaYu3-.js → index.DDx6TP95.js} +1 -1
- streamlit/static/static/js/{index.DMgiqc8r.js → index.DIIdzDwK.js} +1 -1
- streamlit/static/static/js/{index.9lrRft8u.js → index.DJ4GBc1k.js} +1 -1
- streamlit/static/static/js/{index.BA25ZBoD.js → index.DSSQzzPk.js} +1 -1
- streamlit/static/static/js/{index.4DpGzJxM.js → index.DbmtfcDm.js} +1 -1
- streamlit/static/static/js/{index.CWEfMTRP.js → index.DcudoGfL.js} +1 -1
- streamlit/static/static/js/{index.AF9wK9Wi.js → index.DiZfOR0A.js} +1 -1
- streamlit/static/static/js/{index.BuCGo7-5.js → index.DkSjHoXw.js} +5 -5
- streamlit/static/static/js/{index.CcpuNeOs.js → index.DoLorXMA.js} +1 -1
- streamlit/static/static/js/{index.up8HPR4v.js → index.DpnqUQVD.js} +1 -1
- streamlit/static/static/js/{index.DrHoCPek.js → index.Dqphk1ee.js} +2 -2
- streamlit/static/static/js/{index.Cto6hKVz.js → index.Ds-w0zIo.js} +1 -1
- streamlit/static/static/js/{index.5zBrLB5N.js → index.DuFqxjbN.js} +1 -1
- streamlit/static/static/js/{index.BTcImDDt.js → index.Dx8TcTHV.js} +6 -6
- streamlit/static/static/js/{index.DltYrNjp.js → index.V4C1Oi-F.js} +1 -1
- streamlit/static/static/js/{index.DyL5do6X.js → index.aJ3XRx8R.js} +1 -1
- streamlit/static/static/js/{index.i5tC1QD-.js → index.f_s01aPm.js} +1 -1
- streamlit/static/static/js/{index.4evoB7lO.js → index.gnFSTAhI.js} +1 -1
- streamlit/static/static/js/{index.Dm8qt8Me.js → index.mZ1qbnKs.js} +1 -1
- streamlit/static/static/js/{input.C76A8APa.js → input.CZPD7mCu.js} +1 -1
- streamlit/static/static/js/{main.CFbvktEv.js → main.CX1jAiMw.js} +1 -1
- streamlit/static/static/js/{memory.BkhqbxJl.js → memory.m0jC5ULx.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.Dpeh6_Ag.js → number-overlay-editor.Dy0iTeCo.js} +1 -1
- streamlit/static/static/js/{pandasStylerUtils.D8MDzfFI.js → pandasStylerUtils.D9jj-wHU.js} +1 -1
- streamlit/static/static/js/{sandbox.m1TYtBuF.js → sandbox.CbvG1iAz.js} +1 -1
- streamlit/static/static/js/{styled-components.yin3sIMA.js → styled-components.Cw3ioniY.js} +1 -1
- streamlit/static/static/js/{throttle.Df6MiNTy.js → throttle.CAwhGpn0.js} +1 -1
- streamlit/static/static/js/{timepicker.gcx4yeRx.js → timepicker.Bh3m6Pjp.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.Ca7RO9Jm.js → toConsumableArray.DM0o32JS.js} +1 -1
- streamlit/static/static/js/uniqueId.DtV_RZzG.js +1 -0
- streamlit/static/static/js/{useBasicWidgetState.CRkPCtR5.js → useBasicWidgetState.C9zOVP8a.js} +1 -1
- streamlit/static/static/js/{useIntlLocale.CFOMULNz.js → useIntlLocale.Bo42aN1U.js} +1 -1
- streamlit/static/static/js/{useTextInputAutoExpand.9c205rhQ.js → useTextInputAutoExpand.DmyHLDxl.js} +1 -1
- streamlit/static/static/js/{useUpdateUiValue.SYJJuEJM.js → useUpdateUiValue.aWXWpqmw.js} +1 -1
- streamlit/static/static/js/{useWaveformController.CCs9fdSv.js → useWaveformController.DlE14M1X.js} +1 -1
- streamlit/static/static/js/{withCalculatedWidth.MG9RY_Y-.js → withCalculatedWidth.B5JFJSmG.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.BgGLtZrC.js → withFullScreenWrapper.dgVioHk1.js} +1 -1
- {streamlit_nightly-1.52.3.dev20260107.dist-info → streamlit_nightly-1.52.3.dev20260108.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.52.3.dev20260107.dist-info → streamlit_nightly-1.52.3.dev20260108.dist-info}/RECORD +98 -98
- streamlit/static/static/js/index.Cszkm2ii.js +0 -1
- streamlit/static/static/js/index.xQYe72hk.js +0 -1
- streamlit/static/static/js/uniqueId.Bf2Hsb60.js +0 -1
- {streamlit_nightly-1.52.3.dev20260107.data → streamlit_nightly-1.52.3.dev20260108.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.52.3.dev20260107.dist-info → streamlit_nightly-1.52.3.dev20260108.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.52.3.dev20260107.dist-info → streamlit_nightly-1.52.3.dev20260108.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.52.3.dev20260107.dist-info → streamlit_nightly-1.52.3.dev20260108.dist-info}/top_level.txt +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as a,r as t,n as i,j as d,e}from"./index.
|
|
1
|
+
import{F as a,r as t,n as i,j as d,e}from"./index.DkSjHoXw.js";import{D as c,a as l}from"./IFrameUtil.DefezniK.js";const m=a("iframe",{target:"eu9re3w0"})(({theme:o,disableScrolling:r})=>({width:"100%",height:"100%",colorScheme:"normal",border:"none",padding:o.spacing.none,margin:o.spacing.none,overflow:r?"hidden":void 0}));function n(o){return e(o)||o===""?void 0:o}function g({element:o}){const r=n(o.src),s=i(r)?void 0:n(o.srcdoc);return d(m,{className:"stIFrame","data-testid":"stIFrame",allow:l,disableScrolling:!o.scrolling,src:r,srcDoc:s,scrolling:o.scrolling?"auto":"no",sandbox:c,title:"st.iframe",tabIndex:o.tabIndex??void 0})}const F=t.memo(g);export{F as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as p,N as o,r as C,O as N,o as g,j as s,Q as u,q as T,R as m}from"./index.
|
|
1
|
+
import{F as p,N as o,r as C,O as N,o as g,j as s,Q as u,q as T,R as m}from"./index.DkSjHoXw.js";import{g as A,a as L,f as w}from"./pandasStylerUtils.D9jj-wHU.js";import"./moment.C7qA8nIE.js";import"./numbro.B9_PXfzp.js";import"./_baseIndexOf.BTknn6Gb.js";const x=p("div",{target:"e10e2fxn0"})(({theme:e})=>({fontSize:e.fontSizes.md,fontFamily:e.genericFonts.bodyFont,lineHeight:e.lineHeights.small,captionSide:"bottom"})),h=p("div",{target:"e10e2fxn1"})(({theme:e})=>({fontFamily:e.genericFonts.bodyFont,fontSize:e.fontSizes.sm,paddingTop:e.spacing.sm,paddingBottom:0,color:e.colors.fadedText60,textAlign:"left",wordWrap:"break-word",display:"inline-block"})),M=p("div",{target:"e10e2fxn2"})(({theme:e,borderMode:t})=>({border:t===o.BorderMode.ALL?`${e.sizes.borderWidth} solid ${e.colors.dataframeBorderColor}`:"none",borderRadius:e.radii.default,overflow:"auto"})),O=p("table",{target:"e10e2fxn3"})(({theme:e})=>({width:e.sizes.full,color:e.colors.bodyText,borderSpacing:0})),S=(e,t=o.BorderMode.ALL)=>({borderBottom:t!==o.BorderMode.NONE?`${e.sizes.borderWidth} solid ${e.colors.dataframeBorderColor}`:"none","tbody tr:last-child &":{borderBottom:t===o.BorderMode.ALL||t===o.BorderMode.HORIZONTAL?"none":void 0},borderRight:t===o.BorderMode.ALL?`${e.sizes.borderWidth} solid ${e.colors.dataframeBorderColor}`:"none","&:last-child":{borderRight:t===o.BorderMode.ALL?"none":void 0,paddingRight:t===o.BorderMode.NONE?"0":e.spacing.xs},verticalAlign:"middle",padding:`${e.spacing.twoXS} ${e.spacing.xs}`,"&:not(:first-of-type)":{paddingLeft:t===o.BorderMode.NONE||t===o.BorderMode.HORIZONTAL?e.spacing.lg:e.spacing.xs},"&:first-of-type":{paddingLeft:t===o.BorderMode.NONE?"0":e.spacing.xs},fontWeight:e.fontWeights.normal}),b=p("td",{target:"e10e2fxn4"})(({theme:e,borderMode:t})=>S(e,t)),B=p("th",{target:"e10e2fxn5"})(({theme:e,borderMode:t})=>({...S(e,t),textAlign:"inherit",color:e.colors.fadedText60,"&:first-of-type":{paddingLeft:t===o.BorderMode.NONE?"0":e.spacing.sm},"&:not(:first-of-type)":{paddingLeft:t===o.BorderMode.NONE||t===o.BorderMode.HORIZONTAL?e.spacing.lg:e.spacing.sm}})),R=p(b,{target:"e10e2fxn6"})(({theme:e})=>({color:e.colors.gray70,fontStyle:"italic",fontSize:e.fontSizes.md,textAlign:"center"}));function H(e){const t=e.data,{cssId:l,cssStyles:r,caption:d}=t.styler??{},{numHeaderRows:f,numDataRows:c,numColumns:a}=t.dimensions,n=N(c),i=e.element.borderMode;return g(x,{className:"stTable","data-testid":"stTable",children:[r&&s("style",{children:r}),s(M,{borderMode:i,children:g(O,{id:l,"data-testid":"stTableStyledTable",children:[f>0&&E(t,i),s("tbody",{children:n.length===0?s("tr",{children:s(R,{"data-testid":"stTableStyledEmptyTableCell",colSpan:a||1,borderMode:i,children:"empty"})}):n.map(y=>$(t,y,a,i))})]})}),d&&s(h,{children:d})]})}function E(e,t){const l=t===o.BorderMode.NONE||t===o.BorderMode.HORIZONTAL;return s("thead",{children:A(e).map((r,d)=>s("tr",{children:r.map((f,c)=>{let a="inherit";if(l&&e.dimensions.numDataRows>0){const{contentType:n}=e.getCell(0,c);a=u(n)?"right":"left"}return s(B,{className:f.cssClass,scope:"col",borderMode:t,style:{textAlign:a},children:s(T,{source:f.name||" ",allowHTML:!1})},c)})},d))})}function $(e,t,l,r){return s("tr",{children:N(l).map(d=>z(e,t,d,r))},t)}function z(e,t,l,r){const{type:d,content:f,contentType:c}=e.getCell(t,l),a=L(e,t,l);let n=a?.displayContent||w(f,c),i=!1;const y={textAlign:u(c)?"right":"left"};switch(n?.endsWith('<span class="pd-t"></span>')&&(n=n.replace(/<span class="pd-t"><\/span>$/,""),i=!0),d){case m.INDEX:return g(B,{scope:"row",id:a?.cssId,className:a?.cssClass,borderMode:r,children:[i&&s("span",{className:"pd-t"}),s(T,{source:n||" ",allowHTML:!1})]},l);case m.DATA:return g(b,{id:a?.cssId,className:a?.cssClass,style:y,borderMode:r,children:[i&&s("span",{className:"pd-t"}),s(T,{source:n||" ",allowHTML:!1})]},l);default:throw new Error(`Cannot parse type "${d}".`)}}const j=C.memo(H);export{j as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as m,l as x,m as C,j as s,o as T,p as y,q as S,P as L,t as W,v as B,C as w,w as R}from"./index.DkSjHoXw.js";import{W as E}from"./WidgetLabelHelpIconInline.D2EEUEQX.js";import{u as P}from"./useBasicWidgetState.C9zOVP8a.js";import{S as v,L as $,a as u}from"./checkbox.D9H9J-_W.js";import"./FormClearHelper.lF7Ran5M.js";function M({element:o,disabled:a,widgetMgr:n,fragmentId:d}){const[p,g]=P({getStateFromWidgetMgr:X,getDefaultStateFromProto:H,getCurrStateFromProto:V,updateWidgetMgrState:F,element:o,widgetMgr:n,fragmentId:d}),f=m.useCallback(i=>{g({value:i.target.checked,fromUi:!0})},[g]),t=x(),{colors:e,spacing:h,sizes:r}=t,b=C(t),k=a?e.fadedText40:e.bodyText;return s(R,{className:"row-widget stCheckbox","data-testid":"stCheckbox",children:s(v,{checked:p,disabled:a,onChange:f,"aria-label":o.label,checkmarkType:o.type===w.StyleType.TOGGLE?u.toggle:u.default,labelPlacement:$.right,overrides:{Root:{style:({$isFocusVisible:i})=>({marginBottom:h.none,marginTop:h.none,backgroundColor:i?e.darkenedBgMix25:"",display:"flex",alignItems:"start"})},Toggle:{style:({$checked:i})=>{let c=b?e.bgColor:e.bodyText;return a&&(c=b?e.gray70:e.gray90),{width:`calc(${r.checkbox} - ${t.spacing.twoXS})`,height:`calc(${r.checkbox} - ${t.spacing.twoXS})`,transform:i?`translateX(${r.checkbox})`:"",backgroundColor:c,boxShadow:""}}},ToggleTrack:{style:({$checked:i,$isHovered:c})=>{let l=e.borderColor;return c&&!a&&(l=e.darkenedBgMix15),i&&!a&&(l=e.primary),{marginRight:0,marginLeft:0,marginBottom:0,marginTop:t.spacing.twoXS,paddingLeft:t.spacing.threeXS,paddingRight:t.spacing.threeXS,width:`calc(2 * ${r.checkbox})`,minWidth:`calc(2 * ${r.checkbox})`,height:r.checkbox,minHeight:r.checkbox,borderBottomLeftRadius:t.radii.full,borderTopLeftRadius:t.radii.full,borderBottomRightRadius:t.radii.full,borderTopRightRadius:t.radii.full,backgroundColor:l}}},Checkmark:{style:({$isFocusVisible:i,$checked:c})=>{const l=c&&!a?e.primary:e.borderColor;return{outline:0,width:r.checkbox,height:r.checkbox,marginTop:t.spacing.twoXS,marginLeft:0,marginBottom:0,boxShadow:i&&c?B(e.primary):"",borderLeftWidth:r.borderWidth,borderRightWidth:r.borderWidth,borderTopWidth:r.borderWidth,borderBottomWidth:r.borderWidth,borderLeftColor:l,borderRightColor:l,borderTopColor:l,borderBottomColor:l}}},Label:{style:{lineHeight:t.lineHeights.small,paddingLeft:t.spacing.sm,position:"relative",color:k}}},children:T(W,{visibility:y(o.labelVisibility?.value),"data-testid":"stWidgetLabel",children:[s(S,{source:o.label,allowHTML:!1,isLabel:!0,largerLabel:!0}),o.help&&s(E,{content:o.help,placement:L.TOP_RIGHT,label:o.label})]})})})}function X(o,a){return o.getBoolValue(a)}function H(o){return o.default??null}function V(o){return o.value??null}function F(o,a,n,d){a.setBoolValue(o,n.value,{fromUi:n.fromUi},d)}const A=m.memo(M);export{A as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as W,aB as O,F as _,r as i,k as $,l as q,aa as S,o as G,j as c,ab as M,ac as N,ae as J}from"./index.
|
|
1
|
+
import{p as W,aB as O,F as _,r as i,k as $,l as q,aa as S,o as G,j as c,ab as M,ac as N,ae as J}from"./index.DkSjHoXw.js";import{I as Q}from"./InputInstructions.CMvqhPhy.js";import{u as X}from"./useBasicWidgetState.C9zOVP8a.js";import{u as Y,a as Z,b as tt}from"./useUpdateUiValue.aWXWpqmw.js";import{u as et,T as ot}from"./useTextInputAutoExpand.DmyHLDxl.js";import{u as at}from"./uniqueId.DtV_RZzG.js";import"./FormClearHelper.lF7Ran5M.js";import"./inputUtils.CptNuJwn.js";import"./base-input.DKTA2QNz.js";const it=(e,t)=>{let a="auto";if(e.heightConfig?.useStretch)a="100%";else if(e.heightConfig?.pixelHeight&&e.heightConfig.pixelHeight>0){const s=W(t.labelVisibility?.value)===O.Collapsed?2:30,l=e.heightConfig.pixelHeight-s;a=`${Math.max(0,l)}px`}return a},st=_("div",{target:"e1tmb1p40"})({height:"100%",display:"flex",flexDirection:"column"}),T=(e,t)=>e.getStringValue(t)??t.default??null,rt=e=>e.default??null,lt=e=>e.value??null,nt=(e,t,a,s)=>{t.setStringValue(e,a.value,{fromUi:a.fromUi},s)},ut=({disabled:e,element:t,widgetMgr:a,fragmentId:s,outerElement:l})=>{const h=i.useRef(at("text_area_")).current,{width:y,elementRef:V}=$(),[r,g]=i.useState(!1),[I,x]=i.useState(!1),n=l.heightConfig?.useContent??!1,F=l.heightConfig?.useStretch??!1,v=it(l,t),C=i.useRef(null),[u,p]=i.useState(()=>T(a,t)??null),A=i.useCallback(()=>{p(t.default??null),g(!0)},[t]),[R,f]=X({getStateFromWidgetMgr:T,getDefaultStateFromProto:rt,getCurrStateFromProto:lt,updateWidgetMgrState:nt,element:t,widgetMgr:a,fragmentId:s,onFormCleared:A});Y(R,u,p,r);const o=q(),{height:k,maxHeight:B,updateScrollHeight:H}=et({textareaRef:C,dependencies:[t.placeholder]}),m=i.useCallback(()=>{g(!1),f({value:u,fromUi:!0})},[u,f]),L=i.useCallback(()=>{r&&m(),x(!1)},[r,m]),z=i.useCallback(()=>{x(!0)},[]),D=i.useCallback(()=>{n&&H()},[n,H]),E=Z({formId:t.formId,maxChars:t.maxChars,setDirty:g,setUiValue:p,setValueWithSource:f,additionalAction:D}),U=tt(t.formId,m,r,a,s,!0),{placeholder:P,formId:b}=t,j=S({formId:b})?a.allowFormEnterToSubmit(b):r,w=I&&y>o.breakpoints.hideWidgetDetails;return G(st,{className:"stTextArea","data-testid":"stTextArea",ref:V,children:[c(N,{label:t.label,disabled:e,labelVisibility:W(t.labelVisibility?.value),htmlFor:h,children:t.help&&c(M,{content:t.help,label:t.label})}),c(ot,{inputRef:n?C:void 0,value:u??"",placeholder:P,onBlur:L,onFocus:z,onChange:E,onKeyDown:U,"aria-label":t.label,disabled:e,id:h,overrides:{Input:{style:{fontWeight:o.fontWeights.normal,lineHeight:o.lineHeights.inputWidget,height:n?k:v,maxHeight:n?B:"",minHeight:o.sizes.largestElementHeight,resize:F?"none":"vertical",paddingRight:o.spacing.md,paddingLeft:o.spacing.md,paddingBottom:o.spacing.md,paddingTop:o.spacing.md,"::placeholder":{color:o.colors.fadedText60}}},Root:{props:{"data-testid":"stTextAreaRootElement"},style:({$isFocused:K})=>{const d=J(o.colors,K);return{borderLeftWidth:o.sizes.borderWidth,borderRightWidth:o.sizes.borderWidth,borderTopWidth:o.sizes.borderWidth,borderBottomWidth:o.sizes.borderWidth,borderTopColor:d,borderRightColor:d,borderBottomColor:d,borderLeftColor:d,flexGrow:1}}}}}),w&&c(Q,{dirty:r,value:u??"",maxLength:t.maxChars,type:"multiline",inForm:S({formId:b}),allowEnterToSubmit:j})]})},Ct=i.memo(ut);export{Ct as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{W as Q,e as Z,bv as me,bw as ge,F as he,r as d,l as ye,bx as V,ak as _,j as A,aN as pe,by as H,bz as Ee,a1 as be,a2 as Fe,o as Ce,a0 as we,aM as Se,n as Ne,S as Oe}from"./index.BuCGo7-5.js";import{bA as nr}from"./index.BuCGo7-5.js";import{w as Ae}from"./withCalculatedWidth.MG9RY_Y-.js";import{C as W,a as Y}from"./urls.BwSlolu9.js";import{D as Re,a as Ie}from"./IFrameUtil.DefezniK.js";const v="%[a-f0-9]{2}",G=new RegExp("("+v+")|([^%]+?)","gi"),B=new RegExp("("+v+")+","gi");function T(e,r){try{return[decodeURIComponent(e.join(""))]}catch{}if(e.length===1)return e;r=r||1;const t=e.slice(0,r),n=e.slice(r);return Array.prototype.concat.call([],T(t),T(n))}function _e(e){try{return decodeURIComponent(e)}catch{let r=e.match(G)||[];for(let t=1;t<r.length;t++)e=T(r,t).join(""),r=e.match(G)||[];return e}}function Te(e){const r={"%FE%FF":"��","%FF%FE":"��"};let t=B.exec(e);for(;t;){try{r[t[0]]=decodeURIComponent(t[0])}catch{const a=_e(t[0]);a!==t[0]&&(r[t[0]]=a)}t=B.exec(e)}r["%C2"]="�";const n=Object.keys(r);for(const a of n)e=e.replace(new RegExp(a,"g"),r[a]);return e}function xe(e){if(typeof e!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return decodeURIComponent(e)}catch{return Te(e)}}function Ue(e,r){const t={};if(Array.isArray(r))for(const n of r){const a=Object.getOwnPropertyDescriptor(e,n);a?.enumerable&&Object.defineProperty(t,n,a)}else for(const n of Reflect.ownKeys(e)){const a=Object.getOwnPropertyDescriptor(e,n);if(a.enumerable){const s=e[n];r(n,s,e)&&Object.defineProperty(t,n,a)}}return t}function ee(e,r){if(!(typeof e=="string"&&typeof r=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e===""||r==="")return[];const t=e.indexOf(r);return t===-1?[]:[e.slice(0,t),e.slice(t+r.length)]}const $e=e=>e==null,Me=e=>encodeURIComponent(e).replaceAll(/[!'()*]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase()}`),x=Symbol("encodeFragmentIdentifier");function Le(e){switch(e.arrayFormat){case"index":return r=>(t,n)=>{const a=t.length;return n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?t:n===null?[...t,[c(r,e),"[",a,"]"].join("")]:[...t,[c(r,e),"[",c(a,e),"]=",c(n,e)].join("")]};case"bracket":return r=>(t,n)=>n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?t:n===null?[...t,[c(r,e),"[]"].join("")]:[...t,[c(r,e),"[]=",c(n,e)].join("")];case"colon-list-separator":return r=>(t,n)=>n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?t:n===null?[...t,[c(r,e),":list="].join("")]:[...t,[c(r,e),":list=",c(n,e)].join("")];case"comma":case"separator":case"bracket-separator":{const r=e.arrayFormat==="bracket-separator"?"[]=":"=";return t=>(n,a)=>a===void 0||e.skipNull&&a===null||e.skipEmptyString&&a===""?n:(a=a===null?"":a,n.length===0?[[c(t,e),r,c(a,e)].join("")]:[[n,c(a,e)].join(e.arrayFormatSeparator)])}default:return r=>(t,n)=>n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?t:n===null?[...t,c(r,e)]:[...t,[c(r,e),"=",c(n,e)].join("")]}}function je(e){let r;switch(e.arrayFormat){case"index":return(t,n,a)=>{if(r=/\[(\d*)]$/.exec(t),t=t.replace(/\[\d*]$/,""),!r){a[t]=n;return}a[t]===void 0&&(a[t]={}),a[t][r[1]]=n};case"bracket":return(t,n,a)=>{if(r=/(\[])$/.exec(t),t=t.replace(/\[]$/,""),!r){a[t]=n;return}if(a[t]===void 0){a[t]=[n];return}a[t]=[...a[t],n]};case"colon-list-separator":return(t,n,a)=>{if(r=/(:list)$/.exec(t),t=t.replace(/:list$/,""),!r){a[t]=n;return}if(a[t]===void 0){a[t]=[n];return}a[t]=[...a[t],n]};case"comma":case"separator":return(t,n,a)=>{const o=typeof n=="string"&&n.includes(e.arrayFormatSeparator)?n.split(e.arrayFormatSeparator).map(i=>h(i,e)):n===null?n:h(n,e);a[t]=o};case"bracket-separator":return(t,n,a)=>{const s=/(\[])$/.test(t);if(t=t.replace(/\[]$/,""),!s){a[t]=n&&h(n,e);return}const o=n===null?[]:h(n,e).split(e.arrayFormatSeparator);if(a[t]===void 0){a[t]=o;return}a[t]=[...a[t],...o]};default:return(t,n,a)=>{if(a[t]===void 0){a[t]=n;return}a[t]=[...[a[t]].flat(),n]}}}function re(e){if(typeof e!="string"||e.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function c(e,r){return r.encode?r.strict?Me(e):encodeURIComponent(e):e}function h(e,r){return r.decode?xe(e):e}function te(e){return Array.isArray(e)?e.sort():typeof e=="object"?te(Object.keys(e)).sort((r,t)=>Number(r)-Number(t)).map(r=>e[r]):e}function ne(e){const r=e.indexOf("#");return r!==-1&&(e=e.slice(0,r)),e}function De(e){let r="";const t=e.indexOf("#");return t!==-1&&(r=e.slice(t)),r}function q(e,r,t){return t==="string"&&typeof e=="string"?e:typeof t=="function"&&typeof e=="string"?t(e):t==="boolean"&&e===null?!0:t==="boolean"&&e!==null&&(e.toLowerCase()==="true"||e.toLowerCase()==="false")?e.toLowerCase()==="true":t==="boolean"&&e!==null&&(e.toLowerCase()==="1"||e.toLowerCase()==="0")?e.toLowerCase()==="1":t==="string[]"&&r.arrayFormat!=="none"&&typeof e=="string"?[e]:t==="number[]"&&r.arrayFormat!=="none"&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""?[Number(e)]:t==="number"&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""?Number(e):r.parseBooleans&&e!==null&&(e.toLowerCase()==="true"||e.toLowerCase()==="false")?e.toLowerCase()==="true":r.parseNumbers&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""?Number(e):e}function U(e){e=ne(e);const r=e.indexOf("?");return r===-1?"":e.slice(r+1)}function $(e,r){r={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,types:Object.create(null),...r},re(r.arrayFormatSeparator);const t=je(r),n=Object.create(null);if(typeof e!="string"||(e=e.trim().replace(/^[?#&]/,""),!e))return n;for(const a of e.split("&")){if(a==="")continue;const s=r.decode?a.replaceAll("+"," "):a;let[o,i]=ee(s,"=");o===void 0&&(o=s),i=i===void 0?null:["comma","separator","bracket-separator"].includes(r.arrayFormat)?i:h(i,r),t(h(o,r),i,n)}for(const[a,s]of Object.entries(n))if(typeof s=="object"&&s!==null&&r.types[a]!=="string")for(const[o,i]of Object.entries(s)){const l=r.types[a],f=typeof l=="function"?l:l?l.replace("[]",""):void 0;s[o]=q(i,r,f)}else typeof s=="object"&&s!==null&&r.types[a]==="string"?n[a]=Object.values(s).join(r.arrayFormatSeparator):n[a]=q(s,r,r.types[a]);return r.sort===!1?n:(r.sort===!0?Object.keys(n).sort():Object.keys(n).sort(r.sort)).reduce((a,s)=>{const o=n[s];return a[s]=o&&typeof o=="object"&&!Array.isArray(o)?te(o):o,a},Object.create(null))}function ae(e,r){if(!e)return"";r={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...r},re(r.arrayFormatSeparator);const t=o=>r.skipNull&&$e(e[o])||r.skipEmptyString&&e[o]==="",n=Le(r),a={};for(const[o,i]of Object.entries(e))t(o)||(a[o]=i);const s=Object.keys(a);return r.sort!==!1&&s.sort(r.sort),s.map(o=>{let i=e[o];if(r.replacer&&(i=r.replacer(o,i),i===void 0)||i===void 0)return"";if(i===null)return c(o,r);if(Array.isArray(i)){if(i.length===0&&r.arrayFormat==="bracket-separator")return c(o,r)+"[]";let l=i;return r.replacer&&(l=i.map((f,u)=>r.replacer(`${o}[${u}]`,f)).filter(f=>f!==void 0)),l.reduce(n(o),[]).join("&")}return c(o,r)+"="+c(i,r)}).filter(o=>o.length>0).join("&")}function se(e,r){r={decode:!0,...r};let[t,n]=ee(e,"#");return t===void 0&&(t=e),{url:t?.split("?")?.[0]??"",query:$(U(e),r),...r&&r.parseFragmentIdentifier&&n?{fragmentIdentifier:h(n,r)}:{}}}function oe(e,r){r={encode:!0,strict:!0,[x]:!0,...r};const t=ne(e.url).split("?")[0]||"",n=U(e.url),a={...$(n,{sort:!1,...r}),...e.query};let s=ae(a,r);s&&=`?${s}`;let o=De(e.url);if(typeof e.fragmentIdentifier=="string"){const i=new URL(t);i.hash=e.fragmentIdentifier,o=r[x]?i.hash:`#${e.fragmentIdentifier}`}return`${t}${s}${o}`}function ie(e,r,t){t={parseFragmentIdentifier:!0,[x]:!1,...t};const{url:n,query:a,fragmentIdentifier:s}=se(e,t);return oe({url:n,query:Ue(a,r),fragmentIdentifier:s},t)}function Pe(e,r,t){const n=Array.isArray(r)?a=>!r.includes(a):(a,s)=>!r(a,s);return ie(e,n,t)}const ke=Object.freeze(Object.defineProperty({__proto__:null,exclude:Pe,extract:U,parse:$,parseUrl:se,pick:ie,stringify:ae,stringifyUrl:oe},Symbol.toStringTag,{value:"Module"}));var S=(function(e){return e.COMPONENT_READY="streamlit:componentReady",e.SET_COMPONENT_VALUE="streamlit:setComponentValue",e.SET_FRAME_HEIGHT="streamlit:setFrameHeight",e})({}),Ve=(function(e){return e.RENDER="streamlit:render",e})({});const He=1,F=Q.getLogger("componentUtils");function We(e){return(r,t)=>{if(!e.current)return;const{isReady:n,element:a,widgetMgr:s,setComponentError:o,componentReadyCallback:i,frameHeightCallback:l,fragmentId:f}=e.current,u=n();switch(r){case S.COMPONENT_READY:{const{apiVersion:y}=t;y!==He?o(new Error(`Unrecognized component API version: '${y}'`)):i();break}case S.SET_COMPONENT_VALUE:u?Ge(K(t,"value"),t.dataType,{fromUi:!0},a,s,f):F.warn(`Got ${r} before ${S.COMPONENT_READY}!`);break;case S.SET_FRAME_HEIGHT:u?l(K(t,"height")):F.warn(`Got ${r} before ${S.COMPONENT_READY}!`);break;default:F.warn(`Unrecognized ComponentBackMsgType: ${r}`)}}}function Ye(e,r){const t=JSON.parse(e),n=[];for(const a of r){const{key:s}=a;switch(a.value?.toLowerCase()){case"arrowdataframe":n.push({key:s,value:ge.toObject(a.arrowDataframe)});break;case"bytes":t[s]=a.bytes;break;default:throw new Error(`Unrecognized SpecialArg type: ${a.value}`)}}return[t,n]}function z(e,r,t,n,a){if(!a){F.warn("Can't send ForwardMsg; missing our iframe!");return}if(Z(a.contentWindow)){F.warn("Can't send ForwardMsg; iframe has no contentWindow!");return}a.contentWindow.postMessage({type:Ve.RENDER,args:e,dfs:r,disabled:t,theme:{...me(n),font:n.genericFonts.bodyFont}},"*")}function Ge(e,r,t,n,a,s){if(e===void 0){F.warn("handleSetComponentValue: missing 'value' prop");return}switch(r){case"dataframe":a.setArrowValue(n,e,t,s);break;case"bytes":a.setBytesValue(n,e,t,s);break;default:a.setJsonValue(n,e,t,s)}}function K(e,r,t=void 0){return Object.hasOwn(e,r)?e[r]:t}const Be=he("iframe",{target:"edxyb2x0"})(({theme:e,componentReady:r})=>({colorScheme:"normal",border:"none",padding:e.spacing.none,margin:e.spacing.none,display:r?"initial":"none"})),R=Q.getLogger("ComponentInstance"),J=6e4;function qe(e,r,t){let n;Ne(t)&&t!==""?n=t:n=r.getComponentURL(e,"index.html");const a=Oe.CUSTOM_COMPONENT_CLIENT_ID,s=new URL(window.location.href);return n=ke.stringifyUrl({url:n,query:{streamlitUrl:s.origin+s.pathname,...a&&{__streamlit_parent_client_id:a}}}),n}function X(e,r){let t;return r&&r!==""?t=`Your app is having trouble loading the **${e}** component.
|
|
1
|
+
import{W as Q,e as Z,bv as me,bw as ge,F as he,r as d,l as ye,bx as V,ak as _,j as A,aN as pe,by as H,bz as Ee,a1 as be,a2 as Fe,o as Ce,a0 as we,aM as Se,n as Ne,S as Oe}from"./index.DkSjHoXw.js";import{bA as nr}from"./index.DkSjHoXw.js";import{w as Ae}from"./withCalculatedWidth.B5JFJSmG.js";import{C as W,a as Y}from"./urls.BwSlolu9.js";import{D as Re,a as Ie}from"./IFrameUtil.DefezniK.js";const v="%[a-f0-9]{2}",G=new RegExp("("+v+")|([^%]+?)","gi"),B=new RegExp("("+v+")+","gi");function T(e,r){try{return[decodeURIComponent(e.join(""))]}catch{}if(e.length===1)return e;r=r||1;const t=e.slice(0,r),n=e.slice(r);return Array.prototype.concat.call([],T(t),T(n))}function _e(e){try{return decodeURIComponent(e)}catch{let r=e.match(G)||[];for(let t=1;t<r.length;t++)e=T(r,t).join(""),r=e.match(G)||[];return e}}function Te(e){const r={"%FE%FF":"��","%FF%FE":"��"};let t=B.exec(e);for(;t;){try{r[t[0]]=decodeURIComponent(t[0])}catch{const a=_e(t[0]);a!==t[0]&&(r[t[0]]=a)}t=B.exec(e)}r["%C2"]="�";const n=Object.keys(r);for(const a of n)e=e.replace(new RegExp(a,"g"),r[a]);return e}function xe(e){if(typeof e!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return decodeURIComponent(e)}catch{return Te(e)}}function Ue(e,r){const t={};if(Array.isArray(r))for(const n of r){const a=Object.getOwnPropertyDescriptor(e,n);a?.enumerable&&Object.defineProperty(t,n,a)}else for(const n of Reflect.ownKeys(e)){const a=Object.getOwnPropertyDescriptor(e,n);if(a.enumerable){const s=e[n];r(n,s,e)&&Object.defineProperty(t,n,a)}}return t}function ee(e,r){if(!(typeof e=="string"&&typeof r=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e===""||r==="")return[];const t=e.indexOf(r);return t===-1?[]:[e.slice(0,t),e.slice(t+r.length)]}const $e=e=>e==null,Me=e=>encodeURIComponent(e).replaceAll(/[!'()*]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase()}`),x=Symbol("encodeFragmentIdentifier");function Le(e){switch(e.arrayFormat){case"index":return r=>(t,n)=>{const a=t.length;return n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?t:n===null?[...t,[c(r,e),"[",a,"]"].join("")]:[...t,[c(r,e),"[",c(a,e),"]=",c(n,e)].join("")]};case"bracket":return r=>(t,n)=>n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?t:n===null?[...t,[c(r,e),"[]"].join("")]:[...t,[c(r,e),"[]=",c(n,e)].join("")];case"colon-list-separator":return r=>(t,n)=>n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?t:n===null?[...t,[c(r,e),":list="].join("")]:[...t,[c(r,e),":list=",c(n,e)].join("")];case"comma":case"separator":case"bracket-separator":{const r=e.arrayFormat==="bracket-separator"?"[]=":"=";return t=>(n,a)=>a===void 0||e.skipNull&&a===null||e.skipEmptyString&&a===""?n:(a=a===null?"":a,n.length===0?[[c(t,e),r,c(a,e)].join("")]:[[n,c(a,e)].join(e.arrayFormatSeparator)])}default:return r=>(t,n)=>n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?t:n===null?[...t,c(r,e)]:[...t,[c(r,e),"=",c(n,e)].join("")]}}function je(e){let r;switch(e.arrayFormat){case"index":return(t,n,a)=>{if(r=/\[(\d*)]$/.exec(t),t=t.replace(/\[\d*]$/,""),!r){a[t]=n;return}a[t]===void 0&&(a[t]={}),a[t][r[1]]=n};case"bracket":return(t,n,a)=>{if(r=/(\[])$/.exec(t),t=t.replace(/\[]$/,""),!r){a[t]=n;return}if(a[t]===void 0){a[t]=[n];return}a[t]=[...a[t],n]};case"colon-list-separator":return(t,n,a)=>{if(r=/(:list)$/.exec(t),t=t.replace(/:list$/,""),!r){a[t]=n;return}if(a[t]===void 0){a[t]=[n];return}a[t]=[...a[t],n]};case"comma":case"separator":return(t,n,a)=>{const o=typeof n=="string"&&n.includes(e.arrayFormatSeparator)?n.split(e.arrayFormatSeparator).map(i=>h(i,e)):n===null?n:h(n,e);a[t]=o};case"bracket-separator":return(t,n,a)=>{const s=/(\[])$/.test(t);if(t=t.replace(/\[]$/,""),!s){a[t]=n&&h(n,e);return}const o=n===null?[]:h(n,e).split(e.arrayFormatSeparator);if(a[t]===void 0){a[t]=o;return}a[t]=[...a[t],...o]};default:return(t,n,a)=>{if(a[t]===void 0){a[t]=n;return}a[t]=[...[a[t]].flat(),n]}}}function re(e){if(typeof e!="string"||e.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function c(e,r){return r.encode?r.strict?Me(e):encodeURIComponent(e):e}function h(e,r){return r.decode?xe(e):e}function te(e){return Array.isArray(e)?e.sort():typeof e=="object"?te(Object.keys(e)).sort((r,t)=>Number(r)-Number(t)).map(r=>e[r]):e}function ne(e){const r=e.indexOf("#");return r!==-1&&(e=e.slice(0,r)),e}function De(e){let r="";const t=e.indexOf("#");return t!==-1&&(r=e.slice(t)),r}function q(e,r,t){return t==="string"&&typeof e=="string"?e:typeof t=="function"&&typeof e=="string"?t(e):t==="boolean"&&e===null?!0:t==="boolean"&&e!==null&&(e.toLowerCase()==="true"||e.toLowerCase()==="false")?e.toLowerCase()==="true":t==="boolean"&&e!==null&&(e.toLowerCase()==="1"||e.toLowerCase()==="0")?e.toLowerCase()==="1":t==="string[]"&&r.arrayFormat!=="none"&&typeof e=="string"?[e]:t==="number[]"&&r.arrayFormat!=="none"&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""?[Number(e)]:t==="number"&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""?Number(e):r.parseBooleans&&e!==null&&(e.toLowerCase()==="true"||e.toLowerCase()==="false")?e.toLowerCase()==="true":r.parseNumbers&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""?Number(e):e}function U(e){e=ne(e);const r=e.indexOf("?");return r===-1?"":e.slice(r+1)}function $(e,r){r={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,types:Object.create(null),...r},re(r.arrayFormatSeparator);const t=je(r),n=Object.create(null);if(typeof e!="string"||(e=e.trim().replace(/^[?#&]/,""),!e))return n;for(const a of e.split("&")){if(a==="")continue;const s=r.decode?a.replaceAll("+"," "):a;let[o,i]=ee(s,"=");o===void 0&&(o=s),i=i===void 0?null:["comma","separator","bracket-separator"].includes(r.arrayFormat)?i:h(i,r),t(h(o,r),i,n)}for(const[a,s]of Object.entries(n))if(typeof s=="object"&&s!==null&&r.types[a]!=="string")for(const[o,i]of Object.entries(s)){const l=r.types[a],f=typeof l=="function"?l:l?l.replace("[]",""):void 0;s[o]=q(i,r,f)}else typeof s=="object"&&s!==null&&r.types[a]==="string"?n[a]=Object.values(s).join(r.arrayFormatSeparator):n[a]=q(s,r,r.types[a]);return r.sort===!1?n:(r.sort===!0?Object.keys(n).sort():Object.keys(n).sort(r.sort)).reduce((a,s)=>{const o=n[s];return a[s]=o&&typeof o=="object"&&!Array.isArray(o)?te(o):o,a},Object.create(null))}function ae(e,r){if(!e)return"";r={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...r},re(r.arrayFormatSeparator);const t=o=>r.skipNull&&$e(e[o])||r.skipEmptyString&&e[o]==="",n=Le(r),a={};for(const[o,i]of Object.entries(e))t(o)||(a[o]=i);const s=Object.keys(a);return r.sort!==!1&&s.sort(r.sort),s.map(o=>{let i=e[o];if(r.replacer&&(i=r.replacer(o,i),i===void 0)||i===void 0)return"";if(i===null)return c(o,r);if(Array.isArray(i)){if(i.length===0&&r.arrayFormat==="bracket-separator")return c(o,r)+"[]";let l=i;return r.replacer&&(l=i.map((f,u)=>r.replacer(`${o}[${u}]`,f)).filter(f=>f!==void 0)),l.reduce(n(o),[]).join("&")}return c(o,r)+"="+c(i,r)}).filter(o=>o.length>0).join("&")}function se(e,r){r={decode:!0,...r};let[t,n]=ee(e,"#");return t===void 0&&(t=e),{url:t?.split("?")?.[0]??"",query:$(U(e),r),...r&&r.parseFragmentIdentifier&&n?{fragmentIdentifier:h(n,r)}:{}}}function oe(e,r){r={encode:!0,strict:!0,[x]:!0,...r};const t=ne(e.url).split("?")[0]||"",n=U(e.url),a={...$(n,{sort:!1,...r}),...e.query};let s=ae(a,r);s&&=`?${s}`;let o=De(e.url);if(typeof e.fragmentIdentifier=="string"){const i=new URL(t);i.hash=e.fragmentIdentifier,o=r[x]?i.hash:`#${e.fragmentIdentifier}`}return`${t}${s}${o}`}function ie(e,r,t){t={parseFragmentIdentifier:!0,[x]:!1,...t};const{url:n,query:a,fragmentIdentifier:s}=se(e,t);return oe({url:n,query:Ue(a,r),fragmentIdentifier:s},t)}function Pe(e,r,t){const n=Array.isArray(r)?a=>!r.includes(a):(a,s)=>!r(a,s);return ie(e,n,t)}const ke=Object.freeze(Object.defineProperty({__proto__:null,exclude:Pe,extract:U,parse:$,parseUrl:se,pick:ie,stringify:ae,stringifyUrl:oe},Symbol.toStringTag,{value:"Module"}));var S=(function(e){return e.COMPONENT_READY="streamlit:componentReady",e.SET_COMPONENT_VALUE="streamlit:setComponentValue",e.SET_FRAME_HEIGHT="streamlit:setFrameHeight",e})({}),Ve=(function(e){return e.RENDER="streamlit:render",e})({});const He=1,F=Q.getLogger("componentUtils");function We(e){return(r,t)=>{if(!e.current)return;const{isReady:n,element:a,widgetMgr:s,setComponentError:o,componentReadyCallback:i,frameHeightCallback:l,fragmentId:f}=e.current,u=n();switch(r){case S.COMPONENT_READY:{const{apiVersion:y}=t;y!==He?o(new Error(`Unrecognized component API version: '${y}'`)):i();break}case S.SET_COMPONENT_VALUE:u?Ge(K(t,"value"),t.dataType,{fromUi:!0},a,s,f):F.warn(`Got ${r} before ${S.COMPONENT_READY}!`);break;case S.SET_FRAME_HEIGHT:u?l(K(t,"height")):F.warn(`Got ${r} before ${S.COMPONENT_READY}!`);break;default:F.warn(`Unrecognized ComponentBackMsgType: ${r}`)}}}function Ye(e,r){const t=JSON.parse(e),n=[];for(const a of r){const{key:s}=a;switch(a.value?.toLowerCase()){case"arrowdataframe":n.push({key:s,value:ge.toObject(a.arrowDataframe)});break;case"bytes":t[s]=a.bytes;break;default:throw new Error(`Unrecognized SpecialArg type: ${a.value}`)}}return[t,n]}function z(e,r,t,n,a){if(!a){F.warn("Can't send ForwardMsg; missing our iframe!");return}if(Z(a.contentWindow)){F.warn("Can't send ForwardMsg; iframe has no contentWindow!");return}a.contentWindow.postMessage({type:Ve.RENDER,args:e,dfs:r,disabled:t,theme:{...me(n),font:n.genericFonts.bodyFont}},"*")}function Ge(e,r,t,n,a,s){if(e===void 0){F.warn("handleSetComponentValue: missing 'value' prop");return}switch(r){case"dataframe":a.setArrowValue(n,e,t,s);break;case"bytes":a.setBytesValue(n,e,t,s);break;default:a.setJsonValue(n,e,t,s)}}function K(e,r,t=void 0){return Object.hasOwn(e,r)?e[r]:t}const Be=he("iframe",{target:"edxyb2x0"})(({theme:e,componentReady:r})=>({colorScheme:"normal",border:"none",padding:e.spacing.none,margin:e.spacing.none,display:r?"initial":"none"})),R=Q.getLogger("ComponentInstance"),J=6e4;function qe(e,r,t){let n;Ne(t)&&t!==""?n=t:n=r.getComponentURL(e,"index.html");const a=Oe.CUSTOM_COMPONENT_CLIENT_ID,s=new URL(window.location.href);return n=ke.stringifyUrl({url:n,query:{streamlitUrl:s.origin+s.pathname,...a&&{__streamlit_parent_client_id:a}}}),n}function X(e,r){let t;return r&&r!==""?t=`Your app is having trouble loading the **${e}** component.
|
|
2
2
|
The app is attempting to load the component from **${r}**,
|
|
3
3
|
and hasn't received its \`Streamlit.setComponentReady()\` message.
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,E as B,_ as X,l as $,e as L,R as Q,Q as K,be as j,bf as z,bg as Y,bh as Z,n as k,bi as M,W as P,X as q,k as ee,b9 as te,bj as ne,j as A,o as re,b2 as se}from"./index.
|
|
1
|
+
import{r as a,E as B,_ as X,l as $,e as L,R as Q,Q as K,be as j,bf as z,bg as Y,bh as Z,n as k,bi as M,W as P,X as q,k as ee,b9 as te,bj as ne,j as A,o as re,b2 as se}from"./index.DkSjHoXw.js";import{w as oe,E as ae}from"./withFullScreenWrapper.dgVioHk1.js";import{a as _,S as H,T as ce}from"./Toolbar.CFMvwQYl.js";import{R as ie}from"./index.Dx8TcTHV.js";import{a as J,c as le,b as ue,e as fe,t as de,S as me,d as pe}from"./embed.CxOHZWx2.js";import{u as he}from"./FormClearHelper.lF7Ran5M.js";import{T as ge}from"./TableChart.esm.nZsTq1Sb.js";import"./moment.C7qA8nIE.js";import"./pandasStylerUtils.D9jj-wHU.js";import"./numbro.B9_PXfzp.js";import"./_baseIndexOf.BTknn6Gb.js";import"./index.8HslT92O.js";import"./main.CX1jAiMw.js";import"./throttle.CAwhGpn0.js";import"./formatNumber.D_w4fBsk.js";import"./sprintf.DpPCfzXw.js";import"./formatMoment.C6Hwn6X5.js";import"./checkbox.D9H9J-_W.js";import"./createDownloadLinkElement.DCk6EhPM.js";import"./toConsumableArray.DM0o32JS.js";import"./FileDownload.esm.DCizXv6Q.js";import"./_arrayIncludes.B19Iyn2B.js";import"./threshold.CUNQbqMA.js";import"./value.DaKxGC7O.js";import"./timer.BZio6gjG.js";var U=a.forwardRef(function(n,e){var s={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return a.createElement(B,X({iconAttrs:s,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},n,{ref:e}),a.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),a.createElement("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zM7 10h2v7H7zm4-3h2v10h-2zm4 6h2v4h-2z"}))});U.displayName="InsertChart";const Se=20;function ye(n){"params"in n&&"encoding"in n&&n.params.forEach(e=>{"select"in e&&(["interval","point"].includes(e.select)&&(e.select={type:e.select}),"type"in e.select&&e.select.type==="point"&&!("encodings"in e.select)&&L(e.select.encodings)&&(e.select.encodings=Object.keys(n.encoding)))})}const be=(n,e,s,r,u,l,f,p)=>{const t=JSON.parse(n);if(r==="streamlit"?t.config=J(t.config,l):t.usermeta?.embedOptions?.theme==="streamlit"?(t.config=J(t.config,l),t.usermeta.embedOptions.theme=void 0):t.config=le(t.config,l),t.title&&(typeof t.title=="string"&&(t.title={text:t.title}),t.title.limit=t.title.limit??Math.max(f-40,0)),s&&(t.height=p),e&&(t.width=f,"vconcat"in t&&t.vconcat.forEach(o=>{o===null||typeof o!="object"||"hconcat"in o||"vconcat"in o||"concat"in o||"layer"in o||(o.width=f)})),t.padding||(t.padding={}),L(t.padding.bottom)&&(t.padding.bottom=Se),t.datasets)throw new Error("Datasets should not be passed as part of the spec");return u.length>0&&ye(t),t},we=(n,e,s,r,u)=>{const l=$(),{id:f,formId:p,spec:t,data:o,datasets:c,vegaLiteTheme:d,selectionMode:i}=n,h=a.useMemo(()=>i,[JSON.stringify(i)]),S=a.useMemo(()=>be(t,r,u,d,h,l,e,s),[t,r,u,d,h,l,e,s]);return{id:f,formId:p,vegaLiteTheme:d,spec:S,selectionMode:h,data:o,datasets:c,useContainerWidth:r}},Ce={DATAFRAME_INDEX:"(index)"};function Ee(n){return!n||n.dimensions.numDataRows===0?null:F(n)}function Ne(n){const e=I(n);if(L(e))return null;const s={};for(const[r,u]of Object.entries(e))s[r]=F(u);return s}function I(n){if(n?.length===0)return null;const e={};return n.forEach(s=>{if(!s)return;const r=s.hasName?s.name:null;e[r]=s.data}),e}function F(n,e=0){if(n.dimensions.numDataRows===0)return[];const s=[],{numDataRows:r,numDataColumns:u,numIndexColumns:l}=n.dimensions,f=n.columnTypes[0]??void 0,p=f?.type===Q.INDEX&&(K(f)||j(f)||z(f));for(let t=e;t<r;t++){const o={};if(p){const{content:c}=n.getCell(t,0);o[Ce.DATAFRAME_INDEX]=typeof c=="bigint"?Number(c):c}for(let c=0;c<u;c++){const d=c+l,{content:i,contentType:h}=n.getCell(t,d);if((i instanceof Date||typeof i=="number"&&Number.isFinite(i))&&(j(h)||z(h))&&!Y(h)){const S=new Date(i).getTimezoneOffset()*60*1e3;o[n.columnNames[0][d]]=i.valueOf()+S}else o[n.columnNames[0][d]]=typeof i=="bigint"?Number(i):i}s.push(o)}return s}const De=150,Ve=P.getLogger("useVegaLiteSelections"),Oe=(n,e,s)=>{const{id:r,formId:u,selectionMode:l}=n,f=a.useCallback(t=>{l.forEach(c=>{t.addSignalListener(c,Z(De,(d,i)=>{const h=t.getState({data:(E,v)=>l.some(g=>`${g}_store`===E),recurse:!1});k(h)&&e.setElementState(r,"viewState",h);let S=i;"vlPoint"in i&&"or"in i.vlPoint&&(S=i.vlPoint.or);const V={id:r,formId:u},N=JSON.parse(e.getStringValue(V)||"{}"),D={selection:{...N?.selection||{},[d]:S||{}}};M(N,D)||e.setStringValue(V,JSON.stringify(D),{fromUi:!0},s)}))});const o=e.getElementState(r,"viewState");if(k(o))try{return t.setState(o)}catch(c){Ve.warn("Failed to restore view state",c)}return t},[r,l,e,u,s]),p=a.useCallback(()=>{const t={selection:{}};l.forEach(i=>{t.selection[i]={}});const o={id:r,formId:u},c=e.getStringValue(o),d=c?JSON.parse(c):t;M(d,t)||e.setStringValue(o,JSON.stringify(t),{fromUi:!0},s)},[r,u,s,l,e]);return{maybeConfigureSelections:f,onFormCleared:p}},W="source",Te=P.getLogger("useVegaEmbed");function ve(n,e,s){const r=a.useRef(null),u=a.useRef(null),l=a.useRef(W),f=a.useRef(null),p=a.useRef([]),t=a.useRef(null),o=a.useRef([]),[c,d]=a.useState(!1),{maybeConfigureSelections:i,onFormCleared:h}=Oe(n,e,s);he({widgetMgr:e,element:n,onFormCleared:h});const{data:S,datasets:V}=n;a.useEffect(()=>{t.current=S,o.current=V,r.current===null&&(f.current=S,p.current=V)},[S,V]);const N=a.useCallback(()=>{u.current&&u.current(),u.current=null,r.current=null},[]),D=a.useCallback(async(g,b)=>{if(g.current===null)throw new Error("Element missing.");d(!0);try{N();const w={ast:!0,expr:ue,tooltip:{disableDefaultStyle:!0},defaultStyle:!1,forceActionsMenu:!0},{vgSpec:y,view:R,finalize:T}=await fe(g.current,b,w);r.current=i(R),u.current=T;const m=Ne(o.current),C=m?Object.keys(m):[];if(C.length===1){const[x]=C;l.current=x}else C.length===0&&y.data&&(l.current=W);const O=Ee(t.current);if(O&&r.current.insert(l.current,O),m)for(const[x,G]of Object.entries(m))r.current.insert(x,G);return await r.current.runAsync(),await r.current.resize().runAsync(),f.current=t.current,p.current=o.current,r.current}finally{d(!1)}},[N,i]),E=a.useCallback((g,b,w,y)=>{if(!y||y.dimensions.numDataRows===0){try{g.remove(b,de)}catch{}return}if(!w||w.dimensions.numDataRows===0){g.insert(b,F(y));return}y.hash!==w.hash&&(g.data(b,F(y)),Te.info(`Had to clear the ${b} dataset before inserting data through Vega view.`))},[]),v=a.useCallback(async(g,b)=>{if(r.current===null||c)return null;const w=f.current,y=p.current;(w||g)&&E(r.current,l.current,w,g);const R=I(y)??{},T=I(b)??{};for(const[m,C]of Object.entries(T)){const O=m||l.current,x=R[O];E(r.current,O,x,C)}for(const m of Object.keys(R))!Object.hasOwn(T,m)&&m!==l.current&&E(r.current,m,null,null);return await r.current?.resize().runAsync(),f.current=g,p.current=b,r.current},[E,c]);return{createView:D,updateView:v,finalizeView:N}}function Re(n){try{const e=typeof n=="string"?JSON.parse(n):n;return!!(e.facet||e.encoding?.row||e.encoding?.column||e.encoding?.facet)}catch{return!1}}function Ae(n){try{const e=typeof n=="string"?JSON.parse(n):n;return!("vconcat"in e)||!Array.isArray(e.vconcat)?!1:e.vconcat.some(s=>s!==null&&typeof s=="object"&&("hconcat"in s||"vconcat"in s||"concat"in s||"layer"in s))}catch{return!1}}const xe=({disableFullscreenMode:n,element:e,fragmentId:s,widgetMgr:r,widthConfig:u,heightConfig:l})=>{const[f,p]=a.useState(!1),[t,o]=a.useState(!1),{expanded:c,height:d,width:i,expand:h,collapse:S}=q(ae),{width:V,height:N,elementRef:D}=ee([f],0),E=te(u)||e.useContainerWidth,v=ne(l),g=Re(e.spec),b=Ae(e.spec),w=we(e,g?i??0:V,(c?d:N)??0,c&&!b?!0:E,c?!0:v),{createView:y,updateView:R,finalizeView:T}=ve(w,r,s),{data:m,datasets:C,spec:O}=w;return a.useLayoutEffect(()=>(D.current!==null&&y(D,O),T),[y,T,O,i,d,f,D]),a.useEffect(()=>{R(m,C)},[m,C]),a.useEffect(()=>{m||C?.[0]?.data?o(!0):o(!1)},[m,C]),f?A(ie,{data:m??C[0]?.data,height:d??N??void 0,width:u??void 0,customToolbarActions:[A(_,{label:"Show chart",icon:U,onClick:()=>{p(!1)}},"show-chart")]}):re(H,{height:v?c?d:"100%":d,useContainerWidth:c?!0:E,children:[A(ce,{target:H,isFullScreen:c,onExpand:h,onCollapse:S,disableFullscreenMode:n,children:t&&A(_,{label:"Show data",icon:ge,onClick:()=>{p(!0)}})}),A(se,{styles:[me]}),A(pe,{"data-testid":"stVegaLiteChart",className:"stVegaLiteChart",useContainerWidth:E,useContainerHeight:v,ref:D})]})},Fe=oe(xe),st=a.memo(Fe);export{me as StyledVegaLiteChartTooltips,J as applyStreamlitTheme,st as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r,E as b,_ as E,W as te,F as h,ai as xt,m as ee,cs as x,ct as zt,o as S,j as a,P as Vt,ay as V,az as Rt,a0 as P,b as re,B as oe,Z as At,bW as ne,l as ae,k as ie,b7 as le,cu as se,e as J,bR as bt,bS as ce}from"./index.DkSjHoXw.js";import{I as de,g as Et,F as X,E as Dt,b as ue,s as pe,u as ge,a as he}from"./FileHelper.EpMV5UVe.js";import{u as fe}from"./useWaveformController.DlE14M1X.js";import{I as we}from"./InputInstructions.CMvqhPhy.js";import{u as me,T as St}from"./useTextInputAutoExpand.DmyHLDxl.js";import{i as ve}from"./inputUtils.CptNuJwn.js";import{T as Ce}from"./TableChart.esm.nZsTq1Sb.js";import{E as ye}from"./ErrorOutline.esm.j3b3OjAK.js";import{U as Mt}from"./UploadFileInfo.Dr-zDST7.js";import"./base-input.DKTA2QNz.js";var kt=r.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(b,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),r.createElement("rect",{width:24,height:24,fill:"none"}),r.createElement("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"}),r.createElement("path",{d:"M14 17H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z"}))});kt.displayName="Article";var Ft=r.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(b,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"}))});Ft.displayName="Code";var Ut=r.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(b,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z"}))});Ut.displayName="Description";var Ht=r.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(b,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M9.17 6l2 2H20v10H4V6h5.17M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"}))});Ht.displayName="Folder";var Tt=r.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(b,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4.86 8.86l-3 3.87L9 13.14 6 17h12l-3.86-5.14z"}))});Tt.displayName="Image";var Bt=r.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(b,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M12 3l.01 10.55c-.59-.34-1.27-.55-2-.55a4.001 4.001 0 100 8c2.22 0 3.99-1.79 3.99-4V7h4V3h-6zm-1.99 16c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"}))});Bt.displayName="MusicNote";var Nt=r.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(b,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M15 8v8H5V8h10m1-2H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11l-4 4V7c0-.55-.45-1-1-1z"}))});Nt.displayName="Videocam";var Lt=r.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(b,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),r.createElement("rect",{width:24,height:24,fill:"none"}),r.createElement("path",{d:"M18 13h-5v5c0 .55-.45 1-1 1s-1-.45-1-1v-5H6c-.55 0-1-.45-1-1s.45-1 1-1h5V6c0-.55.45-1 1-1s1 .45 1 1v5h5c.55 0 1 .45 1 1s-.45 1-1 1z"}))});Lt.displayName="Add";var et=r.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(b,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M13 19V7.83l4.88 4.88c.39.39 1.03.39 1.42 0a.996.996 0 000-1.41l-6.59-6.59a.996.996 0 00-1.41 0l-6.6 6.58a.996.996 0 101.41 1.41L11 7.83V19c0 .55.45 1 1 1s1-.45 1-1z"}))});et.displayName="ArrowUpward";var Pt=r.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(b,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm4.29 12.89a.996.996 0 11-1.41 1.41L12 13.41 9.11 16.3a.996.996 0 11-1.41-1.41L10.59 12 7.71 9.11A.996.996 0 119.12 7.7L12 10.59l2.89-2.89a.996.996 0 111.41 1.41L13.41 12l2.88 2.89z"}))});Pt.displayName="Cancel";var Wt=r.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(b,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M18 6.7l-8.48 8.48-3.54-3.54a.996.996 0 10-1.41 1.41l4.24 4.24c.39.39 1.02.39 1.41 0l9.18-9.18a.999.999 0 00-.01-1.42c-.37-.38-1-.38-1.39.01z"}))});Wt.displayName="Check";var Ot=r.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(b,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M18.3 5.71a.996.996 0 00-1.41 0L12 10.59 7.11 5.7A.996.996 0 105.7 7.11L10.59 12 5.7 16.89a.996.996 0 101.41 1.41L12 13.41l4.89 4.89a.996.996 0 101.41-1.41L13.41 12l4.89-4.89c.38-.38.38-1.02 0-1.4z"}))});Ot.displayName="Close";var $t=r.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(b,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),r.createElement("rect",{width:24,height:24,fill:"none"}),r.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 11c-.55 0-1-.45-1-1V8c0-.55.45-1 1-1s1 .45 1 1v4c0 .55-.45 1-1 1zm0 4c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1z"}))});$t.displayName="ErrorOutline";var Xt=r.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(b,E({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),r.createElement("rect",{width:24,height:24,fill:"none"}),r.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"}),r.createElement("path",{d:"M17.91 11c-.49 0-.9.36-.98.85C16.52 14.21 14.47 16 12 16s-4.52-1.79-4.93-4.15a.998.998 0 00-.98-.85c-.61 0-1.09.54-1 1.14.49 3 2.89 5.34 5.91 5.78V20c0 .55.45 1 1 1s1-.45 1-1v-2.08c3.02-.44 5.42-2.78 5.91-5.78.1-.6-.39-1.14-1-1.14z"}))});Xt.displayName="Mic";const $=te.getLogger("ChatInput"),xe=h("div",{target:"e15qancx0"})({position:"relative",display:"flex",flexDirection:"column"}),be=h("div",{target:"e15qancx1"})(({theme:t})=>({backgroundColor:t.colors.secondaryBg,border:`${t.sizes.borderWidth} solid`,borderColor:t.colors.widgetBorderColor??t.colors.transparent,position:"relative",display:"flex",flexDirection:"column",alignItems:"stretch",flex:1,padding:t.spacing.lg,borderRadius:t.radii.default,boxSizing:"border-box",":focus-within":{borderColor:t.colors.primary}})),Ee=h("div",{target:"e15qancx2"})(({theme:t})=>({position:"relative",display:"flex",flexDirection:"column",gap:t.spacing.sm})),Se=h("div",{target:"e15qancx3"})({position:"relative",display:"flex",flexDirection:"column"}),Ie=h("div",{target:"e15qancx4"})(({theme:t})=>({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",gap:t.spacing.sm})),ze=h("div",{target:"e15qancx5"})(({theme:t})=>({display:"flex",flexDirection:"row",alignItems:"flex-end",width:"100%",marginTop:"auto",gap:t.spacing.lg})),Ve=h("div",{target:"e15qancx6"})(({theme:t})=>({display:"flex",flexDirection:"row",flex:"1 0 0",gap:t.spacing.sm,alignItems:"center"})),Re=h("div",{target:"e15qancx7"})(({theme:t})=>({display:"flex",flexDirection:"row",gap:t.spacing.sm,alignItems:"center",position:"relative"})),Ae=h("div",{target:"e15qancx8"})(({theme:t})=>({position:"absolute",top:t.spacing.twoXS,right:t.spacing.lg,color:t.colors.fadedText60,fontSize:t.fontSizes.twoSm,textAlign:"right",whiteSpace:"nowrap",pointerEvents:"auto",cursor:"text",zIndex:t.zIndices.priority,"& .stChatInputInstructions":{position:"static"}})),U=h("button",{target:"e15qancx9"})(({theme:t,disabled:e,hasError:o,primary:s,withVerticalOffset:d})=>{if(s)return{border:"none",backgroundColor:e?t.colors.darkenedBgMix15:t.colors.primary,borderRadius:t.radii.button,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:t.lineHeights.none,margin:t.spacing.none,marginBottom:d?t.sizes.chatInputButtonVerticalOffset:void 0,padding:t.spacing.xs,width:t.sizes.chatInputPrimaryButtonSize,height:t.sizes.chatInputPrimaryButtonSize,color:e?t.colors.fadedText40:t.colors.white,cursor:e?"not-allowed":"pointer",transition:"background-color 200ms ease","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{boxShadow:xt(t)},"&:hover":{backgroundColor:e?t.colors.darkenedBgMix15:t.colors.primary}};const f=ee(t),[c,v]=f?[t.colors.gray60,t.colors.gray80]:[t.colors.gray80,t.colors.gray40],C=()=>o?t.colors.redTextColor:e?c:v;return{border:"none",backgroundColor:t.colors.transparent,borderRadius:t.radii.default,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:t.lineHeights.none,margin:t.spacing.none,padding:t.spacing.none,color:C(),pointerEvents:"auto","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{backgroundColor:f?t.colors.gray10:t.colors.gray90,boxShadow:xt(t)},"&:hover":{color:o?t.colors.red70:t.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{backgroundColor:t.colors.transparent,borderColor:t.colors.transparent,color:t.colors.gray60,cursor:"not-allowed"},"& svg":{width:t.iconSizes.lg,height:t.iconSizes.lg}}}),De=h("div",{target:"e15qancx10"})(({isRecording:t})=>({display:t?"flex":"none",flex:1,alignItems:"center",minWidth:0})),Me=h("div",{target:"e15qancx11"})(({theme:t})=>({position:"relative",width:"100%",minHeight:t.sizes.minElementHeight,borderRadius:t.radii.default,overflow:"hidden","& > div":{position:"absolute",inset:0}})),jt=(t,e)=>e===x.Directory?{...t,webkitdirectory:"",multiple:!0}:t,ke=(t,e)=>{if(!e||e.length===0)return!0;const o=t.name.toLowerCase(),s=o.lastIndexOf(".");if(s===-1||s===o.length-1)return e.some(c=>c===""||c===".");const d=o.substring(s),f=o.substring(s+1);return e.some(c=>{const v=c.toLowerCase();return v.startsWith(".")?d===v:f===v})},Fe=(t,e)=>ke(t,e)?{isValid:!0}:{isValid:!1,errorMessage:`${t.type||"This type of"} files are not allowed.`},rt=t=>{switch(t){case x.None:return"a file";case x.Single:return"a file";case x.Multiple:return"files";case x.Directory:return"a directory";default:return zt(t),"a file"}},Ue=h("div",{target:"e1w5pa0h0"})(({theme:t})=>({backgroundColor:t.colors.transparent,position:"absolute",inset:0,zIndex:t.zIndices.priority,borderRadius:t.radii.chatInput})),He=h("div",{target:"e1w5pa0h1"})(({theme:t})=>({position:"absolute",inset:0,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",fontWeight:t.fontWeights.bold,pointerEvents:"none",zIndex:t.zIndices.priority})),Te=h("div",{target:"e1w5pa0h2"})(({disabled:t})=>({pointerEvents:t?"none":"auto"})),Be=h("div",{target:"e1w5pa0h3"})(({theme:t})=>({lineHeight:t.lineHeights.tight})),Ne=h("div",{target:"e1w5pa0h4"})(({theme:t})=>({display:"flex",flexWrap:"wrap",gap:t.spacing.sm})),Le=h("div",{target:"e1w5pa0h5"})({flex:"0 0 auto",maxWidth:"100%"}),Pe=h("div",{target:"e1w5pa0h6"})(({theme:t,isError:e,isClickable:o})=>({position:"relative",display:"inline-flex",alignItems:"center",width:"fit-content",minWidth:"9rem",maxWidth:"100%",backgroundColor:e?t.colors.redBackgroundColor:t.colors.bgColor,padding:t.spacing.twoXS,paddingRight:t.spacing.twoXL,borderRadius:t.radii.default,gap:t.spacing.sm,cursor:o?"pointer":"default"})),We=h("div",{target:"e1w5pa0h7"})({display:"flex",flexDirection:"column",minWidth:0}),Oe=h("div",{target:"e1w5pa0h8"})(({theme:t,fileStatus:e})=>({display:"flex",alignItems:"center",justifyContent:"center",borderRadius:t.radii.default,width:t.sizes.chatInputFileIconSize,height:t.sizes.chatInputFileIconSize,flexShrink:0,...e==="uploaded"&&{backgroundColor:t.colors.bodyText,color:t.colors.bgColor},...e==="uploading"&&{backgroundColor:t.colors.fadedText10,color:t.colors.fadedText60},...e==="error"&&{backgroundColor:t.colors.redBackgroundColor,color:t.colors.redTextColor}})),$e=h("div",{target:"e1w5pa0h9"})(({theme:t,fileStatus:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:e.type==="uploading"?t.colors.fadedText60:t.colors.bodyText})),Xe=h("div",{target:"e1w5pa0h10"})(({theme:t})=>({color:t.colors.fadedText60,fontSize:t.fontSizes.sm})),je=h("div",{target:"e1w5pa0h11"})(({theme:t})=>({color:t.colors.redTextColor,fontSize:t.fontSizes.sm})),qe=h("small",{target:"e1w5pa0h12"})(({theme:t})=>({position:"absolute",top:t.spacing.twoXS,right:t.spacing.twoXS,display:"flex",alignItems:"center",justifyContent:"center",lineHeight:0,"& button":{display:"flex",alignItems:"center",justifyContent:"center",width:"fit-content",height:"fit-content",minHeight:"unset",minWidth:"unset",maxHeight:"unset",maxWidth:"unset",borderRadius:"50%",backgroundColor:"transparent",color:t.colors.fadedText20,padding:0,overflow:"hidden",boxSizing:"border-box",lineHeight:0,"&:hover":{backgroundColor:"transparent",color:t.colors.fadedText40}}})),_e=({getRootProps:t,getInputProps:e,acceptFile:o,disabled:s})=>{const d=jt(e(),o),f=t({tabIndex:-1});return S(Te,{"data-testid":"stChatInputFileUploadButton",disabled:s,...f,children:[a("input",{...d}),a(Rt,{content:`Upload or drag and drop ${rt(o)}`,placement:Vt.TOP,onMouseEnterDelay:500,children:a(U,{disabled:s,"aria-label":`Upload ${rt(o)}`,children:a(V,{content:Lt,size:"xl",color:"inherit"})})})]})},Ke=r.memo(_e),Ge=({getRootProps:t,getInputProps:e,acceptFile:o})=>{const s=jt(e(),o);return S(P,{children:[a(Ue,{...t(),children:a("input",{...s})}),a(He,{children:`Drag and drop ${rt(o)} here`})]})},Ye=r.memo(Ge),Ze=new Set(["jpg","jpeg","png","gif","webp","svg","bmp"]),Je=new Set(["pdf"]),Qe=new Set(["csv","tsv","xlsx","xls"]),tr=new Set(["txt","md","json","xml","yaml","yml"]),er=new Set(["py","js","ts","jsx","tsx","css","html","java","cpp","c","go","rs","rb","php","swift","kt","scala","sh","bash","sql"]),rr=new Set(["mp3","wav","m4a","ogg","flac","aac"]),or=new Set(["mp4","webm","mov","avi","mkv","wmv"]),nr=new Set(["zip","tar","gz","rar","7z","bz2"]);function ar(t){const e=t.lastIndexOf(".");return e===-1||e===t.length-1?"":t.slice(e+1).toLowerCase()}function ir(t){const e=ar(t);return Ze.has(e)?Tt:Je.has(e)?kt:Qe.has(e)?Ce:tr.has(e)?Ut:er.has(e)?Ft:rr.has(e)?Bt:or.has(e)?Nt:nr.has(e)?Ht:de}const lr=36;function sr(t,e=lr){if(t.length<=e)return t;const o=t.lastIndexOf(".");if(!(o>0&&o<t.length-1)){const p=Math.floor((e-3)/2),w=p>0?t.slice(-p):"";return`${t.slice(0,p)}...${w}`}const d=t.slice(o),f=t.slice(0,o),c=e-d.length-3;if(c<=0){const p=Math.floor((e-3)/2),w=p>0?t.slice(-p):"";return`${t.slice(0,p)}...${w}`}const v=Math.ceil(c/2),C=Math.floor(c/2),m=C>0?f.slice(-C):"";return`${f.slice(0,v)}...${m}${d}`}const cr=({fileInfo:t})=>{const{type:e}=t.status;switch(e){case"uploading":return a(At,{iconValue:"spinner",testid:"stChatInputFileIconSpinner",size:"lg"});case"error":return a(V,{content:ye,size:"lg",testid:"stChatInputFileIconError"});case"uploaded":return a(V,{content:ir(t.name),size:"lg"});default:return zt(e),null}},dr=({fileInfo:t,onDelete:e,onRetry:o})=>{const s=t.status.type,d=s==="error",f=s==="uploading",c=d&&o!==void 0&&t.file!==void 0,v=t.status.type==="error"?t.status.errorMessage:"Upload failed",C=r.useCallback(()=>{c&&o(t)},[c,o,t]),m=r.useCallback(R=>{c&&(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),o(t))},[c,o,t]),p=r.useCallback(R=>{R.stopPropagation(),e(t.id)},[e,t.id]),w=f?`Cancel upload of ${t.name}`:`Remove ${t.name}`,g=Et(t.size,X.Byte),y=d?`${t.name}, ${v}`:`${t.name}, ${g}`;return S(Pe,{className:"stChatInputFile","data-testid":"stChatInputFile",isError:d,isClickable:c,onClick:c?C:void 0,onKeyDown:c?m:void 0,title:c?"Click to retry upload":void 0,role:c?"button":void 0,tabIndex:c?0:void 0,"aria-label":y,children:[a(Oe,{fileStatus:s,children:a(cr,{fileInfo:t})}),S(We,{children:[a($e,{className:"stChatInputFileName","data-testid":"stChatInputFileName",title:t.name,fileStatus:t.status,children:sr(t.name)}),d?a(je,{"data-testid":"stChatInputFileError",children:v}):a(Xe,{children:Et(t.size,X.Byte)})]}),a(qe,{"data-testid":"stChatInputDeleteBtn",children:a(re,{onClick:p,kind:oe.MINIMAL,"aria-label":w,children:a(V,{content:Pt,size:"md"})})})]})},ur=r.memo(dr),pr=({items:t,onDelete:e,onRetry:o})=>a(Be,{"data-testid":"stChatUploadedFiles",children:a(Ne,{children:t.map(s=>a(Le,{children:a(ur,{fileInfo:s,onDelete:e,onRetry:o})},s.id))})}),gr=r.memo(pr),hr=(t,e)=>{const o=[],s=[];return t.forEach(d=>{const f=Fe(d,e.fileType);f.isValid?o.push(d):s.push({file:d,errors:[{code:Dt.FileInvalidType,message:f.errorMessage||"File type not allowed."}]})}),{accepted:o,rejected:s}},fr=({acceptMultipleFiles:t,acceptDirectoryFiles:e,maxFileSize:o,uploadClient:s,uploadFile:d,addFiles:f,getNextLocalFileId:c,deleteExistingFiles:v,onUploadComplete:C,element:m})=>(p,w)=>{if(e&&p.length>0){const{accepted:g,rejected:y}=hr(p,m);p=g,w=[...w,...y]}if(!t&&p.length===0&&w.length>1){const g=w.findIndex(y=>y.errors?.[0].code===Dt.TooManyFiles);g>=0&&(p.push(w[g].file),w.splice(g,1))}if(!t&&p.length>0&&v(),s.fetchFileURLs(p).then(g=>{ne(g,p).forEach(([y,R])=>{d(y,R)})}).catch(g=>{f(p.map(y=>new Mt(y.name,y.size,c(),{type:"error",errorMessage:g},y)))}),w.length>0){const g=w.map(y=>ue(y,c(),o));f(g)}C()},wr=({getNextLocalFileId:t,addFiles:e,updateFile:o,uploadClient:s,element:d,onUploadProgress:f,onUploadComplete:c})=>(v,C)=>{const m=C.webkitRelativePath||C.name,p=new AbortController,w=new Mt(m,C.size,t(),{type:"uploading",abortController:p,progress:1},C);e([w]),s.uploadFile({formId:"",...d},v.uploadUrl,C,g=>f(g,w.id),p.signal).then(()=>c(w.id,v)).catch(g=>{g instanceof DOMException&&g.name==="AbortError"||o(w.id,w.setStatus({type:"error",errorMessage:g?g.toString():"Unknown error"}))})};function It(t,e,o){return{Root:{style:{minHeight:t.sizes.chatInputTextareaMinHeight,outline:"none",borderLeftWidth:"0",borderRightWidth:"0",borderTopWidth:"0",borderBottomWidth:"0",borderTopLeftRadius:"0",borderTopRightRadius:"0",borderBottomRightRadius:"0",borderBottomLeftRadius:"0",...o}},Input:{props:{"data-testid":"stChatInputTextArea"},style:{fontWeight:t.fontWeights.normal,lineHeight:t.lineHeights.inputWidget,"::placeholder":{color:t.colors.fadedText60},height:e.height,maxHeight:e.maxHeight,overflowY:"auto",paddingLeft:t.spacing.none,paddingRight:t.spacing.none,paddingBottom:t.spacing.sm,paddingTop:t.spacing.sm,width:"100%"}}}}const Q=(t,e,o)=>o.map(s=>s.id===t?e:s),tt=(t,e)=>e.find(o=>o.id===t);function mr({disabled:t,element:e,widgetMgr:o,fragmentId:s,uploadClient:d}){const f=ae(),{placeholder:c,maxChars:v}=e,C=r.useRef(0),m=r.useRef(null),p=r.useRef(!1),w=r.useRef(null),g=r.useRef(null),{width:y,elementRef:R}=ie(),{innerWidth:ot,innerHeight:nt}=le(),[M,j]=r.useState(e.default),[D,k]=r.useState([]),[T,q]=r.useState(!1),[B,at]=r.useState(!1),[_,N]=r.useState(null),W=e.acceptAudio??!1;r.useEffect(()=>()=>{g.current&&g.current.abort()},[]);const H=me({textareaRef:m,dependencies:[c]}),L=r.useMemo(()=>D.some(n=>n.status.type==="uploading")?!1:M!==""||D.length>0,[D,M]),I=se(e.acceptFile),it=pe(e.maxUploadSizeMb,X.Megabyte,X.Byte),lt=r.useCallback(n=>k(l=>[...l,...n]),[]),st=r.useCallback(n=>{n.status.type==="uploading"&&n.status.abortController.abort(),n.status.type==="uploaded"&&n.status.fileUrls.deleteUrl&&d.deleteFile(n.status.fileUrls.deleteUrl).catch(l=>{$.error("Failed to delete file from server:",l)})},[d]),ct=r.useCallback(n=>{k(l=>{const u=tt(n,l);return J(u)?l:(st(u),l.filter(i=>i.id!==n))})},[st]),K=r.useRef(null),qt=r.useCallback(n=>{!n.file||n.status.type!=="error"||(k(l=>l.filter(u=>u.id!==n.id)),K.current&&K.current([n.file],[]))},[]),dt=r.useCallback(()=>{const n=D.filter(l=>l.status.type==="uploaded").map(l=>{const{name:u,size:i,status:z}=l,{fileId:Z,fileUrls:Qt}=z;return new bt({fileId:Z,fileUrls:Qt,name:u,size:i})});return new ce({uploadedFileInfo:n})},[D]),ut=()=>C.current++,pt=fr({acceptMultipleFiles:I===x.Multiple||I===x.Directory,acceptDirectoryFiles:I===x.Directory,maxFileSize:it,uploadClient:d,uploadFile:wr({getNextLocalFileId:ut,addFiles:lt,updateFile:(n,l)=>{k(u=>Q(n,l,u))},uploadClient:d,element:e,onUploadProgress:(n,l)=>{k(u=>{const i=tt(l,u);if(J(i)||i.status.type!=="uploading")return u;const z=Math.round(n.loaded*100/n.total);return i.status.progress===z?u:Q(l,i.setStatus({type:"uploading",abortController:i.status.abortController,progress:z}),u)})},onUploadComplete:(n,l)=>{k(u=>{const i=tt(n,u);return J(i)||i.status.type!=="uploading"?u:Q(i.id,i.setStatus({type:"uploaded",fileId:l.fileId,fileUrls:l}),u)})}}),addFiles:lt,getNextLocalFileId:ut,deleteExistingFiles:()=>D.forEach(n=>ct(n.id)),onUploadComplete:()=>{m.current&&m.current.focus()},element:e});K.current=pt;const{getRootProps:gt,getInputProps:ht}=ge({onDrop:pt,multiple:I===x.Multiple||I===x.Directory,accept:he(e.fileType),maxSize:it}),O=r.useCallback(n=>{if(m.current&&m.current.focus(),!L&&!n||t)return;const l=dt(),u={data:M,fileUploaderState:l,audioFileInfo:n};o.setChatInputValue(e,u,{fromUi:!0},s),k([]),j(""),H.clearScrollHeight()},[L,t,M,dt,o,e,s,H]),ft=r.useCallback(async n=>{const l=new Date().toISOString().replace(/[:.]/g,"-"),u=new File([n],`audio-${l}.wav`,{type:"audio/wav"});try{at(!0);const i=await d.fetchFileURLs([u]);if(i.length===0)throw new Error("Failed to get upload URL for audio file");const z=i[0];g.current=new AbortController,await d.uploadFile({formId:"",...e},z.uploadUrl,u,()=>{},g.current.signal);const Z=new bt({fileId:z.fileId,fileUrls:z,name:u.name,size:u.size});O(Z)}catch(i){const z="Recording failed";$.error("Audio upload failed:",i),N(z),m.current&&m.current.focus()}finally{at(!1)}},[d,e,O]),_t=r.useMemo(()=>({onApprove:ft,onPermissionDenied:()=>{const n="Microphone access denied";N(n),$.error("Permission denied:",n)},onError:n=>{N("Recording failed"),$.error("Recording error:",n)},onRecordStart:()=>{N(null)}}),[ft]),A=fe({containerRef:w,sampleRate:e.audioSampleRate??void 0,events:_t}),G=r.useCallback(()=>{O()},[O]),wt=n=>{const{metaKey:l,ctrlKey:u,shiftKey:i}=n;ve(n)&&!i&&!u&&!l&&(n.preventDefault(),G())},mt=n=>{const{value:l}=n.target;v!==0&&l.length>v||(j(l),H.updateScrollHeight(),_&&N(null))},vt=r.useCallback(async n=>{n.preventDefault(),n.stopPropagation(),!(!W||t||A.state==="recording")&&await A.start()},[W,t,A]),Kt=r.useCallback(()=>{A.cancel(),m.current&&m.current.focus()},[A]),Ct=r.useCallback(async()=>{const{blob:n}=await A.stop();await A.approve(n)},[A]),yt=r.useCallback(n=>{vt(n)},[vt]),Gt=r.useCallback(()=>{Ct()},[Ct]),Yt=r.useCallback(()=>{m.current&&m.current.focus()},[]);r.useEffect(()=>{if(e.setValue&&!p.current){p.current=!0;const n=e.value||"";j(n)}},[e.setValue,e.value]),r.useEffect(()=>{p.current=!1},[e]),r.useEffect(()=>{const n=i=>{i.preventDefault(),i.stopPropagation(),!T&&i.dataTransfer?.types.includes("Files")&&q(!0)},l=i=>{i.preventDefault(),i.stopPropagation(),T&&(i.clientX<=0&&i.clientY<=0||i.clientX>=ot&&i.clientY>=nt)&&q(!1)},u=i=>{i.preventDefault(),i.stopPropagation(),T&&q(!1)};return window.addEventListener("dragover",n),window.addEventListener("drop",u),window.addEventListener("dragleave",l),()=>{window.removeEventListener("dragover",n),window.removeEventListener("drop",u),window.removeEventListener("dragleave",l)}},[T,ot,nt]);const Zt=I!==x.None&&T,F=A.state==="recording",Jt=I===x.None&&!W&&!F,Y=!F&&y>f.breakpoints.hideWidgetDetails&&v>0;return a(xe,{className:"stChatInput","data-testid":"stChatInput",ref:R,children:S(be,{extended:H.isExtended||F,children:[Y&&a(Ae,{onClick:Yt,id:"stChatInputInstructions",children:a(we,{dirty:L,value:M,maxLength:v,type:"chat",inForm:!1,className:"stChatInputInstructions"})}),Jt?S(ze,{children:[a(St,{inputRef:m,value:M,placeholder:c,onChange:mt,onKeyDown:wt,"aria-label":c,disabled:t,rows:1,"aria-describedby":Y?"stChatInputInstructions":void 0,overrides:It(f,H,{flex:1})}),a(U,{onClick:G,disabled:!L||t,"data-testid":"stChatInputSubmitButton","aria-label":"Send message",primary:!0,withVerticalOffset:!0,children:a(V,{content:et,size:"lg",color:"inherit"})})]}):S(P,{children:[S(Ee,{children:[Zt&&a(Ye,{getRootProps:gt,getInputProps:ht,acceptFile:I}),I!==x.None&&D.length>0&&a(gr,{items:[...D],onDelete:ct,onRetry:qt}),S(Se,{children:[a(De,{isRecording:F,children:a(Me,{ref:w})}),!F&&a(St,{inputRef:m,value:M,placeholder:c,onChange:mt,onKeyDown:wt,"aria-label":c,disabled:t,rows:1,"aria-describedby":Y?"stChatInputInstructions":void 0,overrides:It(f,H,{width:"100%"})})]})]}),S(Ie,{children:[a(Ve,{children:I!==x.None&&!F&&a(Ke,{getRootProps:gt,getInputProps:ht,acceptFile:I,disabled:t})}),a(Re,{children:F?S(P,{children:[a(U,{onClick:Kt,disabled:t,"data-testid":"stChatInputCancelButton","aria-label":"Cancel recording",children:a(V,{content:Ot,size:"lg",color:"inherit"})}),a(U,{onClick:Gt,disabled:t||B,"data-testid":"stChatInputApproveButton","aria-label":"Submit recording",children:B?a(At,{size:"lg",iconValue:"spinner"}):a(V,{content:Wt,size:"lg",color:"inherit"})})]}):S(P,{children:[W&&a(P,{children:_?a(Rt,{content:_,placement:Vt.TOP,error:!0,children:a(U,{onClick:yt,disabled:t||B,hasError:!0,"data-testid":"stChatInputMicButton","aria-label":"Start recording",children:a(V,{content:$t,size:"xl",color:"inherit"})})}):a(U,{onClick:yt,disabled:t||B,"data-testid":"stChatInputMicButton","aria-label":"Start recording",children:a(V,{content:Xt,size:"xl",color:"inherit"})})}),a(U,{onClick:G,disabled:!L||t||B,"data-testid":"stChatInputSubmitButton","aria-label":"Send message",primary:!0,children:a(V,{content:et,size:"lg",color:"inherit"})})]})})]})]})]})})}const Rr=r.memo(mr);export{Rr as default};
|