streamlit-nightly 1.45.1.dev20250510__py3-none-any.whl → 1.45.2.dev20250512__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.
Files changed (126) hide show
  1. streamlit/commands/experimental_query_params.py +1 -1
  2. streamlit/commands/navigation.py +1 -4
  3. streamlit/commands/page_config.py +6 -26
  4. streamlit/config.py +9 -11
  5. streamlit/config_util.py +1 -1
  6. streamlit/connections/sql_connection.py +1 -1
  7. streamlit/dataframe_util.py +50 -51
  8. streamlit/elements/arrow.py +1 -1
  9. streamlit/elements/deck_gl_json_chart.py +1 -4
  10. streamlit/elements/doc_string.py +1 -4
  11. streamlit/elements/exception.py +5 -7
  12. streamlit/elements/layouts.py +4 -3
  13. streamlit/elements/lib/built_in_chart_utils.py +9 -14
  14. streamlit/elements/lib/pandas_styler_utils.py +6 -8
  15. streamlit/elements/map.py +2 -8
  16. streamlit/elements/markdown.py +1 -4
  17. streamlit/elements/media.py +50 -2
  18. streamlit/elements/metric.py +9 -10
  19. streamlit/elements/widgets/audio_input.py +1 -4
  20. streamlit/elements/widgets/camera_input.py +1 -4
  21. streamlit/elements/widgets/chat.py +52 -5
  22. streamlit/elements/widgets/data_editor.py +1 -1
  23. streamlit/elements/widgets/slider.py +3 -4
  24. streamlit/elements/widgets/time_widgets.py +1 -4
  25. streamlit/env_util.py +2 -7
  26. streamlit/errors.py +1 -14
  27. streamlit/logger.py +4 -5
  28. streamlit/proto/Audio_pb2.py +4 -3
  29. streamlit/proto/Audio_pb2.pyi +8 -1
  30. streamlit/proto/Block_pb2.py +5 -5
  31. streamlit/proto/Block_pb2.pyi +7 -1
  32. streamlit/proto/ChatInput_pb2.py +8 -7
  33. streamlit/proto/ChatInput_pb2.pyi +10 -1
  34. streamlit/proto/PageConfig_pb2.py +7 -7
  35. streamlit/proto/PageConfig_pb2.pyi +5 -1
  36. streamlit/proto/Video_pb2.py +8 -7
  37. streamlit/proto/Video_pb2.pyi +8 -1
  38. streamlit/runtime/app_session.py +1 -1
  39. streamlit/runtime/caching/hashing.py +8 -8
  40. streamlit/runtime/credentials.py +5 -4
  41. streamlit/runtime/memory_media_file_storage.py +5 -4
  42. streamlit/runtime/metrics_util.py +1 -1
  43. streamlit/runtime/scriptrunner/script_runner.py +1 -1
  44. streamlit/runtime/scriptrunner_utils/script_run_context.py +0 -15
  45. streamlit/runtime/state/query_params.py +2 -4
  46. streamlit/runtime/state/session_state.py +15 -15
  47. streamlit/static/index.html +1 -1
  48. streamlit/static/static/js/{ErrorOutline.esm.BewaDzzJ.js → ErrorOutline.esm.Cfhrjz42.js} +1 -1
  49. streamlit/static/static/js/{FileDownload.esm.D6ilL7v-.js → FileDownload.esm.BN5DkI-d.js} +1 -1
  50. streamlit/static/static/js/{FileHelper.q7erXtkb.js → FileHelper.BWWhRdUs.js} +1 -1
  51. streamlit/static/static/js/{FormClearHelper.Dd0v0IXt.js → FormClearHelper.CHPGUkGG.js} +1 -1
  52. streamlit/static/static/js/{Hooks.CchmJZGs.js → Hooks.DjxyUmgD.js} +1 -1
  53. streamlit/static/static/js/{InputInstructions.DI9h4PJ7.js → InputInstructions.Bkai2tFZ.js} +1 -1
  54. streamlit/static/static/js/{ProgressBar.DfcVR_JA.js → ProgressBar.DFiqS51i.js} +1 -1
  55. streamlit/static/static/js/{RenderInPortalIfExists.BAkT-LV5.js → RenderInPortalIfExists.DWTzV71R.js} +1 -1
  56. streamlit/static/static/js/{Toolbar.CNzefYiX.js → Toolbar.Dk2A3VxL.js} +1 -1
  57. streamlit/static/static/js/{base-input.BmA1ZV9Y.js → base-input.DfiT3r4p.js} +1 -1
  58. streamlit/static/static/js/{checkbox.mT4TKcAG.js → checkbox.DLXFjls2.js} +1 -1
  59. streamlit/static/static/js/{createSuper.Duo43uhY.js → createSuper.n2DV0o-4.js} +1 -1
  60. streamlit/static/static/js/{data-grid-overlay-editor.CY3l_gmP.js → data-grid-overlay-editor.v1LF25Ml.js} +1 -1
  61. streamlit/static/static/js/{downloader.CM5asV91.js → downloader.CI8EFE9Y.js} +1 -1
  62. streamlit/static/static/js/{es6.uiOeU51e.js → es6.CH6Tf3Uw.js} +2 -2
  63. streamlit/static/static/js/{iframeResizer.contentWindow.ClkMmI3q.js → iframeResizer.contentWindow.VCjyiSg6.js} +1 -1
  64. streamlit/static/static/js/{index.wiodyGjO.js → index.7XN_jSTW.js} +1 -1
  65. streamlit/static/static/js/{index.JA6OF_5t.js → index.9p279joF.js} +1 -1
  66. streamlit/static/static/js/{index.D56z-_rt.js → index.B-Q1qQil.js} +1 -1
  67. streamlit/static/static/js/{index.3d64wPzr.js → index.B1j5m20t.js} +1 -1
  68. streamlit/static/static/js/{index.BWubePhz.js → index.BEE4v1Vc.js} +1 -1
  69. streamlit/static/static/js/{index.C6tuB1Tp.js → index.BFEA8ufN.js} +1 -1
  70. streamlit/static/static/js/{index.BPK3aPVr.js → index.BROoC18J.js} +1 -1
  71. streamlit/static/static/js/{index.BnmoQ0mJ.js → index.BWVpiUBA.js} +1 -1
  72. streamlit/static/static/js/{index.DLO5_tVd.js → index.BgY_Js0s.js} +1 -1
  73. streamlit/static/static/js/{index.DAEzs_UL.js → index.C1P3O0oI.js} +1 -1
  74. streamlit/static/static/js/index.C1TEsRV0.js +779 -0
  75. streamlit/static/static/js/{index.DLyB6OQM.js → index.C9ORVZvA.js} +1 -1
  76. streamlit/static/static/js/{index.IqYlA3jn.js → index.CR4eM0Q3.js} +1 -1
  77. streamlit/static/static/js/{index.DeLPvnoy.js → index.CXpQxU0G.js} +1 -1
  78. streamlit/static/static/js/{index.Dhu_cVNQ.js → index.Cdsxte9t.js} +1 -1
  79. streamlit/static/static/js/{index.CB8SwV8L.js → index.CmsMgepL.js} +1 -1
  80. streamlit/static/static/js/{index.D6AKDy4z.js → index.D1An7GDs.js} +1 -1
  81. streamlit/static/static/js/{index.WlA_Ju7i.js → index.D1DxKfIm.js} +1 -1
  82. streamlit/static/static/js/{index.DNWXtL99.js → index.DKsDSPTo.js} +1 -1
  83. streamlit/static/static/js/{index.C1_voZpt.js → index.DMDjQhhk.js} +1 -1
  84. streamlit/static/static/js/{index.D9lEoddJ.js → index.DM_jnlWC.js} +1 -1
  85. streamlit/static/static/js/{index.Dj8nqcpI.js → index.DUU38l7N.js} +1 -1
  86. streamlit/static/static/js/{index.blwBIOHe.js → index.DXDmqevk.js} +1 -1
  87. streamlit/static/static/js/{index.DeeFVG0Y.js → index.D_Bv6KD1.js} +1 -1
  88. streamlit/static/static/js/{index.B2EfQ-qM.js → index.DcH46Eo2.js} +1 -1
  89. streamlit/static/static/js/{index.SW3uv22k.js → index.DgeyRl4J.js} +1 -1
  90. streamlit/static/static/js/{index.B6y8ns6u.js → index.DoM9A12Z.js} +1 -1
  91. streamlit/static/static/js/{index.BArkjssT.js → index.LqvX_Kr6.js} +1 -1
  92. streamlit/static/static/js/{index.CXmZFP__.js → index.Ovig-AMR.js} +62 -62
  93. streamlit/static/static/js/{index.BmBUBll0.js → index.SPkHHODG.js} +1 -1
  94. streamlit/static/static/js/{index.DbgE46VI.js → index.STF1QdPr.js} +1 -1
  95. streamlit/static/static/js/{index.B-oXGsp7.js → index.ZuW7Olhm.js} +1 -1
  96. streamlit/static/static/js/{index.CYAmxIg2.js → index.hFB9saa3.js} +1 -1
  97. streamlit/static/static/js/{index.D-zMZsin.js → index.jZkr87Ly.js} +1 -1
  98. streamlit/static/static/js/{index.B5wTpdet.js → index.nmbrjghZ.js} +1 -1
  99. streamlit/static/static/js/{index.1tDlzcmX.js → index.uN3TP5oq.js} +1 -1
  100. streamlit/static/static/js/{index.DpWg6flp.js → index.uhNJX5pn.js} +1 -1
  101. streamlit/static/static/js/{input.B3uNJm6d.js → input.BAfiLByr.js} +1 -1
  102. streamlit/static/static/js/{memory.BWtwV556.js → memory.CvD1KGKJ.js} +1 -1
  103. streamlit/static/static/js/{mergeWith.BeTmYGS_.js → mergeWith.Dy4BuY-h.js} +1 -1
  104. streamlit/static/static/js/{number-overlay-editor.MW9-6kFx.js → number-overlay-editor.Bl84FLfp.js} +1 -1
  105. streamlit/static/static/js/{possibleConstructorReturn.ZgHiGHSO.js → possibleConstructorReturn.gffiKeDQ.js} +1 -1
  106. streamlit/static/static/js/{sandbox.BZyTt4zT.js → sandbox.BXw8ya9t.js} +1 -1
  107. streamlit/static/static/js/{textarea.CgvEg9Xi.js → textarea.DNNNKi6n.js} +1 -1
  108. streamlit/static/static/js/{timepicker.CHPC9KOb.js → timepicker.CgHlrhoy.js} +1 -1
  109. streamlit/static/static/js/{toConsumableArray.6GvveewD.js → toConsumableArray.MtZ-3vir.js} +1 -1
  110. streamlit/static/static/js/{uniqueId.BV5h1uCx.js → uniqueId.CFcd6g0d.js} +1 -1
  111. streamlit/static/static/js/{useBasicWidgetState.DzE2MsN8.js → useBasicWidgetState.DadZUraL.js} +1 -1
  112. streamlit/static/static/js/{useOnInputChange.sGAnyCSU.js → useOnInputChange.V6d5TCFH.js} +1 -1
  113. streamlit/static/static/js/{withFullScreenWrapper.Bh08pTH8.js → withFullScreenWrapper.8qpius26.js} +1 -1
  114. streamlit/string_util.py +1 -4
  115. streamlit/testing/v1/element_tree.py +5 -4
  116. streamlit/testing/v1/local_script_runner.py +1 -4
  117. streamlit/type_util.py +2 -5
  118. streamlit/watcher/path_watcher.py +2 -5
  119. streamlit/watcher/polling_path_watcher.py +7 -6
  120. {streamlit_nightly-1.45.1.dev20250510.dist-info → streamlit_nightly-1.45.2.dev20250512.dist-info}/METADATA +1 -1
  121. {streamlit_nightly-1.45.1.dev20250510.dist-info → streamlit_nightly-1.45.2.dev20250512.dist-info}/RECORD +125 -125
  122. streamlit/static/static/js/index.PoIwzrI7.js +0 -779
  123. {streamlit_nightly-1.45.1.dev20250510.data → streamlit_nightly-1.45.2.dev20250512.data}/scripts/streamlit.cmd +0 -0
  124. {streamlit_nightly-1.45.1.dev20250510.dist-info → streamlit_nightly-1.45.2.dev20250512.dist-info}/WHEEL +0 -0
  125. {streamlit_nightly-1.45.1.dev20250510.dist-info → streamlit_nightly-1.45.2.dev20250512.dist-info}/entry_points.txt +0 -0
  126. {streamlit_nightly-1.45.1.dev20250510.dist-info → streamlit_nightly-1.45.2.dev20250512.dist-info}/top_level.txt +0 -0
@@ -1 +1 @@
1
- import{r as s,bd as U,z as k,cp as W,C as A,j as l,bo as L,bC as P,bp as B,b5 as D,bq as j}from"./index.PoIwzrI7.js";import{u as _}from"./uniqueId.BV5h1uCx.js";import{u as q,a as w,b as K}from"./useOnInputChange.sGAnyCSU.js";import{I as O}from"./InputInstructions.DI9h4PJ7.js";import{a as $}from"./useBasicWidgetState.DzE2MsN8.js";import{T as G}from"./textarea.CgvEg9Xi.js";import"./inputUtils.CQWz5UKz.js";import"./FormClearHelper.Dd0v0IXt.js";import"./base-input.BmA1ZV9Y.js";const x=(a,t)=>a.getStringValue(t)??t.default??null,N=a=>a.default??null,J=a=>a.value??null,Q=(a,t,o,u)=>{t.setStringValue(a,o.value,{fromUi:o.fromUi},u)},X=({disabled:a,element:t,widgetMgr:o,fragmentId:u})=>{var f;const h=s.useRef(_("text_area_")).current,[T,S]=U(),[r,n]=s.useState(!1),[C,b]=s.useState(!1),[i,d]=s.useState(()=>x(o,t)??null),I=s.useCallback(()=>{d(t.default??null),n(!0)},[t]),[y,c]=$({getStateFromWidgetMgr:x,getDefaultStateFromProto:N,getCurrStateFromProto:J,updateWidgetMgrState:Q,element:t,widgetMgr:o,fragmentId:u,onFormCleared:I});q(y,i,d,r);const e=k(),m=s.useCallback(()=>{n(!1),c({value:i,fromUi:!0})},[i,c]),V=s.useCallback(()=>{r&&m(),b(!1)},[r,m]),F=s.useCallback(()=>{b(!0)},[]),v=w({formId:t.formId,maxChars:t.maxChars,setDirty:n,setUiValue:d,setValueWithSource:c}),z=K(t.formId,m,r,o,u,!0),{height:g,placeholder:E,formId:p}=t,R=W({formId:p})?o.allowFormEnterToSubmit(p):r,H=C&&T>e.breakpoints.hideWidgetDetails;return A("div",{className:"stTextArea","data-testid":"stTextArea",ref:S,children:[l(j,{label:t.label,disabled:a,labelVisibility:L((f=t.labelVisibility)==null?void 0:f.value),htmlFor:h,children:t.help&&l(P,{children:l(B,{content:t.help,placement:D.TOP_RIGHT})})}),l(G,{value:i??"",placeholder:E,onBlur:V,onFocus:F,onChange:v,onKeyDown:z,"aria-label":t.label,disabled:a,id:h,overrides:{Input:{style:{lineHeight:e.lineHeights.inputWidget,height:g?`${g}px`:"",minHeight:e.sizes.largestElementHeight,resize:"vertical","::placeholder":{opacity:"0.7"},paddingRight:e.spacing.md,paddingLeft:e.spacing.md,paddingBottom:e.spacing.md,paddingTop:e.spacing.md}},Root:{props:{"data-testid":"stTextAreaRootElement"},style:{borderLeftWidth:e.sizes.borderWidth,borderRightWidth:e.sizes.borderWidth,borderTopWidth:e.sizes.borderWidth,borderBottomWidth:e.sizes.borderWidth}}}}),H&&l(O,{dirty:r,value:i??"",maxLength:t.maxChars,type:"multiline",inForm:W({formId:p}),allowEnterToSubmit:R})]})},it=s.memo(X);export{it as default};
1
+ import{r as s,bd as U,z as k,cp as W,C as A,j as l,bo as L,bC as P,bp as B,b5 as D,bq as j}from"./index.C1TEsRV0.js";import{u as _}from"./uniqueId.CFcd6g0d.js";import{u as q,a as w,b as K}from"./useOnInputChange.V6d5TCFH.js";import{I as O}from"./InputInstructions.Bkai2tFZ.js";import{a as $}from"./useBasicWidgetState.DadZUraL.js";import{T as G}from"./textarea.DNNNKi6n.js";import"./inputUtils.CQWz5UKz.js";import"./FormClearHelper.CHPGUkGG.js";import"./base-input.DfiT3r4p.js";const x=(a,t)=>a.getStringValue(t)??t.default??null,N=a=>a.default??null,J=a=>a.value??null,Q=(a,t,o,u)=>{t.setStringValue(a,o.value,{fromUi:o.fromUi},u)},X=({disabled:a,element:t,widgetMgr:o,fragmentId:u})=>{var f;const h=s.useRef(_("text_area_")).current,[T,S]=U(),[r,n]=s.useState(!1),[C,b]=s.useState(!1),[i,d]=s.useState(()=>x(o,t)??null),I=s.useCallback(()=>{d(t.default??null),n(!0)},[t]),[y,c]=$({getStateFromWidgetMgr:x,getDefaultStateFromProto:N,getCurrStateFromProto:J,updateWidgetMgrState:Q,element:t,widgetMgr:o,fragmentId:u,onFormCleared:I});q(y,i,d,r);const e=k(),m=s.useCallback(()=>{n(!1),c({value:i,fromUi:!0})},[i,c]),V=s.useCallback(()=>{r&&m(),b(!1)},[r,m]),F=s.useCallback(()=>{b(!0)},[]),v=w({formId:t.formId,maxChars:t.maxChars,setDirty:n,setUiValue:d,setValueWithSource:c}),z=K(t.formId,m,r,o,u,!0),{height:g,placeholder:E,formId:p}=t,R=W({formId:p})?o.allowFormEnterToSubmit(p):r,H=C&&T>e.breakpoints.hideWidgetDetails;return A("div",{className:"stTextArea","data-testid":"stTextArea",ref:S,children:[l(j,{label:t.label,disabled:a,labelVisibility:L((f=t.labelVisibility)==null?void 0:f.value),htmlFor:h,children:t.help&&l(P,{children:l(B,{content:t.help,placement:D.TOP_RIGHT})})}),l(G,{value:i??"",placeholder:E,onBlur:V,onFocus:F,onChange:v,onKeyDown:z,"aria-label":t.label,disabled:a,id:h,overrides:{Input:{style:{lineHeight:e.lineHeights.inputWidget,height:g?`${g}px`:"",minHeight:e.sizes.largestElementHeight,resize:"vertical","::placeholder":{opacity:"0.7"},paddingRight:e.spacing.md,paddingLeft:e.spacing.md,paddingBottom:e.spacing.md,paddingTop:e.spacing.md}},Root:{props:{"data-testid":"stTextAreaRootElement"},style:{borderLeftWidth:e.sizes.borderWidth,borderRightWidth:e.sizes.borderWidth,borderTopWidth:e.sizes.borderWidth,borderBottomWidth:e.sizes.borderWidth}}}}),H&&l(O,{dirty:r,value:i??"",maxLength:t.maxChars,type:"multiline",inForm:W({formId:p}),allowEnterToSubmit:R})]})},it=s.memo(X);export{it as default};
@@ -1 +1 @@
1
- import{r as i,E as J,_ as Q,n as g,B as ht,z as W,j as n,b5 as Z,br as ft,C as F,bm as tt,b0 as et,bl as T,aW as mt,bD as yt,bg as Ct,bE as v,bp as It,F as ot,bd as bt,bF as vt,M,bi as xt,bh as wt}from"./index.PoIwzrI7.js";import{g as St,F as N,C as Ft,I as Et,E as Ut,a as zt,s as Tt,u as Ht,b as Bt}from"./FileHelper.q7erXtkb.js";import{I as Dt}from"./InputInstructions.DI9h4PJ7.js";import{i as Rt}from"./inputUtils.CQWz5UKz.js";import{E as Lt}from"./ErrorOutline.esm.BewaDzzJ.js";import{a as q,U as nt}from"./UploadFileInfo.0DCkpDDf.js";import{T as Mt}from"./textarea.CgvEg9Xi.js";import"./base-input.BmA1ZV9Y.js";var at=i.forwardRef(function(t,e){var s={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return i.createElement(J,Q({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"}))});at.displayName="AttachFile";var rt=i.forwardRef(function(t,e){var s={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return i.createElement(J,Q({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"}))});rt.displayName="Send";const $t=g("div",{target:"e1togvvn0"})("border:none;position:relative;display:flex;"),kt=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}})),Vt=g("button",{target:"e1togvvn2"})(({theme:t,disabled:e,extended:s})=>{const p=ht(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"}}}),Nt=g("div",{target:"e1togvvn3"})(({theme:t})=>({display:"flex",alignItems:"flex-end",height:"100%",position:"absolute",right:0,marginBottom:`-${t.sizes.borderWidth}`,pointerEvents:"none"})),Wt=g("div",{target:"e1togvvn4"})(({theme:t})=>({position:"absolute",bottom:"0px",right:`calc(${t.iconSizes.xl} + 2 * ${t.spacing.sm} + ${t.spacing.sm})`})),At=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})),Pt=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})),Kt=g("div",{target:"e15560op2"})(({theme:t,disabled:e})=>({display:"flex",alignItems:"top",height:"100%",marginTop:`-${t.sizes.borderWidth}`,cursor:e?"not-allowed":"auto"})),Ot=g("div",{target:"e15560op3"})(({disabled:t})=>({pointerEvents:t?"none":"auto"})),_t=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})),Xt=g("div",{target:"e15560op5"})(({theme:t})=>({left:0,right:0,lineHeight:t.lineHeights.tight,paddingLeft:t.spacing.sm,paddingRight:t.spacing.sm,overflowX:"auto"})),Gt=g("div",{target:"e15560op6"})({display:"flex"}),jt=g("div",{target:"e15560op7"})({flex:"0 0 auto"}),Yt=g("div",{target:"e15560op8"})(({theme:t})=>({display:"flex",alignItems:"center",padding:t.spacing.sm,gap:t.spacing.twoXS})),qt=g("div",{target:"e15560op9"})(({theme:t})=>({color:t.colors.fadedText60})),Jt=g("div",{target:"e15560op10"})(({theme:t,fileStatus:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:e.type==="uploaded"?t.colors.bodyText:t.colors.fadedText60})),Qt=g("div",{target:"e15560op11"})(({theme:t})=>({marginRight:t.spacing.md,color:t.colors.fadedText60})),Zt=g("small",{target:"e15560op12"})(({theme:t})=>({display:"flex",alignItems:"center",maxHeight:t.sizes.smallElementHeight,color:t.colors.fadedText60,"& :hover":{color:t.colors.bodyText}}));function te({children:t,content:e}){const s=W();return n(ft,{content:e,placement:Z.TOP,overrides:{Body:{style:{top:`-${s.sizes.minElementHeight}`}}},children:t})}const ee=({fileInfo:t})=>{const e=W(),{type:s}=t.status;switch(s){case"uploading":return n(yt,{usingCustomTheme:!1,"data-testid":"stChatInputFileIconSpinner",size:"lg",margin:"0",padding:"0"});case"error":return n(te,{content:t.status.errorMessage,children:n(T,{color:e.colors.red,content:Lt,size:"lg"})});case"uploaded":return n(T,{content:Et,size:"lg"});default:return mt(s),null}},oe=({fileInfo:t,onDelete:e})=>F(Yt,{className:"stChatInputFile","data-testid":"stChatInputFile",children:[n(qt,{children:n(ee,{fileInfo:t})}),n(Jt,{className:"stChatInputFileName","data-testid":"stChatInputFileName",title:t.name,fileStatus:t.status,children:t.name}),n(Qt,{children:St(t.size,N.Byte)}),n(Zt,{"data-testid":"stChatInputDeleteBtn",children:n(tt,{onClick:()=>e(t.id),kind:et.MINIMAL,children:n(T,{content:Ft,size:"lg"})})})]}),ne=i.memo(oe),ae=({items:t,onDelete:e})=>n(Xt,{"data-testid":"stChatUploadedFiles",children:n(Gt,{children:t.map(s=>n(jt,{children:n(ne,{fileInfo:s,onDelete:e})},s.id))})}),re=i.memo(ae),ie=({getNextLocalFileId:t,addFiles:e,updateFile:s,uploadClient:p,element:f,onUploadProgress:u,onUploadComplete:I})=>(y,d)=>{const m=q.CancelToken.source(),c=new nt(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"}))})},se=({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)===Ut.TooManyFiles});c>=0&&(d.push(m[c].file),m.splice(c,1))}if(!t&&d.length>0&&I(),s.fetchFileURLs(d).then(c=>{Ct(c,d).forEach(([h,x])=>{p(h,x)})}).catch(c=>{f(d.map(h=>new nt(h.name,h.size,u(),{type:"error",errorMessage:c})))}),m.length>0){const c=m.map(h=>zt(h,u(),e));f(c)}y()},le=({getRootProps:t,getInputProps:e,acceptFile:s,disabled:p,theme:f})=>F(Kt,{disabled:p,children:[F(Ot,{"data-testid":"stChatInputFileUploadButton",disabled:p,...t(),children:[n("input",{...e()}),n(It,{content:`Upload or drag and drop ${s===v.Multiple?"files":"a file"}`,placement:Z.TOP,onMouseEnterDelay:500,children:n(tt,{kind:et.MINIMAL,disabled:p,children:n(T,{content:at,size:"lg",color:p?f.colors.fadedText40:f.colors.fadedText60})})})]}),n(_t,{})]}),de=i.memo(le),ce=({getRootProps:t,getInputProps:e,acceptFile:s,inputHeight:p})=>F(ot,{children:[n(At,{height:p,...t(),children:n("input",{...e()})}),n(Pt,{height:p,children:`Drag and drop ${s===v.Multiple?"files":"a file"} here`})]}),pe=i.memo(ce),ue=6.5,$=1,k=(t,e,s)=>s.map(p=>p.id===t?e:p),V=(t,e)=>e.find(s=>s.id===t);function ge({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]=bt(),[E,B]=i.useState(e.default),[U,D]=i.useState(0),[H,it]=i.useState(!1),[w,S]=i.useState([]),[z,R]=i.useState(!1),L=i.useMemo(()=>w.some(o=>o.status.type==="uploading")?!1:E!==""||w.length>0,[w,E]),b=vt(e.acceptFile),A=Tt(e.maxUploadSizeMb,N.Megabyte,N.Byte),P=i.useCallback(o=>S(a=>[...a,...o]),[]),K=i.useCallback(o=>{S(a=>{const l=V(o,a);return M(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]),st=()=>{const o=w.filter(a=>a.status.type==="uploaded").map(a=>{const{name:l,size:r,status:C}=a,{fileId:ut,fileUrls:gt}=C;return new xt({fileId:ut,fileUrls:gt,name:l,size:r})});return new wt({uploadedFileInfo:o})},O=()=>m.current++,lt=se({acceptMultipleFiles:b===v.Multiple,maxFileSize:A,uploadClient:f,uploadFile:ie({getNextLocalFileId:O,addFiles:P,updateFile:(o,a)=>{S(l=>k(o,a,l))},uploadClient:f,element:e,onUploadProgress:(o,a)=>{S(l=>{const r=V(a,l);if(M(r)||r.status.type!=="uploading")return l;const C=Math.round(o.loaded*100/o.total);return r.status.progress===C?l:k(a,r.setStatus({type:"uploading",cancelToken:r.status.cancelToken,progress:C}),l)})},onUploadComplete:(o,a)=>{S(l=>{const r=V(o,l);return M(r)||r.status.type!=="uploading"?l:k(r.id,r.setStatus({type:"uploaded",fileId:a.fileId,fileUrls:a}),l)})}}),addFiles:P,getNextLocalFileId:O,deleteExistingFiles:()=>w.forEach(o=>K(o.id)),onUploadComplete:()=>{d.current&&d.current.focus()}}),{getRootProps:_,getInputProps:X}=Ht({onDrop:lt,multiple:b===v.Multiple,accept:Bt(e.fileType),maxSize:A}),G=()=>{let o=0;const{current:a}=d;return a&&(a.style.height="auto",o=a.scrollHeight,a.style.height=""),o},j=()=>{if(d.current&&d.current.focus(),!L||t)return;const o={data:E,fileUploaderState:st()};s.setChatInputValue(e,o,{fromUi:!0},p),S([]),B(""),D(0)},dt=o=>{const{metaKey:a,ctrlKey:l,shiftKey:r}=o;Rt(o)&&!r&&!l&&!a&&(o.preventDefault(),j())},ct=o=>{const{value:a}=o.target;y!==0&&a.length>y||(B(a),D(G()))};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*ue}},[d]),i.useEffect(()=>{const o=r=>{var C;r.preventDefault(),r.stopPropagation(),!z&&((C=r.dataTransfer)!=null&&C.types.includes("Files"))&&R(!0)},a=r=>{r.preventDefault(),r.stopPropagation(),z&&(r.clientX<=0&&r.clientY<=0||r.clientX>=window.innerWidth&&r.clientY>=window.innerHeight)&&R(!1)},l=r=>{r.preventDefault(),r.stopPropagation(),z&&R(!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]),i.useLayoutEffect(()=>{const{minHeight:o}=c.current;it(U>0&&d.current?Math.abs(U-o)>$:!1)},[U]),i.useLayoutEffect(()=>{D(G())},[I]);const{maxHeight:Y}=c.current,pt=b!==v.None&&z;return F(ot,{children:[b===v.None?null:n(re,{items:[...w],onDelete:K}),n($t,{className:"stChatInput","data-testid":"stChatInput",ref:x,children:pt?n(pe,{getRootProps:_,getInputProps:X,acceptFile:b,inputHeight:H?`${U+$}px`:u.sizes.minElementHeight}):F(kt,{extended:H,children:[b===v.None?null:n(de,{getRootProps:_,getInputProps:X,acceptFile:b,disabled:t,theme:u}),n(Mt,{inputRef:d,value:E,placeholder:I,onChange:ct,onKeyDown:dt,"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":{opacity:"0.7"},height:H?`${U+$}px`:"auto",maxHeight:Y?`${Y}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(Wt,{children:n(Dt,{dirty:L,value:E,maxLength:y,type:"chat",inForm:!1})}),n(Nt,{children:n(Vt,{onClick:j,disabled:!L||t,extended:H,"data-testid":"stChatInputSubmitButton",children:n(T,{content:rt,size:"xl",color:"inherit"})})})]})})]})}const xe=i.memo(ge);export{xe as default};
1
+ import{r as i,E as J,_ as Q,n as g,B as ht,z as W,j as n,b5 as Z,br as ft,C as F,bm as tt,b0 as et,bl as T,aW as mt,bD as yt,bg as Ct,bE as v,bp as It,F as ot,bd as bt,bF as vt,M,bi as xt,bh as wt}from"./index.C1TEsRV0.js";import{g as St,F as N,C as Ft,I as Et,E as Ut,a as zt,s as Tt,u as Ht,b as Bt}from"./FileHelper.BWWhRdUs.js";import{I as Dt}from"./InputInstructions.Bkai2tFZ.js";import{i as Rt}from"./inputUtils.CQWz5UKz.js";import{E as Lt}from"./ErrorOutline.esm.Cfhrjz42.js";import{a as q,U as nt}from"./UploadFileInfo.0DCkpDDf.js";import{T as Mt}from"./textarea.DNNNKi6n.js";import"./base-input.DfiT3r4p.js";var at=i.forwardRef(function(t,e){var s={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return i.createElement(J,Q({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"}))});at.displayName="AttachFile";var rt=i.forwardRef(function(t,e){var s={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return i.createElement(J,Q({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"}))});rt.displayName="Send";const $t=g("div",{target:"e1togvvn0"})("border:none;position:relative;display:flex;"),kt=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}})),Vt=g("button",{target:"e1togvvn2"})(({theme:t,disabled:e,extended:s})=>{const p=ht(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"}}}),Nt=g("div",{target:"e1togvvn3"})(({theme:t})=>({display:"flex",alignItems:"flex-end",height:"100%",position:"absolute",right:0,marginBottom:`-${t.sizes.borderWidth}`,pointerEvents:"none"})),Wt=g("div",{target:"e1togvvn4"})(({theme:t})=>({position:"absolute",bottom:"0px",right:`calc(${t.iconSizes.xl} + 2 * ${t.spacing.sm} + ${t.spacing.sm})`})),At=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})),Pt=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})),Kt=g("div",{target:"e15560op2"})(({theme:t,disabled:e})=>({display:"flex",alignItems:"top",height:"100%",marginTop:`-${t.sizes.borderWidth}`,cursor:e?"not-allowed":"auto"})),Ot=g("div",{target:"e15560op3"})(({disabled:t})=>({pointerEvents:t?"none":"auto"})),_t=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})),Xt=g("div",{target:"e15560op5"})(({theme:t})=>({left:0,right:0,lineHeight:t.lineHeights.tight,paddingLeft:t.spacing.sm,paddingRight:t.spacing.sm,overflowX:"auto"})),Gt=g("div",{target:"e15560op6"})({display:"flex"}),jt=g("div",{target:"e15560op7"})({flex:"0 0 auto"}),Yt=g("div",{target:"e15560op8"})(({theme:t})=>({display:"flex",alignItems:"center",padding:t.spacing.sm,gap:t.spacing.twoXS})),qt=g("div",{target:"e15560op9"})(({theme:t})=>({color:t.colors.fadedText60})),Jt=g("div",{target:"e15560op10"})(({theme:t,fileStatus:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:e.type==="uploaded"?t.colors.bodyText:t.colors.fadedText60})),Qt=g("div",{target:"e15560op11"})(({theme:t})=>({marginRight:t.spacing.md,color:t.colors.fadedText60})),Zt=g("small",{target:"e15560op12"})(({theme:t})=>({display:"flex",alignItems:"center",maxHeight:t.sizes.smallElementHeight,color:t.colors.fadedText60,"& :hover":{color:t.colors.bodyText}}));function te({children:t,content:e}){const s=W();return n(ft,{content:e,placement:Z.TOP,overrides:{Body:{style:{top:`-${s.sizes.minElementHeight}`}}},children:t})}const ee=({fileInfo:t})=>{const e=W(),{type:s}=t.status;switch(s){case"uploading":return n(yt,{usingCustomTheme:!1,"data-testid":"stChatInputFileIconSpinner",size:"lg",margin:"0",padding:"0"});case"error":return n(te,{content:t.status.errorMessage,children:n(T,{color:e.colors.red,content:Lt,size:"lg"})});case"uploaded":return n(T,{content:Et,size:"lg"});default:return mt(s),null}},oe=({fileInfo:t,onDelete:e})=>F(Yt,{className:"stChatInputFile","data-testid":"stChatInputFile",children:[n(qt,{children:n(ee,{fileInfo:t})}),n(Jt,{className:"stChatInputFileName","data-testid":"stChatInputFileName",title:t.name,fileStatus:t.status,children:t.name}),n(Qt,{children:St(t.size,N.Byte)}),n(Zt,{"data-testid":"stChatInputDeleteBtn",children:n(tt,{onClick:()=>e(t.id),kind:et.MINIMAL,children:n(T,{content:Ft,size:"lg"})})})]}),ne=i.memo(oe),ae=({items:t,onDelete:e})=>n(Xt,{"data-testid":"stChatUploadedFiles",children:n(Gt,{children:t.map(s=>n(jt,{children:n(ne,{fileInfo:s,onDelete:e})},s.id))})}),re=i.memo(ae),ie=({getNextLocalFileId:t,addFiles:e,updateFile:s,uploadClient:p,element:f,onUploadProgress:u,onUploadComplete:I})=>(y,d)=>{const m=q.CancelToken.source(),c=new nt(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"}))})},se=({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)===Ut.TooManyFiles});c>=0&&(d.push(m[c].file),m.splice(c,1))}if(!t&&d.length>0&&I(),s.fetchFileURLs(d).then(c=>{Ct(c,d).forEach(([h,x])=>{p(h,x)})}).catch(c=>{f(d.map(h=>new nt(h.name,h.size,u(),{type:"error",errorMessage:c})))}),m.length>0){const c=m.map(h=>zt(h,u(),e));f(c)}y()},le=({getRootProps:t,getInputProps:e,acceptFile:s,disabled:p,theme:f})=>F(Kt,{disabled:p,children:[F(Ot,{"data-testid":"stChatInputFileUploadButton",disabled:p,...t(),children:[n("input",{...e()}),n(It,{content:`Upload or drag and drop ${s===v.Multiple?"files":"a file"}`,placement:Z.TOP,onMouseEnterDelay:500,children:n(tt,{kind:et.MINIMAL,disabled:p,children:n(T,{content:at,size:"lg",color:p?f.colors.fadedText40:f.colors.fadedText60})})})]}),n(_t,{})]}),de=i.memo(le),ce=({getRootProps:t,getInputProps:e,acceptFile:s,inputHeight:p})=>F(ot,{children:[n(At,{height:p,...t(),children:n("input",{...e()})}),n(Pt,{height:p,children:`Drag and drop ${s===v.Multiple?"files":"a file"} here`})]}),pe=i.memo(ce),ue=6.5,$=1,k=(t,e,s)=>s.map(p=>p.id===t?e:p),V=(t,e)=>e.find(s=>s.id===t);function ge({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]=bt(),[E,B]=i.useState(e.default),[U,D]=i.useState(0),[H,it]=i.useState(!1),[w,S]=i.useState([]),[z,R]=i.useState(!1),L=i.useMemo(()=>w.some(o=>o.status.type==="uploading")?!1:E!==""||w.length>0,[w,E]),b=vt(e.acceptFile),A=Tt(e.maxUploadSizeMb,N.Megabyte,N.Byte),P=i.useCallback(o=>S(a=>[...a,...o]),[]),K=i.useCallback(o=>{S(a=>{const l=V(o,a);return M(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]),st=()=>{const o=w.filter(a=>a.status.type==="uploaded").map(a=>{const{name:l,size:r,status:C}=a,{fileId:ut,fileUrls:gt}=C;return new xt({fileId:ut,fileUrls:gt,name:l,size:r})});return new wt({uploadedFileInfo:o})},O=()=>m.current++,lt=se({acceptMultipleFiles:b===v.Multiple,maxFileSize:A,uploadClient:f,uploadFile:ie({getNextLocalFileId:O,addFiles:P,updateFile:(o,a)=>{S(l=>k(o,a,l))},uploadClient:f,element:e,onUploadProgress:(o,a)=>{S(l=>{const r=V(a,l);if(M(r)||r.status.type!=="uploading")return l;const C=Math.round(o.loaded*100/o.total);return r.status.progress===C?l:k(a,r.setStatus({type:"uploading",cancelToken:r.status.cancelToken,progress:C}),l)})},onUploadComplete:(o,a)=>{S(l=>{const r=V(o,l);return M(r)||r.status.type!=="uploading"?l:k(r.id,r.setStatus({type:"uploaded",fileId:a.fileId,fileUrls:a}),l)})}}),addFiles:P,getNextLocalFileId:O,deleteExistingFiles:()=>w.forEach(o=>K(o.id)),onUploadComplete:()=>{d.current&&d.current.focus()}}),{getRootProps:_,getInputProps:X}=Ht({onDrop:lt,multiple:b===v.Multiple,accept:Bt(e.fileType),maxSize:A}),G=()=>{let o=0;const{current:a}=d;return a&&(a.style.height="auto",o=a.scrollHeight,a.style.height=""),o},j=()=>{if(d.current&&d.current.focus(),!L||t)return;const o={data:E,fileUploaderState:st()};s.setChatInputValue(e,o,{fromUi:!0},p),S([]),B(""),D(0)},dt=o=>{const{metaKey:a,ctrlKey:l,shiftKey:r}=o;Rt(o)&&!r&&!l&&!a&&(o.preventDefault(),j())},ct=o=>{const{value:a}=o.target;y!==0&&a.length>y||(B(a),D(G()))};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*ue}},[d]),i.useEffect(()=>{const o=r=>{var C;r.preventDefault(),r.stopPropagation(),!z&&((C=r.dataTransfer)!=null&&C.types.includes("Files"))&&R(!0)},a=r=>{r.preventDefault(),r.stopPropagation(),z&&(r.clientX<=0&&r.clientY<=0||r.clientX>=window.innerWidth&&r.clientY>=window.innerHeight)&&R(!1)},l=r=>{r.preventDefault(),r.stopPropagation(),z&&R(!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]),i.useLayoutEffect(()=>{const{minHeight:o}=c.current;it(U>0&&d.current?Math.abs(U-o)>$:!1)},[U]),i.useLayoutEffect(()=>{D(G())},[I]);const{maxHeight:Y}=c.current,pt=b!==v.None&&z;return F(ot,{children:[b===v.None?null:n(re,{items:[...w],onDelete:K}),n($t,{className:"stChatInput","data-testid":"stChatInput",ref:x,children:pt?n(pe,{getRootProps:_,getInputProps:X,acceptFile:b,inputHeight:H?`${U+$}px`:u.sizes.minElementHeight}):F(kt,{extended:H,children:[b===v.None?null:n(de,{getRootProps:_,getInputProps:X,acceptFile:b,disabled:t,theme:u}),n(Mt,{inputRef:d,value:E,placeholder:I,onChange:ct,onKeyDown:dt,"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":{opacity:"0.7"},height:H?`${U+$}px`:"auto",maxHeight:Y?`${Y}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(Wt,{children:n(Dt,{dirty:L,value:E,maxLength:y,type:"chat",inForm:!1})}),n(Nt,{children:n(Vt,{onClick:j,disabled:!L||t,extended:H,"data-testid":"stChatInputSubmitButton",children:n(T,{content:rt,size:"xl",color:"inherit"})})})]})})]})}const xe=i.memo(ge);export{xe as default};
@@ -1 +1 @@
1
- import{r,E as Q,_ as Y,cz as y,M as m,O as Z,l as mt,n as D,z as gt,bd as ht,cp as It,H as q,C as F,j as c,bo as yt,bC as Ct,bp as Tt,b5 as wt,bq as St,D as vt,bl as K}from"./index.PoIwzrI7.js";import{u as Vt}from"./uniqueId.BV5h1uCx.js";import{u as kt}from"./FormClearHelper.Dd0v0IXt.js";import{I as Rt}from"./InputInstructions.DI9h4PJ7.js";import{s as xt}from"./sprintf.D7DtBTRn.js";import{I as Dt}from"./input.B3uNJm6d.js";import"./base-input.BmA1ZV9Y.js";var tt=r.forwardRef(function(t,e){var a={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(Q,Y({iconAttrs:a,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),r.createElement("path",{d:"M0 3v2h8V3H0z"}))});tt.displayName="Minus";var et=r.forwardRef(function(t,e){var a={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(Q,Y({iconAttrs:a,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),r.createElement("path",{d:"M3 0v3H0v2h3v3h2V5h3V3H5V0H3z"}))});et.displayName="Plus";const Et=mt.getLogger("NumberInput");function Nt(t){return m(t)||t===""?void 0:t}const W=({value:t,format:e,step:a,dataType:b})=>{if(m(t))return null;let o=Nt(e);if(m(o)&&Z(a)){const d=a.toString();b===y.DataType.FLOAT&&a!==0&&d.includes(".")&&(o=`%0.${d.split(".")[1].length}f`)}if(m(o))return t.toString();try{return xt.sprintf(o,t)}catch(d){return Et.warn(`Error in sprintf(${o}, ${t}): ${d}`),String(t)}},zt=(t,e,a)=>m(t)?!1:t-e>=a,Ft=(t,e,a)=>m(t)?!1:t+e<=a,Wt=t=>(t.element.dataType===y.DataType.INT?t.widgetMgr.getIntValue(t.element):t.widgetMgr.getDoubleValue(t.element))??t.element.default??null,M=({step:t,dataType:e})=>t||(e===y.DataType.INT?1:.01),Bt=D("div",{target:"e4u2kar0"})(({theme:t})=>({display:"flex",flexDirection:"row",flexWrap:"nowrap",alignItems:"center",height:t.sizes.minElementHeight,borderWidth:t.sizes.borderWidth,borderStyle:"solid",borderColor:t.colors.widgetBorderColor??t.colors.secondaryBg,transitionDuration:"200ms",transitionProperty:"border",transitionTimingFunction:"cubic-bezier(0.2, 0.8, 0.4, 1)",borderRadius:t.radii.default,overflow:"hidden","&.focused":{borderColor:t.colors.primary},input:{MozAppearance:"textfield","&::-webkit-inner-spin-button, &::-webkit-outer-spin-button":{WebkitAppearance:"none",margin:t.spacing.none}}})),Lt=D("div",{target:"e4u2kar1"})({display:"flex",flexDirection:"row",alignSelf:"stretch"}),J=D("button",{target:"e4u2kar2"})(({theme:t})=>({margin:t.spacing.none,border:"none",height:t.sizes.full,display:"flex",alignItems:"center",width:t.sizes.numberInputControlsWidth,justifyContent:"center",color:t.colors.bodyText,transition:"color 300ms, backgroundColor 300ms",backgroundColor:t.colors.secondaryBg,"&:hover:enabled, &:focus:enabled":{color:t.colors.white,backgroundColor:t.colors.primary,transition:"none",outline:"none"},"&:active":{outline:"none",border:"none"},"&:last-of-type":{borderTopRightRadius:t.radii.default,borderBottomRightRadius:t.radii.default},"&:disabled":{cursor:"not-allowed",color:t.colors.fadedText40}})),Ht=D("div",{target:"e4u2kar3"})(({theme:t,clearable:e})=>({position:"absolute",marginRight:t.spacing.twoXS,left:0,right:`calc(${t.sizes.numberInputControlsWidth} * 2 + ${e?"1em":"0em"})`})),Pt=({disabled:t,element:e,widgetMgr:a,fragmentId:b})=>{var X;const o=gt(),{dataType:d,id:S,formId:p,default:B,format:L,icon:C,min:g,max:h}=e,[H,ot]=ht(),[s,rt]=r.useState(()=>M(e)),P=Wt({element:e,widgetMgr:a}),[I,T]=r.useState(!1),[l,w]=r.useState(P),[U,v]=r.useState(()=>W({value:P,...e,step:s})),[A,$]=r.useState(!1),V=r.useRef(null),O=r.useRef(Vt("number_input_")),k=zt(l,s,g),R=Ft(l,s,h),j=It({formId:p}),nt=j?a.allowFormEnterToSubmit(p):I,at=A&&H>o.breakpoints.hideWidgetDetails;r.useEffect(()=>{rt(M({step:e.step,dataType:e.dataType}))},[e.dataType,e.step]);const u=r.useCallback(({value:n,source:i})=>{var f;if(Z(n)&&(g>n||n>h))(f=V.current)==null||f.reportValidity();else{const x=n??B??null;switch(d){case y.DataType.INT:a.setIntValue({id:S,formId:p},x,i,b);break;case y.DataType.FLOAT:a.setDoubleValue({id:S,formId:p},x,i,b);break;default:throw new Error("Invalid data type")}T(!1),w(x),v(W({value:x,dataType:d,format:L,step:s}))}},[g,h,V,a,b,s,d,S,p,B,L]),st=r.useCallback(()=>{I&&u({value:l,source:{fromUi:!0}}),$(!1)},[I,l,u]),it=r.useCallback(()=>{$(!0)},[]),_=r.useCallback(()=>{const{value:n}=e;e.setValue=!1,w(n??null),v(W({value:n??null,...e,step:s})),u({value:n??null,source:{fromUi:!1}})},[e,s,u]);r.useEffect(()=>{e.setValue?_():u({value:l,source:{fromUi:!1}});const n=V.current;if(n){const i=f=>{f.preventDefault()};return n.addEventListener("wheel",i),()=>{n.removeEventListener("wheel",i)}}},[]),e.setValue&&_();const E=m(e.default)&&!t,lt=r.useCallback(()=>{const n=e.default??null;w(n),u({value:n,source:{fromUi:!0}})},[e]);kt({element:e,widgetMgr:a,onFormCleared:lt});const ct=n=>{const{value:i}=n.target;if(i==="")T(!0),w(null),v(null);else{let f;e.dataType===y.DataType.INT?f=parseInt(i,10):f=parseFloat(i),T(!0),w(f),v(i)}},N=r.useCallback(()=>{R&&(T(!0),u({value:(l??g)+s,source:{fromUi:!0}}))},[l,g,s,R]),z=r.useCallback(()=>{k&&(T(!0),u({value:(l??h)-s,source:{fromUi:!0}}))},[l,h,s,k]),ut=r.useCallback(n=>{const{key:i}=n;switch(i){case"ArrowUp":n.preventDefault(),N();break;case"ArrowDown":n.preventDefault(),z();break}},[N,z]),dt=r.useCallback(n=>{n.key==="Enter"&&(I&&u({value:l,source:{fromUi:!0}}),a.allowFormEnterToSubmit(p)&&a.submitForm(p,b))},[I,l,u,a,p,b]),G=C==null?void 0:C.startsWith(":material"),pt=G?"lg":"base",ft=q(o.iconSizes.lg)+2*q(o.spacing.twoXS),bt=C?o.breakpoints.hideNumberInputControls+ft:o.breakpoints.hideNumberInputControls;return F("div",{className:"stNumberInput","data-testid":"stNumberInput",ref:ot,children:[c(St,{label:e.label,disabled:t,labelVisibility:yt((X=e.labelVisibility)==null?void 0:X.value),htmlFor:O.current,children:e.help&&c(Ct,{children:c(Tt,{content:e.help,placement:wt.TOP_RIGHT})})}),F(Bt,{className:A?"focused":"","data-testid":"stNumberInputContainer",children:[c(Dt,{type:"number",inputRef:V,value:U??"",placeholder:e.placeholder,onBlur:st,onFocus:it,onChange:ct,onKeyPress:dt,onKeyDown:ut,clearable:E,clearOnEscape:E,disabled:t,"aria-label":e.label,startEnhancer:e.icon&&c(vt,{"data-testid":"stNumberInputIcon",iconValue:e.icon,size:pt}),id:O.current,overrides:{ClearIconContainer:{style:{padding:0}},ClearIcon:{props:{overrides:{Svg:{style:{color:o.colors.darkGray,padding:o.spacing.threeXS,height:o.sizes.clearIconSize,width:o.sizes.clearIconSize,":hover":{fill:o.colors.bodyText}}}}}},Input:{props:{"data-testid":"stNumberInputField",step:s,min:g,max:h,type:"number",inputMode:""},style:{lineHeight:o.lineHeights.inputWidget,paddingRight:o.spacing.sm,paddingLeft:o.spacing.md,paddingBottom:o.spacing.sm,paddingTop:o.spacing.sm}},InputContainer:{style:()=>({borderTopRightRadius:0,borderBottomRightRadius:0})},Root:{style:{borderTopRightRadius:0,borderBottomRightRadius:0,borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeftWidth:0,borderRightWidth:0,borderTopWidth:0,borderBottomWidth:0,paddingRight:0,paddingLeft:C?o.spacing.sm:0}},StartEnhancer:{style:{paddingLeft:0,paddingRight:0,minWidth:o.iconSizes.lg,color:G?o.colors.fadedText60:"inherit"}}}}),H>bt&&F(Lt,{children:[c(J,{"data-testid":"stNumberInputStepDown",onClick:z,disabled:!k||t,tabIndex:-1,children:c(K,{content:tt,size:"xs",color:k?"inherit":o.colors.disabled})}),c(J,{"data-testid":"stNumberInputStepUp",onClick:N,disabled:!R||t,tabIndex:-1,children:c(K,{content:et,size:"xs",color:R?"inherit":o.colors.disabled})})]})]}),at&&c(Ht,{clearable:E,children:c(Rt,{dirty:I,value:U??"",inForm:j,allowEnterToSubmit:nt})})]})},Xt=r.memo(Pt);export{Xt as default};
1
+ import{r,E as Q,_ as Y,cz as y,M as m,O as Z,l as mt,n as D,z as gt,bd as ht,cp as It,H as q,C as F,j as c,bo as yt,bC as Ct,bp as Tt,b5 as wt,bq as St,D as vt,bl as K}from"./index.C1TEsRV0.js";import{u as Vt}from"./uniqueId.CFcd6g0d.js";import{u as kt}from"./FormClearHelper.CHPGUkGG.js";import{I as Rt}from"./InputInstructions.Bkai2tFZ.js";import{s as xt}from"./sprintf.D7DtBTRn.js";import{I as Dt}from"./input.BAfiLByr.js";import"./base-input.DfiT3r4p.js";var tt=r.forwardRef(function(t,e){var a={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(Q,Y({iconAttrs:a,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),r.createElement("path",{d:"M0 3v2h8V3H0z"}))});tt.displayName="Minus";var et=r.forwardRef(function(t,e){var a={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(Q,Y({iconAttrs:a,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),r.createElement("path",{d:"M3 0v3H0v2h3v3h2V5h3V3H5V0H3z"}))});et.displayName="Plus";const Et=mt.getLogger("NumberInput");function Nt(t){return m(t)||t===""?void 0:t}const W=({value:t,format:e,step:a,dataType:b})=>{if(m(t))return null;let o=Nt(e);if(m(o)&&Z(a)){const d=a.toString();b===y.DataType.FLOAT&&a!==0&&d.includes(".")&&(o=`%0.${d.split(".")[1].length}f`)}if(m(o))return t.toString();try{return xt.sprintf(o,t)}catch(d){return Et.warn(`Error in sprintf(${o}, ${t}): ${d}`),String(t)}},zt=(t,e,a)=>m(t)?!1:t-e>=a,Ft=(t,e,a)=>m(t)?!1:t+e<=a,Wt=t=>(t.element.dataType===y.DataType.INT?t.widgetMgr.getIntValue(t.element):t.widgetMgr.getDoubleValue(t.element))??t.element.default??null,M=({step:t,dataType:e})=>t||(e===y.DataType.INT?1:.01),Bt=D("div",{target:"e4u2kar0"})(({theme:t})=>({display:"flex",flexDirection:"row",flexWrap:"nowrap",alignItems:"center",height:t.sizes.minElementHeight,borderWidth:t.sizes.borderWidth,borderStyle:"solid",borderColor:t.colors.widgetBorderColor??t.colors.secondaryBg,transitionDuration:"200ms",transitionProperty:"border",transitionTimingFunction:"cubic-bezier(0.2, 0.8, 0.4, 1)",borderRadius:t.radii.default,overflow:"hidden","&.focused":{borderColor:t.colors.primary},input:{MozAppearance:"textfield","&::-webkit-inner-spin-button, &::-webkit-outer-spin-button":{WebkitAppearance:"none",margin:t.spacing.none}}})),Lt=D("div",{target:"e4u2kar1"})({display:"flex",flexDirection:"row",alignSelf:"stretch"}),J=D("button",{target:"e4u2kar2"})(({theme:t})=>({margin:t.spacing.none,border:"none",height:t.sizes.full,display:"flex",alignItems:"center",width:t.sizes.numberInputControlsWidth,justifyContent:"center",color:t.colors.bodyText,transition:"color 300ms, backgroundColor 300ms",backgroundColor:t.colors.secondaryBg,"&:hover:enabled, &:focus:enabled":{color:t.colors.white,backgroundColor:t.colors.primary,transition:"none",outline:"none"},"&:active":{outline:"none",border:"none"},"&:last-of-type":{borderTopRightRadius:t.radii.default,borderBottomRightRadius:t.radii.default},"&:disabled":{cursor:"not-allowed",color:t.colors.fadedText40}})),Ht=D("div",{target:"e4u2kar3"})(({theme:t,clearable:e})=>({position:"absolute",marginRight:t.spacing.twoXS,left:0,right:`calc(${t.sizes.numberInputControlsWidth} * 2 + ${e?"1em":"0em"})`})),Pt=({disabled:t,element:e,widgetMgr:a,fragmentId:b})=>{var X;const o=gt(),{dataType:d,id:S,formId:p,default:B,format:L,icon:C,min:g,max:h}=e,[H,ot]=ht(),[s,rt]=r.useState(()=>M(e)),P=Wt({element:e,widgetMgr:a}),[I,T]=r.useState(!1),[l,w]=r.useState(P),[U,v]=r.useState(()=>W({value:P,...e,step:s})),[A,$]=r.useState(!1),V=r.useRef(null),O=r.useRef(Vt("number_input_")),k=zt(l,s,g),R=Ft(l,s,h),j=It({formId:p}),nt=j?a.allowFormEnterToSubmit(p):I,at=A&&H>o.breakpoints.hideWidgetDetails;r.useEffect(()=>{rt(M({step:e.step,dataType:e.dataType}))},[e.dataType,e.step]);const u=r.useCallback(({value:n,source:i})=>{var f;if(Z(n)&&(g>n||n>h))(f=V.current)==null||f.reportValidity();else{const x=n??B??null;switch(d){case y.DataType.INT:a.setIntValue({id:S,formId:p},x,i,b);break;case y.DataType.FLOAT:a.setDoubleValue({id:S,formId:p},x,i,b);break;default:throw new Error("Invalid data type")}T(!1),w(x),v(W({value:x,dataType:d,format:L,step:s}))}},[g,h,V,a,b,s,d,S,p,B,L]),st=r.useCallback(()=>{I&&u({value:l,source:{fromUi:!0}}),$(!1)},[I,l,u]),it=r.useCallback(()=>{$(!0)},[]),_=r.useCallback(()=>{const{value:n}=e;e.setValue=!1,w(n??null),v(W({value:n??null,...e,step:s})),u({value:n??null,source:{fromUi:!1}})},[e,s,u]);r.useEffect(()=>{e.setValue?_():u({value:l,source:{fromUi:!1}});const n=V.current;if(n){const i=f=>{f.preventDefault()};return n.addEventListener("wheel",i),()=>{n.removeEventListener("wheel",i)}}},[]),e.setValue&&_();const E=m(e.default)&&!t,lt=r.useCallback(()=>{const n=e.default??null;w(n),u({value:n,source:{fromUi:!0}})},[e]);kt({element:e,widgetMgr:a,onFormCleared:lt});const ct=n=>{const{value:i}=n.target;if(i==="")T(!0),w(null),v(null);else{let f;e.dataType===y.DataType.INT?f=parseInt(i,10):f=parseFloat(i),T(!0),w(f),v(i)}},N=r.useCallback(()=>{R&&(T(!0),u({value:(l??g)+s,source:{fromUi:!0}}))},[l,g,s,R]),z=r.useCallback(()=>{k&&(T(!0),u({value:(l??h)-s,source:{fromUi:!0}}))},[l,h,s,k]),ut=r.useCallback(n=>{const{key:i}=n;switch(i){case"ArrowUp":n.preventDefault(),N();break;case"ArrowDown":n.preventDefault(),z();break}},[N,z]),dt=r.useCallback(n=>{n.key==="Enter"&&(I&&u({value:l,source:{fromUi:!0}}),a.allowFormEnterToSubmit(p)&&a.submitForm(p,b))},[I,l,u,a,p,b]),G=C==null?void 0:C.startsWith(":material"),pt=G?"lg":"base",ft=q(o.iconSizes.lg)+2*q(o.spacing.twoXS),bt=C?o.breakpoints.hideNumberInputControls+ft:o.breakpoints.hideNumberInputControls;return F("div",{className:"stNumberInput","data-testid":"stNumberInput",ref:ot,children:[c(St,{label:e.label,disabled:t,labelVisibility:yt((X=e.labelVisibility)==null?void 0:X.value),htmlFor:O.current,children:e.help&&c(Ct,{children:c(Tt,{content:e.help,placement:wt.TOP_RIGHT})})}),F(Bt,{className:A?"focused":"","data-testid":"stNumberInputContainer",children:[c(Dt,{type:"number",inputRef:V,value:U??"",placeholder:e.placeholder,onBlur:st,onFocus:it,onChange:ct,onKeyPress:dt,onKeyDown:ut,clearable:E,clearOnEscape:E,disabled:t,"aria-label":e.label,startEnhancer:e.icon&&c(vt,{"data-testid":"stNumberInputIcon",iconValue:e.icon,size:pt}),id:O.current,overrides:{ClearIconContainer:{style:{padding:0}},ClearIcon:{props:{overrides:{Svg:{style:{color:o.colors.darkGray,padding:o.spacing.threeXS,height:o.sizes.clearIconSize,width:o.sizes.clearIconSize,":hover":{fill:o.colors.bodyText}}}}}},Input:{props:{"data-testid":"stNumberInputField",step:s,min:g,max:h,type:"number",inputMode:""},style:{lineHeight:o.lineHeights.inputWidget,paddingRight:o.spacing.sm,paddingLeft:o.spacing.md,paddingBottom:o.spacing.sm,paddingTop:o.spacing.sm}},InputContainer:{style:()=>({borderTopRightRadius:0,borderBottomRightRadius:0})},Root:{style:{borderTopRightRadius:0,borderBottomRightRadius:0,borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeftWidth:0,borderRightWidth:0,borderTopWidth:0,borderBottomWidth:0,paddingRight:0,paddingLeft:C?o.spacing.sm:0}},StartEnhancer:{style:{paddingLeft:0,paddingRight:0,minWidth:o.iconSizes.lg,color:G?o.colors.fadedText60:"inherit"}}}}),H>bt&&F(Lt,{children:[c(J,{"data-testid":"stNumberInputStepDown",onClick:z,disabled:!k||t,tabIndex:-1,children:c(K,{content:tt,size:"xs",color:k?"inherit":o.colors.disabled})}),c(J,{"data-testid":"stNumberInputStepUp",onClick:N,disabled:!R||t,tabIndex:-1,children:c(K,{content:et,size:"xs",color:R?"inherit":o.colors.disabled})})]})]}),at&&c(Ht,{clearable:E,children:c(Rt,{dirty:I,value:U??"",inForm:j,allowEnterToSubmit:nt})})]})},Xt=r.memo(Pt);export{Xt as default};
@@ -1,2 +1,2 @@
1
- import{n as jt,r as Et,j as st,F as Vt}from"./index.PoIwzrI7.js";/*! @license DOMPurify 3.2.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.5/LICENSE */const{entries:gt,setPrototypeOf:lt,isFrozen:$t,getPrototypeOf:qt,getOwnPropertyDescriptor:Kt}=Object;let{freeze:S,seal:y,create:At}=Object,{apply:Ce,construct:we}=typeof Reflect<"u"&&Reflect;S||(S=function(n){return n});y||(y=function(n){return n});Ce||(Ce=function(n,s,l){return n.apply(s,l)});we||(we=function(n,s){return new n(...s)});const se=R(Array.prototype.forEach),Zt=R(Array.prototype.lastIndexOf),ct=R(Array.prototype.pop),V=R(Array.prototype.push),Jt=R(Array.prototype.splice),ce=R(String.prototype.toLowerCase),be=R(String.prototype.toString),ft=R(String.prototype.match),$=R(String.prototype.replace),Qt=R(String.prototype.indexOf),en=R(String.prototype.trim),L=R(Object.prototype.hasOwnProperty),h=R(RegExp.prototype.test),q=tn(TypeError);function R(a){return function(n){n instanceof RegExp&&(n.lastIndex=0);for(var s=arguments.length,l=new Array(s>1?s-1:0),T=1;T<s;T++)l[T-1]=arguments[T];return Ce(a,n,l)}}function tn(a){return function(){for(var n=arguments.length,s=new Array(n),l=0;l<n;l++)s[l]=arguments[l];return we(a,s)}}function r(a,n){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ce;lt&&lt(a,null);let l=n.length;for(;l--;){let T=n[l];if(typeof T=="string"){const D=s(T);D!==T&&($t(n)||(n[l]=D),T=D)}a[T]=!0}return a}function nn(a){for(let n=0;n<a.length;n++)L(a,n)||(a[n]=null);return a}function w(a){const n=At(null);for(const[s,l]of gt(a))L(a,s)&&(Array.isArray(l)?n[s]=nn(l):l&&typeof l=="object"&&l.constructor===Object?n[s]=w(l):n[s]=l);return n}function K(a,n){for(;a!==null;){const l=Kt(a,n);if(l){if(l.get)return R(l.get);if(typeof l.value=="function")return R(l.value)}a=qt(a)}function s(){return null}return s}const ut=S(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Ne=S(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),De=S(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),on=S(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Ie=S(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),an=S(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),mt=S(["#text"]),pt=S(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Me=S(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),dt=S(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),le=S(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),rn=y(/\{\{[\w\W]*|[\w\W]*\}\}/gm),sn=y(/<%[\w\W]*|[\w\W]*%>/gm),ln=y(/\$\{[\w\W]*/gm),cn=y(/^data-[\-\w.\u00B7-\uFFFF]+$/),fn=y(/^aria-[\-\w]+$/),ht=y(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),un=y(/^(?:\w+script|data):/i),mn=y(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),St=y(/^html$/i),pn=y(/^[a-z][.\w]*(-[.\w]+)+$/i);var Tt=Object.freeze({__proto__:null,ARIA_ATTR:fn,ATTR_WHITESPACE:mn,CUSTOM_ELEMENT:pn,DATA_ATTR:cn,DOCTYPE_NAME:St,ERB_EXPR:sn,IS_ALLOWED_URI:ht,IS_SCRIPT_OR_DATA:un,MUSTACHE_EXPR:rn,TMPLIT_EXPR:ln});const Z={element:1,text:3,progressingInstruction:7,comment:8,document:9},dn=function(){return typeof window>"u"?null:window},Tn=function(n,s){if(typeof n!="object"||typeof n.createPolicy!="function")return null;let l=null;const T="data-tt-policy-suffix";s&&s.hasAttribute(T)&&(l=s.getAttribute(T));const D="dompurify"+(l?"#"+l:"");try{return n.createPolicy(D,{createHTML(x){return x},createScriptURL(x){return x}})}catch{return console.warn("TrustedTypes policy "+D+" could not be created."),null}},_t=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Rt(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:dn();const n=i=>Rt(i);if(n.version="3.2.5",n.removed=[],!a||!a.document||a.document.nodeType!==Z.document||!a.Element)return n.isSupported=!1,n;let{document:s}=a;const l=s,T=l.currentScript,{DocumentFragment:D,HTMLTemplateElement:x,Node:fe,Element:ke,NodeFilter:z,NamedNodeMap:Ot=a.NamedNodeMap||a.MozNamedAttrMap,HTMLFormElement:yt,DOMParser:Lt,trustedTypes:J}=a,G=ke.prototype,bt=K(G,"cloneNode"),Nt=K(G,"remove"),Dt=K(G,"nextSibling"),It=K(G,"childNodes"),Q=K(G,"parentNode");if(typeof x=="function"){const i=s.createElement("template");i.content&&i.content.ownerDocument&&(s=i.content.ownerDocument)}let E,W="";const{implementation:ue,createNodeIterator:Mt,createDocumentFragment:Ct,getElementsByTagName:wt}=s,{importNode:xt}=l;let g=_t();n.isSupported=typeof gt=="function"&&typeof Q=="function"&&ue&&ue.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:me,ERB_EXPR:pe,TMPLIT_EXPR:de,DATA_ATTR:Pt,ARIA_ATTR:kt,IS_SCRIPT_OR_DATA:vt,ATTR_WHITESPACE:ve,CUSTOM_ELEMENT:Ut}=Tt;let{IS_ALLOWED_URI:Ue}=Tt,u=null;const Fe=r({},[...ut,...Ne,...De,...Ie,...mt]);let p=null;const He=r({},[...pt,...Me,...dt,...le]);let f=Object.seal(At(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),B=null,Te=null,ze=!0,_e=!0,Ge=!1,We=!0,P=!1,Ee=!0,C=!1,ge=!1,Ae=!1,k=!1,ee=!1,te=!1,Be=!0,Ye=!1;const Ft="user-content-";let he=!0,Y=!1,v={},U=null;const Xe=r({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let je=null;const Ve=r({},["audio","video","img","source","image","track"]);let Se=null;const $e=r({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ne="http://www.w3.org/1998/Math/MathML",oe="http://www.w3.org/2000/svg",I="http://www.w3.org/1999/xhtml";let F=I,Re=!1,Oe=null;const Ht=r({},[ne,oe,I],be);let ie=r({},["mi","mo","mn","ms","mtext"]),ae=r({},["annotation-xml"]);const zt=r({},["title","style","font","a","script"]);let X=null;const Gt=["application/xhtml+xml","text/html"],Wt="text/html";let m=null,H=null;const Bt=s.createElement("form"),qe=function(e){return e instanceof RegExp||e instanceof Function},ye=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(H&&H===e)){if((!e||typeof e!="object")&&(e={}),e=w(e),X=Gt.indexOf(e.PARSER_MEDIA_TYPE)===-1?Wt:e.PARSER_MEDIA_TYPE,m=X==="application/xhtml+xml"?be:ce,u=L(e,"ALLOWED_TAGS")?r({},e.ALLOWED_TAGS,m):Fe,p=L(e,"ALLOWED_ATTR")?r({},e.ALLOWED_ATTR,m):He,Oe=L(e,"ALLOWED_NAMESPACES")?r({},e.ALLOWED_NAMESPACES,be):Ht,Se=L(e,"ADD_URI_SAFE_ATTR")?r(w($e),e.ADD_URI_SAFE_ATTR,m):$e,je=L(e,"ADD_DATA_URI_TAGS")?r(w(Ve),e.ADD_DATA_URI_TAGS,m):Ve,U=L(e,"FORBID_CONTENTS")?r({},e.FORBID_CONTENTS,m):Xe,B=L(e,"FORBID_TAGS")?r({},e.FORBID_TAGS,m):{},Te=L(e,"FORBID_ATTR")?r({},e.FORBID_ATTR,m):{},v=L(e,"USE_PROFILES")?e.USE_PROFILES:!1,ze=e.ALLOW_ARIA_ATTR!==!1,_e=e.ALLOW_DATA_ATTR!==!1,Ge=e.ALLOW_UNKNOWN_PROTOCOLS||!1,We=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,P=e.SAFE_FOR_TEMPLATES||!1,Ee=e.SAFE_FOR_XML!==!1,C=e.WHOLE_DOCUMENT||!1,k=e.RETURN_DOM||!1,ee=e.RETURN_DOM_FRAGMENT||!1,te=e.RETURN_TRUSTED_TYPE||!1,Ae=e.FORCE_BODY||!1,Be=e.SANITIZE_DOM!==!1,Ye=e.SANITIZE_NAMED_PROPS||!1,he=e.KEEP_CONTENT!==!1,Y=e.IN_PLACE||!1,Ue=e.ALLOWED_URI_REGEXP||ht,F=e.NAMESPACE||I,ie=e.MATHML_TEXT_INTEGRATION_POINTS||ie,ae=e.HTML_INTEGRATION_POINTS||ae,f=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&qe(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(f.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&qe(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(f.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(f.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),P&&(_e=!1),ee&&(k=!0),v&&(u=r({},mt),p=[],v.html===!0&&(r(u,ut),r(p,pt)),v.svg===!0&&(r(u,Ne),r(p,Me),r(p,le)),v.svgFilters===!0&&(r(u,De),r(p,Me),r(p,le)),v.mathMl===!0&&(r(u,Ie),r(p,dt),r(p,le))),e.ADD_TAGS&&(u===Fe&&(u=w(u)),r(u,e.ADD_TAGS,m)),e.ADD_ATTR&&(p===He&&(p=w(p)),r(p,e.ADD_ATTR,m)),e.ADD_URI_SAFE_ATTR&&r(Se,e.ADD_URI_SAFE_ATTR,m),e.FORBID_CONTENTS&&(U===Xe&&(U=w(U)),r(U,e.FORBID_CONTENTS,m)),he&&(u["#text"]=!0),C&&r(u,["html","head","body"]),u.table&&(r(u,["tbody"]),delete B.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw q('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw q('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');E=e.TRUSTED_TYPES_POLICY,W=E.createHTML("")}else E===void 0&&(E=Tn(J,T)),E!==null&&typeof W=="string"&&(W=E.createHTML(""));S&&S(e),H=e}},Ke=r({},[...Ne,...De,...on]),Ze=r({},[...Ie,...an]),Yt=function(e){let t=Q(e);(!t||!t.tagName)&&(t={namespaceURI:F,tagName:"template"});const o=ce(e.tagName),c=ce(t.tagName);return Oe[e.namespaceURI]?e.namespaceURI===oe?t.namespaceURI===I?o==="svg":t.namespaceURI===ne?o==="svg"&&(c==="annotation-xml"||ie[c]):!!Ke[o]:e.namespaceURI===ne?t.namespaceURI===I?o==="math":t.namespaceURI===oe?o==="math"&&ae[c]:!!Ze[o]:e.namespaceURI===I?t.namespaceURI===oe&&!ae[c]||t.namespaceURI===ne&&!ie[c]?!1:!Ze[o]&&(zt[o]||!Ke[o]):!!(X==="application/xhtml+xml"&&Oe[e.namespaceURI]):!1},b=function(e){V(n.removed,{element:e});try{Q(e).removeChild(e)}catch{Nt(e)}},re=function(e,t){try{V(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch{V(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),e==="is")if(k||ee)try{b(t)}catch{}else try{t.setAttribute(e,"")}catch{}},Je=function(e){let t=null,o=null;if(Ae)e="<remove></remove>"+e;else{const d=ft(e,/^[\r\n\t ]+/);o=d&&d[0]}X==="application/xhtml+xml"&&F===I&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const c=E?E.createHTML(e):e;if(F===I)try{t=new Lt().parseFromString(c,X)}catch{}if(!t||!t.documentElement){t=ue.createDocument(F,"template",null);try{t.documentElement.innerHTML=Re?W:c}catch{}}const _=t.body||t.documentElement;return e&&o&&_.insertBefore(s.createTextNode(o),_.childNodes[0]||null),F===I?wt.call(t,C?"html":"body")[0]:C?t.documentElement:_},Qe=function(e){return Mt.call(e.ownerDocument||e,e,z.SHOW_ELEMENT|z.SHOW_COMMENT|z.SHOW_TEXT|z.SHOW_PROCESSING_INSTRUCTION|z.SHOW_CDATA_SECTION,null)},Le=function(e){return e instanceof yt&&(typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||!(e.attributes instanceof Ot)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function")},et=function(e){return typeof fe=="function"&&e instanceof fe};function M(i,e,t){se(i,o=>{o.call(n,e,t,H)})}const tt=function(e){let t=null;if(M(g.beforeSanitizeElements,e,null),Le(e))return b(e),!0;const o=m(e.nodeName);if(M(g.uponSanitizeElement,e,{tagName:o,allowedTags:u}),e.hasChildNodes()&&!et(e.firstElementChild)&&h(/<[/\w!]/g,e.innerHTML)&&h(/<[/\w!]/g,e.textContent)||e.nodeType===Z.progressingInstruction||Ee&&e.nodeType===Z.comment&&h(/<[/\w]/g,e.data))return b(e),!0;if(!u[o]||B[o]){if(!B[o]&&ot(o)&&(f.tagNameCheck instanceof RegExp&&h(f.tagNameCheck,o)||f.tagNameCheck instanceof Function&&f.tagNameCheck(o)))return!1;if(he&&!U[o]){const c=Q(e)||e.parentNode,_=It(e)||e.childNodes;if(_&&c){const d=_.length;for(let O=d-1;O>=0;--O){const N=bt(_[O],!0);N.__removalCount=(e.__removalCount||0)+1,c.insertBefore(N,Dt(e))}}}return b(e),!0}return e instanceof ke&&!Yt(e)||(o==="noscript"||o==="noembed"||o==="noframes")&&h(/<\/no(script|embed|frames)/i,e.innerHTML)?(b(e),!0):(P&&e.nodeType===Z.text&&(t=e.textContent,se([me,pe,de],c=>{t=$(t,c," ")}),e.textContent!==t&&(V(n.removed,{element:e.cloneNode()}),e.textContent=t)),M(g.afterSanitizeElements,e,null),!1)},nt=function(e,t,o){if(Be&&(t==="id"||t==="name")&&(o in s||o in Bt))return!1;if(!(_e&&!Te[t]&&h(Pt,t))){if(!(ze&&h(kt,t))){if(!p[t]||Te[t]){if(!(ot(e)&&(f.tagNameCheck instanceof RegExp&&h(f.tagNameCheck,e)||f.tagNameCheck instanceof Function&&f.tagNameCheck(e))&&(f.attributeNameCheck instanceof RegExp&&h(f.attributeNameCheck,t)||f.attributeNameCheck instanceof Function&&f.attributeNameCheck(t))||t==="is"&&f.allowCustomizedBuiltInElements&&(f.tagNameCheck instanceof RegExp&&h(f.tagNameCheck,o)||f.tagNameCheck instanceof Function&&f.tagNameCheck(o))))return!1}else if(!Se[t]){if(!h(Ue,$(o,ve,""))){if(!((t==="src"||t==="xlink:href"||t==="href")&&e!=="script"&&Qt(o,"data:")===0&&je[e])){if(!(Ge&&!h(vt,$(o,ve,"")))){if(o)return!1}}}}}}return!0},ot=function(e){return e!=="annotation-xml"&&ft(e,Ut)},it=function(e){M(g.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||Le(e))return;const o={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:p,forceKeepAttr:void 0};let c=t.length;for(;c--;){const _=t[c],{name:d,namespaceURI:O,value:N}=_,j=m(d);let A=d==="value"?N:en(N);if(o.attrName=j,o.attrValue=A,o.keepAttr=!0,o.forceKeepAttr=void 0,M(g.uponSanitizeAttribute,e,o),A=o.attrValue,Ye&&(j==="id"||j==="name")&&(re(d,e),A=Ft+A),Ee&&h(/((--!?|])>)|<\/(style|title)/i,A)){re(d,e);continue}if(o.forceKeepAttr||(re(d,e),!o.keepAttr))continue;if(!We&&h(/\/>/i,A)){re(d,e);continue}P&&se([me,pe,de],rt=>{A=$(A,rt," ")});const at=m(e.nodeName);if(nt(at,j,A)){if(E&&typeof J=="object"&&typeof J.getAttributeType=="function"&&!O)switch(J.getAttributeType(at,j)){case"TrustedHTML":{A=E.createHTML(A);break}case"TrustedScriptURL":{A=E.createScriptURL(A);break}}try{O?e.setAttributeNS(O,d,A):e.setAttribute(d,A),Le(e)?b(e):ct(n.removed)}catch{}}}M(g.afterSanitizeAttributes,e,null)},Xt=function i(e){let t=null;const o=Qe(e);for(M(g.beforeSanitizeShadowDOM,e,null);t=o.nextNode();)M(g.uponSanitizeShadowNode,t,null),tt(t),it(t),t.content instanceof D&&i(t.content);M(g.afterSanitizeShadowDOM,e,null)};return n.sanitize=function(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=null,o=null,c=null,_=null;if(Re=!i,Re&&(i="<!-->"),typeof i!="string"&&!et(i))if(typeof i.toString=="function"){if(i=i.toString(),typeof i!="string")throw q("dirty is not a string, aborting")}else throw q("toString is not a function");if(!n.isSupported)return i;if(ge||ye(e),n.removed=[],typeof i=="string"&&(Y=!1),Y){if(i.nodeName){const N=m(i.nodeName);if(!u[N]||B[N])throw q("root node is forbidden and cannot be sanitized in-place")}}else if(i instanceof fe)t=Je("<!---->"),o=t.ownerDocument.importNode(i,!0),o.nodeType===Z.element&&o.nodeName==="BODY"||o.nodeName==="HTML"?t=o:t.appendChild(o);else{if(!k&&!P&&!C&&i.indexOf("<")===-1)return E&&te?E.createHTML(i):i;if(t=Je(i),!t)return k?null:te?W:""}t&&Ae&&b(t.firstChild);const d=Qe(Y?i:t);for(;c=d.nextNode();)tt(c),it(c),c.content instanceof D&&Xt(c.content);if(Y)return i;if(k){if(ee)for(_=Ct.call(t.ownerDocument);t.firstChild;)_.appendChild(t.firstChild);else _=t;return(p.shadowroot||p.shadowrootmode)&&(_=xt.call(l,_,!0)),_}let O=C?t.outerHTML:t.innerHTML;return C&&u["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&h(St,t.ownerDocument.doctype.name)&&(O="<!DOCTYPE "+t.ownerDocument.doctype.name+`>
1
+ import{n as jt,r as Et,j as st,F as Vt}from"./index.C1TEsRV0.js";/*! @license DOMPurify 3.2.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.5/LICENSE */const{entries:gt,setPrototypeOf:lt,isFrozen:$t,getPrototypeOf:qt,getOwnPropertyDescriptor:Kt}=Object;let{freeze:S,seal:y,create:At}=Object,{apply:Ce,construct:we}=typeof Reflect<"u"&&Reflect;S||(S=function(n){return n});y||(y=function(n){return n});Ce||(Ce=function(n,s,l){return n.apply(s,l)});we||(we=function(n,s){return new n(...s)});const se=R(Array.prototype.forEach),Zt=R(Array.prototype.lastIndexOf),ct=R(Array.prototype.pop),V=R(Array.prototype.push),Jt=R(Array.prototype.splice),ce=R(String.prototype.toLowerCase),be=R(String.prototype.toString),ft=R(String.prototype.match),$=R(String.prototype.replace),Qt=R(String.prototype.indexOf),en=R(String.prototype.trim),L=R(Object.prototype.hasOwnProperty),h=R(RegExp.prototype.test),q=tn(TypeError);function R(a){return function(n){n instanceof RegExp&&(n.lastIndex=0);for(var s=arguments.length,l=new Array(s>1?s-1:0),T=1;T<s;T++)l[T-1]=arguments[T];return Ce(a,n,l)}}function tn(a){return function(){for(var n=arguments.length,s=new Array(n),l=0;l<n;l++)s[l]=arguments[l];return we(a,s)}}function r(a,n){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ce;lt&&lt(a,null);let l=n.length;for(;l--;){let T=n[l];if(typeof T=="string"){const D=s(T);D!==T&&($t(n)||(n[l]=D),T=D)}a[T]=!0}return a}function nn(a){for(let n=0;n<a.length;n++)L(a,n)||(a[n]=null);return a}function w(a){const n=At(null);for(const[s,l]of gt(a))L(a,s)&&(Array.isArray(l)?n[s]=nn(l):l&&typeof l=="object"&&l.constructor===Object?n[s]=w(l):n[s]=l);return n}function K(a,n){for(;a!==null;){const l=Kt(a,n);if(l){if(l.get)return R(l.get);if(typeof l.value=="function")return R(l.value)}a=qt(a)}function s(){return null}return s}const ut=S(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Ne=S(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),De=S(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),on=S(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Ie=S(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),an=S(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),mt=S(["#text"]),pt=S(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Me=S(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),dt=S(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),le=S(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),rn=y(/\{\{[\w\W]*|[\w\W]*\}\}/gm),sn=y(/<%[\w\W]*|[\w\W]*%>/gm),ln=y(/\$\{[\w\W]*/gm),cn=y(/^data-[\-\w.\u00B7-\uFFFF]+$/),fn=y(/^aria-[\-\w]+$/),ht=y(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),un=y(/^(?:\w+script|data):/i),mn=y(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),St=y(/^html$/i),pn=y(/^[a-z][.\w]*(-[.\w]+)+$/i);var Tt=Object.freeze({__proto__:null,ARIA_ATTR:fn,ATTR_WHITESPACE:mn,CUSTOM_ELEMENT:pn,DATA_ATTR:cn,DOCTYPE_NAME:St,ERB_EXPR:sn,IS_ALLOWED_URI:ht,IS_SCRIPT_OR_DATA:un,MUSTACHE_EXPR:rn,TMPLIT_EXPR:ln});const Z={element:1,text:3,progressingInstruction:7,comment:8,document:9},dn=function(){return typeof window>"u"?null:window},Tn=function(n,s){if(typeof n!="object"||typeof n.createPolicy!="function")return null;let l=null;const T="data-tt-policy-suffix";s&&s.hasAttribute(T)&&(l=s.getAttribute(T));const D="dompurify"+(l?"#"+l:"");try{return n.createPolicy(D,{createHTML(x){return x},createScriptURL(x){return x}})}catch{return console.warn("TrustedTypes policy "+D+" could not be created."),null}},_t=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Rt(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:dn();const n=i=>Rt(i);if(n.version="3.2.5",n.removed=[],!a||!a.document||a.document.nodeType!==Z.document||!a.Element)return n.isSupported=!1,n;let{document:s}=a;const l=s,T=l.currentScript,{DocumentFragment:D,HTMLTemplateElement:x,Node:fe,Element:ke,NodeFilter:z,NamedNodeMap:Ot=a.NamedNodeMap||a.MozNamedAttrMap,HTMLFormElement:yt,DOMParser:Lt,trustedTypes:J}=a,G=ke.prototype,bt=K(G,"cloneNode"),Nt=K(G,"remove"),Dt=K(G,"nextSibling"),It=K(G,"childNodes"),Q=K(G,"parentNode");if(typeof x=="function"){const i=s.createElement("template");i.content&&i.content.ownerDocument&&(s=i.content.ownerDocument)}let E,W="";const{implementation:ue,createNodeIterator:Mt,createDocumentFragment:Ct,getElementsByTagName:wt}=s,{importNode:xt}=l;let g=_t();n.isSupported=typeof gt=="function"&&typeof Q=="function"&&ue&&ue.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:me,ERB_EXPR:pe,TMPLIT_EXPR:de,DATA_ATTR:Pt,ARIA_ATTR:kt,IS_SCRIPT_OR_DATA:vt,ATTR_WHITESPACE:ve,CUSTOM_ELEMENT:Ut}=Tt;let{IS_ALLOWED_URI:Ue}=Tt,u=null;const Fe=r({},[...ut,...Ne,...De,...Ie,...mt]);let p=null;const He=r({},[...pt,...Me,...dt,...le]);let f=Object.seal(At(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),B=null,Te=null,ze=!0,_e=!0,Ge=!1,We=!0,P=!1,Ee=!0,C=!1,ge=!1,Ae=!1,k=!1,ee=!1,te=!1,Be=!0,Ye=!1;const Ft="user-content-";let he=!0,Y=!1,v={},U=null;const Xe=r({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let je=null;const Ve=r({},["audio","video","img","source","image","track"]);let Se=null;const $e=r({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ne="http://www.w3.org/1998/Math/MathML",oe="http://www.w3.org/2000/svg",I="http://www.w3.org/1999/xhtml";let F=I,Re=!1,Oe=null;const Ht=r({},[ne,oe,I],be);let ie=r({},["mi","mo","mn","ms","mtext"]),ae=r({},["annotation-xml"]);const zt=r({},["title","style","font","a","script"]);let X=null;const Gt=["application/xhtml+xml","text/html"],Wt="text/html";let m=null,H=null;const Bt=s.createElement("form"),qe=function(e){return e instanceof RegExp||e instanceof Function},ye=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(H&&H===e)){if((!e||typeof e!="object")&&(e={}),e=w(e),X=Gt.indexOf(e.PARSER_MEDIA_TYPE)===-1?Wt:e.PARSER_MEDIA_TYPE,m=X==="application/xhtml+xml"?be:ce,u=L(e,"ALLOWED_TAGS")?r({},e.ALLOWED_TAGS,m):Fe,p=L(e,"ALLOWED_ATTR")?r({},e.ALLOWED_ATTR,m):He,Oe=L(e,"ALLOWED_NAMESPACES")?r({},e.ALLOWED_NAMESPACES,be):Ht,Se=L(e,"ADD_URI_SAFE_ATTR")?r(w($e),e.ADD_URI_SAFE_ATTR,m):$e,je=L(e,"ADD_DATA_URI_TAGS")?r(w(Ve),e.ADD_DATA_URI_TAGS,m):Ve,U=L(e,"FORBID_CONTENTS")?r({},e.FORBID_CONTENTS,m):Xe,B=L(e,"FORBID_TAGS")?r({},e.FORBID_TAGS,m):{},Te=L(e,"FORBID_ATTR")?r({},e.FORBID_ATTR,m):{},v=L(e,"USE_PROFILES")?e.USE_PROFILES:!1,ze=e.ALLOW_ARIA_ATTR!==!1,_e=e.ALLOW_DATA_ATTR!==!1,Ge=e.ALLOW_UNKNOWN_PROTOCOLS||!1,We=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,P=e.SAFE_FOR_TEMPLATES||!1,Ee=e.SAFE_FOR_XML!==!1,C=e.WHOLE_DOCUMENT||!1,k=e.RETURN_DOM||!1,ee=e.RETURN_DOM_FRAGMENT||!1,te=e.RETURN_TRUSTED_TYPE||!1,Ae=e.FORCE_BODY||!1,Be=e.SANITIZE_DOM!==!1,Ye=e.SANITIZE_NAMED_PROPS||!1,he=e.KEEP_CONTENT!==!1,Y=e.IN_PLACE||!1,Ue=e.ALLOWED_URI_REGEXP||ht,F=e.NAMESPACE||I,ie=e.MATHML_TEXT_INTEGRATION_POINTS||ie,ae=e.HTML_INTEGRATION_POINTS||ae,f=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&qe(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(f.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&qe(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(f.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(f.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),P&&(_e=!1),ee&&(k=!0),v&&(u=r({},mt),p=[],v.html===!0&&(r(u,ut),r(p,pt)),v.svg===!0&&(r(u,Ne),r(p,Me),r(p,le)),v.svgFilters===!0&&(r(u,De),r(p,Me),r(p,le)),v.mathMl===!0&&(r(u,Ie),r(p,dt),r(p,le))),e.ADD_TAGS&&(u===Fe&&(u=w(u)),r(u,e.ADD_TAGS,m)),e.ADD_ATTR&&(p===He&&(p=w(p)),r(p,e.ADD_ATTR,m)),e.ADD_URI_SAFE_ATTR&&r(Se,e.ADD_URI_SAFE_ATTR,m),e.FORBID_CONTENTS&&(U===Xe&&(U=w(U)),r(U,e.FORBID_CONTENTS,m)),he&&(u["#text"]=!0),C&&r(u,["html","head","body"]),u.table&&(r(u,["tbody"]),delete B.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw q('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw q('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');E=e.TRUSTED_TYPES_POLICY,W=E.createHTML("")}else E===void 0&&(E=Tn(J,T)),E!==null&&typeof W=="string"&&(W=E.createHTML(""));S&&S(e),H=e}},Ke=r({},[...Ne,...De,...on]),Ze=r({},[...Ie,...an]),Yt=function(e){let t=Q(e);(!t||!t.tagName)&&(t={namespaceURI:F,tagName:"template"});const o=ce(e.tagName),c=ce(t.tagName);return Oe[e.namespaceURI]?e.namespaceURI===oe?t.namespaceURI===I?o==="svg":t.namespaceURI===ne?o==="svg"&&(c==="annotation-xml"||ie[c]):!!Ke[o]:e.namespaceURI===ne?t.namespaceURI===I?o==="math":t.namespaceURI===oe?o==="math"&&ae[c]:!!Ze[o]:e.namespaceURI===I?t.namespaceURI===oe&&!ae[c]||t.namespaceURI===ne&&!ie[c]?!1:!Ze[o]&&(zt[o]||!Ke[o]):!!(X==="application/xhtml+xml"&&Oe[e.namespaceURI]):!1},b=function(e){V(n.removed,{element:e});try{Q(e).removeChild(e)}catch{Nt(e)}},re=function(e,t){try{V(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch{V(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),e==="is")if(k||ee)try{b(t)}catch{}else try{t.setAttribute(e,"")}catch{}},Je=function(e){let t=null,o=null;if(Ae)e="<remove></remove>"+e;else{const d=ft(e,/^[\r\n\t ]+/);o=d&&d[0]}X==="application/xhtml+xml"&&F===I&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const c=E?E.createHTML(e):e;if(F===I)try{t=new Lt().parseFromString(c,X)}catch{}if(!t||!t.documentElement){t=ue.createDocument(F,"template",null);try{t.documentElement.innerHTML=Re?W:c}catch{}}const _=t.body||t.documentElement;return e&&o&&_.insertBefore(s.createTextNode(o),_.childNodes[0]||null),F===I?wt.call(t,C?"html":"body")[0]:C?t.documentElement:_},Qe=function(e){return Mt.call(e.ownerDocument||e,e,z.SHOW_ELEMENT|z.SHOW_COMMENT|z.SHOW_TEXT|z.SHOW_PROCESSING_INSTRUCTION|z.SHOW_CDATA_SECTION,null)},Le=function(e){return e instanceof yt&&(typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||!(e.attributes instanceof Ot)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function")},et=function(e){return typeof fe=="function"&&e instanceof fe};function M(i,e,t){se(i,o=>{o.call(n,e,t,H)})}const tt=function(e){let t=null;if(M(g.beforeSanitizeElements,e,null),Le(e))return b(e),!0;const o=m(e.nodeName);if(M(g.uponSanitizeElement,e,{tagName:o,allowedTags:u}),e.hasChildNodes()&&!et(e.firstElementChild)&&h(/<[/\w!]/g,e.innerHTML)&&h(/<[/\w!]/g,e.textContent)||e.nodeType===Z.progressingInstruction||Ee&&e.nodeType===Z.comment&&h(/<[/\w]/g,e.data))return b(e),!0;if(!u[o]||B[o]){if(!B[o]&&ot(o)&&(f.tagNameCheck instanceof RegExp&&h(f.tagNameCheck,o)||f.tagNameCheck instanceof Function&&f.tagNameCheck(o)))return!1;if(he&&!U[o]){const c=Q(e)||e.parentNode,_=It(e)||e.childNodes;if(_&&c){const d=_.length;for(let O=d-1;O>=0;--O){const N=bt(_[O],!0);N.__removalCount=(e.__removalCount||0)+1,c.insertBefore(N,Dt(e))}}}return b(e),!0}return e instanceof ke&&!Yt(e)||(o==="noscript"||o==="noembed"||o==="noframes")&&h(/<\/no(script|embed|frames)/i,e.innerHTML)?(b(e),!0):(P&&e.nodeType===Z.text&&(t=e.textContent,se([me,pe,de],c=>{t=$(t,c," ")}),e.textContent!==t&&(V(n.removed,{element:e.cloneNode()}),e.textContent=t)),M(g.afterSanitizeElements,e,null),!1)},nt=function(e,t,o){if(Be&&(t==="id"||t==="name")&&(o in s||o in Bt))return!1;if(!(_e&&!Te[t]&&h(Pt,t))){if(!(ze&&h(kt,t))){if(!p[t]||Te[t]){if(!(ot(e)&&(f.tagNameCheck instanceof RegExp&&h(f.tagNameCheck,e)||f.tagNameCheck instanceof Function&&f.tagNameCheck(e))&&(f.attributeNameCheck instanceof RegExp&&h(f.attributeNameCheck,t)||f.attributeNameCheck instanceof Function&&f.attributeNameCheck(t))||t==="is"&&f.allowCustomizedBuiltInElements&&(f.tagNameCheck instanceof RegExp&&h(f.tagNameCheck,o)||f.tagNameCheck instanceof Function&&f.tagNameCheck(o))))return!1}else if(!Se[t]){if(!h(Ue,$(o,ve,""))){if(!((t==="src"||t==="xlink:href"||t==="href")&&e!=="script"&&Qt(o,"data:")===0&&je[e])){if(!(Ge&&!h(vt,$(o,ve,"")))){if(o)return!1}}}}}}return!0},ot=function(e){return e!=="annotation-xml"&&ft(e,Ut)},it=function(e){M(g.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||Le(e))return;const o={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:p,forceKeepAttr:void 0};let c=t.length;for(;c--;){const _=t[c],{name:d,namespaceURI:O,value:N}=_,j=m(d);let A=d==="value"?N:en(N);if(o.attrName=j,o.attrValue=A,o.keepAttr=!0,o.forceKeepAttr=void 0,M(g.uponSanitizeAttribute,e,o),A=o.attrValue,Ye&&(j==="id"||j==="name")&&(re(d,e),A=Ft+A),Ee&&h(/((--!?|])>)|<\/(style|title)/i,A)){re(d,e);continue}if(o.forceKeepAttr||(re(d,e),!o.keepAttr))continue;if(!We&&h(/\/>/i,A)){re(d,e);continue}P&&se([me,pe,de],rt=>{A=$(A,rt," ")});const at=m(e.nodeName);if(nt(at,j,A)){if(E&&typeof J=="object"&&typeof J.getAttributeType=="function"&&!O)switch(J.getAttributeType(at,j)){case"TrustedHTML":{A=E.createHTML(A);break}case"TrustedScriptURL":{A=E.createScriptURL(A);break}}try{O?e.setAttributeNS(O,d,A):e.setAttribute(d,A),Le(e)?b(e):ct(n.removed)}catch{}}}M(g.afterSanitizeAttributes,e,null)},Xt=function i(e){let t=null;const o=Qe(e);for(M(g.beforeSanitizeShadowDOM,e,null);t=o.nextNode();)M(g.uponSanitizeShadowNode,t,null),tt(t),it(t),t.content instanceof D&&i(t.content);M(g.afterSanitizeShadowDOM,e,null)};return n.sanitize=function(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=null,o=null,c=null,_=null;if(Re=!i,Re&&(i="<!-->"),typeof i!="string"&&!et(i))if(typeof i.toString=="function"){if(i=i.toString(),typeof i!="string")throw q("dirty is not a string, aborting")}else throw q("toString is not a function");if(!n.isSupported)return i;if(ge||ye(e),n.removed=[],typeof i=="string"&&(Y=!1),Y){if(i.nodeName){const N=m(i.nodeName);if(!u[N]||B[N])throw q("root node is forbidden and cannot be sanitized in-place")}}else if(i instanceof fe)t=Je("<!---->"),o=t.ownerDocument.importNode(i,!0),o.nodeType===Z.element&&o.nodeName==="BODY"||o.nodeName==="HTML"?t=o:t.appendChild(o);else{if(!k&&!P&&!C&&i.indexOf("<")===-1)return E&&te?E.createHTML(i):i;if(t=Je(i),!t)return k?null:te?W:""}t&&Ae&&b(t.firstChild);const d=Qe(Y?i:t);for(;c=d.nextNode();)tt(c),it(c),c.content instanceof D&&Xt(c.content);if(Y)return i;if(k){if(ee)for(_=Ct.call(t.ownerDocument);t.firstChild;)_.appendChild(t.firstChild);else _=t;return(p.shadowroot||p.shadowrootmode)&&(_=xt.call(l,_,!0)),_}let O=C?t.outerHTML:t.innerHTML;return C&&u["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&h(St,t.ownerDocument.doctype.name)&&(O="<!DOCTYPE "+t.ownerDocument.doctype.name+`>
2
2
  `+O),P&&se([me,pe,de],N=>{O=$(O,N," ")}),E&&te?E.createHTML(O):O},n.setConfig=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ye(i),ge=!0},n.clearConfig=function(){H=null,ge=!1},n.isValidAttribute=function(i,e,t){H||ye({});const o=m(i),c=m(e);return nt(o,c,t)},n.addHook=function(i,e){typeof e=="function"&&V(g[i],e)},n.removeHook=function(i,e){if(e!==void 0){const t=Zt(g[i],e);return t===-1?void 0:Jt(g[i],t,1)[0]}return ct(g[i])},n.removeHooks=function(i){g[i]=[]},n.removeAllHooks=function(){g=_t()},n}var Pe=Rt();const _n=jt("div",{target:"ez8s6cm0"})({width:"100%"}),xe="data-temp-href-target";Pe.addHook("beforeSanitizeAttributes",function(a){a instanceof HTMLElement&&a.hasAttribute("target")&&a.getAttribute("target")==="_blank"&&a.setAttribute(xe,"_blank")});Pe.addHook("afterSanitizeAttributes",function(a){a instanceof HTMLElement&&a.hasAttribute(xe)&&(a.setAttribute("target","_blank"),a.setAttribute("rel","noopener noreferrer"),a.removeAttribute(xe))});const En=a=>{const n={USE_PROFILES:{html:!0},FORCE_BODY:!0};return Pe.sanitize(a,n)};function gn({element:a}){const{body:n}=a,s=Et.useMemo(()=>En(n),[n]);return st(Vt,{children:s&&st(_n,{className:"stHtml","data-testid":"stHtml",dangerouslySetInnerHTML:{__html:s}})})}const hn=Et.memo(gn);export{hn as default};
@@ -1,4 +1,4 @@
1
- import{r as reactExports,j as jsx}from"./index.PoIwzrI7.js";/*!
1
+ import{r as reactExports,j as jsx}from"./index.C1TEsRV0.js";/*!
2
2
  * Copyright (c) 2012 - 2022, Anaconda, Inc., and Bokeh Contributors
3
3
  * All rights reserved.
4
4
  *
@@ -1 +1 @@
1
- import{r as c,E as C,_ as b,n as d,H as X,C as g,j as a,bl as m,bm as F,a$ as O,b0 as S,cn as _,co as q,be as G,F as K,bB as Y,aA as J,bg as Q,M as h,b as f,bi as Z,bh as ee,bo as te,bC as ie,bp as se,b5 as le,bq as ne}from"./index.PoIwzrI7.js";import{U as w,a as I}from"./UploadFileInfo.0DCkpDDf.js";import{F as ae}from"./FormClearHelper.Dd0v0IXt.js";import{g as M,F as y,b as oe,D as re,I as de,C as ce,a as pe,s as ge}from"./FileHelper.q7erXtkb.js";import{S as ue,P as he}from"./ProgressBar.DfcVR_JA.js";import{u as me}from"./Hooks.CchmJZGs.js";var B=c.forwardRef(function(e,s){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return c.createElement(C,b({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:s}),c.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),c.createElement("path",{d:"M19.35 10.04A7.49 7.49 0 0012 4C9.11 4 6.6 5.64 5.35 8.04A5.994 5.994 0 000 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM19 18H6c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97l1.07-.11.5-.95A5.469 5.469 0 0112 6c2.62 0 4.88 1.86 5.39 4.43l.3 1.5 1.53.11A2.98 2.98 0 0122 15c0 1.65-1.35 3-3 3zM8 13h2.55v3h2.9v-3H16l-4-4z"}))});B.displayName="CloudUpload";var D=c.forwardRef(function(e,s){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return c.createElement(C,b({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:s}),c.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}))});D.displayName="Error";const V=d("section",{target:"e16xj5sw0"})(({isDisabled:e,theme:s})=>({display:"flex",alignItems:"center",padding:s.spacing.lg,backgroundColor:s.colors.secondaryBg,borderRadius:s.radii.default,border:s.colors.widgetBorderColor?`${s.sizes.borderWidth} solid ${s.colors.widgetBorderColor}`:void 0,":focus":{outline:"none"},":focus-visible":{boxShadow:`0 0 0 1px ${s.colors.primary}`},color:e?s.colors.gray:s.colors.bodyText})),P=d("div",{target:"e16xj5sw1"})({marginRight:"auto",alignItems:"center",display:"flex"}),L=d("span",{target:"e16xj5sw2"})(({theme:e})=>({color:e.colors.darkenedBgMix100,marginRight:e.spacing.lg})),fe=d("span",{target:"e16xj5sw3"})(({theme:e})=>({marginBottom:e.spacing.twoXS})),Fe=d("div",{target:"e16xj5sw4"})({display:"flex",flexDirection:"column"}),j=d("div",{target:"e16xj5sw5"})(({theme:e})=>({left:0,right:0,lineHeight:e.lineHeights.tight,paddingTop:e.spacing.md,paddingLeft:e.spacing.lg,paddingRight:e.spacing.lg})),Se=d("ul",{target:"e16xj5sw6"})(({theme:e})=>({listStyleType:"none",margin:e.spacing.none,padding:e.spacing.none})),E=d("li",{target:"e16xj5sw7"})(({theme:e})=>({margin:e.spacing.none,padding:e.spacing.none})),A=d("div",{target:"e16xj5sw8"})(({theme:e})=>({display:"flex",alignItems:"baseline",flex:1,paddingLeft:e.spacing.lg,overflow:"hidden"})),W=d("div",{target:"e16xj5sw9"})(({theme:e})=>({marginRight:e.spacing.sm,marginBottom:e.spacing.twoXS,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})),k=d("div",{target:"e16xj5sw10"})(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing.twoXS})),ye=d("span",{target:"e16xj5sw11"})(({theme:e})=>({marginRight:e.spacing.twoXS})),xe=d("div",{target:"e16xj5sw12"})(({theme:e})=>({display:"flex",padding:e.spacing.twoXS,color:e.colors.darkenedBgMix100})),H=d("small",{target:"e16xj5sw13"})(({theme:e})=>({color:e.colors.red,fontSize:e.fontSizes.sm,height:e.fontSizes.sm,lineHeight:e.fontSizes.sm,display:"flex",alignItems:"center",whiteSpace:"nowrap"})),N=d("span",{target:"e16xj5sw14"})({}),we=e=>({[V]:{display:"flex",flexDirection:"column",alignItems:"flex-start"},[P]:{marginBottom:e.spacing.lg},[L]:{display:"none"},[j]:{paddingRight:e.spacing.lg},[k]:{maxWidth:"inherit",flex:1,alignItems:"flex-start",marginBottom:e.spacing.sm},[W]:{width:e.sizes.full},[A]:{flexDirection:"column"},[H]:{height:"auto",whiteSpace:"initial"},[N]:{display:"none"},[E]:{margin:e.spacing.none,padding:e.spacing.none}}),Ue=d("div",{target:"e16xj5sw15"})(({theme:e,width:s})=>{if(s<X("23rem"))return we(e)});var v;(function(e){e.DANGER="danger"})(v||(v={}));const U=d("small",{target:"ejh2rmr0"})(({kind:e,theme:s})=>{const{danger:t,fadedText60:i}=s.colors;return{color:e==="danger"?t:i,fontSize:s.fontSizes.sm,lineHeight:s.lineHeights.tight}}),Ie=({multiple:e,acceptedExtensions:s,maxSizeBytes:t})=>g(P,{"data-testid":"stFileUploaderDropzoneInstructions",children:[a(L,{children:a(m,{content:B,size:"threeXL"})}),g(Fe,{children:[g(fe,{children:["Drag and drop file",e?"s":""," here"]}),g(U,{children:[`Limit ${M(t,y.Byte,0)} per file`,s.length?` • ${s.map(i=>i.replace(/^\./,"").toUpperCase()).join(", ")}`:null]})]})]}),ve=c.memo(Ie),ze=({onDrop:e,multiple:s,acceptedExtensions:t,maxSizeBytes:i,disabled:l,label:o})=>a(re,{onDrop:e,multiple:s,accept:oe(t),maxSize:i,disabled:l,useFsAccessApi:!1,children:({getRootProps:n,getInputProps:r})=>g(V,{...n(),"data-testid":"stFileUploaderDropzone",isDisabled:l,"aria-label":o,children:[a("input",{"data-testid":"stFileUploaderDropzoneInput",...r()}),a(ve,{multiple:s,acceptedExtensions:t,maxSizeBytes:i}),a(F,{kind:S.SECONDARY,disabled:l,size:O.SMALL,children:"Browse files"})]})}),Ce=c.memo(ze),be=d("div",{target:"egc9vxm0"})(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:e.spacing.twoXS,marginBottom:e.spacing.twoXS})),Me=d("div",{target:"egc9vxm1"})(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",color:e.colors.fadedText40})),Be=({currentPage:e,totalPages:s,onNext:t,onPrevious:i})=>g(be,{"data-testid":"stFileUploaderPagination",children:[a(U,{children:`Showing page ${e} of ${s}`}),g(Me,{children:[a(F,{onClick:i,kind:S.MINIMAL,children:a(m,{content:_,size:"xl"})}),a(F,{onClick:t,kind:S.MINIMAL,children:a(m,{content:q,size:"xl"})})]})]}),De=c.memo(Be),z=(e,s)=>Math.ceil(e.length/s),Ve=e=>G(({pageSize:t,items:i,resetOnAdd:l,...o})=>{const[n,r]=c.useState(0),[p,x]=c.useState(()=>z(i,t)),u=me(i);c.useEffect(()=>{u&&u.length!==i.length&&x(z(i,t)),u&&u.length<i.length?l&&r(0):n+1>=p&&r(p-1)},[i,n,t,u,l,p]);const T=()=>{r(Math.min(n+1,p-1))},R=()=>{r(Math.max(0,n-1))},$=i.slice(n*t,n*t+t);return g(K,{children:[a(e,{items:$,...o}),i.length>t?a(De,{pageSize:t,totalPages:p,currentPage:n+1,onNext:T,onPrevious:R}):null]})},e),Pe=({fileInfo:e})=>e.status.type==="uploading"?a(he,{value:e.status.progress,size:ue.SMALL}):e.status.type==="error"?g(H,{children:[a(ye,{"data-testid":"stFileUploaderFileErrorMessage",children:e.status.errorMessage}),a(N,{children:a(m,{content:D,size:"lg"})})]}):e.status.type==="uploaded"?a(U,{children:M(e.size,y.Byte)}):null,Le=({fileInfo:e,onDelete:s})=>g(k,{className:"stFileUploaderFile","data-testid":"stFileUploaderFile",children:[a(xe,{children:a(m,{content:de,size:"twoXL"})}),g(A,{className:"stFileUploaderFileData",children:[a(W,{className:"stFileUploaderFileName","data-testid":"stFileUploaderFileName",title:e.name,children:e.name}),a(Pe,{fileInfo:e})]}),a("div",{"data-testid":"stFileUploaderDeleteBtn",children:a(F,{onClick:()=>s(e.id),kind:S.MINIMAL,children:a(m,{content:ce,size:"lg"})})})]}),je=c.memo(Le),Ee=({items:e,onDelete:s})=>a(Se,{children:e.map(t=>a(E,{children:a(je,{fileInfo:t,onDelete:s})},t.id))}),Ae=Ve(Ee),We=e=>a(j,{children:a(Ae,{...e})}),ke=c.memo(We);class He extends c.PureComponent{constructor(s){super(s),this.formClearHelper=new ae,this.localFileIdCounter=1,this.forceUpdatingStatus=!1,this.componentDidUpdate=()=>{if(this.status!=="ready")return;const t=this.createWidgetValue(),{element:i,widgetMgr:l,fragmentId:o}=this.props,n=l.getFileUploaderStateValue(i);J(t,n)||l.setFileUploaderStateValue(i,t,{fromUi:!0},o)},this.dropHandler=(t,i)=>{const{element:l}=this.props,{multipleFiles:o}=l;if(!o&&t.length===0&&i.length>1){const n=i.findIndex(r=>r.errors.length===1&&r.errors[0].code==="too-many-files");n>=0&&(t.push(i[n].file),i.splice(n,1))}if(this.props.uploadClient.fetchFileURLs(t).then(n=>{if(!o&&t.length>0){const r=this.state.files.find(p=>p.status.type!=="error");r&&(this.forceUpdatingStatus=!0,this.deleteFile(r.id),this.forceUpdatingStatus=!1)}Q(n,t).forEach(([r,p])=>{this.uploadFile(r,p)})}).catch(n=>{this.addFiles(t.map(r=>new w(r.name,r.size,this.nextLocalFileId(),{type:"error",errorMessage:n})))}),i.length>0){const n=i.map(r=>pe(r,this.nextLocalFileId(),this.maxUploadSizeInBytes));this.addFiles(n)}},this.uploadFile=(t,i)=>{const l=I.CancelToken.source(),o=new w(i.name,i.size,this.nextLocalFileId(),{type:"uploading",cancelToken:l,progress:1});this.addFile(o),this.props.uploadClient.uploadFile(this.props.element,t.uploadUrl,i,n=>this.onUploadProgress(n,o.id),l.token).then(()=>this.onUploadComplete(o.id,t)).catch(n=>{I.isCancel(n)||this.updateFile(o.id,o.setStatus({type:"error",errorMessage:n?n.toString():"Unknown error"}))})},this.onUploadComplete=(t,i)=>{const l=this.getFile(t);h(l)||l.status.type!=="uploading"||this.updateFile(l.id,l.setStatus({type:"uploaded",fileId:i.fileId,fileUrls:i}))},this.deleteFile=t=>{const i=this.getFile(t);h(i)||(i.status.type==="uploading"&&i.status.cancelToken.cancel(),i.status.type==="uploaded"&&i.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(i.status.fileUrls.deleteUrl),this.removeFile(t))},this.addFile=t=>{f.flushSync(()=>{this.setState(i=>({files:[...i.files,t]}))})},this.addFiles=t=>{f.flushSync(()=>{this.setState(i=>({files:[...i.files,...t]}))})},this.removeFile=t=>{f.flushSync(()=>{this.setState(i=>({files:i.files.filter(l=>l.id!==t)}))})},this.getFile=t=>this.state.files.find(i=>i.id===t),this.updateFile=(t,i)=>{f.flushSync(()=>{this.setState(l=>({files:l.files.map(o=>o.id===t?i:o)}))})},this.onUploadProgress=(t,i)=>{const l=this.getFile(i);if(h(l)||l.status.type!=="uploading")return;const o=Math.round(t.loaded*100/t.total);l.status.progress!==o&&this.updateFile(i,l.setStatus({type:"uploading",cancelToken:l.status.cancelToken,progress:o}))},this.onFormCleared=()=>{f.flushSync(()=>{this.setState({files:[]},()=>{const t=this.createWidgetValue();if(h(t))return;const{widgetMgr:i,element:l,fragmentId:o}=this.props;i.setFileUploaderStateValue(l,t,{fromUi:!0},o)})})},this.state=this.initialValue}get initialValue(){const s={files:[]},{widgetMgr:t,element:i}=this.props,l=t.getFileUploaderStateValue(i);if(h(l))return s;const{uploadedFileInfo:o}=l;return h(o)||o.length===0?s:{files:o.map(n=>{const r=n.name,p=n.size,x=n.fileId,u=n.fileUrls;return new w(r,p,this.nextLocalFileId(),{type:"uploaded",fileId:x,fileUrls:u})})}}componentWillUnmount(){this.formClearHelper.disconnect()}get maxUploadSizeInBytes(){const s=this.props.element.maxUploadSizeMb;return ge(s,y.Megabyte,y.Byte)}get status(){const s=t=>t.status.type==="uploading";return this.state.files.some(s)||this.forceUpdatingStatus?"updating":"ready"}componentDidMount(){const s=this.createWidgetValue(),{element:t,widgetMgr:i,fragmentId:l}=this.props;i.getFileUploaderStateValue(t)===void 0&&i.setFileUploaderStateValue(t,s,{fromUi:!1},l)}createWidgetValue(){const s=this.state.files.filter(t=>t.status.type==="uploaded").map(t=>{const{name:i,size:l,status:o}=t,{fileId:n,fileUrls:r}=o;return new Z({fileId:n,fileUrls:r,name:i,size:l})});return new ee({uploadedFileInfo:s})}render(){var p;const{files:s}=this.state,{element:t,disabled:i,widgetMgr:l,width:o}=this.props,n=t.type;this.formClearHelper.manageFormClearListener(l,t.formId,this.onFormCleared);const r=s.slice().reverse();return g(Ue,{className:"stFileUploader","data-testid":"stFileUploader",width:o,children:[a(ne,{label:t.label,disabled:i,labelVisibility:te((p=t.labelVisibility)==null?void 0:p.value),children:t.help&&a(ie,{children:a(se,{content:t.help,placement:le.TOP_RIGHT})})}),a(Ce,{onDrop:this.dropHandler,multiple:t.multipleFiles,acceptedExtensions:n,maxSizeBytes:this.maxUploadSizeInBytes,label:t.label,disabled:i}),r.length>0&&a(ke,{items:r,pageSize:3,onDelete:this.deleteFile,resetOnAdd:!0})]})}nextLocalFileId(){return this.localFileIdCounter++}}const _e=Y(c.memo(He));export{_e as default};
1
+ import{r as c,E as C,_ as b,n as d,H as X,C as g,j as a,bl as m,bm as F,a$ as O,b0 as S,cn as _,co as q,be as G,F as K,bB as Y,aA as J,bg as Q,M as h,b as f,bi as Z,bh as ee,bo as te,bC as ie,bp as se,b5 as le,bq as ne}from"./index.C1TEsRV0.js";import{U as w,a as I}from"./UploadFileInfo.0DCkpDDf.js";import{F as ae}from"./FormClearHelper.CHPGUkGG.js";import{g as M,F as y,b as oe,D as re,I as de,C as ce,a as pe,s as ge}from"./FileHelper.BWWhRdUs.js";import{S as ue,P as he}from"./ProgressBar.DFiqS51i.js";import{u as me}from"./Hooks.DjxyUmgD.js";var B=c.forwardRef(function(e,s){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return c.createElement(C,b({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:s}),c.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),c.createElement("path",{d:"M19.35 10.04A7.49 7.49 0 0012 4C9.11 4 6.6 5.64 5.35 8.04A5.994 5.994 0 000 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM19 18H6c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97l1.07-.11.5-.95A5.469 5.469 0 0112 6c2.62 0 4.88 1.86 5.39 4.43l.3 1.5 1.53.11A2.98 2.98 0 0122 15c0 1.65-1.35 3-3 3zM8 13h2.55v3h2.9v-3H16l-4-4z"}))});B.displayName="CloudUpload";var D=c.forwardRef(function(e,s){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return c.createElement(C,b({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:s}),c.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}))});D.displayName="Error";const V=d("section",{target:"e16xj5sw0"})(({isDisabled:e,theme:s})=>({display:"flex",alignItems:"center",padding:s.spacing.lg,backgroundColor:s.colors.secondaryBg,borderRadius:s.radii.default,border:s.colors.widgetBorderColor?`${s.sizes.borderWidth} solid ${s.colors.widgetBorderColor}`:void 0,":focus":{outline:"none"},":focus-visible":{boxShadow:`0 0 0 1px ${s.colors.primary}`},color:e?s.colors.gray:s.colors.bodyText})),P=d("div",{target:"e16xj5sw1"})({marginRight:"auto",alignItems:"center",display:"flex"}),L=d("span",{target:"e16xj5sw2"})(({theme:e})=>({color:e.colors.darkenedBgMix100,marginRight:e.spacing.lg})),fe=d("span",{target:"e16xj5sw3"})(({theme:e})=>({marginBottom:e.spacing.twoXS})),Fe=d("div",{target:"e16xj5sw4"})({display:"flex",flexDirection:"column"}),j=d("div",{target:"e16xj5sw5"})(({theme:e})=>({left:0,right:0,lineHeight:e.lineHeights.tight,paddingTop:e.spacing.md,paddingLeft:e.spacing.lg,paddingRight:e.spacing.lg})),Se=d("ul",{target:"e16xj5sw6"})(({theme:e})=>({listStyleType:"none",margin:e.spacing.none,padding:e.spacing.none})),E=d("li",{target:"e16xj5sw7"})(({theme:e})=>({margin:e.spacing.none,padding:e.spacing.none})),A=d("div",{target:"e16xj5sw8"})(({theme:e})=>({display:"flex",alignItems:"baseline",flex:1,paddingLeft:e.spacing.lg,overflow:"hidden"})),W=d("div",{target:"e16xj5sw9"})(({theme:e})=>({marginRight:e.spacing.sm,marginBottom:e.spacing.twoXS,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})),k=d("div",{target:"e16xj5sw10"})(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing.twoXS})),ye=d("span",{target:"e16xj5sw11"})(({theme:e})=>({marginRight:e.spacing.twoXS})),xe=d("div",{target:"e16xj5sw12"})(({theme:e})=>({display:"flex",padding:e.spacing.twoXS,color:e.colors.darkenedBgMix100})),H=d("small",{target:"e16xj5sw13"})(({theme:e})=>({color:e.colors.red,fontSize:e.fontSizes.sm,height:e.fontSizes.sm,lineHeight:e.fontSizes.sm,display:"flex",alignItems:"center",whiteSpace:"nowrap"})),N=d("span",{target:"e16xj5sw14"})({}),we=e=>({[V]:{display:"flex",flexDirection:"column",alignItems:"flex-start"},[P]:{marginBottom:e.spacing.lg},[L]:{display:"none"},[j]:{paddingRight:e.spacing.lg},[k]:{maxWidth:"inherit",flex:1,alignItems:"flex-start",marginBottom:e.spacing.sm},[W]:{width:e.sizes.full},[A]:{flexDirection:"column"},[H]:{height:"auto",whiteSpace:"initial"},[N]:{display:"none"},[E]:{margin:e.spacing.none,padding:e.spacing.none}}),Ue=d("div",{target:"e16xj5sw15"})(({theme:e,width:s})=>{if(s<X("23rem"))return we(e)});var v;(function(e){e.DANGER="danger"})(v||(v={}));const U=d("small",{target:"ejh2rmr0"})(({kind:e,theme:s})=>{const{danger:t,fadedText60:i}=s.colors;return{color:e==="danger"?t:i,fontSize:s.fontSizes.sm,lineHeight:s.lineHeights.tight}}),Ie=({multiple:e,acceptedExtensions:s,maxSizeBytes:t})=>g(P,{"data-testid":"stFileUploaderDropzoneInstructions",children:[a(L,{children:a(m,{content:B,size:"threeXL"})}),g(Fe,{children:[g(fe,{children:["Drag and drop file",e?"s":""," here"]}),g(U,{children:[`Limit ${M(t,y.Byte,0)} per file`,s.length?` • ${s.map(i=>i.replace(/^\./,"").toUpperCase()).join(", ")}`:null]})]})]}),ve=c.memo(Ie),ze=({onDrop:e,multiple:s,acceptedExtensions:t,maxSizeBytes:i,disabled:l,label:o})=>a(re,{onDrop:e,multiple:s,accept:oe(t),maxSize:i,disabled:l,useFsAccessApi:!1,children:({getRootProps:n,getInputProps:r})=>g(V,{...n(),"data-testid":"stFileUploaderDropzone",isDisabled:l,"aria-label":o,children:[a("input",{"data-testid":"stFileUploaderDropzoneInput",...r()}),a(ve,{multiple:s,acceptedExtensions:t,maxSizeBytes:i}),a(F,{kind:S.SECONDARY,disabled:l,size:O.SMALL,children:"Browse files"})]})}),Ce=c.memo(ze),be=d("div",{target:"egc9vxm0"})(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:e.spacing.twoXS,marginBottom:e.spacing.twoXS})),Me=d("div",{target:"egc9vxm1"})(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",color:e.colors.fadedText40})),Be=({currentPage:e,totalPages:s,onNext:t,onPrevious:i})=>g(be,{"data-testid":"stFileUploaderPagination",children:[a(U,{children:`Showing page ${e} of ${s}`}),g(Me,{children:[a(F,{onClick:i,kind:S.MINIMAL,children:a(m,{content:_,size:"xl"})}),a(F,{onClick:t,kind:S.MINIMAL,children:a(m,{content:q,size:"xl"})})]})]}),De=c.memo(Be),z=(e,s)=>Math.ceil(e.length/s),Ve=e=>G(({pageSize:t,items:i,resetOnAdd:l,...o})=>{const[n,r]=c.useState(0),[p,x]=c.useState(()=>z(i,t)),u=me(i);c.useEffect(()=>{u&&u.length!==i.length&&x(z(i,t)),u&&u.length<i.length?l&&r(0):n+1>=p&&r(p-1)},[i,n,t,u,l,p]);const T=()=>{r(Math.min(n+1,p-1))},R=()=>{r(Math.max(0,n-1))},$=i.slice(n*t,n*t+t);return g(K,{children:[a(e,{items:$,...o}),i.length>t?a(De,{pageSize:t,totalPages:p,currentPage:n+1,onNext:T,onPrevious:R}):null]})},e),Pe=({fileInfo:e})=>e.status.type==="uploading"?a(he,{value:e.status.progress,size:ue.SMALL}):e.status.type==="error"?g(H,{children:[a(ye,{"data-testid":"stFileUploaderFileErrorMessage",children:e.status.errorMessage}),a(N,{children:a(m,{content:D,size:"lg"})})]}):e.status.type==="uploaded"?a(U,{children:M(e.size,y.Byte)}):null,Le=({fileInfo:e,onDelete:s})=>g(k,{className:"stFileUploaderFile","data-testid":"stFileUploaderFile",children:[a(xe,{children:a(m,{content:de,size:"twoXL"})}),g(A,{className:"stFileUploaderFileData",children:[a(W,{className:"stFileUploaderFileName","data-testid":"stFileUploaderFileName",title:e.name,children:e.name}),a(Pe,{fileInfo:e})]}),a("div",{"data-testid":"stFileUploaderDeleteBtn",children:a(F,{onClick:()=>s(e.id),kind:S.MINIMAL,children:a(m,{content:ce,size:"lg"})})})]}),je=c.memo(Le),Ee=({items:e,onDelete:s})=>a(Se,{children:e.map(t=>a(E,{children:a(je,{fileInfo:t,onDelete:s})},t.id))}),Ae=Ve(Ee),We=e=>a(j,{children:a(Ae,{...e})}),ke=c.memo(We);class He extends c.PureComponent{constructor(s){super(s),this.formClearHelper=new ae,this.localFileIdCounter=1,this.forceUpdatingStatus=!1,this.componentDidUpdate=()=>{if(this.status!=="ready")return;const t=this.createWidgetValue(),{element:i,widgetMgr:l,fragmentId:o}=this.props,n=l.getFileUploaderStateValue(i);J(t,n)||l.setFileUploaderStateValue(i,t,{fromUi:!0},o)},this.dropHandler=(t,i)=>{const{element:l}=this.props,{multipleFiles:o}=l;if(!o&&t.length===0&&i.length>1){const n=i.findIndex(r=>r.errors.length===1&&r.errors[0].code==="too-many-files");n>=0&&(t.push(i[n].file),i.splice(n,1))}if(this.props.uploadClient.fetchFileURLs(t).then(n=>{if(!o&&t.length>0){const r=this.state.files.find(p=>p.status.type!=="error");r&&(this.forceUpdatingStatus=!0,this.deleteFile(r.id),this.forceUpdatingStatus=!1)}Q(n,t).forEach(([r,p])=>{this.uploadFile(r,p)})}).catch(n=>{this.addFiles(t.map(r=>new w(r.name,r.size,this.nextLocalFileId(),{type:"error",errorMessage:n})))}),i.length>0){const n=i.map(r=>pe(r,this.nextLocalFileId(),this.maxUploadSizeInBytes));this.addFiles(n)}},this.uploadFile=(t,i)=>{const l=I.CancelToken.source(),o=new w(i.name,i.size,this.nextLocalFileId(),{type:"uploading",cancelToken:l,progress:1});this.addFile(o),this.props.uploadClient.uploadFile(this.props.element,t.uploadUrl,i,n=>this.onUploadProgress(n,o.id),l.token).then(()=>this.onUploadComplete(o.id,t)).catch(n=>{I.isCancel(n)||this.updateFile(o.id,o.setStatus({type:"error",errorMessage:n?n.toString():"Unknown error"}))})},this.onUploadComplete=(t,i)=>{const l=this.getFile(t);h(l)||l.status.type!=="uploading"||this.updateFile(l.id,l.setStatus({type:"uploaded",fileId:i.fileId,fileUrls:i}))},this.deleteFile=t=>{const i=this.getFile(t);h(i)||(i.status.type==="uploading"&&i.status.cancelToken.cancel(),i.status.type==="uploaded"&&i.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(i.status.fileUrls.deleteUrl),this.removeFile(t))},this.addFile=t=>{f.flushSync(()=>{this.setState(i=>({files:[...i.files,t]}))})},this.addFiles=t=>{f.flushSync(()=>{this.setState(i=>({files:[...i.files,...t]}))})},this.removeFile=t=>{f.flushSync(()=>{this.setState(i=>({files:i.files.filter(l=>l.id!==t)}))})},this.getFile=t=>this.state.files.find(i=>i.id===t),this.updateFile=(t,i)=>{f.flushSync(()=>{this.setState(l=>({files:l.files.map(o=>o.id===t?i:o)}))})},this.onUploadProgress=(t,i)=>{const l=this.getFile(i);if(h(l)||l.status.type!=="uploading")return;const o=Math.round(t.loaded*100/t.total);l.status.progress!==o&&this.updateFile(i,l.setStatus({type:"uploading",cancelToken:l.status.cancelToken,progress:o}))},this.onFormCleared=()=>{f.flushSync(()=>{this.setState({files:[]},()=>{const t=this.createWidgetValue();if(h(t))return;const{widgetMgr:i,element:l,fragmentId:o}=this.props;i.setFileUploaderStateValue(l,t,{fromUi:!0},o)})})},this.state=this.initialValue}get initialValue(){const s={files:[]},{widgetMgr:t,element:i}=this.props,l=t.getFileUploaderStateValue(i);if(h(l))return s;const{uploadedFileInfo:o}=l;return h(o)||o.length===0?s:{files:o.map(n=>{const r=n.name,p=n.size,x=n.fileId,u=n.fileUrls;return new w(r,p,this.nextLocalFileId(),{type:"uploaded",fileId:x,fileUrls:u})})}}componentWillUnmount(){this.formClearHelper.disconnect()}get maxUploadSizeInBytes(){const s=this.props.element.maxUploadSizeMb;return ge(s,y.Megabyte,y.Byte)}get status(){const s=t=>t.status.type==="uploading";return this.state.files.some(s)||this.forceUpdatingStatus?"updating":"ready"}componentDidMount(){const s=this.createWidgetValue(),{element:t,widgetMgr:i,fragmentId:l}=this.props;i.getFileUploaderStateValue(t)===void 0&&i.setFileUploaderStateValue(t,s,{fromUi:!1},l)}createWidgetValue(){const s=this.state.files.filter(t=>t.status.type==="uploaded").map(t=>{const{name:i,size:l,status:o}=t,{fileId:n,fileUrls:r}=o;return new Z({fileId:n,fileUrls:r,name:i,size:l})});return new ee({uploadedFileInfo:s})}render(){var p;const{files:s}=this.state,{element:t,disabled:i,widgetMgr:l,width:o}=this.props,n=t.type;this.formClearHelper.manageFormClearListener(l,t.formId,this.onFormCleared);const r=s.slice().reverse();return g(Ue,{className:"stFileUploader","data-testid":"stFileUploader",width:o,children:[a(ne,{label:t.label,disabled:i,labelVisibility:te((p=t.labelVisibility)==null?void 0:p.value),children:t.help&&a(ie,{children:a(se,{content:t.help,placement:le.TOP_RIGHT})})}),a(Ce,{onDrop:this.dropHandler,multiple:t.multipleFiles,acceptedExtensions:n,maxSizeBytes:this.maxUploadSizeInBytes,label:t.label,disabled:i}),r.length>0&&a(ke,{items:r,pageSize:3,onDelete:this.deleteFile,resetOnAdd:!0})]})}nextLocalFileId(){return this.localFileIdCounter++}}const _e=Y(c.memo(He));export{_e as default};
@@ -1 +1 @@
1
- import{r as l,b0 as n,j as e,b1 as d,bm as u,a$ as c,b2 as B,b3 as m}from"./index.PoIwzrI7.js";function b(i){const{disabled:o,element:t,widgetMgr:s,fragmentId:r}=i;let a=n.SECONDARY;return t.type==="primary"?a=n.PRIMARY:t.type==="tertiary"&&(a=n.TERTIARY),e(m,{className:"stButton","data-testid":"stButton",children:e(d,{help:t.help,containerWidth:t.useContainerWidth,children:e(u,{kind:a,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(b);export{p as default};
1
+ import{r as l,b0 as n,j as e,b1 as d,bm as u,a$ as c,b2 as B,b3 as m}from"./index.C1TEsRV0.js";function b(i){const{disabled:o,element:t,widgetMgr:s,fragmentId:r}=i;let a=n.SECONDARY;return t.type==="primary"?a=n.PRIMARY:t.type==="tertiary"&&(a=n.TERTIARY),e(m,{className:"stButton","data-testid":"stButton",children:e(d,{help:t.help,containerWidth:t.useContainerWidth,children:e(u,{kind:a,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(b);export{p as default};
@@ -1 +1 @@
1
- import{r,aE as f,b0 as l,j as t,b1 as m,bm as B,a$ as b,b2 as p}from"./index.PoIwzrI7.js";import{c as h}from"./createDownloadLinkElement.DZMwyjvU.js";function w(n,o,e){return h({enforceDownloadInNewTab:e,url:n.buildMediaURL(o),filename:""})}function D(n){const{disabled:o,element:e,widgetMgr:s,endpoints:a,fragmentId:d}=n,{libConfig:{enforceDownloadInNewTab:c=!1}}=r.useContext(f);let i=l.SECONDARY;e.type==="primary"?i=l.PRIMARY:e.type==="tertiary"&&(i=l.TERTIARY),r.useEffect(()=>{a.checkSourceUrlResponse(e.url,"Download Button")},[e.url,a]);const u=()=>{e.ignoreRerun||s.setTriggerValue(e,{fromUi:!0},d),w(a,e.url,c).click()};return t("div",{className:"stDownloadButton","data-testid":"stDownloadButton",children:t(m,{help:e.help,containerWidth:e.useContainerWidth,children:t(B,{kind:i,size:b.SMALL,disabled:o,onClick:u,containerWidth:e.useContainerWidth,children:t(p,{icon:e.icon,label:e.label})})})})}const g=r.memo(D);export{g as default};
1
+ import{r,aE as f,b0 as l,j as t,b1 as m,bm as B,a$ as b,b2 as p}from"./index.C1TEsRV0.js";import{c as h}from"./createDownloadLinkElement.DZMwyjvU.js";function w(n,o,e){return h({enforceDownloadInNewTab:e,url:n.buildMediaURL(o),filename:""})}function D(n){const{disabled:o,element:e,widgetMgr:s,endpoints:a,fragmentId:d}=n,{libConfig:{enforceDownloadInNewTab:c=!1}}=r.useContext(f);let i=l.SECONDARY;e.type==="primary"?i=l.PRIMARY:e.type==="tertiary"&&(i=l.TERTIARY),r.useEffect(()=>{a.checkSourceUrlResponse(e.url,"Download Button")},[e.url,a]);const u=()=>{e.ignoreRerun||s.setTriggerValue(e,{fromUi:!0},d),w(a,e.url,c).click()};return t("div",{className:"stDownloadButton","data-testid":"stDownloadButton",children:t(m,{help:e.help,containerWidth:e.useContainerWidth,children:t(B,{kind:i,size:b.SMALL,disabled:o,onClick:u,containerWidth:e.useContainerWidth,children:t(p,{icon:e.icon,label:e.label})})})})}const g=r.memo(D);export{g as default};
@@ -1 +1 @@
1
- import{n as T,r,z as M,b_ as C,b$ as W,C as V,j as n,bo as I,bC as O,bp as $,b5 as L,bq as N,bZ as P,c0 as k,bV as E,c1 as A,bz as B}from"./index.PoIwzrI7.js";import{a as F}from"./useBasicWidgetState.DzE2MsN8.js";import"./FormClearHelper.Dd0v0IXt.js";const H=T("div",{target:"euzcfsp0"})(({theme:s})=>({"span[aria-disabled='true']":{background:s.colors.fadedText05}})),D=(s,t)=>s.getStringArrayValue(t),U=s=>s.default.map(t=>s.options[t])??null,j=s=>s.rawValues??null,G=(s,t,a,p)=>{t.setStringArrayValue(s,a.value,{fromUi:a.fromUi},p)},K=s=>{var S;const{element:t,widgetMgr:a,fragmentId:p}=s,e=M(),[i,m]=F({getStateFromWidgetMgr:D,getDefaultStateFromProto:U,getCurrStateFromProto:j,updateWidgetMgrState:G,element:t,widgetMgr:a,fragmentId:p}),h=t.maxSelections>0&&i.length>=t.maxSelections,f=r.useMemo(()=>{if(t.maxSelections===0)return"No results";if(i.length===t.maxSelections){const o=t.maxSelections!==1?"options":"option";return`You can only select up to ${t.maxSelections} ${o}. Remove an option first.`}return"No results"},[t.maxSelections,i.length]),y=r.useMemo(()=>i.map(o=>({value:o,label:o})),[i]),b=r.useCallback(o=>{var l,d;switch(o.type){case"remove":return C(i,(l=o.option)==null?void 0:l.value);case"clear":return[];case"select":return i.concat([(d=o.option)==null?void 0:d.value]);default:throw new Error(`State transition is unknown: ${o.type}`)}},[i]),v=r.useCallback(o=>{t.maxSelections&&o.type==="select"&&i.length>=t.maxSelections||m({value:b(o),fromUi:!0})},[t.maxSelections,b,m,i.length]),x=r.useCallback((o,l)=>{if(h)return[];const d=o.filter(R=>!i.includes(R.value));return W(d,l)},[h,i]),{options:u}=t;let c=s.disabled,g=t.placeholder;u.length===0&&(t.acceptNewOptions?g="Add options":(g="No options to select",c=!0));const z=u.map((o,l)=>({label:o,value:o,id:`${o}_${l}`})),w=u.length>10;return V("div",{className:"stMultiSelect","data-testid":"stMultiSelect",children:[n(N,{label:t.label,disabled:c,labelVisibility:I((S=t.labelVisibility)==null?void 0:S.value),children:t.help&&n(O,{children:n($,{content:t.help,placement:L.TOP_RIGHT})})}),n(H,{children:n(P,{creatable:t.acceptNewOptions??!1,options:z,labelKey:"label",valueKey:"value","aria-label":t.label,placeholder:g,type:A.select,multi:!0,onChange:v,value:y,disabled:c,size:"compact",noResultsMsg:f,filterOptions:x,closeOnSelect:!1,ignoreCase:!1,overrides:{Popover:{props:{overrides:{Body:{style:()=>({marginTop:e.spacing.px})}}}},SelectArrow:{component:E,props:{overrides:{Svg:{style:()=>({width:e.iconSizes.xl,height:e.iconSizes.xl})}}}},IconsContainer:{style:()=>({paddingRight:e.spacing.sm})},ControlContainer:{style:{minHeight:e.sizes.minElementHeight,borderLeftWidth:e.sizes.borderWidth,borderRightWidth:e.sizes.borderWidth,borderTopWidth:e.sizes.borderWidth,borderBottomWidth:e.sizes.borderWidth}},Placeholder:{style:()=>({flex:"inherit",color:c?e.colors.fadedText40:e.colors.fadedText60})},ValueContainer:{style:()=>({paddingLeft:e.spacing.sm,paddingTop:e.spacing.none,paddingBottom:e.spacing.none,paddingRight:e.spacing.none})},ClearIcon:{props:{overrides:{Svg:{style:{color:e.colors.darkGray,padding:e.spacing.threeXS,height:e.sizes.clearIconSize,width:e.sizes.clearIconSize,cursor:"pointer",":hover":{fill:e.colors.bodyText}}}}}},SearchIcon:{style:{color:e.colors.darkGray}},Tag:{props:{overrides:{Root:{style:{borderTopLeftRadius:e.radii.md,borderTopRightRadius:e.radii.md,borderBottomRightRadius:e.radii.md,borderBottomLeftRadius:e.radii.md,fontSize:e.fontSizes.md,paddingLeft:e.spacing.sm,marginLeft:e.spacing.none,marginRight:e.spacing.sm,height:`calc(${e.sizes.minElementHeight} - 2 * ${e.spacing.xs})`,maxWidth:`calc(100% - ${e.spacing.lg})`,cursor:"default !important"}},Action:{style:{paddingLeft:0}},ActionIcon:{props:{overrides:{Svg:{style:{width:"0.625em",height:"0.625em"}}}}}}}},MultiValue:{props:{overrides:{Root:{style:{fontSize:e.fontSizes.sm}}}}},Input:{props:{readOnly:B.isMobile&&w===!1?"readonly":null}},Dropdown:{component:k}}})})]})},X=r.memo(K);export{X as default};
1
+ import{n as T,r,z as M,b_ as C,b$ as W,C as V,j as n,bo as I,bC as O,bp as $,b5 as L,bq as N,bZ as P,c0 as k,bV as E,c1 as A,bz as B}from"./index.C1TEsRV0.js";import{a as F}from"./useBasicWidgetState.DadZUraL.js";import"./FormClearHelper.CHPGUkGG.js";const H=T("div",{target:"euzcfsp0"})(({theme:s})=>({"span[aria-disabled='true']":{background:s.colors.fadedText05}})),D=(s,t)=>s.getStringArrayValue(t),U=s=>s.default.map(t=>s.options[t])??null,j=s=>s.rawValues??null,G=(s,t,a,p)=>{t.setStringArrayValue(s,a.value,{fromUi:a.fromUi},p)},K=s=>{var S;const{element:t,widgetMgr:a,fragmentId:p}=s,e=M(),[i,m]=F({getStateFromWidgetMgr:D,getDefaultStateFromProto:U,getCurrStateFromProto:j,updateWidgetMgrState:G,element:t,widgetMgr:a,fragmentId:p}),h=t.maxSelections>0&&i.length>=t.maxSelections,f=r.useMemo(()=>{if(t.maxSelections===0)return"No results";if(i.length===t.maxSelections){const o=t.maxSelections!==1?"options":"option";return`You can only select up to ${t.maxSelections} ${o}. Remove an option first.`}return"No results"},[t.maxSelections,i.length]),y=r.useMemo(()=>i.map(o=>({value:o,label:o})),[i]),b=r.useCallback(o=>{var l,d;switch(o.type){case"remove":return C(i,(l=o.option)==null?void 0:l.value);case"clear":return[];case"select":return i.concat([(d=o.option)==null?void 0:d.value]);default:throw new Error(`State transition is unknown: ${o.type}`)}},[i]),v=r.useCallback(o=>{t.maxSelections&&o.type==="select"&&i.length>=t.maxSelections||m({value:b(o),fromUi:!0})},[t.maxSelections,b,m,i.length]),x=r.useCallback((o,l)=>{if(h)return[];const d=o.filter(R=>!i.includes(R.value));return W(d,l)},[h,i]),{options:u}=t;let c=s.disabled,g=t.placeholder;u.length===0&&(t.acceptNewOptions?g="Add options":(g="No options to select",c=!0));const z=u.map((o,l)=>({label:o,value:o,id:`${o}_${l}`})),w=u.length>10;return V("div",{className:"stMultiSelect","data-testid":"stMultiSelect",children:[n(N,{label:t.label,disabled:c,labelVisibility:I((S=t.labelVisibility)==null?void 0:S.value),children:t.help&&n(O,{children:n($,{content:t.help,placement:L.TOP_RIGHT})})}),n(H,{children:n(P,{creatable:t.acceptNewOptions??!1,options:z,labelKey:"label",valueKey:"value","aria-label":t.label,placeholder:g,type:A.select,multi:!0,onChange:v,value:y,disabled:c,size:"compact",noResultsMsg:f,filterOptions:x,closeOnSelect:!1,ignoreCase:!1,overrides:{Popover:{props:{overrides:{Body:{style:()=>({marginTop:e.spacing.px})}}}},SelectArrow:{component:E,props:{overrides:{Svg:{style:()=>({width:e.iconSizes.xl,height:e.iconSizes.xl})}}}},IconsContainer:{style:()=>({paddingRight:e.spacing.sm})},ControlContainer:{style:{minHeight:e.sizes.minElementHeight,borderLeftWidth:e.sizes.borderWidth,borderRightWidth:e.sizes.borderWidth,borderTopWidth:e.sizes.borderWidth,borderBottomWidth:e.sizes.borderWidth}},Placeholder:{style:()=>({flex:"inherit",color:c?e.colors.fadedText40:e.colors.fadedText60})},ValueContainer:{style:()=>({paddingLeft:e.spacing.sm,paddingTop:e.spacing.none,paddingBottom:e.spacing.none,paddingRight:e.spacing.none})},ClearIcon:{props:{overrides:{Svg:{style:{color:e.colors.darkGray,padding:e.spacing.threeXS,height:e.sizes.clearIconSize,width:e.sizes.clearIconSize,cursor:"pointer",":hover":{fill:e.colors.bodyText}}}}}},SearchIcon:{style:{color:e.colors.darkGray}},Tag:{props:{overrides:{Root:{style:{borderTopLeftRadius:e.radii.md,borderTopRightRadius:e.radii.md,borderBottomRightRadius:e.radii.md,borderBottomLeftRadius:e.radii.md,fontSize:e.fontSizes.md,paddingLeft:e.spacing.sm,marginLeft:e.spacing.none,marginRight:e.spacing.sm,height:`calc(${e.sizes.minElementHeight} - 2 * ${e.spacing.xs})`,maxWidth:`calc(100% - ${e.spacing.lg})`,cursor:"default !important"}},Action:{style:{paddingLeft:0}},ActionIcon:{props:{overrides:{Svg:{style:{width:"0.625em",height:"0.625em"}}}}}}}},MultiValue:{props:{overrides:{Root:{style:{fontSize:e.fontSizes.sm}}}}},Input:{props:{readOnly:B.isMobile&&w===!1?"readonly":null}},Dropdown:{component:k}}})})]})},X=r.memo(K);export{X as default};